@drjoshcsimmons/scl 0.1.2 → 0.1.3

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 (102) hide show
  1. package/README.md +202 -13
  2. package/dist/index100.js +49 -218
  3. package/dist/index101.js +8 -649
  4. package/dist/index102.js +628 -159
  5. package/dist/index103.js +180 -3
  6. package/dist/index104.js +15 -30
  7. package/dist/index106.js +21 -12
  8. package/dist/index107.js +3 -15
  9. package/dist/index108.js +32 -3
  10. package/dist/index109.js +12 -32
  11. package/dist/index11.js +2 -2
  12. package/dist/index110.js +12 -18
  13. package/dist/index112.js +1 -1
  14. package/dist/index115.js +1 -1
  15. package/dist/index116.js +1 -1
  16. package/dist/index117.js +2 -25
  17. package/dist/index118.js +2 -29
  18. package/dist/index119.js +25 -5
  19. package/dist/index12.js +1 -1
  20. package/dist/index120.js +29 -2
  21. package/dist/index121.js +5 -2
  22. package/dist/index125.js +1 -1
  23. package/dist/index126.js +1 -1
  24. package/dist/index13.js +2 -2
  25. package/dist/index130.js +1 -1
  26. package/dist/index14.js +2 -2
  27. package/dist/index15.js +2 -2
  28. package/dist/index17.js +4 -4
  29. package/dist/index18.js +2 -2
  30. package/dist/index20.js +2 -2
  31. package/dist/index21.js +1 -1
  32. package/dist/index22.js +1 -1
  33. package/dist/index23.js +2 -2
  34. package/dist/index24.js +1 -1
  35. package/dist/index25.js +4 -4
  36. package/dist/index27.js +3 -3
  37. package/dist/index29.js +1 -1
  38. package/dist/index31.js +1 -1
  39. package/dist/index36.js +1 -1
  40. package/dist/index37.js +1 -1
  41. package/dist/index4.js +2 -2
  42. package/dist/index45.js +108 -220
  43. package/dist/index46.js +33 -11
  44. package/dist/index47.js +118 -33
  45. package/dist/index48.js +62 -107
  46. package/dist/index49.js +237 -61
  47. package/dist/index5.js +1 -1
  48. package/dist/index50.js +9 -310
  49. package/dist/index51.js +237 -12
  50. package/dist/index52.js +11 -260
  51. package/dist/index53.js +18 -12
  52. package/dist/index54.js +856 -56
  53. package/dist/index55.js +9 -254
  54. package/dist/index56.js +205 -229
  55. package/dist/index57.js +5 -3
  56. package/dist/index58.js +11 -125
  57. package/dist/index59.js +60 -12
  58. package/dist/index6.js +1 -1
  59. package/dist/index60.js +252 -16
  60. package/dist/index61.js +511 -206
  61. package/dist/index62.js +241 -11
  62. package/dist/index63.js +260 -11
  63. package/dist/index64.js +12 -241
  64. package/dist/index65.js +12 -236
  65. package/dist/index66.js +392 -487
  66. package/dist/index67.js +8 -8
  67. package/dist/index68.js +325 -119
  68. package/dist/index69.js +66 -320
  69. package/dist/index7.js +1 -1
  70. package/dist/index70.js +299 -71
  71. package/dist/index71.js +12 -435
  72. package/dist/index72.js +1 -1
  73. package/dist/index73.js +204 -828
  74. package/dist/index74.js +130 -9
  75. package/dist/index75.js +3 -3
  76. package/dist/index76.js +66 -5
  77. package/dist/index77.js +23 -64
  78. package/dist/index78.js +6 -51
  79. package/dist/index79.js +54 -4
  80. package/dist/index8.js +1 -1
  81. package/dist/index80.js +49 -24
  82. package/dist/index81.js +4 -34
  83. package/dist/index82.js +32 -67
  84. package/dist/index83.js +68 -10
  85. package/dist/index84.js +10 -54
  86. package/dist/index85.js +54 -10
  87. package/dist/index86.js +11 -30
  88. package/dist/index87.js +30 -13
  89. package/dist/index88.js +11 -44
  90. package/dist/index89.js +5 -7
  91. package/dist/index9.js +2 -2
  92. package/dist/index90.js +24 -14
  93. package/dist/index91.js +44 -123
  94. package/dist/index92.js +7 -134
  95. package/dist/index93.js +4 -14
  96. package/dist/index94.js +122 -12
  97. package/dist/index95.js +14 -8
  98. package/dist/index96.js +133 -48
  99. package/dist/index97.js +216 -51
  100. package/dist/index98.js +14 -6
  101. package/dist/index99.js +30 -25
  102. package/package.json +1 -1
package/dist/index74.js CHANGED
@@ -1,11 +1,132 @@
1
- import e from "./index107.js";
2
- /**
3
- * @license lucide-react v0.460.0 - ISC
4
- *
5
- * This source code is licensed under the ISC license.
6
- * See the LICENSE file in the root directory of this source tree.
7
- */
8
- const r = e("ChevronUp", [["path", { d: "m18 15-6-6-6 6", key: "153udz" }]]);
1
+ import * as r from "react";
2
+ import { composeEventHandlers as T } from "./index78.js";
3
+ import { useComposedRefs as P } from "./index77.js";
4
+ import { createContextScope as I } from "./index76.js";
5
+ import { useControllableState as M } from "./index80.js";
6
+ import { usePrevious as H } from "./index89.js";
7
+ import { useSize as j } from "./index90.js";
8
+ import { Primitive as y } from "./index82.js";
9
+ import { jsxs as A, jsx as m } from "react/jsx-runtime";
10
+ var h = "Switch", [U] = I(h), [q, z] = U(h), R = r.forwardRef(
11
+ (t, a) => {
12
+ const {
13
+ __scopeSwitch: e,
14
+ name: c,
15
+ checked: o,
16
+ defaultChecked: v,
17
+ required: i,
18
+ disabled: n,
19
+ value: p = "on",
20
+ onCheckedChange: w,
21
+ form: s,
22
+ ...S
23
+ } = t, [d, u] = r.useState(null), b = P(a, (f) => u(f)), C = r.useRef(!1), k = d ? s || !!d.closest("form") : !0, [l, B] = M({
24
+ prop: o,
25
+ defaultProp: v ?? !1,
26
+ onChange: w,
27
+ caller: h
28
+ });
29
+ return /* @__PURE__ */ A(q, { scope: e, checked: l, disabled: n, children: [
30
+ /* @__PURE__ */ m(
31
+ y.button,
32
+ {
33
+ type: "button",
34
+ role: "switch",
35
+ "aria-checked": l,
36
+ "aria-required": i,
37
+ "data-state": g(l),
38
+ "data-disabled": n ? "" : void 0,
39
+ disabled: n,
40
+ value: p,
41
+ ...S,
42
+ ref: b,
43
+ onClick: T(t.onClick, (f) => {
44
+ B((N) => !N), k && (C.current = f.isPropagationStopped(), C.current || f.stopPropagation());
45
+ })
46
+ }
47
+ ),
48
+ k && /* @__PURE__ */ m(
49
+ x,
50
+ {
51
+ control: d,
52
+ bubbles: !C.current,
53
+ name: c,
54
+ value: p,
55
+ checked: l,
56
+ required: i,
57
+ disabled: n,
58
+ form: s,
59
+ style: { transform: "translateX(-100%)" }
60
+ }
61
+ )
62
+ ] });
63
+ }
64
+ );
65
+ R.displayName = h;
66
+ var E = "SwitchThumb", _ = r.forwardRef(
67
+ (t, a) => {
68
+ const { __scopeSwitch: e, ...c } = t, o = z(E, e);
69
+ return /* @__PURE__ */ m(
70
+ y.span,
71
+ {
72
+ "data-state": g(o.checked),
73
+ "data-disabled": o.disabled ? "" : void 0,
74
+ ...c,
75
+ ref: a
76
+ }
77
+ );
78
+ }
79
+ );
80
+ _.displayName = E;
81
+ var L = "SwitchBubbleInput", x = r.forwardRef(
82
+ ({
83
+ __scopeSwitch: t,
84
+ control: a,
85
+ checked: e,
86
+ bubbles: c = !0,
87
+ ...o
88
+ }, v) => {
89
+ const i = r.useRef(null), n = P(i, v), p = H(e), w = j(a);
90
+ return r.useEffect(() => {
91
+ const s = i.current;
92
+ if (!s) return;
93
+ const S = window.HTMLInputElement.prototype, u = Object.getOwnPropertyDescriptor(
94
+ S,
95
+ "checked"
96
+ ).set;
97
+ if (p !== e && u) {
98
+ const b = new Event("click", { bubbles: c });
99
+ u.call(s, e), s.dispatchEvent(b);
100
+ }
101
+ }, [p, e, c]), /* @__PURE__ */ m(
102
+ "input",
103
+ {
104
+ type: "checkbox",
105
+ "aria-hidden": !0,
106
+ defaultChecked: e,
107
+ ...o,
108
+ tabIndex: -1,
109
+ ref: n,
110
+ style: {
111
+ ...o.style,
112
+ ...w,
113
+ position: "absolute",
114
+ pointerEvents: "none",
115
+ opacity: 0,
116
+ margin: 0
117
+ }
118
+ }
119
+ );
120
+ }
121
+ );
122
+ x.displayName = L;
123
+ function g(t) {
124
+ return t ? "checked" : "unchecked";
125
+ }
126
+ var Q = R, V = _;
9
127
  export {
10
- r as default
128
+ Q as Root,
129
+ R as Switch,
130
+ _ as SwitchThumb,
131
+ V as Thumb
11
132
  };
package/dist/index75.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as f from "react";
2
- import { composeEventHandlers as m } from "./index76.js";
3
- import { useControllableState as p } from "./index78.js";
4
- import { Primitive as b } from "./index81.js";
2
+ import { composeEventHandlers as m } from "./index78.js";
3
+ import { useControllableState as p } from "./index80.js";
4
+ import { Primitive as b } from "./index82.js";
5
5
  import { jsx as c } from "react/jsx-runtime";
6
6
  var r = "Toggle", t = f.forwardRef((e, a) => {
7
7
  const { pressed: s, defaultPressed: d, onPressedChange: i, ...l } = e, [o, n] = p({
package/dist/index76.js CHANGED
@@ -1,9 +1,70 @@
1
- function h(f, c, { checkForDefaultPrevented: p = !0 } = {}) {
2
- return function(s) {
3
- if (f == null || f(s), p === !1 || !s.defaultPrevented)
4
- return c == null ? void 0 : c(s);
1
+ import * as u from "react";
2
+ import { jsx as h } from "react/jsx-runtime";
3
+ function w(e, c) {
4
+ const o = u.createContext(c), a = (r) => {
5
+ const { children: t, ...n } = r, s = u.useMemo(() => n, Object.values(n));
6
+ return /* @__PURE__ */ h(o.Provider, { value: s, children: t });
5
7
  };
8
+ a.displayName = e + "Provider";
9
+ function i(r) {
10
+ const t = u.useContext(o);
11
+ if (t) return t;
12
+ if (c !== void 0) return c;
13
+ throw new Error(`\`${r}\` must be used within \`${e}\``);
14
+ }
15
+ return [a, i];
16
+ }
17
+ function _(e, c = []) {
18
+ let o = [];
19
+ function a(r, t) {
20
+ const n = u.createContext(t), s = o.length;
21
+ o = [...o, t];
22
+ const p = (d) => {
23
+ var S;
24
+ const { scope: x, children: C, ...m } = d, v = ((S = x == null ? void 0 : x[e]) == null ? void 0 : S[s]) || n, P = u.useMemo(() => m, Object.values(m));
25
+ return /* @__PURE__ */ h(v.Provider, { value: P, children: C });
26
+ };
27
+ p.displayName = r + "Provider";
28
+ function f(d, x) {
29
+ var v;
30
+ const C = ((v = x == null ? void 0 : x[e]) == null ? void 0 : v[s]) || n, m = u.useContext(C);
31
+ if (m) return m;
32
+ if (t !== void 0) return t;
33
+ throw new Error(`\`${d}\` must be used within \`${r}\``);
34
+ }
35
+ return [p, f];
36
+ }
37
+ const i = () => {
38
+ const r = o.map((t) => u.createContext(t));
39
+ return function(n) {
40
+ const s = (n == null ? void 0 : n[e]) || r;
41
+ return u.useMemo(
42
+ () => ({ [`__scope${e}`]: { ...n, [e]: s } }),
43
+ [n, s]
44
+ );
45
+ };
46
+ };
47
+ return i.scopeName = e, [a, l(i, ...c)];
48
+ }
49
+ function l(...e) {
50
+ const c = e[0];
51
+ if (e.length === 1) return c;
52
+ const o = () => {
53
+ const a = e.map((i) => ({
54
+ useScope: i(),
55
+ scopeName: i.scopeName
56
+ }));
57
+ return function(r) {
58
+ const t = a.reduce((n, { useScope: s, scopeName: p }) => {
59
+ const d = s(r)[`__scope${p}`];
60
+ return { ...n, ...d };
61
+ }, {});
62
+ return u.useMemo(() => ({ [`__scope${c.scopeName}`]: t }), [t]);
63
+ };
64
+ };
65
+ return o.scopeName = c.scopeName, o;
6
66
  }
7
67
  export {
8
- h as composeEventHandlers
68
+ w as createContext,
69
+ _ as createContextScope
9
70
  };
package/dist/index77.js CHANGED
@@ -1,70 +1,29 @@
1
- import * as u from "react";
2
- import { jsx as h } from "react/jsx-runtime";
3
- function w(e, c) {
4
- const o = u.createContext(c), a = (r) => {
5
- const { children: t, ...n } = r, s = u.useMemo(() => n, Object.values(n));
6
- return /* @__PURE__ */ h(o.Provider, { value: s, children: t });
7
- };
8
- a.displayName = e + "Provider";
9
- function i(r) {
10
- const t = u.useContext(o);
11
- if (t) return t;
12
- if (c !== void 0) return c;
13
- throw new Error(`\`${r}\` must be used within \`${e}\``);
14
- }
15
- return [a, i];
1
+ import * as f from "react";
2
+ function l(n, o) {
3
+ if (typeof n == "function")
4
+ return n(o);
5
+ n != null && (n.current = o);
16
6
  }
17
- function _(e, c = []) {
18
- let o = [];
19
- function a(r, t) {
20
- const n = u.createContext(t), s = o.length;
21
- o = [...o, t];
22
- const p = (d) => {
23
- var S;
24
- const { scope: x, children: C, ...m } = d, v = ((S = x == null ? void 0 : x[e]) == null ? void 0 : S[s]) || n, P = u.useMemo(() => m, Object.values(m));
25
- return /* @__PURE__ */ h(v.Provider, { value: P, children: C });
26
- };
27
- p.displayName = r + "Provider";
28
- function f(d, x) {
29
- var v;
30
- const C = ((v = x == null ? void 0 : x[e]) == null ? void 0 : v[s]) || n, m = u.useContext(C);
31
- if (m) return m;
32
- if (t !== void 0) return t;
33
- throw new Error(`\`${d}\` must be used within \`${r}\``);
34
- }
35
- return [p, f];
36
- }
37
- const i = () => {
38
- const r = o.map((t) => u.createContext(t));
39
- return function(n) {
40
- const s = (n == null ? void 0 : n[e]) || r;
41
- return u.useMemo(
42
- () => ({ [`__scope${e}`]: { ...n, [e]: s } }),
43
- [n, s]
44
- );
45
- };
7
+ function i(...n) {
8
+ return (o) => {
9
+ let u = !1;
10
+ const c = n.map((t) => {
11
+ const e = l(t, o);
12
+ return !u && typeof e == "function" && (u = !0), e;
13
+ });
14
+ if (u)
15
+ return () => {
16
+ for (let t = 0; t < c.length; t++) {
17
+ const e = c[t];
18
+ typeof e == "function" ? e() : l(n[t], null);
19
+ }
20
+ };
46
21
  };
47
- return i.scopeName = e, [a, l(i, ...c)];
48
22
  }
49
- function l(...e) {
50
- const c = e[0];
51
- if (e.length === 1) return c;
52
- const o = () => {
53
- const a = e.map((i) => ({
54
- useScope: i(),
55
- scopeName: i.scopeName
56
- }));
57
- return function(r) {
58
- const t = a.reduce((n, { useScope: s, scopeName: p }) => {
59
- const d = s(r)[`__scope${p}`];
60
- return { ...n, ...d };
61
- }, {});
62
- return u.useMemo(() => ({ [`__scope${c.scopeName}`]: t }), [t]);
63
- };
64
- };
65
- return o.scopeName = c.scopeName, o;
23
+ function s(...n) {
24
+ return f.useCallback(i(...n), n);
66
25
  }
67
26
  export {
68
- w as createContext,
69
- _ as createContextScope
27
+ i as composeRefs,
28
+ s as useComposedRefs
70
29
  };
package/dist/index78.js CHANGED
@@ -1,54 +1,9 @@
1
- import * as n from "react";
2
- import { useLayoutEffect as v } from "./index79.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];
36
- }
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";
1
+ function h(f, c, { checkForDefaultPrevented: p = !0 } = {}) {
2
+ return function(s) {
3
+ if (f == null || f(s), p === !1 || !s.defaultPrevented)
4
+ return c == null ? void 0 : c(s);
5
+ };
51
6
  }
52
7
  export {
53
- y as useControllableState
8
+ h as composeEventHandlers
54
9
  };
package/dist/index79.js CHANGED
@@ -1,6 +1,56 @@
1
- import * as t from "react";
2
- var e = globalThis != null && globalThis.document ? t.useLayoutEffect : () => {
3
- };
1
+ import * as l from "react";
2
+ import { composeRefs as y } from "./index77.js";
3
+ import { jsx as p, Fragment as S } from "react/jsx-runtime";
4
+ // @__NO_SIDE_EFFECTS__
5
+ function _(e) {
6
+ const r = /* @__PURE__ */ g(e), o = l.forwardRef((n, t) => {
7
+ const { children: i, ...a } = n, s = l.Children.toArray(i), c = s.find(E);
8
+ if (c) {
9
+ const f = c.props.children, m = s.map((u) => u === c ? l.Children.count(f) > 1 ? l.Children.only(null) : l.isValidElement(f) ? f.props.children : null : u);
10
+ return /* @__PURE__ */ p(r, { ...a, ref: t, children: l.isValidElement(f) ? l.cloneElement(f, void 0, m) : null });
11
+ }
12
+ return /* @__PURE__ */ p(r, { ...a, ref: t, children: i });
13
+ });
14
+ return o.displayName = `${e}.Slot`, o;
15
+ }
16
+ // @__NO_SIDE_EFFECTS__
17
+ function g(e) {
18
+ const r = l.forwardRef((o, n) => {
19
+ const { children: t, ...i } = o;
20
+ if (l.isValidElement(t)) {
21
+ const a = b(t), s = C(i, t.props);
22
+ return t.type !== l.Fragment && (s.ref = n ? y(n, a) : a), l.cloneElement(t, s);
23
+ }
24
+ return l.Children.count(t) > 1 ? l.Children.only(null) : null;
25
+ });
26
+ return r.displayName = `${e}.SlotClone`, r;
27
+ }
28
+ var d = Symbol("radix.slottable");
29
+ // @__NO_SIDE_EFFECTS__
30
+ function x(e) {
31
+ const r = ({ children: o }) => /* @__PURE__ */ p(S, { children: o });
32
+ return r.displayName = `${e}.Slottable`, r.__radixId = d, r;
33
+ }
34
+ function E(e) {
35
+ return l.isValidElement(e) && typeof e.type == "function" && "__radixId" in e.type && e.type.__radixId === d;
36
+ }
37
+ function C(e, r) {
38
+ const o = { ...r };
39
+ for (const n in r) {
40
+ const t = e[n], i = r[n];
41
+ /^on[A-Z]/.test(n) ? t && i ? o[n] = (...s) => {
42
+ const c = i(...s);
43
+ return t(...s), c;
44
+ } : t && (o[n] = t) : n === "style" ? o[n] = { ...t, ...i } : n === "className" && (o[n] = [t, i].filter(Boolean).join(" "));
45
+ }
46
+ return { ...e, ...o };
47
+ }
48
+ function b(e) {
49
+ var n, t;
50
+ let r = (n = Object.getOwnPropertyDescriptor(e.props, "ref")) == null ? void 0 : n.get, o = r && "isReactWarning" in r && r.isReactWarning;
51
+ return o ? e.ref : (r = (t = Object.getOwnPropertyDescriptor(e, "ref")) == null ? void 0 : t.get, o = r && "isReactWarning" in r && r.isReactWarning, o ? e.props.ref : e.props.ref || e.ref);
52
+ }
4
53
  export {
5
- e as useLayoutEffect
54
+ _ as createSlot,
55
+ x as createSlottable
6
56
  };
package/dist/index8.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { jsx as o } from "react/jsx-runtime";
2
- import { cva as n } from "./index47.js";
2
+ import { cva as n } from "./index46.js";
3
3
  import { cn as a } from "./index2.js";
4
4
  const i = n(
5
5
  "inline-flex items-center border-2 px-2.5 py-0.5 text-xs font-semibold uppercase tracking-wider transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
package/dist/index80.js CHANGED
@@ -1,29 +1,54 @@
1
- import * as f from "react";
2
- function l(n, o) {
3
- if (typeof n == "function")
4
- return n(o);
5
- n != null && (n.current = o);
1
+ import * as n from "react";
2
+ import { useLayoutEffect as v } from "./index81.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];
6
36
  }
7
- function i(...n) {
8
- return (o) => {
9
- let u = !1;
10
- const c = n.map((t) => {
11
- const e = l(t, o);
12
- return !u && typeof e == "function" && (u = !0), e;
13
- });
14
- if (u)
15
- return () => {
16
- for (let t = 0; t < c.length; t++) {
17
- const e = c[t];
18
- typeof e == "function" ? e() : l(n[t], null);
19
- }
20
- };
21
- };
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];
22
48
  }
23
- function s(...n) {
24
- return f.useCallback(i(...n), n);
49
+ function R(t) {
50
+ return typeof t == "function";
25
51
  }
26
52
  export {
27
- i as composeRefs,
28
- s as useComposedRefs
53
+ y as useControllableState
29
54
  };
package/dist/index81.js CHANGED
@@ -1,36 +1,6 @@
1
- import * as f from "react";
2
- import * as p from "react-dom";
3
- import { createSlot as c } from "./index97.js";
4
- import { jsx as l } from "react/jsx-runtime";
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
- }
1
+ import * as t from "react";
2
+ var e = globalThis != null && globalThis.document ? t.useLayoutEffect : () => {
3
+ };
33
4
  export {
34
- h as Primitive,
35
- w as dispatchDiscreteCustomEvent
5
+ e as useLayoutEffect
36
6
  };