@ariakit/core 0.3.8 → 0.3.10
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.
- package/CHANGELOG.md +10 -0
- package/cjs/__chunks/{2UK5WUJX.cjs → 5CBCKBZ2.cjs} +0 -2
- package/cjs/__chunks/{3J44Z7YH.cjs → CWDUO5EV.cjs} +4 -4
- package/cjs/__chunks/{5SIVMOID.cjs → HMO4CKUP.cjs} +4 -4
- package/cjs/__chunks/{2LS4JJ4S.cjs → MFSCSSBJ.cjs} +2 -2
- package/cjs/__chunks/{GJFZ5ZPP.cjs → MWNFQD55.cjs} +11 -11
- package/cjs/__chunks/{EFIT5L4X.cjs → Y6PHIDP6.cjs} +7 -7
- package/cjs/__chunks/{ZQTYFYRS.cjs → YLMJBIQM.cjs} +26 -21
- package/cjs/__chunks/{QAZ4PF7S.cjs → ZXCB7MXN.cjs} +6 -6
- package/cjs/checkbox/checkbox-store.cjs +3 -3
- package/cjs/checkbox/checkbox-store.d.cts +5 -2
- package/cjs/checkbox/checkbox-store.d.ts +5 -2
- package/cjs/collection/collection-store.cjs +3 -3
- package/cjs/collection/collection-store.d.cts +11 -11
- package/cjs/collection/collection-store.d.ts +11 -11
- package/cjs/combobox/combobox-store.cjs +20 -20
- package/cjs/combobox/combobox-store.d.cts +5 -1
- package/cjs/combobox/combobox-store.d.ts +5 -1
- package/cjs/composite/composite-overflow-store.cjs +5 -5
- package/cjs/composite/composite-store.cjs +4 -4
- package/cjs/composite/composite-store.d.cts +134 -53
- package/cjs/composite/composite-store.d.ts +134 -53
- package/cjs/dialog/dialog-store.cjs +4 -4
- package/cjs/disclosure/disclosure-store.cjs +3 -3
- package/cjs/disclosure/disclosure-store.d.cts +33 -27
- package/cjs/disclosure/disclosure-store.d.ts +33 -27
- package/cjs/form/form-store.cjs +7 -7
- package/cjs/form/form-store.d.cts +34 -25
- package/cjs/form/form-store.d.ts +34 -25
- package/cjs/hovercard/hovercard-store.cjs +6 -6
- package/cjs/hovercard/hovercard-store.d.cts +6 -2
- package/cjs/hovercard/hovercard-store.d.ts +6 -2
- package/cjs/menu/menu-bar-store.cjs +5 -5
- package/cjs/menu/menu-store.cjs +18 -18
- package/cjs/menu/menu-store.d.cts +12 -2
- package/cjs/menu/menu-store.d.ts +12 -2
- package/cjs/menubar/menubar-store.cjs +5 -5
- package/cjs/popover/popover-store.cjs +5 -5
- package/cjs/popover/popover-store.d.cts +2 -0
- package/cjs/popover/popover-store.d.ts +2 -0
- package/cjs/radio/radio-store.cjs +5 -5
- package/cjs/select/select-store.cjs +18 -18
- package/cjs/tab/tab-store.cjs +15 -15
- package/cjs/tab/tab-store.d.cts +15 -4
- package/cjs/tab/tab-store.d.ts +15 -4
- package/cjs/toolbar/toolbar-store.cjs +4 -4
- package/cjs/tooltip/tooltip-store.cjs +7 -7
- package/cjs/utils/store.cjs +2 -2
- package/esm/__chunks/{LT2OYWRD.js → 25MEC56I.js} +1 -1
- package/esm/__chunks/{J6JIOWCS.js → AKMSZ36N.js} +2 -2
- package/esm/__chunks/{A2J4XZ5T.js → K6ELJFXN.js} +0 -2
- package/esm/__chunks/{NKLTHWCR.js → L5RYKTVQ.js} +1 -1
- package/esm/__chunks/{HMQYEBKF.js → MYUKSFP5.js} +20 -15
- package/esm/__chunks/{T3DVYGXI.js → QJ5CUA32.js} +2 -2
- package/esm/__chunks/{A2AGSVJO.js → UUFF4PQ6.js} +2 -2
- package/esm/__chunks/{CTZ2GQIZ.js → VEUNYQYR.js} +2 -2
- package/esm/checkbox/checkbox-store.d.ts +5 -2
- package/esm/checkbox/checkbox-store.js +1 -1
- package/esm/collection/collection-store.d.ts +11 -11
- package/esm/collection/collection-store.js +2 -2
- package/esm/combobox/combobox-store.d.ts +5 -1
- package/esm/combobox/combobox-store.js +6 -6
- package/esm/composite/composite-overflow-store.js +4 -4
- package/esm/composite/composite-store.d.ts +134 -53
- package/esm/composite/composite-store.js +3 -3
- package/esm/dialog/dialog-store.js +3 -3
- package/esm/disclosure/disclosure-store.d.ts +33 -27
- package/esm/disclosure/disclosure-store.js +2 -2
- package/esm/form/form-store.d.ts +34 -25
- package/esm/form/form-store.js +2 -2
- package/esm/hovercard/hovercard-store.d.ts +6 -2
- package/esm/hovercard/hovercard-store.js +5 -5
- package/esm/menu/menu-bar-store.js +4 -4
- package/esm/menu/menu-store.d.ts +12 -2
- package/esm/menu/menu-store.js +7 -7
- package/esm/menubar/menubar-store.js +4 -4
- package/esm/popover/popover-store.d.ts +2 -0
- package/esm/popover/popover-store.js +4 -4
- package/esm/radio/radio-store.js +3 -3
- package/esm/select/select-store.js +6 -6
- package/esm/tab/tab-store.d.ts +15 -4
- package/esm/tab/tab-store.js +3 -3
- package/esm/toolbar/toolbar-store.js +3 -3
- package/esm/tooltip/tooltip-store.js +5 -5
- package/esm/utils/store.js +1 -1
- package/package.json +1 -1
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
5
|
-
require('../__chunks/
|
|
6
|
-
require('../__chunks/
|
|
7
|
-
require('../__chunks/
|
|
4
|
+
var _Y6PHIDP6cjs = require('../__chunks/Y6PHIDP6.cjs');
|
|
5
|
+
require('../__chunks/MFSCSSBJ.cjs');
|
|
6
|
+
require('../__chunks/MWNFQD55.cjs');
|
|
7
|
+
require('../__chunks/5CBCKBZ2.cjs');
|
|
8
8
|
require('../__chunks/3UT5FE6K.cjs');
|
|
9
9
|
require('../__chunks/AV6KTKLE.cjs');
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
exports.createPopoverStore =
|
|
12
|
+
exports.createPopoverStore = _Y6PHIDP6cjs.createPopoverStore;
|
|
@@ -31,6 +31,8 @@ export interface PopoverStoreState extends DialogStoreState {
|
|
|
31
31
|
*
|
|
32
32
|
* Live examples:
|
|
33
33
|
* - [Navigation Menubar](https://ariakit.org/examples/menubar-navigation)
|
|
34
|
+
* - [Submenu with
|
|
35
|
+
* Combobox](https://ariakit.org/examples/menu-nested-combobox)
|
|
34
36
|
* @default "bottom"
|
|
35
37
|
*/
|
|
36
38
|
placement: Placement;
|
|
@@ -31,6 +31,8 @@ export interface PopoverStoreState extends DialogStoreState {
|
|
|
31
31
|
*
|
|
32
32
|
* Live examples:
|
|
33
33
|
* - [Navigation Menubar](https://ariakit.org/examples/menubar-navigation)
|
|
34
|
+
* - [Submenu with
|
|
35
|
+
* Combobox](https://ariakit.org/examples/menu-nested-combobox)
|
|
34
36
|
* @default "bottom"
|
|
35
37
|
*/
|
|
36
38
|
placement: Placement;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
5
|
-
require('../__chunks/
|
|
4
|
+
var _ZXCB7MXNcjs = require('../__chunks/ZXCB7MXN.cjs');
|
|
5
|
+
require('../__chunks/YLMJBIQM.cjs');
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var
|
|
8
|
+
var _5CBCKBZ2cjs = require('../__chunks/5CBCKBZ2.cjs');
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
var _3UT5FE6Kcjs = require('../__chunks/3UT5FE6K.cjs');
|
|
@@ -22,7 +22,7 @@ function createRadioStore(_a = {}) {
|
|
|
22
22
|
var props = _AV6KTKLEcjs.__objRest.call(void 0, _a, []);
|
|
23
23
|
var _a2;
|
|
24
24
|
const syncState = (_a2 = props.store) == null ? void 0 : _a2.getState();
|
|
25
|
-
const composite =
|
|
25
|
+
const composite = _ZXCB7MXNcjs.createCompositeStore.call(void 0, _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, props), {
|
|
26
26
|
focusLoop: _3UT5FE6Kcjs.defaultValue.call(void 0, props.focusLoop, syncState == null ? void 0 : syncState.focusLoop, true)
|
|
27
27
|
}));
|
|
28
28
|
const initialState = _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, composite.getState()), {
|
|
@@ -33,7 +33,7 @@ function createRadioStore(_a = {}) {
|
|
|
33
33
|
null
|
|
34
34
|
)
|
|
35
35
|
});
|
|
36
|
-
const radio =
|
|
36
|
+
const radio = _5CBCKBZ2cjs.createStore.call(void 0, initialState, composite, props.store);
|
|
37
37
|
return _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, composite), radio), {
|
|
38
38
|
setValue: (value) => radio.setState("value", value)
|
|
39
39
|
});
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
5
|
-
require('../__chunks/
|
|
6
|
-
require('../__chunks/
|
|
4
|
+
var _Y6PHIDP6cjs = require('../__chunks/Y6PHIDP6.cjs');
|
|
5
|
+
require('../__chunks/MFSCSSBJ.cjs');
|
|
6
|
+
require('../__chunks/MWNFQD55.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var
|
|
10
|
-
require('../__chunks/
|
|
9
|
+
var _ZXCB7MXNcjs = require('../__chunks/ZXCB7MXN.cjs');
|
|
10
|
+
require('../__chunks/YLMJBIQM.cjs');
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
@@ -16,7 +16,7 @@ require('../__chunks/ZQTYFYRS.cjs');
|
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
|
|
19
|
-
var
|
|
19
|
+
var _5CBCKBZ2cjs = require('../__chunks/5CBCKBZ2.cjs');
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
var _3UT5FE6Kcjs = require('../__chunks/3UT5FE6K.cjs');
|
|
@@ -37,9 +37,9 @@ function createSelectStore(_a = {}) {
|
|
|
37
37
|
} = _b, props = _AV6KTKLEcjs.__objRest.call(void 0, _b, [
|
|
38
38
|
"combobox"
|
|
39
39
|
]);
|
|
40
|
-
const store =
|
|
40
|
+
const store = _5CBCKBZ2cjs.mergeStore.call(void 0,
|
|
41
41
|
props.store,
|
|
42
|
-
|
|
42
|
+
_5CBCKBZ2cjs.omit.call(void 0, combobox, [
|
|
43
43
|
"value",
|
|
44
44
|
"items",
|
|
45
45
|
"renderedItems",
|
|
@@ -51,9 +51,9 @@ function createSelectStore(_a = {}) {
|
|
|
51
51
|
"disclosureElement"
|
|
52
52
|
])
|
|
53
53
|
);
|
|
54
|
-
|
|
54
|
+
_5CBCKBZ2cjs.throwOnConflictingProps.call(void 0, props, store);
|
|
55
55
|
const syncState = store.getState();
|
|
56
|
-
const composite =
|
|
56
|
+
const composite = _ZXCB7MXNcjs.createCompositeStore.call(void 0, _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, props), {
|
|
57
57
|
store,
|
|
58
58
|
virtualFocus: _3UT5FE6Kcjs.defaultValue.call(void 0,
|
|
59
59
|
props.virtualFocus,
|
|
@@ -77,7 +77,7 @@ function createSelectStore(_a = {}) {
|
|
|
77
77
|
"vertical"
|
|
78
78
|
)
|
|
79
79
|
}));
|
|
80
|
-
const popover =
|
|
80
|
+
const popover = _Y6PHIDP6cjs.createPopoverStore.call(void 0, _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, props), {
|
|
81
81
|
store,
|
|
82
82
|
placement: _3UT5FE6Kcjs.defaultValue.call(void 0,
|
|
83
83
|
props.placement,
|
|
@@ -101,10 +101,10 @@ function createSelectStore(_a = {}) {
|
|
|
101
101
|
selectElement: _3UT5FE6Kcjs.defaultValue.call(void 0, syncState.selectElement, null),
|
|
102
102
|
labelElement: _3UT5FE6Kcjs.defaultValue.call(void 0, syncState.labelElement, null)
|
|
103
103
|
});
|
|
104
|
-
const select =
|
|
105
|
-
|
|
104
|
+
const select = _5CBCKBZ2cjs.createStore.call(void 0, initialState, composite, popover, store);
|
|
105
|
+
_5CBCKBZ2cjs.setup.call(void 0,
|
|
106
106
|
select,
|
|
107
|
-
() =>
|
|
107
|
+
() => _5CBCKBZ2cjs.sync.call(void 0, select, ["value", "items"], (state) => {
|
|
108
108
|
if (state.value !== initialValue)
|
|
109
109
|
return;
|
|
110
110
|
if (!state.items.length)
|
|
@@ -117,9 +117,9 @@ function createSelectStore(_a = {}) {
|
|
|
117
117
|
select.setState("value", item.value);
|
|
118
118
|
})
|
|
119
119
|
);
|
|
120
|
-
|
|
120
|
+
_5CBCKBZ2cjs.setup.call(void 0,
|
|
121
121
|
select,
|
|
122
|
-
() =>
|
|
122
|
+
() => _5CBCKBZ2cjs.sync.call(void 0, select, ["mounted", "items", "value"], (state) => {
|
|
123
123
|
if (combobox)
|
|
124
124
|
return;
|
|
125
125
|
if (state.mounted)
|
|
@@ -136,9 +136,9 @@ function createSelectStore(_a = {}) {
|
|
|
136
136
|
select.setState("activeId", item.id);
|
|
137
137
|
})
|
|
138
138
|
);
|
|
139
|
-
|
|
139
|
+
_5CBCKBZ2cjs.setup.call(void 0,
|
|
140
140
|
select,
|
|
141
|
-
() =>
|
|
141
|
+
() => _5CBCKBZ2cjs.batch.call(void 0, select, ["setValueOnMove", "moves"], (state) => {
|
|
142
142
|
const { mounted, value, activeId } = select.getState();
|
|
143
143
|
if (!state.setValueOnMove && mounted)
|
|
144
144
|
return;
|
package/cjs/tab/tab-store.cjs
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _ZXCB7MXNcjs = require('../__chunks/ZXCB7MXN.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _YLMJBIQMcjs = require('../__chunks/YLMJBIQM.cjs');
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
var
|
|
13
|
+
var _5CBCKBZ2cjs = require('../__chunks/5CBCKBZ2.cjs');
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
var _3UT5FE6Kcjs = require('../__chunks/3UT5FE6K.cjs');
|
|
@@ -25,7 +25,7 @@ var _AV6KTKLEcjs = require('../__chunks/AV6KTKLE.cjs');
|
|
|
25
25
|
function createTabStore(props = {}) {
|
|
26
26
|
var _a;
|
|
27
27
|
const syncState = (_a = props.store) == null ? void 0 : _a.getState();
|
|
28
|
-
const composite =
|
|
28
|
+
const composite = _ZXCB7MXNcjs.createCompositeStore.call(void 0, _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, props), {
|
|
29
29
|
orientation: _3UT5FE6Kcjs.defaultValue.call(void 0,
|
|
30
30
|
props.orientation,
|
|
31
31
|
syncState == null ? void 0 : syncState.orientation,
|
|
@@ -33,7 +33,7 @@ function createTabStore(props = {}) {
|
|
|
33
33
|
),
|
|
34
34
|
focusLoop: _3UT5FE6Kcjs.defaultValue.call(void 0, props.focusLoop, syncState == null ? void 0 : syncState.focusLoop, true)
|
|
35
35
|
}));
|
|
36
|
-
const panels =
|
|
36
|
+
const panels = _YLMJBIQMcjs.createCollectionStore.call(void 0, );
|
|
37
37
|
const initialState = _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, composite.getState()), {
|
|
38
38
|
selectedId: _3UT5FE6Kcjs.defaultValue.call(void 0,
|
|
39
39
|
props.selectedId,
|
|
@@ -47,10 +47,10 @@ function createTabStore(props = {}) {
|
|
|
47
47
|
true
|
|
48
48
|
)
|
|
49
49
|
});
|
|
50
|
-
const tab =
|
|
51
|
-
|
|
50
|
+
const tab = _5CBCKBZ2cjs.createStore.call(void 0, initialState, composite, props.store);
|
|
51
|
+
_5CBCKBZ2cjs.setup.call(void 0,
|
|
52
52
|
tab,
|
|
53
|
-
() =>
|
|
53
|
+
() => _5CBCKBZ2cjs.sync.call(void 0, tab, ["moves"], () => {
|
|
54
54
|
const { activeId, selectOnMove } = tab.getState();
|
|
55
55
|
if (!selectOnMove)
|
|
56
56
|
return;
|
|
@@ -66,17 +66,17 @@ function createTabStore(props = {}) {
|
|
|
66
66
|
tab.setState("selectedId", tabItem.id);
|
|
67
67
|
})
|
|
68
68
|
);
|
|
69
|
-
|
|
69
|
+
_5CBCKBZ2cjs.setup.call(void 0,
|
|
70
70
|
tab,
|
|
71
|
-
() =>
|
|
71
|
+
() => _5CBCKBZ2cjs.batch.call(void 0,
|
|
72
72
|
tab,
|
|
73
73
|
["selectedId"],
|
|
74
74
|
(state) => tab.setState("activeId", state.selectedId)
|
|
75
75
|
)
|
|
76
76
|
);
|
|
77
|
-
|
|
77
|
+
_5CBCKBZ2cjs.setup.call(void 0,
|
|
78
78
|
tab,
|
|
79
|
-
() =>
|
|
79
|
+
() => _5CBCKBZ2cjs.sync.call(void 0, tab, ["selectedId", "renderedItems"], (state) => {
|
|
80
80
|
if (state.selectedId !== void 0)
|
|
81
81
|
return;
|
|
82
82
|
const { activeId, renderedItems } = tab.getState();
|
|
@@ -91,13 +91,13 @@ function createTabStore(props = {}) {
|
|
|
91
91
|
}
|
|
92
92
|
})
|
|
93
93
|
);
|
|
94
|
-
|
|
94
|
+
_5CBCKBZ2cjs.setup.call(void 0,
|
|
95
95
|
tab,
|
|
96
|
-
() =>
|
|
96
|
+
() => _5CBCKBZ2cjs.sync.call(void 0, tab, ["renderedItems"], (state) => {
|
|
97
97
|
const tabs = state.renderedItems;
|
|
98
98
|
if (!tabs.length)
|
|
99
99
|
return;
|
|
100
|
-
return
|
|
100
|
+
return _5CBCKBZ2cjs.sync.call(void 0, panels, ["renderedItems"], (state2) => {
|
|
101
101
|
const items = state2.renderedItems;
|
|
102
102
|
const hasOrphanPanels = items.some((panel) => !panel.tabId);
|
|
103
103
|
if (!hasOrphanPanels)
|
package/cjs/tab/tab-store.d.cts
CHANGED
|
@@ -24,6 +24,7 @@ export interface TabStoreState extends CompositeStoreState<TabStoreItem> {
|
|
|
24
24
|
*
|
|
25
25
|
* Live examples:
|
|
26
26
|
* - [Tab with React Router](https://ariakit.org/examples/tab-react-router)
|
|
27
|
+
* - [Combobox with tabs](https://ariakit.org/examples/combobox-tabs)
|
|
27
28
|
*/
|
|
28
29
|
selectedId: TabStoreState["activeId"];
|
|
29
30
|
/**
|
|
@@ -38,8 +39,11 @@ export interface TabStoreState extends CompositeStoreState<TabStoreItem> {
|
|
|
38
39
|
}
|
|
39
40
|
export interface TabStoreFunctions extends CompositeStoreFunctions<TabStoreItem> {
|
|
40
41
|
/**
|
|
41
|
-
* Sets the
|
|
42
|
-
*
|
|
42
|
+
* Sets the
|
|
43
|
+
* [`selectedId`](https://ariakit.org/reference/tab-provider#selectedid) state
|
|
44
|
+
* without moving focus. If you want to move focus, use the
|
|
45
|
+
* [`select`](https://ariakit.org/reference/use-tab-store#select) function
|
|
46
|
+
* instead.
|
|
43
47
|
*
|
|
44
48
|
* Live examples:
|
|
45
49
|
* - [Tab with React Router](https://ariakit.org/examples/tab-react-router)
|
|
@@ -60,9 +64,13 @@ export interface TabStoreFunctions extends CompositeStoreFunctions<TabStoreItem>
|
|
|
60
64
|
panels: CollectionStore<TabStorePanel>;
|
|
61
65
|
/**
|
|
62
66
|
* Selects the tab for the given id and moves focus to it. If you want to set
|
|
63
|
-
* the `selectedId`
|
|
67
|
+
* the [`selectedId`](https://ariakit.org/reference/tab-provider#selectedid)
|
|
68
|
+
* state without moving focus, use the
|
|
69
|
+
* [`setSelectedId`](https://ariakit.org/reference/use-tab-store#setselectedid-1)
|
|
64
70
|
* function instead.
|
|
65
|
-
*
|
|
71
|
+
*
|
|
72
|
+
* Live examples:
|
|
73
|
+
* - [Combobox with tabs](https://ariakit.org/examples/combobox-tabs)
|
|
66
74
|
* @example
|
|
67
75
|
* // Selects the tab with id "tab-1"
|
|
68
76
|
* store.select("tab-1");
|
|
@@ -77,6 +85,9 @@ export interface TabStoreOptions extends StoreOptions<TabStoreState, "orientatio
|
|
|
77
85
|
/**
|
|
78
86
|
* The id of the tab whose panel is currently visible. If it's `undefined`, it
|
|
79
87
|
* will be automatically set to the first enabled tab.
|
|
88
|
+
*
|
|
89
|
+
* Live examples:
|
|
90
|
+
* - [Combobox with tabs](https://ariakit.org/examples/combobox-tabs)
|
|
80
91
|
*/
|
|
81
92
|
defaultSelectedId?: TabStoreState["selectedId"];
|
|
82
93
|
}
|
package/cjs/tab/tab-store.d.ts
CHANGED
|
@@ -24,6 +24,7 @@ export interface TabStoreState extends CompositeStoreState<TabStoreItem> {
|
|
|
24
24
|
*
|
|
25
25
|
* Live examples:
|
|
26
26
|
* - [Tab with React Router](https://ariakit.org/examples/tab-react-router)
|
|
27
|
+
* - [Combobox with tabs](https://ariakit.org/examples/combobox-tabs)
|
|
27
28
|
*/
|
|
28
29
|
selectedId: TabStoreState["activeId"];
|
|
29
30
|
/**
|
|
@@ -38,8 +39,11 @@ export interface TabStoreState extends CompositeStoreState<TabStoreItem> {
|
|
|
38
39
|
}
|
|
39
40
|
export interface TabStoreFunctions extends CompositeStoreFunctions<TabStoreItem> {
|
|
40
41
|
/**
|
|
41
|
-
* Sets the
|
|
42
|
-
*
|
|
42
|
+
* Sets the
|
|
43
|
+
* [`selectedId`](https://ariakit.org/reference/tab-provider#selectedid) state
|
|
44
|
+
* without moving focus. If you want to move focus, use the
|
|
45
|
+
* [`select`](https://ariakit.org/reference/use-tab-store#select) function
|
|
46
|
+
* instead.
|
|
43
47
|
*
|
|
44
48
|
* Live examples:
|
|
45
49
|
* - [Tab with React Router](https://ariakit.org/examples/tab-react-router)
|
|
@@ -60,9 +64,13 @@ export interface TabStoreFunctions extends CompositeStoreFunctions<TabStoreItem>
|
|
|
60
64
|
panels: CollectionStore<TabStorePanel>;
|
|
61
65
|
/**
|
|
62
66
|
* Selects the tab for the given id and moves focus to it. If you want to set
|
|
63
|
-
* the `selectedId`
|
|
67
|
+
* the [`selectedId`](https://ariakit.org/reference/tab-provider#selectedid)
|
|
68
|
+
* state without moving focus, use the
|
|
69
|
+
* [`setSelectedId`](https://ariakit.org/reference/use-tab-store#setselectedid-1)
|
|
64
70
|
* function instead.
|
|
65
|
-
*
|
|
71
|
+
*
|
|
72
|
+
* Live examples:
|
|
73
|
+
* - [Combobox with tabs](https://ariakit.org/examples/combobox-tabs)
|
|
66
74
|
* @example
|
|
67
75
|
* // Selects the tab with id "tab-1"
|
|
68
76
|
* store.select("tab-1");
|
|
@@ -77,6 +85,9 @@ export interface TabStoreOptions extends StoreOptions<TabStoreState, "orientatio
|
|
|
77
85
|
/**
|
|
78
86
|
* The id of the tab whose panel is currently visible. If it's `undefined`, it
|
|
79
87
|
* will be automatically set to the first enabled tab.
|
|
88
|
+
*
|
|
89
|
+
* Live examples:
|
|
90
|
+
* - [Combobox with tabs](https://ariakit.org/examples/combobox-tabs)
|
|
80
91
|
*/
|
|
81
92
|
defaultSelectedId?: TabStoreState["selectedId"];
|
|
82
93
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
5
|
-
require('../__chunks/
|
|
6
|
-
require('../__chunks/
|
|
4
|
+
var _ZXCB7MXNcjs = require('../__chunks/ZXCB7MXN.cjs');
|
|
5
|
+
require('../__chunks/YLMJBIQM.cjs');
|
|
6
|
+
require('../__chunks/5CBCKBZ2.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
var _3UT5FE6Kcjs = require('../__chunks/3UT5FE6K.cjs');
|
|
@@ -18,7 +18,7 @@ var _AV6KTKLEcjs = require('../__chunks/AV6KTKLE.cjs');
|
|
|
18
18
|
function createToolbarStore(props = {}) {
|
|
19
19
|
var _a;
|
|
20
20
|
const syncState = (_a = props.store) == null ? void 0 : _a.getState();
|
|
21
|
-
return
|
|
21
|
+
return _ZXCB7MXNcjs.createCompositeStore.call(void 0, _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, props), {
|
|
22
22
|
orientation: _3UT5FE6Kcjs.defaultValue.call(void 0,
|
|
23
23
|
props.orientation,
|
|
24
24
|
syncState == null ? void 0 : syncState.orientation,
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
5
|
-
require('../__chunks/
|
|
6
|
-
require('../__chunks/
|
|
7
|
-
require('../__chunks/
|
|
4
|
+
var _HMO4CKUPcjs = require('../__chunks/HMO4CKUP.cjs');
|
|
5
|
+
require('../__chunks/Y6PHIDP6.cjs');
|
|
6
|
+
require('../__chunks/MFSCSSBJ.cjs');
|
|
7
|
+
require('../__chunks/MWNFQD55.cjs');
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _5CBCKBZ2cjs = require('../__chunks/5CBCKBZ2.cjs');
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
var _3UT5FE6Kcjs = require('../__chunks/3UT5FE6K.cjs');
|
|
@@ -20,7 +20,7 @@ var _AV6KTKLEcjs = require('../__chunks/AV6KTKLE.cjs');
|
|
|
20
20
|
function createTooltipStore(props = {}) {
|
|
21
21
|
var _a;
|
|
22
22
|
const syncState = (_a = props.store) == null ? void 0 : _a.getState();
|
|
23
|
-
const hovercard =
|
|
23
|
+
const hovercard = _HMO4CKUPcjs.createHovercardStore.call(void 0, _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, props), {
|
|
24
24
|
placement: _3UT5FE6Kcjs.defaultValue.call(void 0,
|
|
25
25
|
props.placement,
|
|
26
26
|
syncState == null ? void 0 : syncState.placement,
|
|
@@ -32,7 +32,7 @@ function createTooltipStore(props = {}) {
|
|
|
32
32
|
type: _3UT5FE6Kcjs.defaultValue.call(void 0, props.type, syncState == null ? void 0 : syncState.type, "description"),
|
|
33
33
|
skipTimeout: _3UT5FE6Kcjs.defaultValue.call(void 0, props.skipTimeout, syncState == null ? void 0 : syncState.skipTimeout, 300)
|
|
34
34
|
});
|
|
35
|
-
const tooltip =
|
|
35
|
+
const tooltip = _5CBCKBZ2cjs.createStore.call(void 0, initialState, hovercard, props.store);
|
|
36
36
|
return _AV6KTKLEcjs.__spreadValues.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, hovercard), tooltip);
|
|
37
37
|
}
|
|
38
38
|
|
package/cjs/utils/store.cjs
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
var
|
|
13
|
+
var _5CBCKBZ2cjs = require('../__chunks/5CBCKBZ2.cjs');
|
|
14
14
|
require('../__chunks/3UT5FE6K.cjs');
|
|
15
15
|
require('../__chunks/AV6KTKLE.cjs');
|
|
16
16
|
|
|
@@ -24,4 +24,4 @@ require('../__chunks/AV6KTKLE.cjs');
|
|
|
24
24
|
|
|
25
25
|
|
|
26
26
|
|
|
27
|
-
exports.batch =
|
|
27
|
+
exports.batch = _5CBCKBZ2cjs.batch; exports.createStore = _5CBCKBZ2cjs.createStore; exports.init = _5CBCKBZ2cjs.init; exports.mergeStore = _5CBCKBZ2cjs.mergeStore; exports.omit = _5CBCKBZ2cjs.omit; exports.pick = _5CBCKBZ2cjs.pick; exports.setup = _5CBCKBZ2cjs.setup; exports.subscribe = _5CBCKBZ2cjs.subscribe; exports.sync = _5CBCKBZ2cjs.sync; exports.throwOnConflictingProps = _5CBCKBZ2cjs.throwOnConflictingProps;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
createDialogStore
|
|
4
|
-
} from "./
|
|
4
|
+
} from "./25MEC56I.js";
|
|
5
5
|
import {
|
|
6
6
|
createStore,
|
|
7
7
|
mergeStore,
|
|
8
8
|
omit,
|
|
9
9
|
throwOnConflictingProps
|
|
10
|
-
} from "./
|
|
10
|
+
} from "./K6ELJFXN.js";
|
|
11
11
|
import {
|
|
12
12
|
defaultValue
|
|
13
13
|
} from "./I2VQ3XGR.js";
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
init,
|
|
6
6
|
setup,
|
|
7
7
|
throwOnConflictingProps
|
|
8
|
-
} from "./
|
|
8
|
+
} from "./K6ELJFXN.js";
|
|
9
9
|
import {
|
|
10
10
|
chain,
|
|
11
11
|
defaultValue
|
|
@@ -88,34 +88,39 @@ function createCollectionStore(props = {}) {
|
|
|
88
88
|
syncPrivateStore
|
|
89
89
|
);
|
|
90
90
|
const collection = createStore(initialState, props.store);
|
|
91
|
-
const sortItems = () => {
|
|
92
|
-
const
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
collection.setState("renderedItems", renderedItems);
|
|
91
|
+
const sortItems = (renderedItems) => {
|
|
92
|
+
const sortedItems = sortBasedOnDOMPosition(renderedItems);
|
|
93
|
+
privateStore.setState("renderedItems", sortedItems);
|
|
94
|
+
collection.setState("renderedItems", sortedItems);
|
|
96
95
|
};
|
|
97
96
|
setup(collection, () => init(privateStore));
|
|
98
97
|
setup(privateStore, () => {
|
|
99
98
|
return batch(privateStore, ["renderedItems"], (state) => {
|
|
100
99
|
let firstRun = true;
|
|
101
|
-
let raf = requestAnimationFrame(
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
100
|
+
let raf = requestAnimationFrame(() => {
|
|
101
|
+
const { renderedItems } = collection.getState();
|
|
102
|
+
if (state.renderedItems === renderedItems)
|
|
103
|
+
return;
|
|
104
|
+
sortItems(state.renderedItems);
|
|
105
|
+
});
|
|
106
|
+
if (typeof IntersectionObserver !== "function") {
|
|
107
|
+
return () => cancelAnimationFrame(raf);
|
|
108
|
+
}
|
|
109
|
+
const ioCallback = () => {
|
|
105
110
|
if (firstRun) {
|
|
106
111
|
firstRun = false;
|
|
107
112
|
return;
|
|
108
113
|
}
|
|
109
114
|
cancelAnimationFrame(raf);
|
|
110
|
-
raf = requestAnimationFrame(sortItems);
|
|
115
|
+
raf = requestAnimationFrame(() => sortItems(state.renderedItems));
|
|
111
116
|
};
|
|
112
117
|
const root = getCommonParent(state.renderedItems);
|
|
113
|
-
const observer = new IntersectionObserver(
|
|
114
|
-
state.renderedItems
|
|
118
|
+
const observer = new IntersectionObserver(ioCallback, { root });
|
|
119
|
+
for (const item of state.renderedItems) {
|
|
115
120
|
if (!item.element)
|
|
116
|
-
|
|
121
|
+
continue;
|
|
117
122
|
observer.observe(item.element);
|
|
118
|
-
}
|
|
123
|
+
}
|
|
119
124
|
return () => {
|
|
120
125
|
cancelAnimationFrame(raf);
|
|
121
126
|
observer.disconnect();
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
createCollectionStore
|
|
4
|
-
} from "./
|
|
4
|
+
} from "./MYUKSFP5.js";
|
|
5
5
|
import {
|
|
6
6
|
createStore,
|
|
7
7
|
setup,
|
|
8
8
|
sync
|
|
9
|
-
} from "./
|
|
9
|
+
} from "./K6ELJFXN.js";
|
|
10
10
|
import {
|
|
11
11
|
defaultValue
|
|
12
12
|
} from "./I2VQ3XGR.js";
|
|
@@ -17,7 +17,8 @@ export interface CheckboxStoreState<T extends CheckboxStoreValue = CheckboxStore
|
|
|
17
17
|
}
|
|
18
18
|
export interface CheckboxStoreFunctions<T extends CheckboxStoreValue = CheckboxStoreValue> {
|
|
19
19
|
/**
|
|
20
|
-
* Sets the `value`
|
|
20
|
+
* Sets the [`value`](https://ariakit.org/reference/checkbox-provider#value)
|
|
21
|
+
* state.
|
|
21
22
|
* @example
|
|
22
23
|
* store.setValue(true);
|
|
23
24
|
* store.setValue((value) => !value);
|
|
@@ -26,7 +27,9 @@ export interface CheckboxStoreFunctions<T extends CheckboxStoreValue = CheckboxS
|
|
|
26
27
|
}
|
|
27
28
|
export interface CheckboxStoreOptions<T extends CheckboxStoreValue = CheckboxStoreValue> extends StoreOptions<CheckboxStoreState<T>, "value"> {
|
|
28
29
|
/**
|
|
29
|
-
* The default
|
|
30
|
+
* The default
|
|
31
|
+
* [`value`](https://ariakit.org/reference/checkbox-provider#value) state of
|
|
32
|
+
* the checkbox.
|
|
30
33
|
*
|
|
31
34
|
* Live examples:
|
|
32
35
|
* - [Custom Checkbox](https://ariakit.org/examples/checkbox-custom)
|