@itilite/lumina-ui 1.0.1 → 1.0.2-alpha

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 (102) hide show
  1. package/README.md +43 -10
  2. package/dist/AdvancedDateRangePicker-ozItnkhp.d.mts +57 -0
  3. package/dist/AdvancedDateRangePicker-ozItnkhp.d.ts +57 -0
  4. package/dist/Table-BOq-_9Nr.d.mts +121 -0
  5. package/dist/Table-BOq-_9Nr.d.ts +121 -0
  6. package/dist/atom/AdvancedDateRangePicker/AdvancedDateRangePicker.d.mts +2 -0
  7. package/dist/atom/AdvancedDateRangePicker/AdvancedDateRangePicker.d.ts +2 -0
  8. package/dist/atom/AdvancedDateRangePicker/AdvancedDateRangePicker.js +791 -0
  9. package/dist/atom/AdvancedDateRangePicker/AdvancedDateRangePicker.mjs +11 -0
  10. package/dist/atom/AdvancedDateRangePicker/InternalCalendar.d.mts +17 -0
  11. package/dist/atom/AdvancedDateRangePicker/InternalCalendar.d.ts +17 -0
  12. package/dist/atom/AdvancedDateRangePicker/InternalCalendar.js +370 -0
  13. package/dist/atom/AdvancedDateRangePicker/InternalCalendar.mjs +8 -0
  14. package/dist/{Avatar.d.mts → atom/Avatar/Avatar.d.mts} +1 -9
  15. package/dist/{Avatar.d.ts → atom/Avatar/Avatar.d.ts} +1 -9
  16. package/dist/{Avatar.js → atom/Avatar/Avatar.js} +4 -2
  17. package/dist/{Avatar.mjs → atom/Avatar/Avatar.mjs} +2 -2
  18. package/dist/{Button.js → atom/Button/Button.js} +1 -1
  19. package/dist/{Button.mjs → atom/Button/Button.mjs} +2 -2
  20. package/dist/{Checkbox.mjs → atom/Checkbox/Checkbox.mjs} +2 -2
  21. package/dist/atom/LoadingSpinner/LoadingSpinner.d.mts +19 -0
  22. package/dist/atom/LoadingSpinner/LoadingSpinner.d.ts +19 -0
  23. package/dist/atom/LoadingSpinner/LoadingSpinner.js +90 -0
  24. package/dist/atom/LoadingSpinner/LoadingSpinner.mjs +9 -0
  25. package/dist/{Modal.d.mts → atom/Modal/Modal.d.mts} +1 -1
  26. package/dist/{Modal.d.ts → atom/Modal/Modal.d.ts} +1 -1
  27. package/dist/{Modal.js → atom/Modal/Modal.js} +1 -1
  28. package/dist/atom/Modal/Modal.mjs +10 -0
  29. package/dist/{Radio.mjs → atom/Radio/Radio.mjs} +2 -2
  30. package/dist/atom/RangePicker/Chevron.d.mts +13 -0
  31. package/dist/atom/RangePicker/Chevron.d.ts +13 -0
  32. package/dist/atom/RangePicker/Chevron.js +110 -0
  33. package/dist/atom/RangePicker/Chevron.mjs +7 -0
  34. package/dist/atom/RangePicker/RangePicker.d.mts +26 -0
  35. package/dist/atom/RangePicker/RangePicker.d.ts +26 -0
  36. package/dist/atom/RangePicker/RangePicker.js +1465 -0
  37. package/dist/atom/RangePicker/RangePicker.mjs +13 -0
  38. package/dist/atom/Select/Select.d.mts +40 -0
  39. package/dist/atom/Select/Select.d.ts +40 -0
  40. package/dist/atom/Select/Select.js +805 -0
  41. package/dist/atom/Select/Select.mjs +11 -0
  42. package/dist/atom/Slider/Slider.d.mts +34 -0
  43. package/dist/atom/Slider/Slider.d.ts +34 -0
  44. package/dist/atom/Slider/Slider.js +107 -0
  45. package/dist/atom/Slider/Slider.mjs +9 -0
  46. package/dist/{Switch.mjs → atom/Switch/Switch.mjs} +2 -2
  47. package/dist/atom/Table/Table.d.mts +3 -0
  48. package/dist/atom/Table/Table.d.ts +3 -0
  49. package/dist/atom/Table/Table.js +306 -0
  50. package/dist/atom/Table/Table.mjs +9 -0
  51. package/dist/atom/Tag/Tag.d.mts +6 -0
  52. package/dist/atom/Tag/Tag.d.ts +6 -0
  53. package/dist/atom/Tag/Tag.js +108 -0
  54. package/dist/atom/Tag/Tag.mjs +9 -0
  55. package/dist/{Tooltip.mjs → atom/Tooltip/Tooltip.mjs} +2 -2
  56. package/dist/chunk-4JX54OKI.mjs +627 -0
  57. package/dist/chunk-4VZB2KR2.mjs +51 -0
  58. package/dist/chunk-53O7JM5I.mjs +424 -0
  59. package/dist/{chunk-HISCHZ5H.mjs → chunk-AF2RKLH6.mjs} +1 -1
  60. package/dist/chunk-D3N7VFER.mjs +73 -0
  61. package/dist/chunk-GU5F7Z7I.mjs +681 -0
  62. package/dist/{chunk-X76GNSBB.mjs → chunk-IWO2Y5QX.mjs} +4 -2
  63. package/dist/chunk-J4YYP4IZ.mjs +0 -0
  64. package/dist/chunk-N2WTNCQU.mjs +66 -0
  65. package/dist/chunk-N4DPPZVJ.mjs +269 -0
  66. package/dist/chunk-PQ3B2FEB.mjs +249 -0
  67. package/dist/chunk-QKTMWS4J.mjs +43 -0
  68. package/dist/{chunk-N355RJGH.mjs → chunk-UQJ3BDM4.mjs} +1 -1
  69. package/dist/chunk-V3CHJHUX.mjs +424 -0
  70. package/dist/chunk-ZTRM4HZJ.mjs +53 -0
  71. package/dist/index.d.mts +18 -7
  72. package/dist/index.d.ts +18 -7
  73. package/dist/index.js +2461 -8
  74. package/dist/index.mjs +46 -12
  75. package/dist/molecules/UserProfile/UserProfile.d.mts +23 -0
  76. package/dist/molecules/UserProfile/UserProfile.d.ts +23 -0
  77. package/dist/molecules/UserProfile/UserProfile.js +243 -0
  78. package/dist/molecules/UserProfile/UserProfile.mjs +11 -0
  79. package/dist/styles.css +1740 -891
  80. package/dist/types-D4MD2w3_.d.mts +9 -0
  81. package/dist/types-D4MD2w3_.d.ts +9 -0
  82. package/dist/types-mhQmqhsR.d.mts +10 -0
  83. package/dist/types-mhQmqhsR.d.ts +10 -0
  84. package/package.json +9 -32
  85. package/dist/Modal.mjs +0 -10
  86. package/dist/chunk-2O2IH2FG.mjs +0 -83
  87. package/dist/styles.d.mts +0 -2
  88. package/dist/styles.d.ts +0 -2
  89. /package/dist/{Button.d.mts → atom/Button/Button.d.mts} +0 -0
  90. /package/dist/{Button.d.ts → atom/Button/Button.d.ts} +0 -0
  91. /package/dist/{Checkbox.d.mts → atom/Checkbox/Checkbox.d.mts} +0 -0
  92. /package/dist/{Checkbox.d.ts → atom/Checkbox/Checkbox.d.ts} +0 -0
  93. /package/dist/{Checkbox.js → atom/Checkbox/Checkbox.js} +0 -0
  94. /package/dist/{Radio.d.mts → atom/Radio/Radio.d.mts} +0 -0
  95. /package/dist/{Radio.d.ts → atom/Radio/Radio.d.ts} +0 -0
  96. /package/dist/{Radio.js → atom/Radio/Radio.js} +0 -0
  97. /package/dist/{Switch.d.mts → atom/Switch/Switch.d.mts} +0 -0
  98. /package/dist/{Switch.d.ts → atom/Switch/Switch.d.ts} +0 -0
  99. /package/dist/{Switch.js → atom/Switch/Switch.js} +0 -0
  100. /package/dist/{Tooltip.d.mts → atom/Tooltip/Tooltip.d.mts} +0 -0
  101. /package/dist/{Tooltip.d.ts → atom/Tooltip/Tooltip.d.ts} +0 -0
  102. /package/dist/{Tooltip.js → atom/Tooltip/Tooltip.js} +0 -0
package/dist/index.js CHANGED
@@ -57,24 +57,32 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
57
57
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
58
58
 
59
59
  // src/index.ts
60
- var src_exports = {};
61
- __export(src_exports, {
60
+ var index_exports = {};
61
+ __export(index_exports, {
62
+ AdvancedDateRangePicker: () => AdvancedDateRangePicker,
62
63
  Avatar: () => Avatar_default,
63
64
  Button: () => Button_default,
64
65
  Checkbox: () => Checkbox_default,
66
+ LoadingSpinner: () => LoadingSpinner_default,
65
67
  Modal: () => Modal_default,
66
68
  Radio: () => Radio_default,
69
+ RangePicker: () => RangePicker_default,
70
+ Select: () => Select_default,
71
+ Slider: () => Slider_default,
67
72
  Switch: () => Switch_default,
68
- Tooltip: () => Tooltip_default
73
+ Table: () => Table,
74
+ Tag: () => Tag_default,
75
+ Tooltip: () => Tooltip_default,
76
+ UserProfile: () => UserProfile_default
69
77
  });
70
- module.exports = __toCommonJS(src_exports);
78
+ module.exports = __toCommonJS(index_exports);
71
79
 
72
80
  // src/atom/Button/Button.tsx
73
81
  var import_antd = require("antd");
74
82
  var import_clsx = __toESM(require("clsx"));
75
83
 
76
84
  // src/atom/Button/Button.module.scss
77
- var Button_module_default = { "button": "Button-module__button___cLCyl", "size_large": "Button-module__size_large___S-mbU", "shape_circle": "Button-module__shape_circle___sPUS5", "size_normal": "Button-module__size_normal___qJUMj", "size_small": "Button-module__size_small___IUeei", "type_primary": "Button-module__type_primary___Tauz-", "variant_subtle": "Button-module__variant_subtle___BMbbd", "variant_text": "Button-module__variant_text___Pc5Ia", "variant_link": "Button-module__variant_link___Cj1O9", "type_secondary": "Button-module__type_secondary___CLmrA", "type_critical": "Button-module__type_critical___6ILOp", "onHoverUnderline": "Button-module__onHoverUnderline___LOfXo" };
85
+ var Button_module_default = { "button": "Button-module__button___cLCyl", "size_large": "Button-module__size_large___S-mbU", "shape_circle": "Button-module__shape_circle___sPUS5", "size_normal": "Button-module__size_normal___qJUMj", "size_small": "Button-module__size_small___IUeei", "type_primary": "Button-module__type_primary___Tauz-", "variant_subtle": "Button-module__variant_subtle___BMbbd", "variant_text": "Button-module__variant_text___Pc5Ia", "variant_link": "Button-module__variant_link___Cj1O9", "disabled": "Button-module__disabled___nwPn4", "type_secondary": "Button-module__type_secondary___CLmrA", "type_critical": "Button-module__type_critical___6ILOp", "onHoverUnderline": "Button-module__onHoverUnderline___LOfXo" };
78
86
 
79
87
  // src/atom/Button/Button.tsx
80
88
  var import_jsx_runtime = require("react/jsx-runtime");
@@ -505,6 +513,8 @@ function Avatar({
505
513
  width = 28,
506
514
  size = "normal"
507
515
  }) {
516
+ var _a;
517
+ const firstChar = (_a = name == null ? void 0 : name[0]) == null ? void 0 : _a.toUpperCase();
508
518
  return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
509
519
  "div",
510
520
  {
@@ -514,7 +524,7 @@ function Avatar({
514
524
  "div",
515
525
  {
516
526
  style: {
517
- backgroundColor: COLOR_MAP[name[0]],
527
+ backgroundColor: COLOR_MAP[firstChar],
518
528
  height,
519
529
  width
520
530
  },
@@ -523,7 +533,7 @@ function Avatar({
523
533
  `tw-text-white tw-font-medium tw-rounded-full tw-flex tw-items-center tw-justify-center`,
524
534
  className
525
535
  ),
526
- children: name[0]
536
+ children: firstChar
527
537
  }
528
538
  ) : img ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
529
539
  "img",
@@ -539,13 +549,2456 @@ function Avatar({
539
549
  }
540
550
  Avatar.displayName = "Avatar";
541
551
  var Avatar_default = Avatar;
552
+
553
+ // src/atom/Tag/Tag.tsx
554
+ var import_antd7 = require("antd");
555
+ var import_clsx7 = __toESM(require("clsx"));
556
+
557
+ // src/atom/Tag/Tag.module.scss
558
+ var Tag_module_default = { "tag": "Tag-module__tag___PIkhI", "small": "Tag-module__small___nG5XQ", "success": "Tag-module__success___99fad", "blue": "Tag-module__blue___Zky2Z", "warning": "Tag-module__warning___KXsly", "processing": "Tag-module__processing___OssXC", "bookingConfirmed": "Tag-module__bookingConfirmed___potR4", "bookingRescheduled": "Tag-module__bookingRescheduled___ynrwI", "bookingRescheduledPending": "Tag-module__bookingRescheduledPending___K3GqS", "failed": "Tag-module__failed___dvpyQ", "bookingPending": "Tag-module__bookingPending___64umX" };
559
+
560
+ // src/atom/Tag/Tag.tsx
561
+ var import_jsx_runtime8 = require("react/jsx-runtime");
562
+ var Tag = (_a) => {
563
+ var _b = _a, {
564
+ type = "success",
565
+ className = "",
566
+ title = "",
567
+ icon = null,
568
+ size = ""
569
+ } = _b, rest = __objRest(_b, [
570
+ "type",
571
+ "className",
572
+ "title",
573
+ "icon",
574
+ "size"
575
+ ]);
576
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
577
+ import_antd7.Tag,
578
+ __spreadProps(__spreadValues({
579
+ className: (0, import_clsx7.default)(
580
+ Tag_module_default.tag,
581
+ size === "small" && Tag_module_default.small,
582
+ Tag_module_default[type],
583
+ className
584
+ ),
585
+ icon
586
+ }, rest), {
587
+ children: title
588
+ })
589
+ );
590
+ };
591
+ Tag.displayName = "Tag";
592
+ var Tag_default = Tag;
593
+
594
+ // src/atom/RangePicker/RangePicker.tsx
595
+ var import_react3 = require("react");
596
+ var import_clsx9 = __toESM(require("clsx"));
597
+ var import_dayjs = __toESM(require("dayjs"));
598
+
599
+ // src/atom/RangePicker/Chevron.tsx
600
+ var React = __toESM(require("react"));
601
+ var import_jsx_runtime9 = require("react/jsx-runtime");
602
+ var Chevron = React.memo(
603
+ (_a) => {
604
+ var _b = _a, { size = "normal", color = "black", className } = _b, rest = __objRest(_b, ["size", "color", "className"]);
605
+ const getSize = (size2) => {
606
+ switch (size2) {
607
+ case "small":
608
+ return "M9.78 11.78a.75.75 0 000-1.06L7.06 8l2.72-2.72a.75.75 0 00-1.06-1.06L5.47 7.47a.75.75 0 000 1.06l3.25 3.25a.75.75 0 001.06 0z";
609
+ case "normal":
610
+ return "M14.78 17.78a.75.75 0 000-1.06L10.06 12l4.72-4.72a.75.75 0 00-1.06-1.06l-5.25 5.25a.75.75 0 000 1.06l5.25 5.25a.75.75 0 001.06 0z";
611
+ default:
612
+ return "M14.78 17.78a.75.75 0 000-1.06L10.06 12l4.72-4.72a.75.75 0 00-1.06-1.06l-5.25 5.25a.75.75 0 000 1.06l5.25 5.25a.75.75 0 001.06 0z";
613
+ }
614
+ };
615
+ const getContainer = (size2) => {
616
+ switch (size2) {
617
+ case "small":
618
+ return 16;
619
+ case "medium":
620
+ return 20;
621
+ case "normal":
622
+ return 24;
623
+ default:
624
+ return 24;
625
+ }
626
+ };
627
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
628
+ "svg",
629
+ __spreadProps(__spreadValues({
630
+ xmlns: "http://www.w3.org/2000/svg",
631
+ width: getContainer(size),
632
+ height: getContainer(size),
633
+ fill: "none",
634
+ viewBox: `0 0 ${getContainer(size)} ${getContainer(size)}`,
635
+ className
636
+ }, rest), {
637
+ children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("path", { fill: color, d: getSize(size) })
638
+ })
639
+ );
640
+ }
641
+ );
642
+
643
+ // src/atom/RangePicker/RangePicker.module.scss
644
+ var RangePicker_module_default = { "range_start": "RangePicker-module__range_start___hGQp-", "range_end": "RangePicker-module__range_end___JJNib" };
645
+
646
+ // src/atom/Select/Select.tsx
647
+ var import_react2 = require("react");
648
+ var import_clsx8 = __toESM(require("clsx"));
649
+
650
+ // src/icons/Chevron.tsx
651
+ var React2 = __toESM(require("react"));
652
+ var import_jsx_runtime10 = require("react/jsx-runtime");
653
+ var Chevron2 = React2.memo(
654
+ (_a) => {
655
+ var _b = _a, { size = 16, color = "#6b7280", className } = _b, rest = __objRest(_b, ["size", "color", "className"]);
656
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
657
+ "svg",
658
+ __spreadProps(__spreadValues({
659
+ xmlns: "http://www.w3.org/2000/svg",
660
+ width: size,
661
+ height: size,
662
+ fill: "none",
663
+ viewBox: "0 0 16 16",
664
+ className
665
+ }, rest), {
666
+ children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
667
+ "path",
668
+ {
669
+ fill: color,
670
+ d: "M11.78 6.22a.75.75 0 00-1.06 0L8 8.94 5.28 6.22a.75.75 0 00-1.06 1.06l3.25 3.25a.75.75 0 001.06 0l3.25-3.25a.75.75 0 000-1.06z"
671
+ }
672
+ )
673
+ })
674
+ );
675
+ }
676
+ );
677
+ Chevron2.displayName = "Chevron";
678
+
679
+ // src/icons/CrossV2.tsx
680
+ var React3 = __toESM(require("react"));
681
+ var import_jsx_runtime11 = require("react/jsx-runtime");
682
+ var CrossV2 = React3.memo(
683
+ (_a) => {
684
+ var _b = _a, { size = 16, color = "#111827", className } = _b, rest = __objRest(_b, ["size", "color", "className"]);
685
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
686
+ "svg",
687
+ __spreadProps(__spreadValues({
688
+ xmlns: "http://www.w3.org/2000/svg",
689
+ width: size,
690
+ height: size,
691
+ fill: "none",
692
+ viewBox: "0 0 20 20"
693
+ }, rest), {
694
+ children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
695
+ "path",
696
+ {
697
+ fill: color,
698
+ d: "M4.411 4.41a.833.833 0 0 1 1.179 0L10 8.822l4.411-4.41a.833.833 0 1 1 1.179 1.178L11.179 10l4.41 4.41a.833.833 0 0 1-1.178 1.18l-4.41-4.411-4.411 4.41a.833.833 0 1 1-1.179-1.178L8.821 10l-4.41-4.41a.833.833 0 0 1 0-1.18"
699
+ }
700
+ )
701
+ })
702
+ );
703
+ }
704
+ );
705
+ CrossV2.displayName = "CrossV2";
706
+
707
+ // src/icons/Lock.tsx
708
+ var import_react = __toESM(require("react"));
709
+ var import_jsx_runtime12 = require("react/jsx-runtime");
710
+ var Lock = import_react.default.memo((_a) => {
711
+ var _b = _a, { size = 16, color = "#000" } = _b, rest = __objRest(_b, ["size", "color"]);
712
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
713
+ "svg",
714
+ __spreadProps(__spreadValues({
715
+ xmlns: "http://www.w3.org/2000/svg",
716
+ width: size,
717
+ height: size,
718
+ fill: "none",
719
+ viewBox: "0 0 16 16"
720
+ }, rest), {
721
+ children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
722
+ "path",
723
+ {
724
+ fill: color,
725
+ d: "M9 9a1 1 0 11-2 0 1 1 0 012 0zM5 4h-.5A2.5 2.5 0 002 6.5v5A2.5 2.5 0 004.5 14h7a2.5 2.5 0 002.5-2.5v-5A2.5 2.5 0 0011.5 4H11v-.5a3 3 0 00-6 0V4zm1-.5a2 2 0 114 0V4H6v-.5zM11.5 5A1.5 1.5 0 0113 6.5v5a1.5 1.5 0 01-1.5 1.5h-7A1.5 1.5 0 013 11.5v-5A1.5 1.5 0 014.5 5h7z"
726
+ }
727
+ )
728
+ })
729
+ );
730
+ });
731
+
732
+ // src/atom/LoadingSpinner/LoadingSpinner.tsx
733
+ var import_icons = require("@ant-design/icons");
734
+ var import_antd8 = require("antd");
735
+
736
+ // src/atom/LoadingSpinner/LoadingSpinner.module.scss
737
+ var LoadingSpinner_module_default = { "spinnerContainer": "LoadingSpinner-module__spinnerContainer___DiPLf" };
738
+
739
+ // src/atom/LoadingSpinner/LoadingSpinner.tsx
740
+ var import_jsx_runtime13 = require("react/jsx-runtime");
741
+ var sizeMapping = {
742
+ xs: 16,
743
+ small: 24,
744
+ medium: 36,
745
+ large: 48
746
+ };
747
+ var LoadingSpinner = (_a) => {
748
+ var _b = _a, { size = "small", color = "#ec5d25" } = _b, rest = __objRest(_b, ["size", "color"]);
749
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", __spreadProps(__spreadValues({ className: LoadingSpinner_module_default.spinnerContainer }, rest), { children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
750
+ import_antd8.Spin,
751
+ {
752
+ indicator: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
753
+ import_icons.LoadingOutlined,
754
+ {
755
+ style: { fontSize: sizeMapping[size], color },
756
+ spin: true
757
+ }
758
+ )
759
+ }
760
+ ) }));
761
+ };
762
+ LoadingSpinner.displayName = "LoadingSpinner";
763
+ var LoadingSpinner_default = LoadingSpinner;
764
+
765
+ // src/atom/Select/Select.tsx
766
+ var import_jsx_runtime14 = require("react/jsx-runtime");
767
+ var InputWrapper = (0, import_react2.memo)(({ children, disabled, disabledTooltip }) => {
768
+ if (disabled && disabledTooltip)
769
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Tooltip_default, { title: disabledTooltip, children });
770
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_jsx_runtime14.Fragment, { children });
771
+ });
772
+ var OptionItem = (0, import_react2.memo)(({
773
+ option,
774
+ index,
775
+ isSelected,
776
+ isHighlighted,
777
+ experience,
778
+ size,
779
+ optionClassName,
780
+ onSelectHandler,
781
+ onMouseEnterHandler
782
+ }) => {
783
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
784
+ "div",
785
+ {
786
+ onClick: () => onSelectHandler(option),
787
+ onMouseEnter: () => onMouseEnterHandler(index),
788
+ className: (0, import_clsx8.default)(
789
+ "tw-transition-all tw-duration-150",
790
+ { "tw-typography-body2": size !== "small" },
791
+ { "tw-typography-caption1": size === "small" },
792
+ optionClassName
793
+ ),
794
+ children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
795
+ "div",
796
+ {
797
+ className: (0, import_clsx8.default)(
798
+ "tw-px-4 tw-cursor-pointer tw-py-2 tw-mx-0.5 tw-rounded-xl",
799
+ isSelected ? experience === "personal" ? "tw-bg-[#f1e8fa]" : "tw-bg-[#fff1e1]" : isHighlighted ? "tw-bg-[#f3f4f6] tw-text-gray-900" : "tw-text-gray-900 hover:tw-bg-[#1118270a]"
800
+ ),
801
+ children: option.label
802
+ }
803
+ )
804
+ }
805
+ );
806
+ });
807
+ var Select = ({
808
+ label,
809
+ mandatory = false,
810
+ error = false,
811
+ options = [],
812
+ valueSelected = "",
813
+ // Keep for backward compatibility
814
+ value: _valueProp,
815
+ // Rename to avoid potential conflicts with native value attribute
816
+ onChange,
817
+ onSearch,
818
+ isLoading = false,
819
+ disabled = false,
820
+ disabledTooltip = "",
821
+ className = "",
822
+ dropdownClassName = "",
823
+ optionClassName = "",
824
+ style = {},
825
+ showDisplayValue = false,
826
+ // New prop to show displayValue instead of label
827
+ allowClear = true,
828
+ enableSearch = true,
829
+ doubleCharSearch = false,
830
+ id,
831
+ name,
832
+ tabIndex,
833
+ // Add tabIndex prop
834
+ // Additional styling props
835
+ size = "default",
836
+ // 'small', 'default', 'large'
837
+ variant = "default",
838
+ // 'default', 'filled', 'outlined'
839
+ wrapperClassName = "",
840
+ inputClassName = "",
841
+ // Custom class for input element specifically
842
+ labelClassName = "",
843
+ // Custom class for label element specifically
844
+ height = "tw-h-12",
845
+ // Custom height
846
+ experience = "business"
847
+ }) => {
848
+ const normalizeValue = (0, import_react2.useCallback)(
849
+ (val) => {
850
+ if (val === null || val === void 0) return "";
851
+ return String(val);
852
+ },
853
+ []
854
+ );
855
+ const validatedOptions = (0, import_react2.useMemo)(() => {
856
+ if (!Array.isArray(options)) return [];
857
+ return options.filter(
858
+ (opt) => opt && typeof opt === "object" && opt.value !== void 0 && opt.value !== null && opt.label !== void 0
859
+ );
860
+ }, [options]);
861
+ const [isOpen, setIsOpen] = (0, import_react2.useState)(false);
862
+ const [isFocused, setIsFocused] = (0, import_react2.useState)(false);
863
+ const [searchTerm, setSearchTerm] = (0, import_react2.useState)("");
864
+ const [isHovering, setIsHovering] = (0, import_react2.useState)(false);
865
+ const [highlightedIndex, setHighlightedIndex] = (0, import_react2.useState)(-1);
866
+ const [selectedValue, setSelectedValue] = (0, import_react2.useState)(() => {
867
+ const initialValue = valueSelected;
868
+ if (initialValue === null || initialValue === void 0) return "";
869
+ return String(initialValue);
870
+ });
871
+ const inputRef = (0, import_react2.useRef)(null);
872
+ const inputValueRef = (0, import_react2.useRef)("");
873
+ const dropdownRef = (0, import_react2.useRef)(null);
874
+ const optionRefs = (0, import_react2.useRef)([]);
875
+ const optionListRef = (0, import_react2.useRef)(null);
876
+ const blurTimeoutRef = (0, import_react2.useRef)(null);
877
+ const hoverTimeoutRef = (0, import_react2.useRef)(null);
878
+ const isActive = isFocused || Boolean(selectedValue) || Boolean(valueSelected) || Boolean(searchTerm);
879
+ const sizeClasses = (0, import_react2.useMemo)(() => {
880
+ switch (size) {
881
+ case "small":
882
+ return {
883
+ input: "tw-h-6 tw-typography-caption1Bold !tw-rounded-lg",
884
+ padding: "tw-px-2 tw-py-1",
885
+ labelActive: "tw-top-0.5 tw-typography-caption2",
886
+ labelInactive: "tw-top-1.5 tw-typography-caption3"
887
+ };
888
+ case "medium":
889
+ return {
890
+ input: "tw-h-10 tw-px-4 tw-typography-body2",
891
+ padding: label ? "tw-pt-4 tw-pb-1" : "tw-py-2",
892
+ labelActive: "tw-top-1 tw-typography-caption3",
893
+ labelInactive: "tw-top-2.5 tw-typography-body2"
894
+ };
895
+ case "large":
896
+ return {
897
+ input: "tw-h-16 tw-px-5 tw-typography-bodyLarge",
898
+ padding: label ? "tw-pt-8 tw-pb-4" : "tw-py-5",
899
+ labelActive: "tw-top-1 tw-typography-caption2",
900
+ labelInactive: "tw-top-5 tw-typography-body1"
901
+ };
902
+ default:
903
+ return {
904
+ input: height + " tw-px-4 tw-typography-bodyLarge",
905
+ padding: label ? "tw-pt-6 tw-pb-3" : "tw-py-3",
906
+ labelActive: "tw-top-1 tw-typography-caption3",
907
+ labelInactive: "tw-top-3.5 tw-typography-body2"
908
+ };
909
+ }
910
+ }, [size, label, height]);
911
+ const variantClasses = (0, import_react2.useMemo)(() => {
912
+ switch (variant) {
913
+ case "filled":
914
+ return "tw-bg-gray-50 tw-border-transparent";
915
+ case "outlined":
916
+ return "tw-bg-transparent tw-border-2";
917
+ default:
918
+ return " tw-border";
919
+ }
920
+ }, [variant]);
921
+ const handleBlur = (0, import_react2.useCallback)(() => {
922
+ blurTimeoutRef.current = setTimeout(() => {
923
+ setIsOpen(false);
924
+ setSearchTerm("");
925
+ setHighlightedIndex(-1);
926
+ blurTimeoutRef.current = null;
927
+ setIsFocused(false);
928
+ }, 150);
929
+ }, []);
930
+ const handleSearchChange = (0, import_react2.useCallback)(
931
+ (e) => {
932
+ var _a;
933
+ const searchValue = doubleCharSearch ? e.target.value.slice(0, 2) || "" : e.target.value;
934
+ if (doubleCharSearch) {
935
+ setSearchTerm(searchValue);
936
+ } else {
937
+ setSearchTerm(searchValue);
938
+ }
939
+ setIsOpen(true);
940
+ setHighlightedIndex(-1);
941
+ if (onSearch && typeof onSearch === "function") {
942
+ onSearch(searchValue);
943
+ }
944
+ (_a = optionListRef == null ? void 0 : optionListRef.current) == null ? void 0 : _a.scrollTo({
945
+ top: 0,
946
+ behavior: "smooth"
947
+ });
948
+ },
949
+ [doubleCharSearch, onSearch]
950
+ );
951
+ const handleOptionSelect = (0, import_react2.useCallback)(
952
+ (option) => {
953
+ var _a;
954
+ if (blurTimeoutRef.current) {
955
+ clearTimeout(blurTimeoutRef.current);
956
+ blurTimeoutRef.current = null;
957
+ }
958
+ inputValueRef.current = option.label;
959
+ const normalizedValue = normalizeValue(option.value);
960
+ setSelectedValue(normalizedValue);
961
+ setSearchTerm("");
962
+ setIsOpen(false);
963
+ if (enableSearch) {
964
+ setIsFocused(false);
965
+ }
966
+ setIsHovering(false);
967
+ if (onChange) onChange(option.value);
968
+ if (enableSearch) (_a = inputRef.current) == null ? void 0 : _a.blur();
969
+ },
970
+ [normalizeValue, onChange, enableSearch]
971
+ );
972
+ const handleClear = (0, import_react2.useCallback)(
973
+ (e) => {
974
+ var _a;
975
+ inputValueRef.current = "";
976
+ e.stopPropagation();
977
+ e.preventDefault();
978
+ setSelectedValue("");
979
+ setSearchTerm("");
980
+ if (enableSearch) {
981
+ setIsOpen(true);
982
+ setIsFocused(true);
983
+ (_a = inputRef.current) == null ? void 0 : _a.focus();
984
+ } else {
985
+ setIsOpen(false);
986
+ setIsFocused(false);
987
+ }
988
+ if (onChange) onChange(null);
989
+ },
990
+ [onChange, enableSearch]
991
+ );
992
+ (0, import_react2.useEffect)(() => {
993
+ if (!validatedOptions.length) {
994
+ setSelectedValue("");
995
+ setSearchTerm("");
996
+ inputValueRef.current = "";
997
+ }
998
+ }, [validatedOptions.length]);
999
+ (0, import_react2.useEffect)(() => {
1000
+ const externalValue = _valueProp !== void 0 ? _valueProp : valueSelected;
1001
+ const newValue = normalizeValue(externalValue);
1002
+ setSelectedValue((prevValue) => {
1003
+ const prevNormalized = normalizeValue(prevValue);
1004
+ return prevNormalized !== newValue ? newValue : prevValue;
1005
+ });
1006
+ }, [valueSelected, _valueProp, normalizeValue]);
1007
+ (0, import_react2.useEffect)(() => {
1008
+ const handleClickOutside = (event) => {
1009
+ if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
1010
+ if (blurTimeoutRef.current) {
1011
+ clearTimeout(blurTimeoutRef.current);
1012
+ blurTimeoutRef.current = null;
1013
+ }
1014
+ setIsOpen(false);
1015
+ setIsFocused(false);
1016
+ setSearchTerm("");
1017
+ setHighlightedIndex(-1);
1018
+ }
1019
+ };
1020
+ document.addEventListener("mousedown", handleClickOutside);
1021
+ return () => {
1022
+ document.removeEventListener("mousedown", handleClickOutside);
1023
+ if (blurTimeoutRef.current) {
1024
+ clearTimeout(blurTimeoutRef.current);
1025
+ }
1026
+ if (hoverTimeoutRef.current) {
1027
+ clearTimeout(hoverTimeoutRef.current);
1028
+ }
1029
+ };
1030
+ }, []);
1031
+ const getDisplayValue = (0, import_react2.useCallback)(() => {
1032
+ if (selectedValue && (validatedOptions == null ? void 0 : validatedOptions.length) > 0) {
1033
+ const selected = validatedOptions.find(
1034
+ (opt) => normalizeValue(opt.value) === normalizeValue(selectedValue)
1035
+ );
1036
+ if (selected) {
1037
+ return showDisplayValue && selected.displayValue ? selected.displayValue : selected.label;
1038
+ }
1039
+ }
1040
+ if (selectedValue && (!validatedOptions || validatedOptions.length === 0)) {
1041
+ return selectedValue;
1042
+ }
1043
+ return "";
1044
+ }, [selectedValue, validatedOptions, showDisplayValue, normalizeValue]);
1045
+ const displayValue = (0, import_react2.useMemo)(() => getDisplayValue(), [getDisplayValue]);
1046
+ const inputClasses = (0, import_react2.useMemo)(() => {
1047
+ return (0, import_clsx8.default)(
1048
+ "tw-w-full tw-rounded-xl tw-outline-none tw-transition-all tw-duration-200 tw-cursor-pointer tw-border-solid tw-text-color-text-default",
1049
+ sizeClasses.input,
1050
+ sizeClasses.padding,
1051
+ variantClasses,
1052
+ {
1053
+ "tw-bg-white": valueSelected || displayValue || isFocused,
1054
+ "tw-bg-color-gray-5": !valueSelected || !displayValue,
1055
+ "!tw-bg-[#F8F7F6] tw-cursor-not-allowed tw-pointer-events-none": disabled
1056
+ },
1057
+ !label && "tw-flex tw-items-center",
1058
+ {
1059
+ "!tw-border-color-primary": isFocused && experience === "business"
1060
+ },
1061
+ {
1062
+ "!tw-border-[#804D7B]": isFocused && experience === "personal"
1063
+ },
1064
+ error ? "!tw-border-color-text-critical " : "tw-border-[#EBE3DD] hover:tw-border-[#C5B7AC]",
1065
+ "focus:tw-shadow-sm focus:tw-ring-offset-1",
1066
+ className,
1067
+ inputClassName
1068
+ );
1069
+ }, [sizeClasses, variantClasses, valueSelected, displayValue, isFocused, disabled, label, experience, error, className, inputClassName]);
1070
+ const filteredOptions = (0, import_react2.useMemo)(() => {
1071
+ var _a;
1072
+ if (!enableSearch) {
1073
+ return validatedOptions;
1074
+ }
1075
+ (_a = dropdownRef.current) == null ? void 0 : _a.scrollTo(0, 0);
1076
+ const updatedFilteredOptions = validatedOptions.filter((option) => {
1077
+ var _a2;
1078
+ return (_a2 = option == null ? void 0 : option.label) == null ? void 0 : _a2.toLowerCase().includes(searchTerm == null ? void 0 : searchTerm.toLowerCase());
1079
+ });
1080
+ return updatedFilteredOptions;
1081
+ }, [validatedOptions, searchTerm, enableSearch]);
1082
+ const getSelectedOptionIndex = (0, import_react2.useCallback)(() => {
1083
+ if (!selectedValue || !filteredOptions.length) {
1084
+ return 0;
1085
+ }
1086
+ const index = filteredOptions.findIndex(
1087
+ (option) => normalizeValue(option.value) === normalizeValue(selectedValue)
1088
+ );
1089
+ return index >= 0 ? index : 0;
1090
+ }, [selectedValue, filteredOptions, normalizeValue]);
1091
+ const handleInputInteraction = (0, import_react2.useCallback)(
1092
+ (_e) => {
1093
+ var _a;
1094
+ if (blurTimeoutRef.current) {
1095
+ clearTimeout(blurTimeoutRef.current);
1096
+ blurTimeoutRef.current = null;
1097
+ }
1098
+ if (isOpen) {
1099
+ setIsOpen(false);
1100
+ setIsFocused(false);
1101
+ setSearchTerm("");
1102
+ setHighlightedIndex(-1);
1103
+ (_a = inputRef.current) == null ? void 0 : _a.blur();
1104
+ return;
1105
+ }
1106
+ setIsFocused(true);
1107
+ setIsOpen(true);
1108
+ setHighlightedIndex(getSelectedOptionIndex());
1109
+ if (inputRef.current) {
1110
+ inputRef.current.focus();
1111
+ }
1112
+ },
1113
+ [isOpen, getSelectedOptionIndex]
1114
+ );
1115
+ const handleKeyDown = (0, import_react2.useCallback)(
1116
+ (e) => {
1117
+ var _a;
1118
+ if (!isOpen) return;
1119
+ switch (e.key) {
1120
+ case "ArrowDown":
1121
+ e.preventDefault();
1122
+ setHighlightedIndex((prev) => {
1123
+ const nextIndex = prev < filteredOptions.length - 1 ? prev + 1 : prev;
1124
+ return nextIndex;
1125
+ });
1126
+ break;
1127
+ case "ArrowUp":
1128
+ e.preventDefault();
1129
+ setHighlightedIndex((prev) => {
1130
+ const nextIndex = prev > 0 ? prev - 1 : prev;
1131
+ return nextIndex;
1132
+ });
1133
+ break;
1134
+ case "Enter":
1135
+ e.preventDefault();
1136
+ if (highlightedIndex >= 0 && filteredOptions[highlightedIndex]) {
1137
+ handleOptionSelect(filteredOptions[highlightedIndex]);
1138
+ }
1139
+ break;
1140
+ case "Escape":
1141
+ e.preventDefault();
1142
+ setIsOpen(false);
1143
+ setIsFocused(false);
1144
+ setSearchTerm("");
1145
+ setHighlightedIndex(-1);
1146
+ (_a = inputRef.current) == null ? void 0 : _a.blur();
1147
+ break;
1148
+ default:
1149
+ break;
1150
+ }
1151
+ },
1152
+ [isOpen, highlightedIndex, filteredOptions, handleOptionSelect]
1153
+ );
1154
+ (0, import_react2.useEffect)(() => {
1155
+ if (highlightedIndex >= 0 && optionRefs.current[highlightedIndex]) {
1156
+ optionRefs.current[highlightedIndex].scrollIntoView({
1157
+ block: "nearest",
1158
+ behavior: "smooth"
1159
+ });
1160
+ }
1161
+ }, [highlightedIndex]);
1162
+ (0, import_react2.useEffect)(() => {
1163
+ optionRefs.current = [];
1164
+ }, [filteredOptions.length]);
1165
+ const handleMouseEnter = (0, import_react2.useCallback)(() => {
1166
+ if (hoverTimeoutRef.current) {
1167
+ clearTimeout(hoverTimeoutRef.current);
1168
+ }
1169
+ if (!isHovering) {
1170
+ setIsHovering(true);
1171
+ }
1172
+ }, [isHovering]);
1173
+ const handleMouseLeave = (0, import_react2.useCallback)(() => {
1174
+ hoverTimeoutRef.current = setTimeout(() => {
1175
+ setIsHovering(false);
1176
+ }, 50);
1177
+ }, []);
1178
+ const handleChevronClick = (0, import_react2.useCallback)(
1179
+ (e) => {
1180
+ var _a;
1181
+ e.preventDefault();
1182
+ if (blurTimeoutRef.current) {
1183
+ clearTimeout(blurTimeoutRef.current);
1184
+ blurTimeoutRef.current = null;
1185
+ }
1186
+ if (isOpen) {
1187
+ setIsOpen(false);
1188
+ setIsFocused(false);
1189
+ setSearchTerm("");
1190
+ setHighlightedIndex(-1);
1191
+ (_a = inputRef.current) == null ? void 0 : _a.blur();
1192
+ } else {
1193
+ if (inputRef.current) {
1194
+ inputRef.current.focus();
1195
+ }
1196
+ handleInputInteraction();
1197
+ }
1198
+ },
1199
+ [isOpen, handleInputInteraction]
1200
+ );
1201
+ const handleChevronMouseDown = (0, import_react2.useCallback)(
1202
+ (e) => {
1203
+ if (isHovering && selectedValue && allowClear) {
1204
+ handleClear(e);
1205
+ } else {
1206
+ handleChevronClick(e);
1207
+ }
1208
+ },
1209
+ [isHovering, selectedValue, allowClear, handleClear, handleChevronClick]
1210
+ );
1211
+ const handleOptionClick = (0, import_react2.useCallback)((option) => {
1212
+ handleOptionSelect(option);
1213
+ }, [handleOptionSelect]);
1214
+ const handleOptionMouseEnter = (0, import_react2.useCallback)((index) => {
1215
+ setHighlightedIndex(index);
1216
+ }, []);
1217
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(InputWrapper, { disabled, disabledTooltip, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
1218
+ "div",
1219
+ {
1220
+ style,
1221
+ className: (0, import_clsx8.default)("tw-relative tw-w-full", wrapperClassName, {
1222
+ "tw-cursor-not-allowed": disabled
1223
+ }),
1224
+ ref: dropdownRef,
1225
+ onMouseEnter: handleMouseEnter,
1226
+ onMouseLeave: handleMouseLeave,
1227
+ children: [
1228
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "tw-relative", children: [
1229
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1230
+ "input",
1231
+ {
1232
+ ref: inputRef,
1233
+ type: "text",
1234
+ id,
1235
+ name,
1236
+ tabIndex,
1237
+ autoComplete: "off",
1238
+ autoCorrect: "off",
1239
+ autoCapitalize: "off",
1240
+ spellCheck: "false",
1241
+ value: isFocused && enableSearch ? searchTerm : displayValue,
1242
+ onChange: enableSearch ? handleSearchChange : void 0,
1243
+ onClick: handleInputInteraction,
1244
+ onKeyDown: handleKeyDown,
1245
+ className: inputClasses,
1246
+ readOnly: !isFocused || !enableSearch
1247
+ }
1248
+ ),
1249
+ label && size !== "small" && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
1250
+ "label",
1251
+ {
1252
+ htmlFor: id,
1253
+ className: (0, import_clsx8.default)(
1254
+ "tw-absolute tw-left-[18px] tw-pointer-events-none tw-transition-all tw-duration-200 tw-ease-out tw-text-gray-500",
1255
+ isActive ? sizeClasses.labelActive : sizeClasses.labelInactive,
1256
+ error && "tw-text-color-text-critical",
1257
+ labelClassName
1258
+ ),
1259
+ children: [
1260
+ label,
1261
+ mandatory && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "tw-text-color-text-critical tw-ml-1", children: "*" })
1262
+ ]
1263
+ }
1264
+ ),
1265
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
1266
+ "div",
1267
+ {
1268
+ className: (0, import_clsx8.default)(
1269
+ "tw-absolute tw-right-3 tw--translate-y-1/2 tw-flex tw-items-center",
1270
+ {
1271
+ "!tw-right-[5px]": doubleCharSearch && !(isHovering && selectedValue && allowClear),
1272
+ "tw-top-3 !tw-right-2": size === "small",
1273
+ "tw-top-1/2": size !== "small"
1274
+ }
1275
+ ),
1276
+ children: [
1277
+ disabled && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "tw-absolute tw-right-0 -tw-top-2", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Lock, { size: 16 }) }),
1278
+ isLoading ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(LoadingSpinner_default, { size: "xs" }) }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1279
+ "div",
1280
+ {
1281
+ className: (0, import_clsx8.default)(
1282
+ "tw-transition-all tw-duration-200 tw-cursor-pointer tw-flex tw-items-center",
1283
+ // Only rotate chevron when open and not showing clear icon
1284
+ isOpen && !(isHovering && selectedValue && allowClear) && "-tw-rotate-180"
1285
+ ),
1286
+ onMouseDown: handleChevronMouseDown,
1287
+ children: disabled ? null : isHovering && selectedValue && allowClear ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1288
+ CrossV2,
1289
+ {
1290
+ color: "#111827",
1291
+ className: (0, import_clsx8.default)({ "tw-mr-1": size !== "small" }),
1292
+ size: size === "small" ? 12 : 16
1293
+ }
1294
+ ) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1295
+ Chevron2,
1296
+ {
1297
+ className: (0, import_clsx8.default)("tw-text-gray-400"),
1298
+ color: "#6B7280"
1299
+ }
1300
+ )
1301
+ }
1302
+ )
1303
+ ]
1304
+ }
1305
+ )
1306
+ ] }),
1307
+ isOpen && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1308
+ "div",
1309
+ {
1310
+ className: (0, import_clsx8.default)(
1311
+ "tw-absolute tw-z-[100] tw-w-full tw-mt-0 tw-bg-white tw-border tw-border-[#ebe3dd] tw-border-solid tw-rounded-xl tw-shadow-lg tw-overflow-y-auto tw-py-1",
1312
+ { "tw-max-h-60": !doubleCharSearch },
1313
+ { "tw-max-h-44": doubleCharSearch },
1314
+ dropdownClassName
1315
+ ),
1316
+ ref: optionListRef,
1317
+ children: filteredOptions.length > 0 ? filteredOptions.map((option, index) => {
1318
+ const isSelected = normalizeValue(selectedValue) === normalizeValue(option.value);
1319
+ const isHighlighted = index === highlightedIndex;
1320
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { ref: (el) => optionRefs.current[index] = el, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1321
+ OptionItem,
1322
+ {
1323
+ option,
1324
+ index,
1325
+ isSelected,
1326
+ isHighlighted,
1327
+ experience,
1328
+ size,
1329
+ optionClassName,
1330
+ onSelectHandler: handleOptionClick,
1331
+ onMouseEnterHandler: handleOptionMouseEnter
1332
+ }
1333
+ ) }, doubleCharSearch ? option.label : option.value);
1334
+ }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "tw-px-4 tw-py-3 tw-text-gray-500 tw-text-sm", children: "No options found" })
1335
+ }
1336
+ )
1337
+ ]
1338
+ }
1339
+ ) });
1340
+ };
1341
+ Select.displayName = "Select";
1342
+ var Select_default = Select;
1343
+
1344
+ // src/atom/RangePicker/RangePicker.tsx
1345
+ var import_jsx_runtime15 = require("react/jsx-runtime");
1346
+ function CustomRangePicker(props) {
1347
+ var _a, _b;
1348
+ const {
1349
+ id = "",
1350
+ footer,
1351
+ onChange = () => {
1352
+ },
1353
+ dateRange = ["", ""],
1354
+ showNightCount = false,
1355
+ isRange = true,
1356
+ showYearDropdown = false,
1357
+ showSingleCalendar = false,
1358
+ disablePastDates = false,
1359
+ // New prop to control past date restriction
1360
+ minDate = null,
1361
+ // New prop for minimum allowed date
1362
+ maxDate = null,
1363
+ // New prop for maximum allowed date
1364
+ minYear = 1900,
1365
+ // Minimum year for dropdown
1366
+ maxYear = (/* @__PURE__ */ new Date()).getFullYear() + 10,
1367
+ // Maximum year for dropdown
1368
+ experience = "business",
1369
+ showToastError = () => {
1370
+ }
1371
+ } = props;
1372
+ const onChangeRef = (0, import_react3.useRef)(onChange);
1373
+ (0, import_react3.useEffect)(() => {
1374
+ onChangeRef.current = onChange;
1375
+ }, [onChange]);
1376
+ const getInitialDate = () => {
1377
+ if (dateRange[0]) {
1378
+ return new Date(dateRange[0]);
1379
+ }
1380
+ if (!minDate && !maxDate && !minYear && !maxYear) {
1381
+ return /* @__PURE__ */ new Date();
1382
+ }
1383
+ if (maxYear && maxYear !== (/* @__PURE__ */ new Date()).getFullYear()) {
1384
+ let targetDate = new Date(maxYear, 7, 1);
1385
+ if (maxDate) {
1386
+ const maxDateTime = new Date(maxDate);
1387
+ if (targetDate > maxDateTime) {
1388
+ targetDate = new Date(
1389
+ maxDateTime.getFullYear(),
1390
+ maxDateTime.getMonth(),
1391
+ 1
1392
+ );
1393
+ }
1394
+ }
1395
+ return targetDate;
1396
+ }
1397
+ if (minDate) {
1398
+ const minDateTime = new Date(minDate);
1399
+ minDateTime.setHours(0, 0, 0, 0);
1400
+ return minDateTime;
1401
+ }
1402
+ return /* @__PURE__ */ new Date();
1403
+ };
1404
+ const [currentDate, setCurrentDate] = (0, import_react3.useState)(() => getInitialDate());
1405
+ const [startDate, setStartDate] = (0, import_react3.useState)(
1406
+ dateRange[0] ? new Date(dateRange[0]) : null
1407
+ );
1408
+ const [endDate, setEndDate] = (0, import_react3.useState)(
1409
+ dateRange[0] && dateRange[1] ? new Date(dateRange[1]) : null
1410
+ );
1411
+ const [hoverDate, setHoverDate] = (0, import_react3.useState)(null);
1412
+ const [isSelectingEnd, setIsSelectingEnd] = (0, import_react3.useState)(
1413
+ dateRange[0] && !dateRange[1] ? true : false
1414
+ );
1415
+ const [selectedDate, setSelectedDate] = (0, import_react3.useState)(
1416
+ !isRange && dateRange[0] ? new Date(dateRange[0]) : null
1417
+ );
1418
+ (0, import_react3.useEffect)(() => {
1419
+ const newStart = dateRange[0] ? new Date(dateRange[0]) : null;
1420
+ const newEnd = dateRange[1] ? new Date(dateRange[1]) : null;
1421
+ setStartDate(newStart);
1422
+ setEndDate(newEnd);
1423
+ if (newStart) {
1424
+ setCurrentDate(new Date(newStart.getFullYear(), newStart.getMonth(), 1));
1425
+ }
1426
+ }, [dateRange]);
1427
+ const getDaysBetween = (start, end) => {
1428
+ if (!start || !end) return 0;
1429
+ const startDay = (0, import_dayjs.default)(start).startOf("day");
1430
+ const endDay = (0, import_dayjs.default)(end).startOf("day");
1431
+ return endDay.diff(startDay, "day");
1432
+ };
1433
+ const nightCount = Math.abs(getDaysBetween(startDate || endDate, hoverDate));
1434
+ const nightCountText = nightCount > 1 ? `${nightCount} nights` : "1 night";
1435
+ const today = /* @__PURE__ */ new Date();
1436
+ today.setHours(0, 0, 0, 0);
1437
+ const firstMonth = new Date(
1438
+ currentDate.getFullYear(),
1439
+ currentDate.getMonth(),
1440
+ 1
1441
+ );
1442
+ const secondMonth = new Date(
1443
+ currentDate.getFullYear(),
1444
+ currentDate.getMonth() + 1,
1445
+ 1
1446
+ );
1447
+ const monthNames = [
1448
+ "January",
1449
+ "February",
1450
+ "March",
1451
+ "April",
1452
+ "May",
1453
+ "June",
1454
+ "July",
1455
+ "August",
1456
+ "September",
1457
+ "October",
1458
+ "November",
1459
+ "December"
1460
+ ];
1461
+ const dayNames = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"];
1462
+ const generateYearOptions = () => {
1463
+ const years = [];
1464
+ for (let i = minYear; i <= maxYear; i++) {
1465
+ const isYearDisabled = isYearCompletelyDisabled(i);
1466
+ years.push({
1467
+ label: i.toString(),
1468
+ value: i,
1469
+ disabled: isYearDisabled
1470
+ });
1471
+ }
1472
+ return years;
1473
+ };
1474
+ const isYearCompletelyDisabled = (year) => {
1475
+ const firstDayOfYear = new Date(year, 0, 1);
1476
+ const lastDayOfYear = new Date(year, 11, 31);
1477
+ if (minDate) {
1478
+ const minDateTime = new Date(minDate);
1479
+ minDateTime.setHours(0, 0, 0, 0);
1480
+ if (minDateTime > lastDayOfYear) {
1481
+ return true;
1482
+ }
1483
+ }
1484
+ if (maxDate) {
1485
+ const maxDateTime = new Date(maxDate);
1486
+ maxDateTime.setHours(0, 0, 0, 0);
1487
+ if (maxDateTime < firstDayOfYear) {
1488
+ return true;
1489
+ }
1490
+ }
1491
+ if (disablePastDates) {
1492
+ const today2 = /* @__PURE__ */ new Date();
1493
+ today2.setHours(0, 0, 0, 0);
1494
+ if (lastDayOfYear < today2) {
1495
+ return true;
1496
+ }
1497
+ }
1498
+ return false;
1499
+ };
1500
+ const yearOptions = generateYearOptions();
1501
+ const generateCalendarDays = (monthDate) => {
1502
+ const year = monthDate.getFullYear();
1503
+ const month = monthDate.getMonth();
1504
+ const firstDay = new Date(year, month, 1);
1505
+ const lastDay = new Date(year, month + 1, 0);
1506
+ const daysInMonth = lastDay.getDate();
1507
+ const startingDayOfWeek = firstDay.getDay();
1508
+ const days = [];
1509
+ for (let i = 0; i < startingDayOfWeek; i++) {
1510
+ days.push(null);
1511
+ }
1512
+ for (let day = 1; day <= daysInMonth; day++) {
1513
+ days.push(new Date(year, month, day));
1514
+ }
1515
+ return days;
1516
+ };
1517
+ const formatDateKey = (date) => {
1518
+ if (!date) return "";
1519
+ return `${date.getFullYear()}-${date.getMonth()}-${date.getDate()}`;
1520
+ };
1521
+ const isSameDate = (date1, date2) => {
1522
+ if (!date1 || !date2) return false;
1523
+ return formatDateKey(date1) === formatDateKey(date2);
1524
+ };
1525
+ const isDateDisabled = (date) => {
1526
+ if (!date) return false;
1527
+ const checkDate = new Date(date);
1528
+ checkDate.setHours(0, 0, 0, 0);
1529
+ if (disablePastDates && checkDate < today) {
1530
+ return true;
1531
+ }
1532
+ if (minDate) {
1533
+ const minDateTime = new Date(minDate);
1534
+ minDateTime.setHours(0, 0, 0, 0);
1535
+ if (checkDate < minDateTime) {
1536
+ return true;
1537
+ }
1538
+ }
1539
+ if (maxDate) {
1540
+ const maxDateTime = new Date(maxDate);
1541
+ maxDateTime.setHours(0, 0, 0, 0);
1542
+ if (checkDate > maxDateTime) {
1543
+ return true;
1544
+ }
1545
+ }
1546
+ return false;
1547
+ };
1548
+ const isDateInRange = (date) => {
1549
+ if (!isRange || !startDate || !date) return false;
1550
+ const compareDate = endDate || hoverDate;
1551
+ if (!compareDate) return false;
1552
+ const start = startDate < compareDate ? startDate : compareDate;
1553
+ const end = startDate < compareDate ? compareDate : startDate;
1554
+ return date >= start && date <= end;
1555
+ };
1556
+ const isDateBetweenRange = (date) => {
1557
+ if (!isRange || !startDate || !date) return false;
1558
+ const compareDate = endDate || hoverDate;
1559
+ if (!compareDate) return false;
1560
+ const start = startDate < compareDate ? startDate : compareDate;
1561
+ const end = startDate < compareDate ? compareDate : startDate;
1562
+ return date > start && date < end;
1563
+ };
1564
+ const handleDateClick = (date) => {
1565
+ if (isDateDisabled(date)) return;
1566
+ if (!isRange) {
1567
+ setSelectedDate(date);
1568
+ onChangeRef.current(null, (0, import_dayjs.default)(date).format("D MMM, YYYY"));
1569
+ return;
1570
+ }
1571
+ let nextStart = startDate;
1572
+ let nextEnd = endDate;
1573
+ const isCheckinCheckoutSame = (0, import_dayjs.default)(date).format("D MMM, YYYY") === (0, import_dayjs.default)(startDate).format("D MMM, YYYY");
1574
+ if (showNightCount && isCheckinCheckoutSame) {
1575
+ setStartDate(null);
1576
+ setEndDate(null);
1577
+ setIsSelectingEnd(false);
1578
+ setHoverDate(null);
1579
+ showToastError("Check-in and check-out dates cannot be the same.");
1580
+ onChangeRef.current(null, ["", ""]);
1581
+ return;
1582
+ }
1583
+ if (!startDate || startDate && endDate) {
1584
+ nextStart = date;
1585
+ nextEnd = null;
1586
+ setStartDate(nextStart);
1587
+ setEndDate(nextEnd);
1588
+ setIsSelectingEnd(true);
1589
+ setHoverDate(null);
1590
+ } else if (startDate && !endDate) {
1591
+ if (date < startDate) {
1592
+ nextEnd = startDate;
1593
+ nextStart = date;
1594
+ } else {
1595
+ nextEnd = date;
1596
+ }
1597
+ setStartDate(nextStart);
1598
+ setEndDate(nextEnd);
1599
+ setIsSelectingEnd(false);
1600
+ setHoverDate(null);
1601
+ }
1602
+ onChangeRef.current(null, [
1603
+ nextStart ? (0, import_dayjs.default)(nextStart).format("D MMM, YYYY") : "",
1604
+ nextEnd ? (0, import_dayjs.default)(nextEnd).format("D MMM, YYYY") : ""
1605
+ ]);
1606
+ };
1607
+ (0, import_react3.useEffect)(() => {
1608
+ if (isRange && startDate && !endDate) {
1609
+ sessionStorage.setItem(
1610
+ "rangePickerStartDate",
1611
+ (0, import_dayjs.default)(startDate).format("D MMM, YYYY")
1612
+ );
1613
+ }
1614
+ }, [startDate, endDate, isRange]);
1615
+ const handleDateHover = (date) => {
1616
+ if (isDateDisabled(date) || !isRange) return;
1617
+ if (isSelectingEnd && startDate && !endDate) {
1618
+ setHoverDate(date);
1619
+ }
1620
+ };
1621
+ const navigateMonth = (direction) => {
1622
+ const newDate = new Date(currentDate);
1623
+ newDate.setMonth(currentDate.getMonth() + direction);
1624
+ setCurrentDate(newDate);
1625
+ };
1626
+ const isPreviousMonthDisabled = () => {
1627
+ const previousMonth = new Date(currentDate);
1628
+ previousMonth.setMonth(currentDate.getMonth() - 1);
1629
+ const lastDayOfPreviousMonth = new Date(
1630
+ previousMonth.getFullYear(),
1631
+ previousMonth.getMonth() + 1,
1632
+ 0
1633
+ );
1634
+ return isDateDisabled(lastDayOfPreviousMonth);
1635
+ };
1636
+ const isNextMonthDisabled = () => {
1637
+ const nextMonth = new Date(currentDate);
1638
+ nextMonth.setMonth(currentDate.getMonth() + 1);
1639
+ const firstDayOfNextMonth = new Date(
1640
+ nextMonth.getFullYear(),
1641
+ nextMonth.getMonth(),
1642
+ 1
1643
+ );
1644
+ return isDateDisabled(firstDayOfNextMonth);
1645
+ };
1646
+ const handleYearChange = (selectedYear) => {
1647
+ const newDate = new Date(currentDate);
1648
+ newDate.setFullYear(selectedYear);
1649
+ const targetMonth = newDate.getMonth();
1650
+ if (!isMonthDisabled(selectedYear, targetMonth)) {
1651
+ setCurrentDate(newDate);
1652
+ } else {
1653
+ const firstAvailableMonth = findFirstAvailableMonth(selectedYear);
1654
+ if (firstAvailableMonth !== -1) {
1655
+ newDate.setMonth(firstAvailableMonth);
1656
+ setCurrentDate(newDate);
1657
+ }
1658
+ }
1659
+ };
1660
+ const isMonthDisabled = (year, month) => {
1661
+ const lastDayOfMonth = new Date(year, month + 1, 0);
1662
+ const firstDayOfMonth = new Date(year, month, 1);
1663
+ return isDateDisabled(lastDayOfMonth) && isDateDisabled(firstDayOfMonth);
1664
+ };
1665
+ const findFirstAvailableMonth = (year) => {
1666
+ for (let month = 0; month < 12; month++) {
1667
+ if (!isMonthDisabled(year, month)) {
1668
+ return month;
1669
+ }
1670
+ }
1671
+ return -1;
1672
+ };
1673
+ const isSameDay = ((_a = (0, import_dayjs.default)(startDate)) == null ? void 0 : _a.format("D MMM, YYYY")) === ((_b = (0, import_dayjs.default)(endDate)) == null ? void 0 : _b.format("D MMM, YYYY"));
1674
+ const NightCountTooltip = () => {
1675
+ const TooltipArrow = (0, import_react3.memo)(() => {
1676
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "tw-w-3 tw-h-3 tw-flex tw-items-center tw-justify-center tw-rounded tw-bg-transparent tw-rotate-90", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1677
+ "div",
1678
+ {
1679
+ style: {
1680
+ borderTop: "5px solid transparent",
1681
+ borderBottom: "5px solid transparent",
1682
+ borderLeft: "8px solid black"
1683
+ }
1684
+ }
1685
+ ) });
1686
+ });
1687
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "tw-absolute tw-bottom-11 tw-py-2 tw-bg-black tw-text-white tw-px-2 tw-rounded-lg tw-z-50 tw-text-xs tw-whitespace-nowrap tw-opacity-0 tw-pointer-events-none group-hover:tw-opacity-100 tw-transition-opacity tw-duration-200", children: [
1688
+ nightCountText,
1689
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "tw-absolute tw-right-[42%] tw-bottom-[-7px]", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(TooltipArrow, {}) })
1690
+ ] });
1691
+ };
1692
+ const renderCalendar = (monthDate, isSecondCalendar = false) => {
1693
+ const days = generateCalendarDays(monthDate);
1694
+ const monthName = monthNames[monthDate.getMonth()];
1695
+ const year = monthDate.getFullYear();
1696
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
1697
+ "div",
1698
+ {
1699
+ className: (0, import_clsx9.default)("tw-flex-1 tw-max-w-[83vw] tw-mb-2", {
1700
+ "tw-h-[320px]": showYearDropdown || days.length > 35,
1701
+ "tw-h-[290px]": !showYearDropdown || days.length <= 35
1702
+ }),
1703
+ children: [
1704
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "tw-text-center tw-mb-4 sm:tw-mt-0", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: " tw-flex tw-justify-center tw-items-center tw-gap-4 ", children: [
1705
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("h3", { className: "tw-typography-footNoteBold tw-text-color-text-default tw-m-0", children: [
1706
+ monthName,
1707
+ " ",
1708
+ !showYearDropdown && ` ${year}`
1709
+ ] }),
1710
+ showYearDropdown && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1711
+ Select_default,
1712
+ {
1713
+ options: yearOptions,
1714
+ value: currentDate.getFullYear(),
1715
+ valueSelected: currentDate.getFullYear(),
1716
+ onChange: (selectedYear) => {
1717
+ if (typeof selectedYear === "number") {
1718
+ handleYearChange(selectedYear);
1719
+ }
1720
+ },
1721
+ className: "tw-min-w-fit tw-bg-transparent tw-typography-footNoteBold tw-text-color-text-default",
1722
+ size: "small",
1723
+ variant: "filled",
1724
+ style: { width: "80px" },
1725
+ id: `${id}-year-select`,
1726
+ allowClear: false,
1727
+ enableSearch: false,
1728
+ experience
1729
+ }
1730
+ )
1731
+ ] }) }),
1732
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "tw-grid tw-grid-cols-7 tw-mb-2", children: dayNames.map((day) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1733
+ "div",
1734
+ {
1735
+ className: "tw-py-2 tw-px-0 tw-text-center tw-typography-caption2 tw-text-[#6B7280]",
1736
+ children: day
1737
+ },
1738
+ day
1739
+ )) }),
1740
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "tw-grid tw-grid-cols-7", children: days.map((date, index) => {
1741
+ if (!date) {
1742
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "tw-h-10" }, index);
1743
+ }
1744
+ const isStart = isRange ? isSameDate(date, startDate) : false;
1745
+ const isEnd = isRange ? isSameDate(date, endDate) : false;
1746
+ const isSelected = !isRange ? isSameDate(date, selectedDate) : false;
1747
+ const isInRange = isRange ? isDateBetweenRange(date) : false;
1748
+ const isHovering = isRange && isSelectingEnd && hoverDate && isDateInRange(date) && !isStart && !isEnd;
1749
+ const isDisabled = isDateDisabled(date);
1750
+ let className = "tw-relative tw-z-20 tw-h-10 tw-w-10 tw-flex tw-items-center tw-justify-center tw-typography-caption1Bold ";
1751
+ const isFirstInRow = index % 7 === 0;
1752
+ const isLastInRow = index % 7 === 6;
1753
+ let pseudoClass = "";
1754
+ if (isDisabled) {
1755
+ className += "tw-text-gray-300 tw-cursor-not-allowed ";
1756
+ } else {
1757
+ className += "tw-cursor-pointer ";
1758
+ if (isStart || isEnd || isSelected) {
1759
+ className += "tw-bg-black tw-z-[21] tw-text-white tw-font-medium tw-rounded-full ";
1760
+ } else if (isInRange) {
1761
+ className += "tw-text-gray-900";
1762
+ if (window.innerWidth < 640) {
1763
+ className = className.replace(
1764
+ "tw-w-10",
1765
+ "tw-pr-2 tw-w-[50px] sm:tw-w-10 sm:tw-pr-0"
1766
+ );
1767
+ }
1768
+ pseudoClass = (0, import_clsx9.default)(RangePicker_module_default.range_start, RangePicker_module_default.range_end);
1769
+ } else {
1770
+ className += "tw-text-gray-700 hover:tw-border-2 hover:tw-border-black tw-rounded-full hover:tw-border-solid ";
1771
+ }
1772
+ if (isHovering) {
1773
+ className += "tw-border-2 tw-border-gray-400 tw-bg-white tw-z-[22]";
1774
+ }
1775
+ }
1776
+ const titleDate = (0, import_dayjs.default)(date).format("YYYY-MM-DD");
1777
+ const hoverDateFormatted = (0, import_dayjs.default)(hoverDate || null).format(
1778
+ "YYYY-MM-DD"
1779
+ );
1780
+ const isHoveringDate = (0, import_dayjs.default)(hoverDateFormatted).isSame(
1781
+ (0, import_dayjs.default)(date),
1782
+ "day"
1783
+ );
1784
+ const isHoverDateGreater = (0, import_dayjs.default)(hoverDate).isAfter(
1785
+ (0, import_dayjs.default)(startDate),
1786
+ "day"
1787
+ );
1788
+ const isHoverDateLess = (0, import_dayjs.default)(hoverDate).isBefore(
1789
+ (0, import_dayjs.default)(startDate),
1790
+ "day"
1791
+ );
1792
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "tw-relative", children: [
1793
+ (isStart || isEnd) && startDate && endDate && !isSameDay && isRange && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1794
+ "div",
1795
+ {
1796
+ className: (0, import_clsx9.default)(
1797
+ "tw-w-9 tw-h-8 tw-bg-[#F2EFEC] tw-rotate-90 tw-absolute tw-z-10 tw-top-1",
1798
+ {
1799
+ "tw-left-5": isStart,
1800
+ "tw-right-5": isEnd,
1801
+ "tw-invisible": isFirstInRow && isEnd || isLastInRow && isStart
1802
+ }
1803
+ )
1804
+ }
1805
+ ),
1806
+ isHoveringDate && isHovering && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
1807
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1808
+ "div",
1809
+ {
1810
+ className: (0, import_clsx9.default)(
1811
+ "tw-w-9 tw-h-8 tw-bg-[#F2EFEC] tw-rotate-90 tw-absolute tw-z-10 tw-top-1",
1812
+ {
1813
+ "tw-right-5": isHoverDateGreater,
1814
+ "tw-left-5": isHoverDateLess,
1815
+ "tw-invisible": isFirstInRow && isHoverDateGreater || isLastInRow && isHoverDateLess
1816
+ }
1817
+ )
1818
+ }
1819
+ ),
1820
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1821
+ "div",
1822
+ {
1823
+ className: (0, import_clsx9.default)(
1824
+ "tw-w-[18px] tw-h-[40px] tw-bg-white tw-rounded-r-full tw-absolute tw-z-20",
1825
+ {
1826
+ "tw-left-5": isHoverDateLess,
1827
+ "tw-right-5 tw-rotate-180": isHoverDateGreater
1828
+ }
1829
+ )
1830
+ }
1831
+ )
1832
+ ] }),
1833
+ isStart && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
1834
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1835
+ "div",
1836
+ {
1837
+ className: (0, import_clsx9.default)(
1838
+ "tw-w-9 tw-h-8 tw-bg-[#F2EFEC] tw-rotate-90 tw-absolute tw-z-10 tw-top-1",
1839
+ {
1840
+ "tw-right-5": isHoverDateLess,
1841
+ "tw-left-5": isHoverDateGreater,
1842
+ "tw-invisible": isLastInRow
1843
+ }
1844
+ )
1845
+ }
1846
+ ),
1847
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1848
+ "div",
1849
+ {
1850
+ className: (0, import_clsx9.default)(
1851
+ "tw-w-[18px] tw-h-[40px] tw-bg-white tw-rounded-r-full tw-absolute tw-z-20",
1852
+ {
1853
+ "tw-left-5": isHoverDateGreater,
1854
+ "tw-right-5 tw-rotate-180": isHoverDateLess
1855
+ }
1856
+ )
1857
+ }
1858
+ )
1859
+ ] }),
1860
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
1861
+ "div",
1862
+ {
1863
+ className: (0, import_clsx9.default)(className, pseudoClass, "tw-group", {
1864
+ "tw-border-2 !tw-border-black tw-rounded-full tw-border-solid": (0, import_dayjs.default)(date).isSame((0, import_dayjs.default)(hoverDate), "day")
1865
+ }),
1866
+ onClick: () => handleDateClick(date),
1867
+ onMouseEnter: () => handleDateHover(date),
1868
+ "data-date": titleDate,
1869
+ children: [
1870
+ showNightCount && isRange && isHovering && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(NightCountTooltip, {}),
1871
+ date.getDate()
1872
+ ]
1873
+ }
1874
+ )
1875
+ ] }, formatDateKey(date));
1876
+ }) })
1877
+ ]
1878
+ }
1879
+ );
1880
+ };
1881
+ const arrowClasses = "tw-relative tw-top-3 sm:tw-top-0 tw-cursor-pointer tw-rounded-full tw-w-10 tw-h-10 tw-flex tw-justify-center hover:tw-bg-gray-100 tw-items-center";
1882
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
1883
+ "div",
1884
+ {
1885
+ className: (0, import_clsx9.default)(
1886
+ "custom-range-picker tw-relative tw-bg-white tw-rounded-xl tw-pt-1 tw-px-0 tw-max-w-4xl tw-mx-auto tw-border tw-border-gray-200 tw-border-solid tw-w-full tw-max-h-[90vh] tw-overflow-y-auto",
1887
+ {
1888
+ "sm:tw-w-[640px]": !showSingleCalendar,
1889
+ "sm:tw-w-[330px]": showSingleCalendar
1890
+ }
1891
+ ),
1892
+ children: [
1893
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "tw-flex tw-items-center tw-px-4 tw-justify-between tw-mb-4 tw-absolute tw-right-0 tw-left-0 tw-top-0.5 sm:tw-top-4 tw-w-auto", children: [
1894
+ !isPreviousMonthDisabled() && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1895
+ "div",
1896
+ {
1897
+ className: (0, import_clsx9.default)(arrowClasses, "tw-left-1"),
1898
+ onClick: () => navigateMonth(-1),
1899
+ id: "calendar-previous-month-button",
1900
+ children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1901
+ Chevron,
1902
+ {
1903
+ size: "medium",
1904
+ className: "tw-relative -tw-top-0.5 tw-right-0.5"
1905
+ }
1906
+ )
1907
+ }
1908
+ ),
1909
+ isPreviousMonthDisabled() && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "tw-w-10 tw-h-10" }),
1910
+ !isNextMonthDisabled() && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1911
+ "div",
1912
+ {
1913
+ className: (0, import_clsx9.default)(arrowClasses, "tw-mt-[1px] tw-right-1"),
1914
+ onClick: () => navigateMonth(1),
1915
+ id: "calendar-next-month-button",
1916
+ children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1917
+ Chevron,
1918
+ {
1919
+ size: "medium",
1920
+ onClick: () => navigateMonth(1),
1921
+ className: "tw-rotate-180 tw-relative tw-top-0.5 tw-left-0.5"
1922
+ }
1923
+ )
1924
+ }
1925
+ ),
1926
+ isNextMonthDisabled() && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "tw-w-10 tw-h-10" })
1927
+ ] }),
1928
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "tw-flex tw-items-center tw-justify-between tw-px-6 tw-border-solid tw-border-color-gray-100 tw-border-b tw-border-t-0 tw-border-l-0 tw-border-r-0 tw-w-auto", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
1929
+ "div",
1930
+ {
1931
+ className: (0, import_clsx9.default)("tw-flex tw-w-full", {
1932
+ "tw-flex-col sm:tw-space-x-8 sm:tw-flex-row": isRange || !showSingleCalendar,
1933
+ "tw-justify-center": !isRange || showSingleCalendar,
1934
+ "tw-pt-4": showYearDropdown,
1935
+ // More space when year dropdown is visible
1936
+ "tw-pt-6": !showYearDropdown
1937
+ }),
1938
+ children: [
1939
+ renderCalendar(firstMonth),
1940
+ !showSingleCalendar && renderCalendar(secondMonth, true)
1941
+ ]
1942
+ }
1943
+ ) }),
1944
+ footer
1945
+ ]
1946
+ }
1947
+ );
1948
+ }
1949
+ CustomRangePicker.displayName = "RangePicker";
1950
+ var RangePicker_default = CustomRangePicker;
1951
+
1952
+ // src/atom/AdvancedDateRangePicker/AdvancedDateRangePicker.tsx
1953
+ var import_react5 = require("react");
1954
+ var import_clsx10 = __toESM(require("clsx"));
1955
+ var import_dayjs3 = __toESM(require("dayjs"));
1956
+ var import_customParseFormat = __toESM(require("dayjs/plugin/customParseFormat.js"));
1957
+ var import_isSameOrBefore = __toESM(require("dayjs/plugin/isSameOrBefore.js"));
1958
+
1959
+ // src/atom/AdvancedDateRangePicker/AdvancedDateRangePicker.module.scss
1960
+ var AdvancedDateRangePicker_module_default = { "root": "AdvancedDateRangePicker-module__root___udir8", "inner": "AdvancedDateRangePicker-module__inner___P4OHa", "left": "AdvancedDateRangePicker-module__left___T6E84", "sidebarItem": "AdvancedDateRangePicker-module__sidebarItem___-NXPm", "sidebarItemActive": "AdvancedDateRangePicker-module__sidebarItemActive___5GmBY", "main": "AdvancedDateRangePicker-module__main___G4MU9", "header": "AdvancedDateRangePicker-module__header___mxXEE", "headerGroup": "AdvancedDateRangePicker-module__headerGroup___J7mJB", "headerLabel": "AdvancedDateRangePicker-module__headerLabel___Yvhkr", "timezoneWrapper": "AdvancedDateRangePicker-module__timezoneWrapper___886Qm", "dateTimeWrapper": "AdvancedDateRangePicker-module__dateTimeWrapper___unDQJ", "headerSeparator": "AdvancedDateRangePicker-module__headerSeparator___Vwx6P", "timezoneSelect": "AdvancedDateRangePicker-module__timezoneSelect___f4oln", "dateTimeColumn": "AdvancedDateRangePicker-module__dateTimeColumn___tdDV3", "dateTimeGroup": "AdvancedDateRangePicker-module__dateTimeGroup___azF09", "dateInput": "AdvancedDateRangePicker-module__dateInput___0t9ww", "inputError": "AdvancedDateRangePicker-module__inputError___A5hid", "timeInput": "AdvancedDateRangePicker-module__timeInput___Jalr9", "errorMessage": "AdvancedDateRangePicker-module__errorMessage___gx7ag", "body": "AdvancedDateRangePicker-module__body___f8XYj", "footer": "AdvancedDateRangePicker-module__footer___rsJ2w", "doneBtn": "AdvancedDateRangePicker-module__doneBtn___mt-Sv" };
1961
+
1962
+ // src/atom/AdvancedDateRangePicker/InternalCalendar.tsx
1963
+ var import_react4 = require("react");
1964
+ var import_dayjs2 = __toESM(require("dayjs"));
1965
+ var import_jsx_runtime16 = require("react/jsx-runtime");
1966
+ var InternalCalendar = ({
1967
+ id = "",
1968
+ onChange = () => {
1969
+ },
1970
+ dateRange = ["", ""],
1971
+ showSingleCalendar: showSingleCalendarProp = false,
1972
+ disablePastDates = false,
1973
+ minDate = null,
1974
+ maxDate = null,
1975
+ minYear = 1900,
1976
+ maxYear = (/* @__PURE__ */ new Date()).getFullYear() + 10,
1977
+ allowSameDates = false
1978
+ }) => {
1979
+ const onChangeRef = (0, import_react4.useRef)(onChange);
1980
+ (0, import_react4.useEffect)(() => {
1981
+ onChangeRef.current = onChange;
1982
+ }, [onChange]);
1983
+ const getInitialDate = () => {
1984
+ const today2 = /* @__PURE__ */ new Date();
1985
+ today2.setHours(0, 0, 0, 0);
1986
+ if (dateRange[0]) return new Date(dateRange[0]);
1987
+ if (today2.getFullYear() >= minYear && today2.getFullYear() <= maxYear) {
1988
+ return today2;
1989
+ }
1990
+ if (minDate) {
1991
+ const minDateTime = new Date(minDate);
1992
+ minDateTime.setHours(0, 0, 0, 0);
1993
+ return minDateTime;
1994
+ }
1995
+ return today2;
1996
+ };
1997
+ const [currentDate, setCurrentDate] = (0, import_react4.useState)(() => getInitialDate());
1998
+ const [startDate, setStartDate] = (0, import_react4.useState)(
1999
+ dateRange[0] ? new Date(dateRange[0]) : null
2000
+ );
2001
+ const [endDate, setEndDate] = (0, import_react4.useState)(
2002
+ dateRange[0] && dateRange[1] ? new Date(dateRange[1]) : null
2003
+ );
2004
+ const [hoverDate, setHoverDate] = (0, import_react4.useState)(null);
2005
+ const [isSelectingEnd, setIsSelectingEnd] = (0, import_react4.useState)(
2006
+ dateRange[0] && !dateRange[1] ? true : false
2007
+ );
2008
+ const [isMobile, setIsMobile] = (0, import_react4.useState)(false);
2009
+ (0, import_react4.useEffect)(() => {
2010
+ const checkMobile = () => {
2011
+ setIsMobile(window.innerWidth < 1024);
2012
+ };
2013
+ checkMobile();
2014
+ window.addEventListener("resize", checkMobile);
2015
+ return () => window.removeEventListener("resize", checkMobile);
2016
+ }, []);
2017
+ const showSingle = showSingleCalendarProp || isMobile;
2018
+ const prevRangeRef = (0, import_react4.useRef)(dateRange);
2019
+ (0, import_react4.useEffect)(() => {
2020
+ const isSameRange = dateRange[0] === prevRangeRef.current[0] && dateRange[1] === prevRangeRef.current[1];
2021
+ if (isSameRange) return;
2022
+ prevRangeRef.current = dateRange;
2023
+ const nextStart = dateRange[0] ? new Date(dateRange[0]) : null;
2024
+ const nextEnd = dateRange[1] ? new Date(dateRange[1]) : null;
2025
+ setStartDate(nextStart);
2026
+ setEndDate(nextEnd);
2027
+ if (nextStart) {
2028
+ const startMonth = nextStart.getFullYear() * 12 + nextStart.getMonth();
2029
+ const currentMonthVal = currentDate.getFullYear() * 12 + currentDate.getMonth();
2030
+ const isVisibleInFirst = startMonth === currentMonthVal;
2031
+ const isVisibleInSecond = !showSingle && startMonth === currentMonthVal + 1;
2032
+ if (!isVisibleInFirst && !isVisibleInSecond) {
2033
+ setCurrentDate(new Date(nextStart.getFullYear(), nextStart.getMonth(), 1));
2034
+ }
2035
+ }
2036
+ }, [dateRange, showSingle]);
2037
+ const today = /* @__PURE__ */ new Date();
2038
+ today.setHours(0, 0, 0, 0);
2039
+ const firstMonth = new Date(currentDate.getFullYear(), currentDate.getMonth(), 1);
2040
+ const secondMonth = new Date(currentDate.getFullYear(), currentDate.getMonth() + 1, 1);
2041
+ const monthNames = [
2042
+ "January",
2043
+ "February",
2044
+ "March",
2045
+ "April",
2046
+ "May",
2047
+ "June",
2048
+ "July",
2049
+ "August",
2050
+ "September",
2051
+ "October",
2052
+ "November",
2053
+ "December"
2054
+ ];
2055
+ const dayNames = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"];
2056
+ const generateCalendarDays = (monthDate) => {
2057
+ const year = monthDate.getFullYear();
2058
+ const month = monthDate.getMonth();
2059
+ const firstDay = new Date(year, month, 1);
2060
+ const lastDay = new Date(year, month + 1, 0);
2061
+ const daysInMonth = lastDay.getDate();
2062
+ const startingDayOfWeek = firstDay.getDay();
2063
+ const days = [];
2064
+ for (let i = 0; i < startingDayOfWeek; i++) days.push(null);
2065
+ for (let day = 1; day <= daysInMonth; day++) days.push(new Date(year, month, day));
2066
+ return days;
2067
+ };
2068
+ const isSameDate = (d1, d2) => {
2069
+ if (!d1 || !d2) return false;
2070
+ return d1.getFullYear() === d2.getFullYear() && d1.getMonth() === d2.getMonth() && d1.getDate() === d2.getDate();
2071
+ };
2072
+ const isDateDisabled = (date) => {
2073
+ if (!date) return false;
2074
+ const checkDate = new Date(date);
2075
+ checkDate.setHours(0, 0, 0, 0);
2076
+ if (disablePastDates && checkDate < today) return true;
2077
+ if (minDate) {
2078
+ const m = new Date(minDate);
2079
+ m.setHours(0, 0, 0, 0);
2080
+ if (checkDate < m) return true;
2081
+ }
2082
+ if (maxDate) {
2083
+ const m = new Date(maxDate);
2084
+ m.setHours(0, 0, 0, 0);
2085
+ if (checkDate > m) return true;
2086
+ }
2087
+ return false;
2088
+ };
2089
+ const isDateBetweenRange = (date) => {
2090
+ if (!startDate || !date) return false;
2091
+ const comp = endDate || hoverDate;
2092
+ if (!comp) return false;
2093
+ const s = startDate < comp ? startDate : comp;
2094
+ const e = startDate < comp ? comp : startDate;
2095
+ return date > s && date < e;
2096
+ };
2097
+ const isDateInRange = (date) => {
2098
+ if (!startDate || !date) return false;
2099
+ const comp = endDate || hoverDate;
2100
+ if (!comp) return false;
2101
+ const s = startDate < comp ? startDate : comp;
2102
+ const e = startDate < comp ? comp : startDate;
2103
+ return date >= s && date <= e;
2104
+ };
2105
+ const handleDateClick = (date) => {
2106
+ if (isDateDisabled(date)) return;
2107
+ let nextStart = startDate;
2108
+ let nextEnd = endDate;
2109
+ const isSame = startDate && (0, import_dayjs2.default)(date).isSame(startDate, "day");
2110
+ if (!allowSameDates && isSame) {
2111
+ setStartDate(null);
2112
+ setEndDate(null);
2113
+ setIsSelectingEnd(false);
2114
+ onChangeRef.current(["", ""]);
2115
+ return;
2116
+ }
2117
+ if (!startDate || startDate && endDate) {
2118
+ nextStart = date;
2119
+ nextEnd = null;
2120
+ setStartDate(nextStart);
2121
+ setEndDate(nextEnd);
2122
+ setIsSelectingEnd(true);
2123
+ } else {
2124
+ if (date < startDate) {
2125
+ nextEnd = startDate;
2126
+ nextStart = date;
2127
+ } else {
2128
+ nextEnd = date;
2129
+ }
2130
+ setStartDate(nextStart);
2131
+ setEndDate(nextEnd);
2132
+ setIsSelectingEnd(false);
2133
+ }
2134
+ onChangeRef.current([
2135
+ nextStart ? (0, import_dayjs2.default)(nextStart).format("D MMM, YYYY") : "",
2136
+ nextEnd ? (0, import_dayjs2.default)(nextEnd).format("D MMM, YYYY") : ""
2137
+ ]);
2138
+ };
2139
+ const handleDateHover = (date) => {
2140
+ if (isDateDisabled(date)) return;
2141
+ if (isSelectingEnd && startDate && !endDate) setHoverDate(date);
2142
+ };
2143
+ const navigateMonth = (direction) => {
2144
+ const newDate = new Date(currentDate);
2145
+ newDate.setMonth(currentDate.getMonth() + direction);
2146
+ setCurrentDate(newDate);
2147
+ };
2148
+ const renderCalendar = (monthDate) => {
2149
+ const days = generateCalendarDays(monthDate);
2150
+ const monthName = monthNames[monthDate.getMonth()];
2151
+ const year = monthDate.getFullYear();
2152
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "tw-flex-1 tw-mb-2", children: [
2153
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "tw-text-center tw-mb-4", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("h3", { className: "tw-typography-footNoteBold tw-text-gray-900 tw-m-0", children: [
2154
+ monthName,
2155
+ " ",
2156
+ year
2157
+ ] }) }),
2158
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "tw-grid tw-grid-cols-7 tw-mb-2", children: dayNames.map((day) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "tw-py-2 tw-text-center tw-typography-caption2 tw-text-gray-500", children: day }, day)) }),
2159
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "tw-grid tw-grid-cols-7", children: days.map((date, index) => {
2160
+ if (!date) return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "tw-h-10" }, index);
2161
+ const isStart = isSameDate(date, startDate);
2162
+ const isEnd = isSameDate(date, endDate);
2163
+ const isInRange = isDateBetweenRange(date);
2164
+ const isSelected = isDateInRange(date);
2165
+ const isDisabled = isDateDisabled(date);
2166
+ const isHovering = isSelectingEnd && hoverDate && isSameDate(date, hoverDate);
2167
+ let cellClasses = "tw-relative tw-z-20 tw-h-10 tw-w-10 tw-flex tw-items-center tw-justify-center tw-typography-caption1Bold tw-cursor-pointer tw-transition-all ";
2168
+ if (isDisabled) {
2169
+ cellClasses += "tw-text-gray-300 tw-cursor-not-allowed ";
2170
+ } else if (isStart || isEnd) {
2171
+ cellClasses += "tw-bg-black tw-text-white tw-rounded-full ";
2172
+ } else if (isInRange) {
2173
+ cellClasses += "tw-text-gray-900 ";
2174
+ } else {
2175
+ cellClasses += "tw-text-gray-700 hover:tw-bg-gray-100 tw-rounded-full ";
2176
+ }
2177
+ if (isHovering && !isEnd) {
2178
+ cellClasses += "tw-border-2 tw-border-gray-400 tw-border-dashed ";
2179
+ }
2180
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "tw-relative tw-flex tw-justify-center", children: [
2181
+ isInRange && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "tw-absolute tw-inset-y-1 tw-inset-x-0 tw-bg-[#f2efec] tw-z-10" }),
2182
+ isStart && endDate && !isSameDate(startDate, endDate) && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "tw-absolute tw-inset-y-1 tw-right-0 tw-left-1/2 tw-bg-[#f2efec] tw-z-10" }),
2183
+ isEnd && startDate && !isSameDate(startDate, endDate) && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "tw-absolute tw-inset-y-1 tw-left-0 tw-right-1/2 tw-bg-[#f2efec] tw-z-10" }),
2184
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
2185
+ "div",
2186
+ {
2187
+ className: cellClasses,
2188
+ onClick: () => handleDateClick(date),
2189
+ onMouseEnter: () => handleDateHover(date),
2190
+ children: date.getDate()
2191
+ }
2192
+ )
2193
+ ] }, date.toISOString());
2194
+ }) })
2195
+ ] });
2196
+ };
2197
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "tw-relative tw-bg-white tw-w-full", children: [
2198
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "tw-flex tw-items-center tw-justify-between tw-absolute tw-inset-x-0 tw-top-0 tw-z-30 tw-px-4", children: [
2199
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
2200
+ "div",
2201
+ {
2202
+ className: "tw-cursor-pointer tw-p-2 tw-rounded-full hover:tw-bg-gray-100",
2203
+ onClick: () => navigateMonth(-1),
2204
+ children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Chevron, { size: "medium" })
2205
+ }
2206
+ ),
2207
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
2208
+ "div",
2209
+ {
2210
+ className: "tw-cursor-pointer tw-p-2 tw-rounded-full hover:tw-bg-gray-100",
2211
+ onClick: () => navigateMonth(1),
2212
+ children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Chevron, { size: "medium", className: "tw-rotate-180" })
2213
+ }
2214
+ )
2215
+ ] }),
2216
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "tw-flex tw-gap-8 tw-pt-2", children: [
2217
+ renderCalendar(firstMonth),
2218
+ !showSingle && renderCalendar(secondMonth)
2219
+ ] })
2220
+ ] });
2221
+ };
2222
+ var InternalCalendar_default = (0, import_react4.memo)(InternalCalendar);
2223
+
2224
+ // src/atom/AdvancedDateRangePicker/AdvancedDateRangePicker.tsx
2225
+ var import_jsx_runtime17 = require("react/jsx-runtime");
2226
+ import_dayjs3.default.extend(import_customParseFormat.default);
2227
+ import_dayjs3.default.extend(import_isSameOrBefore.default);
2228
+ var DEFAULT_TIME = { hour: "12", minute: "00", period: "PM" };
2229
+ function getPresets() {
2230
+ const today = /* @__PURE__ */ new Date();
2231
+ today.setHours(0, 0, 0, 0);
2232
+ return [
2233
+ {
2234
+ label: "Custom",
2235
+ key: "custom",
2236
+ getRange: () => [null, null]
2237
+ },
2238
+ {
2239
+ label: "Yesterday",
2240
+ key: "yesterday",
2241
+ getRange: () => {
2242
+ const d = new Date(today);
2243
+ d.setDate(d.getDate() - 1);
2244
+ return [d, d];
2245
+ }
2246
+ },
2247
+ {
2248
+ label: "Previous week",
2249
+ key: "previous-week",
2250
+ getRange: () => {
2251
+ const dayOfWeek = today.getDay();
2252
+ const start = new Date(today);
2253
+ start.setDate(today.getDate() - dayOfWeek - 6);
2254
+ const end = new Date(today);
2255
+ return [start, end];
2256
+ }
2257
+ },
2258
+ {
2259
+ label: "This month",
2260
+ key: "this-month",
2261
+ getRange: () => {
2262
+ const start = new Date(today.getFullYear(), today.getMonth(), 1);
2263
+ const end = new Date(today.getFullYear(), today.getMonth() + 1, 0);
2264
+ return [start, end];
2265
+ }
2266
+ },
2267
+ {
2268
+ label: "Previous month",
2269
+ key: "previous-month",
2270
+ getRange: () => {
2271
+ const start = new Date(today.getFullYear(), today.getMonth() - 1, 1);
2272
+ const end = new Date(today.getFullYear(), today.getMonth(), 0);
2273
+ return [start, end];
2274
+ }
2275
+ },
2276
+ {
2277
+ label: "Previous quarter",
2278
+ key: "previous-quarter",
2279
+ getRange: () => {
2280
+ const month = today.getMonth();
2281
+ const quarter = Math.floor(month / 3);
2282
+ const startMonth = (quarter - 1) * 3;
2283
+ const start = new Date(today.getFullYear(), startMonth, 1);
2284
+ const end = new Date(today.getFullYear(), startMonth + 3, 0);
2285
+ return [start, end];
2286
+ }
2287
+ }
2288
+ ];
2289
+ }
2290
+ function applyDateMask(v, prev) {
2291
+ if (v.length < prev.length) return v;
2292
+ const digits = v.replace(/[^\d]/g, "").slice(0, 8);
2293
+ if (digits.length >= 2) {
2294
+ const d = Number(digits.slice(0, 2));
2295
+ if (d < 1 || d > 31) return prev;
2296
+ }
2297
+ if (digits.length >= 4) {
2298
+ const m = Number(digits.slice(2, 4));
2299
+ if (m < 1 || m > 12) return prev;
2300
+ }
2301
+ let result = "";
2302
+ if (digits.length > 0) result += digits.slice(0, 2);
2303
+ if (digits.length >= 2) result += "-";
2304
+ if (digits.length > 2) result += digits.slice(2, 4);
2305
+ if (digits.length >= 4) result += "-";
2306
+ if (digits.length > 4) result += digits.slice(4, 8);
2307
+ return result.slice(0, 10);
2308
+ }
2309
+ function applyTimeMask(v, prev) {
2310
+ if (v.length < prev.length) return v;
2311
+ const digits = v.replace(/[^\d]/g, "").slice(0, 4);
2312
+ if (digits.length >= 2) {
2313
+ const h = Number(digits.slice(0, 2));
2314
+ if (h < 1 || h > 12) return prev;
2315
+ }
2316
+ if (digits.length >= 4) {
2317
+ const m = Number(digits.slice(2, 4));
2318
+ if (m > 59) return prev;
2319
+ }
2320
+ let result = "";
2321
+ if (digits.length > 0) result += digits.slice(0, 2);
2322
+ if (digits.length >= 2) result += ":";
2323
+ if (digits.length > 2) result += digits.slice(2, 4);
2324
+ if (v.toUpperCase().includes("A")) result += " AM";
2325
+ else if (v.toUpperCase().includes("P")) result += " PM";
2326
+ else if (digits.length === 4) result += " ";
2327
+ return result.slice(0, 8);
2328
+ }
2329
+ function formatForDisplay(date) {
2330
+ if (!date) return "";
2331
+ return (0, import_dayjs3.default)(date).format("DD-MM-YYYY");
2332
+ }
2333
+ function validateDateString(raw) {
2334
+ const regex = /^(0[1-9]|[12][0-9]|3[01])-(0[1-9]|1[0-2])-\d{4}$/;
2335
+ if (!regex.test(raw)) return false;
2336
+ const [d, m, y] = raw.split("-").map(Number);
2337
+ const date = new Date(y, m - 1, d);
2338
+ return date.getFullYear() === y && date.getMonth() === m - 1 && date.getDate() === d;
2339
+ }
2340
+ function validateTimeString(raw) {
2341
+ const regex = /^(0[1-9]|1[0-2]):(0[0-9]|[1-5][0-9])\s(AM|PM)$/i;
2342
+ return regex.test(raw);
2343
+ }
2344
+ function parseDateInput(raw) {
2345
+ if (!validateDateString(raw)) return null;
2346
+ return (0, import_dayjs3.default)(raw, "DD-MM-YYYY", true).toDate();
2347
+ }
2348
+ function parseTimeInput(raw) {
2349
+ if (!validateTimeString(raw)) return null;
2350
+ const match = raw.match(/^(\d{1,2}):(\d{2})\s*(AM|PM)$/i);
2351
+ if (!match) return null;
2352
+ return {
2353
+ hour: match[1].padStart(2, "0"),
2354
+ minute: match[2].padStart(2, "0"),
2355
+ period: match[3].toUpperCase()
2356
+ };
2357
+ }
2358
+ function formatTime(t) {
2359
+ return `${t.hour}:${t.minute} ${t.period}`;
2360
+ }
2361
+ var DateTimeInputGroup = (0, import_react5.memo)(function DateTimeInputGroup2({
2362
+ label,
2363
+ dateValue,
2364
+ timeValue,
2365
+ dateError,
2366
+ timeError,
2367
+ onDateChange,
2368
+ onTimeChange
2369
+ }) {
2370
+ const [isDateFocused, setIsDateFocused] = (0, import_react5.useState)(false);
2371
+ const [isTimeFocused, setIsTimeFocused] = (0, import_react5.useState)(false);
2372
+ const showDateError = dateError && !isDateFocused;
2373
+ const showTimeError = timeError && !isTimeFocused && !showDateError;
2374
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: AdvancedDateRangePicker_module_default.headerGroup, children: [
2375
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: AdvancedDateRangePicker_module_default.headerLabel, children: label }),
2376
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: AdvancedDateRangePicker_module_default.dateTimeColumn, children: [
2377
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: AdvancedDateRangePicker_module_default.dateTimeGroup, children: [
2378
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2379
+ "input",
2380
+ {
2381
+ type: "text",
2382
+ placeholder: "DD-MM-YYYY",
2383
+ value: dateValue,
2384
+ onFocus: () => setIsDateFocused(true),
2385
+ onBlur: () => setIsDateFocused(false),
2386
+ onChange: (e) => onDateChange(e.target.value),
2387
+ className: (0, import_clsx10.default)(AdvancedDateRangePicker_module_default.dateInput, { [AdvancedDateRangePicker_module_default.inputError]: showDateError })
2388
+ }
2389
+ ),
2390
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2391
+ "input",
2392
+ {
2393
+ type: "text",
2394
+ placeholder: "12:00 PM",
2395
+ value: timeValue,
2396
+ onFocus: () => setIsTimeFocused(true),
2397
+ onBlur: () => setIsTimeFocused(false),
2398
+ onChange: (e) => onTimeChange(e.target.value),
2399
+ className: (0, import_clsx10.default)(AdvancedDateRangePicker_module_default.timeInput, { [AdvancedDateRangePicker_module_default.inputError]: showTimeError })
2400
+ }
2401
+ )
2402
+ ] }),
2403
+ showDateError && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: AdvancedDateRangePicker_module_default.errorMessage, children: "Enter valid date" }),
2404
+ showTimeError && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: AdvancedDateRangePicker_module_default.errorMessage, children: "Enter valid time" })
2405
+ ] })
2406
+ ] });
2407
+ });
2408
+ function AdvancedDateRangePicker({
2409
+ value,
2410
+ onChange,
2411
+ confirmLabel = "Done",
2412
+ className = "",
2413
+ disabled = false,
2414
+ disablePastDates = false,
2415
+ minDate = null,
2416
+ maxDate = null,
2417
+ showSingleCalendar = false,
2418
+ id = "adv-drp",
2419
+ defaultTimezone = "UTC",
2420
+ isTimezoneDisabled = false,
2421
+ timezoneOptions = []
2422
+ }) {
2423
+ var _a, _b, _c;
2424
+ const PRESETS = (0, import_react5.useMemo)(() => getPresets(), []);
2425
+ const [startDate, setStartDate] = (0, import_react5.useState)((_a = value == null ? void 0 : value.startDate) != null ? _a : null);
2426
+ const [endDate, setEndDate] = (0, import_react5.useState)((_b = value == null ? void 0 : value.endDate) != null ? _b : null);
2427
+ const [timezone, setTimezone] = (0, import_react5.useState)((_c = value == null ? void 0 : value.timezone) != null ? _c : defaultTimezone);
2428
+ const [fromDateStr, setFromDateStr] = (0, import_react5.useState)(formatForDisplay(startDate));
2429
+ const [toDateStr, setToDateStr] = (0, import_react5.useState)(formatForDisplay(endDate));
2430
+ const [fromTimeStr, setFromTimeStr] = (0, import_react5.useState)(
2431
+ (value == null ? void 0 : value.startTime) ? formatTime(value.startTime) : "12:00 PM"
2432
+ );
2433
+ const [toTimeStr, setToTimeStr] = (0, import_react5.useState)(
2434
+ (value == null ? void 0 : value.endTime) ? formatTime(value.endTime) : "12:00 PM"
2435
+ );
2436
+ const [activePreset, setActivePreset] = (0, import_react5.useState)("custom");
2437
+ const fromDateError = (0, import_react5.useMemo)(() => fromDateStr.length > 0 && (fromDateStr.length < 10 || !validateDateString(fromDateStr)), [fromDateStr]);
2438
+ const toDateError = (0, import_react5.useMemo)(() => toDateStr.length > 0 && (toDateStr.length < 10 || !validateDateString(toDateStr)), [toDateStr]);
2439
+ const fromTimeError = (0, import_react5.useMemo)(() => fromTimeStr.length > 0 && (fromTimeStr.length < 8 || !validateTimeString(fromTimeStr)), [fromTimeStr]);
2440
+ const toTimeError = (0, import_react5.useMemo)(() => toTimeStr.length > 0 && (toTimeStr.length < 8 || !validateTimeString(toTimeStr)), [toTimeStr]);
2441
+ const isReady = (0, import_react5.useMemo)(() => {
2442
+ return startDate !== null && endDate !== null && validateDateString(fromDateStr) && validateDateString(toDateStr) && validateTimeString(fromTimeStr) && validateTimeString(toTimeStr) && (0, import_dayjs3.default)(startDate).isSameOrBefore((0, import_dayjs3.default)(endDate), "day");
2443
+ }, [startDate, endDate, fromDateStr, toDateStr, fromTimeStr, toTimeStr]);
2444
+ (0, import_react5.useEffect)(() => {
2445
+ var _a2, _b2, _c2;
2446
+ if (value) {
2447
+ setStartDate((_a2 = value.startDate) != null ? _a2 : null);
2448
+ setEndDate((_b2 = value.endDate) != null ? _b2 : null);
2449
+ setTimezone((_c2 = value.timezone) != null ? _c2 : defaultTimezone);
2450
+ if (value.startTime) setFromTimeStr(formatTime(value.startTime));
2451
+ if (value.endTime) setToTimeStr(formatTime(value.endTime));
2452
+ }
2453
+ }, [value, defaultTimezone]);
2454
+ (0, import_react5.useEffect)(() => {
2455
+ setFromDateStr(formatForDisplay(startDate));
2456
+ }, [startDate]);
2457
+ (0, import_react5.useEffect)(() => {
2458
+ setToDateStr(formatForDisplay(endDate));
2459
+ }, [endDate]);
2460
+ const rangeValue = (0, import_react5.useMemo)(() => [
2461
+ startDate ? startDate.toISOString() : "",
2462
+ endDate ? endDate.toISOString() : ""
2463
+ ], [startDate, endDate]);
2464
+ const handleRangeChange = (0, import_react5.useCallback)(
2465
+ (range) => {
2466
+ const [s, e] = range;
2467
+ if (s) {
2468
+ const sDateByDayjs = (0, import_dayjs3.default)(s, "D MMM, YYYY").toDate();
2469
+ setStartDate(sDateByDayjs);
2470
+ } else {
2471
+ setStartDate(null);
2472
+ }
2473
+ if (e) {
2474
+ const eDateByDayjs = (0, import_dayjs3.default)(e, "D MMM, YYYY").toDate();
2475
+ setEndDate(eDateByDayjs);
2476
+ } else {
2477
+ setEndDate(null);
2478
+ }
2479
+ setActivePreset("custom");
2480
+ },
2481
+ []
2482
+ );
2483
+ const handlePreset = (0, import_react5.useCallback)(
2484
+ (preset) => {
2485
+ const [s, e] = preset.getRange();
2486
+ setStartDate(s);
2487
+ setEndDate(e);
2488
+ setActivePreset(preset.key);
2489
+ },
2490
+ []
2491
+ );
2492
+ const handleFromDateChange = (0, import_react5.useCallback)((v) => {
2493
+ const masked = applyDateMask(v, fromDateStr);
2494
+ setFromDateStr(masked);
2495
+ setActivePreset("custom");
2496
+ if (masked.length === 10) {
2497
+ const parsed = parseDateInput(masked);
2498
+ if (parsed) {
2499
+ setStartDate(parsed);
2500
+ if (endDate && (0, import_dayjs3.default)(parsed).isAfter((0, import_dayjs3.default)(endDate), "day")) {
2501
+ setEndDate(null);
2502
+ }
2503
+ }
2504
+ }
2505
+ }, [fromDateStr, endDate]);
2506
+ const handleToDateChange = (0, import_react5.useCallback)((v) => {
2507
+ const masked = applyDateMask(v, toDateStr);
2508
+ setToDateStr(masked);
2509
+ setActivePreset("custom");
2510
+ if (masked.length === 10) {
2511
+ const parsed = parseDateInput(masked);
2512
+ if (parsed) {
2513
+ setEndDate(parsed);
2514
+ if (startDate && (0, import_dayjs3.default)(parsed).isBefore((0, import_dayjs3.default)(startDate), "day")) {
2515
+ setStartDate(null);
2516
+ }
2517
+ }
2518
+ }
2519
+ }, [toDateStr, startDate]);
2520
+ const handleFromTimeChange = (0, import_react5.useCallback)((v) => {
2521
+ const masked = applyTimeMask(v, fromTimeStr);
2522
+ setFromTimeStr(masked);
2523
+ setActivePreset("custom");
2524
+ }, [fromTimeStr]);
2525
+ const handleToTimeChange = (0, import_react5.useCallback)((v) => {
2526
+ const masked = applyTimeMask(v, toTimeStr);
2527
+ setToTimeStr(masked);
2528
+ setActivePreset("custom");
2529
+ }, [toTimeStr]);
2530
+ const handleDone = (0, import_react5.useCallback)(() => {
2531
+ var _a2, _b2;
2532
+ if (!isReady) return;
2533
+ const fromTime = (_a2 = parseTimeInput(fromTimeStr)) != null ? _a2 : DEFAULT_TIME;
2534
+ const toTime = (_b2 = parseTimeInput(toTimeStr)) != null ? _b2 : DEFAULT_TIME;
2535
+ onChange == null ? void 0 : onChange({
2536
+ startDate,
2537
+ endDate,
2538
+ startTime: fromTime,
2539
+ endTime: toTime,
2540
+ timezone
2541
+ });
2542
+ }, [isReady, onChange, startDate, endDate, fromTimeStr, toTimeStr, timezone]);
2543
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: (0, import_clsx10.default)(AdvancedDateRangePicker_module_default.root, className), id, children: [
2544
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: AdvancedDateRangePicker_module_default.inner, children: [
2545
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("aside", { className: AdvancedDateRangePicker_module_default.left, children: PRESETS.map((p) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2546
+ "button",
2547
+ {
2548
+ type: "button",
2549
+ onClick: () => handlePreset(p),
2550
+ className: (0, import_clsx10.default)(AdvancedDateRangePicker_module_default.sidebarItem, {
2551
+ [AdvancedDateRangePicker_module_default.sidebarItemActive]: activePreset === p.key
2552
+ }),
2553
+ children: p.label
2554
+ },
2555
+ p.key
2556
+ )) }),
2557
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: AdvancedDateRangePicker_module_default.main, children: [
2558
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("header", { className: AdvancedDateRangePicker_module_default.header, children: [
2559
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: (0, import_clsx10.default)(AdvancedDateRangePicker_module_default.headerGroup, AdvancedDateRangePicker_module_default.timezoneWrapper), children: [
2560
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: AdvancedDateRangePicker_module_default.headerLabel, children: "Timezone" }),
2561
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2562
+ "select",
2563
+ {
2564
+ value: timezone,
2565
+ onChange: (e) => setTimezone(e.target.value),
2566
+ className: AdvancedDateRangePicker_module_default.timezoneSelect,
2567
+ disabled: isTimezoneDisabled,
2568
+ children: timezoneOptions.map((tz) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("option", { value: tz.value, children: tz.label }, tz.value))
2569
+ }
2570
+ )
2571
+ ] }),
2572
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: AdvancedDateRangePicker_module_default.headerSeparator }),
2573
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: AdvancedDateRangePicker_module_default.dateTimeWrapper, children: [
2574
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2575
+ DateTimeInputGroup,
2576
+ {
2577
+ label: "From",
2578
+ dateValue: fromDateStr,
2579
+ timeValue: fromTimeStr,
2580
+ dateError: fromDateError,
2581
+ timeError: fromTimeError,
2582
+ onDateChange: handleFromDateChange,
2583
+ onTimeChange: handleFromTimeChange
2584
+ }
2585
+ ),
2586
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: AdvancedDateRangePicker_module_default.headerSeparator }),
2587
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2588
+ DateTimeInputGroup,
2589
+ {
2590
+ label: "To",
2591
+ dateValue: toDateStr,
2592
+ timeValue: toTimeStr,
2593
+ dateError: toDateError,
2594
+ timeError: toTimeError,
2595
+ onDateChange: handleToDateChange,
2596
+ onTimeChange: handleToTimeChange
2597
+ }
2598
+ )
2599
+ ] })
2600
+ ] }),
2601
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: AdvancedDateRangePicker_module_default.body, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2602
+ InternalCalendar_default,
2603
+ {
2604
+ id: `${id}-calendar`,
2605
+ dateRange: rangeValue,
2606
+ onChange: handleRangeChange,
2607
+ disablePastDates,
2608
+ minDate,
2609
+ maxDate,
2610
+ showSingleCalendar
2611
+ }
2612
+ ) })
2613
+ ] })
2614
+ ] }),
2615
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("footer", { className: AdvancedDateRangePicker_module_default.footer, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2616
+ "button",
2617
+ {
2618
+ type: "button",
2619
+ onClick: handleDone,
2620
+ disabled: disabled || !isReady,
2621
+ className: AdvancedDateRangePicker_module_default.doneBtn,
2622
+ children: confirmLabel
2623
+ }
2624
+ ) })
2625
+ ] });
2626
+ }
2627
+ AdvancedDateRangePicker.displayName = "AdvancedDateRangePicker";
2628
+
2629
+ // src/atom/Slider/Slider.tsx
2630
+ var import_antd9 = require("antd");
2631
+ var import_clsx11 = __toESM(require("clsx"));
2632
+
2633
+ // src/atom/Slider/Slider.module.scss
2634
+ var Slider_module_default = { "label": "Slider-module__label___9Uea-", "slider": "Slider-module__slider___JCS-c", "disableFill": "Slider-module__disableFill___rjbsy" };
2635
+
2636
+ // src/atom/Slider/Slider.tsx
2637
+ var import_jsx_runtime18 = require("react/jsx-runtime");
2638
+ function Slider(props) {
2639
+ const {
2640
+ label = "",
2641
+ className = "",
2642
+ onChange,
2643
+ onAfterChange,
2644
+ defaultValue = [],
2645
+ value,
2646
+ step = 10,
2647
+ range = true,
2648
+ disabled = false,
2649
+ min,
2650
+ max,
2651
+ marks,
2652
+ dots,
2653
+ included,
2654
+ reverse,
2655
+ vertical,
2656
+ tipFormatter,
2657
+ tooltipVisible,
2658
+ tooltipPlacement,
2659
+ disableFill = false
2660
+ } = props;
2661
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
2662
+ label && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { className: Slider_module_default.label, children: label }),
2663
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2664
+ import_antd9.Slider,
2665
+ {
2666
+ className: (0, import_clsx11.default)(
2667
+ Slider_module_default.slider,
2668
+ className,
2669
+ Slider_module_default[disableFill ? "disableFill" : ""]
2670
+ ),
2671
+ "data-testid": "lumina-slider",
2672
+ range,
2673
+ step,
2674
+ defaultValue,
2675
+ value,
2676
+ onChange,
2677
+ onAfterChange,
2678
+ disabled,
2679
+ min,
2680
+ max,
2681
+ marks,
2682
+ dots,
2683
+ included,
2684
+ reverse,
2685
+ vertical,
2686
+ tooltip: {
2687
+ formatter: tipFormatter,
2688
+ open: tooltipVisible,
2689
+ placement: tooltipPlacement
2690
+ }
2691
+ }
2692
+ )
2693
+ ] });
2694
+ }
2695
+ Slider.displayName = "Slider";
2696
+ var Slider_default = Slider;
2697
+
2698
+ // src/atom/Table/Table.tsx
2699
+ var React5 = __toESM(require("react"));
2700
+ var import_antd10 = require("antd");
2701
+ var import_clsx12 = __toESM(require("clsx"));
2702
+
2703
+ // src/atom/Table/Table.module.scss
2704
+ var Table_module_default = { "tableWrapper": "Table-module__tableWrapper___3cqiD", "isAccordion": "Table-module__isAccordion___-uIs6", "isToolbar": "Table-module__isToolbar___LdS-m", "table": "Table-module__table___5d7g0", "firstRow": "Table-module__firstRow___Xq-Hi", "lastRow": "Table-module__lastRow___ahv4g", "showHoverEffect": "Table-module__showHoverEffect___IyKyO", "columnHeader": "Table-module__columnHeader___Unr6d", "columnHeaderLeft": "Table-module__columnHeaderLeft___mp7pK", "columnHeaderSortArea": "Table-module__columnHeaderSortArea___jrIYo", "columnHeaderLabel": "Table-module__columnHeaderLabel___A-mRu", "columnHeaderSortIcon": "Table-module__columnHeaderSortIcon___mWVZN", "columnHeaderSortIconActive": "Table-module__columnHeaderSortIconActive___wHAqC", "columnHeaderFilterWrapper": "Table-module__columnHeaderFilterWrapper___DnSve", "columnHeaderFilterBtn": "Table-module__columnHeaderFilterBtn___NR7DY", "columnHeaderFilterBtnActive": "Table-module__columnHeaderFilterBtnActive___JdO11", "columnHeaderFilterBadge": "Table-module__columnHeaderFilterBadge___-Q2T2", "columnHeaderFilterDropdown": "Table-module__columnHeaderFilterDropdown___M-fD4" };
2705
+
2706
+ // src/atom/Table/Table.tsx
2707
+ var import_jsx_runtime19 = require("react/jsx-runtime");
2708
+ function buildPagination(pagination, overrides = {}) {
2709
+ var _a, _b, _c, _d;
2710
+ if (pagination === false) {
2711
+ return false;
2712
+ }
2713
+ const defaults = {
2714
+ showSizeChanger: true,
2715
+ pageSizeOptions: ["10", "25", "50"],
2716
+ locale: { items_per_page: "" },
2717
+ // Removes "/ page" text
2718
+ showTotal: (total, range) => `${range[0]}\u2013${range[1]} of ${total} items`
2719
+ };
2720
+ const baseConfig = pagination === true || pagination === void 0 ? defaults : __spreadValues(__spreadValues({}, defaults), pagination);
2721
+ return __spreadProps(__spreadValues({}, baseConfig), {
2722
+ total: (_a = overrides.total) != null ? _a : baseConfig.total,
2723
+ current: (_b = overrides.current) != null ? _b : baseConfig.current,
2724
+ pageSize: (_c = overrides.pageSize) != null ? _c : baseConfig.pageSize,
2725
+ onChange: (_d = overrides.onChange) != null ? _d : baseConfig.onChange
2726
+ });
2727
+ }
2728
+ function nextSortOrder(current) {
2729
+ if (current === void 0) return "ascend";
2730
+ if (current === "ascend") return "descend";
2731
+ return void 0;
2732
+ }
2733
+ function ColumnHeader({
2734
+ label,
2735
+ sortable = false,
2736
+ sortOrder,
2737
+ onSortChange,
2738
+ sortIcon,
2739
+ filterCount = 0,
2740
+ filterIcon,
2741
+ filterContent,
2742
+ className = ""
2743
+ }) {
2744
+ const [filterOpen, setFilterOpen] = React5.useState(false);
2745
+ const wrapperRef = React5.useRef(null);
2746
+ const filterActive = filterCount > 0;
2747
+ const hasFilter = filterContent !== void 0 && filterIcon !== void 0;
2748
+ const hasSort = sortable && sortIcon !== void 0;
2749
+ React5.useEffect(() => {
2750
+ if (!filterOpen) return;
2751
+ const onOutside = (e) => {
2752
+ if (wrapperRef.current && !wrapperRef.current.contains(e.target)) {
2753
+ setFilterOpen(false);
2754
+ }
2755
+ };
2756
+ document.addEventListener("mousedown", onOutside);
2757
+ return () => document.removeEventListener("mousedown", onOutside);
2758
+ }, [filterOpen]);
2759
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: Table_module_default.columnHeader, ref: wrapperRef, children: [
2760
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: Table_module_default.columnHeaderLeft, children: hasSort ? /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
2761
+ "button",
2762
+ {
2763
+ type: "button",
2764
+ className: Table_module_default.columnHeaderSortArea,
2765
+ onClick: () => onSortChange == null ? void 0 : onSortChange(nextSortOrder(sortOrder)),
2766
+ "aria-label": typeof label === "string" ? `Sort by ${label}` : "Sort",
2767
+ children: [
2768
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: (0, import_clsx12.default)(Table_module_default.columnHeaderLabel, "tw-typography-caption2Bold tw-text-color-text-weak", className), children: label }),
2769
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2770
+ "span",
2771
+ {
2772
+ className: (0, import_clsx12.default)(Table_module_default.columnHeaderSortIcon, {
2773
+ [Table_module_default.columnHeaderSortIconActive]: sortOrder !== void 0
2774
+ }),
2775
+ children: sortIcon
2776
+ }
2777
+ )
2778
+ ]
2779
+ }
2780
+ ) : /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: (0, import_clsx12.default)(Table_module_default.columnHeaderLabel, "tw-typography-caption2Bold tw-text-color-text-weak", className), children: label }) }),
2781
+ hasFilter && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: Table_module_default.columnHeaderFilterWrapper, children: [
2782
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
2783
+ "button",
2784
+ {
2785
+ type: "button",
2786
+ className: (0, import_clsx12.default)(Table_module_default.columnHeaderFilterBtn, {
2787
+ [Table_module_default.columnHeaderFilterBtnActive]: filterActive
2788
+ }),
2789
+ onClick: () => setFilterOpen((v) => !v),
2790
+ "aria-label": typeof label === "string" ? `Filter ${label}` : "Filter",
2791
+ "aria-expanded": filterOpen,
2792
+ "aria-haspopup": "dialog",
2793
+ children: [
2794
+ filterIcon,
2795
+ filterActive && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: Table_module_default.columnHeaderFilterBadge, children: filterCount })
2796
+ ]
2797
+ }
2798
+ ),
2799
+ filterOpen && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: Table_module_default.columnHeaderFilterDropdown, role: "dialog", children: filterContent })
2800
+ ] })
2801
+ ] });
2802
+ }
2803
+ function processColumns(columns) {
2804
+ if (!columns) return void 0;
2805
+ return columns.map((col) => {
2806
+ const _a = col, { headerProps, title } = _a, rest = __objRest(_a, ["headerProps", "title"]);
2807
+ if (!headerProps) return __spreadValues({ title }, rest);
2808
+ return __spreadProps(__spreadValues({}, rest), {
2809
+ title: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(ColumnHeader, __spreadValues({ label: title }, headerProps))
2810
+ });
2811
+ });
2812
+ }
2813
+ function Table(props) {
2814
+ const _a = props, {
2815
+ size = "middle",
2816
+ variant = "default",
2817
+ isAccordion = false,
2818
+ isToolbar = false,
2819
+ className = "",
2820
+ pagination,
2821
+ loading,
2822
+ total,
2823
+ current,
2824
+ pageSize,
2825
+ onPaginationChange,
2826
+ columns,
2827
+ rowSelection,
2828
+ rowKey = "key",
2829
+ onRow,
2830
+ dataSource,
2831
+ emptyState,
2832
+ hideHeader,
2833
+ loadingIndicator,
2834
+ style
2835
+ } = _a, rest = __objRest(_a, [
2836
+ "size",
2837
+ "variant",
2838
+ "isAccordion",
2839
+ "isToolbar",
2840
+ "className",
2841
+ "pagination",
2842
+ "loading",
2843
+ "total",
2844
+ "current",
2845
+ "pageSize",
2846
+ "onPaginationChange",
2847
+ "columns",
2848
+ "rowSelection",
2849
+ "rowKey",
2850
+ "onRow",
2851
+ "dataSource",
2852
+ "emptyState",
2853
+ "hideHeader",
2854
+ "loadingIndicator",
2855
+ "style"
2856
+ ]);
2857
+ const isChildVariant = isAccordion || isToolbar;
2858
+ const resolvedPagination = buildPagination(pagination, {
2859
+ total,
2860
+ current,
2861
+ pageSize,
2862
+ onChange: onPaginationChange
2863
+ });
2864
+ const processedColumns = React5.useMemo(
2865
+ () => processColumns(columns),
2866
+ // eslint-disable-next-line react-hooks/exhaustive-deps
2867
+ [columns]
2868
+ );
2869
+ const resolvedOnRow = React5.useMemo(() => {
2870
+ const onChange = rowSelection == null ? void 0 : rowSelection.onChange;
2871
+ if (variant !== "selectable" || !onChange) return onRow;
2872
+ return (record, index) => {
2873
+ var _a2;
2874
+ const base = (_a2 = onRow == null ? void 0 : onRow(record, index)) != null ? _a2 : {};
2875
+ const getKey = (r, i) => typeof rowKey === "function" ? rowKey(r, i) : r[rowKey];
2876
+ return __spreadProps(__spreadValues({}, base), {
2877
+ style: __spreadValues({ cursor: "pointer" }, base.style),
2878
+ onClick: (e) => {
2879
+ var _a3, _b;
2880
+ (_a3 = base.onClick) == null ? void 0 : _a3.call(base, e);
2881
+ const key = getKey(record, index);
2882
+ const current2 = (_b = rowSelection.selectedRowKeys) != null ? _b : [];
2883
+ const isSelected = current2.some((k) => k === key);
2884
+ const newKeys = isSelected ? current2.filter((k) => k !== key) : [...current2, key];
2885
+ const newRows = (dataSource != null ? dataSource : []).filter(
2886
+ (r) => newKeys.some((k) => k === getKey(r))
2887
+ );
2888
+ onChange(newKeys, newRows, { type: "single" });
2889
+ }
2890
+ });
2891
+ };
2892
+ }, [variant, rowSelection, rowKey, onRow, dataSource]);
2893
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2894
+ "div",
2895
+ {
2896
+ className: (0, import_clsx12.default)(
2897
+ Table_module_default.tableWrapper,
2898
+ Table_module_default.showHoverEffect,
2899
+ { [Table_module_default.isAccordion]: isAccordion },
2900
+ { [Table_module_default.isToolbar]: isToolbar },
2901
+ className
2902
+ ),
2903
+ style,
2904
+ "data-testid": "lumina-table",
2905
+ children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2906
+ import_antd10.Table,
2907
+ __spreadProps(__spreadValues({
2908
+ className: Table_module_default.table,
2909
+ size,
2910
+ pagination: resolvedPagination,
2911
+ columns: processedColumns,
2912
+ rowSelection,
2913
+ rowKey,
2914
+ onRow: resolvedOnRow,
2915
+ dataSource,
2916
+ showHeader: !hideHeader,
2917
+ locale: {
2918
+ emptyText: loading && loadingIndicator ? loadingIndicator : loading ? " " : emptyState
2919
+ }
2920
+ }, rest), {
2921
+ loading: loadingIndicator ? false : loading,
2922
+ rowClassName: (_, index) => {
2923
+ var _a2;
2924
+ return (0, import_clsx12.default)({
2925
+ [Table_module_default.firstRow]: index === 0,
2926
+ [Table_module_default.lastRow]: index === ((_a2 = dataSource == null ? void 0 : dataSource.length) != null ? _a2 : 0) - 1
2927
+ });
2928
+ }
2929
+ })
2930
+ )
2931
+ }
2932
+ );
2933
+ }
2934
+ Table.displayName = "Table";
2935
+
2936
+ // src/molecules/UserProfile/UserProfile.tsx
2937
+ var import_clsx13 = __toESM(require("clsx"));
2938
+
2939
+ // src/molecules/UserProfile/UserProfile.module.scss
2940
+ var UserProfile_module_default = { "userProfile": "UserProfile-module__userProfile___cRMm9", "profileContent": "UserProfile-module__profileContent___tfy8E", "profileHeader": "UserProfile-module__profileHeader___5qYbt", "profileName": "UserProfile-module__profileName___x8pg-", "profileEmail": "UserProfile-module__profileEmail___ZWKDd" };
2941
+
2942
+ // src/molecules/UserProfile/UserProfile.tsx
2943
+ var import_jsx_runtime20 = require("react/jsx-runtime");
2944
+ var UserProfile = ({
2945
+ firstName = "",
2946
+ lastName = "",
2947
+ email = "",
2948
+ profileImg = "",
2949
+ className = "",
2950
+ avatarHeight = 32,
2951
+ avatarWidth = 32,
2952
+ avatarSize = "normal",
2953
+ showTag = false,
2954
+ tagProps,
2955
+ uniqueKey = "",
2956
+ nameClassName = "",
2957
+ emailClassName = ""
2958
+ }) => {
2959
+ const fullName = `${firstName} ${lastName}`;
2960
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: (0, import_clsx13.default)(UserProfile_module_default.userProfile, className), children: [
2961
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2962
+ Avatar,
2963
+ {
2964
+ img: profileImg,
2965
+ name: fullName,
2966
+ className: "tw-w-full tw-h-full tw-border-none",
2967
+ height: avatarHeight,
2968
+ width: avatarWidth,
2969
+ size: avatarSize
2970
+ }
2971
+ ),
2972
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: UserProfile_module_default.profileContent, children: [
2973
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: UserProfile_module_default.profileHeader, children: [
2974
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("p", { className: (0, import_clsx13.default)(nameClassName || (0, import_clsx13.default)(UserProfile_module_default.profileName, "tw-typography-body2Bold")), children: [
2975
+ firstName,
2976
+ " ",
2977
+ lastName
2978
+ ] }),
2979
+ showTag && tagProps && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Tag, __spreadValues({}, tagProps))
2980
+ ] }),
2981
+ email && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: (0, import_clsx13.default)(emailClassName || (0, import_clsx13.default)(UserProfile_module_default.profileEmail, "tw-typography-caption3", "amp-mask")), children: email })
2982
+ ] })
2983
+ ] }, uniqueKey);
2984
+ };
2985
+ UserProfile.displayName = "UserProfile";
2986
+ var UserProfile_default = UserProfile;
542
2987
  // Annotate the CommonJS export names for ESM import in node:
543
2988
  0 && (module.exports = {
2989
+ AdvancedDateRangePicker,
544
2990
  Avatar,
545
2991
  Button,
546
2992
  Checkbox,
2993
+ LoadingSpinner,
547
2994
  Modal,
548
2995
  Radio,
2996
+ RangePicker,
2997
+ Select,
2998
+ Slider,
549
2999
  Switch,
550
- Tooltip
3000
+ Table,
3001
+ Tag,
3002
+ Tooltip,
3003
+ UserProfile
551
3004
  });