@ariakit/core 0.1.3 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/cjs/__chunks/{QYB6XH64.cjs → 27ZAGOYG.cjs} +17 -13
  3. package/cjs/__chunks/6455U47T.cjs +37 -0
  4. package/cjs/__chunks/{ZPOXPO2L.cjs → 6SPJEESB.cjs} +33 -21
  5. package/cjs/__chunks/{2YFRPUZP.cjs → DBHIHK7C.cjs} +6 -6
  6. package/cjs/__chunks/{W5IHD6VG.cjs → EUJ6NNA6.cjs} +56 -43
  7. package/cjs/__chunks/{4DQ3OTE7.cjs → FXEBKN6G.cjs} +22 -17
  8. package/cjs/__chunks/{ZJEEK57E.cjs → HEFJPUYD.cjs} +2 -2
  9. package/cjs/__chunks/LBTLD2RB.cjs +58 -0
  10. package/cjs/__chunks/{QNEPGQLL.cjs → M6ZA7XUP.cjs} +6 -2
  11. package/cjs/__chunks/{HLVPXX7H.cjs → SDBF6KIY.cjs} +107 -107
  12. package/cjs/__chunks/{OFNGELMA.cjs → ZNW4LSWU.cjs} +8 -6
  13. package/cjs/checkbox/checkbox-store.cjs +14 -10
  14. package/cjs/checkbox/checkbox-store.d.ts +7 -0
  15. package/cjs/collection/collection-store.cjs +6 -5
  16. package/cjs/combobox/combobox-store.cjs +49 -48
  17. package/cjs/combobox/combobox-store.d.ts +24 -0
  18. package/cjs/composite/composite-overflow-store.cjs +7 -6
  19. package/cjs/composite/composite-store.cjs +7 -6
  20. package/cjs/composite/composite-store.d.ts +38 -34
  21. package/cjs/dialog/dialog-store.cjs +6 -5
  22. package/cjs/disclosure/disclosure-store.cjs +5 -4
  23. package/cjs/disclosure/disclosure-store.d.ts +36 -6
  24. package/cjs/form/form-store.cjs +38 -35
  25. package/cjs/hovercard/hovercard-store.cjs +8 -7
  26. package/cjs/index.cjs +3 -1
  27. package/cjs/menu/menu-bar-store.cjs +17 -13
  28. package/cjs/menu/menu-store.cjs +41 -43
  29. package/cjs/popover/popover-store.cjs +7 -6
  30. package/cjs/radio/radio-store.cjs +25 -24
  31. package/cjs/select/select-store.cjs +42 -42
  32. package/cjs/select/select-store.d.ts +16 -0
  33. package/cjs/tab/tab-store.cjs +29 -28
  34. package/cjs/tab/tab-store.d.ts +9 -0
  35. package/cjs/toolbar/toolbar-store.cjs +17 -13
  36. package/cjs/tooltip/tooltip-store.cjs +24 -25
  37. package/cjs/tsconfig.build.tsbuildinfo +1 -1
  38. package/cjs/utils/array.cjs +1 -0
  39. package/cjs/utils/dom.cjs +3 -2
  40. package/cjs/utils/events.cjs +14 -9
  41. package/cjs/utils/focus.cjs +24 -14
  42. package/cjs/utils/misc.cjs +3 -2
  43. package/cjs/utils/platform.cjs +4 -3
  44. package/cjs/utils/store.cjs +4 -3
  45. package/esm/__chunks/4BKCJXBM.js +37 -0
  46. package/esm/__chunks/AHZW5LR4.js +58 -0
  47. package/esm/__chunks/{NA5BK7DD.js → BOKMNDR7.js} +22 -10
  48. package/esm/__chunks/{6PEWNRTN.js → CUW3E24J.js} +100 -100
  49. package/esm/__chunks/{WFGVC6LE.js → EWHSN7GO.js} +17 -12
  50. package/esm/__chunks/{4T5RHRE5.js → MNNKHNLW.js} +1 -1
  51. package/esm/__chunks/{UVCATTRC.js → N6JW4ITM.js} +7 -5
  52. package/esm/__chunks/{RMD7SNCC.js → NWU4GBZ6.js} +5 -1
  53. package/esm/__chunks/{X7MJ3FB5.js → R6VHFWTV.js} +49 -36
  54. package/esm/__chunks/{DXA3K2FY.js → TFBCK4JB.js} +1 -1
  55. package/esm/__chunks/{IOAGNCXX.js → ZV2GEGPL.js} +14 -10
  56. package/esm/checkbox/checkbox-store.d.ts +7 -0
  57. package/esm/checkbox/checkbox-store.js +11 -7
  58. package/esm/collection/collection-store.js +5 -4
  59. package/esm/combobox/combobox-store.d.ts +24 -0
  60. package/esm/combobox/combobox-store.js +34 -33
  61. package/esm/composite/composite-overflow-store.js +6 -5
  62. package/esm/composite/composite-store.d.ts +38 -34
  63. package/esm/composite/composite-store.js +6 -5
  64. package/esm/dialog/dialog-store.js +5 -4
  65. package/esm/disclosure/disclosure-store.d.ts +36 -6
  66. package/esm/disclosure/disclosure-store.js +4 -3
  67. package/esm/form/form-store.js +24 -21
  68. package/esm/hovercard/hovercard-store.js +7 -6
  69. package/esm/index.js +2 -0
  70. package/esm/menu/menu-bar-store.js +15 -11
  71. package/esm/menu/menu-store.js +31 -33
  72. package/esm/popover/popover-store.js +6 -5
  73. package/esm/radio/radio-store.js +22 -21
  74. package/esm/select/select-store.d.ts +16 -0
  75. package/esm/select/select-store.js +29 -29
  76. package/esm/tab/tab-store.d.ts +9 -0
  77. package/esm/tab/tab-store.js +23 -22
  78. package/esm/toolbar/toolbar-store.js +15 -11
  79. package/esm/tooltip/tooltip-store.js +20 -21
  80. package/esm/tsconfig.build.tsbuildinfo +1 -1
  81. package/esm/utils/array.js +1 -0
  82. package/esm/utils/dom.js +2 -1
  83. package/esm/utils/events.js +10 -5
  84. package/esm/utils/focus.js +14 -4
  85. package/esm/utils/misc.js +2 -1
  86. package/esm/utils/platform.js +3 -2
  87. package/esm/utils/store.js +3 -2
  88. package/package.json +1 -1
  89. package/cjs/__chunks/DQHU5K4Q.cjs +0 -57
  90. package/esm/__chunks/6HMPWUDT.js +0 -57
@@ -25,6 +25,10 @@ export interface CompositeStoreState<T extends Item = Item> extends CollectionSt
25
25
  * tabindex](https://www.w3.org/WAI/ARIA/apg/practices/keyboard-interface/#kbd_roving_tabindex).
26
26
  * DOM focus will remain on the composite element while its items receive
27
27
  * virtual focus.
28
+ *
29
+ * Live examples:
30
+ * - [Multi-selectable
31
+ * Combobox](https://ariakit.org/examples/combobox-multiple)
28
32
  * @default false
29
33
  */
30
34
  virtualFocus: boolean;
@@ -32,9 +36,9 @@ export interface CompositeStoreState<T extends Item = Item> extends CollectionSt
32
36
  * Defines the orientation of the composite widget. If the composite has a
33
37
  * single row or column (one-dimensional), the `orientation` value determines
34
38
  * which arrow keys can be used to move focus:
35
- * - `both`: all arrow keys work.
36
- * - `horizontal`: only left and right arrow keys work.
37
- * - `vertical`: only up and down arrow keys work.
39
+ * - `both`: all arrow keys work.
40
+ * - `horizontal`: only left and right arrow keys work.
41
+ * - `vertical`: only up and down arrow keys work.
38
42
  *
39
43
  * It doesn't have any effect on two-dimensional composites.
40
44
  * @default "both"
@@ -52,27 +56,27 @@ export interface CompositeStoreState<T extends Item = Item> extends CollectionSt
52
56
  * composite widget.
53
57
  *
54
58
  * On one-dimensional composites:
55
- * - `true` loops from the last item to the first item and vice-versa.
56
- * - `horizontal` loops only if `orientation` is `horizontal` or not set.
57
- * - `vertical` loops only if `orientation` is `vertical` or not set.
58
- * - If `includesBaseElement` is set to `true` (or `activeId` is initially
59
- * set to `null`), the composite element will be focused in between the
60
- * last and first items.
59
+ * - `true` loops from the last item to the first item and vice-versa.
60
+ * - `horizontal` loops only if `orientation` is `horizontal` or not set.
61
+ * - `vertical` loops only if `orientation` is `vertical` or not set.
62
+ * - If `includesBaseElement` is set to `true` (or `activeId` is initially set
63
+ * to `null`), the composite element will be focused in between the last and
64
+ * first items.
61
65
  *
62
66
  * On two-dimensional composites (when using `CompositeRow`):
63
- * - `true` loops from the last row/column item to the first item in the
64
- * same row/column and vice-versa. If it's the last item in the last row,
65
- * it moves to the first item in the first row and vice-versa.
66
- * - `horizontal` loops only from the last row item to the first item in the
67
- * same row.
68
- * - `vertical` loops only from the last column item to the first item in
69
- * the column row.
70
- * - If `includesBaseElement` is set to `true` (or `activeId` is initially
71
- * set to `null`), vertical loop will have no effect as moving down from
72
- * the last row or up from the first row will focus the composite element.
73
- * - If `focusWrap` matches the value of `focusLoop`, it'll wrap between the
74
- * last item in the last row or column and the first item in the first row
75
- * or column and vice-versa.
67
+ * - `true` loops from the last row/column item to the first item in the same
68
+ * row/column and vice-versa. If it's the last item in the last row, it
69
+ * moves to the first item in the first row and vice-versa.
70
+ * - `horizontal` loops only from the last row item to the first item in the
71
+ * same row.
72
+ * - `vertical` loops only from the last column item to the first item in the
73
+ * column row.
74
+ * - If `includesBaseElement` is set to `true` (or `activeId` is initially set
75
+ * to `null`), vertical loop will have no effect as moving down from the
76
+ * last row or up from the first row will focus the composite element.
77
+ * - If `focusWrap` matches the value of `focusLoop`, it'll wrap between the
78
+ * last item in the last row or column and the first item in the first row
79
+ * or column and vice-versa.
76
80
  * @default false
77
81
  */
78
82
  focusLoop: boolean | Orientation;
@@ -80,12 +84,12 @@ export interface CompositeStoreState<T extends Item = Item> extends CollectionSt
80
84
  * **Works only on two-dimensional composites**. If enabled, moving to the
81
85
  * next item from the last one in a row or column will focus the first item in
82
86
  * the next row or column and vice-versa.
83
- * - `true` wraps between rows and columns.
84
- * - `horizontal` wraps only between rows.
85
- * - `vertical` wraps only between columns.
86
- * - If `focusLoop` matches the value of `focusWrap`, it'll wrap between the
87
- * last item in the last row or column and the first item in the first row
88
- * or column and vice-versa.
87
+ * - `true` wraps between rows and columns.
88
+ * - `horizontal` wraps only between rows.
89
+ * - `vertical` wraps only between columns.
90
+ * - If `focusLoop` matches the value of `focusWrap`, it'll wrap between the
91
+ * last item in the last row or column and the first item in the first row
92
+ * or column and vice-versa.
89
93
  * @default false
90
94
  */
91
95
  focusWrap: boolean | Orientation;
@@ -108,12 +112,12 @@ export interface CompositeStoreState<T extends Item = Item> extends CollectionSt
108
112
  includesBaseElement: boolean;
109
113
  /**
110
114
  * The current focused item `id`.
111
- * - `null` focuses the base composite element and users will be able to
112
- * navigate out of it using arrow keys.
113
- * - If `activeId` is initially set to `null`, the `includesBaseElement`
114
- * prop will also default to `true`, which means the base composite
115
- * element itself will have focus and users will be able to navigate to it
116
- * using arrow keys.
115
+ * - `null` focuses the base composite element and users will be able to
116
+ * navigate out of it using arrow keys.
117
+ * - If `activeId` is initially set to `null`, the `includesBaseElement` prop
118
+ * will also default to `true`, which means the base composite element
119
+ * itself will have focus and users will be able to navigate to it using
120
+ * arrow keys.
117
121
  */
118
122
  activeId: string | null | undefined;
119
123
  }
@@ -1,11 +1,12 @@
1
1
  import {
2
2
  createCompositeStore
3
- } from "../__chunks/X7MJ3FB5.js";
4
- import "../__chunks/WFGVC6LE.js";
5
- import "../__chunks/NA5BK7DD.js";
6
- import "../__chunks/RMD7SNCC.js";
7
- import "../__chunks/UVCATTRC.js";
3
+ } from "../__chunks/R6VHFWTV.js";
4
+ import "../__chunks/EWHSN7GO.js";
5
+ import "../__chunks/BOKMNDR7.js";
6
+ import "../__chunks/NWU4GBZ6.js";
7
+ import "../__chunks/N6JW4ITM.js";
8
8
  import "../__chunks/5XEKIOCW.js";
9
+ import "../__chunks/4BKCJXBM.js";
9
10
  export {
10
11
  createCompositeStore
11
12
  };
@@ -1,9 +1,10 @@
1
1
  import {
2
2
  createDialogStore
3
- } from "../__chunks/4T5RHRE5.js";
4
- import "../__chunks/IOAGNCXX.js";
5
- import "../__chunks/NA5BK7DD.js";
6
- import "../__chunks/RMD7SNCC.js";
3
+ } from "../__chunks/MNNKHNLW.js";
4
+ import "../__chunks/ZV2GEGPL.js";
5
+ import "../__chunks/BOKMNDR7.js";
6
+ import "../__chunks/NWU4GBZ6.js";
7
+ import "../__chunks/4BKCJXBM.js";
7
8
  export {
8
9
  createDialogStore
9
10
  };
@@ -7,6 +7,10 @@ export declare function createDisclosureStore(props?: DisclosureStoreProps): Dis
7
7
  export interface DisclosureStoreState {
8
8
  /**
9
9
  * The visibility state of the content.
10
+ *
11
+ * Live examples:
12
+ * - [Dialog with React
13
+ * Router](https://ariakit.org/examples/dialog-react-router)
10
14
  * @default false
11
15
  */
12
16
  open: boolean;
@@ -15,16 +19,26 @@ export interface DisclosureStoreState {
15
19
  * this will be the same as `open`. Otherwise, it will wait for the animation
16
20
  * to complete before becoming `false` so the content is not unmounted while
17
21
  * animating.
22
+ *
23
+ * Live examples:
24
+ * - [Combobox with links](https://ariakit.org/examples/combobox-links)
25
+ * - [Textarea with inline
26
+ * Combobox](https://ariakit.org/examples/combobox-textarea)
18
27
  */
19
28
  mounted: boolean;
20
29
  /**
21
30
  * Determines whether the content should animate when it is shown or hidden.
22
- * - If `true`, the `animating` state will be `true` when the content is
23
- * shown or hidden and it will wait for `stopAnimation` to be called or a
24
- * CSS animation/transition to end before becoming `false`.
25
- * - If it's set to a number, the `animating` state will be `true` when the
26
- * content is shown or hidden and it will wait for the number of
27
- * milliseconds to pass before becoming `false`.
31
+ * - If `true`, the `animating` state will be `true` when the content is shown
32
+ * or hidden and it will wait for `stopAnimation` to be called or a CSS
33
+ * animation/transition to end before becoming `false`.
34
+ * - If it's set to a number, the `animating` state will be `true` when the
35
+ * content is shown or hidden and it will wait for the number of
36
+ * milliseconds to pass before becoming `false`.
37
+ *
38
+ * Live examples:
39
+ * - [Animated Combobox](https://ariakit.org/examples/combobox-animated)
40
+ * - [Animated Dialog](https://ariakit.org/examples/dialog-animated)
41
+ * - [Animated Select](https://ariakit.org/examples/select-animated)
28
42
  * @default false
29
43
  */
30
44
  animated: boolean | number;
@@ -44,6 +58,12 @@ export interface DisclosureStoreState {
44
58
  export interface DisclosureStoreFunctions {
45
59
  /**
46
60
  * Sets the `open` state.
61
+ *
62
+ * Live examples:
63
+ * - [Textarea with inline
64
+ * Combobox](https://ariakit.org/examples/combobox-textarea)
65
+ * - [Dialog with React
66
+ * Router](https://ariakit.org/examples/dialog-react-router)
47
67
  * @example
48
68
  * store.setOpen(true);
49
69
  * store.setOpen((open) => !open);
@@ -51,10 +71,20 @@ export interface DisclosureStoreFunctions {
51
71
  setOpen: SetState<DisclosureStoreState["open"]>;
52
72
  /**
53
73
  * Sets the `open` state to `true`.
74
+ *
75
+ * Live examples:
76
+ * - [Textarea with inline
77
+ * Combobox](https://ariakit.org/examples/combobox-textarea)
54
78
  */
55
79
  show: () => void;
56
80
  /**
57
81
  * Sets the `open` state to `false`.
82
+ *
83
+ * Live examples:
84
+ * - [Textarea with inline
85
+ * Combobox](https://ariakit.org/examples/combobox-textarea)
86
+ * - [Dialog with React
87
+ * Router](https://ariakit.org/examples/dialog-react-router)
58
88
  */
59
89
  hide: () => void;
60
90
  /**
@@ -1,8 +1,9 @@
1
1
  import {
2
2
  createDisclosureStore
3
- } from "../__chunks/IOAGNCXX.js";
4
- import "../__chunks/NA5BK7DD.js";
5
- import "../__chunks/RMD7SNCC.js";
3
+ } from "../__chunks/ZV2GEGPL.js";
4
+ import "../__chunks/BOKMNDR7.js";
5
+ import "../__chunks/NWU4GBZ6.js";
6
+ import "../__chunks/4BKCJXBM.js";
6
7
  export {
7
8
  createDisclosureStore
8
9
  };
@@ -1,16 +1,20 @@
1
1
  import {
2
2
  createCollectionStore
3
- } from "../__chunks/WFGVC6LE.js";
3
+ } from "../__chunks/EWHSN7GO.js";
4
4
  import {
5
5
  createStore
6
- } from "../__chunks/NA5BK7DD.js";
6
+ } from "../__chunks/BOKMNDR7.js";
7
7
  import {
8
8
  applyState,
9
9
  defaultValue,
10
10
  isInteger,
11
11
  isObject
12
- } from "../__chunks/RMD7SNCC.js";
13
- import "../__chunks/UVCATTRC.js";
12
+ } from "../__chunks/NWU4GBZ6.js";
13
+ import "../__chunks/N6JW4ITM.js";
14
+ import {
15
+ __spreadProps,
16
+ __spreadValues
17
+ } from "../__chunks/4BKCJXBM.js";
14
18
 
15
19
  // src/form/form-store.ts
16
20
  function nextFrame() {
@@ -25,12 +29,13 @@ function hasMessages(object) {
25
29
  });
26
30
  }
27
31
  function get(values, path, defaultValue2) {
32
+ var _a;
28
33
  const [key, ...rest] = Array.isArray(path) ? path : `${path}`.split(".");
29
34
  if (key == null || !values) {
30
35
  return defaultValue2;
31
36
  }
32
37
  if (!rest.length) {
33
- return values[key] ?? defaultValue2;
38
+ return (_a = values[key]) != null ? _a : defaultValue2;
34
39
  }
35
40
  return get(values[key], rest, defaultValue2);
36
41
  }
@@ -56,7 +61,7 @@ function set(values, path, value) {
56
61
  nextValues2[index] = result;
57
62
  return nextValues2;
58
63
  }
59
- return { ...values, [key]: result };
64
+ return __spreadProps(__spreadValues({}, values), { [key]: result });
60
65
  }
61
66
  function setAll(values, value) {
62
67
  const result = {};
@@ -101,37 +106,37 @@ function createNames() {
101
106
  return new Proxy(/* @__PURE__ */ Object.create(null), getNameHandler(cache));
102
107
  }
103
108
  function createFormStore(props = {}) {
104
- const syncState = props.store?.getState();
109
+ var _a;
110
+ const syncState = (_a = props.store) == null ? void 0 : _a.getState();
105
111
  const collection = createCollectionStore(props);
106
112
  const values = defaultValue(
107
113
  props.values,
108
- syncState?.values,
114
+ syncState == null ? void 0 : syncState.values,
109
115
  props.defaultValues,
110
116
  {}
111
117
  );
112
118
  const errors = defaultValue(
113
119
  props.errors,
114
- syncState?.errors,
120
+ syncState == null ? void 0 : syncState.errors,
115
121
  props.defaultErrors,
116
122
  {}
117
123
  );
118
124
  const touched = defaultValue(
119
125
  props.touched,
120
- syncState?.touched,
126
+ syncState == null ? void 0 : syncState.touched,
121
127
  props.defaultTouched,
122
128
  {}
123
129
  );
124
- const initialState = {
125
- ...collection.getState(),
130
+ const initialState = __spreadProps(__spreadValues({}, collection.getState()), {
126
131
  values,
127
132
  errors,
128
133
  touched,
129
- validating: defaultValue(syncState?.validating, false),
130
- submitting: defaultValue(syncState?.submitting, false),
131
- submitSucceed: defaultValue(syncState?.submitSucceed, 0),
132
- submitFailed: defaultValue(syncState?.submitFailed, 0),
134
+ validating: defaultValue(syncState == null ? void 0 : syncState.validating, false),
135
+ submitting: defaultValue(syncState == null ? void 0 : syncState.submitting, false),
136
+ submitSucceed: defaultValue(syncState == null ? void 0 : syncState.submitSucceed, 0),
137
+ submitFailed: defaultValue(syncState == null ? void 0 : syncState.submitFailed, 0),
133
138
  valid: !hasMessages(errors)
134
- };
139
+ });
135
140
  const form = createStore(initialState, collection, props.store);
136
141
  const validateCallbacks = /* @__PURE__ */ new Set();
137
142
  const submitCallbacks = /* @__PURE__ */ new Set();
@@ -148,9 +153,7 @@ function createFormStore(props = {}) {
148
153
  form.setState("validating", false);
149
154
  }
150
155
  };
151
- return {
152
- ...collection,
153
- ...form,
156
+ return __spreadProps(__spreadValues(__spreadValues({}, collection), form), {
154
157
  names: createNames(),
155
158
  setValues: (values2) => form.setState("values", values2),
156
159
  getValue: (name) => get(form.getState().values, name),
@@ -232,7 +235,7 @@ function createFormStore(props = {}) {
232
235
  form.setState("submitSucceed", 0);
233
236
  form.setState("submitFailed", 0);
234
237
  }
235
- };
238
+ });
236
239
  }
237
240
  export {
238
241
  createFormStore,
@@ -1,11 +1,12 @@
1
1
  import {
2
2
  createHovercardStore
3
- } from "../__chunks/6HMPWUDT.js";
4
- import "../__chunks/6PEWNRTN.js";
5
- import "../__chunks/4T5RHRE5.js";
6
- import "../__chunks/IOAGNCXX.js";
7
- import "../__chunks/NA5BK7DD.js";
8
- import "../__chunks/RMD7SNCC.js";
3
+ } from "../__chunks/AHZW5LR4.js";
4
+ import "../__chunks/CUW3E24J.js";
5
+ import "../__chunks/MNNKHNLW.js";
6
+ import "../__chunks/ZV2GEGPL.js";
7
+ import "../__chunks/BOKMNDR7.js";
8
+ import "../__chunks/NWU4GBZ6.js";
9
+ import "../__chunks/4BKCJXBM.js";
9
10
  export {
10
11
  createHovercardStore
11
12
  };
package/esm/index.js CHANGED
@@ -1,3 +1,5 @@
1
+ import "./__chunks/4BKCJXBM.js";
2
+
1
3
  // src/index.ts
2
4
  var src_default = {};
3
5
  export {
@@ -1,26 +1,30 @@
1
1
  import {
2
2
  createCompositeStore
3
- } from "../__chunks/X7MJ3FB5.js";
4
- import "../__chunks/WFGVC6LE.js";
5
- import "../__chunks/NA5BK7DD.js";
3
+ } from "../__chunks/R6VHFWTV.js";
4
+ import "../__chunks/EWHSN7GO.js";
5
+ import "../__chunks/BOKMNDR7.js";
6
6
  import {
7
7
  defaultValue
8
- } from "../__chunks/RMD7SNCC.js";
9
- import "../__chunks/UVCATTRC.js";
8
+ } from "../__chunks/NWU4GBZ6.js";
9
+ import "../__chunks/N6JW4ITM.js";
10
10
  import "../__chunks/5XEKIOCW.js";
11
+ import {
12
+ __spreadProps,
13
+ __spreadValues
14
+ } from "../__chunks/4BKCJXBM.js";
11
15
 
12
16
  // src/menu/menu-bar-store.ts
13
17
  function createMenuBarStore(props = {}) {
14
- const syncState = props.store?.getState();
15
- return createCompositeStore({
16
- ...props,
18
+ var _a;
19
+ const syncState = (_a = props.store) == null ? void 0 : _a.getState();
20
+ return createCompositeStore(__spreadProps(__spreadValues({}, props), {
17
21
  orientation: defaultValue(
18
22
  props.orientation,
19
- syncState?.orientation,
23
+ syncState == null ? void 0 : syncState.orientation,
20
24
  "horizontal"
21
25
  ),
22
- focusLoop: defaultValue(props.focusLoop, syncState?.focusLoop, true)
23
- });
26
+ focusLoop: defaultValue(props.focusLoop, syncState == null ? void 0 : syncState.focusLoop, true)
27
+ }));
24
28
  }
25
29
  export {
26
30
  createMenuBarStore
@@ -1,33 +1,39 @@
1
1
  import {
2
2
  createHovercardStore
3
- } from "../__chunks/6HMPWUDT.js";
4
- import "../__chunks/6PEWNRTN.js";
5
- import "../__chunks/4T5RHRE5.js";
6
- import "../__chunks/IOAGNCXX.js";
3
+ } from "../__chunks/AHZW5LR4.js";
4
+ import "../__chunks/CUW3E24J.js";
5
+ import "../__chunks/MNNKHNLW.js";
6
+ import "../__chunks/ZV2GEGPL.js";
7
7
  import {
8
8
  createCompositeStore
9
- } from "../__chunks/X7MJ3FB5.js";
10
- import "../__chunks/WFGVC6LE.js";
9
+ } from "../__chunks/R6VHFWTV.js";
10
+ import "../__chunks/EWHSN7GO.js";
11
11
  import {
12
12
  createStore,
13
13
  mergeStore
14
- } from "../__chunks/NA5BK7DD.js";
14
+ } from "../__chunks/BOKMNDR7.js";
15
15
  import {
16
16
  applyState,
17
17
  defaultValue
18
- } from "../__chunks/RMD7SNCC.js";
19
- import "../__chunks/UVCATTRC.js";
18
+ } from "../__chunks/NWU4GBZ6.js";
19
+ import "../__chunks/N6JW4ITM.js";
20
20
  import "../__chunks/5XEKIOCW.js";
21
+ import {
22
+ __objRest,
23
+ __spreadProps,
24
+ __spreadValues
25
+ } from "../__chunks/4BKCJXBM.js";
21
26
 
22
27
  // src/menu/menu-store.ts
23
- function createMenuStore({
24
- combobox,
25
- ...props
26
- } = {}) {
28
+ function createMenuStore(_a = {}) {
29
+ var _b = _a, {
30
+ combobox
31
+ } = _b, props = __objRest(_b, [
32
+ "combobox"
33
+ ]);
27
34
  const store = mergeStore(
28
35
  props.store,
29
- combobox?.omit(
30
- "baseElement",
36
+ combobox == null ? void 0 : combobox.omit(
31
37
  "arrowElement",
32
38
  "anchorElement",
33
39
  "contentElement",
@@ -36,17 +42,15 @@ function createMenuStore({
36
42
  )
37
43
  );
38
44
  const syncState = store.getState();
39
- const composite = createCompositeStore({
40
- ...props,
45
+ const composite = createCompositeStore(__spreadProps(__spreadValues({}, props), {
41
46
  store,
42
47
  orientation: defaultValue(
43
48
  props.orientation,
44
49
  syncState.orientation,
45
50
  "vertical"
46
51
  )
47
- });
48
- const hovercard = createHovercardStore({
49
- ...props,
52
+ }));
53
+ const hovercard = createHovercardStore(__spreadProps(__spreadValues({}, props), {
50
54
  store,
51
55
  placement: defaultValue(
52
56
  props.placement,
@@ -54,10 +58,8 @@ function createMenuStore({
54
58
  "bottom-start"
55
59
  ),
56
60
  hideTimeout: defaultValue(props.hideTimeout, syncState.hideTimeout, 0)
57
- });
58
- const initialState = {
59
- ...composite.getState(),
60
- ...hovercard.getState(),
61
+ }));
62
+ const initialState = __spreadProps(__spreadValues(__spreadValues({}, composite.getState()), hovercard.getState()), {
61
63
  initialFocus: defaultValue(syncState.initialFocus, "container"),
62
64
  values: defaultValue(
63
65
  props.values,
@@ -65,7 +67,7 @@ function createMenuStore({
65
67
  props.defaultValues,
66
68
  {}
67
69
  )
68
- };
70
+ });
69
71
  const menu = createStore(initialState, composite, hovercard, store);
70
72
  menu.setup(
71
73
  () => menu.sync(
@@ -77,10 +79,7 @@ function createMenuStore({
77
79
  ["mounted"]
78
80
  )
79
81
  );
80
- return {
81
- ...composite,
82
- ...hovercard,
83
- ...menu,
82
+ return __spreadProps(__spreadValues(__spreadValues(__spreadValues({}, composite), hovercard), menu), {
84
83
  setInitialFocus: (value) => menu.setState("initialFocus", value),
85
84
  setValues: (values) => menu.setState("values", values),
86
85
  setValue: (name, value) => {
@@ -95,13 +94,12 @@ function createMenuStore({
95
94
  const nextValue = applyState(value, prevValue);
96
95
  if (nextValue === prevValue)
97
96
  return values;
98
- return {
99
- ...values,
97
+ return __spreadProps(__spreadValues({}, values), {
100
98
  [name]: nextValue !== void 0 && nextValue
101
- };
99
+ });
102
100
  });
103
101
  }
104
- };
102
+ });
105
103
  }
106
104
  export {
107
105
  createMenuStore
@@ -1,10 +1,11 @@
1
1
  import {
2
2
  createPopoverStore
3
- } from "../__chunks/6PEWNRTN.js";
4
- import "../__chunks/4T5RHRE5.js";
5
- import "../__chunks/IOAGNCXX.js";
6
- import "../__chunks/NA5BK7DD.js";
7
- import "../__chunks/RMD7SNCC.js";
3
+ } from "../__chunks/CUW3E24J.js";
4
+ import "../__chunks/MNNKHNLW.js";
5
+ import "../__chunks/ZV2GEGPL.js";
6
+ import "../__chunks/BOKMNDR7.js";
7
+ import "../__chunks/NWU4GBZ6.js";
8
+ import "../__chunks/4BKCJXBM.js";
8
9
  export {
9
10
  createPopoverStore
10
11
  };
@@ -1,40 +1,41 @@
1
1
  import {
2
2
  createCompositeStore
3
- } from "../__chunks/X7MJ3FB5.js";
4
- import "../__chunks/WFGVC6LE.js";
3
+ } from "../__chunks/R6VHFWTV.js";
4
+ import "../__chunks/EWHSN7GO.js";
5
5
  import {
6
6
  createStore
7
- } from "../__chunks/NA5BK7DD.js";
7
+ } from "../__chunks/BOKMNDR7.js";
8
8
  import {
9
9
  defaultValue
10
- } from "../__chunks/RMD7SNCC.js";
11
- import "../__chunks/UVCATTRC.js";
10
+ } from "../__chunks/NWU4GBZ6.js";
11
+ import "../__chunks/N6JW4ITM.js";
12
12
  import "../__chunks/5XEKIOCW.js";
13
+ import {
14
+ __objRest,
15
+ __spreadProps,
16
+ __spreadValues
17
+ } from "../__chunks/4BKCJXBM.js";
13
18
 
14
19
  // src/radio/radio-store.ts
15
- function createRadioStore({
16
- ...props
17
- } = {}) {
18
- const syncState = props.store?.getState();
19
- const composite = createCompositeStore({
20
- ...props,
21
- focusLoop: defaultValue(props.focusLoop, syncState?.focusLoop, true)
22
- });
23
- const initialState = {
24
- ...composite.getState(),
20
+ function createRadioStore(_a = {}) {
21
+ var props = __objRest(_a, []);
22
+ var _a2;
23
+ const syncState = (_a2 = props.store) == null ? void 0 : _a2.getState();
24
+ const composite = createCompositeStore(__spreadProps(__spreadValues({}, props), {
25
+ focusLoop: defaultValue(props.focusLoop, syncState == null ? void 0 : syncState.focusLoop, true)
26
+ }));
27
+ const initialState = __spreadProps(__spreadValues({}, composite.getState()), {
25
28
  value: defaultValue(
26
29
  props.value,
27
- syncState?.value,
30
+ syncState == null ? void 0 : syncState.value,
28
31
  props.defaultValue,
29
32
  null
30
33
  )
31
- };
34
+ });
32
35
  const radio = createStore(initialState, composite, props.store);
33
- return {
34
- ...composite,
35
- ...radio,
36
+ return __spreadProps(__spreadValues(__spreadValues({}, composite), radio), {
36
37
  setValue: (value) => radio.setState("value", value)
37
- };
38
+ });
38
39
  }
39
40
  export {
40
41
  createRadioStore
@@ -35,6 +35,10 @@ export interface SelectStoreState<T extends Value = Value> extends CompositeStor
35
35
  placement: PopoverStoreState["placement"];
36
36
  /**
37
37
  * The select value.
38
+ *
39
+ * Live examples:
40
+ * - [Multi-selectable
41
+ * Combobox](https://ariakit.org/examples/combobox-multiple)
38
42
  */
39
43
  value: MutableValue<T>;
40
44
  /**
@@ -55,6 +59,10 @@ export interface SelectStoreState<T extends Value = Value> extends CompositeStor
55
59
  export interface SelectStoreFunctions<T extends Value = Value> extends CompositeStoreFunctions<Item>, PopoverStoreFunctions {
56
60
  /**
57
61
  * Sets the `value` state.
62
+ *
63
+ * Live examples:
64
+ * - [Multi-selectable
65
+ * Combobox](https://ariakit.org/examples/combobox-multiple)
58
66
  * @example
59
67
  * store.setValue("Apple");
60
68
  * store.setValue(["Apple", "Banana"]);
@@ -75,10 +83,18 @@ export interface SelectStoreOptions<T extends Value = Value> extends StoreOption
75
83
  * A reference to a combobox store. This is used when combining the combobox
76
84
  * with a select (e.g., select with a search input). The stores will share the
77
85
  * same state.
86
+ *
87
+ * Live examples:
88
+ * - [Multi-selectable
89
+ * Combobox](https://ariakit.org/examples/combobox-multiple)
78
90
  */
79
91
  combobox?: ComboboxStore;
80
92
  /**
81
93
  * The default value. If not set, the first non-disabled item will be used.
94
+ *
95
+ * Live examples:
96
+ * - [Multi-selectable
97
+ * Combobox](https://ariakit.org/examples/combobox-multiple)
82
98
  */
83
99
  defaultValue?: SelectStoreState<T>["value"];
84
100
  }