@tensor_1/react 2.62.0 → 2.64.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 (44) hide show
  1. package/README.md +30 -1
  2. package/component-inventory.json +16 -0
  3. package/dist/{SchedulingCalendar-WWyFL3Eo.d.ts → SchedulingCalendar-CHOIb5cT.d.ts} +10 -2
  4. package/dist/components/Card.d.ts +1 -1
  5. package/dist/components/Card.js +2 -2
  6. package/dist/components/DataWorkspace.d.ts +8 -0
  7. package/dist/components/DataWorkspace.js +13 -4
  8. package/dist/components/DateTime.d.ts +33 -0
  9. package/dist/components/DateTime.js +53 -0
  10. package/dist/components/EditorialHome.d.ts +24 -7
  11. package/dist/components/EditorialHome.js +13 -9
  12. package/dist/components/Field.d.ts +18 -3
  13. package/dist/components/Field.js +6 -6
  14. package/dist/components/InfoTip.d.ts +9 -3
  15. package/dist/components/InfoTip.js +6 -2
  16. package/dist/components/Markdown.d.ts +12 -2
  17. package/dist/components/Markdown.js +3 -2
  18. package/dist/components/NumberInput.d.ts +28 -0
  19. package/dist/components/NumberInput.js +27 -0
  20. package/dist/components/OverflowRow.d.ts +34 -0
  21. package/dist/components/OverflowRow.js +77 -0
  22. package/dist/components/PageHeader.d.ts +1 -1
  23. package/dist/components/PageHeader.js +2 -2
  24. package/dist/components/RelativeTime.d.ts +5 -2
  25. package/dist/components/RelativeTime.js +4 -2
  26. package/dist/components/SchedulingAgenda.d.ts +1 -1
  27. package/dist/components/SchedulingCalendar.d.ts +1 -1
  28. package/dist/components/SchedulingCalendar.js +2 -0
  29. package/dist/components/SchedulingTimeGrid.d.ts +1 -1
  30. package/dist/components/SchedulingTimeGrid.js +164 -105
  31. package/dist/components/SchedulingTimeline.d.ts +1 -1
  32. package/dist/components/Timeline.d.ts +14 -2
  33. package/dist/components/Timeline.js +6 -1
  34. package/dist/index.cjs +3635 -3395
  35. package/dist/index.d.cts +180 -20
  36. package/dist/index.d.ts +4 -1
  37. package/dist/index.js +8 -0
  38. package/dist/info-tip-model.d.ts +12 -1
  39. package/dist/info-tip-model.js +10 -2
  40. package/dist/labels-context.d.ts +11 -1
  41. package/dist/markdown.cjs +3 -2
  42. package/dist/markdown.d.cts +12 -2
  43. package/dist/rich-text.cjs +3 -2
  44. package/package.json +1 -1
package/README.md CHANGED
@@ -439,7 +439,7 @@ A small ? next to a title or label opens a plain-text explanation. Use it for wh
439
439
  ```
440
440
 
441
441
  - **`help?: string | null`** on `PageHeader`, `Card`, `SectionHead` and `Field`. Empty, whitespace-only or `null` renders nothing, so pass the resolved string without a guard. Blank lines become paragraphs. The text is always plain, never HTML.
442
- - **`helpLabel`** is the ? button's accessible name. It defaults to `"About: <title>"` (English), so pass a translated one.
442
+ - **`helpLabel`** is the ? button's accessible name. Without it the name comes from `UixLabelsProvider` `infoTip`: `about` (`"About: {title}"`, `{title}` replaced by a text title) and `more` (`"More information"`, for any other title), English without a provider. Set the template once, `<UixLabelsProvider labels={{ infoTip: { about: t('help.about') } }}>`, rather than a `helpLabel` on every ? (HAR-3100).
443
443
  - **Placement:** the ? is a fixed 9 px glyph, superscript at the top right of the title or label, whatever the text size. It sits beside the heading or `<label>`, never inside it, so the heading's name stays the title and clicking a field label still focuses the input.
444
444
  - **Behaviour:** hover opens it after about 300 ms, keyboard focus opens it at once, and a click or tap keeps it open. Esc closes it and keeps focus on the ?, and a press outside also closes it. The panel is the button's `aria-describedby`, so screen readers announce it on focus. It uses `popover="manual"`, so it never closes another open popover.
445
445
 
@@ -1061,6 +1061,21 @@ The layout grid for dashboard widgets (HAR-1555; TENSOR's role dashboards). Pure
1061
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)`.
1062
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.
1063
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
+
1064
1079
  ### OrgChart
1065
1080
 
1066
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.
@@ -1779,6 +1794,20 @@ like an icon (a Kbd legend, a diff sign) goes in `glyph-icons.allow.json` with a
1779
1794
  regular tabular h3 values.
1780
1795
  - `SectionHead size="compact"` (15 px / 1.3 / 600) and `as="h3"`; `CellSub tabular`.
1781
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
+
1782
1811
  #### Sidebar actions and search, AccountMenu, the rail hotkey and the phone nav tier (HAR-1371)
1783
1812
 
1784
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": "."
@@ -529,6 +537,10 @@
529
537
  "name": "NoticeQueue",
530
538
  "subpath": "."
531
539
  },
540
+ {
541
+ "name": "NumberInput",
542
+ "subpath": "."
543
+ },
532
544
  {
533
545
  "name": "OrgChart",
534
546
  "subpath": "."
@@ -537,6 +549,10 @@
537
549
  "name": "OtpInput",
538
550
  "subpath": "."
539
551
  },
552
+ {
553
+ "name": "OverflowRow",
554
+ "subpath": "."
555
+ },
540
556
  {
541
557
  "name": "PageHeader",
542
558
  "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 };
@@ -18,7 +18,7 @@ interface CardProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {
18
18
  * empty, whitespace-only or `null` renders no button.
19
19
  */
20
20
  help?: string | null;
21
- /** Accessible name of the ? button. Default `"About: <title>"` when title is text; pass a localised one. */
21
+ /** Accessible name of the ? button. Default: the `UixLabelsProvider` `infoTip` template with the title (`"About: <title>"` without a provider). */
22
22
  helpLabel?: string;
23
23
  headerAction?: ReactNode;
24
24
  footer?: ReactNode;
@@ -2,7 +2,7 @@ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
2
  import { cx } from "../cx.js";
3
3
  import { renderUixLink } from "../link.js";
4
4
  import { InfoTip } from "./InfoTip.js";
5
- import { hasHelp, helpLabelFor } from "../info-tip-model.js";
5
+ import { hasHelp, helpTopic } from "../info-tip-model.js";
6
6
  function Card({ title, titleAs: TitleTag = "div", titleId, subtitle, help, helpLabel, headerAction, footer, children, className, ...props }) {
7
7
  const hasHeader = title != null || subtitle != null || headerAction != null;
8
8
  const heading = title ? /* @__PURE__ */ jsx(TitleTag, { className: "uix-card__title", id: titleId, children: title }) : null;
@@ -11,7 +11,7 @@ function Card({ title, titleAs: TitleTag = "div", titleId, subtitle, help, helpL
11
11
  /* @__PURE__ */ jsxs("div", { style: { flex: 1 }, children: [
12
12
  heading && hasHelp(help) ? /* @__PURE__ */ jsxs("div", { className: "uix-card__title-row", children: [
13
13
  heading,
14
- /* @__PURE__ */ jsx(InfoTip, { content: help, label: helpLabel ?? helpLabelFor(title) })
14
+ /* @__PURE__ */ jsx(InfoTip, { content: help, label: helpLabel, topic: helpTopic(title) })
15
15
  ] }) : heading,
16
16
  subtitle && /* @__PURE__ */ jsx("div", { className: "uix-card__subtitle", children: subtitle })
17
17
  ] }),
@@ -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). */
@@ -30,20 +31,28 @@ interface SectionHeadProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'>
30
31
  * empty, whitespace-only or `null` renders no button.
31
32
  */
32
33
  help?: string | null;
33
- /** Accessible name of the ? button. Default `"About: <title>"` when title is text; pass a localised one. */
34
+ /** Accessible name of the ? button. Default: the `UixLabelsProvider` `infoTip` template with the title (`"About: <title>"` without a provider). */
34
35
  helpLabel?: string;
35
36
  /** Right-aligned slot — a `.uix-section-link` anchor, a button, a pill. */
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,7 +1,9 @@
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
- import { hasHelp, helpLabelFor } from "../info-tip-model.js";
6
+ import { hasHelp, helpTopic } from "../info-tip-model.js";
5
7
  function PageIntro({
6
8
  kicker,
7
9
  title,
@@ -28,12 +30,13 @@ 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
- /* @__PURE__ */ jsx(InfoTip, { content: help, label: helpLabel ?? helpLabelFor(title) })
39
+ /* @__PURE__ */ jsx(InfoTip, { content: help, label: helpLabel, topic: helpTopic(title) })
37
40
  ] }) : heading,
38
41
  action
39
42
  ] });
@@ -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 }) {
@@ -4,7 +4,8 @@ import { ReactNode } from 'react';
4
4
  interface FieldProps {
5
5
  label?: string;
6
6
  hint?: string;
7
- error?: string;
7
+ /** The error under the control, announced at once (`role="alert"`). Text, or a node such as a sentence with a link. */
8
+ error?: ReactNode;
8
9
  /**
9
10
  * A value to check, not an error (HAR-1814): shown under the control in the warning colour,
10
11
  * announced politely, and marks the control `data-warning`. `error` wins over it; it wins
@@ -19,13 +20,27 @@ interface FieldProps {
19
20
  * Keep format or validation instructions in `hint`, where they stay visible.
20
21
  */
21
22
  help?: string | null;
22
- /** Accessible name of the ? button. Default `"About: <label>"`; pass a localised one. */
23
+ /**
24
+ * Accessible name of the ? button. Default: the `UixLabelsProvider` `infoTip.about` template
25
+ * with the label (`"About: <label>"` without a provider).
26
+ */
23
27
  helpLabel?: string;
28
+ /**
29
+ * The label element's id (HAR-3100), so a control that is not a labelable element (a rich-text
30
+ * editor, a `role="textbox"` region) can name itself with `aria-labelledby`. A native control
31
+ * needs none: the label's `htmlFor` names it.
32
+ */
33
+ labelId?: string;
34
+ /**
35
+ * The id of the message line (HAR-3100), which the control's `aria-describedby` points at. Default:
36
+ * a generated one. Pass it when a product's tests or other elements need a fixed id.
37
+ */
38
+ messageId?: string;
24
39
  children: ReactNode;
25
40
  className?: string;
26
41
  /** Explicit label target. When a Combobox also supplies `inputId`, the two IDs must match. */
27
42
  htmlFor?: string;
28
43
  }
29
- declare function Field({ label, hint, error, warning, success, required, help, helpLabel, children, className, htmlFor }: FieldProps): react.JSX.Element;
44
+ declare function Field({ label, hint, error, warning, success, required, help, helpLabel, labelId, messageId, children, className, htmlFor }: FieldProps): react.JSX.Element;
30
45
 
31
46
  export { Field, type FieldProps };
@@ -3,7 +3,7 @@ import { cloneElement, isValidElement, useId } from "react";
3
3
  import { cx } from "../cx.js";
4
4
  import { InfoTip } from "./InfoTip.js";
5
5
  import { Combobox } from "./Combobox.js";
6
- import { hasHelp, helpLabelFor } from "../info-tip-model.js";
6
+ import { hasHelp, helpTopic } from "../info-tip-model.js";
7
7
  function isComboboxElement(child) {
8
8
  let type = child.type;
9
9
  while (type !== null && typeof type === "object" && Reflect.get(type, "$$typeof") === /* @__PURE__ */ Symbol.for("react.memo")) {
@@ -11,9 +11,9 @@ function isComboboxElement(child) {
11
11
  }
12
12
  return type === Combobox;
13
13
  }
14
- function Field({ label, hint, error, warning, success, required, help, helpLabel, children, className, htmlFor }) {
14
+ function Field({ label, hint, error, warning, success, required, help, helpLabel, labelId, messageId, children, className, htmlFor }) {
15
15
  const uid = useId();
16
- const msgId = `${uid}-msg`;
16
+ const msgId = messageId ?? `${uid}-msg`;
17
17
  const describedBy = error || warning || success || hint ? msgId : void 0;
18
18
  const isCombobox = isValidElement(children) && isComboboxElement(children);
19
19
  const controlId = isValidElement(children) ? isCombobox ? children.props.inputId ?? htmlFor ?? `${uid}-ctl` : children.props.id ?? `${uid}-ctl` : void 0;
@@ -26,10 +26,10 @@ function Field({ label, hint, error, warning, success, required, help, helpLabel
26
26
  }) : children;
27
27
  return /* @__PURE__ */ jsxs("div", { className: cx("uix-field", className), children: [
28
28
  label && hasHelp(help) ? /* @__PURE__ */ jsxs("div", { className: "uix-field__label-row", children: [
29
- /* @__PURE__ */ jsx("label", { className: "uix-field__label", htmlFor: htmlFor ?? controlId, children: label }),
30
- /* @__PURE__ */ jsx(InfoTip, { content: help, label: helpLabel ?? helpLabelFor(label) }),
29
+ /* @__PURE__ */ jsx("label", { id: labelId, className: "uix-field__label", htmlFor: htmlFor ?? controlId, children: label }),
30
+ /* @__PURE__ */ jsx(InfoTip, { content: help, label: helpLabel, topic: helpTopic(label) }),
31
31
  required && /* @__PURE__ */ jsx("span", { className: "uix-field__required", "aria-hidden": "true", children: "*" })
32
- ] }) : label && /* @__PURE__ */ jsx("label", { className: "uix-field__label", htmlFor: htmlFor ?? controlId, "data-required": required || void 0, children: label }),
32
+ ] }) : label && /* @__PURE__ */ jsx("label", { id: labelId, className: "uix-field__label", htmlFor: htmlFor ?? controlId, "data-required": required || void 0, children: label }),
33
33
  control,
34
34
  /* @__PURE__ */ jsx("div", { className: "uix-field__msg", id: msgId, children: error ? /* @__PURE__ */ jsx("span", { className: "uix-field__error", role: "alert", children: error }) : warning ? /* @__PURE__ */ jsx("span", { className: "uix-field__warning", role: "status", children: warning }) : success ? /* @__PURE__ */ jsx("span", { className: "uix-field__success", role: "status", children: success }) : hint ? /* @__PURE__ */ jsx("span", { className: "uix-field__hint", children: hint }) : null })
35
35
  ] });
@@ -1,5 +1,5 @@
1
1
  import * as react from 'react';
2
- import { HTMLAttributes } from 'react';
2
+ import { HTMLAttributes, ReactNode } from 'react';
3
3
  import { Placement } from '../overlay-position.js';
4
4
 
5
5
  interface InfoTipProps extends Omit<HTMLAttributes<HTMLSpanElement>, 'content' | 'children'> {
@@ -8,8 +8,14 @@ interface InfoTipProps extends Omit<HTMLAttributes<HTMLSpanElement>, 'content' |
8
8
  * Empty or whitespace-only text renders nothing, so a missing help string needs no guard.
9
9
  */
10
10
  content: string;
11
- /** Accessible name of the ? button, e.g. "About: Incidents". The consumer localises it. */
12
- label: string;
11
+ /**
12
+ * Accessible name of the ? button, e.g. "About: Incidents". Without it the name comes from
13
+ * `topic` and the `UixLabelsProvider` `infoTip` template (HAR-3100), so an app localises every
14
+ * ? once instead of at each one.
15
+ */
16
+ label?: string;
17
+ /** What the ? explains (a title), for the provider's `infoTip.about` template when `label` is not given. */
18
+ topic?: ReactNode;
13
19
  /** Preferred panel placement. Default `'bottom-start'`. */
14
20
  placement?: Placement;
15
21
  }
@@ -2,7 +2,8 @@
2
2
  import { jsx, jsxs } from "react/jsx-runtime";
3
3
  import { useEffect, useId, useLayoutEffect, useRef, useState } from "react";
4
4
  import { cx } from "../cx.js";
5
- import { helpParagraphs } from "../info-tip-model.js";
5
+ import { helpLabelFrom, helpParagraphs } from "../info-tip-model.js";
6
+ import { useUixLabels } from "../labels-context.js";
6
7
  import { Popover } from "./Popover.js";
7
8
  const OPEN_DELAY = 300;
8
9
  const CLOSE_DELAY = 100;
@@ -22,11 +23,14 @@ function InfoTip({ content, ...props }) {
22
23
  }
23
24
  function InfoTipControl({
24
25
  paragraphs,
25
- label,
26
+ label: ownLabel,
27
+ topic,
26
28
  placement = "bottom-start",
27
29
  className,
28
30
  ...props
29
31
  }) {
32
+ const { infoTip } = useUixLabels();
33
+ const label = ownLabel?.trim() ? ownLabel : helpLabelFrom(topic, infoTip);
30
34
  const wrapRef = useRef(null);
31
35
  const buttonRef = useRef(null);
32
36
  const timer = useRef(null);
@@ -16,9 +16,19 @@ interface MarkdownProps {
16
16
  resolveImageSrc?: (src: string) => string | null;
17
17
  /**
18
18
  * Added to markdown heading levels so content headings sit below the page's own
19
- * (`#` → `<h3>` by default, as in TENSOR's original renderer). Capped at `<h6>`.
19
+ * (`#` → `<h3>` by default, as in TENSOR's original renderer; `<h2>` for `variant="document"`).
20
+ * Capped at `<h6>`.
20
21
  */
21
22
  headingOffset?: number;
23
+ /**
24
+ * `inline` (default): Markdown inside a page, a comment, a note or a description. `#` renders as
25
+ * `<h3>`, below the page's own headings.
26
+ * `document` (HAR-3096): the body of a page that is the document, such as an article whose title
27
+ * is the page `<h1>`. `#` renders as `<h2>` and `##` as `<h3>` (`.uix-prose--document`), so the
28
+ * article's own sections are at least as prominent as a `SectionHead` after the body
29
+ * ("Related articles"), and each section has room above it.
30
+ */
31
+ variant?: 'inline' | 'document';
22
32
  /**
23
33
  * The name to show for a mention (`@[Name](mention:<id>)`), e.g. the person's current
24
34
  * or masked name. Return `undefined` to show the name stored in the text. Without it
@@ -38,6 +48,6 @@ interface MarkdownProps {
38
48
  * (`@[Name](mention:<id>)`, drawn as `.uix-mention`, named by `resolveMention`).
39
49
  * Server-component safe.
40
50
  */
41
- declare function Markdown({ children, className, isSafeUrl, resolveImageSrc, headingOffset, resolveMention, }: MarkdownProps): react.JSX.Element | null;
51
+ declare function Markdown({ children, className, isSafeUrl, resolveImageSrc, variant, headingOffset, resolveMention, }: MarkdownProps): react.JSX.Element | null;
42
52
 
43
53
  export { Markdown, type MarkdownProps, defaultMarkdownIsSafeUrl };
@@ -103,14 +103,15 @@ function Markdown({
103
103
  className,
104
104
  isSafeUrl = defaultMarkdownIsSafeUrl,
105
105
  resolveImageSrc,
106
- headingOffset = 2,
106
+ variant = "inline",
107
+ headingOffset = variant === "document" ? 1 : 2,
107
108
  resolveMention
108
109
  }) {
109
110
  const source = typeof children === "string" ? children : "";
110
111
  if (source.trim() === "") return null;
111
112
  const policy = { isSafeUrl, resolveImageSrc, resolveMention };
112
113
  const blocks = parseMarkdown(source);
113
- return /* @__PURE__ */ jsx("div", { className: cx("uix-prose", "uix-markdown", className), "data-component": "markdown", children: blocks.map((block, i) => renderBlock(block, policy, headingOffset, i)) });
114
+ return /* @__PURE__ */ jsx("div", { className: cx("uix-prose", variant === "document" && "uix-prose--document", "uix-markdown", className), "data-component": "markdown", children: blocks.map((block, i) => renderBlock(block, policy, headingOffset, i)) });
114
115
  }
115
116
  export {
116
117
  Markdown,