@tensor_1/react 2.61.0 → 2.63.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 CHANGED
@@ -831,6 +831,25 @@ Both are a `role="grid"` table with one tab stop. Arrow keys move between cells,
831
831
  - `count: 0` shows a zero. `hideCount` shows the band alone, for a zero you would rather not print. A row and column left out of `cells` is drawn empty (dashed, `labels.empty`), and can still be opened: `onOpenCell` gets only its `rowId` and `columnId`.
832
832
  - Tones are `neutral`, `info`, `success`, `warning`, `attention` and `danger`, always beside their words.
833
833
 
834
+ ### ListSummary: long lists of names
835
+
836
+ A cell that lists sixteen roles makes every row of its table tall. `ListSummary` shows a count, the first `max` names (default 3) and the words for the rest, with one button that shows the whole list in place and hides it again (`aria-expanded`, `aria-controls`). A list only one name longer than `max` is shown whole, because hiding a single name saves no space. Every word is a prop; the defaults are English.
837
+
838
+ ```tsx
839
+ import { ListSummary } from '@tensor_1/react';
840
+
841
+ <ListSummary
842
+ items={roles.map((r) => r.name)}
843
+ count={(n) => `${n} Rollen`}
844
+ more={(n) => `und ${n} weitere`}
845
+ expandLabel="Alle anzeigen"
846
+ collapseLabel="Weniger anzeigen"
847
+ empty="Keine Rolle"
848
+ />
849
+ ```
850
+
851
+ The toggle sits in the line of names: underlined, so colour is not its only cue, with a 24 px hit area that leaves the line height alone (`.uix-list-summary__toggle`).
852
+
834
853
  ### FilterEditor (typed column filters)
835
854
 
836
855
  `FilterEditor` is the content of one column-filter popover with a typed value (HAR-1365; TENSOR's
@@ -1042,6 +1061,21 @@ The layout grid for dashboard widgets (HAR-1555; TENSOR's role dashboards). Pure
1042
1061
  - Refs reach the grid and item `<div>`s, and other props pass through. For an element you render yourself (a drag-and-drop library's sortable node, a server template), use `dashboardGridClassName(columns, gap)` and `dashboardGridItemClassName(span)`.
1043
1062
  - Plain HTML: `.uix-dashboard-grid` with `--cols-N` / `--{sm,md,lg,xl}-cols-N` and `--gap-sm|lg`, items `.uix-dashboard-grid__item` with `--span-2` / `--full`. Every direct child of the grid is a cell.
1044
1063
 
1064
+ ### OverflowRow
1065
+
1066
+ One line of items that never wraps (HAR-3072; TENSOR's member roles). It shows, in order, the items that fit whole and replaces the rest with one counter, so a table row keeps one height and no badge is cut mid-word.
1067
+
1068
+ ```tsx
1069
+ <OverflowRow more="+{count}" moreLabel="{count} weitere: {items}">
1070
+ {roles.map((r) => <StatusPill key={r.key} tone="neutral">{r.name}</StatusPill>)}
1071
+ </OverflowRow>
1072
+ ```
1073
+
1074
+ - **What it shows:** every item when they fit side by side; otherwise the most that fit whole beside the counter, never fewer than one (`overflowRowFit(widths, available, gap, counterWidth)` is the rule, exported for tests). The first item may shrink, so a single item wider than the row is clipped at its edge: give it its own truncating text for an ellipsis.
1075
+ - **Accessible:** the hidden items stay in the DOM for measuring but out of the layout and the accessibility tree; the counter's screen-reader text (`moreLabel`, `{count}` and `{items}`) and its `title` name them, so each item is heard once.
1076
+ - **Measures** with a ResizeObserver and on every render. Before it can (a server render, no ResizeObserver) every item shows and the row clips. In a table cell, give the column or the row a width (`max-width`): a cell sized by its content would grow to fit every item.
1077
+ - Plain HTML: `.uix-overflow-row` > `.uix-overflow-row__item` (`[data-overflow-hidden]` for a hidden one), `.uix-overflow-row__more`, and the hidden `.uix-overflow-row__probe` holding the widest counter text.
1078
+
1045
1079
  ### OrgChart
1046
1080
 
1047
1081
  Reporting lines as a top-down chart (HAR-1807; TENSOR's People directory). Managers sit above their direct reports, joined by lines; each person is a card with photo or initials, name, title, team, location and the number of direct reports, which is also the control that shows or hides them. Data fetching stays in the product: the chart asks for a person's reports through `loadChildren` the first time they are opened.
@@ -1760,6 +1794,20 @@ like an icon (a Kbd legend, a diff sign) goes in `glyph-icons.allow.json` with a
1760
1794
  regular tabular h3 values.
1761
1795
  - `SectionHead size="compact"` (15 px / 1.3 / 600) and `as="h3"`; `CellSub tabular`.
1762
1796
 
1797
+ #### Eyebrow section labels that link, and 24 px link targets (HAR-3097, HAR-3084, HAR-3091)
1798
+
1799
+ ```tsx
1800
+ <SectionHead size="eyebrow" as="h3" title={t('incidents')} href="/settings/c/incidents" renderLink={(p) => <NextLink {...p} />} />
1801
+ <Peek open={open} onClose={close} title={title} footer={<NextLink href={recordHref}>{t('openRecord')}</NextLink>}>…</Peek>
1802
+ ```
1803
+
1804
+ - `SectionHead size="eyebrow"`: the 11 px / 700 uppercase hushed label over a group of tiles, on a 24 px row
1805
+ (`.uix-section-head--eyebrow`; the text style alone is `.uix-eyebrow`). With `href` the title is the link
1806
+ (`.uix-section-title__link`), a 24 px target; a linked and an unlinked label put their text in the same place.
1807
+ - A link that stands on its own in a kit slot is a 24 px target, with no utility classes: a sort button, a cell's
1808
+ link (`.uix-cell-link` or a classless anchor), a link in the Peek footer (a classless anchor, or
1809
+ `.uix-peek__footer-link` when it must carry a class) and `.uix-section-link`.
1810
+
1763
1811
  #### Sidebar actions and search, AccountMenu, the rail hotkey and the phone nav tier (HAR-1371)
1764
1812
 
1765
1813
  ```tsx
@@ -221,10 +221,18 @@
221
221
  "name": "DateRangePicker",
222
222
  "subpath": "."
223
223
  },
224
+ {
225
+ "name": "DateTime",
226
+ "subpath": "."
227
+ },
224
228
  {
225
229
  "name": "DateTimePicker",
226
230
  "subpath": "."
227
231
  },
232
+ {
233
+ "name": "DateTimeRange",
234
+ "subpath": "."
235
+ },
228
236
  {
229
237
  "name": "DescriptionItem",
230
238
  "subpath": "."
@@ -425,6 +433,10 @@
425
433
  "name": "ListItem",
426
434
  "subpath": "."
427
435
  },
436
+ {
437
+ "name": "ListSummary",
438
+ "subpath": "."
439
+ },
428
440
  {
429
441
  "name": "LiveIndicator",
430
442
  "subpath": "."
@@ -533,6 +545,10 @@
533
545
  "name": "OtpInput",
534
546
  "subpath": "."
535
547
  },
548
+ {
549
+ "name": "OverflowRow",
550
+ "subpath": "."
551
+ },
536
552
  {
537
553
  "name": "PageHeader",
538
554
  "subpath": "."
@@ -38,11 +38,12 @@ interface SchedulingTimeGridProps {
38
38
  topLaneCap: number;
39
39
  windowLaneCap: number;
40
40
  maxLanes: number;
41
+ scrollToTime?: string;
41
42
  emptyNote?: ReactNode;
42
43
  nothingToShow: boolean;
43
44
  }
44
45
  /** Week (seven columns) or Day (one column) with an hour axis. */
45
- declare function SchedulingTimeGrid({ view, days, timeZone, entries: givenEntries, overlays: givenOverlays, dayInfo, labels, gridLabel, dateText, formatInstant, entryName, entryStatus, entryMarkers, overlayName, renderEntry, renderMarker, onSelectEntry, onSelectOverlay, onSelectDate, onShowMore, now, canMove, step: givenStep, onProposeMove, topLaneCrossMidnightMinutes, topLaneCap, windowLaneCap, maxLanes, emptyNote, nothingToShow, }: SchedulingTimeGridProps): react.JSX.Element;
46
+ declare function SchedulingTimeGrid({ view, days, timeZone, entries: givenEntries, overlays: givenOverlays, dayInfo, labels, gridLabel, dateText, formatInstant, entryName, entryStatus, entryMarkers, overlayName, renderEntry, renderMarker, onSelectEntry, onSelectOverlay, onSelectDate, onShowMore, now, canMove, step: givenStep, onProposeMove, topLaneCrossMidnightMinutes, topLaneCap, windowLaneCap, maxLanes, scrollToTime, emptyNote, nothingToShow, }: SchedulingTimeGridProps): react.JSX.Element;
46
47
 
47
48
  /** `day` is one column of the time grid. `week` is the time grid when `timeGrid` is set, else seven day cells. */
48
49
  type SchedulingCalendarView = 'month' | 'week' | 'day' | 'agenda';
@@ -390,6 +391,13 @@ interface SchedulingCalendarProps {
390
391
  topLaneCap?: number;
391
392
  /** Lanes side by side in one day column of the time grid, at most. Fewer are used when the column is narrow. Default 4. */
392
393
  maxLanes?: number;
394
+ /**
395
+ * The local time (`HH:MM` in `timeZone`) the time grid's hours open at. The grid scrolls inside
396
+ * its own height (`--uix-scheduling-calendar-tg-height`, default `min(70vh, 46rem)`) with the day
397
+ * heads kept on top. Unset opens at the earlier of 08:00 and the first item that starts on screen.
398
+ * It opens there again when the days or the view change, never after the user scrolled.
399
+ */
400
+ scrollToTime?: string;
393
401
  /**
394
402
  * With `view="day"`, one column per resource (a practitioner, a room) instead of the time grid
395
403
  * (HAR-983). Their stretches of the day come from `resourceSpans`; a time no span covers is
@@ -432,6 +440,6 @@ interface SchedulingCalendarProps {
432
440
  * Month/week/day/agenda calendar for UTC ranges rendered in an explicit IANA time zone. With
433
441
  * `resources`, the day view is one column per resource (HAR-983).
434
442
  */
435
- declare function SchedulingCalendar({ entries, anchorDate, timeZone, view: controlledView, onViewChange, onAnchorDateChange, onSelectEntry, overlays, onSelectOverlay, filter, renderEntry, locale, weekStartsOn, formatDate, formatInstant: formatInstantProp, maxEntriesPerDay, onShowMore, renderDayBadge, days: dayInfo, dayEntries, spanLayout, windowLaneCap, spanLaneCap, legend, legendCaption, showHeader, notice, emptyNote, onSelectDate, agendaGroups, agendaHeadingLevel, virtualizeAbove, monthDensity, timeGrid, now, canMove, step, onProposeMove, topLaneCrossMidnightMinutes, topLaneCap, maxLanes, resources, resourceSpans, slotMinutes, dayStart, dayEnd, onSelectSlot, selectedSlot, resourceLayout, resourceListBelow, loading, error, onRetry, className, labels: labelOverrides, }: SchedulingCalendarProps): react.JSX.Element;
443
+ declare function SchedulingCalendar({ entries, anchorDate, timeZone, view: controlledView, onViewChange, onAnchorDateChange, onSelectEntry, overlays, onSelectOverlay, filter, renderEntry, locale, weekStartsOn, formatDate, formatInstant: formatInstantProp, maxEntriesPerDay, onShowMore, renderDayBadge, days: dayInfo, dayEntries, spanLayout, windowLaneCap, spanLaneCap, legend, legendCaption, showHeader, notice, emptyNote, onSelectDate, agendaGroups, agendaHeadingLevel, virtualizeAbove, monthDensity, timeGrid, now, canMove, step, onProposeMove, topLaneCrossMidnightMinutes, topLaneCap, maxLanes, scrollToTime, resources, resourceSpans, slotMinutes, dayStart, dayEnd, onSelectSlot, selectedSlot, resourceLayout, resourceListBelow, loading, error, onRetry, className, labels: labelOverrides, }: SchedulingCalendarProps): react.JSX.Element;
436
444
 
437
445
  export { DEFAULT_SCHEDULING_CALENDAR_LABELS as D, type SchedulingAgendaGroup as S, type TimeGridEntryContext as T, type SchedulingBand as a, SchedulingCalendar as b, type SchedulingCalendarDay as c, type SchedulingCalendarEntry as d, type SchedulingCalendarLabels as e, type SchedulingCalendarOverlay as f, type SchedulingCalendarProps as g, type SchedulingCalendarView as h, type SchedulingDatePart as i, type SchedulingEntryState as j, type SchedulingLegendItem as k, type SchedulingMarker as l, type SchedulingMarkerEmphasis as m, type SchedulingOverlayKind as n, type SchedulingOverlayPattern as o, type SchedulingStatus as p, SchedulingTimeGrid as q, type SchedulingTimeGridProps as r };
@@ -71,6 +71,14 @@ interface DataWorkspaceColumn<T> {
71
71
  * tier (`uix-col--w-md`) or `uix-col--flex` also sizes the column's `<col>` in a fixed layout.
72
72
  */
73
73
  className?: string;
74
+ /**
75
+ * How the column's text behaves (HAR-3201): `nowrap` keeps one line and never cuts it (a date, an
76
+ * ID, an amount; the column's width must fit it), `truncate` keeps one line and ends in an ellipsis,
77
+ * `wrap` breaks anywhere a long word needs. Default: the table's own wrapping.
78
+ */
79
+ textWrap?: 'wrap' | 'nowrap' | 'truncate';
80
+ /** At most this many lines of each body cell, then an ellipsis (HAR-3201), e.g. `2` for a description. */
81
+ lineClamp?: number;
74
82
  /**
75
83
  * The responsive ladder (`mobile`, HAR-2622): `low` columns go below 900 px of workspace width,
76
84
  * `mid` ones below 600 px; `high` (the default) stay.
@@ -430,14 +430,23 @@ const columnFloor = (width, minWidth, className) => {
430
430
  if (width && !width.trim().endsWith("%")) return width;
431
431
  const classes = className?.split(/\s+/) ?? [];
432
432
  for (const cls of classes) {
433
- const tier = /^uix-col--w-(xs|sm|md|lg|xl)$/.exec(cls)?.[1];
433
+ const tier = /^uix-col--w-(xs|sm|md|lg|lg-plus|xl)$/.exec(cls)?.[1];
434
434
  if (tier) return `var(--uix-col-w-${tier})`;
435
435
  }
436
436
  if (classes.includes("uix-col--flex") || classes.includes("uix-col--primary")) return "var(--uix-col-title-min)";
437
437
  return "var(--uix-col-w-sm)";
438
438
  };
439
439
  const isFlex = (className) => /(^|\s)uix-col--(flex|primary)(\s|$)/.test(className ?? "");
440
- const colClasses = (className) => className?.split(/\s+/).filter((cls) => /^uix-col--(w-(xs|sm|md|lg|xl)|flex|primary)$/.test(cls)).join(" ") || void 0;
440
+ const colClasses = (className) => className?.split(/\s+/).filter((cls) => /^uix-col--(w-(xs|sm|md|lg|lg-plus|xl)|flex|primary)$/.test(cls)).join(" ") || void 0;
441
+ const cellClasses = (column) => cx(column.align === "end" && "uix-col--num", column.className, column.textWrap && `uix-col--${column.textWrap}`) || void 0;
442
+ const clampLines = (lineClamp) => {
443
+ const lines = Math.floor(lineClamp ?? 0);
444
+ return Number.isFinite(lines) && lines >= 1 ? lines : null;
445
+ };
446
+ const cellContent = (column, row) => {
447
+ const lines = clampLines(column.lineClamp);
448
+ return lines != null ? /* @__PURE__ */ jsx("span", { className: "uix-cell-clamp", style: { "--uix-clamp": String(lines) }, children: column.cell(row) }) : column.cell(row);
449
+ };
441
450
  function WorkspaceTable({
442
451
  label,
443
452
  rows,
@@ -975,7 +984,7 @@ function WorkspaceTable({
975
984
  Th,
976
985
  {
977
986
  scope: "col",
978
- className: cx(column.align === "end" && "uix-col--num", column.className) || void 0,
987
+ className: cellClasses(column),
979
988
  style,
980
989
  ...sortProps(column, column.sortable === true),
981
990
  ...ladderAttrs(ladderOn, column, false),
@@ -1068,7 +1077,7 @@ function WorkspaceRowInner({
1068
1077
  }
1069
1078
  ) }),
1070
1079
  idColumn && /* @__PURE__ */ jsx(Td, { className: "uix-id-cell", "data-col": ladderOn ? "id" : void 0, children: /* @__PURE__ */ jsx(IdCell, { row, text, idColumn, openLabel }) }),
1071
- columns.map((column) => /* @__PURE__ */ jsx(Td, { className: cx(column.align === "end" && "uix-col--num", column.className) || void 0, ...ladderAttrs(ladderOn, column, true), children: column.cell(row) }, column.id)),
1080
+ columns.map((column) => /* @__PURE__ */ jsx(Td, { className: cellClasses(column), ...ladderAttrs(ladderOn, column, true), children: cellContent(column, row) }, column.id)),
1072
1081
  hasActions && /* @__PURE__ */ jsx(RowActions, { "data-col": ladderOn ? "actions" : void 0, children: renderedActions })
1073
1082
  ]
1074
1083
  }
@@ -0,0 +1,33 @@
1
+ import * as react from 'react';
2
+ import { HTMLAttributes, ReactNode } from 'react';
3
+
4
+ type DateTimePrecision = 'date' | 'minute';
5
+ interface Formatting {
6
+ locale?: string | readonly string[];
7
+ timeZone?: string;
8
+ /** `date`: the day only. `minute` (default): the day and the time. A `YYYY-MM-DD` value is always a day. */
9
+ precision?: DateTimePrecision;
10
+ }
11
+ interface DateTimeProps extends Omit<HTMLAttributes<HTMLTimeElement>, 'children' | 'dateTime'>, Formatting {
12
+ value: Date | number | string;
13
+ /** Shown when `value` is not a date. Default `—`. */
14
+ invalidLabel?: ReactNode;
15
+ }
16
+ /** An absolute date, or date and time, that never breaks inside itself (`<time class="uix-time">`). */
17
+ declare function DateTime({ value, precision, locale, timeZone, invalidLabel, className, ...props }: DateTimeProps): react.JSX.Element;
18
+ interface DateTimeRangeProps extends Omit<HTMLAttributes<HTMLSpanElement>, 'children'>, Formatting {
19
+ start: Date | number | string;
20
+ end: Date | number | string;
21
+ /** Shown for an instant that is not a date. Default `—`. */
22
+ invalidLabel?: ReactNode;
23
+ }
24
+ /**
25
+ * A range, "11.11.2026 09:00 – 12:00" (`.uix-time-range`). A range within one day shows its date
26
+ * once. Each end never breaks inside itself; the range breaks only after the dash, unless its cell
27
+ * keeps it on one line (`.uix-col--nowrap`, `textWrap: 'nowrap'`). The ends print as given: the
28
+ * component does not reorder a reversed range, and `end` is inclusive (an all-day range that ends
29
+ * at the next midnight shows two days). Across a clock change an hour can repeat ("02:30 – 02:30").
30
+ */
31
+ declare function DateTimeRange({ start, end, precision, locale, timeZone, invalidLabel, className, ...props }: DateTimeRangeProps): react.JSX.Element;
32
+
33
+ export { DateTime, type DateTimePrecision, type DateTimeProps, DateTimeRange, type DateTimeRangeProps };
@@ -0,0 +1,53 @@
1
+ "use client";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import { cx } from "../cx.js";
4
+ import { useUixLabels } from "../labels-context.js";
5
+ import { parseDateValue } from "../relative-time-model.js";
6
+ const NBSP = String.fromCharCode(160);
7
+ const CALENDAR_DAY = /^\d{4}-\d{2}-\d{2}$/;
8
+ const instantOf = (value, timeZone) => {
9
+ const dayOnly = typeof value === "string" && CALENDAR_DAY.test(value);
10
+ const date = parseDateValue(value);
11
+ return date ? { date, zone: dayOnly ? "UTC" : timeZone, dayOnly } : null;
12
+ };
13
+ function isoDay(date, timeZone) {
14
+ const parts = new Intl.DateTimeFormat("en-CA", { year: "numeric", month: "2-digit", day: "2-digit", timeZone }).formatToParts(date);
15
+ const part = (type) => parts.find((p) => p.type === type)?.value ?? "";
16
+ return `${part("year").padStart(4, "0")}-${part("month")}-${part("day")}`;
17
+ }
18
+ function useFormat({ locale }) {
19
+ const { dateFormat } = useUixLabels();
20
+ const resolvedLocale = locale ?? dateFormat?.locale;
21
+ const formatDate = locale == null ? dateFormat?.formatDate : void 0;
22
+ const day = ({ date, zone }) => formatDate ? formatDate(isoDay(date, zone)) : new Intl.DateTimeFormat(resolvedLocale, { year: "numeric", month: "2-digit", day: "2-digit", timeZone: zone }).format(date);
23
+ const time = ({ date, zone }) => new Intl.DateTimeFormat(resolvedLocale, { hour: "2-digit", minute: "2-digit", timeZone: zone }).format(date);
24
+ return { day, time };
25
+ }
26
+ const showsDayOnly = (precision, at) => precision === "date" || at.dayOnly;
27
+ const machineValue = (precision, at) => showsDayOnly(precision, at) ? isoDay(at.date, at.zone) : at.date.toISOString();
28
+ function DateTime({ value, precision = "minute", locale, timeZone, invalidLabel = "\u2014", className, ...props }) {
29
+ const format = useFormat({ locale });
30
+ const at = instantOf(value, timeZone);
31
+ if (!at) return /* @__PURE__ */ jsx("time", { className: cx("uix-time", className), "data-invalid": "true", suppressHydrationWarning: true, ...props, children: invalidLabel });
32
+ const text = showsDayOnly(precision, at) ? format.day(at) : `${format.day(at)} ${format.time(at)}`;
33
+ return /* @__PURE__ */ jsx("time", { className: cx("uix-time", className), dateTime: machineValue(precision, at), suppressHydrationWarning: true, ...props, children: text });
34
+ }
35
+ function DateTimeRange({ start, end, precision = "minute", locale, timeZone, invalidLabel = "\u2014", className, ...props }) {
36
+ const format = useFormat({ locale });
37
+ const from = instantOf(start, timeZone);
38
+ const to = instantOf(end, timeZone);
39
+ const full = (at) => showsDayOnly(precision, at) ? format.day(at) : `${format.day(at)} ${format.time(at)}`;
40
+ const instant = (at, text) => at ? /* @__PURE__ */ jsx("time", { className: "uix-time", dateTime: machineValue(precision, at), suppressHydrationWarning: true, children: text(at) }) : /* @__PURE__ */ jsx("time", { className: "uix-time", "data-invalid": "true", children: invalidLabel });
41
+ const sameDay = from != null && to != null && isoDay(from.date, from.zone) === isoDay(to.date, to.zone);
42
+ const dayOnly = from != null && to != null && showsDayOnly(precision, from) && showsDayOnly(precision, to);
43
+ if (sameDay && dayOnly) return /* @__PURE__ */ jsx("span", { className: cx("uix-time-range", className), ...props, children: instant(from, format.day) });
44
+ return /* @__PURE__ */ jsxs("span", { className: cx("uix-time-range", className), ...props, children: [
45
+ instant(from, full),
46
+ /* @__PURE__ */ jsx("span", { className: "uix-time-range__sep", children: `${NBSP}\u2013 ` }),
47
+ instant(to, sameDay && !showsDayOnly(precision, to) ? format.time : full)
48
+ ] });
49
+ }
50
+ export {
51
+ DateTime,
52
+ DateTimeRange
53
+ };
@@ -1,5 +1,6 @@
1
1
  import * as react from 'react';
2
2
  import { HTMLAttributes, ReactNode, ButtonHTMLAttributes } from 'react';
3
+ import { UixRenderLink } from '../link.js';
3
4
 
4
5
  interface PageIntroProps extends Omit<HTMLAttributes<HTMLElement>, 'title'> {
5
6
  /** Small line above the title (e.g. today's date). */
@@ -36,14 +37,22 @@ interface SectionHeadProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'>
36
37
  action?: ReactNode;
37
38
  /**
38
39
  * `compact` is the in-card section preset (HAR-1815): a 15 px / 1.3 / 600 title in place of
39
- * the 24 px editorial h2. Default `default`.
40
+ * the 24 px editorial h2. `eyebrow` is the small uppercase label over a group of tiles or rows
41
+ * (HAR-3097): an 11 px / 700 hushed title on a 24 px row. Default `default`.
40
42
  */
41
- size?: 'default' | 'compact';
43
+ size?: 'default' | 'compact' | 'eyebrow';
42
44
  /** Heading level of the title. Default `h2`; an in-card section is often an `h3`. */
43
45
  as?: 'h2' | 'h3';
46
+ /**
47
+ * The page the section stands for (HAR-3097). The title becomes its link
48
+ * (`.uix-section-title__link`), a 24 px target on its own row; the heading stays the heading.
49
+ */
50
+ href?: string;
51
+ /** The consumer's router link for `href` (the same `UixRenderLink` adapter as `CardLink`). Default: `<a>`. */
52
+ renderLink?: UixRenderLink;
44
53
  }
45
54
  /** Section head — title row (+ optional `help` ?) with an optional trailing action (`.uix-section-head`). */
46
- declare function SectionHead({ title, titleId, help, helpLabel, action, size, as: Heading, className, ...props }: SectionHeadProps): react.JSX.Element;
55
+ declare function SectionHead({ title, titleId, help, helpLabel, action, size, as: Heading, href, renderLink, className, ...props }: SectionHeadProps): react.JSX.Element;
47
56
  interface NoticeQueueProps extends Omit<HTMLAttributes<HTMLElement>, 'title'> {
48
57
  /** Leading icon slot. */
49
58
  icon?: ReactNode;
@@ -146,11 +155,19 @@ declare function ContentList({ children, className, ...props }: ContentListProps
146
155
  interface ContentListItemProps extends Omit<HTMLAttributes<HTMLLIElement>, 'title'> {
147
156
  title: ReactNode;
148
157
  meta?: ReactNode;
149
- /** Trailing slot — an arrow glyph, a pill. */
158
+ /** Trailing slot — an arrow glyph, a pill. A linked row (`href`) shows an arrow when this is unset. */
150
159
  trailing?: ReactNode;
160
+ /**
161
+ * Makes the whole row one link (HAR-3070): the title renders as the anchor, its hit area
162
+ * covers the row, and the row shows an arrow at rest plus hover and focus states. Pass a
163
+ * plain-text `title` with it, not a link of your own.
164
+ */
165
+ href?: string;
166
+ /** Renders the row's link with your router, as on `Breadcrumbs`. Default: `<a>`. */
167
+ renderLink?: UixRenderLink;
151
168
  }
152
- /** One content-list row — title + meta with an optional trailing slot. */
153
- declare function ContentListItem({ title, meta, trailing, className, ...props }: ContentListItemProps): react.JSX.Element;
169
+ /** One content-list row — title + meta with an optional trailing slot; with `href`, one link. */
170
+ declare function ContentListItem({ title, meta, trailing, href, renderLink, className, ...props }: ContentListItemProps): react.JSX.Element;
154
171
  interface ResourceGridProps extends HTMLAttributes<HTMLDivElement> {
155
172
  /** Resource buttons/links (typically `.uix-btn--outline`). */
156
173
  children?: ReactNode;
@@ -1,5 +1,7 @@
1
1
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
2
  import { cx } from "../cx.js";
3
+ import { renderUixLink } from "../link.js";
4
+ import { ChevronRightIcon } from "../icons/components.js";
3
5
  import { InfoTip } from "./InfoTip.js";
4
6
  import { hasHelp, helpLabelFor } from "../info-tip-model.js";
5
7
  function PageIntro({
@@ -28,9 +30,10 @@ function PageIntro({
28
30
  children
29
31
  ] });
30
32
  }
31
- function SectionHead({ title, titleId, help, helpLabel, action, size = "default", as: Heading = "h2", className, ...props }) {
32
- const heading = /* @__PURE__ */ jsx(Heading, { className: "uix-section-title", id: titleId, children: title });
33
- return /* @__PURE__ */ jsxs("div", { className: cx("uix-section-head", size === "compact" && "uix-section-head--compact", className), ...props, children: [
33
+ function SectionHead({ title, titleId, help, helpLabel, action, size = "default", as: Heading = "h2", href, renderLink, className, ...props }) {
34
+ const label = href !== void 0 ? renderUixLink(renderLink, { href, className: "uix-section-title__link", children: title }) : title;
35
+ const heading = /* @__PURE__ */ jsx(Heading, { className: "uix-section-title", id: titleId, children: label });
36
+ return /* @__PURE__ */ jsxs("div", { className: cx("uix-section-head", size === "compact" && "uix-section-head--compact", size === "eyebrow" && "uix-section-head--eyebrow", className), ...props, children: [
34
37
  hasHelp(help) ? /* @__PURE__ */ jsxs("div", { className: "uix-section-head__title-row", children: [
35
38
  heading,
36
39
  /* @__PURE__ */ jsx(InfoTip, { content: help, label: helpLabel ?? helpLabelFor(title) })
@@ -132,13 +135,14 @@ function NewsLead({ meta, title, summary, className, ...props }) {
132
135
  function ContentList({ children, className, ...props }) {
133
136
  return /* @__PURE__ */ jsx("ul", { className: cx("uix-content-list", className), ...props, children });
134
137
  }
135
- function ContentListItem({ title, meta, trailing, className, ...props }) {
136
- return /* @__PURE__ */ jsxs("li", { className: cx("uix-content-list__item", className), ...props, children: [
138
+ function ContentListItem({ title, meta, trailing, href, renderLink, className, ...props }) {
139
+ const linked = href !== void 0;
140
+ return /* @__PURE__ */ jsxs("li", { className: cx("uix-content-list__item", linked && "uix-content-list__item--link", className), ...props, children: [
137
141
  /* @__PURE__ */ jsxs("div", { children: [
138
- /* @__PURE__ */ jsx("p", { className: "uix-content-list__title", children: title }),
142
+ /* @__PURE__ */ jsx("p", { className: "uix-content-list__title", children: linked ? renderUixLink(renderLink, { href, className: "uix-content-list__link", children: title }) : title }),
139
143
  meta != null && /* @__PURE__ */ jsx("p", { className: "uix-content-list__meta", children: meta })
140
144
  ] }),
141
- trailing
145
+ trailing ?? (linked ? /* @__PURE__ */ jsx("span", { className: "uix-content-list__go", "aria-hidden": "true", children: /* @__PURE__ */ jsx(ChevronRightIcon, {}) }) : null)
142
146
  ] });
143
147
  }
144
148
  function ResourceGrid({ children, className, ...props }) {
@@ -0,0 +1,32 @@
1
+ import * as react from 'react';
2
+ import { HTMLAttributes, ReactNode } from 'react';
3
+
4
+ interface ListSummaryProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children'> {
5
+ /** The names, in the order to show them. */
6
+ items: ReadonlyArray<string>;
7
+ /** How many names show while the list is collapsed. Default 3. */
8
+ max?: number;
9
+ /** An optional first line that counts the whole list, e.g. `(n) => \`${n} roles\``. */
10
+ count?: (total: number) => ReactNode;
11
+ /** The words for the names not shown, e.g. `(n) => \`und ${n} weitere\``. Default `and N more`. */
12
+ more?: (hidden: number) => string;
13
+ /** The toggle while collapsed. Translatable; default `Show all`. */
14
+ expandLabel?: string;
15
+ /** The toggle while expanded. Translatable; default `Show less`. */
16
+ collapseLabel?: string;
17
+ /** Shown instead of the list when `items` is empty. */
18
+ empty?: ReactNode;
19
+ /** Joins the names. Default `, `. */
20
+ separator?: string;
21
+ /** Start with the whole list shown. */
22
+ defaultExpanded?: boolean;
23
+ }
24
+ /**
25
+ * A long list of names (roles, teams, recipients) read as a count, the first few names and the
26
+ * words for the rest, with a button that shows the whole list in place and hides it again
27
+ * (HAR-3069). A list only one name longer than `max` is shown whole: hiding a single name saves
28
+ * no space. Every word is a prop; the defaults are English.
29
+ */
30
+ declare function ListSummary({ items, max, count, more, expandLabel, collapseLabel, empty, separator, defaultExpanded, className, ...props }: ListSummaryProps): react.JSX.Element;
31
+
32
+ export { ListSummary, type ListSummaryProps };
@@ -0,0 +1,49 @@
1
+ "use client";
2
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
+ import { useId, useState } from "react";
4
+ import { cx } from "../cx.js";
5
+ function ListSummary({
6
+ items,
7
+ max = 3,
8
+ count,
9
+ more = (hidden) => `and ${hidden} more`,
10
+ expandLabel = "Show all",
11
+ collapseLabel = "Show less",
12
+ empty,
13
+ separator = ", ",
14
+ defaultExpanded = false,
15
+ className,
16
+ ...props
17
+ }) {
18
+ const [expanded, setExpanded] = useState(defaultExpanded);
19
+ const listId = useId();
20
+ const limit = Math.max(1, Math.floor(max));
21
+ const collapsible = items.length > limit + 1;
22
+ const shown = collapsible && !expanded ? items.slice(0, limit) : items;
23
+ return /* @__PURE__ */ jsx("div", { className: cx("uix-list-summary", className), ...props, children: items.length === 0 ? /* @__PURE__ */ jsx("p", { className: "uix-list-summary__items", children: empty }) : /* @__PURE__ */ jsxs(Fragment, { children: [
24
+ count ? /* @__PURE__ */ jsx("p", { className: "uix-list-summary__count", children: count(items.length) }) : null,
25
+ /* @__PURE__ */ jsxs("p", { className: "uix-list-summary__items", children: [
26
+ /* @__PURE__ */ jsxs("span", { id: listId, children: [
27
+ shown.join(separator),
28
+ collapsible && !expanded ? ` ${more(items.length - limit)}` : null
29
+ ] }),
30
+ collapsible ? /* @__PURE__ */ jsxs(Fragment, { children: [
31
+ " ",
32
+ /* @__PURE__ */ jsx(
33
+ "button",
34
+ {
35
+ type: "button",
36
+ className: "uix-list-summary__toggle",
37
+ "aria-expanded": expanded,
38
+ "aria-controls": listId,
39
+ onClick: () => setExpanded((open) => !open),
40
+ children: expanded ? collapseLabel : expandLabel
41
+ }
42
+ )
43
+ ] }) : null
44
+ ] })
45
+ ] }) });
46
+ }
47
+ export {
48
+ ListSummary
49
+ };
@@ -0,0 +1,34 @@
1
+ import * as react from 'react';
2
+ import { HTMLAttributes, ReactNode } from 'react';
3
+
4
+ interface OverflowRowProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children'> {
5
+ /** The items, in order: each child is one item (a pill, a chip, a short label). */
6
+ children?: ReactNode;
7
+ /** The counter's text; `{count}` is the number of hidden items. Default "+{count}". */
8
+ more?: string;
9
+ /**
10
+ * What a screen reader hears for the counter. `{count}` is the number of hidden items and
11
+ * `{items}` their text, comma-separated. Default "{count} more: {items}". The counter's
12
+ * `title` lists the same items for a pointer.
13
+ */
14
+ moreLabel?: string;
15
+ }
16
+ /**
17
+ * How many items an `OverflowRow` shows (pure, so it can be tested without layout): all of
18
+ * them when they fit side by side, otherwise the most that fit whole together with the counter
19
+ * for the rest, and never fewer than one. `counterWidth(hidden)` is the counter's width when it
20
+ * stands for `hidden` items.
21
+ */
22
+ declare function overflowRowFit(widths: readonly number[], available: number, gap: number, counterWidth: (hidden: number) => number): number;
23
+ /**
24
+ * One line of items that never wraps (HAR-3072): it shows, in order, the items that fit whole
25
+ * and replaces the rest with one counter ("+3"), so a table row keeps one height and no badge is
26
+ * cut mid-word. The first item always shows; when it alone is wider than the row it is clipped at
27
+ * the row's edge (give it its own truncating text for an ellipsis). Re-measures when it is
28
+ * resized and on every render; before it can measure (server render, no ResizeObserver) every
29
+ * item shows and the row clips. The hidden items stay in the DOM for measuring but out of the
30
+ * layout and the accessibility tree; the counter's label names them, so each is heard once.
31
+ */
32
+ declare function OverflowRow({ children, more, moreLabel, className, ...props }: OverflowRowProps): react.JSX.Element;
33
+
34
+ export { OverflowRow, type OverflowRowProps, overflowRowFit };
@@ -0,0 +1,77 @@
1
+ "use client";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import { Children, isValidElement, useEffect, useLayoutEffect, useRef, useState } from "react";
4
+ import { cx } from "../cx.js";
5
+ function overflowRowFit(widths, available, gap, counterWidth) {
6
+ const n = widths.length;
7
+ if (n === 0) return 0;
8
+ const total = widths.reduce((sum, w, i) => sum + w + (i > 0 ? gap : 0), 0);
9
+ if (total <= available) return n;
10
+ let best = 1;
11
+ let used = 0;
12
+ for (let k = 1; k < n; k += 1) {
13
+ used += (widths[k - 1] ?? 0) + (k > 1 ? gap : 0);
14
+ if (used + gap + counterWidth(n - k) <= available) best = k;
15
+ }
16
+ return best;
17
+ }
18
+ const fill = (template, count, items) => template.replace("{count}", String(count)).replace("{items}", items);
19
+ function OverflowRow({
20
+ children,
21
+ more = "+{count}",
22
+ moreLabel = "{count} more: {items}",
23
+ className,
24
+ ...props
25
+ }) {
26
+ const items = Children.toArray(children);
27
+ const ref = useRef(null);
28
+ const [shown, setShown] = useState(items.length);
29
+ const [hidden, setHidden] = useState([]);
30
+ const measure = useRef(() => void 0);
31
+ measure.current = () => {
32
+ const row = ref.current;
33
+ if (!row) return;
34
+ const nodes = Array.from(row.children).filter((el) => el.classList.contains("uix-overflow-row__item"));
35
+ const probe = row.querySelector(".uix-overflow-row__probe");
36
+ const widths = nodes.map((el) => Math.max(el.scrollWidth, el.getBoundingClientRect().width));
37
+ const gap = Number.parseFloat(getComputedStyle(row).columnGap) || 0;
38
+ const counter = probe ? probe.getBoundingClientRect().width : 0;
39
+ const next = overflowRowFit(widths, row.clientWidth, gap, () => counter);
40
+ const text = nodes.slice(next).map((el) => (el.textContent ?? "").trim()).filter(Boolean);
41
+ setShown((current) => current === next ? current : next);
42
+ setHidden((current) => current.join("\0") === text.join("\0") ? current : text);
43
+ };
44
+ useLayoutEffect(() => {
45
+ if (typeof ResizeObserver !== "undefined") measure.current();
46
+ });
47
+ useEffect(() => {
48
+ const row = ref.current;
49
+ if (!row || typeof ResizeObserver === "undefined") return void 0;
50
+ const observer = new ResizeObserver(() => measure.current());
51
+ observer.observe(row);
52
+ return () => observer.disconnect();
53
+ }, []);
54
+ const visible = Math.min(shown, items.length);
55
+ const hiddenCount = items.length - visible;
56
+ const names = hidden.join(", ");
57
+ return /* @__PURE__ */ jsxs("div", { ref, className: cx("uix-overflow-row", className), ...props, children: [
58
+ items.map((child, i) => /* @__PURE__ */ jsx(
59
+ "span",
60
+ {
61
+ className: "uix-overflow-row__item",
62
+ ...i >= visible ? { "data-overflow-hidden": "", "aria-hidden": true } : {},
63
+ children: child
64
+ },
65
+ isValidElement(child) && child.key != null ? child.key : i
66
+ )),
67
+ hiddenCount > 0 && /* @__PURE__ */ jsxs("span", { className: "uix-overflow-row__more", title: names || void 0, children: [
68
+ /* @__PURE__ */ jsx("span", { "aria-hidden": "true", children: fill(more, hiddenCount, names) }),
69
+ /* @__PURE__ */ jsx("span", { className: "uix-visually-hidden", children: fill(moreLabel, hiddenCount, names) })
70
+ ] }),
71
+ /* @__PURE__ */ jsx("span", { className: "uix-overflow-row__probe", "aria-hidden": "true", children: fill(more, items.length, "") })
72
+ ] });
73
+ }
74
+ export {
75
+ OverflowRow,
76
+ overflowRowFit
77
+ };
@@ -17,7 +17,10 @@ interface RelativeTimeProps extends Omit<HTMLAttributes<HTMLTimeElement>, 'child
17
17
  refreshInterval?: number | false;
18
18
  formatter?: (context: RelativeTimeFormatContext) => ReactNode;
19
19
  }
20
- /** Locale-aware relative time with deterministic `now` support for SSR and tests. */
21
- declare function RelativeTime({ value, now, locale, timeZone, numeric, invalidLabel, refreshInterval, formatter, title, ...props }: RelativeTimeProps): react.JSX.Element;
20
+ /**
21
+ * Locale-aware relative time with deterministic `now` support for SSR and tests. It carries `.uix-time`
22
+ * (HAR-3094): it never breaks inside itself ("vor 3 Minuten" is one unit) and its digits are tabular.
23
+ */
24
+ declare function RelativeTime({ value, now, locale, timeZone, numeric, invalidLabel, refreshInterval, formatter, title, className, ...props }: RelativeTimeProps): react.JSX.Element;
22
25
 
23
26
  export { RelativeTime, type RelativeTimeFormatContext, type RelativeTimeProps };