@sincpro/web-ui 2.8.0 → 2.10.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.
Files changed (75) hide show
  1. package/README.md +152 -3
  2. package/dist/components/activity/Activity.js +3 -2
  3. package/dist/components/board/Board.d.ts +2 -1
  4. package/dist/components/board/Board.js +17 -1
  5. package/dist/components/form/Form.js +12 -3
  6. package/dist/components/form/FormIndex.d.ts +5 -1
  7. package/dist/components/form/FormIndex.js +71 -23
  8. package/dist/components/form/Sheet.js +22 -4
  9. package/dist/components/listing/ListingBar.d.ts +25 -1
  10. package/dist/components/listing/ListingBar.js +43 -14
  11. package/dist/components/listing/Pagination.d.ts +4 -1
  12. package/dist/components/listing/Pagination.js +19 -6
  13. package/dist/components/listing/modelCells.js +1 -9
  14. package/dist/components/record/ActionDock.d.ts +58 -0
  15. package/dist/components/record/ActionDock.js +69 -0
  16. package/dist/components/record/Breadcrumb.d.ts +3 -1
  17. package/dist/components/record/Breadcrumb.js +13 -5
  18. package/dist/components/record/DirtyActions.js +11 -1
  19. package/dist/components/record/Pager.d.ts +12 -10
  20. package/dist/components/record/Pager.js +39 -6
  21. package/dist/components/record/RecordHeader.d.ts +13 -1
  22. package/dist/components/record/RecordHeader.js +70 -25
  23. package/dist/components/record/SmartButtons.js +2 -2
  24. package/dist/components/record/StatusBar.d.ts +68 -1
  25. package/dist/components/record/StatusBar.js +218 -48
  26. package/dist/components/record/dock.d.ts +56 -0
  27. package/dist/components/record/dock.js +58 -0
  28. package/dist/components/record/index.d.ts +3 -1
  29. package/dist/components/record/index.js +5 -1
  30. package/dist/foundations/copy.d.ts +9 -0
  31. package/dist/foundations/copy.es.js +10 -1
  32. package/dist/foundations/copy.js +5 -0
  33. package/dist/foundations/form.d.ts +10 -1
  34. package/dist/foundations/grouping.d.ts +9 -0
  35. package/dist/foundations/index.d.ts +3 -1
  36. package/dist/foundations/index.js +8 -2
  37. package/dist/foundations/keys.d.ts +34 -0
  38. package/dist/foundations/keys.js +99 -0
  39. package/dist/foundations/shortcut.d.ts +17 -1
  40. package/dist/foundations/shortcut.js +57 -1
  41. package/dist/foundations/viewStyle.d.ts +8 -0
  42. package/dist/foundations/viewStyle.js +12 -0
  43. package/dist/primitives/choice/Switch.d.ts +4 -1
  44. package/dist/primitives/choice/Switch.js +2 -2
  45. package/dist/primitives/menu/Menu.d.ts +3 -0
  46. package/dist/primitives/menu/Menu.js +7 -1
  47. package/dist/primitives/table/DataTable.d.ts +29 -0
  48. package/dist/primitives/table/DataTable.js +84 -13
  49. package/dist/primitives/table/EditableTable.js +7 -2
  50. package/dist/primitives/table/RowActions.d.ts +5 -0
  51. package/dist/primitives/table/RowActions.js +27 -3
  52. package/dist/primitives/table/SheetTable.d.ts +3 -0
  53. package/dist/primitives/table/SheetTable.js +15 -2
  54. package/dist/primitives/table/index.d.ts +1 -1
  55. package/dist/primitives/value/Value.d.ts +5 -1
  56. package/dist/primitives/value/Value.js +9 -3
  57. package/dist/primitives/value/YesNo.d.ts +22 -0
  58. package/dist/primitives/value/YesNo.js +16 -0
  59. package/dist/primitives/value/index.d.ts +1 -0
  60. package/dist/primitives/value/index.js +1 -0
  61. package/dist/tokens.css +35 -2
  62. package/dist/views/list/List.d.ts +7 -2
  63. package/dist/views/list/List.js +12 -4
  64. package/dist/views/list/ListView.d.ts +1 -1
  65. package/dist/views/list/ListView.js +112 -17
  66. package/dist/views/list/derive.d.ts +1 -1
  67. package/dist/views/list/derive.js +45 -9
  68. package/dist/views/list/presentations.d.ts +2 -2
  69. package/dist/views/list/presentations.js +35 -3
  70. package/dist/views/list/types.d.ts +43 -0
  71. package/dist/views/list/useReachBottom.d.ts +15 -0
  72. package/dist/views/list/useReachBottom.js +55 -0
  73. package/dist/views/record/Record.d.ts +16 -2
  74. package/dist/views/record/Record.js +30 -7
  75. package/package.json +1 -1
@@ -1,24 +1,51 @@
1
1
  "use client";
2
- import { jsxs as _jsxs, jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
+ import { ActionDock, DockBand, DockHostContext, } 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";
8
9
  import { SurfaceProvider } from "../../foundations/surface.js";
10
+ import { useViewStyle } from "../../foundations/viewStyle.js";
9
11
  import { Line } from "../../primitives/block/Line.js";
10
12
  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, }) {
13
+ import { useCallback, useEffect, useMemo, useRef, useState } from "react";
14
+ 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
15
  const d = useDensity();
14
- /* The «settings» form style (`FormStyleProvider`): Save and Discard float at the bottom
15
- (`DirtyBar`) instead of taking the rail and the thumb bar, and the record has no white
16
- sheet of its own — its sections are the cards, on the ground. */
17
- const floating = useFormStyle() === "settings";
16
+ /* The «settings» and «sections» form styles (`FormStyleProvider`): Save and Discard float
17
+ at the bottom (`DirtyBar`) instead of taking the rail and the thumb bar, and the record has
18
+ no white sheet of its own — its sections are the cards, on the ground. */
19
+ const floating = useFormStyle() !== "dense";
18
20
  /* «Guardado» is said where Save was; a record whose rail exists only while it has changes
19
21
  keeps it for that moment, or the answer would leave with the question. */
20
22
  const saved = useJustSaved(dirty);
21
- const railDirty = floating ? undefined : dirty;
23
+ /* THE STYLE decides where the dock's actions go when the dock does not say: the rail's
24
+ buttons in `traditional`, the floating pill at the bottom in `modern`. The same `DockAction`s
25
+ draw both. Floating, the pill holds the actions AND Save / Discard: the rail keeps the
26
+ rest. */
27
+ const modern = useViewStyle(look) === "modern";
28
+ /* In compact (a peek) there is no rail to hold them: the dock floats at the bottom of the
29
+ drawer in either style. Dropping them with the rail left a previewed record with no
30
+ actions — and, edited, with no way to save. */
31
+ const asked = dock?.placement ?? (modern ? "bottom" : "rail");
32
+ const dockWhere = dock === undefined ? undefined : d === "compact" && asked === "rail" ? "bottom" : asked;
33
+ const docked = dockWhere === "bottom";
34
+ const railDirty = floating || docked ? undefined : dirty;
35
+ /* ONE PILL PER SCREEN (see `DockHost`): floating at the bottom, the record's pill is the
36
+ screen's place for one, and a collection inside it takes that place while it has rows
37
+ chosen. `taken` counts the takers; the band they draw into is `slot`. */
38
+ const hosting = dockWhere === "bottom";
39
+ const [taken, setTaken] = useState(0);
40
+ const [slot, setSlot] = useState(null);
41
+ const take = useCallback(() => {
42
+ setTaken((n) => n + 1);
43
+ return () => setTaken((n) => n - 1);
44
+ }, []);
45
+ const changed = dirty !== undefined;
46
+ const host = useMemo(() => (hosting ? { target: slot, dirty: changed, take } : null), [hosting, slot, changed, take]);
47
+ const given = hosting && taken > 0 && !changed;
48
+ const railActions_ = docked ? undefined : dock !== undefined ? (_jsx(ActionDock, { ...dock, look: "bare", placement: "inline" })) : (actions);
22
49
  /* Save is gone the moment it has saved, and the focus that was on it fell to the page —
23
50
  a keyboard was left at the top of the document. It comes back to the record's name:
24
51
  where reading the record starts, and announced together with «Guardado». */
@@ -30,16 +57,19 @@ export function RecordHeader({ crumbs, pager, actions, status, kicker, icon: Ico
30
57
  if (lost)
31
58
  nameRef.current?.focus({ preventScroll: true });
32
59
  }, [saved]);
33
- const hasRail = (saved && !floating) ||
60
+ const hasRail = (saved && !floating && !docked) ||
34
61
  crumbs !== undefined ||
35
62
  pager !== undefined ||
36
- actions !== undefined ||
63
+ railActions_ !== undefined ||
37
64
  status !== undefined ||
38
65
  railDirty !== undefined;
39
66
  /* In compact the rail goes away ENTIRELY, and it is not for room: in a
40
67
  preview, the breadcrumbs and the pager belong to the surface that opened it
41
- —the list behind is still there— and the actions are already in the
42
- drawer's header. A rail inside another rail is two bars saying where I am.
68
+ —the list behind is still there—. A rail inside another rail is two bars
69
+ saying where I am. What the rail held for the RECORD does not go with it:
70
+ its actions as data (`Record.Dock`) float at the bottom of the drawer, and
71
+ Save / Discard too (`DirtyBar`). Actions drawn by hand (`Record.Actions`)
72
+ are the application's to place, in the drawer's own strip (`Peek actions`).
43
73
 
44
74
  The state does survive: it moves to the sheet, below the title. It is the
45
75
  only thing in the rail that belongs to the RECORD and not to my position in
@@ -48,7 +78,7 @@ export function RecordHeader({ crumbs, pager, actions, status, kicker, icon: Ico
48
78
  /* The activity column at the RIGHT of the sheet when the page is wide (THE PAGE). */
49
79
  const beside = activity !== undefined && activityLayout === "auto";
50
80
  /* 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 });
81
+ const { rail: railActions, primaries, mode: thumb, } = thumbPlan({ withRail, actions: railActions_, dirty: railDirty });
52
82
  /* In compact the TITLE is not drawn either, for the same reason as in
53
83
  `Listing`: the surface header already says it. Drawing it here showed it
54
84
  twice in the same 480 px drawer — and the name of a customer in this product
@@ -74,7 +104,11 @@ export function RecordHeader({ crumbs, pager, actions, status, kicker, icon: Ico
74
104
  arrive late (loaded, allowed) and the guess flips with them. `paper`, when given, is the
75
105
  answer — the rail's contents no longer decide it. */
76
106
  const paper = onPaper === undefined
77
- ? withRail && (crumbs !== undefined || pager !== undefined || actions !== undefined)
107
+ ? withRail &&
108
+ (crumbs !== undefined ||
109
+ pager !== undefined ||
110
+ actions !== undefined ||
111
+ dock !== undefined)
78
112
  : onPaper && d === "comfortable";
79
113
  /* ONE column for the rail and the page: the rail used to span the screen while the sheet
80
114
  stopped at 72rem, so on a wide desk the buttons sat 250 px left of the paper they act on
@@ -92,21 +126,30 @@ export function RecordHeader({ crumbs, pager, actions, status, kicker, icon: Ico
92
126
  /* The line is the sheet's mouth. In comfortable it walks to the
93
127
  edges; the current tab sits on it and opens into the page below. */
94
128
  _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: `px-3 py-2.5 ${railSurface === "chrome" ? "bg-chrome" : "border-b border-line bg-surface"}`, children: _jsxs("div", { className: `flex flex-col gap-2 ${paper ? column : ""}`, children: [_jsx(Line, { start: crumbs === undefined || crumbs.length === 0 ? null : (_jsx(Breadcrumb, { crumbs: crumbs, surface: railSurface })), center:
96
- /* The notices' indicator rides with the counters: both are about the
129
+ return (_jsxs(DockHostContext, { value: host, children: [withRail ? (_jsx(SurfaceProvider, { value: railSurface, children: _jsx("div", { className: "@container/record", children: _jsx("div", { className: modern
130
+ ? /* Modern: the rail is the page's heading on the ground, not a white strip. */
131
+ "bg-ground px-3 pt-4 pb-1"
132
+ : `px-3 py-2.5 ${railSurface === "chrome"
133
+ ? "bg-chrome"
134
+ : "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 &&
135
+ indicator === undefined &&
136
+ status === undefined &&
137
+ railActions_ === undefined &&
138
+ 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] })), 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:
139
+ /* The notices' indicator rides with the counters: both are about the
97
140
  record and both open something; neither is my position in front of
98
141
  it. The line wraps on a phone, so it is never pushed out of reach. */
99
- smart === undefined && indicator === undefined ? undefined : (_jsxs("div", { className: "flex min-w-0 flex-wrap items-center justify-center gap-2", children: [smart, indicator] })), end: pager }), actions === undefined &&
100
- status === undefined &&
101
- railDirty === undefined &&
102
- (!saved || floating) ? null : (
103
- /* Row 2 — WHAT I CAN DO and WHERE IT IS AT: actions stuck to the
142
+ smart === undefined && indicator === undefined ? undefined : (_jsxs("div", { className: "flex min-w-0 flex-wrap items-center justify-center gap-2", children: [smart, indicator] })), end: pager }), railActions_ === undefined &&
143
+ status === undefined &&
144
+ railDirty === undefined &&
145
+ (!saved || floating || docked) ? null : (
146
+ /* Row 2 — WHAT I CAN DO and WHERE IT IS AT: actions stuck to the
104
147
  left edge, the history and the state stuck to the right one. No
105
148
  `flex-wrap`: wrapping split the row in two and the state ended up
106
149
  below the actions, which is another hierarchy. */
107
- _jsxs("div", { className: "flex min-w-0 items-start gap-x-4", children: [railDirty !== undefined ? (_jsx("div", { className: "flex shrink-0 items-center gap-1.5 @max-handheld/record:hidden", children: _jsx(DirtyActions, { ...railDirty }) })) : actions === undefined ? (floating ? null : (_jsx(SavedMark, { saved: saved }))) : (_jsxs("div", { className: "flex shrink-0 items-center gap-1.5", children: [primaries.length === 0
108
- ? actions
109
- : 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 ? null : (_jsx("div", { className: "ml-auto flex min-w-0 flex-col items-end gap-1.5", children: status }))] }))] }) }) }) })) : null, paper ? (
150
+ _jsxs("div", { className: "flex min-w-0 items-start gap-x-4", children: [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
151
+ ? railActions_
152
+ : 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 ? null : (_jsx("div", { className: "ml-auto flex min-w-0 flex-col items-end gap-1.5", children: status }))] }))] })) }) }) }) })) : null, paper ? (
110
153
  /* ==================================================================== *
111
154
  * THE PAGE — [sheet | Actividad], on the ground.
112
155
  *
@@ -143,5 +186,7 @@ export function RecordHeader({ crumbs, pager, actions, status, kicker, icon: Ico
143
186
  _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
187
  /* No paper (a modal, a drawer): one surface, no ground beside
145
188
  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] }));
189
+ _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 || d === "compact") && !docked ? (_jsx(DirtyBar, { dirty: dirty, saved: saved })) : null, dock === undefined || !hosting ? null : given ? (
190
+ /* Given away: an empty band where the taker draws its pill. */
191
+ _jsx(DockBand, { ref: setSlot })) : (_jsx(ActionDock, { ...dock, ...(dirty === undefined ? {} : { dirty }), saved: saved, placement: "bottom" }))] }));
147
192
  }
@@ -20,10 +20,10 @@ const SmartGroup = createContext(false);
20
20
  * arrived yet. */
21
21
  export function SmartButton({ icon: Icon, count, label, onClick, disabled = false, surface, layout = "stacked", }) {
22
22
  const copy = useUiCopy();
23
- const empty = count === 0;
24
23
  const activeSurface = useSurface(surface);
25
- const isInline = layout === "inline";
26
24
  const grouped = useContext(SmartGroup);
25
+ const empty = count === 0;
26
+ const isInline = layout === "inline";
27
27
  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
28
  ? `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
29
  : `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
- export declare function StatusBar({ stages, current, failed, surface: surfaceProp, onSelect, selected, layout, }: {
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;
@@ -4,14 +4,16 @@ import { useUiCopy } from "../../foundations/copy.js";
4
4
  import { byDensity, useDensity } from "../../foundations/density.js";
5
5
  import { useSurface } from "../../foundations/surface.js";
6
6
  import { cn, focusRing, tv } from "../../foundations/variants.js";
7
- import { Check, CircleAlert } from "lucide-react";
8
- import { Radio, RadioGroup } from "react-aria-components";
7
+ import { MenuList } from "../../primitives/menu/Menu.js";
8
+ import { Popover } from "../../primitives/overlay/Popover.js";
9
+ import { Check, ChevronDown, CircleAlert } from "lucide-react";
10
+ import { Button as AriaButton, MenuTrigger, Radio, RadioGroup } from "react-aria-components";
9
11
  /** The track the stages sit in. Same rail as the other grouped controls on each
10
12
  * surface: a tinted well with a hairline, and on the chrome TRANSLUCENT —ink at 8 %
11
13
  * over the navy— so the header's brand wash goes across it and it reads as a layer,
12
14
  * not as one more box stuck on top. */
13
15
  const trackStyles = tv({
14
- base: "min-w-0 gap-0.5 rounded-control border p-0.5",
16
+ base: "min-w-0 gap-0.5 border p-0.5",
15
17
  variants: {
16
18
  surface: {
17
19
  canvas: "border-line bg-ground",
@@ -21,7 +23,15 @@ const trackStyles = tv({
21
23
  trail: "inline-flex max-w-full shrink-0 items-stretch",
22
24
  stacked: "flex w-full flex-col",
23
25
  },
26
+ /* `well` is Odoo's track; `pill` the segmented control — the action dock's shape: a pill
27
+ holding pills, on the paper's surface. */
28
+ shape: { well: "rounded-control", pill: "rounded-pill" },
24
29
  },
30
+ compoundVariants: [
31
+ { shape: "pill", surface: "canvas", class: "border-line-strong bg-surface" },
32
+ /* Stacked, a pill of rows is a capsule nobody reads as a list: the box's corners. */
33
+ { shape: "pill", layout: "stacked", class: "rounded-box" },
34
+ ],
25
35
  });
26
36
  /** One stage. Three steps —done, current, next— and ONE way of painting each, the
27
37
  * same in both layouts and with or without `onSelect`:
@@ -36,8 +46,9 @@ const trackStyles = tv({
36
46
  * one included — without competing with the fill. */
37
47
  const stageStyles = tv({
38
48
  extend: focusRing,
39
- base: "relative flex min-w-0 items-center gap-1.5 rounded-mark px-2.5 text-meta whitespace-nowrap transition-colors duration-(--duration-instant)",
49
+ base: "relative flex min-w-0 items-center gap-1.5 text-meta whitespace-nowrap transition-colors duration-(--duration-instant)",
40
50
  variants: {
51
+ shape: { well: "rounded-mark px-2.5", pill: "rounded-pill px-3" },
41
52
  surface: { canvas: "", chrome: "outline-chrome-link" },
42
53
  step: { done: "font-medium", current: "font-semibold", next: "" },
43
54
  failed: { true: "", false: "" },
@@ -82,38 +93,7 @@ const stageStyles = tv({
82
93
  },
83
94
  ],
84
95
  });
85
- /** Which step something is on, **with the steps that come next in sight**.
86
- *
87
- * ── One track, one language ──────────────────────────────────────────
88
- *
89
- * The stages are segments of ONE track, Odoo's statusbar: the order is the
90
- * direction. What is behind is ink with a check, what comes next is muted, and the
91
- * current stage is the only FILLED segment — `primary` on the canvas, the chrome's
92
- * ink inverted on the rail. With `failed` that fill turns `danger` and carries an
93
- * alert mark, so the failure is not only a color.
94
- *
95
- * A clipped arrow per step was tried and dropped: the notch between two arrows
96
- * reads as a gap — four chips, not a path.
97
- *
98
- * ── Narrow: it STACKS, it does not hide ──────────────────────────────
99
- *
100
- * Four stages side by side do not fit in a 480 px drawer, and the answer is not
101
- * tucking them behind a chevron: a state you have to open stops answering «where
102
- * is this at?», which is the only question it has. It stacks — one stage per row —
103
- * in the same track, with the same three paints and the same marks. What changes
104
- * is the DIRECTION, not how much is shown nor how it is painted.
105
- *
106
- * ── And it can be CHOSEN ─────────────────────────────────────────────
107
- *
108
- * With `onSelect` the track is a React Aria `RadioGroup`: one stage at a time,
109
- * arrow keys move between them, Tab enters at the chosen one. It is not
110
- * «advancing» — a stage does not change by pressing it — it is choosing which
111
- * stage we are talking about: in a list grouped by stage, pressing «generando» asks
112
- * for those. So the record's CURRENT stage (`current`, the fill, `aria-current`)
113
- * and the stage being VIEWED (`selected`, the underline, the checked radio) are two
114
- * different things and are painted differently. Without `onSelect` it is a plain
115
- * ordered list and the current stage is `aria-current="step"`. */
116
- export function StatusBar({ stages, current, failed = false, surface: surfaceProp, onSelect, selected, layout, }) {
96
+ export function StatusBar({ stages, current, failed = false, surface: surfaceProp, onSelect, selected, layout, look = "track", display = "auto", renderStage, }) {
117
97
  const d = useDensity();
118
98
  const surface = useSurface(surfaceProp);
119
99
  const copy = useUiCopy();
@@ -126,32 +106,221 @@ export function StatusBar({ stages, current, failed = false, surface: surfacePro
126
106
  return "current";
127
107
  return at >= 0 && i < at ? "done" : "next";
128
108
  }
129
- /** The check, the alert, or nothing. Stacked keeps the slot even when it is
130
- * empty, so the labels line up in a column; side by side an empty slot would
131
- * only be a gap. */
132
- function mark(step) {
109
+ /** The icon a stage wears now: its `activeIcon` when it is current or looked at. */
110
+ function iconOf(stage, step, viewed) {
111
+ return (step === "current" || viewed) && stage.activeIcon !== undefined
112
+ ? stage.activeIcon
113
+ : stage.icon;
114
+ }
115
+ /** Whether the stage's name is SEEN — otherwise it is said (visually hidden, and on hover). */
116
+ function nameShown(step, viewed) {
117
+ return (display === "auto" ||
118
+ display === "both" ||
119
+ display === "label" ||
120
+ (display === "current" && (step === "current" || viewed)));
121
+ }
122
+ /** `auto`, side by side, a stage that is not where the record is: its name is SAID on a
123
+ * phone and seen where there is room. */
124
+ function namedWide(step, viewed) {
125
+ return display === "auto" && !stacked && step !== "current" && !viewed;
126
+ }
127
+ /** The class of a stage's name: seen, said, or seen only where there is room. */
128
+ function nameClass(step, viewed, seen) {
129
+ if (!nameShown(step, viewed))
130
+ return "sr-only";
131
+ return namedWide(step, viewed) ? `${seen} max-sm:sr-only` : seen;
132
+ }
133
+ /** On a phone, a stage whose name is only said and that has no icon shows its number. */
134
+ function numberOnPhone(i) {
135
+ return (_jsx("span", { "aria-hidden": true, className: "min-w-(--size-icon-sm) text-center tabular-nums sm:hidden", children: (i + 1).toLocaleString(copy.locale) }));
136
+ }
137
+ /** The alert, the stage's icon, the check, its number — or nothing. Stacked keeps the slot
138
+ * even when it is empty, so the labels line up in a column; side by side an empty slot
139
+ * would only be a gap. */
140
+ function mark(stage, i, step, viewed) {
133
141
  const icon = "size-(--size-icon-sm) shrink-0";
134
- if (step === "done")
135
- return _jsx(Check, { className: icon, strokeWidth: 2, "aria-hidden": true });
136
142
  if (step === "current" && failed) {
137
143
  return _jsx(CircleAlert, { className: icon, strokeWidth: 2, "aria-hidden": true });
138
144
  }
145
+ const Icon = display === "label" ? undefined : iconOf(stage, step, viewed);
146
+ /* The stage's own icon says it better than the check: done is still read in its ink. */
147
+ if (Icon !== undefined)
148
+ return _jsx(Icon, { className: icon, strokeWidth: 2, "aria-hidden": true });
149
+ /* Its name hidden and no icon of its own: its place in the order. */
150
+ if (!nameShown(step, viewed)) {
151
+ return (_jsx("span", { "aria-hidden": true, className: "min-w-(--size-icon-sm) text-center tabular-nums", children: (i + 1).toLocaleString(copy.locale) }));
152
+ }
153
+ if (namedWide(step, viewed)) {
154
+ return (_jsxs(_Fragment, { children: [step === "done" ? (_jsx(Check, { className: `${icon} max-sm:hidden`, strokeWidth: 2, "aria-hidden": true })) : null, numberOnPhone(i)] }));
155
+ }
156
+ if (step === "done" && display !== "label") {
157
+ return _jsx(Check, { className: icon, strokeWidth: 2, "aria-hidden": true });
158
+ }
139
159
  return stacked ? _jsx("span", { className: icon, "aria-hidden": true }) : null;
140
160
  }
141
- function content(stage, step, viewed) {
142
- return (_jsxs(_Fragment, { children: [mark(step), _jsx("span", { "aria-current": step === "current" && selectable ? "step" : undefined, className: cn("min-w-0 truncate", viewed &&
161
+ /** How many are on the stage, after its name — quieter than the name. */
162
+ function countOf(stage) {
163
+ return stage.count === undefined ? null : (_jsx("span", { className: "shrink-0 tabular-nums opacity-70", children: stage.count.toLocaleString(copy.locale) }));
164
+ }
165
+ function content(stage, i, step, viewed) {
166
+ if (renderStage !== undefined) {
167
+ return renderStage(stage, {
168
+ step,
169
+ failed: step === "current" && failed,
170
+ viewed,
171
+ index: i,
172
+ });
173
+ }
174
+ const seen = nameShown(step, viewed);
175
+ return (
176
+ /* Its name hidden, the hint — else the name — is what pointing at it says. */
177
+ _jsxs("span", { className: "flex min-w-0 items-center gap-1.5", title: seen ? undefined : (stage.hint ?? stage.label), children: [mark(stage, i, step, viewed), _jsx("span", { title: seen ? stage.hint : undefined, "aria-current": step === "current" && selectable ? "step" : undefined, className: cn(nameClass(step, viewed, "min-w-0 truncate"), viewed &&
143
178
  "underline decoration-2 underline-offset-4 " +
144
179
  (step === "current"
145
180
  ? "decoration-current"
146
181
  : surface === "chrome"
147
182
  ? "decoration-chrome-link"
148
- : "decoration-primary")), children: stage.label })] }));
183
+ : "decoration-primary")), children: stage.label }), countOf(stage)] }));
184
+ }
185
+ const rounded = look === "segmented" ? "pill" : "well";
186
+ const track = trackStyles({ surface, layout: shape, shape: rounded });
187
+ if (look === "pill") {
188
+ const chrome = surface === "chrome";
189
+ const now = stages[at];
190
+ const dot = failed
191
+ ? chrome
192
+ ? "bg-chrome-bad"
193
+ : "bg-danger"
194
+ : chrome
195
+ ? "bg-chrome-link"
196
+ : "bg-primary";
197
+ /* Its name is what it shows, said first what it is: «Estado: Publicada 2/3». As a button
198
+ the name comes from its content (voice control matches what is SEEN); a status takes no
199
+ name from content, so it says it in a label. */
200
+ const said = `${copy.record.status}: ${now?.label ?? current} ${at + 1}/${stages.length}`;
201
+ const NowIcon = now === undefined || display === "label" ? undefined : iconOf(now, "current", false);
202
+ const chip = (_jsxs(_Fragment, { children: [NowIcon !== undefined && !failed ? (_jsx(NowIcon, { className: `size-(--size-icon-sm) shrink-0 ${chrome ? "text-chrome-link" : "text-primary"}`, strokeWidth: 2, "aria-hidden": true })) : (_jsx("span", { "aria-hidden": true, className: `size-2 shrink-0 rounded-pill ${dot}` })), _jsx("span", { className: "font-semibold", children: now?.label ?? current }), _jsx("span", { className: `tabular-nums ${chrome ? "text-chrome-muted" : "text-muted"}`, children: `${at + 1}/${stages.length}` })] }));
203
+ const frame = `inline-flex h-(--size-control-sm) shrink-0 items-center gap-1.5 rounded-pill border px-2.5 text-meta ${chrome
204
+ ? "border-chrome-ink/20 bg-chrome-ink/8 text-chrome-ink"
205
+ : "border-line-strong bg-surface text-ink"}`;
206
+ if (!selectable) {
207
+ return (_jsx("span", { role: "status", "aria-label": said, "data-failed": failed ? true : undefined, className: frame, children: chip }));
208
+ }
209
+ /* The chip IS the trigger: the same face, a chevron added — the stages open below it. */
210
+ return (_jsxs(MenuTrigger, { children: [_jsxs(AriaButton, { className: ({ isFocusVisible }) => cn(frame, "cursor-pointer transition-colors duration-(--duration-instant)", chrome
211
+ ? "hover:bg-chrome-ink/14"
212
+ : "hover:border-primary/45 hover:bg-primary/5", isFocusVisible && "outline-2 outline-offset-2 outline-primary"), children: [_jsx("span", { className: "sr-only", children: `${copy.record.status}: ` }), chip, _jsx(ChevronDown, { className: `size-(--size-icon-sm) ${chrome ? "text-chrome-muted" : "text-muted"}`, strokeWidth: 2, "aria-hidden": true })] }), _jsx(Popover, { placement: "bottom end", className: "min-w-44", children: _jsx(MenuList, { label: copy.record.status, closeOnSelect: true, emptyText: "", width: "sm", groups: [
213
+ {
214
+ options: stages.map((stage) => ({
215
+ id: stage.id,
216
+ label: stage.label,
217
+ ...(display === "label" || stage.icon === undefined
218
+ ? {}
219
+ : { icon: stage.icon }),
220
+ ...(stage.count === undefined
221
+ ? {}
222
+ : { hint: stage.count.toLocaleString(copy.locale) }),
223
+ checked: stage.id === (selected ?? current),
224
+ })),
225
+ },
226
+ ], onAction: (id) => onSelect?.(String(id)) }) })] }));
227
+ }
228
+ if (look === "progress" && !stacked) {
229
+ const chrome = surface === "chrome";
230
+ const barOf = (step) => step === "current"
231
+ ? failed
232
+ ? chrome
233
+ ? "bg-chrome-bad"
234
+ : "bg-danger"
235
+ : chrome
236
+ ? "bg-chrome-link"
237
+ : "bg-primary"
238
+ : step === "done"
239
+ ? chrome
240
+ ? "bg-chrome-link/45"
241
+ : "bg-primary/40"
242
+ : chrome
243
+ ? "bg-chrome-ink/15"
244
+ : "bg-ink/10";
245
+ const labelOf = (step) => step === "current"
246
+ ? `font-semibold ${chrome ? "text-chrome-ink" : "text-ink"}`
247
+ : step === "done"
248
+ ? chrome
249
+ ? "text-chrome-ink"
250
+ : "text-ink"
251
+ : chrome
252
+ ? "text-chrome-muted"
253
+ : "text-muted";
254
+ const segment = (stage, i, viewed) => {
255
+ const where = stepOf(i);
256
+ return (_jsxs(_Fragment, { children: [_jsx("span", { "aria-hidden": true, className: `block h-1.5 w-full rounded-pill ${barOf(where)}` }), _jsxs("span", { "aria-current": where === "current" && selectable ? "step" : undefined, className: cn("mt-1 flex min-w-0 items-center gap-1 text-micro whitespace-nowrap", labelOf(where), viewed && "underline decoration-2 underline-offset-4"), children: [(() => {
257
+ const Icon = display === "label" ? undefined : iconOf(stage, where, viewed);
258
+ return where === "current" && failed ? (_jsx(CircleAlert, { className: "size-3 shrink-0", strokeWidth: 2.5, "aria-hidden": true })) : Icon !== undefined ? (_jsx(Icon, { className: "size-3 shrink-0", strokeWidth: 2.5, "aria-hidden": true })) : where === "done" && display !== "label" ? (_jsx(Check, { className: "size-3 shrink-0", strokeWidth: 2.5, "aria-hidden": true })) : null;
259
+ })(), _jsx("span", { className: nameClass(where, viewed, "min-w-0 truncate"), title: stage.hint, children: stage.label }), countOf(stage)] })] }));
260
+ };
261
+ /* Each stage asks for room for its name: squeezed, «Borrador Publicada» read as one. */
262
+ const row = "grid shrink-0 auto-cols-fr grid-flow-col gap-1.5";
263
+ if (!selectable) {
264
+ return (_jsx("ol", { "aria-label": copy.record.status, "data-look": "progress", className: row, children: stages.map((stage, i) => (_jsx("li", { "aria-current": stepOf(i) === "current" ? "step" : undefined, "data-failed": stepOf(i) === "current" && failed ? true : undefined, className: "flex w-24 min-w-0 flex-col", children: segment(stage, i, false) }, stage.id))) }));
265
+ }
266
+ return (_jsx(RadioGroup, { "aria-label": copy.record.status, orientation: "horizontal", ...(selected === undefined ? {} : { value: selected }), onChange: onSelect, "data-look": "progress", className: row, children: stages.map((stage, i) => (_jsx(Radio, { value: stage.id, className: ({ isFocusVisible }) => cn("flex w-24 min-w-0 cursor-pointer flex-col rounded-mark", isFocusVisible && "outline-2 outline-offset-2 outline-primary"), children: ({ isSelected }) => segment(stage, i, isSelected) }, stage.id))) }));
267
+ }
268
+ if (look === "steps" && !stacked) {
269
+ const chrome = surface === "chrome";
270
+ const dotOf = (step) => step === "current"
271
+ ? failed
272
+ ? `${chrome ? "bg-chrome-bad" : "bg-danger"} ring-3 ${chrome ? "ring-chrome-bad/25" : "ring-danger/20"}`
273
+ : `${chrome ? "bg-chrome-ink" : "bg-primary"} ring-3 ${chrome ? "ring-chrome-ink/25" : "ring-primary/20"}`
274
+ : step === "done"
275
+ ? chrome
276
+ ? "bg-chrome-ink/60"
277
+ : "bg-ink/55"
278
+ : `border ${chrome ? "border-chrome-muted/60" : "border-line-strong"} bg-transparent`;
279
+ const labelOf = (step) => step === "current"
280
+ ? `font-semibold ${chrome ? "text-chrome-ink" : "text-ink"}`
281
+ : step === "done"
282
+ ? chrome
283
+ ? "text-chrome-ink"
284
+ : "text-ink"
285
+ : chrome
286
+ ? "text-chrome-muted"
287
+ : "text-muted";
288
+ const joinOf = (i) => i <= at
289
+ ? chrome
290
+ ? "bg-chrome-ink/45"
291
+ : "bg-ink/35"
292
+ : chrome
293
+ ? "bg-chrome-muted/35"
294
+ : "bg-line-strong";
295
+ const step = (stage, i, viewed) => {
296
+ const where = stepOf(i);
297
+ if (renderStage !== undefined) {
298
+ return (_jsxs(_Fragment, { children: [i === 0 ? null : (_jsx("span", { "aria-hidden": true, className: `h-px w-5 shrink-0 ${joinOf(i)}` })), renderStage(stage, {
299
+ step: where,
300
+ failed: where === "current" && failed,
301
+ viewed,
302
+ index: i,
303
+ })] }));
304
+ }
305
+ const StepIcon = display === "label" ? undefined : iconOf(stage, where, viewed);
306
+ return (_jsxs(_Fragment, { children: [i === 0 ? null : _jsx("span", { "aria-hidden": true, className: `h-px w-5 shrink-0 ${joinOf(i)}` }), _jsx("span", { "aria-hidden": true, className: `size-2 shrink-0 rounded-pill ${dotOf(where)}` }), where === "current" && failed ? (_jsx(CircleAlert, { className: `size-(--size-icon-sm) shrink-0 ${chrome ? "text-chrome-bad" : "text-danger"}`, strokeWidth: 2, "aria-hidden": true })) : StepIcon !== undefined ? (_jsx(StepIcon, { className: `size-(--size-icon-sm) shrink-0 ${labelOf(where)}`, strokeWidth: 2, "aria-hidden": true })) : null, _jsx("span", { title: stage.hint, "aria-current": where === "current" && selectable ? "step" : undefined, className: cn(nameClass(where, viewed, "min-w-0 truncate text-meta whitespace-nowrap"), labelOf(where), viewed && "underline decoration-2 underline-offset-4"), children: stage.label }), stage.count === undefined ? null : (_jsx("span", { className: `text-meta ${labelOf(where)}`, children: countOf(stage) }))] }));
307
+ };
308
+ if (!selectable) {
309
+ return (_jsx("ol", { "aria-label": copy.record.status, className: "flex min-w-0 shrink-0 items-center gap-2", children: stages.map((stage, i) => (_jsx("li", { "aria-current": stepOf(i) === "current" ? "step" : undefined, "data-failed": stepOf(i) === "current" && failed ? true : undefined, className: "flex min-w-0 items-center gap-2", children: step(stage, i, false) }, stage.id))) }));
310
+ }
311
+ return (_jsx(RadioGroup, { "aria-label": copy.record.status, orientation: "horizontal", ...(selected === undefined ? {} : { value: selected }), onChange: onSelect, className: "flex min-w-0 shrink-0 items-center gap-2", children: stages.map((stage, i) => (_jsx(Radio, { value: stage.id, className: ({ isFocusVisible }) => cn("flex min-w-0 cursor-pointer items-center gap-2 rounded-mark", isFocusVisible && "outline-2 outline-offset-2 outline-primary"), children: ({ isSelected }) => step(stage, i, isSelected) }, stage.id))) }));
149
312
  }
150
- const track = trackStyles({ surface, layout: shape });
151
313
  if (!selectable) {
152
314
  return (_jsx("ol", { "aria-label": copy.record.status, className: track, children: stages.map((stage, i) => {
153
315
  const step = stepOf(i);
154
- return (_jsx("li", { "aria-current": step === "current" ? "step" : undefined, "data-failed": step === "current" && failed ? true : undefined, className: stageStyles({ surface, step, failed, selectable, layout: shape }), children: content(stage, step, false) }, stage.id));
316
+ return (_jsx("li", { "aria-current": step === "current" ? "step" : undefined, "data-failed": step === "current" && failed ? true : undefined, className: stageStyles({
317
+ surface,
318
+ step,
319
+ failed,
320
+ selectable,
321
+ layout: shape,
322
+ shape: rounded,
323
+ }), children: content(stage, i, step, false) }, stage.id));
155
324
  }) }));
156
325
  }
157
326
  return (_jsx(RadioGroup, { "aria-label": copy.record.status, orientation: stacked ? "vertical" : "horizontal", ...(selected === undefined ? {} : { value: selected }), onChange: onSelect, className: track, children: stages.map((stage, i) => {
@@ -162,7 +331,8 @@ export function StatusBar({ stages, current, failed = false, surface: surfacePro
162
331
  failed,
163
332
  selectable,
164
333
  layout: shape,
334
+ shape: rounded,
165
335
  isFocusVisible,
166
- }), children: ({ isSelected }) => content(stage, step, isSelected) }, stage.id));
336
+ }), children: ({ isSelected }) => content(stage, i, step, isSelected) }, stage.id));
167
337
  }) }));
168
338
  }