@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.
- package/CHANGELOG.md +10 -0
- package/cjs/__chunks/{QYB6XH64.cjs → 27ZAGOYG.cjs} +17 -13
- package/cjs/__chunks/6455U47T.cjs +37 -0
- package/cjs/__chunks/{ZPOXPO2L.cjs → 6SPJEESB.cjs} +33 -21
- package/cjs/__chunks/{2YFRPUZP.cjs → DBHIHK7C.cjs} +6 -6
- package/cjs/__chunks/{W5IHD6VG.cjs → EUJ6NNA6.cjs} +56 -43
- package/cjs/__chunks/{4DQ3OTE7.cjs → FXEBKN6G.cjs} +22 -17
- package/cjs/__chunks/{ZJEEK57E.cjs → HEFJPUYD.cjs} +2 -2
- package/cjs/__chunks/LBTLD2RB.cjs +58 -0
- package/cjs/__chunks/{QNEPGQLL.cjs → M6ZA7XUP.cjs} +6 -2
- package/cjs/__chunks/{HLVPXX7H.cjs → SDBF6KIY.cjs} +107 -107
- package/cjs/__chunks/{OFNGELMA.cjs → ZNW4LSWU.cjs} +8 -6
- package/cjs/checkbox/checkbox-store.cjs +14 -10
- package/cjs/collection/collection-store.cjs +6 -5
- package/cjs/combobox/combobox-store.cjs +49 -48
- package/cjs/composite/composite-overflow-store.cjs +7 -6
- package/cjs/composite/composite-store.cjs +7 -6
- package/cjs/dialog/dialog-store.cjs +6 -5
- package/cjs/disclosure/disclosure-store.cjs +5 -4
- package/cjs/disclosure/disclosure-store.d.ts +8 -0
- package/cjs/form/form-store.cjs +38 -35
- package/cjs/hovercard/hovercard-store.cjs +8 -7
- package/cjs/index.cjs +3 -1
- package/cjs/menu/menu-bar-store.cjs +17 -13
- package/cjs/menu/menu-store.cjs +41 -43
- package/cjs/popover/popover-store.cjs +7 -6
- package/cjs/radio/radio-store.cjs +25 -24
- package/cjs/select/select-store.cjs +42 -42
- package/cjs/tab/tab-store.cjs +29 -28
- package/cjs/tab/tab-store.d.ts +9 -0
- package/cjs/toolbar/toolbar-store.cjs +17 -13
- package/cjs/tooltip/tooltip-store.cjs +24 -25
- package/cjs/tsconfig.build.tsbuildinfo +1 -1
- package/cjs/utils/array.cjs +1 -0
- package/cjs/utils/dom.cjs +3 -2
- package/cjs/utils/events.cjs +14 -9
- package/cjs/utils/focus.cjs +24 -14
- package/cjs/utils/misc.cjs +3 -2
- package/cjs/utils/platform.cjs +4 -3
- package/cjs/utils/store.cjs +4 -3
- package/esm/__chunks/4BKCJXBM.js +37 -0
- package/esm/__chunks/AHZW5LR4.js +58 -0
- package/esm/__chunks/{NA5BK7DD.js → BOKMNDR7.js} +22 -10
- package/esm/__chunks/{6PEWNRTN.js → CUW3E24J.js} +100 -100
- package/esm/__chunks/{WFGVC6LE.js → EWHSN7GO.js} +17 -12
- package/esm/__chunks/{4T5RHRE5.js → MNNKHNLW.js} +1 -1
- package/esm/__chunks/{UVCATTRC.js → N6JW4ITM.js} +7 -5
- package/esm/__chunks/{RMD7SNCC.js → NWU4GBZ6.js} +5 -1
- package/esm/__chunks/{X7MJ3FB5.js → R6VHFWTV.js} +49 -36
- package/esm/__chunks/{DXA3K2FY.js → TFBCK4JB.js} +1 -1
- package/esm/__chunks/{IOAGNCXX.js → ZV2GEGPL.js} +14 -10
- package/esm/checkbox/checkbox-store.js +11 -7
- package/esm/collection/collection-store.js +5 -4
- package/esm/combobox/combobox-store.js +34 -33
- package/esm/composite/composite-overflow-store.js +6 -5
- package/esm/composite/composite-store.js +6 -5
- package/esm/dialog/dialog-store.js +5 -4
- package/esm/disclosure/disclosure-store.d.ts +8 -0
- package/esm/disclosure/disclosure-store.js +4 -3
- package/esm/form/form-store.js +24 -21
- package/esm/hovercard/hovercard-store.js +7 -6
- package/esm/index.js +2 -0
- package/esm/menu/menu-bar-store.js +15 -11
- package/esm/menu/menu-store.js +31 -33
- package/esm/popover/popover-store.js +6 -5
- package/esm/radio/radio-store.js +22 -21
- package/esm/select/select-store.js +29 -29
- package/esm/tab/tab-store.d.ts +9 -0
- package/esm/tab/tab-store.js +23 -22
- package/esm/toolbar/toolbar-store.js +15 -11
- package/esm/tooltip/tooltip-store.js +20 -21
- package/esm/tsconfig.build.tsbuildinfo +1 -1
- package/esm/utils/array.js +1 -0
- package/esm/utils/dom.js +2 -1
- package/esm/utils/events.js +10 -5
- package/esm/utils/focus.js +14 -4
- package/esm/utils/misc.js +2 -1
- package/esm/utils/platform.js +3 -2
- package/esm/utils/store.js +3 -2
- package/package.json +1 -1
- package/cjs/__chunks/DQHU5K4Q.cjs +0 -57
- package/esm/__chunks/6HMPWUDT.js +0 -57
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createStore
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./BOKMNDR7.js";
|
|
4
4
|
import {
|
|
5
5
|
chain,
|
|
6
6
|
defaultValue
|
|
7
|
-
} from "./
|
|
7
|
+
} from "./NWU4GBZ6.js";
|
|
8
8
|
import {
|
|
9
9
|
getDocument
|
|
10
|
-
} from "./
|
|
10
|
+
} from "./N6JW4ITM.js";
|
|
11
|
+
import {
|
|
12
|
+
__spreadProps,
|
|
13
|
+
__spreadValues
|
|
14
|
+
} from "./4BKCJXBM.js";
|
|
11
15
|
|
|
12
16
|
// src/collection/collection-store.ts
|
|
13
17
|
function isElementPreceding(a, b) {
|
|
@@ -42,10 +46,11 @@ function sortBasedOnDOMPosition(items) {
|
|
|
42
46
|
return items;
|
|
43
47
|
}
|
|
44
48
|
function getCommonParent(items) {
|
|
49
|
+
var _a;
|
|
45
50
|
const firstItem = items.find((item) => !!item.element);
|
|
46
51
|
const lastItem = [...items].reverse().find((item) => !!item.element);
|
|
47
|
-
let parentElement = firstItem
|
|
48
|
-
while (parentElement && lastItem
|
|
52
|
+
let parentElement = (_a = firstItem == null ? void 0 : firstItem.element) == null ? void 0 : _a.parentElement;
|
|
53
|
+
while (parentElement && (lastItem == null ? void 0 : lastItem.element)) {
|
|
49
54
|
const parent = parentElement;
|
|
50
55
|
if (lastItem && parent.contains(lastItem.element)) {
|
|
51
56
|
return parentElement;
|
|
@@ -55,11 +60,12 @@ function getCommonParent(items) {
|
|
|
55
60
|
return getDocument(parentElement).body;
|
|
56
61
|
}
|
|
57
62
|
function createCollectionStore(props = {}) {
|
|
63
|
+
var _a;
|
|
58
64
|
const itemsMap = /* @__PURE__ */ new Map();
|
|
59
|
-
const syncState = props.store
|
|
65
|
+
const syncState = (_a = props.store) == null ? void 0 : _a.getState();
|
|
60
66
|
const initialState = {
|
|
61
|
-
items: defaultValue(props.items, syncState
|
|
62
|
-
renderedItems: defaultValue(syncState
|
|
67
|
+
items: defaultValue(props.items, syncState == null ? void 0 : syncState.items, props.defaultItems, []),
|
|
68
|
+
renderedItems: defaultValue(syncState == null ? void 0 : syncState.renderedItems, [])
|
|
63
69
|
};
|
|
64
70
|
const privateStore = createStore({
|
|
65
71
|
renderedItems: initialState.renderedItems
|
|
@@ -108,7 +114,7 @@ function createCollectionStore(props = {}) {
|
|
|
108
114
|
const nextItems = items.slice();
|
|
109
115
|
if (index && index >= 0) {
|
|
110
116
|
prevItem = items[index];
|
|
111
|
-
const nextItem = {
|
|
117
|
+
const nextItem = __spreadValues(__spreadValues({}, prevItem), item);
|
|
112
118
|
nextItems[index] = nextItem;
|
|
113
119
|
itemsMap.set(item.id, nextItem);
|
|
114
120
|
} else {
|
|
@@ -137,8 +143,7 @@ function createCollectionStore(props = {}) {
|
|
|
137
143
|
return unmergeItem;
|
|
138
144
|
};
|
|
139
145
|
const registerItem = (item) => mergeItem(item, (getItems) => collection.setState("items", getItems), true);
|
|
140
|
-
return {
|
|
141
|
-
...collection,
|
|
146
|
+
return __spreadProps(__spreadValues({}, collection), {
|
|
142
147
|
registerItem,
|
|
143
148
|
renderItem: (item) => chain(
|
|
144
149
|
registerItem(item),
|
|
@@ -160,7 +165,7 @@ function createCollectionStore(props = {}) {
|
|
|
160
165
|
}
|
|
161
166
|
return item || null;
|
|
162
167
|
}
|
|
163
|
-
};
|
|
168
|
+
});
|
|
164
169
|
}
|
|
165
170
|
|
|
166
171
|
export {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
// src/utils/dom.ts
|
|
2
2
|
var canUseDOM = checkIsBrowser();
|
|
3
3
|
function checkIsBrowser() {
|
|
4
|
-
|
|
4
|
+
var _a;
|
|
5
|
+
return typeof window !== "undefined" && !!((_a = window.document) == null ? void 0 : _a.createElement);
|
|
5
6
|
}
|
|
6
7
|
function getDocument(node) {
|
|
7
8
|
return node ? node.ownerDocument || node : document;
|
|
@@ -11,7 +12,7 @@ function getWindow(node) {
|
|
|
11
12
|
}
|
|
12
13
|
function getActiveElement(node, activeDescendant = false) {
|
|
13
14
|
const { activeElement } = getDocument(node);
|
|
14
|
-
if (!activeElement
|
|
15
|
+
if (!(activeElement == null ? void 0 : activeElement.nodeName)) {
|
|
15
16
|
return null;
|
|
16
17
|
}
|
|
17
18
|
if (isFrame(activeElement) && activeElement.contentDocument) {
|
|
@@ -88,13 +89,14 @@ function isTextField(element) {
|
|
|
88
89
|
}
|
|
89
90
|
function getPopupRole(element, fallback) {
|
|
90
91
|
const allowedPopupRoles = ["dialog", "menu", "listbox", "tree", "grid"];
|
|
91
|
-
const role = element
|
|
92
|
+
const role = element == null ? void 0 : element.getAttribute("role");
|
|
92
93
|
if (role && allowedPopupRoles.indexOf(role) !== -1) {
|
|
93
94
|
return role;
|
|
94
95
|
}
|
|
95
96
|
return fallback;
|
|
96
97
|
}
|
|
97
98
|
function getPopupItemRole(element, fallback) {
|
|
99
|
+
var _a;
|
|
98
100
|
const itemRoleByPopupRole = {
|
|
99
101
|
menu: "menuitem",
|
|
100
102
|
listbox: "option",
|
|
@@ -105,7 +107,7 @@ function getPopupItemRole(element, fallback) {
|
|
|
105
107
|
if (!popupRole)
|
|
106
108
|
return fallback;
|
|
107
109
|
const key = popupRole;
|
|
108
|
-
return itemRoleByPopupRole[key]
|
|
110
|
+
return (_a = itemRoleByPopupRole[key]) != null ? _a : fallback;
|
|
109
111
|
}
|
|
110
112
|
function getTextboxSelection(element) {
|
|
111
113
|
let start = 0;
|
|
@@ -115,7 +117,7 @@ function getTextboxSelection(element) {
|
|
|
115
117
|
end = element.selectionEnd || 0;
|
|
116
118
|
} else if (element.isContentEditable) {
|
|
117
119
|
const selection = getDocument(element).getSelection();
|
|
118
|
-
if (selection
|
|
120
|
+
if ((selection == null ? void 0 : selection.rangeCount) && selection.anchorNode && contains(element, selection.anchorNode) && selection.focusNode && contains(element, selection.focusNode)) {
|
|
119
121
|
const range = selection.getRangeAt(0);
|
|
120
122
|
const nextRange = range.cloneRange();
|
|
121
123
|
nextRange.selectNodeContents(element);
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__spreadValues
|
|
3
|
+
} from "./4BKCJXBM.js";
|
|
4
|
+
|
|
1
5
|
// src/utils/misc.ts
|
|
2
6
|
function noop(..._) {
|
|
3
7
|
}
|
|
@@ -76,7 +80,7 @@ function normalizeString(str) {
|
|
|
76
80
|
return str.normalize("NFD").replace(/[\u0300-\u036f]/g, "");
|
|
77
81
|
}
|
|
78
82
|
function omit(object, keys) {
|
|
79
|
-
const result = {
|
|
83
|
+
const result = __spreadValues({}, object);
|
|
80
84
|
for (const key of keys) {
|
|
81
85
|
if (hasOwnProperty(result, key)) {
|
|
82
86
|
delete result[key];
|
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createCollectionStore
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./EWHSN7GO.js";
|
|
4
4
|
import {
|
|
5
5
|
createStore
|
|
6
|
-
} from "./
|
|
6
|
+
} from "./BOKMNDR7.js";
|
|
7
7
|
import {
|
|
8
8
|
defaultValue
|
|
9
|
-
} from "./
|
|
9
|
+
} from "./NWU4GBZ6.js";
|
|
10
10
|
import {
|
|
11
11
|
flatten2DArray,
|
|
12
12
|
reverseArray
|
|
13
13
|
} from "./5XEKIOCW.js";
|
|
14
|
+
import {
|
|
15
|
+
__spreadProps,
|
|
16
|
+
__spreadValues
|
|
17
|
+
} from "./4BKCJXBM.js";
|
|
14
18
|
|
|
15
19
|
// src/composite/composite-store.ts
|
|
16
20
|
var NULL_ITEM = { id: null };
|
|
@@ -51,7 +55,10 @@ function flipItems(items, activeId, shouldInsertNullItem = false) {
|
|
|
51
55
|
function groupItemsByRows(items) {
|
|
52
56
|
const rows = [];
|
|
53
57
|
for (const item of items) {
|
|
54
|
-
const row = rows.find((currentRow) =>
|
|
58
|
+
const row = rows.find((currentRow) => {
|
|
59
|
+
var _a;
|
|
60
|
+
return ((_a = currentRow[0]) == null ? void 0 : _a.rowId) === item.rowId;
|
|
61
|
+
});
|
|
55
62
|
if (row) {
|
|
56
63
|
row.push(item);
|
|
57
64
|
} else {
|
|
@@ -84,7 +91,7 @@ function normalizeRows(rows, activeId, focusShift) {
|
|
|
84
91
|
if (!item || focusShift && item.disabled) {
|
|
85
92
|
const isFirst = i === 0;
|
|
86
93
|
const previousItem = isFirst && focusShift ? findFirstEnabledItem(row) : row[i - 1];
|
|
87
|
-
row[i] = previousItem && activeId !== previousItem.id && focusShift ? previousItem : createEmptyItem(previousItem
|
|
94
|
+
row[i] = previousItem && activeId !== previousItem.id && focusShift ? previousItem : createEmptyItem(previousItem == null ? void 0 : previousItem.rowId);
|
|
88
95
|
}
|
|
89
96
|
}
|
|
90
97
|
}
|
|
@@ -98,77 +105,78 @@ function verticalizeItems(items) {
|
|
|
98
105
|
for (const row of rows) {
|
|
99
106
|
const item = row[i];
|
|
100
107
|
if (item) {
|
|
101
|
-
verticalized.push({
|
|
102
|
-
...item,
|
|
108
|
+
verticalized.push(__spreadProps(__spreadValues({}, item), {
|
|
103
109
|
// If there's no rowId, it means that it's not a grid composite, but
|
|
104
110
|
// a single row instead. So, instead of verticalizing it, that is,
|
|
105
111
|
// assigning a different rowId based on the column index, we keep it
|
|
106
112
|
// undefined so they will be part of the same row. This is useful
|
|
107
113
|
// when using up/down on one-dimensional composites.
|
|
108
114
|
rowId: item.rowId ? `${i}` : void 0
|
|
109
|
-
});
|
|
115
|
+
}));
|
|
110
116
|
}
|
|
111
117
|
}
|
|
112
118
|
}
|
|
113
119
|
return verticalized;
|
|
114
120
|
}
|
|
115
121
|
function createCompositeStore(props = {}) {
|
|
116
|
-
|
|
122
|
+
var _a;
|
|
123
|
+
const syncState = (_a = props.store) == null ? void 0 : _a.getState();
|
|
117
124
|
const collection = createCollectionStore(props);
|
|
118
125
|
const activeId = defaultValue(
|
|
119
126
|
props.activeId,
|
|
120
|
-
syncState
|
|
127
|
+
syncState == null ? void 0 : syncState.activeId,
|
|
121
128
|
props.defaultActiveId
|
|
122
129
|
);
|
|
123
|
-
const initialState = {
|
|
124
|
-
...collection.getState(),
|
|
130
|
+
const initialState = __spreadProps(__spreadValues({}, collection.getState()), {
|
|
125
131
|
activeId,
|
|
126
|
-
baseElement: defaultValue(syncState
|
|
132
|
+
baseElement: defaultValue(syncState == null ? void 0 : syncState.baseElement, null),
|
|
127
133
|
includesBaseElement: defaultValue(
|
|
128
134
|
props.includesBaseElement,
|
|
129
|
-
syncState
|
|
135
|
+
syncState == null ? void 0 : syncState.includesBaseElement,
|
|
130
136
|
activeId === null
|
|
131
137
|
),
|
|
132
|
-
moves: defaultValue(syncState
|
|
138
|
+
moves: defaultValue(syncState == null ? void 0 : syncState.moves, 0),
|
|
133
139
|
orientation: defaultValue(
|
|
134
140
|
props.orientation,
|
|
135
|
-
syncState
|
|
141
|
+
syncState == null ? void 0 : syncState.orientation,
|
|
136
142
|
"both"
|
|
137
143
|
),
|
|
138
|
-
rtl: defaultValue(props.rtl, syncState
|
|
144
|
+
rtl: defaultValue(props.rtl, syncState == null ? void 0 : syncState.rtl, false),
|
|
139
145
|
virtualFocus: defaultValue(
|
|
140
146
|
props.virtualFocus,
|
|
141
|
-
syncState
|
|
147
|
+
syncState == null ? void 0 : syncState.virtualFocus,
|
|
142
148
|
false
|
|
143
149
|
),
|
|
144
|
-
focusLoop: defaultValue(props.focusLoop, syncState
|
|
145
|
-
focusWrap: defaultValue(props.focusWrap, syncState
|
|
146
|
-
focusShift: defaultValue(props.focusShift, syncState
|
|
147
|
-
};
|
|
150
|
+
focusLoop: defaultValue(props.focusLoop, syncState == null ? void 0 : syncState.focusLoop, false),
|
|
151
|
+
focusWrap: defaultValue(props.focusWrap, syncState == null ? void 0 : syncState.focusWrap, false),
|
|
152
|
+
focusShift: defaultValue(props.focusShift, syncState == null ? void 0 : syncState.focusShift, false)
|
|
153
|
+
});
|
|
148
154
|
const composite = createStore(initialState, collection, props.store);
|
|
149
155
|
composite.setup(
|
|
150
156
|
() => composite.sync(
|
|
151
157
|
(state) => {
|
|
152
158
|
composite.setState("activeId", (activeId2) => {
|
|
159
|
+
var _a2;
|
|
153
160
|
if (activeId2 !== void 0)
|
|
154
161
|
return activeId2;
|
|
155
|
-
return findFirstEnabledItem(state.renderedItems)
|
|
162
|
+
return (_a2 = findFirstEnabledItem(state.renderedItems)) == null ? void 0 : _a2.id;
|
|
156
163
|
});
|
|
157
164
|
},
|
|
158
165
|
["renderedItems", "activeId"]
|
|
159
166
|
)
|
|
160
167
|
);
|
|
161
168
|
const getNextId = (items, orientation, hasNullItem, skip) => {
|
|
169
|
+
var _a2, _b;
|
|
162
170
|
const { activeId: activeId2, rtl, focusLoop, focusWrap, includesBaseElement } = composite.getState();
|
|
163
171
|
const isHorizontal = orientation !== "vertical";
|
|
164
172
|
const isRTL = rtl && isHorizontal;
|
|
165
173
|
const allItems = isRTL ? reverseArray(items) : items;
|
|
166
174
|
if (activeId2 == null) {
|
|
167
|
-
return findFirstEnabledItem(allItems)
|
|
175
|
+
return (_a2 = findFirstEnabledItem(allItems)) == null ? void 0 : _a2.id;
|
|
168
176
|
}
|
|
169
177
|
const activeItem = allItems.find((item) => item.id === activeId2);
|
|
170
178
|
if (!activeItem) {
|
|
171
|
-
return findFirstEnabledItem(allItems)
|
|
179
|
+
return (_b = findFirstEnabledItem(allItems)) == null ? void 0 : _b.id;
|
|
172
180
|
}
|
|
173
181
|
const isGrid = !!activeItem.rowId;
|
|
174
182
|
const activeIndex = allItems.indexOf(activeItem);
|
|
@@ -178,7 +186,7 @@ function createCompositeStore(props = {}) {
|
|
|
178
186
|
const nextEnabledItemsInRow = getEnabledItems(nextItemsInRow, activeId2);
|
|
179
187
|
const nextItem2 = nextEnabledItemsInRow.slice(skip)[0] || // If we can't find an item, just return the last one.
|
|
180
188
|
nextEnabledItemsInRow[nextEnabledItemsInRow.length - 1];
|
|
181
|
-
return nextItem2
|
|
189
|
+
return nextItem2 == null ? void 0 : nextItem2.id;
|
|
182
190
|
}
|
|
183
191
|
const oppositeOrientation = getOppositeOrientation(
|
|
184
192
|
// If it's a grid and orientation is not set, it's a next/previous call,
|
|
@@ -193,7 +201,7 @@ function createCompositeStore(props = {}) {
|
|
|
193
201
|
const loopItems = canWrap && !hasNullItem ? allItems : getItemsInRow(allItems, activeItem.rowId);
|
|
194
202
|
const sortedItems = flipItems(loopItems, activeId2, hasNullItem);
|
|
195
203
|
const nextItem2 = findFirstEnabledItem(sortedItems, activeId2);
|
|
196
|
-
return nextItem2
|
|
204
|
+
return nextItem2 == null ? void 0 : nextItem2.id;
|
|
197
205
|
}
|
|
198
206
|
if (canWrap) {
|
|
199
207
|
const nextItem2 = findFirstEnabledItem(
|
|
@@ -206,18 +214,16 @@ function createCompositeStore(props = {}) {
|
|
|
206
214
|
hasNullItem ? nextItemsInRow : nextItems,
|
|
207
215
|
activeId2
|
|
208
216
|
);
|
|
209
|
-
const nextId = hasNullItem ? nextItem2
|
|
217
|
+
const nextId = hasNullItem ? (nextItem2 == null ? void 0 : nextItem2.id) || null : nextItem2 == null ? void 0 : nextItem2.id;
|
|
210
218
|
return nextId;
|
|
211
219
|
}
|
|
212
220
|
const nextItem = findFirstEnabledItem(nextItemsInRow, activeId2);
|
|
213
221
|
if (!nextItem && hasNullItem) {
|
|
214
222
|
return null;
|
|
215
223
|
}
|
|
216
|
-
return nextItem
|
|
224
|
+
return nextItem == null ? void 0 : nextItem.id;
|
|
217
225
|
};
|
|
218
|
-
return {
|
|
219
|
-
...collection,
|
|
220
|
-
...composite,
|
|
226
|
+
return __spreadProps(__spreadValues(__spreadValues({}, collection), composite), {
|
|
221
227
|
setBaseElement: (element) => composite.setState("baseElement", element),
|
|
222
228
|
setActiveId: (id) => composite.setState("activeId", id),
|
|
223
229
|
move: (id) => {
|
|
@@ -226,15 +232,22 @@ function createCompositeStore(props = {}) {
|
|
|
226
232
|
composite.setState("activeId", id);
|
|
227
233
|
composite.setState("moves", (moves) => moves + 1);
|
|
228
234
|
},
|
|
229
|
-
first: () =>
|
|
230
|
-
|
|
235
|
+
first: () => {
|
|
236
|
+
var _a2;
|
|
237
|
+
return (_a2 = findFirstEnabledItem(composite.getState().renderedItems)) == null ? void 0 : _a2.id;
|
|
238
|
+
},
|
|
239
|
+
last: () => {
|
|
240
|
+
var _a2;
|
|
241
|
+
return (_a2 = findFirstEnabledItem(reverseArray(composite.getState().renderedItems))) == null ? void 0 : _a2.id;
|
|
242
|
+
},
|
|
231
243
|
next: (skip) => {
|
|
232
244
|
const { renderedItems, orientation } = composite.getState();
|
|
233
245
|
return getNextId(renderedItems, orientation, false, skip);
|
|
234
246
|
},
|
|
235
247
|
previous: (skip) => {
|
|
248
|
+
var _a2;
|
|
236
249
|
const { renderedItems, orientation, includesBaseElement } = composite.getState();
|
|
237
|
-
const isGrid = !!findFirstEnabledItem(renderedItems)
|
|
250
|
+
const isGrid = !!((_a2 = findFirstEnabledItem(renderedItems)) == null ? void 0 : _a2.rowId);
|
|
238
251
|
const hasNullItem = !isGrid && includesBaseElement;
|
|
239
252
|
return getNextId(
|
|
240
253
|
reverseArray(renderedItems),
|
|
@@ -278,7 +291,7 @@ function createCompositeStore(props = {}) {
|
|
|
278
291
|
const hasNullItem = includesBaseElement;
|
|
279
292
|
return getNextId(verticalItems, "vertical", hasNullItem, skip);
|
|
280
293
|
}
|
|
281
|
-
};
|
|
294
|
+
});
|
|
282
295
|
}
|
|
283
296
|
|
|
284
297
|
export {
|
|
@@ -1,27 +1,32 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createStore
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./BOKMNDR7.js";
|
|
4
4
|
import {
|
|
5
5
|
defaultValue
|
|
6
|
-
} from "./
|
|
6
|
+
} from "./NWU4GBZ6.js";
|
|
7
|
+
import {
|
|
8
|
+
__spreadProps,
|
|
9
|
+
__spreadValues
|
|
10
|
+
} from "./4BKCJXBM.js";
|
|
7
11
|
|
|
8
12
|
// src/disclosure/disclosure-store.ts
|
|
9
13
|
function createDisclosureStore(props = {}) {
|
|
10
|
-
|
|
14
|
+
var _a;
|
|
15
|
+
const syncState = (_a = props.store) == null ? void 0 : _a.getState();
|
|
11
16
|
const open = defaultValue(
|
|
12
17
|
props.open,
|
|
13
|
-
syncState
|
|
18
|
+
syncState == null ? void 0 : syncState.open,
|
|
14
19
|
props.defaultOpen,
|
|
15
20
|
false
|
|
16
21
|
);
|
|
17
|
-
const animated = defaultValue(props.animated, syncState
|
|
22
|
+
const animated = defaultValue(props.animated, syncState == null ? void 0 : syncState.animated, false);
|
|
18
23
|
const initialState = {
|
|
19
24
|
open,
|
|
20
25
|
animated,
|
|
21
26
|
animating: !!animated && open,
|
|
22
27
|
mounted: open,
|
|
23
|
-
contentElement: defaultValue(syncState
|
|
24
|
-
disclosureElement: defaultValue(syncState
|
|
28
|
+
contentElement: defaultValue(syncState == null ? void 0 : syncState.contentElement, null),
|
|
29
|
+
disclosureElement: defaultValue(syncState == null ? void 0 : syncState.disclosureElement, null)
|
|
25
30
|
};
|
|
26
31
|
const disclosure = createStore(initialState, props.store);
|
|
27
32
|
disclosure.setup(
|
|
@@ -54,8 +59,7 @@ function createDisclosureStore(props = {}) {
|
|
|
54
59
|
["open", "animating"]
|
|
55
60
|
)
|
|
56
61
|
);
|
|
57
|
-
return {
|
|
58
|
-
...disclosure,
|
|
62
|
+
return __spreadProps(__spreadValues({}, disclosure), {
|
|
59
63
|
setOpen: (value) => disclosure.setState("open", value),
|
|
60
64
|
show: () => disclosure.setState("open", true),
|
|
61
65
|
hide: () => disclosure.setState("open", false),
|
|
@@ -63,7 +67,7 @@ function createDisclosureStore(props = {}) {
|
|
|
63
67
|
stopAnimation: () => disclosure.setState("animating", false),
|
|
64
68
|
setContentElement: (value) => disclosure.setState("contentElement", value),
|
|
65
69
|
setDisclosureElement: (value) => disclosure.setState("disclosureElement", value)
|
|
66
|
-
};
|
|
70
|
+
});
|
|
67
71
|
}
|
|
68
72
|
|
|
69
73
|
export {
|
|
@@ -1,26 +1,30 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createStore
|
|
3
|
-
} from "../__chunks/
|
|
3
|
+
} from "../__chunks/BOKMNDR7.js";
|
|
4
4
|
import {
|
|
5
5
|
defaultValue
|
|
6
|
-
} from "../__chunks/
|
|
6
|
+
} from "../__chunks/NWU4GBZ6.js";
|
|
7
|
+
import {
|
|
8
|
+
__spreadProps,
|
|
9
|
+
__spreadValues
|
|
10
|
+
} from "../__chunks/4BKCJXBM.js";
|
|
7
11
|
|
|
8
12
|
// src/checkbox/checkbox-store.ts
|
|
9
13
|
function createCheckboxStore(props = {}) {
|
|
10
|
-
|
|
14
|
+
var _a;
|
|
15
|
+
const syncState = (_a = props.store) == null ? void 0 : _a.getState();
|
|
11
16
|
const initialState = {
|
|
12
17
|
value: defaultValue(
|
|
13
18
|
props.value,
|
|
14
|
-
syncState
|
|
19
|
+
syncState == null ? void 0 : syncState.value,
|
|
15
20
|
props.defaultValue,
|
|
16
21
|
false
|
|
17
22
|
)
|
|
18
23
|
};
|
|
19
24
|
const checkbox = createStore(initialState, props.store);
|
|
20
|
-
return {
|
|
21
|
-
...checkbox,
|
|
25
|
+
return __spreadProps(__spreadValues({}, checkbox), {
|
|
22
26
|
setValue: (value) => checkbox.setState("value", value)
|
|
23
|
-
};
|
|
27
|
+
});
|
|
24
28
|
}
|
|
25
29
|
export {
|
|
26
30
|
createCheckboxStore
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createCollectionStore
|
|
3
|
-
} from "../__chunks/
|
|
4
|
-
import "../__chunks/
|
|
5
|
-
import "../__chunks/
|
|
6
|
-
import "../__chunks/
|
|
3
|
+
} from "../__chunks/EWHSN7GO.js";
|
|
4
|
+
import "../__chunks/BOKMNDR7.js";
|
|
5
|
+
import "../__chunks/NWU4GBZ6.js";
|
|
6
|
+
import "../__chunks/N6JW4ITM.js";
|
|
7
|
+
import "../__chunks/4BKCJXBM.js";
|
|
7
8
|
export {
|
|
8
9
|
createCollectionStore
|
|
9
10
|
};
|
|
@@ -1,36 +1,44 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createPopoverStore
|
|
3
|
-
} from "../__chunks/
|
|
4
|
-
import "../__chunks/
|
|
5
|
-
import "../__chunks/
|
|
3
|
+
} from "../__chunks/CUW3E24J.js";
|
|
4
|
+
import "../__chunks/MNNKHNLW.js";
|
|
5
|
+
import "../__chunks/ZV2GEGPL.js";
|
|
6
6
|
import {
|
|
7
7
|
createCompositeStore
|
|
8
|
-
} from "../__chunks/
|
|
9
|
-
import "../__chunks/
|
|
8
|
+
} from "../__chunks/R6VHFWTV.js";
|
|
9
|
+
import "../__chunks/EWHSN7GO.js";
|
|
10
10
|
import {
|
|
11
11
|
createStore,
|
|
12
12
|
mergeStore
|
|
13
|
-
} from "../__chunks/
|
|
13
|
+
} from "../__chunks/BOKMNDR7.js";
|
|
14
14
|
import {
|
|
15
15
|
defaultValue
|
|
16
|
-
} from "../__chunks/
|
|
16
|
+
} from "../__chunks/NWU4GBZ6.js";
|
|
17
17
|
import {
|
|
18
18
|
isSafari,
|
|
19
19
|
isTouchDevice
|
|
20
|
-
} from "../__chunks/
|
|
21
|
-
import "../__chunks/
|
|
20
|
+
} from "../__chunks/TFBCK4JB.js";
|
|
21
|
+
import "../__chunks/N6JW4ITM.js";
|
|
22
22
|
import "../__chunks/5XEKIOCW.js";
|
|
23
|
+
import {
|
|
24
|
+
__objRest,
|
|
25
|
+
__spreadProps,
|
|
26
|
+
__spreadValues
|
|
27
|
+
} from "../__chunks/4BKCJXBM.js";
|
|
23
28
|
|
|
24
29
|
// src/combobox/combobox-store.ts
|
|
25
30
|
var isSafariOnMobile = isSafari() && isTouchDevice();
|
|
26
|
-
function createComboboxStore({
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
} =
|
|
31
|
+
function createComboboxStore(_a = {}) {
|
|
32
|
+
var _b = _a, {
|
|
33
|
+
menu,
|
|
34
|
+
select
|
|
35
|
+
} = _b, props = __objRest(_b, [
|
|
36
|
+
"menu",
|
|
37
|
+
"select"
|
|
38
|
+
]);
|
|
31
39
|
const store = mergeStore(
|
|
32
40
|
props.store,
|
|
33
|
-
menu
|
|
41
|
+
menu == null ? void 0 : menu.omit(
|
|
34
42
|
"baseElement",
|
|
35
43
|
"arrowElement",
|
|
36
44
|
"anchorElement",
|
|
@@ -38,7 +46,7 @@ function createComboboxStore({
|
|
|
38
46
|
"popoverElement",
|
|
39
47
|
"disclosureElement"
|
|
40
48
|
),
|
|
41
|
-
select
|
|
49
|
+
select == null ? void 0 : select.omit(
|
|
42
50
|
"value",
|
|
43
51
|
"items",
|
|
44
52
|
"renderedItems",
|
|
@@ -57,8 +65,7 @@ function createComboboxStore({
|
|
|
57
65
|
props.defaultActiveId,
|
|
58
66
|
null
|
|
59
67
|
);
|
|
60
|
-
const composite = createCompositeStore({
|
|
61
|
-
...props,
|
|
68
|
+
const composite = createCompositeStore(__spreadProps(__spreadValues({}, props), {
|
|
62
69
|
store,
|
|
63
70
|
activeId,
|
|
64
71
|
includesBaseElement: defaultValue(
|
|
@@ -75,28 +82,25 @@ function createComboboxStore({
|
|
|
75
82
|
focusWrap: defaultValue(props.focusWrap, syncState.focusWrap, true),
|
|
76
83
|
virtualFocus: defaultValue(
|
|
77
84
|
props.virtualFocus,
|
|
78
|
-
syncState
|
|
85
|
+
syncState == null ? void 0 : syncState.virtualFocus,
|
|
79
86
|
!isSafariOnMobile
|
|
80
87
|
)
|
|
81
|
-
});
|
|
82
|
-
const popover = createPopoverStore({
|
|
83
|
-
...props,
|
|
88
|
+
}));
|
|
89
|
+
const popover = createPopoverStore(__spreadProps(__spreadValues({}, props), {
|
|
84
90
|
store,
|
|
85
91
|
placement: defaultValue(
|
|
86
92
|
props.placement,
|
|
87
93
|
syncState.placement,
|
|
88
94
|
"bottom-start"
|
|
89
95
|
)
|
|
90
|
-
});
|
|
96
|
+
}));
|
|
91
97
|
const initialValue = defaultValue(
|
|
92
98
|
props.value,
|
|
93
99
|
syncState.value,
|
|
94
100
|
props.defaultValue,
|
|
95
101
|
""
|
|
96
102
|
);
|
|
97
|
-
const initialState = {
|
|
98
|
-
...composite.getState(),
|
|
99
|
-
...popover.getState(),
|
|
103
|
+
const initialState = __spreadProps(__spreadValues(__spreadValues({}, composite.getState()), popover.getState()), {
|
|
100
104
|
value: initialValue,
|
|
101
105
|
resetValueOnHide: defaultValue(
|
|
102
106
|
props.resetValueOnHide,
|
|
@@ -104,7 +108,7 @@ function createComboboxStore({
|
|
|
104
108
|
false
|
|
105
109
|
),
|
|
106
110
|
activeValue: syncState.activeValue
|
|
107
|
-
};
|
|
111
|
+
});
|
|
108
112
|
const combobox = createStore(initialState, composite, popover, store);
|
|
109
113
|
combobox.setup(
|
|
110
114
|
() => combobox.sync(
|
|
@@ -146,17 +150,14 @@ function createComboboxStore({
|
|
|
146
150
|
return;
|
|
147
151
|
const { activeId: activeId2 } = combobox.getState();
|
|
148
152
|
const activeItem = composite.item(activeId2);
|
|
149
|
-
combobox.setState("activeValue", activeItem
|
|
153
|
+
combobox.setState("activeValue", activeItem == null ? void 0 : activeItem.value);
|
|
150
154
|
},
|
|
151
155
|
["moves", "renderedItems"]
|
|
152
156
|
)
|
|
153
157
|
);
|
|
154
|
-
return {
|
|
155
|
-
...popover,
|
|
156
|
-
...composite,
|
|
157
|
-
...combobox,
|
|
158
|
+
return __spreadProps(__spreadValues(__spreadValues(__spreadValues({}, popover), composite), combobox), {
|
|
158
159
|
setValue: (value) => combobox.setState("value", value)
|
|
159
|
-
};
|
|
160
|
+
});
|
|
160
161
|
}
|
|
161
162
|
export {
|
|
162
163
|
createComboboxStore
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createPopoverStore
|
|
3
|
-
} from "../__chunks/
|
|
4
|
-
import "../__chunks/
|
|
5
|
-
import "../__chunks/
|
|
6
|
-
import "../__chunks/
|
|
7
|
-
import "../__chunks/
|
|
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
|
|
|
9
10
|
// src/composite/composite-overflow-store.ts
|
|
10
11
|
function createCompositeOverflowStore(props = {}) {
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createCompositeStore
|
|
3
|
-
} from "../__chunks/
|
|
4
|
-
import "../__chunks/
|
|
5
|
-
import "../__chunks/
|
|
6
|
-
import "../__chunks/
|
|
7
|
-
import "../__chunks/
|
|
3
|
+
} from "../__chunks/R6VHFWTV.js";
|
|
4
|
+
import "../__chunks/EWHSN7GO.js";
|
|
5
|
+
import "../__chunks/BOKMNDR7.js";
|
|
6
|
+
import "../__chunks/NWU4GBZ6.js";
|
|
7
|
+
import "../__chunks/N6JW4ITM.js";
|
|
8
8
|
import "../__chunks/5XEKIOCW.js";
|
|
9
|
+
import "../__chunks/4BKCJXBM.js";
|
|
9
10
|
export {
|
|
10
11
|
createCompositeStore
|
|
11
12
|
};
|