@seekho/ui 0.1.33 → 0.1.34

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,15 +1,18 @@
1
1
  'use strict';
2
2
 
3
- var React8 = require('react');
3
+ var React10 = require('react');
4
4
  var jsxRuntime = require('react/jsx-runtime');
5
+ var ReactDOM = require('react-dom');
5
6
  var reactHotkeysHook = require('react-hotkeys-hook');
6
- var reactDom = require('react-dom');
7
7
 
8
8
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
9
9
 
10
- var React8__default = /*#__PURE__*/_interopDefault(React8);
10
+ var React10__default = /*#__PURE__*/_interopDefault(React10);
11
+ var ReactDOM__default = /*#__PURE__*/_interopDefault(ReactDOM);
11
12
 
12
13
  var __defProp = Object.defineProperty;
14
+ var __defProps = Object.defineProperties;
15
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
13
16
  var __getOwnPropSymbols = Object.getOwnPropertySymbols;
14
17
  var __hasOwnProp = Object.prototype.hasOwnProperty;
15
18
  var __propIsEnum = Object.prototype.propertyIsEnumerable;
@@ -25,6 +28,7 @@ var __spreadValues = (a, b) => {
25
28
  }
26
29
  return a;
27
30
  };
31
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
28
32
  var __objRest = (source, exclude) => {
29
33
  var target = {};
30
34
  for (var prop in source)
@@ -37,9 +41,9 @@ var __objRest = (source, exclude) => {
37
41
  }
38
42
  return target;
39
43
  };
40
- var AccordionContext = React8.createContext(null);
44
+ var AccordionContext = React10.createContext(null);
41
45
  var useAccordion = () => {
42
- const ctx = React8.useContext(AccordionContext);
46
+ const ctx = React10.useContext(AccordionContext);
43
47
  if (!ctx)
44
48
  throw new Error(
45
49
  "AccordionSummary / AccordionDetails must be used inside <Accordion>"
@@ -55,7 +59,7 @@ var Accordion = ({
55
59
  variant = "outlined",
56
60
  className
57
61
  }) => {
58
- const [internalExpanded, setInternalExpanded] = React8.useState(defaultExpanded);
62
+ const [internalExpanded, setInternalExpanded] = React10.useState(defaultExpanded);
59
63
  const isControlled = controlledExpanded !== void 0;
60
64
  const isExpanded = isControlled ? controlledExpanded : internalExpanded;
61
65
  const handleToggle = () => {
@@ -157,6 +161,62 @@ var AccordionDetails = ({
157
161
  }
158
162
  );
159
163
  };
164
+ var typeMap = {
165
+ success: "bg-green-100 text-green-500",
166
+ error: "bg-red-100 text-red-500",
167
+ warning: "bg-orange-100 text-orange-500",
168
+ default: "bg-gray-100 text-gray-500"
169
+ };
170
+ var Chip = ({
171
+ label,
172
+ type = "default",
173
+ style,
174
+ deleteIcon,
175
+ disabled = false,
176
+ className = "",
177
+ onClick,
178
+ onDelete
179
+ }) => {
180
+ var _a;
181
+ const typeClass = (_a = typeMap[type]) != null ? _a : typeMap.default;
182
+ const cursorClass = disabled ? "opacity-50 cursor-not-allowed" : onClick ? "cursor-pointer" : "cursor-default";
183
+ return /* @__PURE__ */ jsxRuntime.jsxs(
184
+ "div",
185
+ {
186
+ role: onClick ? "button" : void 0,
187
+ tabIndex: onClick && !disabled ? 0 : void 0,
188
+ style,
189
+ onClick: !disabled && onClick ? onClick : void 0,
190
+ className: `inline-flex items-center gap-1 rounded-full w-fit px-3 py-[6px] text-[12px] capitalize ${typeClass} ${cursorClass} ${className}`,
191
+ children: [
192
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "leading-none", children: label }),
193
+ onDelete && /* @__PURE__ */ jsxRuntime.jsx(
194
+ "span",
195
+ {
196
+ role: "button",
197
+ tabIndex: disabled ? -1 : 0,
198
+ onClick: (e) => {
199
+ e.stopPropagation();
200
+ if (!disabled) onDelete(e);
201
+ },
202
+ className: "flex items-center cursor-pointer ml-0.5 opacity-60 hover:opacity-100",
203
+ children: deleteIcon != null ? deleteIcon : /* @__PURE__ */ jsxRuntime.jsx(
204
+ "svg",
205
+ {
206
+ xmlns: "http://www.w3.org/2000/svg",
207
+ width: "16",
208
+ height: "16",
209
+ viewBox: "0 0 24 24",
210
+ fill: "currentColor",
211
+ children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z" })
212
+ }
213
+ )
214
+ }
215
+ )
216
+ ]
217
+ }
218
+ );
219
+ };
160
220
  function AutoComplete({
161
221
  label,
162
222
  value,
@@ -171,14 +231,14 @@ function AutoComplete({
171
231
  onChange,
172
232
  onInputChange
173
233
  }) {
174
- const inputId = React8.useId();
175
- const containerRef = React8.useRef(null);
176
- const listRef = React8.useRef(null);
177
- const [open, setOpen] = React8.useState(false);
178
- const [inputValue, setInputValue] = React8.useState(
234
+ const inputId = React10.useId();
235
+ const containerRef = React10.useRef(null);
236
+ const listRef = React10.useRef(null);
237
+ const [open, setOpen] = React10.useState(false);
238
+ const [inputValue, setInputValue] = React10.useState(
179
239
  value ? getOptionLabel(value) : ""
180
240
  );
181
- const [highlightedIndex, setHighlightedIndex] = React8.useState(-1);
241
+ const [highlightedIndex, setHighlightedIndex] = React10.useState(-1);
182
242
  const filteredOptions = options.filter(
183
243
  (option) => getOptionLabel(option).toLowerCase().includes(inputValue.toLowerCase())
184
244
  );
@@ -217,10 +277,10 @@ function AutoComplete({
217
277
  if (!value) return false;
218
278
  return isOptionEqualToValue ? isOptionEqualToValue(option, value) : getOptionLabel(option) === getOptionLabel(value);
219
279
  };
220
- React8.useEffect(() => {
280
+ React10.useEffect(() => {
221
281
  setInputValue(value ? getOptionLabel(value) : "");
222
282
  }, [value]);
223
- React8.useEffect(() => {
283
+ React10.useEffect(() => {
224
284
  const handleClickOutside = (e) => {
225
285
  if (containerRef.current && !containerRef.current.contains(e.target)) {
226
286
  setOpen(false);
@@ -397,7 +457,7 @@ function AutoComplete({
397
457
  isSelected({ option }) ? "font-semibold" : ""
398
458
  ].join(" ")
399
459
  };
400
- return renderOption ? /* @__PURE__ */ jsxRuntime.jsx(React8__default.default.Fragment, { children: renderOption(optionProps, option) }, idx) : /* @__PURE__ */ jsxRuntime.jsx(
460
+ return renderOption ? /* @__PURE__ */ jsxRuntime.jsx(React10__default.default.Fragment, { children: renderOption(optionProps, option) }, idx) : /* @__PURE__ */ jsxRuntime.jsx(
401
461
  "li",
402
462
  {
403
463
  onMouseDown: () => handleSelect({ option }),
@@ -640,7 +700,7 @@ var CustomAnchor = ({
640
700
  }
641
701
  );
642
702
  };
643
- var CustomInput = React8__default.default.forwardRef(
703
+ var CustomInput = React10__default.default.forwardRef(
644
704
  (_a, ref) => {
645
705
  var _b = _a, { label: _label, error, className, type } = _b, props = __objRest(_b, ["label", "error", "className", "type"]);
646
706
  return /* @__PURE__ */ jsxRuntime.jsx(
@@ -681,13 +741,13 @@ var Drawer = ({
681
741
  className,
682
742
  onClose
683
743
  }) => {
684
- React8.useEffect(() => {
744
+ React10.useEffect(() => {
685
745
  document.body.style.overflow = open ? "hidden" : "";
686
746
  return () => {
687
747
  document.body.style.overflow = "";
688
748
  };
689
749
  }, [open]);
690
- React8.useEffect(() => {
750
+ React10.useEffect(() => {
691
751
  const handleKeyDown = (e) => {
692
752
  if (e.key === "Escape" && open) onClose();
693
753
  };
@@ -820,6 +880,123 @@ var FilterDrawer = ({
820
880
  }
821
881
  );
822
882
  };
883
+ var GAP = 4;
884
+ var PAD = 6;
885
+ function reposition(menu, anchorEl, align) {
886
+ const rect = anchorEl.getBoundingClientRect();
887
+ const mw = menu.offsetWidth;
888
+ const mh = menu.offsetHeight;
889
+ const vw = window.innerWidth;
890
+ const vh = window.innerHeight;
891
+ let top = rect.bottom + GAP + mh > vh - PAD ? Math.max(PAD, rect.top - mh - GAP) : rect.bottom + GAP;
892
+ let left = align === "right" ? rect.right - mw : rect.left;
893
+ left = Math.max(PAD, Math.min(left, vw - mw - PAD));
894
+ menu.style.top = `${top}px`;
895
+ menu.style.left = `${left}px`;
896
+ menu.style.minWidth = `${rect.width}px`;
897
+ menu.style.opacity = "1";
898
+ }
899
+ var Menu = ({
900
+ anchorEl,
901
+ open,
902
+ onClose,
903
+ children,
904
+ align = "left",
905
+ className = ""
906
+ }) => {
907
+ const menuRef = React10.useRef(null);
908
+ const onCloseRef = React10.useRef(onClose);
909
+ React10.useEffect(() => {
910
+ onCloseRef.current = onClose;
911
+ });
912
+ React10.useEffect(() => {
913
+ if (!open || !anchorEl) return;
914
+ const id = requestAnimationFrame(() => {
915
+ if (menuRef.current) reposition(menuRef.current, anchorEl, align);
916
+ });
917
+ return () => cancelAnimationFrame(id);
918
+ }, [open, anchorEl, align]);
919
+ React10.useEffect(() => {
920
+ if (!open || !anchorEl) return;
921
+ const update = () => {
922
+ if (menuRef.current) reposition(menuRef.current, anchorEl, align);
923
+ };
924
+ window.addEventListener("scroll", update, true);
925
+ window.addEventListener("resize", update);
926
+ return () => {
927
+ window.removeEventListener("scroll", update, true);
928
+ window.removeEventListener("resize", update);
929
+ };
930
+ }, [open, anchorEl, align]);
931
+ React10.useEffect(() => {
932
+ if (!open) return;
933
+ const handleKey = (e) => {
934
+ if (e.key === "Escape") onCloseRef.current();
935
+ };
936
+ document.addEventListener("keydown", handleKey);
937
+ return () => document.removeEventListener("keydown", handleKey);
938
+ }, [open]);
939
+ React10.useEffect(() => {
940
+ if (!open) return;
941
+ const handleMouseDown = (e) => {
942
+ var _a;
943
+ if ((anchorEl == null ? void 0 : anchorEl.contains(e.target)) || ((_a = menuRef.current) == null ? void 0 : _a.contains(e.target)))
944
+ return;
945
+ onCloseRef.current();
946
+ };
947
+ document.addEventListener("mousedown", handleMouseDown);
948
+ return () => document.removeEventListener("mousedown", handleMouseDown);
949
+ }, [open, anchorEl]);
950
+ if (!open) return null;
951
+ return ReactDOM__default.default.createPortal(
952
+ /* @__PURE__ */ jsxRuntime.jsx(
953
+ "div",
954
+ {
955
+ ref: menuRef,
956
+ role: "menu",
957
+ style: {
958
+ position: "fixed",
959
+ top: -9999,
960
+ left: -9999,
961
+ opacity: 0,
962
+ zIndex: 9999,
963
+ transition: "opacity 100ms ease"
964
+ },
965
+ className: `bg-white rounded shadow-lg border border-gray-100 py-1 max-w-[calc(100vw-12px)] ${className}`,
966
+ children
967
+ }
968
+ ),
969
+ document.body
970
+ );
971
+ };
972
+ var MenuItem = ({
973
+ onClick,
974
+ children,
975
+ disabled = false,
976
+ selected = false,
977
+ icon,
978
+ className = ""
979
+ }) => {
980
+ return /* @__PURE__ */ jsxRuntime.jsxs(
981
+ "div",
982
+ {
983
+ role: "menuitem",
984
+ "aria-disabled": disabled,
985
+ onClick: disabled ? void 0 : onClick,
986
+ className: [
987
+ "px-3 py-2 flex gap-x-3 items-center text-[14px] tracking-wide min-w-0 w-full",
988
+ disabled ? "opacity-40 cursor-not-allowed" : "cursor-pointer hover:bg-gray-50",
989
+ selected ? "bg-gray-100 font-medium" : "",
990
+ className
991
+ ].filter(Boolean).join(" "),
992
+ children: [
993
+ icon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex items-center shrink-0", children: icon }),
994
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "min-w-0 break-words", children })
995
+ ]
996
+ }
997
+ );
998
+ };
999
+ var MenuDivider = () => /* @__PURE__ */ jsxRuntime.jsx("hr", { className: "my-1 border-gray-100" });
823
1000
 
824
1001
  // src/utils/modalStack.ts
825
1002
  var stack = [];
@@ -847,8 +1024,8 @@ function Modal({
847
1024
  handleConfirmation,
848
1025
  handleConfirmationBtnText = "Confirm"
849
1026
  }) {
850
- const modalId = React8.useId();
851
- React8.useEffect(() => {
1027
+ const modalId = React10.useId();
1028
+ React10.useEffect(() => {
852
1029
  if (show) handlePushModal({ id: modalId });
853
1030
  return () => handlePopModal({ id: modalId });
854
1031
  }, [show, modalId]);
@@ -1082,9 +1259,9 @@ var MonthYearPicker = ({
1082
1259
  triggerClassName,
1083
1260
  dropdownClassName
1084
1261
  }) => {
1085
- const [isOpen, setIsOpen] = React8.useState(false);
1086
- const [pickerYear, setPickerYear] = React8.useState(year);
1087
- const ref = React8.useRef(null);
1262
+ const [isOpen, setIsOpen] = React10.useState(false);
1263
+ const [pickerYear, setPickerYear] = React10.useState(year);
1264
+ const ref = React10.useRef(null);
1088
1265
  const now = /* @__PURE__ */ new Date();
1089
1266
  const currentMonth = now.getMonth() + 1;
1090
1267
  const currentYear = now.getFullYear();
@@ -1117,10 +1294,10 @@ var MonthYearPicker = ({
1117
1294
  if (maxDate && pickerYear >= maxDate.year) return true;
1118
1295
  return false;
1119
1296
  };
1120
- React8.useEffect(() => {
1297
+ React10.useEffect(() => {
1121
1298
  setPickerYear(year);
1122
1299
  }, [year]);
1123
- React8.useEffect(() => {
1300
+ React10.useEffect(() => {
1124
1301
  const handleClickOutside = (e) => {
1125
1302
  if (ref.current && !ref.current.contains(e.target)) {
1126
1303
  setIsOpen(false);
@@ -1695,6 +1872,228 @@ var StagingAlert = ({
1695
1872
  ] })
1696
1873
  ] });
1697
1874
  };
1875
+ var sizeStyles = {
1876
+ small: { padding: "4px 10px", fontSize: "13px" },
1877
+ medium: { padding: "7px 14px", fontSize: "16px" },
1878
+ large: { padding: "10px 16px", fontSize: "16px" }
1879
+ };
1880
+ var Select = ({
1881
+ value,
1882
+ onChange,
1883
+ children,
1884
+ disabled = false,
1885
+ placeholder = "Select...",
1886
+ size = "medium",
1887
+ error = false,
1888
+ className = ""
1889
+ }) => {
1890
+ const [isOpen, setIsOpen] = React10.useState(false);
1891
+ const [dropdownStyle, setDropdownStyle] = React10.useState({});
1892
+ const [focusedIndex, setFocusedIndex] = React10.useState(-1);
1893
+ const triggerRef = React10.useRef(null);
1894
+ const dropdownRef = React10.useRef(null);
1895
+ const options = React10__default.default.Children.toArray(children).filter(Boolean).map((child) => {
1896
+ var _a, _b, _c, _d, _e;
1897
+ const c = child;
1898
+ return {
1899
+ value: (_b = (_a = c.props) == null ? void 0 : _a.value) != null ? _b : "",
1900
+ label: (_c = c.props) == null ? void 0 : _c.children,
1901
+ disabled: (_e = (_d = c.props) == null ? void 0 : _d.disabled) != null ? _e : false
1902
+ };
1903
+ });
1904
+ const selectedOption = options.find(
1905
+ (opt) => String(opt.value) === String(value)
1906
+ );
1907
+ const computePosition = React10.useCallback(() => {
1908
+ if (!triggerRef.current) return;
1909
+ const rect = triggerRef.current.getBoundingClientRect();
1910
+ const dropdownHeight = Math.min(options.length * 40, 240);
1911
+ const spaceBelow = window.innerHeight - rect.bottom;
1912
+ const openAbove = spaceBelow < dropdownHeight + 8 && rect.top > dropdownHeight;
1913
+ setDropdownStyle(__spreadProps(__spreadValues({
1914
+ position: "fixed"
1915
+ }, openAbove ? { bottom: window.innerHeight - rect.top + 2 } : { top: rect.bottom + 2 }), {
1916
+ left: rect.left,
1917
+ width: rect.width,
1918
+ zIndex: 9999
1919
+ }));
1920
+ }, [options.length]);
1921
+ React10.useEffect(() => {
1922
+ const handleClickOutside = (e) => {
1923
+ if (triggerRef.current && !triggerRef.current.contains(e.target) && (!dropdownRef.current || !dropdownRef.current.contains(e.target))) {
1924
+ setIsOpen(false);
1925
+ setFocusedIndex(-1);
1926
+ }
1927
+ };
1928
+ document.addEventListener("mousedown", handleClickOutside);
1929
+ return () => document.removeEventListener("mousedown", handleClickOutside);
1930
+ }, []);
1931
+ React10.useEffect(() => {
1932
+ if (!isOpen) return;
1933
+ const handleKeyDown = (e) => {
1934
+ if (e.key === "Escape") {
1935
+ setIsOpen(false);
1936
+ setFocusedIndex(-1);
1937
+ } else if (e.key === "ArrowDown") {
1938
+ e.preventDefault();
1939
+ setFocusedIndex((prev) => {
1940
+ var _a;
1941
+ let next = prev + 1;
1942
+ while (next < options.length && ((_a = options[next]) == null ? void 0 : _a.disabled)) next++;
1943
+ return next < options.length ? next : prev;
1944
+ });
1945
+ } else if (e.key === "ArrowUp") {
1946
+ e.preventDefault();
1947
+ setFocusedIndex((prev) => {
1948
+ var _a;
1949
+ let next = prev - 1;
1950
+ while (next >= 0 && ((_a = options[next]) == null ? void 0 : _a.disabled)) next--;
1951
+ return next >= 0 ? next : prev;
1952
+ });
1953
+ } else if (e.key === "Enter" && focusedIndex >= 0) {
1954
+ const opt = options[focusedIndex];
1955
+ if (opt && !opt.disabled) {
1956
+ onChange({ target: { value: opt.value } });
1957
+ setIsOpen(false);
1958
+ setFocusedIndex(-1);
1959
+ }
1960
+ }
1961
+ };
1962
+ document.addEventListener("keydown", handleKeyDown);
1963
+ return () => document.removeEventListener("keydown", handleKeyDown);
1964
+ }, [isOpen, focusedIndex, options, onChange]);
1965
+ React10.useEffect(() => {
1966
+ if (focusedIndex >= 0 && dropdownRef.current) {
1967
+ const item = dropdownRef.current.children[focusedIndex];
1968
+ item == null ? void 0 : item.scrollIntoView({ block: "nearest" });
1969
+ }
1970
+ }, [focusedIndex]);
1971
+ React10.useEffect(() => {
1972
+ if (!isOpen) return;
1973
+ window.addEventListener("scroll", computePosition, true);
1974
+ window.addEventListener("resize", computePosition);
1975
+ return () => {
1976
+ window.removeEventListener("scroll", computePosition, true);
1977
+ window.removeEventListener("resize", computePosition);
1978
+ };
1979
+ }, [isOpen, computePosition]);
1980
+ const handleOpen = () => {
1981
+ if (disabled) return;
1982
+ if (!isOpen) {
1983
+ computePosition();
1984
+ setFocusedIndex(
1985
+ options.findIndex((opt) => String(opt.value) === String(value))
1986
+ );
1987
+ }
1988
+ setIsOpen((prev) => !prev);
1989
+ };
1990
+ const handleSelect = (opt) => {
1991
+ if (opt.disabled) return;
1992
+ onChange({ target: { value: opt.value } });
1993
+ setIsOpen(false);
1994
+ setFocusedIndex(-1);
1995
+ };
1996
+ const borderColor = error ? "#ef4444" : isOpen ? "#534f8f" : "rgba(0,0,0,0.23)";
1997
+ const { padding, fontSize } = sizeStyles[size];
1998
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `relative ${className}`, ref: triggerRef, children: [
1999
+ /* @__PURE__ */ jsxRuntime.jsxs(
2000
+ "button",
2001
+ {
2002
+ type: "button",
2003
+ disabled,
2004
+ onClick: handleOpen,
2005
+ className: "w-full flex items-center justify-between rounded-md bg-white text-left outline-none disabled:opacity-50 disabled:cursor-not-allowed",
2006
+ style: { padding, border: `1px solid ${borderColor}`, transition: "border-color 0.15s ease" },
2007
+ children: [
2008
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate flex-1", style: { fontSize }, children: selectedOption ? selectedOption.label : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-gray-400", children: placeholder }) }),
2009
+ /* @__PURE__ */ jsxRuntime.jsx(
2010
+ "svg",
2011
+ {
2012
+ xmlns: "http://www.w3.org/2000/svg",
2013
+ width: "18",
2014
+ height: "18",
2015
+ viewBox: "0 0 24 24",
2016
+ fill: "currentColor",
2017
+ className: `shrink-0 ml-2 text-gray-400 transition-transform duration-150 ${isOpen ? "rotate-180" : ""}`,
2018
+ children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M7.41 8.59L12 13.17l4.59-4.58L18 10l-6 6-6-6 1.41-1.41z" })
2019
+ }
2020
+ )
2021
+ ]
2022
+ }
2023
+ ),
2024
+ isOpen && ReactDOM__default.default.createPortal(
2025
+ /* @__PURE__ */ jsxRuntime.jsx(
2026
+ "ul",
2027
+ {
2028
+ ref: dropdownRef,
2029
+ style: dropdownStyle,
2030
+ className: "bg-white shadow-lg rounded-md border border-gray-200 max-h-60 overflow-y-auto",
2031
+ children: options.map((opt, i) => /* @__PURE__ */ jsxRuntime.jsx(
2032
+ "li",
2033
+ {
2034
+ onClick: () => handleSelect(opt),
2035
+ className: `px-4 py-2 text-[14px] ${opt.disabled ? "text-gray-400 cursor-not-allowed" : String(opt.value) === String(value) ? "bg-purple-100 text-[#534f8f] font-medium cursor-pointer" : focusedIndex === i ? "bg-gray-100 text-gray-800 cursor-pointer" : "text-gray-800 hover:bg-gray-50 cursor-pointer"}`,
2036
+ children: opt.label
2037
+ },
2038
+ i
2039
+ ))
2040
+ }
2041
+ ),
2042
+ document.body
2043
+ )
2044
+ ] });
2045
+ };
2046
+
2047
+ // src/components/Select/SelectOption.tsx
2048
+ var SelectOption = (_props) => null;
2049
+ var Switch = ({
2050
+ checked,
2051
+ onChange,
2052
+ disabled = false,
2053
+ className = ""
2054
+ }) => {
2055
+ return /* @__PURE__ */ jsxRuntime.jsxs(
2056
+ "button",
2057
+ {
2058
+ type: "button",
2059
+ role: "switch",
2060
+ "aria-checked": checked,
2061
+ disabled,
2062
+ onClick: disabled ? void 0 : onChange,
2063
+ className: `relative inline-flex shrink-0 border-0 bg-transparent p-0 focus:outline-none ${disabled ? "opacity-40 cursor-not-allowed" : "cursor-pointer"} ${className}`,
2064
+ style: { width: 58, height: 38 },
2065
+ children: [
2066
+ /* @__PURE__ */ jsxRuntime.jsx(
2067
+ "span",
2068
+ {
2069
+ className: "absolute rounded-full transition-colors duration-200",
2070
+ style: {
2071
+ width: 34,
2072
+ height: 14,
2073
+ top: 12,
2074
+ left: 12,
2075
+ backgroundColor: checked ? "rgba(83,79,143,0.5)" : "rgba(0,0,0,0.38)"
2076
+ }
2077
+ }
2078
+ ),
2079
+ /* @__PURE__ */ jsxRuntime.jsx(
2080
+ "span",
2081
+ {
2082
+ className: "absolute rounded-full transition-all duration-200",
2083
+ style: {
2084
+ width: 20,
2085
+ height: 20,
2086
+ top: 9,
2087
+ left: checked ? 29 : 9,
2088
+ backgroundColor: checked ? "#534f8f" : "#fafafa",
2089
+ boxShadow: "0px 2px 1px -1px rgba(0,0,0,0.2), 0px 1px 1px 0px rgba(0,0,0,0.14), 0px 1px 3px 0px rgba(0,0,0,0.12)"
2090
+ }
2091
+ }
2092
+ )
2093
+ ]
2094
+ }
2095
+ );
2096
+ };
1698
2097
  var SCROLL_STEP = 120;
1699
2098
  function Tabs({
1700
2099
  value,
@@ -1707,12 +2106,12 @@ function Tabs({
1707
2106
  className,
1708
2107
  "aria-label": ariaLabel
1709
2108
  }) {
1710
- const listRef = React8.useRef(null);
1711
- const [canScrollLeft, setCanScrollLeft] = React8.useState(false);
1712
- const [canScrollRight, setCanScrollRight] = React8.useState(false);
1713
- const tabRefs = React8.useRef([]);
1714
- const tabs = React8.Children.toArray(children).filter(
1715
- React8.isValidElement
2109
+ const listRef = React10.useRef(null);
2110
+ const [canScrollLeft, setCanScrollLeft] = React10.useState(false);
2111
+ const [canScrollRight, setCanScrollRight] = React10.useState(false);
2112
+ const tabRefs = React10.useRef([]);
2113
+ const tabs = React10.Children.toArray(children).filter(
2114
+ React10.isValidElement
1716
2115
  );
1717
2116
  function resolveIndex(val) {
1718
2117
  var _a;
@@ -1723,13 +2122,13 @@ function Tabs({
1723
2122
  return -1;
1724
2123
  }
1725
2124
  const selectedIndex = resolveIndex(value);
1726
- const updateScrollState = React8.useCallback(() => {
2125
+ const updateScrollState = React10.useCallback(() => {
1727
2126
  const el = listRef.current;
1728
2127
  if (!el) return;
1729
2128
  setCanScrollLeft(el.scrollLeft > 0);
1730
2129
  setCanScrollRight(el.scrollLeft + el.clientWidth < el.scrollWidth - 1);
1731
2130
  }, []);
1732
- React8.useEffect(() => {
2131
+ React10.useEffect(() => {
1733
2132
  const el = listRef.current;
1734
2133
  if (!el) return;
1735
2134
  updateScrollState();
@@ -1741,7 +2140,7 @@ function Tabs({
1741
2140
  ro.disconnect();
1742
2141
  };
1743
2142
  }, [updateScrollState]);
1744
- React8.useEffect(() => {
2143
+ React10.useEffect(() => {
1745
2144
  const el = tabRefs.current[selectedIndex];
1746
2145
  el == null ? void 0 : el.scrollIntoView({
1747
2146
  block: "nearest",
@@ -1796,7 +2195,7 @@ function Tabs({
1796
2195
  var _a;
1797
2196
  const tabValue = (_a = tab.props.value) != null ? _a : i;
1798
2197
  const selected = tabValue === value;
1799
- return React8.cloneElement(tab, {
2198
+ return React10.cloneElement(tab, {
1800
2199
  key: i,
1801
2200
  selected,
1802
2201
  onChange: (e) => {
@@ -1869,7 +2268,7 @@ function Tab({
1869
2268
  }
1870
2269
  );
1871
2270
  }
1872
- var GAP = 8;
2271
+ var GAP2 = 8;
1873
2272
  var VIEWPORT_PADDING = 6;
1874
2273
  var arrowClass = {
1875
2274
  top: "top-full left-1/2 -translate-x-1/2 border-t-gray-600/80 border-x-transparent border-b-transparent",
@@ -1882,18 +2281,18 @@ function getPosition(trigger, tooltip, placement) {
1882
2281
  const th = tooltip.offsetHeight;
1883
2282
  const { top, left, right, bottom, width, height } = trigger;
1884
2283
  const positions = {
1885
- top: { top: top - th - GAP, left: left + width / 2 - tw / 2 },
1886
- "top-start": { top: top - th - GAP, left },
1887
- "top-end": { top: top - th - GAP, left: right - tw },
1888
- bottom: { top: bottom + GAP, left: left + width / 2 - tw / 2 },
1889
- "bottom-start": { top: bottom + GAP, left },
1890
- "bottom-end": { top: bottom + GAP, left: right - tw },
1891
- left: { top: top + height / 2 - th / 2, left: left - tw - GAP },
1892
- "left-start": { top, left: left - tw - GAP },
1893
- "left-end": { top: bottom - th, left: left - tw - GAP },
1894
- right: { top: top + height / 2 - th / 2, left: right + GAP },
1895
- "right-start": { top, left: right + GAP },
1896
- "right-end": { top: bottom - th, left: right + GAP }
2284
+ top: { top: top - th - GAP2, left: left + width / 2 - tw / 2 },
2285
+ "top-start": { top: top - th - GAP2, left },
2286
+ "top-end": { top: top - th - GAP2, left: right - tw },
2287
+ bottom: { top: bottom + GAP2, left: left + width / 2 - tw / 2 },
2288
+ "bottom-start": { top: bottom + GAP2, left },
2289
+ "bottom-end": { top: bottom + GAP2, left: right - tw },
2290
+ left: { top: top + height / 2 - th / 2, left: left - tw - GAP2 },
2291
+ "left-start": { top, left: left - tw - GAP2 },
2292
+ "left-end": { top: bottom - th, left: left - tw - GAP2 },
2293
+ right: { top: top + height / 2 - th / 2, left: right + GAP2 },
2294
+ "right-start": { top, left: right + GAP2 },
2295
+ "right-end": { top: bottom - th, left: right + GAP2 }
1897
2296
  };
1898
2297
  const pos = positions[placement];
1899
2298
  pos.left = Math.max(
@@ -1917,14 +2316,14 @@ function Tooltip({
1917
2316
  className,
1918
2317
  disabled = false
1919
2318
  }) {
1920
- const [visible, setVisible] = React8.useState(false);
1921
- const triggerRef = React8.useRef(null);
1922
- const tooltipRef = React8.useRef(null);
1923
- const enterTimer = React8.useRef(null);
1924
- const leaveTimer = React8.useRef(null);
2319
+ const [visible, setVisible] = React10.useState(false);
2320
+ const triggerRef = React10.useRef(null);
2321
+ const tooltipRef = React10.useRef(null);
2322
+ const enterTimer = React10.useRef(null);
2323
+ const leaveTimer = React10.useRef(null);
1925
2324
  const isControlled = controlledOpen !== void 0;
1926
2325
  const show = isControlled ? controlledOpen : visible;
1927
- const positionAndShow = React8.useCallback(() => {
2326
+ const positionAndShow = React10.useCallback(() => {
1928
2327
  const tooltip = tooltipRef.current;
1929
2328
  const trigger2 = triggerRef.current;
1930
2329
  if (!tooltip || !trigger2) return;
@@ -1937,7 +2336,7 @@ function Tooltip({
1937
2336
  tooltip.style.left = `${pos.left}px`;
1938
2337
  tooltip.style.opacity = "1";
1939
2338
  }, [placement]);
1940
- React8.useEffect(() => {
2339
+ React10.useEffect(() => {
1941
2340
  if (!show) {
1942
2341
  const tooltip = tooltipRef.current;
1943
2342
  if (tooltip) tooltip.style.opacity = "0";
@@ -1956,15 +2355,15 @@ function Tooltip({
1956
2355
  if (enterTimer.current) clearTimeout(enterTimer.current);
1957
2356
  leaveTimer.current = setTimeout(() => setVisible(false), leaveDelay);
1958
2357
  };
1959
- React8.useEffect(() => {
2358
+ React10.useEffect(() => {
1960
2359
  return () => {
1961
2360
  if (enterTimer.current) clearTimeout(enterTimer.current);
1962
2361
  if (leaveTimer.current) clearTimeout(leaveTimer.current);
1963
2362
  };
1964
2363
  }, []);
1965
- if (!React8__default.default.isValidElement(children)) return children;
2364
+ if (!React10__default.default.isValidElement(children)) return children;
1966
2365
  const side = placement.split("-")[0];
1967
- const trigger = React8__default.default.cloneElement(
2366
+ const trigger = React10__default.default.cloneElement(
1968
2367
  children,
1969
2368
  {
1970
2369
  ref: triggerRef,
@@ -1992,7 +2391,7 @@ function Tooltip({
1992
2391
  );
1993
2392
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1994
2393
  trigger,
1995
- reactDom.createPortal(
2394
+ ReactDOM.createPortal(
1996
2395
  title ? /* @__PURE__ */ jsxRuntime.jsxs(
1997
2396
  "div",
1998
2397
  {
@@ -2028,7 +2427,7 @@ function Tooltip({
2028
2427
  ] });
2029
2428
  }
2030
2429
  function useLocalStorage(key, initialValue) {
2031
- const [storedValue, setStoredValue] = React8.useState(() => {
2430
+ const [storedValue, setStoredValue] = React10.useState(() => {
2032
2431
  if (typeof window === "undefined") return initialValue;
2033
2432
  try {
2034
2433
  const item = window.localStorage.getItem(key);
@@ -2067,18 +2466,25 @@ exports.AccordionSummary = AccordionSummary;
2067
2466
  exports.AutoComplete = AutoComplete;
2068
2467
  exports.Breadcrumb = Breadcrumb;
2069
2468
  exports.ButtonLoader = ButtonLoader;
2469
+ exports.Chip = Chip;
2070
2470
  exports.CopyId = CopyId;
2071
2471
  exports.CustomAnchor = CustomAnchor;
2072
2472
  exports.CustomInput = CustomInput;
2073
2473
  exports.Drawer = Drawer;
2074
2474
  exports.FilterDrawer = FilterDrawer;
2075
2475
  exports.InputTitleWithRequired = InputTitleWithRequired;
2476
+ exports.Menu = Menu;
2477
+ exports.MenuDivider = MenuDivider;
2478
+ exports.MenuItem = MenuItem;
2076
2479
  exports.Modal = Modal;
2077
2480
  exports.MonthYearPicker = MonthYearPicker;
2078
2481
  exports.Pagination = Pagination;
2079
2482
  exports.ReadMore = ReadMore;
2080
2483
  exports.SearchBar = SearchBar;
2484
+ exports.Select = Select;
2485
+ exports.SelectOption = SelectOption;
2081
2486
  exports.StagingAlert = StagingAlert;
2487
+ exports.Switch = Switch;
2082
2488
  exports.Tab = Tab;
2083
2489
  exports.Tabs = Tabs;
2084
2490
  exports.Tooltip = Tooltip;