@ariakit/core 0.3.5 → 0.3.7

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 (98) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/cjs/__chunks/{FJSZTIOU.cjs → 46BH65MC.cjs} +4 -6
  3. package/cjs/__chunks/{FTB5CXVB.cjs → 5F4DVUNS.cjs} +7 -1
  4. package/cjs/__chunks/{AR2VJ37F.cjs → 6WBY3ZZM.cjs} +6 -6
  5. package/cjs/__chunks/{HOEZKRUM.cjs → 7ZUFMSXJ.cjs} +7 -7
  6. package/cjs/__chunks/{F5YZIIEA.cjs → GXIZMD53.cjs} +8 -2
  7. package/cjs/__chunks/{MYTMMWXI.cjs → GZDVJEID.cjs} +2 -2
  8. package/cjs/__chunks/{FFY2GSOG.cjs → JLC5A6WF.cjs} +8 -8
  9. package/cjs/__chunks/{F6Q5QSXF.cjs → MEHGRTJ3.cjs} +11 -11
  10. package/cjs/__chunks/{XVR5QRC3.cjs → PD7XZBXC.cjs} +4 -4
  11. package/cjs/__chunks/{G5EW4WED.cjs → YIUPKKEK.cjs} +6 -6
  12. package/cjs/checkbox/checkbox-store.cjs +3 -3
  13. package/cjs/collection/collection-store.cjs +4 -4
  14. package/cjs/collection/collection-store.d.cts +6 -4
  15. package/cjs/collection/collection-store.d.ts +6 -4
  16. package/cjs/combobox/combobox-store.cjs +48 -26
  17. package/cjs/combobox/combobox-store.d.cts +69 -21
  18. package/cjs/combobox/combobox-store.d.ts +69 -21
  19. package/cjs/composite/composite-overflow-store.cjs +5 -5
  20. package/cjs/composite/composite-store.cjs +5 -5
  21. package/cjs/composite/composite-store.d.cts +6 -8
  22. package/cjs/composite/composite-store.d.ts +6 -8
  23. package/cjs/dialog/dialog-store.cjs +4 -4
  24. package/cjs/disclosure/disclosure-store.cjs +3 -3
  25. package/cjs/disclosure/disclosure-store.d.cts +2 -0
  26. package/cjs/disclosure/disclosure-store.d.ts +2 -0
  27. package/cjs/form/form-store.cjs +8 -8
  28. package/cjs/hovercard/hovercard-store.cjs +6 -6
  29. package/cjs/hovercard/hovercard-store.d.cts +6 -0
  30. package/cjs/hovercard/hovercard-store.d.ts +6 -0
  31. package/cjs/menu/menu-bar-store.cjs +6 -6
  32. package/cjs/menu/menu-store.cjs +19 -19
  33. package/cjs/menubar/menubar-store.cjs +6 -6
  34. package/cjs/menubar/menubar-store.d.cts +12 -6
  35. package/cjs/menubar/menubar-store.d.ts +12 -6
  36. package/cjs/popover/popover-store.cjs +5 -5
  37. package/cjs/popover/popover-store.d.cts +3 -0
  38. package/cjs/popover/popover-store.d.ts +3 -0
  39. package/cjs/radio/radio-store.cjs +6 -6
  40. package/cjs/select/select-store.cjs +19 -19
  41. package/cjs/select/select-store.d.cts +28 -18
  42. package/cjs/select/select-store.d.ts +28 -18
  43. package/cjs/tab/tab-store.cjs +16 -16
  44. package/cjs/toolbar/toolbar-store.cjs +5 -5
  45. package/cjs/tooltip/tooltip-store.cjs +7 -7
  46. package/cjs/utils/dom.cjs +4 -2
  47. package/cjs/utils/dom.d.cts +9 -0
  48. package/cjs/utils/dom.d.ts +9 -0
  49. package/cjs/utils/events.cjs +5 -5
  50. package/cjs/utils/focus.cjs +13 -13
  51. package/cjs/utils/platform.cjs +3 -3
  52. package/cjs/utils/store.cjs +2 -2
  53. package/cjs/utils/store.d.cts +3 -0
  54. package/cjs/utils/store.d.ts +3 -0
  55. package/esm/__chunks/{6LSGADQM.js → ANO6WJO4.js} +8 -2
  56. package/esm/__chunks/{EIFVU736.js → BXH3I7ML.js} +2 -2
  57. package/esm/__chunks/{6EMNXRG3.js → CCU5UHQ2.js} +2 -2
  58. package/esm/__chunks/{DREIYIMP.js → CL47ZAPY.js} +1 -1
  59. package/esm/__chunks/{NIF7E7VE.js → DLOEKDPY.js} +7 -1
  60. package/esm/__chunks/{PCA5ARZU.js → DYD4YNLE.js} +1 -1
  61. package/esm/__chunks/{HJS6GJT4.js → E7OQVGGY.js} +4 -6
  62. package/esm/__chunks/{5UJPJ37G.js → MHPO2BXA.js} +1 -1
  63. package/esm/__chunks/{5BWT4GY2.js → OGMLJYDV.js} +2 -2
  64. package/esm/__chunks/{MRBDYBGO.js → WY3EMTH6.js} +2 -2
  65. package/esm/checkbox/checkbox-store.js +1 -1
  66. package/esm/collection/collection-store.d.ts +6 -4
  67. package/esm/collection/collection-store.js +3 -3
  68. package/esm/combobox/combobox-store.d.ts +69 -21
  69. package/esm/combobox/combobox-store.js +35 -13
  70. package/esm/composite/composite-overflow-store.js +4 -4
  71. package/esm/composite/composite-store.d.ts +6 -8
  72. package/esm/composite/composite-store.js +4 -4
  73. package/esm/dialog/dialog-store.js +3 -3
  74. package/esm/disclosure/disclosure-store.d.ts +2 -0
  75. package/esm/disclosure/disclosure-store.js +2 -2
  76. package/esm/form/form-store.js +3 -3
  77. package/esm/hovercard/hovercard-store.d.ts +6 -0
  78. package/esm/hovercard/hovercard-store.js +5 -5
  79. package/esm/menu/menu-bar-store.js +5 -5
  80. package/esm/menu/menu-store.js +8 -8
  81. package/esm/menubar/menubar-store.d.ts +12 -6
  82. package/esm/menubar/menubar-store.js +5 -5
  83. package/esm/popover/popover-store.d.ts +3 -0
  84. package/esm/popover/popover-store.js +4 -4
  85. package/esm/radio/radio-store.js +4 -4
  86. package/esm/select/select-store.d.ts +28 -18
  87. package/esm/select/select-store.js +7 -7
  88. package/esm/tab/tab-store.js +4 -4
  89. package/esm/toolbar/toolbar-store.js +4 -4
  90. package/esm/tooltip/tooltip-store.js +5 -5
  91. package/esm/utils/dom.d.ts +9 -0
  92. package/esm/utils/dom.js +5 -3
  93. package/esm/utils/events.js +2 -2
  94. package/esm/utils/focus.js +1 -1
  95. package/esm/utils/platform.js +2 -2
  96. package/esm/utils/store.d.ts +3 -0
  97. package/esm/utils/store.js +1 -1
  98. package/package.json +1 -1
@@ -1,28 +1,28 @@
1
1
  "use client";
2
2
  import {
3
3
  createPopoverStore
4
- } from "../__chunks/MRBDYBGO.js";
5
- import "../__chunks/DREIYIMP.js";
6
- import "../__chunks/PCA5ARZU.js";
4
+ } from "../__chunks/WY3EMTH6.js";
5
+ import "../__chunks/CL47ZAPY.js";
6
+ import "../__chunks/DYD4YNLE.js";
7
7
  import {
8
8
  createCompositeStore
9
- } from "../__chunks/5BWT4GY2.js";
10
- import "../__chunks/6EMNXRG3.js";
9
+ } from "../__chunks/OGMLJYDV.js";
10
+ import "../__chunks/CCU5UHQ2.js";
11
11
  import {
12
12
  batch,
13
13
  createStore,
14
14
  setup,
15
15
  sync,
16
16
  throwOnConflictingProps
17
- } from "../__chunks/HJS6GJT4.js";
17
+ } from "../__chunks/E7OQVGGY.js";
18
18
  import {
19
19
  defaultValue
20
20
  } from "../__chunks/I2VQ3XGR.js";
21
21
  import {
22
22
  isSafari,
23
23
  isTouchDevice
24
- } from "../__chunks/5UJPJ37G.js";
25
- import "../__chunks/NIF7E7VE.js";
24
+ } from "../__chunks/MHPO2BXA.js";
25
+ import "../__chunks/DLOEKDPY.js";
26
26
  import "../__chunks/7PRQYBBV.js";
27
27
  import {
28
28
  __spreadProps,
@@ -68,18 +68,31 @@ function createComboboxStore(props = {}) {
68
68
  "bottom-start"
69
69
  )
70
70
  }));
71
- const initialValue = defaultValue(
71
+ const value = defaultValue(
72
72
  props.value,
73
73
  syncState == null ? void 0 : syncState.value,
74
74
  props.defaultValue,
75
75
  ""
76
76
  );
77
+ const selectedValue = defaultValue(
78
+ props.selectedValue,
79
+ syncState == null ? void 0 : syncState.selectedValue,
80
+ props.defaultSelectedValue,
81
+ ""
82
+ );
83
+ const multiSelectable = Array.isArray(selectedValue);
77
84
  const initialState = __spreadProps(__spreadValues(__spreadValues({}, composite.getState()), popover.getState()), {
78
- value: initialValue,
85
+ value,
86
+ selectedValue,
87
+ resetValueOnSelect: defaultValue(
88
+ props.resetValueOnSelect,
89
+ syncState == null ? void 0 : syncState.resetValueOnSelect,
90
+ multiSelectable
91
+ ),
79
92
  resetValueOnHide: defaultValue(
80
93
  props.resetValueOnHide,
81
94
  syncState == null ? void 0 : syncState.resetValueOnHide,
82
- false
95
+ multiSelectable
83
96
  ),
84
97
  activeValue: syncState == null ? void 0 : syncState.activeValue
85
98
  });
@@ -91,7 +104,15 @@ function createComboboxStore(props = {}) {
91
104
  return;
92
105
  if (state.mounted)
93
106
  return;
94
- combobox.setState("value", initialValue);
107
+ combobox.setState("value", value);
108
+ })
109
+ );
110
+ setup(
111
+ combobox,
112
+ () => sync(combobox, ["resetValueOnSelect", "selectedValue"], (state) => {
113
+ if (!state.resetValueOnSelect)
114
+ return;
115
+ combobox.setState("value", value);
95
116
  })
96
117
  );
97
118
  setup(
@@ -122,7 +143,8 @@ function createComboboxStore(props = {}) {
122
143
  })
123
144
  );
124
145
  return __spreadProps(__spreadValues(__spreadValues(__spreadValues({}, popover), composite), combobox), {
125
- setValue: (value) => combobox.setState("value", value)
146
+ setValue: (value2) => combobox.setState("value", value2),
147
+ setSelectedValue: (selectedValue2) => combobox.setState("selectedValue", selectedValue2)
126
148
  });
127
149
  }
128
150
  export {
@@ -1,10 +1,10 @@
1
1
  "use client";
2
2
  import {
3
3
  createPopoverStore
4
- } from "../__chunks/MRBDYBGO.js";
5
- import "../__chunks/DREIYIMP.js";
6
- import "../__chunks/PCA5ARZU.js";
7
- import "../__chunks/HJS6GJT4.js";
4
+ } from "../__chunks/WY3EMTH6.js";
5
+ import "../__chunks/CL47ZAPY.js";
6
+ import "../__chunks/DYD4YNLE.js";
7
+ import "../__chunks/E7OQVGGY.js";
8
8
  import "../__chunks/I2VQ3XGR.js";
9
9
  import "../__chunks/4R3V3JGP.js";
10
10
 
@@ -2,11 +2,11 @@ import type { CollectionStoreFunctions, CollectionStoreItem, CollectionStoreOpti
2
2
  import type { Store, StoreOptions, StoreProps } from "../utils/store.js";
3
3
  import type { SetState } from "../utils/types.js";
4
4
  type Orientation = "horizontal" | "vertical" | "both";
5
- type Item = CollectionStoreItem & {
5
+ interface Item extends CollectionStoreItem {
6
6
  rowId?: string;
7
7
  disabled?: boolean;
8
8
  children?: string;
9
- };
9
+ }
10
10
  /**
11
11
  * Creates a composite store.
12
12
  */
@@ -25,10 +25,6 @@ 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)
32
28
  * @default false
33
29
  */
34
30
  virtualFocus: boolean;
@@ -201,6 +197,8 @@ export interface CompositeStoreOptions<T extends Item = Item> extends StoreOptio
201
197
  */
202
198
  defaultActiveId?: CompositeStoreState<T>["activeId"];
203
199
  }
204
- export type CompositeStoreProps<T extends Item = Item> = CompositeStoreOptions<T> & StoreProps<CompositeStoreState<T>>;
205
- export type CompositeStore<T extends Item = Item> = CompositeStoreFunctions<T> & Store<CompositeStoreState<T>>;
200
+ export interface CompositeStoreProps<T extends Item = Item> extends CompositeStoreOptions<T>, StoreProps<CompositeStoreState<T>> {
201
+ }
202
+ export interface CompositeStore<T extends Item = Item> extends CompositeStoreFunctions<T>, Store<CompositeStoreState<T>> {
203
+ }
206
204
  export {};
@@ -1,11 +1,11 @@
1
1
  "use client";
2
2
  import {
3
3
  createCompositeStore
4
- } from "../__chunks/5BWT4GY2.js";
5
- import "../__chunks/6EMNXRG3.js";
6
- import "../__chunks/HJS6GJT4.js";
4
+ } from "../__chunks/OGMLJYDV.js";
5
+ import "../__chunks/CCU5UHQ2.js";
6
+ import "../__chunks/E7OQVGGY.js";
7
7
  import "../__chunks/I2VQ3XGR.js";
8
- import "../__chunks/NIF7E7VE.js";
8
+ import "../__chunks/DLOEKDPY.js";
9
9
  import "../__chunks/7PRQYBBV.js";
10
10
  import "../__chunks/4R3V3JGP.js";
11
11
  export {
@@ -1,9 +1,9 @@
1
1
  "use client";
2
2
  import {
3
3
  createDialogStore
4
- } from "../__chunks/DREIYIMP.js";
5
- import "../__chunks/PCA5ARZU.js";
6
- import "../__chunks/HJS6GJT4.js";
4
+ } from "../__chunks/CL47ZAPY.js";
5
+ import "../__chunks/DYD4YNLE.js";
6
+ import "../__chunks/E7OQVGGY.js";
7
7
  import "../__chunks/I2VQ3XGR.js";
8
8
  import "../__chunks/4R3V3JGP.js";
9
9
  export {
@@ -36,6 +36,7 @@ export interface DisclosureStoreState {
36
36
  * milliseconds to pass before becoming `false`.
37
37
  *
38
38
  * Live examples:
39
+ * - [Navigation Menubar](https://ariakit.org/examples/menubar-navigation)
39
40
  * - [Animated Combobox](https://ariakit.org/examples/combobox-animated)
40
41
  * - [Animated Dialog](https://ariakit.org/examples/dialog-animated)
41
42
  * - [Animated Select](https://ariakit.org/examples/select-animated)
@@ -73,6 +74,7 @@ export interface DisclosureStoreFunctions {
73
74
  * Sets the `open` state to `true`.
74
75
  *
75
76
  * Live examples:
77
+ * - [Navigation Menubar](https://ariakit.org/examples/menubar-navigation)
76
78
  * - [Textarea with inline
77
79
  * Combobox](https://ariakit.org/examples/combobox-textarea)
78
80
  */
@@ -1,8 +1,8 @@
1
1
  "use client";
2
2
  import {
3
3
  createDisclosureStore
4
- } from "../__chunks/PCA5ARZU.js";
5
- import "../__chunks/HJS6GJT4.js";
4
+ } from "../__chunks/DYD4YNLE.js";
5
+ import "../__chunks/E7OQVGGY.js";
6
6
  import "../__chunks/I2VQ3XGR.js";
7
7
  import "../__chunks/4R3V3JGP.js";
8
8
  export {
@@ -1,20 +1,20 @@
1
1
  "use client";
2
2
  import {
3
3
  createCollectionStore
4
- } from "../__chunks/6EMNXRG3.js";
4
+ } from "../__chunks/CCU5UHQ2.js";
5
5
  import {
6
6
  createStore,
7
7
  init,
8
8
  setup,
9
9
  throwOnConflictingProps
10
- } from "../__chunks/HJS6GJT4.js";
10
+ } from "../__chunks/E7OQVGGY.js";
11
11
  import {
12
12
  applyState,
13
13
  defaultValue,
14
14
  isInteger,
15
15
  isObject
16
16
  } from "../__chunks/I2VQ3XGR.js";
17
- import "../__chunks/NIF7E7VE.js";
17
+ import "../__chunks/DLOEKDPY.js";
18
18
  import {
19
19
  __spreadProps,
20
20
  __spreadValues
@@ -20,11 +20,17 @@ export interface HovercardStoreState extends PopoverStoreState {
20
20
  /**
21
21
  * The amount of time in milliseconds to wait before **showing** the popover.
22
22
  * It defaults to the value passed to `timeout`.
23
+ *
24
+ * Live examples:
25
+ * - [Navigation Menubar](https://ariakit.org/examples/menubar-navigation)
23
26
  */
24
27
  showTimeout?: number;
25
28
  /**
26
29
  * The amount of time in milliseconds to wait before **hiding** the popover.
27
30
  * It defaults to the value passed to `timeout`.
31
+ *
32
+ * Live examples:
33
+ * - [Navigation Menubar](https://ariakit.org/examples/menubar-navigation)
28
34
  */
29
35
  hideTimeout?: number;
30
36
  /**
@@ -1,11 +1,11 @@
1
1
  "use client";
2
2
  import {
3
3
  createHovercardStore
4
- } from "../__chunks/EIFVU736.js";
5
- import "../__chunks/MRBDYBGO.js";
6
- import "../__chunks/DREIYIMP.js";
7
- import "../__chunks/PCA5ARZU.js";
8
- import "../__chunks/HJS6GJT4.js";
4
+ } from "../__chunks/BXH3I7ML.js";
5
+ import "../__chunks/WY3EMTH6.js";
6
+ import "../__chunks/CL47ZAPY.js";
7
+ import "../__chunks/DYD4YNLE.js";
8
+ import "../__chunks/E7OQVGGY.js";
9
9
  import "../__chunks/I2VQ3XGR.js";
10
10
  import "../__chunks/4R3V3JGP.js";
11
11
  export {
@@ -1,12 +1,12 @@
1
1
  "use client";
2
2
  import {
3
3
  createMenubarStore
4
- } from "../__chunks/6LSGADQM.js";
5
- import "../__chunks/5BWT4GY2.js";
6
- import "../__chunks/6EMNXRG3.js";
7
- import "../__chunks/HJS6GJT4.js";
4
+ } from "../__chunks/ANO6WJO4.js";
5
+ import "../__chunks/OGMLJYDV.js";
6
+ import "../__chunks/CCU5UHQ2.js";
7
+ import "../__chunks/E7OQVGGY.js";
8
8
  import "../__chunks/I2VQ3XGR.js";
9
- import "../__chunks/NIF7E7VE.js";
9
+ import "../__chunks/DLOEKDPY.js";
10
10
  import "../__chunks/7PRQYBBV.js";
11
11
  import "../__chunks/4R3V3JGP.js";
12
12
 
@@ -1,14 +1,14 @@
1
1
  "use client";
2
2
  import {
3
3
  createHovercardStore
4
- } from "../__chunks/EIFVU736.js";
5
- import "../__chunks/MRBDYBGO.js";
6
- import "../__chunks/DREIYIMP.js";
7
- import "../__chunks/PCA5ARZU.js";
4
+ } from "../__chunks/BXH3I7ML.js";
5
+ import "../__chunks/WY3EMTH6.js";
6
+ import "../__chunks/CL47ZAPY.js";
7
+ import "../__chunks/DYD4YNLE.js";
8
8
  import {
9
9
  createCompositeStore
10
- } from "../__chunks/5BWT4GY2.js";
11
- import "../__chunks/6EMNXRG3.js";
10
+ } from "../__chunks/OGMLJYDV.js";
11
+ import "../__chunks/CCU5UHQ2.js";
12
12
  import {
13
13
  createStore,
14
14
  mergeStore,
@@ -17,12 +17,12 @@ import {
17
17
  setup,
18
18
  sync,
19
19
  throwOnConflictingProps
20
- } from "../__chunks/HJS6GJT4.js";
20
+ } from "../__chunks/E7OQVGGY.js";
21
21
  import {
22
22
  applyState,
23
23
  defaultValue
24
24
  } from "../__chunks/I2VQ3XGR.js";
25
- import "../__chunks/NIF7E7VE.js";
25
+ import "../__chunks/DLOEKDPY.js";
26
26
  import "../__chunks/7PRQYBBV.js";
27
27
  import {
28
28
  __objRest,
@@ -1,10 +1,16 @@
1
- import type { CompositeStore, CompositeStoreFunctions, CompositeStoreOptions, CompositeStoreProps, CompositeStoreState } from "../composite/composite-store.js";
1
+ import type { CompositeStoreFunctions, CompositeStoreOptions, CompositeStoreState } from "../composite/composite-store.js";
2
+ import type { Store, StoreProps } from "../utils/store.js";
2
3
  /**
3
4
  * Creates a menu bar store.
4
5
  */
5
6
  export declare function createMenubarStore(props?: MenubarStoreProps): MenubarStore;
6
- export type MenubarStoreState = CompositeStoreState;
7
- export type MenubarStoreFunctions = CompositeStoreFunctions;
8
- export type MenubarStoreOptions = CompositeStoreOptions;
9
- export type MenubarStoreProps = CompositeStoreProps;
10
- export type MenubarStore = CompositeStore;
7
+ export interface MenubarStoreState extends CompositeStoreState {
8
+ }
9
+ export interface MenubarStoreFunctions extends CompositeStoreFunctions {
10
+ }
11
+ export interface MenubarStoreOptions extends CompositeStoreOptions {
12
+ }
13
+ export interface MenubarStoreProps extends MenubarStoreOptions, StoreProps<MenubarStoreState> {
14
+ }
15
+ export interface MenubarStore extends MenubarStoreFunctions, Store<MenubarStoreState> {
16
+ }
@@ -1,12 +1,12 @@
1
1
  "use client";
2
2
  import {
3
3
  createMenubarStore
4
- } from "../__chunks/6LSGADQM.js";
5
- import "../__chunks/5BWT4GY2.js";
6
- import "../__chunks/6EMNXRG3.js";
7
- import "../__chunks/HJS6GJT4.js";
4
+ } from "../__chunks/ANO6WJO4.js";
5
+ import "../__chunks/OGMLJYDV.js";
6
+ import "../__chunks/CCU5UHQ2.js";
7
+ import "../__chunks/E7OQVGGY.js";
8
8
  import "../__chunks/I2VQ3XGR.js";
9
- import "../__chunks/NIF7E7VE.js";
9
+ import "../__chunks/DLOEKDPY.js";
10
10
  import "../__chunks/7PRQYBBV.js";
11
11
  import "../__chunks/4R3V3JGP.js";
12
12
  export {
@@ -28,6 +28,9 @@ export interface PopoverStoreState extends DialogStoreState {
28
28
  currentPlacement: Placement;
29
29
  /**
30
30
  * The placement of the popover.
31
+ *
32
+ * Live examples:
33
+ * - [Navigation Menubar](https://ariakit.org/examples/menubar-navigation)
31
34
  * @default "bottom"
32
35
  */
33
36
  placement: Placement;
@@ -1,10 +1,10 @@
1
1
  "use client";
2
2
  import {
3
3
  createPopoverStore
4
- } from "../__chunks/MRBDYBGO.js";
5
- import "../__chunks/DREIYIMP.js";
6
- import "../__chunks/PCA5ARZU.js";
7
- import "../__chunks/HJS6GJT4.js";
4
+ } from "../__chunks/WY3EMTH6.js";
5
+ import "../__chunks/CL47ZAPY.js";
6
+ import "../__chunks/DYD4YNLE.js";
7
+ import "../__chunks/E7OQVGGY.js";
8
8
  import "../__chunks/I2VQ3XGR.js";
9
9
  import "../__chunks/4R3V3JGP.js";
10
10
  export {
@@ -1,15 +1,15 @@
1
1
  "use client";
2
2
  import {
3
3
  createCompositeStore
4
- } from "../__chunks/5BWT4GY2.js";
5
- import "../__chunks/6EMNXRG3.js";
4
+ } from "../__chunks/OGMLJYDV.js";
5
+ import "../__chunks/CCU5UHQ2.js";
6
6
  import {
7
7
  createStore
8
- } from "../__chunks/HJS6GJT4.js";
8
+ } from "../__chunks/E7OQVGGY.js";
9
9
  import {
10
10
  defaultValue
11
11
  } from "../__chunks/I2VQ3XGR.js";
12
- import "../__chunks/NIF7E7VE.js";
12
+ import "../__chunks/DLOEKDPY.js";
13
13
  import "../__chunks/7PRQYBBV.js";
14
14
  import {
15
15
  __objRest,
@@ -5,9 +5,9 @@ import type { Store, StoreOptions, StoreProps } from "../utils/store.js";
5
5
  import type { PickRequired, SetState } from "../utils/types.js";
6
6
  type Value = string | string[];
7
7
  type MutableValue<T extends Value = Value> = T extends string ? string : T;
8
- type Item = CompositeStoreItem & {
8
+ interface Item extends CompositeStoreItem {
9
9
  value?: string;
10
- };
10
+ }
11
11
  export declare function createSelectStore<T extends Value = Value>(props: PickRequired<SelectStoreProps<T>, "value" | "defaultValue">): SelectStore<T>;
12
12
  export declare function createSelectStore(props?: SelectStoreProps): SelectStore;
13
13
  export type SelectStoreItem = Item;
@@ -27,18 +27,32 @@ export interface SelectStoreState<T extends Value = Value> extends CompositeStor
27
27
  * The select value.
28
28
  *
29
29
  * Live examples:
30
- * - [Multi-selectable
31
- * Combobox](https://ariakit.org/examples/combobox-multiple)
30
+ * - [Form with Select](https://ariakit.org/examples/form-select)
31
+ * - [Select Grid](https://ariakit.org/examples/select-grid)
32
+ * - [Select with custom
33
+ * items](https://ariakit.org/examples/select-item-custom)
34
+ * - [Multi-Select](https://ariakit.org/examples/select-multiple)
35
+ * - [Toolbar with Select](https://ariakit.org/examples/toolbar-select)
32
36
  */
33
37
  value: MutableValue<T>;
34
38
  /**
35
- * Whether the select value should be set when the active item changes by
36
- * moving (which usually happens when moving to an item using the keyboard).
39
+ * Whether the select
40
+ * [`value`](https://ariakit.org/reference/select-provider#value) should be
41
+ * set when the active item changes by moving (which usually happens when
42
+ * moving to an item using the keyboard).
43
+ *
44
+ * Live examples:
45
+ * - [Select Grid](https://ariakit.org/examples/select-grid)
46
+ * - [Select with custom
47
+ * items](https://ariakit.org/examples/select-item-custom)
37
48
  * @default false
38
49
  */
39
50
  setValueOnMove: boolean;
40
51
  /**
41
52
  * The select button element.
53
+ *
54
+ * Live examples:
55
+ * - [Form with Select](https://ariakit.org/examples/form-select)
42
56
  */
43
57
  selectElement: HTMLElement | null;
44
58
  /**
@@ -49,10 +63,6 @@ export interface SelectStoreState<T extends Value = Value> extends CompositeStor
49
63
  export interface SelectStoreFunctions<T extends Value = Value> extends Pick<SelectStoreOptions<T>, "combobox">, CompositeStoreFunctions<Item>, PopoverStoreFunctions {
50
64
  /**
51
65
  * Sets the `value` state.
52
- *
53
- * Live examples:
54
- * - [Multi-selectable
55
- * Combobox](https://ariakit.org/examples/combobox-multiple)
56
66
  * @example
57
67
  * store.setValue("Apple");
58
68
  * store.setValue(["Apple", "Banana"]);
@@ -73,21 +83,21 @@ export interface SelectStoreOptions<T extends Value = Value> extends StoreOption
73
83
  * A reference to a combobox store. This is used when combining the combobox
74
84
  * with a select (e.g., select with a search input). The stores will share the
75
85
  * same state.
76
- *
77
- * Live examples:
78
- * - [Multi-selectable
79
- * Combobox](https://ariakit.org/examples/combobox-multiple)
80
86
  */
81
87
  combobox?: ComboboxStore | null;
82
88
  /**
83
89
  * The default value. If not set, the first non-disabled item will be used.
84
90
  *
85
91
  * Live examples:
86
- * - [Multi-selectable
87
- * Combobox](https://ariakit.org/examples/combobox-multiple)
92
+ * - [Form with Select](https://ariakit.org/examples/form-select)
93
+ * - [Animated Select](https://ariakit.org/examples/select-animated)
94
+ * - [Select with Combobox](https://ariakit.org/examples/select-combobox)
95
+ * - [SelectGroup](https://ariakit.org/examples/select-group)
88
96
  */
89
97
  defaultValue?: SelectStoreState<T>["value"];
90
98
  }
91
- export type SelectStoreProps<T extends Value = Value> = SelectStoreOptions<T> & StoreProps<SelectStoreState<T>>;
92
- export type SelectStore<T extends Value = Value> = SelectStoreFunctions<T> & Store<SelectStoreState<T>>;
99
+ export interface SelectStoreProps<T extends Value = Value> extends SelectStoreOptions<T>, StoreProps<SelectStoreState<T>> {
100
+ }
101
+ export interface SelectStore<T extends Value = Value> extends SelectStoreFunctions<T>, Store<SelectStoreState<T>> {
102
+ }
93
103
  export {};
@@ -1,13 +1,13 @@
1
1
  "use client";
2
2
  import {
3
3
  createPopoverStore
4
- } from "../__chunks/MRBDYBGO.js";
5
- import "../__chunks/DREIYIMP.js";
6
- import "../__chunks/PCA5ARZU.js";
4
+ } from "../__chunks/WY3EMTH6.js";
5
+ import "../__chunks/CL47ZAPY.js";
6
+ import "../__chunks/DYD4YNLE.js";
7
7
  import {
8
8
  createCompositeStore
9
- } from "../__chunks/5BWT4GY2.js";
10
- import "../__chunks/6EMNXRG3.js";
9
+ } from "../__chunks/OGMLJYDV.js";
10
+ import "../__chunks/CCU5UHQ2.js";
11
11
  import {
12
12
  batch,
13
13
  createStore,
@@ -16,11 +16,11 @@ import {
16
16
  setup,
17
17
  sync,
18
18
  throwOnConflictingProps
19
- } from "../__chunks/HJS6GJT4.js";
19
+ } from "../__chunks/E7OQVGGY.js";
20
20
  import {
21
21
  defaultValue
22
22
  } from "../__chunks/I2VQ3XGR.js";
23
- import "../__chunks/NIF7E7VE.js";
23
+ import "../__chunks/DLOEKDPY.js";
24
24
  import {
25
25
  toArray
26
26
  } from "../__chunks/7PRQYBBV.js";
@@ -1,20 +1,20 @@
1
1
  "use client";
2
2
  import {
3
3
  createCompositeStore
4
- } from "../__chunks/5BWT4GY2.js";
4
+ } from "../__chunks/OGMLJYDV.js";
5
5
  import {
6
6
  createCollectionStore
7
- } from "../__chunks/6EMNXRG3.js";
7
+ } from "../__chunks/CCU5UHQ2.js";
8
8
  import {
9
9
  batch,
10
10
  createStore,
11
11
  setup,
12
12
  sync
13
- } from "../__chunks/HJS6GJT4.js";
13
+ } from "../__chunks/E7OQVGGY.js";
14
14
  import {
15
15
  defaultValue
16
16
  } from "../__chunks/I2VQ3XGR.js";
17
- import "../__chunks/NIF7E7VE.js";
17
+ import "../__chunks/DLOEKDPY.js";
18
18
  import "../__chunks/7PRQYBBV.js";
19
19
  import {
20
20
  __spreadProps,
@@ -1,13 +1,13 @@
1
1
  "use client";
2
2
  import {
3
3
  createCompositeStore
4
- } from "../__chunks/5BWT4GY2.js";
5
- import "../__chunks/6EMNXRG3.js";
6
- import "../__chunks/HJS6GJT4.js";
4
+ } from "../__chunks/OGMLJYDV.js";
5
+ import "../__chunks/CCU5UHQ2.js";
6
+ import "../__chunks/E7OQVGGY.js";
7
7
  import {
8
8
  defaultValue
9
9
  } from "../__chunks/I2VQ3XGR.js";
10
- import "../__chunks/NIF7E7VE.js";
10
+ import "../__chunks/DLOEKDPY.js";
11
11
  import "../__chunks/7PRQYBBV.js";
12
12
  import {
13
13
  __spreadProps,
@@ -1,13 +1,13 @@
1
1
  "use client";
2
2
  import {
3
3
  createHovercardStore
4
- } from "../__chunks/EIFVU736.js";
5
- import "../__chunks/MRBDYBGO.js";
6
- import "../__chunks/DREIYIMP.js";
7
- import "../__chunks/PCA5ARZU.js";
4
+ } from "../__chunks/BXH3I7ML.js";
5
+ import "../__chunks/WY3EMTH6.js";
6
+ import "../__chunks/CL47ZAPY.js";
7
+ import "../__chunks/DYD4YNLE.js";
8
8
  import {
9
9
  createStore
10
- } from "../__chunks/HJS6GJT4.js";
10
+ } from "../__chunks/E7OQVGGY.js";
11
11
  import {
12
12
  defaultValue
13
13
  } from "../__chunks/I2VQ3XGR.js";
@@ -103,3 +103,12 @@ export declare function getScrollingElement(element?: Element | null): HTMLEleme
103
103
  * Determines whether an element is hidden or partially hidden in the viewport.
104
104
  */
105
105
  export declare function isPartiallyHidden(element: Element): boolean;
106
+ /**
107
+ * SelectionRange only works on a few types of input.
108
+ * Calling `setSelectionRange` on a unsupported input type may throw an error on certain browsers.
109
+ * To avoid it, we check if its type supports SelectionRange first.
110
+ * It will be a noop to non-supported types until we find a workaround.
111
+ *
112
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/setSelectionRange
113
+ */
114
+ export declare function setSelectionRange(element: HTMLInputElement, ...args: Parameters<typeof HTMLInputElement.prototype.setSelectionRange>): void;
package/esm/utils/dom.js CHANGED
@@ -16,8 +16,9 @@ import {
16
16
  isTextField,
17
17
  isVisible,
18
18
  matches,
19
- scrollIntoViewIfNeeded
20
- } from "../__chunks/NIF7E7VE.js";
19
+ scrollIntoViewIfNeeded,
20
+ setSelectionRange
21
+ } from "../__chunks/DLOEKDPY.js";
21
22
  import "../__chunks/4R3V3JGP.js";
22
23
  export {
23
24
  canUseDOM,
@@ -36,5 +37,6 @@ export {
36
37
  isTextField,
37
38
  isVisible,
38
39
  matches,
39
- scrollIntoViewIfNeeded
40
+ scrollIntoViewIfNeeded,
41
+ setSelectionRange
40
42
  };
@@ -1,10 +1,10 @@
1
1
  "use client";
2
2
  import {
3
3
  isApple
4
- } from "../__chunks/5UJPJ37G.js";
4
+ } from "../__chunks/MHPO2BXA.js";
5
5
  import {
6
6
  contains
7
- } from "../__chunks/NIF7E7VE.js";
7
+ } from "../__chunks/DLOEKDPY.js";
8
8
  import {
9
9
  __spreadProps,
10
10
  __spreadValues