@itilite/lumina-ui 1.1.4 → 1.1.5

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 (41) hide show
  1. package/dist/atom/RangePicker/Chevron.d.mts +13 -0
  2. package/dist/atom/RangePicker/Chevron.d.ts +13 -0
  3. package/dist/atom/RangePicker/Chevron.js +110 -0
  4. package/dist/atom/RangePicker/Chevron.mjs +7 -0
  5. package/dist/atom/RangePicker/RangePicker.d.mts +26 -0
  6. package/dist/atom/RangePicker/RangePicker.d.ts +26 -0
  7. package/dist/atom/RangePicker/RangePicker.js +1322 -0
  8. package/dist/atom/RangePicker/RangePicker.mjs +11 -0
  9. package/dist/atom/Select/Select.d.mts +40 -0
  10. package/dist/atom/Select/Select.d.ts +40 -0
  11. package/dist/atom/Select/Select.js +678 -0
  12. package/dist/atom/Select/Select.mjs +9 -0
  13. package/dist/chunk-33JITG5Y.mjs +621 -0
  14. package/dist/chunk-3K2RTVMH.mjs +584 -0
  15. package/dist/chunk-3YDCRJYV.mjs +618 -0
  16. package/dist/chunk-6NZEDJ2M.mjs +582 -0
  17. package/dist/chunk-BP4XS2GF.mjs +585 -0
  18. package/dist/chunk-BTIIO2CP.mjs +582 -0
  19. package/dist/chunk-D5B2TUSL.mjs +591 -0
  20. package/dist/chunk-E6UPDTDY.mjs +611 -0
  21. package/dist/chunk-G6P5MKL3.mjs +582 -0
  22. package/dist/chunk-IUTUCRDD.mjs +611 -0
  23. package/dist/chunk-JCMSG75Q.mjs +51 -0
  24. package/dist/chunk-JZCHXA6R.mjs +585 -0
  25. package/dist/chunk-KH7D4ESJ.mjs +584 -0
  26. package/dist/chunk-KQBCWIIM.mjs +618 -0
  27. package/dist/chunk-PGAAFJOG.mjs +576 -0
  28. package/dist/chunk-QUZAACW5.mjs +585 -0
  29. package/dist/chunk-RZ7V2KQZ.mjs +621 -0
  30. package/dist/chunk-S3CUYIE3.mjs +585 -0
  31. package/dist/chunk-TENXL4LK.mjs +107 -0
  32. package/dist/chunk-UFAFA6RV.mjs +585 -0
  33. package/dist/chunk-XE4LPYOW.mjs +581 -0
  34. package/dist/chunk-ZTRM4HZJ.mjs +53 -0
  35. package/dist/chunk-ZUMHWVMV.mjs +585 -0
  36. package/dist/index.d.mts +2 -0
  37. package/dist/index.d.ts +2 -0
  38. package/dist/index.js +1259 -0
  39. package/dist/index.mjs +21 -12
  40. package/dist/styles.css +794 -218
  41. package/package.json +2 -1
package/dist/index.js CHANGED
@@ -64,6 +64,8 @@ __export(index_exports, {
64
64
  Checkbox: () => Checkbox_default,
65
65
  Modal: () => Modal_default,
66
66
  Radio: () => Radio_default,
67
+ RangePicker: () => RangePicker_default,
68
+ Select: () => Select_default,
67
69
  Switch: () => Switch_default,
68
70
  Tag: () => Tag_default,
69
71
  Tooltip: () => Tooltip_default
@@ -583,6 +585,1261 @@ var Tag = (_a) => {
583
585
  };
584
586
  Tag.displayName = "Tag";
585
587
  var Tag_default = Tag;
588
+
589
+ // src/atom/RangePicker/RangePicker.tsx
590
+ var import_react2 = require("react");
591
+ var import_clsx9 = __toESM(require("clsx"));
592
+ var import_dayjs = __toESM(require("dayjs"));
593
+
594
+ // src/atom/RangePicker/Chevron.tsx
595
+ var React = __toESM(require("react"));
596
+ var import_jsx_runtime9 = require("react/jsx-runtime");
597
+ var Chevron = React.memo(
598
+ (_a) => {
599
+ var _b = _a, { size = "normal", color = "black", className } = _b, rest = __objRest(_b, ["size", "color", "className"]);
600
+ const getSize = (size2) => {
601
+ switch (size2) {
602
+ case "small":
603
+ 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";
604
+ case "normal":
605
+ 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";
606
+ default:
607
+ 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";
608
+ }
609
+ };
610
+ const getContainer = (size2) => {
611
+ switch (size2) {
612
+ case "small":
613
+ return 16;
614
+ case "medium":
615
+ return 20;
616
+ case "normal":
617
+ return 24;
618
+ default:
619
+ return 24;
620
+ }
621
+ };
622
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
623
+ "svg",
624
+ __spreadProps(__spreadValues({
625
+ xmlns: "http://www.w3.org/2000/svg",
626
+ width: getContainer(size),
627
+ height: getContainer(size),
628
+ fill: "none",
629
+ viewBox: `0 0 ${getContainer(size)} ${getContainer(size)}`,
630
+ className
631
+ }, rest), {
632
+ children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("path", { fill: color, d: getSize(size) })
633
+ })
634
+ );
635
+ }
636
+ );
637
+
638
+ // src/atom/RangePicker/RangePicker.module.scss
639
+ var RangePicker_module_default = { "range_start": "RangePicker-module__range_start___hGQp-", "range_end": "RangePicker-module__range_end___JJNib" };
640
+
641
+ // src/atom/Select/Select.tsx
642
+ var import_react = require("react");
643
+ var import_clsx8 = __toESM(require("clsx"));
644
+
645
+ // src/icons/Chevron.tsx
646
+ var React2 = __toESM(require("react"));
647
+ var import_jsx_runtime10 = require("react/jsx-runtime");
648
+ var Chevron2 = React2.memo(
649
+ (_a) => {
650
+ var _b = _a, { size = 16, color = "#6b7280", className } = _b, rest = __objRest(_b, ["size", "color", "className"]);
651
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
652
+ "svg",
653
+ __spreadProps(__spreadValues({
654
+ xmlns: "http://www.w3.org/2000/svg",
655
+ width: size,
656
+ height: size,
657
+ fill: "none",
658
+ viewBox: "0 0 16 16",
659
+ className
660
+ }, rest), {
661
+ children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
662
+ "path",
663
+ {
664
+ fill: color,
665
+ 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"
666
+ }
667
+ )
668
+ })
669
+ );
670
+ }
671
+ );
672
+ Chevron2.displayName = "Chevron";
673
+
674
+ // src/icons/CrossV2.tsx
675
+ var React3 = __toESM(require("react"));
676
+ var import_jsx_runtime11 = require("react/jsx-runtime");
677
+ var CrossV2 = React3.memo(
678
+ (_a) => {
679
+ var _b = _a, { size = 16, color = "#111827", className } = _b, rest = __objRest(_b, ["size", "color", "className"]);
680
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
681
+ "svg",
682
+ __spreadProps(__spreadValues({
683
+ xmlns: "http://www.w3.org/2000/svg",
684
+ width: size,
685
+ height: size,
686
+ fill: "none",
687
+ viewBox: "0 0 16 16",
688
+ className
689
+ }, rest), {
690
+ children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
691
+ "path",
692
+ {
693
+ fill: color,
694
+ fillRule: "evenodd",
695
+ d: "M4.293 4.293a1 1 0 011.414 0L8 6.586l2.293-2.293a1 1 0 111.414 1.414L9.414 8l2.293 2.293a1 1 0 01-1.414 1.414L8 9.414l-2.293 2.293a1 1 0 01-1.414-1.414L6.586 8 4.293 5.707a1 1 0 010-1.414z",
696
+ clipRule: "evenodd"
697
+ }
698
+ )
699
+ })
700
+ );
701
+ }
702
+ );
703
+ CrossV2.displayName = "CrossV2";
704
+
705
+ // src/atom/Select/Select.tsx
706
+ var import_jsx_runtime12 = require("react/jsx-runtime");
707
+ var Select = ({
708
+ label,
709
+ mandatory = false,
710
+ error = false,
711
+ options = [],
712
+ valueSelected = "",
713
+ // Keep for backward compatibility
714
+ value: _valueProp,
715
+ // Rename to avoid potential conflicts with native value attribute
716
+ onChange,
717
+ className = "",
718
+ dropdownClassName = "",
719
+ optionClassName = "",
720
+ style = {},
721
+ showDisplayValue = false,
722
+ // New prop to show displayValue instead of label
723
+ allowClear = true,
724
+ enableSearch = true,
725
+ // New prop to control search functionality, default true
726
+ doubleCharSearch = false,
727
+ id,
728
+ name,
729
+ tabIndex,
730
+ // Add tabIndex prop
731
+ // Additional styling props
732
+ size = "default",
733
+ // 'small', 'default', 'large'
734
+ variant = "default",
735
+ // 'default', 'filled', 'outlined'
736
+ wrapperClassName = "",
737
+ inputClassName = "",
738
+ // Custom class for input element specifically
739
+ labelClassName = "",
740
+ // Custom class for label element specifically
741
+ height = "tw-h-12",
742
+ // Custom height
743
+ experience = "business"
744
+ }) => {
745
+ const normalizeValue = (0, import_react.useCallback)(
746
+ (val) => {
747
+ if (val === null || val === void 0) return "";
748
+ return String(val);
749
+ },
750
+ []
751
+ );
752
+ const validatedOptions = (0, import_react.useMemo)(() => {
753
+ if (!Array.isArray(options)) return [];
754
+ return options.filter(
755
+ (opt) => opt && typeof opt === "object" && opt.value !== void 0 && opt.value !== null && opt.label !== void 0
756
+ );
757
+ }, [options]);
758
+ const [isOpen, setIsOpen] = (0, import_react.useState)(false);
759
+ const [isFocused, setIsFocused] = (0, import_react.useState)(false);
760
+ const [searchTerm, setSearchTerm] = (0, import_react.useState)("");
761
+ const [isHovering, setIsHovering] = (0, import_react.useState)(false);
762
+ const [highlightedIndex, setHighlightedIndex] = (0, import_react.useState)(-1);
763
+ const [selectedValue, setSelectedValue] = (0, import_react.useState)(() => {
764
+ const initialValue = valueSelected;
765
+ if (initialValue === null || initialValue === void 0) return "";
766
+ return String(initialValue);
767
+ });
768
+ const inputRef = (0, import_react.useRef)(null);
769
+ const inputValueRef = (0, import_react.useRef)("");
770
+ const dropdownRef = (0, import_react.useRef)(null);
771
+ const optionRefs = (0, import_react.useRef)([]);
772
+ const optionListRef = (0, import_react.useRef)(null);
773
+ const blurTimeoutRef = (0, import_react.useRef)(null);
774
+ const hoverTimeoutRef = (0, import_react.useRef)(null);
775
+ const isActive = isFocused || Boolean(selectedValue) || Boolean(valueSelected) || Boolean(searchTerm);
776
+ const sizeClasses = (0, import_react.useMemo)(() => {
777
+ switch (size) {
778
+ case "small":
779
+ return {
780
+ input: "tw-h-8 tw-px-3 tw-typography-body2",
781
+ padding: label ? "tw-pt-4 tw-pb-1" : "tw-py-2",
782
+ labelActive: "tw-top-0 tw-typography-caption4",
783
+ labelInactive: "tw-top-2 tw-typography-caption3"
784
+ };
785
+ case "medium":
786
+ return {
787
+ input: "tw-h-10 tw-px-4 tw-typography-body2",
788
+ padding: label ? "tw-pt-4 tw-pb-1" : "tw-py-2",
789
+ labelActive: "tw-top-1 tw-typography-caption3",
790
+ labelInactive: "tw-top-2.5 tw-typography-body2"
791
+ };
792
+ case "large":
793
+ return {
794
+ input: "tw-h-16 tw-px-5 tw-typography-bodyLarge",
795
+ padding: label ? "tw-pt-8 tw-pb-4" : "tw-py-5",
796
+ labelActive: "tw-top-1 tw-typography-caption2",
797
+ labelInactive: "tw-top-5 tw-typography-body1"
798
+ };
799
+ default:
800
+ return {
801
+ input: height + " tw-px-4 tw-typography-bodyLarge",
802
+ padding: label ? "tw-pt-6 tw-pb-3" : "tw-py-3",
803
+ labelActive: "tw-top-1 tw-typography-caption3",
804
+ labelInactive: "tw-top-3.5 tw-typography-body2"
805
+ };
806
+ }
807
+ }, [size, label, height]);
808
+ const variantClasses = (0, import_react.useMemo)(() => {
809
+ switch (variant) {
810
+ case "filled":
811
+ return "tw-bg-gray-50 tw-border-transparent";
812
+ case "outlined":
813
+ return "tw-bg-transparent tw-border-2";
814
+ default:
815
+ return " tw-border";
816
+ }
817
+ }, [variant]);
818
+ const handleBlur = (0, import_react.useCallback)(() => {
819
+ blurTimeoutRef.current = setTimeout(() => {
820
+ setIsOpen(false);
821
+ setSearchTerm("");
822
+ setHighlightedIndex(-1);
823
+ blurTimeoutRef.current = null;
824
+ setIsFocused(false);
825
+ }, 150);
826
+ }, []);
827
+ const handleSearchChange = (0, import_react.useCallback)(
828
+ (e) => {
829
+ var _a;
830
+ if (doubleCharSearch) {
831
+ setSearchTerm(e.target.value.slice(0, 2) || "");
832
+ } else {
833
+ setSearchTerm(e.target.value);
834
+ }
835
+ setIsOpen(true);
836
+ setHighlightedIndex(-1);
837
+ (_a = optionListRef == null ? void 0 : optionListRef.current) == null ? void 0 : _a.scrollTo({
838
+ top: 0,
839
+ behavior: "smooth"
840
+ });
841
+ },
842
+ [doubleCharSearch]
843
+ );
844
+ const handleOptionSelect = (0, import_react.useCallback)(
845
+ (option) => {
846
+ var _a;
847
+ if (blurTimeoutRef.current) {
848
+ clearTimeout(blurTimeoutRef.current);
849
+ blurTimeoutRef.current = null;
850
+ }
851
+ inputValueRef.current = option.label;
852
+ const normalizedValue = normalizeValue(option.value);
853
+ setSelectedValue(normalizedValue);
854
+ setSearchTerm("");
855
+ setIsOpen(false);
856
+ if (enableSearch) {
857
+ setIsFocused(false);
858
+ }
859
+ setIsHovering(false);
860
+ if (onChange) onChange(option.value);
861
+ if (enableSearch) (_a = inputRef.current) == null ? void 0 : _a.blur();
862
+ },
863
+ [normalizeValue, onChange, enableSearch]
864
+ );
865
+ const handleClear = (0, import_react.useCallback)(
866
+ (e) => {
867
+ var _a;
868
+ inputValueRef.current = "";
869
+ e.stopPropagation();
870
+ e.preventDefault();
871
+ setSelectedValue("");
872
+ setSearchTerm("");
873
+ if (enableSearch) {
874
+ setIsOpen(true);
875
+ setIsFocused(true);
876
+ (_a = inputRef.current) == null ? void 0 : _a.focus();
877
+ } else {
878
+ setIsOpen(false);
879
+ setIsFocused(false);
880
+ }
881
+ if (onChange) onChange(null);
882
+ },
883
+ [onChange, enableSearch]
884
+ );
885
+ (0, import_react.useEffect)(() => {
886
+ if (!validatedOptions.length) {
887
+ setSelectedValue("");
888
+ setSearchTerm("");
889
+ inputValueRef.current = "";
890
+ }
891
+ }, [validatedOptions.length]);
892
+ (0, import_react.useEffect)(() => {
893
+ const newValue = normalizeValue(valueSelected);
894
+ setSelectedValue((prevValue) => {
895
+ const prevNormalized = normalizeValue(prevValue);
896
+ return prevNormalized !== newValue ? newValue : prevValue;
897
+ });
898
+ }, [valueSelected, normalizeValue]);
899
+ (0, import_react.useEffect)(() => {
900
+ const handleClickOutside = (event) => {
901
+ if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
902
+ if (blurTimeoutRef.current) {
903
+ clearTimeout(blurTimeoutRef.current);
904
+ blurTimeoutRef.current = null;
905
+ }
906
+ setIsOpen(false);
907
+ setIsFocused(false);
908
+ setSearchTerm("");
909
+ setHighlightedIndex(-1);
910
+ }
911
+ };
912
+ document.addEventListener("mousedown", handleClickOutside);
913
+ return () => {
914
+ document.removeEventListener("mousedown", handleClickOutside);
915
+ if (blurTimeoutRef.current) {
916
+ clearTimeout(blurTimeoutRef.current);
917
+ }
918
+ if (hoverTimeoutRef.current) {
919
+ clearTimeout(hoverTimeoutRef.current);
920
+ }
921
+ };
922
+ }, []);
923
+ const getDisplayValue = (0, import_react.useCallback)(() => {
924
+ if (selectedValue && (validatedOptions == null ? void 0 : validatedOptions.length) > 0) {
925
+ const selected = validatedOptions.find(
926
+ (opt) => normalizeValue(opt.value) === normalizeValue(selectedValue)
927
+ );
928
+ if (selected) {
929
+ return showDisplayValue && selected.displayValue ? selected.displayValue : selected.label;
930
+ }
931
+ }
932
+ if (selectedValue && (!validatedOptions || validatedOptions.length === 0)) {
933
+ return selectedValue;
934
+ }
935
+ return "";
936
+ }, [selectedValue, validatedOptions, showDisplayValue, normalizeValue]);
937
+ const filteredOptions = (0, import_react.useMemo)(() => {
938
+ var _a;
939
+ if (!enableSearch) {
940
+ return validatedOptions;
941
+ }
942
+ (_a = dropdownRef.current) == null ? void 0 : _a.scrollTo(0, 0);
943
+ const updatedFilteredOptions = validatedOptions.filter((option) => {
944
+ var _a2;
945
+ return (_a2 = option == null ? void 0 : option.label) == null ? void 0 : _a2.toLowerCase().includes(searchTerm == null ? void 0 : searchTerm.toLowerCase());
946
+ });
947
+ return updatedFilteredOptions;
948
+ }, [validatedOptions, searchTerm, enableSearch]);
949
+ const getSelectedOptionIndex = (0, import_react.useCallback)(() => {
950
+ if (!selectedValue || !filteredOptions.length) {
951
+ return 0;
952
+ }
953
+ const index = filteredOptions.findIndex(
954
+ (option) => normalizeValue(option.value) === normalizeValue(selectedValue)
955
+ );
956
+ return index >= 0 ? index : 0;
957
+ }, [selectedValue, filteredOptions, normalizeValue]);
958
+ const handleInputInteraction = (0, import_react.useCallback)(
959
+ (_e) => {
960
+ var _a;
961
+ if (blurTimeoutRef.current) {
962
+ clearTimeout(blurTimeoutRef.current);
963
+ blurTimeoutRef.current = null;
964
+ }
965
+ if (isOpen) {
966
+ setIsOpen(false);
967
+ setIsFocused(false);
968
+ setSearchTerm("");
969
+ setHighlightedIndex(-1);
970
+ (_a = inputRef.current) == null ? void 0 : _a.blur();
971
+ return;
972
+ }
973
+ setIsFocused(true);
974
+ setIsOpen(true);
975
+ setHighlightedIndex(getSelectedOptionIndex());
976
+ if (inputRef.current) {
977
+ inputRef.current.focus();
978
+ }
979
+ },
980
+ [isOpen, getSelectedOptionIndex]
981
+ );
982
+ const handleKeyDown = (0, import_react.useCallback)(
983
+ (e) => {
984
+ var _a;
985
+ if (!isOpen) return;
986
+ switch (e.key) {
987
+ case "ArrowDown":
988
+ e.preventDefault();
989
+ setHighlightedIndex((prev) => {
990
+ const nextIndex = prev < filteredOptions.length - 1 ? prev + 1 : prev;
991
+ return nextIndex;
992
+ });
993
+ break;
994
+ case "ArrowUp":
995
+ e.preventDefault();
996
+ setHighlightedIndex((prev) => {
997
+ const nextIndex = prev > 0 ? prev - 1 : prev;
998
+ return nextIndex;
999
+ });
1000
+ break;
1001
+ case "Enter":
1002
+ e.preventDefault();
1003
+ if (highlightedIndex >= 0 && filteredOptions[highlightedIndex]) {
1004
+ handleOptionSelect(filteredOptions[highlightedIndex]);
1005
+ }
1006
+ break;
1007
+ case "Escape":
1008
+ e.preventDefault();
1009
+ setIsOpen(false);
1010
+ setIsFocused(false);
1011
+ setSearchTerm("");
1012
+ setHighlightedIndex(-1);
1013
+ (_a = inputRef.current) == null ? void 0 : _a.blur();
1014
+ break;
1015
+ default:
1016
+ break;
1017
+ }
1018
+ },
1019
+ [isOpen, highlightedIndex, filteredOptions, handleOptionSelect]
1020
+ );
1021
+ (0, import_react.useEffect)(() => {
1022
+ if (highlightedIndex >= 0 && optionRefs.current[highlightedIndex]) {
1023
+ optionRefs.current[highlightedIndex].scrollIntoView({
1024
+ block: "nearest",
1025
+ behavior: "smooth"
1026
+ });
1027
+ }
1028
+ }, [highlightedIndex]);
1029
+ (0, import_react.useEffect)(() => {
1030
+ optionRefs.current = [];
1031
+ }, [filteredOptions]);
1032
+ const handleMouseEnter = (0, import_react.useCallback)(() => {
1033
+ if (hoverTimeoutRef.current) {
1034
+ clearTimeout(hoverTimeoutRef.current);
1035
+ }
1036
+ if (!isHovering) {
1037
+ setIsHovering(true);
1038
+ }
1039
+ }, [isHovering]);
1040
+ const handleMouseLeave = (0, import_react.useCallback)(() => {
1041
+ hoverTimeoutRef.current = setTimeout(() => {
1042
+ setIsHovering(false);
1043
+ }, 50);
1044
+ }, []);
1045
+ const handleChevronClick = (0, import_react.useCallback)(
1046
+ (e) => {
1047
+ var _a;
1048
+ e.preventDefault();
1049
+ if (blurTimeoutRef.current) {
1050
+ clearTimeout(blurTimeoutRef.current);
1051
+ blurTimeoutRef.current = null;
1052
+ }
1053
+ if (isOpen) {
1054
+ setIsOpen(false);
1055
+ setIsFocused(false);
1056
+ setSearchTerm("");
1057
+ setHighlightedIndex(-1);
1058
+ (_a = inputRef.current) == null ? void 0 : _a.blur();
1059
+ } else {
1060
+ if (inputRef.current) {
1061
+ inputRef.current.focus();
1062
+ }
1063
+ handleInputInteraction();
1064
+ }
1065
+ },
1066
+ [isOpen, handleInputInteraction]
1067
+ );
1068
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
1069
+ "div",
1070
+ {
1071
+ style,
1072
+ className: (0, import_clsx8.default)("tw-relative tw-w-full", wrapperClassName),
1073
+ ref: dropdownRef,
1074
+ onMouseEnter: handleMouseEnter,
1075
+ onMouseLeave: handleMouseLeave,
1076
+ children: [
1077
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "tw-relative", children: [
1078
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1079
+ "input",
1080
+ {
1081
+ ref: inputRef,
1082
+ type: "text",
1083
+ id,
1084
+ name,
1085
+ tabIndex,
1086
+ autoComplete: "off",
1087
+ autoCorrect: "off",
1088
+ autoCapitalize: "off",
1089
+ spellCheck: "false",
1090
+ value: isFocused && enableSearch ? searchTerm : getDisplayValue(),
1091
+ onChange: enableSearch ? handleSearchChange : void 0,
1092
+ onClick: handleInputInteraction,
1093
+ onKeyDown: handleKeyDown,
1094
+ className: (0, import_clsx8.default)(
1095
+ "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",
1096
+ sizeClasses.input,
1097
+ sizeClasses.padding,
1098
+ variantClasses,
1099
+ {
1100
+ "tw-bg-white": valueSelected || getDisplayValue() || isFocused,
1101
+ "tw-bg-color-gray-5": !valueSelected || !getDisplayValue()
1102
+ },
1103
+ // Conditional padding based on label presence
1104
+ !label && "tw-flex tw-items-center",
1105
+ {
1106
+ "!tw-border-color-primary": isFocused && experience === "business"
1107
+ },
1108
+ {
1109
+ "!tw-border-[#804D7B]": isFocused && experience === "personal"
1110
+ },
1111
+ error ? "!tw-border-color-text-critical " : "tw-border-[#EBE3DD] hover:tw-border-[#C5B7AC]",
1112
+ // Add focus state styling
1113
+ "focus:tw-shadow-sm focus:tw-ring-offset-1",
1114
+ className,
1115
+ inputClassName
1116
+ // Put inputClassName last so it can override default classes
1117
+ ),
1118
+ readOnly: !isFocused || !enableSearch
1119
+ }
1120
+ ),
1121
+ label && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
1122
+ "label",
1123
+ {
1124
+ htmlFor: id,
1125
+ className: (0, import_clsx8.default)(
1126
+ "tw-absolute tw-left-[18px] tw-pointer-events-none tw-transition-all tw-duration-200 tw-ease-out tw-text-gray-500",
1127
+ isActive ? sizeClasses.labelActive : sizeClasses.labelInactive,
1128
+ error && "tw-text-color-text-critical",
1129
+ labelClassName
1130
+ ),
1131
+ children: [
1132
+ label,
1133
+ mandatory && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "tw-text-color-text-critical tw-ml-1", children: "*" })
1134
+ ]
1135
+ }
1136
+ ),
1137
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1138
+ "div",
1139
+ {
1140
+ className: (0, import_clsx8.default)(
1141
+ "tw-absolute tw-right-3 tw-top-1/2 tw--translate-y-1/2 tw-flex tw-items-center",
1142
+ {
1143
+ "!tw-right-[5px]": doubleCharSearch && !(isHovering && selectedValue && allowClear)
1144
+ }
1145
+ ),
1146
+ children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1147
+ "div",
1148
+ {
1149
+ className: (0, import_clsx8.default)(
1150
+ "tw-transition-all tw-duration-200 tw-cursor-pointer tw-flex tw-items-center",
1151
+ // Only rotate chevron when open and not showing clear icon
1152
+ isOpen && !(isHovering && selectedValue && allowClear) && "-tw-rotate-180"
1153
+ ),
1154
+ onMouseDown: (e) => {
1155
+ if (isHovering && selectedValue && allowClear) {
1156
+ handleClear(e);
1157
+ } else {
1158
+ handleChevronClick(e);
1159
+ }
1160
+ },
1161
+ children: isHovering && selectedValue && allowClear ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(CrossV2, { color: "#111827", className: "tw-mr-1" }) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1162
+ Chevron2,
1163
+ {
1164
+ className: (0, import_clsx8.default)("tw-text-gray-400"),
1165
+ color: "#6B7280"
1166
+ }
1167
+ )
1168
+ }
1169
+ )
1170
+ }
1171
+ )
1172
+ ] }),
1173
+ isOpen && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1174
+ "div",
1175
+ {
1176
+ className: (0, import_clsx8.default)(
1177
+ "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",
1178
+ { "tw-max-h-60": !doubleCharSearch },
1179
+ { "tw-max-h-44": doubleCharSearch },
1180
+ dropdownClassName
1181
+ ),
1182
+ ref: optionListRef,
1183
+ children: filteredOptions.length > 0 ? filteredOptions.map((option, index) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1184
+ "div",
1185
+ {
1186
+ ref: (el) => optionRefs.current[index] = el,
1187
+ onClick: () => handleOptionSelect(option),
1188
+ onMouseEnter: () => setHighlightedIndex(index),
1189
+ className: (0, import_clsx8.default)(
1190
+ "tw-transition-all tw-duration-150 tw-typography-body2",
1191
+ // Selected option styling
1192
+ optionClassName
1193
+ ),
1194
+ children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1195
+ "div",
1196
+ {
1197
+ className: (0, import_clsx8.default)(
1198
+ "tw-px-4 tw-cursor-pointer tw-py-2 tw-mx-0.5 tw-rounded-xl",
1199
+ normalizeValue(selectedValue) === normalizeValue(option.value) ? experience === "personal" ? "tw-bg-[#f1e8fa]" : "tw-bg-[#fff1e1]" : (
1200
+ // Highlighted option styling (keyboard navigation)
1201
+ index === highlightedIndex ? "tw-bg-[#f3f4f6] tw-text-gray-900" : (
1202
+ // Default option styling
1203
+ "tw-text-gray-900 hover:tw-bg-[#1118270a]"
1204
+ )
1205
+ )
1206
+ ),
1207
+ children: option.label
1208
+ }
1209
+ )
1210
+ },
1211
+ doubleCharSearch ? option.label : option.value
1212
+ )) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "tw-px-4 tw-py-3 tw-text-gray-500 tw-text-sm", children: "No options found" })
1213
+ }
1214
+ )
1215
+ ]
1216
+ }
1217
+ );
1218
+ };
1219
+ var arePropsEqual = (prevProps, nextProps) => {
1220
+ var _a, _b;
1221
+ const criticalProps = [
1222
+ "value",
1223
+ "valueSelected",
1224
+ "options",
1225
+ "error",
1226
+ "disabled",
1227
+ "label",
1228
+ "mandatory"
1229
+ ];
1230
+ for (const prop of criticalProps) {
1231
+ if (prevProps[prop] !== nextProps[prop]) {
1232
+ return false;
1233
+ }
1234
+ }
1235
+ if (((_a = prevProps.options) == null ? void 0 : _a.length) !== ((_b = nextProps.options) == null ? void 0 : _b.length)) {
1236
+ return false;
1237
+ }
1238
+ if (prevProps.options && nextProps.options) {
1239
+ for (let i = 0; i < prevProps.options.length; i++) {
1240
+ const prevOpt = prevProps.options[i];
1241
+ const nextOpt = nextProps.options[i];
1242
+ if ((prevOpt == null ? void 0 : prevOpt.value) !== (nextOpt == null ? void 0 : nextOpt.value) || (prevOpt == null ? void 0 : prevOpt.label) !== (nextOpt == null ? void 0 : nextOpt.label)) {
1243
+ return false;
1244
+ }
1245
+ }
1246
+ }
1247
+ return true;
1248
+ };
1249
+ Select.displayName = "Select";
1250
+ var Select_default = (0, import_react.memo)(Select, arePropsEqual);
1251
+
1252
+ // src/atom/RangePicker/RangePicker.tsx
1253
+ var import_jsx_runtime13 = require("react/jsx-runtime");
1254
+ function CustomRangePicker(props) {
1255
+ var _a, _b;
1256
+ const {
1257
+ id = "",
1258
+ footer,
1259
+ onChange = () => {
1260
+ },
1261
+ dateRange = ["", ""],
1262
+ showNightCount = false,
1263
+ isRange = true,
1264
+ showYearDropdown = false,
1265
+ showSingleCalendar = false,
1266
+ disablePastDates = false,
1267
+ // New prop to control past date restriction
1268
+ minDate = null,
1269
+ // New prop for minimum allowed date
1270
+ maxDate = null,
1271
+ // New prop for maximum allowed date
1272
+ minYear = 1900,
1273
+ // Minimum year for dropdown
1274
+ maxYear = (/* @__PURE__ */ new Date()).getFullYear() + 10,
1275
+ // Maximum year for dropdown
1276
+ experience = "business",
1277
+ showToastError = () => {
1278
+ }
1279
+ } = props;
1280
+ const onChangeRef = (0, import_react2.useRef)(onChange);
1281
+ (0, import_react2.useEffect)(() => {
1282
+ onChangeRef.current = onChange;
1283
+ }, [onChange]);
1284
+ const getInitialDate = () => {
1285
+ if (dateRange[0]) {
1286
+ return new Date(dateRange[0]);
1287
+ }
1288
+ if (!minDate && !maxDate && !minYear && !maxYear) {
1289
+ return /* @__PURE__ */ new Date();
1290
+ }
1291
+ if (maxYear && maxYear !== (/* @__PURE__ */ new Date()).getFullYear()) {
1292
+ let targetDate = new Date(maxYear, 7, 1);
1293
+ if (maxDate) {
1294
+ const maxDateTime = new Date(maxDate);
1295
+ if (targetDate > maxDateTime) {
1296
+ targetDate = new Date(
1297
+ maxDateTime.getFullYear(),
1298
+ maxDateTime.getMonth(),
1299
+ 1
1300
+ );
1301
+ }
1302
+ }
1303
+ return targetDate;
1304
+ }
1305
+ if (minDate) {
1306
+ const minDateTime = new Date(minDate);
1307
+ minDateTime.setHours(0, 0, 0, 0);
1308
+ return minDateTime;
1309
+ }
1310
+ return /* @__PURE__ */ new Date();
1311
+ };
1312
+ const [currentDate, setCurrentDate] = (0, import_react2.useState)(() => getInitialDate());
1313
+ const [startDate, setStartDate] = (0, import_react2.useState)(
1314
+ dateRange[0] ? new Date(dateRange[0]) : null
1315
+ );
1316
+ const [endDate, setEndDate] = (0, import_react2.useState)(
1317
+ dateRange[0] && dateRange[1] ? new Date(dateRange[1]) : null
1318
+ );
1319
+ const [hoverDate, setHoverDate] = (0, import_react2.useState)(null);
1320
+ const [isSelectingEnd, setIsSelectingEnd] = (0, import_react2.useState)(
1321
+ dateRange[0] && !dateRange[1] ? true : false
1322
+ );
1323
+ const [selectedDate, setSelectedDate] = (0, import_react2.useState)(
1324
+ !isRange && dateRange[0] ? new Date(dateRange[0]) : null
1325
+ );
1326
+ const getDaysBetween = (start, end) => {
1327
+ if (!start || !end) return 0;
1328
+ const startDay = (0, import_dayjs.default)(start).startOf("day");
1329
+ const endDay = (0, import_dayjs.default)(end).startOf("day");
1330
+ return endDay.diff(startDay, "day");
1331
+ };
1332
+ const nightCount = Math.abs(getDaysBetween(startDate || endDate, hoverDate));
1333
+ const nightCountText = nightCount > 1 ? `${nightCount} nights` : "1 night";
1334
+ const today = /* @__PURE__ */ new Date();
1335
+ today.setHours(0, 0, 0, 0);
1336
+ const firstMonth = new Date(
1337
+ currentDate.getFullYear(),
1338
+ currentDate.getMonth(),
1339
+ 1
1340
+ );
1341
+ const secondMonth = new Date(
1342
+ currentDate.getFullYear(),
1343
+ currentDate.getMonth() + 1,
1344
+ 1
1345
+ );
1346
+ const monthNames = [
1347
+ "January",
1348
+ "February",
1349
+ "March",
1350
+ "April",
1351
+ "May",
1352
+ "June",
1353
+ "July",
1354
+ "August",
1355
+ "September",
1356
+ "October",
1357
+ "November",
1358
+ "December"
1359
+ ];
1360
+ const dayNames = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"];
1361
+ const generateYearOptions = () => {
1362
+ const years = [];
1363
+ for (let i = minYear; i <= maxYear; i++) {
1364
+ const isYearDisabled = isYearCompletelyDisabled(i);
1365
+ years.push({
1366
+ label: i.toString(),
1367
+ value: i,
1368
+ disabled: isYearDisabled
1369
+ });
1370
+ }
1371
+ return years;
1372
+ };
1373
+ const isYearCompletelyDisabled = (year) => {
1374
+ const firstDayOfYear = new Date(year, 0, 1);
1375
+ const lastDayOfYear = new Date(year, 11, 31);
1376
+ if (minDate) {
1377
+ const minDateTime = new Date(minDate);
1378
+ minDateTime.setHours(0, 0, 0, 0);
1379
+ if (minDateTime > lastDayOfYear) {
1380
+ return true;
1381
+ }
1382
+ }
1383
+ if (maxDate) {
1384
+ const maxDateTime = new Date(maxDate);
1385
+ maxDateTime.setHours(0, 0, 0, 0);
1386
+ if (maxDateTime < firstDayOfYear) {
1387
+ return true;
1388
+ }
1389
+ }
1390
+ if (disablePastDates) {
1391
+ const today2 = /* @__PURE__ */ new Date();
1392
+ today2.setHours(0, 0, 0, 0);
1393
+ if (lastDayOfYear < today2) {
1394
+ return true;
1395
+ }
1396
+ }
1397
+ return false;
1398
+ };
1399
+ const yearOptions = generateYearOptions();
1400
+ const generateCalendarDays = (monthDate) => {
1401
+ const year = monthDate.getFullYear();
1402
+ const month = monthDate.getMonth();
1403
+ const firstDay = new Date(year, month, 1);
1404
+ const lastDay = new Date(year, month + 1, 0);
1405
+ const daysInMonth = lastDay.getDate();
1406
+ const startingDayOfWeek = firstDay.getDay();
1407
+ const days = [];
1408
+ for (let i = 0; i < startingDayOfWeek; i++) {
1409
+ days.push(null);
1410
+ }
1411
+ for (let day = 1; day <= daysInMonth; day++) {
1412
+ days.push(new Date(year, month, day));
1413
+ }
1414
+ return days;
1415
+ };
1416
+ const formatDateKey = (date) => {
1417
+ if (!date) return "";
1418
+ return `${date.getFullYear()}-${date.getMonth()}-${date.getDate()}`;
1419
+ };
1420
+ const isSameDate = (date1, date2) => {
1421
+ if (!date1 || !date2) return false;
1422
+ return formatDateKey(date1) === formatDateKey(date2);
1423
+ };
1424
+ const isDateDisabled = (date) => {
1425
+ if (!date) return false;
1426
+ const checkDate = new Date(date);
1427
+ checkDate.setHours(0, 0, 0, 0);
1428
+ if (disablePastDates && checkDate < today) {
1429
+ return true;
1430
+ }
1431
+ if (minDate) {
1432
+ const minDateTime = new Date(minDate);
1433
+ minDateTime.setHours(0, 0, 0, 0);
1434
+ if (checkDate < minDateTime) {
1435
+ return true;
1436
+ }
1437
+ }
1438
+ if (maxDate) {
1439
+ const maxDateTime = new Date(maxDate);
1440
+ maxDateTime.setHours(0, 0, 0, 0);
1441
+ if (checkDate > maxDateTime) {
1442
+ return true;
1443
+ }
1444
+ }
1445
+ return false;
1446
+ };
1447
+ const isDateInRange = (date) => {
1448
+ if (!isRange || !startDate || !date) return false;
1449
+ const compareDate = endDate || hoverDate;
1450
+ if (!compareDate) return false;
1451
+ const start = startDate < compareDate ? startDate : compareDate;
1452
+ const end = startDate < compareDate ? compareDate : startDate;
1453
+ return date >= start && date <= end;
1454
+ };
1455
+ const isDateBetweenRange = (date) => {
1456
+ if (!isRange || !startDate || !date) return false;
1457
+ const compareDate = endDate || hoverDate;
1458
+ if (!compareDate) return false;
1459
+ const start = startDate < compareDate ? startDate : compareDate;
1460
+ const end = startDate < compareDate ? compareDate : startDate;
1461
+ return date > start && date < end;
1462
+ };
1463
+ const handleDateClick = (date) => {
1464
+ if (isDateDisabled(date)) return;
1465
+ if (!isRange) {
1466
+ setSelectedDate(date);
1467
+ return;
1468
+ }
1469
+ const isCheckinCheckoutSame = (0, import_dayjs.default)(date).format("D MMM, YYYY") === (0, import_dayjs.default)(startDate).format("D MMM, YYYY");
1470
+ if (showNightCount && isCheckinCheckoutSame) {
1471
+ setStartDate(null);
1472
+ setEndDate(null);
1473
+ setIsSelectingEnd(false);
1474
+ setHoverDate(null);
1475
+ showToastError("Check-in and check-out dates cannot be the same.");
1476
+ return;
1477
+ }
1478
+ if (!startDate || startDate && endDate) {
1479
+ setStartDate(date);
1480
+ setEndDate(null);
1481
+ setIsSelectingEnd(true);
1482
+ setHoverDate(null);
1483
+ } else if (startDate && !endDate) {
1484
+ if (date < startDate) {
1485
+ setEndDate(startDate);
1486
+ setStartDate(date);
1487
+ } else {
1488
+ setEndDate(date);
1489
+ }
1490
+ setIsSelectingEnd(false);
1491
+ setHoverDate(null);
1492
+ }
1493
+ };
1494
+ (0, import_react2.useEffect)(() => {
1495
+ if (isRange) {
1496
+ sessionStorage.removeItem("rangePickerStartDate");
1497
+ onChangeRef.current(null, [
1498
+ startDate ? (0, import_dayjs.default)(startDate).format("D MMM, YYYY") : "",
1499
+ endDate ? (0, import_dayjs.default)(endDate).format("D MMM, YYYY") : ""
1500
+ ]);
1501
+ }
1502
+ if (isRange && startDate && !endDate) {
1503
+ sessionStorage.setItem(
1504
+ "rangePickerStartDate",
1505
+ (0, import_dayjs.default)(startDate).format("D MMM, YYYY")
1506
+ );
1507
+ }
1508
+ }, [startDate, endDate, isRange]);
1509
+ (0, import_react2.useEffect)(() => {
1510
+ if (!isRange && selectedDate) {
1511
+ onChangeRef.current(null, (0, import_dayjs.default)(selectedDate).format("D MMM, YYYY"));
1512
+ }
1513
+ }, [selectedDate, isRange]);
1514
+ const handleDateHover = (date) => {
1515
+ if (isDateDisabled(date) || !isRange) return;
1516
+ if (isSelectingEnd && startDate && !endDate) {
1517
+ setHoverDate(date);
1518
+ }
1519
+ };
1520
+ const navigateMonth = (direction) => {
1521
+ const newDate = new Date(currentDate);
1522
+ newDate.setMonth(currentDate.getMonth() + direction);
1523
+ setCurrentDate(newDate);
1524
+ };
1525
+ const isPreviousMonthDisabled = () => {
1526
+ const previousMonth = new Date(currentDate);
1527
+ previousMonth.setMonth(currentDate.getMonth() - 1);
1528
+ const lastDayOfPreviousMonth = new Date(
1529
+ previousMonth.getFullYear(),
1530
+ previousMonth.getMonth() + 1,
1531
+ 0
1532
+ );
1533
+ return isDateDisabled(lastDayOfPreviousMonth);
1534
+ };
1535
+ const isNextMonthDisabled = () => {
1536
+ const nextMonth = new Date(currentDate);
1537
+ nextMonth.setMonth(currentDate.getMonth() + 1);
1538
+ const firstDayOfNextMonth = new Date(
1539
+ nextMonth.getFullYear(),
1540
+ nextMonth.getMonth(),
1541
+ 1
1542
+ );
1543
+ return isDateDisabled(firstDayOfNextMonth);
1544
+ };
1545
+ const handleYearChange = (selectedYear) => {
1546
+ const newDate = new Date(currentDate);
1547
+ newDate.setFullYear(selectedYear);
1548
+ const targetMonth = newDate.getMonth();
1549
+ if (!isMonthDisabled(selectedYear, targetMonth)) {
1550
+ setCurrentDate(newDate);
1551
+ } else {
1552
+ const firstAvailableMonth = findFirstAvailableMonth(selectedYear);
1553
+ if (firstAvailableMonth !== -1) {
1554
+ newDate.setMonth(firstAvailableMonth);
1555
+ setCurrentDate(newDate);
1556
+ }
1557
+ }
1558
+ };
1559
+ const isMonthDisabled = (year, month) => {
1560
+ const lastDayOfMonth = new Date(year, month + 1, 0);
1561
+ const firstDayOfMonth = new Date(year, month, 1);
1562
+ return isDateDisabled(lastDayOfMonth) && isDateDisabled(firstDayOfMonth);
1563
+ };
1564
+ const findFirstAvailableMonth = (year) => {
1565
+ for (let month = 0; month < 12; month++) {
1566
+ if (!isMonthDisabled(year, month)) {
1567
+ return month;
1568
+ }
1569
+ }
1570
+ return -1;
1571
+ };
1572
+ 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"));
1573
+ const NightCountTooltip = () => {
1574
+ const TooltipArrow = (0, import_react2.memo)(() => {
1575
+ return /* @__PURE__ */ (0, import_jsx_runtime13.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_runtime13.jsx)(
1576
+ "div",
1577
+ {
1578
+ style: {
1579
+ borderTop: "5px solid transparent",
1580
+ borderBottom: "5px solid transparent",
1581
+ borderLeft: "8px solid black"
1582
+ }
1583
+ }
1584
+ ) });
1585
+ });
1586
+ return /* @__PURE__ */ (0, import_jsx_runtime13.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: [
1587
+ nightCountText,
1588
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "tw-absolute tw-right-[42%] tw-bottom-[-7px]", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(TooltipArrow, {}) })
1589
+ ] });
1590
+ };
1591
+ const renderCalendar = (monthDate, isSecondCalendar = false) => {
1592
+ const days = generateCalendarDays(monthDate);
1593
+ const monthName = monthNames[monthDate.getMonth()];
1594
+ const year = monthDate.getFullYear();
1595
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
1596
+ "div",
1597
+ {
1598
+ className: (0, import_clsx9.default)("tw-flex-1 tw-max-w-[83vw] tw-mb-2", {
1599
+ "tw-h-[320px]": showYearDropdown || days.length > 35,
1600
+ "tw-h-[290px]": !showYearDropdown || days.length <= 35
1601
+ }),
1602
+ children: [
1603
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "tw-text-center tw-mb-4 sm:tw-mt-0", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: " tw-flex tw-justify-center tw-items-center tw-gap-4 ", children: [
1604
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("h3", { className: "tw-typography-footNoteBold tw-text-color-text-default tw-m-0", children: [
1605
+ monthName,
1606
+ " ",
1607
+ !showYearDropdown && ` ${year}`
1608
+ ] }),
1609
+ showYearDropdown && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1610
+ Select_default,
1611
+ {
1612
+ options: yearOptions,
1613
+ value: currentDate.getFullYear(),
1614
+ valueSelected: currentDate.getFullYear(),
1615
+ onChange: (selectedYear) => {
1616
+ if (typeof selectedYear === "number") {
1617
+ handleYearChange(selectedYear);
1618
+ }
1619
+ },
1620
+ className: "tw-min-w-fit tw-bg-transparent tw-typography-footNoteBold tw-text-color-text-default",
1621
+ size: "small",
1622
+ variant: "filled",
1623
+ style: { width: "80px" },
1624
+ id: `${id}-year-select`,
1625
+ allowClear: false,
1626
+ enableSearch: false,
1627
+ experience
1628
+ }
1629
+ )
1630
+ ] }) }),
1631
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "tw-grid tw-grid-cols-7 tw-mb-2", children: dayNames.map((day) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1632
+ "div",
1633
+ {
1634
+ className: "tw-py-2 tw-px-0 tw-text-center tw-typography-caption2 tw-text-[#6B7280]",
1635
+ children: day
1636
+ },
1637
+ day
1638
+ )) }),
1639
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "tw-grid tw-grid-cols-7", children: days.map((date, index) => {
1640
+ if (!date) {
1641
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "tw-h-10" }, index);
1642
+ }
1643
+ const isStart = isRange ? isSameDate(date, startDate) : false;
1644
+ const isEnd = isRange ? isSameDate(date, endDate) : false;
1645
+ const isSelected = !isRange ? isSameDate(date, selectedDate) : false;
1646
+ const isInRange = isRange ? isDateBetweenRange(date) : false;
1647
+ const isHovering = isRange && isSelectingEnd && hoverDate && isDateInRange(date) && !isStart && !isEnd;
1648
+ const isDisabled = isDateDisabled(date);
1649
+ let className = "tw-relative tw-z-20 tw-h-10 tw-w-10 tw-flex tw-items-center tw-justify-center tw-typography-caption1Bold ";
1650
+ const isFirstInRow = index % 7 === 0;
1651
+ const isLastInRow = index % 7 === 6;
1652
+ let pseudoClass = "";
1653
+ if (isDisabled) {
1654
+ className += "tw-text-gray-300 tw-cursor-not-allowed ";
1655
+ } else {
1656
+ className += "tw-cursor-pointer ";
1657
+ if (isStart || isEnd || isSelected) {
1658
+ className += "tw-bg-black tw-z-[21] tw-text-white tw-font-medium tw-rounded-full ";
1659
+ } else if (isInRange) {
1660
+ className += "tw-text-gray-900";
1661
+ if (window.innerWidth < 640) {
1662
+ className = className.replace(
1663
+ "tw-w-10",
1664
+ "tw-pr-2 tw-w-[50px] sm:tw-w-10 sm:tw-pr-0"
1665
+ );
1666
+ }
1667
+ pseudoClass = (0, import_clsx9.default)(RangePicker_module_default.range_start, RangePicker_module_default.range_end);
1668
+ } else {
1669
+ className += "tw-text-gray-700 hover:tw-border-2 hover:tw-border-black tw-rounded-full hover:tw-border-solid ";
1670
+ }
1671
+ if (isHovering) {
1672
+ className += "tw-border-2 tw-border-gray-400 tw-bg-white tw-z-[22]";
1673
+ }
1674
+ }
1675
+ const titleDate = (0, import_dayjs.default)(date).format("YYYY-MM-DD");
1676
+ const hoverDateFormatted = (0, import_dayjs.default)(hoverDate || null).format(
1677
+ "YYYY-MM-DD"
1678
+ );
1679
+ const isHoveringDate = (0, import_dayjs.default)(hoverDateFormatted).isSame(
1680
+ (0, import_dayjs.default)(date),
1681
+ "day"
1682
+ );
1683
+ const isHoverDateGreater = (0, import_dayjs.default)(hoverDate).isAfter(
1684
+ (0, import_dayjs.default)(startDate),
1685
+ "day"
1686
+ );
1687
+ const isHoverDateLess = (0, import_dayjs.default)(hoverDate).isBefore(
1688
+ (0, import_dayjs.default)(startDate),
1689
+ "day"
1690
+ );
1691
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "tw-relative", children: [
1692
+ (isStart || isEnd) && startDate && endDate && !isSameDay && isRange && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1693
+ "div",
1694
+ {
1695
+ className: (0, import_clsx9.default)(
1696
+ "tw-w-9 tw-h-8 tw-bg-[#F2EFEC] tw-rotate-90 tw-absolute tw-z-10 tw-top-1",
1697
+ {
1698
+ "tw-left-5": isStart,
1699
+ "tw-right-5": isEnd,
1700
+ "tw-invisible": isFirstInRow && isEnd || isLastInRow && isStart
1701
+ }
1702
+ )
1703
+ }
1704
+ ),
1705
+ isHoveringDate && isHovering && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
1706
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1707
+ "div",
1708
+ {
1709
+ className: (0, import_clsx9.default)(
1710
+ "tw-w-9 tw-h-8 tw-bg-[#F2EFEC] tw-rotate-90 tw-absolute tw-z-10 tw-top-1",
1711
+ {
1712
+ "tw-right-5": isHoverDateGreater,
1713
+ "tw-left-5": isHoverDateLess,
1714
+ "tw-invisible": isFirstInRow && isHoverDateGreater || isLastInRow && isHoverDateLess
1715
+ }
1716
+ )
1717
+ }
1718
+ ),
1719
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1720
+ "div",
1721
+ {
1722
+ className: (0, import_clsx9.default)(
1723
+ "tw-w-[18px] tw-h-[40px] tw-bg-white tw-rounded-r-full tw-absolute tw-z-20",
1724
+ {
1725
+ "tw-left-5": isHoverDateLess,
1726
+ "tw-right-5 tw-rotate-180": isHoverDateGreater
1727
+ }
1728
+ )
1729
+ }
1730
+ )
1731
+ ] }),
1732
+ isStart && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
1733
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1734
+ "div",
1735
+ {
1736
+ className: (0, import_clsx9.default)(
1737
+ "tw-w-9 tw-h-8 tw-bg-[#F2EFEC] tw-rotate-90 tw-absolute tw-z-10 tw-top-1",
1738
+ {
1739
+ "tw-right-5": isHoverDateLess,
1740
+ "tw-left-5": isHoverDateGreater,
1741
+ "tw-invisible": isLastInRow
1742
+ }
1743
+ )
1744
+ }
1745
+ ),
1746
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1747
+ "div",
1748
+ {
1749
+ className: (0, import_clsx9.default)(
1750
+ "tw-w-[18px] tw-h-[40px] tw-bg-white tw-rounded-r-full tw-absolute tw-z-20",
1751
+ {
1752
+ "tw-left-5": isHoverDateGreater,
1753
+ "tw-right-5 tw-rotate-180": isHoverDateLess
1754
+ }
1755
+ )
1756
+ }
1757
+ )
1758
+ ] }),
1759
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
1760
+ "div",
1761
+ {
1762
+ className: (0, import_clsx9.default)(className, pseudoClass, "tw-group", {
1763
+ "tw-border-2 !tw-border-black tw-rounded-full tw-border-solid": (0, import_dayjs.default)(date).isSame((0, import_dayjs.default)(hoverDate), "day")
1764
+ }),
1765
+ onClick: () => handleDateClick(date),
1766
+ onMouseEnter: () => handleDateHover(date),
1767
+ "data-date": titleDate,
1768
+ children: [
1769
+ showNightCount && isRange && isHovering && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(NightCountTooltip, {}),
1770
+ date.getDate()
1771
+ ]
1772
+ }
1773
+ )
1774
+ ] }, formatDateKey(date));
1775
+ }) })
1776
+ ]
1777
+ }
1778
+ );
1779
+ };
1780
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
1781
+ "div",
1782
+ {
1783
+ className: (0, import_clsx9.default)(
1784
+ "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",
1785
+ {
1786
+ "sm:tw-w-[640px]": !showSingleCalendar,
1787
+ "sm:tw-w-[330px]": showSingleCalendar
1788
+ }
1789
+ ),
1790
+ children: [
1791
+ /* @__PURE__ */ (0, import_jsx_runtime13.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: [
1792
+ !isPreviousMonthDisabled() && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1793
+ "div",
1794
+ {
1795
+ className: "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",
1796
+ onClick: () => navigateMonth(-1),
1797
+ id: "calendar-previous-month-button",
1798
+ children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Chevron, { size: "medium" })
1799
+ }
1800
+ ),
1801
+ isPreviousMonthDisabled() && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "tw-w-10 tw-h-10" }),
1802
+ !isNextMonthDisabled() && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1803
+ "div",
1804
+ {
1805
+ className: "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",
1806
+ onClick: () => navigateMonth(1),
1807
+ id: "calendar-next-month-button",
1808
+ children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1809
+ Chevron,
1810
+ {
1811
+ size: "medium",
1812
+ onClick: () => navigateMonth(1),
1813
+ className: "tw-rotate-180"
1814
+ }
1815
+ )
1816
+ }
1817
+ ),
1818
+ isNextMonthDisabled() && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "tw-w-10 tw-h-10" })
1819
+ ] }),
1820
+ /* @__PURE__ */ (0, import_jsx_runtime13.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_runtime13.jsxs)(
1821
+ "div",
1822
+ {
1823
+ className: (0, import_clsx9.default)("tw-flex tw-w-full", {
1824
+ "tw-flex-col sm:tw-space-x-8 sm:tw-flex-row": isRange || !showSingleCalendar,
1825
+ "tw-justify-center": !isRange || showSingleCalendar,
1826
+ "tw-pt-4": showYearDropdown,
1827
+ // More space when year dropdown is visible
1828
+ "tw-pt-6": !showYearDropdown
1829
+ }),
1830
+ children: [
1831
+ renderCalendar(firstMonth),
1832
+ !showSingleCalendar && renderCalendar(secondMonth, true)
1833
+ ]
1834
+ }
1835
+ ) }),
1836
+ footer
1837
+ ]
1838
+ }
1839
+ );
1840
+ }
1841
+ CustomRangePicker.displayName = "RangePicker";
1842
+ var RangePicker_default = CustomRangePicker;
586
1843
  // Annotate the CommonJS export names for ESM import in node:
587
1844
  0 && (module.exports = {
588
1845
  Avatar,
@@ -590,6 +1847,8 @@ var Tag_default = Tag;
590
1847
  Checkbox,
591
1848
  Modal,
592
1849
  Radio,
1850
+ RangePicker,
1851
+ Select,
593
1852
  Switch,
594
1853
  Tag,
595
1854
  Tooltip