@tensor_1/react 2.67.3 → 2.69.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.
@@ -857,6 +857,10 @@
857
857
  "name": "ToggleRow",
858
858
  "subpath": "."
859
859
  },
860
+ {
861
+ "name": "ToolbarMore",
862
+ "subpath": "."
863
+ },
860
864
  {
861
865
  "name": "Tooltip",
862
866
  "subpath": "."
@@ -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 hasToolbar = savedViews != null || viewChanged && onSaveView != null || showSaveAs || filters != null || search != null || viewMenu != null || onMaximizedChange != null || toolbarEnd != null && toolbarEnd !== false;
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
- 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: [
296
- savedViews.note != null && /* @__PURE__ */ jsx("div", { className: "uix-data-workspace__views-note", children: savedViews.note }),
297
- /* @__PURE__ */ jsx(SavedViewMenu, { ...savedViews.menu, onSelect: (viewId) => {
298
- savedViews.menu.onSelect(viewId);
299
- close();
300
- } })
301
- ] }) }),
302
- viewChanged && onSaveView && /* @__PURE__ */ jsx(Button, { size: "sm", variant: "secondary", onClick: onSaveView, children: labels.saveView }),
303
- showSaveAs && /* @__PURE__ */ jsx(Button, { size: "sm", variant: "ghost", onClick: onSaveViewAs, children: labels.saveViewAs }),
304
- filters && /* @__PURE__ */ jsx(FilterChips, { filters, labels, baseId: id }),
305
- /* @__PURE__ */ jsx("span", { className: "uix-toolbar__spacer" }),
306
- search && /* @__PURE__ */ jsx(
307
- SearchBar,
308
- {
309
- className: "uix-data-workspace__search",
310
- landmark: false,
311
- label: search.label ?? labels.search,
312
- placeholder: search.placeholder ?? labels.searchPlaceholder,
313
- value: search.value,
314
- onValueChange: search.onChange,
315
- inputRef: searchRef,
316
- onSubmit: search.onSubmit,
317
- onClear: search.onClear,
318
- maxLength: search.maxLength
319
- }
320
- ),
321
- viewMenu && /* @__PURE__ */ jsx(PopoverButton, { id: `${id}-view`, label: labels.view, variant: "ghost", children: () => /* @__PURE__ */ jsx(ViewMenu, { ...viewMenu }) }),
322
- onMaximizedChange && /* @__PURE__ */ jsx(Button, { size: "sm", variant: "ghost", icon: true, "aria-label": maximized ? labels.restore : labels.maximize, "aria-pressed": maximized, onClick: () => onMaximizedChange(!maximized), children: /* @__PURE__ */ jsx(MaximizeIcon, { restore: maximized }) }),
323
- toolbarEnd
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 }) {
@@ -1,11 +1,21 @@
1
1
  import * as react from 'react';
2
- import { HTMLAttributes, ReactNode } from 'react';
2
+ import { HTMLAttributes, ReactNode, PointerEvent } from 'react';
3
3
  import { DialogCloseEvent, DiscardPromptLabels } from './DiscardPrompt.js';
4
4
  import './Button.js';
5
5
  import '../link.js';
6
6
  import './Kbd.js';
7
7
  import './ButtonFeedback.js';
8
8
 
9
+ /** Internal (not in index.ts): the side Peek swipes closed the same way since 2.68 (HAR-4659). */
10
+ declare function useDrawerSwipe(side: 'end' | 'start' | 'bottom', canClose: boolean, dismiss: (event: PointerEvent<HTMLDialogElement>) => boolean): {
11
+ settle: (el: HTMLElement) => void;
12
+ handlers: {
13
+ onPointerDown: (e: PointerEvent<HTMLDialogElement>) => void;
14
+ onPointerMove: (e: PointerEvent<HTMLDialogElement>) => void;
15
+ onPointerUp: (e: PointerEvent<HTMLDialogElement>) => void;
16
+ onPointerCancel: (e: PointerEvent<HTMLDialogElement>) => void;
17
+ };
18
+ };
9
19
  interface DrawerProps extends Omit<HTMLAttributes<HTMLDialogElement>, 'title'> {
10
20
  /** TENSOR RX-125 (UIX-04): translatable; English default. */
11
21
  closeLabel?: string;
@@ -44,4 +54,4 @@ interface DrawerProps extends Omit<HTMLAttributes<HTMLDialogElement>, 'title'> {
44
54
  }
45
55
  declare function Drawer({ open, onClose, dirty, pending, discardLabels, dismissOnBackdrop, side, title, children, footer, closeLabel: closeLabelProp, className, onClick, onKeyDown, ...rest }: DrawerProps): react.JSX.Element;
46
56
 
47
- export { Drawer, type DrawerProps };
57
+ export { Drawer, type DrawerProps, useDrawerSwipe };
@@ -174,5 +174,6 @@ function Drawer({
174
174
  );
175
175
  }
176
176
  export {
177
- Drawer
177
+ Drawer,
178
+ useDrawerSwipe
178
179
  };
@@ -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 === "display" && "uix-page-header--display", className), ...props, children: [
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,7 +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
- declare function Peek({ open, onClose, title, children, footer, onNavPrev, onNavNext, hint, previousLabel: previousLabelProp, nextLabel: nextLabelProp, closeLabel: closeLabelProp, className, onClick, ...rest }: PeekProps): react.JSX.Element;
37
+ /**
38
+ * The record quick view beside a list. Since 2.68 (HAR-4659) it is the side Drawer's panel: the same
39
+ * floating frame, slide, blurred scrim and swipe-to-close on touch (drawer.css styles `.uix-peek`
40
+ * with `.uix-drawer`), plus what a peek adds: the ↑/↓ record arrows, the hint line and the footer.
41
+ */
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;
21
43
 
22
44
  export { Peek, type PeekProps };
@@ -1,14 +1,17 @@
1
1
  "use client";
2
- import { jsx, jsxs } from "react/jsx-runtime";
3
- import { useId } from "react";
2
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
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
+ import { useDrawerSwipe } from "./Drawer.js";
9
+ import { ButtonLink } from "./Button.js";
8
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" }) });
9
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" }) });
10
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" }) });
11
- function Peek({ open, onClose, title, children, footer, onNavPrev, onNavNext, hint, previousLabel: previousLabelProp, nextLabel: nextLabelProp, closeLabel: closeLabelProp, className, onClick, ...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 }) {
12
15
  const uixLabels = useUixLabels();
13
16
  const previousLabel = previousLabelProp ?? uixLabels.peek?.previous ?? "Previous record";
14
17
  const nextLabel = nextLabelProp ?? uixLabels.peek?.next ?? "Next record";
@@ -16,19 +19,65 @@ function Peek({ open, onClose, title, children, footer, onNavPrev, onNavNext, hi
16
19
  const ref = useDialog(open, onClose);
17
20
  const hasNav = onNavPrev != null || onNavNext != null;
18
21
  const titleId = useId();
19
- return /* @__PURE__ */ jsxs("dialog", { ref, className: cx("uix-peek", className), "aria-labelledby": title ? titleId : void 0, ...rest, onClick: backdropDismiss(onClose, onClick), children: [
20
- /* @__PURE__ */ jsxs("div", { className: "uix-peek__header", children: [
21
- hasNav && /* @__PURE__ */ jsxs("div", { className: "uix-peek__nav", children: [
22
- /* @__PURE__ */ jsx("button", { type: "button", className: "uix-peek__navbtn", onClick: () => onNavPrev?.(), "aria-disabled": onNavPrev ? void 0 : true, "aria-label": previousLabel, children: /* @__PURE__ */ jsx(ChevronUp, {}) }),
23
- /* @__PURE__ */ jsx("button", { type: "button", className: "uix-peek__navbtn", onClick: () => onNavNext?.(), "aria-disabled": onNavNext ? void 0 : true, "aria-label": nextLabel, children: /* @__PURE__ */ jsx(ChevronDown, {}) })
24
- ] }),
25
- title && /* @__PURE__ */ jsx("h2", { className: "uix-peek__title", id: titleId, children: title }),
26
- hint && /* @__PURE__ */ jsx("span", { className: "uix-peek__hint", children: hint }),
27
- onClose && /* @__PURE__ */ jsx("button", { type: "button", className: "uix-peek__close", onClick: onClose, "aria-label": closeLabel, children: /* @__PURE__ */ jsx(CloseIcon, {}) })
28
- ] }),
29
- children != null && /* @__PURE__ */ jsx("div", { className: "uix-peek__body", children }),
30
- footer != null && /* @__PURE__ */ jsx("div", { className: "uix-peek__footer", children: footer })
31
- ] });
22
+ const swipe = useDrawerSwipe("end", !!onClose, () => {
23
+ onClose?.();
24
+ return true;
25
+ });
26
+ useEffect(() => {
27
+ const el = ref.current;
28
+ if (open && el) swipe.settle(el);
29
+ }, [open]);
30
+ return /* @__PURE__ */ jsxs(
31
+ "dialog",
32
+ {
33
+ ref,
34
+ className: cx("uix-peek", className),
35
+ "aria-labelledby": title || recordId != null ? titleId : void 0,
36
+ ...rest,
37
+ onClick: backdropDismiss(onClose, onClick),
38
+ onPointerDown: (event) => {
39
+ onPointerDown?.(event);
40
+ swipe.handlers.onPointerDown(event);
41
+ },
42
+ onPointerMove: (event) => {
43
+ onPointerMove?.(event);
44
+ swipe.handlers.onPointerMove(event);
45
+ },
46
+ onPointerUp: (event) => {
47
+ onPointerUp?.(event);
48
+ swipe.handlers.onPointerUp(event);
49
+ },
50
+ onPointerCancel: (event) => {
51
+ onPointerCancel?.(event);
52
+ swipe.handlers.onPointerCancel(event);
53
+ },
54
+ children: [
55
+ /* @__PURE__ */ jsxs("div", { className: "uix-peek__header", children: [
56
+ hasNav && /* @__PURE__ */ jsxs("div", { className: "uix-peek__nav", children: [
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, {}) }),
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, {}) })
59
+ ] }),
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 })
75
+ ] }),
76
+ children != null && /* @__PURE__ */ jsx("div", { className: "uix-peek__body", children }),
77
+ footer != null && /* @__PURE__ */ jsx("div", { className: "uix-peek__footer", children: footer })
78
+ ]
79
+ }
80
+ );
32
81
  }
33
82
  export {
34
83
  Peek
@@ -52,6 +52,17 @@ interface NavItemProps extends AnchorHTMLAttributes<HTMLAnchorElement> {
52
52
  * and the row grows to fit (HAR-1355; TENSOR B31). Hidden in the rail.
53
53
  */
54
54
  description?: ReactNode;
55
+ /**
56
+ * A control at the row's end, beside the link: usually a `StarButton` (HAR-3093). The kit draws the
57
+ * row: the link keeps one end slot that the badge (a count, a marker) and the star share. At rest
58
+ * an unpinned star is hidden and the badge sits in its place; on hover or keyboard focus the star
59
+ * shows there and the badge steps aside; a pinned star (and every star where no hover exists)
60
+ * keeps its own place, with the badge beside it. The label has all the other room and ends in an
61
+ * ellipsis only when it is longer. The row is a `<div class="uix-navrow">` around the link, since
62
+ * a button cannot sit inside a link; the ref still reaches the link. The slot is sized for one
63
+ * 24 px control: a wider one needs its own room.
64
+ */
65
+ trailing?: ReactNode;
55
66
  children?: ReactNode;
56
67
  }
57
68
  /**
@@ -73,6 +84,10 @@ declare function NavGroup({ icon, label, children, defaultExpanded, expanded: co
73
84
  interface SubNavItemProps extends AnchorHTMLAttributes<HTMLAnchorElement> {
74
85
  active?: boolean;
75
86
  as?: 'a' | 'button';
87
+ /** A count or marker at the row's end; it shares the end slot with `trailing` (HAR-3093). */
88
+ badge?: ReactNode;
89
+ /** A control beside the link, usually a `StarButton`: as on `NavItem` (HAR-3093). */
90
+ trailing?: ReactNode;
76
91
  children?: ReactNode;
77
92
  }
78
93
  /** A nested navigation row. Like `NavItem`, it forwards its ref to the `<a>` or `<button>` (HAR-1810). */
@@ -71,7 +71,18 @@ function SidebarSection({ label, children }) {
71
71
  children
72
72
  ] });
73
73
  }
74
- const NavItem = forwardRef(function NavItem2({ icon, badge, active, as: Tag = "a", description, children, className, ...props }, ref) {
74
+ function endSlot(badge, trailing) {
75
+ if (trailing == null) return badge != null ? /* @__PURE__ */ jsx("span", { className: "uix-navitem__badge", children: badge }) : null;
76
+ return /* @__PURE__ */ jsx("span", { className: "uix-navitem__end", children: badge != null && /* @__PURE__ */ jsx("span", { className: "uix-navitem__badge", children: badge }) });
77
+ }
78
+ function withTrailing(link, trailing) {
79
+ if (trailing == null) return link;
80
+ return /* @__PURE__ */ jsxs("div", { className: "uix-navrow", children: [
81
+ link,
82
+ /* @__PURE__ */ jsx("span", { className: "uix-navrow__trailing", children: trailing })
83
+ ] });
84
+ }
85
+ const NavItem = forwardRef(function NavItem2({ icon, badge, active, as: Tag = "a", description, trailing, children, className, ...props }, ref) {
75
86
  const text = description == null ? /* @__PURE__ */ jsx("span", { className: "uix-navitem__label", children }) : /* @__PURE__ */ jsxs("span", { className: "uix-navitem__text", children: [
76
87
  /* @__PURE__ */ jsx("span", { className: "uix-navitem__label", children }),
77
88
  /* @__PURE__ */ jsx("span", { className: "uix-navitem__desc", children: description })
@@ -79,37 +90,43 @@ const NavItem = forwardRef(function NavItem2({ icon, badge, active, as: Tag = "a
79
90
  const multiline = description == null ? void 0 : true;
80
91
  if (Tag === "button") {
81
92
  const { href: _href, ...btnProps } = props;
82
- return /* @__PURE__ */ jsxs(
83
- "button",
93
+ return withTrailing(
94
+ /* @__PURE__ */ jsxs(
95
+ "button",
96
+ {
97
+ ref,
98
+ type: "button",
99
+ className: cx("uix-navitem", className),
100
+ "aria-current": active ? "page" : void 0,
101
+ "data-multiline": multiline,
102
+ ...btnProps,
103
+ children: [
104
+ icon && /* @__PURE__ */ jsx("span", { className: "uix-navitem__icon", "aria-hidden": "true", children: icon }),
105
+ text,
106
+ endSlot(badge, trailing)
107
+ ]
108
+ }
109
+ ),
110
+ trailing
111
+ );
112
+ }
113
+ return withTrailing(
114
+ /* @__PURE__ */ jsxs(
115
+ "a",
84
116
  {
85
117
  ref,
86
- type: "button",
87
118
  className: cx("uix-navitem", className),
88
119
  "aria-current": active ? "page" : void 0,
89
120
  "data-multiline": multiline,
90
- ...btnProps,
121
+ ...props,
91
122
  children: [
92
123
  icon && /* @__PURE__ */ jsx("span", { className: "uix-navitem__icon", "aria-hidden": "true", children: icon }),
93
124
  text,
94
- badge != null && /* @__PURE__ */ jsx("span", { className: "uix-navitem__badge", children: badge })
125
+ endSlot(badge, trailing)
95
126
  ]
96
127
  }
97
- );
98
- }
99
- return /* @__PURE__ */ jsxs(
100
- "a",
101
- {
102
- ref,
103
- className: cx("uix-navitem", className),
104
- "aria-current": active ? "page" : void 0,
105
- "data-multiline": multiline,
106
- ...props,
107
- children: [
108
- icon && /* @__PURE__ */ jsx("span", { className: "uix-navitem__icon", "aria-hidden": "true", children: icon }),
109
- text,
110
- badge != null && /* @__PURE__ */ jsx("span", { className: "uix-navitem__badge", children: badge })
111
- ]
112
- }
128
+ ),
129
+ trailing
113
130
  );
114
131
  });
115
132
  NavItem.displayName = "NavItem";
@@ -152,13 +169,25 @@ function NavGroup({ icon, label, children, defaultExpanded = true, expanded: con
152
169
  /* @__PURE__ */ jsx("div", { ref: panelRef, id: panelId, className: "uix-navgroup__panel", "aria-hidden": !expanded, children: /* @__PURE__ */ jsx("div", { children }) })
153
170
  ] });
154
171
  }
155
- const SubNavItem = forwardRef(function SubNavItem2({ active, as: Tag = "a", children, className, ...props }, ref) {
172
+ const SubNavItem = forwardRef(function SubNavItem2({ active, as: Tag = "a", badge, trailing, children, className, ...props }, ref) {
156
173
  const cls = cx("uix-navitem uix-subitem", className);
157
174
  if (Tag === "button") {
158
175
  const { href: _href, ...btnProps } = props;
159
- return /* @__PURE__ */ jsx("button", { ref, type: "button", className: cls, "aria-current": active ? "page" : void 0, ...btnProps, children: /* @__PURE__ */ jsx("span", { className: "uix-navitem__label", children }) });
176
+ return withTrailing(
177
+ /* @__PURE__ */ jsxs("button", { ref, type: "button", className: cls, "aria-current": active ? "page" : void 0, ...btnProps, children: [
178
+ /* @__PURE__ */ jsx("span", { className: "uix-navitem__label", children }),
179
+ endSlot(badge, trailing)
180
+ ] }),
181
+ trailing
182
+ );
160
183
  }
161
- return /* @__PURE__ */ jsx("a", { ref, className: cls, "aria-current": active ? "page" : void 0, ...props, children: /* @__PURE__ */ jsx("span", { className: "uix-navitem__label", children }) });
184
+ return withTrailing(
185
+ /* @__PURE__ */ jsxs("a", { ref, className: cls, "aria-current": active ? "page" : void 0, ...props, children: [
186
+ /* @__PURE__ */ jsx("span", { className: "uix-navitem__label", children }),
187
+ endSlot(badge, trailing)
188
+ ] }),
189
+ trailing
190
+ );
162
191
  });
163
192
  SubNavItem.displayName = "SubNavItem";
164
193
  export {
@@ -0,0 +1,25 @@
1
+ import * as react from 'react';
2
+ import { ReactNode } from 'react';
3
+
4
+ interface ToolbarMoreProps {
5
+ /**
6
+ * The trigger's visible word and the menu's name. Default: the `UixLabelsProvider`
7
+ * `toolbar.more`, then "More".
8
+ */
9
+ label?: string;
10
+ /** `MenuItem`, `MenuItemCheckbox`, `MenuRadioGroup`, `MenuGroup` and `MenuSeparator`. */
11
+ children?: ReactNode;
12
+ open?: boolean;
13
+ onOpenChange?: (open: boolean) => void;
14
+ className?: string;
15
+ }
16
+ /**
17
+ * A toolbar's one overflow menu (HAR-3090): a quiet "More" trigger at the end of the row that
18
+ * collects the less frequent actions (group by, export, save as, maximize), so search and the
19
+ * filters lead and nothing else competes with them. It is the kit `Menu`, with its keyboard:
20
+ * ↓/↑, Home/End, type-to-find, Enter/Space, Esc and Tab close, focus back on the trigger. The
21
+ * product decides which actions go in; the kit draws the trigger and names it.
22
+ */
23
+ declare function ToolbarMore({ label, children, open, onOpenChange, className }: ToolbarMoreProps): react.JSX.Element;
24
+
25
+ export { ToolbarMore, type ToolbarMoreProps };
@@ -0,0 +1,28 @@
1
+ "use client";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import { cx } from "../cx.js";
4
+ import { useUixLabels } from "../labels-context.js";
5
+ import { MoreHorizontalIcon } from "../icons/components.js";
6
+ import { Button } from "./Button.js";
7
+ import { Menu } from "./Menu.js";
8
+ function ToolbarMore({ label, children, open, onOpenChange, className }) {
9
+ const provided = useUixLabels().toolbar?.more;
10
+ const word = label ?? provided ?? "More";
11
+ return /* @__PURE__ */ jsx(
12
+ Menu,
13
+ {
14
+ trigger: /* @__PURE__ */ jsxs(Button, { size: "sm", variant: "ghost", className: cx("uix-toolbar__more", className), children: [
15
+ /* @__PURE__ */ jsx(MoreHorizontalIcon, { size: "sm", "aria-hidden": "true" }),
16
+ word
17
+ ] }),
18
+ placement: "bottom-end",
19
+ label: word,
20
+ ...open !== void 0 ? { open } : {},
21
+ ...onOpenChange ? { onOpenChange } : {},
22
+ children
23
+ }
24
+ );
25
+ }
26
+ export {
27
+ ToolbarMore
28
+ };