@ariakit/react-core 0.2.3 → 0.2.4
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 +24 -0
- package/cjs/__chunks/{QXQ5XPUN.cjs → 3JRXLDD2.cjs} +3 -4
- package/cjs/__chunks/{TKAXHO22.cjs → 3ZQN2EZT.cjs} +2 -2
- package/cjs/__chunks/{RH6W76ZY.cjs → 6BXEA5EF.cjs} +2 -2
- package/cjs/__chunks/{DCKBTO5Y.cjs → 6EZOH2LA.cjs} +7 -6
- package/cjs/__chunks/{NWDBHXX3.cjs → 7BYVU5SZ.cjs} +7 -1
- package/cjs/__chunks/{J6GEGD5K.cjs → 7N3VSG4A.cjs} +3 -3
- package/cjs/__chunks/{YM35TRAD.cjs → COSA3K2S.cjs} +2 -2
- package/cjs/__chunks/{X6IBALQU.cjs → D3NRDEHG.cjs} +2 -2
- package/cjs/__chunks/{4BX4RTYL.cjs → EB6EBH7V.cjs} +2 -2
- package/cjs/__chunks/{CARNFZQT.cjs → GAXSMBTE.cjs} +2 -2
- package/cjs/__chunks/{XUVHJWFO.cjs → GBEGIHKI.cjs} +2 -2
- package/cjs/__chunks/{FINPO4DA.cjs → HMH6HLVB.cjs} +2 -2
- package/cjs/__chunks/{TVZPJJTX.cjs → HNCLPSSV.cjs} +2 -2
- package/cjs/__chunks/{S3IANNS4.cjs → IT5GLJ4X.cjs} +2 -2
- package/cjs/__chunks/{HLRHZHR2.cjs → NEHIVLGL.cjs} +2 -2
- package/cjs/__chunks/{J4OJ7GJT.cjs → PYMKALFY.cjs} +2 -2
- package/cjs/__chunks/{YY2AVCHR.cjs → QMOLTZZO.cjs} +18 -9
- package/cjs/__chunks/{ERWCTPBK.cjs → RD7ZO2HE.cjs} +4 -2
- package/cjs/__chunks/{A65PNFQY.cjs → T26XOJJH.cjs} +4 -4
- package/cjs/__chunks/{EE6OIU6X.cjs → TFOIZV2V.cjs} +5 -5
- package/cjs/__chunks/{RQPNMOWL.cjs → URXOWQSR.cjs} +1 -1
- package/cjs/__chunks/{L6EQRNH2.cjs → W2HT5JVG.cjs} +9 -22
- package/cjs/__chunks/{O45IXGJW.cjs → YEIYG56F.cjs} +4 -4
- package/cjs/__chunks/{TP4H5PWH.cjs → YQ76PEZV.cjs} +2 -2
- package/cjs/__chunks/{KJGDYG6M.cjs → ZCXLELXW.cjs} +2 -2
- package/cjs/__chunks/{72QRTHBX.cjs → ZHJT7NZK.cjs} +23 -20
- package/cjs/button/button.cjs +3 -3
- package/cjs/checkbox/checkbox.cjs +3 -3
- package/cjs/checkbox/checkbox.d.ts +2 -2
- package/cjs/combobox/combobox-cancel.cjs +3 -3
- package/cjs/combobox/combobox-disclosure.cjs +5 -5
- package/cjs/combobox/combobox-item.cjs +5 -5
- package/cjs/combobox/combobox-popover.cjs +9 -9
- package/cjs/command/command.cjs +2 -2
- package/cjs/composite/composite-hover.cjs +2 -2
- package/cjs/composite/composite-item.cjs +3 -3
- package/cjs/composite/composite-overflow-disclosure.cjs +8 -8
- package/cjs/composite/composite-overflow.cjs +9 -9
- package/cjs/composite/composite-typeahead.cjs +2 -2
- package/cjs/dialog/dialog-backdrop.cjs +4 -4
- package/cjs/dialog/dialog-disclosure.cjs +5 -5
- package/cjs/dialog/dialog-dismiss.cjs +4 -4
- package/cjs/dialog/dialog.cjs +8 -8
- package/cjs/dialog/utils/disable-accessibility-tree-outside.cjs +3 -3
- package/cjs/dialog/utils/disable-tree-outside.cjs +4 -4
- package/cjs/dialog/utils/mark-tree-outside.cjs +3 -3
- package/cjs/dialog/utils/use-hide-on-interact-outside.cjs +4 -4
- package/cjs/dialog/utils/walk-tree-outside.cjs +2 -2
- package/cjs/disclosure/disclosure.cjs +4 -4
- package/cjs/form/form-checkbox.cjs +3 -3
- package/cjs/form/form-push.cjs +3 -3
- package/cjs/form/form-radio.cjs +4 -4
- package/cjs/form/form-remove.cjs +3 -3
- package/cjs/form/form-reset.cjs +3 -3
- package/cjs/form/form-submit.cjs +3 -3
- package/cjs/hovercard/hovercard-disclosure.cjs +5 -5
- package/cjs/hovercard/hovercard-dismiss.cjs +6 -6
- package/cjs/hovercard/hovercard.cjs +10 -10
- package/cjs/hovercard/hovercard.d.ts +0 -9
- package/cjs/menu/menu-button.cjs +8 -8
- package/cjs/menu/menu-dismiss.cjs +6 -6
- package/cjs/menu/menu-item-checkbox.cjs +7 -7
- package/cjs/menu/menu-item-radio.cjs +7 -7
- package/cjs/menu/menu-item.cjs +5 -5
- package/cjs/menu/menu-list.cjs +3 -3
- package/cjs/menu/menu.cjs +13 -13
- package/cjs/popover/popover-disclosure.cjs +6 -6
- package/cjs/popover/popover-dismiss.cjs +5 -5
- package/cjs/popover/popover.cjs +9 -9
- package/cjs/popover/popover.d.ts +1 -1
- package/cjs/radio/radio.cjs +4 -4
- package/cjs/select/select-item.cjs +5 -5
- package/cjs/select/select-list.cjs +3 -3
- package/cjs/select/select-popover.cjs +12 -12
- package/cjs/select/select.cjs +8 -8
- package/cjs/tab/tab.cjs +3 -3
- package/cjs/toolbar/toolbar-container.cjs +4 -4
- package/cjs/toolbar/toolbar-input.cjs +4 -4
- package/cjs/toolbar/toolbar-item.cjs +4 -4
- package/cjs/tooltip/tooltip.cjs +10 -10
- package/cjs/tsconfig.build.tsbuildinfo +1 -1
- package/esm/__chunks/{SSEF6EVJ.js → 3DWMKQHI.js} +1 -1
- package/esm/__chunks/{4H6H5RRM.js → 4GMZGYHX.js} +2 -2
- package/esm/__chunks/{6NDCAXRV.js → 4OUEWDQI.js} +16 -13
- package/esm/__chunks/{7KMNPNCM.js → 5JAOITB6.js} +2 -2
- package/esm/__chunks/{B5KVTUMZ.js → 76X52BLD.js} +1 -1
- package/esm/__chunks/{BH4YAZB2.js → ACAQG6DN.js} +1 -1
- package/esm/__chunks/{U2FJPRXC.js → BBUDEDX6.js} +1 -1
- package/esm/__chunks/{DAQSLIJO.js → EEZDONXU.js} +1 -1
- package/esm/__chunks/{7A3SODQV.js → EKB2TUKR.js} +1 -1
- package/esm/__chunks/{VPMBP3SV.js → FETTDVY4.js} +1 -1
- package/esm/__chunks/{ISPCL6N4.js → FV23EKJL.js} +5 -5
- package/esm/__chunks/{UCNIXL4N.js → GGPLUQQY.js} +4 -5
- package/esm/__chunks/{RDMLE7SJ.js → GJAZZDOH.js} +1 -1
- package/esm/__chunks/{DNPURXZF.js → GKEHNDOU.js} +7 -1
- package/esm/__chunks/{GA2RA37M.js → H2CSFGIT.js} +1 -1
- package/esm/__chunks/{OVVTUDOE.js → HIZJQGB5.js} +9 -22
- package/esm/__chunks/{HYSKO35G.js → OTKCW3PM.js} +1 -1
- package/esm/__chunks/{K76RRXSE.js → QDEVTSDD.js} +1 -1
- package/esm/__chunks/{EPLYSKGE.js → VQPGNVAE.js} +1 -1
- package/esm/__chunks/{GFLJYJHR.js → WNWUDBP3.js} +5 -3
- package/esm/__chunks/{4UNPWQYT.js → WPWRDZX3.js} +1 -1
- package/esm/__chunks/{7W7JS5WE.js → WVBEOY53.js} +1 -1
- package/esm/__chunks/{H2EYGI5B.js → XMEKWVLK.js} +1 -1
- package/esm/__chunks/{ZYTXNZCP.js → XXMIY262.js} +1 -1
- package/esm/__chunks/{EGINZ4IG.js → YJSLDE5C.js} +17 -8
- package/esm/__chunks/{6MPOG72U.js → ZWS67PVZ.js} +6 -5
- package/esm/button/button.js +2 -2
- package/esm/checkbox/checkbox.d.ts +2 -2
- package/esm/checkbox/checkbox.js +2 -2
- package/esm/combobox/combobox-cancel.js +2 -2
- package/esm/combobox/combobox-disclosure.js +4 -4
- package/esm/combobox/combobox-item.js +3 -3
- package/esm/combobox/combobox-popover.js +8 -8
- package/esm/command/command.js +1 -1
- package/esm/composite/composite-hover.js +1 -1
- package/esm/composite/composite-item.js +2 -2
- package/esm/composite/composite-overflow-disclosure.js +6 -6
- package/esm/composite/composite-overflow.js +8 -8
- package/esm/composite/composite-typeahead.js +1 -1
- package/esm/dialog/dialog-backdrop.js +3 -3
- package/esm/dialog/dialog-disclosure.js +4 -4
- package/esm/dialog/dialog-dismiss.js +3 -3
- package/esm/dialog/dialog.js +7 -7
- package/esm/dialog/utils/disable-accessibility-tree-outside.js +2 -2
- package/esm/dialog/utils/disable-tree-outside.js +3 -3
- package/esm/dialog/utils/mark-tree-outside.js +2 -2
- package/esm/dialog/utils/use-hide-on-interact-outside.js +3 -3
- package/esm/dialog/utils/walk-tree-outside.js +1 -1
- package/esm/disclosure/disclosure.js +3 -3
- package/esm/form/form-checkbox.js +2 -2
- package/esm/form/form-push.js +2 -2
- package/esm/form/form-radio.js +3 -3
- package/esm/form/form-remove.js +2 -2
- package/esm/form/form-reset.js +2 -2
- package/esm/form/form-submit.js +2 -2
- package/esm/hovercard/hovercard-disclosure.js +4 -4
- package/esm/hovercard/hovercard-dismiss.js +5 -5
- package/esm/hovercard/hovercard.d.ts +0 -9
- package/esm/hovercard/hovercard.js +9 -9
- package/esm/menu/menu-button.js +6 -6
- package/esm/menu/menu-dismiss.js +5 -5
- package/esm/menu/menu-item-checkbox.js +5 -5
- package/esm/menu/menu-item-radio.js +5 -5
- package/esm/menu/menu-item.js +4 -4
- package/esm/menu/menu-list.js +2 -2
- package/esm/menu/menu.js +11 -11
- package/esm/popover/popover-disclosure.js +5 -5
- package/esm/popover/popover-dismiss.js +4 -4
- package/esm/popover/popover.d.ts +1 -1
- package/esm/popover/popover.js +8 -8
- package/esm/radio/radio.js +3 -3
- package/esm/select/select-item.js +3 -3
- package/esm/select/select-list.js +2 -2
- package/esm/select/select-popover.js +10 -10
- package/esm/select/select.js +6 -6
- package/esm/tab/tab.js +2 -2
- package/esm/toolbar/toolbar-container.js +3 -3
- package/esm/toolbar/toolbar-input.js +3 -3
- package/esm/toolbar/toolbar-item.js +3 -3
- package/esm/tooltip/tooltip.js +9 -9
- package/esm/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DialogBackdrop
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./3DWMKQHI.js";
|
|
4
4
|
import {
|
|
5
5
|
disableTreeOutside
|
|
6
|
-
} from "./
|
|
6
|
+
} from "./4GMZGYHX.js";
|
|
7
7
|
import {
|
|
8
8
|
disableAccessibilityTreeOutside
|
|
9
|
-
} from "./
|
|
9
|
+
} from "./EKB2TUKR.js";
|
|
10
10
|
import {
|
|
11
11
|
usePreventBodyScroll
|
|
12
12
|
} from "./LMWFU6EQ.js";
|
|
@@ -15,13 +15,13 @@ import {
|
|
|
15
15
|
} from "./NOIOBRWH.js";
|
|
16
16
|
import {
|
|
17
17
|
useHideOnInteractOutside
|
|
18
|
-
} from "./
|
|
18
|
+
} from "./H2CSFGIT.js";
|
|
19
19
|
import {
|
|
20
20
|
prependHiddenDismiss
|
|
21
21
|
} from "./62DFK33R.js";
|
|
22
22
|
import {
|
|
23
23
|
markTreeOutside
|
|
24
|
-
} from "./
|
|
24
|
+
} from "./ACAQG6DN.js";
|
|
25
25
|
import {
|
|
26
26
|
useFocusableContainer
|
|
27
27
|
} from "./URYSNCDU.js";
|
|
@@ -89,9 +89,7 @@ function isAlreadyFocusingAnotherElement(dialog) {
|
|
|
89
89
|
const activeElement = getActiveElement();
|
|
90
90
|
if (!activeElement)
|
|
91
91
|
return false;
|
|
92
|
-
if (contains(dialog, activeElement))
|
|
93
|
-
return false;
|
|
94
|
-
if (activeElement.hasAttribute("data-dialog"))
|
|
92
|
+
if (dialog && contains(dialog, activeElement))
|
|
95
93
|
return false;
|
|
96
94
|
if (isFocusable(activeElement))
|
|
97
95
|
return true;
|
|
@@ -228,9 +226,16 @@ var useDialog = createHook(
|
|
|
228
226
|
if (!open)
|
|
229
227
|
return;
|
|
230
228
|
const { disclosureElement } = store.getState();
|
|
231
|
-
const
|
|
229
|
+
const dialog = ref.current;
|
|
232
230
|
const persistentElements = getPersistentElementsProp() || [];
|
|
233
|
-
const allElements = [
|
|
231
|
+
const allElements = [
|
|
232
|
+
// In addition to the dialog element, we also include the portal node here
|
|
233
|
+
// so nested dialogs are considered as well.
|
|
234
|
+
dialog,
|
|
235
|
+
portalNode,
|
|
236
|
+
...nestedDialogs,
|
|
237
|
+
...persistentElements
|
|
238
|
+
];
|
|
234
239
|
if (!shouldDisableAccessibilityTree) {
|
|
235
240
|
return markTreeOutside(id, disclosureElement, ...allElements);
|
|
236
241
|
}
|
|
@@ -310,8 +315,6 @@ var useDialog = createHook(
|
|
|
310
315
|
return;
|
|
311
316
|
const dialog = ref.current;
|
|
312
317
|
const focusOnHide = (retry = true) => {
|
|
313
|
-
if (!dialog)
|
|
314
|
-
return;
|
|
315
318
|
if (isAlreadyFocusingAnotherElement(dialog))
|
|
316
319
|
return;
|
|
317
320
|
const { disclosureElement } = store.getState();
|
|
@@ -344,7 +347,7 @@ var useDialog = createHook(
|
|
|
344
347
|
return;
|
|
345
348
|
if (!isElementFocusable)
|
|
346
349
|
return;
|
|
347
|
-
|
|
350
|
+
element == null ? void 0 : element.focus();
|
|
348
351
|
};
|
|
349
352
|
if (!open) {
|
|
350
353
|
return focusOnHide();
|
|
@@ -19,14 +19,14 @@ function walkTreeOutside(elements, callback, ancestorCallback) {
|
|
|
19
19
|
return false;
|
|
20
20
|
return maybeAncestor.contains(element);
|
|
21
21
|
});
|
|
22
|
-
if (hasAncestorAlready)
|
|
23
|
-
continue;
|
|
24
22
|
const doc = getDocument(element);
|
|
25
23
|
while (element.parentElement && element !== doc.body) {
|
|
26
24
|
ancestorCallback == null ? void 0 : ancestorCallback(element.parentElement);
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
25
|
+
if (!hasAncestorAlready) {
|
|
26
|
+
for (const child of element.parentElement.children) {
|
|
27
|
+
if (isValidElement(child, elements)) {
|
|
28
|
+
callback(child);
|
|
29
|
+
}
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
element = element.parentElement;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
useButton
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./WPWRDZX3.js";
|
|
4
4
|
import {
|
|
5
5
|
createComponent,
|
|
6
6
|
createElement,
|
|
@@ -9,8 +9,7 @@ import {
|
|
|
9
9
|
import {
|
|
10
10
|
useBooleanEvent,
|
|
11
11
|
useEvent,
|
|
12
|
-
useForkRef
|
|
13
|
-
useSafeLayoutEffect
|
|
12
|
+
useForkRef
|
|
14
13
|
} from "./JSNCZ2E2.js";
|
|
15
14
|
import {
|
|
16
15
|
__objRest,
|
|
@@ -19,7 +18,7 @@ import {
|
|
|
19
18
|
} from "./4BKCJXBM.js";
|
|
20
19
|
|
|
21
20
|
// src/disclosure/disclosure.ts
|
|
22
|
-
import { useRef, useState } from "react";
|
|
21
|
+
import { useEffect, useRef, useState } from "react";
|
|
23
22
|
var useDisclosure = createHook(
|
|
24
23
|
(_a) => {
|
|
25
24
|
var _b = _a, { store, toggleOnClick = true } = _b, props = __objRest(_b, ["store", "toggleOnClick"]);
|
|
@@ -27,7 +26,7 @@ var useDisclosure = createHook(
|
|
|
27
26
|
const [expanded, setExpanded] = useState(false);
|
|
28
27
|
const disclosureElement = store.useState("disclosureElement");
|
|
29
28
|
const open = store.useState("open");
|
|
30
|
-
|
|
29
|
+
useEffect(() => {
|
|
31
30
|
let isCurrentDisclosure = disclosureElement === ref.current;
|
|
32
31
|
if (!disclosureElement || !disclosureElement.isConnected) {
|
|
33
32
|
store.setDisclosureElement(ref.current);
|
|
@@ -30,7 +30,13 @@ function isNativeClick(event) {
|
|
|
30
30
|
if (!event.isTrusted)
|
|
31
31
|
return false;
|
|
32
32
|
const element = event.currentTarget;
|
|
33
|
-
|
|
33
|
+
if (event.key === "Enter") {
|
|
34
|
+
return isButton(element) || element.tagName === "SUMMARY" || element.tagName === "A";
|
|
35
|
+
}
|
|
36
|
+
if (event.key === " ") {
|
|
37
|
+
return isButton(element) || element.tagName === "SUMMARY" || element.tagName === "INPUT" || element.tagName === "SELECT";
|
|
38
|
+
}
|
|
39
|
+
return false;
|
|
34
40
|
}
|
|
35
41
|
var useCommand = createHook(
|
|
36
42
|
(_a) => {
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
} from "./X7FKJQME.js";
|
|
6
6
|
import {
|
|
7
7
|
usePopover
|
|
8
|
-
} from "./
|
|
8
|
+
} from "./ZWS67PVZ.js";
|
|
9
9
|
import {
|
|
10
10
|
createComponent,
|
|
11
11
|
createElement,
|
|
@@ -38,7 +38,7 @@ import {
|
|
|
38
38
|
import { contains } from "@ariakit/core/utils/dom";
|
|
39
39
|
import { addGlobalEventListener } from "@ariakit/core/utils/events";
|
|
40
40
|
import { hasFocusWithin } from "@ariakit/core/utils/focus";
|
|
41
|
-
import { chain } from "@ariakit/core/utils/misc";
|
|
41
|
+
import { chain, isFalsyBooleanCallback } from "@ariakit/core/utils/misc";
|
|
42
42
|
import { jsx } from "react/jsx-runtime";
|
|
43
43
|
function isMovingOnHovercard(target, card, anchor, nested) {
|
|
44
44
|
if (hasFocusWithin(card))
|
|
@@ -118,7 +118,6 @@ var useHovercard = createHook(
|
|
|
118
118
|
modal = false,
|
|
119
119
|
portal = !!modal,
|
|
120
120
|
hideOnEscape = true,
|
|
121
|
-
hideOnControl = false,
|
|
122
121
|
hideOnHoverOutside = true,
|
|
123
122
|
disablePointerEventsOnApproach = !!hideOnHoverOutside
|
|
124
123
|
} = _b, props = __objRest(_b, [
|
|
@@ -126,7 +125,6 @@ var useHovercard = createHook(
|
|
|
126
125
|
"modal",
|
|
127
126
|
"portal",
|
|
128
127
|
"hideOnEscape",
|
|
129
|
-
"hideOnControl",
|
|
130
128
|
"hideOnHoverOutside",
|
|
131
129
|
"disablePointerEventsOnApproach"
|
|
132
130
|
]);
|
|
@@ -135,22 +133,6 @@ var useHovercard = createHook(
|
|
|
135
133
|
const hideTimeoutRef = useRef(0);
|
|
136
134
|
const enterPointRef = useRef(null);
|
|
137
135
|
const { portalRef, domReady } = usePortalRef(portal, props.portalRef);
|
|
138
|
-
const hideOnEscapeProp = useBooleanEvent(hideOnEscape);
|
|
139
|
-
const hideOnControlProp = useBooleanEvent(hideOnControl);
|
|
140
|
-
const open = store.useState("open");
|
|
141
|
-
useEffect(() => {
|
|
142
|
-
if (!open)
|
|
143
|
-
return;
|
|
144
|
-
return addGlobalEventListener("keydown", (event) => {
|
|
145
|
-
if (event.defaultPrevented)
|
|
146
|
-
return;
|
|
147
|
-
const isEscape = event.key === "Escape" && hideOnEscapeProp(event);
|
|
148
|
-
const isControl = event.key === "Control" && hideOnControlProp(event);
|
|
149
|
-
if (isEscape || isControl) {
|
|
150
|
-
requestAnimationFrame(store.hide);
|
|
151
|
-
}
|
|
152
|
-
});
|
|
153
|
-
}, [store, open, hideOnEscapeProp, hideOnControlProp]);
|
|
154
136
|
const mayHideOnHoverOutside = !!hideOnHoverOutside;
|
|
155
137
|
const hideOnHoverOutsideProp = useBooleanEvent(hideOnHoverOutside);
|
|
156
138
|
const mayDisablePointerEvents = !!disablePointerEventsOnApproach;
|
|
@@ -283,12 +265,17 @@ var useHovercard = createHook(
|
|
|
283
265
|
props = useAutoFocusOnHide(__spreadValues({ store }, props));
|
|
284
266
|
props = useAutoFocusOnShow(__spreadValues({ store, modal }, props));
|
|
285
267
|
props = usePopover(__spreadProps(__spreadValues({
|
|
286
|
-
hideOnEscape,
|
|
287
268
|
store,
|
|
288
269
|
modal,
|
|
289
270
|
portal
|
|
290
271
|
}, props), {
|
|
291
|
-
portalRef
|
|
272
|
+
portalRef,
|
|
273
|
+
hideOnEscape(event) {
|
|
274
|
+
if (isFalsyBooleanCallback(hideOnEscape, event))
|
|
275
|
+
return false;
|
|
276
|
+
requestAnimationFrame(() => requestAnimationFrame(store.hide));
|
|
277
|
+
return true;
|
|
278
|
+
}
|
|
292
279
|
}));
|
|
293
280
|
return props;
|
|
294
281
|
}
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
// src/composite/composite-hover.ts
|
|
21
21
|
import { useContext } from "react";
|
|
22
22
|
import { closest, contains } from "@ariakit/core/utils/dom";
|
|
23
|
-
import { hasFocusWithin } from "@ariakit/core/utils/focus";
|
|
23
|
+
import { hasFocus, hasFocusWithin } from "@ariakit/core/utils/focus";
|
|
24
24
|
import { invariant } from "@ariakit/core/utils/misc";
|
|
25
25
|
function getMouseDestination(event) {
|
|
26
26
|
const relatedTarget = event.relatedTarget;
|
|
@@ -55,7 +55,6 @@ var useCompositeHover = createHook(
|
|
|
55
55
|
const onMouseMoveProp = props.onMouseMove;
|
|
56
56
|
const focusOnHoverProp = useBooleanEvent(focusOnHover);
|
|
57
57
|
const onMouseMove = useEvent((event) => {
|
|
58
|
-
var _a2;
|
|
59
58
|
onMouseMoveProp == null ? void 0 : onMouseMoveProp(event);
|
|
60
59
|
if (event.defaultPrevented)
|
|
61
60
|
return;
|
|
@@ -64,7 +63,10 @@ var useCompositeHover = createHook(
|
|
|
64
63
|
if (!focusOnHoverProp(event))
|
|
65
64
|
return;
|
|
66
65
|
if (!hasFocusWithin(event.currentTarget)) {
|
|
67
|
-
|
|
66
|
+
const baseElement = store == null ? void 0 : store.getState().baseElement;
|
|
67
|
+
if (baseElement && !hasFocus(baseElement)) {
|
|
68
|
+
baseElement.focus();
|
|
69
|
+
}
|
|
68
70
|
}
|
|
69
71
|
store == null ? void 0 : store.setActiveId(event.currentTarget.id);
|
|
70
72
|
});
|
|
@@ -52,7 +52,7 @@ function itemTextStartsWith(item, text) {
|
|
|
52
52
|
const itemText = ((_a = item.element) == null ? void 0 : _a.textContent) || item.children;
|
|
53
53
|
if (!itemText)
|
|
54
54
|
return false;
|
|
55
|
-
return normalizeString(itemText).toLowerCase().startsWith(text.toLowerCase());
|
|
55
|
+
return normalizeString(itemText).trim().toLowerCase().startsWith(text.toLowerCase());
|
|
56
56
|
}
|
|
57
57
|
function getSameInitialItems(items, char, activeId) {
|
|
58
58
|
if (!activeId)
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./M5KYRTQG.js";
|
|
4
4
|
import {
|
|
5
5
|
useCommand
|
|
6
|
-
} from "./
|
|
6
|
+
} from "./GKEHNDOU.js";
|
|
7
7
|
import {
|
|
8
8
|
createComponent,
|
|
9
9
|
createElement,
|
|
@@ -37,6 +37,12 @@ function setMixed(element, mixed) {
|
|
|
37
37
|
function isNativeCheckbox(tagName, type) {
|
|
38
38
|
return tagName === "input" && (!type || type === "checkbox");
|
|
39
39
|
}
|
|
40
|
+
function getNonArrayValue(value) {
|
|
41
|
+
if (Array.isArray(value)) {
|
|
42
|
+
return value.toString();
|
|
43
|
+
}
|
|
44
|
+
return value;
|
|
45
|
+
}
|
|
40
46
|
var useCheckbox = createHook(
|
|
41
47
|
(_a) => {
|
|
42
48
|
var _b = _a, {
|
|
@@ -56,9 +62,11 @@ var useCheckbox = createHook(
|
|
|
56
62
|
return checkedProp;
|
|
57
63
|
if (state.value === void 0)
|
|
58
64
|
return;
|
|
59
|
-
if (valueProp) {
|
|
60
|
-
if (Array.isArray(state.value))
|
|
61
|
-
|
|
65
|
+
if (valueProp != null) {
|
|
66
|
+
if (Array.isArray(state.value)) {
|
|
67
|
+
const nonArrayValue = getNonArrayValue(valueProp);
|
|
68
|
+
return state.value.includes(nonArrayValue);
|
|
69
|
+
}
|
|
62
70
|
return state.value === valueProp;
|
|
63
71
|
}
|
|
64
72
|
if (Array.isArray(state.value))
|
|
@@ -98,14 +106,15 @@ var useCheckbox = createHook(
|
|
|
98
106
|
const elementChecked = event.currentTarget.checked;
|
|
99
107
|
setChecked(elementChecked);
|
|
100
108
|
store == null ? void 0 : store.setValue((prevValue) => {
|
|
101
|
-
if (
|
|
109
|
+
if (valueProp == null)
|
|
102
110
|
return elementChecked;
|
|
111
|
+
const nonArrayValue = getNonArrayValue(valueProp);
|
|
103
112
|
if (!Array.isArray(prevValue)) {
|
|
104
|
-
return prevValue ===
|
|
113
|
+
return prevValue === nonArrayValue ? false : nonArrayValue;
|
|
105
114
|
}
|
|
106
115
|
if (elementChecked)
|
|
107
|
-
return [...prevValue,
|
|
108
|
-
return prevValue.filter((v) => v !==
|
|
116
|
+
return [...prevValue, nonArrayValue];
|
|
117
|
+
return prevValue.filter((v) => v !== nonArrayValue);
|
|
109
118
|
});
|
|
110
119
|
});
|
|
111
120
|
const onClickProp = props.onClick;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
useDialog
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./4OUEWDQI.js";
|
|
4
4
|
import {
|
|
5
5
|
PopoverContext
|
|
6
6
|
} from "./6GS36SYX.js";
|
|
@@ -201,8 +201,8 @@ var usePopover = createHook(
|
|
|
201
201
|
const [positioned, setPositioned] = useState(false);
|
|
202
202
|
const { portalRef, domReady } = usePortalRef(portal, props.portalRef);
|
|
203
203
|
const getAnchorRectProp = useEvent(getAnchorRect);
|
|
204
|
-
const hasCustomUpdatePosition = !!updatePosition;
|
|
205
204
|
const updatePositionProp = useEvent(updatePosition);
|
|
205
|
+
const hasCustomUpdatePosition = !!updatePosition;
|
|
206
206
|
useSafeLayoutEffect(() => {
|
|
207
207
|
if (!(popoverElement == null ? void 0 : popoverElement.isConnected))
|
|
208
208
|
return;
|
|
@@ -252,11 +252,12 @@ var usePopover = createHook(
|
|
|
252
252
|
return autoUpdate(
|
|
253
253
|
anchor,
|
|
254
254
|
popoverElement,
|
|
255
|
-
() => {
|
|
255
|
+
async () => {
|
|
256
256
|
if (hasCustomUpdatePosition) {
|
|
257
|
-
updatePositionProp({ updatePosition: update });
|
|
257
|
+
await updatePositionProp({ updatePosition: update });
|
|
258
|
+
setPositioned(true);
|
|
258
259
|
} else {
|
|
259
|
-
update();
|
|
260
|
+
await update();
|
|
260
261
|
}
|
|
261
262
|
},
|
|
262
263
|
{
|
package/esm/button/button.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Button,
|
|
3
3
|
useButton
|
|
4
|
-
} from "../__chunks/
|
|
5
|
-
import "../__chunks/
|
|
4
|
+
} from "../__chunks/WPWRDZX3.js";
|
|
5
|
+
import "../__chunks/GKEHNDOU.js";
|
|
6
6
|
import "../__chunks/IMP6LK4U.js";
|
|
7
7
|
import "../__chunks/BMLNRUFQ.js";
|
|
8
8
|
import "../__chunks/U2LXZPCY.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ChangeEvent } from "react";
|
|
1
|
+
import type { ChangeEvent, InputHTMLAttributes } from "react";
|
|
2
2
|
import type { CommandOptions } from "../command/command.js";
|
|
3
3
|
import type { As, Props } from "../utils/types.js";
|
|
4
4
|
import type { CheckboxStore } from "./checkbox-store.js";
|
|
@@ -52,7 +52,7 @@ export interface CheckboxOptions<T extends As = "input"> extends CommandOptions<
|
|
|
52
52
|
* <Checkbox store={checkbox} value="Watermelon" />
|
|
53
53
|
* ```
|
|
54
54
|
*/
|
|
55
|
-
value?:
|
|
55
|
+
value?: InputHTMLAttributes<HTMLInputElement>["value"];
|
|
56
56
|
/**
|
|
57
57
|
* The default `checked` state of the checkbox. This prop is ignored if the
|
|
58
58
|
* `checked` or the `store` props are provided.
|
package/esm/checkbox/checkbox.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Checkbox,
|
|
3
3
|
useCheckbox
|
|
4
|
-
} from "../__chunks/
|
|
4
|
+
} from "../__chunks/YJSLDE5C.js";
|
|
5
5
|
import "../__chunks/M5KYRTQG.js";
|
|
6
|
-
import "../__chunks/
|
|
6
|
+
import "../__chunks/GKEHNDOU.js";
|
|
7
7
|
import "../__chunks/IMP6LK4U.js";
|
|
8
8
|
import "../__chunks/BMLNRUFQ.js";
|
|
9
9
|
import "../__chunks/U2LXZPCY.js";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
useDialogDisclosure
|
|
3
|
-
} from "../__chunks/
|
|
4
|
-
import "../__chunks/
|
|
5
|
-
import "../__chunks/
|
|
6
|
-
import "../__chunks/
|
|
3
|
+
} from "../__chunks/76X52BLD.js";
|
|
4
|
+
import "../__chunks/GGPLUQQY.js";
|
|
5
|
+
import "../__chunks/WPWRDZX3.js";
|
|
6
|
+
import "../__chunks/GKEHNDOU.js";
|
|
7
7
|
import "../__chunks/IMP6LK4U.js";
|
|
8
8
|
import "../__chunks/BMLNRUFQ.js";
|
|
9
9
|
import {
|
|
@@ -4,11 +4,11 @@ import {
|
|
|
4
4
|
} from "../__chunks/5VGBBGF5.js";
|
|
5
5
|
import {
|
|
6
6
|
useCompositeHover
|
|
7
|
-
} from "../__chunks/
|
|
7
|
+
} from "../__chunks/WNWUDBP3.js";
|
|
8
8
|
import {
|
|
9
9
|
useCompositeItem
|
|
10
|
-
} from "../__chunks/
|
|
11
|
-
import "../__chunks/
|
|
10
|
+
} from "../__chunks/OTKCW3PM.js";
|
|
11
|
+
import "../__chunks/GKEHNDOU.js";
|
|
12
12
|
import "../__chunks/CWGC7RDD.js";
|
|
13
13
|
import "../__chunks/T3DJZG63.js";
|
|
14
14
|
import "../__chunks/OXPV2NBK.js";
|
|
@@ -4,20 +4,20 @@ import {
|
|
|
4
4
|
import "../__chunks/5VGBBGF5.js";
|
|
5
5
|
import {
|
|
6
6
|
usePopover
|
|
7
|
-
} from "../__chunks/
|
|
8
|
-
import "../__chunks/
|
|
9
|
-
import "../__chunks/
|
|
10
|
-
import "../__chunks/
|
|
11
|
-
import "../__chunks/
|
|
7
|
+
} from "../__chunks/ZWS67PVZ.js";
|
|
8
|
+
import "../__chunks/4OUEWDQI.js";
|
|
9
|
+
import "../__chunks/3DWMKQHI.js";
|
|
10
|
+
import "../__chunks/4GMZGYHX.js";
|
|
11
|
+
import "../__chunks/EKB2TUKR.js";
|
|
12
12
|
import "../__chunks/LMWFU6EQ.js";
|
|
13
13
|
import "../__chunks/NOIOBRWH.js";
|
|
14
|
-
import "../__chunks/
|
|
14
|
+
import "../__chunks/H2CSFGIT.js";
|
|
15
15
|
import "../__chunks/KOVUJERF.js";
|
|
16
16
|
import "../__chunks/62DFK33R.js";
|
|
17
|
-
import "../__chunks/
|
|
17
|
+
import "../__chunks/ACAQG6DN.js";
|
|
18
18
|
import "../__chunks/DJESYNLE.js";
|
|
19
19
|
import "../__chunks/URYSNCDU.js";
|
|
20
|
-
import "../__chunks/
|
|
20
|
+
import "../__chunks/FV23EKJL.js";
|
|
21
21
|
import "../__chunks/7JNF6I52.js";
|
|
22
22
|
import "../__chunks/6OMX4H3W.js";
|
|
23
23
|
import "../__chunks/56DUJ462.js";
|
package/esm/command/command.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CompositeItem,
|
|
3
3
|
useCompositeItem
|
|
4
|
-
} from "../__chunks/
|
|
5
|
-
import "../__chunks/
|
|
4
|
+
} from "../__chunks/OTKCW3PM.js";
|
|
5
|
+
import "../__chunks/GKEHNDOU.js";
|
|
6
6
|
import "../__chunks/CWGC7RDD.js";
|
|
7
7
|
import "../__chunks/T3DJZG63.js";
|
|
8
8
|
import "../__chunks/OXPV2NBK.js";
|