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