@drjoshcsimmons/scl 0.1.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/LICENSE +21 -0
- package/README.md +73 -0
- package/dist/components/ui/accordion/accordion.d.ts +8 -0
- package/dist/components/ui/accordion/accordion.d.ts.map +1 -0
- package/dist/components/ui/accordion/index.d.ts +2 -0
- package/dist/components/ui/accordion/index.d.ts.map +1 -0
- package/dist/components/ui/alert/alert.d.ts +9 -0
- package/dist/components/ui/alert/alert.d.ts.map +1 -0
- package/dist/components/ui/alert/index.d.ts +2 -0
- package/dist/components/ui/alert/index.d.ts.map +1 -0
- package/dist/components/ui/alert-dialog/alert-dialog.d.ts +21 -0
- package/dist/components/ui/alert-dialog/alert-dialog.d.ts.map +1 -0
- package/dist/components/ui/alert-dialog/index.d.ts +2 -0
- package/dist/components/ui/alert-dialog/index.d.ts.map +1 -0
- package/dist/components/ui/avatar/avatar.d.ts +7 -0
- package/dist/components/ui/avatar/avatar.d.ts.map +1 -0
- package/dist/components/ui/avatar/index.d.ts +2 -0
- package/dist/components/ui/avatar/index.d.ts.map +1 -0
- package/dist/components/ui/badge/badge.d.ts +10 -0
- package/dist/components/ui/badge/badge.d.ts.map +1 -0
- package/dist/components/ui/badge/index.d.ts +2 -0
- package/dist/components/ui/badge/index.d.ts.map +1 -0
- package/dist/components/ui/button/button.d.ts +12 -0
- package/dist/components/ui/button/button.d.ts.map +1 -0
- package/dist/components/ui/button/index.d.ts +2 -0
- package/dist/components/ui/button/index.d.ts.map +1 -0
- package/dist/components/ui/card/card.d.ts +9 -0
- package/dist/components/ui/card/card.d.ts.map +1 -0
- package/dist/components/ui/card/index.d.ts +2 -0
- package/dist/components/ui/card/index.d.ts.map +1 -0
- package/dist/components/ui/checkbox/checkbox.d.ts +5 -0
- package/dist/components/ui/checkbox/checkbox.d.ts.map +1 -0
- package/dist/components/ui/checkbox/index.d.ts +2 -0
- package/dist/components/ui/checkbox/index.d.ts.map +1 -0
- package/dist/components/ui/collapsible/collapsible.d.ts +6 -0
- package/dist/components/ui/collapsible/collapsible.d.ts.map +1 -0
- package/dist/components/ui/collapsible/index.d.ts +2 -0
- package/dist/components/ui/collapsible/index.d.ts.map +1 -0
- package/dist/components/ui/dialog/dialog.d.ts +20 -0
- package/dist/components/ui/dialog/dialog.d.ts.map +1 -0
- package/dist/components/ui/dialog/index.d.ts +2 -0
- package/dist/components/ui/dialog/index.d.ts.map +1 -0
- package/dist/components/ui/dithered-image/dithered-image.d.ts +17 -0
- package/dist/components/ui/dithered-image/dithered-image.d.ts.map +1 -0
- package/dist/components/ui/dithered-image/index.d.ts +3 -0
- package/dist/components/ui/dithered-image/index.d.ts.map +1 -0
- package/dist/components/ui/dropdown-menu/dropdown-menu.d.ts +28 -0
- package/dist/components/ui/dropdown-menu/dropdown-menu.d.ts.map +1 -0
- package/dist/components/ui/dropdown-menu/index.d.ts +2 -0
- package/dist/components/ui/dropdown-menu/index.d.ts.map +1 -0
- package/dist/components/ui/input/index.d.ts +2 -0
- package/dist/components/ui/input/index.d.ts.map +1 -0
- package/dist/components/ui/input/input.d.ts +5 -0
- package/dist/components/ui/input/input.d.ts.map +1 -0
- package/dist/components/ui/label/index.d.ts +2 -0
- package/dist/components/ui/label/index.d.ts.map +1 -0
- package/dist/components/ui/label/label.d.ts +6 -0
- package/dist/components/ui/label/label.d.ts.map +1 -0
- package/dist/components/ui/popover/index.d.ts +2 -0
- package/dist/components/ui/popover/index.d.ts.map +1 -0
- package/dist/components/ui/popover/popover.d.ts +8 -0
- package/dist/components/ui/popover/popover.d.ts.map +1 -0
- package/dist/components/ui/progress/index.d.ts +2 -0
- package/dist/components/ui/progress/index.d.ts.map +1 -0
- package/dist/components/ui/progress/progress.d.ts +19 -0
- package/dist/components/ui/progress/progress.d.ts.map +1 -0
- package/dist/components/ui/radio-group/index.d.ts +2 -0
- package/dist/components/ui/radio-group/index.d.ts.map +1 -0
- package/dist/components/ui/radio-group/radio-group.d.ts +6 -0
- package/dist/components/ui/radio-group/radio-group.d.ts.map +1 -0
- package/dist/components/ui/scroll-area/index.d.ts +2 -0
- package/dist/components/ui/scroll-area/index.d.ts.map +1 -0
- package/dist/components/ui/scroll-area/scroll-area.d.ts +6 -0
- package/dist/components/ui/scroll-area/scroll-area.d.ts.map +1 -0
- package/dist/components/ui/select/index.d.ts +2 -0
- package/dist/components/ui/select/index.d.ts.map +1 -0
- package/dist/components/ui/select/select.d.ts +14 -0
- package/dist/components/ui/select/select.d.ts.map +1 -0
- package/dist/components/ui/separator/index.d.ts +2 -0
- package/dist/components/ui/separator/index.d.ts.map +1 -0
- package/dist/components/ui/separator/separator.d.ts +5 -0
- package/dist/components/ui/separator/separator.d.ts.map +1 -0
- package/dist/components/ui/sheet/index.d.ts +2 -0
- package/dist/components/ui/sheet/index.d.ts.map +1 -0
- package/dist/components/ui/sheet/sheet.d.ts +26 -0
- package/dist/components/ui/sheet/sheet.d.ts.map +1 -0
- package/dist/components/ui/skeleton/index.d.ts +2 -0
- package/dist/components/ui/skeleton/index.d.ts.map +1 -0
- package/dist/components/ui/skeleton/skeleton.d.ts +3 -0
- package/dist/components/ui/skeleton/skeleton.d.ts.map +1 -0
- package/dist/components/ui/slider/index.d.ts +2 -0
- package/dist/components/ui/slider/index.d.ts.map +1 -0
- package/dist/components/ui/slider/slider.d.ts +5 -0
- package/dist/components/ui/slider/slider.d.ts.map +1 -0
- package/dist/components/ui/statusline/index.d.ts +2 -0
- package/dist/components/ui/statusline/index.d.ts.map +1 -0
- package/dist/components/ui/statusline/statusline.d.ts +40 -0
- package/dist/components/ui/statusline/statusline.d.ts.map +1 -0
- package/dist/components/ui/switch/index.d.ts +2 -0
- package/dist/components/ui/switch/index.d.ts.map +1 -0
- package/dist/components/ui/switch/switch.d.ts +5 -0
- package/dist/components/ui/switch/switch.d.ts.map +1 -0
- package/dist/components/ui/table/index.d.ts +2 -0
- package/dist/components/ui/table/index.d.ts.map +1 -0
- package/dist/components/ui/table/table.d.ts +11 -0
- package/dist/components/ui/table/table.d.ts.map +1 -0
- package/dist/components/ui/tabs/index.d.ts +2 -0
- package/dist/components/ui/tabs/index.d.ts.map +1 -0
- package/dist/components/ui/tabs/tabs.d.ts +8 -0
- package/dist/components/ui/tabs/tabs.d.ts.map +1 -0
- package/dist/components/ui/terminal-textarea/index.d.ts +2 -0
- package/dist/components/ui/terminal-textarea/index.d.ts.map +1 -0
- package/dist/components/ui/terminal-textarea/terminal-textarea.d.ts +27 -0
- package/dist/components/ui/terminal-textarea/terminal-textarea.d.ts.map +1 -0
- package/dist/components/ui/textarea/index.d.ts +2 -0
- package/dist/components/ui/textarea/index.d.ts.map +1 -0
- package/dist/components/ui/textarea/textarea.d.ts +5 -0
- package/dist/components/ui/textarea/textarea.d.ts.map +1 -0
- package/dist/components/ui/toggle/index.d.ts +2 -0
- package/dist/components/ui/toggle/index.d.ts.map +1 -0
- package/dist/components/ui/toggle/toggle.d.ts +13 -0
- package/dist/components/ui/toggle/toggle.d.ts.map +1 -0
- package/dist/components/ui/tooltip/index.d.ts +2 -0
- package/dist/components/ui/tooltip/index.d.ts.map +1 -0
- package/dist/components/ui/tooltip/tooltip.d.ts +11 -0
- package/dist/components/ui/tooltip/tooltip.d.ts.map +1 -0
- package/dist/index.d.ts +34 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +165 -0
- package/dist/index10.js +61 -0
- package/dist/index100.js +32 -0
- package/dist/index101.js +17 -0
- package/dist/index102.js +137 -0
- package/dist/index103.js +52 -0
- package/dist/index104.js +11 -0
- package/dist/index105.js +6 -0
- package/dist/index106.js +183 -0
- package/dist/index107.js +652 -0
- package/dist/index108.js +109 -0
- package/dist/index109.js +93 -0
- package/dist/index11.js +27 -0
- package/dist/index110.js +69 -0
- package/dist/index111.js +161 -0
- package/dist/index112.js +399 -0
- package/dist/index113.js +1682 -0
- package/dist/index114.js +280 -0
- package/dist/index115.js +134 -0
- package/dist/index116.js +34 -0
- package/dist/index117.js +1613 -0
- package/dist/index118.js +300 -0
- package/dist/index119.js +637 -0
- package/dist/index12.js +7 -0
- package/dist/index120.js +146 -0
- package/dist/index121.js +23 -0
- package/dist/index122.js +11 -0
- package/dist/index123.js +40 -0
- package/dist/index124.js +20 -0
- package/dist/index125.js +8 -0
- package/dist/index126.js +14 -0
- package/dist/index127.js +208 -0
- package/dist/index128.js +24 -0
- package/dist/index129.js +402 -0
- package/dist/index13.js +100 -0
- package/dist/index130.js +1308 -0
- package/dist/index131.js +620 -0
- package/dist/index132.js +4 -0
- package/dist/index133.js +55 -0
- package/dist/index134.js +67 -0
- package/dist/index135.js +27 -0
- package/dist/index136.js +31 -0
- package/dist/index137.js +7 -0
- package/dist/index138.js +4 -0
- package/dist/index139.js +4 -0
- package/dist/index14.js +226 -0
- package/dist/index140.js +7 -0
- package/dist/index141.js +5 -0
- package/dist/index142.js +26 -0
- package/dist/index143.js +115 -0
- package/dist/index144.js +18 -0
- package/dist/index145.js +527 -0
- package/dist/index146.js +130 -0
- package/dist/index147.js +136 -0
- package/dist/index148.js +67 -0
- package/dist/index149.js +71 -0
- package/dist/index15.js +146 -0
- package/dist/index150.js +11 -0
- package/dist/index151.js +16 -0
- package/dist/index152.js +68 -0
- package/dist/index153.js +6 -0
- package/dist/index154.js +25 -0
- package/dist/index155.js +25 -0
- package/dist/index156.js +15 -0
- package/dist/index157.js +30 -0
- package/dist/index158.js +7 -0
- package/dist/index16.js +21 -0
- package/dist/index17.js +19 -0
- package/dist/index18.js +24 -0
- package/dist/index19.js +58 -0
- package/dist/index2.js +8 -0
- package/dist/index20.js +31 -0
- package/dist/index21.js +38 -0
- package/dist/index22.js +123 -0
- package/dist/index23.js +24 -0
- package/dist/index24.js +72 -0
- package/dist/index25.js +17 -0
- package/dist/index26.js +34 -0
- package/dist/index27.js +81 -0
- package/dist/index28.js +27 -0
- package/dist/index29.js +90 -0
- package/dist/index3.js +22 -0
- package/dist/index30.js +46 -0
- package/dist/index31.js +234 -0
- package/dist/index32.js +20 -0
- package/dist/index33.js +37 -0
- package/dist/index34.js +25 -0
- package/dist/index35.js +105 -0
- package/dist/index36.js +68 -0
- package/dist/index37.js +51 -0
- package/dist/index38.js +102 -0
- package/dist/index39.js +13 -0
- package/dist/index4.js +46 -0
- package/dist/index40.js +17 -0
- package/dist/index41.js +2265 -0
- package/dist/index42.js +35 -0
- package/dist/index43.js +20 -0
- package/dist/index44.js +239 -0
- package/dist/index45.js +13 -0
- package/dist/index46.js +75 -0
- package/dist/index47.js +251 -0
- package/dist/index48.js +11 -0
- package/dist/index49.js +338 -0
- package/dist/index5.js +51 -0
- package/dist/index50.js +62 -0
- package/dist/index51.js +243 -0
- package/dist/index52.js +862 -0
- package/dist/index53.js +11 -0
- package/dist/index54.js +120 -0
- package/dist/index55.js +227 -0
- package/dist/index56.js +13 -0
- package/dist/index57.js +13 -0
- package/dist/index58.js +238 -0
- package/dist/index59.js +262 -0
- package/dist/index6.js +51 -0
- package/dist/index60.js +14 -0
- package/dist/index61.js +24 -0
- package/dist/index62.js +532 -0
- package/dist/index63.js +6157 -0
- package/dist/index64.js +2635 -0
- package/dist/index65.js +300 -0
- package/dist/index66.js +674 -0
- package/dist/index67.js +832 -0
- package/dist/index68.js +27 -0
- package/dist/index69.js +330 -0
- package/dist/index7.js +42 -0
- package/dist/index70.js +4901 -0
- package/dist/index71.js +831 -0
- package/dist/index72.js +1260 -0
- package/dist/index73.js +536 -0
- package/dist/index74.js +127 -0
- package/dist/index75.js +163 -0
- package/dist/index76.js +33 -0
- package/dist/index77.js +437 -0
- package/dist/index78.js +132 -0
- package/dist/index79.js +83 -0
- package/dist/index8.js +31 -0
- package/dist/index80.js +70 -0
- package/dist/index81.js +48 -0
- package/dist/index82.js +29 -0
- package/dist/index83.js +9 -0
- package/dist/index84.js +54 -0
- package/dist/index85.js +36 -0
- package/dist/index86.js +13 -0
- package/dist/index87.js +10 -0
- package/dist/index88.js +32 -0
- package/dist/index89.js +57 -0
- package/dist/index9.js +54 -0
- package/dist/index90.js +13 -0
- package/dist/index91.js +6 -0
- package/dist/index92.js +15 -0
- package/dist/index93.js +8 -0
- package/dist/index94.js +27 -0
- package/dist/index95.js +71 -0
- package/dist/index96.js +127 -0
- package/dist/index97.js +221 -0
- package/dist/index98.js +16 -0
- package/dist/index99.js +56 -0
- package/dist/lib/utils.d.ts +14 -0
- package/dist/lib/utils.d.ts.map +1 -0
- package/dist/tokens/animations.d.ts +174 -0
- package/dist/tokens/animations.d.ts.map +1 -0
- package/dist/tokens/colors.d.ts +92 -0
- package/dist/tokens/colors.d.ts.map +1 -0
- package/dist/tokens/index.d.ts +403 -0
- package/dist/tokens/index.d.ts.map +1 -0
- package/dist/tokens/shadows.d.ts +15 -0
- package/dist/tokens/shadows.d.ts.map +1 -0
- package/dist/tokens/spacing.d.ts +55 -0
- package/dist/tokens/spacing.d.ts.map +1 -0
- package/dist/tokens/typography.d.ts +80 -0
- package/dist/tokens/typography.d.ts.map +1 -0
- package/package.json +128 -0
package/dist/index100.js
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import * as a from "react";
|
|
2
|
+
import { Primitive as o } from "./index85.js";
|
|
3
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
4
|
+
var d = Object.freeze({
|
|
5
|
+
// See: https://github.com/twbs/bootstrap/blob/main/scss/mixins/_visually-hidden.scss
|
|
6
|
+
position: "absolute",
|
|
7
|
+
border: 0,
|
|
8
|
+
width: 1,
|
|
9
|
+
height: 1,
|
|
10
|
+
padding: 0,
|
|
11
|
+
margin: -1,
|
|
12
|
+
overflow: "hidden",
|
|
13
|
+
clip: "rect(0, 0, 0, 0)",
|
|
14
|
+
whiteSpace: "nowrap",
|
|
15
|
+
wordWrap: "normal"
|
|
16
|
+
}), l = "VisuallyHidden", e = a.forwardRef(
|
|
17
|
+
(r, i) => /* @__PURE__ */ t(
|
|
18
|
+
o.span,
|
|
19
|
+
{
|
|
20
|
+
...r,
|
|
21
|
+
ref: i,
|
|
22
|
+
style: { ...d, ...r.style }
|
|
23
|
+
}
|
|
24
|
+
)
|
|
25
|
+
);
|
|
26
|
+
e.displayName = l;
|
|
27
|
+
var p = e;
|
|
28
|
+
export {
|
|
29
|
+
p as Root,
|
|
30
|
+
d as VISUALLY_HIDDEN_STYLES,
|
|
31
|
+
e as VisuallyHidden
|
|
32
|
+
};
|
package/dist/index101.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as r from "react";
|
|
2
|
+
var t = 0;
|
|
3
|
+
function a() {
|
|
4
|
+
r.useEffect(() => {
|
|
5
|
+
const e = document.querySelectorAll("[data-radix-focus-guard]");
|
|
6
|
+
return document.body.insertAdjacentElement("afterbegin", e[0] ?? n()), document.body.insertAdjacentElement("beforeend", e[1] ?? n()), t++, () => {
|
|
7
|
+
t === 1 && document.querySelectorAll("[data-radix-focus-guard]").forEach((o) => o.remove()), t--;
|
|
8
|
+
};
|
|
9
|
+
}, []);
|
|
10
|
+
}
|
|
11
|
+
function n() {
|
|
12
|
+
const e = document.createElement("span");
|
|
13
|
+
return e.setAttribute("data-radix-focus-guard", ""), e.tabIndex = 0, e.style.outline = "none", e.style.opacity = "0", e.style.position = "fixed", e.style.pointerEvents = "none", e;
|
|
14
|
+
}
|
|
15
|
+
export {
|
|
16
|
+
a as useFocusGuards
|
|
17
|
+
};
|
package/dist/index102.js
ADDED
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import * as d from "react";
|
|
2
|
+
import { useComposedRefs as R } from "./index82.js";
|
|
3
|
+
import { Primitive as M } from "./index85.js";
|
|
4
|
+
import { useCallbackRef as y } from "./index90.js";
|
|
5
|
+
import { jsx as _ } from "react/jsx-runtime";
|
|
6
|
+
var F = "focusScope.autoFocusOnMount", T = "focusScope.autoFocusOnUnmount", N = { bubbles: !1, cancelable: !0 }, K = "FocusScope", k = d.forwardRef((e, n) => {
|
|
7
|
+
const {
|
|
8
|
+
loop: t = !1,
|
|
9
|
+
trapped: u = !1,
|
|
10
|
+
onMountAutoFocus: p,
|
|
11
|
+
onUnmountAutoFocus: L,
|
|
12
|
+
...g
|
|
13
|
+
} = e, [o, U] = d.useState(null), E = y(p), v = y(L), b = d.useRef(null), A = R(n, (s) => U(s)), a = d.useRef({
|
|
14
|
+
paused: !1,
|
|
15
|
+
pause() {
|
|
16
|
+
this.paused = !0;
|
|
17
|
+
},
|
|
18
|
+
resume() {
|
|
19
|
+
this.paused = !1;
|
|
20
|
+
}
|
|
21
|
+
}).current;
|
|
22
|
+
d.useEffect(() => {
|
|
23
|
+
if (u) {
|
|
24
|
+
let s = function(i) {
|
|
25
|
+
if (a.paused || !o) return;
|
|
26
|
+
const c = i.target;
|
|
27
|
+
o.contains(c) ? b.current = c : f(b.current, { select: !0 });
|
|
28
|
+
}, l = function(i) {
|
|
29
|
+
if (a.paused || !o) return;
|
|
30
|
+
const c = i.relatedTarget;
|
|
31
|
+
c !== null && (o.contains(c) || f(b.current, { select: !0 }));
|
|
32
|
+
}, r = function(i) {
|
|
33
|
+
if (document.activeElement === document.body)
|
|
34
|
+
for (const h of i)
|
|
35
|
+
h.removedNodes.length > 0 && f(o);
|
|
36
|
+
};
|
|
37
|
+
document.addEventListener("focusin", s), document.addEventListener("focusout", l);
|
|
38
|
+
const m = new MutationObserver(r);
|
|
39
|
+
return o && m.observe(o, { childList: !0, subtree: !0 }), () => {
|
|
40
|
+
document.removeEventListener("focusin", s), document.removeEventListener("focusout", l), m.disconnect();
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
}, [u, o, a.paused]), d.useEffect(() => {
|
|
44
|
+
if (o) {
|
|
45
|
+
S.add(a);
|
|
46
|
+
const s = document.activeElement;
|
|
47
|
+
if (!o.contains(s)) {
|
|
48
|
+
const r = new CustomEvent(F, N);
|
|
49
|
+
o.addEventListener(F, E), o.dispatchEvent(r), r.defaultPrevented || (w(W(I(o)), { select: !0 }), document.activeElement === s && f(o));
|
|
50
|
+
}
|
|
51
|
+
return () => {
|
|
52
|
+
o.removeEventListener(F, E), setTimeout(() => {
|
|
53
|
+
const r = new CustomEvent(T, N);
|
|
54
|
+
o.addEventListener(T, v), o.dispatchEvent(r), r.defaultPrevented || f(s ?? document.body, { select: !0 }), o.removeEventListener(T, v), S.remove(a);
|
|
55
|
+
}, 0);
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
}, [o, E, v, a]);
|
|
59
|
+
const P = d.useCallback(
|
|
60
|
+
(s) => {
|
|
61
|
+
if (!t && !u || a.paused) return;
|
|
62
|
+
const l = s.key === "Tab" && !s.altKey && !s.ctrlKey && !s.metaKey, r = document.activeElement;
|
|
63
|
+
if (l && r) {
|
|
64
|
+
const m = s.currentTarget, [i, c] = x(m);
|
|
65
|
+
i && c ? !s.shiftKey && r === c ? (s.preventDefault(), t && f(i, { select: !0 })) : s.shiftKey && r === i && (s.preventDefault(), t && f(c, { select: !0 })) : r === m && s.preventDefault();
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
[t, u, a.paused]
|
|
69
|
+
);
|
|
70
|
+
return /* @__PURE__ */ _(M.div, { tabIndex: -1, ...g, ref: A, onKeyDown: P });
|
|
71
|
+
});
|
|
72
|
+
k.displayName = K;
|
|
73
|
+
function w(e, { select: n = !1 } = {}) {
|
|
74
|
+
const t = document.activeElement;
|
|
75
|
+
for (const u of e)
|
|
76
|
+
if (f(u, { select: n }), document.activeElement !== t) return;
|
|
77
|
+
}
|
|
78
|
+
function x(e) {
|
|
79
|
+
const n = I(e), t = O(n, e), u = O(n.reverse(), e);
|
|
80
|
+
return [t, u];
|
|
81
|
+
}
|
|
82
|
+
function I(e) {
|
|
83
|
+
const n = [], t = document.createTreeWalker(e, NodeFilter.SHOW_ELEMENT, {
|
|
84
|
+
acceptNode: (u) => {
|
|
85
|
+
const p = u.tagName === "INPUT" && u.type === "hidden";
|
|
86
|
+
return u.disabled || u.hidden || p ? NodeFilter.FILTER_SKIP : u.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
for (; t.nextNode(); ) n.push(t.currentNode);
|
|
90
|
+
return n;
|
|
91
|
+
}
|
|
92
|
+
function O(e, n) {
|
|
93
|
+
for (const t of e)
|
|
94
|
+
if (!D(t, { upTo: n })) return t;
|
|
95
|
+
}
|
|
96
|
+
function D(e, { upTo: n }) {
|
|
97
|
+
if (getComputedStyle(e).visibility === "hidden") return !0;
|
|
98
|
+
for (; e; ) {
|
|
99
|
+
if (n !== void 0 && e === n) return !1;
|
|
100
|
+
if (getComputedStyle(e).display === "none") return !0;
|
|
101
|
+
e = e.parentElement;
|
|
102
|
+
}
|
|
103
|
+
return !1;
|
|
104
|
+
}
|
|
105
|
+
function H(e) {
|
|
106
|
+
return e instanceof HTMLInputElement && "select" in e;
|
|
107
|
+
}
|
|
108
|
+
function f(e, { select: n = !1 } = {}) {
|
|
109
|
+
if (e && e.focus) {
|
|
110
|
+
const t = document.activeElement;
|
|
111
|
+
e.focus({ preventScroll: !0 }), e !== t && H(e) && n && e.select();
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
var S = V();
|
|
115
|
+
function V() {
|
|
116
|
+
let e = [];
|
|
117
|
+
return {
|
|
118
|
+
add(n) {
|
|
119
|
+
const t = e[0];
|
|
120
|
+
n !== t && (t == null || t.pause()), e = C(e, n), e.unshift(n);
|
|
121
|
+
},
|
|
122
|
+
remove(n) {
|
|
123
|
+
var t;
|
|
124
|
+
e = C(e, n), (t = e[0]) == null || t.resume();
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
function C(e, n) {
|
|
129
|
+
const t = [...e], u = t.indexOf(n);
|
|
130
|
+
return u !== -1 && t.splice(u, 1), t;
|
|
131
|
+
}
|
|
132
|
+
function W(e) {
|
|
133
|
+
return e.filter((n) => n.tagName !== "A");
|
|
134
|
+
}
|
|
135
|
+
export {
|
|
136
|
+
k as FocusScope
|
|
137
|
+
};
|
package/dist/index103.js
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
var S = function(r) {
|
|
2
|
+
if (typeof document > "u")
|
|
3
|
+
return null;
|
|
4
|
+
var u = Array.isArray(r) ? r[0] : r;
|
|
5
|
+
return u.ownerDocument.body;
|
|
6
|
+
}, f = /* @__PURE__ */ new WeakMap(), v = /* @__PURE__ */ new WeakMap(), p = {}, h = 0, W = function(r) {
|
|
7
|
+
return r && (r.host || W(r.parentNode));
|
|
8
|
+
}, D = function(r, u) {
|
|
9
|
+
return u.map(function(e) {
|
|
10
|
+
if (r.contains(e))
|
|
11
|
+
return e;
|
|
12
|
+
var n = W(e);
|
|
13
|
+
return n && r.contains(n) ? n : (console.error("aria-hidden", e, "in not contained inside", r, ". Doing nothing"), null);
|
|
14
|
+
}).filter(function(e) {
|
|
15
|
+
return !!e;
|
|
16
|
+
});
|
|
17
|
+
}, E = function(r, u, e, n) {
|
|
18
|
+
var i = D(u, Array.isArray(r) ? r : [r]);
|
|
19
|
+
p[e] || (p[e] = /* @__PURE__ */ new WeakMap());
|
|
20
|
+
var s = p[e], l = [], o = /* @__PURE__ */ new Set(), b = new Set(i), y = function(t) {
|
|
21
|
+
!t || o.has(t) || (o.add(t), y(t.parentNode));
|
|
22
|
+
};
|
|
23
|
+
i.forEach(y);
|
|
24
|
+
var A = function(t) {
|
|
25
|
+
!t || b.has(t) || Array.prototype.forEach.call(t.children, function(a) {
|
|
26
|
+
if (o.has(a))
|
|
27
|
+
A(a);
|
|
28
|
+
else
|
|
29
|
+
try {
|
|
30
|
+
var c = a.getAttribute(n), w = c !== null && c !== "false", d = (f.get(a) || 0) + 1, M = (s.get(a) || 0) + 1;
|
|
31
|
+
f.set(a, d), s.set(a, M), l.push(a), d === 1 && w && v.set(a, !0), M === 1 && a.setAttribute(e, "true"), w || a.setAttribute(n, "true");
|
|
32
|
+
} catch (k) {
|
|
33
|
+
console.error("aria-hidden: cannot operate on ", a, k);
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
return A(u), o.clear(), h++, function() {
|
|
38
|
+
l.forEach(function(t) {
|
|
39
|
+
var a = f.get(t) - 1, c = s.get(t) - 1;
|
|
40
|
+
f.set(t, a), s.set(t, c), a || (v.has(t) || t.removeAttribute(n), v.delete(t)), c || t.removeAttribute(e);
|
|
41
|
+
}), h--, h || (f = /* @__PURE__ */ new WeakMap(), f = /* @__PURE__ */ new WeakMap(), v = /* @__PURE__ */ new WeakMap(), p = {});
|
|
42
|
+
};
|
|
43
|
+
}, C = function(r, u, e) {
|
|
44
|
+
e === void 0 && (e = "data-aria-hidden");
|
|
45
|
+
var n = Array.from(Array.isArray(r) ? r : [r]), i = S(r);
|
|
46
|
+
return i ? (n.push.apply(n, Array.from(i.querySelectorAll("[aria-live], script"))), E(n, i, e, "aria-hidden")) : function() {
|
|
47
|
+
return null;
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
export {
|
|
51
|
+
C as hideOthers
|
|
52
|
+
};
|
package/dist/index104.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { __assign as m } from "./index135.js";
|
|
2
|
+
import * as r from "react";
|
|
3
|
+
import { RemoveScroll as e } from "./index136.js";
|
|
4
|
+
import t from "./index137.js";
|
|
5
|
+
var s = r.forwardRef(function(a, o) {
|
|
6
|
+
return r.createElement(e, m({}, a, { ref: o, sideCar: t }));
|
|
7
|
+
});
|
|
8
|
+
s.classNames = e.classNames;
|
|
9
|
+
export {
|
|
10
|
+
s as default
|
|
11
|
+
};
|
package/dist/index105.js
ADDED
package/dist/index106.js
ADDED
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
import * as c from "react";
|
|
2
|
+
import { composeEventHandlers as p } from "./index83.js";
|
|
3
|
+
import { createCollection as V } from "./index81.js";
|
|
4
|
+
import { useComposedRefs as j } from "./index82.js";
|
|
5
|
+
import { createContextScope as z } from "./index80.js";
|
|
6
|
+
import { useId as q } from "./index86.js";
|
|
7
|
+
import { Primitive as G } from "./index85.js";
|
|
8
|
+
import { useCallbackRef as J } from "./index90.js";
|
|
9
|
+
import { useControllableState as Q } from "./index84.js";
|
|
10
|
+
import { useDirection as W } from "./index87.js";
|
|
11
|
+
import { jsx as d } from "react/jsx-runtime";
|
|
12
|
+
var y = "rovingFocusGroup.onEntryFocus", X = { bubbles: !1, cancelable: !0 }, I = "RovingFocusGroup", [D, N, Z] = V(I), [$, Fe] = z(
|
|
13
|
+
I,
|
|
14
|
+
[Z]
|
|
15
|
+
), [ee, oe] = $(I), O = c.forwardRef(
|
|
16
|
+
(e, r) => /* @__PURE__ */ d(D.Provider, { scope: e.__scopeRovingFocusGroup, children: /* @__PURE__ */ d(D.Slot, { scope: e.__scopeRovingFocusGroup, children: /* @__PURE__ */ d(te, { ...e, ref: r }) }) })
|
|
17
|
+
);
|
|
18
|
+
O.displayName = I;
|
|
19
|
+
var te = c.forwardRef((e, r) => {
|
|
20
|
+
const {
|
|
21
|
+
__scopeRovingFocusGroup: s,
|
|
22
|
+
orientation: o,
|
|
23
|
+
loop: T = !1,
|
|
24
|
+
dir: w,
|
|
25
|
+
currentTabStopId: v,
|
|
26
|
+
defaultCurrentTabStopId: C,
|
|
27
|
+
onCurrentTabStopIdChange: S,
|
|
28
|
+
onEntryFocus: m,
|
|
29
|
+
preventScrollOnEntryFocus: u = !1,
|
|
30
|
+
...b
|
|
31
|
+
} = e, F = c.useRef(null), g = j(r, F), R = W(w), [E, t] = Q({
|
|
32
|
+
prop: v,
|
|
33
|
+
defaultProp: C ?? null,
|
|
34
|
+
onChange: S,
|
|
35
|
+
caller: I
|
|
36
|
+
}), [i, h] = c.useState(!1), a = J(m), l = N(s), A = c.useRef(!1), [L, P] = c.useState(0);
|
|
37
|
+
return c.useEffect(() => {
|
|
38
|
+
const n = F.current;
|
|
39
|
+
if (n)
|
|
40
|
+
return n.addEventListener(y, a), () => n.removeEventListener(y, a);
|
|
41
|
+
}, [a]), /* @__PURE__ */ d(
|
|
42
|
+
ee,
|
|
43
|
+
{
|
|
44
|
+
scope: s,
|
|
45
|
+
orientation: o,
|
|
46
|
+
dir: R,
|
|
47
|
+
loop: T,
|
|
48
|
+
currentTabStopId: E,
|
|
49
|
+
onItemFocus: c.useCallback(
|
|
50
|
+
(n) => t(n),
|
|
51
|
+
[t]
|
|
52
|
+
),
|
|
53
|
+
onItemShiftTab: c.useCallback(() => h(!0), []),
|
|
54
|
+
onFocusableItemAdd: c.useCallback(
|
|
55
|
+
() => P((n) => n + 1),
|
|
56
|
+
[]
|
|
57
|
+
),
|
|
58
|
+
onFocusableItemRemove: c.useCallback(
|
|
59
|
+
() => P((n) => n - 1),
|
|
60
|
+
[]
|
|
61
|
+
),
|
|
62
|
+
children: /* @__PURE__ */ d(
|
|
63
|
+
G.div,
|
|
64
|
+
{
|
|
65
|
+
tabIndex: i || L === 0 ? -1 : 0,
|
|
66
|
+
"data-orientation": o,
|
|
67
|
+
...b,
|
|
68
|
+
ref: g,
|
|
69
|
+
style: { outline: "none", ...e.style },
|
|
70
|
+
onMouseDown: p(e.onMouseDown, () => {
|
|
71
|
+
A.current = !0;
|
|
72
|
+
}),
|
|
73
|
+
onFocus: p(e.onFocus, (n) => {
|
|
74
|
+
const U = !A.current;
|
|
75
|
+
if (n.target === n.currentTarget && U && !i) {
|
|
76
|
+
const x = new CustomEvent(y, X);
|
|
77
|
+
if (n.currentTarget.dispatchEvent(x), !x.defaultPrevented) {
|
|
78
|
+
const _ = l().filter((f) => f.focusable), B = _.find((f) => f.active), Y = _.find((f) => f.id === E), H = [B, Y, ..._].filter(
|
|
79
|
+
Boolean
|
|
80
|
+
).map((f) => f.ref.current);
|
|
81
|
+
k(H, u);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
A.current = !1;
|
|
85
|
+
}),
|
|
86
|
+
onBlur: p(e.onBlur, () => h(!1))
|
|
87
|
+
}
|
|
88
|
+
)
|
|
89
|
+
}
|
|
90
|
+
);
|
|
91
|
+
}), K = "RovingFocusGroupItem", M = c.forwardRef(
|
|
92
|
+
(e, r) => {
|
|
93
|
+
const {
|
|
94
|
+
__scopeRovingFocusGroup: s,
|
|
95
|
+
focusable: o = !0,
|
|
96
|
+
active: T = !1,
|
|
97
|
+
tabStopId: w,
|
|
98
|
+
children: v,
|
|
99
|
+
...C
|
|
100
|
+
} = e, S = q(), m = w || S, u = oe(K, s), b = u.currentTabStopId === m, F = N(s), { onFocusableItemAdd: g, onFocusableItemRemove: R, currentTabStopId: E } = u;
|
|
101
|
+
return c.useEffect(() => {
|
|
102
|
+
if (o)
|
|
103
|
+
return g(), () => R();
|
|
104
|
+
}, [o, g, R]), /* @__PURE__ */ d(
|
|
105
|
+
D.ItemSlot,
|
|
106
|
+
{
|
|
107
|
+
scope: s,
|
|
108
|
+
id: m,
|
|
109
|
+
focusable: o,
|
|
110
|
+
active: T,
|
|
111
|
+
children: /* @__PURE__ */ d(
|
|
112
|
+
G.span,
|
|
113
|
+
{
|
|
114
|
+
tabIndex: b ? 0 : -1,
|
|
115
|
+
"data-orientation": u.orientation,
|
|
116
|
+
...C,
|
|
117
|
+
ref: r,
|
|
118
|
+
onMouseDown: p(e.onMouseDown, (t) => {
|
|
119
|
+
o ? u.onItemFocus(m) : t.preventDefault();
|
|
120
|
+
}),
|
|
121
|
+
onFocus: p(e.onFocus, () => u.onItemFocus(m)),
|
|
122
|
+
onKeyDown: p(e.onKeyDown, (t) => {
|
|
123
|
+
if (t.key === "Tab" && t.shiftKey) {
|
|
124
|
+
u.onItemShiftTab();
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
if (t.target !== t.currentTarget) return;
|
|
128
|
+
const i = ce(t, u.orientation, u.dir);
|
|
129
|
+
if (i !== void 0) {
|
|
130
|
+
if (t.metaKey || t.ctrlKey || t.altKey || t.shiftKey) return;
|
|
131
|
+
t.preventDefault();
|
|
132
|
+
let a = F().filter((l) => l.focusable).map((l) => l.ref.current);
|
|
133
|
+
if (i === "last") a.reverse();
|
|
134
|
+
else if (i === "prev" || i === "next") {
|
|
135
|
+
i === "prev" && a.reverse();
|
|
136
|
+
const l = a.indexOf(t.currentTarget);
|
|
137
|
+
a = u.loop ? se(a, l + 1) : a.slice(l + 1);
|
|
138
|
+
}
|
|
139
|
+
setTimeout(() => k(a));
|
|
140
|
+
}
|
|
141
|
+
}),
|
|
142
|
+
children: typeof v == "function" ? v({ isCurrentTabStop: b, hasTabStop: E != null }) : v
|
|
143
|
+
}
|
|
144
|
+
)
|
|
145
|
+
}
|
|
146
|
+
);
|
|
147
|
+
}
|
|
148
|
+
);
|
|
149
|
+
M.displayName = K;
|
|
150
|
+
var re = {
|
|
151
|
+
ArrowLeft: "prev",
|
|
152
|
+
ArrowUp: "prev",
|
|
153
|
+
ArrowRight: "next",
|
|
154
|
+
ArrowDown: "next",
|
|
155
|
+
PageUp: "first",
|
|
156
|
+
Home: "first",
|
|
157
|
+
PageDown: "last",
|
|
158
|
+
End: "last"
|
|
159
|
+
};
|
|
160
|
+
function ne(e, r) {
|
|
161
|
+
return r !== "rtl" ? e : e === "ArrowLeft" ? "ArrowRight" : e === "ArrowRight" ? "ArrowLeft" : e;
|
|
162
|
+
}
|
|
163
|
+
function ce(e, r, s) {
|
|
164
|
+
const o = ne(e.key, s);
|
|
165
|
+
if (!(r === "vertical" && ["ArrowLeft", "ArrowRight"].includes(o)) && !(r === "horizontal" && ["ArrowUp", "ArrowDown"].includes(o)))
|
|
166
|
+
return re[o];
|
|
167
|
+
}
|
|
168
|
+
function k(e, r = !1) {
|
|
169
|
+
const s = document.activeElement;
|
|
170
|
+
for (const o of e)
|
|
171
|
+
if (o === s || (o.focus({ preventScroll: r }), document.activeElement !== s)) return;
|
|
172
|
+
}
|
|
173
|
+
function se(e, r) {
|
|
174
|
+
return e.map((s, o) => e[(r + o) % e.length]);
|
|
175
|
+
}
|
|
176
|
+
var ge = O, Re = M;
|
|
177
|
+
export {
|
|
178
|
+
Re as Item,
|
|
179
|
+
ge as Root,
|
|
180
|
+
O as RovingFocusGroup,
|
|
181
|
+
M as RovingFocusGroupItem,
|
|
182
|
+
Fe as createRovingFocusGroupScope
|
|
183
|
+
};
|