@ariakit/core 0.3.7 → 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 (110) hide show
  1. package/CHANGELOG.md +6 -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 +16 -12
  15. package/cjs/collection/collection-store.d.ts +16 -12
  16. package/cjs/combobox/combobox-store.cjs +20 -20
  17. package/cjs/combobox/combobox-store.d.cts +12 -14
  18. package/cjs/combobox/combobox-store.d.ts +12 -14
  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 +22 -12
  24. package/cjs/composite/composite-store.d.ts +22 -12
  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 +4 -2
  30. package/cjs/disclosure/disclosure-store.d.ts +4 -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 +5 -3
  36. package/cjs/hovercard/hovercard-store.d.ts +5 -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 +5 -3
  48. package/cjs/popover/popover-store.d.ts +5 -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 +14 -16
  54. package/cjs/select/select-store.d.ts +14 -16
  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/esm/__chunks/{ANO6WJO4.js → A2AGSVJO.js} +2 -2
  66. package/esm/__chunks/{E7OQVGGY.js → A2J4XZ5T.js} +15 -7
  67. package/esm/__chunks/{OGMLJYDV.js → CTZ2GQIZ.js} +2 -2
  68. package/esm/__chunks/{CCU5UHQ2.js → HMQYEBKF.js} +15 -6
  69. package/esm/__chunks/{WY3EMTH6.js → J6JIOWCS.js} +2 -2
  70. package/esm/__chunks/{CL47ZAPY.js → LT2OYWRD.js} +1 -1
  71. package/esm/__chunks/{DYD4YNLE.js → NKLTHWCR.js} +1 -1
  72. package/esm/__chunks/{BXH3I7ML.js → T3DVYGXI.js} +2 -2
  73. package/esm/checkbox/checkbox-store.d.ts +9 -9
  74. package/esm/checkbox/checkbox-store.js +1 -1
  75. package/esm/collection/collection-store.d.ts +16 -12
  76. package/esm/collection/collection-store.js +2 -2
  77. package/esm/combobox/combobox-store.d.ts +12 -14
  78. package/esm/combobox/combobox-store.js +6 -6
  79. package/esm/composite/composite-overflow-store.d.ts +13 -7
  80. package/esm/composite/composite-overflow-store.js +4 -4
  81. package/esm/composite/composite-store.d.ts +22 -12
  82. package/esm/composite/composite-store.js +3 -3
  83. package/esm/dialog/dialog-store.d.ts +12 -6
  84. package/esm/dialog/dialog-store.js +3 -3
  85. package/esm/disclosure/disclosure-store.d.ts +4 -2
  86. package/esm/disclosure/disclosure-store.js +2 -2
  87. package/esm/form/form-store.d.ts +15 -15
  88. package/esm/form/form-store.js +2 -2
  89. package/esm/hovercard/hovercard-store.d.ts +5 -3
  90. package/esm/hovercard/hovercard-store.js +5 -5
  91. package/esm/menu/menu-bar-store.d.ts +12 -6
  92. package/esm/menu/menu-bar-store.js +4 -4
  93. package/esm/menu/menu-store.d.ts +8 -8
  94. package/esm/menu/menu-store.js +7 -7
  95. package/esm/menubar/menubar-store.d.ts +1 -1
  96. package/esm/menubar/menubar-store.js +4 -4
  97. package/esm/popover/popover-store.d.ts +5 -3
  98. package/esm/popover/popover-store.js +4 -4
  99. package/esm/radio/radio-store.d.ts +5 -3
  100. package/esm/radio/radio-store.js +3 -3
  101. package/esm/select/select-store.d.ts +14 -16
  102. package/esm/select/select-store.js +6 -6
  103. package/esm/tab/tab-store.d.ts +15 -16
  104. package/esm/tab/tab-store.js +3 -3
  105. package/esm/toolbar/toolbar-store.d.ts +9 -6
  106. package/esm/toolbar/toolbar-store.js +3 -3
  107. package/esm/tooltip/tooltip-store.d.ts +5 -3
  108. package/esm/tooltip/tooltip-store.js +5 -5
  109. package/esm/utils/store.js +1 -1
  110. package/package.json +1 -1
@@ -24,7 +24,8 @@ function createStore(initialState, ...stores) {
24
24
  let state = initialState;
25
25
  let prevStateBatch = state;
26
26
  let lastUpdate = Symbol();
27
- let initialized = false;
27
+ let destroy = noop;
28
+ const instances = /* @__PURE__ */ new Set();
28
29
  const updatedKeys = /* @__PURE__ */ new Set();
29
30
  const setups = /* @__PURE__ */ new Set();
30
31
  const listeners = /* @__PURE__ */ new Set();
@@ -36,11 +37,19 @@ function createStore(initialState, ...stores) {
36
37
  return () => setups.delete(callback);
37
38
  };
38
39
  const storeInit = () => {
39
- if (initialized)
40
- return noop;
41
40
  if (!stores.length)
42
41
  return noop;
43
- initialized = true;
42
+ const initialized = instances.size;
43
+ const instance = Symbol();
44
+ instances.add(instance);
45
+ const maybeDestroy = () => {
46
+ instances.delete(instance);
47
+ if (instances.size)
48
+ return;
49
+ destroy();
50
+ };
51
+ if (initialized)
52
+ return maybeDestroy;
44
53
  const desyncs = getKeys(state).map(
45
54
  (key) => chain(
46
55
  ...stores.map((store) => {
@@ -65,9 +74,8 @@ function createStore(initialState, ...stores) {
65
74
  const teardowns = [];
66
75
  setups.forEach((setup2) => teardowns.push(setup2()));
67
76
  const cleanups = stores.map(init);
68
- return chain(...desyncs, ...teardowns, ...cleanups, () => {
69
- initialized = false;
70
- });
77
+ destroy = chain(...desyncs, ...teardowns, ...cleanups);
78
+ return maybeDestroy;
71
79
  };
72
80
  const sub = (keys, listener, set = listeners) => {
73
81
  set.add(listener);
@@ -1,12 +1,12 @@
1
1
  "use client";
2
2
  import {
3
3
  createCollectionStore
4
- } from "./CCU5UHQ2.js";
4
+ } from "./HMQYEBKF.js";
5
5
  import {
6
6
  createStore,
7
7
  setup,
8
8
  sync
9
- } from "./E7OQVGGY.js";
9
+ } from "./A2J4XZ5T.js";
10
10
  import {
11
11
  defaultValue
12
12
  } from "./I2VQ3XGR.js";
@@ -2,9 +2,10 @@
2
2
  import {
3
3
  batch,
4
4
  createStore,
5
+ init,
5
6
  setup,
6
7
  throwOnConflictingProps
7
- } from "./E7OQVGGY.js";
8
+ } from "./A2J4XZ5T.js";
8
9
  import {
9
10
  chain,
10
11
  defaultValue
@@ -63,6 +64,9 @@ function getCommonParent(items) {
63
64
  }
64
65
  return getDocument(parentElement).body;
65
66
  }
67
+ function getPrivateStore(store) {
68
+ return store == null ? void 0 : store.__unstablePrivateStore;
69
+ }
66
70
  function createCollectionStore(props = {}) {
67
71
  var _a;
68
72
  throwOnConflictingProps(props, props.store);
@@ -78,9 +82,11 @@ function createCollectionStore(props = {}) {
78
82
  items,
79
83
  renderedItems: defaultValue(syncState == null ? void 0 : syncState.renderedItems, [])
80
84
  };
81
- const privateStore = createStore({
82
- renderedItems: initialState.renderedItems
83
- });
85
+ const syncPrivateStore = getPrivateStore(props.store);
86
+ const privateStore = createStore(
87
+ { renderedItems: initialState.renderedItems },
88
+ syncPrivateStore
89
+ );
84
90
  const collection = createStore(initialState, props.store);
85
91
  const sortItems = () => {
86
92
  const state = privateStore.getState();
@@ -88,7 +94,8 @@ function createCollectionStore(props = {}) {
88
94
  privateStore.setState("renderedItems", renderedItems);
89
95
  collection.setState("renderedItems", renderedItems);
90
96
  };
91
- setup(collection, () => {
97
+ setup(collection, () => init(privateStore));
98
+ setup(privateStore, () => {
92
99
  return batch(privateStore, ["renderedItems"], (state) => {
93
100
  let firstRun = true;
94
101
  let raf = requestAnimationFrame(sortItems);
@@ -172,7 +179,9 @@ function createCollectionStore(props = {}) {
172
179
  }
173
180
  }
174
181
  return item || null;
175
- }
182
+ },
183
+ // @ts-expect-error Internal
184
+ __unstablePrivateStore: privateStore
176
185
  });
177
186
  }
178
187
 
@@ -1,13 +1,13 @@
1
1
  "use client";
2
2
  import {
3
3
  createDialogStore
4
- } from "./CL47ZAPY.js";
4
+ } from "./LT2OYWRD.js";
5
5
  import {
6
6
  createStore,
7
7
  mergeStore,
8
8
  omit,
9
9
  throwOnConflictingProps
10
- } from "./E7OQVGGY.js";
10
+ } from "./A2J4XZ5T.js";
11
11
  import {
12
12
  defaultValue
13
13
  } from "./I2VQ3XGR.js";
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import {
3
3
  createDisclosureStore
4
- } from "./DYD4YNLE.js";
4
+ } from "./NKLTHWCR.js";
5
5
 
6
6
  // src/dialog/dialog-store.ts
7
7
  function createDialogStore(props = {}) {
@@ -7,7 +7,7 @@ import {
7
7
  subscribe,
8
8
  sync,
9
9
  throwOnConflictingProps
10
- } from "./E7OQVGGY.js";
10
+ } from "./A2J4XZ5T.js";
11
11
  import {
12
12
  defaultValue
13
13
  } from "./I2VQ3XGR.js";
@@ -1,10 +1,10 @@
1
1
  "use client";
2
2
  import {
3
3
  createPopoverStore
4
- } from "./WY3EMTH6.js";
4
+ } from "./J6JIOWCS.js";
5
5
  import {
6
6
  createStore
7
- } from "./E7OQVGGY.js";
7
+ } from "./A2J4XZ5T.js";
8
8
  import {
9
9
  defaultValue
10
10
  } from "./I2VQ3XGR.js";
@@ -1,13 +1,12 @@
1
1
  import type { Store, StoreOptions, StoreProps } from "../utils/store.js";
2
2
  import type { PickRequired, SetState, ToPrimitive } from "../utils/types.js";
3
- type Value = boolean | string | number | Array<string | number>;
4
3
  /**
5
4
  * Creates a checkbox store.
6
5
  */
7
- export declare function createCheckboxStore<T extends Value = Value>(props: PickRequired<CheckboxStoreProps<T>, "value" | "defaultValue">): CheckboxStore<T>;
6
+ export declare function createCheckboxStore<T extends CheckboxStoreValue = CheckboxStoreValue>(props: PickRequired<CheckboxStoreProps<T>, "value" | "defaultValue">): CheckboxStore<T>;
8
7
  export declare function createCheckboxStore(props?: CheckboxStoreProps): CheckboxStore;
9
- export type CheckboxStoreValue = Value;
10
- export interface CheckboxStoreState<T extends Value = Value> {
8
+ export type CheckboxStoreValue = boolean | string | number | Array<string | number>;
9
+ export interface CheckboxStoreState<T extends CheckboxStoreValue = CheckboxStoreValue> {
11
10
  /**
12
11
  * The checked state of the checkbox.
13
12
  *
@@ -16,7 +15,7 @@ export interface CheckboxStoreState<T extends Value = Value> {
16
15
  */
17
16
  value: ToPrimitive<T>;
18
17
  }
19
- export interface CheckboxStoreFunctions<T extends Value = Value> {
18
+ export interface CheckboxStoreFunctions<T extends CheckboxStoreValue = CheckboxStoreValue> {
20
19
  /**
21
20
  * Sets the `value` state.
22
21
  * @example
@@ -25,7 +24,7 @@ export interface CheckboxStoreFunctions<T extends Value = Value> {
25
24
  */
26
25
  setValue: SetState<CheckboxStoreState<T>["value"]>;
27
26
  }
28
- export interface CheckboxStoreOptions<T extends Value = Value> extends StoreOptions<CheckboxStoreState<T>, "value"> {
27
+ export interface CheckboxStoreOptions<T extends CheckboxStoreValue = CheckboxStoreValue> extends StoreOptions<CheckboxStoreState<T>, "value"> {
29
28
  /**
30
29
  * The default value of the checkbox.
31
30
  *
@@ -36,6 +35,7 @@ export interface CheckboxStoreOptions<T extends Value = Value> extends StoreOpti
36
35
  */
37
36
  defaultValue?: CheckboxStoreState<T>["value"];
38
37
  }
39
- export type CheckboxStoreProps<T extends Value = Value> = CheckboxStoreOptions<T> & StoreProps<CheckboxStoreState<T>>;
40
- export type CheckboxStore<T extends Value = Value> = CheckboxStoreFunctions<T> & Store<CheckboxStoreState<T>>;
41
- export {};
38
+ export interface CheckboxStoreProps<T extends CheckboxStoreValue = CheckboxStoreValue> extends CheckboxStoreOptions<T>, StoreProps<CheckboxStoreState<T>> {
39
+ }
40
+ export interface CheckboxStore<T extends CheckboxStoreValue = CheckboxStoreValue> extends CheckboxStoreFunctions<T>, Store<CheckboxStoreState<T>> {
41
+ }
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  createStore,
4
4
  throwOnConflictingProps
5
- } from "../__chunks/E7OQVGGY.js";
5
+ } from "../__chunks/A2J4XZ5T.js";
6
6
  import {
7
7
  defaultValue
8
8
  } from "../__chunks/I2VQ3XGR.js";
@@ -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
- interface 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,15 +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 interface CollectionStoreProps<T extends Item = Item> extends CollectionStoreOptions<T>, StoreProps<CollectionStoreState<T>> {
68
+ export interface CollectionStoreProps<T extends CollectionStoreItem = CollectionStoreItem> extends CollectionStoreOptions<T>, StoreProps<CollectionStoreState<T>> {
64
69
  }
65
- export interface CollectionStore<T extends Item = Item> extends CollectionStoreFunctions<T>, Store<CollectionStoreState<T>> {
70
+ export interface CollectionStore<T extends CollectionStoreItem = CollectionStoreItem> extends CollectionStoreFunctions<T>, Store<CollectionStoreState<T>> {
66
71
  }
67
- export {};
@@ -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";
@@ -2,19 +2,17 @@ import type { CompositeStoreFunctions, CompositeStoreItem, CompositeStoreOptions
2
2
  import type { PopoverStoreFunctions, PopoverStoreOptions, PopoverStoreState } from "../popover/popover-store.js";
3
3
  import type { Store, StoreOptions, StoreProps } from "../utils/store.js";
4
4
  import type { PickRequired, SetState } from "../utils/types.js";
5
- type Value = string | string[];
6
- type MutableValue<T extends Value = Value> = T extends string ? string : T;
7
- interface Item extends CompositeStoreItem {
8
- value?: string;
9
- }
5
+ type MutableValue<T extends ComboboxStoreSelectedValue = ComboboxStoreSelectedValue> = T extends string ? string : T;
10
6
  /**
11
7
  * Creates a combobox store.
12
8
  */
13
- export declare function createComboboxStore<T extends Value = Value>(props: PickRequired<ComboboxStoreProps<T>, "selectedValue" | "defaultSelectedValue">): ComboboxStore<T>;
9
+ export declare function createComboboxStore<T extends ComboboxStoreSelectedValue = ComboboxStoreSelectedValue>(props: PickRequired<ComboboxStoreProps<T>, "selectedValue" | "defaultSelectedValue">): ComboboxStore<T>;
14
10
  export declare function createComboboxStore(props?: ComboboxStoreProps): ComboboxStore;
15
- export type ComboboxStoreItem = Item;
16
- export type ComboboxStoreSelectedValue = Value;
17
- export interface ComboboxStoreState<T extends Value = Value> 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 {
18
16
  /**
19
17
  * @default true
20
18
  */
@@ -78,7 +76,7 @@ export interface ComboboxStoreState<T extends Value = Value> extends CompositeSt
78
76
  */
79
77
  resetValueOnSelect: boolean;
80
78
  }
81
- export interface ComboboxStoreFunctions<T extends Value = Value> extends CompositeStoreFunctions<Item>, PopoverStoreFunctions {
79
+ export interface ComboboxStoreFunctions<T extends ComboboxStoreSelectedValue = ComboboxStoreSelectedValue> extends CompositeStoreFunctions<ComboboxStoreItem>, PopoverStoreFunctions {
82
80
  /**
83
81
  * Sets the [`value`](https://ariakit.org/reference/combobox-provider#value)
84
82
  * state.
@@ -98,11 +96,11 @@ export interface ComboboxStoreFunctions<T extends Value = Value> extends Composi
98
96
  */
99
97
  setSelectedValue: SetState<ComboboxStoreState<T>["selectedValue"]>;
100
98
  }
101
- export interface ComboboxStoreOptions<T extends Value = Value> extends StoreOptions<ComboboxStoreState<T>, "includesBaseElement" | "value" | "selectedValue" | "resetValueOnHide" | "resetValueOnSelect">, CompositeStoreOptions<Item>, PopoverStoreOptions {
99
+ export interface ComboboxStoreOptions<T extends ComboboxStoreSelectedValue = ComboboxStoreSelectedValue> extends CompositeStoreOptions<ComboboxStoreItem>, PopoverStoreOptions, StoreOptions<ComboboxStoreState<T>, "includesBaseElement" | "value" | "selectedValue" | "resetValueOnHide" | "resetValueOnSelect"> {
102
100
  /**
103
101
  * @default null
104
102
  */
105
- defaultActiveId?: CompositeStoreOptions<Item>["activeId"];
103
+ defaultActiveId?: CompositeStoreOptions<ComboboxStoreItem>["activeId"];
106
104
  /**
107
105
  * The initial value of the combobox input.
108
106
  * @default ""
@@ -118,8 +116,8 @@ export interface ComboboxStoreOptions<T extends Value = Value> extends StoreOpti
118
116
  */
119
117
  defaultSelectedValue?: ComboboxStoreState<T>["selectedValue"];
120
118
  }
121
- export interface ComboboxStoreProps<T extends Value = Value> extends ComboboxStoreOptions<T>, StoreProps<ComboboxStoreState<T>> {
119
+ export interface ComboboxStoreProps<T extends ComboboxStoreSelectedValue = ComboboxStoreSelectedValue> extends ComboboxStoreOptions<T>, StoreProps<ComboboxStoreState<T>> {
122
120
  }
123
- export interface ComboboxStore<T extends Value = Value> extends ComboboxStoreFunctions<T>, Store<ComboboxStoreState<T>> {
121
+ export interface ComboboxStore<T extends ComboboxStoreSelectedValue = ComboboxStoreSelectedValue> extends ComboboxStoreFunctions<T>, Store<ComboboxStoreState<T>> {
124
122
  }
125
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";
@@ -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
- interface Item extends 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
  */
@@ -117,7 +127,7 @@ export interface CompositeStoreState<T extends Item = Item> extends CollectionSt
117
127
  */
118
128
  activeId: string | null | undefined;
119
129
  }
120
- export interface CompositeStoreFunctions<T extends Item = Item> extends CollectionStoreFunctions<T> {
130
+ export interface CompositeStoreFunctions<T extends CompositeStoreItem = CompositeStoreItem> extends CollectionStoreFunctions<T> {
121
131
  /**
122
132
  * Sets the `baseElement`.
123
133
  */
@@ -188,7 +198,7 @@ export interface CompositeStoreFunctions<T extends Item = Item> extends Collecti
188
198
  */
189
199
  last: () => string | null | undefined;
190
200
  }
191
- 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"> {
192
202
  /**
193
203
  * The composite item id that should be active by default when the composite
194
204
  * widget is rendered. If `null`, the composite element itself will have focus
@@ -197,8 +207,8 @@ export interface CompositeStoreOptions<T extends Item = Item> extends StoreOptio
197
207
  */
198
208
  defaultActiveId?: CompositeStoreState<T>["activeId"];
199
209
  }
200
- export interface CompositeStoreProps<T extends Item = Item> extends CompositeStoreOptions<T>, StoreProps<CompositeStoreState<T>> {
210
+ export interface CompositeStoreProps<T extends CompositeStoreItem = CompositeStoreItem> extends CompositeStoreOptions<T>, StoreProps<CompositeStoreState<T>> {
201
211
  }
202
- export interface CompositeStore<T extends Item = Item> extends CompositeStoreFunctions<T>, Store<CompositeStoreState<T>> {
212
+ export interface CompositeStore<T extends CompositeStoreItem = CompositeStoreItem> extends CompositeStoreFunctions<T>, Store<CompositeStoreState<T>> {
203
213
  }
204
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 {
@@ -123,5 +123,7 @@ export interface DisclosureStoreOptions extends StoreOptions<DisclosureStoreStat
123
123
  */
124
124
  disclosure?: DisclosureStore | null;
125
125
  }
126
- export type DisclosureStoreProps = DisclosureStoreOptions & StoreProps<DisclosureStoreState>;
127
- 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 {};