@ariakit/core 0.3.8 → 0.3.9

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 (45) hide show
  1. package/CHANGELOG.md +5 -0
  2. package/cjs/__chunks/{QAZ4PF7S.cjs → JNFZSNOI.cjs} +2 -2
  3. package/cjs/__chunks/{ZQTYFYRS.cjs → UCLKUBNP.cjs} +17 -16
  4. package/cjs/__chunks/{3J44Z7YH.cjs → UTICNXST.cjs} +2 -2
  5. package/cjs/collection/collection-store.cjs +2 -2
  6. package/cjs/combobox/combobox-store.cjs +3 -3
  7. package/cjs/combobox/combobox-store.d.cts +2 -0
  8. package/cjs/combobox/combobox-store.d.ts +2 -0
  9. package/cjs/composite/composite-store.cjs +3 -3
  10. package/cjs/composite/composite-store.d.cts +9 -2
  11. package/cjs/composite/composite-store.d.ts +9 -2
  12. package/cjs/form/form-store.cjs +2 -2
  13. package/cjs/hovercard/hovercard-store.d.cts +6 -2
  14. package/cjs/hovercard/hovercard-store.d.ts +6 -2
  15. package/cjs/menu/menu-bar-store.cjs +4 -4
  16. package/cjs/menu/menu-store.cjs +3 -3
  17. package/cjs/menu/menu-store.d.cts +12 -2
  18. package/cjs/menu/menu-store.d.ts +12 -2
  19. package/cjs/menubar/menubar-store.cjs +4 -4
  20. package/cjs/popover/popover-store.d.cts +2 -0
  21. package/cjs/popover/popover-store.d.ts +2 -0
  22. package/cjs/radio/radio-store.cjs +3 -3
  23. package/cjs/select/select-store.cjs +3 -3
  24. package/cjs/tab/tab-store.cjs +4 -4
  25. package/cjs/toolbar/toolbar-store.cjs +3 -3
  26. package/esm/__chunks/{CTZ2GQIZ.js → DLX2AS6C.js} +1 -1
  27. package/esm/__chunks/{A2AGSVJO.js → EZ2TTBAQ.js} +1 -1
  28. package/esm/__chunks/{HMQYEBKF.js → TLN4ALYH.js} +17 -16
  29. package/esm/collection/collection-store.js +1 -1
  30. package/esm/combobox/combobox-store.d.ts +2 -0
  31. package/esm/combobox/combobox-store.js +2 -2
  32. package/esm/composite/composite-store.d.ts +9 -2
  33. package/esm/composite/composite-store.js +2 -2
  34. package/esm/form/form-store.js +1 -1
  35. package/esm/hovercard/hovercard-store.d.ts +6 -2
  36. package/esm/menu/menu-bar-store.js +3 -3
  37. package/esm/menu/menu-store.d.ts +12 -2
  38. package/esm/menu/menu-store.js +2 -2
  39. package/esm/menubar/menubar-store.js +3 -3
  40. package/esm/popover/popover-store.d.ts +2 -0
  41. package/esm/radio/radio-store.js +2 -2
  42. package/esm/select/select-store.js +2 -2
  43. package/esm/tab/tab-store.js +2 -2
  44. package/esm/toolbar/toolbar-store.js +2 -2
  45. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # @ariakit/core
2
2
 
3
+ ## 0.3.9
4
+
5
+ - Fixed `Maximum update depth exceeded` warning when rendering multiple collection items on the page.
6
+ - Improved JSDocs.
7
+
3
8
  ## 0.3.8
4
9
 
5
10
  - Fixed [`CollectionItem`](https://ariakit.org/reference/collection-item) elements getting out of order when composing stores.
@@ -1,7 +1,7 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
2
2
 
3
3
 
4
- var _ZQTYFYRScjs = require('./ZQTYFYRS.cjs');
4
+ var _UCLKUBNPcjs = require('./UCLKUBNP.cjs');
5
5
 
6
6
 
7
7
 
@@ -124,7 +124,7 @@ function verticalizeItems(items) {
124
124
  function createCompositeStore(props = {}) {
125
125
  var _a;
126
126
  const syncState = (_a = props.store) == null ? void 0 : _a.getState();
127
- const collection = _ZQTYFYRScjs.createCollectionStore.call(void 0, props);
127
+ const collection = _UCLKUBNPcjs.createCollectionStore.call(void 0, props);
128
128
  const activeId = _3UT5FE6Kcjs.defaultValue.call(void 0,
129
129
  props.activeId,
130
130
  syncState == null ? void 0 : syncState.activeId,
@@ -88,34 +88,35 @@ function createCollectionStore(props = {}) {
88
88
  syncPrivateStore
89
89
  );
90
90
  const collection = _2UK5WUJXcjs.createStore.call(void 0, initialState, props.store);
91
- const sortItems = () => {
92
- const state = privateStore.getState();
93
- const renderedItems = sortBasedOnDOMPosition(state.renderedItems);
94
- privateStore.setState("renderedItems", renderedItems);
95
- collection.setState("renderedItems", renderedItems);
96
- };
97
91
  _2UK5WUJXcjs.setup.call(void 0, collection, () => _2UK5WUJXcjs.init.call(void 0, privateStore));
98
92
  _2UK5WUJXcjs.setup.call(void 0, privateStore, () => {
99
93
  return _2UK5WUJXcjs.batch.call(void 0, privateStore, ["renderedItems"], (state) => {
100
94
  let firstRun = true;
101
- let raf = requestAnimationFrame(sortItems);
102
- if (typeof IntersectionObserver !== "function")
103
- return;
104
- const callback = () => {
95
+ const raf = requestAnimationFrame(() => {
96
+ const { renderedItems } = collection.getState();
97
+ if (state.renderedItems === renderedItems)
98
+ return;
99
+ const sortedItems = sortBasedOnDOMPosition(state.renderedItems);
100
+ privateStore.setState("renderedItems", sortedItems);
101
+ collection.setState("renderedItems", sortedItems);
102
+ });
103
+ if (typeof IntersectionObserver !== "function") {
104
+ return () => cancelAnimationFrame(raf);
105
+ }
106
+ const ioCallback = () => {
105
107
  if (firstRun) {
106
108
  firstRun = false;
107
109
  return;
108
110
  }
109
- cancelAnimationFrame(raf);
110
- raf = requestAnimationFrame(sortItems);
111
+ privateStore.setState("renderedItems", [...state.renderedItems]);
111
112
  };
112
113
  const root = getCommonParent(state.renderedItems);
113
- const observer = new IntersectionObserver(callback, { root });
114
- state.renderedItems.forEach((item) => {
114
+ const observer = new IntersectionObserver(ioCallback, { root });
115
+ for (const item of state.renderedItems) {
115
116
  if (!item.element)
116
- return;
117
+ continue;
117
118
  observer.observe(item.element);
118
- });
119
+ }
119
120
  return () => {
120
121
  cancelAnimationFrame(raf);
121
122
  observer.disconnect();
@@ -1,7 +1,7 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
2
2
 
3
3
 
4
- var _QAZ4PF7Scjs = require('./QAZ4PF7S.cjs');
4
+ var _JNFZSNOIcjs = require('./JNFZSNOI.cjs');
5
5
 
6
6
 
7
7
  var _2UK5WUJXcjs = require('./2UK5WUJX.cjs');
@@ -17,7 +17,7 @@ var _AV6KTKLEcjs = require('./AV6KTKLE.cjs');
17
17
  function createMenubarStore(props = {}) {
18
18
  var _a;
19
19
  const syncState = (_a = props.store) == null ? void 0 : _a.getState();
20
- const composite = _QAZ4PF7Scjs.createCompositeStore.call(void 0, _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, props), {
20
+ const composite = _JNFZSNOIcjs.createCompositeStore.call(void 0, _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, props), {
21
21
  orientation: _3UT5FE6Kcjs.defaultValue.call(void 0,
22
22
  props.orientation,
23
23
  syncState == null ? void 0 : syncState.orientation,
@@ -1,11 +1,11 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
2
2
 
3
3
 
4
- var _ZQTYFYRScjs = require('../__chunks/ZQTYFYRS.cjs');
4
+ var _UCLKUBNPcjs = require('../__chunks/UCLKUBNP.cjs');
5
5
  require('../__chunks/2UK5WUJX.cjs');
6
6
  require('../__chunks/3UT5FE6K.cjs');
7
7
  require('../__chunks/5F4DVUNS.cjs');
8
8
  require('../__chunks/AV6KTKLE.cjs');
9
9
 
10
10
 
11
- exports.createCollectionStore = _ZQTYFYRScjs.createCollectionStore;
11
+ exports.createCollectionStore = _UCLKUBNPcjs.createCollectionStore;
@@ -6,8 +6,8 @@ require('../__chunks/2LS4JJ4S.cjs');
6
6
  require('../__chunks/GJFZ5ZPP.cjs');
7
7
 
8
8
 
9
- var _QAZ4PF7Scjs = require('../__chunks/QAZ4PF7S.cjs');
10
- require('../__chunks/ZQTYFYRS.cjs');
9
+ var _JNFZSNOIcjs = require('../__chunks/JNFZSNOI.cjs');
10
+ require('../__chunks/UCLKUBNP.cjs');
11
11
 
12
12
 
13
13
 
@@ -41,7 +41,7 @@ function createComboboxStore(props = {}) {
41
41
  props.defaultActiveId,
42
42
  null
43
43
  );
44
- const composite = _QAZ4PF7Scjs.createCompositeStore.call(void 0, _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, props), {
44
+ const composite = _JNFZSNOIcjs.createCompositeStore.call(void 0, _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, props), {
45
45
  activeId,
46
46
  includesBaseElement: _3UT5FE6Kcjs.defaultValue.call(void 0,
47
47
  props.includesBaseElement,
@@ -59,6 +59,8 @@ export interface ComboboxStoreState<T extends ComboboxStoreSelectedValue = Combo
59
59
  * Combobox](https://ariakit.org/examples/combobox-multiple)
60
60
  * - [Menu with Combobox](https://ariakit.org/examples/menu-combobox)
61
61
  * - [Select with Combobox](https://ariakit.org/examples/select-combobox)
62
+ * - [Submenu with
63
+ * Combobox](https://ariakit.org/examples/menu-nested-combobox)
62
64
  */
63
65
  resetValueOnHide: boolean;
64
66
  /**
@@ -59,6 +59,8 @@ export interface ComboboxStoreState<T extends ComboboxStoreSelectedValue = Combo
59
59
  * Combobox](https://ariakit.org/examples/combobox-multiple)
60
60
  * - [Menu with Combobox](https://ariakit.org/examples/menu-combobox)
61
61
  * - [Select with Combobox](https://ariakit.org/examples/select-combobox)
62
+ * - [Submenu with
63
+ * Combobox](https://ariakit.org/examples/menu-nested-combobox)
62
64
  */
63
65
  resetValueOnHide: boolean;
64
66
  /**
@@ -1,8 +1,8 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
2
2
 
3
3
 
4
- var _QAZ4PF7Scjs = require('../__chunks/QAZ4PF7S.cjs');
5
- require('../__chunks/ZQTYFYRS.cjs');
4
+ var _JNFZSNOIcjs = require('../__chunks/JNFZSNOI.cjs');
5
+ require('../__chunks/UCLKUBNP.cjs');
6
6
  require('../__chunks/2UK5WUJX.cjs');
7
7
  require('../__chunks/3UT5FE6K.cjs');
8
8
  require('../__chunks/5F4DVUNS.cjs');
@@ -10,4 +10,4 @@ require('../__chunks/ULSPM3Y3.cjs');
10
10
  require('../__chunks/AV6KTKLE.cjs');
11
11
 
12
12
 
13
- exports.createCompositeStore = _QAZ4PF7Scjs.createCompositeStore;
13
+ exports.createCompositeStore = _JNFZSNOIcjs.createCompositeStore;
@@ -111,8 +111,15 @@ export interface CompositeStoreState<T extends CompositeStoreItem = CompositeSto
111
111
  */
112
112
  moves: number;
113
113
  /**
114
- * Indicates whether the composite element should be included in the focus
115
- * order.
114
+ * Indicates if the composite element (such as `menu`, `combobox`, `listbox`,
115
+ * `toolbar`, etc.) should be part of the focus order. In other words, moving
116
+ * to the previous element when the first item is in focus will focus on the
117
+ * composite element itself. The same applies to the last item when moving to
118
+ * the next element.
119
+ *
120
+ * Live examples:
121
+ * - [Submenu with
122
+ * Combobox](https://ariakit.org/examples/menu-nested-combobox)
116
123
  * @default false
117
124
  */
118
125
  includesBaseElement: boolean;
@@ -111,8 +111,15 @@ export interface CompositeStoreState<T extends CompositeStoreItem = CompositeSto
111
111
  */
112
112
  moves: number;
113
113
  /**
114
- * Indicates whether the composite element should be included in the focus
115
- * order.
114
+ * Indicates if the composite element (such as `menu`, `combobox`, `listbox`,
115
+ * `toolbar`, etc.) should be part of the focus order. In other words, moving
116
+ * to the previous element when the first item is in focus will focus on the
117
+ * composite element itself. The same applies to the last item when moving to
118
+ * the next element.
119
+ *
120
+ * Live examples:
121
+ * - [Submenu with
122
+ * Combobox](https://ariakit.org/examples/menu-nested-combobox)
116
123
  * @default false
117
124
  */
118
125
  includesBaseElement: boolean;
@@ -1,7 +1,7 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
2
2
 
3
3
 
4
- var _ZQTYFYRScjs = require('../__chunks/ZQTYFYRS.cjs');
4
+ var _UCLKUBNPcjs = require('../__chunks/UCLKUBNP.cjs');
5
5
 
6
6
 
7
7
 
@@ -116,7 +116,7 @@ function createFormStore(props = {}) {
116
116
  var _a;
117
117
  _2UK5WUJXcjs.throwOnConflictingProps.call(void 0, props, props.store);
118
118
  const syncState = (_a = props.store) == null ? void 0 : _a.getState();
119
- const collection = _ZQTYFYRScjs.createCollectionStore.call(void 0, props);
119
+ const collection = _UCLKUBNPcjs.createCollectionStore.call(void 0, props);
120
120
  const values = _3UT5FE6Kcjs.defaultValue.call(void 0,
121
121
  props.values,
122
122
  syncState == null ? void 0 : syncState.values,
@@ -19,15 +19,19 @@ export interface HovercardStoreState extends PopoverStoreState {
19
19
  timeout: number;
20
20
  /**
21
21
  * The amount of time in milliseconds to wait before **showing** the popover.
22
- * It defaults to the value passed to `timeout`.
22
+ * It defaults to the value passed to
23
+ * [`timeout`](https://ariakit.org/reference/hovercard-provider#timeout).
23
24
  *
24
25
  * Live examples:
25
26
  * - [Navigation Menubar](https://ariakit.org/examples/menubar-navigation)
27
+ * - [Submenu with
28
+ * Combobox](https://ariakit.org/examples/menu-nested-combobox)
26
29
  */
27
30
  showTimeout?: number;
28
31
  /**
29
32
  * The amount of time in milliseconds to wait before **hiding** the popover.
30
- * It defaults to the value passed to `timeout`.
33
+ * It defaults to the value passed to
34
+ * [`timeout`](https://ariakit.org/reference/hovercard-provider#timeout).
31
35
  *
32
36
  * Live examples:
33
37
  * - [Navigation Menubar](https://ariakit.org/examples/menubar-navigation)
@@ -19,15 +19,19 @@ export interface HovercardStoreState extends PopoverStoreState {
19
19
  timeout: number;
20
20
  /**
21
21
  * The amount of time in milliseconds to wait before **showing** the popover.
22
- * It defaults to the value passed to `timeout`.
22
+ * It defaults to the value passed to
23
+ * [`timeout`](https://ariakit.org/reference/hovercard-provider#timeout).
23
24
  *
24
25
  * Live examples:
25
26
  * - [Navigation Menubar](https://ariakit.org/examples/menubar-navigation)
27
+ * - [Submenu with
28
+ * Combobox](https://ariakit.org/examples/menu-nested-combobox)
26
29
  */
27
30
  showTimeout?: number;
28
31
  /**
29
32
  * The amount of time in milliseconds to wait before **hiding** the popover.
30
- * It defaults to the value passed to `timeout`.
33
+ * It defaults to the value passed to
34
+ * [`timeout`](https://ariakit.org/reference/hovercard-provider#timeout).
31
35
  *
32
36
  * Live examples:
33
37
  * - [Navigation Menubar](https://ariakit.org/examples/menubar-navigation)
@@ -1,9 +1,9 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
2
2
 
3
3
 
4
- var _3J44Z7YHcjs = require('../__chunks/3J44Z7YH.cjs');
5
- require('../__chunks/QAZ4PF7S.cjs');
6
- require('../__chunks/ZQTYFYRS.cjs');
4
+ var _UTICNXSTcjs = require('../__chunks/UTICNXST.cjs');
5
+ require('../__chunks/JNFZSNOI.cjs');
6
+ require('../__chunks/UCLKUBNP.cjs');
7
7
  require('../__chunks/2UK5WUJX.cjs');
8
8
  require('../__chunks/3UT5FE6K.cjs');
9
9
  require('../__chunks/5F4DVUNS.cjs');
@@ -12,7 +12,7 @@ require('../__chunks/AV6KTKLE.cjs');
12
12
 
13
13
  // src/menu/menu-bar-store.ts
14
14
  function createMenuBarStore(props = {}) {
15
- return _3J44Z7YHcjs.createMenubarStore.call(void 0, props);
15
+ return _UTICNXSTcjs.createMenubarStore.call(void 0, props);
16
16
  }
17
17
 
18
18
 
@@ -7,8 +7,8 @@ require('../__chunks/2LS4JJ4S.cjs');
7
7
  require('../__chunks/GJFZ5ZPP.cjs');
8
8
 
9
9
 
10
- var _QAZ4PF7Scjs = require('../__chunks/QAZ4PF7S.cjs');
11
- require('../__chunks/ZQTYFYRS.cjs');
10
+ var _JNFZSNOIcjs = require('../__chunks/JNFZSNOI.cjs');
11
+ require('../__chunks/UCLKUBNP.cjs');
12
12
 
13
13
 
14
14
 
@@ -55,7 +55,7 @@ function createMenuStore(_a = {}) {
55
55
  );
56
56
  _2UK5WUJXcjs.throwOnConflictingProps.call(void 0, props, store);
57
57
  const syncState = store.getState();
58
- const composite = _QAZ4PF7Scjs.createCompositeStore.call(void 0, _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, props), {
58
+ const composite = _JNFZSNOIcjs.createCompositeStore.call(void 0, _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, props), {
59
59
  store,
60
60
  orientation: _3UT5FE6Kcjs.defaultValue.call(void 0,
61
61
  props.orientation,
@@ -15,6 +15,10 @@ export interface MenuStoreState<T extends MenuStoreValues = MenuStoreValues> ext
15
15
  /**
16
16
  * A map of names and values that will be used by the `MenuItemCheckbox` and
17
17
  * `MenuItemRadio` components.
18
+ *
19
+ * Live examples:
20
+ * - [Submenu with
21
+ * Combobox](https://ariakit.org/examples/menu-nested-combobox)
18
22
  */
19
23
  values: T;
20
24
  /** @default "vertical" */
@@ -27,6 +31,10 @@ export interface MenuStoreState<T extends MenuStoreValues = MenuStoreValues> ext
27
31
  export interface MenuStoreFunctions<T extends MenuStoreValues = MenuStoreValues> extends CompositeStoreFunctions, HovercardStoreFunctions, Pick<MenuStoreOptions, "combobox" | "parent" | "menubar"> {
28
32
  /**
29
33
  * Hides the menu and all its parent menus.
34
+ *
35
+ * Live examples:
36
+ * - [Submenu with
37
+ * Combobox](https://ariakit.org/examples/menu-nested-combobox)
30
38
  */
31
39
  hideAll: () => void;
32
40
  /**
@@ -42,8 +50,10 @@ export interface MenuStoreFunctions<T extends MenuStoreValues = MenuStoreValues>
42
50
  setValues: SetState<MenuStoreState<T>["values"]>;
43
51
  /**
44
52
  * Sets a specific menu value.
45
- * @param name The name.
46
- * @param value The value.
53
+ *
54
+ * Live examples:
55
+ * - [Submenu with
56
+ * Combobox](https://ariakit.org/examples/menu-nested-combobox)
47
57
  * @example
48
58
  * store.setValue("watching", ["issues"]);
49
59
  * store.setValue("watching", (value) => [...value, "issues"]);
@@ -15,6 +15,10 @@ export interface MenuStoreState<T extends MenuStoreValues = MenuStoreValues> ext
15
15
  /**
16
16
  * A map of names and values that will be used by the `MenuItemCheckbox` and
17
17
  * `MenuItemRadio` components.
18
+ *
19
+ * Live examples:
20
+ * - [Submenu with
21
+ * Combobox](https://ariakit.org/examples/menu-nested-combobox)
18
22
  */
19
23
  values: T;
20
24
  /** @default "vertical" */
@@ -27,6 +31,10 @@ export interface MenuStoreState<T extends MenuStoreValues = MenuStoreValues> ext
27
31
  export interface MenuStoreFunctions<T extends MenuStoreValues = MenuStoreValues> extends CompositeStoreFunctions, HovercardStoreFunctions, Pick<MenuStoreOptions, "combobox" | "parent" | "menubar"> {
28
32
  /**
29
33
  * Hides the menu and all its parent menus.
34
+ *
35
+ * Live examples:
36
+ * - [Submenu with
37
+ * Combobox](https://ariakit.org/examples/menu-nested-combobox)
30
38
  */
31
39
  hideAll: () => void;
32
40
  /**
@@ -42,8 +50,10 @@ export interface MenuStoreFunctions<T extends MenuStoreValues = MenuStoreValues>
42
50
  setValues: SetState<MenuStoreState<T>["values"]>;
43
51
  /**
44
52
  * Sets a specific menu value.
45
- * @param name The name.
46
- * @param value The value.
53
+ *
54
+ * Live examples:
55
+ * - [Submenu with
56
+ * Combobox](https://ariakit.org/examples/menu-nested-combobox)
47
57
  * @example
48
58
  * store.setValue("watching", ["issues"]);
49
59
  * store.setValue("watching", (value) => [...value, "issues"]);
@@ -1,9 +1,9 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
2
2
 
3
3
 
4
- var _3J44Z7YHcjs = require('../__chunks/3J44Z7YH.cjs');
5
- require('../__chunks/QAZ4PF7S.cjs');
6
- require('../__chunks/ZQTYFYRS.cjs');
4
+ var _UTICNXSTcjs = require('../__chunks/UTICNXST.cjs');
5
+ require('../__chunks/JNFZSNOI.cjs');
6
+ require('../__chunks/UCLKUBNP.cjs');
7
7
  require('../__chunks/2UK5WUJX.cjs');
8
8
  require('../__chunks/3UT5FE6K.cjs');
9
9
  require('../__chunks/5F4DVUNS.cjs');
@@ -11,4 +11,4 @@ require('../__chunks/ULSPM3Y3.cjs');
11
11
  require('../__chunks/AV6KTKLE.cjs');
12
12
 
13
13
 
14
- exports.createMenubarStore = _3J44Z7YHcjs.createMenubarStore;
14
+ exports.createMenubarStore = _UTICNXSTcjs.createMenubarStore;
@@ -31,6 +31,8 @@ export interface PopoverStoreState extends DialogStoreState {
31
31
  *
32
32
  * Live examples:
33
33
  * - [Navigation Menubar](https://ariakit.org/examples/menubar-navigation)
34
+ * - [Submenu with
35
+ * Combobox](https://ariakit.org/examples/menu-nested-combobox)
34
36
  * @default "bottom"
35
37
  */
36
38
  placement: Placement;
@@ -31,6 +31,8 @@ export interface PopoverStoreState extends DialogStoreState {
31
31
  *
32
32
  * Live examples:
33
33
  * - [Navigation Menubar](https://ariakit.org/examples/menubar-navigation)
34
+ * - [Submenu with
35
+ * Combobox](https://ariakit.org/examples/menu-nested-combobox)
34
36
  * @default "bottom"
35
37
  */
36
38
  placement: Placement;
@@ -1,8 +1,8 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
2
2
 
3
3
 
4
- var _QAZ4PF7Scjs = require('../__chunks/QAZ4PF7S.cjs');
5
- require('../__chunks/ZQTYFYRS.cjs');
4
+ var _JNFZSNOIcjs = require('../__chunks/JNFZSNOI.cjs');
5
+ require('../__chunks/UCLKUBNP.cjs');
6
6
 
7
7
 
8
8
  var _2UK5WUJXcjs = require('../__chunks/2UK5WUJX.cjs');
@@ -22,7 +22,7 @@ function createRadioStore(_a = {}) {
22
22
  var props = _AV6KTKLEcjs.__objRest.call(void 0, _a, []);
23
23
  var _a2;
24
24
  const syncState = (_a2 = props.store) == null ? void 0 : _a2.getState();
25
- const composite = _QAZ4PF7Scjs.createCompositeStore.call(void 0, _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, props), {
25
+ const composite = _JNFZSNOIcjs.createCompositeStore.call(void 0, _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, props), {
26
26
  focusLoop: _3UT5FE6Kcjs.defaultValue.call(void 0, props.focusLoop, syncState == null ? void 0 : syncState.focusLoop, true)
27
27
  }));
28
28
  const initialState = _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, composite.getState()), {
@@ -6,8 +6,8 @@ require('../__chunks/2LS4JJ4S.cjs');
6
6
  require('../__chunks/GJFZ5ZPP.cjs');
7
7
 
8
8
 
9
- var _QAZ4PF7Scjs = require('../__chunks/QAZ4PF7S.cjs');
10
- require('../__chunks/ZQTYFYRS.cjs');
9
+ var _JNFZSNOIcjs = require('../__chunks/JNFZSNOI.cjs');
10
+ require('../__chunks/UCLKUBNP.cjs');
11
11
 
12
12
 
13
13
 
@@ -53,7 +53,7 @@ function createSelectStore(_a = {}) {
53
53
  );
54
54
  _2UK5WUJXcjs.throwOnConflictingProps.call(void 0, props, store);
55
55
  const syncState = store.getState();
56
- const composite = _QAZ4PF7Scjs.createCompositeStore.call(void 0, _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, props), {
56
+ const composite = _JNFZSNOIcjs.createCompositeStore.call(void 0, _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, props), {
57
57
  store,
58
58
  virtualFocus: _3UT5FE6Kcjs.defaultValue.call(void 0,
59
59
  props.virtualFocus,
@@ -1,10 +1,10 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
2
2
 
3
3
 
4
- var _QAZ4PF7Scjs = require('../__chunks/QAZ4PF7S.cjs');
4
+ var _JNFZSNOIcjs = require('../__chunks/JNFZSNOI.cjs');
5
5
 
6
6
 
7
- var _ZQTYFYRScjs = require('../__chunks/ZQTYFYRS.cjs');
7
+ var _UCLKUBNPcjs = require('../__chunks/UCLKUBNP.cjs');
8
8
 
9
9
 
10
10
 
@@ -25,7 +25,7 @@ var _AV6KTKLEcjs = require('../__chunks/AV6KTKLE.cjs');
25
25
  function createTabStore(props = {}) {
26
26
  var _a;
27
27
  const syncState = (_a = props.store) == null ? void 0 : _a.getState();
28
- const composite = _QAZ4PF7Scjs.createCompositeStore.call(void 0, _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, props), {
28
+ const composite = _JNFZSNOIcjs.createCompositeStore.call(void 0, _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, props), {
29
29
  orientation: _3UT5FE6Kcjs.defaultValue.call(void 0,
30
30
  props.orientation,
31
31
  syncState == null ? void 0 : syncState.orientation,
@@ -33,7 +33,7 @@ function createTabStore(props = {}) {
33
33
  ),
34
34
  focusLoop: _3UT5FE6Kcjs.defaultValue.call(void 0, props.focusLoop, syncState == null ? void 0 : syncState.focusLoop, true)
35
35
  }));
36
- const panels = _ZQTYFYRScjs.createCollectionStore.call(void 0, );
36
+ const panels = _UCLKUBNPcjs.createCollectionStore.call(void 0, );
37
37
  const initialState = _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, composite.getState()), {
38
38
  selectedId: _3UT5FE6Kcjs.defaultValue.call(void 0,
39
39
  props.selectedId,
@@ -1,8 +1,8 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
2
2
 
3
3
 
4
- var _QAZ4PF7Scjs = require('../__chunks/QAZ4PF7S.cjs');
5
- require('../__chunks/ZQTYFYRS.cjs');
4
+ var _JNFZSNOIcjs = require('../__chunks/JNFZSNOI.cjs');
5
+ require('../__chunks/UCLKUBNP.cjs');
6
6
  require('../__chunks/2UK5WUJX.cjs');
7
7
 
8
8
 
@@ -18,7 +18,7 @@ var _AV6KTKLEcjs = require('../__chunks/AV6KTKLE.cjs');
18
18
  function createToolbarStore(props = {}) {
19
19
  var _a;
20
20
  const syncState = (_a = props.store) == null ? void 0 : _a.getState();
21
- return _QAZ4PF7Scjs.createCompositeStore.call(void 0, _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, props), {
21
+ return _JNFZSNOIcjs.createCompositeStore.call(void 0, _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, props), {
22
22
  orientation: _3UT5FE6Kcjs.defaultValue.call(void 0,
23
23
  props.orientation,
24
24
  syncState == null ? void 0 : syncState.orientation,
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import {
3
3
  createCollectionStore
4
- } from "./HMQYEBKF.js";
4
+ } from "./TLN4ALYH.js";
5
5
  import {
6
6
  createStore,
7
7
  setup,
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import {
3
3
  createCompositeStore
4
- } from "./CTZ2GQIZ.js";
4
+ } from "./DLX2AS6C.js";
5
5
  import {
6
6
  createStore
7
7
  } from "./A2J4XZ5T.js";
@@ -88,34 +88,35 @@ function createCollectionStore(props = {}) {
88
88
  syncPrivateStore
89
89
  );
90
90
  const collection = createStore(initialState, props.store);
91
- const sortItems = () => {
92
- const state = privateStore.getState();
93
- const renderedItems = sortBasedOnDOMPosition(state.renderedItems);
94
- privateStore.setState("renderedItems", renderedItems);
95
- collection.setState("renderedItems", renderedItems);
96
- };
97
91
  setup(collection, () => init(privateStore));
98
92
  setup(privateStore, () => {
99
93
  return batch(privateStore, ["renderedItems"], (state) => {
100
94
  let firstRun = true;
101
- let raf = requestAnimationFrame(sortItems);
102
- if (typeof IntersectionObserver !== "function")
103
- return;
104
- const callback = () => {
95
+ const raf = requestAnimationFrame(() => {
96
+ const { renderedItems } = collection.getState();
97
+ if (state.renderedItems === renderedItems)
98
+ return;
99
+ const sortedItems = sortBasedOnDOMPosition(state.renderedItems);
100
+ privateStore.setState("renderedItems", sortedItems);
101
+ collection.setState("renderedItems", sortedItems);
102
+ });
103
+ if (typeof IntersectionObserver !== "function") {
104
+ return () => cancelAnimationFrame(raf);
105
+ }
106
+ const ioCallback = () => {
105
107
  if (firstRun) {
106
108
  firstRun = false;
107
109
  return;
108
110
  }
109
- cancelAnimationFrame(raf);
110
- raf = requestAnimationFrame(sortItems);
111
+ privateStore.setState("renderedItems", [...state.renderedItems]);
111
112
  };
112
113
  const root = getCommonParent(state.renderedItems);
113
- const observer = new IntersectionObserver(callback, { root });
114
- state.renderedItems.forEach((item) => {
114
+ const observer = new IntersectionObserver(ioCallback, { root });
115
+ for (const item of state.renderedItems) {
115
116
  if (!item.element)
116
- return;
117
+ continue;
117
118
  observer.observe(item.element);
118
- });
119
+ }
119
120
  return () => {
120
121
  cancelAnimationFrame(raf);
121
122
  observer.disconnect();
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import {
3
3
  createCollectionStore
4
- } from "../__chunks/HMQYEBKF.js";
4
+ } from "../__chunks/TLN4ALYH.js";
5
5
  import "../__chunks/A2J4XZ5T.js";
6
6
  import "../__chunks/I2VQ3XGR.js";
7
7
  import "../__chunks/DLOEKDPY.js";
@@ -59,6 +59,8 @@ export interface ComboboxStoreState<T extends ComboboxStoreSelectedValue = Combo
59
59
  * Combobox](https://ariakit.org/examples/combobox-multiple)
60
60
  * - [Menu with Combobox](https://ariakit.org/examples/menu-combobox)
61
61
  * - [Select with Combobox](https://ariakit.org/examples/select-combobox)
62
+ * - [Submenu with
63
+ * Combobox](https://ariakit.org/examples/menu-nested-combobox)
62
64
  */
63
65
  resetValueOnHide: boolean;
64
66
  /**
@@ -6,8 +6,8 @@ import "../__chunks/LT2OYWRD.js";
6
6
  import "../__chunks/NKLTHWCR.js";
7
7
  import {
8
8
  createCompositeStore
9
- } from "../__chunks/CTZ2GQIZ.js";
10
- import "../__chunks/HMQYEBKF.js";
9
+ } from "../__chunks/DLX2AS6C.js";
10
+ import "../__chunks/TLN4ALYH.js";
11
11
  import {
12
12
  batch,
13
13
  createStore,
@@ -111,8 +111,15 @@ export interface CompositeStoreState<T extends CompositeStoreItem = CompositeSto
111
111
  */
112
112
  moves: number;
113
113
  /**
114
- * Indicates whether the composite element should be included in the focus
115
- * order.
114
+ * Indicates if the composite element (such as `menu`, `combobox`, `listbox`,
115
+ * `toolbar`, etc.) should be part of the focus order. In other words, moving
116
+ * to the previous element when the first item is in focus will focus on the
117
+ * composite element itself. The same applies to the last item when moving to
118
+ * the next element.
119
+ *
120
+ * Live examples:
121
+ * - [Submenu with
122
+ * Combobox](https://ariakit.org/examples/menu-nested-combobox)
116
123
  * @default false
117
124
  */
118
125
  includesBaseElement: boolean;
@@ -1,8 +1,8 @@
1
1
  "use client";
2
2
  import {
3
3
  createCompositeStore
4
- } from "../__chunks/CTZ2GQIZ.js";
5
- import "../__chunks/HMQYEBKF.js";
4
+ } from "../__chunks/DLX2AS6C.js";
5
+ import "../__chunks/TLN4ALYH.js";
6
6
  import "../__chunks/A2J4XZ5T.js";
7
7
  import "../__chunks/I2VQ3XGR.js";
8
8
  import "../__chunks/DLOEKDPY.js";
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import {
3
3
  createCollectionStore
4
- } from "../__chunks/HMQYEBKF.js";
4
+ } from "../__chunks/TLN4ALYH.js";
5
5
  import {
6
6
  createStore,
7
7
  init,
@@ -19,15 +19,19 @@ export interface HovercardStoreState extends PopoverStoreState {
19
19
  timeout: number;
20
20
  /**
21
21
  * The amount of time in milliseconds to wait before **showing** the popover.
22
- * It defaults to the value passed to `timeout`.
22
+ * It defaults to the value passed to
23
+ * [`timeout`](https://ariakit.org/reference/hovercard-provider#timeout).
23
24
  *
24
25
  * Live examples:
25
26
  * - [Navigation Menubar](https://ariakit.org/examples/menubar-navigation)
27
+ * - [Submenu with
28
+ * Combobox](https://ariakit.org/examples/menu-nested-combobox)
26
29
  */
27
30
  showTimeout?: number;
28
31
  /**
29
32
  * The amount of time in milliseconds to wait before **hiding** the popover.
30
- * It defaults to the value passed to `timeout`.
33
+ * It defaults to the value passed to
34
+ * [`timeout`](https://ariakit.org/reference/hovercard-provider#timeout).
31
35
  *
32
36
  * Live examples:
33
37
  * - [Navigation Menubar](https://ariakit.org/examples/menubar-navigation)
@@ -1,9 +1,9 @@
1
1
  "use client";
2
2
  import {
3
3
  createMenubarStore
4
- } from "../__chunks/A2AGSVJO.js";
5
- import "../__chunks/CTZ2GQIZ.js";
6
- import "../__chunks/HMQYEBKF.js";
4
+ } from "../__chunks/EZ2TTBAQ.js";
5
+ import "../__chunks/DLX2AS6C.js";
6
+ import "../__chunks/TLN4ALYH.js";
7
7
  import "../__chunks/A2J4XZ5T.js";
8
8
  import "../__chunks/I2VQ3XGR.js";
9
9
  import "../__chunks/DLOEKDPY.js";
@@ -15,6 +15,10 @@ export interface MenuStoreState<T extends MenuStoreValues = MenuStoreValues> ext
15
15
  /**
16
16
  * A map of names and values that will be used by the `MenuItemCheckbox` and
17
17
  * `MenuItemRadio` components.
18
+ *
19
+ * Live examples:
20
+ * - [Submenu with
21
+ * Combobox](https://ariakit.org/examples/menu-nested-combobox)
18
22
  */
19
23
  values: T;
20
24
  /** @default "vertical" */
@@ -27,6 +31,10 @@ export interface MenuStoreState<T extends MenuStoreValues = MenuStoreValues> ext
27
31
  export interface MenuStoreFunctions<T extends MenuStoreValues = MenuStoreValues> extends CompositeStoreFunctions, HovercardStoreFunctions, Pick<MenuStoreOptions, "combobox" | "parent" | "menubar"> {
28
32
  /**
29
33
  * Hides the menu and all its parent menus.
34
+ *
35
+ * Live examples:
36
+ * - [Submenu with
37
+ * Combobox](https://ariakit.org/examples/menu-nested-combobox)
30
38
  */
31
39
  hideAll: () => void;
32
40
  /**
@@ -42,8 +50,10 @@ export interface MenuStoreFunctions<T extends MenuStoreValues = MenuStoreValues>
42
50
  setValues: SetState<MenuStoreState<T>["values"]>;
43
51
  /**
44
52
  * Sets a specific menu value.
45
- * @param name The name.
46
- * @param value The value.
53
+ *
54
+ * Live examples:
55
+ * - [Submenu with
56
+ * Combobox](https://ariakit.org/examples/menu-nested-combobox)
47
57
  * @example
48
58
  * store.setValue("watching", ["issues"]);
49
59
  * store.setValue("watching", (value) => [...value, "issues"]);
@@ -7,8 +7,8 @@ import "../__chunks/LT2OYWRD.js";
7
7
  import "../__chunks/NKLTHWCR.js";
8
8
  import {
9
9
  createCompositeStore
10
- } from "../__chunks/CTZ2GQIZ.js";
11
- import "../__chunks/HMQYEBKF.js";
10
+ } from "../__chunks/DLX2AS6C.js";
11
+ import "../__chunks/TLN4ALYH.js";
12
12
  import {
13
13
  createStore,
14
14
  mergeStore,
@@ -1,9 +1,9 @@
1
1
  "use client";
2
2
  import {
3
3
  createMenubarStore
4
- } from "../__chunks/A2AGSVJO.js";
5
- import "../__chunks/CTZ2GQIZ.js";
6
- import "../__chunks/HMQYEBKF.js";
4
+ } from "../__chunks/EZ2TTBAQ.js";
5
+ import "../__chunks/DLX2AS6C.js";
6
+ import "../__chunks/TLN4ALYH.js";
7
7
  import "../__chunks/A2J4XZ5T.js";
8
8
  import "../__chunks/I2VQ3XGR.js";
9
9
  import "../__chunks/DLOEKDPY.js";
@@ -31,6 +31,8 @@ export interface PopoverStoreState extends DialogStoreState {
31
31
  *
32
32
  * Live examples:
33
33
  * - [Navigation Menubar](https://ariakit.org/examples/menubar-navigation)
34
+ * - [Submenu with
35
+ * Combobox](https://ariakit.org/examples/menu-nested-combobox)
34
36
  * @default "bottom"
35
37
  */
36
38
  placement: Placement;
@@ -1,8 +1,8 @@
1
1
  "use client";
2
2
  import {
3
3
  createCompositeStore
4
- } from "../__chunks/CTZ2GQIZ.js";
5
- import "../__chunks/HMQYEBKF.js";
4
+ } from "../__chunks/DLX2AS6C.js";
5
+ import "../__chunks/TLN4ALYH.js";
6
6
  import {
7
7
  createStore
8
8
  } from "../__chunks/A2J4XZ5T.js";
@@ -6,8 +6,8 @@ import "../__chunks/LT2OYWRD.js";
6
6
  import "../__chunks/NKLTHWCR.js";
7
7
  import {
8
8
  createCompositeStore
9
- } from "../__chunks/CTZ2GQIZ.js";
10
- import "../__chunks/HMQYEBKF.js";
9
+ } from "../__chunks/DLX2AS6C.js";
10
+ import "../__chunks/TLN4ALYH.js";
11
11
  import {
12
12
  batch,
13
13
  createStore,
@@ -1,10 +1,10 @@
1
1
  "use client";
2
2
  import {
3
3
  createCompositeStore
4
- } from "../__chunks/CTZ2GQIZ.js";
4
+ } from "../__chunks/DLX2AS6C.js";
5
5
  import {
6
6
  createCollectionStore
7
- } from "../__chunks/HMQYEBKF.js";
7
+ } from "../__chunks/TLN4ALYH.js";
8
8
  import {
9
9
  batch,
10
10
  createStore,
@@ -1,8 +1,8 @@
1
1
  "use client";
2
2
  import {
3
3
  createCompositeStore
4
- } from "../__chunks/CTZ2GQIZ.js";
5
- import "../__chunks/HMQYEBKF.js";
4
+ } from "../__chunks/DLX2AS6C.js";
5
+ import "../__chunks/TLN4ALYH.js";
6
6
  import "../__chunks/A2J4XZ5T.js";
7
7
  import {
8
8
  defaultValue
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ariakit/core",
3
- "version": "0.3.8",
3
+ "version": "0.3.9",
4
4
  "description": "Ariakit core",
5
5
  "sideEffects": false,
6
6
  "license": "MIT",