@ariakit/core 0.4.9 → 0.4.11

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 (72) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/cjs/__chunks/{3IVNQNIV.cjs → 7EQBAZ46.cjs} +1 -2
  3. package/cjs/__chunks/{3QF3ODTR.cjs → BSLRW6E7.cjs} +15 -16
  4. package/cjs/__chunks/{H6ZQSQQL.cjs → C5P5S22J.cjs} +17 -18
  5. package/cjs/__chunks/{QLWAGBAQ.cjs → G2MFLTB2.cjs} +19 -20
  6. package/cjs/__chunks/{CCI5VM7E.cjs → G2NIRMCL.cjs} +19 -20
  7. package/cjs/__chunks/{ULSPM3Y3.cjs → GDZQUFNP.cjs} +1 -3
  8. package/cjs/__chunks/{N667HVED.cjs → I2G6EN27.cjs} +3 -4
  9. package/cjs/__chunks/LLZO7SOB.cjs +34 -0
  10. package/cjs/__chunks/LSC6QXJ7.cjs +41 -0
  11. package/cjs/__chunks/{BTUHABP4.cjs → MLCPLY2P.cjs} +3 -4
  12. package/cjs/__chunks/{7CES7GVE.cjs → SHOLYDNP.cjs} +1 -3
  13. package/cjs/__chunks/{KCEXELK7.cjs → TEPPO3KC.cjs} +7 -8
  14. package/cjs/__chunks/{PW36G76L.cjs → W3GMUKTU.cjs} +76 -99
  15. package/cjs/__chunks/{7WYII4AN.cjs → WCFMOJKV.cjs} +8 -7
  16. package/cjs/checkbox/checkbox-store.cjs +8 -9
  17. package/cjs/collection/collection-store.cjs +7 -8
  18. package/cjs/combobox/combobox-store.cjs +47 -48
  19. package/cjs/composite/composite-overflow-store.cjs +8 -9
  20. package/cjs/composite/composite-store.cjs +9 -10
  21. package/cjs/composite/composite-store.d.cts +30 -12
  22. package/cjs/composite/composite-store.d.ts +30 -12
  23. package/cjs/dialog/dialog-store.cjs +7 -8
  24. package/cjs/disclosure/disclosure-store.cjs +6 -7
  25. package/cjs/form/form-store.cjs +29 -30
  26. package/cjs/form/types.cjs +1 -1
  27. package/cjs/hovercard/hovercard-store.cjs +9 -10
  28. package/cjs/index.cjs +1 -2
  29. package/cjs/menu/menu-bar-store.cjs +10 -11
  30. package/cjs/menu/menu-store.cjs +34 -35
  31. package/cjs/menubar/menubar-store.cjs +10 -11
  32. package/cjs/popover/popover-store.cjs +8 -9
  33. package/cjs/radio/radio-store.cjs +15 -16
  34. package/cjs/select/select-store.cjs +39 -40
  35. package/cjs/tab/tab-store.cjs +45 -40
  36. package/cjs/tag/tag-store.cjs +21 -22
  37. package/cjs/toolbar/toolbar-store.cjs +11 -12
  38. package/cjs/tooltip/tooltip-store.cjs +16 -17
  39. package/cjs/utils/array.cjs +4 -5
  40. package/cjs/utils/dom.cjs +4 -5
  41. package/cjs/utils/events.cjs +9 -10
  42. package/cjs/utils/focus.cjs +13 -14
  43. package/cjs/utils/misc.cjs +4 -5
  44. package/cjs/utils/platform.cjs +5 -6
  45. package/cjs/utils/store.cjs +5 -6
  46. package/cjs/utils/types.cjs +1 -1
  47. package/cjs/utils/undo.cjs +4 -5
  48. package/esm/__chunks/{US4USQPI.js → 3VBK76MS.js} +1 -1
  49. package/esm/__chunks/{6DHTHWXD.js → 7DTP4AQO.js} +1 -1
  50. package/esm/__chunks/{D7EIQZAU.js → 7IJEP35G.js} +53 -75
  51. package/esm/__chunks/{HWOIWM4O.js → PQP5VPTV.js} +7 -4
  52. package/esm/__chunks/{PIWLWQMB.js → YKFX5MNB.js} +1 -1
  53. package/esm/collection/collection-store.js +2 -2
  54. package/esm/combobox/combobox-store.js +6 -6
  55. package/esm/composite/composite-store.d.ts +30 -12
  56. package/esm/composite/composite-store.js +3 -3
  57. package/esm/form/form-store.js +2 -2
  58. package/esm/menu/menu-bar-store.js +4 -4
  59. package/esm/menu/menu-store.js +3 -3
  60. package/esm/menubar/menubar-store.js +4 -4
  61. package/esm/radio/radio-store.js +3 -3
  62. package/esm/select/select-store.js +3 -3
  63. package/esm/tab/tab-store.js +11 -5
  64. package/esm/tag/tag-store.js +3 -3
  65. package/esm/toolbar/toolbar-store.js +3 -3
  66. package/esm/utils/dom.js +1 -1
  67. package/esm/utils/events.js +2 -2
  68. package/esm/utils/focus.js +1 -1
  69. package/esm/utils/platform.js +2 -2
  70. package/package.json +1 -1
  71. package/cjs/__chunks/VJAE2Y4T.cjs +0 -35
  72. package/cjs/__chunks/XIZWLBI2.cjs +0 -42
package/cjs/utils/dom.cjs CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
3
 
4
4
 
@@ -17,9 +17,9 @@
17
17
 
18
18
 
19
19
 
20
+ var _WCFMOJKVcjs = require('../__chunks/WCFMOJKV.cjs');
21
+ require('../__chunks/7EQBAZ46.cjs');
20
22
 
21
- var _7WYII4ANcjs = require('../__chunks/7WYII4AN.cjs');
22
- require('../__chunks/3IVNQNIV.cjs');
23
23
 
24
24
 
25
25
 
@@ -38,5 +38,4 @@ require('../__chunks/3IVNQNIV.cjs');
38
38
 
39
39
 
40
40
 
41
-
42
- exports.canUseDOM = _7WYII4ANcjs.canUseDOM; exports.contains = _7WYII4ANcjs.contains; exports.getActiveElement = _7WYII4ANcjs.getActiveElement; exports.getDocument = _7WYII4ANcjs.getDocument; exports.getPopupItemRole = _7WYII4ANcjs.getPopupItemRole; exports.getPopupRole = _7WYII4ANcjs.getPopupRole; exports.getScrollingElement = _7WYII4ANcjs.getScrollingElement; exports.getTextboxSelection = _7WYII4ANcjs.getTextboxSelection; exports.getTextboxValue = _7WYII4ANcjs.getTextboxValue; exports.getWindow = _7WYII4ANcjs.getWindow; exports.isButton = _7WYII4ANcjs.isButton; exports.isFrame = _7WYII4ANcjs.isFrame; exports.isPartiallyHidden = _7WYII4ANcjs.isPartiallyHidden; exports.isTextField = _7WYII4ANcjs.isTextField; exports.isTextbox = _7WYII4ANcjs.isTextbox; exports.isVisible = _7WYII4ANcjs.isVisible; exports.scrollIntoViewIfNeeded = _7WYII4ANcjs.scrollIntoViewIfNeeded; exports.setSelectionRange = _7WYII4ANcjs.setSelectionRange;
41
+ exports.canUseDOM = _WCFMOJKVcjs.canUseDOM; exports.contains = _WCFMOJKVcjs.contains; exports.getActiveElement = _WCFMOJKVcjs.getActiveElement; exports.getDocument = _WCFMOJKVcjs.getDocument; exports.getPopupItemRole = _WCFMOJKVcjs.getPopupItemRole; exports.getPopupRole = _WCFMOJKVcjs.getPopupRole; exports.getScrollingElement = _WCFMOJKVcjs.getScrollingElement; exports.getTextboxSelection = _WCFMOJKVcjs.getTextboxSelection; exports.getTextboxValue = _WCFMOJKVcjs.getTextboxValue; exports.getWindow = _WCFMOJKVcjs.getWindow; exports.isButton = _WCFMOJKVcjs.isButton; exports.isFrame = _WCFMOJKVcjs.isFrame; exports.isPartiallyHidden = _WCFMOJKVcjs.isPartiallyHidden; exports.isTextField = _WCFMOJKVcjs.isTextField; exports.isTextbox = _WCFMOJKVcjs.isTextbox; exports.isVisible = _WCFMOJKVcjs.isVisible; exports.scrollIntoViewIfNeeded = _WCFMOJKVcjs.scrollIntoViewIfNeeded; exports.setSelectionRange = _WCFMOJKVcjs.setSelectionRange;
@@ -1,19 +1,18 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
+ var _TEPPO3KCcjs = require('../__chunks/TEPPO3KC.cjs');
3
4
 
4
- var _KCEXELK7cjs = require('../__chunks/KCEXELK7.cjs');
5
5
 
6
+ var _WCFMOJKVcjs = require('../__chunks/WCFMOJKV.cjs');
6
7
 
7
- var _7WYII4ANcjs = require('../__chunks/7WYII4AN.cjs');
8
8
 
9
9
 
10
-
11
- var _3IVNQNIVcjs = require('../__chunks/3IVNQNIV.cjs');
10
+ var _7EQBAZ46cjs = require('../__chunks/7EQBAZ46.cjs');
12
11
 
13
12
  // src/utils/events.ts
14
13
  function isPortalEvent(event) {
15
14
  return Boolean(
16
- event.currentTarget && !_7WYII4ANcjs.contains.call(void 0, event.currentTarget, event.target)
15
+ event.currentTarget && !_WCFMOJKVcjs.contains.call(void 0, event.currentTarget, event.target)
17
16
  );
18
17
  }
19
18
  function isSelfTarget(event) {
@@ -22,7 +21,7 @@ function isSelfTarget(event) {
22
21
  function isOpeningInNewTab(event) {
23
22
  const element = event.currentTarget;
24
23
  if (!element) return false;
25
- const isAppleDevice = _KCEXELK7cjs.isApple.call(void 0, );
24
+ const isAppleDevice = _TEPPO3KCcjs.isApple.call(void 0, );
26
25
  if (isAppleDevice && !event.metaKey) return false;
27
26
  if (!isAppleDevice && !event.ctrlKey) return false;
28
27
  const tagName = element.tagName.toLowerCase();
@@ -48,14 +47,14 @@ function fireEvent(element, type, eventInit) {
48
47
  function fireBlurEvent(element, eventInit) {
49
48
  const event = new FocusEvent("blur", eventInit);
50
49
  const defaultAllowed = element.dispatchEvent(event);
51
- const bubbleInit = _3IVNQNIVcjs.__spreadProps.call(void 0, _3IVNQNIVcjs.__spreadValues.call(void 0, {}, eventInit), { bubbles: true });
50
+ const bubbleInit = _7EQBAZ46cjs.__spreadProps.call(void 0, _7EQBAZ46cjs.__spreadValues.call(void 0, {}, eventInit), { bubbles: true });
52
51
  element.dispatchEvent(new FocusEvent("focusout", bubbleInit));
53
52
  return defaultAllowed;
54
53
  }
55
54
  function fireFocusEvent(element, eventInit) {
56
55
  const event = new FocusEvent("focus", eventInit);
57
56
  const defaultAllowed = element.dispatchEvent(event);
58
- const bubbleInit = _3IVNQNIVcjs.__spreadProps.call(void 0, _3IVNQNIVcjs.__spreadValues.call(void 0, {}, eventInit), { bubbles: true });
57
+ const bubbleInit = _7EQBAZ46cjs.__spreadProps.call(void 0, _7EQBAZ46cjs.__spreadValues.call(void 0, {}, eventInit), { bubbles: true });
59
58
  element.dispatchEvent(new FocusEvent("focusin", bubbleInit));
60
59
  return defaultAllowed;
61
60
  }
@@ -70,7 +69,7 @@ function fireClickEvent(element, eventInit) {
70
69
  function isFocusEventOutside(event, container) {
71
70
  const containerElement = container || event.currentTarget;
72
71
  const relatedTarget = event.relatedTarget;
73
- return !relatedTarget || !_7WYII4ANcjs.contains.call(void 0, containerElement, relatedTarget);
72
+ return !relatedTarget || !_WCFMOJKVcjs.contains.call(void 0, containerElement, relatedTarget);
74
73
  }
75
74
  function getInputType(event) {
76
75
  const nativeEvent = "nativeEvent" in event ? event.nativeEvent : event;
@@ -1,13 +1,12 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
3
 
4
4
 
5
5
 
6
+ var _WCFMOJKVcjs = require('../__chunks/WCFMOJKV.cjs');
6
7
 
7
- var _7WYII4ANcjs = require('../__chunks/7WYII4AN.cjs');
8
8
 
9
-
10
- var _3IVNQNIVcjs = require('../__chunks/3IVNQNIV.cjs');
9
+ var _7EQBAZ46cjs = require('../__chunks/7EQBAZ46.cjs');
11
10
 
12
11
  // src/utils/focus.ts
13
12
  var selector = "input:not([type='hidden']):not([disabled]), select:not([disabled]), textarea:not([disabled]), a[href], button:not([disabled]), [tabindex], summary, iframe, object, embed, area[href], audio[controls], video[controls], [contenteditable]:not([contenteditable='false'])";
@@ -17,7 +16,7 @@ function hasNegativeTabIndex(element) {
17
16
  }
18
17
  function isFocusable(element) {
19
18
  if (!element.matches(selector)) return false;
20
- if (!_7WYII4ANcjs.isVisible.call(void 0, element)) return false;
19
+ if (!_WCFMOJKVcjs.isVisible.call(void 0, element)) return false;
21
20
  if (element.closest("[inert]")) return false;
22
21
  return true;
23
22
  }
@@ -31,7 +30,7 @@ function isTabbable(element) {
31
30
  const radioGroup = element.form.elements.namedItem(element.name);
32
31
  if (!radioGroup) return true;
33
32
  if (!("length" in radioGroup)) return true;
34
- const activeElement = _7WYII4ANcjs.getActiveElement.call(void 0, element);
33
+ const activeElement = _WCFMOJKVcjs.getActiveElement.call(void 0, element);
35
34
  if (!activeElement) return true;
36
35
  if (activeElement === element) return true;
37
36
  if (!("form" in activeElement)) return true;
@@ -48,7 +47,7 @@ function getAllFocusableIn(container, includeContainer) {
48
47
  }
49
48
  const focusableElements = elements.filter(isFocusable);
50
49
  focusableElements.forEach((element, i) => {
51
- if (_7WYII4ANcjs.isFrame.call(void 0, element) && element.contentDocument) {
50
+ if (_WCFMOJKVcjs.isFrame.call(void 0, element) && element.contentDocument) {
52
51
  const frameBody = element.contentDocument.body;
53
52
  focusableElements.splice(i, 1, ...getAllFocusableIn(frameBody));
54
53
  }
@@ -74,7 +73,7 @@ function getAllTabbableIn(container, includeContainer, fallbackToFocusable) {
74
73
  tabbableElements.unshift(container);
75
74
  }
76
75
  tabbableElements.forEach((element, i) => {
77
- if (_7WYII4ANcjs.isFrame.call(void 0, element) && element.contentDocument) {
76
+ if (_WCFMOJKVcjs.isFrame.call(void 0, element) && element.contentDocument) {
78
77
  const frameBody = element.contentDocument.body;
79
78
  const allFrameTabbable = getAllTabbableIn(
80
79
  frameBody,
@@ -115,7 +114,7 @@ function getLastTabbable(fallbackToFocusable) {
115
114
  return getLastTabbableIn(document.body, false, fallbackToFocusable);
116
115
  }
117
116
  function getNextTabbableIn(container, includeContainer, fallbackToFirst, fallbackToFocusable) {
118
- const activeElement = _7WYII4ANcjs.getActiveElement.call(void 0, container);
117
+ const activeElement = _WCFMOJKVcjs.getActiveElement.call(void 0, container);
119
118
  const allFocusable = getAllFocusableIn(container, includeContainer);
120
119
  const activeIndex = allFocusable.indexOf(activeElement);
121
120
  const nextFocusableElements = allFocusable.slice(activeIndex + 1);
@@ -130,7 +129,7 @@ function getNextTabbable(fallbackToFirst, fallbackToFocusable) {
130
129
  );
131
130
  }
132
131
  function getPreviousTabbableIn(container, includeContainer, fallbackToLast, fallbackToFocusable) {
133
- const activeElement = _7WYII4ANcjs.getActiveElement.call(void 0, container);
132
+ const activeElement = _WCFMOJKVcjs.getActiveElement.call(void 0, container);
134
133
  const allFocusable = getAllFocusableIn(container, includeContainer).reverse();
135
134
  const activeIndex = allFocusable.indexOf(activeElement);
136
135
  const previousFocusableElements = allFocusable.slice(activeIndex + 1);
@@ -151,7 +150,7 @@ function getClosestFocusable(element) {
151
150
  return element || null;
152
151
  }
153
152
  function hasFocus(element) {
154
- const activeElement = _7WYII4ANcjs.getActiveElement.call(void 0, element);
153
+ const activeElement = _WCFMOJKVcjs.getActiveElement.call(void 0, element);
155
154
  if (!activeElement) return false;
156
155
  if (activeElement === element) return true;
157
156
  const activeDescendant = activeElement.getAttribute("aria-activedescendant");
@@ -159,9 +158,9 @@ function hasFocus(element) {
159
158
  return activeDescendant === element.id;
160
159
  }
161
160
  function hasFocusWithin(element) {
162
- const activeElement = _7WYII4ANcjs.getActiveElement.call(void 0, element);
161
+ const activeElement = _WCFMOJKVcjs.getActiveElement.call(void 0, element);
163
162
  if (!activeElement) return false;
164
- if (_7WYII4ANcjs.contains.call(void 0, element, activeElement)) return true;
163
+ if (_WCFMOJKVcjs.contains.call(void 0, element, activeElement)) return true;
165
164
  const activeDescendant = activeElement.getAttribute("aria-activedescendant");
166
165
  if (!activeDescendant) return false;
167
166
  if (!("id" in element)) return false;
@@ -208,7 +207,7 @@ function focusIntoView(element, options) {
208
207
  element.focus();
209
208
  } else {
210
209
  element.focus({ preventScroll: true });
211
- element.scrollIntoView(_3IVNQNIVcjs.__spreadValues.call(void 0, { block: "nearest", inline: "nearest" }, options));
210
+ element.scrollIntoView(_7EQBAZ46cjs.__spreadValues.call(void 0, { block: "nearest", inline: "nearest" }, options));
212
211
  }
213
212
  }
214
213
 
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
3
 
4
4
 
@@ -20,9 +20,9 @@
20
20
 
21
21
 
22
22
 
23
+ var _MLCPLY2Pcjs = require('../__chunks/MLCPLY2P.cjs');
24
+ require('../__chunks/7EQBAZ46.cjs');
23
25
 
24
- var _BTUHABP4cjs = require('../__chunks/BTUHABP4.cjs');
25
- require('../__chunks/3IVNQNIV.cjs');
26
26
 
27
27
 
28
28
 
@@ -44,5 +44,4 @@ require('../__chunks/3IVNQNIV.cjs');
44
44
 
45
45
 
46
46
 
47
-
48
- exports.afterPaint = _BTUHABP4cjs.afterPaint; exports.applyState = _BTUHABP4cjs.applyState; exports.beforePaint = _BTUHABP4cjs.beforePaint; exports.chain = _BTUHABP4cjs.chain; exports.cx = _BTUHABP4cjs.cx; exports.defaultValue = _BTUHABP4cjs.defaultValue; exports.disabledFromProps = _BTUHABP4cjs.disabledFromProps; exports.getKeys = _BTUHABP4cjs.getKeys; exports.hasOwnProperty = _BTUHABP4cjs.hasOwnProperty; exports.identity = _BTUHABP4cjs.identity; exports.invariant = _BTUHABP4cjs.invariant; exports.isEmpty = _BTUHABP4cjs.isEmpty; exports.isFalsyBooleanCallback = _BTUHABP4cjs.isFalsyBooleanCallback; exports.isInteger = _BTUHABP4cjs.isInteger; exports.isObject = _BTUHABP4cjs.isObject; exports.noop = _BTUHABP4cjs.noop; exports.normalizeString = _BTUHABP4cjs.normalizeString; exports.omit = _BTUHABP4cjs.omit; exports.pick = _BTUHABP4cjs.pick; exports.removeUndefinedValues = _BTUHABP4cjs.removeUndefinedValues; exports.shallowEqual = _BTUHABP4cjs.shallowEqual;
47
+ exports.afterPaint = _MLCPLY2Pcjs.afterPaint; exports.applyState = _MLCPLY2Pcjs.applyState; exports.beforePaint = _MLCPLY2Pcjs.beforePaint; exports.chain = _MLCPLY2Pcjs.chain; exports.cx = _MLCPLY2Pcjs.cx; exports.defaultValue = _MLCPLY2Pcjs.defaultValue; exports.disabledFromProps = _MLCPLY2Pcjs.disabledFromProps; exports.getKeys = _MLCPLY2Pcjs.getKeys; exports.hasOwnProperty = _MLCPLY2Pcjs.hasOwnProperty; exports.identity = _MLCPLY2Pcjs.identity; exports.invariant = _MLCPLY2Pcjs.invariant; exports.isEmpty = _MLCPLY2Pcjs.isEmpty; exports.isFalsyBooleanCallback = _MLCPLY2Pcjs.isFalsyBooleanCallback; exports.isInteger = _MLCPLY2Pcjs.isInteger; exports.isObject = _MLCPLY2Pcjs.isObject; exports.noop = _MLCPLY2Pcjs.noop; exports.normalizeString = _MLCPLY2Pcjs.normalizeString; exports.omit = _MLCPLY2Pcjs.omit; exports.pick = _MLCPLY2Pcjs.pick; exports.removeUndefinedValues = _MLCPLY2Pcjs.removeUndefinedValues; exports.shallowEqual = _MLCPLY2Pcjs.shallowEqual;
@@ -1,17 +1,16 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
3
 
4
4
 
5
5
 
6
6
 
7
+ var _TEPPO3KCcjs = require('../__chunks/TEPPO3KC.cjs');
8
+ require('../__chunks/WCFMOJKV.cjs');
9
+ require('../__chunks/7EQBAZ46.cjs');
7
10
 
8
- var _KCEXELK7cjs = require('../__chunks/KCEXELK7.cjs');
9
- require('../__chunks/7WYII4AN.cjs');
10
- require('../__chunks/3IVNQNIV.cjs');
11
11
 
12
12
 
13
13
 
14
14
 
15
15
 
16
-
17
- exports.isApple = _KCEXELK7cjs.isApple; exports.isFirefox = _KCEXELK7cjs.isFirefox; exports.isMac = _KCEXELK7cjs.isMac; exports.isSafari = _KCEXELK7cjs.isSafari; exports.isTouchDevice = _KCEXELK7cjs.isTouchDevice;
16
+ exports.isApple = _TEPPO3KCcjs.isApple; exports.isFirefox = _TEPPO3KCcjs.isFirefox; exports.isMac = _TEPPO3KCcjs.isMac; exports.isSafari = _TEPPO3KCcjs.isSafari; exports.isTouchDevice = _TEPPO3KCcjs.isTouchDevice;
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
3
 
4
4
 
@@ -9,10 +9,10 @@
9
9
 
10
10
 
11
11
 
12
+ var _BSLRW6E7cjs = require('../__chunks/BSLRW6E7.cjs');
13
+ require('../__chunks/MLCPLY2P.cjs');
14
+ require('../__chunks/7EQBAZ46.cjs');
12
15
 
13
- var _3QF3ODTRcjs = require('../__chunks/3QF3ODTR.cjs');
14
- require('../__chunks/BTUHABP4.cjs');
15
- require('../__chunks/3IVNQNIV.cjs');
16
16
 
17
17
 
18
18
 
@@ -23,5 +23,4 @@ require('../__chunks/3IVNQNIV.cjs');
23
23
 
24
24
 
25
25
 
26
-
27
- exports.batch = _3QF3ODTRcjs.batch; exports.createStore = _3QF3ODTRcjs.createStore; exports.init = _3QF3ODTRcjs.init; exports.mergeStore = _3QF3ODTRcjs.mergeStore; exports.omit = _3QF3ODTRcjs.omit; exports.pick = _3QF3ODTRcjs.pick; exports.setup = _3QF3ODTRcjs.setup; exports.subscribe = _3QF3ODTRcjs.subscribe; exports.sync = _3QF3ODTRcjs.sync; exports.throwOnConflictingProps = _3QF3ODTRcjs.throwOnConflictingProps;
26
+ exports.batch = _BSLRW6E7cjs.batch; exports.createStore = _BSLRW6E7cjs.createStore; exports.init = _BSLRW6E7cjs.init; exports.mergeStore = _BSLRW6E7cjs.mergeStore; exports.omit = _BSLRW6E7cjs.omit; exports.pick = _BSLRW6E7cjs.pick; exports.setup = _BSLRW6E7cjs.setup; exports.subscribe = _BSLRW6E7cjs.subscribe; exports.sync = _BSLRW6E7cjs.sync; exports.throwOnConflictingProps = _BSLRW6E7cjs.throwOnConflictingProps;
@@ -1 +1 @@
1
- "use strict";"use client";
1
+ "use strict";
@@ -1,10 +1,9 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
3
 
4
+ var _SHOLYDNPcjs = require('../__chunks/SHOLYDNP.cjs');
5
+ require('../__chunks/7EQBAZ46.cjs');
4
6
 
5
- var _7CES7GVEcjs = require('../__chunks/7CES7GVE.cjs');
6
- require('../__chunks/3IVNQNIV.cjs');
7
7
 
8
8
 
9
-
10
- exports.UndoManager = _7CES7GVEcjs.UndoManager; exports.createUndoManager = _7CES7GVEcjs.createUndoManager;
9
+ exports.UndoManager = _SHOLYDNPcjs.UndoManager; exports.createUndoManager = _SHOLYDNPcjs.createUndoManager;
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import {
3
3
  canUseDOM
4
- } from "./HWOIWM4O.js";
4
+ } from "./PQP5VPTV.js";
5
5
 
6
6
  // src/utils/platform.ts
7
7
  function isTouchDevice() {
@@ -12,7 +12,7 @@ import {
12
12
  } from "./PBFD2E7P.js";
13
13
  import {
14
14
  getDocument
15
- } from "./HWOIWM4O.js";
15
+ } from "./PQP5VPTV.js";
16
16
  import {
17
17
  __spreadProps,
18
18
  __spreadValues
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import {
3
3
  createCollectionStore
4
- } from "./6DHTHWXD.js";
4
+ } from "./7DTP4AQO.js";
5
5
  import {
6
6
  flatten2DArray,
7
7
  reverseArray
@@ -37,11 +37,6 @@ function getEnabledItems(items, excludeId) {
37
37
  return !item.disabled;
38
38
  });
39
39
  }
40
- function getOppositeOrientation(orientation) {
41
- if (orientation === "vertical") return "horizontal";
42
- if (orientation === "horizontal") return "vertical";
43
- return;
44
- }
45
40
  function getItemsInRow(items, rowId) {
46
41
  return items.filter((item) => item.rowId === rowId);
47
42
  }
@@ -163,40 +158,50 @@ function createCompositeStore(props = {}) {
163
158
  });
164
159
  })
165
160
  );
166
- const getNextId = (items, orientation, hasNullItem, skip) => {
161
+ const getNextId = (direction = "next", options = {}) => {
167
162
  var _a2, _b;
168
- const { activeId: activeId2, rtl, focusLoop, focusWrap, includesBaseElement } = composite.getState();
169
- const isHorizontal = orientation !== "vertical";
170
- const isRTL = rtl && isHorizontal;
171
- const allItems = isRTL ? reverseArray(items) : items;
163
+ const defaultState = composite.getState();
164
+ const {
165
+ skip = 0,
166
+ activeId: activeId2 = defaultState.activeId,
167
+ focusShift = defaultState.focusShift,
168
+ focusLoop = defaultState.focusLoop,
169
+ focusWrap = defaultState.focusWrap,
170
+ includesBaseElement = defaultState.includesBaseElement,
171
+ renderedItems = defaultState.renderedItems,
172
+ rtl = defaultState.rtl
173
+ } = options;
174
+ const isVerticalDirection = direction === "up" || direction === "down";
175
+ const isNextDirection = direction === "next" || direction === "down";
176
+ const canReverse = isNextDirection ? rtl && !isVerticalDirection : !rtl || isVerticalDirection;
177
+ const canShift = focusShift && !skip;
178
+ let items = !isVerticalDirection ? renderedItems : flatten2DArray(
179
+ normalizeRows(groupItemsByRows(renderedItems), activeId2, canShift)
180
+ );
181
+ items = canReverse ? reverseArray(renderedItems) : renderedItems;
182
+ items = isVerticalDirection ? verticalizeItems(items) : items;
172
183
  if (activeId2 == null) {
173
- return (_a2 = findFirstEnabledItem(allItems)) == null ? void 0 : _a2.id;
184
+ return (_a2 = findFirstEnabledItem(items)) == null ? void 0 : _a2.id;
174
185
  }
175
- const activeItem = allItems.find((item) => item.id === activeId2);
186
+ const activeItem = items.find((item) => item.id === activeId2);
176
187
  if (!activeItem) {
177
- return (_b = findFirstEnabledItem(allItems)) == null ? void 0 : _b.id;
188
+ return (_b = findFirstEnabledItem(items)) == null ? void 0 : _b.id;
178
189
  }
179
- const isGrid = !!activeItem.rowId;
180
- const activeIndex = allItems.indexOf(activeItem);
181
- const nextItems = allItems.slice(activeIndex + 1);
190
+ const isGrid = items.some((item) => item.rowId);
191
+ const activeIndex = items.indexOf(activeItem);
192
+ const nextItems = items.slice(activeIndex + 1);
182
193
  const nextItemsInRow = getItemsInRow(nextItems, activeItem.rowId);
183
- if (skip !== void 0) {
194
+ if (skip) {
184
195
  const nextEnabledItemsInRow = getEnabledItems(nextItemsInRow, activeId2);
185
196
  const nextItem2 = nextEnabledItemsInRow.slice(skip)[0] || // If we can't find an item, just return the last one.
186
197
  nextEnabledItemsInRow[nextEnabledItemsInRow.length - 1];
187
198
  return nextItem2 == null ? void 0 : nextItem2.id;
188
199
  }
189
- const oppositeOrientation = getOppositeOrientation(
190
- // If it's a grid and orientation is not set, it's a next/previous call,
191
- // which is inherently horizontal. up/down will call next with orientation
192
- // set to vertical by default (see below on up/down methods).
193
- isGrid ? orientation || "horizontal" : orientation
194
- );
195
- const canLoop = focusLoop && focusLoop !== oppositeOrientation;
196
- const canWrap = isGrid && focusWrap && focusWrap !== oppositeOrientation;
197
- hasNullItem = hasNullItem || !isGrid && canLoop && includesBaseElement;
200
+ const canLoop = focusLoop && (isVerticalDirection ? focusLoop !== "horizontal" : focusLoop !== "vertical");
201
+ const canWrap = isGrid && focusWrap && (isVerticalDirection ? focusWrap !== "horizontal" : focusWrap !== "vertical");
202
+ const hasNullItem = isNextDirection ? (!isGrid || isVerticalDirection) && canLoop && includesBaseElement : isVerticalDirection ? includesBaseElement : false;
198
203
  if (canLoop) {
199
- const loopItems = canWrap && !hasNullItem ? allItems : getItemsInRow(allItems, activeItem.rowId);
204
+ const loopItems = canWrap && !hasNullItem ? items : getItemsInRow(items, activeItem.rowId);
200
205
  const sortedItems = flipItems(loopItems, activeId2, hasNullItem);
201
206
  const nextItem2 = findFirstEnabledItem(sortedItems, activeId2);
202
207
  return nextItem2 == null ? void 0 : nextItem2.id;
@@ -237,56 +242,29 @@ function createCompositeStore(props = {}) {
237
242
  var _a2;
238
243
  return (_a2 = findFirstEnabledItem(reverseArray(composite.getState().renderedItems))) == null ? void 0 : _a2.id;
239
244
  },
240
- next: (skip) => {
241
- const { renderedItems, orientation } = composite.getState();
242
- return getNextId(renderedItems, orientation, false, skip);
245
+ next: (options) => {
246
+ if (options !== void 0 && typeof options === "number") {
247
+ options = { skip: options };
248
+ }
249
+ return getNextId("next", options);
243
250
  },
244
- previous: (skip) => {
245
- var _a2;
246
- const { renderedItems, orientation, includesBaseElement } = composite.getState();
247
- const isGrid = !!((_a2 = findFirstEnabledItem(renderedItems)) == null ? void 0 : _a2.rowId);
248
- const hasNullItem = !isGrid && includesBaseElement;
249
- return getNextId(
250
- reverseArray(renderedItems),
251
- orientation,
252
- hasNullItem,
253
- skip
254
- );
251
+ previous: (options) => {
252
+ if (options !== void 0 && typeof options === "number") {
253
+ options = { skip: options };
254
+ }
255
+ return getNextId("previous", options);
255
256
  },
256
- down: (skip) => {
257
- const {
258
- activeId: activeId2,
259
- renderedItems,
260
- focusShift,
261
- focusLoop,
262
- includesBaseElement
263
- } = composite.getState();
264
- const shouldShift = focusShift && !skip;
265
- const verticalItems = verticalizeItems(
266
- flatten2DArray(
267
- normalizeRows(groupItemsByRows(renderedItems), activeId2, shouldShift)
268
- )
269
- );
270
- const canLoop = focusLoop && focusLoop !== "horizontal";
271
- const hasNullItem = canLoop && includesBaseElement;
272
- return getNextId(verticalItems, "vertical", hasNullItem, skip);
257
+ down: (options) => {
258
+ if (options !== void 0 && typeof options === "number") {
259
+ options = { skip: options };
260
+ }
261
+ return getNextId("down", options);
273
262
  },
274
- up: (skip) => {
275
- const { activeId: activeId2, renderedItems, focusShift, includesBaseElement } = composite.getState();
276
- const shouldShift = focusShift && !skip;
277
- const verticalItems = verticalizeItems(
278
- reverseArray(
279
- flatten2DArray(
280
- normalizeRows(
281
- groupItemsByRows(renderedItems),
282
- activeId2,
283
- shouldShift
284
- )
285
- )
286
- )
287
- );
288
- const hasNullItem = includesBaseElement;
289
- return getNextId(verticalItems, "vertical", hasNullItem, skip);
263
+ up: (options) => {
264
+ if (options !== void 0 && typeof options === "number") {
265
+ options = { skip: options };
266
+ }
267
+ return getNextId("up", options);
290
268
  }
291
269
  });
292
270
  }
@@ -133,14 +133,17 @@ function scrollIntoViewIfNeeded(element, arg) {
133
133
  }
134
134
  function getScrollingElement(element) {
135
135
  if (!element) return null;
136
+ const isScrollableOverflow = (overflow) => {
137
+ if (overflow === "auto") return true;
138
+ if (overflow === "scroll") return true;
139
+ return false;
140
+ };
136
141
  if (element.clientHeight && element.scrollHeight > element.clientHeight) {
137
142
  const { overflowY } = getComputedStyle(element);
138
- const isScrollable = overflowY !== "visible" && overflowY !== "hidden";
139
- if (isScrollable) return element;
143
+ if (isScrollableOverflow(overflowY)) return element;
140
144
  } else if (element.clientWidth && element.scrollWidth > element.clientWidth) {
141
145
  const { overflowX } = getComputedStyle(element);
142
- const isScrollable = overflowX !== "visible" && overflowX !== "hidden";
143
- if (isScrollable) return element;
146
+ if (isScrollableOverflow(overflowX)) return element;
144
147
  }
145
148
  return getScrollingElement(element.parentElement) || document.scrollingElement || document.body;
146
149
  }
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import {
3
3
  createCompositeStore
4
- } from "./D7EIQZAU.js";
4
+ } from "./7IJEP35G.js";
5
5
  import {
6
6
  createStore
7
7
  } from "./EQQLU3CG.js";
@@ -1,10 +1,10 @@
1
1
  "use client";
2
2
  import {
3
3
  createCollectionStore
4
- } from "../__chunks/6DHTHWXD.js";
4
+ } from "../__chunks/7DTP4AQO.js";
5
5
  import "../__chunks/EQQLU3CG.js";
6
6
  import "../__chunks/PBFD2E7P.js";
7
- import "../__chunks/HWOIWM4O.js";
7
+ import "../__chunks/PQP5VPTV.js";
8
8
  import "../__chunks/3YLGPPWQ.js";
9
9
  export {
10
10
  createCollectionStore
@@ -1,8 +1,8 @@
1
1
  "use client";
2
2
  import {
3
3
  createCompositeStore
4
- } from "../__chunks/D7EIQZAU.js";
5
- import "../__chunks/6DHTHWXD.js";
4
+ } from "../__chunks/7IJEP35G.js";
5
+ import "../__chunks/7DTP4AQO.js";
6
6
  import "../__chunks/7PRQYBBV.js";
7
7
  import {
8
8
  createPopoverStore
@@ -25,8 +25,8 @@ import {
25
25
  import {
26
26
  isSafari,
27
27
  isTouchDevice
28
- } from "../__chunks/US4USQPI.js";
29
- import "../__chunks/HWOIWM4O.js";
28
+ } from "../__chunks/3VBK76MS.js";
29
+ import "../__chunks/PQP5VPTV.js";
30
30
  import {
31
31
  __objRest,
32
32
  __spreadProps,
@@ -138,8 +138,8 @@ function createComboboxStore(_a = {}) {
138
138
  );
139
139
  setup(
140
140
  combobox,
141
- () => batch(combobox, ["mounted"], (state) => {
142
- if (state.mounted) return;
141
+ () => sync(combobox, ["open"], (state) => {
142
+ if (state.open) return;
143
143
  combobox.setState("activeId", activeId);
144
144
  combobox.setState("moves", 0);
145
145
  })
@@ -2,6 +2,12 @@ import type { CollectionStoreFunctions, CollectionStoreItem, CollectionStoreOpti
2
2
  import type { Store, StoreOptions, StoreProps } from "../utils/store.ts";
3
3
  import type { SetState } from "../utils/types.ts";
4
4
  type Orientation = "horizontal" | "vertical" | "both";
5
+ interface NextOptions extends Pick<Partial<CompositeStoreState>, "activeId" | "focusShift" | "focusLoop" | "focusWrap" | "includesBaseElement" | "renderedItems" | "rtl"> {
6
+ /**
7
+ * The number of items to skip.
8
+ */
9
+ skip?: number;
10
+ }
5
11
  /**
6
12
  * Creates a composite store.
7
13
  */
@@ -229,39 +235,51 @@ export interface CompositeStoreFunctions<T extends CompositeStoreItem = Composit
229
235
  /**
230
236
  * Returns the id of the next enabled item based on the current
231
237
  * [`activeId`](https://ariakit.org/reference/composite-provider#activeid)
232
- * state.
238
+ * state. You can pass additional options to override the current state.
233
239
  * @example
234
240
  * const nextId = store.next();
235
- * const nextNextId = store.next(2);
236
241
  */
237
- next: (skip?: number) => string | null | undefined;
242
+ next(options?: NextOptions): string | null | undefined;
243
+ /**
244
+ * @deprecated Use the object syntax instead: `next({ skip: 2 })`.
245
+ */
246
+ next(skip?: number): string | null | undefined;
238
247
  /**
239
248
  * Returns the id of the previous enabled item based on the current
240
249
  * [`activeId`](https://ariakit.org/reference/composite-provider#activeid)
241
- * state.
250
+ * state. You can pass additional options to override the current state.
242
251
  * @example
243
252
  * const previousId = store.previous();
244
- * const previousPreviousId = store.previous(2);
245
253
  */
246
- previous: (skip?: number) => string | null | undefined;
254
+ previous(options?: NextOptions): string | null | undefined;
255
+ /**
256
+ * @deprecated Use the object syntax instead: `previous({ skip: 2 })`.
257
+ */
258
+ previous(skip?: number): string | null | undefined;
247
259
  /**
248
260
  * Returns the id of the enabled item above based on the current
249
261
  * [`activeId`](https://ariakit.org/reference/composite-provider#activeid)
250
- * state.
262
+ * state. You can pass additional options to override the current state.
251
263
  * @example
252
264
  * const upId = store.up();
253
- * const upUpId = store.up(2);
254
265
  */
255
- up: (skip?: number) => string | null | undefined;
266
+ up(options?: NextOptions): string | null | undefined;
267
+ /**
268
+ * @deprecated Use the object syntax instead: `up({ skip: 2 })`.
269
+ */
270
+ up(skip?: number): string | null | undefined;
256
271
  /**
257
272
  * Returns the id of the enabled item below based on the current
258
273
  * [`activeId`](https://ariakit.org/reference/composite-provider#activeid)
259
- * state.
274
+ * state. You can pass additional options to override the current state.
260
275
  * @example
261
276
  * const downId = store.down();
262
- * const downDownId = store.down(2);
263
277
  */
264
- down: (skip?: number) => string | null | undefined;
278
+ down(options?: NextOptions): string | null | undefined;
279
+ /**
280
+ * @deprecated Use the object syntax instead: `down({ skip: 2 })`.
281
+ */
282
+ down(skip?: number): string | null | undefined;
265
283
  /**
266
284
  * Returns the id of the first enabled item.
267
285
  */
@@ -1,12 +1,12 @@
1
1
  "use client";
2
2
  import {
3
3
  createCompositeStore
4
- } from "../__chunks/D7EIQZAU.js";
5
- import "../__chunks/6DHTHWXD.js";
4
+ } from "../__chunks/7IJEP35G.js";
5
+ import "../__chunks/7DTP4AQO.js";
6
6
  import "../__chunks/7PRQYBBV.js";
7
7
  import "../__chunks/EQQLU3CG.js";
8
8
  import "../__chunks/PBFD2E7P.js";
9
- import "../__chunks/HWOIWM4O.js";
9
+ import "../__chunks/PQP5VPTV.js";
10
10
  import "../__chunks/3YLGPPWQ.js";
11
11
  export {
12
12
  createCompositeStore