@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.
- 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 +76 -52
- package/dist/components/data/Data.d.ts +6 -4
- package/dist/components/data/Data.js +66 -56
- 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.js +27 -27
- package/dist/components/more/More.d.ts +2 -2
- package/dist/components/more/More.js +46 -45
- package/dist/components/navigation/Navigation.d.ts +7 -5
- package/dist/components/navigation/Navigation.js +91 -74
- package/dist/components/navigation/Navigation2.d.ts +9 -3
- package/dist/components/navigation/Navigation2.js +209 -195
- 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 +10 -1
- package/dist/components/overlay/Overlay.js +54 -52
- package/dist/components/overlay/Sheet.d.ts +2 -0
- package/dist/components/overlay/Sheet.js +30 -30
- package/dist/components/page/PageParts.js +20 -20
- 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/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 +36 -20
- 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 +7 -0
- package/dist/i18n/strings.js +14 -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
|
@@ -5,10 +5,12 @@ export interface FormProps extends Omit<RACFormProps, 'onSubmit'> {
|
|
|
5
5
|
onSubmit?: (values: Record<string, FormDataEntryValue>, event: FormEvent<HTMLFormElement>) => void | Record<string, string | string[]> | Promise<void | Record<string, string | string[]>>;
|
|
6
6
|
/** Space between fields. Default 20 px; it lands on the nearest space step, so it follows the density. */
|
|
7
7
|
gap?: number;
|
|
8
|
+
/** After the server returns field errors, moves focus to the first field marked invalid (inputs, pickers, date fields). Default true. Fields that fail validation before submit already take focus on their own. */
|
|
9
|
+
focusInvalid?: boolean;
|
|
8
10
|
children: ReactNode;
|
|
9
11
|
}
|
|
10
12
|
/** A form that validates on submit, moves focus to the first problem, and shows server errors on their fields. */
|
|
11
|
-
export declare function Form({ onSubmit, gap, children, className, validationBehavior, style, ...props }: FormProps): import("react").JSX.Element;
|
|
13
|
+
export declare function Form({ onSubmit, gap, focusInvalid, children, className, validationBehavior, style, ...props }: FormProps): import("react").JSX.Element;
|
|
12
14
|
export interface FormActionsProps extends HTMLAttributes<HTMLDivElement> {
|
|
13
15
|
/** The submit button text. Default "Save". */
|
|
14
16
|
submitLabel?: ReactNode;
|
|
@@ -18,8 +20,12 @@ export interface FormActionsProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
18
20
|
isLoading?: boolean;
|
|
19
21
|
/** start (default), end, or stretch for full-width buttons. */
|
|
20
22
|
align?: 'start' | 'end' | 'stretch';
|
|
23
|
+
/** A destructive action (Delete) kept apart at the start; the secondary and submit buttons sit at the end. Use it with Modal and Drawer footers. */
|
|
24
|
+
destructive?: ReactNode;
|
|
25
|
+
/** The id of the form the submit button belongs to. Set it when the actions sit outside the form element, as in a pinned modal or drawer footer. */
|
|
26
|
+
form?: string;
|
|
21
27
|
}
|
|
22
|
-
/** The buttons at the end of a form. */
|
|
28
|
+
/** The buttons at the end of a form: a submit button, an optional secondary one and an optional destructive one kept apart at the start. They wrap onto a new line when the width or the text size does not leave room. */
|
|
23
29
|
export declare const FormActions: import("react").ForwardRefExoticComponent<FormActionsProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
24
30
|
/** A summary of what to fix, at the top of a long form, with links to the fields. */
|
|
25
31
|
export interface ErrorSummaryProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {
|
|
@@ -1,53 +1,66 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as
|
|
3
|
-
import { forwardRef as
|
|
4
|
-
import { Form as
|
|
5
|
-
import { cx as
|
|
6
|
-
import { spaceFromPx as
|
|
7
|
-
import { Alert as
|
|
8
|
-
import { Button as
|
|
9
|
-
import { useStrings as
|
|
10
|
-
function
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
2
|
+
import { jsx as a, jsxs as S } from "react/jsx-runtime";
|
|
3
|
+
import { forwardRef as E, useState as v, useRef as b, useEffect as j } from "react";
|
|
4
|
+
import { Form as N } from "react-aria-components";
|
|
5
|
+
import { cx as F } from "../../utils/cx.js";
|
|
6
|
+
import { spaceFromPx as w } from "../../utils/space.js";
|
|
7
|
+
import { Alert as A } from "../feedback/Feedback.js";
|
|
8
|
+
import { Button as O } from "../button/Button.js";
|
|
9
|
+
import { useStrings as g } from "../../i18n/strings.js";
|
|
10
|
+
function T(e) {
|
|
11
|
+
var t;
|
|
12
|
+
if (!e) return;
|
|
13
|
+
const r = e.querySelector('[aria-invalid="true"]:not([disabled]):not([type="hidden"])');
|
|
14
|
+
if (r) {
|
|
15
|
+
r.focus();
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
(t = e.querySelector('[data-invalid] :is(input, button, [tabindex="0"]):not([disabled]):not([type="hidden"])')) == null || t.focus();
|
|
19
|
+
}
|
|
20
|
+
function P({ onSubmit: e, gap: r = 20, focusInvalid: t = !0, children: u, className: s, validationBehavior: n = "native", style: i, ...o }) {
|
|
21
|
+
const [c, m] = v({}), [l, y] = v(!1), h = b(null), d = b(!1);
|
|
22
|
+
return j(() => {
|
|
23
|
+
d.current && (d.current = !1, T(h.current));
|
|
24
|
+
}, [c]), /* @__PURE__ */ a(
|
|
25
|
+
N,
|
|
14
26
|
{
|
|
15
|
-
...
|
|
16
|
-
validationBehavior:
|
|
17
|
-
validationErrors: { ...
|
|
18
|
-
className:
|
|
19
|
-
style: { gap:
|
|
20
|
-
"data-busy":
|
|
21
|
-
"aria-busy":
|
|
22
|
-
onSubmit: async (
|
|
23
|
-
if (
|
|
24
|
-
const
|
|
25
|
-
|
|
27
|
+
...o,
|
|
28
|
+
validationBehavior: n,
|
|
29
|
+
validationErrors: { ...c, ...o.validationErrors || {} },
|
|
30
|
+
className: F("alea-form", s),
|
|
31
|
+
style: { gap: w(r), ...i },
|
|
32
|
+
"data-busy": l || void 0,
|
|
33
|
+
"aria-busy": l || void 0,
|
|
34
|
+
onSubmit: async (f) => {
|
|
35
|
+
if (f.preventDefault(), !e) return;
|
|
36
|
+
const x = Object.fromEntries(new FormData(f.currentTarget));
|
|
37
|
+
y(!0), h.current = f.currentTarget;
|
|
26
38
|
try {
|
|
27
|
-
const
|
|
28
|
-
m(
|
|
39
|
+
const p = await e(x, f);
|
|
40
|
+
d.current = t && !!p && Object.keys(p).length > 0, m(p || {});
|
|
29
41
|
} finally {
|
|
30
|
-
|
|
42
|
+
y(!1);
|
|
31
43
|
}
|
|
32
44
|
},
|
|
33
|
-
children:
|
|
45
|
+
children: u
|
|
34
46
|
}
|
|
35
47
|
);
|
|
36
48
|
}
|
|
37
|
-
const
|
|
38
|
-
const
|
|
39
|
-
return
|
|
40
|
-
|
|
41
|
-
|
|
49
|
+
const W = E(function({ submitLabel: r, secondary: t, isLoading: u, align: s = "start", destructive: n, form: i, className: o, ...c }, m) {
|
|
50
|
+
const l = g();
|
|
51
|
+
return r ?? (r = l.save), /* @__PURE__ */ S("div", { ref: m, ...c, className: F("alea-form-actions", o), "data-align": n ? "end" : s, "data-split": n ? !0 : void 0, children: [
|
|
52
|
+
n && /* @__PURE__ */ a("span", { className: "alea-form-actions-start", children: n }),
|
|
53
|
+
t,
|
|
54
|
+
/* @__PURE__ */ a(O, { type: "submit", form: i, isLoading: u, fullWidth: s === "stretch", children: r })
|
|
42
55
|
] });
|
|
43
|
-
}),
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
const
|
|
47
|
-
return
|
|
56
|
+
}), z = E(function({ errors: r, title: t, ...u }, s) {
|
|
57
|
+
const n = g();
|
|
58
|
+
t ?? (t = n.fixToContinue);
|
|
59
|
+
const i = Object.entries(r);
|
|
60
|
+
return i.length ? /* @__PURE__ */ a(A, { ref: s, ...u, tone: "danger", title: t, live: !0, children: /* @__PURE__ */ a("ul", { className: "alea-error-summary", children: i.map(([o, c]) => /* @__PURE__ */ a("li", { children: /* @__PURE__ */ a("a", { href: `#${o}`, children: c }) }, o)) }) }) : null;
|
|
48
61
|
});
|
|
49
62
|
export {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
63
|
+
z as ErrorSummary,
|
|
64
|
+
P as Form,
|
|
65
|
+
W as FormActions
|
|
53
66
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { IconComponent } from './Icon.js';
|
|
2
|
-
/** The
|
|
3
|
-
export declare const ICON_NAMES: readonly ["search", "x", "check", "chevron-down", "chevron-up", "chevron-left", "chevron-right", "chevrons-left", "chevrons-right", "arrow-left", "arrow-right", "arrow-up", "arrow-down", "arrow-up-right", "plus", "minus", "ellipsis", "ellipsis-vertical", "menu", "grip-vertical", "more-horizontal", "house", "settings", "user", "users", "bell", "mail", "message-square", "calendar", "clock", "star", "heart", "bookmark", "share-2", "link-2", "external-link", "eye", "eye-off", "lock", "lock-open", "key", "shield", "shield-check", "log-in", "log-out", "info", "circle-alert", "circle-check", "circle-x", "triangle-alert", "circle-help", "ban", "trash-2", "pencil", "copy", "clipboard", "download", "upload", "file", "file-text", "folder", "image", "paperclip", "save", "printer", "filter", "sliders-horizontal", "list", "list-ordered", "layout-grid", "table-2", "columns-3", "kanban", "sun", "moon", "monitor", "smartphone", "tablet", "laptop", "bold", "italic", "underline", "strikethrough", "code", "heading-2", "quote", "align-left", "align-center", "align-right", "link", "play", "pause", "skip-forward", "volume-2", "mic", "camera", "video", "refresh-cw", "rotate-ccw", "loader-circle", "zoom-in", "zoom-out", "maximize-2", "minimize-2", "move", "map-pin", "globe", "compass", "navigation", "shopping-cart", "shopping-bag", "credit-card", "wallet", "tag", "gift", "package", "truck", "chart-line", "chart-bar", "chart-pie", "trending-up", "trending-down", "activity", "gauge", "palette", "paintbrush", "type", "contrast", "swatch-book", "pipette", "layers", "component", "frame", "figma", "github", "sparkles", "zap", "rocket", "flag", "award", "trophy", "target", "lightbulb", "thumbs-up", "thumbs-down", "smile", "frown", "inbox", "send", "archive", "reply", "circle", "square", "triangle", "hexagon", "dot", "cloud", "wifi", "battery", "cpu", "database", "server", "hard-drive", "terminal", "book-open", "graduation-cap", "briefcase", "building-2", "phone", "qr-code", "scan-line", "toggle-left", "toggle-right", "ruler", "snowflake", "arrow-down-left", "store", "cloud-upload", "handshake", "layout-list", "leaf", "life-buoy", "newspaper", "piggy-bank"];
|
|
2
|
+
/** The 185 glyphs of the kit, by the kebab-case name of Icon/<name> in Figma (lucide's own name). */
|
|
3
|
+
export declare const ICON_NAMES: readonly ["search", "x", "check", "chevron-down", "chevron-up", "chevron-left", "chevron-right", "chevrons-left", "chevrons-right", "arrow-left", "arrow-right", "arrow-up", "arrow-down", "arrow-up-right", "plus", "minus", "ellipsis", "ellipsis-vertical", "menu", "grip-vertical", "more-horizontal", "house", "settings", "user", "users", "bell", "mail", "message-square", "calendar", "clock", "star", "heart", "bookmark", "share-2", "link-2", "external-link", "eye", "eye-off", "lock", "lock-open", "key", "shield", "shield-check", "log-in", "log-out", "info", "circle-alert", "circle-check", "circle-x", "triangle-alert", "circle-help", "ban", "trash-2", "pencil", "copy", "clipboard", "download", "upload", "file", "file-text", "folder", "image", "paperclip", "save", "printer", "filter", "sliders-horizontal", "list", "list-ordered", "layout-grid", "table-2", "columns-3", "kanban", "sun", "moon", "monitor", "smartphone", "tablet", "laptop", "bold", "italic", "underline", "strikethrough", "code", "heading-2", "quote", "align-left", "align-center", "align-right", "link", "play", "pause", "skip-forward", "volume-2", "mic", "camera", "video", "refresh-cw", "rotate-ccw", "loader-circle", "zoom-in", "zoom-out", "maximize-2", "minimize-2", "move", "map-pin", "globe", "compass", "navigation", "shopping-cart", "shopping-bag", "credit-card", "wallet", "tag", "gift", "package", "truck", "chart-line", "chart-bar", "chart-pie", "trending-up", "trending-down", "activity", "gauge", "palette", "paintbrush", "type", "contrast", "swatch-book", "pipette", "layers", "component", "frame", "figma", "github", "sparkles", "zap", "rocket", "flag", "award", "trophy", "target", "lightbulb", "thumbs-up", "thumbs-down", "smile", "frown", "inbox", "send", "archive", "reply", "circle", "square", "triangle", "hexagon", "dot", "cloud", "wifi", "battery", "cpu", "database", "server", "hard-drive", "terminal", "book-open", "graduation-cap", "briefcase", "building-2", "phone", "qr-code", "scan-line", "toggle-left", "toggle-right", "ruler", "snowflake", "arrow-down-left", "store", "cloud-upload", "handshake", "layout-list", "leaf", "life-buoy", "newspaper", "piggy-bank", "check-check"];
|
|
4
4
|
export type IconName = typeof ICON_NAMES[number];
|
|
5
5
|
/** One dynamic import per glyph: nothing of a glyph is bundled or fetched until an Icon with that name (or preloadIcons) asks for it. */
|
|
6
6
|
export declare const ICON_LOADERS: Record<IconName, () => Promise<{
|
|
@@ -183,7 +183,8 @@ const r = [
|
|
|
183
183
|
"leaf",
|
|
184
184
|
"life-buoy",
|
|
185
185
|
"newspaper",
|
|
186
|
-
"piggy-bank"
|
|
186
|
+
"piggy-bank",
|
|
187
|
+
"check-check"
|
|
187
188
|
], i = {
|
|
188
189
|
search: () => import("lucide-react/dist/esm/icons/search.js"),
|
|
189
190
|
x: () => import("lucide-react/dist/esm/icons/x.js"),
|
|
@@ -368,7 +369,8 @@ const r = [
|
|
|
368
369
|
leaf: () => import("lucide-react/dist/esm/icons/leaf.js"),
|
|
369
370
|
"life-buoy": () => import("lucide-react/dist/esm/icons/life-buoy.js"),
|
|
370
371
|
newspaper: () => import("lucide-react/dist/esm/icons/newspaper.js"),
|
|
371
|
-
"piggy-bank": () => import("lucide-react/dist/esm/icons/piggy-bank.js")
|
|
372
|
+
"piggy-bank": () => import("lucide-react/dist/esm/icons/piggy-bank.js"),
|
|
373
|
+
"check-check": () => import("lucide-react/dist/esm/icons/check-check.js")
|
|
372
374
|
};
|
|
373
375
|
export {
|
|
374
376
|
i as ICON_LOADERS,
|
|
@@ -18,9 +18,11 @@ export interface ListViewProps<T extends object> extends GridListProps<T>, Surfa
|
|
|
18
18
|
onItemsChange?: (items: T[]) => void;
|
|
19
19
|
/** Lists with the same dragGroup accept each other's rows. Items must be plain data (they travel as JSON). */
|
|
20
20
|
dragGroup?: string;
|
|
21
|
+
/** Rows added to `items` rise in (staggered), and rows removed dissolve and give their space back before they leave. Needs items with an id. The removed row is disabled while it leaves. Off by default; reduced motion keeps only the fades. */
|
|
22
|
+
animateRows?: boolean;
|
|
21
23
|
}
|
|
22
24
|
/** A list of rich items people can select, open or act on, with keyboard navigation. Rows can be dragged to reorder, or between lists; cards can sit in a grid. */
|
|
23
|
-
export declare function ListView<T extends object>({ variant, layout, onItemsChange, dragGroup, items, surface, radius, className, ...props }: ListViewProps<T>): import("react").JSX.Element;
|
|
25
|
+
export declare function ListView<T extends object>({ variant, layout, onItemsChange, dragGroup, animateRows, items: itemsIn, surface, radius, className, children: childrenIn, dependencies: depsIn, ...props }: ListViewProps<T>): import("react").JSX.Element;
|
|
24
26
|
/** The line that shows where a dragged row will land. Use it in renderDropIndicator of your own drag and drop. */
|
|
25
27
|
export declare function DropIndicator(props: DropIndicatorProps): import("react").JSX.Element;
|
|
26
28
|
/** The handle that starts a drag with the keyboard (Enter) or a screen reader. Put it in rows of a draggable list or table. */
|
|
@@ -37,6 +39,8 @@ export interface ListItemProps extends Omit<GridListItemProps, 'children'> {
|
|
|
37
39
|
start?: ReactNode;
|
|
38
40
|
/** Actions or meta on the right (buttons stay reachable with Tab and arrows). */
|
|
39
41
|
end?: ReactNode;
|
|
42
|
+
/** Keep the title on one line with an ellipsis. By default the title wraps, so large text and narrow screens never hide it, and the end slot moves under the text when there is no room. */
|
|
43
|
+
truncate?: boolean;
|
|
40
44
|
}
|
|
41
45
|
/** One item of a ListView. */
|
|
42
|
-
export declare function ListItem({ children, description, start, end, className, textValue, ...props }: ListItemProps): import("react").JSX.Element;
|
|
46
|
+
export declare function ListItem({ children, description, start, end, truncate, className, textValue, ...props }: ListItemProps): import("react").JSX.Element;
|
|
@@ -1,82 +1,85 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as
|
|
3
|
-
import { Button as
|
|
4
|
-
import { isTextDropItem as
|
|
5
|
-
import { GripVertical as
|
|
6
|
-
import { cx as
|
|
7
|
-
import { useStrings as
|
|
8
|
-
import { surfaceAttrs as
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
2
|
+
import { jsx as i, jsxs as y, Fragment as P } from "react/jsx-runtime";
|
|
3
|
+
import { Button as V, DropIndicator as j, GridListItem as H, Checkbox as J, useDragAndDrop as R, isTextDropItem as w, GridList as z } from "react-aria-components";
|
|
4
|
+
import { isTextDropItem as ee, useAsyncList as ae, useDragAndDrop as re, useListData as ie, useTreeData as te } from "react-aria-components";
|
|
5
|
+
import { GripVertical as B, Check as $ } from "lucide-react";
|
|
6
|
+
import { cx as A, withBase as T } from "../../utils/cx.js";
|
|
7
|
+
import { useStrings as g } from "../../i18n/strings.js";
|
|
8
|
+
import { surfaceAttrs as E } from "../surface/Surface.js";
|
|
9
|
+
import { useAnimatedRows as F } from "../../utils/animateRows.js";
|
|
10
|
+
function M(r, t, a) {
|
|
11
|
+
const s = r.filter((c) => t.includes(c.id)), o = r.filter((c) => !t.includes(c.id));
|
|
12
|
+
let l = o.findIndex((c) => c.id === a.key);
|
|
13
|
+
return l < 0 ? r : (a.dropPosition === "after" && (l += 1), [...o.slice(0, l), ...s, ...o.slice(l)]);
|
|
13
14
|
}
|
|
14
|
-
function
|
|
15
|
-
const
|
|
16
|
-
getItems: (
|
|
17
|
-
const p =
|
|
18
|
-
return { "text/plain":
|
|
15
|
+
function _({ variant: r = "joined", layout: t = "stack", onItemsChange: a, dragGroup: s, animateRows: o, items: l, surface: c, radius: D, className: N, children: k, dependencies: u, ...b }) {
|
|
16
|
+
const m = F(l, k, o), L = m.items, d = l ? [...l] : [], x = s ? `application/x-alea-${s}` : "application/x-alea-list", O = (e) => String((e == null ? void 0 : e.textValue) ?? (e == null ? void 0 : e.label) ?? (e == null ? void 0 : e.name) ?? (e == null ? void 0 : e.title) ?? (e == null ? void 0 : e.id) ?? ""), { dragAndDropHooks: S } = R({
|
|
17
|
+
getItems: (e) => [...e].map((n) => {
|
|
18
|
+
const p = d.find((f) => f.id === n);
|
|
19
|
+
return { "text/plain": O(p), [x]: JSON.stringify(p) };
|
|
19
20
|
}),
|
|
20
|
-
acceptedDragTypes: [
|
|
21
|
+
acceptedDragTypes: [x],
|
|
21
22
|
getDropOperation: () => "move",
|
|
22
|
-
onReorder: (
|
|
23
|
-
onInsert: s ? async (
|
|
24
|
-
const n = await Promise.all(
|
|
25
|
-
let f =
|
|
26
|
-
p.dropPosition === "after" && (f += 1),
|
|
23
|
+
onReorder: (e) => a == null ? void 0 : a(M(d, [...e.keys], e.target)),
|
|
24
|
+
onInsert: s ? async (e) => {
|
|
25
|
+
const n = await Promise.all(e.items.filter(w).map(async (v) => JSON.parse(await v.getText(x)))), p = e.target;
|
|
26
|
+
let f = d.findIndex((v) => v.id === p.key);
|
|
27
|
+
p.dropPosition === "after" && (f += 1), a == null || a([...d.slice(0, f), ...n, ...d.slice(f)]);
|
|
27
28
|
} : void 0,
|
|
28
|
-
onRootDrop: s ? async (
|
|
29
|
-
const n = await Promise.all(
|
|
30
|
-
|
|
29
|
+
onRootDrop: s ? async (e) => {
|
|
30
|
+
const n = await Promise.all(e.items.filter(w).map(async (p) => JSON.parse(await p.getText(x))));
|
|
31
|
+
a == null || a([...d, ...n]);
|
|
31
32
|
} : void 0,
|
|
32
|
-
onDragEnd: s ? (
|
|
33
|
-
|
|
33
|
+
onDragEnd: s ? (e) => {
|
|
34
|
+
e.dropOperation === "move" && !e.isInternal && (a == null || a(d.filter((n) => !e.keys.has(n.id))));
|
|
34
35
|
} : void 0,
|
|
35
|
-
renderDropIndicator: (
|
|
36
|
+
renderDropIndicator: (e) => /* @__PURE__ */ i(W, { target: e })
|
|
36
37
|
});
|
|
37
|
-
return /* @__PURE__ */
|
|
38
|
-
|
|
38
|
+
return /* @__PURE__ */ i(
|
|
39
|
+
z,
|
|
39
40
|
{
|
|
40
|
-
...
|
|
41
|
-
items:
|
|
42
|
-
layout:
|
|
43
|
-
|
|
41
|
+
...b,
|
|
42
|
+
items: L,
|
|
43
|
+
layout: t,
|
|
44
|
+
dependencies: m.dependencies ? [...u ?? [], ...m.dependencies] : u,
|
|
45
|
+
dragAndDropHooks: a ? S : void 0,
|
|
44
46
|
"data-variant": r,
|
|
45
|
-
"data-layout":
|
|
46
|
-
...
|
|
47
|
-
"data-draggable":
|
|
48
|
-
className:
|
|
47
|
+
"data-layout": t,
|
|
48
|
+
...E({ surface: c, radius: D }),
|
|
49
|
+
"data-draggable": a ? !0 : void 0,
|
|
50
|
+
className: T("alea-list", N),
|
|
51
|
+
children: m.children
|
|
49
52
|
}
|
|
50
53
|
);
|
|
51
54
|
}
|
|
52
|
-
function
|
|
53
|
-
return /* @__PURE__ */
|
|
55
|
+
function W(r) {
|
|
56
|
+
return /* @__PURE__ */ i(j, { ...r, className: A("alea-drop-indicator", r.className) });
|
|
54
57
|
}
|
|
55
|
-
function
|
|
56
|
-
const
|
|
57
|
-
return /* @__PURE__ */
|
|
58
|
+
function h({ label: r, className: t }) {
|
|
59
|
+
const a = g();
|
|
60
|
+
return /* @__PURE__ */ i(V, { slot: "drag", className: A("alea-drag-handle alea-focus-ring", t), "aria-label": r ?? a.dragToMove, children: /* @__PURE__ */ i(B, { size: 16, "aria-hidden": "true" }) });
|
|
58
61
|
}
|
|
59
|
-
function
|
|
60
|
-
return /* @__PURE__ */
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
/* @__PURE__ */
|
|
65
|
-
/* @__PURE__ */
|
|
66
|
-
|
|
62
|
+
function G({ children: r, description: t, start: a, end: s, truncate: o, className: l, textValue: c, ...D }) {
|
|
63
|
+
return /* @__PURE__ */ i(H, { ...D, textValue: c ?? (typeof r == "string" ? r : void 0), className: T("alea-list-item", l), children: ({ selectionMode: N, selectionBehavior: k, allowsDragging: u }) => /* @__PURE__ */ y(P, { children: [
|
|
64
|
+
u && /* @__PURE__ */ i(h, {}),
|
|
65
|
+
N !== "none" && k === "toggle" && /* @__PURE__ */ i(J, { slot: "selection", className: "alea-check alea-table-check", children: /* @__PURE__ */ i("span", { className: "alea-check-box", "aria-hidden": "true", children: /* @__PURE__ */ i($, { size: 14, strokeWidth: 3 }) }) }),
|
|
66
|
+
a && /* @__PURE__ */ i("span", { className: "alea-list-start", children: a }),
|
|
67
|
+
/* @__PURE__ */ y("span", { className: "alea-list-text", children: [
|
|
68
|
+
/* @__PURE__ */ i("span", { className: "alea-list-title", "data-truncate": o || void 0, children: r }),
|
|
69
|
+
t && /* @__PURE__ */ i("span", { className: "alea-list-desc", children: t })
|
|
67
70
|
] }),
|
|
68
|
-
s && /* @__PURE__ */
|
|
71
|
+
s && /* @__PURE__ */ i("span", { className: "alea-list-end", children: s })
|
|
69
72
|
] }) });
|
|
70
73
|
}
|
|
71
74
|
export {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
75
|
+
h as DragHandle,
|
|
76
|
+
W as DropIndicator,
|
|
77
|
+
G as ListItem,
|
|
78
|
+
_ as ListView,
|
|
79
|
+
ee as isTextDropItem,
|
|
80
|
+
M as reorderItems,
|
|
81
|
+
ae as useAsyncList,
|
|
82
|
+
re as useDragAndDrop,
|
|
83
|
+
ie as useListData,
|
|
84
|
+
te as useTreeData
|
|
82
85
|
};
|
|
@@ -60,6 +60,10 @@ export interface ContainedListItemProps extends HTMLAttributes<HTMLLIElement> {
|
|
|
60
60
|
end?: ReactNode;
|
|
61
61
|
/** Makes the whole row a link. */
|
|
62
62
|
href?: string;
|
|
63
|
+
/** Makes the whole row a button and runs this when it is pressed (a link with href wins). */
|
|
64
|
+
onPress?: () => void;
|
|
65
|
+
/** Keep the text and the description on one line each, with an ellipsis. By default they wrap, so large text and narrow screens never hide them, and the end slot moves under the text when there is no room. */
|
|
66
|
+
truncate?: boolean;
|
|
63
67
|
}
|
|
64
68
|
/** One row of a ContainedList. */
|
|
65
69
|
export declare const ContainedListItem: import("react").ForwardRefExoticComponent<ContainedListItemProps & import("react").RefAttributes<HTMLLIElement>>;
|
|
@@ -1,55 +1,55 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as
|
|
3
|
-
import { forwardRef as
|
|
4
|
-
import { RadioGroup as
|
|
5
|
-
import { Check as
|
|
6
|
-
import { cx as
|
|
2
|
+
import { jsxs as r, jsx as a, Fragment as f } from "react/jsx-runtime";
|
|
3
|
+
import { forwardRef as v } from "react";
|
|
4
|
+
import { RadioGroup as b, Radio as k } from "react-aria-components";
|
|
5
|
+
import { Check as y } from "lucide-react";
|
|
6
|
+
import { cx as g } from "../../utils/cx.js";
|
|
7
7
|
import { useStrings as w } from "../../i18n/strings.js";
|
|
8
8
|
import { renamed as x } from "../../utils/vocabulary.js";
|
|
9
|
-
function z({ columns:
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
function z({ columns: n, rows: s, selectionMode: e = "none", value: d, defaultValue: c, onChange: o, showHeader: t = !0, className: m, "aria-label": i }) {
|
|
10
|
+
const p = { gridTemplateColumns: `${e === "single" ? "40px " : ""}${n.map((l) => l.width ?? "minmax(0, 1fr)").join(" ")}` }, N = t && /* @__PURE__ */ r("div", { className: "alea-slist-row alea-slist-head", style: p, "aria-hidden": e === "single" || void 0, role: e === "single" ? void 0 : "row", children: [
|
|
11
|
+
e === "single" && /* @__PURE__ */ a("span", {}),
|
|
12
|
+
n.map((l) => /* @__PURE__ */ a("span", { className: "alea-slist-cell", "data-align": l.align, role: e === "single" ? void 0 : "columnheader", children: l.label }, l.key))
|
|
13
13
|
] });
|
|
14
|
-
return
|
|
14
|
+
return e === "single" ? /* @__PURE__ */ r(b, { "aria-label": i, value: d, defaultValue: c, onChange: o, className: g("alea-slist", m), "data-selectable": !0, children: [
|
|
15
15
|
N,
|
|
16
|
-
|
|
17
|
-
/* @__PURE__ */ a("span", { className: "alea-slist-check", "aria-hidden": "true", children: h && /* @__PURE__ */ a(
|
|
18
|
-
|
|
19
|
-
] }) },
|
|
20
|
-
] }) : /* @__PURE__ */
|
|
16
|
+
s.map((l) => /* @__PURE__ */ a(k, { value: l.id, className: "alea-slist-row alea-slist-option alea-focus-ring", style: p, children: ({ isSelected: h }) => /* @__PURE__ */ r(f, { children: [
|
|
17
|
+
/* @__PURE__ */ a("span", { className: "alea-slist-check", "aria-hidden": "true", children: h && /* @__PURE__ */ a(y, { size: 16 }) }),
|
|
18
|
+
n.map((u) => /* @__PURE__ */ a("span", { className: "alea-slist-cell", "data-align": u.align, "data-label": typeof u.label == "string" ? u.label : void 0, children: l[u.key] }, u.key))
|
|
19
|
+
] }) }, l.id))
|
|
20
|
+
] }) : /* @__PURE__ */ r("div", { className: g("alea-slist", m), role: "table", "aria-label": i, children: [
|
|
21
21
|
N,
|
|
22
|
-
/* @__PURE__ */ a("div", { role: "rowgroup", children:
|
|
22
|
+
/* @__PURE__ */ a("div", { role: "rowgroup", children: s.map((l) => /* @__PURE__ */ a("div", { className: "alea-slist-row", role: "row", style: p, children: n.map((h, u) => /* @__PURE__ */ a("span", { className: "alea-slist-cell", role: u === 0 ? "rowheader" : "cell", "data-align": h.align, "data-label": typeof h.label == "string" ? h.label : void 0, children: l[h.key] }, h.key)) }, l.id)) })
|
|
23
23
|
] });
|
|
24
24
|
}
|
|
25
|
-
function O({ label:
|
|
26
|
-
const
|
|
27
|
-
return /* @__PURE__ */
|
|
28
|
-
/* @__PURE__ */
|
|
29
|
-
/* @__PURE__ */ a(
|
|
30
|
-
|
|
25
|
+
function O({ label: n, action: s, children: e, variant: d, kind: c, size: o = "md", headingLevel: t = 3, className: m }) {
|
|
26
|
+
const i = x("ContainedList", "kind", c, "variant", d) ?? "on-page", p = `h${t}`;
|
|
27
|
+
return /* @__PURE__ */ r("section", { className: g("alea-clist", m), "data-kind": i, "data-size": o, children: [
|
|
28
|
+
/* @__PURE__ */ r("header", { className: "alea-clist-head", children: [
|
|
29
|
+
/* @__PURE__ */ a(p, { className: "alea-clist-title", children: n }),
|
|
30
|
+
s && /* @__PURE__ */ a("div", { className: "alea-clist-action", children: s })
|
|
31
31
|
] }),
|
|
32
|
-
/* @__PURE__ */ a("ul", { className: "alea-clist-items", children:
|
|
32
|
+
/* @__PURE__ */ a("ul", { className: "alea-clist-items", children: e })
|
|
33
33
|
] });
|
|
34
34
|
}
|
|
35
|
-
const S =
|
|
36
|
-
const
|
|
35
|
+
const S = v(function({ children: s, description: e, start: d, end: c, href: o, onPress: t, truncate: m, className: i, ...p }, N) {
|
|
36
|
+
const l = /* @__PURE__ */ r(f, { children: [
|
|
37
37
|
d && /* @__PURE__ */ a("span", { className: "alea-clist-start", children: d }),
|
|
38
|
-
/* @__PURE__ */
|
|
39
|
-
/* @__PURE__ */ a("span", { className: "alea-clist-name", children:
|
|
40
|
-
|
|
38
|
+
/* @__PURE__ */ r("span", { className: "alea-clist-text", children: [
|
|
39
|
+
/* @__PURE__ */ a("span", { className: "alea-clist-name", "data-truncate": m || void 0, children: s }),
|
|
40
|
+
e && /* @__PURE__ */ a("span", { className: "alea-clist-desc", "data-truncate": m || void 0, children: e })
|
|
41
41
|
] })
|
|
42
42
|
] });
|
|
43
|
-
return /* @__PURE__ */
|
|
44
|
-
o ? /* @__PURE__ */ a("a", { href: o, className: "alea-clist-link alea-focus-ring", children:
|
|
43
|
+
return /* @__PURE__ */ r("li", { ref: N, ...p, className: g("alea-clist-item", i), children: [
|
|
44
|
+
o ? /* @__PURE__ */ a("a", { href: o, className: "alea-clist-link alea-focus-ring", onClick: t ? () => t() : void 0, children: l }) : t ? /* @__PURE__ */ a("button", { type: "button", className: "alea-clist-link alea-focus-ring", onClick: () => t(), children: l }) : /* @__PURE__ */ a("span", { className: "alea-clist-link", children: l }),
|
|
45
45
|
c && /* @__PURE__ */ a("span", { className: "alea-clist-end", children: c })
|
|
46
46
|
] });
|
|
47
47
|
});
|
|
48
|
-
function A({ count:
|
|
49
|
-
const
|
|
50
|
-
return d === "numbers" ? /* @__PURE__ */ a("span", { className:
|
|
51
|
-
Array.from({ length:
|
|
52
|
-
!
|
|
48
|
+
function A({ count: n, current: s, onChange: e, variant: d = "dots", className: c, "aria-label": o }) {
|
|
49
|
+
const t = w();
|
|
50
|
+
return d === "numbers" ? /* @__PURE__ */ a("span", { className: g("alea-page-indicator", c), "data-variant": "numbers", role: "status", children: t.nOfTotal(s + 1, n) }) : /* @__PURE__ */ r("div", { className: g("alea-page-indicator", c), "data-variant": d, role: "group", "aria-label": o ?? t.pages, children: [
|
|
51
|
+
Array.from({ length: n }, (m, i) => e ? /* @__PURE__ */ a("button", { type: "button", className: "alea-page-dot alea-focus-ring", "aria-label": t.slideN(i + 1), "aria-current": i === s ? "step" : void 0, "data-current": i === s || void 0, onClick: () => e(i) }, i) : /* @__PURE__ */ a("span", { className: "alea-page-dot", "aria-hidden": "true", "data-current": i === s || void 0 }, i)),
|
|
52
|
+
!e && /* @__PURE__ */ a("span", { className: "alea-visually-hidden", children: t.nOfTotal(s + 1, n) })
|
|
53
53
|
] });
|
|
54
54
|
}
|
|
55
55
|
export {
|