periplo-ui 1.26.0 → 1.27.0
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/dist/chunks/index-0xSCJjjg.js +45 -0
- package/dist/chunks/index-0xSCJjjg.js.map +1 -0
- package/dist/chunks/index-BAKhqUxp.js +19 -0
- package/dist/chunks/index-BAKhqUxp.js.map +1 -0
- package/dist/chunks/{index-BIsOtYaP.js → index-BvF_j4eL.js} +2 -2
- package/dist/chunks/{index-BIsOtYaP.js.map → index-BvF_j4eL.js.map} +1 -1
- package/dist/chunks/{index-BfOl1omc.js → index-DUkGJrHr.js} +32 -31
- package/dist/chunks/{index-BfOl1omc.js.map → index-DUkGJrHr.js.map} +1 -1
- package/dist/chunks/{index-0A8G1gzv.js → index-LzueKcCr.js} +14 -13
- package/dist/chunks/{index-0A8G1gzv.js.map → index-LzueKcCr.js.map} +1 -1
- package/dist/components/Accordion/Accordion.js +9 -8
- package/dist/components/Accordion/Accordion.js.map +1 -1
- package/dist/components/Checkbox/Checkbox.d.ts +4 -0
- package/dist/components/Checkbox/Checkbox.js +133 -0
- package/dist/components/Checkbox/Checkbox.js.map +1 -0
- package/dist/components/Checkbox/index.d.ts +1 -0
- package/dist/components/Checkbox/index.js +5 -0
- package/dist/components/Checkbox/index.js.map +1 -0
- package/dist/components/Command/Command.js +1 -1
- package/dist/components/Dialog/Dialog.js +1 -1
- package/dist/components/MultiSelect/MultiSelect.js +1 -1
- package/dist/components/Popover/Popover.js +16 -15
- package/dist/components/Popover/Popover.js.map +1 -1
- package/dist/components/RadioGroup/RadioGroup.js +2 -2
- package/dist/components/Select/Select.js +8 -7
- package/dist/components/Select/Select.js.map +1 -1
- package/dist/components/Sheet/Sheet.js +1 -1
- package/dist/components/Tabs/Tabs.js +14 -13
- package/dist/components/Tabs/Tabs.js.map +1 -1
- package/dist/components/Tooltip/Tooltip.js +34 -33
- package/dist/components/Tooltip/Tooltip.js.map +1 -1
- package/package.json +2 -1
- package/dist/chunks/index-Chm6XfLb.js +0 -60
- package/dist/chunks/index-Chm6XfLb.js.map +0 -1
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { useCallback as $, useState as i, useRef as b, useEffect as h } from "react";
|
|
2
|
+
import { a } from "./index-C5wtLq4-.js";
|
|
3
|
+
function m(e, c, { checkForDefaultPrevented: n = !0 } = {}) {
|
|
4
|
+
return function(t) {
|
|
5
|
+
if (e?.(t), n === !1 || !t.defaultPrevented)
|
|
6
|
+
return c?.(t);
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
function S({ prop: e, defaultProp: c, onChange: n = () => {
|
|
10
|
+
} }) {
|
|
11
|
+
const [o, t] = p({
|
|
12
|
+
defaultProp: c,
|
|
13
|
+
onChange: n
|
|
14
|
+
}), f = e !== void 0, l = f ? e : o, u = a(n), d = $((r) => {
|
|
15
|
+
if (f) {
|
|
16
|
+
const s = typeof r == "function" ? r(e) : r;
|
|
17
|
+
s !== e && u(s);
|
|
18
|
+
} else
|
|
19
|
+
t(r);
|
|
20
|
+
}, [
|
|
21
|
+
f,
|
|
22
|
+
e,
|
|
23
|
+
t,
|
|
24
|
+
u
|
|
25
|
+
]);
|
|
26
|
+
return [
|
|
27
|
+
l,
|
|
28
|
+
d
|
|
29
|
+
];
|
|
30
|
+
}
|
|
31
|
+
function p({ defaultProp: e, onChange: c }) {
|
|
32
|
+
const n = i(e), [o] = n, t = b(o), f = a(c);
|
|
33
|
+
return h(() => {
|
|
34
|
+
t.current !== o && (f(o), t.current = o);
|
|
35
|
+
}, [
|
|
36
|
+
o,
|
|
37
|
+
t,
|
|
38
|
+
f
|
|
39
|
+
]), n;
|
|
40
|
+
}
|
|
41
|
+
export {
|
|
42
|
+
S as $,
|
|
43
|
+
m as a
|
|
44
|
+
};
|
|
45
|
+
//# sourceMappingURL=index-0xSCJjjg.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-0xSCJjjg.js","sources":["../../node_modules/@radix-ui/primitive/dist/index.mjs","../../node_modules/@radix-ui/react-use-controllable-state/dist/index.mjs"],"sourcesContent":["function $e42e1063c40fb3ef$export$b9ecd428b558ff10(originalEventHandler, ourEventHandler, { checkForDefaultPrevented: checkForDefaultPrevented = true } = {}) {\n return function handleEvent(event) {\n originalEventHandler === null || originalEventHandler === void 0 || originalEventHandler(event);\n if (checkForDefaultPrevented === false || !event.defaultPrevented) return ourEventHandler === null || ourEventHandler === void 0 ? void 0 : ourEventHandler(event);\n };\n}\n\n\n\n\nexport {$e42e1063c40fb3ef$export$b9ecd428b558ff10 as composeEventHandlers};\n//# sourceMappingURL=index.mjs.map\n","import {useCallback as $bnPw9$useCallback, useState as $bnPw9$useState, useRef as $bnPw9$useRef, useEffect as $bnPw9$useEffect} from \"react\";\nimport {useCallbackRef as $bnPw9$useCallbackRef} from \"@radix-ui/react-use-callback-ref\";\n\n\n\nfunction $71cd76cc60e0454e$export$6f32135080cb4c3({ prop: prop , defaultProp: defaultProp , onChange: onChange = ()=>{} }) {\n const [uncontrolledProp, setUncontrolledProp] = $71cd76cc60e0454e$var$useUncontrolledState({\n defaultProp: defaultProp,\n onChange: onChange\n });\n const isControlled = prop !== undefined;\n const value1 = isControlled ? prop : uncontrolledProp;\n const handleChange = $bnPw9$useCallbackRef(onChange);\n const setValue = $bnPw9$useCallback((nextValue)=>{\n if (isControlled) {\n const setter = nextValue;\n const value = typeof nextValue === 'function' ? setter(prop) : nextValue;\n if (value !== prop) handleChange(value);\n } else setUncontrolledProp(nextValue);\n }, [\n isControlled,\n prop,\n setUncontrolledProp,\n handleChange\n ]);\n return [\n value1,\n setValue\n ];\n}\nfunction $71cd76cc60e0454e$var$useUncontrolledState({ defaultProp: defaultProp , onChange: onChange }) {\n const uncontrolledState = $bnPw9$useState(defaultProp);\n const [value] = uncontrolledState;\n const prevValueRef = $bnPw9$useRef(value);\n const handleChange = $bnPw9$useCallbackRef(onChange);\n $bnPw9$useEffect(()=>{\n if (prevValueRef.current !== value) {\n handleChange(value);\n prevValueRef.current = value;\n }\n }, [\n value,\n prevValueRef,\n handleChange\n ]);\n return uncontrolledState;\n}\n\n\n\n\nexport {$71cd76cc60e0454e$export$6f32135080cb4c3 as useControllableState};\n//# sourceMappingURL=index.mjs.map\n"],"names":["$e42e1063c40fb3ef$export$b9ecd428b558ff10","originalEventHandler","ourEventHandler","checkForDefaultPrevented","event","$71cd76cc60e0454e$export$6f32135080cb4c3","prop","defaultProp","onChange","uncontrolledProp","setUncontrolledProp","$71cd76cc60e0454e$var$useUncontrolledState","isControlled","value1","handleChange","$bnPw9$useCallbackRef","setValue","$bnPw9$useCallback","nextValue","value","uncontrolledState","$bnPw9$useState","prevValueRef","$bnPw9$useRef","$bnPw9$useEffect"],"mappings":";;AAAA,SAASA,EAA0CC,GAAsBC,GAAiB,EAAE,0BAA0BC,IAA2B,GAAO,IAAG,IAAI;AAC3J,SAAO,SAAqBC,GAAO;AAE/B,QADoEH,IAAqBG,CAAK,GAC1FD,MAA6B,MAAS,CAACC,EAAM;AAAkB,aAAyEF,IAAgBE,CAAK;AAAA,EACzK;AACA;ACAA,SAASC,EAAyC,EAAE,MAAMC,GAAO,aAAaC,GAAc,UAAUC,IAAW,MAAI;AAAA,KAAO;AACxH,QAAM,CAACC,GAAkBC,CAAmB,IAAIC,EAA2C;AAAA,IACvF,aAAaJ;AAAA,IACb,UAAUC;AAAA,EAClB,CAAK,GACKI,IAAeN,MAAS,QACxBO,IAASD,IAAeN,IAAOG,GAC/BK,IAAeC,EAAsBP,CAAQ,GAC7CQ,IAAWC,EAAmB,CAACC,MAAY;AAC7C,QAAIN,GAAc;AAEd,YAAMO,IAAQ,OAAOD,KAAc,aADpBA,EACwCZ,CAAI,IAAIY;AAC/D,MAAIC,MAAUb,KAAMQ,EAAaK,CAAK;AAAA,IAClD;AAAe,MAAAT,EAAoBQ,CAAS;AAAA,EAC5C,GAAO;AAAA,IACCN;AAAA,IACAN;AAAA,IACAI;AAAA,IACAI;AAAA,EACR,CAAK;AACD,SAAO;AAAA,IACHD;AAAA,IACAG;AAAA,EACR;AACA;AACA,SAASL,EAA2C,EAAE,aAAaJ,GAAc,UAAUC,EAAQ,GAAK;AACpG,QAAMY,IAAoBC,EAAgBd,CAAW,GAC/C,CAACY,CAAK,IAAIC,GACVE,IAAeC,EAAcJ,CAAK,GAClCL,IAAeC,EAAsBP,CAAQ;AACnDgB,SAAAA,EAAiB,MAAI;AACjB,IAAIF,EAAa,YAAYH,MACzBL,EAAaK,CAAK,GAClBG,EAAa,UAAUH;AAAA,EAEnC,GAAO;AAAA,IACCA;AAAA,IACAG;AAAA,IACAR;AAAA,EACR,CAAK,GACMM;AACX;","x_google_ignoreList":[0,1]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as t from "react";
|
|
2
|
+
import { b as r } from "./index-C5wtLq4-.js";
|
|
3
|
+
const e = t.useId || (() => {
|
|
4
|
+
});
|
|
5
|
+
let n = 0;
|
|
6
|
+
function b($) {
|
|
7
|
+
const [o, f] = t.useState(e());
|
|
8
|
+
return r(() => {
|
|
9
|
+
$ || f(
|
|
10
|
+
(a) => a ?? String(n++)
|
|
11
|
+
);
|
|
12
|
+
}, [
|
|
13
|
+
$
|
|
14
|
+
]), $ || (o ? `radix-${o}` : "");
|
|
15
|
+
}
|
|
16
|
+
export {
|
|
17
|
+
b as $
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=index-BAKhqUxp.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-BAKhqUxp.js","sources":["../../node_modules/@radix-ui/react-id/dist/index.mjs"],"sourcesContent":["import * as $2AODx$react from \"react\";\nimport {useLayoutEffect as $2AODx$useLayoutEffect} from \"@radix-ui/react-use-layout-effect\";\n\n\n\nconst $1746a345f3d73bb7$var$useReactId = $2AODx$react['useId'.toString()] || (()=>undefined\n);\nlet $1746a345f3d73bb7$var$count = 0;\nfunction $1746a345f3d73bb7$export$f680877a34711e37(deterministicId) {\n const [id, setId] = $2AODx$react.useState($1746a345f3d73bb7$var$useReactId()); // React versions older than 18 will have client-side ids only.\n $2AODx$useLayoutEffect(()=>{\n if (!deterministicId) setId((reactId)=>reactId !== null && reactId !== void 0 ? reactId : String($1746a345f3d73bb7$var$count++)\n );\n }, [\n deterministicId\n ]);\n return deterministicId || (id ? `radix-${id}` : '');\n}\n\n\n\n\nexport {$1746a345f3d73bb7$export$f680877a34711e37 as useId};\n//# sourceMappingURL=index.mjs.map\n"],"names":["$1746a345f3d73bb7$var$useReactId","$2AODx$react","$1746a345f3d73bb7$var$count","$1746a345f3d73bb7$export$f680877a34711e37","deterministicId","id","setId","$2AODx$useLayoutEffect","reactId"],"mappings":";;AAKA,MAAMA,IAAmCC,EAAa,UAAwB,MAAA;AAAA;AAE9E,IAAIC,IAA8B;AAClC,SAASC,EAA0CC,GAAiB;AAChE,QAAM,CAACC,GAAIC,CAAK,IAAIL,EAAa,SAASD,EAAgC,CAAE;AAC5EO,SAAAA,EAAuB,MAAI;AACvB,IAAKH,KAAiBE;AAAA,MAAM,CAACE,MAAUA,KAAmD,OAAON,GAA6B;AAAA,IACtI;AAAA,EACA,GAAO;AAAA,IACCE;AAAA,EACR,CAAK,GACMA,MAAoBC,IAAK,SAASA,CAAE,KAAK;AACpD;","x_google_ignoreList":[0]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { $ as _, _ as U } from "./index-CM4_Y0D3.js";
|
|
2
2
|
import { useEffect as v, forwardRef as z, useContext as A, useState as T, createElement as K, useRef as p, createContext as N } from "react";
|
|
3
|
-
import { a as h } from "./index-
|
|
3
|
+
import { a as h } from "./index-0xSCJjjg.js";
|
|
4
4
|
import { $ as H, a as X } from "./index-B6k0B0Dk.js";
|
|
5
5
|
import { a as O } from "./index-C5wtLq4-.js";
|
|
6
6
|
function j(s, e = globalThis?.document) {
|
|
@@ -144,4 +144,4 @@ function x(s, e, i, { discrete: o }) {
|
|
|
144
144
|
export {
|
|
145
145
|
ne as $
|
|
146
146
|
};
|
|
147
|
-
//# sourceMappingURL=index-
|
|
147
|
+
//# sourceMappingURL=index-BvF_j4eL.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-BIsOtYaP.js","sources":["../../node_modules/@radix-ui/react-use-escape-keydown/dist/index.mjs","../../node_modules/@radix-ui/react-dismissable-layer/dist/index.mjs"],"sourcesContent":["import {useEffect as $hPSQ5$useEffect} from \"react\";\nimport {useCallbackRef as $hPSQ5$useCallbackRef} from \"@radix-ui/react-use-callback-ref\";\n\n\n\n/**\n * Listens for when the escape key is down\n */ function $addc16e1bbe58fd0$export$3a72a57244d6e765(onEscapeKeyDownProp, ownerDocument = globalThis === null || globalThis === void 0 ? void 0 : globalThis.document) {\n const onEscapeKeyDown = $hPSQ5$useCallbackRef(onEscapeKeyDownProp);\n $hPSQ5$useEffect(()=>{\n const handleKeyDown = (event)=>{\n if (event.key === 'Escape') onEscapeKeyDown(event);\n };\n ownerDocument.addEventListener('keydown', handleKeyDown);\n return ()=>ownerDocument.removeEventListener('keydown', handleKeyDown)\n ;\n }, [\n onEscapeKeyDown,\n ownerDocument\n ]);\n}\n\n\n\n\nexport {$addc16e1bbe58fd0$export$3a72a57244d6e765 as useEscapeKeydown};\n//# sourceMappingURL=index.mjs.map\n","import $kqwpH$babelruntimehelpersesmextends from \"@babel/runtime/helpers/esm/extends\";\nimport {createContext as $kqwpH$createContext, forwardRef as $kqwpH$forwardRef, useContext as $kqwpH$useContext, useState as $kqwpH$useState, useEffect as $kqwpH$useEffect, createElement as $kqwpH$createElement, useRef as $kqwpH$useRef} from \"react\";\nimport {composeEventHandlers as $kqwpH$composeEventHandlers} from \"@radix-ui/primitive\";\nimport {Primitive as $kqwpH$Primitive, dispatchDiscreteCustomEvent as $kqwpH$dispatchDiscreteCustomEvent} from \"@radix-ui/react-primitive\";\nimport {useComposedRefs as $kqwpH$useComposedRefs} from \"@radix-ui/react-compose-refs\";\nimport {useCallbackRef as $kqwpH$useCallbackRef} from \"@radix-ui/react-use-callback-ref\";\nimport {useEscapeKeydown as $kqwpH$useEscapeKeydown} from \"@radix-ui/react-use-escape-keydown\";\n\n\n\n\n\n\n\n\n/* -------------------------------------------------------------------------------------------------\n * DismissableLayer\n * -----------------------------------------------------------------------------------------------*/ const $5cb92bef7577960e$var$DISMISSABLE_LAYER_NAME = 'DismissableLayer';\nconst $5cb92bef7577960e$var$CONTEXT_UPDATE = 'dismissableLayer.update';\nconst $5cb92bef7577960e$var$POINTER_DOWN_OUTSIDE = 'dismissableLayer.pointerDownOutside';\nconst $5cb92bef7577960e$var$FOCUS_OUTSIDE = 'dismissableLayer.focusOutside';\nlet $5cb92bef7577960e$var$originalBodyPointerEvents;\nconst $5cb92bef7577960e$var$DismissableLayerContext = /*#__PURE__*/ $kqwpH$createContext({\n layers: new Set(),\n layersWithOutsidePointerEventsDisabled: new Set(),\n branches: new Set()\n});\nconst $5cb92bef7577960e$export$177fb62ff3ec1f22 = /*#__PURE__*/ $kqwpH$forwardRef((props, forwardedRef)=>{\n var _node$ownerDocument;\n const { disableOutsidePointerEvents: disableOutsidePointerEvents = false , onEscapeKeyDown: onEscapeKeyDown , onPointerDownOutside: onPointerDownOutside , onFocusOutside: onFocusOutside , onInteractOutside: onInteractOutside , onDismiss: onDismiss , ...layerProps } = props;\n const context = $kqwpH$useContext($5cb92bef7577960e$var$DismissableLayerContext);\n const [node1, setNode] = $kqwpH$useState(null);\n const ownerDocument = (_node$ownerDocument = node1 === null || node1 === void 0 ? void 0 : node1.ownerDocument) !== null && _node$ownerDocument !== void 0 ? _node$ownerDocument : globalThis === null || globalThis === void 0 ? void 0 : globalThis.document;\n const [, force] = $kqwpH$useState({});\n const composedRefs = $kqwpH$useComposedRefs(forwardedRef, (node)=>setNode(node)\n );\n const layers = Array.from(context.layers);\n const [highestLayerWithOutsidePointerEventsDisabled] = [\n ...context.layersWithOutsidePointerEventsDisabled\n ].slice(-1); // prettier-ignore\n const highestLayerWithOutsidePointerEventsDisabledIndex = layers.indexOf(highestLayerWithOutsidePointerEventsDisabled); // prettier-ignore\n const index = node1 ? layers.indexOf(node1) : -1;\n const isBodyPointerEventsDisabled = context.layersWithOutsidePointerEventsDisabled.size > 0;\n const isPointerEventsEnabled = index >= highestLayerWithOutsidePointerEventsDisabledIndex;\n const pointerDownOutside = $5cb92bef7577960e$var$usePointerDownOutside((event)=>{\n const target = event.target;\n const isPointerDownOnBranch = [\n ...context.branches\n ].some((branch)=>branch.contains(target)\n );\n if (!isPointerEventsEnabled || isPointerDownOnBranch) return;\n onPointerDownOutside === null || onPointerDownOutside === void 0 || onPointerDownOutside(event);\n onInteractOutside === null || onInteractOutside === void 0 || onInteractOutside(event);\n if (!event.defaultPrevented) onDismiss === null || onDismiss === void 0 || onDismiss();\n }, ownerDocument);\n const focusOutside = $5cb92bef7577960e$var$useFocusOutside((event)=>{\n const target = event.target;\n const isFocusInBranch = [\n ...context.branches\n ].some((branch)=>branch.contains(target)\n );\n if (isFocusInBranch) return;\n onFocusOutside === null || onFocusOutside === void 0 || onFocusOutside(event);\n onInteractOutside === null || onInteractOutside === void 0 || onInteractOutside(event);\n if (!event.defaultPrevented) onDismiss === null || onDismiss === void 0 || onDismiss();\n }, ownerDocument);\n $kqwpH$useEscapeKeydown((event)=>{\n const isHighestLayer = index === context.layers.size - 1;\n if (!isHighestLayer) return;\n onEscapeKeyDown === null || onEscapeKeyDown === void 0 || onEscapeKeyDown(event);\n if (!event.defaultPrevented && onDismiss) {\n event.preventDefault();\n onDismiss();\n }\n }, ownerDocument);\n $kqwpH$useEffect(()=>{\n if (!node1) return;\n if (disableOutsidePointerEvents) {\n if (context.layersWithOutsidePointerEventsDisabled.size === 0) {\n $5cb92bef7577960e$var$originalBodyPointerEvents = ownerDocument.body.style.pointerEvents;\n ownerDocument.body.style.pointerEvents = 'none';\n }\n context.layersWithOutsidePointerEventsDisabled.add(node1);\n }\n context.layers.add(node1);\n $5cb92bef7577960e$var$dispatchUpdate();\n return ()=>{\n if (disableOutsidePointerEvents && context.layersWithOutsidePointerEventsDisabled.size === 1) ownerDocument.body.style.pointerEvents = $5cb92bef7577960e$var$originalBodyPointerEvents;\n };\n }, [\n node1,\n ownerDocument,\n disableOutsidePointerEvents,\n context\n ]);\n /**\n * We purposefully prevent combining this effect with the `disableOutsidePointerEvents` effect\n * because a change to `disableOutsidePointerEvents` would remove this layer from the stack\n * and add it to the end again so the layering order wouldn't be _creation order_.\n * We only want them to be removed from context stacks when unmounted.\n */ $kqwpH$useEffect(()=>{\n return ()=>{\n if (!node1) return;\n context.layers.delete(node1);\n context.layersWithOutsidePointerEventsDisabled.delete(node1);\n $5cb92bef7577960e$var$dispatchUpdate();\n };\n }, [\n node1,\n context\n ]);\n $kqwpH$useEffect(()=>{\n const handleUpdate = ()=>force({})\n ;\n document.addEventListener($5cb92bef7577960e$var$CONTEXT_UPDATE, handleUpdate);\n return ()=>document.removeEventListener($5cb92bef7577960e$var$CONTEXT_UPDATE, handleUpdate)\n ;\n }, []);\n return /*#__PURE__*/ $kqwpH$createElement($kqwpH$Primitive.div, $kqwpH$babelruntimehelpersesmextends({}, layerProps, {\n ref: composedRefs,\n style: {\n pointerEvents: isBodyPointerEventsDisabled ? isPointerEventsEnabled ? 'auto' : 'none' : undefined,\n ...props.style\n },\n onFocusCapture: $kqwpH$composeEventHandlers(props.onFocusCapture, focusOutside.onFocusCapture),\n onBlurCapture: $kqwpH$composeEventHandlers(props.onBlurCapture, focusOutside.onBlurCapture),\n onPointerDownCapture: $kqwpH$composeEventHandlers(props.onPointerDownCapture, pointerDownOutside.onPointerDownCapture)\n }));\n});\n/*#__PURE__*/ Object.assign($5cb92bef7577960e$export$177fb62ff3ec1f22, {\n displayName: $5cb92bef7577960e$var$DISMISSABLE_LAYER_NAME\n});\n/* -------------------------------------------------------------------------------------------------\n * DismissableLayerBranch\n * -----------------------------------------------------------------------------------------------*/ const $5cb92bef7577960e$var$BRANCH_NAME = 'DismissableLayerBranch';\nconst $5cb92bef7577960e$export$4d5eb2109db14228 = /*#__PURE__*/ $kqwpH$forwardRef((props, forwardedRef)=>{\n const context = $kqwpH$useContext($5cb92bef7577960e$var$DismissableLayerContext);\n const ref = $kqwpH$useRef(null);\n const composedRefs = $kqwpH$useComposedRefs(forwardedRef, ref);\n $kqwpH$useEffect(()=>{\n const node = ref.current;\n if (node) {\n context.branches.add(node);\n return ()=>{\n context.branches.delete(node);\n };\n }\n }, [\n context.branches\n ]);\n return /*#__PURE__*/ $kqwpH$createElement($kqwpH$Primitive.div, $kqwpH$babelruntimehelpersesmextends({}, props, {\n ref: composedRefs\n }));\n});\n/*#__PURE__*/ Object.assign($5cb92bef7577960e$export$4d5eb2109db14228, {\n displayName: $5cb92bef7577960e$var$BRANCH_NAME\n});\n/* -----------------------------------------------------------------------------------------------*/ /**\n * Listens for `pointerdown` outside a react subtree. We use `pointerdown` rather than `pointerup`\n * to mimic layer dismissing behaviour present in OS.\n * Returns props to pass to the node we want to check for outside events.\n */ function $5cb92bef7577960e$var$usePointerDownOutside(onPointerDownOutside, ownerDocument = globalThis === null || globalThis === void 0 ? void 0 : globalThis.document) {\n const handlePointerDownOutside = $kqwpH$useCallbackRef(onPointerDownOutside);\n const isPointerInsideReactTreeRef = $kqwpH$useRef(false);\n const handleClickRef = $kqwpH$useRef(()=>{});\n $kqwpH$useEffect(()=>{\n const handlePointerDown = (event)=>{\n if (event.target && !isPointerInsideReactTreeRef.current) {\n const eventDetail = {\n originalEvent: event\n };\n function handleAndDispatchPointerDownOutsideEvent() {\n $5cb92bef7577960e$var$handleAndDispatchCustomEvent($5cb92bef7577960e$var$POINTER_DOWN_OUTSIDE, handlePointerDownOutside, eventDetail, {\n discrete: true\n });\n }\n /**\n * On touch devices, we need to wait for a click event because browsers implement\n * a ~350ms delay between the time the user stops touching the display and when the\n * browser executres events. We need to ensure we don't reactivate pointer-events within\n * this timeframe otherwise the browser may execute events that should have been prevented.\n *\n * Additionally, this also lets us deal automatically with cancellations when a click event\n * isn't raised because the page was considered scrolled/drag-scrolled, long-pressed, etc.\n *\n * This is why we also continuously remove the previous listener, because we cannot be\n * certain that it was raised, and therefore cleaned-up.\n */ if (event.pointerType === 'touch') {\n ownerDocument.removeEventListener('click', handleClickRef.current);\n handleClickRef.current = handleAndDispatchPointerDownOutsideEvent;\n ownerDocument.addEventListener('click', handleClickRef.current, {\n once: true\n });\n } else handleAndDispatchPointerDownOutsideEvent();\n } else // We need to remove the event listener in case the outside click has been canceled.\n // See: https://github.com/radix-ui/primitives/issues/2171\n ownerDocument.removeEventListener('click', handleClickRef.current);\n isPointerInsideReactTreeRef.current = false;\n };\n /**\n * if this hook executes in a component that mounts via a `pointerdown` event, the event\n * would bubble up to the document and trigger a `pointerDownOutside` event. We avoid\n * this by delaying the event listener registration on the document.\n * This is not React specific, but rather how the DOM works, ie:\n * ```\n * button.addEventListener('pointerdown', () => {\n * console.log('I will log');\n * document.addEventListener('pointerdown', () => {\n * console.log('I will also log');\n * })\n * });\n */ const timerId = window.setTimeout(()=>{\n ownerDocument.addEventListener('pointerdown', handlePointerDown);\n }, 0);\n return ()=>{\n window.clearTimeout(timerId);\n ownerDocument.removeEventListener('pointerdown', handlePointerDown);\n ownerDocument.removeEventListener('click', handleClickRef.current);\n };\n }, [\n ownerDocument,\n handlePointerDownOutside\n ]);\n return {\n // ensures we check React component tree (not just DOM tree)\n onPointerDownCapture: ()=>isPointerInsideReactTreeRef.current = true\n };\n}\n/**\n * Listens for when focus happens outside a react subtree.\n * Returns props to pass to the root (node) of the subtree we want to check.\n */ function $5cb92bef7577960e$var$useFocusOutside(onFocusOutside, ownerDocument = globalThis === null || globalThis === void 0 ? void 0 : globalThis.document) {\n const handleFocusOutside = $kqwpH$useCallbackRef(onFocusOutside);\n const isFocusInsideReactTreeRef = $kqwpH$useRef(false);\n $kqwpH$useEffect(()=>{\n const handleFocus = (event)=>{\n if (event.target && !isFocusInsideReactTreeRef.current) {\n const eventDetail = {\n originalEvent: event\n };\n $5cb92bef7577960e$var$handleAndDispatchCustomEvent($5cb92bef7577960e$var$FOCUS_OUTSIDE, handleFocusOutside, eventDetail, {\n discrete: false\n });\n }\n };\n ownerDocument.addEventListener('focusin', handleFocus);\n return ()=>ownerDocument.removeEventListener('focusin', handleFocus)\n ;\n }, [\n ownerDocument,\n handleFocusOutside\n ]);\n return {\n onFocusCapture: ()=>isFocusInsideReactTreeRef.current = true\n ,\n onBlurCapture: ()=>isFocusInsideReactTreeRef.current = false\n };\n}\nfunction $5cb92bef7577960e$var$dispatchUpdate() {\n const event = new CustomEvent($5cb92bef7577960e$var$CONTEXT_UPDATE);\n document.dispatchEvent(event);\n}\nfunction $5cb92bef7577960e$var$handleAndDispatchCustomEvent(name, handler, detail, { discrete: discrete }) {\n const target = detail.originalEvent.target;\n const event = new CustomEvent(name, {\n bubbles: false,\n cancelable: true,\n detail: detail\n });\n if (handler) target.addEventListener(name, handler, {\n once: true\n });\n if (discrete) $kqwpH$dispatchDiscreteCustomEvent(target, event);\n else target.dispatchEvent(event);\n}\nconst $5cb92bef7577960e$export$be92b6f5f03c0fe9 = $5cb92bef7577960e$export$177fb62ff3ec1f22;\nconst $5cb92bef7577960e$export$aecb2ddcb55c95be = $5cb92bef7577960e$export$4d5eb2109db14228;\n\n\n\n\nexport {$5cb92bef7577960e$export$177fb62ff3ec1f22 as DismissableLayer, $5cb92bef7577960e$export$4d5eb2109db14228 as DismissableLayerBranch, $5cb92bef7577960e$export$be92b6f5f03c0fe9 as Root, $5cb92bef7577960e$export$aecb2ddcb55c95be as Branch};\n//# sourceMappingURL=index.mjs.map\n"],"names":["$addc16e1bbe58fd0$export$3a72a57244d6e765","onEscapeKeyDownProp","ownerDocument","onEscapeKeyDown","$hPSQ5$useCallbackRef","$hPSQ5$useEffect","handleKeyDown","event","$5cb92bef7577960e$var$CONTEXT_UPDATE","$5cb92bef7577960e$var$POINTER_DOWN_OUTSIDE","$5cb92bef7577960e$var$FOCUS_OUTSIDE","$5cb92bef7577960e$var$originalBodyPointerEvents","$5cb92bef7577960e$var$DismissableLayerContext","$kqwpH$createContext","$5cb92bef7577960e$export$177fb62ff3ec1f22","$kqwpH$forwardRef","props","forwardedRef","_node$ownerDocument","disableOutsidePointerEvents","onPointerDownOutside","onFocusOutside","onInteractOutside","onDismiss","layerProps","context","$kqwpH$useContext","node1","setNode","$kqwpH$useState","force","composedRefs","$kqwpH$useComposedRefs","node","layers","highestLayerWithOutsidePointerEventsDisabled","highestLayerWithOutsidePointerEventsDisabledIndex","index","isBodyPointerEventsDisabled","isPointerEventsEnabled","pointerDownOutside","$5cb92bef7577960e$var$usePointerDownOutside","target","isPointerDownOnBranch","branch","focusOutside","$5cb92bef7577960e$var$useFocusOutside","$kqwpH$useEscapeKeydown","$kqwpH$useEffect","$5cb92bef7577960e$var$dispatchUpdate","handleUpdate","$kqwpH$createElement","$kqwpH$Primitive","$kqwpH$babelruntimehelpersesmextends","$kqwpH$composeEventHandlers","handlePointerDownOutside","$kqwpH$useCallbackRef","isPointerInsideReactTreeRef","$kqwpH$useRef","handleClickRef","handlePointerDown","handleAndDispatchPointerDownOutsideEvent","$5cb92bef7577960e$var$handleAndDispatchCustomEvent","eventDetail","timerId","handleFocusOutside","isFocusInsideReactTreeRef","handleFocus","name","handler","detail","discrete","$kqwpH$dispatchDiscreteCustomEvent"],"mappings":";;;;;AAOI,SAASA,EAA0CC,GAAqBC,IAAwE,YAAW,UAAU;AACrK,QAAMC,IAAkBC,EAAsBH,CAAmB;AACjEI,EAAAA,EAAiB,MAAI;AACjB,UAAMC,IAAgB,CAACC,MAAQ;AAC3B,MAAIA,EAAM,QAAQ,YAAUJ,EAAgBI,CAAK;AAAA,IAC7D;AACQ,WAAAL,EAAc,iBAAiB,WAAWI,CAAa,GAChD,MAAIJ,EAAc,oBAAoB,WAAWI,CAAa;AAAA,EAE7E,GAAO;AAAA,IACCH;AAAA,IACAD;AAAA,EACR,CAAK;AACL;ACFA,MAAMM,IAAuC,2BACvCC,IAA6C,uCAC7CC,IAAsC;AAC5C,IAAIC;AACJ,M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,cAAcnC,CAAK;AACnC;","x_google_ignoreList":[0,1]}
|
|
1
|
+
{"version":3,"file":"index-BvF_j4eL.js","sources":["../../node_modules/@radix-ui/react-use-escape-keydown/dist/index.mjs","../../node_modules/@radix-ui/react-dismissable-layer/dist/index.mjs"],"sourcesContent":["import {useEffect as $hPSQ5$useEffect} from \"react\";\nimport {useCallbackRef as $hPSQ5$useCallbackRef} from \"@radix-ui/react-use-callback-ref\";\n\n\n\n/**\n * Listens for when the escape key is down\n */ function $addc16e1bbe58fd0$export$3a72a57244d6e765(onEscapeKeyDownProp, ownerDocument = globalThis === null || globalThis === void 0 ? void 0 : globalThis.document) {\n const onEscapeKeyDown = $hPSQ5$useCallbackRef(onEscapeKeyDownProp);\n $hPSQ5$useEffect(()=>{\n const handleKeyDown = (event)=>{\n if (event.key === 'Escape') onEscapeKeyDown(event);\n };\n ownerDocument.addEventListener('keydown', handleKeyDown);\n return ()=>ownerDocument.removeEventListener('keydown', handleKeyDown)\n ;\n }, [\n onEscapeKeyDown,\n ownerDocument\n ]);\n}\n\n\n\n\nexport {$addc16e1bbe58fd0$export$3a72a57244d6e765 as useEscapeKeydown};\n//# sourceMappingURL=index.mjs.map\n","import $kqwpH$babelruntimehelpersesmextends from \"@babel/runtime/helpers/esm/extends\";\nimport {createContext as $kqwpH$createContext, forwardRef as $kqwpH$forwardRef, useContext as $kqwpH$useContext, useState as $kqwpH$useState, useEffect as $kqwpH$useEffect, createElement as $kqwpH$createElement, useRef as $kqwpH$useRef} from \"react\";\nimport {composeEventHandlers as $kqwpH$composeEventHandlers} from \"@radix-ui/primitive\";\nimport {Primitive as $kqwpH$Primitive, dispatchDiscreteCustomEvent as $kqwpH$dispatchDiscreteCustomEvent} from \"@radix-ui/react-primitive\";\nimport {useComposedRefs as $kqwpH$useComposedRefs} from \"@radix-ui/react-compose-refs\";\nimport {useCallbackRef as $kqwpH$useCallbackRef} from \"@radix-ui/react-use-callback-ref\";\nimport {useEscapeKeydown as $kqwpH$useEscapeKeydown} from \"@radix-ui/react-use-escape-keydown\";\n\n\n\n\n\n\n\n\n/* -------------------------------------------------------------------------------------------------\n * DismissableLayer\n * -----------------------------------------------------------------------------------------------*/ const $5cb92bef7577960e$var$DISMISSABLE_LAYER_NAME = 'DismissableLayer';\nconst $5cb92bef7577960e$var$CONTEXT_UPDATE = 'dismissableLayer.update';\nconst $5cb92bef7577960e$var$POINTER_DOWN_OUTSIDE = 'dismissableLayer.pointerDownOutside';\nconst $5cb92bef7577960e$var$FOCUS_OUTSIDE = 'dismissableLayer.focusOutside';\nlet $5cb92bef7577960e$var$originalBodyPointerEvents;\nconst $5cb92bef7577960e$var$DismissableLayerContext = /*#__PURE__*/ $kqwpH$createContext({\n layers: new Set(),\n layersWithOutsidePointerEventsDisabled: new Set(),\n branches: new Set()\n});\nconst $5cb92bef7577960e$export$177fb62ff3ec1f22 = /*#__PURE__*/ $kqwpH$forwardRef((props, forwardedRef)=>{\n var _node$ownerDocument;\n const { disableOutsidePointerEvents: disableOutsidePointerEvents = false , onEscapeKeyDown: onEscapeKeyDown , onPointerDownOutside: onPointerDownOutside , onFocusOutside: onFocusOutside , onInteractOutside: onInteractOutside , onDismiss: onDismiss , ...layerProps } = props;\n const context = $kqwpH$useContext($5cb92bef7577960e$var$DismissableLayerContext);\n const [node1, setNode] = $kqwpH$useState(null);\n const ownerDocument = (_node$ownerDocument = node1 === null || node1 === void 0 ? void 0 : node1.ownerDocument) !== null && _node$ownerDocument !== void 0 ? _node$ownerDocument : globalThis === null || globalThis === void 0 ? void 0 : globalThis.document;\n const [, force] = $kqwpH$useState({});\n const composedRefs = $kqwpH$useComposedRefs(forwardedRef, (node)=>setNode(node)\n );\n const layers = Array.from(context.layers);\n const [highestLayerWithOutsidePointerEventsDisabled] = [\n ...context.layersWithOutsidePointerEventsDisabled\n ].slice(-1); // prettier-ignore\n const highestLayerWithOutsidePointerEventsDisabledIndex = layers.indexOf(highestLayerWithOutsidePointerEventsDisabled); // prettier-ignore\n const index = node1 ? layers.indexOf(node1) : -1;\n const isBodyPointerEventsDisabled = context.layersWithOutsidePointerEventsDisabled.size > 0;\n const isPointerEventsEnabled = index >= highestLayerWithOutsidePointerEventsDisabledIndex;\n const pointerDownOutside = $5cb92bef7577960e$var$usePointerDownOutside((event)=>{\n const target = event.target;\n const isPointerDownOnBranch = [\n ...context.branches\n ].some((branch)=>branch.contains(target)\n );\n if (!isPointerEventsEnabled || isPointerDownOnBranch) return;\n onPointerDownOutside === null || onPointerDownOutside === void 0 || onPointerDownOutside(event);\n onInteractOutside === null || onInteractOutside === void 0 || onInteractOutside(event);\n if (!event.defaultPrevented) onDismiss === null || onDismiss === void 0 || onDismiss();\n }, ownerDocument);\n const focusOutside = $5cb92bef7577960e$var$useFocusOutside((event)=>{\n const target = event.target;\n const isFocusInBranch = [\n ...context.branches\n ].some((branch)=>branch.contains(target)\n );\n if (isFocusInBranch) return;\n onFocusOutside === null || onFocusOutside === void 0 || onFocusOutside(event);\n onInteractOutside === null || onInteractOutside === void 0 || onInteractOutside(event);\n if (!event.defaultPrevented) onDismiss === null || onDismiss === void 0 || onDismiss();\n }, ownerDocument);\n $kqwpH$useEscapeKeydown((event)=>{\n const isHighestLayer = index === context.layers.size - 1;\n if (!isHighestLayer) return;\n onEscapeKeyDown === null || onEscapeKeyDown === void 0 || onEscapeKeyDown(event);\n if (!event.defaultPrevented && onDismiss) {\n event.preventDefault();\n onDismiss();\n }\n }, ownerDocument);\n $kqwpH$useEffect(()=>{\n if (!node1) return;\n if (disableOutsidePointerEvents) {\n if (context.layersWithOutsidePointerEventsDisabled.size === 0) {\n $5cb92bef7577960e$var$originalBodyPointerEvents = ownerDocument.body.style.pointerEvents;\n ownerDocument.body.style.pointerEvents = 'none';\n }\n context.layersWithOutsidePointerEventsDisabled.add(node1);\n }\n context.layers.add(node1);\n $5cb92bef7577960e$var$dispatchUpdate();\n return ()=>{\n if (disableOutsidePointerEvents && context.layersWithOutsidePointerEventsDisabled.size === 1) ownerDocument.body.style.pointerEvents = $5cb92bef7577960e$var$originalBodyPointerEvents;\n };\n }, [\n node1,\n ownerDocument,\n disableOutsidePointerEvents,\n context\n ]);\n /**\n * We purposefully prevent combining this effect with the `disableOutsidePointerEvents` effect\n * because a change to `disableOutsidePointerEvents` would remove this layer from the stack\n * and add it to the end again so the layering order wouldn't be _creation order_.\n * We only want them to be removed from context stacks when unmounted.\n */ $kqwpH$useEffect(()=>{\n return ()=>{\n if (!node1) return;\n context.layers.delete(node1);\n context.layersWithOutsidePointerEventsDisabled.delete(node1);\n $5cb92bef7577960e$var$dispatchUpdate();\n };\n }, [\n node1,\n context\n ]);\n $kqwpH$useEffect(()=>{\n const handleUpdate = ()=>force({})\n ;\n document.addEventListener($5cb92bef7577960e$var$CONTEXT_UPDATE, handleUpdate);\n return ()=>document.removeEventListener($5cb92bef7577960e$var$CONTEXT_UPDATE, handleUpdate)\n ;\n }, []);\n return /*#__PURE__*/ $kqwpH$createElement($kqwpH$Primitive.div, $kqwpH$babelruntimehelpersesmextends({}, layerProps, {\n ref: composedRefs,\n style: {\n pointerEvents: isBodyPointerEventsDisabled ? isPointerEventsEnabled ? 'auto' : 'none' : undefined,\n ...props.style\n },\n onFocusCapture: $kqwpH$composeEventHandlers(props.onFocusCapture, focusOutside.onFocusCapture),\n onBlurCapture: $kqwpH$composeEventHandlers(props.onBlurCapture, focusOutside.onBlurCapture),\n onPointerDownCapture: $kqwpH$composeEventHandlers(props.onPointerDownCapture, pointerDownOutside.onPointerDownCapture)\n }));\n});\n/*#__PURE__*/ Object.assign($5cb92bef7577960e$export$177fb62ff3ec1f22, {\n displayName: $5cb92bef7577960e$var$DISMISSABLE_LAYER_NAME\n});\n/* -------------------------------------------------------------------------------------------------\n * DismissableLayerBranch\n * -----------------------------------------------------------------------------------------------*/ const $5cb92bef7577960e$var$BRANCH_NAME = 'DismissableLayerBranch';\nconst $5cb92bef7577960e$export$4d5eb2109db14228 = /*#__PURE__*/ $kqwpH$forwardRef((props, forwardedRef)=>{\n const context = $kqwpH$useContext($5cb92bef7577960e$var$DismissableLayerContext);\n const ref = $kqwpH$useRef(null);\n const composedRefs = $kqwpH$useComposedRefs(forwardedRef, ref);\n $kqwpH$useEffect(()=>{\n const node = ref.current;\n if (node) {\n context.branches.add(node);\n return ()=>{\n context.branches.delete(node);\n };\n }\n }, [\n context.branches\n ]);\n return /*#__PURE__*/ $kqwpH$createElement($kqwpH$Primitive.div, $kqwpH$babelruntimehelpersesmextends({}, props, {\n ref: composedRefs\n }));\n});\n/*#__PURE__*/ Object.assign($5cb92bef7577960e$export$4d5eb2109db14228, {\n displayName: $5cb92bef7577960e$var$BRANCH_NAME\n});\n/* -----------------------------------------------------------------------------------------------*/ /**\n * Listens for `pointerdown` outside a react subtree. We use `pointerdown` rather than `pointerup`\n * to mimic layer dismissing behaviour present in OS.\n * Returns props to pass to the node we want to check for outside events.\n */ function $5cb92bef7577960e$var$usePointerDownOutside(onPointerDownOutside, ownerDocument = globalThis === null || globalThis === void 0 ? void 0 : globalThis.document) {\n const handlePointerDownOutside = $kqwpH$useCallbackRef(onPointerDownOutside);\n const isPointerInsideReactTreeRef = $kqwpH$useRef(false);\n const handleClickRef = $kqwpH$useRef(()=>{});\n $kqwpH$useEffect(()=>{\n const handlePointerDown = (event)=>{\n if (event.target && !isPointerInsideReactTreeRef.current) {\n const eventDetail = {\n originalEvent: event\n };\n function handleAndDispatchPointerDownOutsideEvent() {\n $5cb92bef7577960e$var$handleAndDispatchCustomEvent($5cb92bef7577960e$var$POINTER_DOWN_OUTSIDE, handlePointerDownOutside, eventDetail, {\n discrete: true\n });\n }\n /**\n * On touch devices, we need to wait for a click event because browsers implement\n * a ~350ms delay between the time the user stops touching the display and when the\n * browser executres events. We need to ensure we don't reactivate pointer-events within\n * this timeframe otherwise the browser may execute events that should have been prevented.\n *\n * Additionally, this also lets us deal automatically with cancellations when a click event\n * isn't raised because the page was considered scrolled/drag-scrolled, long-pressed, etc.\n *\n * This is why we also continuously remove the previous listener, because we cannot be\n * certain that it was raised, and therefore cleaned-up.\n */ if (event.pointerType === 'touch') {\n ownerDocument.removeEventListener('click', handleClickRef.current);\n handleClickRef.current = handleAndDispatchPointerDownOutsideEvent;\n ownerDocument.addEventListener('click', handleClickRef.current, {\n once: true\n });\n } else handleAndDispatchPointerDownOutsideEvent();\n } else // We need to remove the event listener in case the outside click has been canceled.\n // See: https://github.com/radix-ui/primitives/issues/2171\n ownerDocument.removeEventListener('click', handleClickRef.current);\n isPointerInsideReactTreeRef.current = false;\n };\n /**\n * if this hook executes in a component that mounts via a `pointerdown` event, the event\n * would bubble up to the document and trigger a `pointerDownOutside` event. We avoid\n * this by delaying the event listener registration on the document.\n * This is not React specific, but rather how the DOM works, ie:\n * ```\n * button.addEventListener('pointerdown', () => {\n * console.log('I will log');\n * document.addEventListener('pointerdown', () => {\n * console.log('I will also log');\n * })\n * });\n */ const timerId = window.setTimeout(()=>{\n ownerDocument.addEventListener('pointerdown', handlePointerDown);\n }, 0);\n return ()=>{\n window.clearTimeout(timerId);\n ownerDocument.removeEventListener('pointerdown', handlePointerDown);\n ownerDocument.removeEventListener('click', handleClickRef.current);\n };\n }, [\n ownerDocument,\n handlePointerDownOutside\n ]);\n return {\n // ensures we check React component tree (not just DOM tree)\n onPointerDownCapture: ()=>isPointerInsideReactTreeRef.current = true\n };\n}\n/**\n * Listens for when focus happens outside a react subtree.\n * Returns props to pass to the root (node) of the subtree we want to check.\n */ function $5cb92bef7577960e$var$useFocusOutside(onFocusOutside, ownerDocument = globalThis === null || globalThis === void 0 ? void 0 : globalThis.document) {\n const handleFocusOutside = $kqwpH$useCallbackRef(onFocusOutside);\n const isFocusInsideReactTreeRef = $kqwpH$useRef(false);\n $kqwpH$useEffect(()=>{\n const handleFocus = (event)=>{\n if (event.target && !isFocusInsideReactTreeRef.current) {\n const eventDetail = {\n originalEvent: event\n };\n $5cb92bef7577960e$var$handleAndDispatchCustomEvent($5cb92bef7577960e$var$FOCUS_OUTSIDE, handleFocusOutside, eventDetail, {\n discrete: false\n });\n }\n };\n ownerDocument.addEventListener('focusin', handleFocus);\n return ()=>ownerDocument.removeEventListener('focusin', handleFocus)\n ;\n }, [\n ownerDocument,\n handleFocusOutside\n ]);\n return {\n onFocusCapture: ()=>isFocusInsideReactTreeRef.current = true\n ,\n onBlurCapture: ()=>isFocusInsideReactTreeRef.current = false\n };\n}\nfunction $5cb92bef7577960e$var$dispatchUpdate() {\n const event = new CustomEvent($5cb92bef7577960e$var$CONTEXT_UPDATE);\n document.dispatchEvent(event);\n}\nfunction $5cb92bef7577960e$var$handleAndDispatchCustomEvent(name, handler, detail, { discrete: discrete }) {\n const target = detail.originalEvent.target;\n const event = new CustomEvent(name, {\n bubbles: false,\n cancelable: true,\n detail: detail\n });\n if (handler) target.addEventListener(name, handler, {\n once: true\n });\n if (discrete) $kqwpH$dispatchDiscreteCustomEvent(target, event);\n else target.dispatchEvent(event);\n}\nconst $5cb92bef7577960e$export$be92b6f5f03c0fe9 = $5cb92bef7577960e$export$177fb62ff3ec1f22;\nconst $5cb92bef7577960e$export$aecb2ddcb55c95be = $5cb92bef7577960e$export$4d5eb2109db14228;\n\n\n\n\nexport {$5cb92bef7577960e$export$177fb62ff3ec1f22 as DismissableLayer, $5cb92bef7577960e$export$4d5eb2109db14228 as DismissableLayerBranch, $5cb92bef7577960e$export$be92b6f5f03c0fe9 as Root, $5cb92bef7577960e$export$aecb2ddcb55c95be as Branch};\n//# sourceMappingURL=index.mjs.map\n"],"names":["$addc16e1bbe58fd0$export$3a72a57244d6e765","onEscapeKeyDownProp","ownerDocument","onEscapeKeyDown","$hPSQ5$useCallbackRef","$hPSQ5$useEffect","handleKeyDown","event","$5cb92bef7577960e$var$CONTEXT_UPDATE","$5cb92bef7577960e$var$POINTER_DOWN_OUTSIDE","$5cb92bef7577960e$var$FOCUS_OUTSIDE","$5cb92bef7577960e$var$originalBodyPointerEvents","$5cb92bef7577960e$var$DismissableLayerContext","$kqwpH$createContext","$5cb92bef7577960e$export$177fb62ff3ec1f22","$kqwpH$forwardRef","props","forwardedRef","_node$ownerDocument","disableOutsidePointerEvents","onPointerDownOutside","onFocusOutside","onInteractOutside","onDismiss","layerProps","context","$kqwpH$useContext","node1","setNode","$kqwpH$useState","force","composedRefs","$kqwpH$useComposedRefs","node","layers","highestLayerWithOutsidePointerEventsDisabled","highestLayerWithOutsidePointerEventsDisabledIndex","index","isBodyPointerEventsDisabled","isPointerEventsEnabled","pointerDownOutside","$5cb92bef7577960e$var$usePointerDownOutside","target","isPointerDownOnBranch","branch","focusOutside","$5cb92bef7577960e$var$useFocusOutside","$kqwpH$useEscapeKeydown","$kqwpH$useEffect","$5cb92bef7577960e$var$dispatchUpdate","handleUpdate","$kqwpH$createElement","$kqwpH$Primitive","$kqwpH$babelruntimehelpersesmextends","$kqwpH$composeEventHandlers","handlePointerDownOutside","$kqwpH$useCallbackRef","isPointerInsideReactTreeRef","$kqwpH$useRef","handleClickRef","handlePointerDown","handleAndDispatchPointerDownOutsideEvent","$5cb92bef7577960e$var$handleAndDispatchCustomEvent","eventDetail","timerId","handleFocusOutside","isFocusInsideReactTreeRef","handleFocus","name","handler","detail","discrete","$kqwpH$dispatchDiscreteCustomEvent"],"mappings":";;;;;AAOI,SAASA,EAA0CC,GAAqBC,IAAwE,YAAW,UAAU;AACrK,QAAMC,IAAkBC,EAAsBH,CAAmB;AACjEI,EAAAA,EAAiB,MAAI;AACjB,UAAMC,IAAgB,CAACC,MAAQ;AAC3B,MAAIA,EAAM,QAAQ,YAAUJ,EAAgBI,CAAK;AAAA,IAC7D;AACQ,WAAAL,EAAc,iBAAiB,WAAWI,CAAa,GAChD,MAAIJ,EAAc,oBAAoB,WAAWI,CAAa;AAAA,EAE7E,GAAO;AAAA,IACCH;AAAA,IACAD;AAAA,EACR,CAAK;AACL;ACFA,MAAMM,IAAuC,2BACvCC,IAA6C,uCAC7CC,IAAsC;AAC5C,IAAIC;AACJ,MAAMC,IAA8DC,gBAAAA,EAAqB;AAAA,EACrF,QAAQ,oBAAI,I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+1,41 @@
|
|
|
1
1
|
import { _ as C, $ as z } from "./index-CM4_Y0D3.js";
|
|
2
2
|
import { forwardRef as A, createElement as b, useRef as G, useState as y, useEffect as O, useCallback as v } from "react";
|
|
3
|
-
import { $ as H, a as
|
|
4
|
-
import { $ as
|
|
5
|
-
import { $ as
|
|
3
|
+
import { $ as H, a as $ } from "./index-0xSCJjjg.js";
|
|
4
|
+
import { $ as j, a as q } from "./index-C0aYvuS4.js";
|
|
5
|
+
import { $ as J, a as Q } from "./index-C5wtLq4-.js";
|
|
6
|
+
import { $ as W } from "./index-BAKhqUxp.js";
|
|
6
7
|
import { $ as N } from "./index-B6k0B0Dk.js";
|
|
7
8
|
const _ = "rovingFocusGroup.onEntryFocus", X = {
|
|
8
9
|
bubbles: !1,
|
|
9
10
|
cancelable: !0
|
|
10
|
-
}, h = "RovingFocusGroup", [S, M, Z] =
|
|
11
|
+
}, h = "RovingFocusGroup", [S, M, Z] = j(h), [ee, Fe] = J(h, [
|
|
11
12
|
Z
|
|
12
|
-
]), [oe, te] = ee(h),
|
|
13
|
+
]), [oe, te] = ee(h), re = /* @__PURE__ */ A((e, o) => /* @__PURE__ */ b(S.Provider, {
|
|
13
14
|
scope: e.__scopeRovingFocusGroup
|
|
14
15
|
}, /* @__PURE__ */ b(S.Slot, {
|
|
15
16
|
scope: e.__scopeRovingFocusGroup
|
|
16
|
-
}, /* @__PURE__ */ b(
|
|
17
|
+
}, /* @__PURE__ */ b(ne, C({}, e, {
|
|
17
18
|
ref: o
|
|
18
|
-
}))))),
|
|
19
|
-
const { __scopeRovingFocusGroup:
|
|
19
|
+
}))))), ne = /* @__PURE__ */ A((e, o) => {
|
|
20
|
+
const { __scopeRovingFocusGroup: n, orientation: t, loop: I = !1, dir: F, currentTabStopId: g, defaultCurrentTabStopId: T, onCurrentTabStopIdChange: i, onEntryFocus: f, ...E } = e, l = G(null), p = z(o, l), m = q(F), [c = null, d] = H({
|
|
20
21
|
prop: g,
|
|
21
22
|
defaultProp: T,
|
|
22
23
|
onChange: i
|
|
23
|
-
}), [x, s] = y(!1), a =
|
|
24
|
+
}), [x, s] = y(!1), a = Q(f), U = M(n), R = G(!1), [K, D] = y(0);
|
|
24
25
|
return O(() => {
|
|
25
|
-
const
|
|
26
|
-
if (
|
|
27
|
-
return
|
|
26
|
+
const r = l.current;
|
|
27
|
+
if (r)
|
|
28
|
+
return r.addEventListener(_, a), () => r.removeEventListener(_, a);
|
|
28
29
|
}, [
|
|
29
30
|
a
|
|
30
31
|
]), /* @__PURE__ */ b(oe, {
|
|
31
|
-
scope:
|
|
32
|
+
scope: n,
|
|
32
33
|
orientation: t,
|
|
33
34
|
dir: m,
|
|
34
35
|
loop: I,
|
|
35
36
|
currentTabStopId: c,
|
|
36
37
|
onItemFocus: v(
|
|
37
|
-
(
|
|
38
|
+
(r) => d(r),
|
|
38
39
|
[
|
|
39
40
|
d
|
|
40
41
|
]
|
|
@@ -45,13 +46,13 @@ const _ = "rovingFocusGroup.onEntryFocus", X = {
|
|
|
45
46
|
),
|
|
46
47
|
onFocusableItemAdd: v(
|
|
47
48
|
() => D(
|
|
48
|
-
(
|
|
49
|
+
(r) => r + 1
|
|
49
50
|
),
|
|
50
51
|
[]
|
|
51
52
|
),
|
|
52
53
|
onFocusableItemRemove: v(
|
|
53
54
|
() => D(
|
|
54
|
-
(
|
|
55
|
+
(r) => r - 1
|
|
55
56
|
),
|
|
56
57
|
[]
|
|
57
58
|
)
|
|
@@ -67,11 +68,11 @@ const _ = "rovingFocusGroup.onEntryFocus", X = {
|
|
|
67
68
|
onMouseDown: $(e.onMouseDown, () => {
|
|
68
69
|
R.current = !0;
|
|
69
70
|
}),
|
|
70
|
-
onFocus: $(e.onFocus, (
|
|
71
|
+
onFocus: $(e.onFocus, (r) => {
|
|
71
72
|
const B = !R.current;
|
|
72
|
-
if (
|
|
73
|
+
if (r.target === r.currentTarget && B && !x) {
|
|
73
74
|
const P = new CustomEvent(_, X);
|
|
74
|
-
if (
|
|
75
|
+
if (r.currentTarget.dispatchEvent(P), !P.defaultPrevented) {
|
|
75
76
|
const w = U().filter(
|
|
76
77
|
(u) => u.focusable
|
|
77
78
|
), k = w.find(
|
|
@@ -96,7 +97,7 @@ const _ = "rovingFocusGroup.onEntryFocus", X = {
|
|
|
96
97
|
)
|
|
97
98
|
})));
|
|
98
99
|
}), ce = "RovingFocusGroupItem", fe = /* @__PURE__ */ A((e, o) => {
|
|
99
|
-
const { __scopeRovingFocusGroup:
|
|
100
|
+
const { __scopeRovingFocusGroup: n, focusable: t = !0, active: I = !1, tabStopId: F, ...g } = e, T = W(), i = F || T, f = te(ce, n), E = f.currentTabStopId === i, l = M(n), { onFocusableItemAdd: p, onFocusableItemRemove: m } = f;
|
|
100
101
|
return O(() => {
|
|
101
102
|
if (t)
|
|
102
103
|
return p(), () => m();
|
|
@@ -105,7 +106,7 @@ const _ = "rovingFocusGroup.onEntryFocus", X = {
|
|
|
105
106
|
p,
|
|
106
107
|
m
|
|
107
108
|
]), /* @__PURE__ */ b(S.ItemSlot, {
|
|
108
|
-
scope:
|
|
109
|
+
scope: n,
|
|
109
110
|
id: i,
|
|
110
111
|
focusable: t,
|
|
111
112
|
active: I
|
|
@@ -162,8 +163,8 @@ const _ = "rovingFocusGroup.onEntryFocus", X = {
|
|
|
162
163
|
function ae(e, o) {
|
|
163
164
|
return o !== "rtl" ? e : e === "ArrowLeft" ? "ArrowRight" : e === "ArrowRight" ? "ArrowLeft" : e;
|
|
164
165
|
}
|
|
165
|
-
function de(e, o,
|
|
166
|
-
const t = ae(e.key,
|
|
166
|
+
function de(e, o, n) {
|
|
167
|
+
const t = ae(e.key, n);
|
|
167
168
|
if (!(o === "vertical" && [
|
|
168
169
|
"ArrowLeft",
|
|
169
170
|
"ArrowRight"
|
|
@@ -175,19 +176,19 @@ function de(e, o, r) {
|
|
|
175
176
|
}
|
|
176
177
|
function L(e) {
|
|
177
178
|
const o = document.activeElement;
|
|
178
|
-
for (const
|
|
179
|
-
if (
|
|
179
|
+
for (const n of e)
|
|
180
|
+
if (n === o || (n.focus(), document.activeElement !== o))
|
|
180
181
|
return;
|
|
181
182
|
}
|
|
182
183
|
function ue(e, o) {
|
|
183
184
|
return e.map(
|
|
184
|
-
(
|
|
185
|
+
(n, t) => e[(o + t) % e.length]
|
|
185
186
|
);
|
|
186
187
|
}
|
|
187
|
-
const
|
|
188
|
+
const ge = re, Te = fe;
|
|
188
189
|
export {
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
190
|
+
Fe as $,
|
|
191
|
+
ge as a,
|
|
192
|
+
Te as b
|
|
192
193
|
};
|
|
193
|
-
//# sourceMappingURL=index-
|
|
194
|
+
//# sourceMappingURL=index-DUkGJrHr.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-BfOl1omc.js","sources":["../../node_modules/@radix-ui/react-roving-focus/dist/index.mjs"],"sourcesContent":["import $98Iye$babelruntimehelpersesmextends from \"@babel/runtime/helpers/esm/extends\";\nimport {forwardRef as $98Iye$forwardRef, createElement as $98Iye$createElement, useRef as $98Iye$useRef, useState as $98Iye$useState, useEffect as $98Iye$useEffect, useCallback as $98Iye$useCallback} from \"react\";\nimport {composeEventHandlers as $98Iye$composeEventHandlers} from \"@radix-ui/primitive\";\nimport {createCollection as $98Iye$createCollection} from \"@radix-ui/react-collection\";\nimport {useComposedRefs as $98Iye$useComposedRefs} from \"@radix-ui/react-compose-refs\";\nimport {createContextScope as $98Iye$createContextScope} from \"@radix-ui/react-context\";\nimport {useId as $98Iye$useId} from \"@radix-ui/react-id\";\nimport {Primitive as $98Iye$Primitive} from \"@radix-ui/react-primitive\";\nimport {useCallbackRef as $98Iye$useCallbackRef} from \"@radix-ui/react-use-callback-ref\";\nimport {useControllableState as $98Iye$useControllableState} from \"@radix-ui/react-use-controllable-state\";\nimport {useDirection as $98Iye$useDirection} from \"@radix-ui/react-direction\";\n\n\n\n\n\n\n\n\n\n\n\n\nconst $d7bdfb9eb0fdf311$var$ENTRY_FOCUS = 'rovingFocusGroup.onEntryFocus';\nconst $d7bdfb9eb0fdf311$var$EVENT_OPTIONS = {\n bubbles: false,\n cancelable: true\n};\n/* -------------------------------------------------------------------------------------------------\n * RovingFocusGroup\n * -----------------------------------------------------------------------------------------------*/ const $d7bdfb9eb0fdf311$var$GROUP_NAME = 'RovingFocusGroup';\nconst [$d7bdfb9eb0fdf311$var$Collection, $d7bdfb9eb0fdf311$var$useCollection, $d7bdfb9eb0fdf311$var$createCollectionScope] = $98Iye$createCollection($d7bdfb9eb0fdf311$var$GROUP_NAME);\nconst [$d7bdfb9eb0fdf311$var$createRovingFocusGroupContext, $d7bdfb9eb0fdf311$export$c7109489551a4f4] = $98Iye$createContextScope($d7bdfb9eb0fdf311$var$GROUP_NAME, [\n $d7bdfb9eb0fdf311$var$createCollectionScope\n]);\nconst [$d7bdfb9eb0fdf311$var$RovingFocusProvider, $d7bdfb9eb0fdf311$var$useRovingFocusContext] = $d7bdfb9eb0fdf311$var$createRovingFocusGroupContext($d7bdfb9eb0fdf311$var$GROUP_NAME);\nconst $d7bdfb9eb0fdf311$export$8699f7c8af148338 = /*#__PURE__*/ $98Iye$forwardRef((props, forwardedRef)=>{\n return /*#__PURE__*/ $98Iye$createElement($d7bdfb9eb0fdf311$var$Collection.Provider, {\n scope: props.__scopeRovingFocusGroup\n }, /*#__PURE__*/ $98Iye$createElement($d7bdfb9eb0fdf311$var$Collection.Slot, {\n scope: props.__scopeRovingFocusGroup\n }, /*#__PURE__*/ $98Iye$createElement($d7bdfb9eb0fdf311$var$RovingFocusGroupImpl, $98Iye$babelruntimehelpersesmextends({}, props, {\n ref: forwardedRef\n }))));\n});\n/*#__PURE__*/ Object.assign($d7bdfb9eb0fdf311$export$8699f7c8af148338, {\n displayName: $d7bdfb9eb0fdf311$var$GROUP_NAME\n});\n/* -----------------------------------------------------------------------------------------------*/ const $d7bdfb9eb0fdf311$var$RovingFocusGroupImpl = /*#__PURE__*/ $98Iye$forwardRef((props, forwardedRef)=>{\n const { __scopeRovingFocusGroup: __scopeRovingFocusGroup , orientation: orientation , loop: loop = false , dir: dir , currentTabStopId: currentTabStopIdProp , defaultCurrentTabStopId: defaultCurrentTabStopId , onCurrentTabStopIdChange: onCurrentTabStopIdChange , onEntryFocus: onEntryFocus , ...groupProps } = props;\n const ref = $98Iye$useRef(null);\n const composedRefs = $98Iye$useComposedRefs(forwardedRef, ref);\n const direction = $98Iye$useDirection(dir);\n const [currentTabStopId = null, setCurrentTabStopId] = $98Iye$useControllableState({\n prop: currentTabStopIdProp,\n defaultProp: defaultCurrentTabStopId,\n onChange: onCurrentTabStopIdChange\n });\n const [isTabbingBackOut, setIsTabbingBackOut] = $98Iye$useState(false);\n const handleEntryFocus = $98Iye$useCallbackRef(onEntryFocus);\n const getItems = $d7bdfb9eb0fdf311$var$useCollection(__scopeRovingFocusGroup);\n const isClickFocusRef = $98Iye$useRef(false);\n const [focusableItemsCount, setFocusableItemsCount] = $98Iye$useState(0);\n $98Iye$useEffect(()=>{\n const node = ref.current;\n if (node) {\n node.addEventListener($d7bdfb9eb0fdf311$var$ENTRY_FOCUS, handleEntryFocus);\n return ()=>node.removeEventListener($d7bdfb9eb0fdf311$var$ENTRY_FOCUS, handleEntryFocus)\n ;\n }\n }, [\n handleEntryFocus\n ]);\n return /*#__PURE__*/ $98Iye$createElement($d7bdfb9eb0fdf311$var$RovingFocusProvider, {\n scope: __scopeRovingFocusGroup,\n orientation: orientation,\n dir: direction,\n loop: loop,\n currentTabStopId: currentTabStopId,\n onItemFocus: $98Iye$useCallback((tabStopId)=>setCurrentTabStopId(tabStopId)\n , [\n setCurrentTabStopId\n ]),\n onItemShiftTab: $98Iye$useCallback(()=>setIsTabbingBackOut(true)\n , []),\n onFocusableItemAdd: $98Iye$useCallback(()=>setFocusableItemsCount((prevCount)=>prevCount + 1\n )\n , []),\n onFocusableItemRemove: $98Iye$useCallback(()=>setFocusableItemsCount((prevCount)=>prevCount - 1\n )\n , [])\n }, /*#__PURE__*/ $98Iye$createElement($98Iye$Primitive.div, $98Iye$babelruntimehelpersesmextends({\n tabIndex: isTabbingBackOut || focusableItemsCount === 0 ? -1 : 0,\n \"data-orientation\": orientation\n }, groupProps, {\n ref: composedRefs,\n style: {\n outline: 'none',\n ...props.style\n },\n onMouseDown: $98Iye$composeEventHandlers(props.onMouseDown, ()=>{\n isClickFocusRef.current = true;\n }),\n onFocus: $98Iye$composeEventHandlers(props.onFocus, (event)=>{\n // We normally wouldn't need this check, because we already check\n // that the focus is on the current target and not bubbling to it.\n // We do this because Safari doesn't focus buttons when clicked, and\n // instead, the wrapper will get focused and not through a bubbling event.\n const isKeyboardFocus = !isClickFocusRef.current;\n if (event.target === event.currentTarget && isKeyboardFocus && !isTabbingBackOut) {\n const entryFocusEvent = new CustomEvent($d7bdfb9eb0fdf311$var$ENTRY_FOCUS, $d7bdfb9eb0fdf311$var$EVENT_OPTIONS);\n event.currentTarget.dispatchEvent(entryFocusEvent);\n if (!entryFocusEvent.defaultPrevented) {\n const items = getItems().filter((item)=>item.focusable\n );\n const activeItem = items.find((item)=>item.active\n );\n const currentItem = items.find((item)=>item.id === currentTabStopId\n );\n const candidateItems = [\n activeItem,\n currentItem,\n ...items\n ].filter(Boolean);\n const candidateNodes = candidateItems.map((item)=>item.ref.current\n );\n $d7bdfb9eb0fdf311$var$focusFirst(candidateNodes);\n }\n }\n isClickFocusRef.current = false;\n }),\n onBlur: $98Iye$composeEventHandlers(props.onBlur, ()=>setIsTabbingBackOut(false)\n )\n })));\n});\n/* -------------------------------------------------------------------------------------------------\n * RovingFocusGroupItem\n * -----------------------------------------------------------------------------------------------*/ const $d7bdfb9eb0fdf311$var$ITEM_NAME = 'RovingFocusGroupItem';\nconst $d7bdfb9eb0fdf311$export$ab9df7c53fe8454 = /*#__PURE__*/ $98Iye$forwardRef((props, forwardedRef)=>{\n const { __scopeRovingFocusGroup: __scopeRovingFocusGroup , focusable: focusable = true , active: active = false , tabStopId: tabStopId , ...itemProps } = props;\n const autoId = $98Iye$useId();\n const id = tabStopId || autoId;\n const context = $d7bdfb9eb0fdf311$var$useRovingFocusContext($d7bdfb9eb0fdf311$var$ITEM_NAME, __scopeRovingFocusGroup);\n const isCurrentTabStop = context.currentTabStopId === id;\n const getItems = $d7bdfb9eb0fdf311$var$useCollection(__scopeRovingFocusGroup);\n const { onFocusableItemAdd: onFocusableItemAdd , onFocusableItemRemove: onFocusableItemRemove } = context;\n $98Iye$useEffect(()=>{\n if (focusable) {\n onFocusableItemAdd();\n return ()=>onFocusableItemRemove()\n ;\n }\n }, [\n focusable,\n onFocusableItemAdd,\n onFocusableItemRemove\n ]);\n return /*#__PURE__*/ $98Iye$createElement($d7bdfb9eb0fdf311$var$Collection.ItemSlot, {\n scope: __scopeRovingFocusGroup,\n id: id,\n focusable: focusable,\n active: active\n }, /*#__PURE__*/ $98Iye$createElement($98Iye$Primitive.span, $98Iye$babelruntimehelpersesmextends({\n tabIndex: isCurrentTabStop ? 0 : -1,\n \"data-orientation\": context.orientation\n }, itemProps, {\n ref: forwardedRef,\n onMouseDown: $98Iye$composeEventHandlers(props.onMouseDown, (event)=>{\n // We prevent focusing non-focusable items on `mousedown`.\n // Even though the item has tabIndex={-1}, that only means take it out of the tab order.\n if (!focusable) event.preventDefault(); // Safari doesn't focus a button when clicked so we run our logic on mousedown also\n else context.onItemFocus(id);\n }),\n onFocus: $98Iye$composeEventHandlers(props.onFocus, ()=>context.onItemFocus(id)\n ),\n onKeyDown: $98Iye$composeEventHandlers(props.onKeyDown, (event)=>{\n if (event.key === 'Tab' && event.shiftKey) {\n context.onItemShiftTab();\n return;\n }\n if (event.target !== event.currentTarget) return;\n const focusIntent = $d7bdfb9eb0fdf311$var$getFocusIntent(event, context.orientation, context.dir);\n if (focusIntent !== undefined) {\n event.preventDefault();\n const items = getItems().filter((item)=>item.focusable\n );\n let candidateNodes = items.map((item)=>item.ref.current\n );\n if (focusIntent === 'last') candidateNodes.reverse();\n else if (focusIntent === 'prev' || focusIntent === 'next') {\n if (focusIntent === 'prev') candidateNodes.reverse();\n const currentIndex = candidateNodes.indexOf(event.currentTarget);\n candidateNodes = context.loop ? $d7bdfb9eb0fdf311$var$wrapArray(candidateNodes, currentIndex + 1) : candidateNodes.slice(currentIndex + 1);\n }\n /**\n * Imperative focus during keydown is risky so we prevent React's batching updates\n * to avoid potential bugs. See: https://github.com/facebook/react/issues/20332\n */ setTimeout(()=>$d7bdfb9eb0fdf311$var$focusFirst(candidateNodes)\n );\n }\n })\n })));\n});\n/*#__PURE__*/ Object.assign($d7bdfb9eb0fdf311$export$ab9df7c53fe8454, {\n displayName: $d7bdfb9eb0fdf311$var$ITEM_NAME\n});\n/* -----------------------------------------------------------------------------------------------*/ // prettier-ignore\nconst $d7bdfb9eb0fdf311$var$MAP_KEY_TO_FOCUS_INTENT = {\n ArrowLeft: 'prev',\n ArrowUp: 'prev',\n ArrowRight: 'next',\n ArrowDown: 'next',\n PageUp: 'first',\n Home: 'first',\n PageDown: 'last',\n End: 'last'\n};\nfunction $d7bdfb9eb0fdf311$var$getDirectionAwareKey(key, dir) {\n if (dir !== 'rtl') return key;\n return key === 'ArrowLeft' ? 'ArrowRight' : key === 'ArrowRight' ? 'ArrowLeft' : key;\n}\nfunction $d7bdfb9eb0fdf311$var$getFocusIntent(event, orientation, dir) {\n const key = $d7bdfb9eb0fdf311$var$getDirectionAwareKey(event.key, dir);\n if (orientation === 'vertical' && [\n 'ArrowLeft',\n 'ArrowRight'\n ].includes(key)) return undefined;\n if (orientation === 'horizontal' && [\n 'ArrowUp',\n 'ArrowDown'\n ].includes(key)) return undefined;\n return $d7bdfb9eb0fdf311$var$MAP_KEY_TO_FOCUS_INTENT[key];\n}\nfunction $d7bdfb9eb0fdf311$var$focusFirst(candidates) {\n const PREVIOUSLY_FOCUSED_ELEMENT = document.activeElement;\n for (const candidate of candidates){\n // if focus is already where we want to go, we don't want to keep going through the candidates\n if (candidate === PREVIOUSLY_FOCUSED_ELEMENT) return;\n candidate.focus();\n if (document.activeElement !== PREVIOUSLY_FOCUSED_ELEMENT) return;\n }\n}\n/**\n * Wraps an array around itself at a given start index\n * Example: `wrapArray(['a', 'b', 'c', 'd'], 2) === ['c', 'd', 'a', 'b']`\n */ function $d7bdfb9eb0fdf311$var$wrapArray(array, startIndex) {\n return array.map((_, index)=>array[(startIndex + index) % array.length]\n );\n}\nconst $d7bdfb9eb0fdf311$export$be92b6f5f03c0fe9 = $d7bdfb9eb0fdf311$export$8699f7c8af148338;\nconst $d7bdfb9eb0fdf311$export$6d08773d2e66f8f2 = $d7bdfb9eb0fdf311$export$ab9df7c53fe8454;\n\n\n\n\nexport {$d7bdfb9eb0fdf311$export$c7109489551a4f4 as createRovingFocusGroupScope, $d7bdfb9eb0fdf311$export$8699f7c8af148338 as RovingFocusGroup, $d7bdfb9eb0fdf311$export$ab9df7c53fe8454 as RovingFocusGroupItem, $d7bdfb9eb0fdf311$export$be92b6f5f03c0fe9 as Root, $d7bdfb9eb0fdf311$export$6d08773d2e66f8f2 as Item};\n//# sourceMappingURL=index.mjs.map\n"],"names":["$d7bdfb9eb0fdf311$var$ENTRY_FOCUS","$d7bdfb9eb0fdf311$var$EVENT_OPTIONS","$d7bdfb9eb0fdf311$var$GROUP_NAME","$d7bdfb9eb0fdf311$var$Collection","$d7bdfb9eb0fdf311$var$useCollection","$d7bdfb9eb0fdf311$var$createCollectionScope","$98Iye$createCollection","$d7bdfb9eb0fdf311$var$createRovingFocusGroupContext","$d7bdfb9eb0fdf311$export$c7109489551a4f4","$98Iye$createContextScope","$d7bdfb9eb0fdf311$var$RovingFocusProvider","$d7bdfb9eb0fdf311$var$useRovingFocusContext","$d7bdfb9eb0fdf311$export$8699f7c8af148338","$98Iye$forwardRef","props","forwardedRef","$98Iye$createElement","$d7bdfb9eb0fdf311$var$RovingFocusGroupImpl","$98Iye$babelruntimehelpersesmextends","__scopeRovingFocusGroup","orientation","loop","dir","currentTabStopIdProp","defaultCurrentTabStopId","onCurrentTabStopIdChange","onEntryFocus","groupProps","ref","$98Iye$useRef","composedRefs","$98Iye$useComposedRefs","direction","$98Iye$useDirection","currentTabStopId","setCurrentTabStopId","$98Iye$useControllableState","isTabbingBackOut","setIsTabbingBackOut","$98Iye$useState","handleEntryFocus","$98Iye$useCallbackRef","getItems","isClickFocusRef","focusableItemsCount","setFocusableItemsCount","$98Iye$useEffect","node","$98Iye$useCallback","tabStopId","prevCount","$98Iye$Primitive","$98Iye$composeEventHandlers","event","isKeyboardFocus","entryFocusEvent","items","item","activeItem","currentItem","candidateNodes","$d7bdfb9eb0fdf311$var$focusFirst","$d7bdfb9eb0fdf311$var$ITEM_NAME","$d7bdfb9eb0fdf311$export$ab9df7c53fe8454","focusable","active","itemProps","autoId","$98Iye$useId","id","context","isCurrentTabStop","onFocusableItemAdd","onFocusableItemRemove","focusIntent","$d7bdfb9eb0fdf311$var$getFocusIntent","currentIndex","$d7bdfb9eb0fdf311$var$wrapArray","$d7bdfb9eb0fdf311$var$MAP_KEY_TO_FOCUS_INTENT","$d7bdfb9eb0fdf311$var$getDirectionAwareKey","key","candidates","PREVIOUSLY_FOCUSED_ELEMENT","candidate","array","startIndex","_","index","$d7bdfb9eb0fdf311$export$be92b6f5f03c0fe9","$d7bdfb9eb0fdf311$export$6d08773d2e66f8f2"],"mappings":";;;;;;AAuBA,MAAMA,IAAoC,iCACpCC,IAAsC;AAAA,EACxC,SAAS;AAAA,EACT,YAAY;AAChB,GAG2GC,IAAmC,oBACxI,CAACC,GAAkCC,GAAqCC,CAA2C,IAAIC,EAAwBJ,CAAgC,GAC/K,CAACK,IAAqDC,EAAwC,IAAIC,EAA0BP,GAAkC;AAAA,EAChKG;AACJ,CAAC,GACK,CAACK,IAA2CC,EAA2C,IAAIJ,GAAoDL,CAAgC,GAC/KU,KAA0DC,gBAAAA,EAAkB,CAACC,GAAOC,MACjEC,gBAAAA,EAAqBb,EAAiC,UAAU;AAAA,EACjF,OAAOW,EAAM;AACrB,GAAqBE,gBAAAA,EAAqBb,EAAiC,MAAM;AAAA,EACz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A2C1B,EAAM,KAAK/B,CAAG;AACrE,MAAI,EAAAF,MAAgB,cAAc;AAAA,IAC9B;AAAA,IACA;AAAA,EACH,EAAC,SAAS4D,CAAG,MACV,EAAA5D,MAAgB,gBAAgB;AAAA,IAChC;AAAA,IACA;AAAA,EACH,EAAC,SAAS4D,CAAG;AACd,WAAOF,GAA8CE,CAAG;AAC5D;AACA,SAASnB,EAAiCoB,GAAY;AAClD,QAAMC,IAA6B,SAAS;AAC5C,aAAWC,KAAaF;AAIpB,QAFIE,MAAcD,MAClBC,EAAU,MAAK,GACX,SAAS,kBAAkBD;AAA4B;AAEnE;AAII,SAASL,GAAgCO,GAAOC,GAAY;AAC5D,SAAOD,EAAM;AAAA,IAAI,CAACE,GAAGC,MAAQH,GAAOC,IAAaE,KAASH,EAAM,MAAM;AAAA,EAC1E;AACA;AACK,MAACI,KAA4C5E,IAC5C6E,KAA4C1B;","x_google_ignoreList":[0]}
|
|
1
|
+
{"version":3,"file":"index-DUkGJrHr.js","sources":["../../node_modules/@radix-ui/react-roving-focus/dist/index.mjs"],"sourcesContent":["import $98Iye$babelruntimehelpersesmextends from \"@babel/runtime/helpers/esm/extends\";\nimport {forwardRef as $98Iye$forwardRef, createElement as $98Iye$createElement, useRef as $98Iye$useRef, useState as $98Iye$useState, useEffect as $98Iye$useEffect, useCallback as $98Iye$useCallback} from \"react\";\nimport {composeEventHandlers as $98Iye$composeEventHandlers} from \"@radix-ui/primitive\";\nimport {createCollection as $98Iye$createCollection} from \"@radix-ui/react-collection\";\nimport {useComposedRefs as $98Iye$useComposedRefs} from \"@radix-ui/react-compose-refs\";\nimport {createContextScope as $98Iye$createContextScope} from \"@radix-ui/react-context\";\nimport {useId as $98Iye$useId} from \"@radix-ui/react-id\";\nimport {Primitive as $98Iye$Primitive} from \"@radix-ui/react-primitive\";\nimport {useCallbackRef as $98Iye$useCallbackRef} from \"@radix-ui/react-use-callback-ref\";\nimport {useControllableState as $98Iye$useControllableState} from \"@radix-ui/react-use-controllable-state\";\nimport {useDirection as $98Iye$useDirection} from \"@radix-ui/react-direction\";\n\n\n\n\n\n\n\n\n\n\n\n\nconst $d7bdfb9eb0fdf311$var$ENTRY_FOCUS = 'rovingFocusGroup.onEntryFocus';\nconst $d7bdfb9eb0fdf311$var$EVENT_OPTIONS = {\n bubbles: false,\n cancelable: true\n};\n/* -------------------------------------------------------------------------------------------------\n * RovingFocusGroup\n * -----------------------------------------------------------------------------------------------*/ const $d7bdfb9eb0fdf311$var$GROUP_NAME = 'RovingFocusGroup';\nconst [$d7bdfb9eb0fdf311$var$Collection, $d7bdfb9eb0fdf311$var$useCollection, $d7bdfb9eb0fdf311$var$createCollectionScope] = $98Iye$createCollection($d7bdfb9eb0fdf311$var$GROUP_NAME);\nconst [$d7bdfb9eb0fdf311$var$createRovingFocusGroupContext, $d7bdfb9eb0fdf311$export$c7109489551a4f4] = $98Iye$createContextScope($d7bdfb9eb0fdf311$var$GROUP_NAME, [\n $d7bdfb9eb0fdf311$var$createCollectionScope\n]);\nconst [$d7bdfb9eb0fdf311$var$RovingFocusProvider, $d7bdfb9eb0fdf311$var$useRovingFocusContext] = $d7bdfb9eb0fdf311$var$createRovingFocusGroupContext($d7bdfb9eb0fdf311$var$GROUP_NAME);\nconst $d7bdfb9eb0fdf311$export$8699f7c8af148338 = /*#__PURE__*/ $98Iye$forwardRef((props, forwardedRef)=>{\n return /*#__PURE__*/ $98Iye$createElement($d7bdfb9eb0fdf311$var$Collection.Provider, {\n scope: props.__scopeRovingFocusGroup\n }, /*#__PURE__*/ $98Iye$createElement($d7bdfb9eb0fdf311$var$Collection.Slot, {\n scope: props.__scopeRovingFocusGroup\n }, /*#__PURE__*/ $98Iye$createElement($d7bdfb9eb0fdf311$var$RovingFocusGroupImpl, $98Iye$babelruntimehelpersesmextends({}, props, {\n ref: forwardedRef\n }))));\n});\n/*#__PURE__*/ Object.assign($d7bdfb9eb0fdf311$export$8699f7c8af148338, {\n displayName: $d7bdfb9eb0fdf311$var$GROUP_NAME\n});\n/* -----------------------------------------------------------------------------------------------*/ const $d7bdfb9eb0fdf311$var$RovingFocusGroupImpl = /*#__PURE__*/ $98Iye$forwardRef((props, forwardedRef)=>{\n const { __scopeRovingFocusGroup: __scopeRovingFocusGroup , orientation: orientation , loop: loop = false , dir: dir , currentTabStopId: currentTabStopIdProp , defaultCurrentTabStopId: defaultCurrentTabStopId , onCurrentTabStopIdChange: onCurrentTabStopIdChange , onEntryFocus: onEntryFocus , ...groupProps } = props;\n const ref = $98Iye$useRef(null);\n const composedRefs = $98Iye$useComposedRefs(forwardedRef, ref);\n const direction = $98Iye$useDirection(dir);\n const [currentTabStopId = null, setCurrentTabStopId] = $98Iye$useControllableState({\n prop: currentTabStopIdProp,\n defaultProp: defaultCurrentTabStopId,\n onChange: onCurrentTabStopIdChange\n });\n const [isTabbingBackOut, setIsTabbingBackOut] = $98Iye$useState(false);\n const handleEntryFocus = $98Iye$useCallbackRef(onEntryFocus);\n const getItems = $d7bdfb9eb0fdf311$var$useCollection(__scopeRovingFocusGroup);\n const isClickFocusRef = $98Iye$useRef(false);\n const [focusableItemsCount, setFocusableItemsCount] = $98Iye$useState(0);\n $98Iye$useEffect(()=>{\n const node = ref.current;\n if (node) {\n node.addEventListener($d7bdfb9eb0fdf311$var$ENTRY_FOCUS, handleEntryFocus);\n return ()=>node.removeEventListener($d7bdfb9eb0fdf311$var$ENTRY_FOCUS, handleEntryFocus)\n ;\n }\n }, [\n handleEntryFocus\n ]);\n return /*#__PURE__*/ $98Iye$createElement($d7bdfb9eb0fdf311$var$RovingFocusProvider, {\n scope: __scopeRovingFocusGroup,\n orientation: orientation,\n dir: direction,\n loop: loop,\n currentTabStopId: currentTabStopId,\n onItemFocus: $98Iye$useCallback((tabStopId)=>setCurrentTabStopId(tabStopId)\n , [\n setCurrentTabStopId\n ]),\n onItemShiftTab: $98Iye$useCallback(()=>setIsTabbingBackOut(true)\n , []),\n onFocusableItemAdd: $98Iye$useCallback(()=>setFocusableItemsCount((prevCount)=>prevCount + 1\n )\n , []),\n onFocusableItemRemove: $98Iye$useCallback(()=>setFocusableItemsCount((prevCount)=>prevCount - 1\n )\n , [])\n }, /*#__PURE__*/ $98Iye$createElement($98Iye$Primitive.div, $98Iye$babelruntimehelpersesmextends({\n tabIndex: isTabbingBackOut || focusableItemsCount === 0 ? -1 : 0,\n \"data-orientation\": orientation\n }, groupProps, {\n ref: composedRefs,\n style: {\n outline: 'none',\n ...props.style\n },\n onMouseDown: $98Iye$composeEventHandlers(props.onMouseDown, ()=>{\n isClickFocusRef.current = true;\n }),\n onFocus: $98Iye$composeEventHandlers(props.onFocus, (event)=>{\n // We normally wouldn't need this check, because we already check\n // that the focus is on the current target and not bubbling to it.\n // We do this because Safari doesn't focus buttons when clicked, and\n // instead, the wrapper will get focused and not through a bubbling event.\n const isKeyboardFocus = !isClickFocusRef.current;\n if (event.target === event.currentTarget && isKeyboardFocus && !isTabbingBackOut) {\n const entryFocusEvent = new CustomEvent($d7bdfb9eb0fdf311$var$ENTRY_FOCUS, $d7bdfb9eb0fdf311$var$EVENT_OPTIONS);\n event.currentTarget.dispatchEvent(entryFocusEvent);\n if (!entryFocusEvent.defaultPrevented) {\n const items = getItems().filter((item)=>item.focusable\n );\n const activeItem = items.find((item)=>item.active\n );\n const currentItem = items.find((item)=>item.id === currentTabStopId\n );\n const candidateItems = [\n activeItem,\n currentItem,\n ...items\n ].filter(Boolean);\n const candidateNodes = candidateItems.map((item)=>item.ref.current\n );\n $d7bdfb9eb0fdf311$var$focusFirst(candidateNodes);\n }\n }\n isClickFocusRef.current = false;\n }),\n onBlur: $98Iye$composeEventHandlers(props.onBlur, ()=>setIsTabbingBackOut(false)\n )\n })));\n});\n/* -------------------------------------------------------------------------------------------------\n * RovingFocusGroupItem\n * -----------------------------------------------------------------------------------------------*/ const $d7bdfb9eb0fdf311$var$ITEM_NAME = 'RovingFocusGroupItem';\nconst $d7bdfb9eb0fdf311$export$ab9df7c53fe8454 = /*#__PURE__*/ $98Iye$forwardRef((props, forwardedRef)=>{\n const { __scopeRovingFocusGroup: __scopeRovingFocusGroup , focusable: focusable = true , active: active = false , tabStopId: tabStopId , ...itemProps } = props;\n const autoId = $98Iye$useId();\n const id = tabStopId || autoId;\n const context = $d7bdfb9eb0fdf311$var$useRovingFocusContext($d7bdfb9eb0fdf311$var$ITEM_NAME, __scopeRovingFocusGroup);\n const isCurrentTabStop = context.currentTabStopId === id;\n const getItems = $d7bdfb9eb0fdf311$var$useCollection(__scopeRovingFocusGroup);\n const { onFocusableItemAdd: onFocusableItemAdd , onFocusableItemRemove: onFocusableItemRemove } = context;\n $98Iye$useEffect(()=>{\n if (focusable) {\n onFocusableItemAdd();\n return ()=>onFocusableItemRemove()\n ;\n }\n }, [\n focusable,\n onFocusableItemAdd,\n onFocusableItemRemove\n ]);\n return /*#__PURE__*/ $98Iye$createElement($d7bdfb9eb0fdf311$var$Collection.ItemSlot, {\n scope: __scopeRovingFocusGroup,\n id: id,\n focusable: focusable,\n active: active\n }, /*#__PURE__*/ $98Iye$createElement($98Iye$Primitive.span, $98Iye$babelruntimehelpersesmextends({\n tabIndex: isCurrentTabStop ? 0 : -1,\n \"data-orientation\": context.orientation\n }, itemProps, {\n ref: forwardedRef,\n onMouseDown: $98Iye$composeEventHandlers(props.onMouseDown, (event)=>{\n // We prevent focusing non-focusable items on `mousedown`.\n // Even though the item has tabIndex={-1}, that only means take it out of the tab order.\n if (!focusable) event.preventDefault(); // Safari doesn't focus a button when clicked so we run our logic on mousedown also\n else context.onItemFocus(id);\n }),\n onFocus: $98Iye$composeEventHandlers(props.onFocus, ()=>context.onItemFocus(id)\n ),\n onKeyDown: $98Iye$composeEventHandlers(props.onKeyDown, (event)=>{\n if (event.key === 'Tab' && event.shiftKey) {\n context.onItemShiftTab();\n return;\n }\n if (event.target !== event.currentTarget) return;\n const focusIntent = $d7bdfb9eb0fdf311$var$getFocusIntent(event, context.orientation, context.dir);\n if (focusIntent !== undefined) {\n event.preventDefault();\n const items = getItems().filter((item)=>item.focusable\n );\n let candidateNodes = items.map((item)=>item.ref.current\n );\n if (focusIntent === 'last') candidateNodes.reverse();\n else if (focusIntent === 'prev' || focusIntent === 'next') {\n if (focusIntent === 'prev') candidateNodes.reverse();\n const currentIndex = candidateNodes.indexOf(event.currentTarget);\n candidateNodes = context.loop ? $d7bdfb9eb0fdf311$var$wrapArray(candidateNodes, currentIndex + 1) : candidateNodes.slice(currentIndex + 1);\n }\n /**\n * Imperative focus during keydown is risky so we prevent React's batching updates\n * to avoid potential bugs. See: https://github.com/facebook/react/issues/20332\n */ setTimeout(()=>$d7bdfb9eb0fdf311$var$focusFirst(candidateNodes)\n );\n }\n })\n })));\n});\n/*#__PURE__*/ Object.assign($d7bdfb9eb0fdf311$export$ab9df7c53fe8454, {\n displayName: $d7bdfb9eb0fdf311$var$ITEM_NAME\n});\n/* -----------------------------------------------------------------------------------------------*/ // prettier-ignore\nconst $d7bdfb9eb0fdf311$var$MAP_KEY_TO_FOCUS_INTENT = {\n ArrowLeft: 'prev',\n ArrowUp: 'prev',\n ArrowRight: 'next',\n ArrowDown: 'next',\n PageUp: 'first',\n Home: 'first',\n PageDown: 'last',\n End: 'last'\n};\nfunction $d7bdfb9eb0fdf311$var$getDirectionAwareKey(key, dir) {\n if (dir !== 'rtl') return key;\n return key === 'ArrowLeft' ? 'ArrowRight' : key === 'ArrowRight' ? 'ArrowLeft' : key;\n}\nfunction $d7bdfb9eb0fdf311$var$getFocusIntent(event, orientation, dir) {\n const key = $d7bdfb9eb0fdf311$var$getDirectionAwareKey(event.key, dir);\n if (orientation === 'vertical' && [\n 'ArrowLeft',\n 'ArrowRight'\n ].includes(key)) return undefined;\n if (orientation === 'horizontal' && [\n 'ArrowUp',\n 'ArrowDown'\n ].includes(key)) return undefined;\n return $d7bdfb9eb0fdf311$var$MAP_KEY_TO_FOCUS_INTENT[key];\n}\nfunction $d7bdfb9eb0fdf311$var$focusFirst(candidates) {\n const PREVIOUSLY_FOCUSED_ELEMENT = document.activeElement;\n for (const candidate of candidates){\n // if focus is already where we want to go, we don't want to keep going through the candidates\n if (candidate === PREVIOUSLY_FOCUSED_ELEMENT) return;\n candidate.focus();\n if (document.activeElement !== PREVIOUSLY_FOCUSED_ELEMENT) return;\n }\n}\n/**\n * Wraps an array around itself at a given start index\n * Example: `wrapArray(['a', 'b', 'c', 'd'], 2) === ['c', 'd', 'a', 'b']`\n */ function $d7bdfb9eb0fdf311$var$wrapArray(array, startIndex) {\n return array.map((_, index)=>array[(startIndex + index) % array.length]\n );\n}\nconst $d7bdfb9eb0fdf311$export$be92b6f5f03c0fe9 = $d7bdfb9eb0fdf311$export$8699f7c8af148338;\nconst $d7bdfb9eb0fdf311$export$6d08773d2e66f8f2 = $d7bdfb9eb0fdf311$export$ab9df7c53fe8454;\n\n\n\n\nexport {$d7bdfb9eb0fdf311$export$c7109489551a4f4 as createRovingFocusGroupScope, $d7bdfb9eb0fdf311$export$8699f7c8af148338 as RovingFocusGroup, $d7bdfb9eb0fdf311$export$ab9df7c53fe8454 as RovingFocusGroupItem, $d7bdfb9eb0fdf311$export$be92b6f5f03c0fe9 as Root, $d7bdfb9eb0fdf311$export$6d08773d2e66f8f2 as Item};\n//# sourceMappingURL=index.mjs.map\n"],"names":["$d7bdfb9eb0fdf311$var$ENTRY_FOCUS","$d7bdfb9eb0fdf311$var$EVENT_OPTIONS","$d7bdfb9eb0fdf311$var$GROUP_NAME","$d7bdfb9eb0fdf311$var$Collection","$d7bdfb9eb0fdf311$var$useCollection","$d7bdfb9eb0fdf311$var$createCollectionScope","$98Iye$createCollection","$d7bdfb9eb0fdf311$var$createRovingFocusGroupContext","$d7bdfb9eb0fdf311$export$c7109489551a4f4","$98Iye$createContextScope","$d7bdfb9eb0fdf311$var$RovingFocusProvider","$d7bdfb9eb0fdf311$var$useRovingFocusContext","$d7bdfb9eb0fdf311$export$8699f7c8af148338","$98Iye$forwardRef","props","forwardedRef","$98Iye$createElement","$d7bdfb9eb0fdf311$var$RovingFocusGroupImpl","$98Iye$babelruntimehelpersesmextends","__scopeRovingFocusGroup","orientation","loop","dir","currentTabStopIdProp","defaultCurrentTabStopId","onCurrentTabStopIdChange","onEntryFocus","groupProps","ref","$98Iye$useRef","composedRefs","$98Iye$useComposedRefs","direction","$98Iye$useDirection","currentTabStopId","setCurrentTabStopId","$98Iye$useControllableState","isTabbingBackOut","setIsTabbingBackOut","$98Iye$useState","handleEntryFocus","$98Iye$useCallbackRef","getItems","isClickFocusRef","focusableItemsCount","setFocusableItemsCount","$98Iye$useEffect","node","$98Iye$useCallback","tabStopId","prevCount","$98Iye$Primitive","$98Iye$composeEventHandlers","event","isKeyboardFocus","entryFocusEvent","items","item","activeItem","currentItem","candidateNodes","$d7bdfb9eb0fdf311$var$focusFirst","$d7bdfb9eb0fdf311$var$ITEM_NAME","$d7bdfb9eb0fdf311$export$ab9df7c53fe8454","focusable","active","itemProps","autoId","$98Iye$useId","id","context","isCurrentTabStop","onFocusableItemAdd","onFocusableItemRemove","focusIntent","$d7bdfb9eb0fdf311$var$getFocusIntent","currentIndex","$d7bdfb9eb0fdf311$var$wrapArray","$d7bdfb9eb0fdf311$var$MAP_KEY_TO_FOCUS_INTENT","$d7bdfb9eb0fdf311$var$getDirectionAwareKey","key","candidates","PREVIOUSLY_FOCUSED_ELEMENT","candidate","array","startIndex","_","index","$d7bdfb9eb0fdf311$export$be92b6f5f03c0fe9","$d7bdfb9eb0fdf311$export$6d08773d2e66f8f2"],"mappings":";;;;;;;AAuBA,MAAMA,IAAoC,iCACpCC,IAAsC;AAAA,EACxC,SAAS;AAAA,EACT,YAAY;AAChB,GAG2GC,IAAmC,oBACxI,CAACC,GAAkCC,GAAqCC,CAA2C,IAAIC,EAAwBJ,CAAgC,GAC/K,CAACK,IAAqDC,EAAwC,IAAIC,EAA0BP,GAAkC;AAAA,EAChKG;AACJ,CAAC,GACK,CAACK,IAA2CC,EAA2C,IAAIJ,GAAoDL,CAAgC,GAC/KU,KAA0DC,gBAAAA,EAAkB,CAACC,GAAO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ACnBA,MAAQ,cAAc,eAAeA,MAAQ,eAAe,cAAcA;AACrF;AACA,SAASL,GAAqCtB,GAAOjC,GAAaE,GAAK;AACnE,QAAM0D,IAAMD,GAA2C1B,EAAM,KAAK/B,CAAG;AACrE,MAAI,EAAAF,MAAgB,cAAc;AAAA,IAC9B;AAAA,IACA;AAAA,EACH,EAAC,SAAS4D,CAAG,MACV,EAAA5D,MAAgB,gBAAgB;AAAA,IAChC;AAAA,IACA;AAAA,EACH,EAAC,SAAS4D,CAAG;AACd,WAAOF,GAA8CE,CAAG;AAC5D;AACA,SAASnB,EAAiCoB,GAAY;AAClD,QAAMC,IAA6B,SAAS;AAC5C,aAAWC,KAAaF;AAIpB,QAFIE,MAAcD,MAClBC,EAAU,MAAK,GACX,SAAS,kBAAkBD;AAA4B;AAEnE;AAII,SAASL,GAAgCO,GAAOC,GAAY;AAC5D,SAAOD,EAAM;AAAA,IAAI,CAACE,GAAGC,MAAQH,GAAOC,IAAaE,KAASH,EAAM,MAAM;AAAA,EAC1E;AACA;AACK,MAACI,KAA4C5E,IAC5C6E,KAA4C1B;","x_google_ignoreList":[0]}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import s, { forwardRef as $, createElement as l, useRef as u, useEffect as I, Fragment as N, useCallback as T, Children as w } from "react";
|
|
2
2
|
import { b as j } from "./IconBase-BMoPr3f9.js";
|
|
3
3
|
import { _ as i, $ as O, a as Z } from "./index-CM4_Y0D3.js";
|
|
4
|
-
import { a as b, $ as k
|
|
4
|
+
import { a as b, $ as k } from "./index-0xSCJjjg.js";
|
|
5
5
|
import { $ as S } from "./index-C5wtLq4-.js";
|
|
6
|
-
import { $ as
|
|
6
|
+
import { $ as v } from "./index-BAKhqUxp.js";
|
|
7
|
+
import { $ as V } from "./index-BvF_j4eL.js";
|
|
7
8
|
import { h as H, b as G, c as K, a as U, $ as X } from "./index-CV8djSqE.js";
|
|
8
9
|
import { $ as E } from "./index-Ca-W4km-.js";
|
|
9
10
|
import { $ as m } from "./index-B6k0B0Dk.js";
|
|
@@ -49,7 +50,7 @@ var q = Object.defineProperty, z = Object.defineProperties, B = Object.getOwnPro
|
|
|
49
50
|
}, ee = (e, t) => z(e, B(t));
|
|
50
51
|
const te = $((e, t) => /* @__PURE__ */ s.createElement(j, ee(W({ ref: t }, e), { weights: Y })));
|
|
51
52
|
te.displayName = "X";
|
|
52
|
-
const M = "Dialog", [P,
|
|
53
|
+
const M = "Dialog", [P, Ae] = S(M), [oe, f] = P(M), ce = (e) => {
|
|
53
54
|
const { __scopeDialog: t, children: o, open: a, defaultOpen: n, onOpenChange: c, modal: r = !0 } = e, d = u(null), p = u(null), [_ = !1, D] = k({
|
|
54
55
|
prop: a,
|
|
55
56
|
defaultProp: n,
|
|
@@ -230,16 +231,16 @@ const M = "Dialog", [P, Pe] = S(M), [oe, f] = P(M), ce = (e) => {
|
|
|
230
231
|
function C(e) {
|
|
231
232
|
return e ? "open" : "closed";
|
|
232
233
|
}
|
|
233
|
-
const
|
|
234
|
+
const ye = ce, Re = ae, Fe = se, Ie = le, Ne = ie, Te = ue, we = ge, je = _e;
|
|
234
235
|
export {
|
|
235
|
-
|
|
236
|
+
Ie as $,
|
|
236
237
|
te as R,
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
238
|
+
Ne as a,
|
|
239
|
+
je as b,
|
|
240
|
+
Te as c,
|
|
241
|
+
we as d,
|
|
242
|
+
ye as e,
|
|
243
|
+
Re as f,
|
|
244
|
+
Fe as g
|
|
244
245
|
};
|
|
245
|
-
//# sourceMappingURL=index-
|
|
246
|
+
//# sourceMappingURL=index-LzueKcCr.js.map
|