@tensor_1/react 2.68.0 → 2.70.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 +5 -1
- package/component-inventory.json +4 -0
- package/dist/components/DataWorkspace.d.ts +17 -1
- package/dist/components/DataWorkspace.js +48 -33
- package/dist/components/GlanceMarks.d.ts +36 -7
- package/dist/components/GlanceMarks.js +72 -13
- package/dist/components/PageHeader.d.ts +5 -2
- package/dist/components/PageHeader.js +1 -1
- package/dist/components/Peek.d.ts +18 -1
- package/dist/components/Peek.js +20 -6
- package/dist/components/Sidebar.d.ts +23 -0
- package/dist/components/Sidebar.js +57 -33
- package/dist/components/ToolbarMore.d.ts +25 -0
- package/dist/components/ToolbarMore.js +28 -0
- package/dist/index.cjs +3856 -3722
- package/dist/index.d.cts +122 -11
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -0
- package/dist/labels-context.d.ts +4 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -783,7 +783,11 @@ For a home page that greets before it warns: one question per card, red only for
|
|
|
783
783
|
- `BarList`: label, bar, value per bucket; every value written out.
|
|
784
784
|
- `Meter target={95} targetLabel="Ziel 95 %"`: an ink mark at the goal, said after the value.
|
|
785
785
|
- `StatusStrip`: one cell per service and only the affected ones listed, critical first.
|
|
786
|
-
- `Sparkline`: an ink-grey line with a dot on the latest value
|
|
786
|
+
- `Sparkline`: an ink-grey line with a dot on the latest value. `null` is a gap (never zero), `target` a dashed reference line, and a crossed `threshold` turns the last dot into an amber diamond. `valueText` keeps the value in text ("label: value" for a screen reader) and `showValue` writes it beside the line. Decoration unless you pass `label` or `valueText`. Say the target or threshold in `valueText`: the marks are not read out on their own.
|
|
787
|
+
|
|
788
|
+
```tsx
|
|
789
|
+
<Sparkline values={[99.9, 99.8, null, 99.1, 99.6]} target={99.5} label="Verfügbarkeit, 5 Tage" valueText="99,6 %, Ziel 99,5 %" showValue />
|
|
790
|
+
```
|
|
787
791
|
|
|
788
792
|
The option builders are public for your own glance charts: `glanceLineOption`, `pairedBarsOption`, `uixGlanceBase` (pure functions of `uixChartTokens()`).
|
|
789
793
|
|
package/component-inventory.json
CHANGED
|
@@ -18,7 +18,16 @@ interface DataWorkspaceLabels {
|
|
|
18
18
|
saveView: string;
|
|
19
19
|
saveViewAs: string;
|
|
20
20
|
maximize: string;
|
|
21
|
+
/**
|
|
22
|
+
* Unused since 2.69 (HAR-3090): Maximize is a checkbox item in the More menu, named by `maximize`
|
|
23
|
+
* with its state in `aria-checked`. Kept so existing label sets still type-check.
|
|
24
|
+
*/
|
|
21
25
|
restore: string;
|
|
26
|
+
/**
|
|
27
|
+
* The toolbar's overflow menu trigger (HAR-3090): Save as, the product's `toolbarMenu`, Maximize.
|
|
28
|
+
* Unset, the trigger takes `UixLabelsProvider` `toolbar.more`, then "More".
|
|
29
|
+
*/
|
|
30
|
+
more?: string;
|
|
22
31
|
selectAll: string;
|
|
23
32
|
/** `{label}`: the row's id. */
|
|
24
33
|
selectRow: string;
|
|
@@ -316,6 +325,13 @@ interface DataWorkspaceProps<T, S extends DataWorkspaceSortState = DataWorkspace
|
|
|
316
325
|
/** Toolbar: a maximize toggle; Escape restores, unless an open popover or menu takes it first. */
|
|
317
326
|
maximized?: boolean;
|
|
318
327
|
onMaximizedChange?: (maximized: boolean) => void;
|
|
328
|
+
/**
|
|
329
|
+
* Toolbar: the product's less frequent actions (group by, export, open in reports), as `Menu`
|
|
330
|
+
* items (`MenuItem`, `MenuRadioGroup`, `MenuGroup`, `MenuSeparator`). They join Save as and
|
|
331
|
+
* Maximize in the one "More" menu at the end of the row (HAR-3090), so search and the filters
|
|
332
|
+
* lead and nothing else competes with them.
|
|
333
|
+
*/
|
|
334
|
+
toolbarMenu?: ReactNode;
|
|
319
335
|
/** Toolbar: the product's own actions at the end ("New incident"). */
|
|
320
336
|
toolbarEnd?: ReactNode;
|
|
321
337
|
/** Between the toolbar (and bulk bar) and the rows: notices, a "3 new — show" pill, a truncation warning. */
|
|
@@ -395,6 +411,6 @@ interface DataWorkspaceProps<T, S extends DataWorkspaceSortState = DataWorkspace
|
|
|
395
411
|
* rich id cell, multi-column sort, the product's state bodies and `beforeBody`, row groups,
|
|
396
412
|
* windowing (`virtualize`) and a keyboard row model (`onRowActivate`).
|
|
397
413
|
*/
|
|
398
|
-
declare function DataWorkspace<T, S extends DataWorkspaceSortState = DataWorkspaceSort | null>({ label, rows, getRowId, rowLabel, columns, idColumn, sort, onSortChange, selection, onSelectionChange, maxSelection, bulkActions, rowActions, rowActionsColumn, getRowProps, density, zebra, freezeFirstColumn, fixed, mobile, search, filters, savedViews, viewMenu, viewChanged, onSaveView, onSaveViewAs, saveViewAs, maximized, onMaximizedChange, toolbarEnd, beforeBody, pagination, status, refreshing, rowMotion, onRetry, loadingRows, empty, emptyAction, filteredEmpty, filteredEmptyAction, error, stateOverride, groups, collapsedGroups, onCollapsedGroupsChange, virtualize, rowNavigation, onRowActivate, activateOnClick, activeRowId, onActiveRowChange, multiSort, labels: labelOverrides, className, ...props }: DataWorkspaceProps<T, S>): react.JSX.Element;
|
|
414
|
+
declare function DataWorkspace<T, S extends DataWorkspaceSortState = DataWorkspaceSort | null>({ label, rows, getRowId, rowLabel, columns, idColumn, sort, onSortChange, selection, onSelectionChange, maxSelection, bulkActions, rowActions, rowActionsColumn, getRowProps, density, zebra, freezeFirstColumn, fixed, mobile, search, filters, savedViews, viewMenu, viewChanged, onSaveView, onSaveViewAs, saveViewAs, maximized, onMaximizedChange, toolbarMenu, toolbarEnd, beforeBody, pagination, status, refreshing, rowMotion, onRetry, loadingRows, empty, emptyAction, filteredEmpty, filteredEmptyAction, error, stateOverride, groups, collapsedGroups, onCollapsedGroupsChange, virtualize, rowNavigation, onRowActivate, activateOnClick, activeRowId, onActiveRowChange, multiSort, labels: labelOverrides, className, ...props }: DataWorkspaceProps<T, S>): react.JSX.Element;
|
|
399
415
|
|
|
400
416
|
export { DEFAULT_DATA_WORKSPACE_LABELS, DataWorkspace, type DataWorkspaceColumn, type DataWorkspaceGroup, type DataWorkspaceIdColumn, type DataWorkspaceLabels, type DataWorkspacePagination, type DataWorkspaceProps, type DataWorkspaceRowActionsContext, type DataWorkspaceSort, type DataWorkspaceSortState, type DataWorkspaceSortValue, type DataWorkspaceVirtualize };
|
|
@@ -14,7 +14,9 @@ import { Button } from "./Button.js";
|
|
|
14
14
|
import { Checkbox } from "./Checkbox.js";
|
|
15
15
|
import { Chip } from "./Chip.js";
|
|
16
16
|
import { FilterEditor } from "./FilterEditor.js";
|
|
17
|
-
import { Menu, MenuItem } from "./Menu.js";
|
|
17
|
+
import { Menu, MenuItem, MenuItemCheckbox } from "./Menu.js";
|
|
18
|
+
import { ToolbarMore } from "./ToolbarMore.js";
|
|
19
|
+
import { Columns3Icon } from "../icons/components.js";
|
|
18
20
|
import { MotionList } from "./MotionList.js";
|
|
19
21
|
import { Pagination } from "./Pagination.js";
|
|
20
22
|
import { Popover } from "./Popover.js";
|
|
@@ -114,6 +116,7 @@ function DataWorkspace({
|
|
|
114
116
|
saveViewAs = "changed",
|
|
115
117
|
maximized = false,
|
|
116
118
|
onMaximizedChange,
|
|
119
|
+
toolbarMenu,
|
|
117
120
|
toolbarEnd,
|
|
118
121
|
beforeBody,
|
|
119
122
|
pagination,
|
|
@@ -290,37 +293,49 @@ function DataWorkspace({
|
|
|
290
293
|
onSortChange(next);
|
|
291
294
|
};
|
|
292
295
|
const showSaveAs = onSaveViewAs != null && (viewChanged || saveViewAs === "always");
|
|
293
|
-
const
|
|
296
|
+
const hasMenu = showSaveAs || onMaximizedChange != null || toolbarMenu != null && toolbarMenu !== false;
|
|
297
|
+
const hasToolbar = savedViews != null || viewChanged && onSaveView != null || hasMenu || filters != null || search != null || viewMenu != null || toolbarEnd != null && toolbarEnd !== false;
|
|
298
|
+
const hasLead = search != null || filters != null || savedViews != null || viewChanged && onSaveView != null;
|
|
299
|
+
const hasEnd = viewMenu != null || hasMenu || toolbarEnd != null && toolbarEnd !== false;
|
|
294
300
|
const toolbar = hasToolbar && /* @__PURE__ */ jsxs("div", { className: "uix-toolbar uix-data-workspace__toolbar", role: "toolbar", "aria-label": label, children: [
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
}
|
|
320
|
-
),
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
301
|
+
hasLead && /* @__PURE__ */ jsxs("div", { className: "uix-toolbar__lead", children: [
|
|
302
|
+
search && /* @__PURE__ */ jsx(
|
|
303
|
+
SearchBar,
|
|
304
|
+
{
|
|
305
|
+
className: "uix-data-workspace__search",
|
|
306
|
+
landmark: false,
|
|
307
|
+
label: search.label ?? labels.search,
|
|
308
|
+
placeholder: search.placeholder ?? labels.searchPlaceholder,
|
|
309
|
+
value: search.value,
|
|
310
|
+
onValueChange: search.onChange,
|
|
311
|
+
inputRef: searchRef,
|
|
312
|
+
onSubmit: search.onSubmit,
|
|
313
|
+
onClear: search.onClear,
|
|
314
|
+
maxLength: search.maxLength
|
|
315
|
+
}
|
|
316
|
+
),
|
|
317
|
+
filters && /* @__PURE__ */ jsx(FilterChips, { filters, labels, baseId: id }),
|
|
318
|
+
savedViews && /* @__PURE__ */ jsx(PopoverButton, { id: `${id}-views`, label: savedViews.current, title: typeof savedViews.current === "string" ? fillLabel(labels.savedView, { name: savedViews.current }) : void 0, variant: "secondary", children: (close) => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
319
|
+
savedViews.note != null && /* @__PURE__ */ jsx("div", { className: "uix-data-workspace__views-note", children: savedViews.note }),
|
|
320
|
+
/* @__PURE__ */ jsx(SavedViewMenu, { ...savedViews.menu, onSelect: (viewId) => {
|
|
321
|
+
savedViews.menu.onSelect(viewId);
|
|
322
|
+
close();
|
|
323
|
+
} })
|
|
324
|
+
] }) }),
|
|
325
|
+
viewChanged && onSaveView && /* @__PURE__ */ jsx(Button, { size: "sm", variant: "secondary", onClick: onSaveView, children: labels.saveView })
|
|
326
|
+
] }),
|
|
327
|
+
hasEnd && /* @__PURE__ */ jsxs("div", { className: "uix-toolbar__end", children: [
|
|
328
|
+
viewMenu && /* @__PURE__ */ jsx(PopoverButton, { id: `${id}-view`, label: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
329
|
+
/* @__PURE__ */ jsx(Columns3Icon, { size: "sm", "aria-hidden": "true" }),
|
|
330
|
+
labels.view
|
|
331
|
+
] }), name: labels.view, variant: "ghost", children: () => /* @__PURE__ */ jsx(ViewMenu, { ...viewMenu }) }),
|
|
332
|
+
hasMenu && /* @__PURE__ */ jsxs(ToolbarMore, { label: labels.more, children: [
|
|
333
|
+
showSaveAs && /* @__PURE__ */ jsx(MenuItem, { onSelect: () => onSaveViewAs?.(), children: labels.saveViewAs }),
|
|
334
|
+
toolbarMenu,
|
|
335
|
+
onMaximizedChange && /* @__PURE__ */ jsx(MenuItemCheckbox, { checked: maximized, onCheckedChange: (next) => onMaximizedChange(next), closeOnSelect: true, icon: /* @__PURE__ */ jsx(MaximizeIcon, { restore: maximized }), children: labels.maximize })
|
|
336
|
+
] }),
|
|
337
|
+
toolbarEnd
|
|
338
|
+
] })
|
|
324
339
|
] });
|
|
325
340
|
const busy = (node) => /* @__PURE__ */ jsx(BusyRegion, { busy: refreshing, className: "uix-data-workspace__state", children: node });
|
|
326
341
|
let body;
|
|
@@ -1129,7 +1144,7 @@ function Footer({ pagination, labels, rowCount }) {
|
|
|
1129
1144
|
pagination.mode === "offset" ? /* @__PURE__ */ jsx(Pagination, { mode: "offset", page: pagination.page, pageCount: Math.max(1, Math.ceil(pagination.total / pagination.pageSize)), onChange: pagination.onPageChange, labels: pagerLabels }) : /* @__PURE__ */ jsx(Pagination, { mode: "cursor", hasPrevious: pagination.hasPrevious, hasNext: pagination.hasNext, onFirst: pagination.onFirst, onPrevious: pagination.onPrevious, onNext: pagination.onNext, summary: pagination.summary, labels: pagerLabels })
|
|
1130
1145
|
] });
|
|
1131
1146
|
}
|
|
1132
|
-
function PopoverButton({ id, label, title, variant, children }) {
|
|
1147
|
+
function PopoverButton({ id, label, name, title, variant, children }) {
|
|
1133
1148
|
const anchor = useRef(null);
|
|
1134
1149
|
const [open, setOpen] = useState(false);
|
|
1135
1150
|
const popover = () => document.getElementById(id);
|
|
@@ -1146,7 +1161,7 @@ function PopoverButton({ id, label, title, variant, children }) {
|
|
|
1146
1161
|
});
|
|
1147
1162
|
return /* @__PURE__ */ jsxs("span", { ref: anchor, className: "uix-data-workspace__menu", children: [
|
|
1148
1163
|
/* @__PURE__ */ jsx(Button, { size: "sm", variant, title, "aria-haspopup": "dialog", "aria-expanded": open, "aria-controls": id, onClick: () => popover()?.togglePopover?.(), children: label }),
|
|
1149
|
-
/* @__PURE__ */ jsx(Popover, { id, anchor, role: "dialog", "aria-label": title ?? (typeof label === "string" ? label : void 0), children: children(close) })
|
|
1164
|
+
/* @__PURE__ */ jsx(Popover, { id, anchor, role: "dialog", "aria-label": title ?? name ?? (typeof label === "string" ? label : void 0), children: children(close) })
|
|
1150
1165
|
] });
|
|
1151
1166
|
}
|
|
1152
1167
|
function ChipSummary({ field, value, options }) {
|
|
@@ -43,8 +43,17 @@ interface StatusStripProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
43
43
|
* unknown; healthy ones are only cells.
|
|
44
44
|
*/
|
|
45
45
|
declare function StatusStrip({ items, summary, listAffected, className, ...props }: StatusStripProps): react.JSX.Element;
|
|
46
|
-
|
|
47
|
-
|
|
46
|
+
/** A level the latest value should not cross (`above`: higher is bad; `below`: lower is bad). */
|
|
47
|
+
interface SparklineThreshold {
|
|
48
|
+
value: number;
|
|
49
|
+
direction: 'above' | 'below';
|
|
50
|
+
}
|
|
51
|
+
interface SparklineProps extends Omit<SVGAttributes<SVGSVGElement>, 'values' | 'target'> {
|
|
52
|
+
/**
|
|
53
|
+
* The series, oldest first. `null` (or `NaN`) is a missing value: the line breaks there and it
|
|
54
|
+
* is never drawn as zero. A lone value between two gaps is a small dot.
|
|
55
|
+
*/
|
|
56
|
+
values: ReadonlyArray<number | null>;
|
|
48
57
|
/** Width in px. Default 86. */
|
|
49
58
|
width?: number;
|
|
50
59
|
/** Height in px. Default 24. */
|
|
@@ -52,12 +61,32 @@ interface SparklineProps extends Omit<SVGAttributes<SVGSVGElement>, 'values'> {
|
|
|
52
61
|
/** `ink` (default): a muted line with an ink endpoint. `series`: the series blue. */
|
|
53
62
|
tone?: 'ink' | 'series';
|
|
54
63
|
/**
|
|
55
|
-
* What the line
|
|
56
|
-
* sparkline is decoration (`aria-hidden`): say the
|
|
64
|
+
* What the line shows ("Rückstand der letzten 11 Wochen"). With `valueText` the accessible name
|
|
65
|
+
* is "label: valueText". Without either the sparkline is decoration (`aria-hidden`): say the
|
|
66
|
+
* number beside it in words.
|
|
57
67
|
*/
|
|
58
68
|
label?: string;
|
|
69
|
+
/**
|
|
70
|
+
* The current value in words or numbers ("85 offen, Ziel 60"). It joins the accessible name;
|
|
71
|
+
* with `showValue` it is also written beside the line. Mention the target or threshold here:
|
|
72
|
+
* the dashed line and the diamond are not read out on their own.
|
|
73
|
+
*/
|
|
74
|
+
valueText?: string;
|
|
75
|
+
/** Write `valueText` beside the line (the group becomes one image with the same name). Default false. */
|
|
76
|
+
showValue?: boolean;
|
|
77
|
+
/** A horizontal dashed reference line at this value; the scale always includes it. */
|
|
78
|
+
target?: number;
|
|
79
|
+
/** When the latest value is past it, the last mark becomes an amber diamond (shape and colour). */
|
|
80
|
+
threshold?: SparklineThreshold;
|
|
81
|
+
/** Mark the latest known value with a dot. Default true. */
|
|
82
|
+
highlightLast?: boolean;
|
|
59
83
|
}
|
|
60
|
-
/**
|
|
61
|
-
|
|
84
|
+
/**
|
|
85
|
+
* A trend line without axes, beside a number: an ink-grey line and a dot on the latest value.
|
|
86
|
+
* Missing values are gaps, an optional dashed `target` sits under the data, a crossed `threshold`
|
|
87
|
+
* turns the last dot into a diamond, and `valueText` keeps the value in text. `className` goes
|
|
88
|
+
* on the outermost element; every other attribute goes on the `svg.uix-sparkline`.
|
|
89
|
+
*/
|
|
90
|
+
declare function Sparkline({ values, width, height, tone, label, valueText, showValue, target, threshold, highlightLast, className, 'aria-describedby': describedBy, 'aria-labelledby': labelledBy, ...props }: SparklineProps): react.JSX.Element;
|
|
62
91
|
|
|
63
|
-
export { BarList, type BarListItem, type BarListProps, Sparkline, type SparklineProps, StatusStrip, type StatusStripItem, type StatusStripProps, type StatusStripTone };
|
|
92
|
+
export { BarList, type BarListItem, type BarListProps, Sparkline, type SparklineProps, type SparklineThreshold, StatusStrip, type StatusStripItem, type StatusStripProps, type StatusStripTone };
|
|
@@ -25,32 +25,91 @@ function StatusStrip({ items, summary, listAffected = true, className, ...props
|
|
|
25
25
|
] }, item.id)) })
|
|
26
26
|
] });
|
|
27
27
|
}
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
const isValue = (v) => typeof v === "number" && Number.isFinite(v);
|
|
29
|
+
const round = (n) => Number(n.toFixed(1));
|
|
30
|
+
function Sparkline({
|
|
31
|
+
values,
|
|
32
|
+
width = 86,
|
|
33
|
+
height = 24,
|
|
34
|
+
tone = "ink",
|
|
35
|
+
label,
|
|
36
|
+
valueText,
|
|
37
|
+
showValue = false,
|
|
38
|
+
target,
|
|
39
|
+
threshold,
|
|
40
|
+
highlightLast = true,
|
|
41
|
+
className,
|
|
42
|
+
"aria-describedby": describedBy,
|
|
43
|
+
"aria-labelledby": labelledBy,
|
|
44
|
+
...props
|
|
45
|
+
}) {
|
|
30
46
|
const pad = 3;
|
|
31
|
-
const
|
|
32
|
-
const
|
|
47
|
+
const known = values.filter(isValue);
|
|
48
|
+
const domain = isValue(target) ? [...known, target] : known;
|
|
49
|
+
const min = Math.min(...domain);
|
|
50
|
+
const max = Math.max(...domain);
|
|
33
51
|
const x = (i) => values.length < 2 ? width / 2 : pad + i * (width - 2 * pad) / (values.length - 1);
|
|
34
|
-
const y = (v) => height - pad - (v - min) / (max - min
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
52
|
+
const y = (v) => max === min ? height / 2 : height - pad - (v - min) / (max - min) * (height - 2 * pad);
|
|
53
|
+
const segments = [];
|
|
54
|
+
let run = null;
|
|
55
|
+
let lastIndex = -1;
|
|
56
|
+
values.forEach((v, i) => {
|
|
57
|
+
if (!isValue(v)) {
|
|
58
|
+
run = null;
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
if (!run) {
|
|
62
|
+
run = [];
|
|
63
|
+
segments.push(run);
|
|
64
|
+
}
|
|
65
|
+
run.push([x(i), y(v)]);
|
|
66
|
+
lastIndex = i;
|
|
67
|
+
});
|
|
68
|
+
const lastValue = lastIndex >= 0 ? values[lastIndex] : void 0;
|
|
69
|
+
const crossed = threshold != null && lastValue !== void 0 && (threshold.direction === "above" ? lastValue > threshold.value : lastValue < threshold.value);
|
|
70
|
+
const end = lastValue !== void 0 ? [x(lastIndex), y(lastValue)] : void 0;
|
|
71
|
+
const markEnd = end !== void 0 && (highlightLast || crossed);
|
|
72
|
+
const fmt = (n) => n.toFixed(1);
|
|
73
|
+
const name = [label, valueText].filter(Boolean).join(": ");
|
|
74
|
+
const grouped = showValue && Boolean(valueText);
|
|
75
|
+
const relations = { "aria-describedby": describedBy, "aria-labelledby": labelledBy };
|
|
76
|
+
const svg = /* @__PURE__ */ jsxs(
|
|
39
77
|
"svg",
|
|
40
78
|
{
|
|
41
|
-
className: cx("uix-sparkline", tone === "series" && "uix-sparkline--series", className),
|
|
79
|
+
className: cx("uix-sparkline", tone === "series" && "uix-sparkline--series", !grouped && className),
|
|
42
80
|
viewBox: `0 0 ${width} ${height}`,
|
|
43
81
|
width,
|
|
44
82
|
height,
|
|
45
|
-
...
|
|
83
|
+
...name && !grouped ? { role: "img", "aria-label": name } : { "aria-hidden": true },
|
|
46
84
|
focusable: "false",
|
|
85
|
+
...grouped ? {} : relations,
|
|
47
86
|
...props,
|
|
48
87
|
children: [
|
|
49
|
-
|
|
50
|
-
|
|
88
|
+
isValue(target) && known.length > 0 && /* @__PURE__ */ jsx("line", { className: "uix-sparkline__target", x1: pad, x2: width - pad, y1: round(y(target)), y2: round(y(target)) }),
|
|
89
|
+
segments.map((points) => {
|
|
90
|
+
const [px, py] = points[0];
|
|
91
|
+
if (points.length > 1) {
|
|
92
|
+
const d = points.map(([sx, sy], i) => `${i ? "L" : "M"}${fmt(sx)} ${fmt(sy)}`).join(" ");
|
|
93
|
+
return /* @__PURE__ */ jsx("path", { className: "uix-sparkline__line uix-arrive__trace", d, pathLength: 1 }, `${px}`);
|
|
94
|
+
}
|
|
95
|
+
if (markEnd && end && px === end[0]) return null;
|
|
96
|
+
return /* @__PURE__ */ jsx("circle", { className: "uix-sparkline__point", cx: round(px), cy: round(py), r: 1.25 }, `${px}`);
|
|
97
|
+
}),
|
|
98
|
+
markEnd && end && (crossed ? /* @__PURE__ */ jsx(
|
|
99
|
+
"path",
|
|
100
|
+
{
|
|
101
|
+
className: "uix-sparkline__end uix-sparkline__end--crossed",
|
|
102
|
+
d: `M${fmt(end[0])} ${fmt(end[1] - 3.5)} L${fmt(end[0] + 3.5)} ${fmt(end[1])} L${fmt(end[0])} ${fmt(end[1] + 3.5)} L${fmt(end[0] - 3.5)} ${fmt(end[1])} Z`
|
|
103
|
+
}
|
|
104
|
+
) : /* @__PURE__ */ jsx("circle", { className: "uix-sparkline__end", cx: round(end[0]), cy: round(end[1]), r: 2.5 }))
|
|
51
105
|
]
|
|
52
106
|
}
|
|
53
107
|
);
|
|
108
|
+
if (!grouped) return svg;
|
|
109
|
+
return /* @__PURE__ */ jsxs("span", { className: cx("uix-sparkline-group", className), role: "img", "aria-label": name, ...relations, children: [
|
|
110
|
+
svg,
|
|
111
|
+
/* @__PURE__ */ jsx("span", { className: "uix-sparkline__value", children: valueText })
|
|
112
|
+
] });
|
|
54
113
|
}
|
|
55
114
|
export {
|
|
56
115
|
BarList,
|
|
@@ -20,9 +20,12 @@ interface PageHeaderProps extends Omit<HTMLAttributes<HTMLElement>, 'title'> {
|
|
|
20
20
|
/**
|
|
21
21
|
* `display` is the staff type preset (HAR-1815; TENSOR, MOTUS ADR-0047): a 40 px heading-font
|
|
22
22
|
* title, a bold hushed eyebrow, a body-size hushed subtitle up to 42rem, and the actions
|
|
23
|
-
* aligned to the bottom of the titles. `default` is the 24 px header.
|
|
23
|
+
* aligned to the bottom of the titles. `default` is the 24 px header. `compact` (HAR-3081) sets
|
|
24
|
+
* the title one step down the scale, at the h3 size (15 px, semibold), with the same eyebrow,
|
|
25
|
+
* subtitle, help and actions: for a page whose first content (a Sev-1 alert, a live status)
|
|
26
|
+
* must read before its title, such as a greeting on a home page.
|
|
24
27
|
*/
|
|
25
|
-
size?: 'default' | 'display';
|
|
28
|
+
size?: 'default' | 'display' | 'compact';
|
|
26
29
|
}
|
|
27
30
|
/**
|
|
28
31
|
* Page header — eyebrow / title (+ optional `help` ?) / subtitle + actions row, over `.uix-page-header`.
|
|
@@ -4,7 +4,7 @@ import { InfoTip } from "./InfoTip.js";
|
|
|
4
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
|
-
return /* @__PURE__ */ jsxs("header", { className: cx("uix-page-header", size
|
|
7
|
+
return /* @__PURE__ */ jsxs("header", { className: cx("uix-page-header", size !== "default" && `uix-page-header--${size}`, className), ...props, children: [
|
|
8
8
|
/* @__PURE__ */ jsxs("div", { className: "uix-page-header__titles", children: [
|
|
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: [
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { HTMLAttributes, ReactNode } from 'react';
|
|
3
|
+
import { UixRenderLink } from '../link.js';
|
|
3
4
|
|
|
4
5
|
interface PeekProps extends Omit<HTMLAttributes<HTMLDialogElement>, 'title'> {
|
|
5
6
|
/** TENSOR RX-125 (UIX-04): translatable; English default. */
|
|
@@ -16,12 +17,28 @@ interface PeekProps extends Omit<HTMLAttributes<HTMLDialogElement>, 'title'> {
|
|
|
16
17
|
onNavPrev?: () => void;
|
|
17
18
|
onNavNext?: () => void;
|
|
18
19
|
hint?: string;
|
|
20
|
+
/**
|
|
21
|
+
* The record's ID (HAR-3089), shown with the title in the meta size with tabular figures, so the
|
|
22
|
+
* person previewing a row sees which record it is ("INC-1042"). It is part of the dialog's name.
|
|
23
|
+
*/
|
|
24
|
+
recordId?: ReactNode;
|
|
25
|
+
/**
|
|
26
|
+
* Open the record in full (HAR-3089): a secondary link button in the header row, with the close
|
|
27
|
+
* control, right after the title in the Tab order. The product passes its words and the href;
|
|
28
|
+
* `renderLink` is the router's link, as on `ButtonLink`.
|
|
29
|
+
*/
|
|
30
|
+
openAction?: {
|
|
31
|
+
label: string;
|
|
32
|
+
href: string;
|
|
33
|
+
renderLink?: UixRenderLink;
|
|
34
|
+
onClick?: () => void;
|
|
35
|
+
};
|
|
19
36
|
}
|
|
20
37
|
/**
|
|
21
38
|
* The record quick view beside a list. Since 2.68 (HAR-4659) it is the side Drawer's panel: the same
|
|
22
39
|
* floating frame, slide, blurred scrim and swipe-to-close on touch (drawer.css styles `.uix-peek`
|
|
23
40
|
* with `.uix-drawer`), plus what a peek adds: the ↑/↓ record arrows, the hint line and the footer.
|
|
24
41
|
*/
|
|
25
|
-
declare function Peek({ open, onClose, title, children, footer, onNavPrev, onNavNext, hint, previousLabel: previousLabelProp, nextLabel: nextLabelProp, closeLabel: closeLabelProp, className, onClick, onPointerDown, onPointerMove, onPointerUp, onPointerCancel, ...rest }: PeekProps): react.JSX.Element;
|
|
42
|
+
declare function Peek({ open, onClose, title, children, footer, onNavPrev, onNavNext, hint, recordId, openAction, previousLabel: previousLabelProp, nextLabel: nextLabelProp, closeLabel: closeLabelProp, className, onClick, onPointerDown, onPointerMove, onPointerUp, onPointerCancel, ...rest }: PeekProps): react.JSX.Element;
|
|
26
43
|
|
|
27
44
|
export { Peek, type PeekProps };
|
package/dist/components/Peek.js
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useEffect, useId } from "react";
|
|
4
4
|
import { cx } from "../cx.js";
|
|
5
5
|
import { useUixLabels } from "../labels-context.js";
|
|
6
6
|
import { useDialog } from "../hooks/useDialog.js";
|
|
7
7
|
import { backdropDismiss } from "../hooks/backdropDismiss.js";
|
|
8
8
|
import { useDrawerSwipe } from "./Drawer.js";
|
|
9
|
+
import { ButtonLink } from "./Button.js";
|
|
9
10
|
const CloseIcon = () => /* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: 1.5, strokeLinecap: "round", "aria-hidden": "true", children: /* @__PURE__ */ jsx("path", { d: "M4 4l8 8M12 4l-8 8" }) });
|
|
11
|
+
const OpenIcon = () => /* @__PURE__ */ jsx("svg", { width: "14", height: "14", viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: 1.5, strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: /* @__PURE__ */ jsx("path", { d: "M9 3h4v4M13 3 7.5 8.5M12 9.5V12a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h2.5" }) });
|
|
10
12
|
const ChevronUp = () => /* @__PURE__ */ jsx("svg", { width: "12", height: "12", viewBox: "0 0 12 12", fill: "none", stroke: "currentColor", strokeWidth: 1.5, strokeLinecap: "round", "aria-hidden": "true", children: /* @__PURE__ */ jsx("path", { d: "M2 8l4-4 4 4" }) });
|
|
11
13
|
const ChevronDown = () => /* @__PURE__ */ jsx("svg", { width: "12", height: "12", viewBox: "0 0 12 12", fill: "none", stroke: "currentColor", strokeWidth: 1.5, strokeLinecap: "round", "aria-hidden": "true", children: /* @__PURE__ */ jsx("path", { d: "M2 4l4 4 4-4" }) });
|
|
12
|
-
function Peek({ open, onClose, title, children, footer, onNavPrev, onNavNext, hint, previousLabel: previousLabelProp, nextLabel: nextLabelProp, closeLabel: closeLabelProp, className, onClick, onPointerDown, onPointerMove, onPointerUp, onPointerCancel, ...rest }) {
|
|
14
|
+
function Peek({ open, onClose, title, children, footer, onNavPrev, onNavNext, hint, recordId, openAction, previousLabel: previousLabelProp, nextLabel: nextLabelProp, closeLabel: closeLabelProp, className, onClick, onPointerDown, onPointerMove, onPointerUp, onPointerCancel, ...rest }) {
|
|
13
15
|
const uixLabels = useUixLabels();
|
|
14
16
|
const previousLabel = previousLabelProp ?? uixLabels.peek?.previous ?? "Previous record";
|
|
15
17
|
const nextLabel = nextLabelProp ?? uixLabels.peek?.next ?? "Next record";
|
|
@@ -30,7 +32,7 @@ function Peek({ open, onClose, title, children, footer, onNavPrev, onNavNext, hi
|
|
|
30
32
|
{
|
|
31
33
|
ref,
|
|
32
34
|
className: cx("uix-peek", className),
|
|
33
|
-
"aria-labelledby": title ? titleId : void 0,
|
|
35
|
+
"aria-labelledby": title || recordId != null ? titleId : void 0,
|
|
34
36
|
...rest,
|
|
35
37
|
onClick: backdropDismiss(onClose, onClick),
|
|
36
38
|
onPointerDown: (event) => {
|
|
@@ -55,9 +57,21 @@ function Peek({ open, onClose, title, children, footer, onNavPrev, onNavNext, hi
|
|
|
55
57
|
/* @__PURE__ */ jsx("button", { type: "button", className: "uix-peek__navbtn", onClick: () => onNavPrev?.(), "aria-disabled": onNavPrev ? void 0 : true, "aria-label": previousLabel, children: /* @__PURE__ */ jsx(ChevronUp, {}) }),
|
|
56
58
|
/* @__PURE__ */ jsx("button", { type: "button", className: "uix-peek__navbtn", onClick: () => onNavNext?.(), "aria-disabled": onNavNext ? void 0 : true, "aria-label": nextLabel, children: /* @__PURE__ */ jsx(ChevronDown, {}) })
|
|
57
59
|
] }),
|
|
58
|
-
title && /* @__PURE__ */
|
|
59
|
-
|
|
60
|
-
|
|
60
|
+
(title || recordId != null) && /* @__PURE__ */ jsxs("h2", { className: "uix-peek__title", id: titleId, children: [
|
|
61
|
+
recordId != null && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
62
|
+
/* @__PURE__ */ jsx("span", { className: "uix-peek__record-id", children: recordId }),
|
|
63
|
+
" "
|
|
64
|
+
] }),
|
|
65
|
+
title
|
|
66
|
+
] }),
|
|
67
|
+
(openAction || onClose) && /* @__PURE__ */ jsxs("div", { className: "uix-peek__controls", children: [
|
|
68
|
+
openAction && /* @__PURE__ */ jsxs(ButtonLink, { className: "uix-peek__open", href: openAction.href, renderLink: openAction.renderLink, onClick: openAction.onClick, variant: "secondary", size: "sm", children: [
|
|
69
|
+
/* @__PURE__ */ jsx(OpenIcon, {}),
|
|
70
|
+
openAction.label
|
|
71
|
+
] }),
|
|
72
|
+
onClose && /* @__PURE__ */ jsx("button", { type: "button", className: "uix-peek__close", onClick: onClose, "aria-label": closeLabel, children: /* @__PURE__ */ jsx(CloseIcon, {}) })
|
|
73
|
+
] }),
|
|
74
|
+
hint && /* @__PURE__ */ jsx("span", { className: "uix-peek__hint", children: hint })
|
|
61
75
|
] }),
|
|
62
76
|
children != null && /* @__PURE__ */ jsx("div", { className: "uix-peek__body", children }),
|
|
63
77
|
footer != null && /* @__PURE__ */ jsx("div", { className: "uix-peek__footer", children: footer })
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { ReactNode, AnchorHTMLAttributes, HTMLAttributes } from 'react';
|
|
3
|
+
import { UixRenderLink } from '../link.js';
|
|
3
4
|
import { KeyShortcut } from './Kbd.js';
|
|
4
5
|
|
|
5
6
|
/** The search row under the sidebar head (HAR-1371): it opens your search or command palette. */
|
|
@@ -52,6 +53,22 @@ interface NavItemProps extends AnchorHTMLAttributes<HTMLAnchorElement> {
|
|
|
52
53
|
* and the row grows to fit (HAR-1355; TENSOR B31). Hidden in the rail.
|
|
53
54
|
*/
|
|
54
55
|
description?: ReactNode;
|
|
56
|
+
/**
|
|
57
|
+
* A control at the row's end, beside the link: usually a `StarButton` (HAR-3093). The kit draws the
|
|
58
|
+
* row: the link keeps one end slot that the badge (a count, a marker) and the star share. At rest
|
|
59
|
+
* an unpinned star is hidden and the badge sits in its place; on hover or keyboard focus the star
|
|
60
|
+
* shows there and the badge steps aside; a pinned star (and every star where no hover exists)
|
|
61
|
+
* keeps its own place, with the badge beside it. The label has all the other room and ends in an
|
|
62
|
+
* ellipsis only when it is longer. The row is a `<div class="uix-navrow">` around the link, since
|
|
63
|
+
* a button cannot sit inside a link; the ref still reaches the link. The slot is sized for one
|
|
64
|
+
* 24 px control: a wider one needs its own room.
|
|
65
|
+
*/
|
|
66
|
+
trailing?: ReactNode;
|
|
67
|
+
/**
|
|
68
|
+
* Your router's link (`(p) => <NextLink {...p} />`), as on `ButtonLink` (2.69.1). The row's
|
|
69
|
+
* classes, `aria-current`, `href`, the ref and the children are passed in. Default: a plain `<a>`.
|
|
70
|
+
*/
|
|
71
|
+
renderLink?: UixRenderLink;
|
|
55
72
|
children?: ReactNode;
|
|
56
73
|
}
|
|
57
74
|
/**
|
|
@@ -73,6 +90,12 @@ declare function NavGroup({ icon, label, children, defaultExpanded, expanded: co
|
|
|
73
90
|
interface SubNavItemProps extends AnchorHTMLAttributes<HTMLAnchorElement> {
|
|
74
91
|
active?: boolean;
|
|
75
92
|
as?: 'a' | 'button';
|
|
93
|
+
/** A count or marker at the row's end; it shares the end slot with `trailing` (HAR-3093). */
|
|
94
|
+
badge?: ReactNode;
|
|
95
|
+
/** A control beside the link, usually a `StarButton`: as on `NavItem` (HAR-3093). */
|
|
96
|
+
trailing?: ReactNode;
|
|
97
|
+
/** Your router's link, as on `NavItem` (2.69.1). */
|
|
98
|
+
renderLink?: UixRenderLink;
|
|
76
99
|
children?: ReactNode;
|
|
77
100
|
}
|
|
78
101
|
/** A nested navigation row. Like `NavItem`, it forwards its ref to the `<a>` or `<button>` (HAR-1810). */
|