From 05c5b533f5e7f53f5f8ada24eae40cfa1d13f036 Mon Sep 17 00:00:00 2001 From: mindsers Date: Fri, 13 Nov 2026 01:10:40 +0100 Subject: [PATCH 1/2] feat(ui): SidePanel actions in the header (ui 0.10.0) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The item's own buttons (« Modifier », a « … » menu) sit in the panel header, before the walk and the close button; the footer stays for the form's cancel and save. --- ui/README.md | 2 +- ui/package.json | 2 +- ui/src/side-panel.tsx | 7 +++++++ ui/test/components.test.tsx | 18 ++++++++++++++++++ 4 files changed, 27 insertions(+), 2 deletions(-) diff --git a/ui/README.md b/ui/README.md index 5d2772e..f88afdd 100644 --- a/ui/README.md +++ b/ui/README.md @@ -48,7 +48,7 @@ Tell Tailwind v4 to read the classes the components use, next to the tokens impo | `SaveBar` | A form's save actions at the bottom, with the unsaved-changes dot and an announced label | | `Panel` | A bordered block of a page: title and actions, rows edge to edge or `padded` fields, footer | | `SectionHeading` | The line above a block: title, quiet count, tag, actions; `collapsible` shows and hides it | -| `SidePanel` | Edits the selected item beside the main column; sticky, Escape closes, focus goes back; `walk` steps through the list (« 3 sur 12 ») | +| `SidePanel` | Edits the selected item beside the main column; sticky, Escape closes, focus goes back; `walk` steps through the list (« 3 sur 12 »); `actions` puts the item's own buttons in the header | | `Callout` | A notice in the page (refused save, offline, trial): soft tint + status shape, one action | | `DateField` | A date written with its weekday, typed in the reader's order or picked in a month calendar; native picker on touch | | `MapPin` | A place on a map, numbered like the list beside it; a button with hovered / selected states | diff --git a/ui/package.json b/ui/package.json index 95dc728..faaf8f6 100644 --- a/ui/package.json +++ b/ui/package.json @@ -1,6 +1,6 @@ { "name": "@unitae/ui", - "version": "0.9.0", + "version": "0.10.0", "description": "Unitae UI components: stat tiles, chart kit (with table twins), status, avatars, selection bar, segmented control, form sections, save bar, panels, section headings, map pieces and the brand mark. Built on @unitae/tokens.", "license": "MIT", "type": "module", diff --git a/ui/src/side-panel.tsx b/ui/src/side-panel.tsx index 4f04500..1ccd3a0 100644 --- a/ui/src/side-panel.tsx +++ b/ui/src/side-panel.tsx @@ -12,6 +12,11 @@ export interface SidePanelProps { footer?: ReactNode /** Where focus goes back on close, e.g. the row's edit button. Defaults to what had focus when the panel opened. */ returnFocus?: HTMLElement | null + /** + * The item's own actions in the header, before the walk and the close button: « Modifier », a « … » menu. The + * footer stays for the form's cancel and save. + */ + actions?: ReactNode /** * Walks the list the panel was opened from: where this item sits (« 3 sur 12 ») and buttons to the previous and * next ones, in the header beside the close button. Leave a handler out where there is nowhere to go. @@ -48,6 +53,7 @@ export function SidePanel({ closeLabel, footer, returnFocus, + actions, walk, children, className, @@ -132,6 +138,7 @@ export function SidePanel({

)} + {actions != null &&
{actions}
} {walk != null && (
{walk.position} diff --git a/ui/test/components.test.tsx b/ui/test/components.test.tsx index f6fbcb4..6912f98 100644 --- a/ui/test/components.test.tsx +++ b/ui/test/components.test.tsx @@ -921,6 +921,24 @@ describe('SidePanel walk', () => { expect(calls).toEqual(['previous', 'next']) }) + it('puts its actions in the header, before the walk and the close button', () => { + render( + {}} + closeLabel="Fermer" + actions={} + walk={{ position: '1 sur 2', previousLabel: 'Précédent', nextLabel: 'Suivant', onNext: () => {} }} + > +

Contenu

+
, + ) + const buttons = within(screen.getByRole('complementary')) + .getAllByRole('button') + .map((button) => button.textContent || button.getAttribute('aria-label')) + expect(buttons).toEqual(['Modifier', 'Précédent', 'Suivant', 'Fermer']) + }) + it('disables a step that has nowhere to go', () => { render( Date: Fri, 13 Nov 2026 01:11:55 +0100 Subject: [PATCH 2/2] docs(ui): align the components table --- ui/README.md | 66 ++++++++++++++++++++++++++-------------------------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/ui/README.md b/ui/README.md index f88afdd..74a9359 100644 --- a/ui/README.md +++ b/ui/README.md @@ -25,40 +25,40 @@ Tell Tailwind v4 to read the classes the components use, next to the tokens impo ## Components -| Component | Use it for | -| ------------------------- | ------------------------------------------------------------------------------------------------------------------------------------ | -| `StatTile`, `MetricStrip` | Headline numbers in one bordered strip, separated by hairlines | -| `ChartCard` | A chart with title, legend and a Chart / Table switch (`table` + `viewLabels`) | -| `LineChart` | Trends over time; `area` for the series the chart is about, `context` for a grey comparison | -| `ColumnChart` | Magnitudes per period; one highlighted period over muted context, `stack`, `goal`, gaps | -| `BarList` | Ranked horizontal bars, one hue; `other` for the folded tail | -| `SegmentedBar` | One whole split in ≤ 6 parts; values print inside where they fit | -| `Sparkline` | Tiny decorative columns beside a number; `goal` line, gaps for future / missing periods | -| `ProgressBar` | A share of a whole as a thin bar; decorative unless it gets an `aria-label` | -| `ProgressRing` | A share in a list column (« 5/7 »): a thin arc over a track, success once complete | -| `PeriodStepper` | Previous / next period around the current label; `renderLink` for the app's router | -| `Status`, `StatusIcon` | A state as shape + label (`success`, `warning`, `danger`, `neutral`) | -| `Tag`, `Kbd` | Quiet attribute labels, keyboard hints | -| `Avatar` | A person's initials in a quiet disc, next to their name (`initials(name)` is exported too) | -| `SelectionBar` | Floating actions on a list selection; announces the count, Escape clears | -| `SegmentedControl` | 2–5 exclusive choices with a sliding indicator and arrow-key navigation; `null` = no choice | -| `FactList` | Facts as label / value pairs in a `
`; empty values left out, or `emptyLabel` for them | -| `DateChip` | A day as a small tile, month over day, beside a row that says the full date | -| `FormSection` | One part of a long form: title, kicker and actions left, fields right (`col-span-full`) | -| `SaveBar` | A form's save actions at the bottom, with the unsaved-changes dot and an announced label | -| `Panel` | A bordered block of a page: title and actions, rows edge to edge or `padded` fields, footer | -| `SectionHeading` | The line above a block: title, quiet count, tag, actions; `collapsible` shows and hides it | +| Component | Use it for | +| ------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `StatTile`, `MetricStrip` | Headline numbers in one bordered strip, separated by hairlines | +| `ChartCard` | A chart with title, legend and a Chart / Table switch (`table` + `viewLabels`) | +| `LineChart` | Trends over time; `area` for the series the chart is about, `context` for a grey comparison | +| `ColumnChart` | Magnitudes per period; one highlighted period over muted context, `stack`, `goal`, gaps | +| `BarList` | Ranked horizontal bars, one hue; `other` for the folded tail | +| `SegmentedBar` | One whole split in ≤ 6 parts; values print inside where they fit | +| `Sparkline` | Tiny decorative columns beside a number; `goal` line, gaps for future / missing periods | +| `ProgressBar` | A share of a whole as a thin bar; decorative unless it gets an `aria-label` | +| `ProgressRing` | A share in a list column (« 5/7 »): a thin arc over a track, success once complete | +| `PeriodStepper` | Previous / next period around the current label; `renderLink` for the app's router | +| `Status`, `StatusIcon` | A state as shape + label (`success`, `warning`, `danger`, `neutral`) | +| `Tag`, `Kbd` | Quiet attribute labels, keyboard hints | +| `Avatar` | A person's initials in a quiet disc, next to their name (`initials(name)` is exported too) | +| `SelectionBar` | Floating actions on a list selection; announces the count, Escape clears | +| `SegmentedControl` | 2–5 exclusive choices with a sliding indicator and arrow-key navigation; `null` = no choice | +| `FactList` | Facts as label / value pairs in a `
`; empty values left out, or `emptyLabel` for them | +| `DateChip` | A day as a small tile, month over day, beside a row that says the full date | +| `FormSection` | One part of a long form: title, kicker and actions left, fields right (`col-span-full`) | +| `SaveBar` | A form's save actions at the bottom, with the unsaved-changes dot and an announced label | +| `Panel` | A bordered block of a page: title and actions, rows edge to edge or `padded` fields, footer | +| `SectionHeading` | The line above a block: title, quiet count, tag, actions; `collapsible` shows and hides it | | `SidePanel` | Edits the selected item beside the main column; sticky, Escape closes, focus goes back; `walk` steps through the list (« 3 sur 12 »); `actions` puts the item's own buttons in the header | -| `Callout` | A notice in the page (refused save, offline, trial): soft tint + status shape, one action | -| `DateField` | A date written with its weekday, typed in the reader's order or picked in a month calendar; native picker on touch | -| `MapPin` | A place on a map, numbered like the list beside it; a button with hovered / selected states | -| `MapDot` | An entrance's state in a map editor: on, free, elsewhere, to add, to remove | -| `MapCluster` | Places too close to tell apart: a quiet disc with their count, a button that zooms in | -| `MapControls` | Zoom and « Recentrer » over the map; `MapControlGroup` / `MapControlButton` for more | -| `MapCaption`, `MapCard` | A line about the map (top left); a picked place's card (corner, or full width below 1280) | -| `MapAttribution` | The data credit, always visible bottom right (pass `MAP_ATTRIBUTION` from the tokens) | -| `MapStatus` | Loading or failed tiles, in the middle of the map's frame | -| `Mark`, `Lockup` | The Unitae mark, alone or with the wordmark | +| `Callout` | A notice in the page (refused save, offline, trial): soft tint + status shape, one action | +| `DateField` | A date written with its weekday, typed in the reader's order or picked in a month calendar; native picker on touch | +| `MapPin` | A place on a map, numbered like the list beside it; a button with hovered / selected states | +| `MapDot` | An entrance's state in a map editor: on, free, elsewhere, to add, to remove | +| `MapCluster` | Places too close to tell apart: a quiet disc with their count, a button that zooms in | +| `MapControls` | Zoom and « Recentrer » over the map; `MapControlGroup` / `MapControlButton` for more | +| `MapCaption`, `MapCard` | A line about the map (top left); a picked place's card (corner, or full width below 1280) | +| `MapAttribution` | The data credit, always visible bottom right (pass `MAP_ATTRIBUTION` from the tokens) | +| `MapStatus` | Loading or failed tiles, in the middle of the map's frame | +| `Mark`, `Lockup` | The Unitae mark, alone or with the wordmark | Helpers: `seriesColor(i)` (categorical colours in order, folded past eight), `chartMuted`, `chartContext`, `chartOther`, `cn`.