@ariakit/core 0.1.4 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/cjs/__chunks/{QYB6XH64.cjs → 27ZAGOYG.cjs} +17 -13
  3. package/cjs/__chunks/6455U47T.cjs +37 -0
  4. package/cjs/__chunks/{ZPOXPO2L.cjs → 6SPJEESB.cjs} +33 -21
  5. package/cjs/__chunks/{2YFRPUZP.cjs → DBHIHK7C.cjs} +6 -6
  6. package/cjs/__chunks/{W5IHD6VG.cjs → EUJ6NNA6.cjs} +56 -43
  7. package/cjs/__chunks/{4DQ3OTE7.cjs → FXEBKN6G.cjs} +22 -17
  8. package/cjs/__chunks/{ZJEEK57E.cjs → HEFJPUYD.cjs} +2 -2
  9. package/cjs/__chunks/LBTLD2RB.cjs +58 -0
  10. package/cjs/__chunks/{QNEPGQLL.cjs → M6ZA7XUP.cjs} +6 -2
  11. package/cjs/__chunks/{HLVPXX7H.cjs → SDBF6KIY.cjs} +107 -107
  12. package/cjs/__chunks/{OFNGELMA.cjs → ZNW4LSWU.cjs} +8 -6
  13. package/cjs/checkbox/checkbox-store.cjs +14 -10
  14. package/cjs/collection/collection-store.cjs +6 -5
  15. package/cjs/combobox/combobox-store.cjs +49 -48
  16. package/cjs/composite/composite-overflow-store.cjs +7 -6
  17. package/cjs/composite/composite-store.cjs +7 -6
  18. package/cjs/dialog/dialog-store.cjs +6 -5
  19. package/cjs/disclosure/disclosure-store.cjs +5 -4
  20. package/cjs/disclosure/disclosure-store.d.ts +8 -0
  21. package/cjs/form/form-store.cjs +38 -35
  22. package/cjs/hovercard/hovercard-store.cjs +8 -7
  23. package/cjs/index.cjs +3 -1
  24. package/cjs/menu/menu-bar-store.cjs +17 -13
  25. package/cjs/menu/menu-store.cjs +41 -43
  26. package/cjs/popover/popover-store.cjs +7 -6
  27. package/cjs/radio/radio-store.cjs +25 -24
  28. package/cjs/select/select-store.cjs +42 -42
  29. package/cjs/tab/tab-store.cjs +29 -28
  30. package/cjs/tab/tab-store.d.ts +9 -0
  31. package/cjs/toolbar/toolbar-store.cjs +17 -13
  32. package/cjs/tooltip/tooltip-store.cjs +24 -25
  33. package/cjs/tsconfig.build.tsbuildinfo +1 -1
  34. package/cjs/utils/array.cjs +1 -0
  35. package/cjs/utils/dom.cjs +3 -2
  36. package/cjs/utils/events.cjs +14 -9
  37. package/cjs/utils/focus.cjs +24 -14
  38. package/cjs/utils/misc.cjs +3 -2
  39. package/cjs/utils/platform.cjs +4 -3
  40. package/cjs/utils/store.cjs +4 -3
  41. package/esm/__chunks/4BKCJXBM.js +37 -0
  42. package/esm/__chunks/AHZW5LR4.js +58 -0
  43. package/esm/__chunks/{NA5BK7DD.js → BOKMNDR7.js} +22 -10
  44. package/esm/__chunks/{6PEWNRTN.js → CUW3E24J.js} +100 -100
  45. package/esm/__chunks/{WFGVC6LE.js → EWHSN7GO.js} +17 -12
  46. package/esm/__chunks/{4T5RHRE5.js → MNNKHNLW.js} +1 -1
  47. package/esm/__chunks/{UVCATTRC.js → N6JW4ITM.js} +7 -5
  48. package/esm/__chunks/{RMD7SNCC.js → NWU4GBZ6.js} +5 -1
  49. package/esm/__chunks/{X7MJ3FB5.js → R6VHFWTV.js} +49 -36
  50. package/esm/__chunks/{DXA3K2FY.js → TFBCK4JB.js} +1 -1
  51. package/esm/__chunks/{IOAGNCXX.js → ZV2GEGPL.js} +14 -10
  52. package/esm/checkbox/checkbox-store.js +11 -7
  53. package/esm/collection/collection-store.js +5 -4
  54. package/esm/combobox/combobox-store.js +34 -33
  55. package/esm/composite/composite-overflow-store.js +6 -5
  56. package/esm/composite/composite-store.js +6 -5
  57. package/esm/dialog/dialog-store.js +5 -4
  58. package/esm/disclosure/disclosure-store.d.ts +8 -0
  59. package/esm/disclosure/disclosure-store.js +4 -3
  60. package/esm/form/form-store.js +24 -21
  61. package/esm/hovercard/hovercard-store.js +7 -6
  62. package/esm/index.js +2 -0
  63. package/esm/menu/menu-bar-store.js +15 -11
  64. package/esm/menu/menu-store.js +31 -33
  65. package/esm/popover/popover-store.js +6 -5
  66. package/esm/radio/radio-store.js +22 -21
  67. package/esm/select/select-store.js +29 -29
  68. package/esm/tab/tab-store.d.ts +9 -0
  69. package/esm/tab/tab-store.js +23 -22
  70. package/esm/toolbar/toolbar-store.js +15 -11
  71. package/esm/tooltip/tooltip-store.js +20 -21
  72. package/esm/tsconfig.build.tsbuildinfo +1 -1
  73. package/esm/utils/array.js +1 -0
  74. package/esm/utils/dom.js +2 -1
  75. package/esm/utils/events.js +10 -5
  76. package/esm/utils/focus.js +14 -4
  77. package/esm/utils/misc.js +2 -1
  78. package/esm/utils/platform.js +3 -2
  79. package/esm/utils/store.js +3 -2
  80. package/package.json +1 -1
  81. package/cjs/__chunks/DQHU5K4Q.cjs +0 -57
  82. package/esm/__chunks/6HMPWUDT.js +0 -57
@@ -1,9 +1,10 @@
1
1
  import {
2
2
  createDialogStore
3
- } from "../__chunks/4T5RHRE5.js";
4
- import "../__chunks/IOAGNCXX.js";
5
- import "../__chunks/NA5BK7DD.js";
6
- import "../__chunks/RMD7SNCC.js";
3
+ } from "../__chunks/MNNKHNLW.js";
4
+ import "../__chunks/ZV2GEGPL.js";
5
+ import "../__chunks/BOKMNDR7.js";
6
+ import "../__chunks/NWU4GBZ6.js";
7
+ import "../__chunks/4BKCJXBM.js";
7
8
  export {
8
9
  createDialogStore
9
10
  };
@@ -7,6 +7,10 @@ export declare function createDisclosureStore(props?: DisclosureStoreProps): Dis
7
7
  export interface DisclosureStoreState {
8
8
  /**
9
9
  * The visibility state of the content.
10
+ *
11
+ * Live examples:
12
+ * - [Dialog with React
13
+ * Router](https://ariakit.org/examples/dialog-react-router)
10
14
  * @default false
11
15
  */
12
16
  open: boolean;
@@ -58,6 +62,8 @@ export interface DisclosureStoreFunctions {
58
62
  * Live examples:
59
63
  * - [Textarea with inline
60
64
  * Combobox](https://ariakit.org/examples/combobox-textarea)
65
+ * - [Dialog with React
66
+ * Router](https://ariakit.org/examples/dialog-react-router)
61
67
  * @example
62
68
  * store.setOpen(true);
63
69
  * store.setOpen((open) => !open);
@@ -77,6 +83,8 @@ export interface DisclosureStoreFunctions {
77
83
  * Live examples:
78
84
  * - [Textarea with inline
79
85
  * Combobox](https://ariakit.org/examples/combobox-textarea)
86
+ * - [Dialog with React
87
+ * Router](https://ariakit.org/examples/dialog-react-router)
80
88
  */
81
89
  hide: () => void;
82
90
  /**
@@ -1,8 +1,9 @@
1
1
  import {
2
2
  createDisclosureStore
3
- } from "../__chunks/IOAGNCXX.js";
4
- import "../__chunks/NA5BK7DD.js";
5
- import "../__chunks/RMD7SNCC.js";
3
+ } from "../__chunks/ZV2GEGPL.js";
4
+ import "../__chunks/BOKMNDR7.js";
5
+ import "../__chunks/NWU4GBZ6.js";
6
+ import "../__chunks/4BKCJXBM.js";
6
7
  export {
7
8
  createDisclosureStore
8
9
  };
@@ -1,16 +1,20 @@
1
1
  import {
2
2
  createCollectionStore
3
- } from "../__chunks/WFGVC6LE.js";
3
+ } from "../__chunks/EWHSN7GO.js";
4
4
  import {
5
5
  createStore
6
- } from "../__chunks/NA5BK7DD.js";
6
+ } from "../__chunks/BOKMNDR7.js";
7
7
  import {
8
8
  applyState,
9
9
  defaultValue,
10
10
  isInteger,
11
11
  isObject
12
- } from "../__chunks/RMD7SNCC.js";
13
- import "../__chunks/UVCATTRC.js";
12
+ } from "../__chunks/NWU4GBZ6.js";
13
+ import "../__chunks/N6JW4ITM.js";
14
+ import {
15
+ __spreadProps,
16
+ __spreadValues
17
+ } from "../__chunks/4BKCJXBM.js";
14
18
 
15
19
  // src/form/form-store.ts
16
20
  function nextFrame() {
@@ -25,12 +29,13 @@ function hasMessages(object) {
25
29
  });
26
30
  }
27
31
  function get(values, path, defaultValue2) {
32
+ var _a;
28
33
  const [key, ...rest] = Array.isArray(path) ? path : `${path}`.split(".");
29
34
  if (key == null || !values) {
30
35
  return defaultValue2;
31
36
  }
32
37
  if (!rest.length) {
33
- return values[key] ?? defaultValue2;
38
+ return (_a = values[key]) != null ? _a : defaultValue2;
34
39
  }
35
40
  return get(values[key], rest, defaultValue2);
36
41
  }
@@ -56,7 +61,7 @@ function set(values, path, value) {
56
61
  nextValues2[index] = result;
57
62
  return nextValues2;
58
63
  }
59
- return { ...values, [key]: result };
64
+ return __spreadProps(__spreadValues({}, values), { [key]: result });
60
65
  }
61
66
  function setAll(values, value) {
62
67
  const result = {};
@@ -101,37 +106,37 @@ function createNames() {
101
106
  return new Proxy(/* @__PURE__ */ Object.create(null), getNameHandler(cache));
102
107
  }
103
108
  function createFormStore(props = {}) {
104
- const syncState = props.store?.getState();
109
+ var _a;
110
+ const syncState = (_a = props.store) == null ? void 0 : _a.getState();
105
111
  const collection = createCollectionStore(props);
106
112
  const values = defaultValue(
107
113
  props.values,
108
- syncState?.values,
114
+ syncState == null ? void 0 : syncState.values,
109
115
  props.defaultValues,
110
116
  {}
111
117
  );
112
118
  const errors = defaultValue(
113
119
  props.errors,
114
- syncState?.errors,
120
+ syncState == null ? void 0 : syncState.errors,
115
121
  props.defaultErrors,
116
122
  {}
117
123
  );
118
124
  const touched = defaultValue(
119
125
  props.touched,
120
- syncState?.touched,
126
+ syncState == null ? void 0 : syncState.touched,
121
127
  props.defaultTouched,
122
128
  {}
123
129
  );
124
- const initialState = {
125
- ...collection.getState(),
130
+ const initialState = __spreadProps(__spreadValues({}, collection.getState()), {
126
131
  values,
127
132
  errors,
128
133
  touched,
129
- validating: defaultValue(syncState?.validating, false),
130
- submitting: defaultValue(syncState?.submitting, false),
131
- submitSucceed: defaultValue(syncState?.submitSucceed, 0),
132
- submitFailed: defaultValue(syncState?.submitFailed, 0),
134
+ validating: defaultValue(syncState == null ? void 0 : syncState.validating, false),
135
+ submitting: defaultValue(syncState == null ? void 0 : syncState.submitting, false),
136
+ submitSucceed: defaultValue(syncState == null ? void 0 : syncState.submitSucceed, 0),
137
+ submitFailed: defaultValue(syncState == null ? void 0 : syncState.submitFailed, 0),
133
138
  valid: !hasMessages(errors)
134
- };
139
+ });
135
140
  const form = createStore(initialState, collection, props.store);
136
141
  const validateCallbacks = /* @__PURE__ */ new Set();
137
142
  const submitCallbacks = /* @__PURE__ */ new Set();
@@ -148,9 +153,7 @@ function createFormStore(props = {}) {
148
153
  form.setState("validating", false);
149
154
  }
150
155
  };
151
- return {
152
- ...collection,
153
- ...form,
156
+ return __spreadProps(__spreadValues(__spreadValues({}, collection), form), {
154
157
  names: createNames(),
155
158
  setValues: (values2) => form.setState("values", values2),
156
159
  getValue: (name) => get(form.getState().values, name),
@@ -232,7 +235,7 @@ function createFormStore(props = {}) {
232
235
  form.setState("submitSucceed", 0);
233
236
  form.setState("submitFailed", 0);
234
237
  }
235
- };
238
+ });
236
239
  }
237
240
  export {
238
241
  createFormStore,
@@ -1,11 +1,12 @@
1
1
  import {
2
2
  createHovercardStore
3
- } from "../__chunks/6HMPWUDT.js";
4
- import "../__chunks/6PEWNRTN.js";
5
- import "../__chunks/4T5RHRE5.js";
6
- import "../__chunks/IOAGNCXX.js";
7
- import "../__chunks/NA5BK7DD.js";
8
- import "../__chunks/RMD7SNCC.js";
3
+ } from "../__chunks/AHZW5LR4.js";
4
+ import "../__chunks/CUW3E24J.js";
5
+ import "../__chunks/MNNKHNLW.js";
6
+ import "../__chunks/ZV2GEGPL.js";
7
+ import "../__chunks/BOKMNDR7.js";
8
+ import "../__chunks/NWU4GBZ6.js";
9
+ import "../__chunks/4BKCJXBM.js";
9
10
  export {
10
11
  createHovercardStore
11
12
  };
package/esm/index.js CHANGED
@@ -1,3 +1,5 @@
1
+ import "./__chunks/4BKCJXBM.js";
2
+
1
3
  // src/index.ts
2
4
  var src_default = {};
3
5
  export {
@@ -1,26 +1,30 @@
1
1
  import {
2
2
  createCompositeStore
3
- } from "../__chunks/X7MJ3FB5.js";
4
- import "../__chunks/WFGVC6LE.js";
5
- import "../__chunks/NA5BK7DD.js";
3
+ } from "../__chunks/R6VHFWTV.js";
4
+ import "../__chunks/EWHSN7GO.js";
5
+ import "../__chunks/BOKMNDR7.js";
6
6
  import {
7
7
  defaultValue
8
- } from "../__chunks/RMD7SNCC.js";
9
- import "../__chunks/UVCATTRC.js";
8
+ } from "../__chunks/NWU4GBZ6.js";
9
+ import "../__chunks/N6JW4ITM.js";
10
10
  import "../__chunks/5XEKIOCW.js";
11
+ import {
12
+ __spreadProps,
13
+ __spreadValues
14
+ } from "../__chunks/4BKCJXBM.js";
11
15
 
12
16
  // src/menu/menu-bar-store.ts
13
17
  function createMenuBarStore(props = {}) {
14
- const syncState = props.store?.getState();
15
- return createCompositeStore({
16
- ...props,
18
+ var _a;
19
+ const syncState = (_a = props.store) == null ? void 0 : _a.getState();
20
+ return createCompositeStore(__spreadProps(__spreadValues({}, props), {
17
21
  orientation: defaultValue(
18
22
  props.orientation,
19
- syncState?.orientation,
23
+ syncState == null ? void 0 : syncState.orientation,
20
24
  "horizontal"
21
25
  ),
22
- focusLoop: defaultValue(props.focusLoop, syncState?.focusLoop, true)
23
- });
26
+ focusLoop: defaultValue(props.focusLoop, syncState == null ? void 0 : syncState.focusLoop, true)
27
+ }));
24
28
  }
25
29
  export {
26
30
  createMenuBarStore
@@ -1,33 +1,39 @@
1
1
  import {
2
2
  createHovercardStore
3
- } from "../__chunks/6HMPWUDT.js";
4
- import "../__chunks/6PEWNRTN.js";
5
- import "../__chunks/4T5RHRE5.js";
6
- import "../__chunks/IOAGNCXX.js";
3
+ } from "../__chunks/AHZW5LR4.js";
4
+ import "../__chunks/CUW3E24J.js";
5
+ import "../__chunks/MNNKHNLW.js";
6
+ import "../__chunks/ZV2GEGPL.js";
7
7
  import {
8
8
  createCompositeStore
9
- } from "../__chunks/X7MJ3FB5.js";
10
- import "../__chunks/WFGVC6LE.js";
9
+ } from "../__chunks/R6VHFWTV.js";
10
+ import "../__chunks/EWHSN7GO.js";
11
11
  import {
12
12
  createStore,
13
13
  mergeStore
14
- } from "../__chunks/NA5BK7DD.js";
14
+ } from "../__chunks/BOKMNDR7.js";
15
15
  import {
16
16
  applyState,
17
17
  defaultValue
18
- } from "../__chunks/RMD7SNCC.js";
19
- import "../__chunks/UVCATTRC.js";
18
+ } from "../__chunks/NWU4GBZ6.js";
19
+ import "../__chunks/N6JW4ITM.js";
20
20
  import "../__chunks/5XEKIOCW.js";
21
+ import {
22
+ __objRest,
23
+ __spreadProps,
24
+ __spreadValues
25
+ } from "../__chunks/4BKCJXBM.js";
21
26
 
22
27
  // src/menu/menu-store.ts
23
- function createMenuStore({
24
- combobox,
25
- ...props
26
- } = {}) {
28
+ function createMenuStore(_a = {}) {
29
+ var _b = _a, {
30
+ combobox
31
+ } = _b, props = __objRest(_b, [
32
+ "combobox"
33
+ ]);
27
34
  const store = mergeStore(
28
35
  props.store,
29
- combobox?.omit(
30
- "baseElement",
36
+ combobox == null ? void 0 : combobox.omit(
31
37
  "arrowElement",
32
38
  "anchorElement",
33
39
  "contentElement",
@@ -36,17 +42,15 @@ function createMenuStore({
36
42
  )
37
43
  );
38
44
  const syncState = store.getState();
39
- const composite = createCompositeStore({
40
- ...props,
45
+ const composite = createCompositeStore(__spreadProps(__spreadValues({}, props), {
41
46
  store,
42
47
  orientation: defaultValue(
43
48
  props.orientation,
44
49
  syncState.orientation,
45
50
  "vertical"
46
51
  )
47
- });
48
- const hovercard = createHovercardStore({
49
- ...props,
52
+ }));
53
+ const hovercard = createHovercardStore(__spreadProps(__spreadValues({}, props), {
50
54
  store,
51
55
  placement: defaultValue(
52
56
  props.placement,
@@ -54,10 +58,8 @@ function createMenuStore({
54
58
  "bottom-start"
55
59
  ),
56
60
  hideTimeout: defaultValue(props.hideTimeout, syncState.hideTimeout, 0)
57
- });
58
- const initialState = {
59
- ...composite.getState(),
60
- ...hovercard.getState(),
61
+ }));
62
+ const initialState = __spreadProps(__spreadValues(__spreadValues({}, composite.getState()), hovercard.getState()), {
61
63
  initialFocus: defaultValue(syncState.initialFocus, "container"),
62
64
  values: defaultValue(
63
65
  props.values,
@@ -65,7 +67,7 @@ function createMenuStore({
65
67
  props.defaultValues,
66
68
  {}
67
69
  )
68
- };
70
+ });
69
71
  const menu = createStore(initialState, composite, hovercard, store);
70
72
  menu.setup(
71
73
  () => menu.sync(
@@ -77,10 +79,7 @@ function createMenuStore({
77
79
  ["mounted"]
78
80
  )
79
81
  );
80
- return {
81
- ...composite,
82
- ...hovercard,
83
- ...menu,
82
+ return __spreadProps(__spreadValues(__spreadValues(__spreadValues({}, composite), hovercard), menu), {
84
83
  setInitialFocus: (value) => menu.setState("initialFocus", value),
85
84
  setValues: (values) => menu.setState("values", values),
86
85
  setValue: (name, value) => {
@@ -95,13 +94,12 @@ function createMenuStore({
95
94
  const nextValue = applyState(value, prevValue);
96
95
  if (nextValue === prevValue)
97
96
  return values;
98
- return {
99
- ...values,
97
+ return __spreadProps(__spreadValues({}, values), {
100
98
  [name]: nextValue !== void 0 && nextValue
101
- };
99
+ });
102
100
  });
103
101
  }
104
- };
102
+ });
105
103
  }
106
104
  export {
107
105
  createMenuStore
@@ -1,10 +1,11 @@
1
1
  import {
2
2
  createPopoverStore
3
- } from "../__chunks/6PEWNRTN.js";
4
- import "../__chunks/4T5RHRE5.js";
5
- import "../__chunks/IOAGNCXX.js";
6
- import "../__chunks/NA5BK7DD.js";
7
- import "../__chunks/RMD7SNCC.js";
3
+ } from "../__chunks/CUW3E24J.js";
4
+ import "../__chunks/MNNKHNLW.js";
5
+ import "../__chunks/ZV2GEGPL.js";
6
+ import "../__chunks/BOKMNDR7.js";
7
+ import "../__chunks/NWU4GBZ6.js";
8
+ import "../__chunks/4BKCJXBM.js";
8
9
  export {
9
10
  createPopoverStore
10
11
  };
@@ -1,40 +1,41 @@
1
1
  import {
2
2
  createCompositeStore
3
- } from "../__chunks/X7MJ3FB5.js";
4
- import "../__chunks/WFGVC6LE.js";
3
+ } from "../__chunks/R6VHFWTV.js";
4
+ import "../__chunks/EWHSN7GO.js";
5
5
  import {
6
6
  createStore
7
- } from "../__chunks/NA5BK7DD.js";
7
+ } from "../__chunks/BOKMNDR7.js";
8
8
  import {
9
9
  defaultValue
10
- } from "../__chunks/RMD7SNCC.js";
11
- import "../__chunks/UVCATTRC.js";
10
+ } from "../__chunks/NWU4GBZ6.js";
11
+ import "../__chunks/N6JW4ITM.js";
12
12
  import "../__chunks/5XEKIOCW.js";
13
+ import {
14
+ __objRest,
15
+ __spreadProps,
16
+ __spreadValues
17
+ } from "../__chunks/4BKCJXBM.js";
13
18
 
14
19
  // src/radio/radio-store.ts
15
- function createRadioStore({
16
- ...props
17
- } = {}) {
18
- const syncState = props.store?.getState();
19
- const composite = createCompositeStore({
20
- ...props,
21
- focusLoop: defaultValue(props.focusLoop, syncState?.focusLoop, true)
22
- });
23
- const initialState = {
24
- ...composite.getState(),
20
+ function createRadioStore(_a = {}) {
21
+ var props = __objRest(_a, []);
22
+ var _a2;
23
+ const syncState = (_a2 = props.store) == null ? void 0 : _a2.getState();
24
+ const composite = createCompositeStore(__spreadProps(__spreadValues({}, props), {
25
+ focusLoop: defaultValue(props.focusLoop, syncState == null ? void 0 : syncState.focusLoop, true)
26
+ }));
27
+ const initialState = __spreadProps(__spreadValues({}, composite.getState()), {
25
28
  value: defaultValue(
26
29
  props.value,
27
- syncState?.value,
30
+ syncState == null ? void 0 : syncState.value,
28
31
  props.defaultValue,
29
32
  null
30
33
  )
31
- };
34
+ });
32
35
  const radio = createStore(initialState, composite, props.store);
33
- return {
34
- ...composite,
35
- ...radio,
36
+ return __spreadProps(__spreadValues(__spreadValues({}, composite), radio), {
36
37
  setValue: (value) => radio.setState("value", value)
37
- };
38
+ });
38
39
  }
39
40
  export {
40
41
  createRadioStore
@@ -1,32 +1,39 @@
1
1
  import {
2
2
  createPopoverStore
3
- } from "../__chunks/6PEWNRTN.js";
4
- import "../__chunks/4T5RHRE5.js";
5
- import "../__chunks/IOAGNCXX.js";
3
+ } from "../__chunks/CUW3E24J.js";
4
+ import "../__chunks/MNNKHNLW.js";
5
+ import "../__chunks/ZV2GEGPL.js";
6
6
  import {
7
7
  createCompositeStore
8
- } from "../__chunks/X7MJ3FB5.js";
9
- import "../__chunks/WFGVC6LE.js";
8
+ } from "../__chunks/R6VHFWTV.js";
9
+ import "../__chunks/EWHSN7GO.js";
10
10
  import {
11
11
  createStore,
12
12
  mergeStore
13
- } from "../__chunks/NA5BK7DD.js";
13
+ } from "../__chunks/BOKMNDR7.js";
14
14
  import {
15
15
  defaultValue
16
- } from "../__chunks/RMD7SNCC.js";
17
- import "../__chunks/UVCATTRC.js";
16
+ } from "../__chunks/NWU4GBZ6.js";
17
+ import "../__chunks/N6JW4ITM.js";
18
18
  import {
19
19
  toArray
20
20
  } from "../__chunks/5XEKIOCW.js";
21
+ import {
22
+ __objRest,
23
+ __spreadProps,
24
+ __spreadValues
25
+ } from "../__chunks/4BKCJXBM.js";
21
26
 
22
27
  // src/select/select-store.ts
23
- function createSelectStore({
24
- combobox,
25
- ...props
26
- } = {}) {
28
+ function createSelectStore(_a = {}) {
29
+ var _b = _a, {
30
+ combobox
31
+ } = _b, props = __objRest(_b, [
32
+ "combobox"
33
+ ]);
27
34
  const store = mergeStore(
28
35
  props.store,
29
- combobox?.omit(
36
+ combobox == null ? void 0 : combobox.omit(
30
37
  "value",
31
38
  "items",
32
39
  "renderedItems",
@@ -39,8 +46,7 @@ function createSelectStore({
39
46
  )
40
47
  );
41
48
  const syncState = store.getState();
42
- const composite = createCompositeStore({
43
- ...props,
49
+ const composite = createCompositeStore(__spreadProps(__spreadValues({}, props), {
44
50
  store,
45
51
  virtualFocus: defaultValue(
46
52
  props.virtualFocus,
@@ -63,20 +69,17 @@ function createSelectStore({
63
69
  syncState.orientation,
64
70
  "vertical"
65
71
  )
66
- });
67
- const popover = createPopoverStore({
68
- ...props,
72
+ }));
73
+ const popover = createPopoverStore(__spreadProps(__spreadValues({}, props), {
69
74
  store,
70
75
  placement: defaultValue(
71
76
  props.placement,
72
77
  syncState.placement,
73
78
  "bottom-start"
74
79
  )
75
- });
80
+ }));
76
81
  const initialValue = new String("");
77
- const initialState = {
78
- ...composite.getState(),
79
- ...popover.getState(),
82
+ const initialState = __spreadProps(__spreadValues(__spreadValues({}, composite.getState()), popover.getState()), {
80
83
  value: defaultValue(
81
84
  props.value,
82
85
  syncState.value,
@@ -90,7 +93,7 @@ function createSelectStore({
90
93
  ),
91
94
  selectElement: defaultValue(syncState.selectElement, null),
92
95
  labelElement: defaultValue(syncState.labelElement, null)
93
- };
96
+ });
94
97
  const select = createStore(initialState, composite, popover, store);
95
98
  select.setup(
96
99
  () => select.sync(
@@ -102,7 +105,7 @@ function createSelectStore({
102
105
  const item = state.items.find(
103
106
  (item2) => !item2.disabled && item2.value != null
104
107
  );
105
- if (item?.value == null)
108
+ if ((item == null ? void 0 : item.value) == null)
106
109
  return;
107
110
  select.setState("value", item.value);
108
111
  },
@@ -150,14 +153,11 @@ function createSelectStore({
150
153
  ["setValueOnMove", "moves"]
151
154
  )
152
155
  );
153
- return {
154
- ...composite,
155
- ...popover,
156
- ...select,
156
+ return __spreadProps(__spreadValues(__spreadValues(__spreadValues({}, composite), popover), select), {
157
157
  setValue: (value) => select.setState("value", value),
158
158
  setSelectElement: (element) => select.setState("selectElement", element),
159
159
  setLabelElement: (element) => select.setState("labelElement", element)
160
- };
160
+ });
161
161
  }
162
162
  export {
163
163
  createSelectStore
@@ -23,11 +23,17 @@ export interface TabStoreState extends CompositeStoreState<Item> {
23
23
  /**
24
24
  * The id of the tab whose panel is currently visible. If it's `undefined`, it
25
25
  * will be automatically set to the first enabled tab.
26
+ *
27
+ * Live examples:
28
+ * - [Tab with React Router](https://ariakit.org/examples/tab-react-router)
26
29
  */
27
30
  selectedId: TabStoreState["activeId"];
28
31
  /**
29
32
  * Whether the tab should be selected when it receives focus. If it's set to
30
33
  * `false`, the tab will be selected only when it's clicked.
34
+ *
35
+ * Live examples:
36
+ * - [Tab with React Router](https://ariakit.org/examples/tab-react-router)
31
37
  * @default true
32
38
  */
33
39
  selectOnMove?: boolean;
@@ -36,6 +42,9 @@ export interface TabStoreFunctions extends CompositeStoreFunctions<Item> {
36
42
  /**
37
43
  * Sets the `selectedId` state without moving focus. If you want to move focus,
38
44
  * use the `select` function instead.
45
+ *
46
+ * Live examples:
47
+ * - [Tab with React Router](https://ariakit.org/examples/tab-react-router)
39
48
  * @example
40
49
  * // Selects the tab with id "tab-1"
41
50
  * store.setSelectedId("tab-1");