@alea-design/ui 0.1.1 → 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 +7 -1
  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 +3 -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,355 @@
1
+ "use client";
2
+ import { jsx as a, jsxs as x, Fragment as z } from "react/jsx-runtime";
3
+ import { useState as A, useRef as $, forwardRef as Y, useId as K, useEffect as R } from "react";
4
+ import { Popover as H, Menu as j } from "react-aria-components";
5
+ import { withMotionStyle as I } from "@alea-design/motion";
6
+ import { ChevronDown as q } from "lucide-react";
7
+ import { cx as L } from "../../utils/cx.js";
8
+ import { useMergedRef as G } from "../../utils/refs.js";
9
+ import { MenuSeparator as P, MenuItem as U } from "../menu/Menu.js";
10
+ import { useStrings as T } from "../../i18n/strings.js";
11
+ const W = (d) => d.map((s, t) => "separator" in s ? /* @__PURE__ */ a(P, {}, `s${t}`) : /* @__PURE__ */ a(U, { id: s.id, icon: s.icon, shortcut: s.shortcut, description: s.description, tone: s.tone, isDisabled: s.isDisabled, children: s.label }, String(s.id)));
12
+ function se({ motion: d, children: s, items: t, onAction: h, className: w, areaLabel: g, "aria-label": N }) {
13
+ const o = T();
14
+ N ?? (N = o.contextMenu);
15
+ const [f, p] = A(null), m = $(null), y = $(null), r = $(void 0), n = (e, u) => {
16
+ const D = m.current.getBoundingClientRect();
17
+ p({ x: e - D.left, y: u - D.top });
18
+ };
19
+ return /* @__PURE__ */ x(
20
+ "div",
21
+ {
22
+ ref: m,
23
+ className: L("alea-context-area", w),
24
+ tabIndex: 0,
25
+ role: "group",
26
+ "aria-label": `${g}, menu with Shift+F10`,
27
+ onContextMenu: (e) => {
28
+ e.preventDefault(), n(e.clientX, e.clientY);
29
+ },
30
+ onKeyDown: (e) => {
31
+ if (e.shiftKey && e.key === "F10" || e.key === "ContextMenu") {
32
+ e.preventDefault();
33
+ const u = m.current.getBoundingClientRect();
34
+ n(u.left + 16, u.top + 16);
35
+ }
36
+ },
37
+ onTouchStart: (e) => {
38
+ const u = e.touches[0];
39
+ r.current = window.setTimeout(() => n(u.clientX, u.clientY), 550);
40
+ },
41
+ onTouchEnd: () => clearTimeout(r.current),
42
+ onTouchMove: () => clearTimeout(r.current),
43
+ children: [
44
+ s,
45
+ /* @__PURE__ */ a("span", { ref: y, className: "alea-context-anchor", style: { left: (f == null ? void 0 : f.x) ?? 0, top: (f == null ? void 0 : f.y) ?? 0 }, "aria-hidden": "true" }),
46
+ /* @__PURE__ */ a(H, { triggerRef: y, isOpen: !!f, onOpenChange: (e) => {
47
+ var u;
48
+ e || (p(null), (u = m.current) == null || u.focus());
49
+ }, placement: "bottom start", offset: 2, className: "alea-popover alea-menu-popover", style: I(void 0, d), children: /* @__PURE__ */ a(j, { "aria-label": N, autoFocus: "first", className: "alea-menu", onAction: (e) => {
50
+ var u;
51
+ h == null || h(e), p(null), (u = m.current) == null || u.focus();
52
+ }, children: W(t) }) })
53
+ ]
54
+ }
55
+ );
56
+ }
57
+ function oe({ motion: d, menus: s, onAction: t, className: h, "aria-label": w }) {
58
+ const [g, N] = A(0), [o, f] = A(null), p = $([]), m = (r, n) => {
59
+ var u;
60
+ const e = (r + s.length) % s.length;
61
+ N(e), (u = p.current[e]) == null || u.focus(), f(n ? e : null);
62
+ }, y = (r, n) => {
63
+ const e = r.key;
64
+ if (e === "ArrowRight") m(n + 1, !1);
65
+ else if (e === "ArrowLeft") m(n - 1, !1);
66
+ else if (e === "Home") m(0, !1);
67
+ else if (e === "End") m(s.length - 1, !1);
68
+ else if (e === "ArrowDown" || e === "Enter" || e === " ") f(n);
69
+ else return;
70
+ r.preventDefault();
71
+ };
72
+ return /* @__PURE__ */ a("div", { role: "menubar", "aria-label": w, className: L("alea-menubar", h), children: s.map((r, n) => /* @__PURE__ */ x("span", { className: "alea-menubar-slot", children: [
73
+ /* @__PURE__ */ a(
74
+ "button",
75
+ {
76
+ ref: (e) => {
77
+ p.current[n] = e;
78
+ },
79
+ type: "button",
80
+ role: "menuitem",
81
+ "aria-haspopup": "menu",
82
+ "aria-expanded": o === n,
83
+ tabIndex: g === n ? 0 : -1,
84
+ className: "alea-menubar-item alea-focus-ring",
85
+ onClick: () => {
86
+ N(n), f(o === n ? null : n);
87
+ },
88
+ onMouseEnter: () => {
89
+ o != null && o !== n && (N(n), f(n));
90
+ },
91
+ onKeyDown: (e) => y(e, n),
92
+ children: r.label
93
+ }
94
+ ),
95
+ /* @__PURE__ */ a(H, { triggerRef: { current: p.current[n] }, isOpen: o === n, onOpenChange: (e) => {
96
+ var u;
97
+ e || (f(null), (u = p.current[n]) == null || u.focus());
98
+ }, style: I(void 0, d), placement: "bottom start", offset: 4, className: "alea-popover alea-menu-popover", children: /* @__PURE__ */ a("div", { onKeyDown: (e) => {
99
+ e.key === "ArrowRight" && (e.preventDefault(), m(n + 1, !0)), e.key === "ArrowLeft" && (e.preventDefault(), m(n - 1, !0));
100
+ }, children: /* @__PURE__ */ a(j, { "aria-label": r.label, autoFocus: "first", className: "alea-menu", onAction: (e) => {
101
+ var u;
102
+ t == null || t(r.id, e), f(null), (u = p.current[n]) == null || u.focus();
103
+ }, children: W(r.items) }) }) })
104
+ ] }, r.id)) });
105
+ }
106
+ const ie = Y(function({ motion: s, trigger: t, children: h, openDelay: w = 500, closeDelay: g = 200, placement: N = "bottom", className: o, style: f }, p) {
107
+ const [m, y] = A(!1), r = $(null), n = G(p, r), e = $(void 0), u = K(), D = (l, i) => {
108
+ clearTimeout(e.current), e.current = window.setTimeout(() => y(l), i);
109
+ };
110
+ return R(() => () => clearTimeout(e.current), []), R(() => {
111
+ if (!m) return;
112
+ const l = (i) => {
113
+ i.key === "Escape" && y(!1);
114
+ };
115
+ return document.addEventListener("keydown", l), () => document.removeEventListener("keydown", l);
116
+ }, [m]), /* @__PURE__ */ x(z, { children: [
117
+ /* @__PURE__ */ a(
118
+ "span",
119
+ {
120
+ ref: n,
121
+ style: f,
122
+ className: L("alea-hovercard-trigger", o),
123
+ "aria-describedby": m ? u : void 0,
124
+ onMouseEnter: () => D(!0, w),
125
+ onMouseLeave: () => D(!1, g),
126
+ onFocus: () => D(!0, w),
127
+ onBlur: () => D(!1, g),
128
+ children: t
129
+ }
130
+ ),
131
+ /* @__PURE__ */ a(H, { triggerRef: r, isOpen: m, onOpenChange: y, isNonModal: !0, placement: N, offset: 8, className: "alea-popover alea-hovercard", style: I(void 0, s), children: /* @__PURE__ */ a("div", { id: u, role: "tooltip", onMouseEnter: () => clearTimeout(e.current), onMouseLeave: () => D(!1, g), children: h }) })
132
+ ] });
133
+ }), O = (d) => "items" in d, F = (d) => "href" in d, B = (d, s) => !!s && d.items.some((t) => F(t) ? t.href === s : O(t) ? B(t, s) : !1);
134
+ function V({ items: d, current: s, collapsed: t, railLabels: h, accordion: w, size: g = "md", onNavigate: N, className: o, label: f }) {
135
+ const p = K(), m = $(null), [y, r] = A(() => {
136
+ const l = /* @__PURE__ */ new Set(), i = (b, c) => b.forEach((S) => {
137
+ O(S) && B(S, s) && (l.add(`${c}/${S.label}`), i(S.items, `${c}/${S.label}`));
138
+ });
139
+ return t || i(d, ""), l;
140
+ });
141
+ R(() => {
142
+ t && r(/* @__PURE__ */ new Set());
143
+ }, [t]), R(() => {
144
+ if (!t || !y.size) return;
145
+ const l = (i) => {
146
+ var b;
147
+ (b = m.current) != null && b.contains(i.target) || r(/* @__PURE__ */ new Set());
148
+ };
149
+ return document.addEventListener("pointerdown", l), () => document.removeEventListener("pointerdown", l);
150
+ }, [t, y]);
151
+ const n = (l) => r((i) => {
152
+ const b = new Set(i);
153
+ return b.has(l) ? ([...b].forEach((c) => {
154
+ (c === l || c.startsWith(l + "/")) && b.delete(c);
155
+ }), b) : ((w || t) && [...b].forEach((c) => {
156
+ l.startsWith(c + "/") || b.delete(c);
157
+ }), b.add(l), b);
158
+ }), e = () => {
159
+ var l;
160
+ return Array.from(((l = m.current) == null ? void 0 : l.querySelectorAll(".alea-vnav-item")) || []).filter((i) => !i.closest(".alea-vnav-sub:not([data-open])") && !i.hasAttribute("aria-disabled"));
161
+ }, u = (l) => {
162
+ var S, C, k;
163
+ const i = e(), b = i.indexOf(document.activeElement), c = (v) => {
164
+ var E;
165
+ l.preventDefault(), (E = i[(v + i.length) % i.length]) == null || E.focus();
166
+ };
167
+ if (l.key === "ArrowDown") c(b + 1);
168
+ else if (l.key === "ArrowUp") c(b - 1);
169
+ else if (l.key === "Home") c(0);
170
+ else if (l.key === "End") c(i.length - 1);
171
+ else if (l.key === "ArrowRight" || l.key === "ArrowLeft") {
172
+ const v = document.activeElement, E = v == null ? void 0 : v.dataset.path;
173
+ if (l.key === "ArrowRight" && E && v.getAttribute("aria-expanded") === "false")
174
+ l.preventDefault(), n(E);
175
+ else if (l.key === "ArrowLeft")
176
+ if (E && v.getAttribute("aria-expanded") === "true")
177
+ l.preventDefault(), n(E);
178
+ else {
179
+ const M = (S = v.closest(".alea-vnav-sub")) == null ? void 0 : S.previousElementSibling;
180
+ M && (l.preventDefault(), M.focus());
181
+ }
182
+ } else if (l.key === "Escape" && t && y.size) {
183
+ const v = [...y][0];
184
+ (k = (C = m.current) == null ? void 0 : C.querySelector(`[data-path="${CSS.escape(v)}"]`)) == null || k.focus(), r(/* @__PURE__ */ new Set());
185
+ }
186
+ }, D = (l, i, b) => /* @__PURE__ */ a("ul", { className: "alea-vnav-list", "data-level": i, children: l.map((c, S) => {
187
+ if ("divider" in c) return /* @__PURE__ */ a("li", { "aria-hidden": "true", className: "alea-vnav-divider" }, `d${S}`);
188
+ if ("section" in c) return /* @__PURE__ */ a("li", { className: "alea-vnav-section", children: /* @__PURE__ */ a("span", { children: c.section }) }, `s${S}`);
189
+ const C = (v, E, M, X) => /* @__PURE__ */ x(z, { children: [
190
+ v ? /* @__PURE__ */ a("span", { className: "alea-vnav-icon", "aria-hidden": "true", children: v }) : i === 0 && t ? /* @__PURE__ */ a("span", { className: "alea-vnav-icon alea-vnav-initial", "aria-hidden": "true", children: E.slice(0, 1) }) : null,
191
+ /* @__PURE__ */ a("span", { className: "alea-vnav-label", children: E }),
192
+ M != null && /* @__PURE__ */ a("span", { className: "alea-vnav-badge", children: M }),
193
+ X
194
+ ] });
195
+ if (O(c)) {
196
+ const v = `${b}/${c.label}`, E = y.has(v), M = `${p}${v.replace(/[^a-z0-9]/gi, "-")}`;
197
+ return /* @__PURE__ */ x("li", { className: "alea-vnav-li", children: [
198
+ /* @__PURE__ */ a(
199
+ "button",
200
+ {
201
+ type: "button",
202
+ className: "alea-vnav-item alea-focus-ring",
203
+ "data-path": v,
204
+ "aria-expanded": E,
205
+ "aria-controls": M,
206
+ "data-current": B(c, s) || void 0,
207
+ "data-tip": t && i === 0 ? c.label : void 0,
208
+ style: { "--lvl": i },
209
+ onClick: () => n(v),
210
+ children: C(c.icon, c.label, c.badge, /* @__PURE__ */ a(q, { size: 14, "aria-hidden": "true", className: "alea-vnav-chevron" }))
211
+ }
212
+ ),
213
+ /* @__PURE__ */ a("div", { id: M, className: "alea-vnav-sub", "data-open": E || void 0, "data-flyout": t && i === 0 ? !0 : void 0, children: /* @__PURE__ */ x("div", { className: "alea-vnav-sub-inner", children: [
214
+ t && i === 0 && /* @__PURE__ */ a("p", { className: "alea-vnav-flyout-title", children: c.label }),
215
+ D(c.items, t && i === 0 ? 0 : i + 1, v),
216
+ c.footer && /* @__PURE__ */ a("div", { className: "alea-vnav-footer", children: c.footer })
217
+ ] }) })
218
+ ] }, v);
219
+ }
220
+ const k = c;
221
+ return /* @__PURE__ */ a("li", { className: "alea-vnav-li", children: /* @__PURE__ */ a(
222
+ "a",
223
+ {
224
+ href: k.isDisabled ? void 0 : k.href,
225
+ className: "alea-vnav-item alea-focus-ring",
226
+ "aria-current": k.href === s ? "page" : void 0,
227
+ "aria-disabled": k.isDisabled || void 0,
228
+ tabIndex: k.isDisabled ? -1 : void 0,
229
+ "data-tip": t && i === 0 ? k.label : void 0,
230
+ style: { "--lvl": i },
231
+ onClick: (v) => {
232
+ if (k.isDisabled) {
233
+ v.preventDefault();
234
+ return;
235
+ }
236
+ N == null || N(k.href, v), t && r(/* @__PURE__ */ new Set());
237
+ },
238
+ children: C(k.icon, k.label, k.badge)
239
+ }
240
+ ) }, `${b}/${k.href}`);
241
+ }) });
242
+ return /* @__PURE__ */ a(
243
+ "nav",
244
+ {
245
+ ref: m,
246
+ "aria-label": f,
247
+ className: L("alea-vnav", o),
248
+ "data-collapsed": t || void 0,
249
+ "data-rail-labels": t && h ? !0 : void 0,
250
+ "data-size": g !== "md" ? g : void 0,
251
+ onKeyDown: u,
252
+ onBlur: (l) => {
253
+ var i;
254
+ t && !((i = m.current) != null && i.contains(l.relatedTarget)) && r(/* @__PURE__ */ new Set());
255
+ },
256
+ children: D(d, 0, "")
257
+ }
258
+ );
259
+ }
260
+ function ce(d) {
261
+ const s = T();
262
+ return d.orientation === "vertical" ? /* @__PURE__ */ a(V, { ...d, label: d["aria-label"] ?? s.mainNav }) : /* @__PURE__ */ a(J, { ...d });
263
+ }
264
+ function J({ items: d, current: s, className: t, onNavigate: h, "aria-label": w }) {
265
+ const g = T();
266
+ w ?? (w = g.mainNav);
267
+ const N = d.filter((r) => F(r) || O(r)), [o, f] = A(null), p = $(null), m = $([]), y = K();
268
+ return R(() => {
269
+ if (o == null) return;
270
+ const r = (n) => {
271
+ var e;
272
+ (e = p.current) != null && e.contains(n.target) || f(null);
273
+ };
274
+ return document.addEventListener("pointerdown", r), () => document.removeEventListener("pointerdown", r);
275
+ }, [o]), /* @__PURE__ */ a(
276
+ "nav",
277
+ {
278
+ ref: p,
279
+ "aria-label": w,
280
+ className: L("alea-navmenu", t),
281
+ onKeyDown: (r) => {
282
+ var n;
283
+ r.key === "Escape" && o != null && ((n = m.current[o]) == null || n.focus(), f(null));
284
+ },
285
+ onBlur: (r) => {
286
+ var n;
287
+ (n = p.current) != null && n.contains(r.relatedTarget) || f(null);
288
+ },
289
+ children: /* @__PURE__ */ a("ul", { className: "alea-navmenu-list", children: N.map((r, n) => /* @__PURE__ */ a("li", { className: "alea-navmenu-li", children: "items" in r ? /* @__PURE__ */ x(z, { children: [
290
+ /* @__PURE__ */ x(
291
+ "button",
292
+ {
293
+ ref: (e) => {
294
+ m.current[n] = e;
295
+ },
296
+ type: "button",
297
+ className: "alea-navmenu-item alea-focus-ring",
298
+ "aria-expanded": o === n,
299
+ "aria-controls": `${y}-${n}`,
300
+ onClick: () => f(o === n ? null : n),
301
+ "data-current": B(r, s) || void 0,
302
+ children: [
303
+ r.label,
304
+ /* @__PURE__ */ a(q, { size: 14, "aria-hidden": "true", className: "alea-navmenu-chevron" })
305
+ ]
306
+ }
307
+ ),
308
+ /* @__PURE__ */ x("div", { id: `${y}-${n}`, className: "alea-navmenu-panel", hidden: o !== n, children: [
309
+ /* @__PURE__ */ a("ul", { className: "alea-navmenu-links", "data-cols": r.items.length > 3 ? 2 : 1, children: r.items.filter(F).map((e) => /* @__PURE__ */ a("li", { children: /* @__PURE__ */ x("a", { href: e.href, className: "alea-navmenu-link alea-focus-ring", "aria-current": e.href === s ? "page" : void 0, onClick: (u) => h == null ? void 0 : h(e.href, u), children: [
310
+ e.icon && /* @__PURE__ */ a("span", { className: "alea-navmenu-icon", "aria-hidden": "true", children: e.icon }),
311
+ /* @__PURE__ */ x("span", { children: [
312
+ /* @__PURE__ */ a("span", { className: "alea-navmenu-title", children: e.label }),
313
+ e.description && /* @__PURE__ */ a("span", { className: "alea-navmenu-desc", children: e.description })
314
+ ] })
315
+ ] }) }, e.href)) }),
316
+ r.footer && /* @__PURE__ */ a("div", { className: "alea-navmenu-footer", children: r.footer })
317
+ ] })
318
+ ] }) : /* @__PURE__ */ a("a", { href: r.href, className: "alea-navmenu-item alea-focus-ring", "aria-current": r.href === s ? "page" : void 0, onClick: (e) => h == null ? void 0 : h(r.href, e), children: r.label }) }, r.label)) })
319
+ }
320
+ );
321
+ }
322
+ function ue({ items: d, value: s, onChange: t, fixed: h = !0, className: w, "aria-label": g }) {
323
+ const N = T();
324
+ return g ?? (g = N.mainNav), /* @__PURE__ */ a("nav", { "aria-label": g, className: L("alea-bottomnav", w), "data-fixed": h || void 0, children: /* @__PURE__ */ a("ul", { children: d.map((o) => {
325
+ const f = /* @__PURE__ */ x(z, { children: [
326
+ /* @__PURE__ */ x("span", { className: "alea-bottomnav-icon", "aria-hidden": "true", children: [
327
+ o.icon,
328
+ o.badge ? /* @__PURE__ */ a("span", { className: "alea-bottomnav-badge", children: o.badge > 99 ? "99+" : o.badge }) : null
329
+ ] }),
330
+ /* @__PURE__ */ a("span", { className: "alea-bottomnav-label", children: o.label }),
331
+ o.badge ? /* @__PURE__ */ x("span", { className: "alea-visually-hidden", children: [
332
+ ", ",
333
+ o.badge,
334
+ " new"
335
+ ] }) : null
336
+ ] }), p = o.id === s;
337
+ return /* @__PURE__ */ a("li", { children: o.href ? /* @__PURE__ */ a("a", { href: o.href, className: "alea-bottomnav-item alea-focus-ring", "aria-current": p ? "page" : void 0, onClick: () => t == null ? void 0 : t(o.id), children: f }) : /* @__PURE__ */ a("button", { type: "button", className: "alea-bottomnav-item alea-focus-ring", "aria-current": p ? "page" : void 0, onClick: () => t == null ? void 0 : t(o.id), children: f }) }, o.id);
338
+ }) }) });
339
+ }
340
+ function de({ isOpen: d, onChange: s, size: t = "md", className: h, "aria-controls": w, "aria-label": g }) {
341
+ const N = T();
342
+ return g ?? (g = N.menu), /* @__PURE__ */ x("button", { type: "button", className: L("alea-burger alea-focus-ring", h), "data-size": t, "data-open": d || void 0, "aria-expanded": d, "aria-controls": w, "aria-label": g, onClick: () => s(!d), children: [
343
+ /* @__PURE__ */ a("span", { "aria-hidden": "true" }),
344
+ /* @__PURE__ */ a("span", { "aria-hidden": "true" }),
345
+ /* @__PURE__ */ a("span", { "aria-hidden": "true" })
346
+ ] });
347
+ }
348
+ export {
349
+ ue as BottomNavigation,
350
+ de as Burger,
351
+ se as ContextMenu,
352
+ ie as HoverCard,
353
+ oe as Menubar,
354
+ ce as NavigationMenu
355
+ };
@@ -1,8 +1,9 @@
1
- import type { ReactNode } from 'react';
1
+ import { type CSSProperties, type ReactNode } from 'react';
2
2
  import { DialogTrigger, type ModalOverlayProps } from 'react-aria-components';
3
3
  import { type MotionProp } from '@alea-design/motion';
4
- import { type DialogProps, type PopoverProps } from './Overlay';
5
- export interface DrawerProps extends Omit<ModalOverlayProps, 'children'> {
4
+ import { type DialogProps, type PopoverProps } from './Overlay.js';
5
+ import { type SurfaceProps } from '../surface/Surface.js';
6
+ export interface DrawerProps extends Omit<ModalOverlayProps, 'children'>, Pick<SurfaceProps, 'surface'> {
6
7
  children: ReactNode;
7
8
  /** Side it slides in from. Default end (right in left-to-right). */
8
9
  placement?: 'start' | 'end' | 'bottom';
@@ -12,7 +13,7 @@ export interface DrawerProps extends Omit<ModalOverlayProps, 'children'> {
12
13
  motion?: MotionProp;
13
14
  }
14
15
  /** A panel that slides in from the side: filters, details, navigation on mobile. Focus is trapped, Escape closes. */
15
- export declare function Drawer({ children, placement, size, className, isDismissable, motion, ...props }: DrawerProps): import("react").JSX.Element;
16
+ export declare function Drawer({ children, placement, size, className, isDismissable, motion, surface, ...props }: DrawerProps): import("react").JSX.Element;
16
17
  /** The content of a Drawer: title, body and footer, like Dialog. */
17
18
  export declare function DrawerContent(props: DialogProps): import("react").JSX.Element;
18
19
  export { DialogTrigger as DrawerTrigger };
@@ -28,13 +29,17 @@ export interface PopconfirmProps {
28
29
  /** Default "Cancel". */
29
30
  cancelLabel?: ReactNode;
30
31
  /** danger turns the confirm button red. */
31
- tone?: 'default' | 'danger';
32
+ tone?: 'neutral' | 'danger' | /** @deprecated Use neutral. */ 'default';
32
33
  /** Called when the person confirms. */
33
34
  onConfirm: () => unknown;
34
35
  /** Where it opens relative to its trigger. */
35
36
  placement?: PopoverProps['placement'];
36
37
  /** How the popup enters and leaves: a preset (fade, scale, pop, slide-down, blur...), false for none, or options. */
37
38
  motion?: MotionProp;
39
+ /** Extra class names for the popup. */
40
+ className?: string;
41
+ /** Inline style for the popup. */
42
+ style?: CSSProperties;
38
43
  }
39
44
  /** A small confirm next to its trigger, for quick, reversible-ish actions. */
40
- export declare function Popconfirm({ motion, children, title, description, confirmLabel, cancelLabel, tone, onConfirm, placement }: PopconfirmProps): import("react").JSX.Element;
45
+ export declare const Popconfirm: import("react").ForwardRefExoticComponent<PopconfirmProps & import("react").RefAttributes<HTMLElement>>;
@@ -0,0 +1,39 @@
1
+ "use client";
2
+ import { jsx as r, jsxs as s, Fragment as y } from "react/jsx-runtime";
3
+ import { forwardRef as x } from "react";
4
+ import { ModalOverlay as D, Modal as P, DialogTrigger as N } from "react-aria-components";
5
+ import { DialogTrigger as X } from "react-aria-components";
6
+ import { withMotionStyle as M } from "@alea-design/motion";
7
+ import { withBase as T, cx as j } from "../../utils/cx.js";
8
+ import { Button as d } from "../button/Button.js";
9
+ import { Dialog as A, Popover as B, PopoverDialog as F } from "./Overlay.js";
10
+ import { useStrings as S } from "../../i18n/strings.js";
11
+ import { renamedValue as z } from "../../utils/vocabulary.js";
12
+ import { surfaceAttrs as C } from "../surface/Surface.js";
13
+ function J({ children: a, placement: o = "end", size: e = 420, className: l, isDismissable: t = !0, motion: n, surface: i, ...m }) {
14
+ return /* @__PURE__ */ r(D, { ...m, isDismissable: t, className: T("alea-modal-overlay alea-drawer-overlay", l), "data-placement": o, children: /* @__PURE__ */ r(P, { className: "alea-drawer", "data-placement": o, ...C({ surface: i }), style: M({ "--alea-drawer-size": typeof e == "number" ? `${e}px` : e }, n), children: a }) });
15
+ }
16
+ function K(a) {
17
+ return /* @__PURE__ */ r(A, { ...a, className: "alea-drawer-content" });
18
+ }
19
+ const Q = x(function({ motion: o, children: e, title: l, description: t, confirmLabel: n, cancelLabel: i, tone: m, onConfirm: f, placement: u = "top", className: g, style: h }, w) {
20
+ const v = z("Popconfirm", "tone", m, { default: "neutral" }) ?? "neutral", c = S();
21
+ return n ?? (n = c.yes), i ?? (i = c.cancel), /* @__PURE__ */ s(N, { children: [
22
+ e,
23
+ /* @__PURE__ */ r(B, { showArrow: !0, placement: u, motion: o, children: /* @__PURE__ */ r(F, { ref: w, style: h, role: "alertdialog", title: l, className: j("alea-popover-dialog alea-popconfirm", g), children: ({ close: p }) => /* @__PURE__ */ s(y, { children: [
24
+ t && /* @__PURE__ */ r("p", { className: "alea-popconfirm-text", children: t }),
25
+ /* @__PURE__ */ s("div", { className: "alea-popconfirm-actions", children: [
26
+ /* @__PURE__ */ r(d, { size: "sm", variant: "ghost", onPress: p, children: i }),
27
+ /* @__PURE__ */ r(d, { size: "sm", variant: v === "danger" ? "danger" : "primary", autoFocus: !0, onPress: async () => {
28
+ await f(), p();
29
+ }, children: n })
30
+ ] })
31
+ ] }) }) })
32
+ ] });
33
+ });
34
+ export {
35
+ J as Drawer,
36
+ K as DrawerContent,
37
+ X as DrawerTrigger,
38
+ Q as Popconfirm
39
+ };
@@ -1,10 +1,13 @@
1
- import type { ReactNode } from 'react';
1
+ import { type CSSProperties, type ReactNode } from 'react';
2
2
  import { type ModalOverlayProps } from 'react-aria-components';
3
3
  import { type MotionProp } from '@alea-design/motion';
4
+ import { type SurfaceProps } from '../surface/Surface.js';
4
5
  type Render = ReactNode | ((opts: {
5
6
  close: () => void;
6
7
  }) => ReactNode);
7
- export interface ModalProps extends Omit<ModalOverlayProps, 'children' | 'className' | 'style'> {
8
+ export interface ModalProps extends Omit<ModalOverlayProps, 'children' | 'className' | 'style'>, SurfaceProps {
9
+ /** Inline style for the modal surface (the dialog). */
10
+ style?: CSSProperties;
8
11
  /** Anything: a form, a gallery, a video, a wizard, a whole page. A function gets close. */
9
12
  children: Render;
10
13
  /** The button (or any pressable) that opens it. Leave it out and control isOpen yourself. */
@@ -37,5 +40,5 @@ export interface ModalProps extends Omit<ModalOverlayProps, 'children' | 'classN
37
40
  className?: string;
38
41
  }
39
42
  /** A modal with any content: a header and footer if you want them, seven sizes, centered or at the top, the body or the whole modal scrolling, edge-to-edge media, three backdrops. Traps focus, closes on Escape and outside click, and returns focus to what opened it. For a title, text and two buttons, Dialog is quicker; to confirm something destructive, AlertDialog. */
40
- export declare function Modal({ children, trigger, title, 'aria-label': label, header, footer, size, placement, scrollBehavior, padding, backdrop, showClose, fullscreenBelow, motion, className, isDismissable, isOpen, defaultOpen, onOpenChange, ...props }: ModalProps): import("react").JSX.Element;
43
+ export declare const Modal: import("react").ForwardRefExoticComponent<ModalProps & import("react").RefAttributes<HTMLElement>>;
41
44
  export {};
@@ -0,0 +1,27 @@
1
+ "use client";
2
+ import { jsx as a, jsxs as i, Fragment as I } from "react/jsx-runtime";
3
+ import { forwardRef as R } from "react";
4
+ import { ModalOverlay as T, Modal as X, Dialog as $, Heading as q, DialogTrigger as E } from "react-aria-components";
5
+ import { X as v } from "lucide-react";
6
+ import { withMotionStyle as G } from "@alea-design/motion";
7
+ import { cx as J } from "../../utils/cx.js";
8
+ import { IconButton as N } from "../button/Button.js";
9
+ import { useStrings as K } from "../../i18n/strings.js";
10
+ import { surfaceAttrs as L } from "../surface/Surface.js";
11
+ const b = (l, e) => typeof l == "function" ? l({ close: e }) : l, O = R(function({ children: e, trigger: r, title: d, "aria-label": g, header: m, footer: t, size: y = "md", placement: M = "center", scrollBehavior: s = "inside", padding: z = "normal", backdrop: j = "dim", showClose: c = !0, fullscreenBelow: n, motion: w, className: D, isDismissable: P = !0, isOpen: f, defaultOpen: x, onOpenChange: h, style: S, surface: k, radius: A, ...F }, H) {
12
+ const p = K(), u = /* @__PURE__ */ a(T, { ...F, ...r ? {} : { isOpen: f, defaultOpen: x, onOpenChange: h }, isDismissable: P, className: "alea-modal-overlay alea-xmodal-overlay", "data-placement": M, "data-scroll": s, "data-backdrop": j, "data-fullscreen-below": n, children: /* @__PURE__ */ a(X, { className: "alea-modal alea-xmodal", ...L({ surface: k, radius: A }), "data-size": y, "data-scroll": s, "data-fullscreen-below": n, style: G(void 0, w), children: /* @__PURE__ */ a($, { ref: H, "aria-modal": "true", "aria-label": d ? void 0 : g, className: J("alea-xmodal-dialog", D), style: S, "data-padding": z, children: ({ close: o }) => /* @__PURE__ */ i(I, { children: [
13
+ m || d ? /* @__PURE__ */ i("div", { className: "alea-xmodal-head", children: [
14
+ m ?? /* @__PURE__ */ a(q, { slot: "title", className: "alea-dialog-title", children: d }),
15
+ c && /* @__PURE__ */ a(N, { "aria-label": p.close, size: "sm", variant: "ghost", onPress: o, className: "alea-dialog-x", children: /* @__PURE__ */ a(v, {}) })
16
+ ] }) : c && /* @__PURE__ */ a(N, { "aria-label": p.close, size: "sm", variant: "ghost", onPress: o, className: "alea-xmodal-x", children: /* @__PURE__ */ a(v, {}) }),
17
+ /* @__PURE__ */ a("div", { className: "alea-xmodal-body", children: b(e, o) }),
18
+ t && /* @__PURE__ */ a("div", { className: "alea-xmodal-footer", children: b(t, o) })
19
+ ] }) }) }) });
20
+ return r ? /* @__PURE__ */ i(E, { isOpen: f, defaultOpen: x, onOpenChange: h, children: [
21
+ r,
22
+ u
23
+ ] }) : u;
24
+ });
25
+ export {
26
+ O as Modal
27
+ };
@@ -1,8 +1,9 @@
1
- import type { ReactNode } from 'react';
1
+ import { type ReactNode, type CSSProperties } from 'react';
2
2
  import { DialogTrigger, type PopoverProps as RACPopoverProps, type TooltipProps as RACTooltipProps, type TooltipTriggerComponentProps, type DialogProps as RACDialogProps, type ModalOverlayProps } from 'react-aria-components';
3
3
  import { type MotionProp } from '@alea-design/motion';
4
+ import { type SurfaceProps } from '../surface/Surface.js';
4
5
  export { DialogTrigger };
5
- export interface PopoverProps extends Omit<RACPopoverProps, 'children'> {
6
+ export interface PopoverProps extends Omit<RACPopoverProps, 'children'>, SurfaceProps {
6
7
  children: ReactNode;
7
8
  /** Shows the little arrow pointing at the trigger. */
8
9
  showArrow?: boolean;
@@ -12,7 +13,7 @@ export interface PopoverProps extends Omit<RACPopoverProps, 'children'> {
12
13
  size?: 'sm' | 'md' | 'lg';
13
14
  }
14
15
  /** A floating panel attached to a trigger; closes on Escape or outside click. Three widths, an optional arrow. */
15
- export declare function Popover({ children, showArrow, className, offset, motion, style, size, ...props }: PopoverProps): import("react").JSX.Element;
16
+ export declare const Popover: import("react").ForwardRefExoticComponent<PopoverProps & import("react").RefAttributes<HTMLElement>>;
16
17
  export interface PopoverDialogProps extends RACDialogProps {
17
18
  /** Optional title at the top. */
18
19
  title?: ReactNode;
@@ -24,7 +25,7 @@ export interface PopoverDialogProps extends RACDialogProps {
24
25
  showClose?: boolean;
25
26
  }
26
27
  /** The content of a Popover that holds interactive things (forms, filters, settings): a title, a description, a footer and a close button. */
27
- export declare function PopoverDialog({ title, description, footer, showClose, children, className, ...props }: PopoverDialogProps): import("react").JSX.Element;
28
+ export declare const PopoverDialog: import("react").ForwardRefExoticComponent<PopoverDialogProps & import("react").RefAttributes<HTMLElement>>;
28
29
  export interface TooltipProps extends Omit<RACTooltipProps, 'children'> {
29
30
  children: ReactNode;
30
31
  /** A bold first line: a rich tooltip with a title and a sentence. Keep it non-interactive; for links use Toggletip. */
@@ -58,8 +59,8 @@ export interface DialogProps extends Omit<RACDialogProps, 'children'> {
58
59
  hideClose?: boolean;
59
60
  }
60
61
  /** The dialog content: title, text, body and footer. Put it inside DialogModal. */
61
- export declare function Dialog({ title, description, children, footer, hideClose, className, ...props }: DialogProps): import("react").JSX.Element;
62
- export interface DialogModalProps extends Omit<ModalOverlayProps, 'children'> {
62
+ export declare const Dialog: import("react").ForwardRefExoticComponent<DialogProps & import("react").RefAttributes<HTMLElement>>;
63
+ export interface DialogModalProps extends Omit<ModalOverlayProps, 'children'>, SurfaceProps {
63
64
  children: ReactNode;
64
65
  /** sm 400, md 520, lg 720, full. */
65
66
  size?: 'sm' | 'md' | 'lg' | 'full';
@@ -69,7 +70,7 @@ export interface DialogModalProps extends Omit<ModalOverlayProps, 'children'> {
69
70
  motion?: MotionProp;
70
71
  }
71
72
  /** The modal layer: dims the page, traps focus, closes on Escape (and outside click when isDismissable). Four sizes, full screen on phones when you want. */
72
- export declare function DialogModal({ children, size, fullscreenBelow, className, isDismissable, motion, ...props }: DialogModalProps): import("react").JSX.Element;
73
+ export declare function DialogModal({ children, size, fullscreenBelow, className, isDismissable, motion, surface, radius, ...props }: DialogModalProps): import("react").JSX.Element;
73
74
  export interface AlertDialogProps {
74
75
  /** The question, e.g. "Delete this file?". */
75
76
  title: ReactNode;
@@ -79,7 +80,7 @@ export interface AlertDialogProps {
79
80
  /** The cancel button text. Default "Cancel". */
80
81
  cancelLabel?: ReactNode;
81
82
  /** danger turns the confirm button red. */
82
- tone?: 'default' | 'danger';
83
+ tone?: 'neutral' | 'danger' | /** @deprecated Use neutral. */ 'default';
83
84
  /** Runs on confirm; the dialog closes after it (awaits a promise). */
84
85
  onConfirm?: () => unknown;
85
86
  /** Open state (controlled). */
@@ -90,6 +91,10 @@ export interface AlertDialogProps {
90
91
  onOpenChange?: (open: boolean) => void;
91
92
  /** How the dialog enters and leaves (default rise). */
92
93
  motion?: MotionProp;
94
+ /** Extra class names for the dialog. */
95
+ className?: string;
96
+ /** Inline style for the dialog. */
97
+ style?: CSSProperties;
93
98
  }
94
99
  /** A confirm dialog (role alertdialog): Escape and outside click don't dismiss it by accident. */
95
- export declare function AlertDialog({ motion, title, children, confirmLabel, cancelLabel, tone, onConfirm, isOpen, defaultOpen, onOpenChange }: AlertDialogProps): import("react").JSX.Element;
100
+ export declare const AlertDialog: import("react").ForwardRefExoticComponent<AlertDialogProps & import("react").RefAttributes<HTMLElement>>;
@@ -0,0 +1,76 @@
1
+ "use client";
2
+ import { jsx as a, jsxs as p, Fragment as u } from "react/jsx-runtime";
3
+ import { forwardRef as g } from "react";
4
+ import { Dialog as P, Heading as T, ModalOverlay as j, Modal as k, Popover as F, OverlayArrow as x, Button as L, Tooltip as O, TooltipTrigger as S } from "react-aria-components";
5
+ import { DialogTrigger as ra } from "react-aria-components";
6
+ import { X as b } from "lucide-react";
7
+ import { withMotionStyle as v } from "@alea-design/motion";
8
+ import { cx as B, withBase as f } from "../../utils/cx.js";
9
+ import { Button as w, IconButton as H } from "../button/Button.js";
10
+ import { useStrings as N } from "../../i18n/strings.js";
11
+ import { renamedValue as I } from "../../utils/vocabulary.js";
12
+ import { surfaceAttrs as M } from "../surface/Surface.js";
13
+ const Z = g(function({ children: e, showArrow: o, className: l, offset: r = 8, motion: i, style: s, size: t, surface: n, radius: m, ...c }, h) {
14
+ return /* @__PURE__ */ p(F, { ...c, ref: h, offset: o ? 12 : r, "data-size": t, ...M({ surface: n, radius: m }), className: f("alea-popover", l), style: v(s, i), children: [
15
+ o && /* @__PURE__ */ a(x, { className: "alea-arrow", children: /* @__PURE__ */ a("svg", { width: 12, height: 12, viewBox: "0 0 12 12", children: /* @__PURE__ */ a("path", { d: "M0 0 L6 6 L12 0" }) }) }),
16
+ e
17
+ ] });
18
+ }), _ = g(function({ title: e, description: o, footer: l, showClose: r, children: i, className: s, ...t }, n) {
19
+ const m = N();
20
+ return /* @__PURE__ */ a(P, { ...t, ref: n, className: B("alea-popover-dialog", s), children: (c) => /* @__PURE__ */ p(u, { children: [
21
+ (e || r) && /* @__PURE__ */ p("div", { className: "alea-popover-head", children: [
22
+ e && /* @__PURE__ */ a(T, { slot: "title", className: "alea-popover-title", children: e }),
23
+ r && /* @__PURE__ */ a(L, { className: "alea-popover-close alea-focus-ring", "aria-label": m.close, onPress: c.close, children: /* @__PURE__ */ a(b, { size: 16, "aria-hidden": "true" }) })
24
+ ] }),
25
+ o && /* @__PURE__ */ a("p", { className: "alea-popover-desc", children: o }),
26
+ typeof i == "function" ? i(c) : i,
27
+ l && /* @__PURE__ */ a("div", { className: "alea-popover-footer", children: typeof l == "function" ? l(c.close) : l })
28
+ ] }) });
29
+ });
30
+ function C({ children: d, title: e, shortcut: o, hideArrow: l, className: r, offset: i = 8, motion: s, style: t, ...n }) {
31
+ return /* @__PURE__ */ p(O, { ...n, offset: i, className: f("alea-tooltip", r), "data-rich": e ? !0 : void 0, style: v(t, s), children: [
32
+ !l && /* @__PURE__ */ a(x, { className: "alea-arrow alea-tooltip-arrow", children: /* @__PURE__ */ a("svg", { width: 8, height: 8, viewBox: "0 0 8 8", children: /* @__PURE__ */ a("path", { d: "M0 0 L4 4 L8 0" }) }) }),
33
+ e && /* @__PURE__ */ a("span", { className: "alea-tooltip-title", children: e }),
34
+ /* @__PURE__ */ p("span", { className: "alea-tooltip-text", children: [
35
+ d,
36
+ o && /* @__PURE__ */ a("kbd", { className: "alea-tooltip-kbd", children: o })
37
+ ] })
38
+ ] });
39
+ }
40
+ function aa({ delay: d = 600, closeDelay: e = 200, ...o }) {
41
+ return /* @__PURE__ */ a(S, { ...o, delay: d, closeDelay: e });
42
+ }
43
+ const R = g(function({ title: e, description: o, children: l, footer: r, hideClose: i, className: s, ...t }, n) {
44
+ const m = N();
45
+ return /* @__PURE__ */ a(P, { ...t, ref: n, className: B("alea-dialog", s), children: ({ close: c }) => /* @__PURE__ */ p(u, { children: [
46
+ (e || !i) && /* @__PURE__ */ p("div", { className: "alea-dialog-head", children: [
47
+ e && /* @__PURE__ */ a(T, { slot: "title", className: "alea-dialog-title", children: e }),
48
+ !i && /* @__PURE__ */ a(H, { "aria-label": m.close, size: "sm", variant: "ghost", onPress: c, className: "alea-dialog-x", children: /* @__PURE__ */ a(b, {}) })
49
+ ] }),
50
+ o && /* @__PURE__ */ a("p", { className: "alea-dialog-description", children: o }),
51
+ l && /* @__PURE__ */ a("div", { className: "alea-dialog-body", children: typeof l == "function" ? l({ close: c }) : l }),
52
+ r && /* @__PURE__ */ a("div", { className: "alea-dialog-footer", children: typeof r == "function" ? r({ close: c }) : r })
53
+ ] }) });
54
+ });
55
+ function V({ children: d, size: e = "md", fullscreenBelow: o, className: l, isDismissable: r = !0, motion: i, surface: s, radius: t, ...n }) {
56
+ return /* @__PURE__ */ a(j, { ...n, isDismissable: r, className: f("alea-modal-overlay", l), "data-fullscreen-below": o, children: /* @__PURE__ */ a(k, { className: "alea-modal", "data-size": e, "data-fullscreen-below": o, ...M({ surface: s, radius: t }), style: v(void 0, i), children: d }) });
57
+ }
58
+ const ea = g(function({ motion: e, title: o, children: l, confirmLabel: r, cancelLabel: i, tone: s, onConfirm: t, isOpen: n, defaultOpen: m, onOpenChange: c, className: h, style: z }, $) {
59
+ const A = I("AlertDialog", "tone", s, { default: "neutral" }) ?? "neutral", y = N();
60
+ return r ?? (r = y.confirm), i ?? (i = y.cancel), /* @__PURE__ */ a(V, { isOpen: n, defaultOpen: m, onOpenChange: c, isDismissable: !1, size: "sm", motion: e, children: /* @__PURE__ */ a(R, { ref: $, className: h, style: z, role: "alertdialog", title: o, hideClose: !0, footer: ({ close: D }) => /* @__PURE__ */ p(u, { children: [
61
+ /* @__PURE__ */ a(w, { variant: "ghost", onPress: D, children: i }),
62
+ /* @__PURE__ */ a(w, { variant: A === "danger" ? "danger" : "primary", autoFocus: !0, onPress: async () => {
63
+ await (t == null ? void 0 : t()), D();
64
+ }, children: r })
65
+ ] }), children: l }) });
66
+ });
67
+ export {
68
+ ea as AlertDialog,
69
+ R as Dialog,
70
+ V as DialogModal,
71
+ ra as DialogTrigger,
72
+ Z as Popover,
73
+ _ as PopoverDialog,
74
+ C as Tooltip,
75
+ aa as TooltipTrigger
76
+ };