@alea-design/ui 0.2.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (184) hide show
  1. package/README.md +2 -2
  2. package/dist/components/accordion/Accordion.js +29 -0
  3. package/dist/components/ai/AI.d.ts +5 -1
  4. package/dist/components/ai/AI.js +187 -0
  5. package/dist/components/app/AppParts.d.ts +16 -4
  6. package/dist/components/app/AppParts.js +134 -0
  7. package/dist/components/button/Button.d.ts +1 -1
  8. package/dist/components/button/Button.js +137 -0
  9. package/dist/components/button/Groups.d.ts +1 -1
  10. package/dist/components/button/Groups.js +112 -0
  11. package/dist/components/card/Card.d.ts +3 -2
  12. package/dist/components/card/Card.js +47 -0
  13. package/dist/components/chat/Chat.d.ts +4 -2
  14. package/dist/components/chat/Chat.js +275 -0
  15. package/dist/components/choice/Choice.js +69 -0
  16. package/dist/components/color/Color.d.ts +3 -3
  17. package/dist/components/color/Color.js +98 -0
  18. package/dist/components/combobox/Autocomplete.d.ts +5 -5
  19. package/dist/components/combobox/Autocomplete.js +126 -0
  20. package/dist/components/combobox/ComboBox.d.ts +4 -4
  21. package/dist/components/combobox/ComboBox.js +112 -0
  22. package/dist/components/combobox/Highlight.js +50 -0
  23. package/dist/components/command/CommandPalette.d.ts +10 -3
  24. package/dist/components/command/CommandPalette.js +56 -0
  25. package/dist/components/content/Content.d.ts +1 -1
  26. package/dist/components/content/Content.js +125 -0
  27. package/dist/components/data/Data.js +79 -0
  28. package/dist/components/date/Date.js +109 -0
  29. package/dist/components/display/Display.d.ts +5 -3
  30. package/dist/components/display/Display.js +89 -0
  31. package/dist/components/display/Display2.d.ts +3 -1
  32. package/dist/components/display/Display2.js +75 -0
  33. package/dist/components/emoji/EmojiPicker.js +52 -0
  34. package/dist/components/emoji/emoji-data.js +27 -0
  35. package/dist/components/extras/CodeSteps.d.ts +1 -0
  36. package/dist/components/extras/CodeSteps.js +19 -0
  37. package/dist/components/extras/Extras.d.ts +1 -1
  38. package/dist/components/extras/Extras.js +116 -0
  39. package/dist/components/feedback/Feedback.d.ts +11 -8
  40. package/dist/components/feedback/Feedback.js +185 -0
  41. package/dist/components/feedback/Spinner.js +18 -0
  42. package/dist/components/feedback/Status.d.ts +6 -2
  43. package/dist/components/feedback/Status.js +48 -0
  44. package/dist/components/field/Field.d.ts +1 -1
  45. package/dist/components/field/Field.js +187 -0
  46. package/dist/components/field/FieldLoading.d.ts +1 -1
  47. package/dist/components/field/FieldLoading.js +18 -0
  48. package/dist/components/filter/FilterBar.js +96 -0
  49. package/dist/components/form/Form.d.ts +5 -5
  50. package/dist/components/form/Form.js +53 -0
  51. package/dist/components/icon/Icon.d.ts +2 -2
  52. package/dist/components/icon/Icon.js +66 -0
  53. package/dist/components/icon/icon-cells.js +39 -0
  54. package/dist/components/icon/icon-contexts.d.ts +1 -1
  55. package/dist/components/icon/icon-contexts.js +38 -0
  56. package/dist/components/icon/icon-names.d.ts +1 -1
  57. package/dist/components/icon/icon-names.js +376 -0
  58. package/dist/components/layout/Bento.d.ts +1 -1
  59. package/dist/components/layout/Bento.js +38 -0
  60. package/dist/components/layout/Layout.d.ts +1 -1
  61. package/dist/components/layout/Layout.js +54 -0
  62. package/dist/components/layout/Layout2.d.ts +36 -6
  63. package/dist/components/layout/Layout2.js +105 -0
  64. package/dist/components/layout/Layout3.js +35 -0
  65. package/dist/components/layout/Responsive.d.ts +1 -1
  66. package/dist/components/layout/Responsive.js +32 -0
  67. package/dist/components/list/List.d.ts +3 -2
  68. package/dist/components/list/List.js +82 -0
  69. package/dist/components/list/Lists2.d.ts +6 -4
  70. package/dist/components/list/Lists2.js +60 -0
  71. package/dist/components/media/Media.d.ts +8 -4
  72. package/dist/components/media/Media.js +188 -0
  73. package/dist/components/menu/Menu.d.ts +23 -12
  74. package/dist/components/menu/Menu.js +68 -0
  75. package/dist/components/more/More.d.ts +7 -7
  76. package/dist/components/more/More.js +182 -0
  77. package/dist/components/navigation/Navbar.d.ts +1 -1
  78. package/dist/components/navigation/Navbar.js +27 -0
  79. package/dist/components/navigation/Navigation.js +121 -0
  80. package/dist/components/navigation/Navigation2.d.ts +6 -2
  81. package/dist/components/navigation/Navigation2.js +355 -0
  82. package/dist/components/overlay/Drawer.d.ts +11 -6
  83. package/dist/components/overlay/Drawer.js +39 -0
  84. package/dist/components/overlay/Modal.d.ts +6 -3
  85. package/dist/components/overlay/Modal.js +27 -0
  86. package/dist/components/overlay/Overlay.d.ts +14 -9
  87. package/dist/components/overlay/Overlay.js +76 -0
  88. package/dist/components/overlay/Sheet.d.ts +11 -5
  89. package/dist/components/overlay/Sheet.js +52 -0
  90. package/dist/components/page/Page.d.ts +5 -5
  91. package/dist/components/page/Page.js +132 -0
  92. package/dist/components/page/PageParts.d.ts +5 -5
  93. package/dist/components/page/PageParts.js +109 -0
  94. package/dist/components/picker/Picker.d.ts +11 -11
  95. package/dist/components/picker/Picker.js +294 -0
  96. package/dist/components/picker/Wheel.js +132 -0
  97. package/dist/components/rating/Rating.d.ts +2 -1
  98. package/dist/components/rating/Rating.js +66 -0
  99. package/dist/components/select/Select.d.ts +8 -6
  100. package/dist/components/select/Select.js +146 -0
  101. package/dist/components/shell/AppShell.d.ts +3 -3
  102. package/dist/components/shell/AppShell.js +56 -0
  103. package/dist/components/shell/AppSidebar.d.ts +5 -5
  104. package/dist/components/shell/AppSidebar.js +62 -0
  105. package/dist/components/slider/Slider.d.ts +2 -1
  106. package/dist/components/slider/Slider.js +36 -0
  107. package/dist/components/surface/Surface.d.ts +16 -0
  108. package/dist/components/surface/Surface.js +7 -0
  109. package/dist/components/table/Table.d.ts +4 -3
  110. package/dist/components/table/Table.js +58 -0
  111. package/dist/components/tabs/Tabs.d.ts +1 -0
  112. package/dist/components/tabs/Tabs.js +120 -0
  113. package/dist/components/theme/Theme.d.ts +11 -6
  114. package/dist/components/theme/Theme.js +186 -0
  115. package/dist/components/theme/lens.js +104 -0
  116. package/dist/components/tree/Tree.js +303 -0
  117. package/dist/components/typography/Typography.js +43 -0
  118. package/dist/components/upload/Upload.js +71 -0
  119. package/dist/components/work/Ops.js +24 -0
  120. package/dist/components/work/Work.d.ts +4 -2
  121. package/dist/components/work/Work.js +241 -0
  122. package/dist/css/accordion.css +1 -0
  123. package/dist/css/ai.css +1 -0
  124. package/dist/css/app.css +1 -0
  125. package/dist/css/base.css +1 -0
  126. package/dist/css/button.css +1 -0
  127. package/dist/css/card.css +1 -0
  128. package/dist/css/chat.css +1 -0
  129. package/dist/css/choice.css +1 -0
  130. package/dist/css/color.css +1 -0
  131. package/dist/css/combobox.css +1 -0
  132. package/dist/css/command.css +1 -0
  133. package/dist/css/content.css +1 -0
  134. package/dist/css/data.css +1 -0
  135. package/dist/css/date.css +1 -0
  136. package/dist/css/display.css +1 -0
  137. package/dist/css/emoji.css +1 -0
  138. package/dist/css/extras.css +1 -0
  139. package/dist/css/feedback.css +1 -0
  140. package/dist/css/field.css +1 -0
  141. package/dist/css/filter.css +1 -0
  142. package/dist/css/form.css +1 -0
  143. package/dist/css/groups.json +346 -0
  144. package/dist/css/icon.css +1 -0
  145. package/dist/css/layout.css +1 -0
  146. package/dist/css/list.css +1 -0
  147. package/dist/css/media.css +1 -0
  148. package/dist/css/menu.css +1 -0
  149. package/dist/css/more.css +1 -0
  150. package/dist/css/navigation.css +1 -0
  151. package/dist/css/overlay.css +1 -0
  152. package/dist/css/page.css +1 -0
  153. package/dist/css/picker.css +1 -0
  154. package/dist/css/rating.css +1 -0
  155. package/dist/css/select.css +1 -0
  156. package/dist/css/shell.css +1 -0
  157. package/dist/css/slider.css +1 -0
  158. package/dist/css/surface.css +1 -0
  159. package/dist/css/table.css +1 -0
  160. package/dist/css/tabs.css +1 -0
  161. package/dist/css/tree.css +1 -0
  162. package/dist/css/typography.css +1 -0
  163. package/dist/css/upload.css +1 -0
  164. package/dist/css/work.css +1 -0
  165. package/dist/i18n/strings.js +842 -0
  166. package/dist/index.d.ts +71 -70
  167. package/dist/index.js +398 -7436
  168. package/dist/styles.css +1 -1
  169. package/dist/utils/Blueprint.js +131 -0
  170. package/dist/utils/DotField.js +32 -0
  171. package/dist/utils/attr.d.ts +1 -1
  172. package/dist/utils/attr.js +18 -0
  173. package/dist/utils/blueprintScene.js +161 -0
  174. package/dist/utils/controlled.js +11 -0
  175. package/dist/utils/cx.js +11 -0
  176. package/dist/utils/inert.js +9 -0
  177. package/dist/utils/refs.d.ts +3 -0
  178. package/dist/utils/refs.js +11 -0
  179. package/dist/utils/responsive.js +12 -0
  180. package/dist/utils/scrollEdges.js +31 -0
  181. package/dist/utils/space.js +10 -0
  182. package/dist/utils/vocabulary.d.ts +6 -0
  183. package/dist/utils/vocabulary.js +17 -0
  184. package/package.json +12 -8
@@ -0,0 +1,146 @@
1
+ "use client";
2
+ import { jsx as e, jsxs as i, Fragment as Q } from "react/jsx-runtime";
3
+ import { forwardRef as T, useContext as w, useMemo as U } from "react";
4
+ import { ListBox as F, useFilter as W, Select as Y, Button as O, SelectValue as Z, Autocomplete as _, SearchField as ee, Input as ae, ListBoxItem as le, ListBoxSection as te, Header as se, SelectStateContext as re, Virtualizer as ie, ListLayout as ne, AutocompleteStateContext as oe, Text as ce } from "react-aria-components";
5
+ import { ChevronDown as de, Search as ue, Check as pe, X as he } from "lucide-react";
6
+ import { withBase as g, cx as me } from "../../utils/cx.js";
7
+ import { Label as fe, Description as be, FieldError as ye } from "../field/Field.js";
8
+ import { Spinner as Se } from "../feedback/Spinner.js";
9
+ import { useBusy as Ne, loadingAttrs as ve } from "../field/FieldLoading.js";
10
+ import { responsiveAttrs as xe } from "../../utils/responsive.js";
11
+ import { Popover as ge } from "../overlay/Overlay.js";
12
+ import { useStrings as S } from "../../i18n/strings.js";
13
+ import { OptionMatchContext as Be, useOptionMatch as Ve, Highlight as De } from "../combobox/Highlight.js";
14
+ function ke({ style: s, children: l }) {
15
+ const t = w(oe), r = (t == null ? void 0 : t.inputValue) ?? "", a = U(() => ({ query: r, style: s ?? "tint", match: "phrase" }), [r, s]);
16
+ return /* @__PURE__ */ e(Be.Provider, { value: a, children: l });
17
+ }
18
+ function qe() {
19
+ const s = S(), l = w(re), t = l && (Array.isArray(l.value) ? l.value.length > 0 : l.value != null);
20
+ return !l || !t ? null : /* @__PURE__ */ e(O, { slot: null, className: "alea-input-clear alea-select-clear alea-focus-ring", "aria-label": s.clear, onPress: () => l.setValue(l.selectionManager.selectionMode === "multiple" ? [] : null), children: /* @__PURE__ */ e(he, { size: 14 }) });
21
+ }
22
+ function ze({ motion: s, label: l, description: t, errorMessage: r, warningMessage: a, showOptional: n, items: p, children: o, size: h, variant: b = "outline", labelPosition: c = "top", prefix: B, isClearable: C, searchable: V, highlightMatch: E, matchStyle: M, isLoading: N, emptyText: P, footer: D, checkPosition: I = "end", maxTags: v = 2, renderValue: k, virtualized: q, className: j, placeholder: z, ...f }) {
23
+ const m = S();
24
+ z ?? (z = m.selectPlaceholder);
25
+ const H = Ne(N), { contains: K } = W({ sensitivity: "base" }), $ = f.selectionMode === "multiple", A = /* @__PURE__ */ e(F, { items: p, className: "alea-listbox", "data-check": I, renderEmptyState: () => /* @__PURE__ */ e("div", { className: "alea-listbox-empty", children: P ?? m.noResults }), children: o ?? ((u) => /* @__PURE__ */ e(R, { id: u.id, textValue: u.textValue ?? (typeof u.label == "string" ? u.label : String(u.id)), isDisabled: u.isDisabled, description: u.description, icon: u.icon, children: u.label })) }), x = q ? /* @__PURE__ */ e(ie, { layout: ne, layoutOptions: { rowHeight: q }, children: A }) : A;
26
+ return /* @__PURE__ */ i(
27
+ Y,
28
+ {
29
+ ...f,
30
+ placeholder: z,
31
+ allowsEmptyCollection: !0,
32
+ className: g("alea-field alea-select", j),
33
+ ...xe("size", h, "md"),
34
+ "data-variant": b !== "outline" ? b : void 0,
35
+ "data-label-position": c !== "top" ? c : void 0,
36
+ "data-warning": a ? !0 : void 0,
37
+ ...ve(N),
38
+ children: [
39
+ l && /* @__PURE__ */ i(fe, { children: [
40
+ l,
41
+ f.isRequired && /* @__PURE__ */ e("span", { className: "alea-label-required", "aria-hidden": "true", children: " *" }),
42
+ n && !f.isRequired && /* @__PURE__ */ i("span", { className: "alea-label-optional", children: [
43
+ " (",
44
+ m.optional,
45
+ ")"
46
+ ] })
47
+ ] }),
48
+ /* @__PURE__ */ i("div", { className: "alea-select-control", children: [
49
+ /* @__PURE__ */ i(O, { ref: H, className: "alea-select-trigger alea-focus-ring", children: [
50
+ B && /* @__PURE__ */ e("span", { className: "alea-input-affix alea-select-prefix", "aria-hidden": "true", children: B }),
51
+ /* @__PURE__ */ e(Z, { className: "alea-select-value", children: ({ selectedItems: u, isPlaceholder: X, defaultChildren: L }) => {
52
+ const y = u.filter(Boolean);
53
+ if (X) return L;
54
+ if (k) return k(y);
55
+ if (!$) return L;
56
+ const G = (d) => (d == null ? void 0 : d.textValue) ?? (typeof (d == null ? void 0 : d.label) == "string" ? d.label : String((d == null ? void 0 : d.id) ?? ""));
57
+ return /* @__PURE__ */ i("span", { className: "alea-select-tags", children: [
58
+ y.slice(0, v).map((d, J) => /* @__PURE__ */ e("span", { className: "alea-select-tag", children: G(d) }, J)),
59
+ y.length > v && /* @__PURE__ */ i("span", { className: "alea-select-tag", "data-more": !0, children: [
60
+ "+",
61
+ y.length - v
62
+ ] })
63
+ ] });
64
+ } }),
65
+ N ? /* @__PURE__ */ e(Se, { size: "sm", "aria-label": m.loading }) : /* @__PURE__ */ e(de, { size: 16, "aria-hidden": "true", className: "alea-select-chevron" })
66
+ ] }),
67
+ C && !f.isDisabled && /* @__PURE__ */ e(qe, {})
68
+ ] }),
69
+ (t || a) && /* @__PURE__ */ i(be, { children: [
70
+ t,
71
+ a && /* @__PURE__ */ e("span", { className: "alea-field-warning", children: a })
72
+ ] }),
73
+ /* @__PURE__ */ e(ye, { children: r }),
74
+ /* @__PURE__ */ i(ge, { className: "alea-popover alea-select-popover", motion: s, "data-searchable": V || void 0, children: [
75
+ V ? /* @__PURE__ */ i(_, { filter: K, children: [
76
+ /* @__PURE__ */ i(ee, { "aria-label": m.filterOptions, autoFocus: !0, className: "alea-select-search", children: [
77
+ /* @__PURE__ */ e(ue, { size: 14, "aria-hidden": "true" }),
78
+ /* @__PURE__ */ e(ae, { className: "alea-select-search-input", placeholder: m.search })
79
+ ] }),
80
+ E ? /* @__PURE__ */ e(ke, { style: M, children: x }) : x
81
+ ] }) : x,
82
+ D && /* @__PURE__ */ e("div", { className: "alea-select-footer", children: D })
83
+ ] })
84
+ ]
85
+ }
86
+ );
87
+ }
88
+ function Ae({ label: s, description: l, matchQuery: t, matchStyle: r }) {
89
+ const a = Ve(), n = t ?? (a == null ? void 0 : a.query) ?? "", p = (o) => n && typeof o == "string" ? /* @__PURE__ */ e(De, { text: o, query: n, match: (a == null ? void 0 : a.match) ?? "phrase", matchStyle: r ?? (a == null ? void 0 : a.style) }) : o;
90
+ return /* @__PURE__ */ i(ce, { slot: "label", className: "alea-option-text", children: [
91
+ /* @__PURE__ */ e("span", { children: p(s) }),
92
+ l && /* @__PURE__ */ e("span", { className: "alea-option-desc", children: p(l) })
93
+ ] });
94
+ }
95
+ function R({ children: s, description: l, icon: t, matchQuery: r, matchStyle: a, className: n, textValue: p, ...o }) {
96
+ return /* @__PURE__ */ e(le, { ...o, textValue: p ?? (typeof s == "string" || typeof s == "number" ? String(s) : void 0), className: g("alea-option", n), children: ({ isSelected: h }) => /* @__PURE__ */ i(Q, { children: [
97
+ t && /* @__PURE__ */ e("span", { className: "alea-option-icon", "aria-hidden": "true", children: t }),
98
+ /* @__PURE__ */ e(Ae, { label: s, description: l, matchQuery: r, matchStyle: a }),
99
+ /* @__PURE__ */ e(pe, { size: 16, className: "alea-option-check", "aria-hidden": "true", "data-on": h || void 0 })
100
+ ] }) });
101
+ }
102
+ const Ke = T(function({ title: l, children: t, className: r, ...a }, n) {
103
+ return /* @__PURE__ */ i(te, { ...a, ref: n, className: me("alea-option-section", r), children: [
104
+ /* @__PURE__ */ e(se, { className: "alea-option-header", children: l }),
105
+ t
106
+ ] });
107
+ });
108
+ function $e({ items: s, children: l, emptyText: t, checkPosition: r = "end", variant: a = "card", maxHeight: n, className: p, style: o, ...h }) {
109
+ const b = S();
110
+ return /* @__PURE__ */ e(
111
+ F,
112
+ {
113
+ ...h,
114
+ items: s,
115
+ "data-check": r,
116
+ "data-variant": a,
117
+ renderEmptyState: () => /* @__PURE__ */ e("div", { className: "alea-listbox-empty", children: t ?? b.noResults }),
118
+ className: g("alea-listbox alea-listbox-standalone", p),
119
+ style: { ...n ? { maxHeight: n, overflow: "auto" } : {}, ...o },
120
+ children: l ?? ((c) => /* @__PURE__ */ e(R, { id: c.id, textValue: c.textValue ?? (typeof c.label == "string" ? c.label : String(c.id)), isDisabled: c.isDisabled, description: c.description, icon: c.icon, children: c.label }))
121
+ }
122
+ );
123
+ }
124
+ function Xe({ periods: s = ["24h", "7d", "30d", "12m"], value: l, defaultValue: t = "30d", onChange: r, label: a, size: n, className: p }) {
125
+ const o = S();
126
+ return /* @__PURE__ */ e(
127
+ ze,
128
+ {
129
+ "aria-label": a ? void 0 : o.period,
130
+ label: a,
131
+ size: n,
132
+ className: p,
133
+ selectedKey: l,
134
+ defaultSelectedKey: l === void 0 ? t : void 0,
135
+ onSelectionChange: (h) => r == null ? void 0 : r(h),
136
+ items: s.map((h) => ({ id: h, label: o.periods[h] }))
137
+ }
138
+ );
139
+ }
140
+ export {
141
+ $e as ListBox,
142
+ Xe as PeriodSelect,
143
+ ze as Select,
144
+ R as SelectItem,
145
+ Ke as SelectSection
146
+ };
@@ -1,4 +1,4 @@
1
- import { type ReactNode } from 'react';
1
+ import { type ReactNode, type HTMLAttributes } from 'react';
2
2
  import { type LinkProps } from 'react-aria-components';
3
3
  export interface AppShellProps {
4
4
  /** Logo or product name, top left. */
@@ -32,14 +32,14 @@ export interface SidebarNavProps {
32
32
  /** Vertical navigation with groups; the current page is marked. */
33
33
  export declare function SidebarNav({ children, className, 'aria-label': label }: SidebarNavProps): import("react").JSX.Element;
34
34
  /** A titled group of nav links. */
35
- export interface SidebarGroupProps {
35
+ export interface SidebarGroupProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {
36
36
  /** Small uppercase title of the group. */
37
37
  title?: ReactNode;
38
38
  /** The SidebarLinks. */
39
39
  children: ReactNode;
40
40
  }
41
41
  /** A group of sidebar links under a title. */
42
- export declare function SidebarGroup({ title, children }: SidebarGroupProps): import("react").JSX.Element;
42
+ export declare const SidebarGroup: import("react").ForwardRefExoticComponent<SidebarGroupProps & import("react").RefAttributes<HTMLDivElement>>;
43
43
  export interface SidebarLinkProps extends LinkProps {
44
44
  /** Marks the current page (aria-current). */
45
45
  isCurrent?: boolean;
@@ -0,0 +1,56 @@
1
+ "use client";
2
+ import { jsxs as r, jsx as a, Fragment as S } from "react/jsx-runtime";
3
+ import { useState as k, forwardRef as C } from "react";
4
+ import { Link as w } from "react-aria-components";
5
+ import { Menu as y } from "lucide-react";
6
+ import { cx as m, withBase as L } from "../../utils/cx.js";
7
+ import { useMediaQuery as M } from "../layout/Responsive.js";
8
+ import { IconButton as O } from "../button/Button.js";
9
+ import { Drawer as j } from "../overlay/Drawer.js";
10
+ import { Dialog as D } from "../overlay/Overlay.js";
11
+ import { useStrings as f } from "../../i18n/strings.js";
12
+ import { SkipLink as G } from "../more/More.js";
13
+ function J({ brand: s, headerEnd: l, sidebar: e, children: i, sidebarWidth: t = 248, collapseBelow: n = 900, mainAs: c = "main", layout: d = "header", className: v }) {
14
+ const h = f(), N = c, [g, o] = k(!1), b = M(`(max-width: ${n - 0.02}px)`), p = /* @__PURE__ */ r("header", { className: "alea-shell-header", children: [
15
+ e && /* @__PURE__ */ a(O, { "aria-label": h.openNavigation, className: "alea-shell-menu", onPress: () => o(!0), children: /* @__PURE__ */ a(y, {}) }),
16
+ s && /* @__PURE__ */ a("div", { className: "alea-shell-brand", children: s }),
17
+ l && /* @__PURE__ */ a("div", { className: "alea-shell-end", children: l })
18
+ ] }), u = /* @__PURE__ */ a(N, { id: "alea-main", className: "alea-shell-main", tabIndex: -1, children: i });
19
+ return /* @__PURE__ */ r("div", { className: m("alea-shell", v), style: { "--alea-shell-sidebar": `${t}px` }, "data-layout": d, "data-collapse": n, "data-collapsed": b || void 0, "data-custom-collapse": n !== 900 || void 0, children: [
20
+ /* @__PURE__ */ a(G, { target: "alea-main" }),
21
+ d === "header" && p,
22
+ /* @__PURE__ */ r("div", { className: "alea-shell-body", children: [
23
+ e && /* @__PURE__ */ a("aside", { className: "alea-shell-sidebar", children: e }),
24
+ d === "sidebar" ? /* @__PURE__ */ r("div", { className: "alea-shell-panel", children: [
25
+ p,
26
+ u
27
+ ] }) : u
28
+ ] }),
29
+ e && /* @__PURE__ */ a(j, { isOpen: g, onOpenChange: o, placement: "start", size: 300, children: /* @__PURE__ */ a(D, { "aria-label": h.navigation, hideClose: !0, className: "alea-shell-drawer", children: () => /* @__PURE__ */ a("div", { onClickCapture: (x) => {
30
+ x.target.closest("a") && o(!1);
31
+ }, children: e }) }) })
32
+ ] });
33
+ }
34
+ function K({ children: s, className: l, "aria-label": e }) {
35
+ const i = f();
36
+ return e ?? (e = i.mainNav), /* @__PURE__ */ a("nav", { "aria-label": e, className: m("alea-sidenav", l), children: s });
37
+ }
38
+ const T = C(function({ title: l, children: e, className: i, ...t }, n) {
39
+ return /* @__PURE__ */ r("div", { ref: n, ...t, className: m("alea-sidenav-group", i), children: [
40
+ l && /* @__PURE__ */ a("p", { className: "alea-sidenav-title", children: l }),
41
+ /* @__PURE__ */ a("ul", { children: e })
42
+ ] });
43
+ });
44
+ function U({ isCurrent: s, icon: l, end: e, children: i, className: t, ...n }) {
45
+ return /* @__PURE__ */ a("li", { children: /* @__PURE__ */ a(w, { ...n, "aria-current": s ? "page" : void 0, className: L("alea-sidenav-link alea-focus-ring", t), children: (c) => /* @__PURE__ */ r(S, { children: [
46
+ l && /* @__PURE__ */ a("span", { className: "alea-sidenav-icon", "aria-hidden": "true", children: l }),
47
+ /* @__PURE__ */ a("span", { className: "alea-sidenav-label", children: typeof i == "function" ? i(c) : i }),
48
+ e && /* @__PURE__ */ a("span", { className: "alea-sidenav-end", children: e })
49
+ ] }) }) });
50
+ }
51
+ export {
52
+ J as AppShell,
53
+ T as SidebarGroup,
54
+ U as SidebarLink,
55
+ K as SidebarNav
56
+ };
@@ -1,4 +1,4 @@
1
- import { type ReactNode } from 'react';
1
+ import { type ReactNode, type HTMLAttributes } from 'react';
2
2
  import { type LinkProps } from 'react-aria-components';
3
3
  export interface AppSidebarProps {
4
4
  /** The top: usually a WorkspaceSwitcher. Stays in place while the links scroll. */
@@ -13,7 +13,7 @@ export interface AppSidebarProps {
13
13
  }
14
14
  /** The side navigation of a web app: a workspace switcher on top, compact links, sections that fold. Pair it with AppShell layout="sidebar". */
15
15
  export declare function AppSidebar({ header, children, footer, className, 'aria-label': label }: AppSidebarProps): import("react").JSX.Element;
16
- export interface WorkspaceSwitcherProps {
16
+ export interface WorkspaceSwitcherProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children'> {
17
17
  /** The workspace or product name. */
18
18
  name: ReactNode;
19
19
  /** A logo or mark before the name (about 20 px). */
@@ -28,8 +28,8 @@ export interface WorkspaceSwitcherProps {
28
28
  onAction?: (key: string | number) => void;
29
29
  }
30
30
  /** The workspace name at the top of the sidebar: a menu to switch workspaces, with quick actions beside it. */
31
- export declare function WorkspaceSwitcher({ name, logo, children, actions, onAction, 'aria-label': label }: WorkspaceSwitcherProps): import("react").JSX.Element;
32
- export interface AppNavSectionProps {
31
+ export declare const WorkspaceSwitcher: import("react").ForwardRefExoticComponent<WorkspaceSwitcherProps & import("react").RefAttributes<HTMLDivElement>>;
32
+ export interface AppNavSectionProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {
33
33
  /** The section's name, small and muted. Leave it out for the first, main group. */
34
34
  title?: ReactNode;
35
35
  /** The AppNavItems. */
@@ -42,7 +42,7 @@ export interface AppNavSectionProps {
42
42
  action?: ReactNode;
43
43
  }
44
44
  /** A group of links in the AppSidebar; with a title it folds. */
45
- export declare function AppNavSection({ title, children, collapsible, defaultExpanded, action }: AppNavSectionProps): import("react").JSX.Element;
45
+ export declare const AppNavSection: import("react").ForwardRefExoticComponent<AppNavSectionProps & import("react").RefAttributes<HTMLDivElement>>;
46
46
  export interface AppNavItemProps extends LinkProps {
47
47
  /** Marks the current page (aria-current). */
48
48
  isCurrent?: boolean;
@@ -0,0 +1,62 @@
1
+ "use client";
2
+ import { jsx as a, jsxs as l, Fragment as h } from "react/jsx-runtime";
3
+ import { forwardRef as N, useState as w, useId as b } from "react";
4
+ import { Link as g, Button as k } from "react-aria-components";
5
+ import { ChevronRight as S, ChevronDown as x } from "lucide-react";
6
+ import { withBase as y, cx as u } from "../../utils/cx.js";
7
+ import { navIcon as A } from "../icon/icon-contexts.js";
8
+ import { DropdownMenu as I } from "../menu/Menu.js";
9
+ import { useStrings as W } from "../../i18n/strings.js";
10
+ function M({ header: c, children: e, footer: s, className: n, "aria-label": i }) {
11
+ const r = W();
12
+ return /* @__PURE__ */ l("div", { className: u("alea-appnav", n), children: [
13
+ c && /* @__PURE__ */ a("div", { className: "alea-appnav-header", children: c }),
14
+ /* @__PURE__ */ a("nav", { "aria-label": i ?? r.mainNav, className: "alea-appnav-body", children: e }),
15
+ s && /* @__PURE__ */ a("div", { className: "alea-appnav-footer", children: s })
16
+ ] });
17
+ }
18
+ const O = N(function({ name: e, logo: s, children: n, actions: i, onAction: r, "aria-label": t, className: m, ...v }, o) {
19
+ const p = /* @__PURE__ */ l(h, { children: [
20
+ s && /* @__PURE__ */ a("span", { className: "alea-ws-logo", "aria-hidden": "true", children: s }),
21
+ /* @__PURE__ */ a("span", { className: "alea-ws-name", children: e }),
22
+ n && /* @__PURE__ */ a(x, { className: "alea-ws-chevron", "aria-hidden": "true" })
23
+ ] });
24
+ return /* @__PURE__ */ l("div", { ref: o, ...v, className: u("alea-ws", m), children: [
25
+ n ? /* @__PURE__ */ a(
26
+ I,
27
+ {
28
+ "aria-label": t ?? (typeof e == "string" ? `${e}, workspace menu` : "Workspace menu"),
29
+ placement: "bottom start",
30
+ menuProps: r ? { onAction: (d) => r(d) } : void 0,
31
+ trigger: /* @__PURE__ */ a(k, { className: "alea-ws-button alea-focus-ring", "aria-label": t ?? (typeof e == "string" ? `${e}, workspace menu` : void 0), children: p }),
32
+ children: n
33
+ }
34
+ ) : /* @__PURE__ */ a("span", { className: "alea-ws-button", "data-static": !0, children: p }),
35
+ i && /* @__PURE__ */ a("span", { className: "alea-ws-actions", children: i })
36
+ ] });
37
+ }), P = N(function({ title: e, children: s, collapsible: n = !!e, defaultExpanded: i = !0, action: r, className: t, ...m }, v) {
38
+ const [o, p] = w(i), d = b();
39
+ return /* @__PURE__ */ l("div", { ref: v, ...m, className: u("alea-navsec", t), "data-open": o || void 0, children: [
40
+ e && /* @__PURE__ */ l("div", { className: "alea-navsec-head", children: [
41
+ n ? /* @__PURE__ */ l("button", { type: "button", className: "alea-navsec-title alea-focus-ring", "aria-expanded": o, "aria-controls": d, onClick: () => p((f) => !f), children: [
42
+ e,
43
+ /* @__PURE__ */ a(S, { className: "alea-navsec-chevron", "aria-hidden": "true" })
44
+ ] }) : /* @__PURE__ */ a("span", { className: "alea-navsec-title", children: e }),
45
+ r && /* @__PURE__ */ a("span", { className: "alea-navsec-action", children: r })
46
+ ] }),
47
+ /* @__PURE__ */ a("ul", { id: d, className: "alea-navsec-list", hidden: n && !o, children: s })
48
+ ] });
49
+ });
50
+ function q({ isCurrent: c, icon: e, end: s, children: n, className: i, ...r }) {
51
+ return /* @__PURE__ */ a("li", { children: /* @__PURE__ */ a(g, { ...r, "aria-current": c ? "page" : void 0, className: y("alea-navitem alea-focus-ring", i), children: (t) => /* @__PURE__ */ l(h, { children: [
52
+ e && /* @__PURE__ */ a("span", { className: "alea-navitem-icon", "aria-hidden": "true", ...A(c), children: e }),
53
+ /* @__PURE__ */ a("span", { className: "alea-navitem-label", children: typeof n == "function" ? n(t) : n }),
54
+ s != null && /* @__PURE__ */ a("span", { className: "alea-navitem-end", children: s })
55
+ ] }) }) });
56
+ }
57
+ export {
58
+ q as AppNavItem,
59
+ P as AppNavSection,
60
+ M as AppSidebar,
61
+ O as WorkspaceSwitcher
62
+ };
@@ -1,4 +1,5 @@
1
1
  import type { ReactNode } from 'react';
2
+ import type { Tone } from '../display/Display.js';
2
3
  import { type SliderProps as RACSliderProps } from 'react-aria-components';
3
4
  export interface SliderProps<T extends number | number[] = number> extends RACSliderProps<T> {
4
5
  /** The visible label. */
@@ -17,7 +18,7 @@ export interface SliderProps<T extends number | number[] = number> extends RACSl
17
18
  /** sm (4 px track, 16 px thumb), md (default) or lg (8 px track, 24 px thumb). */
18
19
  size?: 'sm' | 'md' | 'lg';
19
20
  /** The fill color: accent (default), success, warning, danger or info. */
20
- tone?: 'accent' | 'success' | 'warning' | 'danger' | 'info';
21
+ tone?: Tone;
21
22
  /** The fill starts here instead of the minimum: 0 in a −50 to 50 slider fills to either side. */
22
23
  fillOffset?: number;
23
24
  /** The value as words, shown and spoken instead of the number: "1:23 of 4:56", "16 px", "Loud". */
@@ -0,0 +1,36 @@
1
+ "use client";
2
+ import { jsxs as f, jsx as r, Fragment as j } from "react/jsx-runtime";
3
+ import { useRef as A, useEffect as E } from "react";
4
+ import { Slider as I, Label as P, SliderOutput as _, SliderTrack as q, SliderThumb as z } from "react-aria-components";
5
+ import { withBase as B } from "../../utils/cx.js";
6
+ function C({ label: u, showValue: o = !0, thumbLabels: h, marks: N, showTooltip: y, size: M, tone: x, fillOffset: b, getValueText: i, className: $, ...c }) {
7
+ const S = A(null);
8
+ E(() => {
9
+ var e;
10
+ i && ((e = S.current) == null || e.querySelectorAll('input[type="range"]').forEach((l) => l.setAttribute("aria-valuetext", i(Number(l.value)))));
11
+ });
12
+ const t = c.minValue ?? 0, v = c.maxValue ?? 100, k = c.step ?? 1, g = y ?? (o ? "never" : "drag"), p = N === !0 ? Array.from({ length: Math.floor((v - t) / k) + 1 }, (e, l) => ({ value: t + l * k, label: void 0 })) : N || [];
13
+ return /* @__PURE__ */ f(I, { ...c, ref: S, className: B("alea-slider", $), "data-size": M, "data-tone": x, "data-marks": p.length ? !0 : void 0, "data-labeled-marks": p.some((e) => e.label != null) || void 0, children: [
14
+ (u || o) && /* @__PURE__ */ f("div", { className: "alea-slider-head", children: [
15
+ u && /* @__PURE__ */ r(P, { className: "alea-label", children: u }),
16
+ o && /* @__PURE__ */ r(_, { className: "alea-slider-output", children: ({ state: e }) => e.values.map((l, n) => i ? i(l) : e.getThumbValueLabel(n)).join(" to ") })
17
+ ] }),
18
+ /* @__PURE__ */ r(q, { className: "alea-slider-track", children: ({ state: e }) => {
19
+ const l = e.values.length, n = (a) => (Math.min(v, Math.max(t, a)) - t) / (v - t);
20
+ let m = l > 1 ? e.getThumbPercent(0) : 0, d = e.getThumbPercent(l - 1);
21
+ if (l === 1 && b != null) {
22
+ const a = n(b);
23
+ m = Math.min(a, d), d = Math.max(a, d);
24
+ }
25
+ return /* @__PURE__ */ f(j, { children: [
26
+ /* @__PURE__ */ r("div", { className: "alea-slider-rail" }),
27
+ /* @__PURE__ */ r("div", { className: "alea-slider-fill", style: { insetInlineStart: `${m * 100}%`, width: `${(d - m) * 100}%` } }),
28
+ p.map((a) => /* @__PURE__ */ r("span", { className: "alea-slider-mark", "data-in": n(a.value) >= m && n(a.value) <= d || void 0, style: { insetInlineStart: `${n(a.value) * 100}%` }, "aria-hidden": "true", children: a.label != null && /* @__PURE__ */ r("span", { className: "alea-slider-mark-label", children: a.label }) }, a.value)),
29
+ e.values.map((a, s) => /* @__PURE__ */ r(z, { index: s, "aria-label": h == null ? void 0 : h[s], className: "alea-slider-thumb", children: g !== "never" && /* @__PURE__ */ r("span", { className: "alea-slider-tip", "data-mode": g, "aria-hidden": "true", children: i ? i(e.values[s]) : e.getThumbValueLabel(s) }) }, s))
30
+ ] });
31
+ } })
32
+ ] });
33
+ }
34
+ export {
35
+ C as Slider
36
+ };
@@ -0,0 +1,16 @@
1
+ /** How a panel is painted: its fill, its ring or shadow, in one word. Every look defines the tokens behind it. */
2
+ export type Surface = 'flat' | 'raised' | 'sunken' | 'overlay';
3
+ /** The corner radius, by token name. none is square. */
4
+ export type SurfaceRadius = 'none' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl';
5
+ /** The two props that every panel-like component shares (Card, Table, Popover, Dialog, Drawer, Toast, a chart, a Kanban card). */
6
+ export interface SurfaceProps {
7
+ /** How the panel is painted. flat: the base surface with a hairline ring and no shadow. raised: the base surface with the card shadow. sunken: the deeper surface of an inset area, no shadow. overlay: the lifted surface of things that float (menu, dialog, a card being dragged) with the strong ring and the pop shadow. Leave it out for the component's own look. */
8
+ surface?: Surface;
9
+ /** Corner radius token: none, sm, md, lg, xl, 2xl or 3xl. Leave it out for the component's own radius. */
10
+ radius?: SurfaceRadius;
11
+ }
12
+ /** The data attributes the stylesheet reads (surface.css). Spread them on the root element. */
13
+ export declare function surfaceAttrs({ surface, radius }: SurfaceProps): {
14
+ readonly 'data-surface-level': Surface | undefined;
15
+ readonly 'data-radius': SurfaceRadius | undefined;
16
+ };
@@ -0,0 +1,7 @@
1
+ "use client";
2
+ function a({ surface: e, radius: t }) {
3
+ return { "data-surface-level": e, "data-radius": t };
4
+ }
5
+ export {
6
+ a as surfaceAttrs
7
+ };
@@ -1,10 +1,11 @@
1
1
  import { type ReactNode } from 'react';
2
2
  import { type TableProps as RACTableProps, type TableHeaderProps, type ColumnProps as RACColumnProps, type TableBodyProps, type RowProps, type CellProps } from 'react-aria-components';
3
- export interface TableProps extends RACTableProps {
3
+ import { type SurfaceProps } from '../surface/Surface.js';
4
+ export interface TableProps extends RACTableProps, SurfaceProps {
4
5
  /** Header stays visible while the body scrolls (needs a height on the container). */
5
6
  stickyHeader?: boolean;
6
7
  /** compact rows (40 px) or comfy (52 px, default). 'comfortable' is a deprecated alias of 'comfy'. */
7
- density?: 'comfy' | 'compact' | 'comfortable';
8
+ density?: 'comfy' | 'compact' | /** @deprecated Use comfy. */ 'comfortable';
8
9
  /** Max height of the scroll area, e.g. 400. */
9
10
  maxHeight?: number | string;
10
11
  /** Lets people drag column edges to resize. */
@@ -20,7 +21,7 @@ export interface TableProps extends RACTableProps {
20
21
  };
21
22
  }
22
23
  /** Data in rows and columns: sorting, row selection, sticky header, resizing, keyboard grid navigation. */
23
- export declare function Table({ stickyHeader, density: densityProp, maxHeight, resizable, variant, stackBelow, virtualized, className, ...props }: TableProps): import("react").JSX.Element;
24
+ export declare function Table({ stickyHeader, density: densityRaw, maxHeight, resizable, variant, stackBelow, virtualized, surface, radius, className, ...props }: TableProps): import("react").JSX.Element;
24
25
  /** The header row. Adds the select-all checkbox when the table selects multiple rows. */
25
26
  export declare function TableHeader<T extends object>({ columns, children, className, ...props }: TableHeaderProps<T>): import("react").JSX.Element;
26
27
  export interface ColumnProps extends RACColumnProps {
@@ -0,0 +1,58 @@
1
+ "use client";
2
+ import { jsx as e, jsxs as h } from "react/jsx-runtime";
3
+ import { useContext as B } from "react";
4
+ import { Cell as d, Column as m, useTableOptions as y, Row as R, Collection as N, Table as v, Virtualizer as H, TableLayout as $, ResizableTableContainer as z, TableBody as S, TableHeader as D, TableColumnResizeStateContext as M, ColumnResizer as j, Checkbox as A } from "react-aria-components";
5
+ import { ArrowUp as O, Minus as P, Check as V } from "lucide-react";
6
+ import { surfaceAttrs as g } from "../surface/Surface.js";
7
+ import { withBase as c, cx as w } from "../../utils/cx.js";
8
+ import { DragHandle as W } from "../list/List.js";
9
+ import { useStrings as L } from "../../i18n/strings.js";
10
+ import { renamedValue as U } from "../../utils/vocabulary.js";
11
+ function C({ slot: a }) {
12
+ return /* @__PURE__ */ e(A, { slot: a, className: "alea-check alea-table-check", children: ({ isIndeterminate: l }) => /* @__PURE__ */ e("span", { className: "alea-check-box", "aria-hidden": "true", children: l ? /* @__PURE__ */ e(P, { size: 14, strokeWidth: 3 }) : /* @__PURE__ */ e(V, { size: 14, strokeWidth: 3 }) }) });
13
+ }
14
+ function _({ stickyHeader: a, density: l = "comfy", maxHeight: t, resizable: n, variant: o = "default", stackBelow: r, virtualized: s, surface: i, radius: u, className: T, ...k }) {
15
+ const x = U("Table", "density", l, { comfortable: "comfy" }) === "compact" ? "compact" : "comfy", b = /* @__PURE__ */ e(v, { ...k, className: c("alea-table", T), "data-density": x, "data-sticky": a || s ? !0 : void 0, "data-variant": o !== "default" ? o : void 0, "data-stack": r, "data-virtualized": s ? !0 : void 0 }), f = s ? /* @__PURE__ */ e(H, { layout: $, layoutOptions: { rowHeight: s.rowHeight, headingHeight: s.headingHeight ?? 44 }, children: b }) : b, p = t ? { maxHeight: t, ...s ? { height: t } : {} } : void 0;
16
+ return n ? /* @__PURE__ */ e(z, { className: "alea-table-wrap", style: p, ...g({ surface: i, radius: u }), children: f }) : /* @__PURE__ */ e("div", { className: "alea-table-wrap", style: p, ...g({ surface: i, radius: u }), children: f });
17
+ }
18
+ function ee({ columns: a, children: l, className: t, ...n }) {
19
+ const o = L(), { selectionBehavior: r, selectionMode: s, allowsDragging: i } = y();
20
+ return /* @__PURE__ */ h(D, { ...n, className: w("alea-thead", t), children: [
21
+ i && /* @__PURE__ */ e(m, { className: "alea-th alea-th-narrow", children: /* @__PURE__ */ e("span", { className: "alea-visually-hidden", children: o.dragToMove }) }),
22
+ r === "toggle" && /* @__PURE__ */ e(m, { className: "alea-th alea-th-narrow", children: s === "multiple" && /* @__PURE__ */ e(C, { slot: "selection" }) }),
23
+ /* @__PURE__ */ e(N, { items: a, children: l })
24
+ ] });
25
+ }
26
+ function ae({ children: a, align: l = "start", className: t, ...n }) {
27
+ return /* @__PURE__ */ e(m, { ...n, className: c("alea-th", t), "data-align": l, children: ({ allowsSorting: o, sortDirection: r }) => /* @__PURE__ */ h("div", { className: "alea-th-inner", children: [
28
+ /* @__PURE__ */ e("span", { className: "alea-th-label", children: a }),
29
+ o && /* @__PURE__ */ e(O, { size: 14, "aria-hidden": "true", className: "alea-sort", "data-direction": r }),
30
+ /* @__PURE__ */ e(q, {})
31
+ ] }) });
32
+ }
33
+ function q() {
34
+ return B(M) ? /* @__PURE__ */ e(j, { className: "alea-col-resizer" }) : null;
35
+ }
36
+ function le({ className: a, ...l }) {
37
+ return /* @__PURE__ */ e(S, { ...l, className: w("alea-tbody", a) });
38
+ }
39
+ function te({ id: a, columns: l, children: t, className: n, ...o }) {
40
+ const { selectionBehavior: r, allowsDragging: s } = y();
41
+ return /* @__PURE__ */ h(R, { id: a, ...o, className: c("alea-tr", n), children: [
42
+ s && /* @__PURE__ */ e(d, { className: "alea-td alea-td-narrow", children: /* @__PURE__ */ e(W, {}) }),
43
+ r === "toggle" && /* @__PURE__ */ e(d, { className: "alea-td alea-td-narrow", children: /* @__PURE__ */ e(C, { slot: "selection" }) }),
44
+ /* @__PURE__ */ e(N, { items: l, dependencies: o.dependencies, children: t })
45
+ ] });
46
+ }
47
+ function oe({ className: a, ...l }) {
48
+ const { align: t, label: n, ...o } = l;
49
+ return /* @__PURE__ */ e(d, { ...o, "data-align": t, "data-label": n, className: c("alea-td", a) });
50
+ }
51
+ export {
52
+ oe as Cell,
53
+ ae as Column,
54
+ te as Row,
55
+ _ as Table,
56
+ le as TableBody,
57
+ ee as TableHeader
58
+ };
@@ -52,6 +52,7 @@ export interface TabNavProps {
52
52
  'aria-label': string;
53
53
  /** The same looks and sizes as Tabs. */
54
54
  variant?: TabsProps['variant'];
55
+ /** sm, md (default) or lg, as in Tabs. */
55
56
  size?: TabsProps['size'];
56
57
  className?: string;
57
58
  }
@@ -0,0 +1,120 @@
1
+ "use client";
2
+ import { jsx as t, jsxs as A, Fragment as M } from "react/jsx-runtime";
3
+ import { useRef as k, useEffect as $, useState as B, useId as F, useLayoutEffect as K } from "react";
4
+ import { Tab as C, SelectionIndicator as H, TabList as U, Link as X, TabPanel as G, Tabs as J } from "react-aria-components";
5
+ import { X as Q, ChevronLeft as V, ChevronRight as W } from "lucide-react";
6
+ import { withBase as L } from "../../utils/cx.js";
7
+ import { tabIcon as Y } from "../icon/icon-contexts.js";
8
+ import { useScrollEdges as Z } from "../../utils/scrollEdges.js";
9
+ import { useStrings as j } from "../../i18n/strings.js";
10
+ function ie({ variant: b = "underline", size: s, fitted: l, justify: f, className: i, ...m }) {
11
+ const r = k(null);
12
+ return K(() => {
13
+ const o = r.current;
14
+ if (!o) return;
15
+ const v = () => o.querySelectorAll('[role="tab"][aria-controls]').forEach((c) => {
16
+ document.getElementById(c.getAttribute("aria-controls")) || c.removeAttribute("aria-controls");
17
+ });
18
+ if (v(), typeof MutationObserver > "u") return;
19
+ const d = new MutationObserver(v);
20
+ return d.observe(o, { subtree: !0, childList: !0, attributes: !0, attributeFilter: ["aria-controls"] }), () => d.disconnect();
21
+ }, []), /* @__PURE__ */ t(J, { ...m, ref: r, "data-variant": b, "data-size": s, "data-fitted": l || void 0, "data-justify": f, className: L("alea-tabs", i) });
22
+ }
23
+ function le({ className: b, extra: s, onReorder: l, ...f }) {
24
+ const i = j(), m = k(null), { edges: r, scroll: o } = Z(m, ".alea-tab-list"), [v, d] = B(""), c = F(), h = k(l);
25
+ return h.current = l, $(() => {
26
+ var q;
27
+ const a = (q = m.current) == null ? void 0 : q.querySelector(".alea-tab-list");
28
+ if (!a || !l) return;
29
+ const p = () => Array.from(a.querySelectorAll('[role="tab"]')), w = () => p().forEach((e) => {
30
+ e.setAttribute("draggable", "true"), e.setAttribute("aria-describedby", c), e.setAttribute("aria-keyshortcuts", "Alt+Shift+ArrowLeft Alt+Shift+ArrowRight");
31
+ });
32
+ w();
33
+ const S = new MutationObserver(w);
34
+ S.observe(a, { childList: !0 });
35
+ const E = () => a.getAttribute("aria-orientation") === "vertical", T = (e, n) => {
36
+ var N;
37
+ const y = p(), g = e.dataset.key;
38
+ n = Math.max(0, Math.min(y.length - 1, n)), n !== y.indexOf(e) && ((N = h.current) == null || N.call(h, g, n), d(i.movedTo(e.textContent ?? g, n + 1, y.length)), requestAnimationFrame(() => {
39
+ var z;
40
+ return (z = a.querySelector(`[data-key="${CSS.escape(g)}"]`)) == null ? void 0 : z.focus();
41
+ }));
42
+ }, x = (e) => {
43
+ const n = e.target.closest('[role="tab"]');
44
+ if (!n || !e.altKey || !e.shiftKey) return;
45
+ const y = E() ? "ArrowUp" : "ArrowLeft", g = E() ? "ArrowDown" : "ArrowRight";
46
+ if (e.key !== y && e.key !== g) return;
47
+ e.preventDefault(), e.stopPropagation();
48
+ const N = getComputedStyle(a).direction === "rtl" && !E();
49
+ T(n, p().indexOf(n) + (e.key === g !== N ? 1 : -1));
50
+ };
51
+ let u = null;
52
+ const D = (e) => {
53
+ var n;
54
+ u = e.target.closest('[role="tab"]'), u && ((n = e.dataTransfer) == null || n.setData("text/plain", u.dataset.key ?? ""), u.dataset.dragging = "true");
55
+ }, O = (e) => {
56
+ u && e.preventDefault();
57
+ }, P = (e) => {
58
+ const n = e.target.closest('[role="tab"]');
59
+ u && n && n !== u && (e.preventDefault(), T(u, p().indexOf(n)));
60
+ }, I = () => {
61
+ u && delete u.dataset.dragging, u = null;
62
+ };
63
+ return a.addEventListener("keydown", x, !0), a.addEventListener("dragstart", D), a.addEventListener("dragover", O), a.addEventListener("drop", P), a.addEventListener("dragend", I), () => {
64
+ S.disconnect(), a.removeEventListener("keydown", x, !0), a.removeEventListener("dragstart", D), a.removeEventListener("dragover", O), a.removeEventListener("drop", P), a.removeEventListener("dragend", I), p().forEach((e) => {
65
+ e.removeAttribute("draggable"), e.removeAttribute("aria-describedby"), e.removeAttribute("aria-keyshortcuts");
66
+ });
67
+ };
68
+ }, [!!l, c]), /* @__PURE__ */ A("div", { ref: m, className: "alea-tab-bar", "data-overflow-start": r.start || void 0, "data-overflow-end": r.end || void 0, "data-reorderable": l ? !0 : void 0, children: [
69
+ r.start && /* @__PURE__ */ t("button", { type: "button", tabIndex: -1, "aria-hidden": "true", className: "alea-tab-scroll", "data-side": "start", onClick: () => o(-1), children: /* @__PURE__ */ t(V, { size: 16 }) }),
70
+ /* @__PURE__ */ t(U, { ...f, "aria-label": f["aria-label"], className: L("alea-tab-list", b) }),
71
+ r.end && /* @__PURE__ */ t("button", { type: "button", tabIndex: -1, "aria-hidden": "true", className: "alea-tab-scroll", "data-side": "end", onClick: () => o(1), children: /* @__PURE__ */ t(W, { size: 16 }) }),
72
+ s && /* @__PURE__ */ t("div", { className: "alea-tab-extra", children: s }),
73
+ l && /* @__PURE__ */ A(M, { children: [
74
+ /* @__PURE__ */ t("span", { id: c, hidden: !0, children: i.reorderHint }),
75
+ /* @__PURE__ */ t("span", { className: "alea-visually-hidden", role: "status", children: v })
76
+ ] })
77
+ ] });
78
+ }
79
+ function oe({ className: b, children: s, icon: l, badge: f, onClose: i, ...m }) {
80
+ const r = j(), o = k(null), v = k(i);
81
+ return v.current = i, $(() => {
82
+ const d = o.current;
83
+ if (!d || !i) return;
84
+ d.setAttribute("aria-keyshortcuts", "Delete");
85
+ const c = (h) => {
86
+ var a;
87
+ (h.key === "Delete" || h.key === "Backspace") && (h.preventDefault(), (a = v.current) == null || a.call(v));
88
+ };
89
+ return d.addEventListener("keydown", c), () => d.removeEventListener("keydown", c);
90
+ }, [!!i]), /* @__PURE__ */ t(C, { ...m, ref: o, className: L("alea-tab alea-focus-ring", b), "data-closable": i ? !0 : void 0, children: (d) => /* @__PURE__ */ A(M, { children: [
91
+ l && /* @__PURE__ */ t("span", { className: "alea-tab-icon", "aria-hidden": "true", ...Y(d.isSelected), children: l }),
92
+ /* @__PURE__ */ t("span", { className: "alea-tab-label", children: typeof s == "function" ? s(d) : s }),
93
+ f != null && /* @__PURE__ */ t("span", { className: "alea-tab-badge", children: f }),
94
+ i && /* @__PURE__ */ t("span", { className: "alea-tab-close", "aria-hidden": "true", title: r.close, onPointerDown: (c) => c.stopPropagation(), onClick: (c) => {
95
+ c.stopPropagation(), i();
96
+ }, children: /* @__PURE__ */ t(Q, { size: 12 }) }),
97
+ /* @__PURE__ */ t(H, { className: "alea-sel-indicator" })
98
+ ] }) });
99
+ }
100
+ function ce({ className: b, ...s }) {
101
+ return s.children == null || s.children === !1 ? null : /* @__PURE__ */ t(G, { ...s, className: L("alea-tab-panel alea-focus-ring", b) });
102
+ }
103
+ function de({ items: b, current: s, variant: l = "underline", size: f, className: i, "aria-label": m }) {
104
+ return /* @__PURE__ */ t("nav", { "aria-label": m, className: ["alea-tabs alea-tab-nav", i].filter(Boolean).join(" "), "data-variant": l, "data-size": f, children: /* @__PURE__ */ t("div", { className: "alea-tab-bar", children: /* @__PURE__ */ t("div", { className: "alea-tab-list", children: b.map((r) => {
105
+ const o = r.id === s;
106
+ return /* @__PURE__ */ A(X, { href: r.href, "aria-current": o ? "page" : void 0, "data-selected": o || void 0, className: "alea-tab alea-focus-ring", children: [
107
+ r.icon && /* @__PURE__ */ t("span", { className: "alea-tab-icon", "aria-hidden": "true", children: r.icon }),
108
+ /* @__PURE__ */ t("span", { className: "alea-tab-label", children: r.label }),
109
+ r.badge != null && /* @__PURE__ */ t("span", { className: "alea-tab-badge", children: r.badge }),
110
+ o && /* @__PURE__ */ t("span", { className: "alea-sel-indicator" })
111
+ ] }, r.id);
112
+ }) }) }) });
113
+ }
114
+ export {
115
+ oe as Tab,
116
+ le as TabList,
117
+ de as TabNav,
118
+ ce as TabPanel,
119
+ ie as Tabs
120
+ };