@ariakit/core 0.4.12 → 0.4.13
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 +9 -0
- package/cjs/__chunks/{WCFMOJKV.cjs → 726BNPQZ.cjs} +36 -2
- package/cjs/__chunks/{BSLRW6E7.cjs → ASR6PAFN.cjs} +1 -1
- package/cjs/__chunks/{G2NIRMCL.cjs → BUEPUCQL.cjs} +14 -42
- package/cjs/__chunks/{C5P5S22J.cjs → BVPEDDW6.cjs} +7 -7
- package/cjs/__chunks/{A47DWKLR.cjs → K7YTZVWC.cjs} +11 -6
- package/cjs/__chunks/{LSC6QXJ7.cjs → RL7DKHOF.cjs} +4 -4
- package/cjs/__chunks/{FGGZELG7.cjs → TFI7KVZO.cjs} +4 -4
- package/cjs/__chunks/{G2MFLTB2.cjs → V4YF2QA6.cjs} +11 -11
- package/cjs/__chunks/{TEPPO3KC.cjs → WOLZY4WC.cjs} +6 -6
- package/cjs/__chunks/{I2G6EN27.cjs → YMCSKJHR.cjs} +2 -2
- package/cjs/checkbox/checkbox-store.cjs +3 -3
- package/cjs/collection/collection-store.cjs +4 -4
- package/cjs/combobox/combobox-store.cjs +27 -27
- package/cjs/composite/composite-overflow-store.cjs +5 -5
- package/cjs/composite/composite-store.cjs +5 -5
- package/cjs/composite/composite-store.d.cts +7 -1
- package/cjs/composite/composite-store.d.ts +7 -1
- package/cjs/dialog/dialog-store.cjs +4 -4
- package/cjs/disclosure/disclosure-store.cjs +3 -3
- package/cjs/form/form-store.cjs +8 -8
- package/cjs/hovercard/hovercard-store.cjs +6 -6
- package/cjs/menu/menu-bar-store.cjs +6 -6
- package/cjs/menu/menu-store.cjs +19 -19
- package/cjs/menubar/menubar-store.cjs +6 -6
- package/cjs/popover/popover-store.cjs +5 -5
- package/cjs/radio/radio-store.cjs +6 -6
- package/cjs/select/select-store.cjs +21 -21
- package/cjs/tab/tab-store.cjs +24 -24
- package/cjs/tag/tag-store.cjs +8 -8
- package/cjs/toolbar/toolbar-store.cjs +5 -5
- package/cjs/tooltip/tooltip-store.cjs +7 -7
- package/cjs/utils/dom.cjs +4 -2
- package/cjs/utils/dom.d.cts +6 -2
- package/cjs/utils/dom.d.ts +6 -2
- package/cjs/utils/events.cjs +7 -7
- package/cjs/utils/focus.cjs +10 -10
- package/cjs/utils/platform.cjs +3 -3
- package/cjs/utils/store.cjs +2 -2
- package/esm/__chunks/{S22RJCNX.js → 7HRRFUKQ.js} +2 -2
- package/esm/__chunks/{IJ6VFLJG.js → AJZ4BYF3.js} +7 -2
- package/esm/__chunks/{EQQLU3CG.js → BCALMBPZ.js} +1 -1
- package/esm/__chunks/{7DTP4AQO.js → CYQWQL4J.js} +6 -34
- package/esm/__chunks/{PQP5VPTV.js → DTR5TSDJ.js} +36 -2
- package/esm/__chunks/{YOHCVXJB.js → FZZ2AVHF.js} +1 -1
- package/esm/__chunks/{EACLTACN.js → JTLIIJ4U.js} +2 -2
- package/esm/__chunks/{3UYWTADI.js → ME2CUF3F.js} +2 -2
- package/esm/__chunks/{3VBK76MS.js → QAGXQEUG.js} +1 -1
- package/esm/__chunks/{6E4KKOSB.js → RCQ5P4YE.js} +1 -1
- package/esm/checkbox/checkbox-store.js +1 -1
- package/esm/collection/collection-store.js +3 -3
- package/esm/combobox/combobox-store.js +8 -8
- package/esm/composite/composite-overflow-store.js +4 -4
- package/esm/composite/composite-store.d.ts +7 -1
- package/esm/composite/composite-store.js +4 -4
- package/esm/dialog/dialog-store.js +3 -3
- package/esm/disclosure/disclosure-store.js +2 -2
- package/esm/form/form-store.js +3 -3
- package/esm/hovercard/hovercard-store.js +5 -5
- package/esm/menu/menu-bar-store.js +5 -5
- package/esm/menu/menu-store.js +8 -8
- package/esm/menubar/menubar-store.js +5 -5
- package/esm/popover/popover-store.js +4 -4
- package/esm/radio/radio-store.js +4 -4
- package/esm/select/select-store.js +7 -7
- package/esm/tab/tab-store.js +4 -4
- package/esm/tag/tag-store.js +4 -4
- package/esm/toolbar/toolbar-store.js +4 -4
- package/esm/tooltip/tooltip-store.js +5 -5
- package/esm/utils/dom.d.ts +6 -2
- package/esm/utils/dom.js +5 -3
- package/esm/utils/events.js +4 -4
- package/esm/utils/focus.js +1 -1
- package/esm/utils/platform.js +2 -2
- package/esm/utils/store.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @ariakit/core
|
|
2
2
|
|
|
3
|
+
## 0.4.13
|
|
4
|
+
|
|
5
|
+
- Fixed the [`item`](https://ariakit.org/reference/use-collection-store#item) method to prevent it from returning items that have been removed from the collection store.
|
|
6
|
+
- Fixed the [`item`](https://ariakit.org/reference/use-menu-store#item) method when keeping different menu stores in sync.
|
|
7
|
+
- Added [`id`](https://ariakit.org/reference/use-composite-store#id) prop to composite stores.
|
|
8
|
+
- Added `sortBasedOnDOMPosition` function.
|
|
9
|
+
- Updated core utils.
|
|
10
|
+
- Improved JSDocs.
|
|
11
|
+
|
|
3
12
|
## 0.4.12
|
|
4
13
|
|
|
5
14
|
- Fixed regression in [`focusShift`](https://ariakit.org/reference/composite-provider#focusshift).
|
|
@@ -5,9 +5,13 @@ function checkIsBrowser() {
|
|
|
5
5
|
return typeof window !== "undefined" && !!((_a = window.document) == null ? void 0 : _a.createElement);
|
|
6
6
|
}
|
|
7
7
|
function getDocument(node) {
|
|
8
|
-
|
|
8
|
+
if (!node) return document;
|
|
9
|
+
if ("self" in node) return node.document;
|
|
10
|
+
return node.ownerDocument || document;
|
|
9
11
|
}
|
|
10
12
|
function getWindow(node) {
|
|
13
|
+
if (!node) return self;
|
|
14
|
+
if ("self" in node) return node.self;
|
|
11
15
|
return getDocument(node).defaultView || window;
|
|
12
16
|
}
|
|
13
17
|
function getActiveElement(node, activeDescendant = false) {
|
|
@@ -166,6 +170,36 @@ function setSelectionRange(element, ...args) {
|
|
|
166
170
|
element.setSelectionRange(...args);
|
|
167
171
|
}
|
|
168
172
|
}
|
|
173
|
+
function sortBasedOnDOMPosition(items, getElement) {
|
|
174
|
+
const pairs = items.map((item, index) => [index, item]);
|
|
175
|
+
let isOrderDifferent = false;
|
|
176
|
+
pairs.sort(([indexA, a], [indexB, b]) => {
|
|
177
|
+
const elementA = getElement(a);
|
|
178
|
+
const elementB = getElement(b);
|
|
179
|
+
if (elementA === elementB) return 0;
|
|
180
|
+
if (!elementA || !elementB) return 0;
|
|
181
|
+
if (isElementPreceding(elementA, elementB)) {
|
|
182
|
+
if (indexA > indexB) {
|
|
183
|
+
isOrderDifferent = true;
|
|
184
|
+
}
|
|
185
|
+
return -1;
|
|
186
|
+
}
|
|
187
|
+
if (indexA < indexB) {
|
|
188
|
+
isOrderDifferent = true;
|
|
189
|
+
}
|
|
190
|
+
return 1;
|
|
191
|
+
});
|
|
192
|
+
if (isOrderDifferent) {
|
|
193
|
+
return pairs.map(([_, item]) => item);
|
|
194
|
+
}
|
|
195
|
+
return items;
|
|
196
|
+
}
|
|
197
|
+
function isElementPreceding(a, b) {
|
|
198
|
+
return Boolean(
|
|
199
|
+
b.compareDocumentPosition(a) & Node.DOCUMENT_POSITION_PRECEDING
|
|
200
|
+
);
|
|
201
|
+
}
|
|
202
|
+
|
|
169
203
|
|
|
170
204
|
|
|
171
205
|
|
|
@@ -186,4 +220,4 @@ function setSelectionRange(element, ...args) {
|
|
|
186
220
|
|
|
187
221
|
|
|
188
222
|
|
|
189
|
-
exports.canUseDOM = canUseDOM; exports.getDocument = getDocument; exports.getWindow = getWindow; exports.getActiveElement = getActiveElement; exports.contains = contains; exports.isFrame = isFrame; exports.isButton = isButton; exports.isVisible = isVisible; exports.isTextField = isTextField; exports.isTextbox = isTextbox; exports.getTextboxValue = getTextboxValue; exports.getTextboxSelection = getTextboxSelection; exports.getPopupRole = getPopupRole; exports.getPopupItemRole = getPopupItemRole; exports.scrollIntoViewIfNeeded = scrollIntoViewIfNeeded; exports.getScrollingElement = getScrollingElement; exports.isPartiallyHidden = isPartiallyHidden; exports.setSelectionRange = setSelectionRange;
|
|
223
|
+
exports.canUseDOM = canUseDOM; exports.getDocument = getDocument; exports.getWindow = getWindow; exports.getActiveElement = getActiveElement; exports.contains = contains; exports.isFrame = isFrame; exports.isButton = isButton; exports.isVisible = isVisible; exports.isTextField = isTextField; exports.isTextbox = isTextbox; exports.getTextboxValue = getTextboxValue; exports.getTextboxSelection = getTextboxSelection; exports.getPopupRole = getPopupRole; exports.getPopupItemRole = getPopupItemRole; exports.scrollIntoViewIfNeeded = scrollIntoViewIfNeeded; exports.getScrollingElement = getScrollingElement; exports.isPartiallyHidden = isPartiallyHidden; exports.setSelectionRange = setSelectionRange; exports.sortBasedOnDOMPosition = sortBasedOnDOMPosition;
|
|
@@ -183,7 +183,7 @@ function mergeStore(...stores) {
|
|
|
183
183
|
return Object.assign(state, nextState);
|
|
184
184
|
}, {});
|
|
185
185
|
const store = createStore(initialState, ...stores);
|
|
186
|
-
return store;
|
|
186
|
+
return Object.assign({}, ...stores, store);
|
|
187
187
|
}
|
|
188
188
|
function throwOnConflictingProps(props, store) {
|
|
189
189
|
if (process.env.NODE_ENV === "production") return;
|
|
@@ -4,49 +4,21 @@
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _ASR6PAFNcjs = require('./ASR6PAFN.cjs');
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
var _MLCPLY2Pcjs = require('./MLCPLY2P.cjs');
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
|
|
15
|
+
var _726BNPQZcjs = require('./726BNPQZ.cjs');
|
|
15
16
|
|
|
16
17
|
|
|
17
18
|
|
|
18
19
|
var _7EQBAZ46cjs = require('./7EQBAZ46.cjs');
|
|
19
20
|
|
|
20
21
|
// src/collection/collection-store.ts
|
|
21
|
-
function isElementPreceding(a, b) {
|
|
22
|
-
return Boolean(
|
|
23
|
-
b.compareDocumentPosition(a) & Node.DOCUMENT_POSITION_PRECEDING
|
|
24
|
-
);
|
|
25
|
-
}
|
|
26
|
-
function sortBasedOnDOMPosition(items) {
|
|
27
|
-
const pairs = items.map((item, index) => [index, item]);
|
|
28
|
-
let isOrderDifferent = false;
|
|
29
|
-
pairs.sort(([indexA, a], [indexB, b]) => {
|
|
30
|
-
const elementA = a.element;
|
|
31
|
-
const elementB = b.element;
|
|
32
|
-
if (elementA === elementB) return 0;
|
|
33
|
-
if (!elementA || !elementB) return 0;
|
|
34
|
-
if (isElementPreceding(elementA, elementB)) {
|
|
35
|
-
if (indexA > indexB) {
|
|
36
|
-
isOrderDifferent = true;
|
|
37
|
-
}
|
|
38
|
-
return -1;
|
|
39
|
-
}
|
|
40
|
-
if (indexA < indexB) {
|
|
41
|
-
isOrderDifferent = true;
|
|
42
|
-
}
|
|
43
|
-
return 1;
|
|
44
|
-
});
|
|
45
|
-
if (isOrderDifferent) {
|
|
46
|
-
return pairs.map(([_, item]) => item);
|
|
47
|
-
}
|
|
48
|
-
return items;
|
|
49
|
-
}
|
|
50
22
|
function getCommonParent(items) {
|
|
51
23
|
var _a;
|
|
52
24
|
const firstItem = items.find((item) => !!item.element);
|
|
@@ -59,14 +31,14 @@ function getCommonParent(items) {
|
|
|
59
31
|
}
|
|
60
32
|
parentElement = parentElement.parentElement;
|
|
61
33
|
}
|
|
62
|
-
return
|
|
34
|
+
return _726BNPQZcjs.getDocument.call(void 0, parentElement).body;
|
|
63
35
|
}
|
|
64
36
|
function getPrivateStore(store) {
|
|
65
37
|
return store == null ? void 0 : store.__unstablePrivateStore;
|
|
66
38
|
}
|
|
67
39
|
function createCollectionStore(props = {}) {
|
|
68
40
|
var _a;
|
|
69
|
-
|
|
41
|
+
_ASR6PAFNcjs.throwOnConflictingProps.call(void 0, props, props.store);
|
|
70
42
|
const syncState = (_a = props.store) == null ? void 0 : _a.getState();
|
|
71
43
|
const items = _MLCPLY2Pcjs.defaultValue.call(void 0,
|
|
72
44
|
props.items,
|
|
@@ -80,24 +52,24 @@ function createCollectionStore(props = {}) {
|
|
|
80
52
|
renderedItems: _MLCPLY2Pcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.renderedItems, [])
|
|
81
53
|
};
|
|
82
54
|
const syncPrivateStore = getPrivateStore(props.store);
|
|
83
|
-
const privateStore =
|
|
55
|
+
const privateStore = _ASR6PAFNcjs.createStore.call(void 0,
|
|
84
56
|
{ items, renderedItems: initialState.renderedItems },
|
|
85
57
|
syncPrivateStore
|
|
86
58
|
);
|
|
87
|
-
const collection =
|
|
59
|
+
const collection = _ASR6PAFNcjs.createStore.call(void 0, initialState, props.store);
|
|
88
60
|
const sortItems = (renderedItems) => {
|
|
89
|
-
const sortedItems = sortBasedOnDOMPosition(renderedItems);
|
|
61
|
+
const sortedItems = _726BNPQZcjs.sortBasedOnDOMPosition.call(void 0, renderedItems, (i) => i.element);
|
|
90
62
|
privateStore.setState("renderedItems", sortedItems);
|
|
91
63
|
collection.setState("renderedItems", sortedItems);
|
|
92
64
|
};
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
return
|
|
65
|
+
_ASR6PAFNcjs.setup.call(void 0, collection, () => _ASR6PAFNcjs.init.call(void 0, privateStore));
|
|
66
|
+
_ASR6PAFNcjs.setup.call(void 0, privateStore, () => {
|
|
67
|
+
return _ASR6PAFNcjs.batch.call(void 0, privateStore, ["items"], (state) => {
|
|
96
68
|
collection.setState("items", state.items);
|
|
97
69
|
});
|
|
98
70
|
});
|
|
99
|
-
|
|
100
|
-
return
|
|
71
|
+
_ASR6PAFNcjs.setup.call(void 0, privateStore, () => {
|
|
72
|
+
return _ASR6PAFNcjs.batch.call(void 0, privateStore, ["renderedItems"], (state) => {
|
|
101
73
|
let firstRun = true;
|
|
102
74
|
let raf = requestAnimationFrame(() => {
|
|
103
75
|
const { renderedItems } = collection.getState();
|
|
@@ -179,7 +151,7 @@ function createCollectionStore(props = {}) {
|
|
|
179
151
|
if (!id) return null;
|
|
180
152
|
let item = itemsMap.get(id);
|
|
181
153
|
if (!item) {
|
|
182
|
-
const { items: items2 } =
|
|
154
|
+
const { items: items2 } = privateStore.getState();
|
|
183
155
|
item = items2.find((item2) => item2.id === id);
|
|
184
156
|
if (item) {
|
|
185
157
|
itemsMap.set(id, item);
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _YMCSKJHRcjs = require('./YMCSKJHR.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var
|
|
9
|
+
var _ASR6PAFNcjs = require('./ASR6PAFN.cjs');
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
var _MLCPLY2Pcjs = require('./MLCPLY2P.cjs');
|
|
@@ -23,9 +23,9 @@ function createPopoverStore(_a = {}) {
|
|
|
23
23
|
} = _b, props = _7EQBAZ46cjs.__objRest.call(void 0, _b, [
|
|
24
24
|
"popover"
|
|
25
25
|
]);
|
|
26
|
-
const store =
|
|
26
|
+
const store = _ASR6PAFNcjs.mergeStore.call(void 0,
|
|
27
27
|
props.store,
|
|
28
|
-
|
|
28
|
+
_ASR6PAFNcjs.omit.call(void 0, otherPopover, [
|
|
29
29
|
"arrowElement",
|
|
30
30
|
"anchorElement",
|
|
31
31
|
"contentElement",
|
|
@@ -33,9 +33,9 @@ function createPopoverStore(_a = {}) {
|
|
|
33
33
|
"disclosureElement"
|
|
34
34
|
])
|
|
35
35
|
);
|
|
36
|
-
|
|
36
|
+
_ASR6PAFNcjs.throwOnConflictingProps.call(void 0, props, store);
|
|
37
37
|
const syncState = store == null ? void 0 : store.getState();
|
|
38
|
-
const dialog =
|
|
38
|
+
const dialog = _YMCSKJHRcjs.createDialogStore.call(void 0, _7EQBAZ46cjs.__spreadProps.call(void 0, _7EQBAZ46cjs.__spreadValues.call(void 0, {}, props), { store }));
|
|
39
39
|
const placement = _MLCPLY2Pcjs.defaultValue.call(void 0,
|
|
40
40
|
props.placement,
|
|
41
41
|
syncState == null ? void 0 : syncState.placement,
|
|
@@ -49,7 +49,7 @@ function createPopoverStore(_a = {}) {
|
|
|
49
49
|
arrowElement: _MLCPLY2Pcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.arrowElement, null),
|
|
50
50
|
rendered: Symbol("rendered")
|
|
51
51
|
});
|
|
52
|
-
const popover =
|
|
52
|
+
const popover = _ASR6PAFNcjs.createStore.call(void 0, initialState, dialog, store);
|
|
53
53
|
return _7EQBAZ46cjs.__spreadProps.call(void 0, _7EQBAZ46cjs.__spreadValues.call(void 0, _7EQBAZ46cjs.__spreadValues.call(void 0, {}, dialog), popover), {
|
|
54
54
|
setAnchorElement: (element) => popover.setState("anchorElement", element),
|
|
55
55
|
setPopoverElement: (element) => popover.setState("popoverElement", element),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _BUEPUCQLcjs = require('./BUEPUCQL.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
@@ -9,7 +9,7 @@ var _GDZQUFNPcjs = require('./GDZQUFNP.cjs');
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _ASR6PAFNcjs = require('./ASR6PAFN.cjs');
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
var _MLCPLY2Pcjs = require('./MLCPLY2P.cjs');
|
|
@@ -116,13 +116,18 @@ function verticalizeItems(items) {
|
|
|
116
116
|
function createCompositeStore(props = {}) {
|
|
117
117
|
var _a;
|
|
118
118
|
const syncState = (_a = props.store) == null ? void 0 : _a.getState();
|
|
119
|
-
const collection =
|
|
119
|
+
const collection = _BUEPUCQLcjs.createCollectionStore.call(void 0, props);
|
|
120
120
|
const activeId = _MLCPLY2Pcjs.defaultValue.call(void 0,
|
|
121
121
|
props.activeId,
|
|
122
122
|
syncState == null ? void 0 : syncState.activeId,
|
|
123
123
|
props.defaultActiveId
|
|
124
124
|
);
|
|
125
125
|
const initialState = _7EQBAZ46cjs.__spreadProps.call(void 0, _7EQBAZ46cjs.__spreadValues.call(void 0, {}, collection.getState()), {
|
|
126
|
+
id: _MLCPLY2Pcjs.defaultValue.call(void 0,
|
|
127
|
+
props.id,
|
|
128
|
+
syncState == null ? void 0 : syncState.id,
|
|
129
|
+
`id-${Math.random().toString(36).slice(2, 8)}`
|
|
130
|
+
),
|
|
126
131
|
activeId,
|
|
127
132
|
baseElement: _MLCPLY2Pcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.baseElement, null),
|
|
128
133
|
includesBaseElement: _MLCPLY2Pcjs.defaultValue.call(void 0,
|
|
@@ -146,10 +151,10 @@ function createCompositeStore(props = {}) {
|
|
|
146
151
|
focusWrap: _MLCPLY2Pcjs.defaultValue.call(void 0, props.focusWrap, syncState == null ? void 0 : syncState.focusWrap, false),
|
|
147
152
|
focusShift: _MLCPLY2Pcjs.defaultValue.call(void 0, props.focusShift, syncState == null ? void 0 : syncState.focusShift, false)
|
|
148
153
|
});
|
|
149
|
-
const composite =
|
|
150
|
-
|
|
154
|
+
const composite = _ASR6PAFNcjs.createStore.call(void 0, initialState, collection, props.store);
|
|
155
|
+
_ASR6PAFNcjs.setup.call(void 0,
|
|
151
156
|
composite,
|
|
152
|
-
() =>
|
|
157
|
+
() => _ASR6PAFNcjs.sync.call(void 0, composite, ["renderedItems", "activeId"], (state) => {
|
|
153
158
|
composite.setState("activeId", (activeId2) => {
|
|
154
159
|
var _a2;
|
|
155
160
|
if (activeId2 !== void 0) return activeId2;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _BVPEDDW6cjs = require('./BVPEDDW6.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _ASR6PAFNcjs = require('./ASR6PAFN.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
var _MLCPLY2Pcjs = require('./MLCPLY2P.cjs');
|
|
@@ -16,7 +16,7 @@ var _7EQBAZ46cjs = require('./7EQBAZ46.cjs');
|
|
|
16
16
|
function createHovercardStore(props = {}) {
|
|
17
17
|
var _a;
|
|
18
18
|
const syncState = (_a = props.store) == null ? void 0 : _a.getState();
|
|
19
|
-
const popover =
|
|
19
|
+
const popover = _BVPEDDW6cjs.createPopoverStore.call(void 0, _7EQBAZ46cjs.__spreadProps.call(void 0, _7EQBAZ46cjs.__spreadValues.call(void 0, {}, props), {
|
|
20
20
|
placement: _MLCPLY2Pcjs.defaultValue.call(void 0,
|
|
21
21
|
props.placement,
|
|
22
22
|
syncState == null ? void 0 : syncState.placement,
|
|
@@ -30,7 +30,7 @@ function createHovercardStore(props = {}) {
|
|
|
30
30
|
hideTimeout: _MLCPLY2Pcjs.defaultValue.call(void 0, props.hideTimeout, syncState == null ? void 0 : syncState.hideTimeout),
|
|
31
31
|
autoFocusOnShow: _MLCPLY2Pcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.autoFocusOnShow, false)
|
|
32
32
|
});
|
|
33
|
-
const hovercard =
|
|
33
|
+
const hovercard = _ASR6PAFNcjs.createStore.call(void 0, initialState, popover, props.store);
|
|
34
34
|
return _7EQBAZ46cjs.__spreadProps.call(void 0, _7EQBAZ46cjs.__spreadValues.call(void 0, _7EQBAZ46cjs.__spreadValues.call(void 0, {}, popover), hovercard), {
|
|
35
35
|
setAutoFocusOnShow: (value) => hovercard.setState("autoFocusOnShow", value)
|
|
36
36
|
});
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _K7YTZVWCcjs = require('./K7YTZVWC.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _ASR6PAFNcjs = require('./ASR6PAFN.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
var _MLCPLY2Pcjs = require('./MLCPLY2P.cjs');
|
|
@@ -16,7 +16,7 @@ var _7EQBAZ46cjs = require('./7EQBAZ46.cjs');
|
|
|
16
16
|
function createMenubarStore(props = {}) {
|
|
17
17
|
var _a;
|
|
18
18
|
const syncState = (_a = props.store) == null ? void 0 : _a.getState();
|
|
19
|
-
const composite =
|
|
19
|
+
const composite = _K7YTZVWCcjs.createCompositeStore.call(void 0, _7EQBAZ46cjs.__spreadProps.call(void 0, _7EQBAZ46cjs.__spreadValues.call(void 0, {}, props), {
|
|
20
20
|
orientation: _MLCPLY2Pcjs.defaultValue.call(void 0,
|
|
21
21
|
props.orientation,
|
|
22
22
|
syncState == null ? void 0 : syncState.orientation,
|
|
@@ -25,7 +25,7 @@ function createMenubarStore(props = {}) {
|
|
|
25
25
|
focusLoop: _MLCPLY2Pcjs.defaultValue.call(void 0, props.focusLoop, syncState == null ? void 0 : syncState.focusLoop, true)
|
|
26
26
|
}));
|
|
27
27
|
const initialState = _7EQBAZ46cjs.__spreadValues.call(void 0, {}, composite.getState());
|
|
28
|
-
const menubar =
|
|
28
|
+
const menubar = _ASR6PAFNcjs.createStore.call(void 0, initialState, composite, props.store);
|
|
29
29
|
return _7EQBAZ46cjs.__spreadValues.call(void 0, _7EQBAZ46cjs.__spreadValues.call(void 0, {}, composite), menubar);
|
|
30
30
|
}
|
|
31
31
|
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var
|
|
9
|
+
var _ASR6PAFNcjs = require('./ASR6PAFN.cjs');
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
var _MLCPLY2Pcjs = require('./MLCPLY2P.cjs');
|
|
@@ -17,11 +17,11 @@ var _7EQBAZ46cjs = require('./7EQBAZ46.cjs');
|
|
|
17
17
|
|
|
18
18
|
// src/disclosure/disclosure-store.ts
|
|
19
19
|
function createDisclosureStore(props = {}) {
|
|
20
|
-
const store =
|
|
20
|
+
const store = _ASR6PAFNcjs.mergeStore.call(void 0,
|
|
21
21
|
props.store,
|
|
22
|
-
|
|
22
|
+
_ASR6PAFNcjs.omit.call(void 0, props.disclosure, ["contentElement", "disclosureElement"])
|
|
23
23
|
);
|
|
24
|
-
|
|
24
|
+
_ASR6PAFNcjs.throwOnConflictingProps.call(void 0, props, store);
|
|
25
25
|
const syncState = store == null ? void 0 : store.getState();
|
|
26
26
|
const open = _MLCPLY2Pcjs.defaultValue.call(void 0,
|
|
27
27
|
props.open,
|
|
@@ -38,24 +38,24 @@ function createDisclosureStore(props = {}) {
|
|
|
38
38
|
contentElement: _MLCPLY2Pcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.contentElement, null),
|
|
39
39
|
disclosureElement: _MLCPLY2Pcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.disclosureElement, null)
|
|
40
40
|
};
|
|
41
|
-
const disclosure =
|
|
42
|
-
|
|
41
|
+
const disclosure = _ASR6PAFNcjs.createStore.call(void 0, initialState, store);
|
|
42
|
+
_ASR6PAFNcjs.setup.call(void 0,
|
|
43
43
|
disclosure,
|
|
44
|
-
() =>
|
|
44
|
+
() => _ASR6PAFNcjs.sync.call(void 0, disclosure, ["animated", "animating"], (state) => {
|
|
45
45
|
if (state.animated) return;
|
|
46
46
|
disclosure.setState("animating", false);
|
|
47
47
|
})
|
|
48
48
|
);
|
|
49
|
-
|
|
49
|
+
_ASR6PAFNcjs.setup.call(void 0,
|
|
50
50
|
disclosure,
|
|
51
|
-
() =>
|
|
51
|
+
() => _ASR6PAFNcjs.subscribe.call(void 0, disclosure, ["open"], () => {
|
|
52
52
|
if (!disclosure.getState().animated) return;
|
|
53
53
|
disclosure.setState("animating", true);
|
|
54
54
|
})
|
|
55
55
|
);
|
|
56
|
-
|
|
56
|
+
_ASR6PAFNcjs.setup.call(void 0,
|
|
57
57
|
disclosure,
|
|
58
|
-
() =>
|
|
58
|
+
() => _ASR6PAFNcjs.sync.call(void 0, disclosure, ["open", "animating"], (state) => {
|
|
59
59
|
disclosure.setState("mounted", state.open || state.animating);
|
|
60
60
|
})
|
|
61
61
|
);
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _726BNPQZcjs = require('./726BNPQZ.cjs');
|
|
4
4
|
|
|
5
5
|
// src/utils/platform.ts
|
|
6
6
|
function isTouchDevice() {
|
|
7
|
-
return
|
|
7
|
+
return _726BNPQZcjs.canUseDOM && !!navigator.maxTouchPoints;
|
|
8
8
|
}
|
|
9
9
|
function isApple() {
|
|
10
|
-
if (!
|
|
10
|
+
if (!_726BNPQZcjs.canUseDOM) return false;
|
|
11
11
|
return /mac|iphone|ipad|ipod/i.test(navigator.platform);
|
|
12
12
|
}
|
|
13
13
|
function isSafari() {
|
|
14
|
-
return
|
|
14
|
+
return _726BNPQZcjs.canUseDOM && isApple() && /apple/i.test(navigator.vendor);
|
|
15
15
|
}
|
|
16
16
|
function isFirefox() {
|
|
17
|
-
return
|
|
17
|
+
return _726BNPQZcjs.canUseDOM && /firefox\//i.test(navigator.userAgent);
|
|
18
18
|
}
|
|
19
19
|
function isMac() {
|
|
20
|
-
return
|
|
20
|
+
return _726BNPQZcjs.canUseDOM && navigator.platform.startsWith("Mac") && !isTouchDevice();
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _V4YF2QA6cjs = require('./V4YF2QA6.cjs');
|
|
4
4
|
|
|
5
5
|
// src/dialog/dialog-store.ts
|
|
6
6
|
function createDialogStore(props = {}) {
|
|
7
|
-
return
|
|
7
|
+
return _V4YF2QA6cjs.createDisclosureStore.call(void 0, props);
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _ASR6PAFNcjs = require('../__chunks/ASR6PAFN.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
var _MLCPLY2Pcjs = require('../__chunks/MLCPLY2P.cjs');
|
|
@@ -13,7 +13,7 @@ var _7EQBAZ46cjs = require('../__chunks/7EQBAZ46.cjs');
|
|
|
13
13
|
// src/checkbox/checkbox-store.ts
|
|
14
14
|
function createCheckboxStore(props = {}) {
|
|
15
15
|
var _a;
|
|
16
|
-
|
|
16
|
+
_ASR6PAFNcjs.throwOnConflictingProps.call(void 0, props, props.store);
|
|
17
17
|
const syncState = (_a = props.store) == null ? void 0 : _a.getState();
|
|
18
18
|
const initialState = {
|
|
19
19
|
value: _MLCPLY2Pcjs.defaultValue.call(void 0,
|
|
@@ -23,7 +23,7 @@ function createCheckboxStore(props = {}) {
|
|
|
23
23
|
false
|
|
24
24
|
)
|
|
25
25
|
};
|
|
26
|
-
const checkbox =
|
|
26
|
+
const checkbox = _ASR6PAFNcjs.createStore.call(void 0, initialState, props.store);
|
|
27
27
|
return _7EQBAZ46cjs.__spreadProps.call(void 0, _7EQBAZ46cjs.__spreadValues.call(void 0, {}, checkbox), {
|
|
28
28
|
setValue: (value) => checkbox.setState("value", value)
|
|
29
29
|
});
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('../__chunks/
|
|
3
|
+
var _BUEPUCQLcjs = require('../__chunks/BUEPUCQL.cjs');
|
|
4
|
+
require('../__chunks/ASR6PAFN.cjs');
|
|
5
5
|
require('../__chunks/MLCPLY2P.cjs');
|
|
6
|
-
require('../__chunks/
|
|
6
|
+
require('../__chunks/726BNPQZ.cjs');
|
|
7
7
|
require('../__chunks/7EQBAZ46.cjs');
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
exports.createCollectionStore =
|
|
10
|
+
exports.createCollectionStore = _BUEPUCQLcjs.createCollectionStore;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('../__chunks/
|
|
3
|
+
var _K7YTZVWCcjs = require('../__chunks/K7YTZVWC.cjs');
|
|
4
|
+
require('../__chunks/BUEPUCQL.cjs');
|
|
5
5
|
require('../__chunks/GDZQUFNP.cjs');
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var
|
|
9
|
-
require('../__chunks/
|
|
10
|
-
require('../__chunks/
|
|
8
|
+
var _BVPEDDW6cjs = require('../__chunks/BVPEDDW6.cjs');
|
|
9
|
+
require('../__chunks/YMCSKJHR.cjs');
|
|
10
|
+
require('../__chunks/V4YF2QA6.cjs');
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
@@ -16,7 +16,7 @@ require('../__chunks/G2MFLTB2.cjs');
|
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
|
|
19
|
-
var
|
|
19
|
+
var _ASR6PAFNcjs = require('../__chunks/ASR6PAFN.cjs');
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
|
|
@@ -24,8 +24,8 @@ var _MLCPLY2Pcjs = require('../__chunks/MLCPLY2P.cjs');
|
|
|
24
24
|
|
|
25
25
|
|
|
26
26
|
|
|
27
|
-
var
|
|
28
|
-
require('../__chunks/
|
|
27
|
+
var _WOLZY4WCcjs = require('../__chunks/WOLZY4WC.cjs');
|
|
28
|
+
require('../__chunks/726BNPQZ.cjs');
|
|
29
29
|
|
|
30
30
|
|
|
31
31
|
|
|
@@ -33,15 +33,15 @@ require('../__chunks/WCFMOJKV.cjs');
|
|
|
33
33
|
var _7EQBAZ46cjs = require('../__chunks/7EQBAZ46.cjs');
|
|
34
34
|
|
|
35
35
|
// src/combobox/combobox-store.ts
|
|
36
|
-
var isTouchSafari =
|
|
36
|
+
var isTouchSafari = _WOLZY4WCcjs.isSafari.call(void 0, ) && _WOLZY4WCcjs.isTouchDevice.call(void 0, );
|
|
37
37
|
function createComboboxStore(_a = {}) {
|
|
38
38
|
var _b = _a, {
|
|
39
39
|
tag
|
|
40
40
|
} = _b, props = _7EQBAZ46cjs.__objRest.call(void 0, _b, [
|
|
41
41
|
"tag"
|
|
42
42
|
]);
|
|
43
|
-
const store =
|
|
44
|
-
|
|
43
|
+
const store = _ASR6PAFNcjs.mergeStore.call(void 0, props.store, _ASR6PAFNcjs.pick.call(void 0, tag, ["value", "rtl"]));
|
|
44
|
+
_ASR6PAFNcjs.throwOnConflictingProps.call(void 0, props, store);
|
|
45
45
|
const tagState = tag == null ? void 0 : tag.getState();
|
|
46
46
|
const syncState = store == null ? void 0 : store.getState();
|
|
47
47
|
const activeId = _MLCPLY2Pcjs.defaultValue.call(void 0,
|
|
@@ -50,7 +50,7 @@ function createComboboxStore(_a = {}) {
|
|
|
50
50
|
props.defaultActiveId,
|
|
51
51
|
null
|
|
52
52
|
);
|
|
53
|
-
const composite =
|
|
53
|
+
const composite = _K7YTZVWCcjs.createCompositeStore.call(void 0, _7EQBAZ46cjs.__spreadProps.call(void 0, _7EQBAZ46cjs.__spreadValues.call(void 0, {}, props), {
|
|
54
54
|
activeId,
|
|
55
55
|
includesBaseElement: _MLCPLY2Pcjs.defaultValue.call(void 0,
|
|
56
56
|
props.includesBaseElement,
|
|
@@ -70,7 +70,7 @@ function createComboboxStore(_a = {}) {
|
|
|
70
70
|
true
|
|
71
71
|
)
|
|
72
72
|
}));
|
|
73
|
-
const popover =
|
|
73
|
+
const popover = _BVPEDDW6cjs.createPopoverStore.call(void 0, _7EQBAZ46cjs.__spreadProps.call(void 0, _7EQBAZ46cjs.__spreadValues.call(void 0, {}, props), {
|
|
74
74
|
placement: _MLCPLY2Pcjs.defaultValue.call(void 0,
|
|
75
75
|
props.placement,
|
|
76
76
|
syncState == null ? void 0 : syncState.placement,
|
|
@@ -106,54 +106,54 @@ function createComboboxStore(_a = {}) {
|
|
|
106
106
|
),
|
|
107
107
|
activeValue: syncState == null ? void 0 : syncState.activeValue
|
|
108
108
|
});
|
|
109
|
-
const combobox =
|
|
109
|
+
const combobox = _ASR6PAFNcjs.createStore.call(void 0, initialState, composite, popover, store);
|
|
110
110
|
if (isTouchSafari) {
|
|
111
|
-
|
|
111
|
+
_ASR6PAFNcjs.setup.call(void 0,
|
|
112
112
|
combobox,
|
|
113
|
-
() =>
|
|
113
|
+
() => _ASR6PAFNcjs.sync.call(void 0, combobox, ["virtualFocus"], () => {
|
|
114
114
|
combobox.setState("virtualFocus", false);
|
|
115
115
|
})
|
|
116
116
|
);
|
|
117
117
|
}
|
|
118
|
-
|
|
118
|
+
_ASR6PAFNcjs.setup.call(void 0, combobox, () => {
|
|
119
119
|
if (!tag) return;
|
|
120
120
|
return _MLCPLY2Pcjs.chain.call(void 0,
|
|
121
|
-
|
|
121
|
+
_ASR6PAFNcjs.sync.call(void 0, combobox, ["selectedValue"], (state) => {
|
|
122
122
|
if (!Array.isArray(state.selectedValue)) return;
|
|
123
123
|
tag.setValues(state.selectedValue);
|
|
124
124
|
}),
|
|
125
|
-
|
|
125
|
+
_ASR6PAFNcjs.sync.call(void 0, tag, ["values"], (state) => {
|
|
126
126
|
combobox.setState("selectedValue", state.values);
|
|
127
127
|
})
|
|
128
128
|
);
|
|
129
129
|
});
|
|
130
|
-
|
|
130
|
+
_ASR6PAFNcjs.setup.call(void 0,
|
|
131
131
|
combobox,
|
|
132
|
-
() =>
|
|
132
|
+
() => _ASR6PAFNcjs.sync.call(void 0, combobox, ["resetValueOnHide", "mounted"], (state) => {
|
|
133
133
|
if (!state.resetValueOnHide) return;
|
|
134
134
|
if (state.mounted) return;
|
|
135
135
|
combobox.setState("value", value);
|
|
136
136
|
})
|
|
137
137
|
);
|
|
138
|
-
|
|
138
|
+
_ASR6PAFNcjs.setup.call(void 0,
|
|
139
139
|
combobox,
|
|
140
|
-
() =>
|
|
140
|
+
() => _ASR6PAFNcjs.sync.call(void 0, combobox, ["open"], (state) => {
|
|
141
141
|
if (state.open) return;
|
|
142
142
|
combobox.setState("activeId", activeId);
|
|
143
143
|
combobox.setState("moves", 0);
|
|
144
144
|
})
|
|
145
145
|
);
|
|
146
|
-
|
|
146
|
+
_ASR6PAFNcjs.setup.call(void 0,
|
|
147
147
|
combobox,
|
|
148
|
-
() =>
|
|
148
|
+
() => _ASR6PAFNcjs.sync.call(void 0, combobox, ["moves", "activeId"], (state, prevState) => {
|
|
149
149
|
if (state.moves === prevState.moves) {
|
|
150
150
|
combobox.setState("activeValue", void 0);
|
|
151
151
|
}
|
|
152
152
|
})
|
|
153
153
|
);
|
|
154
|
-
|
|
154
|
+
_ASR6PAFNcjs.setup.call(void 0,
|
|
155
155
|
combobox,
|
|
156
|
-
() =>
|
|
156
|
+
() => _ASR6PAFNcjs.batch.call(void 0, combobox, ["moves", "renderedItems"], (state, prev) => {
|
|
157
157
|
if (state.moves === prev.moves) return;
|
|
158
158
|
const { activeId: activeId2 } = combobox.getState();
|
|
159
159
|
const activeItem = composite.item(activeId2);
|