@drjoshcsimmons/scl 0.2.8 → 0.3.1

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 (233) hide show
  1. package/dist/components/ui/accordion/accordion.d.ts.map +1 -1
  2. package/dist/components/ui/alert/alert.d.ts +5 -4
  3. package/dist/components/ui/alert/alert.d.ts.map +1 -1
  4. package/dist/components/ui/alert/index.d.ts +1 -1
  5. package/dist/components/ui/alert/index.d.ts.map +1 -1
  6. package/dist/components/ui/avatar/avatar.d.ts.map +1 -1
  7. package/dist/components/ui/badge/badge.d.ts +4 -6
  8. package/dist/components/ui/badge/badge.d.ts.map +1 -1
  9. package/dist/components/ui/badge/index.d.ts +1 -1
  10. package/dist/components/ui/badge/index.d.ts.map +1 -1
  11. package/dist/components/ui/button/button.d.ts +6 -7
  12. package/dist/components/ui/button/button.d.ts.map +1 -1
  13. package/dist/components/ui/button/index.d.ts +1 -1
  14. package/dist/components/ui/button/index.d.ts.map +1 -1
  15. package/dist/components/ui/card/card.d.ts.map +1 -1
  16. package/dist/components/ui/checkbox/checkbox.d.ts.map +1 -1
  17. package/dist/components/ui/collapsible/collapsible.d.ts.map +1 -1
  18. package/dist/components/ui/dialog/dialog.d.ts.map +1 -1
  19. package/dist/components/ui/input/input.d.ts.map +1 -1
  20. package/dist/components/ui/label/label.d.ts +1 -2
  21. package/dist/components/ui/label/label.d.ts.map +1 -1
  22. package/dist/components/ui/popover/popover.d.ts.map +1 -1
  23. package/dist/components/ui/progress/progress.d.ts +0 -3
  24. package/dist/components/ui/progress/progress.d.ts.map +1 -1
  25. package/dist/components/ui/radio-group/radio-group.d.ts.map +1 -1
  26. package/dist/components/ui/scroll-area/scroll-area.d.ts.map +1 -1
  27. package/dist/components/ui/select/select.d.ts.map +1 -1
  28. package/dist/components/ui/separator/separator.d.ts.map +1 -1
  29. package/dist/components/ui/skeleton/skeleton.d.ts +1 -0
  30. package/dist/components/ui/skeleton/skeleton.d.ts.map +1 -1
  31. package/dist/components/ui/slider/slider.d.ts.map +1 -1
  32. package/dist/components/ui/switch/switch.d.ts.map +1 -1
  33. package/dist/components/ui/table/table.d.ts.map +1 -1
  34. package/dist/components/ui/tabs/tabs.d.ts.map +1 -1
  35. package/dist/components/ui/textarea/textarea.d.ts.map +1 -1
  36. package/dist/components/ui/toggle/index.d.ts +1 -1
  37. package/dist/components/ui/toggle/index.d.ts.map +1 -1
  38. package/dist/components/ui/toggle/toggle.d.ts +6 -10
  39. package/dist/components/ui/toggle/toggle.d.ts.map +1 -1
  40. package/dist/components/ui/tooltip/tooltip.d.ts.map +1 -1
  41. package/dist/globals.css +222 -287
  42. package/dist/index.d.ts +1 -10
  43. package/dist/index.d.ts.map +1 -1
  44. package/dist/index.js +115 -184
  45. package/dist/index10.js +29 -57
  46. package/dist/index100.js +6 -30
  47. package/dist/index101.js +44 -11
  48. package/dist/index102.js +54 -5
  49. package/dist/index103.js +30 -25
  50. package/dist/index104.js +30 -9
  51. package/dist/index105.js +3 -180
  52. package/dist/index106.js +218 -3
  53. package/dist/index107.js +47 -29
  54. package/dist/index108.js +30 -9
  55. package/dist/index109.js +47 -29
  56. package/dist/index11.js +6 -19
  57. package/dist/index110.js +8 -54
  58. package/dist/index111.js +6 -30
  59. package/dist/index112.js +1 -1
  60. package/dist/index113.js +11 -47
  61. package/dist/index114.js +1 -1
  62. package/dist/index115.js +204 -10
  63. package/dist/index116.js +20 -204
  64. package/dist/index117.js +399 -21
  65. package/dist/index118.js +2 -400
  66. package/dist/index119.js +50 -45
  67. package/dist/index12.js +80 -5
  68. package/dist/index120.js +65 -6
  69. package/dist/index121.js +24 -20
  70. package/dist/index122.js +29 -9
  71. package/dist/index123.js +5 -38
  72. package/dist/index124.js +2 -18
  73. package/dist/index125.js +2 -25
  74. package/dist/index126.js +5 -29
  75. package/dist/index127.js +3 -5
  76. package/dist/index128.js +24 -2
  77. package/dist/index129.js +109 -49
  78. package/dist/index13.js +16 -136
  79. package/dist/index130.js +15 -64
  80. package/dist/index131.js +525 -2
  81. package/dist/index132.js +128 -2
  82. package/dist/index133.js +134 -5
  83. package/dist/index134.js +65 -3
  84. package/dist/index135.js +69 -24
  85. package/dist/index136.js +9 -113
  86. package/dist/index137.js +14 -16
  87. package/dist/index138.js +64 -523
  88. package/dist/index139.js +3 -127
  89. package/dist/index14.js +11 -97
  90. package/dist/index140.js +22 -133
  91. package/dist/index141.js +12 -64
  92. package/dist/index142.js +27 -68
  93. package/dist/index143.js +4 -8
  94. package/dist/index144.js +23 -14
  95. package/dist/index15.js +18 -72
  96. package/dist/index16.js +30 -252
  97. package/dist/index17.js +20 -133
  98. package/dist/index18.js +37 -89
  99. package/dist/index19.js +138 -18
  100. package/dist/index2.js +5 -5
  101. package/dist/index20.js +21 -10
  102. package/dist/index21.js +13 -22
  103. package/dist/index22.js +24 -35
  104. package/dist/index23.js +13 -19
  105. package/dist/index24.js +32 -37
  106. package/dist/index25.js +23 -102
  107. package/dist/index26.js +16 -20
  108. package/dist/index27.js +11 -72
  109. package/dist/index28.js +24 -12
  110. package/dist/index29.js +99 -28
  111. package/dist/index3.js +6 -6
  112. package/dist/index30.js +39 -111
  113. package/dist/index31.js +11 -25
  114. package/dist/index32.js +49 -65
  115. package/dist/index33.js +65 -43
  116. package/dist/index34.js +230 -79
  117. package/dist/index36.js +58 -33
  118. package/dist/index4.js +42 -26
  119. package/dist/index41.js +73 -49
  120. package/dist/index43.js +159 -13
  121. package/dist/index45.js +232 -210
  122. package/dist/index47.js +16 -223
  123. package/dist/index5.js +21 -32
  124. package/dist/index50.js +236 -11
  125. package/dist/index52.js +30 -309
  126. package/dist/index55.js +860 -18
  127. package/dist/index57.js +71 -249
  128. package/dist/index59.js +22 -12
  129. package/dist/index6.js +26 -70
  130. package/dist/index61.js +509 -109
  131. package/dist/index63.js +225 -109
  132. package/dist/index65.js +409 -210
  133. package/dist/index67.js +103 -321
  134. package/dist/index69.js +245 -18
  135. package/dist/index7.js +7 -40
  136. package/dist/index71.js +320 -66
  137. package/dist/index73.js +111 -416
  138. package/dist/index77.js +25 -44
  139. package/dist/index78.js +52 -24
  140. package/dist/index79.js +10 -6
  141. package/dist/index8.js +20 -26
  142. package/dist/index80.js +4 -52
  143. package/dist/index81.js +8 -12
  144. package/dist/index82.js +12 -10
  145. package/dist/index83.js +30 -8
  146. package/dist/index84.js +5 -123
  147. package/dist/index85.js +65 -12
  148. package/dist/index86.js +173 -127
  149. package/dist/index87.js +66 -216
  150. package/dist/index88.js +33 -13
  151. package/dist/index89.js +7 -68
  152. package/dist/index9.js +33 -36
  153. package/dist/index90.js +49 -45
  154. package/dist/index91.js +11 -50
  155. package/dist/index92.js +124 -8
  156. package/dist/index93.js +135 -4
  157. package/dist/index94.js +13 -649
  158. package/dist/index95.js +13 -13
  159. package/dist/index96.js +9 -30
  160. package/dist/index97.js +49 -47
  161. package/dist/index98.js +44 -51
  162. package/dist/index99.js +24 -10
  163. package/dist/lib/utils.d.ts +8 -8
  164. package/dist/lib/utils.d.ts.map +1 -1
  165. package/package.json +5 -46
  166. package/dist/components/ui/alert-dialog/alert-dialog.d.ts +0 -21
  167. package/dist/components/ui/alert-dialog/alert-dialog.d.ts.map +0 -1
  168. package/dist/components/ui/alert-dialog/index.d.ts +0 -2
  169. package/dist/components/ui/alert-dialog/index.d.ts.map +0 -1
  170. package/dist/components/ui/combobox/combobox.d.ts +0 -31
  171. package/dist/components/ui/combobox/combobox.d.ts.map +0 -1
  172. package/dist/components/ui/combobox/index.d.ts +0 -3
  173. package/dist/components/ui/combobox/index.d.ts.map +0 -1
  174. package/dist/components/ui/command/command.d.ts +0 -85
  175. package/dist/components/ui/command/command.d.ts.map +0 -1
  176. package/dist/components/ui/command/index.d.ts +0 -2
  177. package/dist/components/ui/command/index.d.ts.map +0 -1
  178. package/dist/components/ui/dithered-image/dithered-image.d.ts +0 -21
  179. package/dist/components/ui/dithered-image/dithered-image.d.ts.map +0 -1
  180. package/dist/components/ui/dithered-image/index.d.ts +0 -3
  181. package/dist/components/ui/dithered-image/index.d.ts.map +0 -1
  182. package/dist/components/ui/dropdown-menu/dropdown-menu.d.ts +0 -28
  183. package/dist/components/ui/dropdown-menu/dropdown-menu.d.ts.map +0 -1
  184. package/dist/components/ui/dropdown-menu/index.d.ts +0 -2
  185. package/dist/components/ui/dropdown-menu/index.d.ts.map +0 -1
  186. package/dist/components/ui/form/form.d.ts +0 -24
  187. package/dist/components/ui/form/form.d.ts.map +0 -1
  188. package/dist/components/ui/form/index.d.ts +0 -2
  189. package/dist/components/ui/form/index.d.ts.map +0 -1
  190. package/dist/components/ui/sheet/index.d.ts +0 -2
  191. package/dist/components/ui/sheet/index.d.ts.map +0 -1
  192. package/dist/components/ui/sheet/sheet.d.ts +0 -26
  193. package/dist/components/ui/sheet/sheet.d.ts.map +0 -1
  194. package/dist/components/ui/statusline/index.d.ts +0 -2
  195. package/dist/components/ui/statusline/index.d.ts.map +0 -1
  196. package/dist/components/ui/statusline/statusline.d.ts +0 -40
  197. package/dist/components/ui/statusline/statusline.d.ts.map +0 -1
  198. package/dist/components/ui/terminal-textarea/index.d.ts +0 -2
  199. package/dist/components/ui/terminal-textarea/index.d.ts.map +0 -1
  200. package/dist/components/ui/terminal-textarea/terminal-textarea.d.ts +0 -16
  201. package/dist/components/ui/terminal-textarea/terminal-textarea.d.ts.map +0 -1
  202. package/dist/index145.js +0 -68
  203. package/dist/index146.js +0 -6
  204. package/dist/index147.js +0 -25
  205. package/dist/index148.js +0 -25
  206. package/dist/index149.js +0 -15
  207. package/dist/index150.js +0 -30
  208. package/dist/index151.js +0 -7
  209. package/dist/index35.js +0 -20
  210. package/dist/index37.js +0 -28
  211. package/dist/index38.js +0 -102
  212. package/dist/index39.js +0 -41
  213. package/dist/index40.js +0 -13
  214. package/dist/index42.js +0 -68
  215. package/dist/index44.js +0 -2265
  216. package/dist/index46.js +0 -13
  217. package/dist/index48.js +0 -11
  218. package/dist/index49.js +0 -13
  219. package/dist/index51.js +0 -243
  220. package/dist/index53.js +0 -14
  221. package/dist/index54.js +0 -120
  222. package/dist/index56.js +0 -35
  223. package/dist/index58.js +0 -14
  224. package/dist/index60.js +0 -75
  225. package/dist/index62.js +0 -62
  226. package/dist/index64.js +0 -256
  227. package/dist/index66.js +0 -532
  228. package/dist/index68.js +0 -251
  229. package/dist/index70.js +0 -163
  230. package/dist/index72.js +0 -33
  231. package/dist/index74.js +0 -862
  232. package/dist/index75.js +0 -11
  233. package/dist/index76.js +0 -70
package/dist/index78.js CHANGED
@@ -1,29 +1,57 @@
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);
6
- }
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
- };
1
+ import * as i from "react";
2
+ import { jsx as _ } from "react/jsx-runtime";
3
+ function $(e, x = []) {
4
+ let o = [];
5
+ function f(r, n) {
6
+ const t = i.createContext(n);
7
+ t.displayName = r + "Context";
8
+ const c = o.length;
9
+ o = [...o, n];
10
+ const m = (a) => {
11
+ var l;
12
+ const { scope: s, children: C, ...p } = a, d = ((l = s == null ? void 0 : s[e]) == null ? void 0 : l[c]) || t, v = i.useMemo(() => p, Object.values(p));
13
+ return /* @__PURE__ */ _(d.Provider, { value: v, children: C });
14
+ };
15
+ m.displayName = r + "Provider";
16
+ function S(a, s) {
17
+ var d;
18
+ const C = ((d = s == null ? void 0 : s[e]) == null ? void 0 : d[c]) || t, p = i.useContext(C);
19
+ if (p) return p;
20
+ if (n !== void 0) return n;
21
+ throw new Error(`\`${a}\` must be used within \`${r}\``);
22
+ }
23
+ return [m, S];
24
+ }
25
+ const u = () => {
26
+ const r = o.map((n) => i.createContext(n));
27
+ return function(t) {
28
+ const c = (t == null ? void 0 : t[e]) || r;
29
+ return i.useMemo(
30
+ () => ({ [`__scope${e}`]: { ...t, [e]: c } }),
31
+ [t, c]
32
+ );
33
+ };
21
34
  };
35
+ return u.scopeName = e, [f, h(u, ...x)];
22
36
  }
23
- function s(...n) {
24
- return f.useCallback(i(...n), n);
37
+ function h(...e) {
38
+ const x = e[0];
39
+ if (e.length === 1) return x;
40
+ const o = () => {
41
+ const f = e.map((u) => ({
42
+ useScope: u(),
43
+ scopeName: u.scopeName
44
+ }));
45
+ return function(r) {
46
+ const n = f.reduce((t, { useScope: c, scopeName: m }) => {
47
+ const a = c(r)[`__scope${m}`];
48
+ return { ...t, ...a };
49
+ }, {});
50
+ return i.useMemo(() => ({ [`__scope${x.scopeName}`]: n }), [n]);
51
+ };
52
+ };
53
+ return o.scopeName = x.scopeName, o;
25
54
  }
26
55
  export {
27
- i as composeRefs,
28
- s as useComposedRefs
56
+ $ as createContextScope
29
57
  };
package/dist/index79.js CHANGED
@@ -1,9 +1,13 @@
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
- };
1
+ import * as r from "react";
2
+ function o(t) {
3
+ const e = r.useRef(t);
4
+ return r.useEffect(() => {
5
+ e.current = t;
6
+ }), r.useMemo(() => (...n) => {
7
+ var u;
8
+ return (u = e.current) == null ? void 0 : u.call(e, ...n);
9
+ }, []);
6
10
  }
7
11
  export {
8
- h as composeEventHandlers
12
+ o as useCallbackRef
9
13
  };
package/dist/index8.js CHANGED
@@ -1,30 +1,24 @@
1
- import { jsx as n } from "react/jsx-runtime";
2
- import { cva as o } from "./index56.js";
3
- import { cn as a } from "./index2.js";
4
- const i = o(
5
- "inline-flex items-center border-2 px-2.5 py-0.5 text-xs font-semibold uppercase tracking-wider focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
6
- {
7
- variants: {
8
- variant: {
9
- // Filled variants (color bg, black text)
10
- default: "border-primary bg-primary text-primary-foreground",
11
- secondary: "border-secondary bg-secondary text-secondary-foreground",
12
- destructive: "border-destructive bg-destructive text-destructive-foreground",
13
- // Outline variants (transparent bg, color text/border)
14
- outline: "border-primary bg-transparent text-primary",
15
- "secondary-outline": "border-secondary bg-transparent text-secondary",
16
- "destructive-outline": "border-destructive bg-transparent text-destructive"
17
- }
18
- },
19
- defaultVariants: {
20
- variant: "default"
1
+ import { jsx as p } from "react/jsx-runtime";
2
+ import { Root as n } from "./index36.js";
3
+ import * as c from "react";
4
+ import { cx as e } from "./index2.js";
5
+ /* empty css */
6
+ const f = c.forwardRef(
7
+ ({ className: t, variant: o = "primary", size: r = "default", asChild: m = !1, ...s }, a) => /* @__PURE__ */ p(
8
+ m ? n : "button",
9
+ {
10
+ className: e(
11
+ "scl-button",
12
+ `scl-button--${o}`,
13
+ `scl-button--${r}`,
14
+ t
15
+ ),
16
+ ref: a,
17
+ ...s
21
18
  }
22
- }
19
+ )
23
20
  );
24
- function u({ className: r, variant: e, ...t }) {
25
- return /* @__PURE__ */ n("div", { className: a(i({ variant: e }), r), ...t });
26
- }
21
+ f.displayName = "Button";
27
22
  export {
28
- u as Badge,
29
- i as badgeVariants
23
+ f as Button
30
24
  };
package/dist/index80.js CHANGED
@@ -1,54 +1,6 @@
1
- import * as n from "react";
2
- import { useLayoutEffect as v } from "./index93.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";
51
- }
1
+ import * as t from "react";
2
+ var e = globalThis != null && globalThis.document ? t.useLayoutEffect : () => {
3
+ };
52
4
  export {
53
- y as useControllableState
5
+ e as useLayoutEffect
54
6
  };
package/dist/index81.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as f from "react";
2
- import * as p from "react-dom";
3
- import { createSlot as c } from "./index114.js";
4
- import { jsx as l } from "react/jsx-runtime";
2
+ import "react-dom";
3
+ import { createSlot as l } from "./index36.js";
4
+ import { jsx as n } from "react/jsx-runtime";
5
5
  var u = [
6
6
  "a",
7
7
  "button",
@@ -20,17 +20,13 @@ var u = [
20
20
  "span",
21
21
  "svg",
22
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 });
23
+ ], w = u.reduce((t, i) => {
24
+ const o = l(`Primitive.${i}`), r = f.forwardRef((e, m) => {
25
+ const { asChild: a, ...p } = e, s = a ? o : i;
26
+ return typeof window < "u" && (window[Symbol.for("radix-ui")] = !0), /* @__PURE__ */ n(s, { ...p, ref: m });
27
27
  });
28
28
  return r.displayName = `Primitive.${i}`, { ...t, [i]: r };
29
29
  }, {});
30
- function w(t, i) {
31
- t && p.flushSync(() => t.dispatchEvent(i));
32
- }
33
30
  export {
34
- h as Primitive,
35
- w as dispatchDiscreteCustomEvent
31
+ w as Primitive
36
32
  };
package/dist/index82.js CHANGED
@@ -1,13 +1,15 @@
1
- import * as o from "react";
2
- import { useLayoutEffect as a } from "./index93.js";
3
- var s = o[" useId ".trim().toString()] || (() => {
4
- }), f = 0;
5
- function i(t) {
6
- const [e, r] = o.useState(s());
7
- return a(() => {
8
- r((u) => u ?? String(f++));
9
- }, [t]), t || (e ? `radix-${e}` : "");
1
+ import { s as r } from "./index111.js";
2
+ function s() {
3
+ return r.useSyncExternalStore(
4
+ e,
5
+ () => !0,
6
+ () => !1
7
+ );
8
+ }
9
+ function e() {
10
+ return () => {
11
+ };
10
12
  }
11
13
  export {
12
- i as useId
14
+ s as useIsHydrated
13
15
  };
package/dist/index83.js CHANGED
@@ -1,10 +1,32 @@
1
- import * as t from "react";
2
- import "react/jsx-runtime";
3
- var r = t.createContext(void 0);
4
- function n(o) {
5
- const e = t.useContext(r);
6
- return o || e || "ltr";
7
- }
1
+ import * as f from "react";
2
+ import "react-dom";
3
+ import { createSlot as l } from "./index36.js";
4
+ import { jsx as n } 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
+ ], w = u.reduce((t, i) => {
24
+ const o = l(`Primitive.${i}`), r = f.forwardRef((e, m) => {
25
+ const { asChild: a, ...p } = e, s = a ? o : i;
26
+ return typeof window < "u" && (window[Symbol.for("radix-ui")] = !0), /* @__PURE__ */ n(s, { ...p, ref: m });
27
+ });
28
+ return r.displayName = `Primitive.${i}`, { ...t, [i]: r };
29
+ }, {});
8
30
  export {
9
- n as useDirection
31
+ w as Primitive
10
32
  };
package/dist/index84.js CHANGED
@@ -1,127 +1,9 @@
1
- import * as n from "react";
2
- import { composeEventHandlers as m } from "./index79.js";
3
- import { Primitive as g, dispatchDiscreteCustomEvent as k } from "./index81.js";
4
- import { useComposedRefs as R } from "./index78.js";
5
- import { useCallbackRef as w } from "./index99.js";
6
- import { useEscapeKeydown as U } from "./index115.js";
7
- import { jsx as T } from "react/jsx-runtime";
8
- var z = "DismissableLayer", y = "dismissableLayer.update", H = "dismissableLayer.pointerDownOutside", M = "dismissableLayer.focusOutside", L, B = n.createContext({
9
- layers: /* @__PURE__ */ new Set(),
10
- layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(),
11
- branches: /* @__PURE__ */ new Set()
12
- }), j = n.forwardRef(
13
- (r, e) => {
14
- const {
15
- disableOutsidePointerEvents: i = !1,
16
- onEscapeKeyDown: o,
17
- onPointerDownOutside: t,
18
- onFocusOutside: a,
19
- onInteractOutside: l,
20
- onDismiss: d,
21
- ...v
22
- } = r, c = n.useContext(B), [u, S] = n.useState(null), f = (u == null ? void 0 : u.ownerDocument) ?? (globalThis == null ? void 0 : globalThis.document), [, F] = n.useState({}), W = R(e, (s) => S(s)), p = Array.from(c.layers), [A] = [...c.layersWithOutsidePointerEventsDisabled].slice(-1), N = p.indexOf(A), b = u ? p.indexOf(u) : -1, I = c.layersWithOutsidePointerEventsDisabled.size > 0, P = b >= N, _ = q((s) => {
23
- const E = s.target, C = [...c.branches].some((h) => h.contains(E));
24
- !P || C || (t == null || t(s), l == null || l(s), s.defaultPrevented || d == null || d());
25
- }, f), D = G((s) => {
26
- const E = s.target;
27
- [...c.branches].some((h) => h.contains(E)) || (a == null || a(s), l == null || l(s), s.defaultPrevented || d == null || d());
28
- }, f);
29
- return U((s) => {
30
- b === c.layers.size - 1 && (o == null || o(s), !s.defaultPrevented && d && (s.preventDefault(), d()));
31
- }, f), n.useEffect(() => {
32
- if (u)
33
- return i && (c.layersWithOutsidePointerEventsDisabled.size === 0 && (L = f.body.style.pointerEvents, f.body.style.pointerEvents = "none"), c.layersWithOutsidePointerEventsDisabled.add(u)), c.layers.add(u), O(), () => {
34
- i && c.layersWithOutsidePointerEventsDisabled.size === 1 && (f.body.style.pointerEvents = L);
35
- };
36
- }, [u, f, i, c]), n.useEffect(() => () => {
37
- u && (c.layers.delete(u), c.layersWithOutsidePointerEventsDisabled.delete(u), O());
38
- }, [u, c]), n.useEffect(() => {
39
- const s = () => F({});
40
- return document.addEventListener(y, s), () => document.removeEventListener(y, s);
41
- }, []), /* @__PURE__ */ T(
42
- g.div,
43
- {
44
- ...v,
45
- ref: W,
46
- style: {
47
- pointerEvents: I ? P ? "auto" : "none" : void 0,
48
- ...r.style
49
- },
50
- onFocusCapture: m(r.onFocusCapture, D.onFocusCapture),
51
- onBlurCapture: m(r.onBlurCapture, D.onBlurCapture),
52
- onPointerDownCapture: m(
53
- r.onPointerDownCapture,
54
- _.onPointerDownCapture
55
- )
56
- }
57
- );
58
- }
59
- );
60
- j.displayName = z;
61
- var X = "DismissableLayerBranch", Y = n.forwardRef((r, e) => {
62
- const i = n.useContext(B), o = n.useRef(null), t = R(e, o);
63
- return n.useEffect(() => {
64
- const a = o.current;
65
- if (a)
66
- return i.branches.add(a), () => {
67
- i.branches.delete(a);
68
- };
69
- }, [i.branches]), /* @__PURE__ */ T(g.div, { ...r, ref: t });
70
- });
71
- Y.displayName = X;
72
- function q(r, e = globalThis == null ? void 0 : globalThis.document) {
73
- const i = w(r), o = n.useRef(!1), t = n.useRef(() => {
74
- });
75
- return n.useEffect(() => {
76
- const a = (d) => {
77
- if (d.target && !o.current) {
78
- let v = function() {
79
- x(
80
- H,
81
- i,
82
- c,
83
- { discrete: !0 }
84
- );
85
- };
86
- const c = { originalEvent: d };
87
- d.pointerType === "touch" ? (e.removeEventListener("click", t.current), t.current = v, e.addEventListener("click", t.current, { once: !0 })) : v();
88
- } else
89
- e.removeEventListener("click", t.current);
90
- o.current = !1;
91
- }, l = window.setTimeout(() => {
92
- e.addEventListener("pointerdown", a);
93
- }, 0);
94
- return () => {
95
- window.clearTimeout(l), e.removeEventListener("pointerdown", a), e.removeEventListener("click", t.current);
96
- };
97
- }, [e, i]), {
98
- // ensures we check React component tree (not just DOM tree)
99
- onPointerDownCapture: () => o.current = !0
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);
100
5
  };
101
6
  }
102
- function G(r, e = globalThis == null ? void 0 : globalThis.document) {
103
- const i = w(r), o = n.useRef(!1);
104
- return n.useEffect(() => {
105
- const t = (a) => {
106
- a.target && !o.current && x(M, i, { originalEvent: a }, {
107
- discrete: !1
108
- });
109
- };
110
- return e.addEventListener("focusin", t), () => e.removeEventListener("focusin", t);
111
- }, [e, i]), {
112
- onFocusCapture: () => o.current = !0,
113
- onBlurCapture: () => o.current = !1
114
- };
115
- }
116
- function O() {
117
- const r = new CustomEvent(y);
118
- document.dispatchEvent(r);
119
- }
120
- function x(r, e, i, { discrete: o }) {
121
- const t = i.originalEvent.target, a = new CustomEvent(r, { bubbles: !1, cancelable: !0, detail: i });
122
- e && t.addEventListener(r, e, { once: !0 }), o ? k(t, a) : t.dispatchEvent(a);
123
- }
124
7
  export {
125
- j as DismissableLayer,
126
- Y as DismissableLayerBranch
8
+ h as composeEventHandlers
127
9
  };
package/dist/index85.js CHANGED
@@ -1,17 +1,70 @@
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--;
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];
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
+ );
8
45
  };
9
- }, []);
46
+ };
47
+ return i.scopeName = e, [a, l(i, ...c)];
10
48
  }
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;
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;
14
66
  }
15
67
  export {
16
- a as useFocusGuards
68
+ w as createContext,
69
+ _ as createContextScope
17
70
  };