@alea-design/ui 0.5.1 → 0.6.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 (100) hide show
  1. package/dist/components/button/Button.d.ts +3 -1
  2. package/dist/components/button/Button.js +64 -63
  3. package/dist/components/card/Card.d.ts +6 -2
  4. package/dist/components/card/Card.js +20 -20
  5. package/dist/components/combobox/Autocomplete.d.ts +4 -0
  6. package/dist/components/combobox/Autocomplete.js +89 -87
  7. package/dist/components/command/CommandPalette.d.ts +10 -0
  8. package/dist/components/command/CommandPalette.js +76 -52
  9. package/dist/components/data/Data.d.ts +6 -4
  10. package/dist/components/data/Data.js +66 -56
  11. package/dist/components/date/Date.d.ts +16 -2
  12. package/dist/components/date/Date.js +80 -69
  13. package/dist/components/display/Display.d.ts +3 -1
  14. package/dist/components/display/Display.js +27 -27
  15. package/dist/components/display/Display2.d.ts +2 -2
  16. package/dist/components/display/Display2.js +28 -27
  17. package/dist/components/feedback/Feedback.d.ts +3 -1
  18. package/dist/components/feedback/Feedback.js +102 -102
  19. package/dist/components/feedback/PageSkeleton.d.ts +19 -0
  20. package/dist/components/feedback/PageSkeleton.js +58 -0
  21. package/dist/components/field/Field.d.ts +3 -1
  22. package/dist/components/field/Field.js +82 -82
  23. package/dist/components/filter/FilterBar.d.ts +5 -2
  24. package/dist/components/filter/FilterBar.js +97 -66
  25. package/dist/components/form/Form.d.ts +8 -2
  26. package/dist/components/form/Form.js +53 -40
  27. package/dist/components/icon/icon-names.d.ts +2 -2
  28. package/dist/components/icon/icon-names.js +4 -2
  29. package/dist/components/list/List.d.ts +6 -2
  30. package/dist/components/list/List.js +65 -62
  31. package/dist/components/list/Lists2.d.ts +4 -0
  32. package/dist/components/list/Lists2.js +35 -35
  33. package/dist/components/media/Media.js +27 -27
  34. package/dist/components/more/More.d.ts +2 -2
  35. package/dist/components/more/More.js +46 -45
  36. package/dist/components/navigation/Navigation.d.ts +7 -5
  37. package/dist/components/navigation/Navigation.js +91 -74
  38. package/dist/components/navigation/Navigation2.d.ts +9 -3
  39. package/dist/components/navigation/Navigation2.js +209 -195
  40. package/dist/components/notification/NotificationCenter.js +70 -70
  41. package/dist/components/overlay/Drawer.d.ts +6 -1
  42. package/dist/components/overlay/Drawer.js +27 -25
  43. package/dist/components/overlay/Modal.d.ts +5 -0
  44. package/dist/components/overlay/Modal.js +16 -15
  45. package/dist/components/overlay/Overlay.d.ts +10 -1
  46. package/dist/components/overlay/Overlay.js +54 -52
  47. package/dist/components/overlay/Sheet.d.ts +2 -0
  48. package/dist/components/overlay/Sheet.js +30 -30
  49. package/dist/components/page/PageParts.js +20 -20
  50. package/dist/components/select/Select.js +75 -70
  51. package/dist/components/settings/Settings.d.ts +29 -0
  52. package/dist/components/settings/Settings.js +31 -0
  53. package/dist/components/shell/AccountMenu.d.ts +20 -0
  54. package/dist/components/shell/AccountMenu.js +32 -0
  55. package/dist/components/shell/AppShell.d.ts +9 -2
  56. package/dist/components/shell/AppShell.js +37 -37
  57. package/dist/components/shell/AppSidebar.d.ts +9 -3
  58. package/dist/components/shell/AppSidebar.js +45 -39
  59. package/dist/components/table/Table.d.ts +18 -4
  60. package/dist/components/table/Table.js +70 -46
  61. package/dist/components/tabs/Tabs.js +105 -94
  62. package/dist/components/theme/Theme.d.ts +7 -4
  63. package/dist/components/theme/Theme.js +127 -130
  64. package/dist/components/upload/Upload.js +62 -54
  65. package/dist/css/base.css +1 -1
  66. package/dist/css/button.css +1 -1
  67. package/dist/css/card.css +1 -1
  68. package/dist/css/command.css +1 -1
  69. package/dist/css/date.css +1 -1
  70. package/dist/css/display.css +1 -1
  71. package/dist/css/feedback.css +1 -1
  72. package/dist/css/field.css +1 -1
  73. package/dist/css/form.css +1 -1
  74. package/dist/css/groups.json +36 -20
  75. package/dist/css/list.css +1 -1
  76. package/dist/css/menu.css +1 -1
  77. package/dist/css/navigation.css +1 -1
  78. package/dist/css/notification.css +1 -1
  79. package/dist/css/overlay.css +1 -1
  80. package/dist/css/page.css +1 -1
  81. package/dist/css/select.css +1 -1
  82. package/dist/css/settings.css +1 -0
  83. package/dist/css/shell.css +1 -1
  84. package/dist/css/table.css +1 -1
  85. package/dist/css/tabs.css +1 -1
  86. package/dist/css/upload.css +1 -1
  87. package/dist/i18n/strings.d.ts +7 -0
  88. package/dist/i18n/strings.js +14 -0
  89. package/dist/index.d.ts +4 -0
  90. package/dist/index.js +318 -306
  91. package/dist/styles.css +1 -1
  92. package/dist/utils/animateRows.d.ts +11 -0
  93. package/dist/utils/animateRows.js +23 -0
  94. package/dist/utils/decimal.d.ts +12 -0
  95. package/dist/utils/decimal.js +48 -0
  96. package/dist/utils/initialFocus.d.ts +6 -0
  97. package/dist/utils/initialFocus.js +24 -0
  98. package/dist/utils/refs.d.ts +2 -0
  99. package/dist/utils/refs.js +14 -6
  100. package/package.json +3 -3
@@ -1,33 +1,33 @@
1
1
  "use client";
2
- import { jsxs as c, jsx as a, Fragment as ue } from "react/jsx-runtime";
3
- import { useId as fe, useState as N, useRef as S, useEffect as V, useMemo as he, useLayoutEffect as me, useCallback as pe, useSyncExternalStore as we } from "react";
4
- import { useLocale as Ne, DialogTrigger as xe, Dialog as ye, Heading as ve } from "react-aria-components";
5
- import { Bell as U, CheckCheck as ge, X, CircleAlert as Se, TriangleAlert as be, CircleCheck as Ie, Info as Te, Check as Ee } from "lucide-react";
6
- import { Presence as ke, Reveal as ze } from "@alea-design/motion";
7
- import { cx as De } from "../../utils/cx.js";
8
- import { useStrings as Le } from "../../i18n/strings.js";
9
- import { IconButton as b, Button as _ } from "../button/Button.js";
10
- import { Badge as J } from "../display/Display.js";
11
- import { EmptyState as Pe } from "../data/Data.js";
2
+ import { jsxs as c, jsx as a, Fragment as de } from "react/jsx-runtime";
3
+ import { useId as ue, useState as N, useRef as v, useEffect as Q, useMemo as fe, useLayoutEffect as me, useCallback as he, useSyncExternalStore as pe } from "react";
4
+ import { useLocale as we, DialogTrigger as Ne, Dialog as xe, Heading as ye } from "react-aria-components";
5
+ import { Bell as U, CheckCheck as ge, X, CircleAlert as ve, TriangleAlert as Se, CircleCheck as be, Info as Ie, Check as Te } from "lucide-react";
6
+ import { Presence as Ee, Reveal as ke } from "@alea-design/motion";
7
+ import { cx as ze } from "../../utils/cx.js";
8
+ import { useStrings as De } from "../../i18n/strings.js";
9
+ import { IconButton as S, Button as _ } from "../button/Button.js";
10
+ import { CountBadge as Le, Badge as Pe } from "../display/Display.js";
11
+ import { EmptyState as Me } from "../data/Data.js";
12
12
  import { Popover as $e } from "../overlay/Overlay.js";
13
- import { Drawer as Me } from "../overlay/Drawer.js";
14
- const Ae = { info: Te, success: Ie, warning: be, danger: Se }, Q = "(max-width: 639.98px)";
13
+ import { Drawer as Ae } from "../overlay/Drawer.js";
14
+ const Be = { info: Ie, success: be, warning: Se, danger: ve }, J = "(max-width: 639.98px)";
15
15
  function Fe() {
16
- const r = pe((d) => {
16
+ const r = he((d) => {
17
17
  var s;
18
18
  if (typeof window > "u" || !window.matchMedia) return () => {
19
19
  };
20
- const o = window.matchMedia(Q);
20
+ const o = window.matchMedia(J);
21
21
  return (s = o.addEventListener) == null || s.call(o, "change", d), () => {
22
22
  var l;
23
23
  return (l = o.removeEventListener) == null ? void 0 : l.call(o, "change", d);
24
24
  };
25
25
  }, []);
26
- return we(r, () => typeof window < "u" && window.matchMedia ? window.matchMedia(Q).matches : !1, () => !1);
26
+ return pe(r, () => typeof window < "u" && window.matchMedia ? window.matchMedia(J).matches : !1, () => !1);
27
27
  }
28
- function Be(r, d = 3e4) {
28
+ function Ce(r, d = 3e4) {
29
29
  const [o, s] = N(() => Date.now());
30
- return V(() => {
30
+ return Q(() => {
31
31
  if (!r) return;
32
32
  s(Date.now());
33
33
  const l = window.setInterval(() => s(Date.now()), d);
@@ -35,29 +35,29 @@ function Be(r, d = 3e4) {
35
35
  }, [r, d]), o;
36
36
  }
37
37
  function Oe(r, d, o) {
38
- const s = Math.round((r.getTime() - d) / 1e3), l = Math.abs(s), h = new Intl.RelativeTimeFormat(o, { numeric: "auto" });
39
- return l < 45 ? h.format(0, "second") : l < 3600 ? h.format(Math.round(s / 60), "minute") : l < 86400 ? h.format(Math.round(s / 3600), "hour") : h.format(Math.round(s / 86400), "day");
38
+ const s = Math.round((r.getTime() - d) / 1e3), l = Math.abs(s), m = new Intl.RelativeTimeFormat(o, { numeric: "auto" });
39
+ return l < 45 ? m.format(0, "second") : l < 3600 ? m.format(Math.round(s / 60), "minute") : l < 86400 ? m.format(Math.round(s / 3600), "hour") : m.format(Math.round(s / 86400), "day");
40
40
  }
41
- function We({
41
+ function Ye({
42
42
  items: r,
43
43
  onChange: d,
44
44
  onMarkRead: o,
45
45
  onMarkAllRead: s,
46
46
  onDismiss: l,
47
- onAction: h,
47
+ onAction: m,
48
48
  labels: x,
49
49
  presentation: k = "auto",
50
- placement: W = "bottom end",
50
+ placement: V = "bottom end",
51
51
  isOpen: z,
52
- defaultOpen: Y,
53
- onOpenChange: I,
54
- max: y = 99,
55
- announce: Z = !0,
52
+ defaultOpen: W,
53
+ onOpenChange: b,
54
+ max: I = 99,
55
+ announce: Y = !0,
56
56
  motion: D,
57
- className: q
57
+ className: Z
58
58
  }) {
59
59
  var K;
60
- const u = Le(), { locale: L } = Ne(), f = {
60
+ const u = De(), { locale: L } = we(), f = {
61
61
  title: u.notifications,
62
62
  bell: u.notificationBell,
63
63
  markRead: u.markRead,
@@ -69,23 +69,23 @@ function We({
69
69
  unread: u.unreadNotification,
70
70
  ...x,
71
71
  tones: { ...u.notificationTones, ...x == null ? void 0 : x.tones }
72
- }, P = fe(), ee = Fe(), $ = k === "drawer" || k === "auto" && ee, [te, ne] = N(Y ?? !1), M = z ?? te, ae = (t) => {
73
- z === void 0 && ne(t), I == null || I(t);
74
- }, re = Be(M), m = r.filter((t) => !t.read).length, A = S(null), [ie, F] = N({ text: "", n: 0 });
75
- V(() => {
72
+ }, P = ue(), q = Fe(), M = k === "drawer" || k === "auto" && q, [ee, te] = N(W ?? !1), $ = z ?? ee, ne = (t) => {
73
+ z === void 0 && te(t), b == null || b(t);
74
+ }, ae = Ce($), p = r.filter((t) => !t.read).length, A = v(null), [re, B] = N({ text: "", n: 0 });
75
+ Q(() => {
76
76
  const t = A.current;
77
- if (A.current = new Set(r.map((i) => i.id)), !t || !Z) return;
77
+ if (A.current = new Set(r.map((i) => i.id)), !t || !Y) return;
78
78
  const e = r.filter((i) => !i.read && !t.has(i.id));
79
79
  if (!e.length) return;
80
- F((i) => ({ text: e.map((p) => f.newNotification(p.title)).join(". "), n: i.n + 1 }));
81
- const n = window.setTimeout(() => F((i) => ({ ...i, text: "" })), 6e3);
80
+ B((i) => ({ text: e.map((h) => f.newNotification(h.title)).join(". "), n: i.n + 1 }));
81
+ const n = window.setTimeout(() => B((i) => ({ ...i, text: "" })), 6e3);
82
82
  return () => window.clearTimeout(n);
83
83
  }, [r]);
84
- const [B, O] = N([]), C = he(() => {
84
+ const [F, C] = N([]), O = fe(() => {
85
85
  const t = r.map((n) => ({ item: n, leaving: !1 })), e = new Set(r.map((n) => n.id));
86
- for (const n of B) e.has(n.item.id) || t.splice(Math.min(n.index, t.length), 0, { item: n.item, leaving: !0 });
86
+ for (const n of F) e.has(n.item.id) || t.splice(Math.min(n.index, t.length), 0, { item: n.item, leaving: !0 });
87
87
  return t;
88
- }, [r, B]), T = S(null), H = S(null), [R, v] = N(null), oe = r.some((t) => t.id === R) ? R : ((K = r[0]) == null ? void 0 : K.id) ?? null, g = S(null);
88
+ }, [r, F]), T = v(null), H = v(null), [R, y] = N(null), ie = r.some((t) => t.id === R) ? R : ((K = r[0]) == null ? void 0 : K.id) ?? null, g = v(null);
89
89
  me(() => {
90
90
  var n;
91
91
  const t = g.current;
@@ -94,35 +94,35 @@ function We({
94
94
  e && (g.current = null, e.focus());
95
95
  });
96
96
  const E = (t) => d == null ? void 0 : d(t), j = (t) => {
97
- g.current = t.id, v(t.id), o == null || o(t), E(r.map((e) => e.id === t.id ? { ...e, read: !0 } : e));
98
- }, se = () => {
97
+ g.current = t.id, y(t.id), o == null || o(t), E(r.map((e) => e.id === t.id ? { ...e, read: !0 } : e));
98
+ }, oe = () => {
99
99
  const t = r.filter((e) => !e.read);
100
100
  t.length && (s == null || s(t), E(r.map((e) => e.read ? e : { ...e, read: !0 })));
101
- }, le = (t) => {
101
+ }, se = (t) => {
102
102
  const e = r.findIndex((i) => i.id === t.id), n = r[e + 1] ?? r[e - 1];
103
- g.current = n ? n.id : "empty", n && v(n.id), O((i) => [...i, { item: t, index: e }]), window.setTimeout(() => O((i) => i.filter((p) => p.item.id !== t.id)), 400), l == null || l(t), E(r.filter((i) => i.id !== t.id));
104
- }, ce = (t) => {
103
+ g.current = n ? n.id : "empty", n && y(n.id), C((i) => [...i, { item: t, index: e }]), window.setTimeout(() => C((i) => i.filter((h) => h.item.id !== t.id)), 400), l == null || l(t), E(r.filter((i) => i.id !== t.id));
104
+ }, le = (t) => {
105
105
  var e, n;
106
- (n = (e = t.action) == null ? void 0 : e.onPress) == null || n.call(e), h == null || h(t), t.read || j(t);
107
- }, de = (t) => {
108
- var p;
106
+ (n = (e = t.action) == null ? void 0 : e.onPress) == null || n.call(e), m == null || m(t), t.read || j(t);
107
+ }, ce = (t) => {
108
+ var h;
109
109
  if (!["ArrowDown", "ArrowUp", "Home", "End"].includes(t.key)) return;
110
- const e = [...((p = T.current) == null ? void 0 : p.querySelectorAll("[data-nid]:not([data-leaving])")) ?? []];
110
+ const e = [...((h = T.current) == null ? void 0 : h.querySelectorAll("[data-nid]:not([data-leaving])")) ?? []];
111
111
  if (!e.length) return;
112
112
  const n = e.findIndex((w) => w.contains(t.target)), i = t.key === "Home" ? 0 : t.key === "End" ? e.length - 1 : t.key === "ArrowDown" ? Math.min(n + 1, e.length - 1) : Math.max(n - 1, 0);
113
- t.preventDefault(), v(e[i].dataset.nid ?? null), e[i].focus();
114
- }, G = /* @__PURE__ */ a(ye, { className: "alea-notifs", "aria-labelledby": P, children: ({ close: t }) => /* @__PURE__ */ c(ue, { children: [
113
+ t.preventDefault(), y(e[i].dataset.nid ?? null), e[i].focus();
114
+ }, G = /* @__PURE__ */ a(xe, { className: "alea-notifs", "aria-labelledby": P, children: ({ close: t }) => /* @__PURE__ */ c(de, { children: [
115
115
  /* @__PURE__ */ c("div", { className: "alea-notifs-head", children: [
116
- /* @__PURE__ */ c(ve, { slot: "title", id: P, className: "alea-notifs-title", children: [
116
+ /* @__PURE__ */ c(ye, { slot: "title", id: P, className: "alea-notifs-title", children: [
117
117
  f.title,
118
- m > 0 && /* @__PURE__ */ a(J, { tone: "accent", size: "sm", "aria-hidden": "true", children: m > y ? `${y}+` : m })
118
+ p > 0 && /* @__PURE__ */ a(Pe, { tone: "accent", size: "sm", "aria-hidden": "true", children: p > I ? `${I}+` : p })
119
119
  ] }),
120
- /* @__PURE__ */ a(_, { variant: "text", size: "xs", iconStart: /* @__PURE__ */ a(ge, {}), isDisabled: m === 0, onPress: se, children: f.markAllRead }),
121
- $ && /* @__PURE__ */ a(b, { "aria-label": u.close, size: "xs", onPress: t, children: /* @__PURE__ */ a(X, {}) })
120
+ /* @__PURE__ */ a(_, { variant: "text", size: "xs", iconStart: /* @__PURE__ */ a(ge, {}), isDisabled: p === 0, onPress: oe, children: f.markAllRead }),
121
+ M && /* @__PURE__ */ a(S, { "aria-label": u.close, size: "xs", onPress: t, children: /* @__PURE__ */ a(X, {}) })
122
122
  ] }),
123
- C.length === 0 ? /* @__PURE__ */ a("div", { className: "alea-notifs-empty", ref: H, tabIndex: -1, children: /* @__PURE__ */ a(Pe, { size: "sm", title: f.emptyTitle, description: f.emptyDescription, icon: /* @__PURE__ */ a(U, {}) }) }) : /* @__PURE__ */ a("ul", { className: "alea-notifs-list", ref: T, onKeyDown: de, children: C.map(({ item: e, leaving: n }, i) => {
124
- const p = Ae[e.tone], w = !n && e.id === oe;
125
- return /* @__PURE__ */ a(ke, { show: !n, exitClassName: "alea-notif-out", children: /* @__PURE__ */ a(
123
+ O.length === 0 ? /* @__PURE__ */ a("div", { className: "alea-notifs-empty", ref: H, tabIndex: -1, children: /* @__PURE__ */ a(Me, { size: "sm", title: f.emptyTitle, description: f.emptyDescription, icon: /* @__PURE__ */ a(U, {}) }) }) : /* @__PURE__ */ a("ul", { className: "alea-notifs-list", ref: T, onKeyDown: ce, children: O.map(({ item: e, leaving: n }, i) => {
124
+ const h = Be[e.tone], w = !n && e.id === ie;
125
+ return /* @__PURE__ */ a(Ee, { show: !n, exitClassName: "alea-notif-out", children: /* @__PURE__ */ a(
126
126
  "li",
127
127
  {
128
128
  className: "alea-notif",
@@ -131,9 +131,9 @@ function We({
131
131
  "data-unread": e.read ? void 0 : !0,
132
132
  "data-leaving": n || void 0,
133
133
  tabIndex: w ? 0 : -1,
134
- onFocus: () => !n && v(e.id),
135
- children: /* @__PURE__ */ c(ze, { className: "alea-notif-inner", motion: "rise", delay: Math.min(i, 6) * 30, children: [
136
- /* @__PURE__ */ a("span", { className: "alea-notif-icon", "aria-hidden": "true", children: /* @__PURE__ */ a(p, {}) }),
134
+ onFocus: () => !n && y(e.id),
135
+ children: /* @__PURE__ */ c(ke, { className: "alea-notif-inner", motion: "rise", delay: Math.min(i, 6) * 30, children: [
136
+ /* @__PURE__ */ a("span", { className: "alea-notif-icon", "aria-hidden": "true", children: /* @__PURE__ */ a(h, {}) }),
137
137
  /* @__PURE__ */ c("div", { className: "alea-notif-body", children: [
138
138
  /* @__PURE__ */ c("p", { className: "alea-notif-title", children: [
139
139
  /* @__PURE__ */ c("span", { className: "alea-visually-hidden", children: [
@@ -145,7 +145,7 @@ function We({
145
145
  ] }),
146
146
  e.description && /* @__PURE__ */ a("p", { className: "alea-notif-text", children: e.description }),
147
147
  /* @__PURE__ */ c("p", { className: "alea-notif-meta", children: [
148
- /* @__PURE__ */ a("time", { dateTime: e.time.toISOString(), title: e.time.toLocaleString(L), children: Oe(e.time, re, L) }),
148
+ /* @__PURE__ */ a("time", { dateTime: e.time.toISOString(), title: e.time.toLocaleString(L), children: Oe(e.time, ae, L) }),
149
149
  e.action && /* @__PURE__ */ a(
150
150
  _,
151
151
  {
@@ -154,32 +154,32 @@ function We({
154
154
  href: e.action.href,
155
155
  excludeFromTabOrder: !w,
156
156
  className: "alea-notif-action",
157
- onPress: () => ce(e),
157
+ onPress: () => le(e),
158
158
  children: e.action.label
159
159
  }
160
160
  )
161
161
  ] })
162
162
  ] }),
163
163
  /* @__PURE__ */ c("div", { className: "alea-notif-tools", children: [
164
- !e.read && /* @__PURE__ */ a(b, { "aria-label": `${f.markRead}: ${e.title}`, size: "xs", excludeFromTabOrder: !w, onPress: () => j(e), children: /* @__PURE__ */ a(Ee, {}) }),
165
- /* @__PURE__ */ a(b, { "aria-label": `${f.dismiss}: ${e.title}`, size: "xs", excludeFromTabOrder: !w, onPress: () => le(e), children: /* @__PURE__ */ a(X, {}) })
164
+ !e.read && /* @__PURE__ */ a(S, { "aria-label": `${f.markRead}: ${e.title}`, size: "xs", excludeFromTabOrder: !w, onPress: () => j(e), children: /* @__PURE__ */ a(Te, {}) }),
165
+ /* @__PURE__ */ a(S, { "aria-label": `${f.dismiss}: ${e.title}`, size: "xs", excludeFromTabOrder: !w, onPress: () => se(e), children: /* @__PURE__ */ a(X, {}) })
166
166
  ] })
167
167
  ] })
168
168
  }
169
169
  ) }, e.id);
170
170
  }) })
171
171
  ] }) });
172
- return /* @__PURE__ */ c("span", { className: De("alea-notifs-root", q), children: [
173
- /* @__PURE__ */ c(xe, { isOpen: M, onOpenChange: ae, children: [
172
+ return /* @__PURE__ */ c("span", { className: ze("alea-notifs-root", Z), children: [
173
+ /* @__PURE__ */ c(Ne, { isOpen: $, onOpenChange: ne, children: [
174
174
  /* @__PURE__ */ c("span", { className: "alea-notifs-bell", children: [
175
- /* @__PURE__ */ a(b, { "aria-label": f.bell(m), variant: "ghost", children: /* @__PURE__ */ a(U, {}) }),
176
- m > 0 && /* @__PURE__ */ a(J, { className: "alea-notifs-count", tone: "danger", appearance: "solid", size: "sm", "aria-hidden": "true", children: m > y ? `${y}+` : m })
175
+ /* @__PURE__ */ a(S, { "aria-label": f.bell(p), variant: "ghost", children: /* @__PURE__ */ a(U, {}) }),
176
+ /* @__PURE__ */ a(Le, { className: "alea-notifs-count", count: p, max: I, tone: "danger", size: "sm", "aria-hidden": "true" })
177
177
  ] }),
178
- $ ? /* @__PURE__ */ a(Me, { placement: "bottom", size: 640, motion: D, className: "alea-notifs-drawer", children: G }) : /* @__PURE__ */ a($e, { placement: W, size: "lg", motion: D, className: "alea-notifs-popover", children: G })
178
+ M ? /* @__PURE__ */ a(Ae, { placement: "bottom", size: 640, motion: D, className: "alea-notifs-drawer", children: G }) : /* @__PURE__ */ a($e, { placement: V, size: "lg", motion: D, className: "alea-notifs-popover", children: G })
179
179
  ] }),
180
- /* @__PURE__ */ a("span", { className: "alea-visually-hidden", role: "status", "aria-live": "polite", "aria-atomic": "true", children: ie.text })
180
+ /* @__PURE__ */ a("span", { className: "alea-visually-hidden", role: "status", "aria-live": "polite", "aria-atomic": "true", children: re.text })
181
181
  ] });
182
182
  }
183
183
  export {
184
- We as NotificationCenter
184
+ Ye as NotificationCenter
185
185
  };
@@ -3,6 +3,7 @@ import { DialogTrigger, type ModalOverlayProps } from 'react-aria-components';
3
3
  import { type MotionProp } from '@alea-design/motion';
4
4
  import { type DialogProps, type PopoverProps } from './Overlay.js';
5
5
  import { type SurfaceProps } from '../surface/Surface.js';
6
+ import { type InitialFocus } from '../../utils/initialFocus.js';
6
7
  export interface DrawerProps extends Omit<ModalOverlayProps, 'children'>, Pick<SurfaceProps, 'surface'> {
7
8
  children: ReactNode;
8
9
  /** Side it slides in from. Default end (right in left-to-right). */
@@ -11,9 +12,13 @@ export interface DrawerProps extends Omit<ModalOverlayProps, 'children'>, Pick<S
11
12
  size?: number | string;
12
13
  /** How it enters and leaves (default: from its edge): a preset, false, or options. */
13
14
  motion?: MotionProp;
15
+ /** What is behind it: blur (dim and blur, default) or dim (only the dark layer, no backdrop-filter). */
16
+ backdrop?: 'blur' | 'dim';
17
+ /** Where focus goes when it opens: dialog (default, the dialog itself), first-field (the first input, picker or date field) or a CSS selector for the control inside it. */
18
+ initialFocus?: InitialFocus;
14
19
  }
15
20
  /** A panel that slides in from the side: filters, details, navigation on mobile. Focus is trapped, Escape closes. */
16
- export declare function Drawer({ children, placement, size, className, isDismissable, motion, surface, ...props }: DrawerProps): import("react").JSX.Element;
21
+ export declare function Drawer({ children, placement, size, className, isDismissable, motion, backdrop, initialFocus, surface, ...props }: DrawerProps): import("react").JSX.Element;
17
22
  /** The content of a Drawer: title, body and footer, like Dialog. */
18
23
  export declare function DrawerContent(props: DialogProps): import("react").JSX.Element;
19
24
  export { DialogTrigger as DrawerTrigger };
@@ -1,39 +1,41 @@
1
1
  "use client";
2
- import { jsx as r, jsxs as s, Fragment as y } from "react/jsx-runtime";
2
+ import { jsx as r, jsxs as d, Fragment as y } from "react/jsx-runtime";
3
3
  import { forwardRef as x } from "react";
4
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 }) });
5
+ import { DialogTrigger as Y } from "react-aria-components";
6
+ import { withMotionStyle as F } from "@alea-design/motion";
7
+ import { withBase as M, cx as T } from "../../utils/cx.js";
8
+ import { Button as g } from "../button/Button.js";
9
+ import { Dialog as j, Popover as A, PopoverDialog as B } from "./Overlay.js";
10
+ import { useStrings as R } from "../../i18n/strings.js";
11
+ import { renamedValue as S } from "../../utils/vocabulary.js";
12
+ import { surfaceAttrs as k } from "../surface/Surface.js";
13
+ import { useInitialFocus as z } from "../../utils/initialFocus.js";
14
+ function K({ children: o, placement: a = "end", size: e = 420, className: l, isDismissable: t = !0, motion: n, backdrop: i, initialFocus: m, surface: s, ...c }) {
15
+ const p = z(m);
16
+ return /* @__PURE__ */ r(D, { ...c, isDismissable: t, className: M("alea-modal-overlay alea-drawer-overlay", l), "data-placement": a, "data-backdrop": i, children: /* @__PURE__ */ r(P, { ref: p, className: "alea-drawer", "data-placement": a, ...k({ surface: s }), style: F({ "--alea-drawer-size": typeof e == "number" ? `${e}px` : e }, n), children: o }) });
15
17
  }
16
- function K(a) {
17
- return /* @__PURE__ */ r(A, { ...a, className: "alea-drawer-content" });
18
+ function Q(o) {
19
+ return /* @__PURE__ */ r(j, { ...o, className: "alea-drawer-content" });
18
20
  }
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: [
21
+ const U = x(function({ motion: a, children: e, title: l, description: t, confirmLabel: n, cancelLabel: i, tone: m, onConfirm: s, placement: c = "top", className: p, style: h }, w) {
22
+ const v = S("Popconfirm", "tone", m, { default: "neutral" }) ?? "neutral", f = R();
23
+ return n ?? (n = f.yes), i ?? (i = f.cancel), /* @__PURE__ */ d(N, { children: [
22
24
  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: [
25
+ /* @__PURE__ */ r(A, { showArrow: !0, placement: c, motion: a, children: /* @__PURE__ */ r(B, { ref: w, style: h, role: "alertdialog", title: l, className: T("alea-popover-dialog alea-popconfirm", p), children: ({ close: u }) => /* @__PURE__ */ d(y, { children: [
24
26
  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();
27
+ /* @__PURE__ */ d("div", { className: "alea-popconfirm-actions", children: [
28
+ /* @__PURE__ */ r(g, { size: "sm", variant: "ghost", onPress: u, children: i }),
29
+ /* @__PURE__ */ r(g, { size: "sm", variant: v === "danger" ? "danger" : "primary", autoFocus: !0, onPress: async () => {
30
+ await s(), u();
29
31
  }, children: n })
30
32
  ] })
31
33
  ] }) }) })
32
34
  ] });
33
35
  });
34
36
  export {
35
- J as Drawer,
36
- K as DrawerContent,
37
- X as DrawerTrigger,
38
- Q as Popconfirm
37
+ K as Drawer,
38
+ Q as DrawerContent,
39
+ Y as DrawerTrigger,
40
+ U as Popconfirm
39
41
  };
@@ -2,6 +2,7 @@ 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
4
  import { type SurfaceProps } from '../surface/Surface.js';
5
+ import { type InitialFocus } from '../../utils/initialFocus.js';
5
6
  type Render = ReactNode | ((opts: {
6
7
  close: () => void;
7
8
  }) => ReactNode);
@@ -22,6 +23,8 @@ export interface ModalProps extends Omit<ModalOverlayProps, 'children' | 'classN
22
23
  footer?: Render;
23
24
  /** xs 320, sm 400, md 560 (default), lg 760, xl 960, full (the whole window less a margin), or auto (as wide as its content). */
24
25
  size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'full' | 'auto';
26
+ /** Size of the title: md (24 px display, default) or sm (16 px, semibold) for compact dialogs, forms and settings. */
27
+ titleSize?: 'sm' | 'md';
25
28
  /** center (default) or top (stays put while its content grows, good for search and long forms). */
26
29
  placement?: 'center' | 'top';
27
30
  /** inside: the header and footer stay, the body scrolls (default). outside: the whole modal scrolls with the page, for long reading. */
@@ -36,6 +39,8 @@ export interface ModalProps extends Omit<ModalOverlayProps, 'children' | 'classN
36
39
  fullscreenBelow?: 'sm' | 'md';
37
40
  /** How it enters and leaves (default rise): a preset, false, or options. */
38
41
  motion?: MotionProp;
42
+ /** Where focus goes when it opens: dialog (default, the dialog itself, so its title is read first), first-field (the first input, picker or date field in the body) or a CSS selector for the control inside it. */
43
+ initialFocus?: InitialFocus;
39
44
  /** Extra class names for the modal surface. */
40
45
  className?: string;
41
46
  }
@@ -1,27 +1,28 @@
1
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";
2
+ import { jsx as a, jsxs as i, Fragment as X } from "react/jsx-runtime";
3
+ import { forwardRef as $ } from "react";
4
+ import { ModalOverlay as q, Modal as E, Dialog as G, Heading as J, DialogTrigger as K } from "react-aria-components";
5
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";
6
+ import { withMotionStyle as L } from "@alea-design/motion";
7
+ import { cx as Q } from "../../utils/cx.js";
8
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: [
9
+ import { useStrings as U } from "../../i18n/strings.js";
10
+ import { surfaceAttrs as V } from "../surface/Surface.js";
11
+ import { useInitialFocus as W } from "../../utils/initialFocus.js";
12
+ const b = (l, e) => typeof l == "function" ? l({ close: e }) : l, ra = $(function({ children: e, trigger: r, title: d, "aria-label": g, header: m, footer: s, size: y = "md", titleSize: M = "md", placement: z = "center", scrollBehavior: t = "inside", padding: j = "normal", backdrop: w = "dim", showClose: c = !0, fullscreenBelow: n, motion: D, initialFocus: F, className: I, isDismissable: P = !0, isOpen: f, defaultOpen: u, onOpenChange: x, style: R, surface: S, radius: k, ...A }, H) {
13
+ const p = U(), T = W(F), h = /* @__PURE__ */ a(q, { ...A, ...r ? {} : { isOpen: f, defaultOpen: u, onOpenChange: x }, isDismissable: P, className: "alea-modal-overlay alea-xmodal-overlay", "data-placement": z, "data-scroll": t, "data-backdrop": w, "data-fullscreen-below": n, children: /* @__PURE__ */ a(E, { ref: T, className: "alea-modal alea-xmodal", ...V({ surface: S, radius: k }), "data-size": y, "data-scroll": t, "data-fullscreen-below": n, style: L(void 0, D), children: /* @__PURE__ */ a(G, { ref: H, "aria-modal": "true", "aria-label": d ? void 0 : g, className: Q("alea-xmodal-dialog", I), style: R, "data-padding": j, children: ({ close: o }) => /* @__PURE__ */ i(X, { children: [
13
14
  m || d ? /* @__PURE__ */ i("div", { className: "alea-xmodal-head", children: [
14
- m ?? /* @__PURE__ */ a(q, { slot: "title", className: "alea-dialog-title", children: d }),
15
+ m ?? /* @__PURE__ */ a(J, { slot: "title", className: "alea-dialog-title", "data-size": M === "sm" ? "sm" : void 0, children: d }),
15
16
  c && /* @__PURE__ */ a(N, { "aria-label": p.close, size: "sm", variant: "ghost", onPress: o, className: "alea-dialog-x", children: /* @__PURE__ */ a(v, {}) })
16
17
  ] }) : c && /* @__PURE__ */ a(N, { "aria-label": p.close, size: "sm", variant: "ghost", onPress: o, className: "alea-xmodal-x", children: /* @__PURE__ */ a(v, {}) }),
17
18
  /* @__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
+ s && /* @__PURE__ */ a("div", { className: "alea-xmodal-footer", children: b(s, o) })
19
20
  ] }) }) }) });
20
- return r ? /* @__PURE__ */ i(E, { isOpen: f, defaultOpen: x, onOpenChange: h, children: [
21
+ return r ? /* @__PURE__ */ i(K, { isOpen: f, defaultOpen: u, onOpenChange: x, children: [
21
22
  r,
22
- u
23
- ] }) : u;
23
+ h
24
+ ] }) : h;
24
25
  });
25
26
  export {
26
- O as Modal
27
+ ra as Modal
27
28
  };
@@ -2,6 +2,7 @@ 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
4
  import { type SurfaceProps } from '../surface/Surface.js';
5
+ import { type InitialFocus } from '../../utils/initialFocus.js';
5
6
  export { DialogTrigger };
6
7
  export interface PopoverProps extends Omit<RACPopoverProps, 'children'>, SurfaceProps {
7
8
  children: ReactNode;
@@ -68,9 +69,13 @@ export interface DialogModalProps extends Omit<ModalOverlayProps, 'children'>, S
68
69
  fullscreenBelow?: 'sm' | 'md';
69
70
  /** How the dialog enters and leaves (default rise): a preset, false, or options. */
70
71
  motion?: MotionProp;
72
+ /** What is behind it: blur (dim and blur, default) or dim (only the dark layer, no backdrop-filter: cheaper on big pages and phones). */
73
+ backdrop?: 'blur' | 'dim';
74
+ /** Where focus goes when it opens: dialog (default, the dialog itself), first-field (the first input, picker or date field) or a CSS selector for the control inside it. */
75
+ initialFocus?: InitialFocus;
71
76
  }
72
77
  /** 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. */
73
- export declare function DialogModal({ children, size, fullscreenBelow, className, isDismissable, motion, surface, radius, ...props }: DialogModalProps): import("react").JSX.Element;
78
+ export declare function DialogModal({ children, size, fullscreenBelow, className, isDismissable, motion, backdrop, initialFocus, surface, radius, ...props }: DialogModalProps): import("react").JSX.Element;
74
79
  export interface AlertDialogProps {
75
80
  /** The question, e.g. "Delete this file?". */
76
81
  title: ReactNode;
@@ -91,6 +96,10 @@ export interface AlertDialogProps {
91
96
  onOpenChange?: (open: boolean) => void;
92
97
  /** How the dialog enters and leaves (default rise). */
93
98
  motion?: MotionProp;
99
+ /** What is behind it: blur (default) or dim (no backdrop-filter). */
100
+ backdrop?: 'blur' | 'dim';
101
+ /** Which control has focus when it opens: confirm (default), cancel (the safe choice for a destructive action) or content (the dialog itself, so a screen reader reads the title and text first; use it when the dialog has a required field). */
102
+ initialFocus?: 'confirm' | 'cancel' | 'content';
94
103
  /** Extra class names for the dialog. */
95
104
  className?: string;
96
105
  /** Inline style for the dialog. */
@@ -1,76 +1,78 @@
1
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";
2
+ import { jsx as a, jsxs as m, Fragment as h } from "react/jsx-runtime";
3
+ import { forwardRef as g, useId as j } from "react";
4
+ import { Dialog as T, Heading as b, ModalOverlay as L, Modal as O, Popover as R, OverlayArrow as x, Button as S, Tooltip as H, TooltipTrigger as V } from "react-aria-components";
5
+ import { DialogTrigger as da } from "react-aria-components";
6
+ import { X as B } from "lucide-react";
7
+ import { withMotionStyle as f } from "@alea-design/motion";
8
+ import { cx as M, withBase as v } from "../../utils/cx.js";
9
+ import { Button as P, IconButton as X } from "../button/Button.js";
10
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: [
11
+ import { renamedValue as q } from "../../utils/vocabulary.js";
12
+ import { surfaceAttrs as z } from "../surface/Surface.js";
13
+ import { useInitialFocus as E } from "../../utils/initialFocus.js";
14
+ const la = g(function({ children: e, showArrow: o, className: l, offset: i = 8, motion: r, style: s, size: n, surface: c, radius: d, ...t }, u) {
15
+ return /* @__PURE__ */ m(R, { ...t, ref: u, offset: o ? 12 : i, "data-size": n, ...z({ surface: c, radius: d }), className: v("alea-popover", l), style: f(s, r), children: [
15
16
  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
17
  e
17
18
  ] });
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" }) })
19
+ }), ra = g(function({ title: e, description: o, footer: l, showClose: i, children: r, className: s, ...n }, c) {
20
+ const d = N();
21
+ return /* @__PURE__ */ a(T, { ...n, ref: c, className: M("alea-popover-dialog", s), children: (t) => /* @__PURE__ */ m(h, { children: [
22
+ (e || i) && /* @__PURE__ */ m("div", { className: "alea-popover-head", children: [
23
+ e && /* @__PURE__ */ a(b, { slot: "title", className: "alea-popover-title", children: e }),
24
+ i && /* @__PURE__ */ a(S, { className: "alea-popover-close alea-focus-ring", "aria-label": d.close, onPress: t.close, children: /* @__PURE__ */ a(B, { size: 16, "aria-hidden": "true" }) })
24
25
  ] }),
25
26
  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 })
27
+ typeof r == "function" ? r(t) : r,
28
+ l && /* @__PURE__ */ a("div", { className: "alea-popover-footer", children: typeof l == "function" ? l(t.close) : l })
28
29
  ] }) });
29
30
  });
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: [
31
+ function ia({ children: p, title: e, shortcut: o, hideArrow: l, className: i, offset: r = 8, motion: s, style: n, ...c }) {
32
+ return /* @__PURE__ */ m(H, { ...c, offset: r, className: v("alea-tooltip", i), "data-rich": e ? !0 : void 0, style: f(n, s), children: [
32
33
  !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
34
  e && /* @__PURE__ */ a("span", { className: "alea-tooltip-title", children: e }),
34
- /* @__PURE__ */ p("span", { className: "alea-tooltip-text", children: [
35
- d,
35
+ /* @__PURE__ */ m("span", { className: "alea-tooltip-text", children: [
36
+ p,
36
37
  o && /* @__PURE__ */ a("kbd", { className: "alea-tooltip-kbd", children: o })
37
38
  ] })
38
39
  ] });
39
40
  }
40
- function aa({ delay: d = 600, closeDelay: e = 200, ...o }) {
41
- return /* @__PURE__ */ a(S, { ...o, delay: d, closeDelay: e });
41
+ function ta({ delay: p = 600, closeDelay: e = 200, ...o }) {
42
+ return /* @__PURE__ */ a(V, { ...o, delay: p, closeDelay: e });
42
43
  }
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, {}) })
44
+ const G = g(function({ title: e, description: o, children: l, footer: i, hideClose: r, className: s, ...n }, c) {
45
+ const d = N();
46
+ return /* @__PURE__ */ a(T, { ...n, ref: c, className: M("alea-dialog", s), children: ({ close: t }) => /* @__PURE__ */ m(h, { children: [
47
+ (e || !r) && /* @__PURE__ */ m("div", { className: "alea-dialog-head", children: [
48
+ e && /* @__PURE__ */ a(b, { slot: "title", className: "alea-dialog-title", children: e }),
49
+ !r && /* @__PURE__ */ a(X, { "aria-label": d.close, size: "sm", variant: "ghost", onPress: t, className: "alea-dialog-x", children: /* @__PURE__ */ a(B, {}) })
49
50
  ] }),
50
51
  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 })
52
+ l && /* @__PURE__ */ a("div", { className: "alea-dialog-body", children: typeof l == "function" ? l({ close: t }) : l }),
53
+ i && /* @__PURE__ */ a("div", { className: "alea-dialog-footer", children: typeof i == "function" ? i({ close: t }) : i })
53
54
  ] }) });
54
55
  });
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 }) });
56
+ function J({ children: p, size: e = "md", fullscreenBelow: o, className: l, isDismissable: i = !0, motion: r, backdrop: s, initialFocus: n, surface: c, radius: d, ...t }) {
57
+ const u = E(n);
58
+ return /* @__PURE__ */ a(L, { ...t, isDismissable: i, className: v("alea-modal-overlay", l), "data-backdrop": s, "data-fullscreen-below": o, children: /* @__PURE__ */ a(O, { ref: u, className: "alea-modal", "data-size": e, "data-fullscreen-below": o, ...z({ surface: c, radius: d }), style: f(void 0, r), children: p }) });
57
59
  }
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 }) });
60
+ const sa = g(function({ motion: e, backdrop: o, initialFocus: l = "confirm", title: i, children: r, confirmLabel: s, cancelLabel: n, tone: c, onConfirm: d, isOpen: t, defaultOpen: u, onOpenChange: $, className: A, style: I }, k) {
61
+ const y = j(), F = q("AlertDialog", "tone", c, { default: "neutral" }) ?? "neutral", D = N();
62
+ return s ?? (s = D.confirm), n ?? (n = D.cancel), /* @__PURE__ */ a(J, { isOpen: t, defaultOpen: u, onOpenChange: $, isDismissable: !1, size: "sm", motion: e, backdrop: o, children: /* @__PURE__ */ a(G, { ref: k, className: A, style: I, role: "alertdialog", "aria-describedby": r ? y : void 0, title: i, hideClose: !0, footer: ({ close: w }) => /* @__PURE__ */ m(h, { children: [
63
+ /* @__PURE__ */ a(P, { variant: "ghost", autoFocus: l === "cancel", onPress: w, children: n }),
64
+ /* @__PURE__ */ a(P, { variant: F === "danger" ? "danger" : "primary", autoFocus: l === "confirm", onPress: async () => {
65
+ await (d == null ? void 0 : d()), w();
66
+ }, children: s })
67
+ ] }), children: r ? /* @__PURE__ */ a("div", { id: y, style: { display: "contents" }, children: r }) : null }) });
66
68
  });
67
69
  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
70
+ sa as AlertDialog,
71
+ G as Dialog,
72
+ J as DialogModal,
73
+ da as DialogTrigger,
74
+ la as Popover,
75
+ ra as PopoverDialog,
76
+ ia as Tooltip,
77
+ ta as TooltipTrigger
76
78
  };