@sincpro/web-ui 2.8.0 → 2.9.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 +143 -2
- package/dist/components/activity/Activity.js +3 -2
- package/dist/components/form/Form.js +12 -3
- package/dist/components/form/FormIndex.d.ts +5 -1
- package/dist/components/form/FormIndex.js +71 -23
- package/dist/components/form/Sheet.js +22 -4
- package/dist/components/record/ActionDock.d.ts +36 -0
- package/dist/components/record/ActionDock.js +58 -0
- package/dist/components/record/Breadcrumb.d.ts +3 -1
- package/dist/components/record/Breadcrumb.js +13 -5
- package/dist/components/record/DirtyActions.js +11 -1
- package/dist/components/record/Pager.d.ts +12 -10
- package/dist/components/record/Pager.js +39 -6
- package/dist/components/record/RecordHeader.d.ts +13 -1
- package/dist/components/record/RecordHeader.js +107 -31
- package/dist/components/record/SmartButtons.d.ts +8 -2
- package/dist/components/record/SmartButtons.js +8 -3
- package/dist/components/record/StatusBar.d.ts +68 -1
- package/dist/components/record/StatusBar.js +218 -48
- package/dist/components/record/dock.d.ts +56 -0
- package/dist/components/record/dock.js +58 -0
- package/dist/components/record/index.d.ts +3 -1
- package/dist/components/record/index.js +5 -1
- package/dist/foundations/copy.d.ts +9 -0
- package/dist/foundations/copy.es.js +10 -1
- package/dist/foundations/copy.js +5 -0
- package/dist/foundations/form.d.ts +10 -1
- package/dist/foundations/grouping.d.ts +9 -0
- package/dist/foundations/index.d.ts +3 -1
- package/dist/foundations/index.js +8 -2
- package/dist/foundations/keys.d.ts +34 -0
- package/dist/foundations/keys.js +99 -0
- package/dist/foundations/shortcut.d.ts +17 -1
- package/dist/foundations/shortcut.js +57 -1
- package/dist/foundations/viewStyle.d.ts +8 -0
- package/dist/foundations/viewStyle.js +12 -0
- package/dist/primitives/menu/Menu.d.ts +3 -0
- package/dist/primitives/menu/Menu.js +7 -1
- package/dist/primitives/table/DataTable.d.ts +15 -0
- package/dist/primitives/table/DataTable.js +67 -12
- package/dist/primitives/table/EditableTable.js +7 -2
- package/dist/primitives/table/SheetTable.d.ts +3 -0
- package/dist/primitives/table/SheetTable.js +15 -2
- package/dist/primitives/value/Value.d.ts +5 -1
- package/dist/primitives/value/Value.js +9 -3
- package/dist/tokens.css +19 -2
- package/dist/views/list/List.d.ts +2 -1
- package/dist/views/list/List.js +6 -2
- package/dist/views/list/ListView.d.ts +1 -1
- package/dist/views/list/ListView.js +53 -14
- package/dist/views/list/derive.d.ts +1 -1
- package/dist/views/list/derive.js +45 -9
- package/dist/views/list/types.d.ts +33 -0
- package/dist/views/record/Record.d.ts +16 -2
- package/dist/views/record/Record.js +33 -8
- package/package.json +1 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { fillCopy, useUiCopy } from "../../foundations/copy.js";
|
|
4
|
+
import { useKeysHint, useShortcuts } from "../../foundations/shortcut.js";
|
|
4
5
|
import { bySurface, SurfaceProvider, useSurface } from "../../foundations/surface.js";
|
|
5
6
|
import { Button } from "../../primitives/button/Button.js";
|
|
6
7
|
import { Check, Save, Undo2 } from "lucide-react";
|
|
@@ -18,6 +19,10 @@ import { useEffect, useId, useRef, useState } from "react";
|
|
|
18
19
|
* still reaches a screen reader, as the Save button's description. */
|
|
19
20
|
export function DirtyActions({ onSave, onDiscard, saving = false, label, blocked, changes, floating = false, }) {
|
|
20
21
|
const copy = useUiCopy();
|
|
22
|
+
/* Mod+S saves wherever Save is — the rail, the thumb bar, a floating pill —: the gesture
|
|
23
|
+
every editor has, and in a browser it would otherwise save the PAGE. */
|
|
24
|
+
useShortcuts([{ keys: "Mod+S", run: onSave, enabled: blocked === undefined && !saving }]);
|
|
25
|
+
const saveHint = useKeysHint("Mod+S");
|
|
21
26
|
const blockedId = useId();
|
|
22
27
|
const changesId = useId();
|
|
23
28
|
/* It follows the rail it sits on instead of assuming the dark one: on a light rail the
|
|
@@ -36,7 +41,12 @@ export function DirtyActions({ onSave, onDiscard, saving = false, label, blocked
|
|
|
36
41
|
}
|
|
37
42
|
: { hidden: true }), children: fillCopy(changes === 1 ? copy.record.unsavedOne : copy.record.unsavedMany, {
|
|
38
43
|
count: changes.toLocaleString(copy.locale),
|
|
39
|
-
}) })) : null, _jsx(Button, { ...(floating ? { role: "ghost" } : {}), 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, ...(
|
|
44
|
+
}) })) : null, _jsx(Button, { ...(floating ? { role: "ghost" } : {}), 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
|
+
? {}
|
|
46
|
+
: {
|
|
47
|
+
title: `${copy.record.save} (${saveHint.label})`,
|
|
48
|
+
"aria-keyshortcuts": saveHint.aria,
|
|
49
|
+
}), ...(describedBy === "" ? {} : { "aria-describedby": describedBy }), children: saving ? copy.record.saving : (label ?? copy.record.save) })] }));
|
|
40
50
|
}
|
|
41
51
|
/** The one action a view leads with: the element written with `role="primary"` — the
|
|
42
52
|
* same prop that paints it gold and that `make smoke` counts, so there is no second way to
|
|
@@ -1,18 +1,20 @@
|
|
|
1
|
+
import type { Keys } from "../../foundations/keys.js";
|
|
1
2
|
import type { Surface } from "../../foundations/types.js";
|
|
2
|
-
|
|
3
|
-
*
|
|
4
|
-
* **It turns a record into a position.** Without this, opening the third of a
|
|
5
|
-
* list of eighty and wanting to see the fourth forces going back, finding
|
|
6
|
-
* where you were and opening again — three actions for what is one arrow.
|
|
7
|
-
*
|
|
8
|
-
* It goes far from the actions on purpose: moving between records is not doing
|
|
9
|
-
* something to this record. Stuck next to «Eliminar», one extra click on the
|
|
10
|
-
* wrong arrow is a destructive action. */
|
|
11
|
-
export declare function Pager({ index, total, onPrev, onNext, surface: surfaceProp, }: {
|
|
3
|
+
export declare function Pager({ index, total, onPrev, onNext, surface: surfaceProp, look, keys, }: {
|
|
12
4
|
/** 1-based: what gets shown is «12 de 80», not «11». */
|
|
13
5
|
index: number;
|
|
14
6
|
total: number;
|
|
15
7
|
onPrev?: () => void;
|
|
16
8
|
onNext?: () => void;
|
|
17
9
|
surface?: Surface;
|
|
10
|
+
/** `plain`: quiet, a count and two arrows. `pill`: the position stands out — a translucent
|
|
11
|
+
* primary pill, Odoo's — for the record's modern style, where the trail is the heading
|
|
12
|
+
* and the pager its counterpart on the line. */
|
|
13
|
+
look?: "plain" | "pill";
|
|
14
|
+
/** The combinations that move: Alt+P and Alt+N by default, `false` for none. Bound while the
|
|
15
|
+
* pager is on screen — the last record mounted answers (`useShortcuts`). */
|
|
16
|
+
keys?: {
|
|
17
|
+
prev: Keys;
|
|
18
|
+
next: Keys;
|
|
19
|
+
} | false;
|
|
18
20
|
}): import("react").JSX.Element;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import { useUiCopy } from "../../foundations/copy.js";
|
|
4
|
+
import { useKeysHint, useShortcuts } from "../../foundations/shortcut.js";
|
|
4
5
|
import { useSurface } from "../../foundations/surface.js";
|
|
5
6
|
import { ChevronLeft, ChevronRight } from "lucide-react";
|
|
6
7
|
/* ---------------------------------------------------------------- *
|
|
@@ -15,19 +16,51 @@ import { ChevronLeft, ChevronRight } from "lucide-react";
|
|
|
15
16
|
* It goes far from the actions on purpose: moving between records is not doing
|
|
16
17
|
* something to this record. Stuck next to «Eliminar», one extra click on the
|
|
17
18
|
* wrong arrow is a destructive action. */
|
|
18
|
-
|
|
19
|
+
/** The combinations a pager answers by default: Odoo's — Alt+P the previous, Alt+N the next. */
|
|
20
|
+
const PAGER_KEYS = { prev: "Alt+P", next: "Alt+N" };
|
|
21
|
+
export function Pager({ index, total, onPrev, onNext, surface: surfaceProp, look = "plain", keys = PAGER_KEYS, }) {
|
|
19
22
|
const copy = useUiCopy();
|
|
20
23
|
const surface = useSurface(surfaceProp);
|
|
21
24
|
const isChrome = surface === "chrome";
|
|
22
|
-
const
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
|
|
25
|
+
const pill = look === "pill";
|
|
26
|
+
const atStart = index <= 1;
|
|
27
|
+
const atEnd = index >= total;
|
|
28
|
+
useShortcuts(keys === false
|
|
29
|
+
? []
|
|
30
|
+
: [
|
|
31
|
+
{
|
|
32
|
+
keys: keys.prev,
|
|
33
|
+
run: () => onPrev?.(),
|
|
34
|
+
enabled: onPrev !== undefined && !atStart,
|
|
35
|
+
},
|
|
36
|
+
{ keys: keys.next, run: () => onNext?.(), enabled: onNext !== undefined && !atEnd },
|
|
37
|
+
]);
|
|
38
|
+
const prevHint = useKeysHint(keys === false ? undefined : keys.prev);
|
|
39
|
+
const nextHint = useKeysHint(keys === false ? undefined : keys.next);
|
|
40
|
+
const faint = pill
|
|
41
|
+
? isChrome
|
|
42
|
+
? "text-chrome-link"
|
|
43
|
+
: "text-primary"
|
|
44
|
+
: isChrome
|
|
45
|
+
? "text-chrome-muted"
|
|
46
|
+
: "text-muted";
|
|
47
|
+
const hover = pill
|
|
48
|
+
? isChrome
|
|
49
|
+
? "not-disabled:hover:bg-chrome-link/20"
|
|
50
|
+
: "not-disabled:hover:bg-primary/15"
|
|
51
|
+
: isChrome
|
|
52
|
+
? "not-disabled:hover:bg-chrome-ink/10 not-disabled:hover:text-chrome-ink"
|
|
53
|
+
: "not-disabled:hover:bg-ink/6 not-disabled:hover:text-ink";
|
|
26
54
|
/* On the chrome the ring is the chrome's link cyan, like the TopBar's: the
|
|
27
55
|
primary navy on a navy band is a ring nobody sees. */
|
|
28
56
|
const ring = isChrome
|
|
29
57
|
? "focus-visible:outline-chrome-link"
|
|
30
58
|
: "focus-visible:outline-primary";
|
|
31
59
|
const arrow = `inline-flex size-(--size-control-sm) items-center justify-center rounded-pill transition-colors duration-(--duration-instant) disabled:opacity-30 focus-visible:outline-2 focus-visible:outline-offset-2 ${ring} ${faint} ${hover}`;
|
|
32
|
-
|
|
60
|
+
const titled = (word, hint) => hint === undefined ? word : `${word} (${hint.label})`;
|
|
61
|
+
return (_jsxs("div", { "data-ui": "pager", "data-look": look, className: `flex shrink-0 items-center gap-1 ${pill
|
|
62
|
+
? `rounded-pill border p-0.5 ${isChrome
|
|
63
|
+
? "border-chrome-link/30 bg-chrome-link/12"
|
|
64
|
+
: "border-primary/20 bg-primary/8"}`
|
|
65
|
+
: ""}`, children: [_jsxs("span", { className: `tabular-nums ${pill ? `px-2 text-meta font-semibold ${faint}` : `text-micro ${faint}`}`, children: [index, " / ", total.toLocaleString(copy.locale)] }), _jsx("button", { type: "button", onClick: onPrev, disabled: atStart, "aria-label": copy.record.prev, title: titled(copy.record.prev, prevHint), ...(prevHint === undefined ? {} : { "aria-keyshortcuts": prevHint.aria }), className: arrow, children: _jsx(ChevronLeft, { className: "size-(--size-icon-md)", strokeWidth: 2 }) }), _jsx("button", { type: "button", onClick: onNext, disabled: atEnd, "aria-label": copy.record.next, title: titled(copy.record.next, nextHint), ...(nextHint === undefined ? {} : { "aria-keyshortcuts": nextHint.aria }), className: arrow, children: _jsx(ChevronRight, { className: "size-(--size-icon-md)", strokeWidth: 2 }) })] }));
|
|
33
66
|
}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
+
import { type RecordDockProps } from "./ActionDock.js";
|
|
1
2
|
import { type Crumb } from "./Breadcrumb.js";
|
|
2
3
|
import { type DirtyState } from "./DirtyActions.js";
|
|
3
4
|
import type { Surface, Tone } from "../../foundations/types.js";
|
|
5
|
+
import { type ViewStyle } from "../../foundations/viewStyle.js";
|
|
4
6
|
import type { LucideIcon } from "lucide-react";
|
|
5
7
|
import { type ReactNode } from "react";
|
|
6
8
|
export type { Surface };
|
|
7
|
-
export declare function RecordHeader({ crumbs, pager, actions, status, kicker, icon: Icon, title, subtitle, tag, figure, railSurface, smart, aspects, dirty, activity, activityLayout, width, ribbon, blocking, indicator, paper: onPaper, children, }: {
|
|
9
|
+
export declare function RecordHeader({ crumbs, pager, actions, status, kicker, icon: Icon, title, subtitle, tag, figure, railSurface, smart, aspects, dirty, activity, activityLayout, width, ribbon, blocking, indicator, paper: onPaper, dock, look, children, }: {
|
|
8
10
|
crumbs?: readonly Crumb[];
|
|
9
11
|
pager?: ReactNode;
|
|
10
12
|
/** The action buttons. At most three visible + a `Menu` with `iconOnly`, and
|
|
@@ -79,6 +81,16 @@ export declare function RecordHeader({ crumbs, pager, actions, status, kicker, i
|
|
|
79
81
|
* `placement`). Only in comfortable: compact (the peek) is always one surface. Omitted, it
|
|
80
82
|
* is guessed from the rail: crumbs, pager or actions mean a page. */
|
|
81
83
|
paper?: boolean;
|
|
84
|
+
/**
|
|
85
|
+
* The record's actions FLOATING (`ActionDock`): in place of `actions` and of
|
|
86
|
+
* Save / Discard on the rail, one pill that, at the top, sits over the paper and stays in
|
|
87
|
+
* view as the record scrolls; at the bottom, the settings bar's place. The rail keeps where
|
|
88
|
+
* I am, which of eighty, and the state.
|
|
89
|
+
*/
|
|
90
|
+
dock?: RecordDockProps;
|
|
91
|
+
/** How the record is drawn — `traditional` or `modern`. Absent, the
|
|
92
|
+
* `ViewStyleProvider`'s. See `style.tsx`. */
|
|
93
|
+
look?: ViewStyle;
|
|
82
94
|
/** The record body. It sits IN the paper with the title, so groups, tabs
|
|
83
95
|
* and the page are one white sheet on the ground — Odoo's `<sheet>`. */
|
|
84
96
|
children?: ReactNode;
|
|
@@ -1,24 +1,35 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { ActionDock, } from "./ActionDock.js";
|
|
3
4
|
import { Breadcrumb } from "./Breadcrumb.js";
|
|
4
5
|
import { DirtyActions, DirtyBar, SavedMark, useJustSaved, } from "./DirtyActions.js";
|
|
5
6
|
import { isPrimary, ThumbBar, thumbPlan } from "./ThumbBar.js";
|
|
6
7
|
import { byDensity, useDensity } from "../../foundations/density.js";
|
|
7
8
|
import { useFormStyle } from "../../foundations/form.js";
|
|
9
|
+
import { stickyTop, useStickyLayer } from "../../foundations/sticky.js";
|
|
8
10
|
import { SurfaceProvider } from "../../foundations/surface.js";
|
|
11
|
+
import { useViewStyle } from "../../foundations/viewStyle.js";
|
|
9
12
|
import { Line } from "../../primitives/block/Line.js";
|
|
10
13
|
import { Tag } from "../../primitives/tag/Tag.js";
|
|
11
|
-
import { useEffect, useRef } from "react";
|
|
12
|
-
export function RecordHeader({ crumbs, pager, actions, status, kicker, icon: Icon, title, subtitle, tag, figure, railSurface = "canvas", smart, aspects, dirty, activity, activityLayout = "auto", width = "reading", ribbon, blocking, indicator, paper: onPaper, children, }) {
|
|
14
|
+
import { useEffect, useRef, useState } from "react";
|
|
15
|
+
export function RecordHeader({ crumbs, pager, actions, status, kicker, icon: Icon, title, subtitle, tag, figure, railSurface = "canvas", smart, aspects, dirty, activity, activityLayout = "auto", width = "reading", ribbon, blocking, indicator, paper: onPaper, dock, look, children, }) {
|
|
13
16
|
const d = useDensity();
|
|
14
|
-
/* The «settings» form
|
|
15
|
-
(`DirtyBar`) instead of taking the rail and the thumb bar, and the record has
|
|
16
|
-
sheet of its own — its sections are the cards, on the ground. */
|
|
17
|
-
const floating = useFormStyle()
|
|
17
|
+
/* The «settings» and «sections» form styles (`FormStyleProvider`): Save and Discard float
|
|
18
|
+
at the bottom (`DirtyBar`) instead of taking the rail and the thumb bar, and the record has
|
|
19
|
+
no white sheet of its own — its sections are the cards, on the ground. */
|
|
20
|
+
const floating = useFormStyle() !== "dense";
|
|
18
21
|
/* «Guardado» is said where Save was; a record whose rail exists only while it has changes
|
|
19
22
|
keeps it for that moment, or the answer would leave with the question. */
|
|
20
23
|
const saved = useJustSaved(dirty);
|
|
21
|
-
|
|
24
|
+
/* THE STYLE decides where the dock's actions go when the dock does not say: the rail's
|
|
25
|
+
buttons in `traditional`, the floating pill at the bottom in `modern`. The same `DockAction`s
|
|
26
|
+
draw both. Floating, the pill holds the actions AND Save / Discard: the rail keeps the
|
|
27
|
+
rest. */
|
|
28
|
+
const modern = useViewStyle(look) === "modern";
|
|
29
|
+
const dockWhere = dock === undefined ? undefined : (dock.placement ?? (modern ? "bottom" : "rail"));
|
|
30
|
+
const docked = dockWhere === "top" || dockWhere === "bottom";
|
|
31
|
+
const railDirty = floating || docked ? undefined : dirty;
|
|
32
|
+
const railActions_ = docked ? undefined : dock !== undefined ? (_jsx(ActionDock, { ...dock, look: "bare", placement: "inline" })) : (actions);
|
|
22
33
|
/* Save is gone the moment it has saved, and the focus that was on it fell to the page —
|
|
23
34
|
a keyboard was left at the top of the document. It comes back to the record's name:
|
|
24
35
|
where reading the record starts, and announced together with «Guardado». */
|
|
@@ -30,10 +41,10 @@ export function RecordHeader({ crumbs, pager, actions, status, kicker, icon: Ico
|
|
|
30
41
|
if (lost)
|
|
31
42
|
nameRef.current?.focus({ preventScroll: true });
|
|
32
43
|
}, [saved]);
|
|
33
|
-
const hasRail = (saved && !floating) ||
|
|
44
|
+
const hasRail = (saved && !floating && !docked) ||
|
|
34
45
|
crumbs !== undefined ||
|
|
35
46
|
pager !== undefined ||
|
|
36
|
-
|
|
47
|
+
railActions_ !== undefined ||
|
|
37
48
|
status !== undefined ||
|
|
38
49
|
railDirty !== undefined;
|
|
39
50
|
/* In compact the rail goes away ENTIRELY, and it is not for room: in a
|
|
@@ -48,7 +59,7 @@ export function RecordHeader({ crumbs, pager, actions, status, kicker, icon: Ico
|
|
|
48
59
|
/* The activity column at the RIGHT of the sheet when the page is wide (THE PAGE). */
|
|
49
60
|
const beside = activity !== undefined && activityLayout === "auto";
|
|
50
61
|
/* The thumb bar's content (see THE THUMB BAR in `ThumbBar`): dirty first, else the primary. */
|
|
51
|
-
const { rail: railActions, primaries, mode: thumb, } = thumbPlan({ withRail, actions, dirty: railDirty });
|
|
62
|
+
const { rail: railActions, primaries, mode: thumb, } = thumbPlan({ withRail, actions: railActions_, dirty: railDirty });
|
|
52
63
|
/* In compact the TITLE is not drawn either, for the same reason as in
|
|
53
64
|
`Listing`: the surface header already says it. Drawing it here showed it
|
|
54
65
|
twice in the same 480 px drawer — and the name of a customer in this product
|
|
@@ -74,7 +85,11 @@ export function RecordHeader({ crumbs, pager, actions, status, kicker, icon: Ico
|
|
|
74
85
|
arrive late (loaded, allowed) and the guess flips with them. `paper`, when given, is the
|
|
75
86
|
answer — the rail's contents no longer decide it. */
|
|
76
87
|
const paper = onPaper === undefined
|
|
77
|
-
? withRail &&
|
|
88
|
+
? withRail &&
|
|
89
|
+
(crumbs !== undefined ||
|
|
90
|
+
pager !== undefined ||
|
|
91
|
+
actions !== undefined ||
|
|
92
|
+
dock !== undefined)
|
|
78
93
|
: onPaper && d === "comfortable";
|
|
79
94
|
/* ONE column for the rail and the page: the rail used to span the screen while the sheet
|
|
80
95
|
stopped at 72rem, so on a wide desk the buttons sat 250 px left of the paper they act on
|
|
@@ -84,6 +99,44 @@ export function RecordHeader({ crumbs, pager, actions, status, kicker, icon: Ico
|
|
|
84
99
|
: beside
|
|
85
100
|
? "mx-auto w-full max-w-(--container-record)"
|
|
86
101
|
: "mx-auto w-full max-w-(--container-sheet)";
|
|
102
|
+
/* THE DOCK AT THE TOP. At rest it is the RAIL's: in its second row, where the actions were,
|
|
103
|
+
with the state at the other end — a band of its own between the rail and the paper was a
|
|
104
|
+
fourth band before the record, and read as empty space. When the rail scrolls away, the pill
|
|
105
|
+
FLOATS: it detaches and stays at the top of the page, under whatever already sticks.
|
|
106
|
+
Floating it is one more layer of the sticky stack —a table header sticks under it, not
|
|
107
|
+
behind it— over a veil of the ground, so what scrolls passes under the pill instead of
|
|
108
|
+
peeking between it and the header. Without a rail (a dialog, compact) it floats from the
|
|
109
|
+
start, in the flow. */
|
|
110
|
+
const dockTop = dockWhere === "top";
|
|
111
|
+
const inRail = dockTop && withRail;
|
|
112
|
+
const anchor = useRef(null);
|
|
113
|
+
const [detached, setDetached] = useState(false);
|
|
114
|
+
useEffect(() => {
|
|
115
|
+
const node = anchor.current;
|
|
116
|
+
if (!inRail || node === null || typeof IntersectionObserver === "undefined") {
|
|
117
|
+
setDetached(false);
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
/* Detached once the rail's pill is wholly ABOVE the view — not below it, at the bottom of a
|
|
121
|
+
short window, where it is about to be scrolled to. */
|
|
122
|
+
const observer = new IntersectionObserver(([entry]) => {
|
|
123
|
+
if (entry === undefined)
|
|
124
|
+
return;
|
|
125
|
+
const top = entry.rootBounds?.top ?? 0;
|
|
126
|
+
setDetached(!entry.isIntersecting && entry.boundingClientRect.bottom <= top);
|
|
127
|
+
});
|
|
128
|
+
observer.observe(node);
|
|
129
|
+
return () => observer.disconnect();
|
|
130
|
+
}, [inRail]);
|
|
131
|
+
const floats = dockTop && (!inRail || detached);
|
|
132
|
+
const dockLayer = useStickyLayer();
|
|
133
|
+
const justify = dock?.align === "end" ? "justify-end" : "justify-center";
|
|
134
|
+
const dockPill = dock === undefined ? null : (_jsx(ActionDock, { ...dock, ...(dirty === undefined ? {} : { dirty }), saved: saved, placement: "inline" }));
|
|
135
|
+
const topDock = !dockTop ? null : inRail ? (
|
|
136
|
+
/* Takes no room: it only holds the pill while the rail's is out of sight. */
|
|
137
|
+
_jsx("div", { style: stickyTop, className: `pointer-events-none sticky z-20 h-0 ${paper ? column : ""}`, children: _jsx("div", { ref: dockLayer.ref, className: `absolute inset-x-0 top-0 flex ${justify} pt-2 pb-3 ${detached
|
|
138
|
+
? "bg-linear-to-b from-ground from-75% to-transparent transition-[opacity,translate] duration-(--duration-quick) ease-(--ease-out) starting:-translate-y-1 starting:opacity-0"
|
|
139
|
+
: ""}`, children: detached ? dockPill : null }) })) : (_jsx("div", { ref: dockLayer.ref, style: dockLayer.self, className: `pointer-events-none sticky z-20 -mt-1 flex bg-linear-to-b from-ground from-75% to-transparent pb-3 ${paper ? column : ""} ${justify}`, children: dockPill }));
|
|
87
140
|
const identity = (_jsxs("div", { className: `flex flex-col ${byDensity(d, "gap-2.5 px-4 pt-3.5", "gap-2 px-0 pt-0")}`, children: [withRail || (smart === undefined && indicator === undefined) ? null : (_jsxs("div", { className: "flex min-w-0 flex-wrap items-center gap-2", children: [smart, indicator] })), _jsxs("div", { className: "flex min-w-0 flex-wrap items-start gap-x-5 gap-y-2", children: [_jsxs("div", { className: "flex min-w-0 items-start gap-2.5", children: [Icon === undefined || d === "compact" ? null : (_jsx("span", { className: "mt-1 flex size-9 shrink-0 items-center justify-center rounded-box bg-ink/5 text-muted", children: _jsx(Icon, { className: "size-(--size-icon-lg)", strokeWidth: 1.75 }) })), _jsxs("div", { className: "flex min-w-0 flex-col", children: [kicker === undefined || !withIdentity ? null : (_jsx("span", { className: "text-micro font-medium text-muted", children: kicker })), _jsxs("div", { className: "flex min-w-0 flex-wrap items-center gap-x-3 gap-y-1", children: [!withIdentity ? null : (
|
|
88
141
|
/* `display`, not `title`: the record's name is the entry point of the
|
|
89
142
|
screen. At the title size (19 px over a 13 px body, 1.46:1) nothing on
|
|
@@ -92,21 +145,44 @@ export function RecordHeader({ crumbs, pager, actions, status, kicker, icon: Ico
|
|
|
92
145
|
/* The line is the sheet's mouth. In comfortable it walks to the
|
|
93
146
|
edges; the current tab sits on it and opens into the page below. */
|
|
94
147
|
_jsx("div", { className: `border-b border-line-strong ${byDensity(d, "-mx-4 px-4", "")}`, children: aspects }))] }));
|
|
95
|
-
return (_jsxs(_Fragment, { children: [withRail ? (_jsx(SurfaceProvider, { value: railSurface, children: _jsx("div", { className: "@container/record", children: _jsx("div", { className:
|
|
96
|
-
|
|
148
|
+
return (_jsxs(_Fragment, { children: [withRail ? (_jsx(SurfaceProvider, { value: railSurface, children: _jsx("div", { className: "@container/record", children: _jsx("div", { className: modern
|
|
149
|
+
? /* Modern: the rail is the page's heading on the ground, not a white strip. */
|
|
150
|
+
"bg-ground px-3 pt-4 pb-1"
|
|
151
|
+
: `px-3 py-2.5 ${railSurface === "chrome"
|
|
152
|
+
? "bg-chrome"
|
|
153
|
+
: "border-b border-line bg-surface"}`, children: _jsx("div", { className: `flex flex-col gap-2 ${paper ? column : ""}`, children: modern ? (_jsxs(_Fragment, { children: [_jsx(Line, { start: crumbs === undefined || crumbs.length === 0 ? null : (_jsx(Breadcrumb, { crumbs: crumbs, surface: railSurface, size: "lg" })), end: pager }), smart === undefined &&
|
|
154
|
+
indicator === undefined &&
|
|
155
|
+
status === undefined &&
|
|
156
|
+
!inRail &&
|
|
157
|
+
railActions_ === undefined &&
|
|
158
|
+
railDirty === undefined ? null : (_jsxs("div", { className: "flex min-w-0 flex-wrap items-center gap-x-4 gap-y-2", children: [railDirty !== undefined ? (_jsx("div", { className: "flex shrink-0 items-center gap-1.5", children: _jsx(DirtyActions, { ...railDirty }) })) : railActions_ === undefined ? null : (_jsxs("div", { className: "flex shrink-0 items-center gap-1.5", children: [railActions_, _jsx(SavedMark, { saved: saved })] })), smart === undefined && indicator === undefined ? null : (_jsxs("div", { className: "flex min-w-0 flex-wrap items-center gap-2", children: [smart, indicator] })), inRail ? (_jsx("div", { ref: anchor, className: `flex flex-1 items-center ${dock?.align === "end" ? "justify-end" : "justify-center"}`, ...(detached ? { inert: true, "aria-hidden": true } : {}), children: dockPill })) : null, status === undefined ? null : (_jsx("div", { className: "ml-auto flex shrink-0 flex-col items-end gap-1.5", children: status }))] }))] })) : (_jsxs(_Fragment, { children: [_jsx(Line, { start: crumbs === undefined || crumbs.length === 0 ? null : (_jsx(Breadcrumb, { crumbs: crumbs, surface: railSurface })), center:
|
|
159
|
+
/* The notices' indicator rides with the counters: both are about the
|
|
97
160
|
record and both open something; neither is my position in front of
|
|
98
161
|
it. The line wraps on a phone, so it is never pushed out of reach. */
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
162
|
+
smart === undefined && indicator === undefined ? undefined : (_jsxs("div", { className: "flex min-w-0 flex-wrap items-center justify-center gap-2", children: [smart, indicator] })),
|
|
163
|
+
/* With the dock in the rail the pager goes down to its second row, beside
|
|
164
|
+
the state: row 2 has room on the right, and row 1 —crumbs and seven
|
|
165
|
+
counters— pushed it to a line of its own. */
|
|
166
|
+
end: inRail ? undefined : pager }), !inRail &&
|
|
167
|
+
railActions_ === undefined &&
|
|
168
|
+
status === undefined &&
|
|
169
|
+
railDirty === undefined &&
|
|
170
|
+
(!saved || floating || docked) ? null : (
|
|
171
|
+
/* Row 2 — WHAT I CAN DO and WHERE IT IS AT: actions stuck to the
|
|
104
172
|
left edge, the history and the state stuck to the right one. No
|
|
105
173
|
`flex-wrap`: wrapping split the row in two and the state ended up
|
|
106
174
|
below the actions, which is another hierarchy. */
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
175
|
+
_jsxs("div", { className: `flex min-w-0 gap-x-4 ${inRail ? "items-center" : "items-start"}`, children: [inRail && dock?.align !== "end" ? (_jsx("div", { "aria-hidden": true, className: "min-w-0 flex-1 basis-0" })) : null, inRail ? (
|
|
176
|
+
/* The dock at rest. While it floats this copy is out of sight, and out
|
|
177
|
+
of reach too — one toolbar at a time for a keyboard and a reader. */
|
|
178
|
+
_jsx("div", { ref: anchor, className: `flex shrink-0 items-center ${dock?.align === "end" ? "ml-auto" : ""}`, ...(detached ? { inert: true, "aria-hidden": true } : {}), children: dockPill })) : railDirty !== undefined ? (_jsx("div", { className: "flex shrink-0 items-center gap-1.5 @max-handheld/record:hidden", children: _jsx(DirtyActions, { ...railDirty }) })) : railActions_ === undefined ? (floating || docked ? null : (_jsx(SavedMark, { saved: saved }))) : (_jsxs("div", { className: "flex shrink-0 items-center gap-1.5", children: [primaries.length === 0
|
|
179
|
+
? railActions_
|
|
180
|
+
: railActions.map((node) => isPrimary(node) ? (_jsx("span", { "data-thumb-moves": "", className: "contents @max-handheld/record:hidden", children: node }, node.key)) : (node)), floating ? null : _jsx(SavedMark, { saved: saved })] })), status === undefined && !(inRail && pager !== undefined) ? (inRail && dock?.align !== "end" ? (_jsx("div", { "aria-hidden": true, className: "min-w-0 flex-1 basis-0" })) : null) : (_jsxs("div", {
|
|
181
|
+
/* Centred, the state's side never shrinks below what it holds: a
|
|
182
|
+
pill grown by «Guardado» pushes the spacer, not over the state. */
|
|
183
|
+
className: `flex items-center justify-end gap-x-3 ${inRail && dock?.align !== "end"
|
|
184
|
+
? "flex-1 basis-0"
|
|
185
|
+
: "ml-auto min-w-0"}`, children: [status === undefined ? null : (_jsx("div", { className: "flex min-w-0 flex-col items-end gap-1.5", children: status })), inRail ? pager : null] }))] }))] })) }) }) }) })) : null, paper ? (
|
|
110
186
|
/* ==================================================================== *
|
|
111
187
|
* THE PAGE — [sheet | Actividad], on the ground.
|
|
112
188
|
*
|
|
@@ -133,15 +209,15 @@ export function RecordHeader({ crumbs, pager, actions, status, kicker, icon: Ico
|
|
|
133
209
|
* a scroll container and the line table header would stick inside it, not under
|
|
134
210
|
* the application bar.
|
|
135
211
|
* ==================================================================== */
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
212
|
+
_jsxs("div", { className: "bg-ground px-3 pt-3 pb-3", children: [topDock, _jsx("div", { className: "@container/page", ...(floats ? { style: dockLayer.below } : {}), children: _jsxs("div", { className: `flex min-w-0 flex-col gap-3 ${column} ${beside
|
|
213
|
+
? `@beside/page:flex-row @beside/page:items-stretch @beside/page:justify-center ${floating ? "@beside/page:gap-4" : "@beside/page:gap-0"}`
|
|
214
|
+
: ""}`, children: [_jsxs("div", { className: `flex min-w-0 flex-1 flex-col gap-3 ${beside && width === "reading"
|
|
215
|
+
? "mx-auto w-full max-w-(--container-sheet) @beside/page:mx-0"
|
|
216
|
+
: ""}`, children: [blocking, _jsxs("div", { className: `relative flex min-w-0 flex-col overflow-clip ${floating ? "" : "rounded-box border border-line bg-surface"} ${beside && !floating ? "@beside/page:rounded-r-none" : ""}`, children: [ribbon, identity, children] }), activity !== undefined && activityLayout === "below" ? activity : null] }), beside ? (
|
|
217
|
+
/* After the sheet: the record first, what is around it second — in the
|
|
218
|
+
reading order and on screen. */
|
|
219
|
+
_jsx("div", { className: "mx-auto w-full max-w-(--container-sheet) min-w-0 @beside/page:mx-0 @beside/page:flex @beside/page:w-auto @beside/page:max-w-none @beside/page:shrink-0", children: activity })) : null] }) })] })) : (
|
|
144
220
|
/* No paper (a modal, a drawer): one surface, no ground beside
|
|
145
221
|
it — the band first, the record, and the activity below. */
|
|
146
|
-
_jsxs("div", { className: "relative flex min-w-0 flex-1 flex-col overflow-clip bg-surface", children: [ribbon, blocking === undefined ? null : (_jsx("div", { className: byDensity(d, "px-4 pt-3.5", "pb-2"), children: blocking })), identity, children, activity === undefined ? null : (_jsx("div", { className: byDensity(d, "px-4 pb-4", "pb-2"), children: activity }))] })), thumb === null ? null : (_jsx(ThumbBar, { mode: thumb, dirty: railDirty, primaries: primaries })), floating ? _jsx(DirtyBar, { dirty: dirty, saved: saved }) : null] }));
|
|
222
|
+
_jsxs("div", { className: "relative flex min-w-0 flex-1 flex-col overflow-clip bg-surface", children: [topDock, ribbon, blocking === undefined ? null : (_jsx("div", { className: byDensity(d, "px-4 pt-3.5", "pb-2"), children: blocking })), identity, children, activity === undefined ? null : (_jsx("div", { className: byDensity(d, "px-4 pb-4", "pb-2"), children: activity }))] })), thumb === null ? null : (_jsx(ThumbBar, { mode: thumb, dirty: railDirty, primaries: primaries })), floating && !docked ? _jsx(DirtyBar, { dirty: dirty, saved: saved }) : null, dock === undefined || dockWhere !== "bottom" ? null : (_jsx(ActionDock, { ...dock, ...(dirty === undefined ? {} : { dirty }), saved: saved, placement: "bottom" }))] }));
|
|
147
223
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Surface } from "../../foundations/types.js";
|
|
2
|
-
import type
|
|
2
|
+
import { type LucideIcon } from "lucide-react";
|
|
3
3
|
import { type ReactNode } from "react";
|
|
4
4
|
/** What hangs off this record, with its number, and can be pressed.
|
|
5
5
|
*
|
|
@@ -10,7 +10,7 @@ import { type ReactNode } from "react";
|
|
|
10
10
|
* **`—` is not `0`.** «I don't know yet» and «there is none» are two different
|
|
11
11
|
* answers, and confusing them makes somebody decide on data that has not
|
|
12
12
|
* arrived yet. */
|
|
13
|
-
export declare function SmartButton({ icon: Icon, count, label, onClick, disabled, surface, layout, }: {
|
|
13
|
+
export declare function SmartButton({ icon: Icon, count, label, onClick, disabled, surface, layout, look, }: {
|
|
14
14
|
icon: LucideIcon;
|
|
15
15
|
count?: number;
|
|
16
16
|
label: string;
|
|
@@ -29,6 +29,12 @@ export declare function SmartButton({ icon: Icon, count, label, onClick, disable
|
|
|
29
29
|
* «something looks off».
|
|
30
30
|
*/
|
|
31
31
|
layout?: "stacked" | "inline";
|
|
32
|
+
/**
|
|
33
|
+
* `box` (the default): a bordered box, the rail's. `link`: it reads as what it is — a way
|
|
34
|
+
* to ANOTHER place: the count in a primary pill, the label, and a «›» that says it leads
|
|
35
|
+
* somewhere; at zero it goes quiet and loses the «›». The record's modern style.
|
|
36
|
+
*/
|
|
37
|
+
look?: "box" | "link";
|
|
32
38
|
}): import("react").JSX.Element;
|
|
33
39
|
export declare function SmartButtons({ children }: {
|
|
34
40
|
children: ReactNode;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useUiCopy } from "../../foundations/copy.js";
|
|
4
4
|
import { bySurface, useSurface } from "../../foundations/surface.js";
|
|
5
|
+
import { ChevronRight } from "lucide-react";
|
|
5
6
|
import { Children, createContext, useContext } from "react";
|
|
6
7
|
/* ---------------------------------------------------------------- *
|
|
7
8
|
* THE SMART BUTTONS
|
|
@@ -18,12 +19,16 @@ const SmartGroup = createContext(false);
|
|
|
18
19
|
* **`—` is not `0`.** «I don't know yet» and «there is none» are two different
|
|
19
20
|
* answers, and confusing them makes somebody decide on data that has not
|
|
20
21
|
* arrived yet. */
|
|
21
|
-
export function SmartButton({ icon: Icon, count, label, onClick, disabled = false, surface, layout = "stacked", }) {
|
|
22
|
+
export function SmartButton({ icon: Icon, count, label, onClick, disabled = false, surface, layout = "stacked", look = "box", }) {
|
|
22
23
|
const copy = useUiCopy();
|
|
23
|
-
const empty = count === 0;
|
|
24
24
|
const activeSurface = useSurface(surface);
|
|
25
|
-
const isInline = layout === "inline";
|
|
26
25
|
const grouped = useContext(SmartGroup);
|
|
26
|
+
const empty = count === 0;
|
|
27
|
+
if (look === "link") {
|
|
28
|
+
const off = disabled || onClick === undefined;
|
|
29
|
+
return (_jsxs("button", { type: "button", onClick: onClick, disabled: off, "data-ui": "smart", "data-look": "link", className: "group inline-flex h-(--size-control-sm) shrink-0 items-center gap-1.5 rounded-pill px-2 text-left text-meta transition-colors duration-(--duration-instant) not-disabled:hover:bg-primary/8 disabled:cursor-default focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary", children: [_jsx(Icon, { className: `size-(--size-icon-sm) shrink-0 ${empty ? "text-muted/60" : "text-primary"}`, strokeWidth: 2, "aria-hidden": true }), _jsx("span", { className: `rounded-pill px-1.5 text-micro font-semibold tabular-nums ${empty ? "bg-ink/6 text-muted" : "bg-primary/12 text-primary"}`, children: count === undefined ? "—" : count.toLocaleString(copy.locale) }), _jsx("span", { className: empty ? "text-muted" : "text-ink", children: label }), empty || off ? null : (_jsx(ChevronRight, { className: "size-(--size-icon-sm) shrink-0 text-muted transition-colors duration-(--duration-instant) group-hover:text-primary", strokeWidth: 2, "aria-hidden": true }))] }));
|
|
30
|
+
}
|
|
31
|
+
const isInline = layout === "inline";
|
|
27
32
|
return (_jsxs("button", { type: "button", onClick: onClick, disabled: disabled || onClick === undefined, className: `flex shrink-0 items-center gap-2 text-left transition-[background-color,border-color,box-shadow] duration-(--duration-instant) disabled:cursor-default disabled:opacity-60 focus-visible:outline-2 focus-visible:outline-primary ${grouped
|
|
28
33
|
? `not-disabled:hover:bg-chrome-ink/10 focus-visible:-outline-offset-2 ${isInline ? "h-(--size-control-sm) px-2.5" : "px-2.5 py-1"}`
|
|
29
34
|
: `rounded-control border focus-visible:outline-offset-2 ${isInline ? "h-(--size-control-sm) px-2" : "px-2.5 py-1"} ${bySurface(activeSurface, "border-ink/12 bg-surface shadow-raised not-disabled:hover:border-primary/40 not-disabled:hover:bg-primary/4", "border-chrome-ink/12 bg-chrome-ink/6 not-disabled:hover:border-chrome-link/40 not-disabled:hover:bg-chrome-ink/12")}`}`, children: [_jsx(Icon, { className: `size-(--size-icon-md) shrink-0 ${bySurface(activeSurface, empty ? "text-muted/50" : "text-muted", empty ? "text-chrome-muted/50" : "text-chrome-muted")}`, strokeWidth: 1.75 }), _jsxs("span", { className: `min-w-0 leading-tight ${isInline ? "flex items-baseline gap-1.5" : ""}`, children: [_jsx("span", { className: `text-meta font-medium tabular-nums ${isInline ? "" : "block"} ${bySurface(activeSurface, empty ? "text-muted" : "text-ink", empty ? "text-chrome-muted" : "text-chrome-ink")}`, children: count === undefined ? "—" : count.toLocaleString(copy.locale) }), _jsx("span", { className: `text-micro ${isInline ? "" : "block"} ${bySurface(activeSurface, "text-muted", "text-chrome-muted")}`, children: label })] })] }));
|
|
@@ -1,7 +1,20 @@
|
|
|
1
1
|
import type { Surface } from "../../foundations/types.js";
|
|
2
|
+
import { type LucideIcon } from "lucide-react";
|
|
3
|
+
import type { ReactNode } from "react";
|
|
2
4
|
export interface Stage {
|
|
3
5
|
id: string;
|
|
4
6
|
label: string;
|
|
7
|
+
/** Drawn before its name in every widget — a truck for «En camino», a seal for «Firmada».
|
|
8
|
+
* On the failed stage the alert takes its place: a failure is never hidden behind an icon. */
|
|
9
|
+
icon?: LucideIcon;
|
|
10
|
+
/** The icon it wears when it is the CURRENT stage — or the one being looked at, when they
|
|
11
|
+
* can be chosen —: `Circle` → `CircleDot`, an outline → its filled twin. Absent, `icon`. */
|
|
12
|
+
activeIcon?: LucideIcon;
|
|
13
|
+
/** What the stage means, said when it is pointed at: «Publicada en el SIAT, ya no se edita». */
|
|
14
|
+
hint?: string;
|
|
15
|
+
/** How many are there — in a list grouped by stage, «Por cobrar 12». Zero is drawn: it is an
|
|
16
|
+
* answer too. */
|
|
17
|
+
count?: number;
|
|
5
18
|
}
|
|
6
19
|
/** Which step something is on, **with the steps that come next in sight**.
|
|
7
20
|
*
|
|
@@ -34,7 +47,45 @@ export interface Stage {
|
|
|
34
47
|
* and the stage being VIEWED (`selected`, the underline, the checked radio) are two
|
|
35
48
|
* different things and are painted differently. Without `onSelect` it is a plain
|
|
36
49
|
* ordered list and the current stage is `aria-current="step"`. */
|
|
37
|
-
|
|
50
|
+
/**
|
|
51
|
+
* How the state is drawn — the same stages, four widgets:
|
|
52
|
+
*
|
|
53
|
+
* track Odoo's statusbar: segments of one well, the current one filled. The default, in
|
|
54
|
+
* both styles.
|
|
55
|
+
* steps dots joined by a line, the current one ringed.
|
|
56
|
+
* progress a segmented bar with each stage's name under its segment: how far it is, at a
|
|
57
|
+
* glance, and where.
|
|
58
|
+
* pill ONE chip, «● Publicada · 2/3», that unfolds the stages when they can be chosen:
|
|
59
|
+
* the state where room is short.
|
|
60
|
+
*/
|
|
61
|
+
export type StatusLook = "track" | "segmented" | "steps" | "progress" | "pill";
|
|
62
|
+
/**
|
|
63
|
+
* What each stage shows:
|
|
64
|
+
*
|
|
65
|
+
* auto `both` where there is room, `current` on a phone (side by side, below `sm`):
|
|
66
|
+
* four names do not fit in a phone's width, four marks and one name do. The
|
|
67
|
+
* default.
|
|
68
|
+
* both its icon (when it has one) and its name, always.
|
|
69
|
+
* label the names only — no icon, no check.
|
|
70
|
+
* icon the icons only; the name is said to a screen reader and on hover. A stage with
|
|
71
|
+
* no icon shows its number.
|
|
72
|
+
* current the icons, and the name of the current stage (and of the one being looked at):
|
|
73
|
+
* where the record is, said; the rest, a glance — the state where room is short.
|
|
74
|
+
*
|
|
75
|
+
* Whatever is shown, a failed stage keeps its alert: a failure is never only a colour.
|
|
76
|
+
*/
|
|
77
|
+
export type StatusDisplay = "auto" | "both" | "label" | "icon" | "current";
|
|
78
|
+
/** What `renderStage` is told about the stage it draws. */
|
|
79
|
+
export interface StageState {
|
|
80
|
+
/** Behind, on it, or ahead. */
|
|
81
|
+
step: "done" | "current" | "next";
|
|
82
|
+
/** It is the current stage, and the record failed there. */
|
|
83
|
+
failed: boolean;
|
|
84
|
+
/** It is the one being looked at (chosen), when the stages can be chosen. */
|
|
85
|
+
viewed: boolean;
|
|
86
|
+
index: number;
|
|
87
|
+
}
|
|
88
|
+
export declare function StatusBar({ stages, current, failed, surface: surfaceProp, onSelect, selected, layout, look, display, renderStage, }: {
|
|
38
89
|
stages: readonly Stage[];
|
|
39
90
|
current: string;
|
|
40
91
|
failed?: boolean;
|
|
@@ -48,4 +99,20 @@ export declare function StatusBar({ stages, current, failed, surface: surfacePro
|
|
|
48
99
|
/** `trail` side by side, `stacked` one per row. Without it the surface's density
|
|
49
100
|
* decides — it is what knows how much width there is. */
|
|
50
101
|
layout?: "trail" | "stacked";
|
|
102
|
+
/**
|
|
103
|
+
* `track` (the default) is Odoo's statusbar: segments of one well, the current one filled.
|
|
104
|
+
* `segmented` is the same in a pill of pills — the action dock's shape. `steps`, `progress`
|
|
105
|
+
* and `pill` are the other widgets (`StatusLook`). Every one draws a stage's `icon`,
|
|
106
|
+
* `activeIcon`, `hint` and `count`.
|
|
107
|
+
*/
|
|
108
|
+
look?: StatusLook;
|
|
109
|
+
/** What each stage shows: `auto` (the default), `both`, `label`, `icon` or `current`
|
|
110
|
+
* (`StatusDisplay`). */
|
|
111
|
+
display?: StatusDisplay;
|
|
112
|
+
/**
|
|
113
|
+
* Draws a stage your way, INSIDE the system's segment — which keeps the order, the paint of
|
|
114
|
+
* the step, the focus, the choosing and the names for a screen reader. Write the stage's
|
|
115
|
+
* name in it, or say it with a visually hidden text. `track`, `segmented` and `steps`.
|
|
116
|
+
*/
|
|
117
|
+
renderStage?: (stage: Stage, state: StageState) => ReactNode;
|
|
51
118
|
}): import("react").JSX.Element;
|