mezh-hq / react-seat-toolkit Goto Github PK
View Code? Open in Web Editor NEWReact UI library to design and render seat layouts
Home Page: https://www.npmjs.com/package/@mezh-hq/react-seat-toolkit
License: MIT License
React UI library to design and render seat layouts
Home Page: https://www.npmjs.com/package/@mezh-hq/react-seat-toolkit
License: MIT License
Description:
I am trying to use the react-seat-toolkit package in my Next.js application, but I am encountering the following error:
SyntaxError: Cannot use import statement outside a module
at internalCompileFunction (node:internal/vm:73:18)
at wrapSafe (node:internal/modules/cjs/loader:1274:20)
at Module._compile (node:internal/modules/cjs/loader:1320:27)
at Module._extensions..js (node:internal/modules/cjs/loader:1414:10)
at Module.load (node:internal/modules/cjs/loader:1197:32)
at Module._load (node:internal/modules/cjs/loader:1013:12)
at Module.require (node:internal/modules/cjs/loader:1225:19)
at mod.require (D:\ReactApp\myproject\node_modules\next\dist\server\require-hook.js:65:28)
at require (node:internal/modules/helpers:177:18)
at @mezh-hq/react-seat-toolkit (D:\ReactApp\myproject.next\server\pages[locale]\events[eventId]\seat.js:1747:18)
at webpack_require (D:\ReactApp\myproject.next\server\webpack-runtime.js:33:42)
at eval (webpack-internal:///./screens/screen-event-seat.tsx:13:85)
at webpack_require.a (D:\ReactApp\myproject.next\server\webpack-runtime.js:97:13)
at eval (webpack-internal:///./screens/screen-event-seat.tsx:1:21)
at ./screens/screen-event-seat.tsx (D:\ReactApp\myproject.next\server\pages[locale]\events[eventId]\seat.js:1617:1) {
page: '/en/events/EVENT-789833323/seat'
}
Steps to reproduce the behavior:
Expected Behavior:
The SeatPicker component should be imported and rendered without any issues.
Actual Behavior:
The application fails to compile and throws an error:
Code:
import SeatToolkit, { SeatStatus } from "@mezh-hq/react-seat-toolkit";
import "@mezh-hq/react-seat-toolkit/styles";
import {
IPopulatedSeat,
ISTKData,
SeatSelectionMode,
} from "@mezh-hq/react-seat-toolkit/types";
const data = {
seats: [
{
id: "1",
x: 0,
y: 0,
label: "A1",
status: SeatStatus.Available,
},
{
id: "2",
x: 35,
y: 0,
label: "A2",
status: SeatStatus.Available,
},
],
} satisfies ISTKData;
const ScreenEventSeat = () => {
const onSeatClick = (seat: IPopulatedSeat) => {
console.log(seat);
};
return (
<section className="flex justify-between gap-8">
<SeatToolkit
mode="user"
styles={{
root: {
className: "bg-gray-100 p-4 flex-1 w-full rounded-md",
},
}}
data={data}
events={{
onSeatClick: onSeatClick,
}}
/>
</section>
);
};
export default ScreenEventSeat;
Environment:
Additional Context:
While Installing package:
If i try to add using
npm i -g @mezh-hq/react-seat-toolkit
it fails saying it cant find the module 'patch-package'. So i first add patch-package and then seat-toolkit it successfully added the package.
After encountering the error:
I tried clearing yarn, and npm cache and nodemodules, but nothing seems to work!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.