@drjoshcsimmons/scl 0.1.13 → 0.1.14

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.
Files changed (125) hide show
  1. package/dist/index100.js +13 -30
  2. package/dist/index101.js +8 -12
  3. package/dist/index102.js +29 -54
  4. package/dist/index103.js +4 -30
  5. package/dist/index104.js +24 -3
  6. package/dist/index105.js +5 -218
  7. package/dist/index106.js +51 -44
  8. package/dist/index107.js +30 -30
  9. package/dist/index108.js +1 -1
  10. package/dist/index109.js +1 -1
  11. package/dist/index11.js +2 -2
  12. package/dist/index110.js +649 -8
  13. package/dist/index111.js +8 -180
  14. package/dist/index112.js +15 -30
  15. package/dist/index113.js +11 -47
  16. package/dist/index114.js +200 -42
  17. package/dist/index115.js +22 -12
  18. package/dist/index116.js +392 -40
  19. package/dist/index117.js +48 -6
  20. package/dist/index118.js +42 -200
  21. package/dist/index119.js +20 -21
  22. package/dist/index12.js +1 -1
  23. package/dist/index120.js +9 -400
  24. package/dist/index121.js +32 -15
  25. package/dist/index122.js +12 -3
  26. package/dist/index123.js +6 -38
  27. package/dist/index124.js +48 -18
  28. package/dist/index126.js +3 -3
  29. package/dist/index127.js +3 -3
  30. package/dist/index129.js +1 -1
  31. package/dist/index13.js +2 -2
  32. package/dist/index130.js +1 -1
  33. package/dist/index131.js +5 -2
  34. package/dist/index132.js +3 -2
  35. package/dist/index133.js +24 -5
  36. package/dist/index134.js +113 -3
  37. package/dist/index135.js +15 -23
  38. package/dist/index136.js +519 -107
  39. package/dist/index137.js +126 -14
  40. package/dist/index138.js +125 -516
  41. package/dist/index139.js +2 -128
  42. package/dist/index14.js +2 -2
  43. package/dist/index140.js +2 -134
  44. package/dist/index141.js +69 -65
  45. package/dist/index142.js +8 -68
  46. package/dist/index143.js +14 -9
  47. package/dist/index144.js +66 -14
  48. package/dist/index145.js +64 -65
  49. package/dist/index15.js +2 -2
  50. package/dist/index17.js +4 -4
  51. package/dist/index18.js +2 -2
  52. package/dist/index20.js +2 -2
  53. package/dist/index21.js +1 -1
  54. package/dist/index22.js +1 -1
  55. package/dist/index23.js +2 -2
  56. package/dist/index24.js +1 -1
  57. package/dist/index25.js +4 -4
  58. package/dist/index26.js +1 -1
  59. package/dist/index27.js +3 -3
  60. package/dist/index31.js +1 -1
  61. package/dist/index33.js +1 -1
  62. package/dist/index36.js +2 -2
  63. package/dist/index37.js +1 -1
  64. package/dist/index4.js +2 -2
  65. package/dist/index45.js +33 -237
  66. package/dist/index46.js +241 -11
  67. package/dist/index47.js +237 -33
  68. package/dist/index48.js +11 -260
  69. package/dist/index49.js +260 -12
  70. package/dist/index5.js +1 -1
  71. package/dist/index50.js +12 -310
  72. package/dist/index51.js +530 -12
  73. package/dist/index52.js +18 -245
  74. package/dist/index53.js +161 -9
  75. package/dist/index54.js +63 -215
  76. package/dist/index55.js +336 -11
  77. package/dist/index56.js +236 -11
  78. package/dist/index57.js +11 -125
  79. package/dist/index58.js +72 -63
  80. package/dist/index59.js +236 -69
  81. package/dist/index6.js +1 -1
  82. package/dist/index60.js +9 -860
  83. package/dist/index61.js +130 -9
  84. package/dist/index62.js +17 -117
  85. package/dist/index63.js +860 -18
  86. package/dist/index64.js +9 -60
  87. package/dist/index65.js +28 -238
  88. package/dist/index66.js +10 -10
  89. package/dist/index67.js +54 -330
  90. package/dist/index68.js +98 -141
  91. package/dist/index69.js +219 -25
  92. package/dist/index7.js +1 -1
  93. package/dist/index70.js +11 -236
  94. package/dist/index71.js +12 -130
  95. package/dist/index72.js +125 -12
  96. package/dist/index73.js +298 -242
  97. package/dist/index74.js +12 -530
  98. package/dist/index75.js +252 -20
  99. package/dist/index76.js +5 -66
  100. package/dist/index77.js +25 -44
  101. package/dist/index78.js +64 -23
  102. package/dist/index79.js +123 -5
  103. package/dist/index8.js +1 -1
  104. package/dist/index80.js +13 -50
  105. package/dist/index81.js +133 -32
  106. package/dist/index82.js +1 -1
  107. package/dist/index83.js +218 -7
  108. package/dist/index84.js +13 -124
  109. package/dist/index85.js +60 -126
  110. package/dist/index86.js +33 -13
  111. package/dist/index87.js +42 -63
  112. package/dist/index88.js +50 -13
  113. package/dist/index89.js +50 -9
  114. package/dist/index9.js +2 -2
  115. package/dist/index90.js +9 -50
  116. package/dist/index91.js +41 -43
  117. package/dist/index92.js +7 -5
  118. package/dist/index93.js +47 -24
  119. package/dist/index94.js +30 -15
  120. package/dist/index95.js +159 -628
  121. package/dist/index96.js +54 -8
  122. package/dist/index97.js +10 -54
  123. package/dist/index98.js +4 -11
  124. package/dist/index99.js +30 -4
  125. package/package.json +1 -1
package/dist/index85.js CHANGED
@@ -1,137 +1,71 @@
1
- import * as d from "react";
2
- import { useComposedRefs as R } from "./index78.js";
3
- import { Primitive as M } from "./index81.js";
4
- import { useCallbackRef as y } from "./index98.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;
1
+ import * as a from "react";
2
+ import { useComposedRefs as E } from "./index77.js";
3
+ import { useLayoutEffect as A } from "./index98.js";
4
+ function T(n, e) {
5
+ return a.useReducer((r, t) => e[r][t] ?? r, n);
6
+ }
7
+ var R = (n) => {
8
+ const { present: e, children: r } = n, t = v(e), i = typeof r == "function" ? r({ present: t.isPresent }) : a.Children.only(r), c = E(t.ref, P(i));
9
+ return typeof r == "function" || t.isPresent ? a.cloneElement(i, { ref: c }) : null;
10
+ };
11
+ R.displayName = "Presence";
12
+ function v(n) {
13
+ const [e, r] = a.useState(), t = a.useRef(null), i = a.useRef(n), c = a.useRef("none"), p = n ? "mounted" : "unmounted", [N, s] = T(p, {
14
+ mounted: {
15
+ UNMOUNT: "unmounted",
16
+ ANIMATION_OUT: "unmountSuspended"
17
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
- }
18
+ unmountSuspended: {
19
+ MOUNT: "mounted",
20
+ ANIMATION_END: "unmounted"
67
21
  },
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;
22
+ unmounted: {
23
+ MOUNT: "mounted"
87
24
  }
88
25
  });
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();
26
+ return a.useEffect(() => {
27
+ const o = l(t.current);
28
+ c.current = N === "mounted" ? o : "none";
29
+ }, [N]), A(() => {
30
+ const o = t.current, m = i.current;
31
+ if (m !== n) {
32
+ const f = c.current, u = l(o);
33
+ n ? s("MOUNT") : u === "none" || (o == null ? void 0 : o.display) === "none" ? s("UNMOUNT") : s(m && f !== u ? "ANIMATION_OUT" : "UNMOUNT"), i.current = n;
125
34
  }
35
+ }, [n, s]), A(() => {
36
+ if (e) {
37
+ let o;
38
+ const m = e.ownerDocument.defaultView ?? window, d = (u) => {
39
+ const g = l(t.current).includes(CSS.escape(u.animationName));
40
+ if (u.target === e && g && (s("ANIMATION_END"), !i.current)) {
41
+ const O = e.style.animationFillMode;
42
+ e.style.animationFillMode = "forwards", o = m.setTimeout(() => {
43
+ e.style.animationFillMode === "forwards" && (e.style.animationFillMode = O);
44
+ });
45
+ }
46
+ }, f = (u) => {
47
+ u.target === e && (c.current = l(t.current));
48
+ };
49
+ return e.addEventListener("animationstart", f), e.addEventListener("animationcancel", d), e.addEventListener("animationend", d), () => {
50
+ m.clearTimeout(o), e.removeEventListener("animationstart", f), e.removeEventListener("animationcancel", d), e.removeEventListener("animationend", d);
51
+ };
52
+ } else
53
+ s("ANIMATION_END");
54
+ }, [e, s]), {
55
+ isPresent: ["mounted", "unmountSuspended"].includes(N),
56
+ ref: a.useCallback((o) => {
57
+ t.current = o ? getComputedStyle(o) : null, r(o);
58
+ }, [])
126
59
  };
127
60
  }
128
- function C(e, n) {
129
- const t = [...e], u = t.indexOf(n);
130
- return u !== -1 && t.splice(u, 1), t;
61
+ function l(n) {
62
+ return (n == null ? void 0 : n.animationName) || "none";
131
63
  }
132
- function W(e) {
133
- return e.filter((n) => n.tagName !== "A");
64
+ function P(n) {
65
+ var t, i;
66
+ let e = (t = Object.getOwnPropertyDescriptor(n.props, "ref")) == null ? void 0 : t.get, r = e && "isReactWarning" in e && e.isReactWarning;
67
+ return r ? n.ref : (e = (i = Object.getOwnPropertyDescriptor(n, "ref")) == null ? void 0 : i.get, r = e && "isReactWarning" in e && e.isReactWarning, r ? n.props.ref : n.props.ref || n.ref);
134
68
  }
135
69
  export {
136
- k as FocusScope
70
+ R as Presence
137
71
  };
package/dist/index86.js CHANGED
@@ -1,16 +1,36 @@
1
- import * as r from "react";
2
- import s from "react-dom";
3
- import { Primitive as c } from "./index81.js";
4
- import { useLayoutEffect as u } from "./index99.js";
1
+ import * as f from "react";
2
+ import * as p from "react-dom";
3
+ import { createSlot as c } from "./index117.js";
5
4
  import { jsx as l } from "react/jsx-runtime";
6
- var p = "Portal", d = r.forwardRef((e, a) => {
7
- var o;
8
- const { container: f, ...i } = e, [m, n] = r.useState(!1);
9
- u(() => n(!0), []);
10
- const t = f || m && ((o = globalThis == null ? void 0 : globalThis.document) == null ? void 0 : o.body);
11
- return t ? s.createPortal(/* @__PURE__ */ l(c.div, { ...i, ref: a }), t) : null;
12
- });
13
- d.displayName = p;
5
+ var u = [
6
+ "a",
7
+ "button",
8
+ "div",
9
+ "form",
10
+ "h2",
11
+ "h3",
12
+ "img",
13
+ "input",
14
+ "label",
15
+ "li",
16
+ "nav",
17
+ "ol",
18
+ "p",
19
+ "select",
20
+ "span",
21
+ "svg",
22
+ "ul"
23
+ ], h = u.reduce((t, i) => {
24
+ const o = c(`Primitive.${i}`), r = f.forwardRef((e, m) => {
25
+ const { asChild: s, ...a } = e, n = s ? o : i;
26
+ return typeof window < "u" && (window[Symbol.for("radix-ui")] = !0), /* @__PURE__ */ l(n, { ...a, ref: m });
27
+ });
28
+ return r.displayName = `Primitive.${i}`, { ...t, [i]: r };
29
+ }, {});
30
+ function w(t, i) {
31
+ t && p.flushSync(() => t.dispatchEvent(i));
32
+ }
14
33
  export {
15
- d as Portal
34
+ h as Primitive,
35
+ w as dispatchDiscreteCustomEvent
16
36
  };
package/dist/index87.js CHANGED
@@ -1,71 +1,50 @@
1
- import * as a from "react";
2
- import { useComposedRefs as E } from "./index78.js";
3
- import { useLayoutEffect as A } from "./index99.js";
4
- function T(n, e) {
5
- return a.useReducer((r, t) => e[r][t] ?? r, n);
6
- }
7
- var R = (n) => {
8
- const { present: e, children: r } = n, t = v(e), i = typeof r == "function" ? r({ present: t.isPresent }) : a.Children.only(r), c = E(t.ref, P(i));
9
- return typeof r == "function" || t.isPresent ? a.cloneElement(i, { ref: c }) : null;
10
- };
11
- R.displayName = "Presence";
12
- function v(n) {
13
- const [e, r] = a.useState(), t = a.useRef(null), i = a.useRef(n), c = a.useRef("none"), p = n ? "mounted" : "unmounted", [N, s] = T(p, {
14
- mounted: {
15
- UNMOUNT: "unmounted",
16
- ANIMATION_OUT: "unmountSuspended"
17
- },
18
- unmountSuspended: {
19
- MOUNT: "mounted",
20
- ANIMATION_END: "unmounted"
21
- },
22
- unmounted: {
23
- MOUNT: "mounted"
1
+ import * as l from "react";
2
+ import { composeRefs as m } from "./index77.js";
3
+ import { jsx as u } from "react/jsx-runtime";
4
+ // @__NO_SIDE_EFFECTS__
5
+ function b(e) {
6
+ const n = /* @__PURE__ */ y(e), o = l.forwardRef((t, r) => {
7
+ const { children: i, ...c } = t, s = l.Children.toArray(i), a = s.find(E);
8
+ if (a) {
9
+ const f = a.props.children, d = s.map((p) => p === a ? l.Children.count(f) > 1 ? l.Children.only(null) : l.isValidElement(f) ? f.props.children : null : p);
10
+ return /* @__PURE__ */ u(n, { ...c, ref: r, children: l.isValidElement(f) ? l.cloneElement(f, void 0, d) : null });
24
11
  }
12
+ return /* @__PURE__ */ u(n, { ...c, ref: r, children: i });
25
13
  });
26
- return a.useEffect(() => {
27
- const o = l(t.current);
28
- c.current = N === "mounted" ? o : "none";
29
- }, [N]), A(() => {
30
- const o = t.current, m = i.current;
31
- if (m !== n) {
32
- const f = c.current, u = l(o);
33
- n ? s("MOUNT") : u === "none" || (o == null ? void 0 : o.display) === "none" ? s("UNMOUNT") : s(m && f !== u ? "ANIMATION_OUT" : "UNMOUNT"), i.current = n;
14
+ return o.displayName = `${e}.Slot`, o;
15
+ }
16
+ // @__NO_SIDE_EFFECTS__
17
+ function y(e) {
18
+ const n = l.forwardRef((o, t) => {
19
+ const { children: r, ...i } = o;
20
+ if (l.isValidElement(r)) {
21
+ const c = S(r), s = C(i, r.props);
22
+ return r.type !== l.Fragment && (s.ref = t ? m(t, c) : c), l.cloneElement(r, s);
34
23
  }
35
- }, [n, s]), A(() => {
36
- if (e) {
37
- let o;
38
- const m = e.ownerDocument.defaultView ?? window, d = (u) => {
39
- const g = l(t.current).includes(CSS.escape(u.animationName));
40
- if (u.target === e && g && (s("ANIMATION_END"), !i.current)) {
41
- const O = e.style.animationFillMode;
42
- e.style.animationFillMode = "forwards", o = m.setTimeout(() => {
43
- e.style.animationFillMode === "forwards" && (e.style.animationFillMode = O);
44
- });
45
- }
46
- }, f = (u) => {
47
- u.target === e && (c.current = l(t.current));
48
- };
49
- return e.addEventListener("animationstart", f), e.addEventListener("animationcancel", d), e.addEventListener("animationend", d), () => {
50
- m.clearTimeout(o), e.removeEventListener("animationstart", f), e.removeEventListener("animationcancel", d), e.removeEventListener("animationend", d);
51
- };
52
- } else
53
- s("ANIMATION_END");
54
- }, [e, s]), {
55
- isPresent: ["mounted", "unmountSuspended"].includes(N),
56
- ref: a.useCallback((o) => {
57
- t.current = o ? getComputedStyle(o) : null, r(o);
58
- }, [])
59
- };
24
+ return l.Children.count(r) > 1 ? l.Children.only(null) : null;
25
+ });
26
+ return n.displayName = `${e}.SlotClone`, n;
27
+ }
28
+ var g = Symbol("radix.slottable");
29
+ function E(e) {
30
+ return l.isValidElement(e) && typeof e.type == "function" && "__radixId" in e.type && e.type.__radixId === g;
60
31
  }
61
- function l(n) {
62
- return (n == null ? void 0 : n.animationName) || "none";
32
+ function C(e, n) {
33
+ const o = { ...n };
34
+ for (const t in n) {
35
+ const r = e[t], i = n[t];
36
+ /^on[A-Z]/.test(t) ? r && i ? o[t] = (...s) => {
37
+ const a = i(...s);
38
+ return r(...s), a;
39
+ } : r && (o[t] = r) : t === "style" ? o[t] = { ...r, ...i } : t === "className" && (o[t] = [r, i].filter(Boolean).join(" "));
40
+ }
41
+ return { ...e, ...o };
63
42
  }
64
- function P(n) {
65
- var t, i;
66
- let e = (t = Object.getOwnPropertyDescriptor(n.props, "ref")) == null ? void 0 : t.get, r = e && "isReactWarning" in e && e.isReactWarning;
67
- return r ? n.ref : (e = (i = Object.getOwnPropertyDescriptor(n, "ref")) == null ? void 0 : i.get, r = e && "isReactWarning" in e && e.isReactWarning, r ? n.props.ref : n.props.ref || n.ref);
43
+ function S(e) {
44
+ var t, r;
45
+ let n = (t = Object.getOwnPropertyDescriptor(e.props, "ref")) == null ? void 0 : t.get, o = n && "isReactWarning" in n && n.isReactWarning;
46
+ return o ? e.ref : (n = (r = Object.getOwnPropertyDescriptor(e, "ref")) == null ? void 0 : r.get, o = n && "isReactWarning" in n && n.isReactWarning, o ? e.props.ref : e.props.ref || e.ref);
68
47
  }
69
48
  export {
70
- R as Presence
49
+ b as createSlot
71
50
  };
package/dist/index88.js CHANGED
@@ -1,17 +1,54 @@
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
- }, []);
1
+ import * as n from "react";
2
+ import { useLayoutEffect as v } from "./index98.js";
3
+ var E = n[" useInsertionEffect ".trim().toString()] || v;
4
+ function y({
5
+ prop: t,
6
+ defaultProp: u,
7
+ onChange: o = () => {
8
+ },
9
+ caller: i
10
+ }) {
11
+ const [l, e, r] = w({
12
+ defaultProp: u,
13
+ onChange: o
14
+ }), c = t !== void 0, a = c ? t : l;
15
+ {
16
+ const s = n.useRef(t !== void 0);
17
+ n.useEffect(() => {
18
+ const f = s.current;
19
+ f !== c && console.warn(
20
+ `${i} is changing from ${f ? "controlled" : "uncontrolled"} to ${c ? "controlled" : "uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`
21
+ ), s.current = c;
22
+ }, [c, i]);
23
+ }
24
+ const m = n.useCallback(
25
+ (s) => {
26
+ var f;
27
+ if (c) {
28
+ const d = R(s) ? s(t) : s;
29
+ d !== t && ((f = r.current) == null || f.call(r, d));
30
+ } else
31
+ e(s);
32
+ },
33
+ [c, t, e, r]
34
+ );
35
+ return [a, m];
10
36
  }
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;
37
+ function w({
38
+ defaultProp: t,
39
+ onChange: u
40
+ }) {
41
+ const [o, i] = n.useState(t), l = n.useRef(o), e = n.useRef(u);
42
+ return E(() => {
43
+ e.current = u;
44
+ }, [u]), n.useEffect(() => {
45
+ var r;
46
+ l.current !== o && ((r = e.current) == null || r.call(e, o), l.current = o);
47
+ }, [o, l]), [o, i, e];
48
+ }
49
+ function R(t) {
50
+ return typeof t == "function";
14
51
  }
15
52
  export {
16
- a as useFocusGuards
53
+ y as useControllableState
17
54
  };
package/dist/index89.js CHANGED
@@ -1,11 +1,52 @@
1
- import { __assign as m } from "./index125.js";
2
- import * as r from "react";
3
- import { RemoveScroll as e } from "./index126.js";
4
- import t from "./index127.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;
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
+ };
9
50
  export {
10
- s as default
51
+ C as hideOthers
11
52
  };
package/dist/index9.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { jsx as n } from "react/jsx-runtime";
2
2
  import * as s from "react";
3
- import { Root as d } from "./index64.js";
4
- import { cva as b } from "./index47.js";
3
+ import { Root as d } from "./index67.js";
4
+ import { cva as b } from "./index45.js";
5
5
  import { cn as c } from "./index2.js";
6
6
  const p = b(
7
7
  "inline-flex items-center justify-center gap-2 whitespace-nowrap font-mono font-bold uppercase tracking-wider transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:pointer-events-none disabled:opacity-30 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
package/dist/index90.js CHANGED
@@ -1,52 +1,11 @@
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
- };
1
+ import { __assign as m } from "./index125.js";
2
+ import * as r from "react";
3
+ import { RemoveScroll as e } from "./index126.js";
4
+ import t from "./index127.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;
50
9
  export {
51
- C as hideOthers
10
+ s as default
52
11
  };