@ariakit/core 0.4.5 → 0.4.7
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 +12 -0
- package/cjs/__chunks/{QD2A4YF6.cjs → 3COGJMN3.cjs} +11 -11
- package/cjs/__chunks/{MHZQJPY3.cjs → 5BQ2XS3R.cjs} +4 -4
- package/cjs/__chunks/{2D5LEVE7.cjs → D7M2PCAQ.cjs} +6 -6
- package/cjs/__chunks/{LTLFSC4X.cjs → DIYYVJDK.cjs} +2 -2
- package/cjs/__chunks/{AETQC2AR.cjs → LAYUSNGM.cjs} +11 -11
- package/cjs/__chunks/{KL74MAHB.cjs → LBFF2BBK.cjs} +6 -6
- package/cjs/__chunks/{B4LYZ4EM.cjs → M2NNCFIJ.cjs} +13 -11
- package/cjs/__chunks/{5JEQEZFR.cjs → MB5TLEVH.cjs} +7 -7
- package/cjs/__chunks/{IMYW2UAC.cjs → Q2WCPTYS.cjs} +4 -22
- package/cjs/__chunks/{UEZLSKZ4.cjs → XVL5HZ27.cjs} +4 -4
- package/cjs/checkbox/checkbox-store.cjs +3 -3
- package/cjs/checkbox/checkbox-store.d.cts +2 -2
- package/cjs/checkbox/checkbox-store.d.ts +2 -2
- package/cjs/collection/collection-store.cjs +4 -4
- package/cjs/collection/collection-store.d.cts +2 -2
- package/cjs/collection/collection-store.d.ts +2 -2
- package/cjs/combobox/combobox-store.cjs +35 -26
- package/cjs/combobox/combobox-store.d.cts +7 -5
- package/cjs/combobox/combobox-store.d.ts +7 -5
- package/cjs/composite/composite-overflow-store.cjs +5 -5
- package/cjs/composite/composite-overflow-store.d.cts +2 -2
- package/cjs/composite/composite-overflow-store.d.ts +2 -2
- package/cjs/composite/composite-store.cjs +5 -5
- package/cjs/composite/composite-store.d.cts +8 -4
- package/cjs/composite/composite-store.d.ts +8 -4
- package/cjs/dialog/dialog-store.cjs +4 -4
- package/cjs/dialog/dialog-store.d.cts +2 -2
- package/cjs/dialog/dialog-store.d.ts +2 -2
- package/cjs/disclosure/disclosure-store.cjs +3 -3
- package/cjs/disclosure/disclosure-store.d.cts +2 -2
- package/cjs/disclosure/disclosure-store.d.ts +2 -2
- package/cjs/form/form-store.cjs +8 -8
- package/cjs/form/form-store.d.cts +4 -4
- package/cjs/form/form-store.d.ts +4 -4
- package/cjs/form/types.d.cts +3 -3
- package/cjs/form/types.d.ts +3 -3
- package/cjs/hovercard/hovercard-store.cjs +6 -6
- package/cjs/hovercard/hovercard-store.d.cts +3 -3
- package/cjs/hovercard/hovercard-store.d.ts +3 -3
- package/cjs/menu/menu-bar-store.cjs +6 -6
- package/cjs/menu/menu-bar-store.d.cts +2 -2
- package/cjs/menu/menu-bar-store.d.ts +2 -2
- package/cjs/menu/menu-store.cjs +19 -19
- package/cjs/menu/menu-store.d.cts +6 -6
- package/cjs/menu/menu-store.d.ts +6 -6
- package/cjs/menubar/menubar-store.cjs +6 -6
- package/cjs/menubar/menubar-store.d.cts +2 -2
- package/cjs/menubar/menubar-store.d.ts +2 -2
- package/cjs/popover/popover-store.cjs +5 -5
- package/cjs/popover/popover-store.d.cts +3 -3
- package/cjs/popover/popover-store.d.ts +3 -3
- package/cjs/radio/radio-store.cjs +6 -6
- package/cjs/radio/radio-store.d.cts +3 -3
- package/cjs/radio/radio-store.d.ts +3 -3
- package/cjs/select/select-store.cjs +31 -21
- package/cjs/select/select-store.d.cts +19 -9
- package/cjs/select/select-store.d.ts +19 -9
- package/cjs/tab/tab-store.cjs +58 -25
- package/cjs/tab/tab-store.d.cts +17 -10
- package/cjs/tab/tab-store.d.ts +17 -10
- package/cjs/tag/tag-store.cjs +8 -8
- package/cjs/tag/tag-store.d.cts +3 -3
- package/cjs/tag/tag-store.d.ts +3 -3
- package/cjs/toolbar/toolbar-store.cjs +5 -5
- package/cjs/toolbar/toolbar-store.d.cts +2 -2
- package/cjs/toolbar/toolbar-store.d.ts +2 -2
- package/cjs/tooltip/tooltip-store.cjs +7 -7
- package/cjs/tooltip/tooltip-store.d.cts +2 -2
- package/cjs/tooltip/tooltip-store.d.ts +2 -2
- package/cjs/utils/dom.cjs +2 -6
- package/cjs/utils/dom.d.cts +1 -17
- package/cjs/utils/dom.d.ts +1 -17
- package/cjs/utils/events.cjs +23 -16
- package/cjs/utils/events.d.cts +1 -1
- package/cjs/utils/events.d.ts +1 -1
- package/cjs/utils/focus.cjs +20 -18
- package/cjs/utils/focus.d.cts +1 -1
- package/cjs/utils/focus.d.ts +1 -1
- package/cjs/utils/misc.d.cts +1 -1
- package/cjs/utils/misc.d.ts +1 -1
- package/cjs/utils/platform.cjs +3 -3
- package/cjs/utils/store.cjs +2 -2
- package/cjs/utils/store.d.cts +3 -3
- package/cjs/utils/store.d.ts +3 -3
- package/esm/__chunks/{QAI5BPCY.js → CLSHHUGK.js} +1 -1
- package/esm/__chunks/{BRS7GKWU.js → E4HA32QI.js} +2 -2
- package/esm/__chunks/{IUORCTET.js → I2NJJ3XW.js} +3 -21
- package/esm/__chunks/{ABMC67JW.js → I2WJ7JBQ.js} +2 -2
- package/esm/__chunks/{WCKXDMU7.js → KDSZSVV5.js} +1 -1
- package/esm/__chunks/{R676XYVY.js → KLPDXTDE.js} +13 -11
- package/esm/__chunks/{5RJNXXU2.js → NWACXGIN.js} +1 -1
- package/esm/__chunks/{K7A7LTR3.js → RCLYDUHE.js} +2 -2
- package/esm/__chunks/{MFZZDIHG.js → SAZZJI72.js} +2 -2
- package/esm/__chunks/{YVUNPQHS.js → VH2P7HEP.js} +2 -2
- package/esm/checkbox/checkbox-store.d.ts +2 -2
- package/esm/checkbox/checkbox-store.js +1 -1
- package/esm/collection/collection-store.d.ts +2 -2
- package/esm/collection/collection-store.js +3 -3
- package/esm/combobox/combobox-store.d.ts +7 -5
- package/esm/combobox/combobox-store.js +20 -11
- package/esm/composite/composite-overflow-store.d.ts +2 -2
- package/esm/composite/composite-overflow-store.js +4 -4
- package/esm/composite/composite-store.d.ts +8 -4
- package/esm/composite/composite-store.js +4 -4
- package/esm/dialog/dialog-store.d.ts +2 -2
- package/esm/dialog/dialog-store.js +3 -3
- package/esm/disclosure/disclosure-store.d.ts +2 -2
- package/esm/disclosure/disclosure-store.js +2 -2
- package/esm/form/form-store.d.ts +4 -4
- package/esm/form/form-store.js +3 -3
- package/esm/form/types.d.ts +3 -3
- package/esm/hovercard/hovercard-store.d.ts +3 -3
- package/esm/hovercard/hovercard-store.js +5 -5
- package/esm/menu/menu-bar-store.d.ts +2 -2
- package/esm/menu/menu-bar-store.js +5 -5
- package/esm/menu/menu-store.d.ts +6 -6
- package/esm/menu/menu-store.js +8 -8
- package/esm/menubar/menubar-store.d.ts +2 -2
- package/esm/menubar/menubar-store.js +5 -5
- package/esm/popover/popover-store.d.ts +3 -3
- package/esm/popover/popover-store.js +4 -4
- package/esm/radio/radio-store.d.ts +3 -3
- package/esm/radio/radio-store.js +4 -4
- package/esm/select/select-store.d.ts +19 -9
- package/esm/select/select-store.js +19 -9
- package/esm/tab/tab-store.d.ts +17 -10
- package/esm/tab/tab-store.js +44 -11
- package/esm/tag/tag-store.d.ts +3 -3
- package/esm/tag/tag-store.js +4 -4
- package/esm/toolbar/toolbar-store.d.ts +2 -2
- package/esm/toolbar/toolbar-store.js +4 -4
- package/esm/tooltip/tooltip-store.d.ts +2 -2
- package/esm/tooltip/tooltip-store.js +5 -5
- package/esm/utils/dom.d.ts +1 -17
- package/esm/utils/dom.js +1 -5
- package/esm/utils/events.d.ts +1 -1
- package/esm/utils/events.js +20 -13
- package/esm/utils/focus.d.ts +1 -1
- package/esm/utils/focus.js +12 -10
- package/esm/utils/misc.d.ts +1 -1
- package/esm/utils/platform.js +2 -2
- package/esm/utils/store.d.ts +3 -3
- package/esm/utils/store.js +1 -1
- package/package.json +2 -2
- package/.eslintignore +0 -6
package/cjs/utils/focus.cjs
CHANGED
|
@@ -4,9 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
var _IMYW2UACcjs = require('../__chunks/IMYW2UAC.cjs');
|
|
7
|
+
var _Q2WCPTYScjs = require('../__chunks/Q2WCPTYS.cjs');
|
|
10
8
|
|
|
11
9
|
|
|
12
10
|
var _AV6KTKLEcjs = require('../__chunks/AV6KTKLE.cjs');
|
|
@@ -14,15 +12,15 @@ var _AV6KTKLEcjs = require('../__chunks/AV6KTKLE.cjs');
|
|
|
14
12
|
// src/utils/focus.ts
|
|
15
13
|
var selector = "input:not([type='hidden']):not([disabled]), select:not([disabled]), textarea:not([disabled]), a[href], button:not([disabled]), [tabindex], summary, iframe, object, embed, area[href], audio[controls], video[controls], [contenteditable]:not([contenteditable='false'])";
|
|
16
14
|
function hasNegativeTabIndex(element) {
|
|
17
|
-
const tabIndex = parseInt(element.getAttribute("tabindex") || "0", 10);
|
|
15
|
+
const tabIndex = Number.parseInt(element.getAttribute("tabindex") || "0", 10);
|
|
18
16
|
return tabIndex < 0;
|
|
19
17
|
}
|
|
20
18
|
function isFocusable(element) {
|
|
21
|
-
if (!
|
|
19
|
+
if (!element.matches(selector))
|
|
22
20
|
return false;
|
|
23
|
-
if (!
|
|
21
|
+
if (!_Q2WCPTYScjs.isVisible.call(void 0, element))
|
|
24
22
|
return false;
|
|
25
|
-
if (
|
|
23
|
+
if (element.closest("[inert]"))
|
|
26
24
|
return false;
|
|
27
25
|
return true;
|
|
28
26
|
}
|
|
@@ -44,7 +42,7 @@ function isTabbable(element) {
|
|
|
44
42
|
return true;
|
|
45
43
|
if (!("length" in radioGroup))
|
|
46
44
|
return true;
|
|
47
|
-
const activeElement =
|
|
45
|
+
const activeElement = _Q2WCPTYScjs.getActiveElement.call(void 0, element);
|
|
48
46
|
if (!activeElement)
|
|
49
47
|
return true;
|
|
50
48
|
if (activeElement === element)
|
|
@@ -66,7 +64,7 @@ function getAllFocusableIn(container, includeContainer) {
|
|
|
66
64
|
}
|
|
67
65
|
const focusableElements = elements.filter(isFocusable);
|
|
68
66
|
focusableElements.forEach((element, i) => {
|
|
69
|
-
if (
|
|
67
|
+
if (_Q2WCPTYScjs.isFrame.call(void 0, element) && element.contentDocument) {
|
|
70
68
|
const frameBody = element.contentDocument.body;
|
|
71
69
|
focusableElements.splice(i, 1, ...getAllFocusableIn(frameBody));
|
|
72
70
|
}
|
|
@@ -92,7 +90,7 @@ function getAllTabbableIn(container, includeContainer, fallbackToFocusable) {
|
|
|
92
90
|
tabbableElements.unshift(container);
|
|
93
91
|
}
|
|
94
92
|
tabbableElements.forEach((element, i) => {
|
|
95
|
-
if (
|
|
93
|
+
if (_Q2WCPTYScjs.isFrame.call(void 0, element) && element.contentDocument) {
|
|
96
94
|
const frameBody = element.contentDocument.body;
|
|
97
95
|
const allFrameTabbable = getAllTabbableIn(
|
|
98
96
|
frameBody,
|
|
@@ -133,7 +131,7 @@ function getLastTabbable(fallbackToFocusable) {
|
|
|
133
131
|
return getLastTabbableIn(document.body, false, fallbackToFocusable);
|
|
134
132
|
}
|
|
135
133
|
function getNextTabbableIn(container, includeContainer, fallbackToFirst, fallbackToFocusable) {
|
|
136
|
-
const activeElement =
|
|
134
|
+
const activeElement = _Q2WCPTYScjs.getActiveElement.call(void 0, container);
|
|
137
135
|
const allFocusable = getAllFocusableIn(container, includeContainer);
|
|
138
136
|
const activeIndex = allFocusable.indexOf(activeElement);
|
|
139
137
|
const nextFocusableElements = allFocusable.slice(activeIndex + 1);
|
|
@@ -148,7 +146,7 @@ function getNextTabbable(fallbackToFirst, fallbackToFocusable) {
|
|
|
148
146
|
);
|
|
149
147
|
}
|
|
150
148
|
function getPreviousTabbableIn(container, includeContainer, fallbackToLast, fallbackToFocusable) {
|
|
151
|
-
const activeElement =
|
|
149
|
+
const activeElement = _Q2WCPTYScjs.getActiveElement.call(void 0, container);
|
|
152
150
|
const allFocusable = getAllFocusableIn(container, includeContainer).reverse();
|
|
153
151
|
const activeIndex = allFocusable.indexOf(activeElement);
|
|
154
152
|
const previousFocusableElements = allFocusable.slice(activeIndex + 1);
|
|
@@ -164,12 +162,12 @@ function getPreviousTabbable(fallbackToFirst, fallbackToFocusable) {
|
|
|
164
162
|
}
|
|
165
163
|
function getClosestFocusable(element) {
|
|
166
164
|
while (element && !isFocusable(element)) {
|
|
167
|
-
element =
|
|
165
|
+
element = element.closest(selector);
|
|
168
166
|
}
|
|
169
167
|
return element || null;
|
|
170
168
|
}
|
|
171
169
|
function hasFocus(element) {
|
|
172
|
-
const activeElement =
|
|
170
|
+
const activeElement = _Q2WCPTYScjs.getActiveElement.call(void 0, element);
|
|
173
171
|
if (!activeElement)
|
|
174
172
|
return false;
|
|
175
173
|
if (activeElement === element)
|
|
@@ -180,10 +178,10 @@ function hasFocus(element) {
|
|
|
180
178
|
return activeDescendant === element.id;
|
|
181
179
|
}
|
|
182
180
|
function hasFocusWithin(element) {
|
|
183
|
-
const activeElement =
|
|
181
|
+
const activeElement = _Q2WCPTYScjs.getActiveElement.call(void 0, element);
|
|
184
182
|
if (!activeElement)
|
|
185
183
|
return false;
|
|
186
|
-
if (
|
|
184
|
+
if (_Q2WCPTYScjs.contains.call(void 0, element, activeElement))
|
|
187
185
|
return true;
|
|
188
186
|
const activeDescendant = activeElement.getAttribute("aria-activedescendant");
|
|
189
187
|
if (!activeDescendant)
|
|
@@ -207,7 +205,9 @@ function disableFocus(element) {
|
|
|
207
205
|
}
|
|
208
206
|
function disableFocusIn(container, includeContainer) {
|
|
209
207
|
const tabbableElements = getAllTabbableIn(container, includeContainer);
|
|
210
|
-
tabbableElements
|
|
208
|
+
for (const element of tabbableElements) {
|
|
209
|
+
disableFocus(element);
|
|
210
|
+
}
|
|
211
211
|
}
|
|
212
212
|
function restoreFocusIn(container) {
|
|
213
213
|
const elements = container.querySelectorAll("[data-tabindex]");
|
|
@@ -223,7 +223,9 @@ function restoreFocusIn(container) {
|
|
|
223
223
|
if (container.hasAttribute("data-tabindex")) {
|
|
224
224
|
restoreTabIndex(container);
|
|
225
225
|
}
|
|
226
|
-
elements
|
|
226
|
+
for (const element of elements) {
|
|
227
|
+
restoreTabIndex(element);
|
|
228
|
+
}
|
|
227
229
|
}
|
|
228
230
|
function focusIntoView(element, options) {
|
|
229
231
|
if (!("scrollIntoView" in element)) {
|
package/cjs/utils/focus.d.cts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* isFocusable(document.querySelector("input[hidden]")); // false
|
|
7
7
|
* isFocusable(document.querySelector("input:disabled")); // false
|
|
8
8
|
*/
|
|
9
|
-
export declare function isFocusable(element: Element):
|
|
9
|
+
export declare function isFocusable(element: Element): boolean;
|
|
10
10
|
/**
|
|
11
11
|
* Checks whether `element` is tabbable or not.
|
|
12
12
|
* @example
|
package/cjs/utils/focus.d.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* isFocusable(document.querySelector("input[hidden]")); // false
|
|
7
7
|
* isFocusable(document.querySelector("input:disabled")); // false
|
|
8
8
|
*/
|
|
9
|
-
export declare function isFocusable(element: Element):
|
|
9
|
+
export declare function isFocusable(element: Element): boolean;
|
|
10
10
|
/**
|
|
11
11
|
* Checks whether `element` is tabbable or not.
|
|
12
12
|
* @example
|
package/cjs/utils/misc.d.cts
CHANGED
package/cjs/utils/misc.d.ts
CHANGED
package/cjs/utils/platform.cjs
CHANGED
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var
|
|
9
|
-
require('../__chunks/
|
|
8
|
+
var _D7M2PCAQcjs = require('../__chunks/D7M2PCAQ.cjs');
|
|
9
|
+
require('../__chunks/Q2WCPTYS.cjs');
|
|
10
10
|
require('../__chunks/AV6KTKLE.cjs');
|
|
11
11
|
|
|
12
12
|
|
|
@@ -14,4 +14,4 @@ require('../__chunks/AV6KTKLE.cjs');
|
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
|
|
17
|
-
exports.isApple =
|
|
17
|
+
exports.isApple = _D7M2PCAQcjs.isApple; exports.isFirefox = _D7M2PCAQcjs.isFirefox; exports.isMac = _D7M2PCAQcjs.isMac; exports.isSafari = _D7M2PCAQcjs.isSafari; exports.isTouchDevice = _D7M2PCAQcjs.isTouchDevice;
|
package/cjs/utils/store.cjs
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
var
|
|
13
|
+
var _M2NNCFIJcjs = require('../__chunks/M2NNCFIJ.cjs');
|
|
14
14
|
require('../__chunks/EEDWPDM2.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 = _M2NNCFIJcjs.batch; exports.createStore = _M2NNCFIJcjs.createStore; exports.init = _M2NNCFIJcjs.init; exports.mergeStore = _M2NNCFIJcjs.mergeStore; exports.omit = _M2NNCFIJcjs.omit; exports.pick = _M2NNCFIJcjs.pick; exports.setup = _M2NNCFIJcjs.setup; exports.subscribe = _M2NNCFIJcjs.subscribe; exports.sync = _M2NNCFIJcjs.sync; exports.throwOnConflictingProps = _M2NNCFIJcjs.throwOnConflictingProps;
|
package/cjs/utils/store.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AnyObject, SetStateAction } from "./types.
|
|
1
|
+
import type { AnyObject, SetStateAction } from "./types.ts";
|
|
2
2
|
type Listener<S> = (state: S, prevState: S) => void | (() => void);
|
|
3
3
|
type Sync<S, K extends keyof S> = (keys: K[] | null, listener: Listener<Pick<S, K>>) => () => void;
|
|
4
4
|
type StoreSetup = (callback: () => void | (() => void)) => () => void;
|
|
@@ -43,7 +43,7 @@ export type StoreOptions<S extends State, K extends keyof S> = Partial<Pick<S, K
|
|
|
43
43
|
* Props that can be passed to a store creator function.
|
|
44
44
|
* @template S State type.
|
|
45
45
|
*/
|
|
46
|
-
export
|
|
46
|
+
export interface StoreProps<S extends State = State> {
|
|
47
47
|
/**
|
|
48
48
|
* Another store object that will be kept in sync with the original store.
|
|
49
49
|
*
|
|
@@ -51,7 +51,7 @@ export type StoreProps<S extends State = State> = {
|
|
|
51
51
|
* - [Navigation Menubar](https://ariakit.org/examples/menubar-navigation)
|
|
52
52
|
*/
|
|
53
53
|
store?: Store<Partial<S>>;
|
|
54
|
-
}
|
|
54
|
+
}
|
|
55
55
|
/**
|
|
56
56
|
* Extracts the state type from a store type.
|
|
57
57
|
* @template T Store type.
|
package/cjs/utils/store.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AnyObject, SetStateAction } from "./types.
|
|
1
|
+
import type { AnyObject, SetStateAction } from "./types.ts";
|
|
2
2
|
type Listener<S> = (state: S, prevState: S) => void | (() => void);
|
|
3
3
|
type Sync<S, K extends keyof S> = (keys: K[] | null, listener: Listener<Pick<S, K>>) => () => void;
|
|
4
4
|
type StoreSetup = (callback: () => void | (() => void)) => () => void;
|
|
@@ -43,7 +43,7 @@ export type StoreOptions<S extends State, K extends keyof S> = Partial<Pick<S, K
|
|
|
43
43
|
* Props that can be passed to a store creator function.
|
|
44
44
|
* @template S State type.
|
|
45
45
|
*/
|
|
46
|
-
export
|
|
46
|
+
export interface StoreProps<S extends State = State> {
|
|
47
47
|
/**
|
|
48
48
|
* Another store object that will be kept in sync with the original store.
|
|
49
49
|
*
|
|
@@ -51,7 +51,7 @@ export type StoreProps<S extends State = State> = {
|
|
|
51
51
|
* - [Navigation Menubar](https://ariakit.org/examples/menubar-navigation)
|
|
52
52
|
*/
|
|
53
53
|
store?: Store<Partial<S>>;
|
|
54
|
-
}
|
|
54
|
+
}
|
|
55
55
|
/**
|
|
56
56
|
* Extracts the state type from a store type.
|
|
57
57
|
* @template T Store type.
|
|
@@ -57,29 +57,13 @@ var buttonInputTypes = [
|
|
|
57
57
|
"reset",
|
|
58
58
|
"submit"
|
|
59
59
|
];
|
|
60
|
-
function matches(element, selectors) {
|
|
61
|
-
if ("matches" in element) {
|
|
62
|
-
return element.matches(selectors);
|
|
63
|
-
}
|
|
64
|
-
if ("msMatchesSelector" in element) {
|
|
65
|
-
return element.msMatchesSelector(selectors);
|
|
66
|
-
}
|
|
67
|
-
return element.webkitMatchesSelector(selectors);
|
|
68
|
-
}
|
|
69
60
|
function isVisible(element) {
|
|
61
|
+
if (typeof element.checkVisibility === "function") {
|
|
62
|
+
return element.checkVisibility();
|
|
63
|
+
}
|
|
70
64
|
const htmlElement = element;
|
|
71
65
|
return htmlElement.offsetWidth > 0 || htmlElement.offsetHeight > 0 || element.getClientRects().length > 0;
|
|
72
66
|
}
|
|
73
|
-
function closest(element, selectors) {
|
|
74
|
-
if ("closest" in element)
|
|
75
|
-
return element.closest(selectors);
|
|
76
|
-
do {
|
|
77
|
-
if (matches(element, selectors))
|
|
78
|
-
return element;
|
|
79
|
-
element = element.parentElement || element.parentNode;
|
|
80
|
-
} while (element !== null && element.nodeType === 1);
|
|
81
|
-
return null;
|
|
82
|
-
}
|
|
83
67
|
function isTextField(element) {
|
|
84
68
|
try {
|
|
85
69
|
const isTextInput = element instanceof HTMLInputElement && element.selectionStart !== null;
|
|
@@ -196,9 +180,7 @@ export {
|
|
|
196
180
|
contains,
|
|
197
181
|
isFrame,
|
|
198
182
|
isButton,
|
|
199
|
-
matches,
|
|
200
183
|
isVisible,
|
|
201
|
-
closest,
|
|
202
184
|
isTextField,
|
|
203
185
|
isTextbox,
|
|
204
186
|
getTextboxValue,
|
|
@@ -5,14 +5,14 @@ import {
|
|
|
5
5
|
init,
|
|
6
6
|
setup,
|
|
7
7
|
throwOnConflictingProps
|
|
8
|
-
} from "./
|
|
8
|
+
} from "./KLPDXTDE.js";
|
|
9
9
|
import {
|
|
10
10
|
chain,
|
|
11
11
|
defaultValue
|
|
12
12
|
} from "./22HHDS5F.js";
|
|
13
13
|
import {
|
|
14
14
|
getDocument
|
|
15
|
-
} from "./
|
|
15
|
+
} from "./I2NJJ3XW.js";
|
|
16
16
|
import {
|
|
17
17
|
__spreadProps,
|
|
18
18
|
__spreadValues
|
|
@@ -70,7 +70,9 @@ function createStore(initialState, ...stores) {
|
|
|
70
70
|
)
|
|
71
71
|
);
|
|
72
72
|
const teardowns = [];
|
|
73
|
-
|
|
73
|
+
for (const setup2 of setups) {
|
|
74
|
+
teardowns.push(setup2());
|
|
75
|
+
}
|
|
74
76
|
const cleanups = stores.map(init);
|
|
75
77
|
destroy = chain(...desyncs, ...teardowns, ...cleanups);
|
|
76
78
|
return maybeDestroy;
|
|
@@ -99,16 +101,16 @@ function createStore(initialState, ...stores) {
|
|
|
99
101
|
const storeOmit = (keys) => createStore(omit(state, keys), finalStore);
|
|
100
102
|
const getState = () => state;
|
|
101
103
|
const setState = (key, value, fromStores = false) => {
|
|
104
|
+
var _a;
|
|
102
105
|
if (!hasOwnProperty(state, key))
|
|
103
106
|
return;
|
|
104
107
|
const nextValue = applyState(value, state[key]);
|
|
105
108
|
if (nextValue === state[key])
|
|
106
109
|
return;
|
|
107
110
|
if (!fromStores) {
|
|
108
|
-
|
|
109
|
-
var _a;
|
|
111
|
+
for (const store of stores) {
|
|
110
112
|
(_a = store == null ? void 0 : store.setState) == null ? void 0 : _a.call(store, key, nextValue);
|
|
111
|
-
}
|
|
113
|
+
}
|
|
112
114
|
}
|
|
113
115
|
const prevState = state;
|
|
114
116
|
state = __spreadProps(__spreadValues({}, state), { [key]: nextValue });
|
|
@@ -116,24 +118,24 @@ function createStore(initialState, ...stores) {
|
|
|
116
118
|
lastUpdate = thisUpdate;
|
|
117
119
|
updatedKeys.add(key);
|
|
118
120
|
const run = (listener, prev, uKeys) => {
|
|
119
|
-
var
|
|
121
|
+
var _a2;
|
|
120
122
|
const keys = listenerKeys.get(listener);
|
|
121
123
|
const updated = (k) => uKeys ? uKeys.has(k) : k === key;
|
|
122
124
|
if (!keys || keys.some(updated)) {
|
|
123
|
-
(
|
|
125
|
+
(_a2 = disposables.get(listener)) == null ? void 0 : _a2();
|
|
124
126
|
disposables.set(listener, listener(state, prev));
|
|
125
127
|
}
|
|
126
128
|
};
|
|
127
|
-
|
|
129
|
+
for (const listener of listeners) {
|
|
128
130
|
run(listener, prevState);
|
|
129
|
-
}
|
|
131
|
+
}
|
|
130
132
|
queueMicrotask(() => {
|
|
131
133
|
if (lastUpdate !== thisUpdate)
|
|
132
134
|
return;
|
|
133
135
|
const snapshot = state;
|
|
134
|
-
|
|
136
|
+
for (const listener of batchListeners) {
|
|
135
137
|
run(listener, prevStateBatch, updatedKeys);
|
|
136
|
-
}
|
|
138
|
+
}
|
|
137
139
|
prevStateBatch = snapshot;
|
|
138
140
|
updatedKeys.clear();
|
|
139
141
|
});
|
|
@@ -194,7 +196,7 @@ function mergeStore(...stores) {
|
|
|
194
196
|
const nextState = (_a = store2 == null ? void 0 : store2.getState) == null ? void 0 : _a.call(store2);
|
|
195
197
|
if (!nextState)
|
|
196
198
|
return state;
|
|
197
|
-
return
|
|
199
|
+
return Object.assign(state, nextState);
|
|
198
200
|
}, {});
|
|
199
201
|
const store = createStore(initialState, ...stores);
|
|
200
202
|
return store;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
createDialogStore
|
|
4
|
-
} from "./
|
|
4
|
+
} from "./NWACXGIN.js";
|
|
5
5
|
import {
|
|
6
6
|
createStore,
|
|
7
7
|
mergeStore,
|
|
8
8
|
omit,
|
|
9
9
|
throwOnConflictingProps
|
|
10
|
-
} from "./
|
|
10
|
+
} from "./KLPDXTDE.js";
|
|
11
11
|
import {
|
|
12
12
|
defaultValue
|
|
13
13
|
} from "./22HHDS5F.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
createCollectionStore
|
|
4
|
-
} from "./
|
|
4
|
+
} from "./I2WJ7JBQ.js";
|
|
5
5
|
import {
|
|
6
6
|
flatten2DArray,
|
|
7
7
|
reverseArray
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
createStore,
|
|
11
11
|
setup,
|
|
12
12
|
sync
|
|
13
|
-
} from "./
|
|
13
|
+
} from "./KLPDXTDE.js";
|
|
14
14
|
import {
|
|
15
15
|
defaultValue
|
|
16
16
|
} from "./22HHDS5F.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Store, StoreOptions, StoreProps } from "../utils/store.
|
|
2
|
-
import type { PickRequired, SetState, ToPrimitive } from "../utils/types.
|
|
1
|
+
import type { Store, StoreOptions, StoreProps } from "../utils/store.ts";
|
|
2
|
+
import type { PickRequired, SetState, ToPrimitive } from "../utils/types.ts";
|
|
3
3
|
/**
|
|
4
4
|
* Creates a checkbox store.
|
|
5
5
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Store, StoreOptions, StoreProps } from "../utils/store.
|
|
2
|
-
import type { BivariantCallback } from "../utils/types.
|
|
1
|
+
import type { Store, StoreOptions, StoreProps } from "../utils/store.ts";
|
|
2
|
+
import type { BivariantCallback } from "../utils/types.ts";
|
|
3
3
|
/**
|
|
4
4
|
* Creates a collection store.
|
|
5
5
|
*/
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
createCollectionStore
|
|
4
|
-
} from "../__chunks/
|
|
5
|
-
import "../__chunks/
|
|
4
|
+
} from "../__chunks/I2WJ7JBQ.js";
|
|
5
|
+
import "../__chunks/KLPDXTDE.js";
|
|
6
6
|
import "../__chunks/22HHDS5F.js";
|
|
7
|
-
import "../__chunks/
|
|
7
|
+
import "../__chunks/I2NJJ3XW.js";
|
|
8
8
|
import "../__chunks/4R3V3JGP.js";
|
|
9
9
|
export {
|
|
10
10
|
createCollectionStore
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { CompositeStoreFunctions, CompositeStoreItem, CompositeStoreOptions, CompositeStoreState } from "../composite/composite-store.
|
|
2
|
-
import type { PopoverStoreFunctions, PopoverStoreOptions, PopoverStoreState } from "../popover/popover-store.
|
|
3
|
-
import type { TagStore } from "../tag/tag-store.
|
|
4
|
-
import type { Store, StoreOptions, StoreProps } from "../utils/store.
|
|
5
|
-
import type { PickRequired, SetState } from "../utils/types.
|
|
1
|
+
import type { CompositeStoreFunctions, CompositeStoreItem, CompositeStoreOptions, CompositeStoreState } from "../composite/composite-store.ts";
|
|
2
|
+
import type { PopoverStoreFunctions, PopoverStoreOptions, PopoverStoreState } from "../popover/popover-store.ts";
|
|
3
|
+
import type { TagStore } from "../tag/tag-store.ts";
|
|
4
|
+
import type { Store, StoreOptions, StoreProps } from "../utils/store.ts";
|
|
5
|
+
import type { PickRequired, SetState } from "../utils/types.ts";
|
|
6
6
|
type MutableValue<T extends ComboboxStoreSelectedValue = ComboboxStoreSelectedValue> = T extends string ? string : T;
|
|
7
7
|
/**
|
|
8
8
|
* Creates a combobox store.
|
|
@@ -71,6 +71,8 @@ export interface ComboboxStoreState<T extends ComboboxStoreSelectedValue = Combo
|
|
|
71
71
|
* - [Submenu with
|
|
72
72
|
* Combobox](https://ariakit.org/examples/menu-nested-combobox)
|
|
73
73
|
* - [Command Menu](https://ariakit.org/examples/dialog-combobox-command-menu)
|
|
74
|
+
* - [Select with Combobox and
|
|
75
|
+
* Tabs](https://ariakit.org/examples/select-combobox-tab)
|
|
74
76
|
*/
|
|
75
77
|
resetValueOnHide: boolean;
|
|
76
78
|
/**
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
createCompositeStore
|
|
4
|
-
} from "../__chunks/
|
|
5
|
-
import "../__chunks/
|
|
4
|
+
} from "../__chunks/VH2P7HEP.js";
|
|
5
|
+
import "../__chunks/I2WJ7JBQ.js";
|
|
6
6
|
import "../__chunks/7PRQYBBV.js";
|
|
7
7
|
import {
|
|
8
8
|
createPopoverStore
|
|
9
|
-
} from "../__chunks/
|
|
10
|
-
import "../__chunks/
|
|
11
|
-
import "../__chunks/
|
|
9
|
+
} from "../__chunks/SAZZJI72.js";
|
|
10
|
+
import "../__chunks/NWACXGIN.js";
|
|
11
|
+
import "../__chunks/KDSZSVV5.js";
|
|
12
12
|
import {
|
|
13
13
|
batch,
|
|
14
14
|
createStore,
|
|
@@ -17,15 +17,16 @@ import {
|
|
|
17
17
|
setup,
|
|
18
18
|
sync,
|
|
19
19
|
throwOnConflictingProps
|
|
20
|
-
} from "../__chunks/
|
|
20
|
+
} from "../__chunks/KLPDXTDE.js";
|
|
21
21
|
import {
|
|
22
22
|
chain,
|
|
23
23
|
defaultValue
|
|
24
24
|
} from "../__chunks/22HHDS5F.js";
|
|
25
25
|
import {
|
|
26
|
-
isSafari
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
isSafari,
|
|
27
|
+
isTouchDevice
|
|
28
|
+
} from "../__chunks/CLSHHUGK.js";
|
|
29
|
+
import "../__chunks/I2NJJ3XW.js";
|
|
29
30
|
import {
|
|
30
31
|
__objRest,
|
|
31
32
|
__spreadProps,
|
|
@@ -33,7 +34,7 @@ import {
|
|
|
33
34
|
} from "../__chunks/4R3V3JGP.js";
|
|
34
35
|
|
|
35
36
|
// src/combobox/combobox-store.ts
|
|
36
|
-
var
|
|
37
|
+
var isTouchSafari = isSafari() && isTouchDevice();
|
|
37
38
|
function createComboboxStore(_a = {}) {
|
|
38
39
|
var _b = _a, {
|
|
39
40
|
tag
|
|
@@ -67,7 +68,7 @@ function createComboboxStore(_a = {}) {
|
|
|
67
68
|
virtualFocus: defaultValue(
|
|
68
69
|
props.virtualFocus,
|
|
69
70
|
syncState == null ? void 0 : syncState.virtualFocus,
|
|
70
|
-
|
|
71
|
+
true
|
|
71
72
|
)
|
|
72
73
|
}));
|
|
73
74
|
const popover = createPopoverStore(__spreadProps(__spreadValues({}, props), {
|
|
@@ -107,6 +108,14 @@ function createComboboxStore(_a = {}) {
|
|
|
107
108
|
activeValue: syncState == null ? void 0 : syncState.activeValue
|
|
108
109
|
});
|
|
109
110
|
const combobox = createStore(initialState, composite, popover, store);
|
|
111
|
+
if (isTouchSafari) {
|
|
112
|
+
setup(
|
|
113
|
+
combobox,
|
|
114
|
+
() => sync(combobox, ["virtualFocus"], () => {
|
|
115
|
+
combobox.setState("virtualFocus", false);
|
|
116
|
+
})
|
|
117
|
+
);
|
|
118
|
+
}
|
|
110
119
|
setup(combobox, () => {
|
|
111
120
|
if (!tag)
|
|
112
121
|
return;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { PopoverStoreFunctions, PopoverStoreOptions, PopoverStoreState } from "../popover/popover-store.
|
|
2
|
-
import type { Store, StoreProps } from "../utils/store.
|
|
1
|
+
import type { PopoverStoreFunctions, PopoverStoreOptions, PopoverStoreState } from "../popover/popover-store.ts";
|
|
2
|
+
import type { Store, StoreProps } from "../utils/store.ts";
|
|
3
3
|
/**
|
|
4
4
|
* Creates a compositeOverflow store.
|
|
5
5
|
*/
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
createPopoverStore
|
|
4
|
-
} from "../__chunks/
|
|
5
|
-
import "../__chunks/
|
|
6
|
-
import "../__chunks/
|
|
7
|
-
import "../__chunks/
|
|
4
|
+
} from "../__chunks/SAZZJI72.js";
|
|
5
|
+
import "../__chunks/NWACXGIN.js";
|
|
6
|
+
import "../__chunks/KDSZSVV5.js";
|
|
7
|
+
import "../__chunks/KLPDXTDE.js";
|
|
8
8
|
import "../__chunks/22HHDS5F.js";
|
|
9
9
|
import "../__chunks/4R3V3JGP.js";
|
|
10
10
|
|