@sincpro/web-ui 2.18.1 → 2.19.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/README.md +5 -3
- package/dist/components/flow/SetupCard.d.ts +21 -0
- package/dist/components/flow/SetupCard.js +16 -0
- package/dist/components/flow/index.d.ts +1 -0
- package/dist/components/flow/index.js +3 -0
- package/dist/components/form/Form.js +7 -5
- package/dist/components/listing/Row.d.ts +5 -2
- package/dist/components/listing/Row.js +4 -3
- package/dist/components/navigation/NavigationTree.d.ts +3 -0
- package/dist/components/navigation/NavigationTree.js +2 -1
- package/dist/components/record/ActionDock.d.ts +10 -3
- package/dist/components/record/ActionDock.js +15 -8
- package/dist/components/record/DirtyActions.d.ts +15 -7
- package/dist/components/record/DirtyActions.js +37 -13
- package/dist/components/record/DockMessage.d.ts +18 -0
- package/dist/components/record/DockMessage.js +31 -0
- package/dist/components/record/dock.d.ts +25 -0
- package/dist/components/record/index.d.ts +2 -1
- package/dist/components/record/index.js +1 -0
- package/dist/components/shell/Page.d.ts +12 -0
- package/dist/components/shell/Page.js +12 -0
- package/dist/components/shell/Sidebar.d.ts +22 -3
- package/dist/components/shell/Sidebar.js +88 -10
- package/dist/components/shell/index.d.ts +1 -0
- package/dist/components/shell/index.js +2 -0
- package/dist/foundations/copy.es.js +5 -0
- package/dist/foundations/grouping.d.ts +37 -0
- package/dist/foundations/grouping.js +0 -0
- package/dist/foundations/index.d.ts +1 -1
- package/dist/foundations/index.js +1 -1
- package/dist/foundations/uiCopy.d.ts +10 -0
- package/dist/foundations/uiCopy.js +5 -0
- package/dist/primitives/button/Button.d.ts +5 -1
- package/dist/primitives/button/Button.js +4 -4
- package/dist/primitives/button/classes.d.ts +1 -8
- package/dist/primitives/button/classes.js +12 -2
- package/dist/primitives/menu/Menu.d.ts +22 -1
- package/dist/primitives/menu/Menu.js +44 -18
- package/dist/primitives/table/DataTable.d.ts +12 -1
- package/dist/primitives/table/DataTable.js +42 -14
- package/dist/primitives/table/PileFootLine.d.ts +4 -2
- package/dist/primitives/table/PileFootLine.js +16 -5
- package/dist/primitives/table/SheetTable.d.ts +19 -1
- package/dist/primitives/table/SheetTable.js +22 -2
- package/dist/primitives/table/index.d.ts +1 -1
- package/dist/primitives/table/index.js +1 -1
- package/dist/primitives/tabs/Tabs.d.ts +21 -1
- package/dist/primitives/tabs/Tabs.js +26 -7
- package/dist/primitives/tabs/index.d.ts +1 -1
- package/dist/primitives/tag/Tag.d.ts +5 -0
- package/dist/primitives/tag/Tag.js +2 -1
- package/dist/primitives/value/Avatar.d.ts +4 -1
- package/dist/primitives/value/Avatar.js +2 -2
- package/dist/views/list/ListView.js +23 -5
- package/dist/views/list/derive.d.ts +5 -3
- package/dist/views/list/derive.js +30 -5
- package/dist/views/list/presentations.js +2 -1
- package/dist/views/list/types.d.ts +5 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -371,9 +371,11 @@ The parts: `button`, `icon-button`, `control`, `popover`, `menu`, `menu.trigger`
|
|
|
371
371
|
`story-viewer.media`, `notification-bell`, `notification-panel`, `notification-panel.group`,
|
|
372
372
|
`notification-panel.item` (with `data-unread`), `portal-nav`, `portal-nav.person`, `portal-nav.toggle`,
|
|
373
373
|
`portal-nav.sections`, `check-field`, `file-preview.video`, `file-preview.audio`, `file-preview.office` (with `data-kind`), `sidebar`, `sidebar.brand`,
|
|
374
|
-
`sidebar.user`, `sidebar.
|
|
375
|
-
`
|
|
376
|
-
`
|
|
374
|
+
`sidebar.user`, `sidebar.me` (the person at the foot, `account="menu"`), `sidebar.search`,
|
|
375
|
+
`sidebar.nav`, `sidebar.account`, `navigation`, `navigation.item`, `menu.header`, `tabs` (with
|
|
376
|
+
`data-look`), `tabs.tab`, `dirty.blocked`, `dirty.bar`, `field`, `field.label`, `form.section`,
|
|
377
|
+
`form.card`, `form.index`, `dock`, `dock.pill`, `dock.bare`, `dock.message` (with `data-tone`),
|
|
378
|
+
`setup`, `setup.step`, `setup.reason`, `setup.preview`, `page`, `pager`, `pagination`, `smart`, `guide`, `guide.veil`, `guide.spot`, `guide.card`,
|
|
377
379
|
`guide.progress`, `guide.title`, `guide.body`, `guide.actions`. A part that is one of many
|
|
378
380
|
carries `data-key` too (`navigation.item`). Put your rules in a cascade layer above web-ui's, or
|
|
379
381
|
outside any layer.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
export type SetupCardProps = {
|
|
3
|
+
/** Where this card stands in the path: «Paso 1 de 2 · Conectar Slack». */
|
|
4
|
+
step?: {
|
|
5
|
+
index: number;
|
|
6
|
+
total: number;
|
|
7
|
+
label?: string;
|
|
8
|
+
};
|
|
9
|
+
/** What it does for the person, as a sentence: «Trabaja desde un hilo de Slack.» */
|
|
10
|
+
title: string;
|
|
11
|
+
/** The reason, in a paragraph or two (`<p>`). */
|
|
12
|
+
children?: ReactNode;
|
|
13
|
+
/** The ONE thing to do: a primary `Button`, at the foot of the reason. */
|
|
14
|
+
action: ReactNode;
|
|
15
|
+
/** What it will look like once it is on: any composition of the system. */
|
|
16
|
+
preview: ReactNode;
|
|
17
|
+
/** Under the preview, what the person is looking at: «El asistente lee la alerta y
|
|
18
|
+
* propone el arreglo dentro de Slack.» */
|
|
19
|
+
caption?: string;
|
|
20
|
+
};
|
|
21
|
+
export declare function SetupCard({ step, title, children, action, preview, caption, }: SetupCardProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { fillCopy, useUiCopy } from "../../foundations/copy.js";
|
|
4
|
+
import { useId } from "react";
|
|
5
|
+
export function SetupCard({ step, title, children, action, preview, caption, }) {
|
|
6
|
+
const copy = useUiCopy();
|
|
7
|
+
const titleId = useId();
|
|
8
|
+
const where = step === undefined
|
|
9
|
+
? undefined
|
|
10
|
+
: fillCopy(step.label === undefined ? copy.stepFlow.position : copy.stepFlow.where, {
|
|
11
|
+
index: String(step.index),
|
|
12
|
+
total: String(step.total),
|
|
13
|
+
label: step.label ?? "",
|
|
14
|
+
});
|
|
15
|
+
return (_jsxs("section", { "data-ui": "setup", "aria-labelledby": titleId, className: "@container flex min-w-0 flex-col gap-2 rounded-ui-card border border-ui-card-border bg-ground p-2", children: [where === undefined ? null : (_jsx("p", { "data-ui": "setup.step", className: "px-3 pt-1 text-micro text-muted", children: where })), _jsxs("div", { className: "flex min-w-0 flex-col gap-2 @3xl:flex-row", children: [_jsxs("div", { "data-ui": "setup.reason", className: "flex min-w-0 flex-col gap-6 rounded-ui-card border border-ui-card-border bg-surface p-8 @3xl:flex-3", children: [_jsxs("div", { className: "flex min-w-0 flex-col gap-4", children: [_jsx("h2", { id: titleId, className: "text-display font-semibold text-balance text-ink", children: title }), children === undefined ? null : (_jsx("div", { className: "flex max-w-prose flex-col gap-3 text-body text-muted", children: children }))] }), _jsx("div", { className: "mt-auto flex min-w-0 flex-col *:w-full", children: action })] }), _jsxs("figure", { "data-ui": "setup.preview", className: "flex min-w-0 flex-col overflow-clip rounded-ui-card border border-ui-card-border bg-surface @3xl:flex-4", children: [_jsx("div", { className: "min-h-0 flex-1", children: preview }), caption === undefined ? null : (_jsx("figcaption", { className: "border-t border-line px-4 py-3 text-micro text-muted", children: caption }))] })] })] }));
|
|
16
|
+
}
|
|
@@ -1,2 +1,5 @@
|
|
|
1
1
|
/* One operation in several steps, done in one sitting — import: upload › map › review. */
|
|
2
2
|
export { StepFlow, } from "./StepFlow.js";
|
|
3
|
+
/* Turning something on, with the result in sight — connect an integration: the reason and the
|
|
4
|
+
one action beside a preview of what changes. */
|
|
5
|
+
export { SetupCard } from "./SetupCard.js";
|
|
@@ -33,11 +33,13 @@ export function FormSection({ title, hint, status, actions, columns = 1, childre
|
|
|
33
33
|
hint !== undefined ||
|
|
34
34
|
actions !== undefined;
|
|
35
35
|
if (settings) {
|
|
36
|
-
/* «settings»: the section is a card of rows, one under the other, a hairline
|
|
37
|
-
them — `columns` does not apply, a row already has its two.
|
|
38
|
-
the
|
|
39
|
-
|
|
40
|
-
|
|
36
|
+
/* «settings»: the section is a TITLE over a card of rows, one under the other, a hairline
|
|
37
|
+
between them — `columns` does not apply, a row already has its two. The title and its
|
|
38
|
+
help sit above the card, on the ground: the card holds only what is answered, so a page
|
|
39
|
+
of five cards reads as five named blocks and not as five boxes that each start with a
|
|
40
|
+
heading. `@container`: each row measures the card to decide whether its label still
|
|
41
|
+
fits beside the control (`grid-setting`). */
|
|
42
|
+
return (_jsxs("section", { ...(indexed === undefined ? {} : { id: indexed }), "data-ui": "form.section", className: "flex min-w-0 scroll-mt-3 flex-col gap-2.5", children: [withHeader ? (_jsxs("header", { className: "flex min-w-0 flex-wrap items-end gap-x-2.5 gap-y-1", children: [title === undefined && hint === undefined ? null : (_jsxs("div", { className: "flex min-w-0 flex-col gap-0.5", children: [title === undefined ? null : (_jsx("h2", { className: "min-w-0 text-title font-semibold text-ink", children: title })), hint === undefined ? null : (_jsx("p", { className: "max-w-prose text-meta text-muted", children: hint }))] })), status === undefined ? null : _jsx(Tag, { tone: status.tone, children: status.label }), actions === undefined ? null : (_jsx("span", { className: "ml-auto flex shrink-0 items-center gap-1.5", children: actions }))] })) : null, _jsx("div", { "data-ui": "form.card", className: "@container flex min-w-0 flex-col divide-y divide-line rounded-ui-card border border-ui-card-border bg-ui-card px-5 *:py-3.5", children: children })] }));
|
|
41
43
|
}
|
|
42
44
|
if (sections) {
|
|
43
45
|
/* «sections»: the settings' card, the dense sheet's body — label | value in its columns,
|
|
@@ -129,9 +129,12 @@ export declare function GroupHeader({ field, label, count, detail, depth, open,
|
|
|
129
129
|
onToggle?: () => void;
|
|
130
130
|
}): import("react").JSX.Element;
|
|
131
131
|
/** Under a short pile: «Ver 50 más de 49.950», or «Se muestran 500 de 49.950» when there is
|
|
132
|
-
* no next page
|
|
133
|
-
|
|
132
|
+
* no next page — and after a short level of piles, «Ver 50 grupos más». Indented like the
|
|
133
|
+
* pile's rows. */
|
|
134
|
+
export declare function GroupMore({ foot, depth, onMore, of, }: {
|
|
134
135
|
foot: PileFoot;
|
|
135
136
|
depth?: number;
|
|
136
137
|
onMore: () => void;
|
|
138
|
+
/** What it pages: the rows of a pile, or the piles of a level («Ver 50 grupos más»). */
|
|
139
|
+
of?: "rows" | "piles";
|
|
137
140
|
}): import("react").JSX.Element;
|
|
@@ -143,8 +143,9 @@ export function GroupHeader({ field, label, count, detail, depth = 0, open = tru
|
|
|
143
143
|
return onToggle === undefined ? (_jsx("div", { "data-ui": "list.pile", className: box, style: indent, children: content })) : (_jsxs("button", { type: "button", "data-ui": "list.pile", onClick: onToggle, "aria-expanded": open, style: indent, className: `group/head relative ${box} w-full text-left focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-primary`, children: [mark, content] }));
|
|
144
144
|
}
|
|
145
145
|
/** Under a short pile: «Ver 50 más de 49.950», or «Se muestran 500 de 49.950» when there is
|
|
146
|
-
* no next page
|
|
147
|
-
|
|
146
|
+
* no next page — and after a short level of piles, «Ver 50 grupos más». Indented like the
|
|
147
|
+
* pile's rows. */
|
|
148
|
+
export function GroupMore({ foot, depth = 0, onMore, of = "rows", }) {
|
|
148
149
|
const d = useDensity();
|
|
149
|
-
return (_jsx("div", { className: `border-b border-line ${byDensity(d, "px-3 py-1", "px-2.5 py-0.5")}`, style: depth === 0 ? undefined : { paddingLeft: `calc(var(--spacing-indent) * ${depth})` }, children: _jsx(PileFootLine, { foot: foot, onMore: onMore }) }));
|
|
150
|
+
return (_jsx("div", { className: `border-b border-line ${byDensity(d, "px-3 py-1", "px-2.5 py-0.5")}`, style: depth === 0 ? undefined : { paddingLeft: `calc(var(--spacing-indent) * ${depth})` }, children: _jsx(PileFootLine, { foot: foot, onMore: onMore, of: of }) }));
|
|
150
151
|
}
|
|
@@ -8,6 +8,9 @@ export interface NavItem {
|
|
|
8
8
|
/** What is waiting there: drafts, overdue, to approve. Zero is not drawn — a «0» beside
|
|
9
9
|
* every quiet screen is a column of noise the eye has to read to learn nothing. */
|
|
10
10
|
count?: number;
|
|
11
|
+
/** A word about the place itself, not about what waits there: «Gratis en beta», «Configurar».
|
|
12
|
+
* Quiet, at the end of the row; a `count` says how many, this says what kind. */
|
|
13
|
+
badge?: string;
|
|
11
14
|
children?: readonly NavItem[];
|
|
12
15
|
}
|
|
13
16
|
/**
|
|
@@ -5,6 +5,7 @@ import { useUiCopy } from "../../foundations/copy.js";
|
|
|
5
5
|
import { useSurface } from "../../foundations/surface.js";
|
|
6
6
|
import { focusRing, tv } from "../../foundations/variants.js";
|
|
7
7
|
import { Count } from "../../primitives/tag/Count.js";
|
|
8
|
+
import { Tag } from "../../primitives/tag/Tag.js";
|
|
8
9
|
import { ChevronRight } from "lucide-react";
|
|
9
10
|
import { useMemo } from "react";
|
|
10
11
|
import { Button as AriaButton, Link, NavigationTree as AriaNavigationTree, NavigationTreeItem as AriaNavigationTreeItem, NavigationTreeItemContent, RouterProvider, } from "react-aria-components";
|
|
@@ -100,7 +101,7 @@ export function NavigationTree({ items, current, onNavigate, defaultExpanded = [
|
|
|
100
101
|
: undefined;
|
|
101
102
|
return (_jsxs(AriaNavigationTreeItem, { "data-ui": "navigation.item", "data-key": item.id, id: item.id, textValue: item.label, ...(module ? {} : { href: item.id }), className: ({ isCurrent, isFocusVisible }) => row({ surface, isCurrent, isFocusVisible }), children: [_jsx(NavigationTreeItemContent, { children: ({ isCurrent, isCurrentAncestor, isExpanded }) => (_jsxs(_Fragment, { children: [isCurrent ? _jsx("span", { "aria-hidden": true, className: MARKER[surface] }) : null, _jsxs(Link, { className: link({ isModule: module }), style: indent, children: [Icon === undefined ? null : (_jsx(Icon, { className: `size-(--size-icon-md) shrink-0 ${isCurrent || (isCurrentAncestor && !isExpanded)
|
|
102
103
|
? HERE[surface].here
|
|
103
|
-
: HERE[surface].rest}`, strokeWidth: 2, "aria-hidden": true })), _jsx("span", { className: `min-w-0 flex-1 truncate ${isCurrentAncestor && !isExpanded ? HERE[surface].here : ""}`, children: item.label }), item.count === undefined ? null : (_jsx(Count, { value: item.count, current: isCurrent }))] }), module ? (_jsx(AriaButton, { slot: "chevron", className: ({ isFocusVisible }) => chevronButton({ surface, isFocusVisible }), children: _jsx(ChevronRight, { className: `size-(--size-icon-sm) transition-transform duration-(--duration-quick) ease-(--ease-out) ${isExpanded ? "rotate-90" : ""}`, strokeWidth: 2, "aria-hidden": true }) })) : null] })) }), children.map((child) => render(child, level + 1))] }, item.id));
|
|
104
|
+
: HERE[surface].rest}`, strokeWidth: 2, "aria-hidden": true })), _jsx("span", { className: `min-w-0 flex-1 truncate ${isCurrentAncestor && !isExpanded ? HERE[surface].here : ""}`, children: item.label }), item.badge === undefined ? null : (_jsx(Tag, { surface: surface === "chrome" ? "chrome" : "canvas", children: item.badge })), item.count === undefined ? null : (_jsx(Count, { value: item.count, current: isCurrent }))] }), module ? (_jsx(AriaButton, { slot: "chevron", className: ({ isFocusVisible }) => chevronButton({ surface, isFocusVisible }), children: _jsx(ChevronRight, { className: `size-(--size-icon-sm) transition-transform duration-(--duration-quick) ease-(--ease-out) ${isExpanded ? "rotate-90" : ""}`, strokeWidth: 2, "aria-hidden": true }) })) : null] })) }), children.map((child) => render(child, level + 1))] }, item.id));
|
|
104
105
|
};
|
|
105
106
|
return (_jsx(AriaLocale, { children: _jsx(RouterProvider, { navigate: (id) => onNavigate?.(id), useHref: (id) => `#${id}`, children: _jsx(AriaNavigationTree, { "data-ui": "navigation", "aria-label": label ?? copy.shell.menus, selectedRoute: current ?? null, defaultExpandedKeys: expanded, className: "flex w-full min-w-0 flex-col gap-px p-2 outline-0", children: items.map((item) => render(item, 1)) }) }) }));
|
|
106
107
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type DirtyState } from "./DirtyActions.js";
|
|
2
|
-
import { type DockAction } from "./dock.js";
|
|
2
|
+
import { type DockAction, type DockMoment } from "./dock.js";
|
|
3
3
|
import { type ReactNode, type Ref } from "react";
|
|
4
4
|
/** Where the dock goes. `bottom` floats it, stuck to the bottom of what scrolls; `inline` draws
|
|
5
5
|
* only the pill — its host places it (`Record.Dock` does). A pill resting in the rail and
|
|
@@ -23,8 +23,15 @@ export interface ActionDockProps {
|
|
|
23
23
|
/** The toolbar's accessible name: «Acciones de la factura». */
|
|
24
24
|
label?: string;
|
|
25
25
|
/** What the pill says before its actions — «3 elegidas ✕» over a list's chosen rows. Drawn
|
|
26
|
-
* on the pill's band: write it with `useSurface()` colours. */
|
|
26
|
+
* on the pill's band: write it with `useSurface()` colours. For a sentence, `moment`. */
|
|
27
27
|
lead?: ReactNode;
|
|
28
|
+
/**
|
|
29
|
+
* What the moment is, said before the actions and the same on every screen: «Colegiado
|
|
30
|
+
* observado · falta el certificado». The screen changes it with the record's state. While
|
|
31
|
+
* there are changes the pill says those instead (`DirtyState.message`/`detail`), then
|
|
32
|
+
* «Guardado» for a moment, and then this again — one place that changes, with a short rise.
|
|
33
|
+
*/
|
|
34
|
+
moment?: DockMoment;
|
|
28
35
|
}
|
|
29
36
|
/** Where a record's actions go: as the rail's buttons, or floating at the bottom of the screen.
|
|
30
37
|
* Absent, the record's style decides: `traditional` → `rail`, `modern` → `bottom`. */
|
|
@@ -33,7 +40,7 @@ export type RecordDockPlacement = "rail" | "bottom";
|
|
|
33
40
|
export type RecordDockProps = Omit<ActionDockProps, "dirty" | "saved" | "placement"> & {
|
|
34
41
|
placement?: RecordDockPlacement;
|
|
35
42
|
};
|
|
36
|
-
export declare function ActionDock({ actions, visible, dirty, saved, placement, align, look, label, lead, }: ActionDockProps): import("react").JSX.Element;
|
|
43
|
+
export declare function ActionDock({ actions, visible, dirty, saved, placement, align, look, label, lead, moment, }: ActionDockProps): import("react").JSX.Element;
|
|
37
44
|
/**
|
|
38
45
|
* The band a floating pill sits in. Sticky to the edge of what scrolls, as the settings bar: no
|
|
39
46
|
* padding to keep in sync with its height, and at the end of the page it settles in its place in
|
|
@@ -2,13 +2,14 @@
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
3
|
import { DirtyActions, SavedMark, } from "./DirtyActions.js";
|
|
4
4
|
import { dockOption, dockPlan, dockShortcuts, moreGroups, } from "./dock.js";
|
|
5
|
+
import { DockMessage } from "./DockMessage.js";
|
|
5
6
|
import { useUiCopy } from "../../foundations/copy.js";
|
|
6
7
|
import { keysLabel } from "../../foundations/keys.js";
|
|
7
8
|
import { useKeyboardPlatform, useKeysHint, useShortcuts, } from "../../foundations/shortcut.js";
|
|
8
9
|
import { SurfaceProvider, useSurface } from "../../foundations/surface.js";
|
|
9
10
|
import { Button } from "../../primitives/button/Button.js";
|
|
10
11
|
import { Menu } from "../../primitives/menu/Menu.js";
|
|
11
|
-
import { MoreHorizontal } from "lucide-react";
|
|
12
|
+
import { Check, MoreHorizontal } from "lucide-react";
|
|
12
13
|
import { createContext, use } from "react";
|
|
13
14
|
const PILL = { "--ui-button-radius": "var(--radius-pill)" };
|
|
14
15
|
/** One action as a button, its shortcut in its title and in `aria-keyshortcuts`. */
|
|
@@ -20,7 +21,7 @@ function DockButton({ action, role, size, surface, }) {
|
|
|
20
21
|
}
|
|
21
22
|
/** The same actions with no pill: the rail's buttons — the primary first and gold, the
|
|
22
23
|
* secondary ones bordered, «⋯» with the rest. What the `traditional` style draws. */
|
|
23
|
-
function Bare({ actions, visible, dirty, saved, label, }) {
|
|
24
|
+
function Bare({ actions, visible, dirty, saved, label, moment, }) {
|
|
24
25
|
const copy = useUiCopy();
|
|
25
26
|
const surface = useSurface();
|
|
26
27
|
const platform = useKeyboardPlatform();
|
|
@@ -31,24 +32,30 @@ function Bare({ actions, visible, dirty, saved, label, }) {
|
|
|
31
32
|
if (dirty !== undefined) {
|
|
32
33
|
return (_jsx("div", { className: "flex shrink-0 items-center gap-1.5", children: _jsx(DirtyActions, { ...dirty }) }));
|
|
33
34
|
}
|
|
34
|
-
return (_jsxs("div", { role: "toolbar", "aria-label": label ?? copy.dock.label, "data-ui": "dock.bare", className: "flex shrink-0 items-center gap-1.5", children: [plan.primary === undefined ? null : (_jsx(DockButton, { action: plan.primary, role: "primary", size: "sm", surface: tone })), plan.shown.map((action) => action.items === undefined ? (_jsx(DockButton, { action: action, role: "secondary", size: "sm", surface: tone }, action.id)) : (_jsx(Menu, { role: "secondary", size: "sm", surface: surface === "chrome" ? "chrome" : "canvas", label: action.label, ...(action.icon === undefined ? {} : { icon: action.icon }), groups: [{ options: action.items.map((one) => dockOption(one, label_)) }] }, action.id))), more.length === 0 ? null : (_jsx(Menu, { label: copy.dock.more, icon: MoreHorizontal, iconOnly: true, chevron: false, size: "sm", surface: surface === "chrome" ? "chrome" : "canvas", groups: more })), _jsx(SavedMark, { saved: saved === true })] }));
|
|
35
|
+
return (_jsxs("div", { role: "toolbar", "aria-label": label ?? copy.dock.label, "data-ui": "dock.bare", className: "flex min-w-0 shrink-0 items-center gap-1.5", children: [_jsx(DockMessage, { moment: moment }), plan.primary === undefined ? null : (_jsx(DockButton, { action: plan.primary, role: "primary", size: "sm", surface: tone })), plan.shown.map((action) => action.items === undefined ? (_jsx(DockButton, { action: action, role: "secondary", size: "sm", surface: tone }, action.id)) : (_jsx(Menu, { role: "secondary", size: "sm", surface: surface === "chrome" ? "chrome" : "canvas", label: action.label, ...(action.icon === undefined ? {} : { icon: action.icon }), groups: [{ options: action.items.map((one) => dockOption(one, label_)) }] }, action.id))), more.length === 0 ? null : (_jsx(Menu, { label: copy.dock.more, icon: MoreHorizontal, iconOnly: true, chevron: false, size: "sm", surface: surface === "chrome" ? "chrome" : "canvas", groups: more })), _jsx(SavedMark, { saved: saved === true })] }));
|
|
35
36
|
}
|
|
36
37
|
/** The pill alone: the actions, or Save and Discard. */
|
|
37
|
-
function Pill({ actions, visible, dirty, saved, look, label, lead, }) {
|
|
38
|
+
function Pill({ actions, visible, dirty, saved, look, label, lead, moment, }) {
|
|
38
39
|
const copy = useUiCopy();
|
|
39
40
|
const platform = useKeyboardPlatform();
|
|
40
41
|
const label_ = (keys) => keysLabel(keys, platform);
|
|
41
42
|
const plan = dockPlan(actions, visible);
|
|
42
43
|
const more = moreGroups(plan, label_);
|
|
43
|
-
return (_jsx(SurfaceProvider, { value: look, children:
|
|
44
|
+
return (_jsx(SurfaceProvider, { value: look, children: _jsxs("div", { role: "toolbar", "aria-label": label ?? copy.dock.label, "data-ui": "dock.pill", style: PILL, className: `pointer-events-auto flex max-w-full min-w-0 items-center gap-1 rounded-pill p-1.5 shadow-float *:shrink-0 ${look === "chrome"
|
|
44
45
|
? "border border-chrome-edge bg-chrome"
|
|
45
|
-
: "border border-line bg-surface"}`, children:
|
|
46
|
+
: "border border-line bg-surface"}`, children: [_jsx("span", { role: "status", className: "sr-only", children: dirty !== undefined
|
|
47
|
+
? ""
|
|
48
|
+
: saved === true
|
|
49
|
+
? copy.record.saved
|
|
50
|
+
: (moment?.text ?? "") }), dirty !== undefined ? (_jsx(DirtyActions, { ...dirty, floating: true })) : (_jsxs(_Fragment, { children: [_jsx(DockMessage, { moment: saved === true
|
|
51
|
+
? { text: copy.record.saved, tone: "good", icon: Check }
|
|
52
|
+
: moment }), lead, plan.shown.map((action) => action.items === undefined ? (_jsx(DockButton, { action: action, role: "ghost", surface: look }, action.id)) : (_jsx(Menu, { role: "ghost", surface: look, label: action.label, ...(action.icon === undefined ? {} : { icon: action.icon }), groups: [{ options: action.items.map((one) => dockOption(one, label_)) }] }, action.id))), more.length === 0 ? null : (_jsx(Menu, { label: copy.dock.more, icon: MoreHorizontal, iconOnly: true, chevron: false, variant: "text", surface: look, align: "end", groups: more })), plan.primary === undefined ? null : (_jsx(DockButton, { action: plan.primary, role: "primary", surface: look }))] }))] }) }));
|
|
46
53
|
}
|
|
47
|
-
export function ActionDock({ actions, visible = 2, dirty, saved, placement = "bottom", align = "center", look = "chrome", label, lead, }) {
|
|
54
|
+
export function ActionDock({ actions, visible = 2, dirty, saved, placement = "bottom", align = "center", look = "chrome", label, lead, moment, }) {
|
|
48
55
|
/* The combinations run while the dock is on screen; while there are changes Save answers
|
|
49
56
|
Mod+S itself. */
|
|
50
57
|
useShortcuts(dockShortcuts(actions, dirty !== undefined));
|
|
51
|
-
const pill = look === "bare" ? (_jsx(Bare, { actions: actions, visible: visible, ...(dirty === undefined ? {} : { dirty }), ...(saved === undefined ? {} : { saved }), ...(label === undefined ? {} : { label }) })) : (_jsx(Pill, { actions: actions, visible: visible, look: look, ...(lead === undefined ? {} : { lead }), ...(dirty === undefined ? {} : { dirty }), ...(saved === undefined ? {} : { saved }), ...(label === undefined ? {} : { label }) }));
|
|
58
|
+
const pill = look === "bare" ? (_jsx(Bare, { actions: actions, visible: visible, ...(dirty === undefined ? {} : { dirty }), ...(saved === undefined ? {} : { saved }), ...(label === undefined ? {} : { label }), ...(moment === undefined ? {} : { moment }) })) : (_jsx(Pill, { actions: actions, visible: visible, look: look, ...(lead === undefined ? {} : { lead }), ...(moment === undefined ? {} : { moment }), ...(dirty === undefined ? {} : { dirty }), ...(saved === undefined ? {} : { saved }), ...(label === undefined ? {} : { label }) }));
|
|
52
59
|
if (placement === "inline")
|
|
53
60
|
return pill;
|
|
54
61
|
return _jsx(DockBand, { align: align, children: pill });
|
|
@@ -14,6 +14,12 @@ export interface DirtyState {
|
|
|
14
14
|
/** How many fields changed. Not drawn: it describes the Save button, «Guardar — 2 cambios
|
|
15
15
|
* sin guardar», for whoever cannot see the fields' own `Field changed` marks. */
|
|
16
16
|
changes?: number;
|
|
17
|
+
/** What the floating pill says in place of «Cambios sin guardar», when the screen knows
|
|
18
|
+
* better: «La regla tiene cambios», «Respuesta sin enviar». */
|
|
19
|
+
message?: string;
|
|
20
|
+
/** The help under it in the floating pill: what saving will do — «se avisará al cliente»,
|
|
21
|
+
* «aplica desde el próximo mes». `blocked` takes its place while it cannot be saved. */
|
|
22
|
+
detail?: string;
|
|
17
23
|
}
|
|
18
24
|
/** Save and discard, in the rail and in place of the action buttons.
|
|
19
25
|
*
|
|
@@ -21,15 +27,17 @@ export interface DirtyState {
|
|
|
21
27
|
* the same rule as `FormActions`, and here it matters more: the rail is where
|
|
22
28
|
* the hand is after editing.
|
|
23
29
|
*
|
|
24
|
-
* There is no «sin guardar» mark. The two buttons only exist while something
|
|
25
|
-
* each changed field already says so (`Field changed`): a third signal
|
|
26
|
-
* two was noise beside the one action that matters. The
|
|
30
|
+
* There is no «sin guardar» mark in the rail. The two buttons only exist while something
|
|
31
|
+
* changed, and each changed field already says so (`Field changed`): a third signal
|
|
32
|
+
* repeating the other two was noise beside the one action that matters. The floating pill
|
|
33
|
+
* is the exception — it says the moment, because the fields may be out of sight. The only thing written here is what
|
|
27
34
|
* the buttons cannot say — WHY it cannot be saved yet (`blocked`). The count of changes
|
|
28
35
|
* still reaches a screen reader, as the Save button's description. */
|
|
29
|
-
export declare function DirtyActions({ onSave, onDiscard, saving, label, blocked, changes, floating, }: DirtyState & {
|
|
30
|
-
/** In the floating
|
|
31
|
-
* up a long form, out of sight, and their marks with them —
|
|
32
|
-
*
|
|
36
|
+
export declare function DirtyActions({ onSave, onDiscard, saving, label, blocked, changes, message, detail, floating, }: DirtyState & {
|
|
37
|
+
/** In the floating pill (`DirtyBar`, `ActionDock`): what is pending is WRITTEN — the
|
|
38
|
+
* changed fields may be far up a long form, out of sight, and their marks with them — as
|
|
39
|
+
* the pill's sentence (`DockMessage`, `message`/`detail`), and Discard takes the soft red,
|
|
40
|
+
* so the pill reads «what is pending · drop it · save» and not two equal boxes. */
|
|
33
41
|
floating?: boolean;
|
|
34
42
|
}): import("react").JSX.Element;
|
|
35
43
|
/**
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { DockMessage } from "./DockMessage.js";
|
|
3
4
|
import { fillCopy, useUiCopy } from "../../foundations/copy.js";
|
|
4
5
|
import { useKeysHint, useShortcuts } from "../../foundations/shortcut.js";
|
|
5
6
|
import { bySurface, SurfaceProvider, useSurface } from "../../foundations/surface.js";
|
|
@@ -12,12 +13,13 @@ import { useEffect, useId, useRef, useState } from "react";
|
|
|
12
13
|
* the same rule as `FormActions`, and here it matters more: the rail is where
|
|
13
14
|
* the hand is after editing.
|
|
14
15
|
*
|
|
15
|
-
* There is no «sin guardar» mark. The two buttons only exist while something
|
|
16
|
-
* each changed field already says so (`Field changed`): a third signal
|
|
17
|
-
* two was noise beside the one action that matters. The
|
|
16
|
+
* There is no «sin guardar» mark in the rail. The two buttons only exist while something
|
|
17
|
+
* changed, and each changed field already says so (`Field changed`): a third signal
|
|
18
|
+
* repeating the other two was noise beside the one action that matters. The floating pill
|
|
19
|
+
* is the exception — it says the moment, because the fields may be out of sight. The only thing written here is what
|
|
18
20
|
* the buttons cannot say — WHY it cannot be saved yet (`blocked`). The count of changes
|
|
19
21
|
* still reaches a screen reader, as the Save button's description. */
|
|
20
|
-
export function DirtyActions({ onSave, onDiscard, saving = false, label, blocked, changes, floating = false, }) {
|
|
22
|
+
export function DirtyActions({ onSave, onDiscard, saving = false, label, blocked, changes, message, detail, floating = false, }) {
|
|
21
23
|
const copy = useUiCopy();
|
|
22
24
|
/* Mod+S saves wherever Save is — the rail, the thumb bar, a floating pill —: the gesture
|
|
23
25
|
every editor has, and in a browser it would otherwise save the PAGE. */
|
|
@@ -33,15 +35,37 @@ export function DirtyActions({ onSave, onDiscard, saving = false, label, blocked
|
|
|
33
35
|
...(blocked === undefined ? [] : [blockedId]),
|
|
34
36
|
...(counted ? [changesId] : []),
|
|
35
37
|
].join(" ");
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
38
|
+
if (floating) {
|
|
39
|
+
/* The pill's sentence (`DockMessage`), the same one a record's state uses: what is
|
|
40
|
+
pending, and under it why it cannot be saved yet or what saving will do. The dot is the
|
|
41
|
+
accent of a field's own «changed» mark; it turns warn while saving is not possible. */
|
|
42
|
+
const said = message ??
|
|
43
|
+
(counted
|
|
44
|
+
? fillCopy(changes === 1 ? copy.record.unsavedOne : copy.record.unsavedMany, {
|
|
43
45
|
count: changes.toLocaleString(copy.locale),
|
|
44
|
-
})
|
|
46
|
+
})
|
|
47
|
+
: copy.record.unsavedAny);
|
|
48
|
+
const help = blocked ?? detail;
|
|
49
|
+
return (_jsxs(_Fragment, { children: [_jsx(DockMessage, { moment: {
|
|
50
|
+
text: saving ? copy.record.saving : said,
|
|
51
|
+
tone: blocked === undefined ? "accent" : "warn",
|
|
52
|
+
busy: saving,
|
|
53
|
+
...(help === undefined || saving ? {} : { detail: help }),
|
|
54
|
+
}, detailId: blockedId }), _jsx(Button, { surface: surface, onClick: onDiscard, disabled: saving, destructive: true, children: copy.record.discard }), _jsx(Button, { role: "primary", surface: surface, onClick: onSave, busy: saving, disabled: blocked !== undefined, icon: Save, ...(saveHint === undefined
|
|
55
|
+
? {}
|
|
56
|
+
: {
|
|
57
|
+
title: `${copy.record.save} (${saveHint.label})`,
|
|
58
|
+
"aria-keyshortcuts": saveHint.aria,
|
|
59
|
+
}), ...(describedBy === "" ? {} : { "aria-describedby": describedBy }), children: label ?? copy.record.save }), counted ? (_jsx("span", { id: changesId, hidden: true, children: fillCopy(changes === 1 ? copy.record.unsavedOne : copy.record.unsavedMany, {
|
|
60
|
+
count: changes.toLocaleString(copy.locale),
|
|
61
|
+
}) })) : null] }));
|
|
62
|
+
}
|
|
63
|
+
return (_jsxs(_Fragment, { children: [blocked === undefined ? null : (_jsx("span", { id: blockedId, "data-ui": "dirty.blocked", className: `inline-flex h-(--size-control-md) min-w-0 shrink items-center gap-1.5 truncate rounded-control px-2.5 text-meta font-medium ${bySurface(surface, "bg-warn/12 text-warn", "bg-chrome-warn/15 text-chrome-warn")}`, children: blocked })), counted ? (_jsx("span", { id: changesId,
|
|
64
|
+
/* In the rail the changed fields are in sight and the count only describes Save;
|
|
65
|
+
in the floating bar it is written. */
|
|
66
|
+
hidden: true, children: fillCopy(changes === 1 ? copy.record.unsavedOne : copy.record.unsavedMany, {
|
|
67
|
+
count: changes.toLocaleString(copy.locale),
|
|
68
|
+
}) })) : null, _jsx(Button, { surface: surface, onClick: onDiscard, disabled: saving, icon: Undo2, children: copy.record.discard }), _jsx(Button, { role: "primary", surface: surface, onClick: onSave, busy: saving, disabled: blocked !== undefined, icon: Save, ...(saveHint === undefined
|
|
45
69
|
? {}
|
|
46
70
|
: {
|
|
47
71
|
title: `${copy.record.save} (${saveHint.label})`,
|
|
@@ -155,5 +179,5 @@ export function DirtyBar({ dirty, saved, }) {
|
|
|
155
179
|
}, [shown]);
|
|
156
180
|
/* Always mounted, so «Guardado» is announced (see `SavedMark`); with nothing to say it has
|
|
157
181
|
no height and covers nothing. */
|
|
158
|
-
return (_jsxs("div", { ref: ref, "data-ui": "dirty.bar", className: `pointer-events-none sticky bottom-0 z-20 mt-auto flex justify-center px-3 ${shown ? "pt-3 safe-bottom" : ""}`, children: [_jsx("span", { role: "status", className: "sr-only", children: saved ? copy.record.saved : "" }), shown ? (_jsx(SurfaceProvider, { value: "chrome", children: _jsx("div", { style: PILL, className: "pointer-events-auto flex max-w-full min-w-0 items-center gap-1 rounded-pill border border-chrome-edge bg-chrome p-1.5 shadow-float *:shrink-0", children: dirty === undefined ? _jsx(
|
|
182
|
+
return (_jsxs("div", { ref: ref, "data-ui": "dirty.bar", className: `pointer-events-none sticky bottom-0 z-20 mt-auto flex justify-center px-3 ${shown ? "pt-3 safe-bottom" : ""}`, children: [_jsx("span", { role: "status", className: "sr-only", children: saved ? copy.record.saved : "" }), shown ? (_jsx(SurfaceProvider, { value: "chrome", children: _jsx("div", { style: PILL, className: "pointer-events-auto flex max-w-full min-w-0 items-center gap-1 rounded-pill border border-chrome-edge bg-chrome p-1.5 shadow-float *:shrink-0", children: dirty === undefined ? (_jsx(DockMessage, { moment: { text: copy.record.saved, tone: "good", icon: Check } })) : (_jsx(DirtyActions, { ...dirty, floating: true })) }) })) : null] }));
|
|
159
183
|
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { DockMoment } from "./dock.js";
|
|
2
|
+
/**
|
|
3
|
+
* The pill's sentence: a dot of its tone (or its icon), the text, and the help under it.
|
|
4
|
+
*
|
|
5
|
+
* Context: one look for every screen — the unsaved changes, a record waiting on someone,
|
|
6
|
+
* «Guardado» — so the message is told apart by its words and its tone, never by who wrote
|
|
7
|
+
* the screen. It draws, it does not announce: the host keeps ONE always-mounted live region
|
|
8
|
+
* (the pill, `DirtyBar`) — a region inserted together with its words is not reliably read.
|
|
9
|
+
* The visible part is keyed by its text: a new sentence enters with a short rise, so dirty → saved → the record's state reads as one place
|
|
10
|
+
* changing, not as a pill rebuilt. The global reduced-motion rule flattens it.
|
|
11
|
+
*
|
|
12
|
+
* It gives way first: one row on a phone too, the sentence truncates and the buttons stay.
|
|
13
|
+
*/
|
|
14
|
+
export declare function DockMessage({ moment, detailId, }: {
|
|
15
|
+
moment: DockMoment | undefined;
|
|
16
|
+
/** The help's id, for the button it explains (Save names why it is off). */
|
|
17
|
+
detailId?: string;
|
|
18
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { useSurface } from "../../foundations/surface.js";
|
|
4
|
+
import { DOT_TONE } from "../../primitives/tag/Tag.js";
|
|
5
|
+
/* The mark in each tone when it is an icon; the dot is `Tag`'s own (`DOT_TONE`). */
|
|
6
|
+
const INK = {
|
|
7
|
+
neutral: { canvas: "text-muted", chrome: "text-chrome-muted" },
|
|
8
|
+
info: { canvas: "text-info", chrome: "text-chrome-link" },
|
|
9
|
+
good: { canvas: "text-good", chrome: "text-chrome-good" },
|
|
10
|
+
warn: { canvas: "text-warn", chrome: "text-chrome-warn" },
|
|
11
|
+
bad: { canvas: "text-bad", chrome: "text-chrome-bad" },
|
|
12
|
+
accent: { canvas: "text-accent", chrome: "text-chrome-accent" },
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* The pill's sentence: a dot of its tone (or its icon), the text, and the help under it.
|
|
16
|
+
*
|
|
17
|
+
* Context: one look for every screen — the unsaved changes, a record waiting on someone,
|
|
18
|
+
* «Guardado» — so the message is told apart by its words and its tone, never by who wrote
|
|
19
|
+
* the screen. It draws, it does not announce: the host keeps ONE always-mounted live region
|
|
20
|
+
* (the pill, `DirtyBar`) — a region inserted together with its words is not reliably read.
|
|
21
|
+
* The visible part is keyed by its text: a new sentence enters with a short rise, so dirty → saved → the record's state reads as one place
|
|
22
|
+
* changing, not as a pill rebuilt. The global reduced-motion rule flattens it.
|
|
23
|
+
*
|
|
24
|
+
* It gives way first: one row on a phone too, the sentence truncates and the buttons stay.
|
|
25
|
+
*/
|
|
26
|
+
export function DockMessage({ moment, detailId, }) {
|
|
27
|
+
const surface = useSurface() === "chrome" ? "chrome" : "canvas";
|
|
28
|
+
const tone = moment?.tone ?? "neutral";
|
|
29
|
+
const Icon = moment?.icon;
|
|
30
|
+
return (_jsx(_Fragment, { children: moment === undefined ? null : (_jsxs("span", { "data-ui": "dock.message", "data-tone": tone, className: "flex min-w-0 shrink! items-center gap-2 px-2.5 transition-[opacity,translate] duration-(--duration-quick) ease-(--ease-out) starting:translate-y-0.5 starting:opacity-0", children: [Icon === undefined ? (_jsxs("span", { "aria-hidden": true, className: "relative flex size-1.5 shrink-0", children: [moment.busy === true ? (_jsx("span", { className: `absolute inline-flex size-full animate-ping rounded-pill opacity-70 ${DOT_TONE[tone][surface]}` })) : null, _jsx("span", { className: `relative inline-flex size-1.5 rounded-pill ${DOT_TONE[tone][surface]}` })] })) : (_jsx(Icon, { "aria-hidden": true, strokeWidth: 2.25, className: `size-(--size-icon-sm) shrink-0 ${INK[tone][surface]}` })), _jsxs("span", { className: "flex min-w-0 flex-col leading-tight", children: [_jsx("span", { className: `truncate text-meta font-medium ${surface === "chrome" ? "text-chrome-ink" : "text-ink"}`, children: moment.text }), moment.detail === undefined ? null : (_jsx("span", { ...(detailId === undefined ? {} : { id: detailId }), className: `truncate text-micro ${surface === "chrome" ? "text-chrome-muted" : "text-muted"}`, children: moment.detail }))] })] }, moment.text)) }));
|
|
31
|
+
}
|
|
@@ -1,5 +1,30 @@
|
|
|
1
|
+
import type { Tone } from "../../foundations/types.js";
|
|
1
2
|
import type { MenuGroup, MenuOption } from "../../primitives/menu/Menu.js";
|
|
2
3
|
import type { LucideIcon } from "lucide-react";
|
|
4
|
+
/**
|
|
5
|
+
* What the pill SAYS about the moment, before its actions — «Colegiado observado · falta el
|
|
6
|
+
* certificado», «Cambios sin guardar · se avisará al cliente al guardar», «Guardado».
|
|
7
|
+
*
|
|
8
|
+
* Context: the pill only offered buttons, and an application that wanted to say something
|
|
9
|
+
* wrote its own node in `lead`: each screen styled its message, and the pills stopped looking
|
|
10
|
+
* alike. This is the common case, drawn the same everywhere (`DockMessage`): a dot of the
|
|
11
|
+
* tone, the sentence, and under it the help that explains it. It is DATA the screen changes
|
|
12
|
+
* with its state — the record's stage, why it cannot go on, what saving will do —, not copy
|
|
13
|
+
* fixed in the component.
|
|
14
|
+
*/
|
|
15
|
+
export interface DockMoment {
|
|
16
|
+
/** The sentence, short: it truncates before the buttons give way. */
|
|
17
|
+
text: string;
|
|
18
|
+
/** The help under it, quieter: why, or what happens next. */
|
|
19
|
+
detail?: string;
|
|
20
|
+
/** What the moment means: `warn` something waits for you, `bad` something failed, `good`
|
|
21
|
+
* done, `info` news. Without this, `neutral`. Never alone: the text says it too. */
|
|
22
|
+
tone?: Tone;
|
|
23
|
+
/** In place of the dot, when a mark says it faster. */
|
|
24
|
+
icon?: LucideIcon;
|
|
25
|
+
/** Something is happening right now (saving, sending): the dot breathes. */
|
|
26
|
+
busy?: boolean;
|
|
27
|
+
}
|
|
3
28
|
/** One action of a dock. */
|
|
4
29
|
export interface DockAction {
|
|
5
30
|
id: string;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
export { ActionDock, type ActionDockProps, type DockLook, type DockPlacement, type RecordDockPlacement, type RecordDockProps, } from "./ActionDock.js";
|
|
2
2
|
export { Breadcrumb, type Crumb } from "./Breadcrumb.js";
|
|
3
3
|
export { DirtyActions, type DirtyState, } from "./DirtyActions.js";
|
|
4
|
-
export { type DockAction, dockOption, type DockPlan, dockPlan, moreGroups, } from "./dock.js";
|
|
4
|
+
export { type DockAction, type DockMoment, dockOption, type DockPlan, dockPlan, moreGroups, } from "./dock.js";
|
|
5
|
+
export { DockMessage } from "./DockMessage.js";
|
|
5
6
|
export { Pager } from "./Pager.js";
|
|
6
7
|
export { RecordAudit, type RecordStamp } from "./RecordAudit.js";
|
|
7
8
|
export { RecordRibbon } from "./RecordRibbon.js";
|
|
@@ -6,6 +6,7 @@ export { ActionDock, } from "./ActionDock.js";
|
|
|
6
6
|
export { Breadcrumb } from "./Breadcrumb.js";
|
|
7
7
|
export { DirtyActions, } from "./DirtyActions.js";
|
|
8
8
|
export { dockOption, dockPlan, moreGroups, } from "./dock.js";
|
|
9
|
+
export { DockMessage } from "./DockMessage.js";
|
|
9
10
|
export { Pager } from "./Pager.js";
|
|
10
11
|
export { RecordAudit } from "./RecordAudit.js";
|
|
11
12
|
export { RecordRibbon } from "./RecordRibbon.js";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* The page's margin, for content that is not a view.
|
|
4
|
+
*
|
|
5
|
+
* Context: a `Record` and a `List` bring their own margin; a page made of other pieces — a
|
|
6
|
+
* `SetupCard` under a section's tab, an `Empty` that is the whole page, a dashboard — did not
|
|
7
|
+
* have one, and each piece adding its own doubled it inside a padded frame. The frame holds
|
|
8
|
+
* the page; this gives it the side margin and the reading width, once.
|
|
9
|
+
*/
|
|
10
|
+
export declare function Page({ children }: {
|
|
11
|
+
children: ReactNode;
|
|
12
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* The page's margin, for content that is not a view.
|
|
4
|
+
*
|
|
5
|
+
* Context: a `Record` and a `List` bring their own margin; a page made of other pieces — a
|
|
6
|
+
* `SetupCard` under a section's tab, an `Empty` that is the whole page, a dashboard — did not
|
|
7
|
+
* have one, and each piece adding its own doubled it inside a padded frame. The frame holds
|
|
8
|
+
* the page; this gives it the side margin and the reading width, once.
|
|
9
|
+
*/
|
|
10
|
+
export function Page({ children }) {
|
|
11
|
+
return (_jsx("div", { "data-ui": "page", className: "mx-auto flex w-full max-w-(--container-sheet) min-w-0 flex-col gap-4 p-4 sm:p-6", children: children }));
|
|
12
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type BrandLogo } from "./brandMark.js";
|
|
2
2
|
import { type SearchEntryProps } from "./SearchEntry.js";
|
|
3
3
|
import type { Surface } from "../../foundations/types.js";
|
|
4
|
-
import type
|
|
4
|
+
import { type LucideIcon } from "lucide-react";
|
|
5
5
|
import type { ReactNode } from "react";
|
|
6
6
|
export type SidebarAction = {
|
|
7
7
|
id: string;
|
|
@@ -11,6 +11,13 @@ export type SidebarAction = {
|
|
|
11
11
|
href?: string;
|
|
12
12
|
/** The link opens in another tab; a screen reader is told so. */
|
|
13
13
|
external?: boolean;
|
|
14
|
+
/** Choosing it copies this text — «Copiar código de soporte CR-00CED9» — and is reported
|
|
15
|
+
* too, so the application can say «Copiado». */
|
|
16
|
+
copy?: string;
|
|
17
|
+
/** A hairline above it in the account menu: «Salir» apart from the rest. */
|
|
18
|
+
apart?: boolean;
|
|
19
|
+
/** It ends something — «Salir», «Cerrar todas las sesiones»: in the danger tone. */
|
|
20
|
+
danger?: boolean;
|
|
14
21
|
};
|
|
15
22
|
export type SidebarProps = {
|
|
16
23
|
/** The product, at the top: its name and its mark — an icon, or its logo: the URL of an
|
|
@@ -19,13 +26,25 @@ export type SidebarProps = {
|
|
|
19
26
|
label: string;
|
|
20
27
|
icon?: LucideIcon;
|
|
21
28
|
logo?: BrandLogo;
|
|
29
|
+
/** A word beside the name — the plan, the environment: «Avanzado», «Pruebas». */
|
|
30
|
+
badge?: string;
|
|
22
31
|
};
|
|
23
|
-
/** Who is signed in.
|
|
32
|
+
/** Who is signed in. `detail` is the role under the name; `org` names whose account it is,
|
|
33
|
+
* in the menu's header. */
|
|
24
34
|
user?: {
|
|
25
35
|
name: string;
|
|
26
36
|
detail?: string;
|
|
27
37
|
avatar?: string;
|
|
38
|
+
org?: string;
|
|
28
39
|
};
|
|
40
|
+
/** `menu` (default): the person at the bottom, a button that opens the account's menu.
|
|
41
|
+
* `list`: the person at the top and the account's verbs listed at the bottom. */
|
|
42
|
+
account?: "menu" | "list";
|
|
43
|
+
/** The theme (system / light / dark) as one row of the account menu. */
|
|
44
|
+
theme?: boolean;
|
|
45
|
+
/** Beside the person — at the foot with `account="menu"`, beside the name on top with
|
|
46
|
+
* `"list"`: the notifications (`SystrayButton`, `Notifications`). */
|
|
47
|
+
bell?: ReactNode;
|
|
29
48
|
/** «Buscar… ⌘K» under the product and the user: the application's palette, made visible.
|
|
30
49
|
* `onSearch` opens it; the palette keeps listening for its own key. */
|
|
31
50
|
search?: Omit<SearchEntryProps, "layout" | "surface">;
|
|
@@ -40,4 +59,4 @@ export type SidebarProps = {
|
|
|
40
59
|
/** `chrome` wears the brand's colour. By default the frame's `sidebarSurface`. */
|
|
41
60
|
surface?: Surface;
|
|
42
61
|
};
|
|
43
|
-
export declare function Sidebar({ brand, user, search, children, actions, onAction, footer, surface, }: SidebarProps): import("react").JSX.Element;
|
|
62
|
+
export declare function Sidebar({ brand, user, search, children, actions, onAction, footer, surface, account, theme, bell, }: SidebarProps): import("react").JSX.Element;
|