@dmsi/wedgekit-react 0.0.50 → 0.0.52

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 (34) hide show
  1. package/dist/{chunk-VC3R5EUH.js → chunk-6R2HCLEL.js} +2 -2
  2. package/dist/{chunk-VKMJ63WV.js → chunk-ATOEGP3V.js} +3 -3
  3. package/dist/{chunk-Z4UCFUF7.js → chunk-B6PDZCU7.js} +7 -3
  4. package/dist/{chunk-T22EH3MG.js → chunk-FOC6LTSX.js} +1 -1
  5. package/dist/chunk-SWA5WVQO.js +49 -0
  6. package/dist/components/DataGrid.cjs +83 -85
  7. package/dist/components/DataGrid.js +5 -5
  8. package/dist/components/DataGridCell.cjs +51 -53
  9. package/dist/components/DataGridCell.js +5 -5
  10. package/dist/components/Menu.cjs +21 -27
  11. package/dist/components/Menu.js +3 -3
  12. package/dist/components/MenuOption.cjs +14 -20
  13. package/dist/components/MenuOption.js +2 -2
  14. package/dist/components/Modal.cjs +22 -28
  15. package/dist/components/Modal.js +1 -1
  16. package/dist/components/NestedMenu.cjs +40 -49
  17. package/dist/components/NestedMenu.js +4 -33
  18. package/dist/components/ProjectBar.cjs +10 -16
  19. package/dist/components/ProjectBar.js +1 -1
  20. package/dist/components/useMenuSystem.cjs +29 -31
  21. package/dist/components/useMenuSystem.js +2 -2
  22. package/dist/hooks/index.cjs +77 -0
  23. package/dist/{components/useMatchesMedia.js → hooks/index.js} +3 -1
  24. package/package.json +6 -1
  25. package/src/components/Menu.tsx +1 -1
  26. package/src/components/MenuOption.tsx +11 -10
  27. package/src/components/Modal.tsx +1 -1
  28. package/src/components/ProjectBar.tsx +1 -1
  29. package/src/components/useMenuSystem.tsx +23 -12
  30. package/src/hooks/index.ts +1 -0
  31. package/src/hooks/useMatchesMedia.ts +18 -0
  32. package/dist/chunk-SEKKGFM6.js +0 -28
  33. package/dist/components/useMatchesMedia.cjs +0 -53
  34. package/src/components/useMatchesMedia.tsx +0 -28
@@ -118,7 +118,7 @@ var CSS = /* @__PURE__ */ Object.freeze({
118
118
 
119
119
  // src/components/DataGridCell.tsx
120
120
  var import_clsx8 = __toESM(require("clsx"), 1);
121
- var import_react8 = require("react");
121
+ var import_react9 = require("react");
122
122
 
123
123
  // src/classNames.ts
124
124
  var import_clsx = __toESM(require("clsx"), 1);
@@ -855,47 +855,43 @@ Search.displayName = "Search";
855
855
 
856
856
  // src/components/Menu.tsx
857
857
  var import_clsx5 = __toESM(require("clsx"), 1);
858
- var import_react6 = require("react");
858
+ var import_react7 = require("react");
859
859
  var import_react_dom = require("react-dom");
860
860
 
861
861
  // src/components/useMenuSystem.tsx
862
- var import_react5 = require("react");
862
+ var import_react6 = require("react");
863
863
 
864
- // src/components/useMatchesMedia.tsx
864
+ // src/hooks/useKeydown.ts
865
865
  var import_react4 = require("react");
866
+
867
+ // src/hooks/useMatchesMedia.ts
868
+ var import_react5 = require("react");
866
869
  var useMatchesMedia = (query) => {
867
- const [matches, setMatches] = (0, import_react4.useState)(
868
- () => typeof window !== "undefined" ? window.matchMedia(query).matches : false
869
- );
870
- (0, import_react4.useLayoutEffect)(() => {
870
+ const [matches, setMatches] = (0, import_react5.useState)();
871
+ (0, import_react5.useLayoutEffect)(() => {
871
872
  const mediaQueryList = window.matchMedia(query);
872
- const listener = (event) => {
873
- setMatches(event.matches);
874
- };
873
+ const listener = () => setMatches(mediaQueryList.matches);
874
+ listener();
875
875
  mediaQueryList.addEventListener("change", listener);
876
- setMatches(mediaQueryList.matches);
877
- return () => {
878
- mediaQueryList.removeEventListener("change", listener);
879
- };
876
+ return () => mediaQueryList.removeEventListener("change", listener);
880
877
  }, [query]);
881
878
  return matches;
882
879
  };
883
- var useMatchesMobile = () => {
884
- const isMobile = useMatchesMedia("(width < 48rem)");
885
- return isMobile;
886
- };
880
+ var useMatchesMobile = () => useMatchesMedia("(width < 48rem)");
887
881
 
888
882
  // src/components/useMenuSystem.tsx
889
883
  function useSubMenuSystem(mobilePositionTo) {
890
- const [activeMenus, setActiveMenus] = (0, import_react5.useState)(
884
+ const [activeMenus, setActiveMenus] = (0, import_react6.useState)(
891
885
  {}
892
886
  );
893
- const [activeMenu, setActiveMenu] = (0, import_react5.useState)("");
894
- const [currentSubMenuLevel, setCurrentSubMenuLevel] = (0, import_react5.useState)(null);
895
- const menuRootRef = (0, import_react5.useRef)(null);
896
- const subMenuRefs = (0, import_react5.useRef)({});
897
- const hoverTimeoutRef = (0, import_react5.useRef)(null);
898
- const closeTimeoutRef = (0, import_react5.useRef)(null);
887
+ const [activeMenu, setActiveMenu] = (0, import_react6.useState)("");
888
+ const [currentSubMenuLevel, setCurrentSubMenuLevel] = (0, import_react6.useState)(
889
+ null
890
+ );
891
+ const menuRootRef = (0, import_react6.useRef)(null);
892
+ const subMenuRefs = (0, import_react6.useRef)({});
893
+ const hoverTimeoutRef = (0, import_react6.useRef)(null);
894
+ const closeTimeoutRef = (0, import_react6.useRef)(null);
899
895
  const isMobile = useMatchesMobile();
900
896
  const toggleMenu = (menuId, level) => {
901
897
  if (closeTimeoutRef.current) {
@@ -993,7 +989,7 @@ function useSubMenuSystem(mobilePositionTo) {
993
989
  const isMenuActive = (menuId, level) => {
994
990
  return activeMenus[level] === menuId;
995
991
  };
996
- (0, import_react5.useEffect)(() => {
992
+ (0, import_react6.useEffect)(() => {
997
993
  const handleClickOutside = (event) => {
998
994
  var _a;
999
995
  if (Object.keys(activeMenus).length === 0) return;
@@ -1012,7 +1008,7 @@ function useSubMenuSystem(mobilePositionTo) {
1012
1008
  document.removeEventListener("mousedown", handleClickOutside);
1013
1009
  };
1014
1010
  }, [activeMenus]);
1015
- (0, import_react5.useEffect)(() => {
1011
+ (0, import_react6.useEffect)(() => {
1016
1012
  return () => {
1017
1013
  if (hoverTimeoutRef.current) {
1018
1014
  clearTimeout(hoverTimeoutRef.current);
@@ -1025,7 +1021,9 @@ function useSubMenuSystem(mobilePositionTo) {
1025
1021
  const getAllFocusableMenuElements = () => {
1026
1022
  const elements = [];
1027
1023
  if (menuRootRef.current) {
1028
- elements.push(...Array.from(menuRootRef.current.children));
1024
+ elements.push(
1025
+ ...Array.from(menuRootRef.current.children)
1026
+ );
1029
1027
  }
1030
1028
  Object.values(activeMenus).forEach((menuId) => {
1031
1029
  const submenuEl = subMenuRefs.current[menuId];
@@ -1087,13 +1085,13 @@ function useSubMenuSystem(mobilePositionTo) {
1087
1085
  };
1088
1086
  }
1089
1087
  function useMenuPosition(elementRef, position = "bottom", options) {
1090
- const [menuPosition, setMenuPosition] = (0, import_react5.useState)({
1088
+ const [menuPosition, setMenuPosition] = (0, import_react6.useState)({
1091
1089
  top: 0,
1092
1090
  left: 0,
1093
1091
  minWidth: 0
1094
1092
  });
1095
1093
  const isMobile = useMatchesMobile();
1096
- const updatePosition = (0, import_react5.useCallback)(() => {
1094
+ const updatePosition = (0, import_react6.useCallback)(() => {
1097
1095
  var _a, _b, _c, _d, _e, _f, _g, _h, _i;
1098
1096
  if (!(elementRef == null ? void 0 : elementRef.current)) return;
1099
1097
  const triggerRect = elementRef.current.getBoundingClientRect();
@@ -1129,7 +1127,7 @@ function useMenuPosition(elementRef, position = "bottom", options) {
1129
1127
  minWidth: triggerRect.width
1130
1128
  });
1131
1129
  }, [elementRef, position, options == null ? void 0 : options.menuRef, options == null ? void 0 : options.topOffset, isMobile]);
1132
- (0, import_react5.useEffect)(() => {
1130
+ (0, import_react6.useEffect)(() => {
1133
1131
  if (!(options == null ? void 0 : options.isOpen) || !(options == null ? void 0 : options.setIsOpen)) return;
1134
1132
  const handleClickOutside = (event) => {
1135
1133
  var _a, _b, _c, _d, _e;
@@ -1155,7 +1153,7 @@ function useMenuPosition(elementRef, position = "bottom", options) {
1155
1153
  options == null ? void 0 : options.menuRef,
1156
1154
  options == null ? void 0 : options.additionalRefs
1157
1155
  ]);
1158
- (0, import_react5.useEffect)(() => {
1156
+ (0, import_react6.useEffect)(() => {
1159
1157
  updatePosition();
1160
1158
  const resizeObserver = new ResizeObserver(updatePosition);
1161
1159
  if (elementRef == null ? void 0 : elementRef.current) {
@@ -1233,9 +1231,9 @@ var Menu = (_a) => {
1233
1231
  "autoFocusOff",
1234
1232
  "menuName"
1235
1233
  ]);
1236
- const internalRef = (0, import_react6.useRef)(null);
1234
+ const internalRef = (0, import_react7.useRef)(null);
1237
1235
  const actualRef = ref || internalRef;
1238
- const [maxHeight, setMaxHeight] = (0, import_react6.useState)("180px");
1236
+ const [maxHeight, setMaxHeight] = (0, import_react7.useState)("180px");
1239
1237
  const isMobile = useMatchesMobile();
1240
1238
  const { menuPosition, updatePosition } = useMenuPosition(
1241
1239
  isMobile && mobilePositionTo ? mobilePositionTo : positionTo,
@@ -1247,7 +1245,7 @@ var Menu = (_a) => {
1247
1245
  topOffset
1248
1246
  }
1249
1247
  );
1250
- (0, import_react6.useEffect)(() => {
1248
+ (0, import_react7.useEffect)(() => {
1251
1249
  const raf = requestAnimationFrame(() => {
1252
1250
  if (!actualRef || !actualRef.current || customMaxHeight) {
1253
1251
  return;
@@ -1268,14 +1266,14 @@ var Menu = (_a) => {
1268
1266
  cancelAnimationFrame(raf);
1269
1267
  };
1270
1268
  }, [actualRef, customMaxHeight]);
1271
- (0, import_react6.useEffect)(() => {
1269
+ (0, import_react7.useEffect)(() => {
1272
1270
  if (!show) {
1273
1271
  return;
1274
1272
  }
1275
1273
  initializeMenuFocus();
1276
1274
  updatePosition();
1277
1275
  }, [show, updatePosition]);
1278
- (0, import_react6.useEffect)(() => {
1276
+ (0, import_react7.useEffect)(() => {
1279
1277
  if (!show || !setShow) {
1280
1278
  return;
1281
1279
  }
@@ -1428,7 +1426,7 @@ Menu.displayName = "Menu";
1428
1426
 
1429
1427
  // src/components/MenuOption.tsx
1430
1428
  var import_clsx7 = __toESM(require("clsx"), 1);
1431
- var import_react7 = require("react");
1429
+ var import_react8 = require("react");
1432
1430
 
1433
1431
  // src/components/Paragraph.tsx
1434
1432
  var import_clsx6 = __toESM(require("clsx"), 1);
@@ -1506,10 +1504,10 @@ var MenuOption = ({
1506
1504
  highlightMatchingText = false,
1507
1505
  menuValue
1508
1506
  }) => {
1509
- const uniqueId = (0, import_react7.useId)();
1510
- const internalRef = (0, import_react7.useRef)(null);
1507
+ const uniqueId = (0, import_react8.useId)();
1508
+ const internalRef = (0, import_react8.useRef)(null);
1511
1509
  const actualRef = ref || internalRef;
1512
- const menuId = (0, import_react7.useRef)(`menu-${uniqueId}`);
1510
+ const menuId = (0, import_react8.useRef)(`menu-${uniqueId}`);
1513
1511
  const isMobile = useMatchesMobile();
1514
1512
  const handleMouseEnter = () => {
1515
1513
  if (subMenu && onSubMenuHover && !disabled) {
@@ -1652,7 +1650,7 @@ function highlightMatch(text, searchValue) {
1652
1650
 
1653
1651
  // src/components/DataGridCell.tsx
1654
1652
  var import_jsx_runtime8 = require("react/jsx-runtime");
1655
- var DataGridCell = (0, import_react8.memo)(
1653
+ var DataGridCell = (0, import_react9.memo)(
1656
1654
  (_a) => {
1657
1655
  var _b = _a, {
1658
1656
  id,
@@ -1688,10 +1686,10 @@ var DataGridCell = (0, import_react8.memo)(
1688
1686
  "width"
1689
1687
  ]);
1690
1688
  const Element = type === "header" ? "th" : "td";
1691
- const timerRef = (0, import_react8.useRef)(null);
1692
- const [isGrabbing, setIsGrabbing] = (0, import_react8.useState)(false);
1693
- const [isPointerPressed, setIsPointerPressed] = (0, import_react8.useState)(false);
1694
- (0, import_react8.useEffect)(() => {
1689
+ const timerRef = (0, import_react9.useRef)(null);
1690
+ const [isGrabbing, setIsGrabbing] = (0, import_react9.useState)(false);
1691
+ const [isPointerPressed, setIsPointerPressed] = (0, import_react9.useState)(false);
1692
+ (0, import_react9.useEffect)(() => {
1695
1693
  return () => {
1696
1694
  if (timerRef.current) {
1697
1695
  clearTimeout(timerRef.current);
@@ -1792,12 +1790,12 @@ function DataCellHeader(_a) {
1792
1790
  "id"
1793
1791
  ]);
1794
1792
  var _a2;
1795
- const [showMenu, setShowMenu] = (0, import_react8.useState)(false);
1796
- const [filter, setFilter] = (0, import_react8.useState)(
1793
+ const [showMenu, setShowMenu] = (0, import_react9.useState)(false);
1794
+ const [filter, setFilter] = (0, import_react9.useState)(
1797
1795
  (_a2 = header.column.getFilterValue()) != null ? _a2 : ""
1798
1796
  );
1799
- const ref = (0, import_react8.useRef)(null);
1800
- const predeterminedPinned = (0, import_react8.useRef)(false);
1797
+ const ref = (0, import_react9.useRef)(null);
1798
+ const predeterminedPinned = (0, import_react9.useRef)(false);
1801
1799
  const {
1802
1800
  menuRootRef,
1803
1801
  isMenuActive,
@@ -1805,14 +1803,14 @@ function DataCellHeader(_a) {
1805
1803
  listeners: subMenuListeners,
1806
1804
  mobileHide
1807
1805
  } = useSubMenuSystem(node ? node : ref);
1808
- (0, import_react8.useEffect)(() => {
1806
+ (0, import_react9.useEffect)(() => {
1809
1807
  var _a3;
1810
1808
  const columnPinning = (_a3 = header.getContext().table.options.initialState) == null ? void 0 : _a3.columnPinning;
1811
1809
  const left = (columnPinning == null ? void 0 : columnPinning.left) ? columnPinning.left : [];
1812
1810
  const right = (columnPinning == null ? void 0 : columnPinning.right) ? columnPinning.right : [];
1813
1811
  predeterminedPinned.current = [...left, ...right].includes(header.column.id);
1814
1812
  }, []);
1815
- (0, import_react8.useEffect)(() => {
1813
+ (0, import_react9.useEffect)(() => {
1816
1814
  const handler = setTimeout(() => {
1817
1815
  header.column.setFilterValue(filter);
1818
1816
  }, 500);
@@ -4,11 +4,11 @@ import {
4
4
  DataGridCell,
5
5
  DragAlongCell,
6
6
  DraggableCellHeader
7
- } from "../chunk-VKMJ63WV.js";
8
- import "../chunk-VC3R5EUH.js";
9
- import "../chunk-Z4UCFUF7.js";
10
- import "../chunk-T22EH3MG.js";
11
- import "../chunk-SEKKGFM6.js";
7
+ } from "../chunk-ATOEGP3V.js";
8
+ import "../chunk-6R2HCLEL.js";
9
+ import "../chunk-B6PDZCU7.js";
10
+ import "../chunk-FOC6LTSX.js";
11
+ import "../chunk-SWA5WVQO.js";
12
12
  import "../chunk-LP6AZST2.js";
13
13
  import "../chunk-VG4EPHJA.js";
14
14
  import "../chunk-WVUIIBRR.js";
@@ -64,45 +64,39 @@ __export(Menu_exports, {
64
64
  });
65
65
  module.exports = __toCommonJS(Menu_exports);
66
66
  var import_clsx = __toESM(require("clsx"), 1);
67
- var import_react3 = require("react");
67
+ var import_react4 = require("react");
68
68
  var import_react_dom = require("react-dom");
69
69
 
70
70
  // src/components/useMenuSystem.tsx
71
- var import_react2 = require("react");
71
+ var import_react3 = require("react");
72
72
 
73
- // src/components/useMatchesMedia.tsx
73
+ // src/hooks/useKeydown.ts
74
74
  var import_react = require("react");
75
+
76
+ // src/hooks/useMatchesMedia.ts
77
+ var import_react2 = require("react");
75
78
  var useMatchesMedia = (query) => {
76
- const [matches, setMatches] = (0, import_react.useState)(
77
- () => typeof window !== "undefined" ? window.matchMedia(query).matches : false
78
- );
79
- (0, import_react.useLayoutEffect)(() => {
79
+ const [matches, setMatches] = (0, import_react2.useState)();
80
+ (0, import_react2.useLayoutEffect)(() => {
80
81
  const mediaQueryList = window.matchMedia(query);
81
- const listener = (event) => {
82
- setMatches(event.matches);
83
- };
82
+ const listener = () => setMatches(mediaQueryList.matches);
83
+ listener();
84
84
  mediaQueryList.addEventListener("change", listener);
85
- setMatches(mediaQueryList.matches);
86
- return () => {
87
- mediaQueryList.removeEventListener("change", listener);
88
- };
85
+ return () => mediaQueryList.removeEventListener("change", listener);
89
86
  }, [query]);
90
87
  return matches;
91
88
  };
92
- var useMatchesMobile = () => {
93
- const isMobile = useMatchesMedia("(width < 48rem)");
94
- return isMobile;
95
- };
89
+ var useMatchesMobile = () => useMatchesMedia("(width < 48rem)");
96
90
 
97
91
  // src/components/useMenuSystem.tsx
98
92
  function useMenuPosition(elementRef, position = "bottom", options) {
99
- const [menuPosition, setMenuPosition] = (0, import_react2.useState)({
93
+ const [menuPosition, setMenuPosition] = (0, import_react3.useState)({
100
94
  top: 0,
101
95
  left: 0,
102
96
  minWidth: 0
103
97
  });
104
98
  const isMobile = useMatchesMobile();
105
- const updatePosition = (0, import_react2.useCallback)(() => {
99
+ const updatePosition = (0, import_react3.useCallback)(() => {
106
100
  var _a, _b, _c, _d, _e, _f, _g, _h, _i;
107
101
  if (!(elementRef == null ? void 0 : elementRef.current)) return;
108
102
  const triggerRect = elementRef.current.getBoundingClientRect();
@@ -138,7 +132,7 @@ function useMenuPosition(elementRef, position = "bottom", options) {
138
132
  minWidth: triggerRect.width
139
133
  });
140
134
  }, [elementRef, position, options == null ? void 0 : options.menuRef, options == null ? void 0 : options.topOffset, isMobile]);
141
- (0, import_react2.useEffect)(() => {
135
+ (0, import_react3.useEffect)(() => {
142
136
  if (!(options == null ? void 0 : options.isOpen) || !(options == null ? void 0 : options.setIsOpen)) return;
143
137
  const handleClickOutside = (event) => {
144
138
  var _a, _b, _c, _d, _e;
@@ -164,7 +158,7 @@ function useMenuPosition(elementRef, position = "bottom", options) {
164
158
  options == null ? void 0 : options.menuRef,
165
159
  options == null ? void 0 : options.additionalRefs
166
160
  ]);
167
- (0, import_react2.useEffect)(() => {
161
+ (0, import_react3.useEffect)(() => {
168
162
  updatePosition();
169
163
  const resizeObserver = new ResizeObserver(updatePosition);
170
164
  if (elementRef == null ? void 0 : elementRef.current) {
@@ -242,9 +236,9 @@ var Menu = (_a) => {
242
236
  "autoFocusOff",
243
237
  "menuName"
244
238
  ]);
245
- const internalRef = (0, import_react3.useRef)(null);
239
+ const internalRef = (0, import_react4.useRef)(null);
246
240
  const actualRef = ref || internalRef;
247
- const [maxHeight, setMaxHeight] = (0, import_react3.useState)("180px");
241
+ const [maxHeight, setMaxHeight] = (0, import_react4.useState)("180px");
248
242
  const isMobile = useMatchesMobile();
249
243
  const { menuPosition, updatePosition } = useMenuPosition(
250
244
  isMobile && mobilePositionTo ? mobilePositionTo : positionTo,
@@ -256,7 +250,7 @@ var Menu = (_a) => {
256
250
  topOffset
257
251
  }
258
252
  );
259
- (0, import_react3.useEffect)(() => {
253
+ (0, import_react4.useEffect)(() => {
260
254
  const raf = requestAnimationFrame(() => {
261
255
  if (!actualRef || !actualRef.current || customMaxHeight) {
262
256
  return;
@@ -277,14 +271,14 @@ var Menu = (_a) => {
277
271
  cancelAnimationFrame(raf);
278
272
  };
279
273
  }, [actualRef, customMaxHeight]);
280
- (0, import_react3.useEffect)(() => {
274
+ (0, import_react4.useEffect)(() => {
281
275
  if (!show) {
282
276
  return;
283
277
  }
284
278
  initializeMenuFocus();
285
279
  updatePosition();
286
280
  }, [show, updatePosition]);
287
- (0, import_react3.useEffect)(() => {
281
+ (0, import_react4.useEffect)(() => {
288
282
  if (!show || !setShow) {
289
283
  return;
290
284
  }
@@ -1,9 +1,9 @@
1
1
  "use client";
2
2
  import {
3
3
  Menu
4
- } from "../chunk-VC3R5EUH.js";
5
- import "../chunk-Z4UCFUF7.js";
6
- import "../chunk-SEKKGFM6.js";
4
+ } from "../chunk-6R2HCLEL.js";
5
+ import "../chunk-B6PDZCU7.js";
6
+ import "../chunk-SWA5WVQO.js";
7
7
  import "../chunk-4T7F5BZZ.js";
8
8
  import "../chunk-ORMEWXMH.js";
9
9
  export {
@@ -64,7 +64,7 @@ __export(MenuOption_exports, {
64
64
  });
65
65
  module.exports = __toCommonJS(MenuOption_exports);
66
66
  var import_clsx5 = __toESM(require("clsx"), 1);
67
- var import_react2 = require("react");
67
+ var import_react3 = require("react");
68
68
 
69
69
  // src/classNames.ts
70
70
  var import_clsx = __toESM(require("clsx"), 1);
@@ -315,29 +315,23 @@ function Icon(_a) {
315
315
  );
316
316
  }
317
317
 
318
- // src/components/useMatchesMedia.tsx
318
+ // src/hooks/useKeydown.ts
319
319
  var import_react = require("react");
320
+
321
+ // src/hooks/useMatchesMedia.ts
322
+ var import_react2 = require("react");
320
323
  var useMatchesMedia = (query) => {
321
- const [matches, setMatches] = (0, import_react.useState)(
322
- () => typeof window !== "undefined" ? window.matchMedia(query).matches : false
323
- );
324
- (0, import_react.useLayoutEffect)(() => {
324
+ const [matches, setMatches] = (0, import_react2.useState)();
325
+ (0, import_react2.useLayoutEffect)(() => {
325
326
  const mediaQueryList = window.matchMedia(query);
326
- const listener = (event) => {
327
- setMatches(event.matches);
328
- };
327
+ const listener = () => setMatches(mediaQueryList.matches);
328
+ listener();
329
329
  mediaQueryList.addEventListener("change", listener);
330
- setMatches(mediaQueryList.matches);
331
- return () => {
332
- mediaQueryList.removeEventListener("change", listener);
333
- };
330
+ return () => mediaQueryList.removeEventListener("change", listener);
334
331
  }, [query]);
335
332
  return matches;
336
333
  };
337
- var useMatchesMobile = () => {
338
- const isMobile = useMatchesMedia("(width < 48rem)");
339
- return isMobile;
340
- };
334
+ var useMatchesMobile = () => useMatchesMedia("(width < 48rem)");
341
335
 
342
336
  // src/components/MenuOption.tsx
343
337
  var import_jsx_runtime4 = require("react/jsx-runtime");
@@ -365,10 +359,10 @@ var MenuOption = ({
365
359
  highlightMatchingText = false,
366
360
  menuValue
367
361
  }) => {
368
- const uniqueId = (0, import_react2.useId)();
369
- const internalRef = (0, import_react2.useRef)(null);
362
+ const uniqueId = (0, import_react3.useId)();
363
+ const internalRef = (0, import_react3.useRef)(null);
370
364
  const actualRef = ref || internalRef;
371
- const menuId = (0, import_react2.useRef)(`menu-${uniqueId}`);
365
+ const menuId = (0, import_react3.useRef)(`menu-${uniqueId}`);
372
366
  const isMobile = useMatchesMobile();
373
367
  const handleMouseEnter = () => {
374
368
  if (subMenu && onSubMenuHover && !disabled) {
@@ -1,8 +1,8 @@
1
1
  "use client";
2
2
  import {
3
3
  MenuOption
4
- } from "../chunk-T22EH3MG.js";
5
- import "../chunk-SEKKGFM6.js";
4
+ } from "../chunk-FOC6LTSX.js";
5
+ import "../chunk-SWA5WVQO.js";
6
6
  import "../chunk-VG4EPHJA.js";
7
7
  import "../chunk-S5K22XTH.js";
8
8
  import "../chunk-IGQVA7SC.js";
@@ -64,7 +64,7 @@ __export(Modal_exports, {
64
64
  });
65
65
  module.exports = __toCommonJS(Modal_exports);
66
66
  var import_clsx9 = __toESM(require("clsx"), 1);
67
- var import_react3 = require("react");
67
+ var import_react4 = require("react");
68
68
 
69
69
  // src/components/Heading.tsx
70
70
  var import_clsx2 = __toESM(require("clsx"), 1);
@@ -581,35 +581,29 @@ function findDocumentRoot(element) {
581
581
  // src/components/Modal.tsx
582
582
  var import_react_use = require("react-use");
583
583
 
584
- // src/components/useMatchesMedia.tsx
584
+ // src/hooks/useKeydown.ts
585
585
  var import_react = require("react");
586
+
587
+ // src/hooks/useMatchesMedia.ts
588
+ var import_react2 = require("react");
586
589
  var useMatchesMedia = (query) => {
587
- const [matches, setMatches] = (0, import_react.useState)(
588
- () => typeof window !== "undefined" ? window.matchMedia(query).matches : false
589
- );
590
- (0, import_react.useLayoutEffect)(() => {
590
+ const [matches, setMatches] = (0, import_react2.useState)();
591
+ (0, import_react2.useLayoutEffect)(() => {
591
592
  const mediaQueryList = window.matchMedia(query);
592
- const listener = (event) => {
593
- setMatches(event.matches);
594
- };
593
+ const listener = () => setMatches(mediaQueryList.matches);
594
+ listener();
595
595
  mediaQueryList.addEventListener("change", listener);
596
- setMatches(mediaQueryList.matches);
597
- return () => {
598
- mediaQueryList.removeEventListener("change", listener);
599
- };
596
+ return () => mediaQueryList.removeEventListener("change", listener);
600
597
  }, [query]);
601
598
  return matches;
602
599
  };
603
- var useMatchesMobile = () => {
604
- const isMobile = useMatchesMedia("(width < 48rem)");
605
- return isMobile;
606
- };
600
+ var useMatchesMobile = () => useMatchesMedia("(width < 48rem)");
607
601
 
608
602
  // src/components/useMounted.tsx
609
- var import_react2 = require("react");
603
+ var import_react3 = require("react");
610
604
  var useMounted = () => {
611
- const [isMounted, setIsMounted] = (0, import_react2.useState)(false);
612
- (0, import_react2.useEffect)(() => {
605
+ const [isMounted, setIsMounted] = (0, import_react3.useState)(false);
606
+ (0, import_react3.useEffect)(() => {
613
607
  setIsMounted(true);
614
608
  return () => setIsMounted(false);
615
609
  }, []);
@@ -693,12 +687,12 @@ var Modal = ({
693
687
  }) => {
694
688
  var _a;
695
689
  const mounted = useMounted();
696
- const modalRef = (0, import_react3.useRef)(null);
697
- const bgRef = (0, import_react3.useRef)(null);
690
+ const modalRef = (0, import_react4.useRef)(null);
691
+ const bgRef = (0, import_react4.useRef)(null);
698
692
  const wasOpen = (0, import_react_use.usePrevious)(open);
699
693
  const isMobile = useMatchesMobile();
700
694
  const computedFixedHeightScrolling = isMobile || fixedHeightScrolling;
701
- (0, import_react3.useEffect)(() => {
695
+ (0, import_react4.useEffect)(() => {
702
696
  if (!mounted) return;
703
697
  if (!modalRef.current || !bgRef.current) {
704
698
  console.error("Modal or background reference is not set.");
@@ -718,7 +712,7 @@ var Modal = ({
718
712
  bgFadeIn(bgRef.current);
719
713
  }
720
714
  }, [mounted, open]);
721
- const handleKeyDown = (0, import_react3.useCallback)(
715
+ const handleKeyDown = (0, import_react4.useCallback)(
722
716
  (e) => {
723
717
  if (e.key === "Escape") {
724
718
  if (onClose) {
@@ -729,12 +723,12 @@ var Modal = ({
729
723
  },
730
724
  [onClose, bgRef, modalRef]
731
725
  );
732
- const handleClose = (0, import_react3.useCallback)(() => {
726
+ const handleClose = (0, import_react4.useCallback)(() => {
733
727
  if (onClose) {
734
728
  onClose();
735
729
  }
736
730
  }, [onClose]);
737
- (0, import_react3.useEffect)(() => {
731
+ (0, import_react4.useEffect)(() => {
738
732
  if (open) {
739
733
  document.addEventListener("keyup", handleKeyDown);
740
734
  }
@@ -742,7 +736,7 @@ var Modal = ({
742
736
  document.removeEventListener("keyup", handleKeyDown);
743
737
  };
744
738
  }, [open, handleKeyDown]);
745
- (0, import_react3.useEffect)(() => {
739
+ (0, import_react4.useEffect)(() => {
746
740
  if (!open) return;
747
741
  const scrollY = window.scrollY;
748
742
  const body = document.body;
@@ -763,7 +757,7 @@ var Modal = ({
763
757
  };
764
758
  }, [open]);
765
759
  const { sizeClass } = (_a = sizes[size]) != null ? _a : sizes.small;
766
- const backgroundClickHandler = (0, import_react3.useCallback)(
760
+ const backgroundClickHandler = (0, import_react4.useCallback)(
767
761
  (e) => {
768
762
  const target = e.target;
769
763
  const currentTarget = e.currentTarget;
@@ -17,7 +17,7 @@ import {
17
17
  import "../chunk-J6LETUNM.js";
18
18
  import {
19
19
  useMatchesMobile
20
- } from "../chunk-SEKKGFM6.js";
20
+ } from "../chunk-SWA5WVQO.js";
21
21
  import {
22
22
  findDocumentRoot
23
23
  } from "../chunk-4T7F5BZZ.js";