@ariakit/core 0.2.7 → 0.2.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 (58) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/cjs/__chunks/{ZXPKRPGY.cjs → DPHJ32KR.cjs} +8 -7
  3. package/cjs/__chunks/{SXMUYOXB.cjs → F5DMXFQ2.cjs} +30 -31
  4. package/cjs/__chunks/{5AWPMH4S.cjs → FS2K2N7U.cjs} +72 -25
  5. package/cjs/__chunks/{NVEPU4WA.cjs → MCCIH6SG.cjs} +4 -4
  6. package/cjs/__chunks/{PR7FUI5D.cjs → OQIG5VE3.cjs} +16 -16
  7. package/cjs/__chunks/{K2LZWNNX.cjs → PIEJYPN7.cjs} +2 -2
  8. package/cjs/__chunks/{RS4LBZRZ.cjs → V7OHZPBO.cjs} +28 -32
  9. package/cjs/checkbox/checkbox-store.cjs +2 -2
  10. package/cjs/collection/collection-store.cjs +3 -3
  11. package/cjs/combobox/combobox-store.cjs +53 -56
  12. package/cjs/combobox/combobox-store.d.ts +1 -1
  13. package/cjs/composite/composite-overflow-store.cjs +5 -5
  14. package/cjs/composite/composite-store.cjs +4 -4
  15. package/cjs/dialog/dialog-store.cjs +4 -4
  16. package/cjs/disclosure/disclosure-store.cjs +3 -3
  17. package/cjs/form/form-store.cjs +4 -4
  18. package/cjs/hovercard/hovercard-store.cjs +6 -6
  19. package/cjs/menu/menu-bar-store.cjs +4 -4
  20. package/cjs/menu/menu-store.cjs +23 -22
  21. package/cjs/popover/popover-store.cjs +5 -5
  22. package/cjs/radio/radio-store.cjs +5 -5
  23. package/cjs/select/select-store.cjs +65 -67
  24. package/cjs/tab/tab-store.cjs +55 -56
  25. package/cjs/toolbar/toolbar-store.cjs +4 -4
  26. package/cjs/tooltip/tooltip-store.cjs +7 -7
  27. package/cjs/tsconfig.build.tsbuildinfo +1 -1
  28. package/cjs/utils/store.cjs +16 -2
  29. package/cjs/utils/store.d.ts +19 -59
  30. package/esm/__chunks/{SHUO6V52.js → A7IMXABC.js} +29 -30
  31. package/esm/__chunks/{XJGRXN57.js → COUCUJML.js} +2 -2
  32. package/esm/__chunks/{UWW2ZP3K.js → LNMWV6UV.js} +1 -1
  33. package/esm/__chunks/{FQL4TRMX.js → OGOHEUXI.js} +71 -24
  34. package/esm/__chunks/{NRXA5QTV.js → ROY5BBHL.js} +15 -15
  35. package/esm/__chunks/{LM4QG55U.js → SOCHV2LZ.js} +6 -5
  36. package/esm/__chunks/{L5RO76KW.js → WSKDP2MG.js} +27 -31
  37. package/esm/checkbox/checkbox-store.js +1 -1
  38. package/esm/collection/collection-store.js +2 -2
  39. package/esm/combobox/combobox-store.d.ts +1 -1
  40. package/esm/combobox/combobox-store.js +50 -53
  41. package/esm/composite/composite-overflow-store.js +4 -4
  42. package/esm/composite/composite-store.js +3 -3
  43. package/esm/dialog/dialog-store.js +3 -3
  44. package/esm/disclosure/disclosure-store.js +2 -2
  45. package/esm/form/form-store.js +2 -2
  46. package/esm/hovercard/hovercard-store.js +5 -5
  47. package/esm/menu/menu-bar-store.js +3 -3
  48. package/esm/menu/menu-store.js +20 -19
  49. package/esm/popover/popover-store.js +4 -4
  50. package/esm/radio/radio-store.js +3 -3
  51. package/esm/select/select-store.js +62 -64
  52. package/esm/tab/tab-store.js +53 -54
  53. package/esm/toolbar/toolbar-store.js +3 -3
  54. package/esm/tooltip/tooltip-store.js +5 -5
  55. package/esm/tsconfig.build.tsbuildinfo +1 -1
  56. package/esm/utils/store.d.ts +19 -59
  57. package/esm/utils/store.js +17 -3
  58. package/package.json +1 -1
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  createHovercardStore
3
- } from "../__chunks/XJGRXN57.js";
4
- import "../__chunks/LM4QG55U.js";
5
- import "../__chunks/UWW2ZP3K.js";
6
- import "../__chunks/L5RO76KW.js";
7
- import "../__chunks/FQL4TRMX.js";
3
+ } from "../__chunks/COUCUJML.js";
4
+ import "../__chunks/SOCHV2LZ.js";
5
+ import "../__chunks/LNMWV6UV.js";
6
+ import "../__chunks/WSKDP2MG.js";
7
+ import "../__chunks/OGOHEUXI.js";
8
8
  import "../__chunks/WVTCK5PV.js";
9
9
  import "../__chunks/PNRLI7OV.js";
10
10
  export {
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  createCompositeStore
3
- } from "../__chunks/NRXA5QTV.js";
4
- import "../__chunks/SHUO6V52.js";
5
- import "../__chunks/FQL4TRMX.js";
3
+ } from "../__chunks/ROY5BBHL.js";
4
+ import "../__chunks/A7IMXABC.js";
5
+ import "../__chunks/OGOHEUXI.js";
6
6
  import {
7
7
  defaultValue
8
8
  } from "../__chunks/WVTCK5PV.js";
@@ -1,17 +1,20 @@
1
1
  import {
2
2
  createHovercardStore
3
- } from "../__chunks/XJGRXN57.js";
4
- import "../__chunks/LM4QG55U.js";
5
- import "../__chunks/UWW2ZP3K.js";
6
- import "../__chunks/L5RO76KW.js";
3
+ } from "../__chunks/COUCUJML.js";
4
+ import "../__chunks/SOCHV2LZ.js";
5
+ import "../__chunks/LNMWV6UV.js";
6
+ import "../__chunks/WSKDP2MG.js";
7
7
  import {
8
8
  createCompositeStore
9
- } from "../__chunks/NRXA5QTV.js";
10
- import "../__chunks/SHUO6V52.js";
9
+ } from "../__chunks/ROY5BBHL.js";
10
+ import "../__chunks/A7IMXABC.js";
11
11
  import {
12
12
  createStore,
13
- mergeStore
14
- } from "../__chunks/FQL4TRMX.js";
13
+ mergeStore,
14
+ omit,
15
+ setup,
16
+ sync
17
+ } from "../__chunks/OGOHEUXI.js";
15
18
  import {
16
19
  applyState,
17
20
  defaultValue
@@ -33,13 +36,13 @@ function createMenuStore(_a = {}) {
33
36
  ]);
34
37
  const store = mergeStore(
35
38
  props.store,
36
- combobox == null ? void 0 : combobox.omit(
39
+ omit(combobox, [
37
40
  "arrowElement",
38
41
  "anchorElement",
39
42
  "contentElement",
40
43
  "popoverElement",
41
44
  "disclosureElement"
42
- )
45
+ ])
43
46
  );
44
47
  const syncState = store.getState();
45
48
  const composite = createCompositeStore(__spreadProps(__spreadValues({}, props), {
@@ -69,15 +72,13 @@ function createMenuStore(_a = {}) {
69
72
  )
70
73
  });
71
74
  const menu = createStore(initialState, composite, hovercard, store);
72
- menu.setup(
73
- () => menu.sync(
74
- (state) => {
75
- if (state.mounted)
76
- return;
77
- menu.setState("activeId", null);
78
- },
79
- ["mounted"]
80
- )
75
+ setup(
76
+ menu,
77
+ () => sync(menu, ["mounted"], (state) => {
78
+ if (state.mounted)
79
+ return;
80
+ menu.setState("activeId", null);
81
+ })
81
82
  );
82
83
  return __spreadProps(__spreadValues(__spreadValues(__spreadValues({}, composite), hovercard), menu), {
83
84
  setInitialFocus: (value) => menu.setState("initialFocus", value),
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  createPopoverStore
3
- } from "../__chunks/LM4QG55U.js";
4
- import "../__chunks/UWW2ZP3K.js";
5
- import "../__chunks/L5RO76KW.js";
6
- import "../__chunks/FQL4TRMX.js";
3
+ } from "../__chunks/SOCHV2LZ.js";
4
+ import "../__chunks/LNMWV6UV.js";
5
+ import "../__chunks/WSKDP2MG.js";
6
+ import "../__chunks/OGOHEUXI.js";
7
7
  import "../__chunks/WVTCK5PV.js";
8
8
  import "../__chunks/PNRLI7OV.js";
9
9
  export {
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  createCompositeStore
3
- } from "../__chunks/NRXA5QTV.js";
4
- import "../__chunks/SHUO6V52.js";
3
+ } from "../__chunks/ROY5BBHL.js";
4
+ import "../__chunks/A7IMXABC.js";
5
5
  import {
6
6
  createStore
7
- } from "../__chunks/FQL4TRMX.js";
7
+ } from "../__chunks/OGOHEUXI.js";
8
8
  import {
9
9
  defaultValue
10
10
  } from "../__chunks/WVTCK5PV.js";
@@ -1,16 +1,20 @@
1
1
  import {
2
2
  createPopoverStore
3
- } from "../__chunks/LM4QG55U.js";
4
- import "../__chunks/UWW2ZP3K.js";
5
- import "../__chunks/L5RO76KW.js";
3
+ } from "../__chunks/SOCHV2LZ.js";
4
+ import "../__chunks/LNMWV6UV.js";
5
+ import "../__chunks/WSKDP2MG.js";
6
6
  import {
7
7
  createCompositeStore
8
- } from "../__chunks/NRXA5QTV.js";
9
- import "../__chunks/SHUO6V52.js";
8
+ } from "../__chunks/ROY5BBHL.js";
9
+ import "../__chunks/A7IMXABC.js";
10
10
  import {
11
+ batch,
11
12
  createStore,
12
- mergeStore
13
- } from "../__chunks/FQL4TRMX.js";
13
+ mergeStore,
14
+ omit,
15
+ setup,
16
+ sync
17
+ } from "../__chunks/OGOHEUXI.js";
14
18
  import {
15
19
  defaultValue
16
20
  } from "../__chunks/WVTCK5PV.js";
@@ -33,7 +37,7 @@ function createSelectStore(_a = {}) {
33
37
  ]);
34
38
  const store = mergeStore(
35
39
  props.store,
36
- combobox == null ? void 0 : combobox.omit(
40
+ omit(combobox, [
37
41
  "value",
38
42
  "items",
39
43
  "renderedItems",
@@ -43,7 +47,7 @@ function createSelectStore(_a = {}) {
43
47
  "contentElement",
44
48
  "popoverElement",
45
49
  "disclosureElement"
46
- )
50
+ ])
47
51
  );
48
52
  const syncState = store.getState();
49
53
  const composite = createCompositeStore(__spreadProps(__spreadValues({}, props), {
@@ -96,63 +100,57 @@ function createSelectStore(_a = {}) {
96
100
  labelElement: defaultValue(syncState.labelElement, null)
97
101
  });
98
102
  const select = createStore(initialState, composite, popover, store);
99
- select.setup(
100
- () => select.sync(
101
- (state) => {
102
- if (state.value !== initialValue)
103
- return;
104
- if (!state.items.length)
105
- return;
106
- const item = state.items.find(
107
- (item2) => !item2.disabled && item2.value != null
108
- );
109
- if ((item == null ? void 0 : item.value) == null)
110
- return;
111
- select.setState("value", item.value);
112
- },
113
- ["value", "items"]
114
- )
103
+ setup(
104
+ select,
105
+ () => sync(select, ["value", "items"], (state) => {
106
+ if (state.value !== initialValue)
107
+ return;
108
+ if (!state.items.length)
109
+ return;
110
+ const item = state.items.find(
111
+ (item2) => !item2.disabled && item2.value != null
112
+ );
113
+ if ((item == null ? void 0 : item.value) == null)
114
+ return;
115
+ select.setState("value", item.value);
116
+ })
115
117
  );
116
- select.setup(
117
- () => select.sync(
118
- (state) => {
119
- if (combobox)
120
- return;
121
- if (state.mounted)
122
- return;
123
- const values = toArray(state.value);
124
- const lastValue = values[values.length - 1];
125
- if (lastValue == null)
126
- return;
127
- const item = state.items.find(
128
- (item2) => !item2.disabled && item2.value === lastValue
129
- );
130
- if (!item)
131
- return;
132
- select.setState("activeId", item.id);
133
- },
134
- ["mounted", "items", "value"]
135
- )
118
+ setup(
119
+ select,
120
+ () => sync(select, ["mounted", "items", "value"], (state) => {
121
+ if (combobox)
122
+ return;
123
+ if (state.mounted)
124
+ return;
125
+ const values = toArray(state.value);
126
+ const lastValue = values[values.length - 1];
127
+ if (lastValue == null)
128
+ return;
129
+ const item = state.items.find(
130
+ (item2) => !item2.disabled && item2.value === lastValue
131
+ );
132
+ if (!item)
133
+ return;
134
+ select.setState("activeId", item.id);
135
+ })
136
136
  );
137
- select.setup(
138
- () => select.syncBatch(
139
- (state) => {
140
- const { mounted, value, activeId } = select.getState();
141
- if (!state.setValueOnMove && mounted)
142
- return;
143
- if (Array.isArray(value))
144
- return;
145
- if (!state.moves)
146
- return;
147
- if (!activeId)
148
- return;
149
- const item = composite.item(activeId);
150
- if (!item || item.disabled || item.value == null)
151
- return;
152
- select.setState("value", item.value);
153
- },
154
- ["setValueOnMove", "moves"]
155
- )
137
+ setup(
138
+ select,
139
+ () => batch(select, ["setValueOnMove", "moves"], (state) => {
140
+ const { mounted, value, activeId } = select.getState();
141
+ if (!state.setValueOnMove && mounted)
142
+ return;
143
+ if (Array.isArray(value))
144
+ return;
145
+ if (!state.moves)
146
+ return;
147
+ if (!activeId)
148
+ return;
149
+ const item = composite.item(activeId);
150
+ if (!item || item.disabled || item.value == null)
151
+ return;
152
+ select.setState("value", item.value);
153
+ })
156
154
  );
157
155
  return __spreadProps(__spreadValues(__spreadValues(__spreadValues({}, composite), popover), select), {
158
156
  setValue: (value) => select.setState("value", value),
@@ -1,12 +1,15 @@
1
1
  import {
2
2
  createCompositeStore
3
- } from "../__chunks/NRXA5QTV.js";
3
+ } from "../__chunks/ROY5BBHL.js";
4
4
  import {
5
5
  createCollectionStore
6
- } from "../__chunks/SHUO6V52.js";
6
+ } from "../__chunks/A7IMXABC.js";
7
7
  import {
8
- createStore
9
- } from "../__chunks/FQL4TRMX.js";
8
+ batch,
9
+ createStore,
10
+ setup,
11
+ sync
12
+ } from "../__chunks/OGOHEUXI.js";
10
13
  import {
11
14
  defaultValue
12
15
  } from "../__chunks/WVTCK5PV.js";
@@ -44,8 +47,9 @@ function createTabStore(props = {}) {
44
47
  )
45
48
  });
46
49
  const tab = createStore(initialState, composite, props.store);
47
- tab.setup(
48
- () => tab.sync(() => {
50
+ setup(
51
+ tab,
52
+ () => sync(tab, ["moves"], () => {
49
53
  const { activeId, selectOnMove } = tab.getState();
50
54
  if (!selectOnMove)
51
55
  return;
@@ -59,59 +63,54 @@ function createTabStore(props = {}) {
59
63
  if (tabItem.disabled)
60
64
  return;
61
65
  tab.setState("selectedId", tabItem.id);
62
- }, ["moves"])
66
+ })
63
67
  );
64
- tab.setup(
65
- () => tab.syncBatch(
66
- (state) => tab.setState("activeId", state.selectedId),
67
- ["selectedId"]
68
+ setup(
69
+ tab,
70
+ () => batch(
71
+ tab,
72
+ ["selectedId"],
73
+ (state) => tab.setState("activeId", state.selectedId)
68
74
  )
69
75
  );
70
- tab.setup(
71
- () => tab.sync(
72
- (state) => {
73
- if (state.selectedId !== void 0)
74
- return;
75
- const { activeId, renderedItems } = tab.getState();
76
- const tabItem = composite.item(activeId);
77
- if (tabItem && !tabItem.disabled && !tabItem.dimmed) {
78
- tab.setState("selectedId", tabItem.id);
79
- } else {
80
- const tabItem2 = renderedItems.find(
81
- (item) => !item.disabled && !item.dimmed
82
- );
83
- tab.setState("selectedId", tabItem2 == null ? void 0 : tabItem2.id);
84
- }
85
- },
86
- ["selectedId", "renderedItems"]
87
- )
76
+ setup(
77
+ tab,
78
+ () => sync(tab, ["selectedId", "renderedItems"], (state) => {
79
+ if (state.selectedId !== void 0)
80
+ return;
81
+ const { activeId, renderedItems } = tab.getState();
82
+ const tabItem = composite.item(activeId);
83
+ if (tabItem && !tabItem.disabled && !tabItem.dimmed) {
84
+ tab.setState("selectedId", tabItem.id);
85
+ } else {
86
+ const tabItem2 = renderedItems.find(
87
+ (item) => !item.disabled && !item.dimmed
88
+ );
89
+ tab.setState("selectedId", tabItem2 == null ? void 0 : tabItem2.id);
90
+ }
91
+ })
88
92
  );
89
- tab.setup(
90
- () => tab.sync(
91
- (state) => {
92
- const tabs = state.renderedItems;
93
- if (!tabs.length)
93
+ setup(
94
+ tab,
95
+ () => sync(tab, ["renderedItems"], (state) => {
96
+ const tabs = state.renderedItems;
97
+ if (!tabs.length)
98
+ return;
99
+ return sync(panels, ["renderedItems"], (state2) => {
100
+ const items = state2.renderedItems;
101
+ const hasOrphanPanels = items.some((panel) => !panel.tabId);
102
+ if (!hasOrphanPanels)
94
103
  return;
95
- return panels.sync(
96
- (state2) => {
97
- const items = state2.renderedItems;
98
- const hasOrphanPanels = items.some((panel) => !panel.tabId);
99
- if (!hasOrphanPanels)
100
- return;
101
- items.forEach((panel, i) => {
102
- if (panel.tabId)
103
- return;
104
- const tabItem = tabs[i];
105
- if (!tabItem)
106
- return;
107
- panels.renderItem(__spreadProps(__spreadValues({}, panel), { tabId: tabItem.id }));
108
- });
109
- },
110
- ["renderedItems"]
111
- );
112
- },
113
- ["renderedItems"]
114
- )
104
+ items.forEach((panel, i) => {
105
+ if (panel.tabId)
106
+ return;
107
+ const tabItem = tabs[i];
108
+ if (!tabItem)
109
+ return;
110
+ panels.renderItem(__spreadProps(__spreadValues({}, panel), { tabId: tabItem.id }));
111
+ });
112
+ });
113
+ })
115
114
  );
116
115
  return __spreadProps(__spreadValues(__spreadValues({}, composite), tab), {
117
116
  panels,
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  createCompositeStore
3
- } from "../__chunks/NRXA5QTV.js";
4
- import "../__chunks/SHUO6V52.js";
5
- import "../__chunks/FQL4TRMX.js";
3
+ } from "../__chunks/ROY5BBHL.js";
4
+ import "../__chunks/A7IMXABC.js";
5
+ import "../__chunks/OGOHEUXI.js";
6
6
  import {
7
7
  defaultValue
8
8
  } from "../__chunks/WVTCK5PV.js";
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  createHovercardStore
3
- } from "../__chunks/XJGRXN57.js";
4
- import "../__chunks/LM4QG55U.js";
5
- import "../__chunks/UWW2ZP3K.js";
6
- import "../__chunks/L5RO76KW.js";
3
+ } from "../__chunks/COUCUJML.js";
4
+ import "../__chunks/SOCHV2LZ.js";
5
+ import "../__chunks/LNMWV6UV.js";
6
+ import "../__chunks/WSKDP2MG.js";
7
7
  import {
8
8
  createStore
9
- } from "../__chunks/FQL4TRMX.js";
9
+ } from "../__chunks/OGOHEUXI.js";
10
10
  import {
11
11
  defaultValue
12
12
  } from "../__chunks/WVTCK5PV.js";