@alea-design/ui 0.5.1 → 0.6.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.
- package/dist/components/button/Button.d.ts +3 -1
- package/dist/components/button/Button.js +64 -63
- package/dist/components/card/Card.d.ts +6 -2
- package/dist/components/card/Card.js +20 -20
- package/dist/components/combobox/Autocomplete.d.ts +4 -0
- package/dist/components/combobox/Autocomplete.js +89 -87
- package/dist/components/command/CommandPalette.d.ts +10 -0
- package/dist/components/command/CommandPalette.js +82 -56
- package/dist/components/data/Data.d.ts +11 -7
- package/dist/components/data/Data.js +65 -55
- package/dist/components/date/Date.d.ts +16 -2
- package/dist/components/date/Date.js +80 -69
- package/dist/components/display/Display.d.ts +3 -1
- package/dist/components/display/Display.js +27 -27
- package/dist/components/display/Display2.d.ts +2 -2
- package/dist/components/display/Display2.js +28 -27
- package/dist/components/feedback/Feedback.d.ts +3 -1
- package/dist/components/feedback/Feedback.js +102 -102
- package/dist/components/feedback/PageSkeleton.d.ts +19 -0
- package/dist/components/feedback/PageSkeleton.js +58 -0
- package/dist/components/field/Field.d.ts +3 -1
- package/dist/components/field/Field.js +82 -82
- package/dist/components/filter/FilterBar.d.ts +5 -2
- package/dist/components/filter/FilterBar.js +97 -66
- package/dist/components/form/Form.d.ts +8 -2
- package/dist/components/form/Form.js +53 -40
- package/dist/components/icon/icon-names.d.ts +2 -2
- package/dist/components/icon/icon-names.js +4 -2
- package/dist/components/list/List.d.ts +6 -2
- package/dist/components/list/List.js +65 -62
- package/dist/components/list/Lists2.d.ts +4 -0
- package/dist/components/list/Lists2.js +35 -35
- package/dist/components/media/Media.d.ts +5 -1
- package/dist/components/media/Media.js +115 -113
- package/dist/components/more/More.d.ts +2 -2
- package/dist/components/more/More.js +46 -45
- package/dist/components/navigation/Navigation.d.ts +11 -5
- package/dist/components/navigation/Navigation.js +97 -80
- package/dist/components/navigation/Navigation2.d.ts +9 -3
- package/dist/components/navigation/Navigation2.js +208 -194
- package/dist/components/notification/NotificationCenter.js +70 -70
- package/dist/components/overlay/Drawer.d.ts +6 -1
- package/dist/components/overlay/Drawer.js +27 -25
- package/dist/components/overlay/Modal.d.ts +5 -0
- package/dist/components/overlay/Modal.js +16 -15
- package/dist/components/overlay/Overlay.d.ts +14 -1
- package/dist/components/overlay/Overlay.js +52 -50
- package/dist/components/overlay/Sheet.d.ts +2 -0
- package/dist/components/overlay/Sheet.js +30 -30
- package/dist/components/page/PageParts.d.ts +6 -2
- package/dist/components/page/PageParts.js +92 -84
- package/dist/components/select/Select.js +75 -70
- package/dist/components/settings/Settings.d.ts +29 -0
- package/dist/components/settings/Settings.js +31 -0
- package/dist/components/shell/AccountMenu.d.ts +20 -0
- package/dist/components/shell/AccountMenu.js +32 -0
- package/dist/components/shell/AppShell.d.ts +9 -2
- package/dist/components/shell/AppShell.js +37 -37
- package/dist/components/shell/AppSidebar.d.ts +9 -3
- package/dist/components/shell/AppSidebar.js +45 -39
- package/dist/components/table/Table.d.ts +18 -4
- package/dist/components/table/Table.js +70 -46
- package/dist/components/tabs/Tabs.js +105 -94
- package/dist/components/theme/Theme.d.ts +7 -4
- package/dist/components/theme/Theme.js +127 -130
- package/dist/components/upload/Upload.js +62 -54
- package/dist/css/base.css +1 -1
- package/dist/css/button.css +1 -1
- package/dist/css/card.css +1 -1
- package/dist/css/command.css +1 -1
- package/dist/css/data.css +1 -1
- package/dist/css/date.css +1 -1
- package/dist/css/display.css +1 -1
- package/dist/css/feedback.css +1 -1
- package/dist/css/field.css +1 -1
- package/dist/css/form.css +1 -1
- package/dist/css/groups.json +37 -21
- package/dist/css/list.css +1 -1
- package/dist/css/menu.css +1 -1
- package/dist/css/navigation.css +1 -1
- package/dist/css/notification.css +1 -1
- package/dist/css/overlay.css +1 -1
- package/dist/css/page.css +1 -1
- package/dist/css/select.css +1 -1
- package/dist/css/settings.css +1 -0
- package/dist/css/shell.css +1 -1
- package/dist/css/table.css +1 -1
- package/dist/css/tabs.css +1 -1
- package/dist/css/upload.css +1 -1
- package/dist/i18n/strings.d.ts +9 -0
- package/dist/i18n/strings.js +18 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +318 -306
- package/dist/styles.css +1 -1
- package/dist/utils/animateRows.d.ts +11 -0
- package/dist/utils/animateRows.js +23 -0
- package/dist/utils/decimal.d.ts +12 -0
- package/dist/utils/decimal.js +48 -0
- package/dist/utils/initialFocus.d.ts +6 -0
- package/dist/utils/initialFocus.js +24 -0
- package/dist/utils/refs.d.ts +2 -0
- package/dist/utils/refs.js +14 -6
- package/package.json +3 -3
|
@@ -1,42 +1,47 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as e, jsxs as i, Fragment as
|
|
3
|
-
import { forwardRef as
|
|
4
|
-
import { ListBox as
|
|
2
|
+
import { jsx as e, jsxs as i, Fragment as U } from "react/jsx-runtime";
|
|
3
|
+
import { forwardRef as F, useContext as g, useMemo as W } from "react";
|
|
4
|
+
import { ListBox as I, useFilter as Y, Select as Z, SelectValue as _, Autocomplete as ee, SearchField as ae, Input as le, ListBoxItem as te, ListBoxSection as se, Header as re, SelectStateContext as O, Button as R, Virtualizer as ie, ListLayout as ne, AutocompleteStateContext as oe, Text as ce } from "react-aria-components";
|
|
5
5
|
import { ChevronDown as de, Search as ue, Check as pe, X as he } from "lucide-react";
|
|
6
|
-
import { withBase as
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
|
|
15
|
-
|
|
6
|
+
import { withBase as V, cx as me } from "../../utils/cx.js";
|
|
7
|
+
import { useAriaInvalid as fe } from "../../utils/refs.js";
|
|
8
|
+
import { Label as Se, Description as be, FieldError as ye } from "../field/Field.js";
|
|
9
|
+
import { Spinner as ve } from "../feedback/Spinner.js";
|
|
10
|
+
import { useBusy as Ne, loadingAttrs as xe } from "../field/FieldLoading.js";
|
|
11
|
+
import { responsiveAttrs as ge } from "../../utils/responsive.js";
|
|
12
|
+
import { Popover as Ve } from "../overlay/Overlay.js";
|
|
13
|
+
import { useStrings as y } from "../../i18n/strings.js";
|
|
14
|
+
import { OptionMatchContext as Be, useOptionMatch as Ae, Highlight as De } from "../combobox/Highlight.js";
|
|
15
|
+
function ke({ style: r, children: l }) {
|
|
16
|
+
const t = g(oe), s = (t == null ? void 0 : t.inputValue) ?? "", a = W(() => ({ query: s, style: r ?? "tint", match: "phrase" }), [s, r]);
|
|
16
17
|
return /* @__PURE__ */ e(Be.Provider, { value: a, children: l });
|
|
17
18
|
}
|
|
18
|
-
|
|
19
|
-
const s =
|
|
20
|
-
return
|
|
19
|
+
const qe = F(function(l, t) {
|
|
20
|
+
const s = g(O), a = fe(!!(s != null && s.displayValidation.isInvalid), t);
|
|
21
|
+
return /* @__PURE__ */ e(R, { ...l, ref: a });
|
|
22
|
+
});
|
|
23
|
+
function ze() {
|
|
24
|
+
const r = y(), l = g(O), t = l && (Array.isArray(l.value) ? l.value.length > 0 : l.value != null);
|
|
25
|
+
return !l || !t ? null : /* @__PURE__ */ e(R, { slot: null, className: "alea-input-clear alea-select-clear alea-focus-ring", "aria-label": r.clear, onPress: () => l.setValue(l.selectionManager.selectionMode === "multiple" ? [] : null), children: /* @__PURE__ */ e(he, { size: 14 }) });
|
|
21
26
|
}
|
|
22
|
-
function
|
|
23
|
-
const m =
|
|
27
|
+
function Le({ motion: r, label: l, description: t, errorMessage: s, warningMessage: a, showOptional: n, items: p, children: o, size: h, variant: S = "outline", labelPosition: c = "top", prefix: B, isClearable: E, searchable: A, highlightMatch: M, matchStyle: P, isLoading: v, emptyText: j, footer: D, checkPosition: H = "end", maxTags: N = 2, renderValue: k, virtualized: q, className: K, placeholder: z, ...f }) {
|
|
28
|
+
const m = y();
|
|
24
29
|
z ?? (z = m.selectPlaceholder);
|
|
25
|
-
const
|
|
30
|
+
const T = Ne(v), { contains: $ } = Y({ sensitivity: "base" }), X = f.selectionMode === "multiple", L = /* @__PURE__ */ e(I, { items: p, className: "alea-listbox", "data-check": H, renderEmptyState: () => /* @__PURE__ */ e("div", { className: "alea-listbox-empty", children: j ?? m.noResults }), children: o ?? ((u) => /* @__PURE__ */ e(C, { 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: L }) : L;
|
|
26
31
|
return /* @__PURE__ */ i(
|
|
27
|
-
|
|
32
|
+
Z,
|
|
28
33
|
{
|
|
29
34
|
...f,
|
|
30
35
|
placeholder: z,
|
|
31
36
|
allowsEmptyCollection: !0,
|
|
32
|
-
className:
|
|
33
|
-
...
|
|
34
|
-
"data-variant":
|
|
37
|
+
className: V("alea-field alea-select", K),
|
|
38
|
+
...ge("size", h, "md"),
|
|
39
|
+
"data-variant": S !== "outline" ? S : void 0,
|
|
35
40
|
"data-label-position": c !== "top" ? c : void 0,
|
|
36
41
|
"data-warning": a ? !0 : void 0,
|
|
37
|
-
...
|
|
42
|
+
...xe(v),
|
|
38
43
|
children: [
|
|
39
|
-
l && /* @__PURE__ */ i(
|
|
44
|
+
l && /* @__PURE__ */ i(Se, { children: [
|
|
40
45
|
l,
|
|
41
46
|
f.isRequired && /* @__PURE__ */ e("span", { className: "alea-label-required", "aria-hidden": "true", children: " *" }),
|
|
42
47
|
n && !f.isRequired && /* @__PURE__ */ i("span", { className: "alea-label-optional", children: [
|
|
@@ -46,38 +51,38 @@ function ze({ motion: s, label: l, description: t, errorMessage: r, warningMessa
|
|
|
46
51
|
] })
|
|
47
52
|
] }),
|
|
48
53
|
/* @__PURE__ */ i("div", { className: "alea-select-control", children: [
|
|
49
|
-
/* @__PURE__ */ i(
|
|
54
|
+
/* @__PURE__ */ i(qe, { ref: T, className: "alea-select-trigger alea-focus-ring", children: [
|
|
50
55
|
B && /* @__PURE__ */ e("span", { className: "alea-input-affix alea-select-prefix", "aria-hidden": "true", children: B }),
|
|
51
|
-
/* @__PURE__ */ e(
|
|
52
|
-
const
|
|
53
|
-
if (
|
|
54
|
-
if (k) return k(
|
|
55
|
-
if (
|
|
56
|
-
const
|
|
56
|
+
/* @__PURE__ */ e(_, { className: "alea-select-value", children: ({ selectedItems: u, isPlaceholder: G, defaultChildren: w }) => {
|
|
57
|
+
const b = u.filter(Boolean);
|
|
58
|
+
if (G) return w;
|
|
59
|
+
if (k) return k(b);
|
|
60
|
+
if (!X) return w;
|
|
61
|
+
const J = (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
62
|
return /* @__PURE__ */ i("span", { className: "alea-select-tags", children: [
|
|
58
|
-
|
|
59
|
-
|
|
63
|
+
b.slice(0, N).map((d, Q) => /* @__PURE__ */ e("span", { className: "alea-select-tag", children: J(d) }, Q)),
|
|
64
|
+
b.length > N && /* @__PURE__ */ i("span", { className: "alea-select-tag", "data-more": !0, children: [
|
|
60
65
|
"+",
|
|
61
|
-
|
|
66
|
+
b.length - N
|
|
62
67
|
] })
|
|
63
68
|
] });
|
|
64
69
|
} }),
|
|
65
|
-
|
|
70
|
+
v ? /* @__PURE__ */ e(ve, { size: "sm", "aria-label": m.loading }) : /* @__PURE__ */ e(de, { size: 16, "aria-hidden": "true", className: "alea-select-chevron" })
|
|
66
71
|
] }),
|
|
67
|
-
|
|
72
|
+
E && !f.isDisabled && /* @__PURE__ */ e(ze, {})
|
|
68
73
|
] }),
|
|
69
74
|
(t || a) && /* @__PURE__ */ i(be, { children: [
|
|
70
75
|
t,
|
|
71
76
|
a && /* @__PURE__ */ e("span", { className: "alea-field-warning", children: a })
|
|
72
77
|
] }),
|
|
73
|
-
/* @__PURE__ */ e(ye, { children:
|
|
74
|
-
/* @__PURE__ */ i(
|
|
75
|
-
|
|
76
|
-
/* @__PURE__ */ i(
|
|
78
|
+
/* @__PURE__ */ e(ye, { children: s }),
|
|
79
|
+
/* @__PURE__ */ i(Ve, { className: "alea-popover alea-select-popover", motion: r, "data-searchable": A || void 0, children: [
|
|
80
|
+
A ? /* @__PURE__ */ i(ee, { filter: $, children: [
|
|
81
|
+
/* @__PURE__ */ i(ae, { "aria-label": m.filterOptions, autoFocus: !0, className: "alea-select-search", children: [
|
|
77
82
|
/* @__PURE__ */ e(ue, { size: 14, "aria-hidden": "true" }),
|
|
78
|
-
/* @__PURE__ */ e(
|
|
83
|
+
/* @__PURE__ */ e(le, { className: "alea-select-search-input", placeholder: m.search })
|
|
79
84
|
] }),
|
|
80
|
-
|
|
85
|
+
M ? /* @__PURE__ */ e(ke, { style: P, children: x }) : x
|
|
81
86
|
] }) : x,
|
|
82
87
|
D && /* @__PURE__ */ e("div", { className: "alea-select-footer", children: D })
|
|
83
88
|
] })
|
|
@@ -85,46 +90,46 @@ function ze({ motion: s, label: l, description: t, errorMessage: r, warningMessa
|
|
|
85
90
|
}
|
|
86
91
|
);
|
|
87
92
|
}
|
|
88
|
-
function
|
|
89
|
-
const a =
|
|
93
|
+
function we({ label: r, description: l, matchQuery: t, matchStyle: s }) {
|
|
94
|
+
const a = Ae(), 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: s ?? (a == null ? void 0 : a.style) }) : o;
|
|
90
95
|
return /* @__PURE__ */ i(ce, { slot: "label", className: "alea-option-text", children: [
|
|
91
|
-
/* @__PURE__ */ e("span", { children: p(
|
|
96
|
+
/* @__PURE__ */ e("span", { children: p(r) }),
|
|
92
97
|
l && /* @__PURE__ */ e("span", { className: "alea-option-desc", children: p(l) })
|
|
93
98
|
] });
|
|
94
99
|
}
|
|
95
|
-
function
|
|
96
|
-
return /* @__PURE__ */ e(
|
|
100
|
+
function C({ children: r, description: l, icon: t, matchQuery: s, matchStyle: a, className: n, textValue: p, ...o }) {
|
|
101
|
+
return /* @__PURE__ */ e(te, { ...o, textValue: p ?? (typeof r == "string" || typeof r == "number" ? String(r) : void 0), className: V("alea-option", n), children: ({ isSelected: h }) => /* @__PURE__ */ i(U, { children: [
|
|
97
102
|
t && /* @__PURE__ */ e("span", { className: "alea-option-icon", "aria-hidden": "true", children: t }),
|
|
98
|
-
/* @__PURE__ */ e(
|
|
103
|
+
/* @__PURE__ */ e(we, { label: r, description: l, matchQuery: s, matchStyle: a }),
|
|
99
104
|
/* @__PURE__ */ e(pe, { size: 16, className: "alea-option-check", "aria-hidden": "true", "data-on": h || void 0 })
|
|
100
105
|
] }) });
|
|
101
106
|
}
|
|
102
|
-
const
|
|
103
|
-
return /* @__PURE__ */ i(
|
|
104
|
-
/* @__PURE__ */ e(
|
|
107
|
+
const Xe = F(function({ title: l, children: t, className: s, ...a }, n) {
|
|
108
|
+
return /* @__PURE__ */ i(se, { ...a, ref: n, className: me("alea-option-section", s), children: [
|
|
109
|
+
/* @__PURE__ */ e(re, { className: "alea-option-header", children: l }),
|
|
105
110
|
t
|
|
106
111
|
] });
|
|
107
112
|
});
|
|
108
|
-
function
|
|
109
|
-
const
|
|
113
|
+
function Ge({ items: r, children: l, emptyText: t, checkPosition: s = "end", variant: a = "card", maxHeight: n, className: p, style: o, ...h }) {
|
|
114
|
+
const S = y();
|
|
110
115
|
return /* @__PURE__ */ e(
|
|
111
|
-
|
|
116
|
+
I,
|
|
112
117
|
{
|
|
113
118
|
...h,
|
|
114
|
-
items:
|
|
115
|
-
"data-check":
|
|
119
|
+
items: r,
|
|
120
|
+
"data-check": s,
|
|
116
121
|
"data-variant": a,
|
|
117
|
-
renderEmptyState: () => /* @__PURE__ */ e("div", { className: "alea-listbox-empty", children: t ??
|
|
118
|
-
className:
|
|
122
|
+
renderEmptyState: () => /* @__PURE__ */ e("div", { className: "alea-listbox-empty", children: t ?? S.noResults }),
|
|
123
|
+
className: V("alea-listbox alea-listbox-standalone", p),
|
|
119
124
|
style: { ...n ? { maxHeight: n, overflow: "auto" } : {}, ...o },
|
|
120
|
-
children: l ?? ((c) => /* @__PURE__ */ e(
|
|
125
|
+
children: l ?? ((c) => /* @__PURE__ */ e(C, { 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
126
|
}
|
|
122
127
|
);
|
|
123
128
|
}
|
|
124
|
-
function
|
|
125
|
-
const o =
|
|
129
|
+
function Je({ periods: r = ["24h", "7d", "30d", "12m"], value: l, defaultValue: t = "30d", onChange: s, label: a, size: n, className: p }) {
|
|
130
|
+
const o = y();
|
|
126
131
|
return /* @__PURE__ */ e(
|
|
127
|
-
|
|
132
|
+
Le,
|
|
128
133
|
{
|
|
129
134
|
"aria-label": a ? void 0 : o.period,
|
|
130
135
|
label: a,
|
|
@@ -132,15 +137,15 @@ function Xe({ periods: s = ["24h", "7d", "30d", "12m"], value: l, defaultValue:
|
|
|
132
137
|
className: p,
|
|
133
138
|
selectedKey: l,
|
|
134
139
|
defaultSelectedKey: l === void 0 ? t : void 0,
|
|
135
|
-
onSelectionChange: (h) =>
|
|
136
|
-
items:
|
|
140
|
+
onSelectionChange: (h) => s == null ? void 0 : s(h),
|
|
141
|
+
items: r.map((h) => ({ id: h, label: o.periods[h] }))
|
|
137
142
|
}
|
|
138
143
|
);
|
|
139
144
|
}
|
|
140
145
|
export {
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
+
Ge as ListBox,
|
|
147
|
+
Je as PeriodSelect,
|
|
148
|
+
Le as Select,
|
|
149
|
+
C as SelectItem,
|
|
150
|
+
Xe as SelectSection
|
|
146
151
|
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { type HTMLAttributes, type ReactNode } from 'react';
|
|
2
|
+
export interface SettingsSectionProps extends Omit<HTMLAttributes<HTMLElement>, 'title'> {
|
|
3
|
+
/** The name of the group of settings ("Notifications"). */
|
|
4
|
+
title: ReactNode;
|
|
5
|
+
/** One line under the title that says what the group is for. */
|
|
6
|
+
description?: ReactNode;
|
|
7
|
+
/** Buttons or a menu on the right of the title. */
|
|
8
|
+
actions?: ReactNode;
|
|
9
|
+
/** card (default): the rows sit in one bordered panel. plain: no panel, only lines between rows, for settings inside a Card or a Modal. */
|
|
10
|
+
appearance?: 'card' | 'plain';
|
|
11
|
+
/** Heading level of the title. Default 2. */
|
|
12
|
+
headingLevel?: 2 | 3 | 4 | 5;
|
|
13
|
+
/** The SettingRows, or any content such as a Form. */
|
|
14
|
+
children: ReactNode;
|
|
15
|
+
}
|
|
16
|
+
/** A group on a settings page: a title, a line of help and the rows below it in one panel. The region is named by its title. Rows are SettingRow. */
|
|
17
|
+
export declare function SettingsSection({ title, description, actions, appearance, headingLevel, children, className, ...props }: SettingsSectionProps): import("react").JSX.Element;
|
|
18
|
+
export interface SettingRowProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {
|
|
19
|
+
/** What the setting is ("Weekly digest"). */
|
|
20
|
+
title: ReactNode;
|
|
21
|
+
/** What it does, in a sentence. */
|
|
22
|
+
description?: ReactNode;
|
|
23
|
+
/** The id of the control, when there is one field: the title becomes its label. Leave it out for a Switch or a group and give that control its own label. */
|
|
24
|
+
htmlFor?: string;
|
|
25
|
+
/** The control: Switch, Select, Button, SegmentedControl, a field. It sits on the right and drops under the text when the section is narrow. */
|
|
26
|
+
children?: ReactNode;
|
|
27
|
+
}
|
|
28
|
+
/** One setting: the name and its help on the left, the control on the right. Stacks on narrow sections. Use inside SettingsSection. */
|
|
29
|
+
export declare function SettingRow({ title, description, htmlFor, children, className, ...props }: SettingRowProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs as l, jsx as a } from "react/jsx-runtime";
|
|
3
|
+
import { useId as o, createElement as N } from "react";
|
|
4
|
+
import { cx as g } from "../../utils/cx.js";
|
|
5
|
+
function u({ title: n, description: s, actions: t, appearance: d = "card", headingLevel: c = 2, children: r, className: e, ...i }) {
|
|
6
|
+
const m = o();
|
|
7
|
+
return /* @__PURE__ */ l("section", { ...i, "aria-labelledby": `${m}-t`, className: g("alea-settings", e), "data-appearance": d === "plain" ? "plain" : void 0, children: [
|
|
8
|
+
/* @__PURE__ */ l("div", { className: "alea-settings-head", children: [
|
|
9
|
+
/* @__PURE__ */ l("div", { className: "alea-settings-text", children: [
|
|
10
|
+
N(`h${c}`, { id: `${m}-t`, className: "alea-settings-title" }, n),
|
|
11
|
+
s && /* @__PURE__ */ a("p", { className: "alea-settings-desc", children: s })
|
|
12
|
+
] }),
|
|
13
|
+
t && /* @__PURE__ */ a("div", { className: "alea-settings-actions", children: t })
|
|
14
|
+
] }),
|
|
15
|
+
/* @__PURE__ */ a("div", { className: "alea-settings-rows", children: r })
|
|
16
|
+
] });
|
|
17
|
+
}
|
|
18
|
+
function $({ title: n, description: s, htmlFor: t, children: d, className: c, ...r }) {
|
|
19
|
+
const e = o(), i = !t;
|
|
20
|
+
return /* @__PURE__ */ l("div", { ...r, className: g("alea-setting", c), role: i ? "group" : void 0, "aria-labelledby": i ? `${e}-t` : void 0, "aria-describedby": i && s ? `${e}-d` : void 0, children: [
|
|
21
|
+
/* @__PURE__ */ l("div", { className: "alea-setting-text", children: [
|
|
22
|
+
t ? /* @__PURE__ */ a("label", { htmlFor: t, id: `${e}-t`, className: "alea-setting-title", children: n }) : /* @__PURE__ */ a("span", { id: `${e}-t`, className: "alea-setting-title", children: n }),
|
|
23
|
+
s && /* @__PURE__ */ a("span", { id: `${e}-d`, className: "alea-setting-desc", children: s })
|
|
24
|
+
] }),
|
|
25
|
+
d != null && /* @__PURE__ */ a("div", { className: "alea-setting-control", children: d })
|
|
26
|
+
] });
|
|
27
|
+
}
|
|
28
|
+
export {
|
|
29
|
+
$ as SettingRow,
|
|
30
|
+
u as SettingsSection
|
|
31
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import { type DropdownMenuProps } from '../menu/Menu.js';
|
|
3
|
+
export interface AccountMenuProps extends Omit<DropdownMenuProps<object>, 'trigger' | 'header' | 'aria-label' | 'size'> {
|
|
4
|
+
/** The person's name: the avatar's initials and the first line of the menu header. */
|
|
5
|
+
name: string;
|
|
6
|
+
/** A second line in the menu header: an email or a role. */
|
|
7
|
+
secondary?: ReactNode;
|
|
8
|
+
/** The photo. Initials show without it. */
|
|
9
|
+
src?: string;
|
|
10
|
+
/** Name of the menu button. Default "{name}, account menu". */
|
|
11
|
+
'aria-label'?: string;
|
|
12
|
+
/** Size of the button: sm 32, md 40 (default, as the other header buttons), lg 48. */
|
|
13
|
+
size?: 'sm' | 'md' | 'lg';
|
|
14
|
+
/** Called with the menu item's id. */
|
|
15
|
+
onAction?: (key: string | number) => void;
|
|
16
|
+
/** The MenuItems, MenuSections and MenuSeparators: profile, settings, sign out. */
|
|
17
|
+
children: DropdownMenuProps<object>['children'];
|
|
18
|
+
}
|
|
19
|
+
/** The avatar button at the end of a header that opens the account menu: who is signed in on top, then profile, settings and sign out. */
|
|
20
|
+
export declare const AccountMenu: import("react").ForwardRefExoticComponent<AccountMenuProps & import("react").RefAttributes<HTMLElement>>;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as a, jsxs as l } from "react/jsx-runtime";
|
|
3
|
+
import { forwardRef as x } from "react";
|
|
4
|
+
import { cx as N } from "../../utils/cx.js";
|
|
5
|
+
import { Avatar as i } from "../display/Display.js";
|
|
6
|
+
import { IconButton as b } from "../button/Button.js";
|
|
7
|
+
import { DropdownMenu as g } from "../menu/Menu.js";
|
|
8
|
+
const B = x(function({ name: c, secondary: e, src: o, "aria-label": n, size: r = "md", onAction: t, menuProps: m, placement: s = "bottom end", className: u, children: d, ...p }, f) {
|
|
9
|
+
return /* @__PURE__ */ a(
|
|
10
|
+
g,
|
|
11
|
+
{
|
|
12
|
+
...p,
|
|
13
|
+
ref: f,
|
|
14
|
+
placement: s,
|
|
15
|
+
"aria-label": n ?? `${c}, account menu`,
|
|
16
|
+
className: N("alea-account-menu", u),
|
|
17
|
+
menuProps: t ? { ...m, onAction: (h) => t(h) } : m,
|
|
18
|
+
header: /* @__PURE__ */ l("div", { className: "alea-account-head", children: [
|
|
19
|
+
/* @__PURE__ */ a(i, { name: c, src: o, size: "md" }),
|
|
20
|
+
/* @__PURE__ */ l("span", { className: "alea-account-text", children: [
|
|
21
|
+
/* @__PURE__ */ a("span", { className: "alea-account-name", children: c }),
|
|
22
|
+
e && /* @__PURE__ */ a("span", { className: "alea-account-secondary", children: e })
|
|
23
|
+
] })
|
|
24
|
+
] }),
|
|
25
|
+
trigger: /* @__PURE__ */ a(b, { size: r, "aria-label": n ?? `${c}, account menu`, children: /* @__PURE__ */ a(i, { name: c, src: o, size: r === "lg" ? "md" : "sm" }) }),
|
|
26
|
+
children: d
|
|
27
|
+
}
|
|
28
|
+
);
|
|
29
|
+
});
|
|
30
|
+
export {
|
|
31
|
+
B as AccountMenu
|
|
32
|
+
};
|
|
@@ -3,7 +3,7 @@ import { type LinkProps } from 'react-aria-components';
|
|
|
3
3
|
export interface AppShellProps {
|
|
4
4
|
/** Logo or product name, top left. */
|
|
5
5
|
brand?: ReactNode;
|
|
6
|
-
/** Things on the right of the header: search, theme toggle, avatar. */
|
|
6
|
+
/** Things on the right of the header: search, theme toggle, avatar. They wrap onto a second row when the width or the text size does not leave room, so the page never scrolls sideways. */
|
|
7
7
|
headerEnd?: ReactNode;
|
|
8
8
|
/** The side navigation (a SidebarNav). On small screens it moves into a drawer. */
|
|
9
9
|
sidebar?: ReactNode;
|
|
@@ -17,11 +17,18 @@ export interface AppShellProps {
|
|
|
17
17
|
/** header (default): a bar across the top, the sidebar under it. sidebar: a web app layout, the sidebar full height
|
|
18
18
|
* (put the brand in it, e.g. with AppSidebar and WorkspaceSwitcher) and the page in an inset panel whose top bar holds headerEnd. */
|
|
19
19
|
layout?: 'header' | 'sidebar';
|
|
20
|
+
/** Limits and centers the page content: sm 640, md 768, lg 1024, xl 1280 (the same widths as Container, without extra gutters) or full. Default full: the content fills the area. */
|
|
21
|
+
contentSize?: 'sm' | 'md' | 'lg' | 'xl' | 'full';
|
|
22
|
+
/** The built-in "Skip to content" link. false removes it (the app brings its own, so there are not two); an object sets another target id (without #) and text. Default: on, to the shell's own main element. */
|
|
23
|
+
skipLink?: false | {
|
|
24
|
+
target?: string;
|
|
25
|
+
label?: ReactNode;
|
|
26
|
+
};
|
|
20
27
|
/** Extra class names for the root element. */
|
|
21
28
|
className?: string;
|
|
22
29
|
}
|
|
23
30
|
/** The app frame: sticky header, sidebar, scrollable content and a skip link. */
|
|
24
|
-
export declare function AppShell({ brand, headerEnd, sidebar, children, sidebarWidth, collapseBelow, mainAs, layout, className }: AppShellProps): import("react").JSX.Element;
|
|
31
|
+
export declare function AppShell({ brand, headerEnd, sidebar, children, sidebarWidth, collapseBelow, mainAs, layout, contentSize, skipLink, className }: AppShellProps): import("react").JSX.Element;
|
|
25
32
|
export interface SidebarNavProps {
|
|
26
33
|
children: ReactNode;
|
|
27
34
|
/** Name of the navigation. Default "Sidebar". */
|
|
@@ -1,56 +1,56 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as
|
|
3
|
-
import { useState as
|
|
4
|
-
import { Link as
|
|
5
|
-
import { Menu as
|
|
6
|
-
import { cx as
|
|
7
|
-
import { useMediaQuery as
|
|
8
|
-
import { IconButton as
|
|
9
|
-
import { Drawer as
|
|
10
|
-
import { Dialog as
|
|
11
|
-
import { useStrings as
|
|
12
|
-
import { SkipLink as
|
|
13
|
-
function
|
|
14
|
-
const
|
|
15
|
-
e && /* @__PURE__ */ a(
|
|
2
|
+
import { jsxs as t, jsx as a, Fragment as w } from "react/jsx-runtime";
|
|
3
|
+
import { useState as y, forwardRef as M } from "react";
|
|
4
|
+
import { Link as O } from "react-aria-components";
|
|
5
|
+
import { Menu as j } from "lucide-react";
|
|
6
|
+
import { cx as u, withBase as D } from "../../utils/cx.js";
|
|
7
|
+
import { useMediaQuery as G } from "../layout/Responsive.js";
|
|
8
|
+
import { IconButton as I } from "../button/Button.js";
|
|
9
|
+
import { Drawer as $ } from "../overlay/Drawer.js";
|
|
10
|
+
import { Dialog as A } from "../overlay/Overlay.js";
|
|
11
|
+
import { useStrings as N } from "../../i18n/strings.js";
|
|
12
|
+
import { SkipLink as F } from "../more/More.js";
|
|
13
|
+
function V({ brand: s, headerEnd: l, sidebar: e, children: r, sidebarWidth: d = 248, collapseBelow: n = 900, mainAs: c = "main", layout: o = "header", contentSize: m, skipLink: i, className: g }) {
|
|
14
|
+
const p = N(), b = c, [x, h] = y(!1), S = G(`(max-width: ${n - 0.02}px)`), f = /* @__PURE__ */ t("header", { className: "alea-shell-header", children: [
|
|
15
|
+
e && /* @__PURE__ */ a(I, { "aria-label": p.openNavigation, className: "alea-shell-menu", onPress: () => h(!0), children: /* @__PURE__ */ a(j, {}) }),
|
|
16
16
|
s && /* @__PURE__ */ a("div", { className: "alea-shell-brand", children: s }),
|
|
17
17
|
l && /* @__PURE__ */ a("div", { className: "alea-shell-end", children: l })
|
|
18
|
-
] }),
|
|
19
|
-
return /* @__PURE__ */
|
|
20
|
-
/* @__PURE__ */ a(
|
|
21
|
-
|
|
22
|
-
/* @__PURE__ */
|
|
18
|
+
] }), v = /* @__PURE__ */ a(b, { id: "alea-main", className: "alea-shell-main", tabIndex: -1, children: m && m !== "full" ? /* @__PURE__ */ a("div", { className: "alea-shell-content", "data-size": m, children: r }) : r });
|
|
19
|
+
return /* @__PURE__ */ t("div", { className: u("alea-shell", g), style: { "--alea-shell-sidebar": `${d}px` }, "data-layout": o, "data-collapse": n, "data-collapsed": S || void 0, "data-custom-collapse": n !== 900 || void 0, children: [
|
|
20
|
+
i !== !1 && /* @__PURE__ */ a(F, { target: (i == null ? void 0 : i.target) ?? "alea-main", children: i == null ? void 0 : i.label }),
|
|
21
|
+
o === "header" && f,
|
|
22
|
+
/* @__PURE__ */ t("div", { className: "alea-shell-body", children: [
|
|
23
23
|
e && /* @__PURE__ */ a("aside", { className: "alea-shell-sidebar", children: e }),
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
] }) :
|
|
24
|
+
o === "sidebar" ? /* @__PURE__ */ t("div", { className: "alea-shell-panel", children: [
|
|
25
|
+
f,
|
|
26
|
+
v
|
|
27
|
+
] }) : v
|
|
28
28
|
] }),
|
|
29
|
-
e && /* @__PURE__ */ a(
|
|
30
|
-
|
|
29
|
+
e && /* @__PURE__ */ a($, { isOpen: x, onOpenChange: h, placement: "start", size: 300, children: /* @__PURE__ */ a(A, { "aria-label": p.navigation, hideClose: !0, className: "alea-shell-drawer", children: () => /* @__PURE__ */ a("div", { onClickCapture: (C) => {
|
|
30
|
+
C.target.closest("a") && h(!1);
|
|
31
31
|
}, children: e }) }) })
|
|
32
32
|
] });
|
|
33
33
|
}
|
|
34
|
-
function
|
|
35
|
-
const
|
|
36
|
-
return e ?? (e =
|
|
34
|
+
function W({ children: s, className: l, "aria-label": e }) {
|
|
35
|
+
const r = N();
|
|
36
|
+
return e ?? (e = r.mainNav), /* @__PURE__ */ a("nav", { "aria-label": e, className: u("alea-sidenav", l), children: s });
|
|
37
37
|
}
|
|
38
|
-
const
|
|
39
|
-
return /* @__PURE__ */
|
|
38
|
+
const X = M(function({ title: l, children: e, className: r, ...d }, n) {
|
|
39
|
+
return /* @__PURE__ */ t("div", { ref: n, ...d, className: u("alea-sidenav-group", r), children: [
|
|
40
40
|
l && /* @__PURE__ */ a("p", { className: "alea-sidenav-title", children: l }),
|
|
41
41
|
/* @__PURE__ */ a("ul", { children: e })
|
|
42
42
|
] });
|
|
43
43
|
});
|
|
44
|
-
function
|
|
45
|
-
return /* @__PURE__ */ a("li", { children: /* @__PURE__ */ a(
|
|
44
|
+
function Y({ isCurrent: s, icon: l, end: e, children: r, className: d, ...n }) {
|
|
45
|
+
return /* @__PURE__ */ a("li", { children: /* @__PURE__ */ a(O, { ...n, "aria-current": s ? "page" : void 0, className: D("alea-sidenav-link alea-focus-ring", d), children: (c) => /* @__PURE__ */ t(w, { children: [
|
|
46
46
|
l && /* @__PURE__ */ a("span", { className: "alea-sidenav-icon", "aria-hidden": "true", children: l }),
|
|
47
|
-
/* @__PURE__ */ a("span", { className: "alea-sidenav-label", children: typeof
|
|
47
|
+
/* @__PURE__ */ a("span", { className: "alea-sidenav-label", children: typeof r == "function" ? r(c) : r }),
|
|
48
48
|
e && /* @__PURE__ */ a("span", { className: "alea-sidenav-end", children: e })
|
|
49
49
|
] }) }) });
|
|
50
50
|
}
|
|
51
51
|
export {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
52
|
+
V as AppShell,
|
|
53
|
+
X as SidebarGroup,
|
|
54
|
+
Y as SidebarLink,
|
|
55
|
+
W as SidebarNav
|
|
56
56
|
};
|
|
@@ -9,10 +9,14 @@ export interface AppSidebarProps {
|
|
|
9
9
|
footer?: ReactNode;
|
|
10
10
|
/** Name of the navigation. Default "Sidebar". */
|
|
11
11
|
'aria-label'?: string;
|
|
12
|
+
/** Icon-only mode: links show just their icon with the label in a tooltip, section titles hide and every section stays open. Give links an icon, the workspace switcher a logo, and set AppShell `sidebarWidth` to about 64 while collapsed. The labels stay available to screen readers. Default false. */
|
|
13
|
+
collapsed?: boolean;
|
|
14
|
+
/** md (default): 32 px links. touch: 44 px links for touch screens. */
|
|
15
|
+
size?: 'md' | 'touch';
|
|
12
16
|
className?: string;
|
|
13
17
|
}
|
|
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
|
-
export declare function AppSidebar({ header, children, footer, className, 'aria-label': label }: AppSidebarProps): import("react").JSX.Element;
|
|
18
|
+
/** The side navigation of a web app: a workspace switcher on top, compact links, sections that fold. Pair it with AppShell layout="sidebar". Can collapse to icons and offers a 44 px touch size. */
|
|
19
|
+
export declare function AppSidebar({ header, children, footer, className, collapsed, size, 'aria-label': label }: AppSidebarProps): import("react").JSX.Element;
|
|
16
20
|
export interface WorkspaceSwitcherProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children'> {
|
|
17
21
|
/** The workspace or product name. */
|
|
18
22
|
name: ReactNode;
|
|
@@ -40,8 +44,10 @@ export interface AppNavSectionProps extends Omit<HTMLAttributes<HTMLDivElement>,
|
|
|
40
44
|
defaultExpanded?: boolean;
|
|
41
45
|
/** Something on the right of the title: an add button. */
|
|
42
46
|
action?: ReactNode;
|
|
47
|
+
/** default: a small muted title. eyebrow: small capitals with more weight, to tell the groups apart at a glance. */
|
|
48
|
+
appearance?: 'default' | 'eyebrow';
|
|
43
49
|
}
|
|
44
|
-
/** A group of links in the AppSidebar; with a title it folds. */
|
|
50
|
+
/** A group of links in the AppSidebar; with a title it folds, unless collapsible is false: then the title is a plain label. */
|
|
45
51
|
export declare const AppNavSection: import("react").ForwardRefExoticComponent<AppNavSectionProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
46
52
|
export interface AppNavItemProps extends LinkProps {
|
|
47
53
|
/** Marks the current page (aria-current). */
|