@plyaz/ui 0.4.1 → 0.4.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 (213) hide show
  1. package/dist/types/App.d.ts.map +1 -1
  2. package/dist/types/components/AuroraText/AuroraText.d.ts +10 -0
  3. package/dist/types/components/AuroraText/AuroraText.d.ts.map +1 -0
  4. package/dist/types/components/AuroraText/AuroraText.stories.d.ts +10 -0
  5. package/dist/types/components/AuroraText/AuroraText.stories.d.ts.map +1 -0
  6. package/dist/types/components/Box/Box.d.ts.map +1 -1
  7. package/dist/types/components/Box/Box.stories.d.ts.map +1 -1
  8. package/dist/types/components/Button/Button.d.ts +7 -0
  9. package/dist/types/components/Button/Button.d.ts.map +1 -0
  10. package/dist/types/components/Button/Button.stories.d.ts +14 -0
  11. package/dist/types/components/Button/Button.stories.d.ts.map +1 -0
  12. package/dist/types/components/Container/Container.d.ts.map +1 -1
  13. package/dist/types/components/Container/Container.stories.d.ts.map +1 -1
  14. package/dist/types/components/ExternalLink/ExternalLink.d.ts.map +1 -1
  15. package/dist/types/components/ExternalLink/ExternalLink.stories.d.ts.map +1 -1
  16. package/dist/types/components/Flex/Flex.stories.d.ts.map +1 -1
  17. package/dist/types/components/Form/FormComposition.d.ts +1 -1
  18. package/dist/types/components/Form/FormComposition.d.ts.map +1 -1
  19. package/dist/types/components/Form/LoginForm.d.ts.map +1 -1
  20. package/dist/types/components/Grid/Grid.stories.d.ts.map +1 -1
  21. package/dist/types/components/Heading/Heading.d.ts +4 -4
  22. package/dist/types/components/Heading/Heading.d.ts.map +1 -1
  23. package/dist/types/components/Input/Input.d.ts +3 -0
  24. package/dist/types/components/Input/Input.d.ts.map +1 -0
  25. package/dist/types/components/Input/Input.stories.d.ts +10 -0
  26. package/dist/types/components/Input/Input.stories.d.ts.map +1 -0
  27. package/dist/types/components/Layout/Layout.d.ts.map +1 -1
  28. package/dist/types/components/Paragraph/Paragraph.d.ts.map +1 -1
  29. package/dist/types/components/Section/Section.d.ts.map +1 -1
  30. package/dist/types/components/Select/Select.d.ts +16 -0
  31. package/dist/types/components/Select/Select.d.ts.map +1 -0
  32. package/dist/types/components/Select/Select.stories.d.ts +11 -0
  33. package/dist/types/components/Select/Select.stories.d.ts.map +1 -0
  34. package/dist/types/components/Stack/Stack.d.ts +1 -1
  35. package/dist/types/components/Stack/Stack.d.ts.map +1 -1
  36. package/dist/types/components/Stack/Stack.stories.d.ts.map +1 -1
  37. package/dist/types/components/Text/Text.d.ts +1 -1
  38. package/dist/types/components/Text/Text.d.ts.map +1 -1
  39. package/dist/types/components/Text/Text.stories.d.ts.map +1 -1
  40. package/dist/types/components/index.d.ts +4 -0
  41. package/dist/types/components/index.d.ts.map +1 -1
  42. package/dist/types/constants/constant.d.ts +12 -8
  43. package/dist/types/constants/constant.d.ts.map +1 -1
  44. package/dist/types/lib/utils.d.ts +3 -0
  45. package/dist/types/lib/utils.d.ts.map +1 -0
  46. package/dist/types/types/type.d.ts +1 -1
  47. package/dist/ui.cjs.js +1 -1
  48. package/dist/ui.cjs10.js +1 -1
  49. package/dist/ui.cjs11.js +1 -1
  50. package/dist/ui.cjs12.js +1 -1
  51. package/dist/ui.cjs13.js +19 -1
  52. package/dist/ui.cjs14.js +7 -1
  53. package/dist/ui.cjs15.js +53 -1
  54. package/dist/ui.cjs16.js +1 -1
  55. package/dist/ui.cjs17.js +1 -9
  56. package/dist/ui.cjs18.js +31 -14
  57. package/dist/ui.cjs19.js +1 -1
  58. package/dist/ui.cjs2.js +1 -1
  59. package/dist/ui.cjs20.js +1 -1
  60. package/dist/ui.cjs21.js +1 -0
  61. package/dist/ui.cjs22.js +6 -0
  62. package/dist/ui.cjs23.js +6 -0
  63. package/dist/ui.cjs24.js +6 -0
  64. package/dist/ui.cjs25.js +1 -0
  65. package/dist/ui.cjs26.js +1 -0
  66. package/dist/ui.cjs27.js +9 -0
  67. package/dist/ui.cjs28.js +14 -0
  68. package/dist/ui.cjs29.js +1 -0
  69. package/dist/ui.cjs3.js +2 -2
  70. package/dist/ui.cjs30.js +1 -0
  71. package/dist/ui.cjs31.js +1 -0
  72. package/dist/ui.cjs32.js +1 -0
  73. package/dist/ui.cjs33.js +1 -0
  74. package/dist/ui.cjs34.js +1 -0
  75. package/dist/ui.cjs35.js +1 -0
  76. package/dist/ui.cjs36.js +1 -0
  77. package/dist/ui.cjs37.js +1 -0
  78. package/dist/ui.cjs38.js +1 -0
  79. package/dist/ui.cjs39.js +1 -0
  80. package/dist/ui.cjs4.js +1 -1
  81. package/dist/ui.cjs40.js +1 -0
  82. package/dist/ui.cjs41.js +1 -0
  83. package/dist/ui.cjs42.js +1 -0
  84. package/dist/ui.cjs43.js +1 -0
  85. package/dist/ui.cjs44.js +1 -0
  86. package/dist/ui.cjs45.js +1 -0
  87. package/dist/ui.cjs46.js +1 -0
  88. package/dist/ui.cjs47.js +1 -0
  89. package/dist/ui.cjs48.js +1 -0
  90. package/dist/ui.cjs49.js +1 -0
  91. package/dist/ui.cjs5.js +1 -1
  92. package/dist/ui.cjs50.js +1 -0
  93. package/dist/ui.cjs51.js +1 -0
  94. package/dist/ui.cjs52.js +1 -0
  95. package/dist/ui.cjs53.js +1 -0
  96. package/dist/ui.cjs54.js +1 -0
  97. package/dist/ui.cjs55.js +1 -0
  98. package/dist/ui.cjs56.js +1 -0
  99. package/dist/ui.cjs57.js +1 -0
  100. package/dist/ui.cjs58.js +6 -0
  101. package/dist/ui.cjs59.js +6 -0
  102. package/dist/ui.cjs6.js +1 -1
  103. package/dist/ui.cjs60.js +6 -0
  104. package/dist/ui.cjs61.js +6 -0
  105. package/dist/ui.cjs62.js +1 -0
  106. package/dist/ui.cjs63.js +1 -0
  107. package/dist/ui.cjs64.js +1 -0
  108. package/dist/ui.cjs65.js +1 -0
  109. package/dist/ui.cjs66.js +1 -0
  110. package/dist/ui.cjs67.js +1 -0
  111. package/dist/ui.cjs68.js +4 -0
  112. package/dist/ui.cjs69.js +1 -0
  113. package/dist/ui.cjs7.js +1 -1
  114. package/dist/ui.cjs70.js +1 -0
  115. package/dist/ui.cjs71.js +1 -0
  116. package/dist/ui.cjs72.js +1 -0
  117. package/dist/ui.cjs73.js +1 -0
  118. package/dist/ui.cjs74.js +38 -0
  119. package/dist/ui.cjs75.js +1 -0
  120. package/dist/ui.cjs76.js +1 -0
  121. package/dist/ui.cjs77.js +1 -0
  122. package/dist/ui.cjs78.js +1 -0
  123. package/dist/ui.cjs79.js +1 -0
  124. package/dist/ui.cjs8.js +1 -1
  125. package/dist/ui.cjs80.js +1 -0
  126. package/dist/ui.cjs81.js +1 -0
  127. package/dist/ui.cjs82.js +1 -0
  128. package/dist/ui.cjs83.js +1 -0
  129. package/dist/ui.cjs9.js +2 -2
  130. package/dist/ui.es.js +37 -20
  131. package/dist/ui.es10.js +8 -15
  132. package/dist/ui.es11.js +4 -4
  133. package/dist/ui.es12.js +23 -3
  134. package/dist/ui.es13.js +37 -14
  135. package/dist/ui.es14.js +44 -44
  136. package/dist/ui.es15.js +211 -7
  137. package/dist/ui.es16.js +3 -2
  138. package/dist/ui.es17.js +14 -32
  139. package/dist/ui.es18.js +98 -243
  140. package/dist/ui.es19.js +51 -2
  141. package/dist/ui.es2.js +2 -7
  142. package/dist/ui.es20.js +6 -2
  143. package/dist/ui.es21.js +863 -0
  144. package/dist/ui.es22.js +12 -0
  145. package/dist/ui.es23.js +12 -0
  146. package/dist/ui.es24.js +12 -0
  147. package/dist/ui.es25.js +10 -0
  148. package/dist/ui.es26.js +4 -0
  149. package/dist/ui.es27.js +35 -0
  150. package/dist/ui.es28.js +247 -0
  151. package/dist/ui.es29.js +35 -0
  152. package/dist/ui.es3.js +11 -15
  153. package/dist/ui.es30.js +6 -0
  154. package/dist/ui.es31.js +9 -0
  155. package/dist/ui.es32.js +48 -0
  156. package/dist/ui.es33.js +29 -0
  157. package/dist/ui.es34.js +55 -0
  158. package/dist/ui.es35.js +10 -0
  159. package/dist/ui.es36.js +127 -0
  160. package/dist/ui.es37.js +17 -0
  161. package/dist/ui.es38.js +137 -0
  162. package/dist/ui.es39.js +13 -0
  163. package/dist/ui.es4.js +7 -6
  164. package/dist/ui.es40.js +220 -0
  165. package/dist/ui.es41.js +16 -0
  166. package/dist/ui.es42.js +36 -0
  167. package/dist/ui.es43.js +13 -0
  168. package/dist/ui.es44.js +54 -0
  169. package/dist/ui.es45.js +6 -0
  170. package/dist/ui.es46.js +8 -0
  171. package/dist/ui.es47.js +30 -0
  172. package/dist/ui.es48.js +52 -0
  173. package/dist/ui.es49.js +11 -0
  174. package/dist/ui.es5.js +13 -12
  175. package/dist/ui.es50.js +2731 -0
  176. package/dist/ui.es51.js +4 -0
  177. package/dist/ui.es52.js +4 -0
  178. package/dist/ui.es53.js +14 -0
  179. package/dist/ui.es54.js +208 -0
  180. package/dist/ui.es55.js +24 -0
  181. package/dist/ui.es56.js +27 -0
  182. package/dist/ui.es57.js +400 -0
  183. package/dist/ui.es58.js +27 -0
  184. package/dist/ui.es59.js +24 -0
  185. package/dist/ui.es6.js +10 -15
  186. package/dist/ui.es60.js +41 -0
  187. package/dist/ui.es61.js +20 -0
  188. package/dist/ui.es62.js +27 -0
  189. package/dist/ui.es63.js +31 -0
  190. package/dist/ui.es64.js +7 -0
  191. package/dist/ui.es65.js +7 -0
  192. package/dist/ui.es66.js +5 -0
  193. package/dist/ui.es67.js +26 -0
  194. package/dist/ui.es68.js +112 -0
  195. package/dist/ui.es69.js +18 -0
  196. package/dist/ui.es7.js +3 -8
  197. package/dist/ui.es70.js +527 -0
  198. package/dist/ui.es71.js +130 -0
  199. package/dist/ui.es72.js +136 -0
  200. package/dist/ui.es73.js +67 -0
  201. package/dist/ui.es74.js +71 -0
  202. package/dist/ui.es75.js +11 -0
  203. package/dist/ui.es76.js +16 -0
  204. package/dist/ui.es77.js +68 -0
  205. package/dist/ui.es78.js +6 -0
  206. package/dist/ui.es79.js +25 -0
  207. package/dist/ui.es8.js +7 -11
  208. package/dist/ui.es80.js +25 -0
  209. package/dist/ui.es81.js +15 -0
  210. package/dist/ui.es82.js +30 -0
  211. package/dist/ui.es83.js +7 -0
  212. package/dist/ui.es9.js +9 -12
  213. package/package.json +16 -9
@@ -0,0 +1,127 @@
1
+ import * as n from "react";
2
+ import { composeEventHandlers as m } from "./ui.es31.js";
3
+ import { Primitive as R, dispatchDiscreteCustomEvent as k } from "./ui.es42.js";
4
+ import { useComposedRefs as g } from "./ui.es33.js";
5
+ import { useCallbackRef as w } from "./ui.es43.js";
6
+ import { useEscapeKeydown as U } from "./ui.es53.js";
7
+ import { j as x } from "./ui.es16.js";
8
+ var j = "DismissableLayer", p = "dismissableLayer.update", z = "dismissableLayer.pointerDownOutside", H = "dismissableLayer.focusOutside", L, T = n.createContext({
9
+ layers: /* @__PURE__ */ new Set(),
10
+ layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(),
11
+ branches: /* @__PURE__ */ new Set()
12
+ }), M = 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(T), [u, S] = n.useState(null), f = (u == null ? void 0 : u.ownerDocument) ?? (globalThis == null ? void 0 : globalThis.document), [, F] = n.useState({}), W = g(e, (s) => S(s)), y = Array.from(c.layers), [A] = [...c.layersWithOutsidePointerEventsDisabled].slice(-1), N = y.indexOf(A), b = u ? y.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(p, s), () => document.removeEventListener(p, s);
41
+ }, []), /* @__PURE__ */ x.jsx(
42
+ R.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
+ M.displayName = j;
61
+ var X = "DismissableLayerBranch", Y = n.forwardRef((r, e) => {
62
+ const i = n.useContext(T), o = n.useRef(null), t = g(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__ */ x.jsx(R.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
+ B(
80
+ z,
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
100
+ };
101
+ }
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 && B(H, 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(p);
118
+ document.dispatchEvent(r);
119
+ }
120
+ function B(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
+ export {
125
+ M as DismissableLayer,
126
+ Y as DismissableLayerBranch
127
+ };
@@ -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
+ };
@@ -0,0 +1,137 @@
1
+ import * as d from "react";
2
+ import { useComposedRefs as P } from "./ui.es33.js";
3
+ import { Primitive as M } from "./ui.es42.js";
4
+ import { useCallbackRef as y } from "./ui.es43.js";
5
+ import { j as _ } from "./ui.es16.js";
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, R] = d.useState(null), E = y(p), v = y(L), b = d.useRef(null), U = P(n, (s) => R(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(V(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 A = 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__ */ _.jsx(M.div, { tabIndex: -1, ...g, ref: U, onKeyDown: A });
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 = j();
115
+ function j() {
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 V(e) {
133
+ return e.filter((n) => n.tagName !== "A");
134
+ }
135
+ export {
136
+ k as FocusScope
137
+ };
@@ -0,0 +1,13 @@
1
+ import * as o from "react";
2
+ import { useLayoutEffect as a } from "./ui.es45.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}` : "");
10
+ }
11
+ export {
12
+ i as useId
13
+ };
package/dist/ui.es4.js CHANGED
@@ -1,7 +1,8 @@
1
- import { j as t } from "./ui.es12.js";
2
- import { clsx as a } from "./ui.es13.js";
1
+ import { j as t } from "./ui.es16.js";
2
+ import { clsx as a } from "./ui.es17.js";
3
3
  import { Box as w } from "./ui.es2.js";
4
- import { JUASTIFY_MAPPER as P, ALIGN_MAPPER as c } from "./ui.es14.js";
4
+ import { JUASTIFY_MAPPER as P, ALIGN_MAPPER as c } from "./ui.es18.js";
5
+ import "./ui.es14.js";
5
6
  const A = {
6
7
  row: "flex-row",
7
8
  col: "flex-col",
@@ -11,7 +12,7 @@ const A = {
11
12
  wrap: "flex-wrap",
12
13
  nowrap: "flex-nowrap",
13
14
  wrap_reverse: "flex-wrap-reverse"
14
- }, I = ({
15
+ }, M = ({
15
16
  children: l,
16
17
  gap: x,
17
18
  direction: r,
@@ -39,6 +40,6 @@ const A = {
39
40
  }
40
41
  );
41
42
  export {
42
- I as Flex,
43
- I as default
43
+ M as Flex,
44
+ M as default
44
45
  };
@@ -0,0 +1,220 @@
1
+ import * as s from "react";
2
+ import { useFloating as xe, offset as Pe, shift as ye, flip as Ae, size as ve, arrow as Ce, hide as be, limitShift as Se } from "./ui.es54.js";
3
+ import { Root as Oe } from "./ui.es55.js";
4
+ import { useComposedRefs as T } from "./ui.es33.js";
5
+ import { createContextScope as Re } from "./ui.es34.js";
6
+ import { Primitive as z } from "./ui.es42.js";
7
+ import { useCallbackRef as Ee } from "./ui.es43.js";
8
+ import { useLayoutEffect as B } from "./ui.es45.js";
9
+ import { useSize as Ne } from "./ui.es56.js";
10
+ import { j as f } from "./ui.es16.js";
11
+ import { autoUpdate as _e } from "./ui.es57.js";
12
+ var N = "Popper", [L, Ue] = Re(N), [$e, Z] = L(N), U = (e) => {
13
+ const { __scopePopper: i, children: n } = e, [t, a] = s.useState(null);
14
+ return /* @__PURE__ */ f.jsx($e, { scope: i, anchor: t, onAnchorChange: a, children: n });
15
+ };
16
+ U.displayName = N;
17
+ var q = "PopperAnchor", G = s.forwardRef(
18
+ (e, i) => {
19
+ const { __scopePopper: n, virtualRef: t, ...a } = e, r = Z(q, n), o = s.useRef(null), w = T(i, o);
20
+ return s.useEffect(() => {
21
+ r.onAnchorChange((t == null ? void 0 : t.current) || o.current);
22
+ }), t ? null : /* @__PURE__ */ f.jsx(z.div, { ...a, ref: w });
23
+ }
24
+ );
25
+ G.displayName = q;
26
+ var _ = "PopperContent", [je, He] = L(_), J = s.forwardRef(
27
+ (e, i) => {
28
+ var I, Y, M, X, D, F;
29
+ const {
30
+ __scopePopper: n,
31
+ side: t = "bottom",
32
+ sideOffset: a = 0,
33
+ align: r = "center",
34
+ alignOffset: o = 0,
35
+ arrowPadding: w = 0,
36
+ avoidCollisions: p = !0,
37
+ collisionBoundary: c = [],
38
+ collisionPadding: x = 0,
39
+ sticky: m = "partial",
40
+ hideWhenDetached: y = !1,
41
+ updatePositionStrategy: A = "optimized",
42
+ onPlaced: l,
43
+ ...d
44
+ } = e, v = Z(_, n), [h, C] = s.useState(null), ee = T(i, (P) => C(P)), [E, te] = s.useState(null), g = Ne(E), re = (g == null ? void 0 : g.width) ?? 0, $ = (g == null ? void 0 : g.height) ?? 0, oe = t + (r !== "center" ? "-" + r : ""), ne = typeof x == "number" ? x : { top: 0, right: 0, bottom: 0, left: 0, ...x }, j = Array.isArray(c) ? c : [c], ae = j.length > 0, b = {
45
+ padding: ne,
46
+ boundary: j.filter(Ie),
47
+ // with `strategy: 'fixed'`, this is the only way to get it to respect boundaries
48
+ altBoundary: ae
49
+ }, { refs: ie, floatingStyles: H, placement: se, isPositioned: S, middlewareData: u } = xe({
50
+ // default to `fixed` strategy so users don't have to pick and we also avoid focus scroll issues
51
+ strategy: "fixed",
52
+ placement: oe,
53
+ whileElementsMounted: (...P) => _e(...P, {
54
+ animationFrame: A === "always"
55
+ }),
56
+ elements: {
57
+ reference: v.anchor
58
+ },
59
+ middleware: [
60
+ Pe({ mainAxis: a + $, alignmentAxis: o }),
61
+ p && ye({
62
+ mainAxis: !0,
63
+ crossAxis: !1,
64
+ limiter: m === "partial" ? Se() : void 0,
65
+ ...b
66
+ }),
67
+ p && Ae({ ...b }),
68
+ ve({
69
+ ...b,
70
+ apply: ({ elements: P, rects: k, availableWidth: he, availableHeight: ge }) => {
71
+ const { width: ue, height: we } = k.reference, R = P.floating.style;
72
+ R.setProperty("--radix-popper-available-width", `${he}px`), R.setProperty("--radix-popper-available-height", `${ge}px`), R.setProperty("--radix-popper-anchor-width", `${ue}px`), R.setProperty("--radix-popper-anchor-height", `${we}px`);
73
+ }
74
+ }),
75
+ E && Ce({ element: E, padding: w }),
76
+ Ye({ arrowWidth: re, arrowHeight: $ }),
77
+ y && be({ strategy: "referenceHidden", ...b })
78
+ ]
79
+ }), [W, pe] = V(se), O = Ee(l);
80
+ B(() => {
81
+ S && (O == null || O());
82
+ }, [S, O]);
83
+ const ce = (I = u.arrow) == null ? void 0 : I.x, de = (Y = u.arrow) == null ? void 0 : Y.y, le = ((M = u.arrow) == null ? void 0 : M.centerOffset) !== 0, [fe, me] = s.useState();
84
+ return B(() => {
85
+ h && me(window.getComputedStyle(h).zIndex);
86
+ }, [h]), /* @__PURE__ */ f.jsx(
87
+ "div",
88
+ {
89
+ ref: ie.setFloating,
90
+ "data-radix-popper-content-wrapper": "",
91
+ style: {
92
+ ...H,
93
+ transform: S ? H.transform : "translate(0, -200%)",
94
+ // keep off the page when measuring
95
+ minWidth: "max-content",
96
+ zIndex: fe,
97
+ "--radix-popper-transform-origin": [
98
+ (X = u.transformOrigin) == null ? void 0 : X.x,
99
+ (D = u.transformOrigin) == null ? void 0 : D.y
100
+ ].join(" "),
101
+ // hide the content if using the hide middleware and should be hidden
102
+ // set visibility to hidden and disable pointer events so the UI behaves
103
+ // as if the PopperContent isn't there at all
104
+ ...((F = u.hide) == null ? void 0 : F.referenceHidden) && {
105
+ visibility: "hidden",
106
+ pointerEvents: "none"
107
+ }
108
+ },
109
+ dir: e.dir,
110
+ children: /* @__PURE__ */ f.jsx(
111
+ je,
112
+ {
113
+ scope: n,
114
+ placedSide: W,
115
+ onArrowChange: te,
116
+ arrowX: ce,
117
+ arrowY: de,
118
+ shouldHideArrow: le,
119
+ children: /* @__PURE__ */ f.jsx(
120
+ z.div,
121
+ {
122
+ "data-side": W,
123
+ "data-align": pe,
124
+ ...d,
125
+ ref: ee,
126
+ style: {
127
+ ...d.style,
128
+ // if the PopperContent hasn't been placed yet (not all measurements done)
129
+ // we prevent animations so that users's animation don't kick in too early referring wrong sides
130
+ animation: S ? void 0 : "none"
131
+ }
132
+ }
133
+ )
134
+ }
135
+ )
136
+ }
137
+ );
138
+ }
139
+ );
140
+ J.displayName = _;
141
+ var K = "PopperArrow", We = {
142
+ top: "bottom",
143
+ right: "left",
144
+ bottom: "top",
145
+ left: "right"
146
+ }, Q = s.forwardRef(function(i, n) {
147
+ const { __scopePopper: t, ...a } = i, r = He(K, t), o = We[r.placedSide];
148
+ return (
149
+ // we have to use an extra wrapper because `ResizeObserver` (used by `useSize`)
150
+ // doesn't report size as we'd expect on SVG elements.
151
+ // it reports their bounding box which is effectively the largest path inside the SVG.
152
+ /* @__PURE__ */ f.jsx(
153
+ "span",
154
+ {
155
+ ref: r.onArrowChange,
156
+ style: {
157
+ position: "absolute",
158
+ left: r.arrowX,
159
+ top: r.arrowY,
160
+ [o]: 0,
161
+ transformOrigin: {
162
+ top: "",
163
+ right: "0 0",
164
+ bottom: "center 0",
165
+ left: "100% 0"
166
+ }[r.placedSide],
167
+ transform: {
168
+ top: "translateY(100%)",
169
+ right: "translateY(50%) rotate(90deg) translateX(-50%)",
170
+ bottom: "rotate(180deg)",
171
+ left: "translateY(50%) rotate(-90deg) translateX(50%)"
172
+ }[r.placedSide],
173
+ visibility: r.shouldHideArrow ? "hidden" : void 0
174
+ },
175
+ children: /* @__PURE__ */ f.jsx(
176
+ Oe,
177
+ {
178
+ ...a,
179
+ ref: n,
180
+ style: {
181
+ ...a.style,
182
+ // ensures the element can be measured correctly (mostly for if SVG)
183
+ display: "block"
184
+ }
185
+ }
186
+ )
187
+ }
188
+ )
189
+ );
190
+ });
191
+ Q.displayName = K;
192
+ function Ie(e) {
193
+ return e !== null;
194
+ }
195
+ var Ye = (e) => ({
196
+ name: "transformOrigin",
197
+ options: e,
198
+ fn(i) {
199
+ var v, h, C;
200
+ const { placement: n, rects: t, middlewareData: a } = i, o = ((v = a.arrow) == null ? void 0 : v.centerOffset) !== 0, w = o ? 0 : e.arrowWidth, p = o ? 0 : e.arrowHeight, [c, x] = V(n), m = { start: "0%", center: "50%", end: "100%" }[x], y = (((h = a.arrow) == null ? void 0 : h.x) ?? 0) + w / 2, A = (((C = a.arrow) == null ? void 0 : C.y) ?? 0) + p / 2;
201
+ let l = "", d = "";
202
+ return c === "bottom" ? (l = o ? m : `${y}px`, d = `${-p}px`) : c === "top" ? (l = o ? m : `${y}px`, d = `${t.floating.height + p}px`) : c === "right" ? (l = `${-p}px`, d = o ? m : `${A}px`) : c === "left" && (l = `${t.floating.width + p}px`, d = o ? m : `${A}px`), { data: { x: l, y: d } };
203
+ }
204
+ });
205
+ function V(e) {
206
+ const [i, n = "center"] = e.split("-");
207
+ return [i, n];
208
+ }
209
+ var qe = U, Ge = G, Je = J, Ke = Q;
210
+ export {
211
+ Ge as Anchor,
212
+ Ke as Arrow,
213
+ Je as Content,
214
+ U as Popper,
215
+ G as PopperAnchor,
216
+ Q as PopperArrow,
217
+ J as PopperContent,
218
+ qe as Root,
219
+ Ue as createPopperScope
220
+ };
@@ -0,0 +1,16 @@
1
+ import * as r from "react";
2
+ import f from "react-dom";
3
+ import { Primitive as u } from "./ui.es42.js";
4
+ import { useLayoutEffect as c } from "./ui.es45.js";
5
+ import { j as l } from "./ui.es16.js";
6
+ var p = "Portal", d = r.forwardRef((e, a) => {
7
+ var o;
8
+ const { container: s, ...i } = e, [m, n] = r.useState(!1);
9
+ c(() => n(!0), []);
10
+ const t = s || m && ((o = globalThis == null ? void 0 : globalThis.document) == null ? void 0 : o.body);
11
+ return t ? f.createPortal(/* @__PURE__ */ l.jsx(u.div, { ...i, ref: a }), t) : null;
12
+ });
13
+ d.displayName = p;
14
+ export {
15
+ d as Portal
16
+ };
@@ -0,0 +1,36 @@
1
+ import * as p from "react";
2
+ import * as f from "react-dom";
3
+ import { createSlot as c } from "./ui.es19.js";
4
+ import { j as u } from "./ui.es16.js";
5
+ var l = [
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 = l.reduce((t, i) => {
24
+ const o = c(`Primitive.${i}`), r = p.forwardRef((e, s) => {
25
+ const { asChild: m, ...a } = e, n = m ? o : i;
26
+ return typeof window < "u" && (window[Symbol.for("radix-ui")] = !0), /* @__PURE__ */ u.jsx(n, { ...a, ref: s });
27
+ });
28
+ return r.displayName = `Primitive.${i}`, { ...t, [i]: r };
29
+ }, {});
30
+ function w(t, i) {
31
+ t && f.flushSync(() => t.dispatchEvent(i));
32
+ }
33
+ export {
34
+ h as Primitive,
35
+ w as dispatchDiscreteCustomEvent
36
+ };
@@ -0,0 +1,13 @@
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
+ }, []);
10
+ }
11
+ export {
12
+ o as useCallbackRef
13
+ };
@@ -0,0 +1,54 @@
1
+ import * as n from "react";
2
+ import { useLayoutEffect as v } from "./ui.es45.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
+ }
52
+ export {
53
+ y as useControllableState
54
+ };
@@ -0,0 +1,6 @@
1
+ import * as t from "react";
2
+ var e = globalThis != null && globalThis.document ? t.useLayoutEffect : () => {
3
+ };
4
+ export {
5
+ e as useLayoutEffect
6
+ };
@@ -0,0 +1,8 @@
1
+ import * as u from "react";
2
+ function t(r) {
3
+ const e = u.useRef({ value: r, previous: r });
4
+ return u.useMemo(() => (e.current.value !== r && (e.current.previous = e.current.value, e.current.value = r), e.current.previous), [r]);
5
+ }
6
+ export {
7
+ t as usePrevious
8
+ };