@alea-design/ui 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (184) hide show
  1. package/README.md +2 -2
  2. package/dist/components/accordion/Accordion.js +29 -0
  3. package/dist/components/ai/AI.d.ts +5 -1
  4. package/dist/components/ai/AI.js +187 -0
  5. package/dist/components/app/AppParts.d.ts +16 -4
  6. package/dist/components/app/AppParts.js +134 -0
  7. package/dist/components/button/Button.d.ts +1 -1
  8. package/dist/components/button/Button.js +137 -0
  9. package/dist/components/button/Groups.d.ts +1 -1
  10. package/dist/components/button/Groups.js +112 -0
  11. package/dist/components/card/Card.d.ts +3 -2
  12. package/dist/components/card/Card.js +47 -0
  13. package/dist/components/chat/Chat.d.ts +4 -2
  14. package/dist/components/chat/Chat.js +275 -0
  15. package/dist/components/choice/Choice.js +69 -0
  16. package/dist/components/color/Color.d.ts +3 -3
  17. package/dist/components/color/Color.js +98 -0
  18. package/dist/components/combobox/Autocomplete.d.ts +5 -5
  19. package/dist/components/combobox/Autocomplete.js +126 -0
  20. package/dist/components/combobox/ComboBox.d.ts +4 -4
  21. package/dist/components/combobox/ComboBox.js +112 -0
  22. package/dist/components/combobox/Highlight.js +50 -0
  23. package/dist/components/command/CommandPalette.d.ts +10 -3
  24. package/dist/components/command/CommandPalette.js +56 -0
  25. package/dist/components/content/Content.d.ts +1 -1
  26. package/dist/components/content/Content.js +125 -0
  27. package/dist/components/data/Data.js +79 -0
  28. package/dist/components/date/Date.js +109 -0
  29. package/dist/components/display/Display.d.ts +5 -3
  30. package/dist/components/display/Display.js +89 -0
  31. package/dist/components/display/Display2.d.ts +3 -1
  32. package/dist/components/display/Display2.js +75 -0
  33. package/dist/components/emoji/EmojiPicker.js +52 -0
  34. package/dist/components/emoji/emoji-data.js +27 -0
  35. package/dist/components/extras/CodeSteps.d.ts +1 -0
  36. package/dist/components/extras/CodeSteps.js +19 -0
  37. package/dist/components/extras/Extras.d.ts +1 -1
  38. package/dist/components/extras/Extras.js +116 -0
  39. package/dist/components/feedback/Feedback.d.ts +11 -8
  40. package/dist/components/feedback/Feedback.js +185 -0
  41. package/dist/components/feedback/Spinner.js +18 -0
  42. package/dist/components/feedback/Status.d.ts +6 -2
  43. package/dist/components/feedback/Status.js +48 -0
  44. package/dist/components/field/Field.d.ts +1 -1
  45. package/dist/components/field/Field.js +187 -0
  46. package/dist/components/field/FieldLoading.d.ts +1 -1
  47. package/dist/components/field/FieldLoading.js +18 -0
  48. package/dist/components/filter/FilterBar.js +96 -0
  49. package/dist/components/form/Form.d.ts +5 -5
  50. package/dist/components/form/Form.js +53 -0
  51. package/dist/components/icon/Icon.d.ts +2 -2
  52. package/dist/components/icon/Icon.js +66 -0
  53. package/dist/components/icon/icon-cells.js +39 -0
  54. package/dist/components/icon/icon-contexts.d.ts +1 -1
  55. package/dist/components/icon/icon-contexts.js +38 -0
  56. package/dist/components/icon/icon-names.d.ts +1 -1
  57. package/dist/components/icon/icon-names.js +376 -0
  58. package/dist/components/layout/Bento.d.ts +1 -1
  59. package/dist/components/layout/Bento.js +38 -0
  60. package/dist/components/layout/Layout.d.ts +1 -1
  61. package/dist/components/layout/Layout.js +54 -0
  62. package/dist/components/layout/Layout2.d.ts +36 -6
  63. package/dist/components/layout/Layout2.js +105 -0
  64. package/dist/components/layout/Layout3.js +35 -0
  65. package/dist/components/layout/Responsive.d.ts +1 -1
  66. package/dist/components/layout/Responsive.js +32 -0
  67. package/dist/components/list/List.d.ts +3 -2
  68. package/dist/components/list/List.js +82 -0
  69. package/dist/components/list/Lists2.d.ts +6 -4
  70. package/dist/components/list/Lists2.js +60 -0
  71. package/dist/components/media/Media.d.ts +8 -4
  72. package/dist/components/media/Media.js +188 -0
  73. package/dist/components/menu/Menu.d.ts +23 -12
  74. package/dist/components/menu/Menu.js +68 -0
  75. package/dist/components/more/More.d.ts +7 -7
  76. package/dist/components/more/More.js +182 -0
  77. package/dist/components/navigation/Navbar.d.ts +1 -1
  78. package/dist/components/navigation/Navbar.js +27 -0
  79. package/dist/components/navigation/Navigation.js +121 -0
  80. package/dist/components/navigation/Navigation2.d.ts +6 -2
  81. package/dist/components/navigation/Navigation2.js +355 -0
  82. package/dist/components/overlay/Drawer.d.ts +11 -6
  83. package/dist/components/overlay/Drawer.js +39 -0
  84. package/dist/components/overlay/Modal.d.ts +6 -3
  85. package/dist/components/overlay/Modal.js +27 -0
  86. package/dist/components/overlay/Overlay.d.ts +14 -9
  87. package/dist/components/overlay/Overlay.js +76 -0
  88. package/dist/components/overlay/Sheet.d.ts +11 -5
  89. package/dist/components/overlay/Sheet.js +52 -0
  90. package/dist/components/page/Page.d.ts +5 -5
  91. package/dist/components/page/Page.js +132 -0
  92. package/dist/components/page/PageParts.d.ts +5 -5
  93. package/dist/components/page/PageParts.js +109 -0
  94. package/dist/components/picker/Picker.d.ts +11 -11
  95. package/dist/components/picker/Picker.js +294 -0
  96. package/dist/components/picker/Wheel.js +132 -0
  97. package/dist/components/rating/Rating.d.ts +2 -1
  98. package/dist/components/rating/Rating.js +66 -0
  99. package/dist/components/select/Select.d.ts +8 -6
  100. package/dist/components/select/Select.js +146 -0
  101. package/dist/components/shell/AppShell.d.ts +3 -3
  102. package/dist/components/shell/AppShell.js +56 -0
  103. package/dist/components/shell/AppSidebar.d.ts +5 -5
  104. package/dist/components/shell/AppSidebar.js +62 -0
  105. package/dist/components/slider/Slider.d.ts +2 -1
  106. package/dist/components/slider/Slider.js +36 -0
  107. package/dist/components/surface/Surface.d.ts +16 -0
  108. package/dist/components/surface/Surface.js +7 -0
  109. package/dist/components/table/Table.d.ts +4 -3
  110. package/dist/components/table/Table.js +58 -0
  111. package/dist/components/tabs/Tabs.d.ts +1 -0
  112. package/dist/components/tabs/Tabs.js +120 -0
  113. package/dist/components/theme/Theme.d.ts +11 -6
  114. package/dist/components/theme/Theme.js +186 -0
  115. package/dist/components/theme/lens.js +104 -0
  116. package/dist/components/tree/Tree.js +303 -0
  117. package/dist/components/typography/Typography.js +43 -0
  118. package/dist/components/upload/Upload.js +71 -0
  119. package/dist/components/work/Ops.js +24 -0
  120. package/dist/components/work/Work.d.ts +4 -2
  121. package/dist/components/work/Work.js +241 -0
  122. package/dist/css/accordion.css +1 -0
  123. package/dist/css/ai.css +1 -0
  124. package/dist/css/app.css +1 -0
  125. package/dist/css/base.css +1 -0
  126. package/dist/css/button.css +1 -0
  127. package/dist/css/card.css +1 -0
  128. package/dist/css/chat.css +1 -0
  129. package/dist/css/choice.css +1 -0
  130. package/dist/css/color.css +1 -0
  131. package/dist/css/combobox.css +1 -0
  132. package/dist/css/command.css +1 -0
  133. package/dist/css/content.css +1 -0
  134. package/dist/css/data.css +1 -0
  135. package/dist/css/date.css +1 -0
  136. package/dist/css/display.css +1 -0
  137. package/dist/css/emoji.css +1 -0
  138. package/dist/css/extras.css +1 -0
  139. package/dist/css/feedback.css +1 -0
  140. package/dist/css/field.css +1 -0
  141. package/dist/css/filter.css +1 -0
  142. package/dist/css/form.css +1 -0
  143. package/dist/css/groups.json +346 -0
  144. package/dist/css/icon.css +1 -0
  145. package/dist/css/layout.css +1 -0
  146. package/dist/css/list.css +1 -0
  147. package/dist/css/media.css +1 -0
  148. package/dist/css/menu.css +1 -0
  149. package/dist/css/more.css +1 -0
  150. package/dist/css/navigation.css +1 -0
  151. package/dist/css/overlay.css +1 -0
  152. package/dist/css/page.css +1 -0
  153. package/dist/css/picker.css +1 -0
  154. package/dist/css/rating.css +1 -0
  155. package/dist/css/select.css +1 -0
  156. package/dist/css/shell.css +1 -0
  157. package/dist/css/slider.css +1 -0
  158. package/dist/css/surface.css +1 -0
  159. package/dist/css/table.css +1 -0
  160. package/dist/css/tabs.css +1 -0
  161. package/dist/css/tree.css +1 -0
  162. package/dist/css/typography.css +1 -0
  163. package/dist/css/upload.css +1 -0
  164. package/dist/css/work.css +1 -0
  165. package/dist/i18n/strings.js +842 -0
  166. package/dist/index.d.ts +71 -70
  167. package/dist/index.js +398 -7436
  168. package/dist/styles.css +1 -1
  169. package/dist/utils/Blueprint.js +131 -0
  170. package/dist/utils/DotField.js +32 -0
  171. package/dist/utils/attr.d.ts +1 -1
  172. package/dist/utils/attr.js +18 -0
  173. package/dist/utils/blueprintScene.js +161 -0
  174. package/dist/utils/controlled.js +11 -0
  175. package/dist/utils/cx.js +11 -0
  176. package/dist/utils/inert.js +9 -0
  177. package/dist/utils/refs.d.ts +3 -0
  178. package/dist/utils/refs.js +11 -0
  179. package/dist/utils/responsive.js +12 -0
  180. package/dist/utils/scrollEdges.js +31 -0
  181. package/dist/utils/space.js +10 -0
  182. package/dist/utils/vocabulary.d.ts +6 -0
  183. package/dist/utils/vocabulary.js +17 -0
  184. package/package.json +12 -8
@@ -0,0 +1,131 @@
1
+ "use client";
2
+ import { jsxs as K, jsx as I } from "react/jsx-runtime";
3
+ import { useRef as B, useState as Q, useLayoutEffect as U, useEffect as Y } from "react";
4
+ import { cx as Z } from "./cx.js";
5
+ import { useStrings as L } from "../i18n/strings.js";
6
+ import { buildScene as tt, paint as et } from "./blueprintScene.js";
7
+ import { inertProps as nt } from "./inert.js";
8
+ const q = 80, S = 32, O = (o, d) => `${Math.round(o)} × ${Math.round(d)}`, H = () => {
9
+ var o;
10
+ return typeof window < "u" && ((o = window.matchMedia) == null ? void 0 : o.call(window, "(prefers-reduced-motion: reduce)").matches) && document.documentElement.getAttribute("data-alea-reduced") !== "never" || typeof document < "u" && (["off", "reduced"].includes(document.documentElement.getAttribute("data-alea-motion") || "") || document.documentElement.getAttribute("data-alea-reduced") === "always");
11
+ }, V = (o) => parseFloat(o) || 0;
12
+ function rt(o, d) {
13
+ const p = o.getBoundingClientRect(), l = [], e = (r) => ({ x: r.left - p.left, y: r.top - p.top, w: r.width, h: r.height }), x = (r, y) => {
14
+ if (l.length >= q * 2) return;
15
+ const n = getComputedStyle(r);
16
+ if (n.display === "none") return;
17
+ const h = r.getBoundingClientRect(), s = r.tagName.toLowerCase(), M = s === "img" || s === "video" || s === "canvas" || s === "picture" || r.getAttribute("role") === "img", R = s === "button" || s === "input" || s === "select" || s === "textarea" || r.getAttribute("role") === "button";
18
+ if (h.width >= 2 && h.height >= 2) {
19
+ const t = e(h), b = V(n.borderTopLeftRadius), w = b >= Math.min(t.w, t.h) / 2 - 1 && Math.abs(t.w - t.h) < 2;
20
+ if (s === "svg") {
21
+ l.push({ k: "mark", ...t, label: `SVG ${Math.round(t.w)} × ${Math.round(t.h)}` });
22
+ return;
23
+ }
24
+ if (M || R && y > 0 || w) {
25
+ if (l.push(w ? { k: "ring", ...t, label: O(t.w, t.h) } : { k: "box", ...t, r: Math.min(b, t.h / 2), label: O(t.w, t.h) }), M || w) return;
26
+ } else y > 0 && (n.backgroundColor !== "rgba(0, 0, 0, 0)" && n.backgroundColor !== "transparent" || V(n.borderTopWidth) > 0 || n.backgroundImage !== "none") && l.push({ k: "box", ...t, r: Math.min(b, t.h / 2) });
27
+ }
28
+ for (const t of Array.from(r.childNodes))
29
+ if (t.nodeType === 1) x(t, y + 1);
30
+ else if (t.nodeType === 3 && t.textContent && t.textContent.trim()) {
31
+ const b = document.createRange();
32
+ b.selectNodeContents(t);
33
+ const w = /* @__PURE__ */ new Set();
34
+ for (const a of Array.from(b.getClientRects())) {
35
+ if (a.width < 4 || a.height < 4) continue;
36
+ const $ = Math.round(a.top / 2);
37
+ if (w.has($)) continue;
38
+ w.add($);
39
+ const f = e(a);
40
+ l.push({ k: "line", x: f.x, y: f.y + f.h / 2, w: f.w });
41
+ }
42
+ }
43
+ };
44
+ for (const r of Array.from(d.children)) x(r, 0);
45
+ if (l.length > q) {
46
+ const r = l.filter((n) => n.k === "line").slice(0, q / 2);
47
+ return [...l.filter((n) => n.k !== "line").sort((n, h) => ("w" in h ? h.w * ("h" in h && h.h || 1) : 0) - ("w" in n ? n.w * ("h" in n && n.h || 1) : 0)).slice(0, q - r.length), ...r];
48
+ }
49
+ return l;
50
+ }
51
+ function ot(o, d, p, l) {
52
+ if (p === "circle") return [{ k: "ring", x: 0, y: 0, w: o, h: d, label: O(o, d) }];
53
+ const e = Math.min(24, Math.max(12, o * 0.06)), x = l ?? (p === "text" ? 1 : Math.max(2, Math.min(6, Math.floor((d - e * 2) / 28)))), r = [], y = [0.78, 0.5, 0.64, 0.4, 0.7, 0.55], n = p === "rect" && !l ? Math.min(d * 0.4, 96) : 0;
54
+ n && r.push({ k: "box", x: e, y: e, w: o - e * 2, h: n, r: 12, label: O(o - e * 2, n) });
55
+ const h = n ? e * 2 + n : p === "text" ? d / 2 : e + 8;
56
+ for (let s = 0; s < x; s++) r.push({ k: "line", x: e, y: h + s * 24, w: (o - e * 2) * y[s % y.length] });
57
+ return r;
58
+ }
59
+ function dt({ shape: o, width: d, height: p, rows: l, isLoaded: e, children: x, className: r, style: y, "aria-label": n, ...h }) {
60
+ const s = L(), M = x != null && x !== !1, R = B(null), t = B(null), b = B(null), w = B(null), [a, $] = Q(null), f = B({ scene: null, style: null, loaded: !!e, loadedAt: 0, acc: 0, kick: () => {
61
+ } });
62
+ f.current.loaded = !!e;
63
+ const P = B(e);
64
+ P.current && !e ? (P.current = !1, f.current.acc = 0) : e && (P.current || (f.current.loadedAt = 0), P.current = !0), U(() => {
65
+ var v;
66
+ const m = R.current, E = b.current;
67
+ if (!m || !E) return;
68
+ const g = () => {
69
+ const i = m.getBoundingClientRect();
70
+ if (i.width < 1 || i.height < 1) return;
71
+ const u = getComputedStyle(E), z = { color: u.color, font: u.font || `${u.fontSize} ${u.fontFamily}`, gap: parseFloat(u.paddingLeft) || 4, pitch: parseFloat(u.paddingTop) || 24, stroke: parseFloat(u.borderTopWidth) || 1.5 }, F = M && t.current ? rt(m, t.current) : ot(i.width, i.height, o, l);
72
+ F.sort((k, A) => k.y - A.y), f.current.style = z, f.current.scene = tt(F, i.width, i.height, z), $((k) => k && k.w === i.width && k.h === i.height ? k : { w: i.width, h: i.height }), f.current.kick();
73
+ };
74
+ g();
75
+ let C = m.getBoundingClientRect().width + "x" + m.getBoundingClientRect().height;
76
+ const c = new ResizeObserver(() => {
77
+ const i = m.getBoundingClientRect(), u = i.width + "x" + i.height;
78
+ u !== C && (C = u, g());
79
+ });
80
+ return c.observe(m), (v = document.fonts) == null || v.ready.then(g).catch(() => {
81
+ }), () => c.disconnect();
82
+ }, [M, o, l]), Y(() => {
83
+ const m = w.current, E = b.current;
84
+ if (!m || !E || !a) return;
85
+ let g = null;
86
+ try {
87
+ g = m.getContext("2d");
88
+ } catch {
89
+ g = null;
90
+ }
91
+ if (!g) return;
92
+ const C = Math.min(2, window.devicePixelRatio || 1);
93
+ m.width = Math.round((a.w + S * 2) * C), m.height = Math.round((a.h + S * 2) * C), g.setTransform(C, 0, 0, C, 0, 0);
94
+ const c = f.current;
95
+ let v = 0, i = 0, u = !0, z = 0, F = H();
96
+ const k = (N) => {
97
+ v = 0;
98
+ const T = c.scene, j = c.style;
99
+ if (!T || !j || !g) return;
100
+ const G = i ? Math.min(0.1, (N - i) / 1e3) : 0;
101
+ if (i = N, ++z % 30 === 0) {
102
+ const J = getComputedStyle(E);
103
+ j.color = J.color;
104
+ }
105
+ const X = parseFloat(getComputedStyle(R.current).getPropertyValue("--alea-bp-speed")) || 1;
106
+ c.acc += G * X, g.clearRect(0, 0, a.w + S * 2, a.h + S * 2), et(T, { ctx: g, pad: S, st: j, t: c.acc, elapsed: c.acc, still: F }), c.loaded && !c.loadedAt && (c.loadedAt = N);
107
+ const _ = c.loaded && N - c.loadedAt < 1800;
108
+ !F && u && (!c.loaded || _) && (v = requestAnimationFrame(k));
109
+ };
110
+ c.kick = () => {
111
+ F = H(), v || (i = 0, v = requestAnimationFrame(k));
112
+ };
113
+ const A = typeof IntersectionObserver < "u" ? new IntersectionObserver((N) => {
114
+ var T;
115
+ u = ((T = N[0]) == null ? void 0 : T.isIntersecting) ?? !0, u && c.kick();
116
+ }, { rootMargin: "80px" }) : null;
117
+ return A == null || A.observe(R.current), c.kick(), () => {
118
+ cancelAnimationFrame(v), A == null || A.disconnect(), c.kick = () => {
119
+ };
120
+ };
121
+ }, [a, e]);
122
+ const W = a ? `${Math.round(a.h + 56)}px` : void 0, D = { width: d, ...M ? { minHeight: p } : { height: p ?? (o === "circle" ? d : void 0) }, "--alea-bp-end": W, ...y };
123
+ return /* @__PURE__ */ K("span", { ...h, ref: R, className: Z("alea-skeleton-blueprint", r), "data-shape": o, "data-state": e ? "loaded" : "loading", "data-content": M || void 0, "aria-busy": !e, style: D, children: [
124
+ /* @__PURE__ */ I("span", { ref: b, className: "alea-blueprint-sheet", "aria-hidden": "true", children: /* @__PURE__ */ I("canvas", { ref: w, className: "alea-blueprint-canvas", style: a ? { width: a.w + S * 2, height: a.h + S * 2 } : void 0 }) }),
125
+ M && /* @__PURE__ */ I("span", { ref: t, className: "alea-skeleton-blueprint-content", ...nt(!e), children: x }),
126
+ /* @__PURE__ */ I("span", { role: "status", className: "alea-visually-hidden", children: e ? "" : n ?? s.loading })
127
+ ] });
128
+ }
129
+ export {
130
+ dt as SkeletonBlueprint
131
+ };
@@ -0,0 +1,32 @@
1
+ "use client";
2
+ import { jsx as f } from "react/jsx-runtime";
3
+ import { useRef as p, useState as x, useLayoutEffect as y } from "react";
4
+ const m = 600, v = 0.34;
5
+ function s(n) {
6
+ let t = n + 1831565813;
7
+ return t = Math.imul(t ^ t >>> 15, t | 1), t ^= t + Math.imul(t ^ t >>> 7, t | 61), ((t ^ t >>> 14) >>> 0) / 4294967296;
8
+ }
9
+ function k({ rows: n, cols: t }) {
10
+ const u = p(null), [a, h] = x(null);
11
+ y(() => {
12
+ const l = u.current;
13
+ if (!l) return;
14
+ const e = () => {
15
+ const d = parseFloat(getComputedStyle(l).rowGap) || 16;
16
+ let o = t ?? Math.max(1, Math.floor(l.clientWidth / d)), i = n ?? Math.max(1, Math.floor(l.clientHeight / d));
17
+ if (t == null && n == null && o * i > m) {
18
+ const r = Math.sqrt(m / (o * i));
19
+ o = Math.max(1, Math.floor(o * r)), i = Math.max(1, Math.floor(i * r));
20
+ }
21
+ h((r) => r && r.c === o && r.r === i ? r : { c: o, r: i });
22
+ };
23
+ if (e(), t != null && n != null) return;
24
+ const c = new ResizeObserver(e);
25
+ return c.observe(l), () => c.disconnect();
26
+ }, [n, t]);
27
+ const M = a ? { gridTemplateColumns: `repeat(${a.c}, 1fr)`, gridTemplateRows: `repeat(${a.r}, 1fr)` } : void 0;
28
+ return /* @__PURE__ */ f("span", { ref: u, className: "alea-skeleton-matrix-field", "aria-hidden": "true", style: M, children: a && Array.from({ length: a.c * a.r }, (l, e) => /* @__PURE__ */ f("i", { "data-t": s(e * 3 + 3) < v || void 0, style: { "--k": (0.85 + s(e * 3 + 1) * 0.3).toFixed(3), "--d": `${-Math.round(s(e * 3 + 2) * 6e3)}ms` } }, e)) });
29
+ }
30
+ export {
31
+ k as DotField
32
+ };
@@ -1,2 +1,2 @@
1
- /** Sets an attribute React Aria does not pass through (aria-busy, aria-keyshortcuts) on the element a ref points at, or on the control `pick` finds inside it. It is a callback ref because collections (Menu, Tree) mount their items in two passes, so the element can arrive after the first effect. A value of undefined removes the attribute. */
1
+ /** Sets an attribute the underlying component does not pass through (aria-busy, aria-keyshortcuts) on the element a ref points at, or on the control `pick` finds inside it. It is a callback ref because collections (Menu, Tree) mount their items in two passes, so the element can arrive after the first effect. A value of undefined removes the attribute. */
2
2
  export declare function useAttrRef<T extends HTMLElement>(name: string, value: string | undefined, pick?: (root: T) => HTMLElement | null): (node: T | null) => void;
@@ -0,0 +1,18 @@
1
+ "use client";
2
+ import { useRef as s, useCallback as l, useEffect as p } from "react";
3
+ function A(e, c, f) {
4
+ const i = s(null), n = s(c);
5
+ n.current = c;
6
+ const u = s(f);
7
+ u.current = f;
8
+ const r = l(() => {
9
+ const t = i.current, o = t && (u.current ? u.current(t) : t);
10
+ o && (n.current !== void 0 ? o.setAttribute(e, n.current) : o.removeAttribute(e));
11
+ }, [e]);
12
+ return p(r, [c, r]), l((t) => {
13
+ i.current = t, r();
14
+ }, [r]);
15
+ }
16
+ export {
17
+ A as useAttrRef
18
+ };
@@ -0,0 +1,161 @@
1
+ "use client";
2
+ function F(e) {
3
+ let a = e >>> 0;
4
+ return () => {
5
+ a = a + 1831565813 >>> 0;
6
+ let o = Math.imul(a ^ a >>> 15, a | 1);
7
+ return o ^= o + Math.imul(o ^ o >>> 7, o | 61), ((o ^ o >>> 14) >>> 0) / 4294967296;
8
+ };
9
+ }
10
+ const q = (e, a) => Math.hypot(e[0] - a[0], e[1] - a[1]);
11
+ function z(e, a) {
12
+ const o = [];
13
+ let m = 0;
14
+ o.push(e[0][0], e[0][1]);
15
+ for (let l = 1; l < e.length; l++) {
16
+ const h = e[l - 1], f = e[l], r = q(h, f);
17
+ let y = a - m;
18
+ for (; y <= r; ) {
19
+ const g = y / r;
20
+ o.push(h[0] + (f[0] - h[0]) * g, h[1] + (f[1] - h[1]) * g), y += a;
21
+ }
22
+ m = r - (y - a);
23
+ }
24
+ return o;
25
+ }
26
+ function j(e, a, o, m, l) {
27
+ l = Math.max(0, Math.min(l, o / 2, m / 2));
28
+ const h = [], f = (r, y, g) => {
29
+ for (let P = 0; P <= 6; P++) {
30
+ const k = g + P / 6 * (Math.PI / 2);
31
+ h.push([r + Math.cos(k) * l, y + Math.sin(k) * l]);
32
+ }
33
+ };
34
+ return h.push([e + l, a]), h.push([e + o - l, a]), l && f(e + o - l, a + l, -Math.PI / 2), h.push([e + o, a + m - l]), l && f(e + o - l, a + m - l, 0), h.push([e + l, a + m]), l && f(e + l, a + m - l, Math.PI / 2), h.push([e, a + l]), l && f(e + l, a + l, Math.PI), h.push([e + l, a]), h;
35
+ }
36
+ function B(e, a, o, m) {
37
+ const l = e + o / 2, h = a + m / 2, f = o / 2, r = m / 2, y = Math.max(24, Math.ceil(Math.PI * (f + r))), g = [];
38
+ for (let P = 0; P <= y; P++) {
39
+ const k = -Math.PI / 2 + P / y * Math.PI * 2;
40
+ g.push([l + Math.cos(k) * f, h + Math.sin(k) * r]);
41
+ }
42
+ return g;
43
+ }
44
+ const R = (e, a) => `${Math.round(e)} × ${Math.round(a)}`;
45
+ function W(e, a, o, m) {
46
+ const l = F(Math.round(a * 7 + o * 13 + e.length)), h = [], f = (t, v, x, w) => {
47
+ const I = new Float32Array(z(t, m.gap));
48
+ let n = 0;
49
+ for (let c = 1; c < t.length; c++) n += q(t[c - 1], t[c]);
50
+ const s = 0.12 + v * 1.15 + l() * 0.5, M = Math.min(1.6, Math.max(0.4, n / x)) * (0.85 + l() * 0.4);
51
+ return { pts: I, n: I.length / 2, start: s, dur: M, handles: [], pen: l() < 0.4 ? { period: 3 + l() * 3.5, off: l() * 6 } : null, ...w };
52
+ }, r = f(j(0, 0, a, o, Math.min(16, a / 2, o / 2)), 0, 420, { label: { text: "", w: a, h: o, x: 0, y: -10 }, pen: { period: 5, off: 0 } });
53
+ r.start = 0, r.dur = 1.5, r.handles = [[0, 0, 0], [a, 0, 0.25], [a, o, 0.5], [0, o, 0.75]];
54
+ for (const t of e) {
55
+ const v = Math.min(1, t.y / Math.max(1, o));
56
+ if (t.k === "line") h.push(f([[t.x, t.y], [t.x + t.w, t.y]], v, 160));
57
+ else if (t.k === "box") {
58
+ const x = f(j(t.x, t.y, t.w, t.h, t.r), v, 320, { label: t.label ? { text: "", w: t.w, h: t.h, x: t.x, y: t.y - 5 } : void 0 });
59
+ t.w > 48 && t.h > 24 && (x.handles = [[t.x, t.y, 0], [t.x + t.w, t.y, 0.25], [t.x + t.w, t.y + t.h, 0.5], [t.x, t.y + t.h, 0.75]]), h.push(x);
60
+ } else if (t.k === "ring") {
61
+ const x = f(B(t.x, t.y, t.w, t.h), v, 220, { label: t.label ? { text: "", w: t.w, h: t.h, x: t.x, y: t.y - 5 } : void 0 });
62
+ x.handles = [[t.x, t.y, 0.875], [t.x + t.w, t.y, 0.125], [t.x + t.w, t.y + t.h, 0.375], [t.x, t.y + t.h, 0.625]], h.push(x);
63
+ } else {
64
+ const w = [];
65
+ for (const [n, s, M, c] of [[t.x, t.y, 1, 1], [t.x + t.w, t.y, -1, 1], [t.x + t.w, t.y + t.h, -1, -1], [t.x, t.y + t.h, 1, -1]])
66
+ w.push([n + M * 5, s], [n, s], [n, s + c * 5]);
67
+ const I = f(w, v, 200, { popAt: 0, label: t.label ? { text: t.label, w: t.w, h: t.h, x: t.x, y: t.y - 4 } : void 0 });
68
+ h.push(I);
69
+ }
70
+ }
71
+ const y = Math.max(1, Math.floor(a / m.pitch)), g = Math.max(1, Math.floor(o / m.pitch)), P = Math.min(40, Math.max(6, Math.round(y * g * 0.1))), k = [];
72
+ for (let t = 0; t < P; t++) k.push({ x: Math.floor(l() * y), y: Math.floor(l() * g), period: 1.3 + l() * 1.6, off: l() * 3, r: l() < 0.4 ? 1 : 0 });
73
+ const S = Math.max(r.start + r.dur, ...h.map((t) => t.start + t.dur));
74
+ return { items: h, w: a, h: o, sparks: k, end: S, frame: r };
75
+ }
76
+ const T = (e) => e < 0.5 ? 4 * e * e * e : 1 - Math.pow(-2 * e + 2, 3) / 2, $ = (e) => Math.max(0, Math.min(1, e));
77
+ function C(e, a) {
78
+ const { ctx: o, pad: m, st: l, still: h } = a, f = h ? e.end + 100 : a.t;
79
+ o.save(), o.translate(m, m), o.fillStyle = l.color, o.strokeStyle = l.color;
80
+ const r = l.stroke * 0.72, y = Math.max(1, Math.floor(e.w / l.pitch)), g = Math.max(1, Math.floor(e.h / l.pitch)), P = (e.w - (y - 1) * l.pitch) / 2, k = (e.h - (g - 1) * l.pitch) / 2;
81
+ o.globalAlpha = 0.28, o.beginPath();
82
+ for (let n = 0; n < g; n++) for (let s = 0; s < y; s++) {
83
+ const M = P + s * l.pitch, c = k + n * l.pitch;
84
+ o.moveTo(M + 1, c), o.arc(M, c, 1, 0, 6.2832);
85
+ }
86
+ if (o.fill(), !h) {
87
+ o.globalAlpha = 0.9, o.beginPath();
88
+ for (const n of e.sparks) {
89
+ const s = (f + n.off) % n.period / n.period, M = s < 0.35 ? Math.sin(s / 0.35 * Math.PI) : 0;
90
+ if (!(M < 0.15))
91
+ for (let c = -n.r; c <= n.r; c++) for (let d = -n.r; d <= n.r; d++) {
92
+ if (n.r && Math.abs(d) + Math.abs(c) > 1 && d * 7 + c * 3 + n.x & 1) continue;
93
+ const i = n.x + d, p = n.y + c;
94
+ if (i < 0 || p < 0 || i >= y || p >= g) continue;
95
+ const u = P + i * l.pitch, b = k + p * l.pitch, A = 1 + 1.2 * M;
96
+ o.moveTo(u + A, b), o.arc(u, b, A, 0, 6.2832);
97
+ }
98
+ }
99
+ o.fill();
100
+ }
101
+ o.globalAlpha = 0.3, o.beginPath();
102
+ for (const [n, s, M, c] of [[-24, 0, e.w + 24, 0], [-24, e.h, e.w + 24, e.h], [0, -24, 0, e.h + 24], [e.w, -24, e.w, e.h + 24]]) {
103
+ const d = Math.hypot(M - n, c - s), i = Math.floor(d / (l.gap * 2));
104
+ for (let p = 0; p <= i; p++) {
105
+ const u = p / i, b = n + (M - n) * u, A = s + (c - s) * u;
106
+ o.moveTo(b + r, A), o.arc(b, A, r, 0, 6.2832);
107
+ }
108
+ }
109
+ o.fill(), o.font = l.font, o.textBaseline = "alphabetic";
110
+ const S = [e.frame, ...e.items], t = [], v = [], x = [], w = [];
111
+ for (const n of S) {
112
+ const s = (f - n.start) / n.dur;
113
+ if (s <= 0 && !h) continue;
114
+ const M = h ? 1 : T($(s)), c = n.popAt != null ? s >= 0 ? n.n : 0 : Math.floor(M * n.n), d = n.pts;
115
+ for (let i = 0; i < c; i++) {
116
+ const p = d[i * 2], u = d[i * 2 + 1], b = n.popAt == null && M < 1 ? c - 1 - i : 99;
117
+ b === 0 ? x.push(p, u, 1) : b < 3 ? x.push(p, u, 0.6 - b * 0.12) : i % 7 === 3 ? v.push(p, u) : t.push(p, u);
118
+ }
119
+ if (!h && n.pen && M >= 1) {
120
+ const i = (f + n.pen.off) % n.pen.period / 1.4;
121
+ if (i >= 0 && i < 1) {
122
+ const p = Math.floor(T(i) * (n.n - 1));
123
+ for (let u = 0; u < 4 && p - u >= 0; u++) w.push(d[(p - u) * 2], d[(p - u) * 2 + 1], u);
124
+ }
125
+ }
126
+ o.globalAlpha = 0.7;
127
+ for (const [i, p, u] of n.handles) {
128
+ const b = h ? 1 : $((M - u) / 0.06 + (u === 0 && s > 0 ? 0.4 : 0));
129
+ if (b <= 0) continue;
130
+ const A = 6 * (0.6 + 0.4 * T(b));
131
+ o.globalAlpha = 0.7 * b, o.lineWidth = l.stroke, o.strokeRect(i - A / 2, p - A / 2, A, A);
132
+ }
133
+ if (n.label && s > 0) {
134
+ const i = n.label, p = h ? 1 : T($(s * 1.1)), u = !h && p < 1 && (Math.floor(f * 14) + n.n) % 5 === 0, b = i.text ? i.text : R(i.w * p, i.h * p) + (n === e.frame ? ` t+${a.elapsed.toFixed(2)}s` : "");
135
+ o.globalAlpha = u ? 0.35 : 0.7, o.fillText(b, i.x, i.y);
136
+ }
137
+ }
138
+ const I = (n, s, M, c = 2) => {
139
+ if (n.length) {
140
+ o.globalAlpha = M, o.beginPath();
141
+ for (let d = 0; d < n.length; d += c)
142
+ o.moveTo(n[d] + s, n[d + 1]), o.arc(n[d], n[d + 1], s, 0, 6.2832);
143
+ o.fill();
144
+ }
145
+ };
146
+ if (I(t, r, 0.85), I(v, r * 1.6, 0.9), x.length) for (let n = 0; n < x.length; n += 3) {
147
+ o.globalAlpha = Math.min(1, 0.45 + x[n + 2] * 0.55), o.beginPath();
148
+ const s = r * (1.4 + x[n + 2] * 1.4);
149
+ o.moveTo(x[n] + s, x[n + 1]), o.arc(x[n], x[n + 1], s, 0, 6.2832), o.fill();
150
+ }
151
+ if (w.length) for (let n = 0; n < w.length; n += 3) {
152
+ o.globalAlpha = 1 - w[n + 2] * 0.24, o.beginPath();
153
+ const s = r * (2.4 - w[n + 2] * 0.35);
154
+ o.moveTo(w[n] + s, w[n + 1]), o.arc(w[n], w[n + 1], s, 0, 6.2832), o.fill();
155
+ }
156
+ o.restore();
157
+ }
158
+ export {
159
+ W as buildScene,
160
+ C as paint
161
+ };
@@ -0,0 +1,11 @@
1
+ "use client";
2
+ import { useState as f, useRef as n, useCallback as d } from "react";
3
+ function p(s, e, t) {
4
+ const [o, u] = f(e), r = n(s !== void 0).current, l = r ? s : o, i = d((c) => {
5
+ r || u(c), t == null || t(c);
6
+ }, [r, t]);
7
+ return [l, i];
8
+ }
9
+ export {
10
+ p as useControlled
11
+ };
@@ -0,0 +1,11 @@
1
+ "use client";
2
+ function i(...n) {
3
+ return n.filter(Boolean).join(" ");
4
+ }
5
+ function r(n, t) {
6
+ return typeof t == "function" ? (o) => i(n, t(o)) : i(n, t);
7
+ }
8
+ export {
9
+ i as cx,
10
+ r as withBase
11
+ };
@@ -0,0 +1,9 @@
1
+ "use client";
2
+ import { version as t } from "react";
3
+ const e = parseInt(t, 10) >= 19;
4
+ function i(r) {
5
+ return r ? e ? { inert: !0 } : { inert: "" } : {};
6
+ }
7
+ export {
8
+ i as inertProps
9
+ };
@@ -0,0 +1,3 @@
1
+ import { type Ref } from 'react';
2
+ /** One ref callback that fills several refs (the forwarded one and the component's own). */
3
+ export declare function useMergedRef<T>(...refs: Array<Ref<T> | undefined>): (el: T | null) => void;
@@ -0,0 +1,11 @@
1
+ "use client";
2
+ import { useCallback as t } from "react";
3
+ function n(...o) {
4
+ return t((r) => {
5
+ for (const e of o)
6
+ typeof e == "function" ? e(r) : e && (e.current = r);
7
+ }, o);
8
+ }
9
+ export {
10
+ n as useMergedRef
11
+ };
@@ -0,0 +1,12 @@
1
+ "use client";
2
+ const d = ["sm", "md", "lg", "xl"];
3
+ function c(i, n, r) {
4
+ const s = (o) => o === void 0 ? void 0 : typeof o == "boolean" ? o ? "true" : void 0 : String(o);
5
+ if (n === void 0 || typeof n != "object") return { [`data-${i}`]: s(n ?? r) };
6
+ const t = n, e = { [`data-${i}`]: s(t.base ?? r) };
7
+ for (const o of d) t[o] !== void 0 && (e[`data-${i}-${o}`] = typeof t[o] == "boolean" ? String(t[o]) : t[o]);
8
+ return e;
9
+ }
10
+ export {
11
+ c as responsiveAttrs
12
+ };
@@ -0,0 +1,31 @@
1
+ "use client";
2
+ import { useState as f, useEffect as a } from "react";
3
+ function p(n, l, c = !0) {
4
+ const [d, o] = f({ start: !1, end: !1 });
5
+ return a(() => {
6
+ var i;
7
+ const t = c ? (i = n.current) == null ? void 0 : i.querySelector(l) : null;
8
+ if (!t) {
9
+ o({ start: !1, end: !1 });
10
+ return;
11
+ }
12
+ const e = () => {
13
+ const u = Math.abs(t.scrollLeft);
14
+ o({ start: u > 2, end: u + t.clientWidth < t.scrollWidth - 2 });
15
+ };
16
+ e(), t.addEventListener("scroll", e, { passive: !0 });
17
+ const s = typeof ResizeObserver > "u" ? null : new ResizeObserver(e);
18
+ s == null || s.observe(t);
19
+ const r = typeof MutationObserver > "u" ? null : new MutationObserver(e);
20
+ return r == null || r.observe(t, { childList: !0 }), () => {
21
+ t.removeEventListener("scroll", e), s == null || s.disconnect(), r == null || r.disconnect();
22
+ };
23
+ }, [n, l, c]), { edges: d, scroll: (t) => {
24
+ var s;
25
+ const e = (s = n.current) == null ? void 0 : s.querySelector(l);
26
+ e == null || e.scrollBy({ left: t * (getComputedStyle(e).direction === "rtl" ? -1 : 1) * e.clientWidth * 0.8, behavior: "smooth" });
27
+ } };
28
+ }
29
+ export {
30
+ p as useScrollEdges
31
+ };
@@ -0,0 +1,10 @@
1
+ "use client";
2
+ const e = [[0, "0"], [1, "0-25"], [2, "0-5"], [4, "1"], [6, "1-5"], [8, "2"], [10, "2-5"], [12, "3"], [14, "3-5"], [16, "4"], [20, "5"], [24, "6"], [28, "7"], [32, "8"], [40, "10"], [48, "12"], [64, "16"], [80, "20"], [88, "22"], [96, "24"]];
3
+ function o(t) {
4
+ let a = e[0];
5
+ for (const s of e) (Math.abs(s[0] - t) < Math.abs(a[0] - t) || Math.abs(s[0] - t) === Math.abs(a[0] - t) && s[0] > a[0]) && (a = s);
6
+ return `var(--alea-space-${a[1]})`;
7
+ }
8
+ export {
9
+ o as spaceFromPx
10
+ };
@@ -0,0 +1,6 @@
1
+ /** Warn once per component and old name (console.warn; silent on the server and when the console is missing). */
2
+ export declare function warnDeprecated(component: string, oldName: string, newName: string): void;
3
+ /** The value of a renamed prop: the new one wins; the old one still works and warns. */
4
+ export declare function renamed<T>(component: string, oldName: string, oldValue: T | undefined, newName: string, newValue: T | undefined): T | undefined;
5
+ /** A renamed value ("default" is now "neutral", "comfortable" is now "comfy"): an old value maps to the new one and warns; the result no longer has the old value in its type. */
6
+ export declare function renamedValue<V extends string, M extends Readonly<Record<string, string>>>(component: string, prop: string, value: V | undefined, map: M): Exclude<V, keyof M> | M[keyof M] | undefined;
@@ -0,0 +1,17 @@
1
+ "use client";
2
+ const d = /* @__PURE__ */ new Set();
3
+ function o(t, r, e) {
4
+ const n = `${t}.${r}`;
5
+ d.has(n) || typeof console > "u" || (d.add(n), console.warn(`[alea] ${t}: "${r}" is deprecated and will be removed in 1.0. Use "${e}".`));
6
+ }
7
+ function c(t, r, e, n, i) {
8
+ return i !== void 0 ? i : (e !== void 0 && o(t, r, n), e);
9
+ }
10
+ function f(t, r, e, n) {
11
+ return e !== void 0 && Object.prototype.hasOwnProperty.call(n, e) ? (o(t, `${r}="${e}"`, `${r}="${n[e]}"`), n[e]) : e;
12
+ }
13
+ export {
14
+ c as renamed,
15
+ f as renamedValue,
16
+ o as warnDeprecated
17
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alea-design/ui",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "Alea: the complete React design system. Accessible components from forms to AI, charts and editors, Alea Motion, and W3C design tokens for dark, light and high contrast.",
5
5
  "keywords": [
6
6
  "react",
@@ -8,7 +8,6 @@
8
8
  "ui",
9
9
  "design system",
10
10
  "component library",
11
- "react aria",
12
11
  "accessibility",
13
12
  "a11y",
14
13
  "design tokens",
@@ -17,10 +16,10 @@
17
16
  "animation",
18
17
  "figma"
19
18
  ],
20
- "homepage": "https://alea.alevasquez.dev",
19
+ "homepage": "https://alea.alevasquez.dev?utm_source=npm&utm_medium=package&utm_campaign=alea-ui",
21
20
  "repository": {
22
21
  "type": "git",
23
- "url": "https://github.com/alevascha/alea-design.git",
22
+ "url": "git+https://github.com/alevascha/alea-design.git",
24
23
  "directory": "packages/react"
25
24
  },
26
25
  "bugs": {
@@ -36,7 +35,9 @@
36
35
  "types": "./dist/index.d.ts",
37
36
  "default": "./dist/index.js"
38
37
  },
39
- "./styles.css": "./dist/styles.css"
38
+ "./styles.css": "./dist/styles.css",
39
+ "./css/*": "./dist/css/*",
40
+ "./css/groups.json": "./dist/css/groups.json"
40
41
  },
41
42
  "sideEffects": [
42
43
  "*.css"
@@ -51,7 +52,7 @@
51
52
  "access": "public"
52
53
  },
53
54
  "scripts": {
54
- "build": "vite build && tsc -p tsconfig.build.json",
55
+ "build": "vite build && tsc -p tsconfig.build.json && node ../../scripts/fix-dts.mjs dist && node scripts/build-css-groups.mjs",
55
56
  "test": "vitest run",
56
57
  "typecheck": "tsc --noEmit"
57
58
  },
@@ -60,11 +61,14 @@
60
61
  "react-dom": ">=18.3"
61
62
  },
62
63
  "dependencies": {
63
- "@alea-design/motion": "0.2.0",
64
- "@alea-design/tokens": "0.2.0",
64
+ "@alea-design/motion": "0.3.0",
65
+ "@alea-design/tokens": "0.3.0",
65
66
  "@internationalized/date": "^3.8.0",
66
67
  "lucide-react": "^0.525.0",
67
68
  "qrcode-generator": "^1.5.2",
68
69
  "react-aria-components": "^1.22.1"
70
+ },
71
+ "devDependencies": {
72
+ "esbuild": "^0.25.0"
69
73
  }
70
74
  }