@ariakit/core 0.2.9 → 0.3.1

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 (66) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/cjs/__chunks/{F5DMXFQ2.cjs → 4L3HCXJY.cjs} +7 -5
  3. package/cjs/__chunks/{OQIG5VE3.cjs → 4OD4ZFRG.cjs} +6 -6
  4. package/cjs/__chunks/{V7OHZPBO.cjs → 52LQV3SV.cjs} +12 -10
  5. package/cjs/__chunks/{FS2K2N7U.cjs → 7GWXP6CQ.cjs} +38 -1
  6. package/cjs/__chunks/{DPHJ32KR.cjs → AIHTEA5D.cjs} +8 -6
  7. package/cjs/__chunks/{PIEJYPN7.cjs → GHET3DES.cjs} +2 -2
  8. package/cjs/__chunks/{MCCIH6SG.cjs → ZRCUNIY2.cjs} +4 -4
  9. package/cjs/checkbox/checkbox-store.cjs +4 -2
  10. package/cjs/collection/collection-store.cjs +3 -3
  11. package/cjs/combobox/combobox-store.cjs +30 -62
  12. package/cjs/combobox/combobox-store.d.ts +1 -15
  13. package/cjs/composite/composite-overflow-store.cjs +5 -5
  14. package/cjs/composite/composite-store.cjs +4 -4
  15. package/cjs/dialog/dialog-store.cjs +4 -4
  16. package/cjs/disclosure/disclosure-store.cjs +3 -3
  17. package/cjs/disclosure/disclosure-store.d.ts +1 -1
  18. package/cjs/form/form-store.cjs +39 -12
  19. package/cjs/hovercard/hovercard-store.cjs +6 -6
  20. package/cjs/menu/menu-bar-store.cjs +4 -4
  21. package/cjs/menu/menu-store.cjs +46 -16
  22. package/cjs/menu/menu-store.d.ts +16 -2
  23. package/cjs/popover/popover-store.cjs +5 -5
  24. package/cjs/popover/popover-store.d.ts +1 -1
  25. package/cjs/radio/radio-store.cjs +5 -5
  26. package/cjs/select/select-store.cjs +20 -18
  27. package/cjs/select/select-store.d.ts +2 -6
  28. package/cjs/tab/tab-store.cjs +15 -15
  29. package/cjs/toolbar/toolbar-store.cjs +4 -4
  30. package/cjs/tooltip/tooltip-store.cjs +7 -7
  31. package/cjs/tsconfig.build.tsbuildinfo +1 -1
  32. package/cjs/utils/store.cjs +4 -2
  33. package/cjs/utils/store.d.ts +12 -10
  34. package/esm/__chunks/{COUCUJML.js → A2JA3CYE.js} +2 -2
  35. package/esm/__chunks/{LNMWV6UV.js → BE4I5ZDQ.js} +1 -1
  36. package/esm/__chunks/{ROY5BBHL.js → BL2LUIIN.js} +2 -2
  37. package/esm/__chunks/{OGOHEUXI.js → DEGIJZ7N.js} +38 -1
  38. package/esm/__chunks/{SOCHV2LZ.js → LTJQMYBN.js} +5 -3
  39. package/esm/__chunks/{WSKDP2MG.js → OZ4NH3RO.js} +4 -2
  40. package/esm/__chunks/{A7IMXABC.js → STQCKYT6.js} +4 -2
  41. package/esm/checkbox/checkbox-store.js +4 -2
  42. package/esm/collection/collection-store.js +2 -2
  43. package/esm/combobox/combobox-store.d.ts +1 -15
  44. package/esm/combobox/combobox-store.js +22 -54
  45. package/esm/composite/composite-overflow-store.js +4 -4
  46. package/esm/composite/composite-store.js +3 -3
  47. package/esm/dialog/dialog-store.js +3 -3
  48. package/esm/disclosure/disclosure-store.d.ts +1 -1
  49. package/esm/disclosure/disclosure-store.js +2 -2
  50. package/esm/form/form-store.js +38 -11
  51. package/esm/hovercard/hovercard-store.js +5 -5
  52. package/esm/menu/menu-bar-store.js +3 -3
  53. package/esm/menu/menu-store.d.ts +16 -2
  54. package/esm/menu/menu-store.js +40 -10
  55. package/esm/popover/popover-store.d.ts +1 -1
  56. package/esm/popover/popover-store.js +4 -4
  57. package/esm/radio/radio-store.js +3 -3
  58. package/esm/select/select-store.d.ts +2 -6
  59. package/esm/select/select-store.js +10 -8
  60. package/esm/tab/tab-store.js +3 -3
  61. package/esm/toolbar/toolbar-store.js +3 -3
  62. package/esm/tooltip/tooltip-store.js +5 -5
  63. package/esm/tsconfig.build.tsbuildinfo +1 -1
  64. package/esm/utils/store.d.ts +12 -10
  65. package/esm/utils/store.js +5 -3
  66. package/package.json +1 -1
@@ -1,20 +1,19 @@
1
1
  import {
2
2
  createPopoverStore
3
- } from "../__chunks/SOCHV2LZ.js";
4
- import "../__chunks/LNMWV6UV.js";
5
- import "../__chunks/WSKDP2MG.js";
3
+ } from "../__chunks/LTJQMYBN.js";
4
+ import "../__chunks/BE4I5ZDQ.js";
5
+ import "../__chunks/OZ4NH3RO.js";
6
6
  import {
7
7
  createCompositeStore
8
- } from "../__chunks/ROY5BBHL.js";
9
- import "../__chunks/A7IMXABC.js";
8
+ } from "../__chunks/BL2LUIIN.js";
9
+ import "../__chunks/STQCKYT6.js";
10
10
  import {
11
11
  batch,
12
12
  createStore,
13
- mergeStore,
14
- omit,
15
13
  setup,
16
- sync
17
- } from "../__chunks/OGOHEUXI.js";
14
+ sync,
15
+ throwOnConflictingProps
16
+ } from "../__chunks/DEGIJZ7N.js";
18
17
  import {
19
18
  defaultValue
20
19
  } from "../__chunks/WVTCK5PV.js";
@@ -25,66 +24,36 @@ import {
25
24
  import "../__chunks/O35LWD4W.js";
26
25
  import "../__chunks/5XEKIOCW.js";
27
26
  import {
28
- __objRest,
29
27
  __spreadProps,
30
28
  __spreadValues
31
29
  } from "../__chunks/PNRLI7OV.js";
32
30
 
33
31
  // src/combobox/combobox-store.ts
34
32
  var isSafariOnMobile = isSafari() && isTouchDevice();
35
- function createComboboxStore(_a = {}) {
36
- var _b = _a, {
37
- menu,
38
- select
39
- } = _b, props = __objRest(_b, [
40
- "menu",
41
- "select"
42
- ]);
43
- const store = mergeStore(
44
- props.store,
45
- omit(menu, [
46
- "baseElement",
47
- "arrowElement",
48
- "anchorElement",
49
- "contentElement",
50
- "popoverElement",
51
- "disclosureElement",
52
- "anchorElement"
53
- ]),
54
- omit(select, [
55
- "value",
56
- "items",
57
- "renderedItems",
58
- "baseElement",
59
- "arrowElement",
60
- "anchorElement",
61
- "contentElement",
62
- "popoverElement",
63
- "disclosureElement"
64
- ])
65
- );
66
- const syncState = store.getState();
33
+ function createComboboxStore(props = {}) {
34
+ var _a;
35
+ throwOnConflictingProps(props, props.store);
36
+ const syncState = (_a = props.store) == null ? void 0 : _a.getState();
67
37
  const activeId = defaultValue(
68
38
  props.activeId,
69
- syncState.activeId,
39
+ syncState == null ? void 0 : syncState.activeId,
70
40
  props.defaultActiveId,
71
41
  null
72
42
  );
73
43
  const composite = createCompositeStore(__spreadProps(__spreadValues({}, props), {
74
- store,
75
44
  activeId,
76
45
  includesBaseElement: defaultValue(
77
46
  props.includesBaseElement,
78
- syncState.includesBaseElement,
47
+ syncState == null ? void 0 : syncState.includesBaseElement,
79
48
  true
80
49
  ),
81
50
  orientation: defaultValue(
82
51
  props.orientation,
83
- syncState.orientation,
52
+ syncState == null ? void 0 : syncState.orientation,
84
53
  "vertical"
85
54
  ),
86
- focusLoop: defaultValue(props.focusLoop, syncState.focusLoop, true),
87
- focusWrap: defaultValue(props.focusWrap, syncState.focusWrap, true),
55
+ focusLoop: defaultValue(props.focusLoop, syncState == null ? void 0 : syncState.focusLoop, true),
56
+ focusWrap: defaultValue(props.focusWrap, syncState == null ? void 0 : syncState.focusWrap, true),
88
57
  virtualFocus: defaultValue(
89
58
  props.virtualFocus,
90
59
  syncState == null ? void 0 : syncState.virtualFocus,
@@ -92,16 +61,15 @@ function createComboboxStore(_a = {}) {
92
61
  )
93
62
  }));
94
63
  const popover = createPopoverStore(__spreadProps(__spreadValues({}, props), {
95
- store,
96
64
  placement: defaultValue(
97
65
  props.placement,
98
- syncState.placement,
66
+ syncState == null ? void 0 : syncState.placement,
99
67
  "bottom-start"
100
68
  )
101
69
  }));
102
70
  const initialValue = defaultValue(
103
71
  props.value,
104
- syncState.value,
72
+ syncState == null ? void 0 : syncState.value,
105
73
  props.defaultValue,
106
74
  ""
107
75
  );
@@ -109,12 +77,12 @@ function createComboboxStore(_a = {}) {
109
77
  value: initialValue,
110
78
  resetValueOnHide: defaultValue(
111
79
  props.resetValueOnHide,
112
- syncState.resetValueOnHide,
80
+ syncState == null ? void 0 : syncState.resetValueOnHide,
113
81
  false
114
82
  ),
115
- activeValue: syncState.activeValue
83
+ activeValue: syncState == null ? void 0 : syncState.activeValue
116
84
  });
117
- const combobox = createStore(initialState, composite, popover, store);
85
+ const combobox = createStore(initialState, composite, popover, props.store);
118
86
  setup(
119
87
  combobox,
120
88
  () => sync(combobox, ["resetValueOnHide", "mounted"], (state) => {
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  createPopoverStore
3
- } from "../__chunks/SOCHV2LZ.js";
4
- import "../__chunks/LNMWV6UV.js";
5
- import "../__chunks/WSKDP2MG.js";
6
- import "../__chunks/OGOHEUXI.js";
3
+ } from "../__chunks/LTJQMYBN.js";
4
+ import "../__chunks/BE4I5ZDQ.js";
5
+ import "../__chunks/OZ4NH3RO.js";
6
+ import "../__chunks/DEGIJZ7N.js";
7
7
  import "../__chunks/WVTCK5PV.js";
8
8
  import "../__chunks/PNRLI7OV.js";
9
9
 
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  createCompositeStore
3
- } from "../__chunks/ROY5BBHL.js";
4
- import "../__chunks/A7IMXABC.js";
5
- import "../__chunks/OGOHEUXI.js";
3
+ } from "../__chunks/BL2LUIIN.js";
4
+ import "../__chunks/STQCKYT6.js";
5
+ import "../__chunks/DEGIJZ7N.js";
6
6
  import "../__chunks/WVTCK5PV.js";
7
7
  import "../__chunks/O35LWD4W.js";
8
8
  import "../__chunks/5XEKIOCW.js";
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  createDialogStore
3
- } from "../__chunks/LNMWV6UV.js";
4
- import "../__chunks/WSKDP2MG.js";
5
- import "../__chunks/OGOHEUXI.js";
3
+ } from "../__chunks/BE4I5ZDQ.js";
4
+ import "../__chunks/OZ4NH3RO.js";
5
+ import "../__chunks/DEGIJZ7N.js";
6
6
  import "../__chunks/WVTCK5PV.js";
7
7
  import "../__chunks/PNRLI7OV.js";
8
8
  export {
@@ -118,7 +118,7 @@ export interface DisclosureStoreOptions extends StoreOptions<DisclosureStoreStat
118
118
  * `disclosureElement` won't be synced. For that, use the `store` prop
119
119
  * instead.
120
120
  */
121
- disclosure?: DisclosureStore;
121
+ disclosure?: DisclosureStore | null;
122
122
  }
123
123
  export type DisclosureStoreProps = DisclosureStoreOptions & StoreProps<DisclosureStoreState>;
124
124
  export type DisclosureStore = DisclosureStoreFunctions & Store<DisclosureStoreState>;
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  createDisclosureStore
3
- } from "../__chunks/WSKDP2MG.js";
4
- import "../__chunks/OGOHEUXI.js";
3
+ } from "../__chunks/OZ4NH3RO.js";
4
+ import "../__chunks/DEGIJZ7N.js";
5
5
  import "../__chunks/WVTCK5PV.js";
6
6
  import "../__chunks/PNRLI7OV.js";
7
7
  export {
@@ -1,9 +1,12 @@
1
1
  import {
2
2
  createCollectionStore
3
- } from "../__chunks/A7IMXABC.js";
3
+ } from "../__chunks/STQCKYT6.js";
4
4
  import {
5
- createStore
6
- } from "../__chunks/OGOHEUXI.js";
5
+ createStore,
6
+ init,
7
+ setup,
8
+ throwOnConflictingProps
9
+ } from "../__chunks/DEGIJZ7N.js";
7
10
  import {
8
11
  applyState,
9
12
  defaultValue,
@@ -50,7 +53,7 @@ function set(values, path, value) {
50
53
  const result = rest.length && (Array.isArray(nestedValues) || isObject(nestedValues)) ? set(nestedValues, rest, value) : value;
51
54
  if (isIntegerKey) {
52
55
  const index = Number(key);
53
- if (values) {
56
+ if (values && Array.isArray(values)) {
54
57
  return [
55
58
  ...values.slice(0, index),
56
59
  result,
@@ -101,12 +104,16 @@ function getNameHandler(cache, prevKeys = []) {
101
104
  };
102
105
  return handler;
103
106
  }
107
+ function getStoreCallbacks(store) {
108
+ return store == null ? void 0 : store.__unstableCallbacks;
109
+ }
104
110
  function createNames() {
105
111
  const cache = /* @__PURE__ */ Object.create(null);
106
112
  return new Proxy(/* @__PURE__ */ Object.create(null), getNameHandler(cache));
107
113
  }
108
114
  function createFormStore(props = {}) {
109
115
  var _a;
116
+ throwOnConflictingProps(props, props.store);
110
117
  const syncState = (_a = props.store) == null ? void 0 : _a.getState();
111
118
  const collection = createCollectionStore(props);
112
119
  const values = defaultValue(
@@ -138,11 +145,18 @@ function createFormStore(props = {}) {
138
145
  valid: !hasMessages(errors)
139
146
  });
140
147
  const form = createStore(initialState, collection, props.store);
141
- const validateCallbacks = /* @__PURE__ */ new Set();
142
- const submitCallbacks = /* @__PURE__ */ new Set();
148
+ const syncCallbacks = getStoreCallbacks(props.store);
149
+ const syncCallbacksState = syncCallbacks == null ? void 0 : syncCallbacks.getState();
150
+ const callbacksInitialState = {
151
+ validate: (syncCallbacksState == null ? void 0 : syncCallbacksState.validate) || [],
152
+ submit: (syncCallbacksState == null ? void 0 : syncCallbacksState.submit) || []
153
+ };
154
+ const callbacks = createStore(callbacksInitialState, syncCallbacks);
155
+ setup(form, () => init(callbacks));
143
156
  const validate = async () => {
144
157
  form.setState("validating", true);
145
158
  form.setState("errors", {});
159
+ const validateCallbacks = callbacks.getState().validate;
146
160
  try {
147
161
  for (const callback of validateCallbacks) {
148
162
  await callback(form.getState());
@@ -195,19 +209,30 @@ function createFormStore(props = {}) {
195
209
  return set(touched2, name, nextValue);
196
210
  }),
197
211
  onValidate: (callback) => {
198
- validateCallbacks.add(callback);
199
- return () => validateCallbacks.delete(callback);
212
+ callbacks.setState("validate", (callbacks2) => [...callbacks2, callback]);
213
+ return () => {
214
+ callbacks.setState(
215
+ "validate",
216
+ (callbacks2) => callbacks2.filter((c) => c !== callback)
217
+ );
218
+ };
200
219
  },
201
220
  validate,
202
221
  onSubmit: (callback) => {
203
- submitCallbacks.add(callback);
204
- return () => submitCallbacks.delete(callback);
222
+ callbacks.setState("submit", (callbacks2) => [...callbacks2, callback]);
223
+ return () => {
224
+ callbacks.setState(
225
+ "submit",
226
+ (callbacks2) => callbacks2.filter((c) => c !== callback)
227
+ );
228
+ };
205
229
  },
206
230
  submit: async () => {
207
231
  form.setState("submitting", true);
208
232
  form.setState("touched", setAll(form.getState().values, true));
209
233
  try {
210
234
  if (await validate()) {
235
+ const submitCallbacks = callbacks.getState().submit;
211
236
  for (const callback of submitCallbacks) {
212
237
  await callback(form.getState());
213
238
  }
@@ -234,7 +259,9 @@ function createFormStore(props = {}) {
234
259
  form.setState("submitting", false);
235
260
  form.setState("submitSucceed", 0);
236
261
  form.setState("submitFailed", 0);
237
- }
262
+ },
263
+ // @ts-expect-error Internal
264
+ __unstableCallbacks: callbacks
238
265
  });
239
266
  }
240
267
  export {
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  createHovercardStore
3
- } from "../__chunks/COUCUJML.js";
4
- import "../__chunks/SOCHV2LZ.js";
5
- import "../__chunks/LNMWV6UV.js";
6
- import "../__chunks/WSKDP2MG.js";
7
- import "../__chunks/OGOHEUXI.js";
3
+ } from "../__chunks/A2JA3CYE.js";
4
+ import "../__chunks/LTJQMYBN.js";
5
+ import "../__chunks/BE4I5ZDQ.js";
6
+ import "../__chunks/OZ4NH3RO.js";
7
+ import "../__chunks/DEGIJZ7N.js";
8
8
  import "../__chunks/WVTCK5PV.js";
9
9
  import "../__chunks/PNRLI7OV.js";
10
10
  export {
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  createCompositeStore
3
- } from "../__chunks/ROY5BBHL.js";
4
- import "../__chunks/A7IMXABC.js";
5
- import "../__chunks/OGOHEUXI.js";
3
+ } from "../__chunks/BL2LUIIN.js";
4
+ import "../__chunks/STQCKYT6.js";
5
+ import "../__chunks/DEGIJZ7N.js";
6
6
  import {
7
7
  defaultValue
8
8
  } from "../__chunks/WVTCK5PV.js";
@@ -3,6 +3,7 @@ import type { CompositeStoreFunctions, CompositeStoreOptions, CompositeStoreStat
3
3
  import type { HovercardStoreFunctions, HovercardStoreOptions, HovercardStoreState } from "../hovercard/hovercard-store.js";
4
4
  import type { Store, StoreOptions, StoreProps } from "../utils/store.js";
5
5
  import type { BivariantCallback, PickRequired, SetState, SetStateAction } from "../utils/types.js";
6
+ import type { MenuBarStore } from "./menu-bar-store.js";
6
7
  type Values = Record<string, string | boolean | number | Array<string | number>>;
7
8
  export declare function createMenuStore<T extends Values = Values>(props: PickRequired<MenuStoreProps<T>, "values" | "defaultValues">): MenuStore<T>;
8
9
  export declare function createMenuStore(props?: MenuStoreProps): MenuStore;
@@ -24,7 +25,11 @@ export interface MenuStoreState<T extends Values = Values> extends CompositeStor
24
25
  /** @default 0 */
25
26
  hideTimeout?: HovercardStoreState["hideTimeout"];
26
27
  }
27
- export interface MenuStoreFunctions<T extends Values = Values> extends CompositeStoreFunctions, HovercardStoreFunctions {
28
+ export interface MenuStoreFunctions<T extends Values = Values> extends Pick<MenuStoreOptions, "combobox" | "parent" | "menubar">, CompositeStoreFunctions, HovercardStoreFunctions {
29
+ /**
30
+ * Hides the menu and all its parent menus.
31
+ */
32
+ hideAll: () => void;
28
33
  /**
29
34
  * Sets the `initialFocus` state.
30
35
  */
@@ -52,7 +57,16 @@ export interface MenuStoreOptions<T extends Values = Values> extends StoreOption
52
57
  * with a menu (e.g., dropdown menu with a search input). The stores will
53
58
  * share the same state.
54
59
  */
55
- combobox?: ComboboxStore;
60
+ combobox?: ComboboxStore | null;
61
+ /**
62
+ * A reference to a parent menu store. This should be used on nested menus.
63
+ */
64
+ parent?: MenuStore | null;
65
+ /**
66
+ * A reference to a menu bar store. This should be used when rendering menus
67
+ * inside a menu bar.
68
+ */
69
+ menubar?: MenuBarStore | null;
56
70
  /**
57
71
  * The default values for the `values` state.
58
72
  * @default {}
@@ -1,20 +1,22 @@
1
1
  import {
2
2
  createHovercardStore
3
- } from "../__chunks/COUCUJML.js";
4
- import "../__chunks/SOCHV2LZ.js";
5
- import "../__chunks/LNMWV6UV.js";
6
- import "../__chunks/WSKDP2MG.js";
3
+ } from "../__chunks/A2JA3CYE.js";
4
+ import "../__chunks/LTJQMYBN.js";
5
+ import "../__chunks/BE4I5ZDQ.js";
6
+ import "../__chunks/OZ4NH3RO.js";
7
7
  import {
8
8
  createCompositeStore
9
- } from "../__chunks/ROY5BBHL.js";
10
- import "../__chunks/A7IMXABC.js";
9
+ } from "../__chunks/BL2LUIIN.js";
10
+ import "../__chunks/STQCKYT6.js";
11
11
  import {
12
12
  createStore,
13
13
  mergeStore,
14
14
  omit,
15
+ pick,
15
16
  setup,
16
- sync
17
- } from "../__chunks/OGOHEUXI.js";
17
+ sync,
18
+ throwOnConflictingProps
19
+ } from "../__chunks/DEGIJZ7N.js";
18
20
  import {
19
21
  applyState,
20
22
  defaultValue
@@ -30,12 +32,18 @@ import {
30
32
  // src/menu/menu-store.ts
31
33
  function createMenuStore(_a = {}) {
32
34
  var _b = _a, {
33
- combobox
35
+ combobox,
36
+ parent,
37
+ menubar
34
38
  } = _b, props = __objRest(_b, [
35
- "combobox"
39
+ "combobox",
40
+ "parent",
41
+ "menubar"
36
42
  ]);
43
+ const parentIsMenubar = !!menubar && !parent;
37
44
  const store = mergeStore(
38
45
  props.store,
46
+ pick(parent, ["values"]),
39
47
  omit(combobox, [
40
48
  "arrowElement",
41
49
  "anchorElement",
@@ -44,6 +52,7 @@ function createMenuStore(_a = {}) {
44
52
  "disclosureElement"
45
53
  ])
46
54
  );
55
+ throwOnConflictingProps(props, store);
47
56
  const syncState = store.getState();
48
57
  const composite = createCompositeStore(__spreadProps(__spreadValues({}, props), {
49
58
  store,
@@ -60,6 +69,11 @@ function createMenuStore(_a = {}) {
60
69
  syncState.placement,
61
70
  "bottom-start"
62
71
  ),
72
+ timeout: defaultValue(
73
+ props.timeout,
74
+ syncState.timeout,
75
+ parentIsMenubar ? 0 : 150
76
+ ),
63
77
  hideTimeout: defaultValue(props.hideTimeout, syncState.hideTimeout, 0)
64
78
  }));
65
79
  const initialState = __spreadProps(__spreadValues(__spreadValues({}, composite.getState()), hovercard.getState()), {
@@ -80,7 +94,23 @@ function createMenuStore(_a = {}) {
80
94
  menu.setState("activeId", null);
81
95
  })
82
96
  );
97
+ setup(
98
+ menu,
99
+ () => sync(parent, ["orientation"], (state) => {
100
+ menu.setState(
101
+ "placement",
102
+ state.orientation === "vertical" ? "right-start" : "bottom-start"
103
+ );
104
+ })
105
+ );
83
106
  return __spreadProps(__spreadValues(__spreadValues(__spreadValues({}, composite), hovercard), menu), {
107
+ combobox,
108
+ parent,
109
+ menubar,
110
+ hideAll: () => {
111
+ hovercard.hide();
112
+ parent == null ? void 0 : parent.hideAll();
113
+ },
84
114
  setInitialFocus: (value) => menu.setState("initialFocus", value),
85
115
  setValues: (values) => menu.setState("values", values),
86
116
  setValue: (name, value) => {
@@ -62,7 +62,7 @@ export interface PopoverStoreOptions extends StoreOptions<PopoverStoreState, "pl
62
62
  * A reference to another popover store that's controlling another popover to
63
63
  * keep them in sync.
64
64
  */
65
- popover?: PopoverStore;
65
+ popover?: PopoverStore | null;
66
66
  }
67
67
  export type PopoverStoreProps = PopoverStoreOptions & StoreProps<PopoverStoreState>;
68
68
  export type PopoverStore = PopoverStoreFunctions & Store<PopoverStoreState>;
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  createPopoverStore
3
- } from "../__chunks/SOCHV2LZ.js";
4
- import "../__chunks/LNMWV6UV.js";
5
- import "../__chunks/WSKDP2MG.js";
6
- import "../__chunks/OGOHEUXI.js";
3
+ } from "../__chunks/LTJQMYBN.js";
4
+ import "../__chunks/BE4I5ZDQ.js";
5
+ import "../__chunks/OZ4NH3RO.js";
6
+ import "../__chunks/DEGIJZ7N.js";
7
7
  import "../__chunks/WVTCK5PV.js";
8
8
  import "../__chunks/PNRLI7OV.js";
9
9
  export {
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  createCompositeStore
3
- } from "../__chunks/ROY5BBHL.js";
4
- import "../__chunks/A7IMXABC.js";
3
+ } from "../__chunks/BL2LUIIN.js";
4
+ import "../__chunks/STQCKYT6.js";
5
5
  import {
6
6
  createStore
7
- } from "../__chunks/OGOHEUXI.js";
7
+ } from "../__chunks/DEGIJZ7N.js";
8
8
  import {
9
9
  defaultValue
10
10
  } from "../__chunks/WVTCK5PV.js";
@@ -23,10 +23,6 @@ export interface SelectStoreState<T extends Value = Value> extends CompositeStor
23
23
  orientation: CompositeStoreState<Item>["orientation"];
24
24
  /** @default "bottom-start" */
25
25
  placement: PopoverStoreState["placement"];
26
- /**
27
- * Whether the select store has received a combobox prop.
28
- */
29
- combobox: boolean;
30
26
  /**
31
27
  * The select value.
32
28
  *
@@ -50,7 +46,7 @@ export interface SelectStoreState<T extends Value = Value> extends CompositeStor
50
46
  */
51
47
  labelElement: HTMLElement | null;
52
48
  }
53
- export interface SelectStoreFunctions<T extends Value = Value> extends CompositeStoreFunctions<Item>, PopoverStoreFunctions {
49
+ export interface SelectStoreFunctions<T extends Value = Value> extends Pick<SelectStoreOptions<T>, "combobox">, CompositeStoreFunctions<Item>, PopoverStoreFunctions {
54
50
  /**
55
51
  * Sets the `value` state.
56
52
  *
@@ -82,7 +78,7 @@ export interface SelectStoreOptions<T extends Value = Value> extends StoreOption
82
78
  * - [Multi-selectable
83
79
  * Combobox](https://ariakit.org/examples/combobox-multiple)
84
80
  */
85
- combobox?: ComboboxStore;
81
+ combobox?: ComboboxStore | null;
86
82
  /**
87
83
  * The default value. If not set, the first non-disabled item will be used.
88
84
  *
@@ -1,20 +1,21 @@
1
1
  import {
2
2
  createPopoverStore
3
- } from "../__chunks/SOCHV2LZ.js";
4
- import "../__chunks/LNMWV6UV.js";
5
- import "../__chunks/WSKDP2MG.js";
3
+ } from "../__chunks/LTJQMYBN.js";
4
+ import "../__chunks/BE4I5ZDQ.js";
5
+ import "../__chunks/OZ4NH3RO.js";
6
6
  import {
7
7
  createCompositeStore
8
- } from "../__chunks/ROY5BBHL.js";
9
- import "../__chunks/A7IMXABC.js";
8
+ } from "../__chunks/BL2LUIIN.js";
9
+ import "../__chunks/STQCKYT6.js";
10
10
  import {
11
11
  batch,
12
12
  createStore,
13
13
  mergeStore,
14
14
  omit,
15
15
  setup,
16
- sync
17
- } from "../__chunks/OGOHEUXI.js";
16
+ sync,
17
+ throwOnConflictingProps
18
+ } from "../__chunks/DEGIJZ7N.js";
18
19
  import {
19
20
  defaultValue
20
21
  } from "../__chunks/WVTCK5PV.js";
@@ -49,6 +50,7 @@ function createSelectStore(_a = {}) {
49
50
  "disclosureElement"
50
51
  ])
51
52
  );
53
+ throwOnConflictingProps(props, store);
52
54
  const syncState = store.getState();
53
55
  const composite = createCompositeStore(__spreadProps(__spreadValues({}, props), {
54
56
  store,
@@ -84,7 +86,6 @@ function createSelectStore(_a = {}) {
84
86
  }));
85
87
  const initialValue = new String("");
86
88
  const initialState = __spreadProps(__spreadValues(__spreadValues({}, composite.getState()), popover.getState()), {
87
- combobox: defaultValue(syncState.combobox, !!combobox),
88
89
  value: defaultValue(
89
90
  props.value,
90
91
  syncState.value,
@@ -153,6 +154,7 @@ function createSelectStore(_a = {}) {
153
154
  })
154
155
  );
155
156
  return __spreadProps(__spreadValues(__spreadValues(__spreadValues({}, composite), popover), select), {
157
+ combobox,
156
158
  setValue: (value) => select.setState("value", value),
157
159
  setSelectElement: (element) => select.setState("selectElement", element),
158
160
  setLabelElement: (element) => select.setState("labelElement", element)
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  createCompositeStore
3
- } from "../__chunks/ROY5BBHL.js";
3
+ } from "../__chunks/BL2LUIIN.js";
4
4
  import {
5
5
  createCollectionStore
6
- } from "../__chunks/A7IMXABC.js";
6
+ } from "../__chunks/STQCKYT6.js";
7
7
  import {
8
8
  batch,
9
9
  createStore,
10
10
  setup,
11
11
  sync
12
- } from "../__chunks/OGOHEUXI.js";
12
+ } from "../__chunks/DEGIJZ7N.js";
13
13
  import {
14
14
  defaultValue
15
15
  } from "../__chunks/WVTCK5PV.js";
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  createCompositeStore
3
- } from "../__chunks/ROY5BBHL.js";
4
- import "../__chunks/A7IMXABC.js";
5
- import "../__chunks/OGOHEUXI.js";
3
+ } from "../__chunks/BL2LUIIN.js";
4
+ import "../__chunks/STQCKYT6.js";
5
+ import "../__chunks/DEGIJZ7N.js";
6
6
  import {
7
7
  defaultValue
8
8
  } from "../__chunks/WVTCK5PV.js";
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  createHovercardStore
3
- } from "../__chunks/COUCUJML.js";
4
- import "../__chunks/SOCHV2LZ.js";
5
- import "../__chunks/LNMWV6UV.js";
6
- import "../__chunks/WSKDP2MG.js";
3
+ } from "../__chunks/A2JA3CYE.js";
4
+ import "../__chunks/LTJQMYBN.js";
5
+ import "../__chunks/BE4I5ZDQ.js";
6
+ import "../__chunks/OZ4NH3RO.js";
7
7
  import {
8
8
  createStore
9
- } from "../__chunks/OGOHEUXI.js";
9
+ } from "../__chunks/DEGIJZ7N.js";
10
10
  import {
11
11
  defaultValue
12
12
  } from "../__chunks/WVTCK5PV.js";