jett.admin.npmpackage 2.0.1 → 2.0.2

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.
Files changed (4) hide show
  1. package/dist/index.css +1434 -1434
  2. package/dist/index.js +1430 -1430
  3. package/dist/index.mjs +1395 -1395
  4. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,1430 +1,1430 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
- // If the importer is in node compatibility mode or this is not an ESM
21
- // file that has been converted to a CommonJS file using a Babel-
22
- // compatible transform (i.e. "__esModule" has not been set), then set
23
- // "default" to the CommonJS "module.exports" for node compatibility.
24
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
- mod
26
- ));
27
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
-
29
- // src/index.js
30
- var index_exports = {};
31
- __export(index_exports, {
32
- AppSideBar: () => AppSideBar,
33
- Chip: () => Chip,
34
- CustomAutocomplete: () => CustomAutocomplete,
35
- CustomButton: () => CustomButton,
36
- CustomCheckbox: () => CustomCheckbox,
37
- CustomInput: () => CustomInput,
38
- CustomSearch: () => CustomSearch,
39
- CustomSelect: () => CustomSelect,
40
- CustomSwitch: () => CustomSwitch,
41
- CustomTable: () => CustomTable,
42
- CustomTextarea: () => CustomTextarea,
43
- CustomUpload: () => CustomUpload,
44
- Pagination: () => Pagination,
45
- ProgressBar: () => ProgressBar,
46
- RightSheet: () => RightSheet
47
- });
48
- module.exports = __toCommonJS(index_exports);
49
-
50
- // src/utils/cn.ts
51
- var import_clsx = require("clsx");
52
- var import_tailwind_merge = require("tailwind-merge");
53
- function cn(...inputs) {
54
- return (0, import_tailwind_merge.twMerge)((0, import_clsx.clsx)(inputs));
55
- }
56
-
57
- // src/Button.jsx
58
- var import_react = __toESM(require("react"));
59
- var variantStyles = {
60
- PRIMARY: "bg-white dark:bg-[#18181b] dark:text-white",
61
- SECONDARY: "bg-primary text-white dark:text-white",
62
- DEFAULT: "bg-white text-black dark:text-white",
63
- DANGER: "bg-[#ef4444] text-white dark:text-white"
64
- };
65
- var CustomButton = ({
66
- variant = "DEFAULT",
67
- children,
68
- className,
69
- onClick,
70
- disabled = false,
71
- icon
72
- }) => {
73
- return /* @__PURE__ */ import_react.default.createElement(
74
- "div",
75
- {
76
- className: cn(
77
- `cursor-pointer flex items-center py-2 px-3 min-h-10 justify-center border rounded-[6px] border-[#e5e5e5] dark:border-[#303036] ${variant == "DANGER" ? "bg-[#ef4444]" : "dark:bg-[#1d1d20]"} gap-2`,
78
- variantStyles[variant],
79
- className
80
- ),
81
- onClick
82
- },
83
- icon && /* @__PURE__ */ import_react.default.createElement("div", null, icon),
84
- children
85
- );
86
- };
87
-
88
- // src/inputs/Autocomplete.jsx
89
- var import_react2 = __toESM(require("react"));
90
- var import_lucide_react = require("lucide-react");
91
- var CustomAutocomplete = ({
92
- label,
93
- value,
94
- onChange,
95
- options,
96
- placeholder = "Search & select...",
97
- isRequired = false,
98
- error,
99
- heading,
100
- disabled = false
101
- }) => {
102
- const [open, setOpen] = (0, import_react2.useState)(false);
103
- const [search, setSearch] = (0, import_react2.useState)("");
104
- const wrapperRef = (0, import_react2.useRef)(null);
105
- const selectedOptions = options.filter((opt) => value.includes(opt.value));
106
- const handleBlur = (e) => {
107
- var _a;
108
- if (!((_a = wrapperRef.current) == null ? void 0 : _a.contains(e.relatedTarget))) {
109
- setOpen(false);
110
- }
111
- };
112
- const filteredOptions = options.filter(
113
- (opt) => opt.label.toLowerCase().includes(search.toLowerCase())
114
- );
115
- const toggleValue = (val) => {
116
- if (value.includes(val)) {
117
- onChange(value.filter((v) => v !== val));
118
- } else {
119
- onChange([...value, val]);
120
- }
121
- };
122
- return /* @__PURE__ */ import_react2.default.createElement(
123
- "div",
124
- {
125
- className: "flex flex-col w-full relative dark:bg-[#18181b] dark:text-white",
126
- ref: wrapperRef,
127
- tabIndex: disabled ? -1 : 0,
128
- onBlur: handleBlur
129
- },
130
- heading && /* @__PURE__ */ import_react2.default.createElement("h3", { className: "text-lg font-semibold leading-6 mb-1" }, heading),
131
- label && /* @__PURE__ */ import_react2.default.createElement(
132
- "label",
133
- {
134
- className: `font-[500] text-sm leading-5 mb-1 ${heading ? "text-[#737373]" : "text-black dark:text-white"}`
135
- },
136
- label,
137
- " ",
138
- isRequired && /* @__PURE__ */ import_react2.default.createElement("span", { className: "text-red-500" }, "*")
139
- ),
140
- /* @__PURE__ */ import_react2.default.createElement(
141
- "div",
142
- {
143
- onClick: () => {
144
- if (!disabled) setOpen((prev) => !prev);
145
- },
146
- 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
- ${disabled ? "bg-gray-100 cursor-not-allowed text-gray-400" : "cursor-text"}
148
- ${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
- `
150
- },
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(
152
- "span",
153
- {
154
- 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"
156
- },
157
- opt.label,
158
- /* @__PURE__ */ import_react2.default.createElement(
159
- "button",
160
- {
161
- onClick: (e) => {
162
- e.stopPropagation();
163
- toggleValue(opt.value);
164
- },
165
- className: "text-gray-500 hover:text-gray-700 dark:text-white cursor-pointer dark:hover:text-white"
166
- },
167
- "\u2715"
168
- )
169
- )) : /* @__PURE__ */ import_react2.default.createElement("span", { className: "text-gray-400" }, placeholder)),
170
- /* @__PURE__ */ import_react2.default.createElement(
171
- import_lucide_react.ChevronDown,
172
- {
173
- className: `w-4 h-4 text-gray-500 transition-transform ${open ? "rotate-180" : ""}`
174
- }
175
- )
176
- ),
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(
178
- "input",
179
- {
180
- type: "text",
181
- value: search,
182
- onChange: (e) => setSearch(e.target.value),
183
- placeholder: "Search...",
184
- className: "flex-1 text-sm focus:outline-none"
185
- }
186
- )), /* @__PURE__ */ import_react2.default.createElement("ul", null, filteredOptions.length > 0 ? filteredOptions.map((opt) => {
187
- const selected = value.includes(opt.value);
188
- return /* @__PURE__ */ import_react2.default.createElement(
189
- "li",
190
- {
191
- key: opt.value,
192
- 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" : ""}`
194
- },
195
- /* @__PURE__ */ import_react2.default.createElement(
196
- "span",
197
- {
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"}`
199
- },
200
- selected && /* @__PURE__ */ import_react2.default.createElement(import_lucide_react.Check, { size: 14 })
201
- ),
202
- opt.label
203
- );
204
- }) : /* @__PURE__ */ import_react2.default.createElement("li", { className: "px-3 py-2 text-sm text-gray-400" }, "No results found")))
205
- );
206
- };
207
-
208
- // src/inputs/Checkbox.jsx
209
- var import_react3 = __toESM(require("react"));
210
- var CustomCheckbox = ({ onChange, checked }) => {
211
- const handleChange = (e) => {
212
- onChange(e.target.checked);
213
- };
214
- return /* @__PURE__ */ import_react3.default.createElement("label", { className: "inline-flex items-center cursor-pointer select-none" }, /* @__PURE__ */ import_react3.default.createElement(
215
- "input",
216
- {
217
- type: "checkbox",
218
- checked,
219
- onChange: handleChange,
220
- className: "peer hidden"
221
- }
222
- ), /* @__PURE__ */ import_react3.default.createElement(
223
- "span",
224
- {
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 "
226
- },
227
- checked && /* @__PURE__ */ import_react3.default.createElement(
228
- "svg",
229
- {
230
- className: "w-4 h-4 text-white",
231
- fill: "none",
232
- stroke: "currentColor",
233
- strokeWidth: "3",
234
- viewBox: "0 0 24 24"
235
- },
236
- /* @__PURE__ */ import_react3.default.createElement("path", { d: "M5 13l4 4L19 7" })
237
- )
238
- ));
239
- };
240
-
241
- // src/inputs/Chip.jsx
242
- var import_react4 = __toESM(require("react"));
243
- var VARIANTS = {
244
- PRIMARY: "bg-gray-100 text-black dark:bg-gray-800 dark:text-white",
245
- GREEN: "bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-100",
246
- RED: "bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-100",
247
- YELLOW: "bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-100"
248
- };
249
- var Chip = ({ label, variant }) => {
250
- return /* @__PURE__ */ import_react4.default.createElement(
251
- "div",
252
- {
253
- className: `inline-flex text-[12px] items-center px-3 py-1 rounded-full ${VARIANTS[variant] || VARIANTS.PRIMARY} text-sm font-[600]`
254
- },
255
- label
256
- );
257
- };
258
-
259
- // src/inputs/CustomSwitch.jsx
260
- var import_react5 = __toESM(require("react"));
261
- var CustomSwitch = ({ checked, onChange, label, description }) => {
262
- return /* @__PURE__ */ import_react5.default.createElement("div", null, /* @__PURE__ */ import_react5.default.createElement(
263
- "button",
264
- {
265
- type: "button",
266
- role: "switch",
267
- "aria-checked": checked,
268
- 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"}`
270
- },
271
- /* @__PURE__ */ import_react5.default.createElement(
272
- "span",
273
- {
274
- className: `inline-block h-4 w-4 transform rounded-full bg-white shadow transition ${checked ? "translate-x-6" : "translate-x-1"}`
275
- }
276
- )
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)));
278
- };
279
-
280
- // src/inputs/Input.jsx
281
- var import_react6 = __toESM(require("react"));
282
- var CustomInput = ({
283
- label,
284
- isRequired,
285
- value,
286
- onChange,
287
- placeholder,
288
- disabled = false,
289
- error,
290
- heading
291
- }) => {
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(
293
- "label",
294
- {
295
- className: `font-[500] text-sm ${heading ? "text-[#737373]" : "text-black"} dark:text-white`
296
- },
297
- label,
298
- " ",
299
- isRequired && /* @__PURE__ */ import_react6.default.createElement("span", { className: "text-red-500" }, "*")
300
- ), /* @__PURE__ */ import_react6.default.createElement(
301
- "input",
302
- {
303
- className: `border border-gray-200 rounded-md h-10 px-4 py-2 w-full text-[14px]
304
- focus:outline-2 outline-black dark:outline-white outline-offset-2
305
- dark:bg-transparent dark:text-white dark:border-[#303036]
306
- ${disabled ? "bg-gray-100 cursor-not-allowed text-gray-500 border-gray-300" : error ? "border-red-500 bg-red-50" : "bg-white border-[hsl(0_0%_89.8%)]"}
307
- `,
308
- value,
309
- onChange: (e) => onChange == null ? void 0 : onChange(e.target.value),
310
- placeholder,
311
- disabled,
312
- readOnly: disabled
313
- }
314
- ));
315
- };
316
-
317
- // src/inputs/ProgressBar.jsx
318
- var import_react7 = __toESM(require("react"));
319
- var ProgressBar = ({ step, totalSteps }) => {
320
- 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(
322
- "div",
323
- {
324
- className: "bg-black h-2 rounded-full transition-all duration-300",
325
- style: { width: `${progress}%` }
326
- }
327
- )));
328
- };
329
-
330
- // src/inputs/Search.jsx
331
- var import_react8 = __toESM(require("react"));
332
- var import_lucide_react2 = require("lucide-react");
333
- var CustomSearch = ({
334
- value,
335
- onChange,
336
- placeholder = "Search Markets..."
337
- }) => {
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(
339
- "input",
340
- {
341
- type: "text",
342
- value,
343
- onChange,
344
- placeholder,
345
- className: "bg-transparent w-full h-full focus:outline-none"
346
- }
347
- ));
348
- };
349
-
350
- // src/inputs/TextArea.jsx
351
- var import_react9 = __toESM(require("react"));
352
- var CustomTextarea = ({
353
- label,
354
- isRequired,
355
- value,
356
- onChange,
357
- placeholder,
358
- disabled = false,
359
- error,
360
- heading,
361
- rows = 4
362
- }) => {
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(
364
- "label",
365
- {
366
- className: `font-[500] text-sm ${heading ? "text-[#737373]" : "text-black"}`
367
- },
368
- label,
369
- " ",
370
- isRequired && /* @__PURE__ */ import_react9.default.createElement("span", { className: "text-red-500" }, "*")
371
- ), /* @__PURE__ */ import_react9.default.createElement(
372
- "textarea",
373
- {
374
- rows,
375
- className: `border rounded-md px-4 py-2 w-full text-[14px]
376
- focus:outline-2 focus:outline-black focus:outline-offset-2
377
- focus:ring-0 focus:shadow-none focus:border-black
378
- ${disabled ? "bg-gray-100 text-gray-500 border-gray-300" : error ? "border-red-500 bg-red-50" : "bg-white border-[hsl(0_0%_89.8%)]"}
379
- `,
380
- value,
381
- onChange: (e) => onChange == null ? void 0 : onChange(e.target.value),
382
- placeholder,
383
- disabled,
384
- readOnly: disabled
385
- }
386
- ));
387
- };
388
-
389
- // src/inputs/Upload.jsx
390
- var import_react10 = __toESM(require("react"));
391
- var import_lucide_react3 = require("lucide-react");
392
- var CustomUpload = ({
393
- label = "Supporting documents",
394
- description = "Drop items here or Browse Files",
395
- accept = ".pdf,.jpg,.jpeg,.png",
396
- maxSizeMB = 5,
397
- onChange,
398
- error,
399
- value
400
- }) => {
401
- const inputRef = (0, import_react10.useRef)(null);
402
- const handleFileSelect = (files) => {
403
- if (!files || files.length === 0) return;
404
- const selectedFile = files[0];
405
- if (selectedFile.size > maxSizeMB * 1024 * 1024) {
406
- alert(`File size must be less than ${maxSizeMB} MB`);
407
- return;
408
- }
409
- onChange == null ? void 0 : onChange(selectedFile);
410
- };
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(
412
- "div",
413
- {
414
- className: `border-2 border-dashed rounded-lg p-6 flex flex-col items-center justify-center text-center cursor-pointer transition
415
- ${error ? "border-red-500 bg-red-50" : "border-gray-300 hover:border-gray-400 bg-gray-50"}`,
416
- onClick: () => {
417
- var _a;
418
- return (_a = inputRef.current) == null ? void 0 : _a.click();
419
- },
420
- onDragOver: (e) => e.preventDefault(),
421
- onDrop: (e) => {
422
- e.preventDefault();
423
- handleFileSelect(e.dataTransfer.files);
424
- }
425
- },
426
- /* @__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"),
429
- /* @__PURE__ */ import_react10.default.createElement(
430
- "input",
431
- {
432
- ref: inputRef,
433
- type: "file",
434
- accept,
435
- className: "hidden",
436
- onChange: (e) => handleFileSelect(e.target.files)
437
- }
438
- )
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));
440
- };
441
-
442
- // src/sideBar/SideBar.jsx
443
- var import_lucide_react6 = require("lucide-react");
444
- var import_react12 = __toESM(require("react"));
445
-
446
- // ConstantUI.js
447
- var import_lucide_react4 = require("lucide-react");
448
- var encodedAuthData = localStorage.getItem("encodedAuthData");
449
- var navItemsConstant = [
450
- {
451
- Icon: import_lucide_react4.Home,
452
- label: "Home",
453
- onClick: () => {
454
- window.location.href = "/";
455
- },
456
- isDropDown: false
457
- },
458
- {
459
- Icon: import_lucide_react4.Building,
460
- label: "Consumer Ecosystem",
461
- onClick: () => {
462
- },
463
- options: [
464
- {
465
- label: "Corporate",
466
- onClick: () => {
467
- window.location.href = "/corporate/";
468
- }
469
- },
470
- {
471
- label: "Trips",
472
- onClick: () => {
473
- window.location.href = "/trips/";
474
- }
475
- },
476
- {
477
- label: "Users",
478
- onClick: () => {
479
- window.location.href = "/users/users";
480
- }
481
- },
482
- {
483
- label: "Tags (Consumer Variables)",
484
- onClick: () => {
485
- window.location.href = "/orgselector/?path=tag";
486
- }
487
- },
488
- {
489
- label: "Special Request",
490
- onClick: () => {
491
- window.location.href = "/orgselector/?path=special-requests";
492
- }
493
- },
494
- {
495
- label: "Support Tickets (Coming Soon)",
496
- isDisabled: true
497
- // onClick: () => {},
498
- }
499
- ],
500
- isDropDown: true
501
- },
502
- {
503
- Icon: import_lucide_react4.Banknote,
504
- label: "Finance",
505
- onClick: () => {
506
- },
507
- isDropDown: true,
508
- options: [
509
- {
510
- label: "Credit Management",
511
- onClick: () => {
512
- window.location.href = "/finance/paymentsLedger/";
513
- }
514
- },
515
- {
516
- label: "Booking & Invoices",
517
- onClick: () => {
518
- window.location.href = "/finance/bookingHistory/";
519
- }
520
- }
521
- ]
522
- },
523
- {
524
- Icon: import_lucide_react4.DollarSign,
525
- label: "Revenue Management",
526
- onClick: () => {
527
- },
528
- isDropDown: true,
529
- options: [
530
- {
531
- label: "Pricing Engine",
532
- onClick: () => {
533
- window.location.href = "/orgselector/?path=pricing-policy";
534
- }
535
- },
536
- {
537
- label: "Offers",
538
- onClick: () => {
539
- window.location.href = "/orgselector/?path=offer";
540
- }
541
- },
542
- {
543
- label: "Vouchers",
544
- onClick: () => {
545
- window.location.href = "/orgselector/?path=voucher";
546
- }
547
- }
548
- ]
549
- },
550
- {
551
- Icon: import_lucide_react4.Handshake,
552
- label: "Supplier Ecosystem",
553
- onClick: () => {
554
- },
555
- isDropDown: true,
556
- options: [
557
- {
558
- label: "Suppliers List",
559
- onClick: () => {
560
- window.location.href = "/orgselector/?path=supplier-list";
561
- }
562
- },
563
- {
564
- label: "Supplier Deals",
565
- onClick: () => {
566
- window.location.href = "/supplierdeals/";
567
- }
568
- }
569
- ]
570
- },
571
- {
572
- Icon: import_lucide_react4.BarChart3,
573
- label: "Reports",
574
- onClick: () => {
575
- },
576
- isDropDown: true,
577
- options: [
578
- {
579
- label: "Reports (Coming Soon)",
580
- isDisabled: true
581
- // onClick: () => {
582
- // window.open("https://viz.jett.travel", "_blank");
583
- // },
584
- }
585
- ]
586
- },
587
- {
588
- Icon: import_lucide_react4.Cog,
589
- label: "Settings",
590
- onClick: () => {
591
- },
592
- isDropDown: true,
593
- options: [
594
- {
595
- label: "Whitelabel",
596
- onClick: () => {
597
- window.location.href = "/whitelabel/";
598
- }
599
- },
600
- {
601
- label: "Markets",
602
- onClick: () => {
603
- window.location.href = "/market/";
604
- }
605
- },
606
- {
607
- label: "Users",
608
- onClick: () => {
609
- window.location.href = `/users/users?role=admin&auth=${encodedAuthData}`;
610
- }
611
- },
612
- {
613
- label: "Reports Configurations (Coming Soon)",
614
- isDisabled: true
615
- // onClick: () => {},
616
- }
617
- ]
618
- }
619
- ];
620
- var additionalItemsConstant = [
621
- {
622
- Icon: import_lucide_react4.LifeBuoy,
623
- label: "Help",
624
- onClick: () => {
625
- window.location.href = "/help";
626
- }
627
- }
628
- ];
629
-
630
- // src/assests/logo/logo-white.svg
631
- var logo_white_default = "./logo-white-RYMEJOWI.svg";
632
-
633
- // src/sideBar/SideBar.jsx
634
- var import_js_cookie = __toESM(require("js-cookie"));
635
-
636
- // src/inputs/CustomSelect.jsx
637
- var import_react11 = __toESM(require("react"));
638
- var import_lucide_react5 = require("lucide-react");
639
- var CustomSelect = ({
640
- label,
641
- value,
642
- onChange,
643
- options,
644
- placeholder = "Select...",
645
- isRequired = false,
646
- error,
647
- heading,
648
- disabled = false
649
- }) => {
650
- const [open, setOpen] = (0, import_react11.useState)(false);
651
- const [search, setSearch] = (0, import_react11.useState)("");
652
- const wrapperRef = (0, import_react11.useRef)(null);
653
- const handleBlur = (e) => {
654
- var _a;
655
- if (!((_a = wrapperRef.current) == null ? void 0 : _a.contains(e.relatedTarget))) {
656
- setOpen(false);
657
- }
658
- };
659
- const filteredOptions = options.filter(
660
- (opt) => opt.label.toLowerCase().includes(search.toLowerCase())
661
- );
662
- const handleSelect = (val) => {
663
- onChange(val);
664
- setOpen(false);
665
- };
666
- const selectedOption = options.find((opt) => opt.value === value);
667
- return /* @__PURE__ */ import_react11.default.createElement(
668
- "div",
669
- {
670
- className: "flex flex-col w-full relative",
671
- ref: wrapperRef,
672
- tabIndex: disabled ? -1 : 0,
673
- onBlur: handleBlur
674
- },
675
- heading && /* @__PURE__ */ import_react11.default.createElement("h3", { className: "text-lg font-semibold mb-1" }, heading),
676
- label && /* @__PURE__ */ import_react11.default.createElement(
677
- "label",
678
- {
679
- className: `font-medium text-sm mb-1 ${heading ? "text-[#737373] dark:text-white" : "text-black dark:text-white"}`
680
- },
681
- label,
682
- " ",
683
- isRequired && /* @__PURE__ */ import_react11.default.createElement("span", { className: "text-red-500" }, "*")
684
- ),
685
- /* @__PURE__ */ import_react11.default.createElement(
686
- "div",
687
- {
688
- onClick: () => !disabled && setOpen((prev) => !prev),
689
- 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
690
- ${disabled ? "bg-gray-100 text-gray-400" : "bg-white dark:bg-[#18181b] dark:text-white"}
691
- ${error ? "border-red-500" : "border-gray-300"}
692
- `
693
- },
694
- /* @__PURE__ */ import_react11.default.createElement("span", { className: `${selectedOption ? "text-black dark:text-white" : "text-gray-400 dark:text-white"}` }, selectedOption ? selectedOption.label : placeholder),
695
- /* @__PURE__ */ import_react11.default.createElement(
696
- import_lucide_react5.ChevronDown,
697
- {
698
- className: `w-4 h-4 text-gray-500 transition-transform dark:text-white ${open ? "rotate-180" : ""}`
699
- }
700
- )
701
- ),
702
- 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(
703
- "input",
704
- {
705
- type: "text",
706
- value: search,
707
- onChange: (e) => setSearch(e.target.value),
708
- placeholder: "Search...",
709
- className: "flex-1 text-sm focus:outline-none"
710
- }
711
- )), /* @__PURE__ */ import_react11.default.createElement("ul", null, filteredOptions.length > 0 ? filteredOptions.map((opt) => /* @__PURE__ */ import_react11.default.createElement(
712
- "li",
713
- {
714
- key: opt.value,
715
- onClick: () => handleSelect(opt.value),
716
- 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" : ""}`
717
- },
718
- opt.label
719
- )) : /* @__PURE__ */ import_react11.default.createElement("li", { className: "px-3 py-2 text-sm text-gray-400 dark:text-white" }, "No results found")))
720
- );
721
- };
722
-
723
- // src/sideBar/SideBar.jsx
724
- var AppSideBar = ({
725
- username,
726
- role,
727
- navItems,
728
- additionalItems,
729
- sideBarLogo
730
- }) => {
731
- var _a, _b;
732
- const [authData, setAuthData] = (0, import_react12.useState)(null);
733
- const [selectedCountry, setSelectedCountry] = (0, import_react12.useState)("dubai");
734
- const [isMobileMenuOpen, setIsMobileMenuOpen] = (0, import_react12.useState)(false);
735
- const [openMenus, setOpenMenus] = (0, import_react12.useState)(/* @__PURE__ */ new Set());
736
- const [activeMenuPath, setActiveMenuPath] = (0, import_react12.useState)(null);
737
- const [currAppearance, setCurrAppearance] = (0, import_react12.useState)("light");
738
- (0, import_react12.useEffect)(() => {
739
- setCurrAppearance("light");
740
- localStorage.setItem("themeMode", "light");
741
- }, []);
742
- const countryOptions = [
743
- { label: "India", value: "india" },
744
- { label: "Dubai", value: "dubai" },
745
- { label: "Singapore", value: "singapore" },
746
- { label: "Qatar", value: "qatar" }
747
- ];
748
- const toggleMenu = (menuKey) => {
749
- setOpenMenus((prev) => {
750
- const newSet = new Set(prev);
751
- if (newSet.has(menuKey)) {
752
- newSet.delete(menuKey);
753
- } else {
754
- newSet.add(menuKey);
755
- }
756
- return newSet;
757
- });
758
- };
759
- const isMenuOpen = (menuKey) => {
760
- return openMenus.has(menuKey);
761
- };
762
- const handleMenuClick = (item, index, e) => {
763
- if (item.isDropDown) {
764
- e.preventDefault();
765
- const menuKey = `menu-${index}`;
766
- toggleMenu(menuKey);
767
- setActiveMenuPath(`menu-${index}`);
768
- } else {
769
- setActiveMenuPath(`menu-${index}`);
770
- if (item.onClick) {
771
- item.onClick(e);
772
- }
773
- closeMobileMenu();
774
- }
775
- };
776
- const handleSubMenuClick = (option, optionsIndex, parentIndex, e) => {
777
- const parentMenuKey = `menu-${parentIndex}`;
778
- setOpenMenus((prev) => {
779
- const newSet = new Set(prev);
780
- newSet.add(parentMenuKey);
781
- return newSet;
782
- });
783
- if (option.isDropDown) {
784
- e.preventDefault();
785
- const menuKey = `menu-${parentIndex}-option-${optionsIndex}`;
786
- toggleMenu(menuKey);
787
- setActiveMenuPath(`menu-${parentIndex}-option-${optionsIndex}`);
788
- } else {
789
- setActiveMenuPath(`menu-${parentIndex}-option-${optionsIndex}`);
790
- if (option.onClick) {
791
- option.onClick();
792
- }
793
- closeMobileMenu();
794
- }
795
- };
796
- const handleSubSubMenuClick = (subOption, parentIndex, optionsIndex, e) => {
797
- const parentMenuKey = `menu-${parentIndex}`;
798
- const subMenuKey = `menu-${parentIndex}-option-${optionsIndex}`;
799
- setOpenMenus((prev) => {
800
- const newSet = new Set(prev);
801
- newSet.add(parentMenuKey);
802
- newSet.add(subMenuKey);
803
- return newSet;
804
- });
805
- setActiveMenuPath(`menu-${parentIndex}-option-${optionsIndex}-sub-${subOption.label}`);
806
- if (subOption.onClick) {
807
- subOption.onClick();
808
- }
809
- closeMobileMenu();
810
- };
811
- (0, import_react12.useEffect)(() => {
812
- const storedAuthData = localStorage.getItem("authData");
813
- if (storedAuthData) {
814
- let parseData = JSON.parse(storedAuthData);
815
- setAuthData(parseData);
816
- }
817
- }, [localStorage.getItem("authData")]);
818
- const extractUrlFromOnClick = (onClick) => {
819
- if (!onClick || typeof onClick !== "function") return null;
820
- const funcString = onClick.toString();
821
- let match = funcString.match(/window\.location\.href\s*=\s*`([^`]+)`/);
822
- if (!match) {
823
- match = funcString.match(/window\.location\.href\s*=\s*["']([^"']+)["']/);
824
- }
825
- if (match && match[1]) {
826
- try {
827
- if (match[1].startsWith("http://") || match[1].startsWith("https://")) {
828
- const url = new URL(match[1]);
829
- return {
830
- pathname: url.pathname,
831
- search: url.search,
832
- fullPath: url.pathname + url.search
833
- };
834
- }
835
- if (match[1].startsWith("/")) {
836
- const url = new URL(match[1], window.location.origin);
837
- return {
838
- pathname: url.pathname,
839
- search: url.search,
840
- fullPath: url.pathname + url.search
841
- };
842
- }
843
- return null;
844
- } catch {
845
- const pathMatch = match[1].match(/^([^?]+)(\?.*)?$/);
846
- if (pathMatch) {
847
- return {
848
- pathname: pathMatch[1],
849
- search: pathMatch[2] || "",
850
- fullPath: match[1]
851
- };
852
- }
853
- return null;
854
- }
855
- }
856
- return null;
857
- };
858
- const currentUrlMatches = (menuUrlData, currentPath, currentSearch) => {
859
- if (!menuUrlData || !currentPath) return false;
860
- const normalizedMenuPath = menuUrlData.pathname.replace(/\/$/, "") || "/";
861
- const normalizedCurrentPath = currentPath.replace(/\/$/, "") || "/";
862
- if (normalizedMenuPath === "/users/users" && normalizedCurrentPath === "/users/users") {
863
- const menuParams = new URLSearchParams(menuUrlData.search);
864
- const currentParams = new URLSearchParams(currentSearch);
865
- const menuRole = menuParams.get("role");
866
- const currentRole = currentParams.get("role");
867
- if (menuRole && currentRole) {
868
- return menuRole === currentRole;
869
- }
870
- if (menuRole && !currentRole || !menuRole && currentRole) {
871
- return false;
872
- }
873
- return true;
874
- }
875
- if (normalizedMenuPath === "/corporate" && normalizedCurrentPath.startsWith("/org/organizations")) {
876
- return true;
877
- }
878
- if (normalizedMenuPath === "/supplier" && normalizedCurrentPath === "/orgselector") {
879
- const currentPathParam = new URLSearchParams(currentSearch).get("path");
880
- if (currentPathParam === "supplier-list") {
881
- return true;
882
- }
883
- }
884
- if (normalizedMenuPath === "/trips") {
885
- if (normalizedCurrentPath.startsWith("/tripdetails") || normalizedCurrentPath.startsWith("/offline")) {
886
- return true;
887
- }
888
- }
889
- if (normalizedMenuPath === "/orgselector" && menuUrlData.search) {
890
- const menuPathParam = new URLSearchParams(menuUrlData.search).get("path");
891
- if (menuPathParam) {
892
- const pathRouteMap = {
893
- "offer": "/offer/offer",
894
- "voucher": "/voucher/voucher",
895
- "tag": "/tags/tags",
896
- "special-requests": "/corporate/special-requests",
897
- "pricing-policy": "/policies/pricing-policy",
898
- "users": "/users/users"
899
- // Consumer Ecosystem Users (no role param)
900
- };
901
- const expectedRoute = pathRouteMap[menuPathParam];
902
- if (expectedRoute) {
903
- if (normalizedCurrentPath === expectedRoute || normalizedCurrentPath.startsWith(expectedRoute + "/")) {
904
- if (menuPathParam === "users") {
905
- const currentParams = new URLSearchParams(currentSearch);
906
- const currentRole = currentParams.get("role");
907
- return currentRole !== "admin";
908
- }
909
- return true;
910
- }
911
- }
912
- }
913
- if (normalizedCurrentPath === "/orgselector") {
914
- const menuPathParam2 = new URLSearchParams(menuUrlData.search).get("path");
915
- const currentPathParam = new URLSearchParams(currentSearch).get("path");
916
- if (menuPathParam2 && currentPathParam) {
917
- return menuPathParam2 === currentPathParam;
918
- }
919
- }
920
- }
921
- if (normalizedMenuPath === normalizedCurrentPath) {
922
- if (menuUrlData.search) {
923
- const menuParams = new URLSearchParams(menuUrlData.search);
924
- const currentParams = new URLSearchParams(currentSearch);
925
- for (const [key, value] of menuParams.entries()) {
926
- if (key === "auth") {
927
- continue;
928
- }
929
- if (currentParams.get(key) !== value) {
930
- return false;
931
- }
932
- }
933
- return true;
934
- }
935
- return true;
936
- }
937
- if (normalizedCurrentPath.startsWith(normalizedMenuPath + "/")) {
938
- return true;
939
- }
940
- return false;
941
- };
942
- const navItemsLocal = navItems ?? navItemsConstant;
943
- const additionalItemsLocal = additionalItems ?? additionalItemsConstant;
944
- const sideBarLogoLocal = sideBarLogo ?? logo_white_default;
945
- const detectAndSetActiveMenu = (0, import_react12.useCallback)(() => {
946
- const currentPath = window.location.pathname;
947
- const currentSearch = window.location.search;
948
- const newOpenMenus = /* @__PURE__ */ new Set();
949
- let foundActivePath = null;
950
- navItemsLocal.forEach((item, index) => {
951
- if (!item.isDropDown && item.onClick && typeof item.onClick === "function") {
952
- const itemUrlData = extractUrlFromOnClick(item.onClick);
953
- if (itemUrlData && currentUrlMatches(itemUrlData, currentPath, currentSearch)) {
954
- foundActivePath = `menu-${index}`;
955
- }
956
- }
957
- if (item.options && item.options.length > 0) {
958
- item.options.forEach((option, optionsIndex) => {
959
- if (option.onClick && typeof option.onClick === "function") {
960
- const optionUrlData = extractUrlFromOnClick(option.onClick);
961
- if (optionUrlData && currentUrlMatches(optionUrlData, currentPath, currentSearch)) {
962
- const menuKey = `menu-${index}`;
963
- newOpenMenus.add(menuKey);
964
- foundActivePath = `menu-${index}-option-${optionsIndex}`;
965
- if (option.options && option.options.length > 0) {
966
- option.options.forEach((subOption, subIndex) => {
967
- const subOptionUrlData = extractUrlFromOnClick(subOption.onClick);
968
- if (subOptionUrlData && currentUrlMatches(subOptionUrlData, currentPath, currentSearch)) {
969
- const subMenuKey = `menu-${index}-option-${optionsIndex}`;
970
- newOpenMenus.add(subMenuKey);
971
- foundActivePath = `menu-${index}-option-${optionsIndex}-sub-${subOption.label}`;
972
- }
973
- });
974
- }
975
- }
976
- }
977
- });
978
- }
979
- });
980
- if (foundActivePath) {
981
- setOpenMenus(newOpenMenus);
982
- setActiveMenuPath(foundActivePath);
983
- }
984
- }, [navItemsLocal]);
985
- const [currentUrl, setCurrentUrl] = (0, import_react12.useState)(
986
- () => window.location.pathname + window.location.search
987
- );
988
- (0, import_react12.useEffect)(() => {
989
- detectAndSetActiveMenu();
990
- setCurrentUrl(window.location.pathname + window.location.search);
991
- }, [detectAndSetActiveMenu]);
992
- (0, import_react12.useEffect)(() => {
993
- let lastUrl = window.location.pathname + window.location.search;
994
- const handleLocationChange = () => {
995
- const newUrl = window.location.pathname + window.location.search;
996
- if (newUrl !== lastUrl) {
997
- lastUrl = newUrl;
998
- setCurrentUrl(newUrl);
999
- detectAndSetActiveMenu();
1000
- }
1001
- };
1002
- window.addEventListener("popstate", handleLocationChange);
1003
- const checkInterval = setInterval(() => {
1004
- const newUrl = window.location.pathname + window.location.search;
1005
- if (newUrl !== lastUrl) {
1006
- handleLocationChange();
1007
- }
1008
- }, 250);
1009
- return () => {
1010
- window.removeEventListener("popstate", handleLocationChange);
1011
- clearInterval(checkInterval);
1012
- };
1013
- }, [detectAndSetActiveMenu]);
1014
- (0, import_react12.useEffect)(() => {
1015
- detectAndSetActiveMenu();
1016
- }, [currentUrl, detectAndSetActiveMenu]);
1017
- const toggleMobileMenu = () => {
1018
- setIsMobileMenuOpen(!isMobileMenuOpen);
1019
- };
1020
- const closeMobileMenu = () => {
1021
- setIsMobileMenuOpen(false);
1022
- };
1023
- return /* @__PURE__ */ import_react12.default.createElement(import_react12.default.Fragment, null, /* @__PURE__ */ import_react12.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" }, /* @__PURE__ */ import_react12.default.createElement(
1024
- "button",
1025
- {
1026
- onClick: toggleMobileMenu,
1027
- className: "p-2 rounded-lg hover:bg-gray-50 dark:hover:bg-[#27272a] transition-colors",
1028
- "aria-label": "Toggle menu"
1029
- },
1030
- isMobileMenuOpen ? /* @__PURE__ */ import_react12.default.createElement(import_lucide_react6.X, { className: "w-6 h-6 text-gray-700 dark:text-[#f4f4f5cc]" }) : /* @__PURE__ */ import_react12.default.createElement(import_lucide_react6.Menu, { className: "w-6 h-6 text-gray-700 dark:text-[#f4f4f5cc]" })
1031
- ), /* @__PURE__ */ import_react12.default.createElement("div", { className: "flex-1 flex justify-center" }, sideBarLogo && /* @__PURE__ */ import_react12.default.createElement(
1032
- "img",
1033
- {
1034
- src: sideBarLogo,
1035
- alt: "sidebarLogo",
1036
- width: 108,
1037
- height: 40,
1038
- className: "object-contain"
1039
- }
1040
- )), /* @__PURE__ */ import_react12.default.createElement("div", { className: "w-10" })), isMobileMenuOpen && /* @__PURE__ */ import_react12.default.createElement(
1041
- "div",
1042
- {
1043
- className: "fixed inset-0 bg-black/80 bg-opacity-50 z-40 md:hidden",
1044
- onClick: closeMobileMenu
1045
- }
1046
- ), /* @__PURE__ */ import_react12.default.createElement(
1047
- "div",
1048
- {
1049
- 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"}`
1050
- },
1051
- /* @__PURE__ */ import_react12.default.createElement("div", { className: "p-2 mb-2 hidden md:block" }, /* @__PURE__ */ import_react12.default.createElement("div", { className: "flex items-center justify-center w-full h-[60px] mb-2" }, sideBarLogo && /* @__PURE__ */ import_react12.default.createElement(
1052
- "img",
1053
- {
1054
- src: sideBarLogo,
1055
- alt: "sidebarLogo",
1056
- width: 108,
1057
- height: 40,
1058
- className: "object-contain"
1059
- }
1060
- ))),
1061
- /* @__PURE__ */ import_react12.default.createElement("div", { className: "mb-4" }),
1062
- /* @__PURE__ */ import_react12.default.createElement("div", { className: "overflow-y-auto scrollbar-hide" }, /* @__PURE__ */ import_react12.default.createElement("div", null, navItemsLocal == null ? void 0 : navItemsLocal.map((item, index) => {
1063
- const menuKey = `menu-${index}`;
1064
- const isOpen = isMenuOpen(menuKey);
1065
- const isActive = activeMenuPath === menuKey;
1066
- return /* @__PURE__ */ import_react12.default.createElement("div", { key: index, className: "" }, /* @__PURE__ */ import_react12.default.createElement(
1067
- "div",
1068
- {
1069
- 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]" : ""}`,
1070
- onClick: (e) => handleMenuClick(item, index, e)
1071
- },
1072
- /* @__PURE__ */ import_react12.default.createElement("div", { className: "text-primary" }, /* @__PURE__ */ import_react12.default.createElement(item.Icon, { width: 20, height: 20 })),
1073
- /* @__PURE__ */ import_react12.default.createElement("span", { className: "!font-medium !text-[16px] !text-[#000] dark:text-[#f4f4f5cc]" }, item.label),
1074
- item.isDropDown && /* @__PURE__ */ import_react12.default.createElement("div", { className: `ml-auto transition-all delay-75 ${isOpen ? "rotate-180" : ""}` }, /* @__PURE__ */ import_react12.default.createElement(import_lucide_react6.ChevronDown, { width: 20, height: 20, className: "text-gray-500 dark:text-gray-400" }))
1075
- ), item.options && item.options.length > 0 && /* @__PURE__ */ import_react12.default.createElement(
1076
- "div",
1077
- {
1078
- className: `ml-[20px] overflow-hidden flex flex-col transition-all duration-200 ${isOpen ? "max-h-[1000px] min-h-[50px]" : "max-h-0"}`
1079
- },
1080
- item.options.map((options, optionsIndex) => {
1081
- const subMenuKey = `menu-${index}-option-${optionsIndex}`;
1082
- const isSubMenuOpen = isMenuOpen(subMenuKey);
1083
- const isSubActive = activeMenuPath === subMenuKey || (activeMenuPath == null ? void 0 : activeMenuPath.startsWith(`${subMenuKey}-`));
1084
- return /* @__PURE__ */ import_react12.default.createElement("div", { key: optionsIndex, className: "" }, /* @__PURE__ */ import_react12.default.createElement(
1085
- "div",
1086
- {
1087
- className: `flex items-center gap-3 py-2 px-3 ml-4 mr-2 hover:bg-[#f4f4f5] dark:hover:bg-[#27272a] text-gray-600 dark:text-[#a1a1aa] cursor-pointer rounded-md transition-colors duration-200 ${isSubActive ? "bg-[#f4f4f5] dark:bg-[#27272a]" : ""}`,
1088
- onClick: (e) => handleSubMenuClick(options, optionsIndex, index, e)
1089
- },
1090
- /* @__PURE__ */ import_react12.default.createElement("div", null),
1091
- /* @__PURE__ */ import_react12.default.createElement("span", { className: "!font-medium !text-[15px] !text-[#3f3f46cc] dark:text-[#a1a1aa]" }, options.label),
1092
- options.isDropDown && /* @__PURE__ */ import_react12.default.createElement(
1093
- "div",
1094
- {
1095
- className: `ml-auto transition-all delay-75 ${isSubMenuOpen ? "rotate-180" : ""}`
1096
- },
1097
- /* @__PURE__ */ import_react12.default.createElement(import_lucide_react6.ChevronDown, { width: 18, height: 18, className: "text-gray-400 dark:text-gray-500" })
1098
- )
1099
- ), options.options && options.options.length > 0 && /* @__PURE__ */ import_react12.default.createElement(
1100
- "div",
1101
- {
1102
- className: `ml-[20px] overflow-hidden flex flex-col transition-all duration-200 ${isSubMenuOpen ? "max-h-[1000px] min-h-[50px]" : "max-h-0"}`
1103
- },
1104
- options.options.map((subOption, subIndex) => {
1105
- const isSubSubActive = activeMenuPath === `menu-${index}-option-${optionsIndex}-sub-${subOption.label}`;
1106
- return /* @__PURE__ */ import_react12.default.createElement(
1107
- "div",
1108
- {
1109
- key: subIndex,
1110
- 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]" : ""}`,
1111
- onClick: (e) => handleSubSubMenuClick(subOption, index, optionsIndex, e)
1112
- },
1113
- subOption.label
1114
- );
1115
- })
1116
- ));
1117
- })
1118
- ));
1119
- }))),
1120
- /* @__PURE__ */ import_react12.default.createElement("div", { className: "mt-auto bg-[#fafafa] dark:bg-[#18181b] sticky bottom-0 mt-2" }, /* @__PURE__ */ import_react12.default.createElement(
1121
- "div",
1122
- {
1123
- className: "flex items-center justify-between p-2 rounded-lg hover:bg-[#f4f4f5] dark:hover:bg-[#27272a] cursor-pointer transition-colors duration-200",
1124
- onClick: () => {
1125
- window.location.href = "/profile";
1126
- }
1127
- },
1128
- /* @__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" }, ((_a = authData == null ? void 0 : authData.userInfo) == null ? void 0 : _a.UserName) ? authData.userInfo.UserName.split("")[0] : "A")), /* @__PURE__ */ import_react12.default.createElement("div", null, /* @__PURE__ */ import_react12.default.createElement("p", { className: "!font-semibold dark:text-white !text-[16px]" }, ((_b = authData == null ? void 0 : authData.userInfo) == null ? void 0 : _b.UserName) ? authData.userInfo.UserName : "Admin"), /* @__PURE__ */ import_react12.default.createElement("p", { className: "!text-[14px] !font-normal dark:text-[#f4f4f5cc]" }, role)))
1129
- ))
1130
- ));
1131
- };
1132
-
1133
- // src/RightSheet/RightSheet.jsx
1134
- var import_react13 = __toESM(require("react"));
1135
- var RightSheet = ({
1136
- open,
1137
- setOpen,
1138
- children,
1139
- callBack,
1140
- actionLabel = "Save",
1141
- onAction = () => {
1142
- }
1143
- }) => {
1144
- const [visible, setVisible] = (0, import_react13.useState)(open);
1145
- (0, import_react13.useEffect)(() => {
1146
- if (open) {
1147
- document.body.style.overflow = "hidden";
1148
- setVisible(true);
1149
- }
1150
- return () => {
1151
- document.body.style.overflow = "auto";
1152
- };
1153
- }, [open]);
1154
- const handleClose = () => {
1155
- setVisible(false);
1156
- setTimeout(() => {
1157
- setOpen(false);
1158
- callBack();
1159
- }, 200);
1160
- };
1161
- const handleAction = () => {
1162
- onAction();
1163
- handleClose();
1164
- };
1165
- if (!visible) return null;
1166
- return /* @__PURE__ */ import_react13.default.createElement(
1167
- "div",
1168
- {
1169
- className: "fixed inset-0 overflow-x-hidden bg-black/80 sheetPopIn h-full overflow-auto ",
1170
- onClick: handleClose
1171
- },
1172
- /* @__PURE__ */ import_react13.default.createElement(
1173
- "div",
1174
- {
1175
- className: `absolute flex flex-col right-0 top-0 min-h-full min-w-[100%] md:min-w-[576px]
1176
- ${visible ? "sheetRightSlide" : "transition-all duration-200 translate-x-[100%]"} justify-between bg-[#fff] dark:bg-[#18181b] dark:text-white`,
1177
- onClick: (e) => e.stopPropagation()
1178
- },
1179
- /* @__PURE__ */ import_react13.default.createElement("div", { className: " min-h-full " }, children),
1180
- /* @__PURE__ */ import_react13.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" }, /* @__PURE__ */ import_react13.default.createElement(CustomButton, { variant: "SECONDARY", onClick: () => handleClose() }, "Cancel"), /* @__PURE__ */ import_react13.default.createElement(CustomButton, { variant: "SECONDARY", onClick: handleAction }, actionLabel))
1181
- )
1182
- );
1183
- };
1184
-
1185
- // src/Table/CustomTable.jsx
1186
- var import_react14 = __toESM(require("react"));
1187
- var CustomTable = ({
1188
- tableHeader,
1189
- setIsAllChecked,
1190
- isAllChecked,
1191
- children,
1192
- isHideCheckbox = "false"
1193
- }) => {
1194
- return /* @__PURE__ */ import_react14.default.createElement("div", { className: "border border-[#e5e5e5] dark:border-[#303036] rounded-lg overflow-x-auto" }, /* @__PURE__ */ import_react14.default.createElement("div", { className: "w-full relative overflow-x-auto" }, /* @__PURE__ */ import_react14.default.createElement("table", { className: "w-full caption-bottom text-sm overflow-x-auto bg-white dark:bg-[#18181b] table-fixed border-collapse" }, /* @__PURE__ */ import_react14.default.createElement("thead", { className: "border-b border-[#e5e5e5] dark:border-[#303036] dark:bg-[#18181b]" }, /* @__PURE__ */ import_react14.default.createElement(
1195
- "tr",
1196
- {
1197
- className: "transition-colors text-[#737373] hover:bg-muted/50 \r\n data-[state=selected]:bg-muted"
1198
- },
1199
- !isHideCheckbox && /* @__PURE__ */ import_react14.default.createElement("th", { className: "px-4 py-3 text-left w-[50px]" }, /* @__PURE__ */ import_react14.default.createElement(
1200
- CustomCheckbox,
1201
- {
1202
- checked: isAllChecked,
1203
- onChange: () => {
1204
- setIsAllChecked(!isAllChecked);
1205
- }
1206
- }
1207
- )),
1208
- tableHeader.map((header, index) => {
1209
- return /* @__PURE__ */ import_react14.default.createElement(
1210
- "th",
1211
- {
1212
- className: `text-[#737373] px-4 py-3 text-sm dark:bg-[#18181b] font-medium ${index == tableHeader.length - 1 ? "text-right" : "text-left"}`,
1213
- key: header + index
1214
- },
1215
- header
1216
- );
1217
- })
1218
- )), /* @__PURE__ */ import_react14.default.createElement("tbody", null, children))));
1219
- };
1220
-
1221
- // src/Pagination/Pagination.jsx
1222
- var import_react15 = __toESM(require("react"));
1223
- var import_lucide_react7 = require("lucide-react");
1224
- var Pagination = ({
1225
- data = [],
1226
- component: Component,
1227
- itemsPerPage = 6,
1228
- itemsPerPageOptions = [5, 10, 20, 50, 100],
1229
- // Controlled props (optional)
1230
- currentPage: controlledCurrentPage,
1231
- onPageChange: controlledOnPageChange,
1232
- onItemsPerPageChange: controlledOnItemsPerPageChange,
1233
- // Legacy props for backward compatibility
1234
- totalPages,
1235
- totalItems: legacyTotalItems,
1236
- onPageChange: legacyOnPageChange,
1237
- onItemsPerPageChange: legacyOnItemsPerPageChange,
1238
- tableHeader,
1239
- isHideCheckbox,
1240
- callback,
1241
- isTable = false,
1242
- // Component props - any additional props to pass to the component
1243
- componentProps = {},
1244
- ...restProps
1245
- }) => {
1246
- const [internalCurrentPage, setInternalCurrentPage] = (0, import_react15.useState)(1);
1247
- const [internalItemsPerPage, setInternalItemsPerPage] = (0, import_react15.useState)(itemsPerPage);
1248
- const isControlled = controlledCurrentPage !== void 0;
1249
- const isItemsPerPageControlled = controlledOnItemsPerPageChange !== void 0;
1250
- const currentPage = isControlled ? controlledCurrentPage : internalCurrentPage;
1251
- const activeItemsPerPage = isItemsPerPageControlled ? itemsPerPage : internalItemsPerPage;
1252
- const totalItems = legacyTotalItems !== void 0 ? legacyTotalItems : data.length;
1253
- const calculatedTotalPages = (0, import_react15.useMemo)(() => {
1254
- if (totalItems > 0 && activeItemsPerPage > 0) {
1255
- return Math.ceil(totalItems / activeItemsPerPage);
1256
- }
1257
- return 1;
1258
- }, [totalItems, activeItemsPerPage]);
1259
- const paginatedData = (0, import_react15.useMemo)(() => {
1260
- if (!data || data.length === 0) return [];
1261
- const startIndex = (currentPage - 1) * activeItemsPerPage;
1262
- const endIndex = startIndex + activeItemsPerPage;
1263
- return data.slice(startIndex, endIndex);
1264
- }, [data, currentPage, activeItemsPerPage]);
1265
- (0, import_react15.useEffect)(() => {
1266
- if (!isControlled && currentPage > calculatedTotalPages && calculatedTotalPages > 0) {
1267
- setInternalCurrentPage(1);
1268
- }
1269
- }, [calculatedTotalPages, isControlled, currentPage]);
1270
- const getPageNumbers = () => {
1271
- const pages = [];
1272
- const maxVisible = 5;
1273
- let startPage = Math.max(1, currentPage - Math.floor(maxVisible / 2));
1274
- let endPage = Math.min(calculatedTotalPages, startPage + maxVisible - 1);
1275
- if (endPage - startPage < maxVisible - 1) {
1276
- startPage = Math.max(1, endPage - maxVisible + 1);
1277
- }
1278
- for (let i = startPage; i <= endPage; i++) {
1279
- pages.push(i);
1280
- }
1281
- return pages;
1282
- };
1283
- const handlePageChange = (page) => {
1284
- if (page >= 1 && page <= calculatedTotalPages) {
1285
- if (isControlled && controlledOnPageChange) {
1286
- controlledOnPageChange(page);
1287
- } else if (legacyOnPageChange) {
1288
- legacyOnPageChange(page);
1289
- } else {
1290
- setInternalCurrentPage(page);
1291
- }
1292
- }
1293
- };
1294
- const startItem = totalItems !== void 0 ? (currentPage - 1) * activeItemsPerPage + 1 : null;
1295
- const endItem = totalItems !== void 0 ? Math.min(currentPage * activeItemsPerPage, totalItems) : null;
1296
- const renderContent = () => {
1297
- if (Component) {
1298
- if (import_react15.default.isValidElement(Component)) {
1299
- const ComponentType = Component.type;
1300
- const elementProps = Component.props;
1301
- if (isTable) {
1302
- return /* @__PURE__ */ import_react15.default.createElement(
1303
- CustomTable,
1304
- {
1305
- tableHeader,
1306
- isHideCheckbox
1307
- },
1308
- data.map((item, index) => {
1309
- return /* @__PURE__ */ import_react15.default.createElement(
1310
- ComponentType,
1311
- {
1312
- key: item.id || item._id || index,
1313
- data: item,
1314
- ...elementProps,
1315
- ...componentProps,
1316
- ...restProps
1317
- }
1318
- );
1319
- })
1320
- );
1321
- } else {
1322
- if (isTable) {
1323
- return /* @__PURE__ */ import_react15.default.createElement(
1324
- CustomTable,
1325
- {
1326
- tableHeader,
1327
- isHideCheckbox
1328
- },
1329
- paginatedData.map((item, index) => {
1330
- return /* @__PURE__ */ import_react15.default.createElement(
1331
- ComponentType,
1332
- {
1333
- key: item.id || item._id || index,
1334
- data: item,
1335
- ...elementProps,
1336
- ...componentProps,
1337
- ...restProps
1338
- }
1339
- );
1340
- })
1341
- );
1342
- }
1343
- }
1344
- } else {
1345
- return /* @__PURE__ */ import_react15.default.createElement(
1346
- CustomTable,
1347
- {
1348
- tableHeader,
1349
- isHideCheckbox
1350
- },
1351
- paginatedData.map((item, index) => {
1352
- return /* @__PURE__ */ import_react15.default.createElement(
1353
- Component,
1354
- {
1355
- key: item.id || item._id || index,
1356
- data: item,
1357
- ...componentProps,
1358
- ...restProps
1359
- }
1360
- );
1361
- })
1362
- );
1363
- }
1364
- }
1365
- return null;
1366
- };
1367
- return /* @__PURE__ */ import_react15.default.createElement(import_react15.default.Fragment, null, /* @__PURE__ */ import_react15.default.createElement(import_react15.default.Fragment, null, renderContent()), /* @__PURE__ */ import_react15.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" }, totalItems !== void 0 && /* @__PURE__ */ import_react15.default.createElement("div", { className: "text-sm text-[#737373] dark:text-white" }, "Showing ", startItem, " to ", endItem, " of ", totalItems, " entries"), /* @__PURE__ */ import_react15.default.createElement("div", { className: "flex items-center gap-2" }, /* @__PURE__ */ import_react15.default.createElement(
1368
- "button",
1369
- {
1370
- onClick: () => handlePageChange(1),
1371
- disabled: currentPage === 1,
1372
- 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]"}`,
1373
- title: "First page"
1374
- },
1375
- /* @__PURE__ */ import_react15.default.createElement(import_lucide_react7.ChevronsLeft, { size: 16 })
1376
- ), /* @__PURE__ */ import_react15.default.createElement(
1377
- "button",
1378
- {
1379
- onClick: () => handlePageChange(currentPage - 1),
1380
- disabled: currentPage === 1,
1381
- 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]"}`,
1382
- title: "Previous page"
1383
- },
1384
- /* @__PURE__ */ import_react15.default.createElement(import_lucide_react7.ChevronLeft, { size: 16 })
1385
- ), getPageNumbers().map((pageNum) => /* @__PURE__ */ import_react15.default.createElement(
1386
- "button",
1387
- {
1388
- key: pageNum,
1389
- onClick: () => handlePageChange(pageNum),
1390
- 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]"}`
1391
- },
1392
- pageNum
1393
- )), /* @__PURE__ */ import_react15.default.createElement(
1394
- "button",
1395
- {
1396
- onClick: () => handlePageChange(currentPage + 1),
1397
- disabled: currentPage === calculatedTotalPages || calculatedTotalPages === 0,
1398
- 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]"}`,
1399
- title: "Next page"
1400
- },
1401
- /* @__PURE__ */ import_react15.default.createElement(import_lucide_react7.ChevronRight, { size: 16 })
1402
- ), /* @__PURE__ */ import_react15.default.createElement(
1403
- "button",
1404
- {
1405
- onClick: () => handlePageChange(calculatedTotalPages),
1406
- disabled: currentPage === calculatedTotalPages || calculatedTotalPages === 0,
1407
- 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]"}`,
1408
- title: "Last page"
1409
- },
1410
- /* @__PURE__ */ import_react15.default.createElement(import_lucide_react7.ChevronsRight, { size: 16 })
1411
- ))));
1412
- };
1413
- // Annotate the CommonJS export names for ESM import in node:
1414
- 0 && (module.exports = {
1415
- AppSideBar,
1416
- Chip,
1417
- CustomAutocomplete,
1418
- CustomButton,
1419
- CustomCheckbox,
1420
- CustomInput,
1421
- CustomSearch,
1422
- CustomSelect,
1423
- CustomSwitch,
1424
- CustomTable,
1425
- CustomTextarea,
1426
- CustomUpload,
1427
- Pagination,
1428
- ProgressBar,
1429
- RightSheet
1430
- });
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+
29
+ // src/index.js
30
+ var index_exports = {};
31
+ __export(index_exports, {
32
+ AppSideBar: () => AppSideBar,
33
+ Chip: () => Chip,
34
+ CustomAutocomplete: () => CustomAutocomplete,
35
+ CustomButton: () => CustomButton,
36
+ CustomCheckbox: () => CustomCheckbox,
37
+ CustomInput: () => CustomInput,
38
+ CustomSearch: () => CustomSearch,
39
+ CustomSelect: () => CustomSelect,
40
+ CustomSwitch: () => CustomSwitch,
41
+ CustomTable: () => CustomTable,
42
+ CustomTextarea: () => CustomTextarea,
43
+ CustomUpload: () => CustomUpload,
44
+ Pagination: () => Pagination,
45
+ ProgressBar: () => ProgressBar,
46
+ RightSheet: () => RightSheet
47
+ });
48
+ module.exports = __toCommonJS(index_exports);
49
+
50
+ // src/utils/cn.ts
51
+ var import_clsx = require("clsx");
52
+ var import_tailwind_merge = require("tailwind-merge");
53
+ function cn(...inputs) {
54
+ return (0, import_tailwind_merge.twMerge)((0, import_clsx.clsx)(inputs));
55
+ }
56
+
57
+ // src/Button.jsx
58
+ var import_react = __toESM(require("react"));
59
+ var variantStyles = {
60
+ PRIMARY: "bg-white dark:bg-[#18181b] dark:text-white",
61
+ SECONDARY: "bg-primary text-white dark:text-white",
62
+ DEFAULT: "bg-white text-black dark:text-white",
63
+ DANGER: "bg-[#ef4444] text-white dark:text-white"
64
+ };
65
+ var CustomButton = ({
66
+ variant = "DEFAULT",
67
+ children,
68
+ className,
69
+ onClick,
70
+ disabled = false,
71
+ icon
72
+ }) => {
73
+ return /* @__PURE__ */ import_react.default.createElement(
74
+ "div",
75
+ {
76
+ className: cn(
77
+ `cursor-pointer flex items-center py-2 px-3 min-h-10 justify-center border rounded-[6px] border-[#e5e5e5] dark:border-[#303036] ${variant == "DANGER" ? "bg-[#ef4444]" : "dark:bg-[#1d1d20]"} gap-2`,
78
+ variantStyles[variant],
79
+ className
80
+ ),
81
+ onClick
82
+ },
83
+ icon && /* @__PURE__ */ import_react.default.createElement("div", null, icon),
84
+ children
85
+ );
86
+ };
87
+
88
+ // src/inputs/Autocomplete.jsx
89
+ var import_react2 = __toESM(require("react"));
90
+ var import_lucide_react = require("lucide-react");
91
+ var CustomAutocomplete = ({
92
+ label,
93
+ value,
94
+ onChange,
95
+ options,
96
+ placeholder = "Search & select...",
97
+ isRequired = false,
98
+ error,
99
+ heading,
100
+ disabled = false
101
+ }) => {
102
+ const [open, setOpen] = (0, import_react2.useState)(false);
103
+ const [search, setSearch] = (0, import_react2.useState)("");
104
+ const wrapperRef = (0, import_react2.useRef)(null);
105
+ const selectedOptions = options.filter((opt) => value.includes(opt.value));
106
+ const handleBlur = (e) => {
107
+ var _a;
108
+ if (!((_a = wrapperRef.current) == null ? void 0 : _a.contains(e.relatedTarget))) {
109
+ setOpen(false);
110
+ }
111
+ };
112
+ const filteredOptions = options.filter(
113
+ (opt) => opt.label.toLowerCase().includes(search.toLowerCase())
114
+ );
115
+ const toggleValue = (val) => {
116
+ if (value.includes(val)) {
117
+ onChange(value.filter((v) => v !== val));
118
+ } else {
119
+ onChange([...value, val]);
120
+ }
121
+ };
122
+ return /* @__PURE__ */ import_react2.default.createElement(
123
+ "div",
124
+ {
125
+ className: "flex flex-col w-full relative dark:bg-[#18181b] dark:text-white",
126
+ ref: wrapperRef,
127
+ tabIndex: disabled ? -1 : 0,
128
+ onBlur: handleBlur
129
+ },
130
+ heading && /* @__PURE__ */ import_react2.default.createElement("h3", { className: "text-lg font-semibold leading-6 mb-1" }, heading),
131
+ label && /* @__PURE__ */ import_react2.default.createElement(
132
+ "label",
133
+ {
134
+ className: `font-[500] text-sm leading-5 mb-1 ${heading ? "text-[#737373]" : "text-black dark:text-white"}`
135
+ },
136
+ label,
137
+ " ",
138
+ isRequired && /* @__PURE__ */ import_react2.default.createElement("span", { className: "text-red-500" }, "*")
139
+ ),
140
+ /* @__PURE__ */ import_react2.default.createElement(
141
+ "div",
142
+ {
143
+ onClick: () => {
144
+ if (!disabled) setOpen((prev) => !prev);
145
+ },
146
+ 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
+ ${disabled ? "bg-gray-100 cursor-not-allowed text-gray-400" : "cursor-text"}
148
+ ${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
+ `
150
+ },
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(
152
+ "span",
153
+ {
154
+ 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"
156
+ },
157
+ opt.label,
158
+ /* @__PURE__ */ import_react2.default.createElement(
159
+ "button",
160
+ {
161
+ onClick: (e) => {
162
+ e.stopPropagation();
163
+ toggleValue(opt.value);
164
+ },
165
+ className: "text-gray-500 hover:text-gray-700 dark:text-white cursor-pointer dark:hover:text-white"
166
+ },
167
+ "\u2715"
168
+ )
169
+ )) : /* @__PURE__ */ import_react2.default.createElement("span", { className: "text-gray-400" }, placeholder)),
170
+ /* @__PURE__ */ import_react2.default.createElement(
171
+ import_lucide_react.ChevronDown,
172
+ {
173
+ className: `w-4 h-4 text-gray-500 transition-transform ${open ? "rotate-180" : ""}`
174
+ }
175
+ )
176
+ ),
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(
178
+ "input",
179
+ {
180
+ type: "text",
181
+ value: search,
182
+ onChange: (e) => setSearch(e.target.value),
183
+ placeholder: "Search...",
184
+ className: "flex-1 text-sm focus:outline-none"
185
+ }
186
+ )), /* @__PURE__ */ import_react2.default.createElement("ul", null, filteredOptions.length > 0 ? filteredOptions.map((opt) => {
187
+ const selected = value.includes(opt.value);
188
+ return /* @__PURE__ */ import_react2.default.createElement(
189
+ "li",
190
+ {
191
+ key: opt.value,
192
+ 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" : ""}`
194
+ },
195
+ /* @__PURE__ */ import_react2.default.createElement(
196
+ "span",
197
+ {
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"}`
199
+ },
200
+ selected && /* @__PURE__ */ import_react2.default.createElement(import_lucide_react.Check, { size: 14 })
201
+ ),
202
+ opt.label
203
+ );
204
+ }) : /* @__PURE__ */ import_react2.default.createElement("li", { className: "px-3 py-2 text-sm text-gray-400" }, "No results found")))
205
+ );
206
+ };
207
+
208
+ // src/inputs/Checkbox.jsx
209
+ var import_react3 = __toESM(require("react"));
210
+ var CustomCheckbox = ({ onChange, checked }) => {
211
+ const handleChange = (e) => {
212
+ onChange(e.target.checked);
213
+ };
214
+ return /* @__PURE__ */ import_react3.default.createElement("label", { className: "inline-flex items-center cursor-pointer select-none" }, /* @__PURE__ */ import_react3.default.createElement(
215
+ "input",
216
+ {
217
+ type: "checkbox",
218
+ checked,
219
+ onChange: handleChange,
220
+ className: "peer hidden"
221
+ }
222
+ ), /* @__PURE__ */ import_react3.default.createElement(
223
+ "span",
224
+ {
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 "
226
+ },
227
+ checked && /* @__PURE__ */ import_react3.default.createElement(
228
+ "svg",
229
+ {
230
+ className: "w-4 h-4 text-white",
231
+ fill: "none",
232
+ stroke: "currentColor",
233
+ strokeWidth: "3",
234
+ viewBox: "0 0 24 24"
235
+ },
236
+ /* @__PURE__ */ import_react3.default.createElement("path", { d: "M5 13l4 4L19 7" })
237
+ )
238
+ ));
239
+ };
240
+
241
+ // src/inputs/Chip.jsx
242
+ var import_react4 = __toESM(require("react"));
243
+ var VARIANTS = {
244
+ PRIMARY: "bg-gray-100 text-black dark:bg-gray-800 dark:text-white",
245
+ GREEN: "bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-100",
246
+ RED: "bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-100",
247
+ YELLOW: "bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-100"
248
+ };
249
+ var Chip = ({ label, variant }) => {
250
+ return /* @__PURE__ */ import_react4.default.createElement(
251
+ "div",
252
+ {
253
+ className: `inline-flex text-[12px] items-center px-3 py-1 rounded-full ${VARIANTS[variant] || VARIANTS.PRIMARY} text-sm font-[600]`
254
+ },
255
+ label
256
+ );
257
+ };
258
+
259
+ // src/inputs/CustomSwitch.jsx
260
+ var import_react5 = __toESM(require("react"));
261
+ var CustomSwitch = ({ checked, onChange, label, description }) => {
262
+ return /* @__PURE__ */ import_react5.default.createElement("div", null, /* @__PURE__ */ import_react5.default.createElement(
263
+ "button",
264
+ {
265
+ type: "button",
266
+ role: "switch",
267
+ "aria-checked": checked,
268
+ 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"}`
270
+ },
271
+ /* @__PURE__ */ import_react5.default.createElement(
272
+ "span",
273
+ {
274
+ className: `inline-block h-4 w-4 transform rounded-full bg-white shadow transition ${checked ? "translate-x-6" : "translate-x-1"}`
275
+ }
276
+ )
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)));
278
+ };
279
+
280
+ // src/inputs/Input.jsx
281
+ var import_react6 = __toESM(require("react"));
282
+ var CustomInput = ({
283
+ label,
284
+ isRequired,
285
+ value,
286
+ onChange,
287
+ placeholder,
288
+ disabled = false,
289
+ error,
290
+ heading
291
+ }) => {
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(
293
+ "label",
294
+ {
295
+ className: `font-[500] text-sm ${heading ? "text-[#737373]" : "text-black"} dark:text-white`
296
+ },
297
+ label,
298
+ " ",
299
+ isRequired && /* @__PURE__ */ import_react6.default.createElement("span", { className: "text-red-500" }, "*")
300
+ ), /* @__PURE__ */ import_react6.default.createElement(
301
+ "input",
302
+ {
303
+ className: `border border-gray-200 rounded-md h-10 px-4 py-2 w-full text-[14px]
304
+ focus:outline-2 outline-black dark:outline-white outline-offset-2
305
+ dark:bg-transparent dark:text-white dark:border-[#303036]
306
+ ${disabled ? "bg-gray-100 cursor-not-allowed text-gray-500 border-gray-300" : error ? "border-red-500 bg-red-50" : "bg-white border-[hsl(0_0%_89.8%)]"}
307
+ `,
308
+ value,
309
+ onChange: (e) => onChange == null ? void 0 : onChange(e.target.value),
310
+ placeholder,
311
+ disabled,
312
+ readOnly: disabled
313
+ }
314
+ ));
315
+ };
316
+
317
+ // src/inputs/ProgressBar.jsx
318
+ var import_react7 = __toESM(require("react"));
319
+ var ProgressBar = ({ step, totalSteps }) => {
320
+ 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(
322
+ "div",
323
+ {
324
+ className: "bg-black h-2 rounded-full transition-all duration-300",
325
+ style: { width: `${progress}%` }
326
+ }
327
+ )));
328
+ };
329
+
330
+ // src/inputs/Search.jsx
331
+ var import_react8 = __toESM(require("react"));
332
+ var import_lucide_react2 = require("lucide-react");
333
+ var CustomSearch = ({
334
+ value,
335
+ onChange,
336
+ placeholder = "Search Markets..."
337
+ }) => {
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(
339
+ "input",
340
+ {
341
+ type: "text",
342
+ value,
343
+ onChange,
344
+ placeholder,
345
+ className: "bg-transparent w-full h-full focus:outline-none"
346
+ }
347
+ ));
348
+ };
349
+
350
+ // src/inputs/TextArea.jsx
351
+ var import_react9 = __toESM(require("react"));
352
+ var CustomTextarea = ({
353
+ label,
354
+ isRequired,
355
+ value,
356
+ onChange,
357
+ placeholder,
358
+ disabled = false,
359
+ error,
360
+ heading,
361
+ rows = 4
362
+ }) => {
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(
364
+ "label",
365
+ {
366
+ className: `font-[500] text-sm ${heading ? "text-[#737373]" : "text-black"}`
367
+ },
368
+ label,
369
+ " ",
370
+ isRequired && /* @__PURE__ */ import_react9.default.createElement("span", { className: "text-red-500" }, "*")
371
+ ), /* @__PURE__ */ import_react9.default.createElement(
372
+ "textarea",
373
+ {
374
+ rows,
375
+ className: `border rounded-md px-4 py-2 w-full text-[14px]
376
+ focus:outline-2 focus:outline-black focus:outline-offset-2
377
+ focus:ring-0 focus:shadow-none focus:border-black
378
+ ${disabled ? "bg-gray-100 text-gray-500 border-gray-300" : error ? "border-red-500 bg-red-50" : "bg-white border-[hsl(0_0%_89.8%)]"}
379
+ `,
380
+ value,
381
+ onChange: (e) => onChange == null ? void 0 : onChange(e.target.value),
382
+ placeholder,
383
+ disabled,
384
+ readOnly: disabled
385
+ }
386
+ ));
387
+ };
388
+
389
+ // src/inputs/Upload.jsx
390
+ var import_react10 = __toESM(require("react"));
391
+ var import_lucide_react3 = require("lucide-react");
392
+ var CustomUpload = ({
393
+ label = "Supporting documents",
394
+ description = "Drop items here or Browse Files",
395
+ accept = ".pdf,.jpg,.jpeg,.png",
396
+ maxSizeMB = 5,
397
+ onChange,
398
+ error,
399
+ value
400
+ }) => {
401
+ const inputRef = (0, import_react10.useRef)(null);
402
+ const handleFileSelect = (files) => {
403
+ if (!files || files.length === 0) return;
404
+ const selectedFile = files[0];
405
+ if (selectedFile.size > maxSizeMB * 1024 * 1024) {
406
+ alert(`File size must be less than ${maxSizeMB} MB`);
407
+ return;
408
+ }
409
+ onChange == null ? void 0 : onChange(selectedFile);
410
+ };
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(
412
+ "div",
413
+ {
414
+ className: `border-2 border-dashed rounded-lg p-6 flex flex-col items-center justify-center text-center cursor-pointer transition
415
+ ${error ? "border-red-500 bg-red-50" : "border-gray-300 hover:border-gray-400 bg-gray-50"}`,
416
+ onClick: () => {
417
+ var _a;
418
+ return (_a = inputRef.current) == null ? void 0 : _a.click();
419
+ },
420
+ onDragOver: (e) => e.preventDefault(),
421
+ onDrop: (e) => {
422
+ e.preventDefault();
423
+ handleFileSelect(e.dataTransfer.files);
424
+ }
425
+ },
426
+ /* @__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"),
429
+ /* @__PURE__ */ import_react10.default.createElement(
430
+ "input",
431
+ {
432
+ ref: inputRef,
433
+ type: "file",
434
+ accept,
435
+ className: "hidden",
436
+ onChange: (e) => handleFileSelect(e.target.files)
437
+ }
438
+ )
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));
440
+ };
441
+
442
+ // src/sideBar/SideBar.jsx
443
+ var import_lucide_react6 = require("lucide-react");
444
+ var import_react12 = __toESM(require("react"));
445
+
446
+ // ConstantUI.js
447
+ var import_lucide_react4 = require("lucide-react");
448
+ var encodedAuthData = localStorage.getItem("encodedAuthData");
449
+ var navItemsConstant = [
450
+ {
451
+ Icon: import_lucide_react4.Home,
452
+ label: "Home",
453
+ onClick: () => {
454
+ window.location.href = "/";
455
+ },
456
+ isDropDown: false
457
+ },
458
+ {
459
+ Icon: import_lucide_react4.Building,
460
+ label: "Consumer Ecosystem",
461
+ onClick: () => {
462
+ },
463
+ options: [
464
+ {
465
+ label: "Corporate",
466
+ onClick: () => {
467
+ window.location.href = "/corporate/";
468
+ }
469
+ },
470
+ {
471
+ label: "Trips",
472
+ onClick: () => {
473
+ window.location.href = "/trips/";
474
+ }
475
+ },
476
+ {
477
+ label: "Users",
478
+ onClick: () => {
479
+ window.location.href = "/users/users";
480
+ }
481
+ },
482
+ {
483
+ label: "Tags (Custom Variables)",
484
+ onClick: () => {
485
+ window.location.href = "/orgselector/?path=tag";
486
+ }
487
+ },
488
+ {
489
+ label: "Special Request",
490
+ onClick: () => {
491
+ window.location.href = "/orgselector/?path=special-requests";
492
+ }
493
+ },
494
+ {
495
+ label: "Support Tickets (Coming Soon)",
496
+ isDisabled: true
497
+ // onClick: () => {},
498
+ }
499
+ ],
500
+ isDropDown: true
501
+ },
502
+ {
503
+ Icon: import_lucide_react4.Banknote,
504
+ label: "Finance",
505
+ onClick: () => {
506
+ },
507
+ isDropDown: true,
508
+ options: [
509
+ {
510
+ label: "Credit Management",
511
+ onClick: () => {
512
+ window.location.href = "/finance/paymentsLedger/";
513
+ }
514
+ },
515
+ {
516
+ label: "Booking & Invoices",
517
+ onClick: () => {
518
+ window.location.href = "/finance/bookingHistory/";
519
+ }
520
+ }
521
+ ]
522
+ },
523
+ {
524
+ Icon: import_lucide_react4.DollarSign,
525
+ label: "Revenue Management",
526
+ onClick: () => {
527
+ },
528
+ isDropDown: true,
529
+ options: [
530
+ {
531
+ label: "Pricing Engine",
532
+ onClick: () => {
533
+ window.location.href = "/orgselector/?path=pricing-policy";
534
+ }
535
+ },
536
+ {
537
+ label: "Offers",
538
+ onClick: () => {
539
+ window.location.href = "/orgselector/?path=offer";
540
+ }
541
+ },
542
+ {
543
+ label: "Vouchers",
544
+ onClick: () => {
545
+ window.location.href = "/orgselector/?path=voucher";
546
+ }
547
+ }
548
+ ]
549
+ },
550
+ {
551
+ Icon: import_lucide_react4.Handshake,
552
+ label: "Supplier Ecosystem",
553
+ onClick: () => {
554
+ },
555
+ isDropDown: true,
556
+ options: [
557
+ {
558
+ label: "Suppliers List",
559
+ onClick: () => {
560
+ window.location.href = "/orgselector/?path=supplier-list";
561
+ }
562
+ },
563
+ {
564
+ label: "Supplier Deals",
565
+ onClick: () => {
566
+ window.location.href = "/supplierdeals/";
567
+ }
568
+ }
569
+ ]
570
+ },
571
+ {
572
+ Icon: import_lucide_react4.BarChart3,
573
+ label: "Reports",
574
+ onClick: () => {
575
+ },
576
+ isDropDown: true,
577
+ options: [
578
+ {
579
+ label: "Reports (Coming Soon)",
580
+ isDisabled: true
581
+ // onClick: () => {
582
+ // window.open("https://viz.jett.travel", "_blank");
583
+ // },
584
+ }
585
+ ]
586
+ },
587
+ {
588
+ Icon: import_lucide_react4.Cog,
589
+ label: "Settings",
590
+ onClick: () => {
591
+ },
592
+ isDropDown: true,
593
+ options: [
594
+ {
595
+ label: "Whitelabel",
596
+ onClick: () => {
597
+ window.location.href = "/whitelabel/";
598
+ }
599
+ },
600
+ {
601
+ label: "Markets",
602
+ onClick: () => {
603
+ window.location.href = "/market/";
604
+ }
605
+ },
606
+ {
607
+ label: "Users",
608
+ onClick: () => {
609
+ window.location.href = `/users/users?role=admin&auth=${encodedAuthData}`;
610
+ }
611
+ },
612
+ {
613
+ label: "Reports Configurations (Coming Soon)",
614
+ isDisabled: true
615
+ // onClick: () => {},
616
+ }
617
+ ]
618
+ }
619
+ ];
620
+ var additionalItemsConstant = [
621
+ {
622
+ Icon: import_lucide_react4.LifeBuoy,
623
+ label: "Help",
624
+ onClick: () => {
625
+ window.location.href = "/help";
626
+ }
627
+ }
628
+ ];
629
+
630
+ // src/assests/logo/logo-white.svg
631
+ var logo_white_default = "./logo-white-RYMEJOWI.svg";
632
+
633
+ // src/sideBar/SideBar.jsx
634
+ var import_js_cookie = __toESM(require("js-cookie"));
635
+
636
+ // src/inputs/CustomSelect.jsx
637
+ var import_react11 = __toESM(require("react"));
638
+ var import_lucide_react5 = require("lucide-react");
639
+ var CustomSelect = ({
640
+ label,
641
+ value,
642
+ onChange,
643
+ options,
644
+ placeholder = "Select...",
645
+ isRequired = false,
646
+ error,
647
+ heading,
648
+ disabled = false
649
+ }) => {
650
+ const [open, setOpen] = (0, import_react11.useState)(false);
651
+ const [search, setSearch] = (0, import_react11.useState)("");
652
+ const wrapperRef = (0, import_react11.useRef)(null);
653
+ const handleBlur = (e) => {
654
+ var _a;
655
+ if (!((_a = wrapperRef.current) == null ? void 0 : _a.contains(e.relatedTarget))) {
656
+ setOpen(false);
657
+ }
658
+ };
659
+ const filteredOptions = options.filter(
660
+ (opt) => opt.label.toLowerCase().includes(search.toLowerCase())
661
+ );
662
+ const handleSelect = (val) => {
663
+ onChange(val);
664
+ setOpen(false);
665
+ };
666
+ const selectedOption = options.find((opt) => opt.value === value);
667
+ return /* @__PURE__ */ import_react11.default.createElement(
668
+ "div",
669
+ {
670
+ className: "flex flex-col w-full relative",
671
+ ref: wrapperRef,
672
+ tabIndex: disabled ? -1 : 0,
673
+ onBlur: handleBlur
674
+ },
675
+ heading && /* @__PURE__ */ import_react11.default.createElement("h3", { className: "text-lg font-semibold mb-1" }, heading),
676
+ label && /* @__PURE__ */ import_react11.default.createElement(
677
+ "label",
678
+ {
679
+ className: `font-medium text-sm mb-1 ${heading ? "text-[#737373] dark:text-white" : "text-black dark:text-white"}`
680
+ },
681
+ label,
682
+ " ",
683
+ isRequired && /* @__PURE__ */ import_react11.default.createElement("span", { className: "text-red-500" }, "*")
684
+ ),
685
+ /* @__PURE__ */ import_react11.default.createElement(
686
+ "div",
687
+ {
688
+ onClick: () => !disabled && setOpen((prev) => !prev),
689
+ 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
690
+ ${disabled ? "bg-gray-100 text-gray-400" : "bg-white dark:bg-[#18181b] dark:text-white"}
691
+ ${error ? "border-red-500" : "border-gray-300"}
692
+ `
693
+ },
694
+ /* @__PURE__ */ import_react11.default.createElement("span", { className: `${selectedOption ? "text-black dark:text-white" : "text-gray-400 dark:text-white"}` }, selectedOption ? selectedOption.label : placeholder),
695
+ /* @__PURE__ */ import_react11.default.createElement(
696
+ import_lucide_react5.ChevronDown,
697
+ {
698
+ className: `w-4 h-4 text-gray-500 transition-transform dark:text-white ${open ? "rotate-180" : ""}`
699
+ }
700
+ )
701
+ ),
702
+ 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(
703
+ "input",
704
+ {
705
+ type: "text",
706
+ value: search,
707
+ onChange: (e) => setSearch(e.target.value),
708
+ placeholder: "Search...",
709
+ className: "flex-1 text-sm focus:outline-none"
710
+ }
711
+ )), /* @__PURE__ */ import_react11.default.createElement("ul", null, filteredOptions.length > 0 ? filteredOptions.map((opt) => /* @__PURE__ */ import_react11.default.createElement(
712
+ "li",
713
+ {
714
+ key: opt.value,
715
+ onClick: () => handleSelect(opt.value),
716
+ 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" : ""}`
717
+ },
718
+ opt.label
719
+ )) : /* @__PURE__ */ import_react11.default.createElement("li", { className: "px-3 py-2 text-sm text-gray-400 dark:text-white" }, "No results found")))
720
+ );
721
+ };
722
+
723
+ // src/sideBar/SideBar.jsx
724
+ var AppSideBar = ({
725
+ username,
726
+ role,
727
+ navItems,
728
+ additionalItems,
729
+ sideBarLogo
730
+ }) => {
731
+ var _a, _b;
732
+ const [authData, setAuthData] = (0, import_react12.useState)(null);
733
+ const [selectedCountry, setSelectedCountry] = (0, import_react12.useState)("dubai");
734
+ const [isMobileMenuOpen, setIsMobileMenuOpen] = (0, import_react12.useState)(false);
735
+ const [openMenus, setOpenMenus] = (0, import_react12.useState)(/* @__PURE__ */ new Set());
736
+ const [activeMenuPath, setActiveMenuPath] = (0, import_react12.useState)(null);
737
+ const [currAppearance, setCurrAppearance] = (0, import_react12.useState)("light");
738
+ (0, import_react12.useEffect)(() => {
739
+ setCurrAppearance("light");
740
+ localStorage.setItem("themeMode", "light");
741
+ }, []);
742
+ const countryOptions = [
743
+ { label: "India", value: "india" },
744
+ { label: "Dubai", value: "dubai" },
745
+ { label: "Singapore", value: "singapore" },
746
+ { label: "Qatar", value: "qatar" }
747
+ ];
748
+ const toggleMenu = (menuKey) => {
749
+ setOpenMenus((prev) => {
750
+ const newSet = new Set(prev);
751
+ if (newSet.has(menuKey)) {
752
+ newSet.delete(menuKey);
753
+ } else {
754
+ newSet.add(menuKey);
755
+ }
756
+ return newSet;
757
+ });
758
+ };
759
+ const isMenuOpen = (menuKey) => {
760
+ return openMenus.has(menuKey);
761
+ };
762
+ const handleMenuClick = (item, index, e) => {
763
+ if (item.isDropDown) {
764
+ e.preventDefault();
765
+ const menuKey = `menu-${index}`;
766
+ toggleMenu(menuKey);
767
+ setActiveMenuPath(`menu-${index}`);
768
+ } else {
769
+ setActiveMenuPath(`menu-${index}`);
770
+ if (item.onClick) {
771
+ item.onClick(e);
772
+ }
773
+ closeMobileMenu();
774
+ }
775
+ };
776
+ const handleSubMenuClick = (option, optionsIndex, parentIndex, e) => {
777
+ const parentMenuKey = `menu-${parentIndex}`;
778
+ setOpenMenus((prev) => {
779
+ const newSet = new Set(prev);
780
+ newSet.add(parentMenuKey);
781
+ return newSet;
782
+ });
783
+ if (option.isDropDown) {
784
+ e.preventDefault();
785
+ const menuKey = `menu-${parentIndex}-option-${optionsIndex}`;
786
+ toggleMenu(menuKey);
787
+ setActiveMenuPath(`menu-${parentIndex}-option-${optionsIndex}`);
788
+ } else {
789
+ setActiveMenuPath(`menu-${parentIndex}-option-${optionsIndex}`);
790
+ if (option.onClick) {
791
+ option.onClick();
792
+ }
793
+ closeMobileMenu();
794
+ }
795
+ };
796
+ const handleSubSubMenuClick = (subOption, parentIndex, optionsIndex, e) => {
797
+ const parentMenuKey = `menu-${parentIndex}`;
798
+ const subMenuKey = `menu-${parentIndex}-option-${optionsIndex}`;
799
+ setOpenMenus((prev) => {
800
+ const newSet = new Set(prev);
801
+ newSet.add(parentMenuKey);
802
+ newSet.add(subMenuKey);
803
+ return newSet;
804
+ });
805
+ setActiveMenuPath(`menu-${parentIndex}-option-${optionsIndex}-sub-${subOption.label}`);
806
+ if (subOption.onClick) {
807
+ subOption.onClick();
808
+ }
809
+ closeMobileMenu();
810
+ };
811
+ (0, import_react12.useEffect)(() => {
812
+ const storedAuthData = localStorage.getItem("authData");
813
+ if (storedAuthData) {
814
+ let parseData = JSON.parse(storedAuthData);
815
+ setAuthData(parseData);
816
+ }
817
+ }, [localStorage.getItem("authData")]);
818
+ const extractUrlFromOnClick = (onClick) => {
819
+ if (!onClick || typeof onClick !== "function") return null;
820
+ const funcString = onClick.toString();
821
+ let match = funcString.match(/window\.location\.href\s*=\s*`([^`]+)`/);
822
+ if (!match) {
823
+ match = funcString.match(/window\.location\.href\s*=\s*["']([^"']+)["']/);
824
+ }
825
+ if (match && match[1]) {
826
+ try {
827
+ if (match[1].startsWith("http://") || match[1].startsWith("https://")) {
828
+ const url = new URL(match[1]);
829
+ return {
830
+ pathname: url.pathname,
831
+ search: url.search,
832
+ fullPath: url.pathname + url.search
833
+ };
834
+ }
835
+ if (match[1].startsWith("/")) {
836
+ const url = new URL(match[1], window.location.origin);
837
+ return {
838
+ pathname: url.pathname,
839
+ search: url.search,
840
+ fullPath: url.pathname + url.search
841
+ };
842
+ }
843
+ return null;
844
+ } catch {
845
+ const pathMatch = match[1].match(/^([^?]+)(\?.*)?$/);
846
+ if (pathMatch) {
847
+ return {
848
+ pathname: pathMatch[1],
849
+ search: pathMatch[2] || "",
850
+ fullPath: match[1]
851
+ };
852
+ }
853
+ return null;
854
+ }
855
+ }
856
+ return null;
857
+ };
858
+ const currentUrlMatches = (menuUrlData, currentPath, currentSearch) => {
859
+ if (!menuUrlData || !currentPath) return false;
860
+ const normalizedMenuPath = menuUrlData.pathname.replace(/\/$/, "") || "/";
861
+ const normalizedCurrentPath = currentPath.replace(/\/$/, "") || "/";
862
+ if (normalizedMenuPath === "/users/users" && normalizedCurrentPath === "/users/users") {
863
+ const menuParams = new URLSearchParams(menuUrlData.search);
864
+ const currentParams = new URLSearchParams(currentSearch);
865
+ const menuRole = menuParams.get("role");
866
+ const currentRole = currentParams.get("role");
867
+ if (menuRole && currentRole) {
868
+ return menuRole === currentRole;
869
+ }
870
+ if (menuRole && !currentRole || !menuRole && currentRole) {
871
+ return false;
872
+ }
873
+ return true;
874
+ }
875
+ if (normalizedMenuPath === "/corporate" && normalizedCurrentPath.startsWith("/org/organizations")) {
876
+ return true;
877
+ }
878
+ if (normalizedMenuPath === "/supplier" && normalizedCurrentPath === "/orgselector") {
879
+ const currentPathParam = new URLSearchParams(currentSearch).get("path");
880
+ if (currentPathParam === "supplier-list") {
881
+ return true;
882
+ }
883
+ }
884
+ if (normalizedMenuPath === "/trips") {
885
+ if (normalizedCurrentPath.startsWith("/tripdetails") || normalizedCurrentPath.startsWith("/offline")) {
886
+ return true;
887
+ }
888
+ }
889
+ if (normalizedMenuPath === "/orgselector" && menuUrlData.search) {
890
+ const menuPathParam = new URLSearchParams(menuUrlData.search).get("path");
891
+ if (menuPathParam) {
892
+ const pathRouteMap = {
893
+ "offer": "/offer/offer",
894
+ "voucher": "/voucher/voucher",
895
+ "tag": "/tags/tags",
896
+ "special-requests": "/corporate/special-requests",
897
+ "pricing-policy": "/policies/pricing-policy",
898
+ "users": "/users/users"
899
+ // Consumer Ecosystem Users (no role param)
900
+ };
901
+ const expectedRoute = pathRouteMap[menuPathParam];
902
+ if (expectedRoute) {
903
+ if (normalizedCurrentPath === expectedRoute || normalizedCurrentPath.startsWith(expectedRoute + "/")) {
904
+ if (menuPathParam === "users") {
905
+ const currentParams = new URLSearchParams(currentSearch);
906
+ const currentRole = currentParams.get("role");
907
+ return currentRole !== "admin";
908
+ }
909
+ return true;
910
+ }
911
+ }
912
+ }
913
+ if (normalizedCurrentPath === "/orgselector") {
914
+ const menuPathParam2 = new URLSearchParams(menuUrlData.search).get("path");
915
+ const currentPathParam = new URLSearchParams(currentSearch).get("path");
916
+ if (menuPathParam2 && currentPathParam) {
917
+ return menuPathParam2 === currentPathParam;
918
+ }
919
+ }
920
+ }
921
+ if (normalizedMenuPath === normalizedCurrentPath) {
922
+ if (menuUrlData.search) {
923
+ const menuParams = new URLSearchParams(menuUrlData.search);
924
+ const currentParams = new URLSearchParams(currentSearch);
925
+ for (const [key, value] of menuParams.entries()) {
926
+ if (key === "auth") {
927
+ continue;
928
+ }
929
+ if (currentParams.get(key) !== value) {
930
+ return false;
931
+ }
932
+ }
933
+ return true;
934
+ }
935
+ return true;
936
+ }
937
+ if (normalizedCurrentPath.startsWith(normalizedMenuPath + "/")) {
938
+ return true;
939
+ }
940
+ return false;
941
+ };
942
+ const navItemsLocal = navItems ?? navItemsConstant;
943
+ const additionalItemsLocal = additionalItems ?? additionalItemsConstant;
944
+ const sideBarLogoLocal = sideBarLogo ?? logo_white_default;
945
+ const detectAndSetActiveMenu = (0, import_react12.useCallback)(() => {
946
+ const currentPath = window.location.pathname;
947
+ const currentSearch = window.location.search;
948
+ const newOpenMenus = /* @__PURE__ */ new Set();
949
+ let foundActivePath = null;
950
+ navItemsLocal.forEach((item, index) => {
951
+ if (!item.isDropDown && item.onClick && typeof item.onClick === "function") {
952
+ const itemUrlData = extractUrlFromOnClick(item.onClick);
953
+ if (itemUrlData && currentUrlMatches(itemUrlData, currentPath, currentSearch)) {
954
+ foundActivePath = `menu-${index}`;
955
+ }
956
+ }
957
+ if (item.options && item.options.length > 0) {
958
+ item.options.forEach((option, optionsIndex) => {
959
+ if (option.onClick && typeof option.onClick === "function") {
960
+ const optionUrlData = extractUrlFromOnClick(option.onClick);
961
+ if (optionUrlData && currentUrlMatches(optionUrlData, currentPath, currentSearch)) {
962
+ const menuKey = `menu-${index}`;
963
+ newOpenMenus.add(menuKey);
964
+ foundActivePath = `menu-${index}-option-${optionsIndex}`;
965
+ if (option.options && option.options.length > 0) {
966
+ option.options.forEach((subOption, subIndex) => {
967
+ const subOptionUrlData = extractUrlFromOnClick(subOption.onClick);
968
+ if (subOptionUrlData && currentUrlMatches(subOptionUrlData, currentPath, currentSearch)) {
969
+ const subMenuKey = `menu-${index}-option-${optionsIndex}`;
970
+ newOpenMenus.add(subMenuKey);
971
+ foundActivePath = `menu-${index}-option-${optionsIndex}-sub-${subOption.label}`;
972
+ }
973
+ });
974
+ }
975
+ }
976
+ }
977
+ });
978
+ }
979
+ });
980
+ if (foundActivePath) {
981
+ setOpenMenus(newOpenMenus);
982
+ setActiveMenuPath(foundActivePath);
983
+ }
984
+ }, [navItemsLocal]);
985
+ const [currentUrl, setCurrentUrl] = (0, import_react12.useState)(
986
+ () => window.location.pathname + window.location.search
987
+ );
988
+ (0, import_react12.useEffect)(() => {
989
+ detectAndSetActiveMenu();
990
+ setCurrentUrl(window.location.pathname + window.location.search);
991
+ }, [detectAndSetActiveMenu]);
992
+ (0, import_react12.useEffect)(() => {
993
+ let lastUrl = window.location.pathname + window.location.search;
994
+ const handleLocationChange = () => {
995
+ const newUrl = window.location.pathname + window.location.search;
996
+ if (newUrl !== lastUrl) {
997
+ lastUrl = newUrl;
998
+ setCurrentUrl(newUrl);
999
+ detectAndSetActiveMenu();
1000
+ }
1001
+ };
1002
+ window.addEventListener("popstate", handleLocationChange);
1003
+ const checkInterval = setInterval(() => {
1004
+ const newUrl = window.location.pathname + window.location.search;
1005
+ if (newUrl !== lastUrl) {
1006
+ handleLocationChange();
1007
+ }
1008
+ }, 250);
1009
+ return () => {
1010
+ window.removeEventListener("popstate", handleLocationChange);
1011
+ clearInterval(checkInterval);
1012
+ };
1013
+ }, [detectAndSetActiveMenu]);
1014
+ (0, import_react12.useEffect)(() => {
1015
+ detectAndSetActiveMenu();
1016
+ }, [currentUrl, detectAndSetActiveMenu]);
1017
+ const toggleMobileMenu = () => {
1018
+ setIsMobileMenuOpen(!isMobileMenuOpen);
1019
+ };
1020
+ const closeMobileMenu = () => {
1021
+ setIsMobileMenuOpen(false);
1022
+ };
1023
+ return /* @__PURE__ */ import_react12.default.createElement(import_react12.default.Fragment, null, /* @__PURE__ */ import_react12.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" }, /* @__PURE__ */ import_react12.default.createElement(
1024
+ "button",
1025
+ {
1026
+ onClick: toggleMobileMenu,
1027
+ className: "p-2 rounded-lg hover:bg-gray-50 dark:hover:bg-[#27272a] transition-colors",
1028
+ "aria-label": "Toggle menu"
1029
+ },
1030
+ isMobileMenuOpen ? /* @__PURE__ */ import_react12.default.createElement(import_lucide_react6.X, { className: "w-6 h-6 text-gray-700 dark:text-[#f4f4f5cc]" }) : /* @__PURE__ */ import_react12.default.createElement(import_lucide_react6.Menu, { className: "w-6 h-6 text-gray-700 dark:text-[#f4f4f5cc]" })
1031
+ ), /* @__PURE__ */ import_react12.default.createElement("div", { className: "flex-1 flex justify-center" }, sideBarLogo && /* @__PURE__ */ import_react12.default.createElement(
1032
+ "img",
1033
+ {
1034
+ src: sideBarLogo,
1035
+ alt: "sidebarLogo",
1036
+ width: 108,
1037
+ height: 40,
1038
+ className: "object-contain"
1039
+ }
1040
+ )), /* @__PURE__ */ import_react12.default.createElement("div", { className: "w-10" })), isMobileMenuOpen && /* @__PURE__ */ import_react12.default.createElement(
1041
+ "div",
1042
+ {
1043
+ className: "fixed inset-0 bg-black/80 bg-opacity-50 z-40 md:hidden",
1044
+ onClick: closeMobileMenu
1045
+ }
1046
+ ), /* @__PURE__ */ import_react12.default.createElement(
1047
+ "div",
1048
+ {
1049
+ 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"}`
1050
+ },
1051
+ /* @__PURE__ */ import_react12.default.createElement("div", { className: "p-2 mb-2 hidden md:block" }, /* @__PURE__ */ import_react12.default.createElement("div", { className: "flex items-center justify-center w-full h-[60px] mb-2" }, sideBarLogo && /* @__PURE__ */ import_react12.default.createElement(
1052
+ "img",
1053
+ {
1054
+ src: sideBarLogo,
1055
+ alt: "sidebarLogo",
1056
+ width: 108,
1057
+ height: 40,
1058
+ className: "object-contain"
1059
+ }
1060
+ ))),
1061
+ /* @__PURE__ */ import_react12.default.createElement("div", { className: "mb-4" }),
1062
+ /* @__PURE__ */ import_react12.default.createElement("div", { className: "overflow-y-auto scrollbar-hide" }, /* @__PURE__ */ import_react12.default.createElement("div", null, navItemsLocal == null ? void 0 : navItemsLocal.map((item, index) => {
1063
+ const menuKey = `menu-${index}`;
1064
+ const isOpen = isMenuOpen(menuKey);
1065
+ const isActive = activeMenuPath === menuKey;
1066
+ return /* @__PURE__ */ import_react12.default.createElement("div", { key: index, className: "" }, /* @__PURE__ */ import_react12.default.createElement(
1067
+ "div",
1068
+ {
1069
+ 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]" : ""}`,
1070
+ onClick: (e) => handleMenuClick(item, index, e)
1071
+ },
1072
+ /* @__PURE__ */ import_react12.default.createElement("div", { className: "text-primary" }, /* @__PURE__ */ import_react12.default.createElement(item.Icon, { width: 20, height: 20 })),
1073
+ /* @__PURE__ */ import_react12.default.createElement("span", { className: "!font-medium !text-[16px] !text-[#000] dark:text-[#f4f4f5cc]" }, item.label),
1074
+ item.isDropDown && /* @__PURE__ */ import_react12.default.createElement("div", { className: `ml-auto transition-all delay-75 ${isOpen ? "rotate-180" : ""}` }, /* @__PURE__ */ import_react12.default.createElement(import_lucide_react6.ChevronDown, { width: 20, height: 20, className: "text-gray-500 dark:text-gray-400" }))
1075
+ ), item.options && item.options.length > 0 && /* @__PURE__ */ import_react12.default.createElement(
1076
+ "div",
1077
+ {
1078
+ className: `ml-[20px] overflow-hidden flex flex-col transition-all duration-200 ${isOpen ? "max-h-[1000px] min-h-[50px]" : "max-h-0"}`
1079
+ },
1080
+ item.options.map((options, optionsIndex) => {
1081
+ const subMenuKey = `menu-${index}-option-${optionsIndex}`;
1082
+ const isSubMenuOpen = isMenuOpen(subMenuKey);
1083
+ const isSubActive = activeMenuPath === subMenuKey || (activeMenuPath == null ? void 0 : activeMenuPath.startsWith(`${subMenuKey}-`));
1084
+ return /* @__PURE__ */ import_react12.default.createElement("div", { key: optionsIndex, className: "" }, /* @__PURE__ */ import_react12.default.createElement(
1085
+ "div",
1086
+ {
1087
+ className: `flex items-center gap-3 py-2 px-3 ml-4 mr-2 hover:bg-[#f4f4f5] dark:hover:bg-[#27272a] text-gray-600 dark:text-[#a1a1aa] cursor-pointer rounded-md transition-colors duration-200 ${isSubActive ? "bg-[#f4f4f5] dark:bg-[#27272a]" : ""}`,
1088
+ onClick: (e) => handleSubMenuClick(options, optionsIndex, index, e)
1089
+ },
1090
+ /* @__PURE__ */ import_react12.default.createElement("div", null),
1091
+ /* @__PURE__ */ import_react12.default.createElement("span", { className: "!font-medium !text-[15px] !text-[#3f3f46cc] dark:text-[#a1a1aa]" }, options.label),
1092
+ options.isDropDown && /* @__PURE__ */ import_react12.default.createElement(
1093
+ "div",
1094
+ {
1095
+ className: `ml-auto transition-all delay-75 ${isSubMenuOpen ? "rotate-180" : ""}`
1096
+ },
1097
+ /* @__PURE__ */ import_react12.default.createElement(import_lucide_react6.ChevronDown, { width: 18, height: 18, className: "text-gray-400 dark:text-gray-500" })
1098
+ )
1099
+ ), options.options && options.options.length > 0 && /* @__PURE__ */ import_react12.default.createElement(
1100
+ "div",
1101
+ {
1102
+ className: `ml-[20px] overflow-hidden flex flex-col transition-all duration-200 ${isSubMenuOpen ? "max-h-[1000px] min-h-[50px]" : "max-h-0"}`
1103
+ },
1104
+ options.options.map((subOption, subIndex) => {
1105
+ const isSubSubActive = activeMenuPath === `menu-${index}-option-${optionsIndex}-sub-${subOption.label}`;
1106
+ return /* @__PURE__ */ import_react12.default.createElement(
1107
+ "div",
1108
+ {
1109
+ key: subIndex,
1110
+ 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]" : ""}`,
1111
+ onClick: (e) => handleSubSubMenuClick(subOption, index, optionsIndex, e)
1112
+ },
1113
+ subOption.label
1114
+ );
1115
+ })
1116
+ ));
1117
+ })
1118
+ ));
1119
+ }))),
1120
+ /* @__PURE__ */ import_react12.default.createElement("div", { className: "mt-auto bg-[#fafafa] dark:bg-[#18181b] sticky bottom-0 mt-2" }, /* @__PURE__ */ import_react12.default.createElement(
1121
+ "div",
1122
+ {
1123
+ className: "flex items-center justify-between p-2 rounded-lg hover:bg-[#f4f4f5] dark:hover:bg-[#27272a] cursor-pointer transition-colors duration-200",
1124
+ onClick: () => {
1125
+ window.location.href = "/profile";
1126
+ }
1127
+ },
1128
+ /* @__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" }, ((_a = authData == null ? void 0 : authData.userInfo) == null ? void 0 : _a.UserName) ? authData.userInfo.UserName.split("")[0] : "A")), /* @__PURE__ */ import_react12.default.createElement("div", null, /* @__PURE__ */ import_react12.default.createElement("p", { className: "!font-semibold dark:text-white !text-[16px]" }, ((_b = authData == null ? void 0 : authData.userInfo) == null ? void 0 : _b.UserName) ? authData.userInfo.UserName : "Admin"), /* @__PURE__ */ import_react12.default.createElement("p", { className: "!text-[14px] !font-normal dark:text-[#f4f4f5cc]" }, role)))
1129
+ ))
1130
+ ));
1131
+ };
1132
+
1133
+ // src/RightSheet/RightSheet.jsx
1134
+ var import_react13 = __toESM(require("react"));
1135
+ var RightSheet = ({
1136
+ open,
1137
+ setOpen,
1138
+ children,
1139
+ callBack,
1140
+ actionLabel = "Save",
1141
+ onAction = () => {
1142
+ }
1143
+ }) => {
1144
+ const [visible, setVisible] = (0, import_react13.useState)(open);
1145
+ (0, import_react13.useEffect)(() => {
1146
+ if (open) {
1147
+ document.body.style.overflow = "hidden";
1148
+ setVisible(true);
1149
+ }
1150
+ return () => {
1151
+ document.body.style.overflow = "auto";
1152
+ };
1153
+ }, [open]);
1154
+ const handleClose = () => {
1155
+ setVisible(false);
1156
+ setTimeout(() => {
1157
+ setOpen(false);
1158
+ callBack();
1159
+ }, 200);
1160
+ };
1161
+ const handleAction = () => {
1162
+ onAction();
1163
+ handleClose();
1164
+ };
1165
+ if (!visible) return null;
1166
+ return /* @__PURE__ */ import_react13.default.createElement(
1167
+ "div",
1168
+ {
1169
+ className: "fixed inset-0 overflow-x-hidden bg-black/80 sheetPopIn h-full overflow-auto ",
1170
+ onClick: handleClose
1171
+ },
1172
+ /* @__PURE__ */ import_react13.default.createElement(
1173
+ "div",
1174
+ {
1175
+ className: `absolute flex flex-col right-0 top-0 min-h-full min-w-[100%] md:min-w-[576px]
1176
+ ${visible ? "sheetRightSlide" : "transition-all duration-200 translate-x-[100%]"} justify-between bg-[#fff] dark:bg-[#18181b] dark:text-white`,
1177
+ onClick: (e) => e.stopPropagation()
1178
+ },
1179
+ /* @__PURE__ */ import_react13.default.createElement("div", { className: " min-h-full " }, children),
1180
+ /* @__PURE__ */ import_react13.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" }, /* @__PURE__ */ import_react13.default.createElement(CustomButton, { variant: "SECONDARY", onClick: () => handleClose() }, "Cancel"), /* @__PURE__ */ import_react13.default.createElement(CustomButton, { variant: "SECONDARY", onClick: handleAction }, actionLabel))
1181
+ )
1182
+ );
1183
+ };
1184
+
1185
+ // src/Table/CustomTable.jsx
1186
+ var import_react14 = __toESM(require("react"));
1187
+ var CustomTable = ({
1188
+ tableHeader,
1189
+ setIsAllChecked,
1190
+ isAllChecked,
1191
+ children,
1192
+ isHideCheckbox = "false"
1193
+ }) => {
1194
+ return /* @__PURE__ */ import_react14.default.createElement("div", { className: "border border-[#e5e5e5] dark:border-[#303036] rounded-lg overflow-x-auto" }, /* @__PURE__ */ import_react14.default.createElement("div", { className: "w-full relative overflow-x-auto" }, /* @__PURE__ */ import_react14.default.createElement("table", { className: "w-full caption-bottom text-sm overflow-x-auto bg-white dark:bg-[#18181b] table-fixed border-collapse" }, /* @__PURE__ */ import_react14.default.createElement("thead", { className: "border-b border-[#e5e5e5] dark:border-[#303036] dark:bg-[#18181b]" }, /* @__PURE__ */ import_react14.default.createElement(
1195
+ "tr",
1196
+ {
1197
+ className: "transition-colors text-[#737373] hover:bg-muted/50 \r\n data-[state=selected]:bg-muted"
1198
+ },
1199
+ !isHideCheckbox && /* @__PURE__ */ import_react14.default.createElement("th", { className: "px-4 py-3 text-left w-[50px]" }, /* @__PURE__ */ import_react14.default.createElement(
1200
+ CustomCheckbox,
1201
+ {
1202
+ checked: isAllChecked,
1203
+ onChange: () => {
1204
+ setIsAllChecked(!isAllChecked);
1205
+ }
1206
+ }
1207
+ )),
1208
+ tableHeader.map((header, index) => {
1209
+ return /* @__PURE__ */ import_react14.default.createElement(
1210
+ "th",
1211
+ {
1212
+ className: `text-[#737373] px-4 py-3 text-sm dark:bg-[#18181b] font-medium ${index == tableHeader.length - 1 ? "text-right" : "text-left"}`,
1213
+ key: header + index
1214
+ },
1215
+ header
1216
+ );
1217
+ })
1218
+ )), /* @__PURE__ */ import_react14.default.createElement("tbody", null, children))));
1219
+ };
1220
+
1221
+ // src/Pagination/Pagination.jsx
1222
+ var import_react15 = __toESM(require("react"));
1223
+ var import_lucide_react7 = require("lucide-react");
1224
+ var Pagination = ({
1225
+ data = [],
1226
+ component: Component,
1227
+ itemsPerPage = 6,
1228
+ itemsPerPageOptions = [5, 10, 20, 50, 100],
1229
+ // Controlled props (optional)
1230
+ currentPage: controlledCurrentPage,
1231
+ onPageChange: controlledOnPageChange,
1232
+ onItemsPerPageChange: controlledOnItemsPerPageChange,
1233
+ // Legacy props for backward compatibility
1234
+ totalPages,
1235
+ totalItems: legacyTotalItems,
1236
+ onPageChange: legacyOnPageChange,
1237
+ onItemsPerPageChange: legacyOnItemsPerPageChange,
1238
+ tableHeader,
1239
+ isHideCheckbox,
1240
+ callback,
1241
+ isTable = false,
1242
+ // Component props - any additional props to pass to the component
1243
+ componentProps = {},
1244
+ ...restProps
1245
+ }) => {
1246
+ const [internalCurrentPage, setInternalCurrentPage] = (0, import_react15.useState)(1);
1247
+ const [internalItemsPerPage, setInternalItemsPerPage] = (0, import_react15.useState)(itemsPerPage);
1248
+ const isControlled = controlledCurrentPage !== void 0;
1249
+ const isItemsPerPageControlled = controlledOnItemsPerPageChange !== void 0;
1250
+ const currentPage = isControlled ? controlledCurrentPage : internalCurrentPage;
1251
+ const activeItemsPerPage = isItemsPerPageControlled ? itemsPerPage : internalItemsPerPage;
1252
+ const totalItems = legacyTotalItems !== void 0 ? legacyTotalItems : data.length;
1253
+ const calculatedTotalPages = (0, import_react15.useMemo)(() => {
1254
+ if (totalItems > 0 && activeItemsPerPage > 0) {
1255
+ return Math.ceil(totalItems / activeItemsPerPage);
1256
+ }
1257
+ return 1;
1258
+ }, [totalItems, activeItemsPerPage]);
1259
+ const paginatedData = (0, import_react15.useMemo)(() => {
1260
+ if (!data || data.length === 0) return [];
1261
+ const startIndex = (currentPage - 1) * activeItemsPerPage;
1262
+ const endIndex = startIndex + activeItemsPerPage;
1263
+ return data.slice(startIndex, endIndex);
1264
+ }, [data, currentPage, activeItemsPerPage]);
1265
+ (0, import_react15.useEffect)(() => {
1266
+ if (!isControlled && currentPage > calculatedTotalPages && calculatedTotalPages > 0) {
1267
+ setInternalCurrentPage(1);
1268
+ }
1269
+ }, [calculatedTotalPages, isControlled, currentPage]);
1270
+ const getPageNumbers = () => {
1271
+ const pages = [];
1272
+ const maxVisible = 5;
1273
+ let startPage = Math.max(1, currentPage - Math.floor(maxVisible / 2));
1274
+ let endPage = Math.min(calculatedTotalPages, startPage + maxVisible - 1);
1275
+ if (endPage - startPage < maxVisible - 1) {
1276
+ startPage = Math.max(1, endPage - maxVisible + 1);
1277
+ }
1278
+ for (let i = startPage; i <= endPage; i++) {
1279
+ pages.push(i);
1280
+ }
1281
+ return pages;
1282
+ };
1283
+ const handlePageChange = (page) => {
1284
+ if (page >= 1 && page <= calculatedTotalPages) {
1285
+ if (isControlled && controlledOnPageChange) {
1286
+ controlledOnPageChange(page);
1287
+ } else if (legacyOnPageChange) {
1288
+ legacyOnPageChange(page);
1289
+ } else {
1290
+ setInternalCurrentPage(page);
1291
+ }
1292
+ }
1293
+ };
1294
+ const startItem = totalItems !== void 0 ? (currentPage - 1) * activeItemsPerPage + 1 : null;
1295
+ const endItem = totalItems !== void 0 ? Math.min(currentPage * activeItemsPerPage, totalItems) : null;
1296
+ const renderContent = () => {
1297
+ if (Component) {
1298
+ if (import_react15.default.isValidElement(Component)) {
1299
+ const ComponentType = Component.type;
1300
+ const elementProps = Component.props;
1301
+ if (isTable) {
1302
+ return /* @__PURE__ */ import_react15.default.createElement(
1303
+ CustomTable,
1304
+ {
1305
+ tableHeader,
1306
+ isHideCheckbox
1307
+ },
1308
+ data.map((item, index) => {
1309
+ return /* @__PURE__ */ import_react15.default.createElement(
1310
+ ComponentType,
1311
+ {
1312
+ key: item.id || item._id || index,
1313
+ data: item,
1314
+ ...elementProps,
1315
+ ...componentProps,
1316
+ ...restProps
1317
+ }
1318
+ );
1319
+ })
1320
+ );
1321
+ } else {
1322
+ if (isTable) {
1323
+ return /* @__PURE__ */ import_react15.default.createElement(
1324
+ CustomTable,
1325
+ {
1326
+ tableHeader,
1327
+ isHideCheckbox
1328
+ },
1329
+ paginatedData.map((item, index) => {
1330
+ return /* @__PURE__ */ import_react15.default.createElement(
1331
+ ComponentType,
1332
+ {
1333
+ key: item.id || item._id || index,
1334
+ data: item,
1335
+ ...elementProps,
1336
+ ...componentProps,
1337
+ ...restProps
1338
+ }
1339
+ );
1340
+ })
1341
+ );
1342
+ }
1343
+ }
1344
+ } else {
1345
+ return /* @__PURE__ */ import_react15.default.createElement(
1346
+ CustomTable,
1347
+ {
1348
+ tableHeader,
1349
+ isHideCheckbox
1350
+ },
1351
+ paginatedData.map((item, index) => {
1352
+ return /* @__PURE__ */ import_react15.default.createElement(
1353
+ Component,
1354
+ {
1355
+ key: item.id || item._id || index,
1356
+ data: item,
1357
+ ...componentProps,
1358
+ ...restProps
1359
+ }
1360
+ );
1361
+ })
1362
+ );
1363
+ }
1364
+ }
1365
+ return null;
1366
+ };
1367
+ return /* @__PURE__ */ import_react15.default.createElement(import_react15.default.Fragment, null, /* @__PURE__ */ import_react15.default.createElement(import_react15.default.Fragment, null, renderContent()), /* @__PURE__ */ import_react15.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" }, totalItems !== void 0 && /* @__PURE__ */ import_react15.default.createElement("div", { className: "text-sm text-[#737373] dark:text-white" }, "Showing ", startItem, " to ", endItem, " of ", totalItems, " entries"), /* @__PURE__ */ import_react15.default.createElement("div", { className: "flex items-center gap-2" }, /* @__PURE__ */ import_react15.default.createElement(
1368
+ "button",
1369
+ {
1370
+ onClick: () => handlePageChange(1),
1371
+ disabled: currentPage === 1,
1372
+ 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]"}`,
1373
+ title: "First page"
1374
+ },
1375
+ /* @__PURE__ */ import_react15.default.createElement(import_lucide_react7.ChevronsLeft, { size: 16 })
1376
+ ), /* @__PURE__ */ import_react15.default.createElement(
1377
+ "button",
1378
+ {
1379
+ onClick: () => handlePageChange(currentPage - 1),
1380
+ disabled: currentPage === 1,
1381
+ 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]"}`,
1382
+ title: "Previous page"
1383
+ },
1384
+ /* @__PURE__ */ import_react15.default.createElement(import_lucide_react7.ChevronLeft, { size: 16 })
1385
+ ), getPageNumbers().map((pageNum) => /* @__PURE__ */ import_react15.default.createElement(
1386
+ "button",
1387
+ {
1388
+ key: pageNum,
1389
+ onClick: () => handlePageChange(pageNum),
1390
+ 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]"}`
1391
+ },
1392
+ pageNum
1393
+ )), /* @__PURE__ */ import_react15.default.createElement(
1394
+ "button",
1395
+ {
1396
+ onClick: () => handlePageChange(currentPage + 1),
1397
+ disabled: currentPage === calculatedTotalPages || calculatedTotalPages === 0,
1398
+ 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]"}`,
1399
+ title: "Next page"
1400
+ },
1401
+ /* @__PURE__ */ import_react15.default.createElement(import_lucide_react7.ChevronRight, { size: 16 })
1402
+ ), /* @__PURE__ */ import_react15.default.createElement(
1403
+ "button",
1404
+ {
1405
+ onClick: () => handlePageChange(calculatedTotalPages),
1406
+ disabled: currentPage === calculatedTotalPages || calculatedTotalPages === 0,
1407
+ 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]"}`,
1408
+ title: "Last page"
1409
+ },
1410
+ /* @__PURE__ */ import_react15.default.createElement(import_lucide_react7.ChevronsRight, { size: 16 })
1411
+ ))));
1412
+ };
1413
+ // Annotate the CommonJS export names for ESM import in node:
1414
+ 0 && (module.exports = {
1415
+ AppSideBar,
1416
+ Chip,
1417
+ CustomAutocomplete,
1418
+ CustomButton,
1419
+ CustomCheckbox,
1420
+ CustomInput,
1421
+ CustomSearch,
1422
+ CustomSelect,
1423
+ CustomSwitch,
1424
+ CustomTable,
1425
+ CustomTextarea,
1426
+ CustomUpload,
1427
+ Pagination,
1428
+ ProgressBar,
1429
+ RightSheet
1430
+ });