@ciridae/ui 2.85.2-nightly.20261113041242.g303c00a → 2.86.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.
@@ -0,0 +1,2 @@
1
+ declare const stylesheet: string;
2
+ export default stylesheet;
@@ -16,7 +16,7 @@ export type NavItem = {
16
16
  /** `compact` for a secondary list, such as recently opened records. */
17
17
  size?: "regular" | "compact";
18
18
  };
19
- export type NavSection = {
19
+ type NavSectionFields = {
20
20
  id: string;
21
21
  label?: ReactNode;
22
22
  items: readonly NavItem[];
@@ -37,6 +37,19 @@ export type NavSection = {
37
37
  /** Under its items in the expanded sidebar, inset as its label is, such as a picker that scopes them. */
38
38
  footer?: ReactNode;
39
39
  };
40
+ /**
41
+ * A sidebar section. One the reader can fold has a label, which ends in a caret that hides and
42
+ * shows its items in the expanded sidebar: the host keeps `open` and gets each change through
43
+ * `onOpenChange`. The rail is unchanged, so its items or `railControl` stay there.
44
+ */
45
+ export type NavSection = (NavSectionFields & {
46
+ open?: never;
47
+ onOpenChange?: never;
48
+ }) | (NavSectionFields & {
49
+ label: string;
50
+ open: boolean;
51
+ onOpenChange: (open: boolean) => void;
52
+ });
40
53
  export type AppNavigationProps = Omit<ComponentProps<"aside">, "children"> & {
41
54
  sections: readonly NavSection[];
42
55
  /**
@@ -111,3 +124,4 @@ export type WorkspaceSwitcherProps = {
111
124
  compact?: boolean;
112
125
  };
113
126
  export declare function WorkspaceSwitcher({ workspaces, currentId, onSelect, items, compact, }: WorkspaceSwitcherProps): import("react").JSX.Element;
127
+ export {};
@@ -7,7 +7,7 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
7
7
  * holds is open or, with `autoUnfold`, while the sidebar has room for every row. Pinned and recent
8
8
  * records are sections like any other, which the caller builds from its own state.
9
9
  */
10
- import { CaretDownIcon, CaretLineRightIcon, CaretUpDownIcon, CaretUpIcon, } from "@phosphor-icons/react";
10
+ import { CaretDownIcon, CaretLineRightIcon, CaretRightIcon, CaretUpDownIcon, CaretUpIcon, } from "@phosphor-icons/react";
11
11
  import { Fragment, useLayoutEffect, useRef, useState, } from "react";
12
12
  import { css, cx } from "#primitives/css";
13
13
  import { IconButton } from "./button.js";
@@ -118,6 +118,10 @@ function SectionItems({ section, activeIds, renderLink, roomy, labels, expanded,
118
118
  const Caret = unfolded ? CaretUpIcon : CaretDownIcon;
119
119
  return (_jsxs(_Fragment, { children: [!unfolded ? (rows(items.slice(0, maxVisible))) : section.scrollWhenUnfolded ? (_jsx("div", { className: foldScroll, "data-navigation-fold-scroll": "", children: rows(items) })) : (rows(items)), !holdsActiveItem && (_jsx(SidebarItem, { size: "compact", icon: _jsx(Caret, { className: icon({ size: "small" }) }), "aria-expanded": unfolded, onClick: () => onExpandedChange(!unfolded), "data-navigation-more": "", "data-sidebar-action": "", children: unfolded ? labels.less : labels.more }))] }));
120
120
  }
121
+ /** Whether a section's items show in the expanded sidebar: always, unless the reader folded it. */
122
+ function isSectionOpen(section) {
123
+ return section.onOpenChange === undefined || section.open;
124
+ }
121
125
  /** Runs of sections: each main section alone, consecutive panel sections together. */
122
126
  function sectionRuns(sections) {
123
127
  const runs = [];
@@ -148,10 +152,17 @@ export function AppNavigation({ sections, activeId: ownActiveId = null, renderLi
148
152
  next.delete(sectionId);
149
153
  return next;
150
154
  });
151
- const hiddenRows = sections.reduce((rows, section) => rows + countRowsHiddenByFold(section, activeIds, expandedSectionIds.has(section.id)), 0);
155
+ // A folded section draws no rows, so none of them wait behind its More row.
156
+ const hiddenRows = sections.reduce((rows, section) => isSectionOpen(section)
157
+ ? rows + countRowsHiddenByFold(section, activeIds, expandedSectionIds.has(section.id))
158
+ : rows, 0);
152
159
  const room = useSidebarRoom(hiddenRows);
153
160
  const roomy = autoUnfold && room.roomy;
154
- const sectionBlock = (section) => (_jsxs(SidebarSection, { label: section.label, children: [_jsx(SectionItems, { section: section, activeIds: activeIds, renderLink: renderLink, roomy: roomy, labels: labels, expanded: expandedSectionIds.has(section.id), onExpandedChange: (expanded) => setSectionExpanded(section.id, expanded) }), section.footer && _jsx("div", { className: sectionFooter, children: section.footer })] }, section.id));
161
+ const sectionBlock = (section) => {
162
+ const { onOpenChange } = section;
163
+ const open = isSectionOpen(section);
164
+ return (_jsx(SidebarSection, { label: section.label, action: onOpenChange && (_jsx(IconButton, { "aria-expanded": open, "aria-label": open ? locale.labels.common.collapse : locale.labels.common.expand, size: "compact", variant: "ghost", "data-sidebar-action": "", onClick: () => onOpenChange(!open), children: open ? (_jsx(CaretDownIcon, { className: icon({ size: "small" }) })) : (_jsx(CaretRightIcon, { className: cx(icon({ size: "small" }), directional) })) })), children: open && (_jsxs(_Fragment, { children: [_jsx(SectionItems, { section: section, activeIds: activeIds, renderLink: renderLink, roomy: roomy, labels: labels, expanded: expandedSectionIds.has(section.id), onExpandedChange: (expanded) => setSectionExpanded(section.id, expanded) }), section.footer && _jsx("div", { className: sectionFooter, children: section.footer })] })) }, section.id));
165
+ };
155
166
  return (_jsxs(AppSidebar, { "aria-label": labels.navigation, collapsed: collapsed, ...props, children: [_jsxs(AppSidebarNav, { ref: room.navRef, children: [header, sectionRuns(sections).map((run) => run.panel ? (_jsx(SidebarPanel, { children: run.sections.map(sectionBlock) }, run.sections[0].id)) : (_jsx(Fragment, { children: run.sections.map(sectionBlock) }, run.sections[0].id)))] }), _jsxs(AppSidebarRail, { children: [railHeader, sections
156
167
  .filter((section) => section.rail !== false && section.items.length > 0)
157
168
  .map((section) => (_jsxs("div", { className: railSection, children: [section.label && _jsx(SidebarRailRule, {}), section.railControl ??
@@ -11,10 +11,17 @@ const navigation = css({
11
11
  flexDirection: "column",
12
12
  gap: "layout.clusterGap",
13
13
  });
14
- const section = css({ display: "grid", gap: "control.trackInset" });
14
+ // One column as wide as the section and no wider, so a long row ends in an ellipsis rather than
15
+ // widening the section past the sidebar. The panel's column holds its sections the same way.
16
+ const section = css({
17
+ display: "grid",
18
+ gridTemplateColumns: "minmax(0, 1fr)",
19
+ gap: "control.trackInset",
20
+ });
15
21
  // A block of secondary sections, such as pinned and recent records, set apart by a fill.
16
22
  const panel = css({
17
23
  display: "grid",
24
+ gridTemplateColumns: "minmax(0, 1fr)",
18
25
  gap: "layout.controlGap",
19
26
  padding: "layout.tightGap",
20
27
  borderRadius: "action",
@@ -47,7 +54,16 @@ const railRule = css({
47
54
  // A hover is a faint wash in light and the selected glass in dark.
48
55
  const item = css({
49
56
  display: "flex",
50
- alignItems: "center",
57
+ /*
58
+ * The label and its trailing count sit on one baseline, as a tab's do; centring the two boxes
59
+ * left the smaller count high. The label is `flex: 1`, so its hypothetical size is zero and
60
+ * nothing can wrap onto a second line.
61
+ */
62
+ alignItems: "baseline",
63
+ alignContent: "center",
64
+ flexWrap: "wrap",
65
+ // An icon has no baseline of its own, so it centres rather than hanging from the text's.
66
+ "& > svg": { alignSelf: "center" },
51
67
  gap: "layout.controlGap",
52
68
  width: "full",
53
69
  height: "control.row",
@@ -72,7 +72,9 @@ const pill = css({
72
72
  gap: "layout.contentGap",
73
73
  flex: "[1 1 28rem]",
74
74
  minWidth: "0",
75
- paddingBlock: "control.block",
75
+ // The compact block padding: the pill's own action sets how short it can be, so the rest of the
76
+ // room it took went to padding.
77
+ paddingBlock: "control.compactBlock",
76
78
  paddingInlineStart: "control.compactInline",
77
79
  paddingInlineEnd: "control.block",
78
80
  borderRadius: "card",
@@ -116,6 +118,19 @@ const pillText = css({
116
118
  minWidth: "0",
117
119
  lineHeight: "compact",
118
120
  });
121
+ /*
122
+ * The stage's name and its summary sit on one line where the pill is wide enough for both, and the
123
+ * summary wraps under the name where it is not: stacking them always made the pill two lines tall
124
+ * on a row that had room for one.
125
+ */
126
+ const pillHeadline = css({
127
+ display: "flex",
128
+ flexWrap: "wrap",
129
+ alignItems: "baseline",
130
+ columnGap: "layout.controlGap",
131
+ rowGap: "layout.tightGap",
132
+ minWidth: "0",
133
+ });
119
134
  // The stage's name opens it; its hit area stretches over the whole pill, under the action.
120
135
  const openStage = css({
121
136
  padding: "none",
@@ -130,7 +145,7 @@ const openStage = css({
130
145
  outline: "0",
131
146
  "&::after": { content: "''", position: "absolute", inset: "[0]", borderRadius: "[inherit]" },
132
147
  });
133
- const pillSummary = css({ color: "fg.primary", fontSize: "body", lineClamp: "2" });
148
+ const pillSummary = css({ color: "fg.primary", fontSize: "body", minWidth: "0", lineClamp: "2" });
134
149
  const workingLine = css({
135
150
  display: "flex",
136
151
  alignItems: "center",
@@ -161,7 +176,7 @@ export function StageBar({ stages, whoseMove, summary, working = [], action, onO
161
176
  // The link after the pill, or before it when it is the last stage.
162
177
  index - 1 === currentIndex ||
163
178
  (index === currentIndex && currentIndex === stages.length - 1) ||
164
- undefined })), index === currentIndex ? (_jsx("li", { className: barItem, children: _jsxs("div", { className: pill, "data-whose-move": whoseMove, children: [_jsx(WhoseMoveIcon, { weight: "fill", "aria-hidden": "true" }), _jsxs("span", { className: pillText, children: [_jsx("button", { type: "button", className: openStage, "data-open-stage": "", "aria-current": "step", "aria-describedby": summaryId, onClick: () => onOpenStage(stage.id), children: stage.label }), _jsx("span", { id: summaryId, className: pillSummary, children: summary }), working.map((work) => (_jsxs("span", { className: workingLine, children: [_jsx(SparkleIcon, { weight: "fill", "aria-hidden": "true" }), _jsxs("span", { children: [work.who, " \u00B7 ", work.doing, "\u2026"] })] }, work.id)))] }), action && (_jsx("span", { className: pillAction, children: _jsx(Button, { size: "small", loading: action.loading, onClick: action.onClick, children: action.label }) }))] }) })) : (_jsx("li", { className: barItem, children: _jsxs("button", { type: "button", className: otherStage, "data-done": stage.status === "done" || undefined, title: stage.label, "aria-label": stage.status === "done"
179
+ undefined })), index === currentIndex ? (_jsx("li", { className: barItem, children: _jsxs("div", { className: pill, "data-whose-move": whoseMove, children: [_jsx(WhoseMoveIcon, { weight: "fill", "aria-hidden": "true" }), _jsxs("span", { className: pillText, children: [_jsxs("span", { className: pillHeadline, children: [_jsx("button", { type: "button", className: openStage, "data-open-stage": "", "aria-current": "step", "aria-describedby": summaryId, onClick: () => onOpenStage(stage.id), children: stage.label }), _jsx("span", { id: summaryId, className: pillSummary, children: summary })] }), working.map((work) => (_jsxs("span", { className: workingLine, children: [_jsx(SparkleIcon, { weight: "fill", "aria-hidden": "true" }), _jsxs("span", { children: [work.who, " \u00B7 ", work.doing, "\u2026"] })] }, work.id)))] }), action && (_jsx("span", { className: pillAction, children: _jsx(Button, { size: "small", loading: action.loading, onClick: action.onClick, children: action.label }) }))] }) })) : (_jsx("li", { className: barItem, children: _jsxs("button", { type: "button", className: otherStage, "data-done": stage.status === "done" || undefined, title: stage.label, "aria-label": stage.status === "done"
165
180
  ? labels.record.stageDoneLabel(stage.label)
166
181
  : stage.status === "todo" || stage.status === "locked"
167
182
  ? labels.record.stageAheadLabel(stage.label)
@@ -50,16 +50,17 @@ const step = css({
50
50
  },
51
51
  });
52
52
  const stepHead = css({ display: "flex", alignItems: "flex-start", gap: "layout.controlGap" });
53
+ // Big enough to read as the step's number rather than a badge on its name.
53
54
  const marker = css({
54
55
  flexShrink: "0",
55
56
  display: "grid",
56
57
  placeItems: "center",
57
- width: "[28px]",
58
- height: "[28px]",
58
+ width: "[32px]",
59
+ height: "[32px]",
59
60
  borderRadius: "round",
60
61
  border: "2px solid var(--stage-hue)",
61
62
  color: "[color-mix(in srgb, var(--stage-hue) 75%, token(colors.fg.primary))]",
62
- fontSize: "code",
63
+ fontSize: "body",
63
64
  fontWeight: "semibold",
64
65
  fontVariantNumeric: "tabular-nums",
65
66
  "[aria-pressed=true] &": { background: "var(--stage-hue)", color: "fg.onAccent" },
@@ -71,7 +72,7 @@ const stepLabel = css({
71
72
  display: "flex",
72
73
  alignItems: "center",
73
74
  textWrap: "balance",
74
- fontSize: "body",
75
+ fontSize: "heading",
75
76
  fontWeight: "medium",
76
77
  lineHeight: "compact",
77
78
  });
@@ -358,17 +358,20 @@ const attentionHeader = css({
358
358
  // where the muted red read 3.3:1.
359
359
  "&[data-tone=danger]": { color: "fg.red" },
360
360
  });
361
+ /*
362
+ * The card inside the step's tinted row draws no edge of its own: its face is what lifts it off the
363
+ * tint, and a ring here would sit a hairline inside the row's, which already sits inside the panel
364
+ * the step is drawn in.
365
+ */
361
366
  const attentionCard = css({
362
367
  display: "flex",
363
368
  alignItems: "center",
364
369
  justifyContent: "space-between",
365
370
  gap: "layout.clusterGap",
366
371
  padding: "panel.default",
367
- border: "1px solid transparent",
368
372
  borderRadius: "control",
369
373
  background: "bg.panel",
370
374
  _light: { background: "bg.card" },
371
- "--edge": "var(--step-edge)",
372
375
  "@container (max-width: 560px)": { flexDirection: "column", alignItems: "stretch" },
373
376
  _phone: { padding: "panel.compact" },
374
377
  });
@@ -452,7 +455,7 @@ export function HelpMenu({ trigger, title, detail, options }) {
452
455
  export function CurrentStep({ tone, meta, title, description, primary, secondary, help, busy = false, expanded: ownExpanded, defaultExpanded = true, onExpandedChange, className, ...props }) {
453
456
  const { labels } = useCiridaeLocale();
454
457
  const [expanded, setExpanded] = useControllableState(ownExpanded, defaultExpanded, onExpandedChange);
455
- return (_jsxs("div", { ...props, className: cx(attentionRow({ tone }), className), "data-ciridae-ui": "", "data-edge": "gradient", children: [_jsxs("button", { type: "button", className: attentionHeader, "data-tone": tone, "aria-expanded": expanded, onClick: () => setExpanded(!expanded), children: [busy ? (_jsx(Spinner, { size: "compact", "aria-hidden": "true" })) : (_jsx(StepDot, { status: toneStatus[tone], size: "small" })), _jsx("span", { className: css({ flex: "1" }), children: meta }), _jsx("span", { className: collapseToggle({ tone }), "data-ciridae-ui": "", "data-edge": "gradient", children: expanded ? (_jsx(CaretUpIcon, { className: icon({ size: "compact" }) })) : (_jsx(CaretDownIcon, { className: icon({ size: "compact" }) })) })] }), expanded && (_jsxs("div", { className: attentionCard, "data-ciridae-ui": "", "data-edge": "gradient", children: [_jsxs("div", { className: css({ minWidth: "0" }), children: [_jsx("div", { className: attentionTitle, children: title }), description !== undefined && _jsx("div", { className: attentionDescription, children: description })] }), (help || secondary || primary) && (_jsxs(Cluster, { gap: "4", className: stepActions, children: [help && (_jsx(HelpMenu, { ...help, trigger: _jsx(Button, { variant: "ghost", children: labels.record.notSure }) })), secondary && (_jsx(StepActionButton, { action: secondary, variant: tone === "warning" ? "tinted" : "secondary" })), primary && _jsx(StepActionButton, { action: primary, variant: "primary" })] }))] }))] }));
458
+ return (_jsxs("div", { ...props, className: cx(attentionRow({ tone }), className), "data-ciridae-ui": "", "data-edge": "gradient", children: [_jsxs("button", { type: "button", className: attentionHeader, "data-tone": tone, "aria-expanded": expanded, onClick: () => setExpanded(!expanded), children: [busy ? (_jsx(Spinner, { size: "compact", "aria-hidden": "true" })) : (_jsx(StepDot, { status: toneStatus[tone], size: "small" })), _jsx("span", { className: css({ flex: "1" }), children: meta }), _jsx("span", { className: collapseToggle({ tone }), "data-ciridae-ui": "", "data-edge": "gradient", children: expanded ? (_jsx(CaretUpIcon, { className: icon({ size: "compact" }) })) : (_jsx(CaretDownIcon, { className: icon({ size: "compact" }) })) })] }), expanded && (_jsxs("div", { className: attentionCard, "data-ciridae-ui": "", children: [_jsxs("div", { className: css({ minWidth: "0" }), children: [_jsx("div", { className: attentionTitle, children: title }), description !== undefined && _jsx("div", { className: attentionDescription, children: description })] }), (help || secondary || primary) && (_jsxs(Cluster, { gap: "4", className: stepActions, children: [help && (_jsx(HelpMenu, { ...help, trigger: _jsx(Button, { variant: "ghost", children: labels.record.notSure }) })), secondary && (_jsx(StepActionButton, { action: secondary, variant: tone === "warning" ? "tinted" : "secondary" })), primary && _jsx(StepActionButton, { action: primary, variant: "primary" })] }))] }))] }));
456
459
  }
457
460
  const confirmation = css({
458
461
  display: "flex",
@@ -51,8 +51,20 @@ const underlineList = css({
51
51
  const count = css({ color: "fg.muted", fontSize: "code", fontVariantNumeric: "tabular-nums" });
52
52
  const tab = css({
53
53
  display: "inline-flex",
54
- alignItems: "center",
54
+ /*
55
+ * The label and its smaller count sit on one baseline. Centring the two boxes instead left the
56
+ * digits high, and no smaller size fixes that: a line box's baseline falls
57
+ * `fontSize * (ascent - descent) / 2` below its centre, so a 12px count lands 0.73px above a
58
+ * 14px label and only an equal size would line up. `wrap` is here only because `alignContent`
59
+ * needs a multi-line container to centre the line; the tab hugs its content and never shrinks,
60
+ * so nothing can reach a second line.
61
+ */
62
+ alignItems: "baseline",
63
+ alignContent: "center",
64
+ flexWrap: "wrap",
55
65
  justifyContent: "center",
66
+ // An icon has no baseline of its own, so it centres rather than hanging from the text's.
67
+ "& svg": { alignSelf: "center" },
56
68
  gap: "control.iconGap",
57
69
  height: "control.restingTab",
58
70
  paddingInline: "control.tabInline",
@@ -4793,12 +4793,12 @@
4793
4793
  min-width: 150px;
4794
4794
  }
4795
4795
 
4796
- .w_\[28px\] {
4797
- width: 28px;
4796
+ .w_\[32px\] {
4797
+ width: 32px;
4798
4798
  }
4799
4799
 
4800
- .h_\[28px\] {
4801
- height: 28px;
4800
+ .h_\[32px\] {
4801
+ height: 32px;
4802
4802
  }
4803
4803
 
4804
4804
  .min-h_\[2\.5em\] {
@@ -10526,6 +10526,10 @@
10526
10526
  transform: translateX(calc(var(--sizes-control\.compact) - 2 * var(--spacing-control\.track-inset) - var(--sizes-control\.knob)));
10527
10527
  }
10528
10528
 
10529
+ .\[\&_svg\]\:as_center svg {
10530
+ align-self: center;
10531
+ }
10532
+
10529
10533
  .\[\&\[data-icon-tone\=bronze\]_svg\]\:c_accent\.bronze[data-icon-tone=bronze] svg {
10530
10534
  color: var(--colors-accent\.bronze);
10531
10535
  }
@@ -0,0 +1,2 @@
1
+ declare const stylesheet: string;
2
+ export default stylesheet;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ciridae/ui",
3
- "version": "2.85.2-nightly.20261113041242.g303c00a",
3
+ "version": "2.86.0",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",