@tensor_1/react 2.63.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.
- package/README.md +1 -1
- package/component-inventory.json +4 -0
- package/dist/components/Card.d.ts +1 -1
- package/dist/components/Card.js +2 -2
- package/dist/components/EditorialHome.d.ts +1 -1
- package/dist/components/EditorialHome.js +2 -2
- package/dist/components/Field.d.ts +18 -3
- package/dist/components/Field.js +6 -6
- package/dist/components/InfoTip.d.ts +9 -3
- package/dist/components/InfoTip.js +6 -2
- package/dist/components/Markdown.d.ts +12 -2
- package/dist/components/Markdown.js +3 -2
- package/dist/components/NumberInput.d.ts +28 -0
- package/dist/components/NumberInput.js +27 -0
- package/dist/components/PageHeader.d.ts +1 -1
- package/dist/components/PageHeader.js +2 -2
- package/dist/components/Timeline.d.ts +14 -2
- package/dist/components/Timeline.js +6 -1
- package/dist/index.cjs +3363 -3324
- package/dist/index.d.cts +78 -11
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2 -0
- package/dist/info-tip-model.d.ts +12 -1
- package/dist/info-tip-model.js +10 -2
- package/dist/labels-context.d.ts +10 -0
- package/dist/markdown.cjs +3 -2
- package/dist/markdown.d.cts +12 -2
- package/dist/rich-text.cjs +3 -2
- 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.
|
|
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
|
|
package/component-inventory.json
CHANGED
|
@@ -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>"`
|
|
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;
|
package/dist/components/Card.js
CHANGED
|
@@ -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,
|
|
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
|
|
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
|
] }),
|
|
@@ -31,7 +31,7 @@ interface SectionHeadProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'>
|
|
|
31
31
|
* empty, whitespace-only or `null` renders no button.
|
|
32
32
|
*/
|
|
33
33
|
help?: string | null;
|
|
34
|
-
/** Accessible name of the ? button. Default `"About: <title>"`
|
|
34
|
+
/** Accessible name of the ? button. Default: the `UixLabelsProvider` `infoTip` template with the title (`"About: <title>"` without a provider). */
|
|
35
35
|
helpLabel?: string;
|
|
36
36
|
/** Right-aligned slot — a `.uix-section-link` anchor, a button, a pill. */
|
|
37
37
|
action?: ReactNode;
|
|
@@ -3,7 +3,7 @@ import { cx } from "../cx.js";
|
|
|
3
3
|
import { renderUixLink } from "../link.js";
|
|
4
4
|
import { ChevronRightIcon } from "../icons/components.js";
|
|
5
5
|
import { InfoTip } from "./InfoTip.js";
|
|
6
|
-
import { hasHelp,
|
|
6
|
+
import { hasHelp, helpTopic } from "../info-tip-model.js";
|
|
7
7
|
function PageIntro({
|
|
8
8
|
kicker,
|
|
9
9
|
title,
|
|
@@ -36,7 +36,7 @@ function SectionHead({ title, titleId, help, helpLabel, action, size = "default"
|
|
|
36
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: [
|
|
37
37
|
hasHelp(help) ? /* @__PURE__ */ jsxs("div", { className: "uix-section-head__title-row", children: [
|
|
38
38
|
heading,
|
|
39
|
-
/* @__PURE__ */ jsx(InfoTip, { content: help, label: helpLabel
|
|
39
|
+
/* @__PURE__ */ jsx(InfoTip, { content: help, label: helpLabel, topic: helpTopic(title) })
|
|
40
40
|
] }) : heading,
|
|
41
41
|
action
|
|
42
42
|
] });
|
|
@@ -4,7 +4,8 @@ import { ReactNode } from 'react';
|
|
|
4
4
|
interface FieldProps {
|
|
5
5
|
label?: string;
|
|
6
6
|
hint?: string;
|
|
7
|
-
error
|
|
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
|
-
/**
|
|
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 };
|
package/dist/components/Field.js
CHANGED
|
@@ -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,
|
|
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
|
|
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
|
-
/**
|
|
12
|
-
|
|
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
|
|
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
|
-
|
|
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,
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { InputProps } from './Input.js';
|
|
3
|
+
|
|
4
|
+
interface NumberInputProps extends Omit<InputProps, 'type' | 'value' | 'defaultValue'> {
|
|
5
|
+
/**
|
|
6
|
+
* The number the field holds. `NaN`, `null` or `undefined` shows an empty field. Passing the prop
|
|
7
|
+
* at all makes the field controlled, so a form value that starts `undefined` and becomes a number
|
|
8
|
+
* never switches it; leave the prop out (or use `defaultValue`) for an uncontrolled field.
|
|
9
|
+
*/
|
|
10
|
+
value?: number | null;
|
|
11
|
+
/** The starting number of an uncontrolled field. */
|
|
12
|
+
defaultValue?: number;
|
|
13
|
+
/**
|
|
14
|
+
* Called on every change with the field's `valueAsNumber` (HAR-3100, the rule of TENSOR
|
|
15
|
+
* HAR-1597): a number, or `NaN` when the field is empty or holds no number yet. Never the typed
|
|
16
|
+
* text, which a form library would store as a string (digits vanished as they were typed), and
|
|
17
|
+
* never `0` or `undefined` for an emptied field, which read as "zero" and "use the default".
|
|
18
|
+
*/
|
|
19
|
+
onValueChange?: (value: number) => void;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* A number field (`<input type="number">`, `inputMode="decimal"` and `step="any"` by default, so a
|
|
23
|
+
* decimal is never a step mismatch) whose value is a number. Feed `onValueChange` back into `value`:
|
|
24
|
+
* what was typed stays in the box, an emptied field is `NaN`, so a required number refuses it.
|
|
25
|
+
*/
|
|
26
|
+
declare const NumberInput: react.ForwardRefExoticComponent<NumberInputProps & react.RefAttributes<HTMLInputElement>>;
|
|
27
|
+
|
|
28
|
+
export { NumberInput, type NumberInputProps };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { forwardRef } from "react";
|
|
4
|
+
import { Input } from "./Input.js";
|
|
5
|
+
const NumberInput = forwardRef((allProps, ref) => {
|
|
6
|
+
const { value, onValueChange, onChange, inputMode = "decimal", step = "any", ...props } = allProps;
|
|
7
|
+
const controlled = Object.prototype.hasOwnProperty.call(allProps, "value");
|
|
8
|
+
return /* @__PURE__ */ jsx(
|
|
9
|
+
Input,
|
|
10
|
+
{
|
|
11
|
+
ref,
|
|
12
|
+
inputMode,
|
|
13
|
+
step,
|
|
14
|
+
...props,
|
|
15
|
+
...controlled ? { value: value == null || Number.isNaN(value) ? "" : value } : {},
|
|
16
|
+
onChange: (event) => {
|
|
17
|
+
onChange?.(event);
|
|
18
|
+
onValueChange?.(event.currentTarget.valueAsNumber);
|
|
19
|
+
},
|
|
20
|
+
type: "number"
|
|
21
|
+
}
|
|
22
|
+
);
|
|
23
|
+
});
|
|
24
|
+
NumberInput.displayName = "NumberInput";
|
|
25
|
+
export {
|
|
26
|
+
NumberInput
|
|
27
|
+
};
|
|
@@ -13,7 +13,7 @@ interface PageHeaderProps extends Omit<HTMLAttributes<HTMLElement>, 'title'> {
|
|
|
13
13
|
* empty, whitespace-only or `null` renders no button.
|
|
14
14
|
*/
|
|
15
15
|
help?: string | null;
|
|
16
|
-
/** Accessible name of the ? button. Default `"About: <title>"`
|
|
16
|
+
/** Accessible name of the ? button. Default: the `UixLabelsProvider` `infoTip` template with the title (`"About: <title>"` without a provider). */
|
|
17
17
|
helpLabel?: string;
|
|
18
18
|
/** Right-aligned action area (buttons, menus). */
|
|
19
19
|
actions?: ReactNode;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { cx } from "../cx.js";
|
|
3
3
|
import { InfoTip } from "./InfoTip.js";
|
|
4
|
-
import { hasHelp,
|
|
4
|
+
import { hasHelp, helpTopic } from "../info-tip-model.js";
|
|
5
5
|
function PageHeader({ eyebrow, title, subtitle, help, helpLabel, actions, as: TitleTag = "h1", size = "default", className, ...props }) {
|
|
6
6
|
const heading = /* @__PURE__ */ jsx(TitleTag, { className: "uix-page-header__title", children: title });
|
|
7
7
|
return /* @__PURE__ */ jsxs("header", { className: cx("uix-page-header", size === "display" && "uix-page-header--display", className), ...props, children: [
|
|
@@ -9,7 +9,7 @@ function PageHeader({ eyebrow, title, subtitle, help, helpLabel, actions, as: Ti
|
|
|
9
9
|
eyebrow != null && /* @__PURE__ */ jsx("div", { className: "uix-page-header__eyebrow", children: eyebrow }),
|
|
10
10
|
hasHelp(help) ? /* @__PURE__ */ jsxs("div", { className: "uix-page-header__title-row", children: [
|
|
11
11
|
heading,
|
|
12
|
-
/* @__PURE__ */ jsx(InfoTip, { content: help, label: helpLabel
|
|
12
|
+
/* @__PURE__ */ jsx(InfoTip, { content: help, label: helpLabel, topic: helpTopic(title) })
|
|
13
13
|
] }) : heading,
|
|
14
14
|
subtitle != null && /* @__PURE__ */ jsx("p", { className: "uix-page-header__subtitle", children: subtitle })
|
|
15
15
|
] }),
|
|
@@ -6,7 +6,8 @@ interface TimelineProps extends HTMLAttributes<HTMLOListElement> {
|
|
|
6
6
|
}
|
|
7
7
|
/** Activity timeline container over `.uix-timeline`. Ordered list so AT reads entry count + sequence (UIX-A11Y-4). */
|
|
8
8
|
declare function Timeline({ children, className, ...props }: TimelineProps): react.JSX.Element;
|
|
9
|
-
|
|
9
|
+
/** `title` is the entry's event line (HAR-3086), not the native tooltip attribute. */
|
|
10
|
+
interface TimelineItemProps extends Omit<HTMLAttributes<HTMLLIElement>, 'title'> {
|
|
10
11
|
/**
|
|
11
12
|
* Custom rail node — an icon puck, an avatar, a tinted dot. Defaults to the
|
|
12
13
|
* accent `.uix-timeline__node` dot. Supply this to make a heterogeneous feed
|
|
@@ -14,9 +15,20 @@ interface TimelineItemProps extends HTMLAttributes<HTMLLIElement> {
|
|
|
14
15
|
*/
|
|
15
16
|
node?: ReactNode;
|
|
16
17
|
meta?: ReactNode;
|
|
18
|
+
/**
|
|
19
|
+
* The event, one sentence: "Daniel Fischer changed the status from Assigned to In progress"
|
|
20
|
+
* (HAR-3086). Drawn quieter than body copy (`.uix-timeline__title`, the hushed text colour) so a
|
|
21
|
+
* feed reads as a list of events, not a block of paragraphs; wrap the actor in `<strong>` to keep
|
|
22
|
+
* the name emphasised.
|
|
23
|
+
*/
|
|
24
|
+
title?: ReactNode;
|
|
25
|
+
/** A second line under the event, e.g. the comment or the old and new value (`.uix-timeline__detail`, meta size, muted). */
|
|
26
|
+
detail?: ReactNode;
|
|
27
|
+
/** A kit `StatusPill` or `Badge` beside the event, e.g. "Intern" or "Automatisch". */
|
|
28
|
+
badge?: ReactNode;
|
|
17
29
|
children?: ReactNode;
|
|
18
30
|
}
|
|
19
31
|
/** A timeline entry over `.uix-timeline__item` (node + connecting line + body). */
|
|
20
|
-
declare function TimelineItem({ node, meta, children, className, ...props }: TimelineItemProps): react.JSX.Element;
|
|
32
|
+
declare function TimelineItem({ node, meta, title, detail, badge, children, className, ...props }: TimelineItemProps): react.JSX.Element;
|
|
21
33
|
|
|
22
34
|
export { Timeline, TimelineItem, type TimelineItemProps, type TimelineProps };
|
|
@@ -3,7 +3,7 @@ import { cx } from "../cx.js";
|
|
|
3
3
|
function Timeline({ children, className, ...props }) {
|
|
4
4
|
return /* @__PURE__ */ jsx("ol", { className: cx("uix-timeline", className), ...props, children });
|
|
5
5
|
}
|
|
6
|
-
function TimelineItem({ node, meta, children, className, ...props }) {
|
|
6
|
+
function TimelineItem({ node, meta, title, detail, badge, children, className, ...props }) {
|
|
7
7
|
return /* @__PURE__ */ jsxs("li", { className: cx("uix-timeline__item", className), ...props, children: [
|
|
8
8
|
/* @__PURE__ */ jsxs("div", { className: "uix-timeline__rail", "aria-hidden": "true", children: [
|
|
9
9
|
node ?? /* @__PURE__ */ jsx("span", { className: "uix-timeline__node" }),
|
|
@@ -11,6 +11,11 @@ function TimelineItem({ node, meta, children, className, ...props }) {
|
|
|
11
11
|
] }),
|
|
12
12
|
/* @__PURE__ */ jsxs("div", { className: "uix-timeline__body", children: [
|
|
13
13
|
meta != null && /* @__PURE__ */ jsx("div", { className: "uix-timeline__meta", children: meta }),
|
|
14
|
+
(title != null || badge != null) && /* @__PURE__ */ jsxs("div", { className: "uix-timeline__head", children: [
|
|
15
|
+
title != null && /* @__PURE__ */ jsx("p", { className: "uix-timeline__title", children: title }),
|
|
16
|
+
badge != null && /* @__PURE__ */ jsx("span", { className: "uix-timeline__badge", children: badge })
|
|
17
|
+
] }),
|
|
18
|
+
detail != null && /* @__PURE__ */ jsx("p", { className: "uix-timeline__detail", children: detail }),
|
|
14
19
|
children
|
|
15
20
|
] })
|
|
16
21
|
] });
|