@tensor_1/react 2.64.0 → 2.65.1
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 +17 -0
- package/component-inventory.json +4 -0
- package/dist/components/AuditLog.d.ts +1 -0
- package/dist/components/LinkTile.d.ts +28 -0
- package/dist/components/LinkTile.js +38 -0
- package/dist/components/StatusPill.d.ts +11 -1
- package/dist/components/StatusPill.js +7 -2
- package/dist/index.cjs +2727 -2676
- package/dist/index.d.cts +46 -2
- package/dist/index.d.ts +2 -1
- package/dist/index.js +4 -1
- 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.
|
package/component-inventory.json
CHANGED
|
@@ -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 {
|
|
@@ -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
|
+
};
|
|
@@ -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
|