@tensor_1/react 2.63.0 → 2.65.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 +18 -1
- package/component-inventory.json +8 -0
- package/dist/components/AuditLog.d.ts +1 -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/LinkTile.d.ts +28 -0
- package/dist/components/LinkTile.js +38 -0
- 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/StatusPill.d.ts +11 -1
- package/dist/components/StatusPill.js +7 -2
- package/dist/components/Timeline.d.ts +14 -2
- package/dist/components/Timeline.js +6 -1
- package/dist/index.cjs +3415 -3325
- package/dist/index.d.cts +123 -12
- package/dist/index.d.ts +3 -1
- package/dist/index.js +6 -1
- 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/dist/usage-roles.d.ts +14 -1
- package/dist/usage-roles.js +11 -0
- package/package.json +9 -3
- package/page-rules/README.md +74 -0
- package/page-rules/cli.mjs +5 -0
- package/page-rules/index.mjs +158 -0
- package/page-rules/rules.mjs +669 -0
- package/page-rules/scan.mjs +281 -0
package/README.md
CHANGED
|
@@ -54,6 +54,23 @@ presets are exercised with German names, help and actions in the live specimen a
|
|
|
54
54
|
serve the repo with `npm run serve:styleguide`). The browser regression checks the title's
|
|
55
55
|
text fragments as well as page width, so clipping by an ancestor cannot hide an overflow.
|
|
56
56
|
|
|
57
|
+
## Page rules: a gate for how pages use the kit (2.65.0)
|
|
58
|
+
|
|
59
|
+
The package ships `uix-page-rules`, a dependency-free checker for the page-level rules from
|
|
60
|
+
the TENSOR UI council climbs:
|
|
61
|
+
|
|
62
|
+
- severity through `severityTone`, never a generic map that turns "high" red;
|
|
63
|
+
- no mid-word breaks;
|
|
64
|
+
- no page title said twice;
|
|
65
|
+
- row menus named for their row;
|
|
66
|
+
- no comma-joined lists in cells;
|
|
67
|
+
- no raw buttons, tables or form controls;
|
|
68
|
+
- no literal font sizes.
|
|
69
|
+
|
|
70
|
+
Add a `uix-page-rules.config.json`, seed the shrink-only baseline once
|
|
71
|
+
(`npx uix-page-rules baseline --seed`) and run `uix-page-rules` as a required CI step. Setup,
|
|
72
|
+
rules and exit codes: [`page-rules/README.md`](page-rules/README.md).
|
|
73
|
+
|
|
57
74
|
## Rich text, markdown and emoji
|
|
58
75
|
|
|
59
76
|
Three optional entries (RTE-01). None of them is imported by the root entry.
|
|
@@ -439,7 +456,7 @@ A small ? next to a title or label opens a plain-text explanation. Use it for wh
|
|
|
439
456
|
```
|
|
440
457
|
|
|
441
458
|
- **`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.
|
|
459
|
+
- **`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
460
|
- **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
461
|
- **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
462
|
|
package/component-inventory.json
CHANGED
|
@@ -425,6 +425,10 @@
|
|
|
425
425
|
"name": "Lightbox",
|
|
426
426
|
"subpath": "."
|
|
427
427
|
},
|
|
428
|
+
{
|
|
429
|
+
"name": "LinkTile",
|
|
430
|
+
"subpath": "."
|
|
431
|
+
},
|
|
428
432
|
{
|
|
429
433
|
"name": "List",
|
|
430
434
|
"subpath": "."
|
|
@@ -537,6 +541,10 @@
|
|
|
537
541
|
"name": "NoticeQueue",
|
|
538
542
|
"subpath": "."
|
|
539
543
|
},
|
|
544
|
+
{
|
|
545
|
+
"name": "NumberInput",
|
|
546
|
+
"subpath": "."
|
|
547
|
+
},
|
|
540
548
|
{
|
|
541
549
|
"name": "OrgChart",
|
|
542
550
|
"subpath": "."
|
|
@@ -2,6 +2,7 @@ import * as react from 'react';
|
|
|
2
2
|
import { HTMLAttributes, ReactNode } from 'react';
|
|
3
3
|
import { FilterChoice, FilterValue } from '../filter-model.js';
|
|
4
4
|
import { StatusPillProps } from './StatusPill.js';
|
|
5
|
+
import '../overlay-position.js';
|
|
5
6
|
|
|
6
7
|
/** One entry of an access or change history. The consumer supplies it free of personal health data. */
|
|
7
8
|
interface AuditLogEvent {
|
|
@@ -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);
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { AnchorHTMLAttributes, ReactNode } from 'react';
|
|
3
|
+
import { UixRenderLink } from '../link.js';
|
|
4
|
+
|
|
5
|
+
interface LinkTileProps extends Omit<AnchorHTMLAttributes<HTMLAnchorElement>, 'title'> {
|
|
6
|
+
/** The tile's title: the link's accessible name. */
|
|
7
|
+
title: ReactNode;
|
|
8
|
+
/** A short description at the meta size, announced as the link's description. */
|
|
9
|
+
description?: ReactNode;
|
|
10
|
+
/** A 16 px icon before the title, aligned to its first line. Decorative: hidden from screen readers. */
|
|
11
|
+
icon?: ReactNode;
|
|
12
|
+
/** At most this many lines of description, then an ellipsis. Default: no limit. */
|
|
13
|
+
descriptionLines?: number;
|
|
14
|
+
/** The title's element. Default `h3`, for a grid of tiles under a section heading. */
|
|
15
|
+
titleAs?: 'h2' | 'h3' | 'h4' | 'span';
|
|
16
|
+
/** Renders the anchor with your router's link (client navigation, prefetch), as `CardLink` does. */
|
|
17
|
+
renderLink?: UixRenderLink;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* A navigation tile (HAR-3095): a whole-card link to another page, laid out by the kit. It has a
|
|
21
|
+
* leading icon, the title, a short description and a trailing chevron that says "this opens a
|
|
22
|
+
* page". Built on `CardLink`'s interactive card (`.uix-card--interactive`), with no inner padding
|
|
23
|
+
* beyond `.uix-card__body`. One anchor per tile: the title names it, the description describes it,
|
|
24
|
+
* the icon and the arrow are `aria-hidden`.
|
|
25
|
+
*/
|
|
26
|
+
declare function LinkTile({ title, description, icon, descriptionLines, titleAs: Title, className, href, renderLink, ...props }: LinkTileProps): react.JSX.Element;
|
|
27
|
+
|
|
28
|
+
export { LinkTile, type LinkTileProps };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useId } from "react";
|
|
4
|
+
import { cx } from "../cx.js";
|
|
5
|
+
import { renderUixLink } from "../link.js";
|
|
6
|
+
import { ChevronRightIcon } from "../icons/components.js";
|
|
7
|
+
function LinkTile({ title, description, icon, descriptionLines, titleAs: Title = "h3", className, href, renderLink, ...props }) {
|
|
8
|
+
const uid = useId();
|
|
9
|
+
const titleId = `${uid}-title`;
|
|
10
|
+
const descriptionId = description != null ? `${uid}-description` : void 0;
|
|
11
|
+
const lines = descriptionLines != null && Number.isFinite(descriptionLines) && descriptionLines >= 1 ? Math.floor(descriptionLines) : null;
|
|
12
|
+
const classes = cx("uix-card", "uix-card--interactive", "uix-link-tile", className);
|
|
13
|
+
const body = /* @__PURE__ */ jsxs("span", { className: "uix-card__body uix-link-tile__body", children: [
|
|
14
|
+
icon != null && /* @__PURE__ */ jsx("span", { className: "uix-link-tile__icon", "aria-hidden": "true", children: icon }),
|
|
15
|
+
/* @__PURE__ */ jsxs("span", { className: "uix-link-tile__text", children: [
|
|
16
|
+
/* @__PURE__ */ jsx(Title, { id: titleId, className: "uix-link-tile__title", children: title }),
|
|
17
|
+
description != null && /* @__PURE__ */ jsx(
|
|
18
|
+
"span",
|
|
19
|
+
{
|
|
20
|
+
id: descriptionId,
|
|
21
|
+
className: "uix-link-tile__description",
|
|
22
|
+
"data-clamped": lines != null ? "" : void 0,
|
|
23
|
+
style: lines != null ? { "--uix-link-tile-lines": String(lines) } : void 0,
|
|
24
|
+
children: description
|
|
25
|
+
}
|
|
26
|
+
)
|
|
27
|
+
] }),
|
|
28
|
+
/* @__PURE__ */ jsx("span", { className: "uix-link-tile__arrow", "aria-hidden": "true", children: /* @__PURE__ */ jsx(ChevronRightIcon, { size: "sm" }) })
|
|
29
|
+
] });
|
|
30
|
+
const a11y = { "aria-labelledby": titleId, ...descriptionId ? { "aria-describedby": descriptionId } : {} };
|
|
31
|
+
if (renderLink && href !== void 0) {
|
|
32
|
+
return /* @__PURE__ */ jsx(Fragment, { children: renderUixLink(renderLink, { ...a11y, ...props, href, className: classes, children: body }) });
|
|
33
|
+
}
|
|
34
|
+
return /* @__PURE__ */ jsx("a", { className: classes, href, ...a11y, ...props, children: body });
|
|
35
|
+
}
|
|
36
|
+
export {
|
|
37
|
+
LinkTile
|
|
38
|
+
};
|
|
@@ -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
|
] }),
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { HTMLAttributes, ReactNode } from 'react';
|
|
3
|
+
import { Placement } from '../overlay-position.js';
|
|
3
4
|
|
|
4
5
|
type PillTone = 'neutral' | 'success' | 'info' | 'warning' | 'danger' | 'critical' | 'muted' | 'progress' | 'attention' | 'overdue' | 'sla-ok' | 'sla-at-risk' | 'sla-breached' | 'p1' | 'p2' | 'p3' | 'p4' | 'p5';
|
|
5
6
|
/**
|
|
@@ -25,8 +26,17 @@ interface StatusPillProps extends HTMLAttributes<HTMLSpanElement> {
|
|
|
25
26
|
size?: PillSize;
|
|
26
27
|
/** Draws the tone's dot before the label. Always on for the `dot` and `outline` treatments. */
|
|
27
28
|
dot?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* What the pill means, shown in a kit `Tooltip` on hover and on keyboard focus (HAR-3109), e.g. why
|
|
31
|
+
* a sentiment reads "Frustriert". The pill becomes a focus stop with the kit focus ring, but no
|
|
32
|
+
* button: it does nothing when pressed. Screen readers hear the label, then the description once.
|
|
33
|
+
* Non-interactive content only; for a link or a button inside, use `InfoTip` or `Popover`.
|
|
34
|
+
*/
|
|
35
|
+
description?: ReactNode;
|
|
36
|
+
/** Where the description opens. Default `'top'`. */
|
|
37
|
+
descriptionPlacement?: Placement;
|
|
28
38
|
children?: ReactNode;
|
|
29
39
|
}
|
|
30
|
-
declare function StatusPill({ tone, treatment, size, dot, children, className, ...props }: StatusPillProps): react.JSX.Element;
|
|
40
|
+
declare function StatusPill({ tone, treatment, size, dot, description, descriptionPlacement, children, className, ...props }: StatusPillProps): react.JSX.Element;
|
|
31
41
|
|
|
32
42
|
export { type PillSize, type PillTone, type PillTreatment, StatusPill, type StatusPillProps };
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { cx } from "../cx.js";
|
|
3
|
-
|
|
3
|
+
import { Tooltip } from "./Tooltip.js";
|
|
4
|
+
function StatusPill({ tone = "neutral", treatment = "soft", size = "md", dot, description, descriptionPlacement = "top", children, className, ...props }) {
|
|
4
5
|
const quiet = treatment === "dot" || treatment === "outline";
|
|
5
|
-
|
|
6
|
+
const described = description != null && description !== false && description !== "";
|
|
7
|
+
const pill = /* @__PURE__ */ jsxs(
|
|
6
8
|
"span",
|
|
7
9
|
{
|
|
8
10
|
className: cx(
|
|
@@ -11,8 +13,10 @@ function StatusPill({ tone = "neutral", treatment = "soft", size = "md", dot, ch
|
|
|
11
13
|
quiet && `uix-pill--${treatment}`,
|
|
12
14
|
size === "sm" && "uix-pill--sm",
|
|
13
15
|
size === "lg" && "uix-pill--lg",
|
|
16
|
+
described && "uix-pill--described",
|
|
14
17
|
className
|
|
15
18
|
),
|
|
19
|
+
...described ? { tabIndex: 0 } : {},
|
|
16
20
|
...props,
|
|
17
21
|
children: [
|
|
18
22
|
(dot || quiet) && /* @__PURE__ */ jsx("span", { className: "uix-pill__dot", "aria-hidden": "true" }),
|
|
@@ -20,6 +24,7 @@ function StatusPill({ tone = "neutral", treatment = "soft", size = "md", dot, ch
|
|
|
20
24
|
]
|
|
21
25
|
}
|
|
22
26
|
);
|
|
27
|
+
return described ? /* @__PURE__ */ jsx(Tooltip, { content: description, placement: descriptionPlacement, children: pill }) : pill;
|
|
23
28
|
}
|
|
24
29
|
export {
|
|
25
30
|
StatusPill
|
|
@@ -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
|
] });
|