jett.admin.npmpackage 2.0.13 → 2.0.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.css +213 -0
- package/dist/index.js +508 -167
- package/dist/index.mjs +496 -155
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -63,6 +63,7 @@ var variantStyles = {
|
|
|
63
63
|
DANGER: "bg-[#ef4444] text-white dark:text-white"
|
|
64
64
|
};
|
|
65
65
|
var CustomButton = ({
|
|
66
|
+
id = "button",
|
|
66
67
|
variant = "DEFAULT",
|
|
67
68
|
children,
|
|
68
69
|
className,
|
|
@@ -78,9 +79,10 @@ var CustomButton = ({
|
|
|
78
79
|
variantStyles[variant],
|
|
79
80
|
className
|
|
80
81
|
),
|
|
81
|
-
onClick
|
|
82
|
+
onClick,
|
|
83
|
+
id: `${id}-div-1`
|
|
82
84
|
},
|
|
83
|
-
icon && /* @__PURE__ */ import_react.default.createElement("div",
|
|
85
|
+
icon && /* @__PURE__ */ import_react.default.createElement("div", { id: `${id}-div-2` }, icon),
|
|
84
86
|
children
|
|
85
87
|
);
|
|
86
88
|
};
|
|
@@ -89,6 +91,7 @@ var CustomButton = ({
|
|
|
89
91
|
var import_react2 = __toESM(require("react"));
|
|
90
92
|
var import_lucide_react = require("lucide-react");
|
|
91
93
|
var CustomAutocomplete = ({
|
|
94
|
+
id = "autocomplete",
|
|
92
95
|
label,
|
|
93
96
|
value,
|
|
94
97
|
onChange,
|
|
@@ -125,17 +128,19 @@ var CustomAutocomplete = ({
|
|
|
125
128
|
className: "flex flex-col w-full relative dark:bg-[#18181b] dark:text-white",
|
|
126
129
|
ref: wrapperRef,
|
|
127
130
|
tabIndex: disabled ? -1 : 0,
|
|
128
|
-
onBlur: handleBlur
|
|
131
|
+
onBlur: handleBlur,
|
|
132
|
+
id: `${id}-div-1`
|
|
129
133
|
},
|
|
130
|
-
heading && /* @__PURE__ */ import_react2.default.createElement("h3", { className: "text-lg font-semibold leading-6 mb-1" }, heading),
|
|
134
|
+
heading && /* @__PURE__ */ import_react2.default.createElement("h3", { className: "text-lg font-semibold leading-6 mb-1", id: `${id}-h3-1` }, heading),
|
|
131
135
|
label && /* @__PURE__ */ import_react2.default.createElement(
|
|
132
136
|
"label",
|
|
133
137
|
{
|
|
134
|
-
className: `font-[500] text-sm leading-5 mb-1 ${heading ? "text-[#737373]" : "text-black dark:text-white"}
|
|
138
|
+
className: `font-[500] text-sm leading-5 mb-1 ${heading ? "text-[#737373]" : "text-black dark:text-white"}`,
|
|
139
|
+
id: `${id}-label-1`
|
|
135
140
|
},
|
|
136
141
|
label,
|
|
137
142
|
" ",
|
|
138
|
-
isRequired && /* @__PURE__ */ import_react2.default.createElement("span", { className: "text-red-500" }, "*")
|
|
143
|
+
isRequired && /* @__PURE__ */ import_react2.default.createElement("span", { className: "text-red-500", id: `${id}-span-1` }, "*")
|
|
139
144
|
),
|
|
140
145
|
/* @__PURE__ */ import_react2.default.createElement(
|
|
141
146
|
"div",
|
|
@@ -146,13 +151,15 @@ var CustomAutocomplete = ({
|
|
|
146
151
|
className: `flex justify-between items-center flex-wrap gap-1 rounded-md px-3 py-2 text-sm transition border dark:border-[#303036] h-auto min-h-10 dark:bg-[#18181b] dark:text-white
|
|
147
152
|
${disabled ? "bg-gray-100 cursor-not-allowed text-gray-400" : "cursor-text"}
|
|
148
153
|
${error ? "border-red-500 bg-red-50" : "bg-white border-[hsl(0_0%_89.8%)] hover:border-gray-400 dark:bg-[#18181b] dark:text-white"}
|
|
149
|
-
|
|
154
|
+
`,
|
|
155
|
+
id: `${id}-div-2`
|
|
150
156
|
},
|
|
151
|
-
/* @__PURE__ */ import_react2.default.createElement("div", { className: "flex flex-wrap gap-1 flex-1" }, selectedOptions.length > 0 ? selectedOptions.map((opt) => /* @__PURE__ */ import_react2.default.createElement(
|
|
157
|
+
/* @__PURE__ */ import_react2.default.createElement("div", { className: "flex flex-wrap gap-1 flex-1", id: `${id}-div-3` }, selectedOptions.length > 0 ? selectedOptions.map((opt) => /* @__PURE__ */ import_react2.default.createElement(
|
|
152
158
|
"span",
|
|
153
159
|
{
|
|
154
160
|
key: opt.value,
|
|
155
|
-
className: "bg-[#F7FAFC] dark:bg-[#303036] border border-gray-300 px-2 dark:text-white py-0.5 rounded text-xs flex items-center gap-1"
|
|
161
|
+
className: "bg-[#F7FAFC] dark:bg-[#303036] border border-gray-300 px-2 dark:text-white py-0.5 rounded text-xs flex items-center gap-1",
|
|
162
|
+
id: `${id}-span-2`
|
|
156
163
|
},
|
|
157
164
|
opt.label,
|
|
158
165
|
/* @__PURE__ */ import_react2.default.createElement(
|
|
@@ -162,11 +169,12 @@ var CustomAutocomplete = ({
|
|
|
162
169
|
e.stopPropagation();
|
|
163
170
|
toggleValue(opt.value);
|
|
164
171
|
},
|
|
165
|
-
className: "text-gray-500 hover:text-gray-700 dark:text-white cursor-pointer dark:hover:text-white"
|
|
172
|
+
className: "text-gray-500 hover:text-gray-700 dark:text-white cursor-pointer dark:hover:text-white",
|
|
173
|
+
id: `${id}-button-1`
|
|
166
174
|
},
|
|
167
175
|
"\u2715"
|
|
168
176
|
)
|
|
169
|
-
)) : /* @__PURE__ */ import_react2.default.createElement("span", { className: "text-gray-400" }, placeholder)),
|
|
177
|
+
)) : /* @__PURE__ */ import_react2.default.createElement("span", { className: "text-gray-400", id: `${id}-span-3` }, placeholder)),
|
|
170
178
|
/* @__PURE__ */ import_react2.default.createElement(
|
|
171
179
|
import_lucide_react.ChevronDown,
|
|
172
180
|
{
|
|
@@ -174,55 +182,60 @@ var CustomAutocomplete = ({
|
|
|
174
182
|
}
|
|
175
183
|
)
|
|
176
184
|
),
|
|
177
|
-
!disabled && open && /* @__PURE__ */ import_react2.default.createElement("div", { className: "absolute top-full mt-1 w-full bg-white border border-gray-200 rounded-lg shadow-lg z-10 max-h-60 overflow-y-auto dark:bg-[#18181b] dark:text-white" }, /* @__PURE__ */ import_react2.default.createElement("div", { className: "flex items-center gap-2 p-2 border-b border-gray-200" }, /* @__PURE__ */ import_react2.default.createElement(import_lucide_react.Search, { size: 16, className: "text-gray-400" }), /* @__PURE__ */ import_react2.default.createElement(
|
|
185
|
+
!disabled && open && /* @__PURE__ */ import_react2.default.createElement("div", { className: "absolute top-full mt-1 w-full bg-white border border-gray-200 rounded-lg shadow-lg z-10 max-h-60 overflow-y-auto dark:bg-[#18181b] dark:text-white", id: `${id}-div-4` }, /* @__PURE__ */ import_react2.default.createElement("div", { className: "flex items-center gap-2 p-2 border-b border-gray-200", id: `${id}-div-5` }, /* @__PURE__ */ import_react2.default.createElement(import_lucide_react.Search, { size: 16, className: "text-gray-400" }), /* @__PURE__ */ import_react2.default.createElement(
|
|
178
186
|
"input",
|
|
179
187
|
{
|
|
180
188
|
type: "text",
|
|
181
189
|
value: search,
|
|
182
190
|
onChange: (e) => setSearch(e.target.value),
|
|
183
191
|
placeholder: "Search...",
|
|
184
|
-
className: "flex-1 text-sm focus:outline-none"
|
|
192
|
+
className: "flex-1 text-sm focus:outline-none",
|
|
193
|
+
id: `${id}-input-1`
|
|
185
194
|
}
|
|
186
|
-
)), /* @__PURE__ */ import_react2.default.createElement("ul",
|
|
195
|
+
)), /* @__PURE__ */ import_react2.default.createElement("ul", { id: `${id}-ul-1` }, filteredOptions.length > 0 ? filteredOptions.map((opt) => {
|
|
187
196
|
const selected = value.includes(opt.value);
|
|
188
197
|
return /* @__PURE__ */ import_react2.default.createElement(
|
|
189
198
|
"li",
|
|
190
199
|
{
|
|
191
200
|
key: opt.value,
|
|
192
201
|
onClick: () => toggleValue(opt.value),
|
|
193
|
-
className: `flex items-center gap-2 px-3 py-2 text-sm cursor-pointer hover:bg-[#F7FAFC] dark:hover:bg-[#303036] ${selected ? "bg-[#F7FAFC] dark:bg-[#303036] font-medium" : ""}
|
|
202
|
+
className: `flex items-center gap-2 px-3 py-2 text-sm cursor-pointer hover:bg-[#F7FAFC] dark:hover:bg-[#303036] ${selected ? "bg-[#F7FAFC] dark:bg-[#303036] font-medium" : ""}`,
|
|
203
|
+
id: `${id}-li-1`
|
|
194
204
|
},
|
|
195
205
|
/* @__PURE__ */ import_react2.default.createElement(
|
|
196
206
|
"span",
|
|
197
207
|
{
|
|
198
|
-
className: `w-4 h-4 flex items-center justify-center border rounded-sm ${selected ? "bg-blue-600 border-blue-600 text-white" : "border-gray-300"}
|
|
208
|
+
className: `w-4 h-4 flex items-center justify-center border rounded-sm ${selected ? "bg-blue-600 border-blue-600 text-white" : "border-gray-300"}`,
|
|
209
|
+
id: `${id}-span-4`
|
|
199
210
|
},
|
|
200
211
|
selected && /* @__PURE__ */ import_react2.default.createElement(import_lucide_react.Check, { size: 14 })
|
|
201
212
|
),
|
|
202
213
|
opt.label
|
|
203
214
|
);
|
|
204
|
-
}) : /* @__PURE__ */ import_react2.default.createElement("li", { className: "px-3 py-2 text-sm text-gray-400" }, "No results found")))
|
|
215
|
+
}) : /* @__PURE__ */ import_react2.default.createElement("li", { className: "px-3 py-2 text-sm text-gray-400", id: `${id}-li-2` }, "No results found")))
|
|
205
216
|
);
|
|
206
217
|
};
|
|
207
218
|
|
|
208
219
|
// src/inputs/Checkbox.jsx
|
|
209
220
|
var import_react3 = __toESM(require("react"));
|
|
210
|
-
var CustomCheckbox = ({ onChange, checked }) => {
|
|
221
|
+
var CustomCheckbox = ({ id = "checkbox", onChange, checked }) => {
|
|
211
222
|
const handleChange = (e) => {
|
|
212
223
|
onChange(e.target.checked);
|
|
213
224
|
};
|
|
214
|
-
return /* @__PURE__ */ import_react3.default.createElement("label", { className: "inline-flex items-center cursor-pointer select-none" }, /* @__PURE__ */ import_react3.default.createElement(
|
|
225
|
+
return /* @__PURE__ */ import_react3.default.createElement("label", { className: "inline-flex items-center cursor-pointer select-none", id: `${id}-label-1` }, /* @__PURE__ */ import_react3.default.createElement(
|
|
215
226
|
"input",
|
|
216
227
|
{
|
|
217
228
|
type: "checkbox",
|
|
218
229
|
checked,
|
|
219
230
|
onChange: handleChange,
|
|
220
|
-
className: "peer hidden"
|
|
231
|
+
className: "peer hidden",
|
|
232
|
+
id: `${id}-input-1`
|
|
221
233
|
}
|
|
222
234
|
), /* @__PURE__ */ import_react3.default.createElement(
|
|
223
235
|
"span",
|
|
224
236
|
{
|
|
225
|
-
className: "\r\n w-4 h-4 flex items-center justify-center border-2 border-gray-400 rounded \r\n peer-checked:bg-primary peer-checked:border-primary\r\n transition-colors\r\n "
|
|
237
|
+
className: "\r\n w-4 h-4 flex items-center justify-center border-2 border-gray-400 rounded \r\n peer-checked:bg-primary peer-checked:border-primary\r\n transition-colors\r\n ",
|
|
238
|
+
id: `${id}-span-1`
|
|
226
239
|
},
|
|
227
240
|
checked && /* @__PURE__ */ import_react3.default.createElement(
|
|
228
241
|
"svg",
|
|
@@ -231,9 +244,10 @@ var CustomCheckbox = ({ onChange, checked }) => {
|
|
|
231
244
|
fill: "none",
|
|
232
245
|
stroke: "currentColor",
|
|
233
246
|
strokeWidth: "3",
|
|
234
|
-
viewBox: "0 0 24 24"
|
|
247
|
+
viewBox: "0 0 24 24",
|
|
248
|
+
id: `${id}-svg-1`
|
|
235
249
|
},
|
|
236
|
-
/* @__PURE__ */ import_react3.default.createElement("path", { d: "M5 13l4 4L19 7" })
|
|
250
|
+
/* @__PURE__ */ import_react3.default.createElement("path", { d: "M5 13l4 4L19 7", id: `${id}-path-1` })
|
|
237
251
|
)
|
|
238
252
|
));
|
|
239
253
|
};
|
|
@@ -246,11 +260,12 @@ var VARIANTS = {
|
|
|
246
260
|
RED: "bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-100",
|
|
247
261
|
YELLOW: "bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-100"
|
|
248
262
|
};
|
|
249
|
-
var Chip = ({ label, variant }) => {
|
|
263
|
+
var Chip = ({ id = "chip", label, variant }) => {
|
|
250
264
|
return /* @__PURE__ */ import_react4.default.createElement(
|
|
251
265
|
"div",
|
|
252
266
|
{
|
|
253
|
-
className: `inline-flex text-[12px] items-center px-3 py-1 rounded-full ${VARIANTS[variant] || VARIANTS.PRIMARY} text-sm font-[600]
|
|
267
|
+
className: `inline-flex text-[12px] items-center px-3 py-1 rounded-full ${VARIANTS[variant] || VARIANTS.PRIMARY} text-sm font-[600]`,
|
|
268
|
+
id: `${id}-div-1`
|
|
254
269
|
},
|
|
255
270
|
label
|
|
256
271
|
);
|
|
@@ -258,28 +273,31 @@ var Chip = ({ label, variant }) => {
|
|
|
258
273
|
|
|
259
274
|
// src/inputs/CustomSwitch.jsx
|
|
260
275
|
var import_react5 = __toESM(require("react"));
|
|
261
|
-
var CustomSwitch = ({ checked, onChange, label, description }) => {
|
|
262
|
-
return /* @__PURE__ */ import_react5.default.createElement("div",
|
|
276
|
+
var CustomSwitch = ({ id = "custom-switch", checked, onChange, label, description }) => {
|
|
277
|
+
return /* @__PURE__ */ import_react5.default.createElement("div", { id: `${id}-div-1` }, /* @__PURE__ */ import_react5.default.createElement(
|
|
263
278
|
"button",
|
|
264
279
|
{
|
|
265
280
|
type: "button",
|
|
266
281
|
role: "switch",
|
|
267
282
|
"aria-checked": checked,
|
|
268
283
|
onClick: () => onChange(!checked),
|
|
269
|
-
className: `relative inline-flex h-6 w-11 shrink-0 items-center rounded-full transition-colors ${checked ? "bg-black" : "bg-gray-300"}
|
|
284
|
+
className: `relative inline-flex h-6 w-11 shrink-0 items-center rounded-full transition-colors ${checked ? "bg-black" : "bg-gray-300"}`,
|
|
285
|
+
id: `${id}-button-1`
|
|
270
286
|
},
|
|
271
287
|
/* @__PURE__ */ import_react5.default.createElement(
|
|
272
288
|
"span",
|
|
273
289
|
{
|
|
274
|
-
className: `inline-block h-4 w-4 transform rounded-full bg-white shadow transition ${checked ? "translate-x-6" : "translate-x-1"}
|
|
290
|
+
className: `inline-block h-4 w-4 transform rounded-full bg-white shadow transition ${checked ? "translate-x-6" : "translate-x-1"}`,
|
|
291
|
+
id: `${id}-span-1`
|
|
275
292
|
}
|
|
276
293
|
)
|
|
277
|
-
), /* @__PURE__ */ import_react5.default.createElement("div", { className: "flex flex-col" }, label && /* @__PURE__ */ import_react5.default.createElement("h3", { className: "font-[500] text-sm text-black mb-2" }, label), description && /* @__PURE__ */ import_react5.default.createElement("p", { className: "font-[500] text-sm text-[#737373]" }, description)));
|
|
294
|
+
), /* @__PURE__ */ import_react5.default.createElement("div", { className: "flex flex-col", id: `${id}-div-2` }, label && /* @__PURE__ */ import_react5.default.createElement("h3", { className: "font-[500] text-sm text-black mb-2", id: `${id}-h3-1` }, label), description && /* @__PURE__ */ import_react5.default.createElement("p", { className: "font-[500] text-sm text-[#737373]", id: `${id}-p-1` }, description)));
|
|
278
295
|
};
|
|
279
296
|
|
|
280
297
|
// src/inputs/Input.jsx
|
|
281
298
|
var import_react6 = __toESM(require("react"));
|
|
282
299
|
var CustomInput = ({
|
|
300
|
+
id = "input",
|
|
283
301
|
label,
|
|
284
302
|
isRequired,
|
|
285
303
|
value,
|
|
@@ -289,14 +307,15 @@ var CustomInput = ({
|
|
|
289
307
|
error,
|
|
290
308
|
heading
|
|
291
309
|
}) => {
|
|
292
|
-
return /* @__PURE__ */ import_react6.default.createElement("div", { className: "flex flex-col gap-1 w-full" }, heading && /* @__PURE__ */ import_react6.default.createElement("h3", { className: "text-lg font-semibold" }, heading), /* @__PURE__ */ import_react6.default.createElement(
|
|
310
|
+
return /* @__PURE__ */ import_react6.default.createElement("div", { className: "flex flex-col gap-1 w-full", id: `${id}-div-1` }, heading && /* @__PURE__ */ import_react6.default.createElement("h3", { className: "text-lg font-semibold", id: `${id}-h3-1` }, heading), /* @__PURE__ */ import_react6.default.createElement(
|
|
293
311
|
"label",
|
|
294
312
|
{
|
|
295
|
-
className: `font-[500] text-sm ${heading ? "text-[#737373]" : "text-black"} dark:text-white
|
|
313
|
+
className: `font-[500] text-sm ${heading ? "text-[#737373]" : "text-black"} dark:text-white`,
|
|
314
|
+
id: `${id}-label-1`
|
|
296
315
|
},
|
|
297
316
|
label,
|
|
298
317
|
" ",
|
|
299
|
-
isRequired && /* @__PURE__ */ import_react6.default.createElement("span", { className: "text-red-500" }, "*")
|
|
318
|
+
isRequired && /* @__PURE__ */ import_react6.default.createElement("span", { className: "text-red-500", id: `${id}-span-1` }, "*")
|
|
300
319
|
), /* @__PURE__ */ import_react6.default.createElement(
|
|
301
320
|
"input",
|
|
302
321
|
{
|
|
@@ -309,20 +328,22 @@ var CustomInput = ({
|
|
|
309
328
|
onChange: (e) => onChange == null ? void 0 : onChange(e.target.value),
|
|
310
329
|
placeholder,
|
|
311
330
|
disabled,
|
|
312
|
-
readOnly: disabled
|
|
331
|
+
readOnly: disabled,
|
|
332
|
+
id: `${id}-input-1`
|
|
313
333
|
}
|
|
314
334
|
));
|
|
315
335
|
};
|
|
316
336
|
|
|
317
337
|
// src/inputs/ProgressBar.jsx
|
|
318
338
|
var import_react7 = __toESM(require("react"));
|
|
319
|
-
var ProgressBar = ({ step, totalSteps }) => {
|
|
339
|
+
var ProgressBar = ({ id = "progress-bar", step, totalSteps }) => {
|
|
320
340
|
const progress = step / totalSteps * 100;
|
|
321
|
-
return /* @__PURE__ */ import_react7.default.createElement("div", { className: "mb-6" }, /* @__PURE__ */ import_react7.default.createElement("p", { className: "text-gray-600 text-sm mb-2" }, "Step ", step, " of ", totalSteps), /* @__PURE__ */ import_react7.default.createElement("div", { className: "w-full bg-gray-200 rounded-full h-2" }, /* @__PURE__ */ import_react7.default.createElement(
|
|
341
|
+
return /* @__PURE__ */ import_react7.default.createElement("div", { className: "mb-6", id: `${id}-div-1` }, /* @__PURE__ */ import_react7.default.createElement("p", { className: "text-gray-600 text-sm mb-2", id: `${id}-p-1` }, "Step ", step, " of ", totalSteps), /* @__PURE__ */ import_react7.default.createElement("div", { className: "w-full bg-gray-200 rounded-full h-2", id: `${id}-div-2` }, /* @__PURE__ */ import_react7.default.createElement(
|
|
322
342
|
"div",
|
|
323
343
|
{
|
|
324
344
|
className: "bg-black h-2 rounded-full transition-all duration-300",
|
|
325
|
-
style: { width: `${progress}%` }
|
|
345
|
+
style: { width: `${progress}%` },
|
|
346
|
+
id: `${id}-div-3`
|
|
326
347
|
}
|
|
327
348
|
)));
|
|
328
349
|
};
|
|
@@ -331,18 +352,20 @@ var ProgressBar = ({ step, totalSteps }) => {
|
|
|
331
352
|
var import_react8 = __toESM(require("react"));
|
|
332
353
|
var import_lucide_react2 = require("lucide-react");
|
|
333
354
|
var CustomSearch = ({
|
|
355
|
+
id = "search",
|
|
334
356
|
value,
|
|
335
357
|
onChange,
|
|
336
358
|
placeholder = "Search Markets..."
|
|
337
359
|
}) => {
|
|
338
|
-
return /* @__PURE__ */ import_react8.default.createElement("div", { className: "flex items-center border bg-transparent text-[14px] border-[hsl(0_0%_89.8%)] dark:border-[#303036] \r\n rounded-md h-10 px-2 w-full focus-within:outline-2 focus-within:outline-black focus-within:outline-offset-2 dark:text-white" }, /* @__PURE__ */ import_react8.default.createElement(import_lucide_react2.Search, { width: 16, height: 16, color: "gray", className: "mr-2" }), /* @__PURE__ */ import_react8.default.createElement(
|
|
360
|
+
return /* @__PURE__ */ import_react8.default.createElement("div", { className: "flex items-center border bg-transparent text-[14px] border-[hsl(0_0%_89.8%)] dark:border-[#303036] \r\n rounded-md h-10 px-2 w-full focus-within:outline-2 focus-within:outline-black focus-within:outline-offset-2 dark:text-white", id: `${id}-div-1` }, /* @__PURE__ */ import_react8.default.createElement(import_lucide_react2.Search, { width: 16, height: 16, color: "gray", className: "mr-2" }), /* @__PURE__ */ import_react8.default.createElement(
|
|
339
361
|
"input",
|
|
340
362
|
{
|
|
341
363
|
type: "text",
|
|
342
364
|
value,
|
|
343
365
|
onChange,
|
|
344
366
|
placeholder,
|
|
345
|
-
className: "bg-transparent w-full h-full focus:outline-none"
|
|
367
|
+
className: "bg-transparent w-full h-full focus:outline-none",
|
|
368
|
+
id: `${id}-input-1`
|
|
346
369
|
}
|
|
347
370
|
));
|
|
348
371
|
};
|
|
@@ -350,6 +373,7 @@ var CustomSearch = ({
|
|
|
350
373
|
// src/inputs/TextArea.jsx
|
|
351
374
|
var import_react9 = __toESM(require("react"));
|
|
352
375
|
var CustomTextarea = ({
|
|
376
|
+
id = "text-area",
|
|
353
377
|
label,
|
|
354
378
|
isRequired,
|
|
355
379
|
value,
|
|
@@ -360,14 +384,15 @@ var CustomTextarea = ({
|
|
|
360
384
|
heading,
|
|
361
385
|
rows = 4
|
|
362
386
|
}) => {
|
|
363
|
-
return /* @__PURE__ */ import_react9.default.createElement("div", { className: "flex flex-col gap-1 w-full" }, heading && /* @__PURE__ */ import_react9.default.createElement("h3", { className: "text-lg font-semibold" }, heading), /* @__PURE__ */ import_react9.default.createElement(
|
|
387
|
+
return /* @__PURE__ */ import_react9.default.createElement("div", { className: "flex flex-col gap-1 w-full", id: `${id}-div-1` }, heading && /* @__PURE__ */ import_react9.default.createElement("h3", { className: "text-lg font-semibold", id: `${id}-h3-1` }, heading), /* @__PURE__ */ import_react9.default.createElement(
|
|
364
388
|
"label",
|
|
365
389
|
{
|
|
366
|
-
className: `font-[500] text-sm ${heading ? "text-[#737373]" : "text-black"}
|
|
390
|
+
className: `font-[500] text-sm ${heading ? "text-[#737373]" : "text-black"}`,
|
|
391
|
+
id: `${id}-label-1`
|
|
367
392
|
},
|
|
368
393
|
label,
|
|
369
394
|
" ",
|
|
370
|
-
isRequired && /* @__PURE__ */ import_react9.default.createElement("span", { className: "text-red-500" }, "*")
|
|
395
|
+
isRequired && /* @__PURE__ */ import_react9.default.createElement("span", { className: "text-red-500", id: `${id}-span-1` }, "*")
|
|
371
396
|
), /* @__PURE__ */ import_react9.default.createElement(
|
|
372
397
|
"textarea",
|
|
373
398
|
{
|
|
@@ -381,7 +406,8 @@ var CustomTextarea = ({
|
|
|
381
406
|
onChange: (e) => onChange == null ? void 0 : onChange(e.target.value),
|
|
382
407
|
placeholder,
|
|
383
408
|
disabled,
|
|
384
|
-
readOnly: disabled
|
|
409
|
+
readOnly: disabled,
|
|
410
|
+
id: `${id}-textarea-1`
|
|
385
411
|
}
|
|
386
412
|
));
|
|
387
413
|
};
|
|
@@ -390,6 +416,7 @@ var CustomTextarea = ({
|
|
|
390
416
|
var import_react10 = __toESM(require("react"));
|
|
391
417
|
var import_lucide_react3 = require("lucide-react");
|
|
392
418
|
var CustomUpload = ({
|
|
419
|
+
id = "upload",
|
|
393
420
|
label = "Supporting documents",
|
|
394
421
|
description = "Drop items here or Browse Files",
|
|
395
422
|
accept = ".pdf,.jpg,.jpeg,.png",
|
|
@@ -408,7 +435,7 @@ var CustomUpload = ({
|
|
|
408
435
|
}
|
|
409
436
|
onChange == null ? void 0 : onChange(selectedFile);
|
|
410
437
|
};
|
|
411
|
-
return /* @__PURE__ */ import_react10.default.createElement("div", { className: "flex flex-col gap-2 w-full" }, label && /* @__PURE__ */ import_react10.default.createElement("label", { className: "text-sm font-medium" }, label), /* @__PURE__ */ import_react10.default.createElement(
|
|
438
|
+
return /* @__PURE__ */ import_react10.default.createElement("div", { className: "flex flex-col gap-2 w-full", id: `${id}-div-1` }, label && /* @__PURE__ */ import_react10.default.createElement("label", { className: "text-sm font-medium", id: `${id}-label-1` }, label), /* @__PURE__ */ import_react10.default.createElement(
|
|
412
439
|
"div",
|
|
413
440
|
{
|
|
414
441
|
className: `border-2 border-dashed rounded-lg p-6 flex flex-col items-center justify-center text-center cursor-pointer transition
|
|
@@ -421,11 +448,12 @@ var CustomUpload = ({
|
|
|
421
448
|
onDrop: (e) => {
|
|
422
449
|
e.preventDefault();
|
|
423
450
|
handleFileSelect(e.dataTransfer.files);
|
|
424
|
-
}
|
|
451
|
+
},
|
|
452
|
+
id: `${id}-div-2`
|
|
425
453
|
},
|
|
426
454
|
/* @__PURE__ */ import_react10.default.createElement(import_lucide_react3.Upload, { className: "w-6 h-6 text-gray-500 mb-2" }),
|
|
427
|
-
/* @__PURE__ */ import_react10.default.createElement("p", { className: "text-sm text-gray-700" }, description),
|
|
428
|
-
/* @__PURE__ */ import_react10.default.createElement("p", { className: "text-xs text-gray-500 mt-1" }, "File Supported: PDF/JPG/PNG, up to ", maxSizeMB, " MB"),
|
|
455
|
+
/* @__PURE__ */ import_react10.default.createElement("p", { className: "text-sm text-gray-700", id: `${id}-p-1` }, description),
|
|
456
|
+
/* @__PURE__ */ import_react10.default.createElement("p", { className: "text-xs text-gray-500 mt-1", id: `${id}-p-2` }, "File Supported: PDF/JPG/PNG, up to ", maxSizeMB, " MB"),
|
|
429
457
|
/* @__PURE__ */ import_react10.default.createElement(
|
|
430
458
|
"input",
|
|
431
459
|
{
|
|
@@ -433,15 +461,16 @@ var CustomUpload = ({
|
|
|
433
461
|
type: "file",
|
|
434
462
|
accept,
|
|
435
463
|
className: "hidden",
|
|
436
|
-
onChange: (e) => handleFileSelect(e.target.files)
|
|
464
|
+
onChange: (e) => handleFileSelect(e.target.files),
|
|
465
|
+
id: `${id}-input-1`
|
|
437
466
|
}
|
|
438
467
|
)
|
|
439
|
-
), value && /* @__PURE__ */ import_react10.default.createElement("span", { className: "text-sm truncate text-gray-500" }, "Selected: ", value.name), error && /* @__PURE__ */ import_react10.default.createElement("p", { className: "text-xs text-red-500" }, error));
|
|
468
|
+
), value && /* @__PURE__ */ import_react10.default.createElement("span", { className: "text-sm truncate text-gray-500", id: `${id}-span-1` }, "Selected: ", value.name), error && /* @__PURE__ */ import_react10.default.createElement("p", { className: "text-xs text-red-500", id: `${id}-p-3` }, error));
|
|
440
469
|
};
|
|
441
470
|
|
|
442
471
|
// src/sideBar/SideBar.jsx
|
|
443
|
-
var
|
|
444
|
-
var
|
|
472
|
+
var import_lucide_react8 = require("lucide-react");
|
|
473
|
+
var import_react14 = __toESM(require("react"));
|
|
445
474
|
|
|
446
475
|
// ConstantUI.js
|
|
447
476
|
var import_lucide_react4 = require("lucide-react");
|
|
@@ -470,7 +499,7 @@ var navItemsConstant = [
|
|
|
470
499
|
{
|
|
471
500
|
label: "Trips",
|
|
472
501
|
onClick: () => {
|
|
473
|
-
window.location.href = "/
|
|
502
|
+
window.location.href = "/trips/";
|
|
474
503
|
}
|
|
475
504
|
},
|
|
476
505
|
{
|
|
@@ -634,6 +663,7 @@ var import_js_cookie = __toESM(require("js-cookie"));
|
|
|
634
663
|
var import_react11 = __toESM(require("react"));
|
|
635
664
|
var import_lucide_react5 = require("lucide-react");
|
|
636
665
|
var CustomSelect = ({
|
|
666
|
+
id = "custom-select",
|
|
637
667
|
label,
|
|
638
668
|
value,
|
|
639
669
|
onChange,
|
|
@@ -667,17 +697,19 @@ var CustomSelect = ({
|
|
|
667
697
|
className: "flex flex-col w-full relative",
|
|
668
698
|
ref: wrapperRef,
|
|
669
699
|
tabIndex: disabled ? -1 : 0,
|
|
670
|
-
onBlur: handleBlur
|
|
700
|
+
onBlur: handleBlur,
|
|
701
|
+
id: `${id}-div-1`
|
|
671
702
|
},
|
|
672
|
-
heading && /* @__PURE__ */ import_react11.default.createElement("h3", { className: "text-lg font-semibold mb-1" }, heading),
|
|
703
|
+
heading && /* @__PURE__ */ import_react11.default.createElement("h3", { className: "text-lg font-semibold mb-1", id: `${id}-h3-1` }, heading),
|
|
673
704
|
label && /* @__PURE__ */ import_react11.default.createElement(
|
|
674
705
|
"label",
|
|
675
706
|
{
|
|
676
|
-
className: `font-medium text-sm mb-1 ${heading ? "text-[#737373] dark:text-white" : "text-black dark:text-white"}
|
|
707
|
+
className: `font-medium text-sm mb-1 ${heading ? "text-[#737373] dark:text-white" : "text-black dark:text-white"}`,
|
|
708
|
+
id: `${id}-label-1`
|
|
677
709
|
},
|
|
678
710
|
label,
|
|
679
711
|
" ",
|
|
680
|
-
isRequired && /* @__PURE__ */ import_react11.default.createElement("span", { className: "text-red-500" }, "*")
|
|
712
|
+
isRequired && /* @__PURE__ */ import_react11.default.createElement("span", { className: "text-red-500", id: `${id}-span-1` }, "*")
|
|
681
713
|
),
|
|
682
714
|
/* @__PURE__ */ import_react11.default.createElement(
|
|
683
715
|
"div",
|
|
@@ -686,9 +718,10 @@ var CustomSelect = ({
|
|
|
686
718
|
className: `flex justify-between items-center rounded-md px-3 py-2 text-sm border h-10 cursor-pointer dark:border-[#303036] dark:bg-[#18181b] dark:text-white
|
|
687
719
|
${disabled ? "bg-gray-100 text-gray-400" : "bg-white dark:bg-[#18181b] dark:text-white"}
|
|
688
720
|
${error ? "border-red-500" : "border-gray-300"}
|
|
689
|
-
|
|
721
|
+
`,
|
|
722
|
+
id: `${id}-div-2`
|
|
690
723
|
},
|
|
691
|
-
/* @__PURE__ */ import_react11.default.createElement("span", { className: `${selectedOption ? "text-black dark:text-white" : "text-gray-400 dark:text-white"}` }, selectedOption ? selectedOption.label : placeholder),
|
|
724
|
+
/* @__PURE__ */ import_react11.default.createElement("span", { className: `${selectedOption ? "text-black dark:text-white" : "text-gray-400 dark:text-white"}`, id: `${id}-span-2` }, selectedOption ? selectedOption.label : placeholder),
|
|
692
725
|
/* @__PURE__ */ import_react11.default.createElement(
|
|
693
726
|
import_lucide_react5.ChevronDown,
|
|
694
727
|
{
|
|
@@ -696,24 +729,26 @@ var CustomSelect = ({
|
|
|
696
729
|
}
|
|
697
730
|
)
|
|
698
731
|
),
|
|
699
|
-
open && !disabled && /* @__PURE__ */ import_react11.default.createElement("div", { className: "absolute top-full mt-1 w-full bg-white border border-gray-200 rounded-lg shadow-lg z-10 max-h-60 overflow-y-auto dark:bg-[#18181b] dark:text-white" }, /* @__PURE__ */ import_react11.default.createElement("div", { className: "flex items-center gap-2 p-2 border-b border-gray-200" }, /* @__PURE__ */ import_react11.default.createElement(import_lucide_react5.Search, { size: 16, className: "text-gray-400" }), /* @__PURE__ */ import_react11.default.createElement(
|
|
732
|
+
open && !disabled && /* @__PURE__ */ import_react11.default.createElement("div", { className: "absolute top-full mt-1 w-full bg-white border border-gray-200 rounded-lg shadow-lg z-10 max-h-60 overflow-y-auto dark:bg-[#18181b] dark:text-white", id: `${id}-div-3` }, /* @__PURE__ */ import_react11.default.createElement("div", { className: "flex items-center gap-2 p-2 border-b border-gray-200", id: `${id}-div-4` }, /* @__PURE__ */ import_react11.default.createElement(import_lucide_react5.Search, { size: 16, className: "text-gray-400" }), /* @__PURE__ */ import_react11.default.createElement(
|
|
700
733
|
"input",
|
|
701
734
|
{
|
|
702
735
|
type: "text",
|
|
703
736
|
value: search,
|
|
704
737
|
onChange: (e) => setSearch(e.target.value),
|
|
705
738
|
placeholder: "Search...",
|
|
706
|
-
className: "flex-1 text-sm focus:outline-none"
|
|
739
|
+
className: "flex-1 text-sm focus:outline-none",
|
|
740
|
+
id: `${id}-input-1`
|
|
707
741
|
}
|
|
708
|
-
)), /* @__PURE__ */ import_react11.default.createElement("ul",
|
|
742
|
+
)), /* @__PURE__ */ import_react11.default.createElement("ul", { id: `${id}-ul-1` }, filteredOptions.length > 0 ? filteredOptions.map((opt) => /* @__PURE__ */ import_react11.default.createElement(
|
|
709
743
|
"li",
|
|
710
744
|
{
|
|
711
745
|
key: opt.value,
|
|
712
746
|
onClick: () => handleSelect(opt.value),
|
|
713
|
-
className: `px-3 py-2 text-sm cursor-pointer hover:bg-gray-100 dark:hover:bg-[#27272a] ${value === opt.value ? "bg-gray-100 font-medium dark:bg-[#27272a] dark:text-white" : ""}
|
|
747
|
+
className: `px-3 py-2 text-sm cursor-pointer hover:bg-gray-100 dark:hover:bg-[#27272a] ${value === opt.value ? "bg-gray-100 font-medium dark:bg-[#27272a] dark:text-white" : ""}`,
|
|
748
|
+
id: `${id}-li-1`
|
|
714
749
|
},
|
|
715
750
|
opt.label
|
|
716
|
-
)) : /* @__PURE__ */ import_react11.default.createElement("li", { className: "px-3 py-2 text-sm text-gray-400 dark:text-white" }, "No results found")))
|
|
751
|
+
)) : /* @__PURE__ */ import_react11.default.createElement("li", { className: "px-3 py-2 text-sm text-gray-400 dark:text-white", id: `${id}-li-2` }, "No results found")))
|
|
717
752
|
);
|
|
718
753
|
};
|
|
719
754
|
|
|
@@ -762,6 +797,15 @@ function getScopeFromJettIdCookie() {
|
|
|
762
797
|
const data = getJettIdCookieData();
|
|
763
798
|
return (data == null ? void 0 : data.Scope) ?? null;
|
|
764
799
|
}
|
|
800
|
+
function getProfilesFromJettIdCookie(all) {
|
|
801
|
+
const data = getJettIdCookieData();
|
|
802
|
+
if (!(data == null ? void 0 : data.Profiles)) return [];
|
|
803
|
+
if (all) return data.Profiles;
|
|
804
|
+
return data.Profiles.filter((profile) => {
|
|
805
|
+
var _a;
|
|
806
|
+
return (_a = profile.Scope) == null ? void 0 : _a.endsWith("_ENTITY");
|
|
807
|
+
});
|
|
808
|
+
}
|
|
765
809
|
function buildLogoUrl(CDNBasePath, logoPath) {
|
|
766
810
|
const base = (CDNBasePath || "").replace(/\/$/, "");
|
|
767
811
|
const path = (logoPath || "").replace(/^\//, "");
|
|
@@ -769,27 +813,259 @@ function buildLogoUrl(CDNBasePath, logoPath) {
|
|
|
769
813
|
return `${base}/${path}`;
|
|
770
814
|
}
|
|
771
815
|
|
|
816
|
+
// src/sideBar/SwitchProfileSection.jsx
|
|
817
|
+
var import_react13 = __toESM(require("react"));
|
|
818
|
+
var import_react_dom2 = require("react-dom");
|
|
819
|
+
var import_lucide_react7 = require("lucide-react");
|
|
820
|
+
|
|
821
|
+
// src/sideBar/LogoutConfirmModal.jsx
|
|
822
|
+
var import_react12 = __toESM(require("react"));
|
|
823
|
+
var import_react_dom = require("react-dom");
|
|
824
|
+
var import_lucide_react6 = require("lucide-react");
|
|
825
|
+
var LogoutConfirmModal = ({
|
|
826
|
+
id = "logout-confirm",
|
|
827
|
+
open,
|
|
828
|
+
onConfirm,
|
|
829
|
+
onCancel,
|
|
830
|
+
loading = false
|
|
831
|
+
}) => {
|
|
832
|
+
if (!open || typeof document === "undefined") return null;
|
|
833
|
+
const handleOverlayClick = (e) => {
|
|
834
|
+
if (e.target === e.currentTarget && !loading) onCancel();
|
|
835
|
+
};
|
|
836
|
+
return (0, import_react_dom.createPortal)(
|
|
837
|
+
/* @__PURE__ */ import_react12.default.createElement(
|
|
838
|
+
"div",
|
|
839
|
+
{
|
|
840
|
+
className: "fixed inset-0 z-[10000] flex items-center justify-center bg-black/50",
|
|
841
|
+
onClick: handleOverlayClick,
|
|
842
|
+
id: `${id}-overlay`
|
|
843
|
+
},
|
|
844
|
+
/* @__PURE__ */ import_react12.default.createElement("div", { className: "w-[360px] rounded-2xl bg-white dark:bg-[#18181b] p-6 text-center shadow-2xl", id: `${id}-dialog` }, /* @__PURE__ */ import_react12.default.createElement("div", { className: "mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-blue-50 dark:bg-blue-950/40", id: `${id}-icon` }, /* @__PURE__ */ import_react12.default.createElement(import_lucide_react6.LogOut, { className: "text-blue-600", width: 28, height: 28 })), /* @__PURE__ */ import_react12.default.createElement("p", { className: "!text-[22px] !font-semibold text-gray-900 dark:text-white" }, "Are you sure you want to logout?"), /* @__PURE__ */ import_react12.default.createElement("div", { className: "mt-6 flex gap-3" }, /* @__PURE__ */ import_react12.default.createElement(
|
|
845
|
+
"button",
|
|
846
|
+
{
|
|
847
|
+
type: "button",
|
|
848
|
+
onClick: onCancel,
|
|
849
|
+
disabled: loading,
|
|
850
|
+
className: "flex-1 no-wrap rounded-lg border border-gray-300 dark:border-[#303036] px-4 py-2 text-[14px] font-medium text-gray-700 dark:text-[#f4f4f5cc] cursor-pointer hover:bg-gray-50 dark:hover:bg-[#27272a] disabled:opacity-50 disabled:cursor-not-allowed transition-colors duration-200",
|
|
851
|
+
id: `${id}-cancel-button`
|
|
852
|
+
},
|
|
853
|
+
"No, Keep me in"
|
|
854
|
+
), /* @__PURE__ */ import_react12.default.createElement(
|
|
855
|
+
"button",
|
|
856
|
+
{
|
|
857
|
+
type: "button",
|
|
858
|
+
onClick: onConfirm,
|
|
859
|
+
disabled: loading,
|
|
860
|
+
className: "flex-1 rounded-lg bg-red-600 px-4 py-2 text-[14px] font-medium text-white cursor-pointer hover:bg-red-700 disabled:opacity-50 disabled:cursor-not-allowed transition-colors duration-200",
|
|
861
|
+
id: `${id}-confirm-button`
|
|
862
|
+
},
|
|
863
|
+
loading ? "Logging out..." : "Yes, logout"
|
|
864
|
+
)))
|
|
865
|
+
),
|
|
866
|
+
document.body
|
|
867
|
+
);
|
|
868
|
+
};
|
|
869
|
+
|
|
870
|
+
// src/utils/switchProfileEncryption.js
|
|
871
|
+
var import_node_forge = __toESM(require("node-forge"));
|
|
872
|
+
var RSA_MODULUS_BASE64 = "zktSGmyKa5SR8HO540HKTdgDPVmXafgGFrf4OYtRNApRssnt0hGoMU7Jitc/SVWbPstFshIi5XblbDL2NXWYhZtj4PWL4SKc1/bM02xxabPw/eFr3XAAPCF62WxAVPsJBbEoAB0AcOCeIcGHb+tzLtXQJAvOuIBsKLQiiB7/c9ltt5AVVM4si1RC3JsxpqcGTkgwnh+FMg8CFvLdHjh/oi789wj8zoGWLAdYSBBa8IoQgTuzZt1tft2LF0y4Ck3yT8F9TX5GbAiVXb0G9cM/hUmDNz/6xOvHuOfH5147tKDUNCT/sr5tEaLm5ePUmRdpoc5PZa04q1KGJ0rxf6T55E5pQ8Qh2EFr1yPyLh12wiSTRsnHwXwVsosbNNBBN3HdBOMklTQx2VJNDHpi19G+z4d1evlS8yDqNZe9QyRFKEsTd+xPg3ob3j/ObpYDOtXoMaw8fXWbvyG4MJTz7nWG5YL2s5oWSAFZ4mifgwOmM/OuTO/uholelws25k/a3+O/s5Xd/HOugBvpeb5azGLfMHrGvu6J9DSIVI28hfbaFm2+smjyLdS+5PWV2+hM9EQLgaw/euGx4Qhzo2nagLwl9+hNOZ2gjtNHJxJtbQJTNrE90d3mX2/yfxHzh8FiiAiraxiZCgdUQeEZbZNlAwQLHIYWazSqgmRhf4D1LGMMrak=";
|
|
873
|
+
var RSA_EXPONENT_BASE64 = "AQAB";
|
|
874
|
+
var convertModulusExponentToPem = (modulus, exponent) => {
|
|
875
|
+
const decodedModulus = import_node_forge.default.util.decode64(modulus);
|
|
876
|
+
const decodedExponent = import_node_forge.default.util.decode64(exponent);
|
|
877
|
+
const publicKey = import_node_forge.default.pki.setRsaPublicKey(
|
|
878
|
+
new import_node_forge.default.jsbn.BigInteger(import_node_forge.default.util.bytesToHex(decodedModulus), 16),
|
|
879
|
+
new import_node_forge.default.jsbn.BigInteger(import_node_forge.default.util.bytesToHex(decodedExponent), 16)
|
|
880
|
+
);
|
|
881
|
+
return import_node_forge.default.pki.publicKeyToPem(publicKey);
|
|
882
|
+
};
|
|
883
|
+
var cachedPemKey = null;
|
|
884
|
+
var getPemKey = () => {
|
|
885
|
+
if (!cachedPemKey) {
|
|
886
|
+
cachedPemKey = convertModulusExponentToPem(RSA_MODULUS_BASE64, RSA_EXPONENT_BASE64);
|
|
887
|
+
}
|
|
888
|
+
return cachedPemKey;
|
|
889
|
+
};
|
|
890
|
+
var encryptForSwitchProfile = (plainText) => {
|
|
891
|
+
const publicKey = import_node_forge.default.pki.publicKeyFromPem(getPemKey());
|
|
892
|
+
const encrypted = publicKey.encrypt(plainText, "RSAES-PKCS1-V1_5");
|
|
893
|
+
return import_node_forge.default.util.encode64(encrypted).replace(/\r?\n|\r/g, "");
|
|
894
|
+
};
|
|
895
|
+
|
|
896
|
+
// src/sideBar/SwitchProfileSection.jsx
|
|
897
|
+
var SwitchProfileSection = ({
|
|
898
|
+
id = "switch-profile",
|
|
899
|
+
open,
|
|
900
|
+
anchorRef,
|
|
901
|
+
onClose,
|
|
902
|
+
onManageProfile,
|
|
903
|
+
onProfileSwitch,
|
|
904
|
+
onTmcSettings,
|
|
905
|
+
onLogout
|
|
906
|
+
}) => {
|
|
907
|
+
const [position, setPosition] = (0, import_react13.useState)(null);
|
|
908
|
+
const [showLogoutConfirm, setShowLogoutConfirm] = (0, import_react13.useState)(false);
|
|
909
|
+
const [switchingProfileId, setSwitchingProfileId] = (0, import_react13.useState)(null);
|
|
910
|
+
(0, import_react13.useLayoutEffect)(() => {
|
|
911
|
+
if (!open || !(anchorRef == null ? void 0 : anchorRef.current)) return;
|
|
912
|
+
const updatePosition = () => {
|
|
913
|
+
const rect = anchorRef.current.getBoundingClientRect();
|
|
914
|
+
setPosition({
|
|
915
|
+
left: rect.right + 12,
|
|
916
|
+
bottom: window.innerHeight - rect.bottom
|
|
917
|
+
});
|
|
918
|
+
};
|
|
919
|
+
updatePosition();
|
|
920
|
+
window.addEventListener("resize", updatePosition);
|
|
921
|
+
window.addEventListener("scroll", updatePosition, true);
|
|
922
|
+
return () => {
|
|
923
|
+
window.removeEventListener("resize", updatePosition);
|
|
924
|
+
window.removeEventListener("scroll", updatePosition, true);
|
|
925
|
+
};
|
|
926
|
+
}, [open, anchorRef]);
|
|
927
|
+
if (!open && !showLogoutConfirm || typeof document === "undefined") return null;
|
|
928
|
+
const jettIdData = getJettIdCookieData();
|
|
929
|
+
const userName = (jettIdData == null ? void 0 : jettIdData.UserName) || "";
|
|
930
|
+
const userEmail = (jettIdData == null ? void 0 : jettIdData.UserEmail) || "";
|
|
931
|
+
const currentProfileId = jettIdData == null ? void 0 : jettIdData.ProfileId;
|
|
932
|
+
const allMarkets = getProfilesFromJettIdCookie(true);
|
|
933
|
+
const markets = allMarkets.length ? allMarkets : (jettIdData == null ? void 0 : jettIdData.EntityName) ? [{ ProfileId: currentProfileId, EntityName: jettIdData.EntityName }] : [];
|
|
934
|
+
const handleConfirmLogout = () => {
|
|
935
|
+
setShowLogoutConfirm(false);
|
|
936
|
+
onLogout == null ? void 0 : onLogout();
|
|
937
|
+
};
|
|
938
|
+
const buildRequestContext = () => ({
|
|
939
|
+
UserAgent: typeof navigator !== "undefined" ? navigator.userAgent : "Mozilla/5.0",
|
|
940
|
+
TrackingId: crypto.randomUUID(),
|
|
941
|
+
TransactionId: crypto.randomUUID(),
|
|
942
|
+
CountryCode: "IN",
|
|
943
|
+
IpAddress: "127.0.0.1"
|
|
944
|
+
// Client IP cannot be retrieved from browser
|
|
945
|
+
});
|
|
946
|
+
const handleProfileSwitch = async (profile) => {
|
|
947
|
+
var _a;
|
|
948
|
+
if (switchingProfileId) return;
|
|
949
|
+
setSwitchingProfileId(profile.ProfileId);
|
|
950
|
+
try {
|
|
951
|
+
const encryptedRequest = encryptForSwitchProfile(
|
|
952
|
+
JSON.stringify({
|
|
953
|
+
ProfileToken: profile.ProfileToken,
|
|
954
|
+
ProfileId: profile.ProfileId
|
|
955
|
+
})
|
|
956
|
+
);
|
|
957
|
+
const response = await fetch(`${window.location.origin}/auth/switch/profile`, {
|
|
958
|
+
method: "POST",
|
|
959
|
+
credentials: "include",
|
|
960
|
+
headers: { "Content-Type": "application/json" },
|
|
961
|
+
body: JSON.stringify({
|
|
962
|
+
Context: buildRequestContext(),
|
|
963
|
+
Request: encryptedRequest
|
|
964
|
+
})
|
|
965
|
+
}).then((res) => res.json());
|
|
966
|
+
if ((_a = response == null ? void 0 : response.Response) == null ? void 0 : _a.RedirectUrl) {
|
|
967
|
+
window.location.href = response.Response.RedirectUrl;
|
|
968
|
+
return;
|
|
969
|
+
}
|
|
970
|
+
setSwitchingProfileId(null);
|
|
971
|
+
onProfileSwitch == null ? void 0 : onProfileSwitch(profile);
|
|
972
|
+
} catch (error) {
|
|
973
|
+
console.error("Switch profile request failed:", error);
|
|
974
|
+
setSwitchingProfileId(null);
|
|
975
|
+
onProfileSwitch == null ? void 0 : onProfileSwitch(profile);
|
|
976
|
+
}
|
|
977
|
+
};
|
|
978
|
+
return /* @__PURE__ */ import_react13.default.createElement(import_react13.default.Fragment, null, open && (0, import_react_dom2.createPortal)(
|
|
979
|
+
/* @__PURE__ */ import_react13.default.createElement(import_react13.default.Fragment, null, /* @__PURE__ */ import_react13.default.createElement("div", { className: "fixed inset-0 z-[9999]", onClick: onClose, id: `${id}-backdrop` }), /* @__PURE__ */ import_react13.default.createElement(
|
|
980
|
+
"div",
|
|
981
|
+
{
|
|
982
|
+
className: "fixed w-[370px] max-h-[75vh] flex flex-col overflow-hidden bg-white dark:bg-[#18181b] rounded-xl shadow-xl border border-gray-200 dark:border-[#303036] z-[9999]",
|
|
983
|
+
style: position ? { left: position.left, bottom: position.bottom } : { left: -9999, bottom: 0 },
|
|
984
|
+
id: `${id}-panel`
|
|
985
|
+
},
|
|
986
|
+
/* @__PURE__ */ import_react13.default.createElement("div", { className: "flex items-center justify-between gap-3 p-4", id: `${id}-header` }, /* @__PURE__ */ import_react13.default.createElement("div", { className: "flex items-center gap-3 min-w-0", id: `${id}-header-user` }, /* @__PURE__ */ import_react13.default.createElement("span", { className: "relative flex shrink-0 overflow-hidden rounded-full h-10 w-10", id: `${id}-avatar` }, /* @__PURE__ */ import_react13.default.createElement("span", { className: "flex h-full w-full items-center justify-center !text-[16px] !font-normal border border-gray-200 dark:border-[#303036] rounded-full bg-muted dark:text-white" }, userName ? userName.charAt(0) : "A")), /* @__PURE__ */ import_react13.default.createElement("div", { className: "min-w-0", id: `${id}-header-text` }, /* @__PURE__ */ import_react13.default.createElement("p", { className: "!font-semibold dark:text-white !text-[15px] truncate" }, userName || "Admin"), /* @__PURE__ */ import_react13.default.createElement("p", { className: "!text-[13px] !font-normal text-gray-500 dark:text-[#f4f4f5cc] truncate" }, userEmail))), /* @__PURE__ */ import_react13.default.createElement(
|
|
987
|
+
"button",
|
|
988
|
+
{
|
|
989
|
+
type: "button",
|
|
990
|
+
onClick: onManageProfile,
|
|
991
|
+
className: "shrink-0 whitespace-nowrap rounded-md border border-gray-300 dark:border-[#303036] px-3 py-1.5 text-[11px] font-semibold uppercase tracking-wide text-gray-700 dark:text-[#f4f4f5cc] cursor-pointer hover:bg-gray-50 dark:hover:bg-[#27272a] transition-colors duration-200",
|
|
992
|
+
id: `${id}-manage-profile-button`
|
|
993
|
+
},
|
|
994
|
+
"Manage Profile"
|
|
995
|
+
)),
|
|
996
|
+
/* @__PURE__ */ import_react13.default.createElement("div", { className: "border-t border-gray-200 dark:border-[#303036]" }),
|
|
997
|
+
/* @__PURE__ */ import_react13.default.createElement("div", { className: "overflow-y-auto scrollbar-hide", id: `${id}-body` }, /* @__PURE__ */ import_react13.default.createElement("p", { className: "px-4 pt-3 pb-2 text-[11px] font-semibold tracking-wider text-gray-400 uppercase", id: `${id}-markets-label` }, "Your Markets"), /* @__PURE__ */ import_react13.default.createElement("div", { className: "flex flex-col gap-1 px-2 pb-2", id: `${id}-markets-list` }, markets.length === 0 && /* @__PURE__ */ import_react13.default.createElement("p", { className: "px-2 py-2 text-[13px] text-gray-400", id: `${id}-markets-empty` }, "No markets available"), markets.map((profile) => {
|
|
998
|
+
const isCurrent = profile.ProfileId === currentProfileId;
|
|
999
|
+
const isSwitching = switchingProfileId === profile.ProfileId;
|
|
1000
|
+
return /* @__PURE__ */ import_react13.default.createElement(
|
|
1001
|
+
"div",
|
|
1002
|
+
{
|
|
1003
|
+
key: profile.ProfileId,
|
|
1004
|
+
onClick: () => !isCurrent && handleProfileSwitch(profile),
|
|
1005
|
+
"aria-disabled": isSwitching,
|
|
1006
|
+
className: `flex items-center justify-between gap-2 rounded-lg p-3 cursor-pointer hover:bg-[#f4f4f5] dark:hover:bg-[#27272a] transition-colors duration-200 ${isCurrent ? "border border-gray-800 dark:border-white" : "border border-transparent"} ${isSwitching ? "opacity-50 pointer-events-none" : ""}`,
|
|
1007
|
+
id: `${id}-market-${profile.ProfileId}`
|
|
1008
|
+
},
|
|
1009
|
+
/* @__PURE__ */ import_react13.default.createElement("span", { className: "!font-medium !text-[14px] dark:text-[#f4f4f5cc] truncate" }, profile.EntityName),
|
|
1010
|
+
isCurrent && /* @__PURE__ */ import_react13.default.createElement("span", { className: "shrink-0 rounded-full bg-blue-600 px-2.5 py-0.5 text-[10px] font-bold uppercase tracking-wide text-white" }, "Logged In"),
|
|
1011
|
+
isSwitching && /* @__PURE__ */ import_react13.default.createElement("span", { className: "shrink-0 text-[11px] text-gray-400" }, "Switching...")
|
|
1012
|
+
);
|
|
1013
|
+
}))),
|
|
1014
|
+
/* @__PURE__ */ import_react13.default.createElement("div", { className: "border-t border-gray-200 dark:border-[#303036]" }),
|
|
1015
|
+
/* @__PURE__ */ import_react13.default.createElement("div", { className: "p-2", id: `${id}-footer` }, /* @__PURE__ */ import_react13.default.createElement(
|
|
1016
|
+
"div",
|
|
1017
|
+
{
|
|
1018
|
+
onClick: () => {
|
|
1019
|
+
onClose == null ? void 0 : onClose();
|
|
1020
|
+
setShowLogoutConfirm(true);
|
|
1021
|
+
},
|
|
1022
|
+
className: "flex items-center gap-3 rounded-lg p-3 cursor-pointer text-red-600 hover:bg-red-50 dark:hover:bg-[#27272a] transition-colors duration-200",
|
|
1023
|
+
id: `${id}-logout`
|
|
1024
|
+
},
|
|
1025
|
+
/* @__PURE__ */ import_react13.default.createElement(import_lucide_react7.LogOut, { width: 18, height: 18 }),
|
|
1026
|
+
/* @__PURE__ */ import_react13.default.createElement("span", { className: "!font-medium !text-[14px]" }, "Logout")
|
|
1027
|
+
))
|
|
1028
|
+
)),
|
|
1029
|
+
document.body
|
|
1030
|
+
), /* @__PURE__ */ import_react13.default.createElement(
|
|
1031
|
+
LogoutConfirmModal,
|
|
1032
|
+
{
|
|
1033
|
+
id: `${id}-logout-confirm`,
|
|
1034
|
+
open: showLogoutConfirm,
|
|
1035
|
+
onCancel: () => setShowLogoutConfirm(false),
|
|
1036
|
+
onConfirm: handleConfirmLogout
|
|
1037
|
+
}
|
|
1038
|
+
));
|
|
1039
|
+
};
|
|
1040
|
+
|
|
772
1041
|
// src/sideBar/SideBar.jsx
|
|
773
1042
|
var SCOPE_LABELS = {
|
|
774
1043
|
TMC: "TMC Manager",
|
|
775
1044
|
TMC_ENTITY: "TMC Entity Manager"
|
|
776
1045
|
};
|
|
777
1046
|
var AppSideBar = ({
|
|
1047
|
+
id = "side-bar",
|
|
778
1048
|
username,
|
|
779
1049
|
navItems,
|
|
780
1050
|
additionalItems,
|
|
781
|
-
sideBarLogo
|
|
1051
|
+
sideBarLogo,
|
|
1052
|
+
onManageProfile,
|
|
1053
|
+
onProfileSwitch,
|
|
1054
|
+
onTmcSettings,
|
|
1055
|
+
onLogout
|
|
782
1056
|
}) => {
|
|
783
1057
|
var _a, _b;
|
|
784
|
-
const
|
|
785
|
-
const [
|
|
786
|
-
const [
|
|
787
|
-
const [
|
|
788
|
-
const [
|
|
789
|
-
const [
|
|
790
|
-
const [
|
|
791
|
-
const [
|
|
792
|
-
(0,
|
|
1058
|
+
const profileCardRef = (0, import_react14.useRef)(null);
|
|
1059
|
+
const [authData, setAuthData] = (0, import_react14.useState)(null);
|
|
1060
|
+
const [cookieUserName, setCookieUserName] = (0, import_react14.useState)(null);
|
|
1061
|
+
const [scope, setScope] = (0, import_react14.useState)(null);
|
|
1062
|
+
const [selectedCountry, setSelectedCountry] = (0, import_react14.useState)("dubai");
|
|
1063
|
+
const [isMobileMenuOpen, setIsMobileMenuOpen] = (0, import_react14.useState)(false);
|
|
1064
|
+
const [isSwitchProfileOpen, setIsSwitchProfileOpen] = (0, import_react14.useState)(false);
|
|
1065
|
+
const [openMenus, setOpenMenus] = (0, import_react14.useState)(/* @__PURE__ */ new Set());
|
|
1066
|
+
const [activeMenuPath, setActiveMenuPath] = (0, import_react14.useState)(null);
|
|
1067
|
+
const [currAppearance, setCurrAppearance] = (0, import_react14.useState)("light");
|
|
1068
|
+
(0, import_react14.useEffect)(() => {
|
|
793
1069
|
setCurrAppearance("light");
|
|
794
1070
|
}, []);
|
|
795
1071
|
const countryOptions = [
|
|
@@ -861,14 +1137,14 @@ var AppSideBar = ({
|
|
|
861
1137
|
}
|
|
862
1138
|
closeMobileMenu();
|
|
863
1139
|
};
|
|
864
|
-
(0,
|
|
1140
|
+
(0, import_react14.useEffect)(() => {
|
|
865
1141
|
const storedAuthData = localStorage.getItem("authData");
|
|
866
1142
|
if (storedAuthData) {
|
|
867
1143
|
let parseData = JSON.parse(storedAuthData);
|
|
868
1144
|
setAuthData(parseData);
|
|
869
1145
|
}
|
|
870
1146
|
}, [localStorage.getItem("authData")]);
|
|
871
|
-
(0,
|
|
1147
|
+
(0, import_react14.useEffect)(() => {
|
|
872
1148
|
const jettIdData = getJettIdCookieData();
|
|
873
1149
|
if (jettIdData == null ? void 0 : jettIdData.UserName) {
|
|
874
1150
|
setCookieUserName(jettIdData.UserName);
|
|
@@ -1018,7 +1294,7 @@ var AppSideBar = ({
|
|
|
1018
1294
|
authData.userInfo.OrgLogo
|
|
1019
1295
|
) : null;
|
|
1020
1296
|
const sideBarLogoLocal = sideBarLogo ?? logoUrlFromCookie ?? logoUrlFromUserInfo ?? null;
|
|
1021
|
-
const detectAndSetActiveMenu = (0,
|
|
1297
|
+
const detectAndSetActiveMenu = (0, import_react14.useCallback)(() => {
|
|
1022
1298
|
const currentPath = window.location.pathname;
|
|
1023
1299
|
const currentSearch = window.location.search;
|
|
1024
1300
|
const newOpenMenus = /* @__PURE__ */ new Set();
|
|
@@ -1058,14 +1334,14 @@ var AppSideBar = ({
|
|
|
1058
1334
|
setActiveMenuPath(foundActivePath);
|
|
1059
1335
|
}
|
|
1060
1336
|
}, [navItemsLocal]);
|
|
1061
|
-
const [currentUrl, setCurrentUrl] = (0,
|
|
1337
|
+
const [currentUrl, setCurrentUrl] = (0, import_react14.useState)(
|
|
1062
1338
|
() => window.location.pathname + window.location.search
|
|
1063
1339
|
);
|
|
1064
|
-
(0,
|
|
1340
|
+
(0, import_react14.useEffect)(() => {
|
|
1065
1341
|
detectAndSetActiveMenu();
|
|
1066
1342
|
setCurrentUrl(window.location.pathname + window.location.search);
|
|
1067
1343
|
}, [detectAndSetActiveMenu]);
|
|
1068
|
-
(0,
|
|
1344
|
+
(0, import_react14.useEffect)(() => {
|
|
1069
1345
|
let lastUrl = window.location.pathname + window.location.search;
|
|
1070
1346
|
const handleLocationChange = () => {
|
|
1071
1347
|
const newUrl = window.location.pathname + window.location.search;
|
|
@@ -1087,7 +1363,7 @@ var AppSideBar = ({
|
|
|
1087
1363
|
clearInterval(checkInterval);
|
|
1088
1364
|
};
|
|
1089
1365
|
}, [detectAndSetActiveMenu]);
|
|
1090
|
-
(0,
|
|
1366
|
+
(0, import_react14.useEffect)(() => {
|
|
1091
1367
|
detectAndSetActiveMenu();
|
|
1092
1368
|
}, [currentUrl, detectAndSetActiveMenu]);
|
|
1093
1369
|
const toggleMobileMenu = () => {
|
|
@@ -1096,69 +1372,76 @@ var AppSideBar = ({
|
|
|
1096
1372
|
const closeMobileMenu = () => {
|
|
1097
1373
|
setIsMobileMenuOpen(false);
|
|
1098
1374
|
};
|
|
1099
|
-
return /* @__PURE__ */
|
|
1375
|
+
return /* @__PURE__ */ import_react14.default.createElement(import_react14.default.Fragment, null, /* @__PURE__ */ import_react14.default.createElement("div", { className: "fixed top-0 left-0 w-full z-50 flex items-center justify-between px-4 py-3 bg-white dark:bg-[#18181b] border-b border-gray-200 dark:border-[#303036] shadow-lg md:hidden", id: `${id}-div-1` }, /* @__PURE__ */ import_react14.default.createElement(
|
|
1100
1376
|
"button",
|
|
1101
1377
|
{
|
|
1102
1378
|
onClick: toggleMobileMenu,
|
|
1103
1379
|
className: "p-2 rounded-lg hover:bg-gray-50 dark:hover:bg-[#27272a] transition-colors",
|
|
1104
|
-
"aria-label": "Toggle menu"
|
|
1380
|
+
"aria-label": "Toggle menu",
|
|
1381
|
+
id: `${id}-button-1`
|
|
1105
1382
|
},
|
|
1106
|
-
isMobileMenuOpen ? /* @__PURE__ */
|
|
1107
|
-
), /* @__PURE__ */
|
|
1383
|
+
isMobileMenuOpen ? /* @__PURE__ */ import_react14.default.createElement(import_lucide_react8.X, { className: "w-6 h-6 text-gray-700 dark:text-[#f4f4f5cc]" }) : /* @__PURE__ */ import_react14.default.createElement(import_lucide_react8.Menu, { className: "w-6 h-6 text-gray-700 dark:text-[#f4f4f5cc]" })
|
|
1384
|
+
), /* @__PURE__ */ import_react14.default.createElement("div", { className: "flex-1 flex justify-center", id: `${id}-div-2` }, sideBarLogoLocal && /* @__PURE__ */ import_react14.default.createElement(
|
|
1108
1385
|
"img",
|
|
1109
1386
|
{
|
|
1110
1387
|
src: sideBarLogoLocal,
|
|
1111
1388
|
alt: "sidebarLogo",
|
|
1112
1389
|
width: 208,
|
|
1113
1390
|
height: 40,
|
|
1114
|
-
className: "object-contain"
|
|
1391
|
+
className: "object-contain",
|
|
1392
|
+
id: `${id}-img-1`
|
|
1115
1393
|
}
|
|
1116
|
-
)), /* @__PURE__ */
|
|
1394
|
+
)), /* @__PURE__ */ import_react14.default.createElement("div", { className: "w-10", id: `${id}-div-3` })), isMobileMenuOpen && /* @__PURE__ */ import_react14.default.createElement(
|
|
1117
1395
|
"div",
|
|
1118
1396
|
{
|
|
1119
1397
|
className: "fixed inset-0 bg-black/80 bg-opacity-50 z-40 md:hidden",
|
|
1120
|
-
onClick: closeMobileMenu
|
|
1398
|
+
onClick: closeMobileMenu,
|
|
1399
|
+
id: `${id}-div-4`
|
|
1121
1400
|
}
|
|
1122
|
-
), /* @__PURE__ */
|
|
1401
|
+
), /* @__PURE__ */ import_react14.default.createElement(
|
|
1123
1402
|
"div",
|
|
1124
1403
|
{
|
|
1125
|
-
className: `fixed top-0 left-0 md:relative w-[320px] transition-all ease-in-out delay-100 bg-white dark:bg-[#18181b] border-r border-gray-200 dark:border-[#303036] flex flex-col p-4 pt-20 md:pt-4 h-full max-h-[100vh] xs:max-md:z-40 md:max-lg:w-[280px] ${isMobileMenuOpen ? "translate-x-0" : "-translate-x-full md:translate-x-0"}
|
|
1404
|
+
className: `fixed top-0 left-0 md:relative w-[320px] transition-all ease-in-out delay-100 bg-white dark:bg-[#18181b] border-r border-gray-200 dark:border-[#303036] flex flex-col p-4 pt-20 md:pt-4 h-full max-h-[100vh] xs:max-md:z-40 md:max-lg:w-[280px] ${isMobileMenuOpen ? "translate-x-0" : "-translate-x-full md:translate-x-0"}`,
|
|
1405
|
+
id: `${id}-div-5`
|
|
1126
1406
|
},
|
|
1127
|
-
/* @__PURE__ */
|
|
1407
|
+
/* @__PURE__ */ import_react14.default.createElement("div", { className: "p-2 mb-2 hidden md:block", id: `${id}-div-6` }, /* @__PURE__ */ import_react14.default.createElement("div", { className: "flex items-center justify-center w-full h-[60px] mb-2", id: `${id}-div-7` }, sideBarLogoLocal && /* @__PURE__ */ import_react14.default.createElement(
|
|
1128
1408
|
"img",
|
|
1129
1409
|
{
|
|
1130
1410
|
src: sideBarLogoLocal,
|
|
1131
1411
|
alt: "sidebarLogo",
|
|
1132
1412
|
width: 108,
|
|
1133
1413
|
height: 40,
|
|
1134
|
-
className: "object-contain"
|
|
1414
|
+
className: "object-contain",
|
|
1415
|
+
id: `${id}-img-2`
|
|
1135
1416
|
}
|
|
1136
1417
|
))),
|
|
1137
|
-
/* @__PURE__ */
|
|
1138
|
-
/* @__PURE__ */
|
|
1418
|
+
/* @__PURE__ */ import_react14.default.createElement("div", { className: "mb-4", id: `${id}-div-8` }),
|
|
1419
|
+
/* @__PURE__ */ import_react14.default.createElement("div", { className: "overflow-y-auto scrollbar-hide", id: `${id}-div-9` }, /* @__PURE__ */ import_react14.default.createElement("div", { id: `${id}-div-10` }, navItemsLocal == null ? void 0 : navItemsLocal.map((item, index) => {
|
|
1139
1420
|
const menuKey = `menu-${index}`;
|
|
1140
1421
|
const isOpen = isMenuOpen(menuKey);
|
|
1141
1422
|
const isActive = activeMenuPath === menuKey;
|
|
1142
|
-
return /* @__PURE__ */
|
|
1423
|
+
return /* @__PURE__ */ import_react14.default.createElement("div", { key: index, className: "", id: `${id}-div-11` }, /* @__PURE__ */ import_react14.default.createElement(
|
|
1143
1424
|
"div",
|
|
1144
1425
|
{
|
|
1145
1426
|
className: `flex items-center gap-3 p-2.5 hover:bg-[#f4f4f5] dark:hover:bg-[#27272a] text-gray-700 dark:text-[#f4f4f5cc] cursor-pointer rounded-lg ml-2 mr-2 transition-colors duration-200 ${isActive ? "bg-[#f4f4f5] dark:bg-[#27272a]" : ""}`,
|
|
1146
|
-
onClick: (e) => handleMenuClick(item, index, e)
|
|
1427
|
+
onClick: (e) => handleMenuClick(item, index, e),
|
|
1428
|
+
id: `${id}-div-12`
|
|
1147
1429
|
},
|
|
1148
|
-
/* @__PURE__ */
|
|
1149
|
-
/* @__PURE__ */
|
|
1150
|
-
item.isDropDown && /* @__PURE__ */
|
|
1151
|
-
), item.options && item.options.length > 0 && /* @__PURE__ */
|
|
1430
|
+
/* @__PURE__ */ import_react14.default.createElement("div", { className: "text-primary", id: `${id}-div-13` }, /* @__PURE__ */ import_react14.default.createElement(item.Icon, { width: 20, height: 20, id: `${id}-icon-1` })),
|
|
1431
|
+
/* @__PURE__ */ import_react14.default.createElement("span", { className: "!font-medium !text-[16px] !text-[#000] dark:text-[#f4f4f5cc]", id: `${id}-span-1` }, item.label),
|
|
1432
|
+
item.isDropDown && /* @__PURE__ */ import_react14.default.createElement("div", { className: `ml-auto transition-all delay-75 ${isOpen ? "rotate-180" : ""}`, id: `${id}-div-14` }, /* @__PURE__ */ import_react14.default.createElement(import_lucide_react8.ChevronDown, { width: 20, height: 20, className: "text-gray-500 dark:text-gray-400" }))
|
|
1433
|
+
), item.options && item.options.length > 0 && /* @__PURE__ */ import_react14.default.createElement(
|
|
1152
1434
|
"div",
|
|
1153
1435
|
{
|
|
1154
|
-
className: `ml-[20px] overflow-hidden flex flex-col transition-all duration-200 ${isOpen ? "max-h-[1000px] min-h-[50px]" : "max-h-0"}
|
|
1436
|
+
className: `ml-[20px] overflow-hidden flex flex-col transition-all duration-200 ${isOpen ? "max-h-[1000px] min-h-[50px]" : "max-h-0"}`,
|
|
1437
|
+
id: `${id}-div-15`
|
|
1155
1438
|
},
|
|
1156
1439
|
item.options.map((options, optionsIndex) => {
|
|
1157
1440
|
const subMenuKey = `menu-${index}-option-${optionsIndex}`;
|
|
1158
1441
|
const isSubMenuOpen = isMenuOpen(subMenuKey);
|
|
1159
1442
|
const isSubActive = activeMenuPath === subMenuKey || (activeMenuPath == null ? void 0 : activeMenuPath.startsWith(`${subMenuKey}-`));
|
|
1160
1443
|
const isDisabled = options.isDisabled;
|
|
1161
|
-
return /* @__PURE__ */
|
|
1444
|
+
return /* @__PURE__ */ import_react14.default.createElement("div", { key: optionsIndex, className: "", id: `${id}-div-16-${optionsIndex}` }, /* @__PURE__ */ import_react14.default.createElement(
|
|
1162
1445
|
"div",
|
|
1163
1446
|
{
|
|
1164
1447
|
className: `group flex items-center gap-3 py-2 px-3 ml-4 mr-2 rounded-md transition-colors duration-200 ${isDisabled ? "cursor-not-allowed opacity-70 text-gray-400 dark:text-gray-500" : `hover:bg-[#f4f4f5] dark:hover:bg-[#27272a] text-gray-600 dark:text-[#a1a1aa] cursor-pointer ${isSubActive ? "bg-[#f4f4f5] dark:bg-[#27272a]" : ""}`}`,
|
|
@@ -1168,30 +1451,34 @@ var AppSideBar = ({
|
|
|
1168
1451
|
return;
|
|
1169
1452
|
}
|
|
1170
1453
|
handleSubMenuClick(options, optionsIndex, index, e);
|
|
1171
|
-
}
|
|
1454
|
+
},
|
|
1455
|
+
id: `${id}-div-17-${optionsIndex}`
|
|
1172
1456
|
},
|
|
1173
|
-
/* @__PURE__ */
|
|
1174
|
-
/* @__PURE__ */
|
|
1175
|
-
options.isDropDown && /* @__PURE__ */
|
|
1457
|
+
/* @__PURE__ */ import_react14.default.createElement("div", { id: `${id}-div-18-${optionsIndex}` }),
|
|
1458
|
+
/* @__PURE__ */ import_react14.default.createElement("span", { className: `!font-medium !text-[15px] ${isDisabled ? "!text-[#3f3f46cc] dark:!text-[#a1a1aa]" : "!text-[#3f3f46cc] dark:!text-[#a1a1aa]"}`, id: `${id}-span-2-${optionsIndex}` }, options.label),
|
|
1459
|
+
options.isDropDown && /* @__PURE__ */ import_react14.default.createElement(
|
|
1176
1460
|
"div",
|
|
1177
1461
|
{
|
|
1178
|
-
className: `ml-auto transition-all delay-75 ${isSubMenuOpen ? "rotate-180" : ""}
|
|
1462
|
+
className: `ml-auto transition-all delay-75 ${isSubMenuOpen ? "rotate-180" : ""}`,
|
|
1463
|
+
id: `${id}-div-19-${optionsIndex}`
|
|
1179
1464
|
},
|
|
1180
|
-
/* @__PURE__ */
|
|
1465
|
+
/* @__PURE__ */ import_react14.default.createElement(import_lucide_react8.ChevronDown, { width: 18, height: 18, className: "text-gray-400 dark:text-gray-500" })
|
|
1181
1466
|
)
|
|
1182
|
-
), options.options && options.options.length > 0 && /* @__PURE__ */
|
|
1467
|
+
), options.options && options.options.length > 0 && /* @__PURE__ */ import_react14.default.createElement(
|
|
1183
1468
|
"div",
|
|
1184
1469
|
{
|
|
1185
|
-
className: `ml-[20px] overflow-hidden flex flex-col transition-all duration-200 ${isSubMenuOpen ? "max-h-[1000px] min-h-[50px]" : "max-h-0"}
|
|
1470
|
+
className: `ml-[20px] overflow-hidden flex flex-col transition-all duration-200 ${isSubMenuOpen ? "max-h-[1000px] min-h-[50px]" : "max-h-0"}`,
|
|
1471
|
+
id: `${id}-div-20-${optionsIndex}`
|
|
1186
1472
|
},
|
|
1187
1473
|
options.options.map((subOption, subIndex) => {
|
|
1188
1474
|
const isSubSubActive = activeMenuPath === `menu-${index}-option-${optionsIndex}-sub-${subOption.label}`;
|
|
1189
|
-
return /* @__PURE__ */
|
|
1475
|
+
return /* @__PURE__ */ import_react14.default.createElement(
|
|
1190
1476
|
"div",
|
|
1191
1477
|
{
|
|
1192
1478
|
key: subIndex,
|
|
1193
1479
|
className: `py-1.5 px-3 rounded-md hover:bg-[#f4f4f5] dark:hover:bg-[#27272a] text-gray-500 dark:text-[#71717a] font-medium text-base cursor-pointer ml-8 mr-2 transition-colors duration-200 ${isSubSubActive ? "bg-[#f4f4f5] dark:bg-[#27272a]" : ""}`,
|
|
1194
|
-
onClick: (e) => handleSubSubMenuClick(subOption, index, optionsIndex, e)
|
|
1480
|
+
onClick: (e) => handleSubSubMenuClick(subOption, index, optionsIndex, e),
|
|
1481
|
+
id: `${id}-div-21-${subIndex}`
|
|
1195
1482
|
},
|
|
1196
1483
|
subOption.label
|
|
1197
1484
|
);
|
|
@@ -1200,22 +1487,58 @@ var AppSideBar = ({
|
|
|
1200
1487
|
})
|
|
1201
1488
|
));
|
|
1202
1489
|
}))),
|
|
1203
|
-
/* @__PURE__ */
|
|
1490
|
+
/* @__PURE__ */ import_react14.default.createElement("div", { ref: profileCardRef, className: "relative mt-auto bg-[#fafafa] dark:bg-[#18181b] sticky bottom-0 mt-2", id: `${id}-div-22` }, /* @__PURE__ */ import_react14.default.createElement(
|
|
1204
1491
|
"div",
|
|
1205
1492
|
{
|
|
1206
|
-
className: "flex items-center justify-between p-2 rounded-lg hover:bg-[#f4f4f5] dark:hover:bg-[#27272a] cursor-pointer transition-colors duration-200",
|
|
1207
|
-
onClick: () =>
|
|
1493
|
+
className: "group flex items-center justify-between p-2 rounded-lg hover:bg-[#f4f4f5] dark:hover:bg-[#27272a] cursor-pointer transition-colors duration-200",
|
|
1494
|
+
onClick: () => setIsSwitchProfileOpen((prev) => !prev),
|
|
1495
|
+
id: `${id}-div-23`
|
|
1496
|
+
},
|
|
1497
|
+
/* @__PURE__ */ import_react14.default.createElement("div", { className: "flex items-center gap-3", id: `${id}-div-24` }, /* @__PURE__ */ import_react14.default.createElement("span", { className: "relative flex shrink-0 overflow-hidden dark:bg-[#27272a] rounded-full h-10 w-10", id: `${id}-span-3` }, /* @__PURE__ */ import_react14.default.createElement("span", { className: "flex h-full w-full items-center justify-center !text-[16px] !font-normal border border-gray-200 dark:border-[#303036] rounded-full bg-muted dark:text-white", id: `${id}-span-4` }, cookieUserName ? cookieUserName.split("")[0] : "A")), /* @__PURE__ */ import_react14.default.createElement("div", { id: `${id}-div-25` }, /* @__PURE__ */ import_react14.default.createElement("p", { className: "!font-semibold dark:text-white !text-[16px]", id: `${id}-p-1` }, cookieUserName ? cookieUserName : "Admin"), /* @__PURE__ */ import_react14.default.createElement("p", { className: "!text-[14px] !font-normal dark:text-[#f4f4f5cc]", id: `${id}-p-2` }, SCOPE_LABELS[scope] ?? scope))),
|
|
1498
|
+
/* @__PURE__ */ import_react14.default.createElement(
|
|
1499
|
+
"span",
|
|
1500
|
+
{
|
|
1501
|
+
className: "opacity-0 group-hover:opacity-100 transition-opacity duration-200 !text-[14px] !font-bold text-blue-600 dark:text-blue-400 hover:underline",
|
|
1502
|
+
id: `${id}-span-switch`
|
|
1503
|
+
},
|
|
1504
|
+
"Switch"
|
|
1505
|
+
)
|
|
1506
|
+
), /* @__PURE__ */ import_react14.default.createElement(
|
|
1507
|
+
SwitchProfileSection,
|
|
1508
|
+
{
|
|
1509
|
+
id: `${id}-switch-profile`,
|
|
1510
|
+
open: isSwitchProfileOpen,
|
|
1511
|
+
anchorRef: profileCardRef,
|
|
1512
|
+
onClose: () => setIsSwitchProfileOpen(false),
|
|
1513
|
+
onManageProfile: () => {
|
|
1514
|
+
setIsSwitchProfileOpen(false);
|
|
1208
1515
|
window.location.href = "/profile";
|
|
1516
|
+
},
|
|
1517
|
+
onProfileSwitch: (profile) => {
|
|
1518
|
+
setIsSwitchProfileOpen(false);
|
|
1519
|
+
onProfileSwitch == null ? void 0 : onProfileSwitch(profile);
|
|
1520
|
+
},
|
|
1521
|
+
onTmcSettings: () => {
|
|
1522
|
+
setIsSwitchProfileOpen(false);
|
|
1523
|
+
onTmcSettings == null ? void 0 : onTmcSettings();
|
|
1524
|
+
},
|
|
1525
|
+
onLogout: () => {
|
|
1526
|
+
setIsSwitchProfileOpen(false);
|
|
1527
|
+
if (onLogout) {
|
|
1528
|
+
onLogout();
|
|
1529
|
+
} else {
|
|
1530
|
+
window.dispatchEvent(new Event("logout"));
|
|
1531
|
+
}
|
|
1209
1532
|
}
|
|
1210
|
-
}
|
|
1211
|
-
/* @__PURE__ */ import_react12.default.createElement("div", { className: "flex items-center gap-3" }, /* @__PURE__ */ import_react12.default.createElement("span", { className: "relative flex shrink-0 overflow-hidden dark:bg-[#27272a] rounded-full h-10 w-10" }, /* @__PURE__ */ import_react12.default.createElement("span", { className: "flex h-full w-full items-center justify-center !text-[16px] !font-normal border border-gray-200 dark:border-[#303036] rounded-full bg-muted dark:text-white" }, cookieUserName ? cookieUserName.split("")[0] : "A")), /* @__PURE__ */ import_react12.default.createElement("div", null, /* @__PURE__ */ import_react12.default.createElement("p", { className: "!font-semibold dark:text-white !text-[16px]" }, cookieUserName ? cookieUserName : "Admin"), /* @__PURE__ */ import_react12.default.createElement("p", { className: "!text-[14px] !font-normal dark:text-[#f4f4f5cc]" }, SCOPE_LABELS[scope] ?? scope)))
|
|
1533
|
+
}
|
|
1212
1534
|
))
|
|
1213
1535
|
));
|
|
1214
1536
|
};
|
|
1215
1537
|
|
|
1216
1538
|
// src/RightSheet/RightSheet.jsx
|
|
1217
|
-
var
|
|
1539
|
+
var import_react15 = __toESM(require("react"));
|
|
1218
1540
|
var RightSheet = ({
|
|
1541
|
+
id = "right-sheet",
|
|
1219
1542
|
open,
|
|
1220
1543
|
setOpen,
|
|
1221
1544
|
children,
|
|
@@ -1224,8 +1547,8 @@ var RightSheet = ({
|
|
|
1224
1547
|
onAction = () => {
|
|
1225
1548
|
}
|
|
1226
1549
|
}) => {
|
|
1227
|
-
const [visible, setVisible] = (0,
|
|
1228
|
-
(0,
|
|
1550
|
+
const [visible, setVisible] = (0, import_react15.useState)(open);
|
|
1551
|
+
(0, import_react15.useEffect)(() => {
|
|
1229
1552
|
if (open) {
|
|
1230
1553
|
document.body.style.overflow = "hidden";
|
|
1231
1554
|
setVisible(true);
|
|
@@ -1246,65 +1569,72 @@ var RightSheet = ({
|
|
|
1246
1569
|
handleClose();
|
|
1247
1570
|
};
|
|
1248
1571
|
if (!visible) return null;
|
|
1249
|
-
return /* @__PURE__ */
|
|
1572
|
+
return /* @__PURE__ */ import_react15.default.createElement(
|
|
1250
1573
|
"div",
|
|
1251
1574
|
{
|
|
1252
1575
|
className: "fixed inset-0 overflow-x-hidden bg-black/80 sheetPopIn h-full overflow-auto ",
|
|
1253
|
-
onClick: handleClose
|
|
1576
|
+
onClick: handleClose,
|
|
1577
|
+
id: `${id}-div-1`
|
|
1254
1578
|
},
|
|
1255
|
-
/* @__PURE__ */
|
|
1579
|
+
/* @__PURE__ */ import_react15.default.createElement(
|
|
1256
1580
|
"div",
|
|
1257
1581
|
{
|
|
1258
1582
|
className: `absolute flex flex-col right-0 top-0 min-h-full min-w-[100%] md:min-w-[576px]
|
|
1259
1583
|
${visible ? "sheetRightSlide" : "transition-all duration-200 translate-x-[100%]"} justify-between bg-[#fff] dark:bg-[#18181b] dark:text-white`,
|
|
1260
|
-
onClick: (e) => e.stopPropagation()
|
|
1584
|
+
onClick: (e) => e.stopPropagation(),
|
|
1585
|
+
id: `${id}-div-2`
|
|
1261
1586
|
},
|
|
1262
|
-
/* @__PURE__ */
|
|
1263
|
-
/* @__PURE__ */
|
|
1587
|
+
/* @__PURE__ */ import_react15.default.createElement("div", { className: " min-h-full ", id: `${id}-div-3` }, children),
|
|
1588
|
+
/* @__PURE__ */ import_react15.default.createElement("div", { className: "h-[90px] flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2 p-6 border-t sticky bottom-0 bg-white border-[#e6e6e6] dark:border-[#303036] dark:bg-[#18181b] dark:text-white", id: `${id}-div-4` }, /* @__PURE__ */ import_react15.default.createElement(CustomButton, { variant: "SECONDARY", onClick: () => handleClose(), id: `${id}-custom-button-1` }, "Cancel"), /* @__PURE__ */ import_react15.default.createElement(CustomButton, { variant: "SECONDARY", onClick: handleAction, id: `${id}-custom-button-2` }, actionLabel))
|
|
1264
1589
|
)
|
|
1265
1590
|
);
|
|
1266
1591
|
};
|
|
1267
1592
|
|
|
1268
1593
|
// src/Table/CustomTable.jsx
|
|
1269
|
-
var
|
|
1594
|
+
var import_react16 = __toESM(require("react"));
|
|
1270
1595
|
var CustomTable = ({
|
|
1596
|
+
id = "custom-table",
|
|
1271
1597
|
tableHeader,
|
|
1272
1598
|
setIsAllChecked,
|
|
1273
1599
|
isAllChecked,
|
|
1274
1600
|
children,
|
|
1275
1601
|
isHideCheckbox = "false"
|
|
1276
1602
|
}) => {
|
|
1277
|
-
return /* @__PURE__ */
|
|
1603
|
+
return /* @__PURE__ */ import_react16.default.createElement("div", { className: "border border-[#e5e5e5] dark:border-[#303036] rounded-lg overflow-x-auto", id: `${id}-div-1` }, /* @__PURE__ */ import_react16.default.createElement("div", { className: "w-full relative overflow-x-auto", id: `${id}-div-2` }, /* @__PURE__ */ import_react16.default.createElement("table", { className: "w-full caption-bottom text-sm overflow-x-auto bg-white dark:bg-[#18181b] table-fixed border-collapse", id: `${id}-table-1` }, /* @__PURE__ */ import_react16.default.createElement("thead", { className: "border-b border-[#e5e5e5] dark:border-[#303036] dark:bg-[#18181b]", id: `${id}-thead-1` }, /* @__PURE__ */ import_react16.default.createElement(
|
|
1278
1604
|
"tr",
|
|
1279
1605
|
{
|
|
1280
|
-
className: "transition-colors text-[#737373] hover:bg-muted/50 \r\n data-[state=selected]:bg-muted"
|
|
1606
|
+
className: "transition-colors text-[#737373] hover:bg-muted/50 \r\n data-[state=selected]:bg-muted",
|
|
1607
|
+
id: `${id}-tr-1`
|
|
1281
1608
|
},
|
|
1282
|
-
!isHideCheckbox && /* @__PURE__ */
|
|
1609
|
+
!isHideCheckbox && /* @__PURE__ */ import_react16.default.createElement("th", { className: "px-4 py-3 text-left w-[50px]", id: `${id}-th-1` }, /* @__PURE__ */ import_react16.default.createElement(
|
|
1283
1610
|
CustomCheckbox,
|
|
1284
1611
|
{
|
|
1285
1612
|
checked: isAllChecked,
|
|
1286
1613
|
onChange: () => {
|
|
1287
1614
|
setIsAllChecked(!isAllChecked);
|
|
1288
|
-
}
|
|
1615
|
+
},
|
|
1616
|
+
id: `${id}-custom-checkbox-1`
|
|
1289
1617
|
}
|
|
1290
1618
|
)),
|
|
1291
1619
|
tableHeader.map((header, index) => {
|
|
1292
|
-
return /* @__PURE__ */
|
|
1620
|
+
return /* @__PURE__ */ import_react16.default.createElement(
|
|
1293
1621
|
"th",
|
|
1294
1622
|
{
|
|
1295
1623
|
className: `text-[#737373] px-4 py-3 text-sm dark:bg-[#18181b] font-medium ${index == tableHeader.length - 1 ? "text-right" : "text-left"}`,
|
|
1296
|
-
key: header + index
|
|
1624
|
+
key: header + index,
|
|
1625
|
+
id: `${id}-th-2-${index}`
|
|
1297
1626
|
},
|
|
1298
1627
|
header
|
|
1299
1628
|
);
|
|
1300
1629
|
})
|
|
1301
|
-
)), /* @__PURE__ */
|
|
1630
|
+
)), /* @__PURE__ */ import_react16.default.createElement("tbody", { id: `${id}-tbody-1` }, children))));
|
|
1302
1631
|
};
|
|
1303
1632
|
|
|
1304
1633
|
// src/Pagination/Pagination.jsx
|
|
1305
|
-
var
|
|
1306
|
-
var
|
|
1634
|
+
var import_react17 = __toESM(require("react"));
|
|
1635
|
+
var import_lucide_react9 = require("lucide-react");
|
|
1307
1636
|
var Pagination = ({
|
|
1637
|
+
id = "pagination",
|
|
1308
1638
|
data = [],
|
|
1309
1639
|
component: Component,
|
|
1310
1640
|
itemsPerPage = 6,
|
|
@@ -1326,26 +1656,26 @@ var Pagination = ({
|
|
|
1326
1656
|
componentProps = {},
|
|
1327
1657
|
...restProps
|
|
1328
1658
|
}) => {
|
|
1329
|
-
const [internalCurrentPage, setInternalCurrentPage] = (0,
|
|
1330
|
-
const [internalItemsPerPage, setInternalItemsPerPage] = (0,
|
|
1659
|
+
const [internalCurrentPage, setInternalCurrentPage] = (0, import_react17.useState)(1);
|
|
1660
|
+
const [internalItemsPerPage, setInternalItemsPerPage] = (0, import_react17.useState)(itemsPerPage);
|
|
1331
1661
|
const isControlled = controlledCurrentPage !== void 0;
|
|
1332
1662
|
const isItemsPerPageControlled = controlledOnItemsPerPageChange !== void 0;
|
|
1333
1663
|
const currentPage = isControlled ? controlledCurrentPage : internalCurrentPage;
|
|
1334
1664
|
const activeItemsPerPage = isItemsPerPageControlled ? itemsPerPage : internalItemsPerPage;
|
|
1335
1665
|
const totalItems = legacyTotalItems !== void 0 ? legacyTotalItems : data.length;
|
|
1336
|
-
const calculatedTotalPages = (0,
|
|
1666
|
+
const calculatedTotalPages = (0, import_react17.useMemo)(() => {
|
|
1337
1667
|
if (totalItems > 0 && activeItemsPerPage > 0) {
|
|
1338
1668
|
return Math.ceil(totalItems / activeItemsPerPage);
|
|
1339
1669
|
}
|
|
1340
1670
|
return 1;
|
|
1341
1671
|
}, [totalItems, activeItemsPerPage]);
|
|
1342
|
-
const paginatedData = (0,
|
|
1672
|
+
const paginatedData = (0, import_react17.useMemo)(() => {
|
|
1343
1673
|
if (!data || data.length === 0) return [];
|
|
1344
1674
|
const startIndex = (currentPage - 1) * activeItemsPerPage;
|
|
1345
1675
|
const endIndex = startIndex + activeItemsPerPage;
|
|
1346
1676
|
return data.slice(startIndex, endIndex);
|
|
1347
1677
|
}, [data, currentPage, activeItemsPerPage]);
|
|
1348
|
-
(0,
|
|
1678
|
+
(0, import_react17.useEffect)(() => {
|
|
1349
1679
|
if (!isControlled && currentPage > calculatedTotalPages && calculatedTotalPages > 0) {
|
|
1350
1680
|
setInternalCurrentPage(1);
|
|
1351
1681
|
}
|
|
@@ -1378,46 +1708,50 @@ var Pagination = ({
|
|
|
1378
1708
|
const endItem = totalItems !== void 0 ? Math.min(currentPage * activeItemsPerPage, totalItems) : null;
|
|
1379
1709
|
const renderContent = () => {
|
|
1380
1710
|
if (Component) {
|
|
1381
|
-
if (
|
|
1711
|
+
if (import_react17.default.isValidElement(Component)) {
|
|
1382
1712
|
const ComponentType = Component.type;
|
|
1383
1713
|
const elementProps = Component.props;
|
|
1384
1714
|
if (isTable) {
|
|
1385
|
-
return /* @__PURE__ */
|
|
1715
|
+
return /* @__PURE__ */ import_react17.default.createElement(
|
|
1386
1716
|
CustomTable,
|
|
1387
1717
|
{
|
|
1388
1718
|
tableHeader,
|
|
1389
|
-
isHideCheckbox
|
|
1719
|
+
isHideCheckbox,
|
|
1720
|
+
id: `${id}-custom-table-1`
|
|
1390
1721
|
},
|
|
1391
1722
|
data.map((item, index) => {
|
|
1392
|
-
return /* @__PURE__ */
|
|
1723
|
+
return /* @__PURE__ */ import_react17.default.createElement(
|
|
1393
1724
|
ComponentType,
|
|
1394
1725
|
{
|
|
1395
1726
|
key: item.id || item._id || index,
|
|
1396
1727
|
data: item,
|
|
1397
1728
|
...elementProps,
|
|
1398
1729
|
...componentProps,
|
|
1399
|
-
...restProps
|
|
1730
|
+
...restProps,
|
|
1731
|
+
id: `${id}-component-type-1-${index}`
|
|
1400
1732
|
}
|
|
1401
1733
|
);
|
|
1402
1734
|
})
|
|
1403
1735
|
);
|
|
1404
1736
|
} else {
|
|
1405
1737
|
if (isTable) {
|
|
1406
|
-
return /* @__PURE__ */
|
|
1738
|
+
return /* @__PURE__ */ import_react17.default.createElement(
|
|
1407
1739
|
CustomTable,
|
|
1408
1740
|
{
|
|
1409
1741
|
tableHeader,
|
|
1410
|
-
isHideCheckbox
|
|
1742
|
+
isHideCheckbox,
|
|
1743
|
+
id: `${id}-custom-table-2`
|
|
1411
1744
|
},
|
|
1412
1745
|
paginatedData.map((item, index) => {
|
|
1413
|
-
return /* @__PURE__ */
|
|
1746
|
+
return /* @__PURE__ */ import_react17.default.createElement(
|
|
1414
1747
|
ComponentType,
|
|
1415
1748
|
{
|
|
1416
1749
|
key: item.id || item._id || index,
|
|
1417
1750
|
data: item,
|
|
1418
1751
|
...elementProps,
|
|
1419
1752
|
...componentProps,
|
|
1420
|
-
...restProps
|
|
1753
|
+
...restProps,
|
|
1754
|
+
id: `${id}-component-type-2-${index}`
|
|
1421
1755
|
}
|
|
1422
1756
|
);
|
|
1423
1757
|
})
|
|
@@ -1425,20 +1759,22 @@ var Pagination = ({
|
|
|
1425
1759
|
}
|
|
1426
1760
|
}
|
|
1427
1761
|
} else {
|
|
1428
|
-
return /* @__PURE__ */
|
|
1762
|
+
return /* @__PURE__ */ import_react17.default.createElement(
|
|
1429
1763
|
CustomTable,
|
|
1430
1764
|
{
|
|
1431
1765
|
tableHeader,
|
|
1432
|
-
isHideCheckbox
|
|
1766
|
+
isHideCheckbox,
|
|
1767
|
+
id: `${id}-custom-table-3`
|
|
1433
1768
|
},
|
|
1434
1769
|
paginatedData.map((item, index) => {
|
|
1435
|
-
return /* @__PURE__ */
|
|
1770
|
+
return /* @__PURE__ */ import_react17.default.createElement(
|
|
1436
1771
|
Component,
|
|
1437
1772
|
{
|
|
1438
1773
|
key: item.id || item._id || index,
|
|
1439
1774
|
data: item,
|
|
1440
1775
|
...componentProps,
|
|
1441
|
-
...restProps
|
|
1776
|
+
...restProps,
|
|
1777
|
+
id: `${id}-component-1-${index}`
|
|
1442
1778
|
}
|
|
1443
1779
|
);
|
|
1444
1780
|
})
|
|
@@ -1447,50 +1783,55 @@ var Pagination = ({
|
|
|
1447
1783
|
}
|
|
1448
1784
|
return null;
|
|
1449
1785
|
};
|
|
1450
|
-
return /* @__PURE__ */
|
|
1786
|
+
return /* @__PURE__ */ import_react17.default.createElement(import_react17.default.Fragment, null, /* @__PURE__ */ import_react17.default.createElement(import_react17.default.Fragment, null, renderContent()), /* @__PURE__ */ import_react17.default.createElement("div", { className: "flex flex-col sm:flex-row justify-between items-center gap-4 px-4 py-3 border-t border-[#e5e5e5] dark:border-[#303036] bg-white dark:bg-[#18181b] z-10", id: `${id}-div-1` }, totalItems !== void 0 && /* @__PURE__ */ import_react17.default.createElement("div", { className: "text-sm text-[#737373] dark:text-white", id: `${id}-div-2` }, "Showing ", startItem, " to ", endItem, " of ", totalItems, " entries"), /* @__PURE__ */ import_react17.default.createElement("div", { className: "flex items-center gap-2", id: `${id}-div-3` }, /* @__PURE__ */ import_react17.default.createElement(
|
|
1451
1787
|
"button",
|
|
1452
1788
|
{
|
|
1453
1789
|
onClick: () => handlePageChange(1),
|
|
1454
1790
|
disabled: currentPage === 1,
|
|
1455
1791
|
className: `flex items-center justify-center w-9 h-9 rounded-md border border-[#e5e5e5] dark:border-[#303036] text-sm transition-colors ${currentPage === 1 ? "bg-gray-100 text-gray-400 cursor-not-allowed dark:bg-[#27272a] dark:text-gray-600" : "bg-white text-black hover:bg-gray-50 cursor-pointer dark:bg-[#18181b] dark:text-white dark:hover:bg-[#27272a]"}`,
|
|
1456
|
-
title: "First page"
|
|
1792
|
+
title: "First page",
|
|
1793
|
+
id: `${id}-button-1`
|
|
1457
1794
|
},
|
|
1458
|
-
/* @__PURE__ */
|
|
1459
|
-
), /* @__PURE__ */
|
|
1795
|
+
/* @__PURE__ */ import_react17.default.createElement(import_lucide_react9.ChevronsLeft, { size: 16 })
|
|
1796
|
+
), /* @__PURE__ */ import_react17.default.createElement(
|
|
1460
1797
|
"button",
|
|
1461
1798
|
{
|
|
1462
1799
|
onClick: () => handlePageChange(currentPage - 1),
|
|
1463
1800
|
disabled: currentPage === 1,
|
|
1464
1801
|
className: `flex items-center justify-center w-9 h-9 rounded-md border border-[#e5e5e5] dark:border-[#303036] text-sm transition-colors ${currentPage === 1 ? "bg-gray-100 text-gray-400 cursor-not-allowed dark:bg-[#27272a] dark:text-gray-600" : "bg-white text-black hover:bg-gray-50 cursor-pointer dark:bg-[#18181b] dark:text-white dark:hover:bg-[#27272a]"}`,
|
|
1465
|
-
title: "Previous page"
|
|
1802
|
+
title: "Previous page",
|
|
1803
|
+
id: `${id}-button-2`
|
|
1466
1804
|
},
|
|
1467
|
-
/* @__PURE__ */
|
|
1468
|
-
), getPageNumbers().map((pageNum) => /* @__PURE__ */
|
|
1805
|
+
/* @__PURE__ */ import_react17.default.createElement(import_lucide_react9.ChevronLeft, { size: 16 })
|
|
1806
|
+
), getPageNumbers().map((pageNum) => /* @__PURE__ */ import_react17.default.createElement(
|
|
1469
1807
|
"button",
|
|
1470
1808
|
{
|
|
1471
1809
|
key: pageNum,
|
|
1472
1810
|
onClick: () => handlePageChange(pageNum),
|
|
1473
|
-
className: `flex items-center justify-center min-w-9 h-9 px-3 cursor-pointer rounded-md border border-[#e5e5e5] dark:border-[#303036] text-sm transition-colors ${currentPage === pageNum ? "bg-primary text-white border-primary dark:bg-primary" : "bg-white text-black hover:bg-gray-50 dark:bg-[#18181b] dark:text-white dark:hover:bg-[#27272a]"}
|
|
1811
|
+
className: `flex items-center justify-center min-w-9 h-9 px-3 cursor-pointer rounded-md border border-[#e5e5e5] dark:border-[#303036] text-sm transition-colors ${currentPage === pageNum ? "bg-primary text-white border-primary dark:bg-primary" : "bg-white text-black hover:bg-gray-50 dark:bg-[#18181b] dark:text-white dark:hover:bg-[#27272a]"}`,
|
|
1812
|
+
id: `${id}-button-3`
|
|
1474
1813
|
},
|
|
1475
1814
|
pageNum
|
|
1476
|
-
)), /* @__PURE__ */
|
|
1815
|
+
)), /* @__PURE__ */ import_react17.default.createElement(
|
|
1477
1816
|
"button",
|
|
1478
1817
|
{
|
|
1479
1818
|
onClick: () => handlePageChange(currentPage + 1),
|
|
1480
1819
|
disabled: currentPage === calculatedTotalPages || calculatedTotalPages === 0,
|
|
1481
1820
|
className: `flex items-center justify-center w-9 h-9 rounded-md border border-[#e5e5e5] dark:border-[#303036] text-sm transition-colors ${currentPage === calculatedTotalPages || calculatedTotalPages === 0 ? "bg-gray-100 text-gray-400 cursor-not-allowed dark:bg-[#27272a] dark:text-gray-600" : "bg-white text-black hover:bg-gray-50 cursor-pointer dark:bg-[#18181b] dark:text-white dark:hover:bg-[#27272a]"}`,
|
|
1482
|
-
title: "Next page"
|
|
1821
|
+
title: "Next page",
|
|
1822
|
+
id: `${id}-button-4`
|
|
1483
1823
|
},
|
|
1484
|
-
/* @__PURE__ */
|
|
1485
|
-
), /* @__PURE__ */
|
|
1824
|
+
/* @__PURE__ */ import_react17.default.createElement(import_lucide_react9.ChevronRight, { size: 16 })
|
|
1825
|
+
), /* @__PURE__ */ import_react17.default.createElement(
|
|
1486
1826
|
"button",
|
|
1487
1827
|
{
|
|
1488
1828
|
onClick: () => handlePageChange(calculatedTotalPages),
|
|
1489
1829
|
disabled: currentPage === calculatedTotalPages || calculatedTotalPages === 0,
|
|
1490
1830
|
className: `flex items-center justify-center w-9 h-9 rounded-md border border-[#e5e5e5] dark:border-[#303036] text-sm transition-colors ${currentPage === calculatedTotalPages || calculatedTotalPages === 0 ? "bg-gray-100 text-gray-400 cursor-not-allowed dark:bg-[#27272a] dark:text-gray-600" : "bg-white text-black hover:bg-gray-50 cursor-pointer dark:bg-[#18181b] dark:text-white dark:hover:bg-[#27272a]"}`,
|
|
1491
|
-
title: "Last page"
|
|
1831
|
+
title: "Last page",
|
|
1832
|
+
id: `${id}-button-5`
|
|
1492
1833
|
},
|
|
1493
|
-
/* @__PURE__ */
|
|
1834
|
+
/* @__PURE__ */ import_react17.default.createElement(import_lucide_react9.ChevronsRight, { size: 16 })
|
|
1494
1835
|
))));
|
|
1495
1836
|
};
|
|
1496
1837
|
// Annotate the CommonJS export names for ESM import in node:
|