@ariakit/core 0.3.6 → 0.3.8

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 (113) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/cjs/__chunks/{GZDVJEID.cjs → 2LS4JJ4S.cjs} +2 -2
  3. package/cjs/__chunks/{46BH65MC.cjs → 2UK5WUJX.cjs} +15 -7
  4. package/cjs/__chunks/{GXIZMD53.cjs → 3J44Z7YH.cjs} +4 -4
  5. package/cjs/__chunks/{PD7XZBXC.cjs → 5SIVMOID.cjs} +4 -4
  6. package/cjs/__chunks/{7ZUFMSXJ.cjs → EFIT5L4X.cjs} +7 -7
  7. package/cjs/__chunks/{MEHGRTJ3.cjs → GJFZ5ZPP.cjs} +11 -11
  8. package/cjs/__chunks/{6WBY3ZZM.cjs → QAZ4PF7S.cjs} +6 -6
  9. package/cjs/__chunks/{JLC5A6WF.cjs → ZQTYFYRS.cjs} +18 -9
  10. package/cjs/checkbox/checkbox-store.cjs +3 -3
  11. package/cjs/checkbox/checkbox-store.d.cts +9 -9
  12. package/cjs/checkbox/checkbox-store.d.ts +9 -9
  13. package/cjs/collection/collection-store.cjs +3 -3
  14. package/cjs/collection/collection-store.d.cts +18 -12
  15. package/cjs/collection/collection-store.d.ts +18 -12
  16. package/cjs/combobox/combobox-store.cjs +45 -23
  17. package/cjs/combobox/combobox-store.d.cts +66 -23
  18. package/cjs/combobox/combobox-store.d.ts +66 -23
  19. package/cjs/composite/composite-overflow-store.cjs +5 -5
  20. package/cjs/composite/composite-overflow-store.d.cts +13 -7
  21. package/cjs/composite/composite-overflow-store.d.ts +13 -7
  22. package/cjs/composite/composite-store.cjs +4 -4
  23. package/cjs/composite/composite-store.d.cts +24 -16
  24. package/cjs/composite/composite-store.d.ts +24 -16
  25. package/cjs/dialog/dialog-store.cjs +4 -4
  26. package/cjs/dialog/dialog-store.d.cts +12 -6
  27. package/cjs/dialog/dialog-store.d.ts +12 -6
  28. package/cjs/disclosure/disclosure-store.cjs +3 -3
  29. package/cjs/disclosure/disclosure-store.d.cts +6 -2
  30. package/cjs/disclosure/disclosure-store.d.ts +6 -2
  31. package/cjs/form/form-store.cjs +7 -7
  32. package/cjs/form/form-store.d.cts +15 -15
  33. package/cjs/form/form-store.d.ts +15 -15
  34. package/cjs/hovercard/hovercard-store.cjs +6 -6
  35. package/cjs/hovercard/hovercard-store.d.cts +11 -3
  36. package/cjs/hovercard/hovercard-store.d.ts +11 -3
  37. package/cjs/menu/menu-bar-store.cjs +5 -5
  38. package/cjs/menu/menu-bar-store.d.cts +12 -6
  39. package/cjs/menu/menu-bar-store.d.ts +12 -6
  40. package/cjs/menu/menu-store.cjs +18 -18
  41. package/cjs/menu/menu-store.d.cts +8 -8
  42. package/cjs/menu/menu-store.d.ts +8 -8
  43. package/cjs/menubar/menubar-store.cjs +5 -5
  44. package/cjs/menubar/menubar-store.d.cts +1 -1
  45. package/cjs/menubar/menubar-store.d.ts +1 -1
  46. package/cjs/popover/popover-store.cjs +5 -5
  47. package/cjs/popover/popover-store.d.cts +8 -3
  48. package/cjs/popover/popover-store.d.ts +8 -3
  49. package/cjs/radio/radio-store.cjs +5 -5
  50. package/cjs/radio/radio-store.d.cts +5 -3
  51. package/cjs/radio/radio-store.d.ts +5 -3
  52. package/cjs/select/select-store.cjs +18 -18
  53. package/cjs/select/select-store.d.cts +39 -31
  54. package/cjs/select/select-store.d.ts +39 -31
  55. package/cjs/tab/tab-store.cjs +15 -15
  56. package/cjs/tab/tab-store.d.cts +15 -16
  57. package/cjs/tab/tab-store.d.ts +15 -16
  58. package/cjs/toolbar/toolbar-store.cjs +4 -4
  59. package/cjs/toolbar/toolbar-store.d.cts +9 -6
  60. package/cjs/toolbar/toolbar-store.d.ts +9 -6
  61. package/cjs/tooltip/tooltip-store.cjs +7 -7
  62. package/cjs/tooltip/tooltip-store.d.cts +5 -3
  63. package/cjs/tooltip/tooltip-store.d.ts +5 -3
  64. package/cjs/utils/store.cjs +2 -2
  65. package/cjs/utils/store.d.cts +3 -0
  66. package/cjs/utils/store.d.ts +3 -0
  67. package/esm/__chunks/{ANO6WJO4.js → A2AGSVJO.js} +2 -2
  68. package/esm/__chunks/{E7OQVGGY.js → A2J4XZ5T.js} +15 -7
  69. package/esm/__chunks/{OGMLJYDV.js → CTZ2GQIZ.js} +2 -2
  70. package/esm/__chunks/{CCU5UHQ2.js → HMQYEBKF.js} +15 -6
  71. package/esm/__chunks/{WY3EMTH6.js → J6JIOWCS.js} +2 -2
  72. package/esm/__chunks/{CL47ZAPY.js → LT2OYWRD.js} +1 -1
  73. package/esm/__chunks/{DYD4YNLE.js → NKLTHWCR.js} +1 -1
  74. package/esm/__chunks/{BXH3I7ML.js → T3DVYGXI.js} +2 -2
  75. package/esm/checkbox/checkbox-store.d.ts +9 -9
  76. package/esm/checkbox/checkbox-store.js +1 -1
  77. package/esm/collection/collection-store.d.ts +18 -12
  78. package/esm/collection/collection-store.js +2 -2
  79. package/esm/combobox/combobox-store.d.ts +66 -23
  80. package/esm/combobox/combobox-store.js +33 -11
  81. package/esm/composite/composite-overflow-store.d.ts +13 -7
  82. package/esm/composite/composite-overflow-store.js +4 -4
  83. package/esm/composite/composite-store.d.ts +24 -16
  84. package/esm/composite/composite-store.js +3 -3
  85. package/esm/dialog/dialog-store.d.ts +12 -6
  86. package/esm/dialog/dialog-store.js +3 -3
  87. package/esm/disclosure/disclosure-store.d.ts +6 -2
  88. package/esm/disclosure/disclosure-store.js +2 -2
  89. package/esm/form/form-store.d.ts +15 -15
  90. package/esm/form/form-store.js +2 -2
  91. package/esm/hovercard/hovercard-store.d.ts +11 -3
  92. package/esm/hovercard/hovercard-store.js +5 -5
  93. package/esm/menu/menu-bar-store.d.ts +12 -6
  94. package/esm/menu/menu-bar-store.js +4 -4
  95. package/esm/menu/menu-store.d.ts +8 -8
  96. package/esm/menu/menu-store.js +7 -7
  97. package/esm/menubar/menubar-store.d.ts +1 -1
  98. package/esm/menubar/menubar-store.js +4 -4
  99. package/esm/popover/popover-store.d.ts +8 -3
  100. package/esm/popover/popover-store.js +4 -4
  101. package/esm/radio/radio-store.d.ts +5 -3
  102. package/esm/radio/radio-store.js +3 -3
  103. package/esm/select/select-store.d.ts +39 -31
  104. package/esm/select/select-store.js +6 -6
  105. package/esm/tab/tab-store.d.ts +15 -16
  106. package/esm/tab/tab-store.js +3 -3
  107. package/esm/toolbar/toolbar-store.d.ts +9 -6
  108. package/esm/toolbar/toolbar-store.js +3 -3
  109. package/esm/tooltip/tooltip-store.d.ts +5 -3
  110. package/esm/tooltip/tooltip-store.js +5 -5
  111. package/esm/utils/store.d.ts +3 -0
  112. package/esm/utils/store.js +1 -1
  113. package/package.json +1 -1
@@ -1,15 +1,20 @@
1
1
  import type { Store, StoreOptions, StoreProps } from "../utils/store.js";
2
2
  import type { BivariantCallback } from "../utils/types.js";
3
- type Item = {
4
- id: string;
5
- element?: HTMLElement | null;
6
- };
7
3
  /**
8
4
  * Creates a collection store.
9
5
  */
10
- export declare function createCollectionStore<T extends Item = Item>(props?: CollectionStoreProps<T>): CollectionStore<T>;
11
- export type CollectionStoreItem = Item;
12
- export interface CollectionStoreState<T extends Item = Item> {
6
+ export declare function createCollectionStore<T extends CollectionStoreItem = CollectionStoreItem>(props?: CollectionStoreProps<T>): CollectionStore<T>;
7
+ export interface CollectionStoreItem {
8
+ /**
9
+ * The id of the item.
10
+ */
11
+ id: string;
12
+ /**
13
+ * The item HTML element. This is automatically set when the item is rendered.
14
+ */
15
+ element?: HTMLElement | null;
16
+ }
17
+ export interface CollectionStoreState<T extends CollectionStoreItem = CollectionStoreItem> {
13
18
  /**
14
19
  * Lists all the items with their meta data. This state is automatically
15
20
  * updated when an item is registered or unregistered with the `registerItem`
@@ -24,7 +29,7 @@ export interface CollectionStoreState<T extends Item = Item> {
24
29
  */
25
30
  renderedItems: T[];
26
31
  }
27
- export interface CollectionStoreFunctions<T extends Item = Item> {
32
+ export interface CollectionStoreFunctions<T extends CollectionStoreItem = CollectionStoreItem> {
28
33
  /**
29
34
  * Registers an item in the collection. This function returns a cleanup
30
35
  * function that unregisters the item.
@@ -53,13 +58,14 @@ export interface CollectionStoreFunctions<T extends Item = Item> {
53
58
  */
54
59
  item: (id: string | null | undefined) => T | null;
55
60
  }
56
- export interface CollectionStoreOptions<T extends Item = Item> extends StoreOptions<CollectionStoreState<T>, "items"> {
61
+ export interface CollectionStoreOptions<T extends CollectionStoreItem = CollectionStoreItem> extends StoreOptions<CollectionStoreState<T>, "items"> {
57
62
  /**
58
63
  * The defaut value for the `items` state.
59
64
  * @default []
60
65
  */
61
66
  defaultItems?: CollectionStoreState<T>["items"];
62
67
  }
63
- export type CollectionStoreProps<T extends Item = Item> = CollectionStoreOptions<T> & StoreProps<CollectionStoreState<T>>;
64
- export type CollectionStore<T extends Item = Item> = CollectionStoreFunctions<T> & Store<CollectionStoreState<T>>;
65
- export {};
68
+ export interface CollectionStoreProps<T extends CollectionStoreItem = CollectionStoreItem> extends CollectionStoreOptions<T>, StoreProps<CollectionStoreState<T>> {
69
+ }
70
+ export interface CollectionStore<T extends CollectionStoreItem = CollectionStoreItem> extends CollectionStoreFunctions<T>, Store<CollectionStoreState<T>> {
71
+ }
@@ -1,8 +1,8 @@
1
1
  "use client";
2
2
  import {
3
3
  createCollectionStore
4
- } from "../__chunks/CCU5UHQ2.js";
5
- import "../__chunks/E7OQVGGY.js";
4
+ } from "../__chunks/HMQYEBKF.js";
5
+ import "../__chunks/A2J4XZ5T.js";
6
6
  import "../__chunks/I2VQ3XGR.js";
7
7
  import "../__chunks/DLOEKDPY.js";
8
8
  import "../__chunks/4R3V3JGP.js";
@@ -1,22 +1,24 @@
1
1
  import type { CompositeStoreFunctions, CompositeStoreItem, CompositeStoreOptions, CompositeStoreState } from "../composite/composite-store.js";
2
2
  import type { PopoverStoreFunctions, PopoverStoreOptions, PopoverStoreState } from "../popover/popover-store.js";
3
3
  import type { Store, StoreOptions, StoreProps } from "../utils/store.js";
4
- import type { SetState } from "../utils/types.js";
5
- type Item = CompositeStoreItem & {
6
- value?: string;
7
- };
4
+ import type { PickRequired, SetState } from "../utils/types.js";
5
+ type MutableValue<T extends ComboboxStoreSelectedValue = ComboboxStoreSelectedValue> = T extends string ? string : T;
8
6
  /**
9
7
  * Creates a combobox store.
10
8
  */
9
+ export declare function createComboboxStore<T extends ComboboxStoreSelectedValue = ComboboxStoreSelectedValue>(props: PickRequired<ComboboxStoreProps<T>, "selectedValue" | "defaultSelectedValue">): ComboboxStore<T>;
11
10
  export declare function createComboboxStore(props?: ComboboxStoreProps): ComboboxStore;
12
- export type ComboboxStoreItem = Item;
13
- export interface ComboboxStoreState extends CompositeStoreState<Item>, PopoverStoreState {
11
+ export type ComboboxStoreSelectedValue = string | string[];
12
+ export interface ComboboxStoreItem extends CompositeStoreItem {
13
+ value?: string;
14
+ }
15
+ export interface ComboboxStoreState<T extends ComboboxStoreSelectedValue = ComboboxStoreSelectedValue> extends CompositeStoreState<ComboboxStoreItem>, PopoverStoreState {
14
16
  /**
15
17
  * @default true
16
18
  */
17
19
  includesBaseElement: boolean;
18
20
  /**
19
- * The input value.
21
+ * The combobox input value.
20
22
  *
21
23
  * Live examples:
22
24
  * - [Combobox with integrated
@@ -34,47 +36,88 @@ export interface ComboboxStoreState extends CompositeStoreState<Item>, PopoverSt
34
36
  */
35
37
  activeValue: string | undefined;
36
38
  /**
37
- * Whether to reset the value when the combobox popover is hidden.
39
+ * The value(s) of the currently selected item(s). This can be a string or an
40
+ * array of strings. If it's an array, the combobox is considered
41
+ * [multi-selectable](https://ariakit.org/examples/combobox-multiple).
42
+ *
43
+ * Live examples:
44
+ * - [Multi-selectable
45
+ * Combobox](https://ariakit.org/examples/combobox-multiple)
46
+ */
47
+ selectedValue: MutableValue<T>;
48
+ /**
49
+ * Whether to reset the value when the combobox popover closes. This prop is
50
+ * automatically set to `true` by default if the combobox supports multiple
51
+ * selections. In other words, if the
52
+ * [`selectedValue`](https://ariakit.org/reference/combobox-provider#selectedvalue)
53
+ * or
54
+ * [`defaultSelectedValue`](https://ariakit.org/reference/combobox-provider#defaultselectedvalue)
55
+ * props are arrays.
38
56
  *
39
57
  * Live examples:
40
58
  * - [Multi-selectable
41
59
  * Combobox](https://ariakit.org/examples/combobox-multiple)
42
60
  * - [Menu with Combobox](https://ariakit.org/examples/menu-combobox)
43
61
  * - [Select with Combobox](https://ariakit.org/examples/select-combobox)
44
- * @default false
45
62
  */
46
63
  resetValueOnHide: boolean;
47
- }
48
- export interface ComboboxStoreFunctions extends CompositeStoreFunctions<Item>, PopoverStoreFunctions {
49
64
  /**
50
- * Sets the `value` state.
65
+ * Whether to reset the value when an item is selected. This prop is
66
+ * automatically set to `true` by default if the combobox supports multiple
67
+ * selections. In other words, if the
68
+ * [`selectedValue`](https://ariakit.org/reference/combobox-provider#selectedvalue)
69
+ * or
70
+ * [`defaultSelectedValue`](https://ariakit.org/reference/combobox-provider#defaultselectedvalue)
71
+ * props are arrays.
51
72
  *
52
73
  * Live examples:
53
74
  * - [Multi-selectable
54
75
  * Combobox](https://ariakit.org/examples/combobox-multiple)
76
+ */
77
+ resetValueOnSelect: boolean;
78
+ }
79
+ export interface ComboboxStoreFunctions<T extends ComboboxStoreSelectedValue = ComboboxStoreSelectedValue> extends CompositeStoreFunctions<ComboboxStoreItem>, PopoverStoreFunctions {
80
+ /**
81
+ * Sets the [`value`](https://ariakit.org/reference/combobox-provider#value)
82
+ * state.
83
+ *
84
+ * Live examples:
55
85
  * - [Textarea with inline
56
86
  * Combobox](https://ariakit.org/examples/combobox-textarea)
57
87
  * @example
58
88
  * store.setValue("Hello world");
59
89
  * store.setValue((value) => value + "!");
60
90
  */
61
- setValue: SetState<ComboboxStoreState["value"]>;
91
+ setValue: SetState<ComboboxStoreState<T>["value"]>;
92
+ /**
93
+ * Sets the
94
+ * [`selectedValue`](https://ariakit.org/reference/combobox-provider#selectedvalue)
95
+ * state.
96
+ */
97
+ setSelectedValue: SetState<ComboboxStoreState<T>["selectedValue"]>;
62
98
  }
63
- export interface ComboboxStoreOptions extends StoreOptions<ComboboxStoreState, "includesBaseElement" | "value" | "resetValueOnHide">, CompositeStoreOptions<Item>, PopoverStoreOptions {
99
+ export interface ComboboxStoreOptions<T extends ComboboxStoreSelectedValue = ComboboxStoreSelectedValue> extends CompositeStoreOptions<ComboboxStoreItem>, PopoverStoreOptions, StoreOptions<ComboboxStoreState<T>, "includesBaseElement" | "value" | "selectedValue" | "resetValueOnHide" | "resetValueOnSelect"> {
64
100
  /**
65
101
  * @default null
66
102
  */
67
- defaultActiveId?: CompositeStoreOptions<Item>["activeId"];
103
+ defaultActiveId?: CompositeStoreOptions<ComboboxStoreItem>["activeId"];
68
104
  /**
69
- * The combobox initial value.
70
- *
71
- * Live examples:
72
- * - [Multi-selectable
73
- * Combobox](https://ariakit.org/examples/combobox-multiple)
105
+ * The initial value of the combobox input.
106
+ * @default ""
107
+ */
108
+ defaultValue?: ComboboxStoreState<T>["value"];
109
+ /**
110
+ * The initial value of the
111
+ * [`selectedValue`](https://ariakit.org/reference/combobox-provider#selectedvalue)
112
+ * state. This can be a string or an array of strings. If it's an array, the
113
+ * combobox is considered
114
+ * [multi-selectable](https://ariakit.org/examples/combobox-multiple).
74
115
  * @default ""
75
116
  */
76
- defaultValue?: ComboboxStoreState["value"];
117
+ defaultSelectedValue?: ComboboxStoreState<T>["selectedValue"];
118
+ }
119
+ export interface ComboboxStoreProps<T extends ComboboxStoreSelectedValue = ComboboxStoreSelectedValue> extends ComboboxStoreOptions<T>, StoreProps<ComboboxStoreState<T>> {
120
+ }
121
+ export interface ComboboxStore<T extends ComboboxStoreSelectedValue = ComboboxStoreSelectedValue> extends ComboboxStoreFunctions<T>, Store<ComboboxStoreState<T>> {
77
122
  }
78
- export type ComboboxStoreProps = ComboboxStoreOptions & StoreProps<ComboboxStoreState>;
79
- export type ComboboxStore = ComboboxStoreFunctions & Store<ComboboxStoreState>;
80
123
  export {};
@@ -1,20 +1,20 @@
1
1
  "use client";
2
2
  import {
3
3
  createPopoverStore
4
- } from "../__chunks/WY3EMTH6.js";
5
- import "../__chunks/CL47ZAPY.js";
6
- import "../__chunks/DYD4YNLE.js";
4
+ } from "../__chunks/J6JIOWCS.js";
5
+ import "../__chunks/LT2OYWRD.js";
6
+ import "../__chunks/NKLTHWCR.js";
7
7
  import {
8
8
  createCompositeStore
9
- } from "../__chunks/OGMLJYDV.js";
10
- import "../__chunks/CCU5UHQ2.js";
9
+ } from "../__chunks/CTZ2GQIZ.js";
10
+ import "../__chunks/HMQYEBKF.js";
11
11
  import {
12
12
  batch,
13
13
  createStore,
14
14
  setup,
15
15
  sync,
16
16
  throwOnConflictingProps
17
- } from "../__chunks/E7OQVGGY.js";
17
+ } from "../__chunks/A2J4XZ5T.js";
18
18
  import {
19
19
  defaultValue
20
20
  } from "../__chunks/I2VQ3XGR.js";
@@ -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,16 @@
1
- import type { PopoverStore, PopoverStoreFunctions, PopoverStoreOptions, PopoverStoreProps, PopoverStoreState } from "../popover/popover-store.js";
1
+ import type { PopoverStoreFunctions, PopoverStoreOptions, PopoverStoreState } from "../popover/popover-store.js";
2
+ import type { Store, StoreProps } from "../utils/store.js";
2
3
  /**
3
- * Creates a composite overflow store.
4
+ * Creates a compositeOverflow store.
4
5
  */
5
6
  export declare function createCompositeOverflowStore(props?: CompositeOverflowStoreProps): CompositeOverflowStore;
6
- export type CompositeOverflowStoreState = PopoverStoreState;
7
- export type CompositeOverflowStoreFunctions = PopoverStoreFunctions;
8
- export type CompositeOverflowStoreOptions = PopoverStoreOptions;
9
- export type CompositeOverflowStoreProps = PopoverStoreProps;
10
- export type CompositeOverflowStore = PopoverStore;
7
+ export interface CompositeOverflowStoreState extends PopoverStoreState {
8
+ }
9
+ export interface CompositeOverflowStoreFunctions extends PopoverStoreFunctions {
10
+ }
11
+ export interface CompositeOverflowStoreOptions extends PopoverStoreOptions {
12
+ }
13
+ export interface CompositeOverflowStoreProps extends CompositeOverflowStoreOptions, StoreProps<CompositeOverflowStoreState> {
14
+ }
15
+ export interface CompositeOverflowStore extends CompositeOverflowStoreFunctions, Store<CompositeOverflowStoreState> {
16
+ }
@@ -1,10 +1,10 @@
1
1
  "use client";
2
2
  import {
3
3
  createPopoverStore
4
- } from "../__chunks/WY3EMTH6.js";
5
- import "../__chunks/CL47ZAPY.js";
6
- import "../__chunks/DYD4YNLE.js";
7
- import "../__chunks/E7OQVGGY.js";
4
+ } from "../__chunks/J6JIOWCS.js";
5
+ import "../__chunks/LT2OYWRD.js";
6
+ import "../__chunks/NKLTHWCR.js";
7
+ import "../__chunks/A2J4XZ5T.js";
8
8
  import "../__chunks/I2VQ3XGR.js";
9
9
  import "../__chunks/4R3V3JGP.js";
10
10
 
@@ -2,18 +2,28 @@ 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 & {
6
- rowId?: string;
7
- disabled?: boolean;
8
- children?: string;
9
- };
10
5
  /**
11
6
  * Creates a composite store.
12
7
  */
13
- export declare function createCompositeStore<T extends Item = Item>(props?: CompositeStoreProps<T>): CompositeStore<T>;
8
+ export declare function createCompositeStore<T extends CompositeStoreItem = CompositeStoreItem>(props?: CompositeStoreProps<T>): CompositeStore<T>;
14
9
  export type CompositeStoreOrientation = Orientation;
15
- export type CompositeStoreItem = Item;
16
- export interface CompositeStoreState<T extends Item = Item> extends CollectionStoreState<T> {
10
+ export interface CompositeStoreItem extends CollectionStoreItem {
11
+ /**
12
+ * The row id of the item. This is only used on two-dimensional composites
13
+ * (when using `CompositeRow`).
14
+ */
15
+ rowId?: string;
16
+ /**
17
+ * If enabled, the item will be disabled and users won't be able to focus it
18
+ * using arrow keys.
19
+ */
20
+ disabled?: boolean;
21
+ /**
22
+ * The item children. This can be used for typeahead purposes.
23
+ */
24
+ children?: string;
25
+ }
26
+ export interface CompositeStoreState<T extends CompositeStoreItem = CompositeStoreItem> extends CollectionStoreState<T> {
17
27
  /**
18
28
  * The composite element.
19
29
  */
@@ -25,10 +35,6 @@ export interface CompositeStoreState<T extends Item = Item> extends CollectionSt
25
35
  * tabindex](https://www.w3.org/WAI/ARIA/apg/practices/keyboard-interface/#kbd_roving_tabindex).
26
36
  * DOM focus will remain on the composite element while its items receive
27
37
  * virtual focus.
28
- *
29
- * Live examples:
30
- * - [Multi-selectable
31
- * Combobox](https://ariakit.org/examples/combobox-multiple)
32
38
  * @default false
33
39
  */
34
40
  virtualFocus: boolean;
@@ -121,7 +127,7 @@ export interface CompositeStoreState<T extends Item = Item> extends CollectionSt
121
127
  */
122
128
  activeId: string | null | undefined;
123
129
  }
124
- export interface CompositeStoreFunctions<T extends Item = Item> extends CollectionStoreFunctions<T> {
130
+ export interface CompositeStoreFunctions<T extends CompositeStoreItem = CompositeStoreItem> extends CollectionStoreFunctions<T> {
125
131
  /**
126
132
  * Sets the `baseElement`.
127
133
  */
@@ -192,7 +198,7 @@ export interface CompositeStoreFunctions<T extends Item = Item> extends Collecti
192
198
  */
193
199
  last: () => string | null | undefined;
194
200
  }
195
- export interface CompositeStoreOptions<T extends Item = Item> extends StoreOptions<CompositeStoreState<T>, "virtualFocus" | "orientation" | "rtl" | "focusLoop" | "focusWrap" | "focusShift" | "includesBaseElement" | "activeId">, CollectionStoreOptions<T> {
201
+ export interface CompositeStoreOptions<T extends CompositeStoreItem = CompositeStoreItem> extends CollectionStoreOptions<T>, StoreOptions<CompositeStoreState<T>, "virtualFocus" | "orientation" | "rtl" | "focusLoop" | "focusWrap" | "focusShift" | "includesBaseElement" | "activeId"> {
196
202
  /**
197
203
  * The composite item id that should be active by default when the composite
198
204
  * widget is rendered. If `null`, the composite element itself will have focus
@@ -201,6 +207,8 @@ export interface CompositeStoreOptions<T extends Item = Item> extends StoreOptio
201
207
  */
202
208
  defaultActiveId?: CompositeStoreState<T>["activeId"];
203
209
  }
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>>;
210
+ export interface CompositeStoreProps<T extends CompositeStoreItem = CompositeStoreItem> extends CompositeStoreOptions<T>, StoreProps<CompositeStoreState<T>> {
211
+ }
212
+ export interface CompositeStore<T extends CompositeStoreItem = CompositeStoreItem> extends CompositeStoreFunctions<T>, Store<CompositeStoreState<T>> {
213
+ }
206
214
  export {};
@@ -1,9 +1,9 @@
1
1
  "use client";
2
2
  import {
3
3
  createCompositeStore
4
- } from "../__chunks/OGMLJYDV.js";
5
- import "../__chunks/CCU5UHQ2.js";
6
- import "../__chunks/E7OQVGGY.js";
4
+ } from "../__chunks/CTZ2GQIZ.js";
5
+ import "../__chunks/HMQYEBKF.js";
6
+ import "../__chunks/A2J4XZ5T.js";
7
7
  import "../__chunks/I2VQ3XGR.js";
8
8
  import "../__chunks/DLOEKDPY.js";
9
9
  import "../__chunks/7PRQYBBV.js";
@@ -1,10 +1,16 @@
1
- import type { DisclosureStore, DisclosureStoreFunctions, DisclosureStoreOptions, DisclosureStoreProps, DisclosureStoreState } from "../disclosure/disclosure-store.js";
1
+ import type { DisclosureStoreFunctions, DisclosureStoreOptions, DisclosureStoreState } from "../disclosure/disclosure-store.js";
2
+ import type { Store, StoreProps } from "../utils/store.js";
2
3
  /**
3
4
  * Creates a dialog store.
4
5
  */
5
6
  export declare function createDialogStore(props?: DialogStoreProps): DialogStore;
6
- export type DialogStoreState = DisclosureStoreState;
7
- export type DialogStoreFunctions = DisclosureStoreFunctions;
8
- export type DialogStoreOptions = DisclosureStoreOptions;
9
- export type DialogStoreProps = DisclosureStoreProps;
10
- export type DialogStore = DisclosureStore;
7
+ export interface DialogStoreState extends DisclosureStoreState {
8
+ }
9
+ export interface DialogStoreFunctions extends DisclosureStoreFunctions {
10
+ }
11
+ export interface DialogStoreOptions extends DisclosureStoreOptions {
12
+ }
13
+ export interface DialogStoreProps extends DialogStoreOptions, StoreProps<DialogStoreState> {
14
+ }
15
+ export interface DialogStore extends DialogStoreFunctions, Store<DialogStoreState> {
16
+ }
@@ -1,9 +1,9 @@
1
1
  "use client";
2
2
  import {
3
3
  createDialogStore
4
- } from "../__chunks/CL47ZAPY.js";
5
- import "../__chunks/DYD4YNLE.js";
6
- import "../__chunks/E7OQVGGY.js";
4
+ } from "../__chunks/LT2OYWRD.js";
5
+ import "../__chunks/NKLTHWCR.js";
6
+ import "../__chunks/A2J4XZ5T.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
  */
@@ -121,5 +123,7 @@ export interface DisclosureStoreOptions extends StoreOptions<DisclosureStoreStat
121
123
  */
122
124
  disclosure?: DisclosureStore | null;
123
125
  }
124
- export type DisclosureStoreProps = DisclosureStoreOptions & StoreProps<DisclosureStoreState>;
125
- export type DisclosureStore = DisclosureStoreFunctions & Store<DisclosureStoreState>;
126
+ export interface DisclosureStoreProps extends DisclosureStoreOptions, StoreProps<DisclosureStoreState> {
127
+ }
128
+ export interface DisclosureStore extends DisclosureStoreFunctions, Store<DisclosureStoreState> {
129
+ }
@@ -1,8 +1,8 @@
1
1
  "use client";
2
2
  import {
3
3
  createDisclosureStore
4
- } from "../__chunks/DYD4YNLE.js";
5
- import "../__chunks/E7OQVGGY.js";
4
+ } from "../__chunks/NKLTHWCR.js";
5
+ import "../__chunks/A2J4XZ5T.js";
6
6
  import "../__chunks/I2VQ3XGR.js";
7
7
  import "../__chunks/4R3V3JGP.js";
8
8
  export {
@@ -2,23 +2,21 @@ import type { CollectionStoreFunctions, CollectionStoreItem, CollectionStoreOpti
2
2
  import type { Store, StoreOptions, StoreProps } from "../utils/store.js";
3
3
  import type { AnyObject, PickRequired, SetState, SetStateAction } from "../utils/types.js";
4
4
  import type { DeepMap, DeepPartial, Names, StringLike } from "./types.js";
5
- type Values = AnyObject;
6
5
  type ErrorMessage = string | undefined | null;
7
- type Item = CollectionStoreItem & {
8
- type: "field" | "label" | "description" | "error" | "button";
9
- name: string;
10
- };
11
- export declare function hasMessages(object: Values): boolean;
12
- export declare function get<T>(values: Values, path: StringLike | string[], defaultValue?: T): T;
6
+ export declare function hasMessages(object: FormStoreValues): boolean;
7
+ export declare function get<T>(values: FormStoreValues, path: StringLike | string[], defaultValue?: T): T;
13
8
  /**
14
9
  * Creates a form store.
15
10
  */
16
- export declare function createFormStore<T extends Values = Values>(props: PickRequired<FormStoreProps<T>, "values" | "defaultValues" | "errors" | "defaultErrors" | "touched" | "defaultTouched">): FormStore<T>;
11
+ export declare function createFormStore<T extends FormStoreValues = FormStoreValues>(props: PickRequired<FormStoreProps<T>, "values" | "defaultValues" | "errors" | "defaultErrors" | "touched" | "defaultTouched">): FormStore<T>;
17
12
  export declare function createFormStore(props: FormStoreProps): FormStore;
18
13
  export type FormStoreCallback<T extends FormStoreState = FormStoreState> = (state: T) => void | Promise<void>;
19
- export type FormStoreValues = Values;
20
- export type FormStoreItem = Item;
21
- export interface FormStoreState<T extends Values = Values> extends CollectionStoreState<Item> {
14
+ export type FormStoreValues = AnyObject;
15
+ export interface FormStoreItem extends CollectionStoreItem {
16
+ type: "field" | "label" | "description" | "error" | "button";
17
+ name: string;
18
+ }
19
+ export interface FormStoreState<T extends FormStoreValues = FormStoreValues> extends CollectionStoreState<FormStoreItem> {
22
20
  /**
23
21
  * Form values.
24
22
  * @default {}
@@ -54,7 +52,7 @@ export interface FormStoreState<T extends Values = Values> extends CollectionSto
54
52
  */
55
53
  submitFailed: number;
56
54
  }
57
- export interface FormStoreFunctions<T extends Values = Values> extends CollectionStoreFunctions<Item> {
55
+ export interface FormStoreFunctions<T extends FormStoreValues = FormStoreValues> extends CollectionStoreFunctions<FormStoreItem> {
58
56
  /**
59
57
  * An object containing the names of the form fields for type-safety.
60
58
  * @example
@@ -216,7 +214,7 @@ export interface FormStoreFunctions<T extends Values = Values> extends Collectio
216
214
  */
217
215
  reset: () => void;
218
216
  }
219
- export interface FormStoreOptions<T extends Values = Values> extends StoreOptions<FormStoreState<T>, "values" | "errors" | "touched">, CollectionStoreOptions<Item> {
217
+ export interface FormStoreOptions<T extends FormStoreValues = FormStoreValues> extends CollectionStoreOptions<FormStoreItem>, StoreOptions<FormStoreState<T>, "values" | "errors" | "touched"> {
220
218
  /**
221
219
  * The default values of the form.
222
220
  * @default {}
@@ -231,6 +229,8 @@ export interface FormStoreOptions<T extends Values = Values> extends StoreOption
231
229
  */
232
230
  defaultTouched?: FormStoreState<T>["touched"];
233
231
  }
234
- export type FormStoreProps<T extends Values = Values> = FormStoreOptions<T> & StoreProps<FormStoreState<T>>;
235
- export type FormStore<T extends Values = Values> = FormStoreFunctions<T> & Store<FormStoreState<T>>;
232
+ export interface FormStoreProps<T extends FormStoreValues = FormStoreValues> extends FormStoreOptions<T>, StoreProps<FormStoreState<T>> {
233
+ }
234
+ export interface FormStore<T extends FormStoreValues = FormStoreValues> extends FormStoreFunctions<T>, Store<FormStoreState<T>> {
235
+ }
236
236
  export {};
@@ -1,13 +1,13 @@
1
1
  "use client";
2
2
  import {
3
3
  createCollectionStore
4
- } from "../__chunks/CCU5UHQ2.js";
4
+ } from "../__chunks/HMQYEBKF.js";
5
5
  import {
6
6
  createStore,
7
7
  init,
8
8
  setup,
9
9
  throwOnConflictingProps
10
- } from "../__chunks/E7OQVGGY.js";
10
+ } from "../__chunks/A2J4XZ5T.js";
11
11
  import {
12
12
  applyState,
13
13
  defaultValue,
@@ -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
  /**
@@ -40,7 +46,9 @@ export interface HovercardStoreFunctions extends PopoverStoreFunctions {
40
46
  */
41
47
  setAutoFocusOnShow: SetState<HovercardStoreState["autoFocusOnShow"]>;
42
48
  }
43
- export interface HovercardStoreOptions extends StoreOptions<HovercardStoreState, "placement" | "timeout" | "showTimeout" | "hideTimeout">, PopoverStoreOptions {
49
+ export interface HovercardStoreOptions extends PopoverStoreOptions, StoreOptions<HovercardStoreState, "placement" | "timeout" | "showTimeout" | "hideTimeout"> {
50
+ }
51
+ export interface HovercardStoreProps extends HovercardStoreOptions, StoreProps<HovercardStoreState> {
52
+ }
53
+ export interface HovercardStore extends HovercardStoreFunctions, Store<HovercardStoreState> {
44
54
  }
45
- export type HovercardStoreProps = HovercardStoreOptions & StoreProps<HovercardStoreState>;
46
- export type HovercardStore = HovercardStoreFunctions & Store<HovercardStoreState>;
@@ -1,11 +1,11 @@
1
1
  "use client";
2
2
  import {
3
3
  createHovercardStore
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";
4
+ } from "../__chunks/T3DVYGXI.js";
5
+ import "../__chunks/J6JIOWCS.js";
6
+ import "../__chunks/LT2OYWRD.js";
7
+ import "../__chunks/NKLTHWCR.js";
8
+ import "../__chunks/A2J4XZ5T.js";
9
9
  import "../__chunks/I2VQ3XGR.js";
10
10
  import "../__chunks/4R3V3JGP.js";
11
11
  export {