@sincpro/web-ui 2.12.0 → 2.14.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.
Files changed (137) hide show
  1. package/README.md +56 -21
  2. package/dist/components/gallery/Gallery.d.ts +29 -0
  3. package/dist/components/gallery/Gallery.js +78 -0
  4. package/dist/components/gallery/Lightbox.d.ts +28 -0
  5. package/dist/components/gallery/Lightbox.js +59 -0
  6. package/dist/components/gallery/index.d.ts +2 -0
  7. package/dist/components/gallery/index.js +3 -0
  8. package/dist/components/index.d.ts +3 -0
  9. package/dist/components/index.js +3 -0
  10. package/dist/components/listing/BoardColumns.js +10 -6
  11. package/dist/components/listing/ColumnsMenu.js +4 -2
  12. package/dist/components/listing/Listing.js +3 -1
  13. package/dist/components/listing/ListingBar.d.ts +16 -94
  14. package/dist/components/listing/ListingBar.js +24 -2
  15. package/dist/components/listing/RecordCard.d.ts +41 -3
  16. package/dist/components/listing/RecordCard.js +63 -22
  17. package/dist/components/listing/Row.js +5 -2
  18. package/dist/components/listing/columns.d.ts +3 -0
  19. package/dist/components/listing/columns.js +4 -0
  20. package/dist/components/listing/index.d.ts +2 -2
  21. package/dist/components/listing/index.js +2 -2
  22. package/dist/components/listing/set.d.ts +1 -1
  23. package/dist/components/plans/PlanCard.d.ts +43 -0
  24. package/dist/components/plans/PlanCard.js +35 -0
  25. package/dist/components/plans/index.d.ts +1 -0
  26. package/dist/components/plans/index.js +2 -0
  27. package/dist/components/receipt/Receipt.d.ts +51 -0
  28. package/dist/components/receipt/Receipt.js +23 -0
  29. package/dist/components/receipt/index.d.ts +1 -0
  30. package/dist/components/receipt/index.js +3 -0
  31. package/dist/components/search/CriteriaChips.d.ts +14 -1
  32. package/dist/components/search/CriteriaChips.js +123 -13
  33. package/dist/components/search/JoinWord.js +8 -14
  34. package/dist/components/search/SearchBar.d.ts +10 -1
  35. package/dist/components/search/SearchBar.js +715 -176
  36. package/dist/components/search/WordChoice.d.ts +19 -0
  37. package/dist/components/search/WordChoice.js +8 -0
  38. package/dist/components/search/criteria.d.ts +27 -0
  39. package/dist/components/search/criteria.js +33 -0
  40. package/dist/components/search/index.d.ts +2 -2
  41. package/dist/components/search/index.js +2 -2
  42. package/dist/components/search/query.d.ts +24 -0
  43. package/dist/components/search/query.js +29 -0
  44. package/dist/components/shell/AppFrame.d.ts +4 -0
  45. package/dist/components/shell/AppFrame.js +4 -1
  46. package/dist/components/shell/Inbox.d.ts +53 -0
  47. package/dist/components/shell/Inbox.js +55 -0
  48. package/dist/components/shell/KioskFrame.d.ts +35 -0
  49. package/dist/components/shell/KioskFrame.js +39 -0
  50. package/dist/components/shell/SearchEntry.js +2 -3
  51. package/dist/components/shell/TopBar.d.ts +4 -2
  52. package/dist/components/shell/TopBar.js +3 -3
  53. package/dist/components/shell/index.d.ts +2 -0
  54. package/dist/components/shell/index.js +4 -0
  55. package/dist/foundations/clock.d.ts +3 -0
  56. package/dist/foundations/clock.js +41 -0
  57. package/dist/foundations/copy.es.js +86 -1
  58. package/dist/foundations/form.d.ts +7 -0
  59. package/dist/foundations/form.js +1 -0
  60. package/dist/foundations/idle.d.ts +1 -0
  61. package/dist/foundations/idle.js +34 -0
  62. package/dist/foundations/index.d.ts +3 -0
  63. package/dist/foundations/index.js +7 -0
  64. package/dist/foundations/pointer.d.ts +25 -0
  65. package/dist/foundations/pointer.js +28 -0
  66. package/dist/foundations/uiCopy.d.ts +123 -2
  67. package/dist/foundations/uiCopy.js +86 -1
  68. package/dist/primitives/choice/RadioGroup.d.ts +8 -1
  69. package/dist/primitives/choice/RadioGroup.js +38 -1
  70. package/dist/primitives/choice/Rating.d.ts +32 -0
  71. package/dist/primitives/choice/Rating.js +75 -0
  72. package/dist/primitives/choice/Slider.d.ts +19 -0
  73. package/dist/primitives/choice/Slider.js +27 -2
  74. package/dist/primitives/choice/index.d.ts +2 -1
  75. package/dist/primitives/choice/index.js +4 -1
  76. package/dist/primitives/choice/options.d.ts +7 -0
  77. package/dist/primitives/field/Field.js +1 -0
  78. package/dist/primitives/field/Keypad.d.ts +43 -0
  79. package/dist/primitives/field/Keypad.js +62 -0
  80. package/dist/primitives/field/Stepper.d.ts +28 -0
  81. package/dist/primitives/field/Stepper.js +52 -0
  82. package/dist/primitives/field/clipboard.js +1 -1
  83. package/dist/primitives/field/index.d.ts +3 -0
  84. package/dist/primitives/field/index.js +6 -0
  85. package/dist/primitives/field/keypadKeys.d.ts +24 -0
  86. package/dist/primitives/field/keypadKeys.js +80 -0
  87. package/dist/primitives/hint/Hint.js +1 -1
  88. package/dist/primitives/hint/Kbd.d.ts +23 -0
  89. package/dist/primitives/hint/Kbd.js +23 -0
  90. package/dist/primitives/hint/index.d.ts +1 -0
  91. package/dist/primitives/hint/index.js +2 -0
  92. package/dist/primitives/menu/ContextMenu.d.ts +29 -0
  93. package/dist/primitives/menu/ContextMenu.js +74 -0
  94. package/dist/primitives/menu/Menu.d.ts +4 -1
  95. package/dist/primitives/menu/Menu.js +2 -2
  96. package/dist/primitives/menu/index.d.ts +1 -0
  97. package/dist/primitives/menu/index.js +2 -0
  98. package/dist/primitives/notice/Banner.d.ts +27 -0
  99. package/dist/primitives/notice/Banner.js +21 -0
  100. package/dist/primitives/notice/Callout.d.ts +4 -4
  101. package/dist/primitives/notice/Callout.js +8 -19
  102. package/dist/primitives/notice/Flag.js +1 -1
  103. package/dist/primitives/notice/Notice.d.ts +38 -10
  104. package/dist/primitives/notice/Notice.js +48 -9
  105. package/dist/primitives/notice/Outcome.d.ts +28 -0
  106. package/dist/primitives/notice/Outcome.js +28 -0
  107. package/dist/primitives/notice/index.d.ts +4 -1
  108. package/dist/primitives/notice/index.js +5 -0
  109. package/dist/primitives/notice/tones.d.ts +8 -0
  110. package/dist/primitives/notice/tones.js +22 -0
  111. package/dist/primitives/table/CellCopy.js +1 -1
  112. package/dist/primitives/table/ReportTable.js +1 -1
  113. package/dist/primitives/table/RowActions.js +1 -1
  114. package/dist/primitives/table/Table.js +9 -5
  115. package/dist/primitives/tag/Tags.d.ts +22 -1
  116. package/dist/primitives/tag/Tags.js +57 -14
  117. package/dist/primitives/tag/index.d.ts +1 -1
  118. package/dist/primitives/value/Elapsed.d.ts +16 -0
  119. package/dist/primitives/value/Elapsed.js +37 -0
  120. package/dist/primitives/value/Price.d.ts +31 -0
  121. package/dist/primitives/value/Price.js +32 -0
  122. package/dist/primitives/value/QrCode.d.ts +32 -0
  123. package/dist/primitives/value/QrCode.js +53 -0
  124. package/dist/primitives/value/elapsedTime.d.ts +26 -0
  125. package/dist/primitives/value/elapsedTime.js +32 -0
  126. package/dist/primitives/value/index.d.ts +5 -0
  127. package/dist/primitives/value/index.js +10 -0
  128. package/dist/primitives/value/priceFormat.d.ts +12 -0
  129. package/dist/primitives/value/priceFormat.js +22 -0
  130. package/dist/tokens.css +126 -1
  131. package/dist/views/list/List.d.ts +11 -0
  132. package/dist/views/list/List.js +14 -3
  133. package/dist/views/list/ListView.d.ts +1 -1
  134. package/dist/views/list/ListView.js +48 -9
  135. package/dist/views/list/types.d.ts +15 -0
  136. package/dist/views/record/Record.js +1 -1
  137. package/package.json +3 -2
@@ -0,0 +1,29 @@
1
+ import { type MenuGroup } from "./Menu.js";
2
+ import { type ReactNode } from "react";
3
+ export type ContextMenuProps = {
4
+ /** What the menu is about, read when it opens: «Acciones de la factura 0047». */
5
+ label: string;
6
+ groups: readonly MenuGroup[];
7
+ onSelect?: (id: string) => void;
8
+ /** The row, the card, the event — what is right-clicked or held. As a function it is told
9
+ * whether its menu is open, so the row can stay marked: with the menu over the list, which
10
+ * row it belongs to is otherwise a guess. */
11
+ children: ReactNode | ((state: {
12
+ open: boolean;
13
+ }) => ReactNode);
14
+ /** Off for now (a row being saved): the browser's own menu answers instead. */
15
+ disabled?: boolean;
16
+ };
17
+ /**
18
+ * The verbs of ONE thing, where the hand already is: right click on a row or a card, a finger
19
+ * held on it, or Shift+F10 / the Menu key on it.
20
+ *
21
+ * Context: an ERP list's frequent verbs — open, duplicate, send, cancel — live in the record's
22
+ * `⋯`, three moves away from the row; a board's card and a calendar's event have no room for a
23
+ * `⋯` at all. This is the same menu (`MenuList`: the same groups, icons, shortcuts and danger
24
+ * rows as `Menu`) opened AT the pointer. It is a shortcut, never the only way: whatever is here
25
+ * must also be reachable by a visible control, because nobody finds a right click by looking.
26
+ * It wraps its child without a box of its own (`display: contents`), so a table's row or a
27
+ * grid's card keeps its layout; the keyboard opens it from the focused element inside.
28
+ */
29
+ export declare function ContextMenu({ label, groups, onSelect, children, disabled, }: ContextMenuProps): import("react").JSX.Element;
@@ -0,0 +1,74 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { useUiCopy } from "../../foundations/copy.js";
4
+ import { indexOptions, MenuList } from "./Menu.js";
5
+ import { Popover } from "../overlay/Popover.js";
6
+ import { useRef, useState, } from "react";
7
+ /* How long a finger rests before it is a «press and hold», and how far it may drift and still
8
+ be one — the platforms' own numbers, near enough. */
9
+ const HOLD_MS = 500;
10
+ const DRIFT = 10;
11
+ /**
12
+ * The verbs of ONE thing, where the hand already is: right click on a row or a card, a finger
13
+ * held on it, or Shift+F10 / the Menu key on it.
14
+ *
15
+ * Context: an ERP list's frequent verbs — open, duplicate, send, cancel — live in the record's
16
+ * `⋯`, three moves away from the row; a board's card and a calendar's event have no room for a
17
+ * `⋯` at all. This is the same menu (`MenuList`: the same groups, icons, shortcuts and danger
18
+ * rows as `Menu`) opened AT the pointer. It is a shortcut, never the only way: whatever is here
19
+ * must also be reachable by a visible control, because nobody finds a right click by looking.
20
+ * It wraps its child without a box of its own (`display: contents`), so a table's row or a
21
+ * grid's card keeps its layout; the keyboard opens it from the focused element inside.
22
+ */
23
+ export function ContextMenu({ label, groups, onSelect, children, disabled = false, }) {
24
+ const copy = useUiCopy();
25
+ const [at, setAt] = useState(null);
26
+ const anchor = useRef(null);
27
+ const hold = useRef(null);
28
+ const byId = indexOptions(groups.flatMap((g) => g.options));
29
+ const cancelHold = () => {
30
+ if (hold.current !== null)
31
+ window.clearTimeout(hold.current.timer);
32
+ hold.current = null;
33
+ };
34
+ const onContextMenu = (event) => {
35
+ if (disabled)
36
+ return;
37
+ event.preventDefault();
38
+ cancelHold();
39
+ setAt({ x: event.clientX, y: event.clientY });
40
+ };
41
+ /* iOS fires no `contextmenu` on a long press; Android does, and then the hold has already
42
+ been cancelled by it. */
43
+ const onPointerDown = (event) => {
44
+ if (disabled || event.pointerType !== "touch")
45
+ return;
46
+ const { clientX: x, clientY: y } = event;
47
+ hold.current = { x, y, timer: window.setTimeout(() => setAt({ x, y }), HOLD_MS) };
48
+ };
49
+ const onPointerMove = (event) => {
50
+ const start = hold.current;
51
+ if (start === null)
52
+ return;
53
+ if (Math.hypot(event.clientX - start.x, event.clientY - start.y) > DRIFT)
54
+ cancelHold();
55
+ };
56
+ const onKeyDown = (event) => {
57
+ if (disabled)
58
+ return;
59
+ if (event.key !== "ContextMenu" && !(event.shiftKey && event.key === "F10"))
60
+ return;
61
+ event.preventDefault();
62
+ const box = event.target.getBoundingClientRect();
63
+ setAt({ x: box.left, y: box.bottom });
64
+ };
65
+ return (_jsxs("div", { "data-ui": "context-menu", className: "contents", onContextMenu: onContextMenu, onPointerDown: onPointerDown, onPointerMove: onPointerMove, onPointerUp: cancelHold, onPointerCancel: cancelHold, onKeyDown: onKeyDown, children: [typeof children === "function" ? children({ open: at !== null }) : children, _jsx("span", { ref: anchor, "aria-hidden": true, className: "pointer-events-none fixed size-0", style: at === null ? undefined : { left: at.x, top: at.y } }), _jsx(Popover, { triggerRef: anchor, isOpen: at !== null, onOpenChange: (open) => {
66
+ if (!open)
67
+ setAt(null);
68
+ }, placement: "bottom start", offset: 2, className: "w-max min-w-48 max-w-(--container-short)", children: _jsx(MenuList, { label: label, groups: groups, closeOnSelect: true, autoFocus: true, emptyText: copy.menu.empty, onAction: (key) => {
69
+ const option = byId.get(String(key));
70
+ option?.onSelect?.();
71
+ onSelect?.(String(key));
72
+ setAt(null);
73
+ } }) })] }));
74
+ }
@@ -137,7 +137,7 @@ chevron, active, iconOnly, variant, searchPlaceholder, emptyText, width, role, s
137
137
  * submenu is this same panel one level down, and a panel can be rendered on the server
138
138
  * without the trigger's popover, which is how the tests see the rows.
139
139
  */
140
- export declare function MenuList({ label, groups, onAction, closeOnSelect, emptyText, width, layout, foldable, }: {
140
+ export declare function MenuList({ label, groups, onAction, closeOnSelect, emptyText, width, layout, foldable, autoFocus, }: {
141
141
  label: string;
142
142
  groups: readonly MenuGroup[];
143
143
  onAction: (key: Key) => void;
@@ -147,4 +147,7 @@ export declare function MenuList({ label, groups, onAction, closeOnSelect, empty
147
147
  layout?: "list" | "columns";
148
148
  /** `false` shows every `collapsible` section open — under a search box. */
149
149
  foldable?: boolean;
150
+ /** Focus the first row when it appears. A `MenuTrigger` does it by itself; a panel opened
151
+ * without one — the `ContextMenu` — asks for it. */
152
+ autoFocus?: boolean;
150
153
  }): import("react").JSX.Element;
@@ -78,7 +78,7 @@ chevron = true, active = false, iconOnly = false, variant = "button", searchPlac
78
78
  * submenu is this same panel one level down, and a panel can be rendered on the server
79
79
  * without the trigger's popover, which is how the tests see the rows.
80
80
  */
81
- export function MenuList({ label, groups, onAction, closeOnSelect, emptyText, width = "md", layout = "list", foldable = true, }) {
81
+ export function MenuList({ label, groups, onAction, closeOnSelect, emptyText, width = "md", layout = "list", foldable = true, autoFocus = false, }) {
82
82
  const sectionKey = (g, index) => g.label ?? String(index);
83
83
  const folds = (g) => foldable && g.collapsible === true && g.label !== undefined;
84
84
  /* Which folded sections are open. One that holds something ticked starts open: otherwise
@@ -117,7 +117,7 @@ export function MenuList({ label, groups, onAction, closeOnSelect, emptyText, wi
117
117
  ? "font-medium text-ink"
118
118
  : "text-ink"}`, children: o.label }), o.badge === undefined ? null : typeof o.badge === "number" ? (_jsx("span", { className: "ml-auto flex shrink-0", children: _jsx(Count, { value: o.badge }) })) : typeof o.badge === "string" ? (_jsx("span", { className: "inline-flex shrink-0 items-center rounded-pill border border-warn/30 bg-warn/10 px-2 py-0.5 text-micro text-warn", children: o.badge })) : (_jsx("span", { className: "ml-auto shrink-0", children: o.badge }))] }), o.hint === undefined ? null : (_jsx("span", { className: "mt-0.5 block truncate text-micro text-muted", children: o.hint }))] }), o.shortcut === undefined ? null : (_jsx(Keyboard, { className: "shrink-0 self-center pl-3 font-mono text-micro text-muted", children: o.shortcut })), opens ? (_jsx(ChevronRight, { className: "size-(--size-icon-sm) shrink-0 self-center text-muted", strokeWidth: 2, "aria-hidden": true })) : null] }, o.id));
119
119
  };
120
- return (_jsx(AriaMenu, { "data-ui": "menu", "aria-label": label, shouldCloseOnSelect: closeOnSelect, onAction: act, renderEmptyState: () => (_jsx("p", { className: "px-3 py-3 text-meta text-muted italic", children: emptyText })), className: `max-h-[inherit] overflow-y-auto p-1 outline-0 ${layout === "columns" ? "flex flex-col sm:flex-row sm:items-stretch" : ""}`, children: groups.map((g, gi) => {
120
+ return (_jsx(AriaMenu, { "data-ui": "menu", "aria-label": label, shouldCloseOnSelect: closeOnSelect, ...(autoFocus ? { autoFocus: "first" } : {}), onAction: act, renderEmptyState: () => (_jsx("p", { className: "px-3 py-3 text-meta text-muted italic", children: emptyText })), className: `max-h-[inherit] overflow-y-auto p-1 outline-0 ${layout === "columns" ? "flex flex-col sm:flex-row sm:items-stretch" : ""}`, children: groups.map((g, gi) => {
121
121
  const key = sectionKey(g, gi);
122
122
  const folding = folds(g);
123
123
  const open = !folding || unfolded.has(key);
@@ -1,2 +1,3 @@
1
1
  export { Menu, type MenuGroup, type MenuOption } from "./Menu.js";
2
2
  export { menuTriggerClasses } from "./classes.js";
3
+ export { ContextMenu, type ContextMenuProps, } from "./ContextMenu.js";
@@ -2,3 +2,5 @@
2
2
  export { Menu } from "./Menu.js";
3
3
  /* A trigger's look without the menu, without `"use client"`: a server component calls it. */
4
4
  export { menuTriggerClasses } from "./classes.js";
5
+ /* The same menu opened AT the pointer: right click, a finger held, Shift+F10 on a row or a card. */
6
+ export { ContextMenu, } from "./ContextMenu.js";
@@ -0,0 +1,27 @@
1
+ import { type NoticeTone } from "./tones.js";
2
+ import { type LucideIcon } from "lucide-react";
3
+ import type { ReactNode } from "react";
4
+ export type BannerProps = {
5
+ /** What is happening, in one sentence: «El sistema se actualiza hoy a las 22:00». */
6
+ children: ReactNode;
7
+ /** Without this, `info`. The same four degrees as `Callout`. */
8
+ tone?: NoticeTone;
9
+ /** What resolves it, if there is something to press — usually a link: «Renovar el plan». */
10
+ action?: ReactNode;
11
+ /** Present = it can be closed. Absent = it stays, because it stays true for whoever looks. */
12
+ onDismiss?: () => void;
13
+ /** An icon of its own, when the tone's does not say enough (a truck for «envío gratis»). */
14
+ icon?: LucideIcon;
15
+ };
16
+ /**
17
+ * A notice about the whole APPLICATION, across the top of the frame: a maintenance window, a
18
+ * plan about to expire, «envío gratis desde Bs 300», a company in a test environment.
19
+ *
20
+ * Context: a `Callout` speaks about the view it sits in and lives inside it; this speaks about
21
+ * everything, so it goes in `AppFrame banner` — above the bar, edge to edge, scrolled away with
22
+ * the page instead of stuck on top taking a line from every screen. It is the same four tones
23
+ * as the `Callout` (one table, `tones.ts`), the sentence in ink and the tone on the icon and
24
+ * the edge. A `status`, never an `alert`: it was there when the screen opened, it interrupts
25
+ * nothing.
26
+ */
27
+ export declare function Banner({ children, tone, action, onDismiss, icon }: BannerProps): import("react").JSX.Element;
@@ -0,0 +1,21 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { useUiCopy } from "../../foundations/copy.js";
4
+ import { NOTICE_DISMISS, NOTICE_ICON, NOTICE_SKIN, } from "./tones.js";
5
+ import { X } from "lucide-react";
6
+ /**
7
+ * A notice about the whole APPLICATION, across the top of the frame: a maintenance window, a
8
+ * plan about to expire, «envío gratis desde Bs 300», a company in a test environment.
9
+ *
10
+ * Context: a `Callout` speaks about the view it sits in and lives inside it; this speaks about
11
+ * everything, so it goes in `AppFrame banner` — above the bar, edge to edge, scrolled away with
12
+ * the page instead of stuck on top taking a line from every screen. It is the same four tones
13
+ * as the `Callout` (one table, `tones.ts`), the sentence in ink and the tone on the icon and
14
+ * the edge. A `status`, never an `alert`: it was there when the screen opened, it interrupts
15
+ * nothing.
16
+ */
17
+ export function Banner({ children, tone = "info", action, onDismiss, icon }) {
18
+ const copy = useUiCopy();
19
+ const Icon = icon ?? NOTICE_ICON[tone];
20
+ return (_jsxs("div", { role: "status", "data-ui": "banner", "data-tone": tone, className: `flex min-h-(--size-control-md) min-w-0 items-center gap-3 border-b px-4 py-1 print:hidden ${NOTICE_SKIN[tone]}`, children: [_jsxs("div", { className: "flex min-w-0 flex-1 flex-wrap items-center justify-center gap-x-3 gap-y-1", children: [_jsxs("span", { className: "inline-flex min-w-0 items-center gap-2", children: [_jsx(Icon, { className: "size-(--size-icon-sm) shrink-0", strokeWidth: 2, "aria-hidden": true }), _jsx("span", { className: "min-w-0 text-meta text-ink", children: children })] }), action === undefined ? null : (_jsx("span", { className: "shrink-0 text-meta", "data-ui": "banner.action", children: action }))] }), onDismiss === undefined ? null : (_jsx("button", { type: "button", onClick: onDismiss, "aria-label": copy.shell.closeNotice, title: copy.shell.closeNotice, className: NOTICE_DISMISS, children: _jsx(X, { className: "size-(--size-icon-sm)", strokeWidth: 2 }) }))] }));
21
+ }
@@ -1,5 +1,5 @@
1
- import type { Tone } from "../../foundations/types.js";
2
- import type { LucideIcon } from "lucide-react";
1
+ import { type NoticeTone } from "./tones.js";
2
+ import { type LucideIcon } from "lucide-react";
3
3
  import type { ReactNode } from "react";
4
4
  /**
5
5
  * A NOTICE about what is being looked at.
@@ -32,7 +32,7 @@ export type CalloutProps = {
32
32
  /** What is happening. One sentence, in the product's voice. */
33
33
  children: ReactNode;
34
34
  /** Without this, `info`. */
35
- tone?: Extract<Tone, "info" | "warn" | "bad" | "good">;
35
+ tone?: NoticeTone;
36
36
  /** The heading, when the sentence alone is not enough. Most do not
37
37
  * need it: a two-line notice with a title is a poster. */
38
38
  title?: ReactNode;
@@ -41,7 +41,7 @@ export type CalloutProps = {
41
41
  /** Present = it can be closed. Absent = it cannot, because what it says stays
42
42
  * true whoever looks at it. */
43
43
  onDismiss?: () => void;
44
- /** The accessible label of the ×. */
44
+ /** The accessible label of the ×. «Descartar el aviso» by default. */
45
45
  dismissLabel?: string;
46
46
  /** An icon of its own, when the tone's does not say enough. */
47
47
  icon?: LucideIcon;
@@ -1,26 +1,15 @@
1
1
  "use client";
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { useUiCopy } from "../../foundations/copy.js";
3
4
  import { byDensity, useDensity } from "../../foundations/density.js";
4
5
  import { currentPage, ErrorCopy, errorReport, } from "./Notice.js";
5
- import { AlertTriangle, CheckCircle2, Info, OctagonAlert, X } from "lucide-react";
6
- const ICON = {
7
- info: Info,
8
- warn: AlertTriangle,
9
- bad: OctagonAlert,
10
- good: CheckCircle2,
11
- };
12
- /* The background is a layer of the colour over the paper and not a colour of its own: so the
13
- notice reads on the floor and on white paper without two sets of tokens, and
14
- keeps working the day the palette changes. */
15
- const SKIN = {
16
- info: "border-info/25 bg-info/8 text-info",
17
- warn: "border-warn/30 bg-warn/10 text-warn",
18
- bad: "border-bad/25 bg-bad/8 text-bad",
19
- good: "border-good/25 bg-good/8 text-good",
20
- };
6
+ import { NOTICE_DISMISS, NOTICE_ICON, NOTICE_SKIN, } from "./tones.js";
7
+ import { X } from "lucide-react";
21
8
  export function Callout({ children, tone = "info", title, action, onDismiss, dismissLabel, icon, report, }) {
22
9
  const d = useDensity();
23
- const Icon = icon ?? ICON[tone];
10
+ const copy = useUiCopy();
11
+ const Icon = icon ?? NOTICE_ICON[tone];
12
+ const dismiss = dismissLabel ?? copy.shell.closeNotice;
24
13
  /* The text a person would paste: the sentence, or what the caller names. A title that
25
14
  is text becomes the report's heading; without one the sentence is the heading. */
26
15
  const sentence = report ?? (typeof children === "string" ? children : "");
@@ -29,10 +18,10 @@ export function Callout({ children, tone = "info", title, action, onDismiss, dis
29
18
  /* `status` and not `alert`: `alert` interrupts the screen reader and is
30
19
  reserved for what happened RIGHT NOW. A notice that was already there when the
31
20
  screen opened interrupts nothing. */
32
- role: "status", className: `flex min-w-0 items-start gap-2.5 rounded-box border ${SKIN[tone]} ${byDensity(d, "px-3 py-2.5", "px-2.5 py-2")}`, children: [_jsx(Icon, { className: "mt-0.5 size-(--size-icon-sm) shrink-0", strokeWidth: 2, "aria-hidden": true }), _jsxs("div", { className: "flex min-w-0 flex-1 flex-wrap items-start gap-x-3 gap-y-2", children: [_jsxs("div", { className: "flex min-w-0 flex-1 basis-(--container-name) flex-col gap-1", children: [title === undefined ? null : (_jsx("p", { className: "text-meta font-medium text-ink", children: title })), _jsx("div", { className: "min-w-0 text-meta text-ink", children: children })] }), action === undefined ? null : _jsx("span", { className: "shrink-0", children: action }), copyable ? (_jsx("span", { className: "shrink-0", children: _jsx(ErrorCopy, { report: () => errorReport({
21
+ role: "status", className: `flex min-w-0 items-start gap-2.5 rounded-box border ${NOTICE_SKIN[tone]} ${byDensity(d, "px-3 py-2.5", "px-2.5 py-2")}`, children: [_jsx(Icon, { className: "mt-0.5 size-(--size-icon-sm) shrink-0", strokeWidth: 2, "aria-hidden": true }), _jsxs("div", { className: "flex min-w-0 flex-1 flex-wrap items-start gap-x-3 gap-y-2", children: [_jsxs("div", { className: "flex min-w-0 flex-1 basis-(--container-name) flex-col gap-1", children: [title === undefined ? null : (_jsx("p", { className: "text-meta font-medium text-ink", children: title })), _jsx("div", { className: "min-w-0 text-meta text-ink", children: children })] }), action === undefined ? null : _jsx("span", { className: "shrink-0", children: action }), copyable ? (_jsx("span", { className: "shrink-0", children: _jsx(ErrorCopy, { report: () => errorReport({
33
22
  heading: typeof title === "string" ? title : "",
34
23
  sentence: typeof title === "string" ? sentence : undefined,
35
24
  at: new Date(),
36
25
  page: currentPage(),
37
- }) }) })) : null] }), onDismiss === undefined ? null : (_jsx("button", { type: "button", onClick: onDismiss, "aria-label": dismissLabel ?? "cerrar", title: dismissLabel ?? "cerrar", className: "-mr-1 shrink-0 rounded-control p-0.5 text-muted transition-colors duration-(--duration-instant) hover:bg-ink/6 hover:text-ink", children: _jsx(X, { className: "size-(--size-icon-sm)", strokeWidth: 2 }) }))] }));
26
+ }) }) })) : null] }), onDismiss === undefined ? null : (_jsx("button", { type: "button", onClick: onDismiss, "aria-label": dismiss, title: dismiss, className: NOTICE_DISMISS, children: _jsx(X, { className: "size-(--size-icon-sm)", strokeWidth: 2 }) }))] }));
38
27
  }
@@ -11,7 +11,7 @@ const ICON = {
11
11
  good: CircleCheck,
12
12
  };
13
13
  const mark = tv({
14
- base: "inline-flex size-5 shrink-0 cursor-default items-center justify-center rounded-pill outline-0 transition-colors duration-(--duration-instant) forced-colors:text-[ButtonText]",
14
+ base: "hit-target inline-flex size-5 shrink-0 cursor-default items-center justify-center rounded-pill outline-0 transition-colors duration-(--duration-instant) forced-colors:text-[ButtonText]",
15
15
  variants: {
16
16
  tone: {
17
17
  bad: "bg-bad/12 text-bad hover:bg-bad/20 aria-expanded:bg-bad/20",
@@ -1,22 +1,50 @@
1
1
  import { type LucideIcon } from "lucide-react";
2
2
  import { type ReactNode } from "react";
3
- export declare function Skeleton({ rows, label, }: {
4
- /** How many row-silhouettes. Six is a screen of a list, not a guess at
5
- * the real count. */
3
+ /** The silhouette's shape: the one of what is coming. */
4
+ export type SkeletonShape = "rows" | "table" | "tiles" | "board";
5
+ /** Quiet stand-in for what has not arrived, in ITS shape.
6
+ *
7
+ * Context: the bars are the content's scan held in place — a list's name and figure, a
8
+ * table's columns, a grid's cards, a board's lanes — so the page does not jump when the data
9
+ * lands. Rows for a grid of products was a jump from lines to boxes; each presentation now
10
+ * waits in its own shape (`List` picks it). There is no shimmer: a pulse already means «this
11
+ * state is alive» (`StatusDot`), a second one would spend motion on a wait. The sentence is for
12
+ * the screen reader — the bars are not the message. */
13
+ export declare function Skeleton({ rows, label, shape, }: {
14
+ /** How many silhouettes — rows, or cards in a grid. Six is a screen, not a guess at the
15
+ * real count. */
6
16
  rows?: number;
7
17
  /** What a screen reader hears. The bars stay silent. */
8
18
  label: string;
19
+ shape?: SkeletonShape;
9
20
  }): import("react").JSX.Element;
10
- /** What is shown when there is nothing to show: a sentence, and the gesture
11
- * that resolves it if there is one. Never a drawing. */
12
- export declare function Empty({ sentence, action,
13
- /** Centered for an empty list; left-aligned inside a block, where centering it
14
- * detaches it from everything else. */
15
- align, }: {
21
+ export type EmptyProps = {
16
22
  sentence: string;
17
23
  action?: ReactNode;
24
+ /** Centered for an empty list; left-aligned inside a block, where centering it
25
+ * detaches it from everything else. */
18
26
  align?: "center" | "start";
19
- }): import("react").JSX.Element;
27
+ /** A heading over the sentence, for an empty that IS the page — «Todavía no tenés pedidos» —
28
+ * rather than a quiet line inside a panel. */
29
+ title?: string;
30
+ /** A mark in a soft disc above the title: what the place holds (a cart, an invoice). */
31
+ icon?: LucideIcon;
32
+ /** The application's own art, in place of the icon: a shop's drawing, a brand's mascot. It
33
+ * is decoration — the title and the sentence carry the meaning — so it is hidden from a
34
+ * screen reader. */
35
+ illustration?: ReactNode;
36
+ };
37
+ /**
38
+ * Nothing here yet — or the filter left nothing. It is NORMAL, and it says what to do.
39
+ *
40
+ * Context: two sizes from the same piece. Bare — a sentence and maybe a button — it is the
41
+ * quiet line inside a panel (an empty chart, no attachments), as it always was. With a `title`
42
+ * and an `icon` or an `illustration` it is the empty that IS the screen — a shop's empty cart,
43
+ * a portal's «no orders yet», a module the company has not used — where a lone grey sentence
44
+ * in the middle of a white page reads as broken. The picture is never the message: it is
45
+ * hidden from a screen reader, and the title says what the drawing shows.
46
+ */
47
+ export declare function Empty({ sentence, action, align, title, icon: Icon, illustration, }: EmptyProps): import("react").JSX.Element;
20
48
  /**
21
49
  * The sentence the backend wrote, whole and verbatim.
22
50
  *
@@ -28,20 +28,59 @@ import { useEffect, useRef, useState } from "react";
28
28
  * (`StatusDot`); a second one would spend motion on a wait. The sentence is
29
29
  * for the screen reader — the bars are not the message. */
30
30
  const SKELETON_NAME = ["w-48", "w-36", "w-56", "w-40", "w-44", "w-32"];
31
- export function Skeleton({ rows = 6, label, }) {
31
+ const BAR = "rounded-control bg-ink/8";
32
+ const BAR_QUIET = "rounded-control bg-ink/5";
33
+ function SkeletonRows({ rows }) {
32
34
  const d = useDensity();
35
+ return Array.from({ length: rows }, (_, i) => (_jsxs("div", { "aria-hidden": true, className: `flex items-center ${byDensity(d, "gap-3 px-2 py-2", "gap-2 px-1.5 py-1")}`, children: [_jsx("span", { className: `h-3.5 ${BAR} ${SKELETON_NAME[i % SKELETON_NAME.length]}` }), _jsx("span", { className: `ml-auto h-3 w-14 ${BAR_QUIET}` })] }, i)));
36
+ }
37
+ /* A header and four columns: a name, two short facts, a figure on the right — the scan of a
38
+ table, so the columns land where the bars were. */
39
+ function SkeletonTable({ rows }) {
40
+ const d = useDensity();
41
+ const cell = byDensity(d, "px-3 py-2.5", "px-2 py-1.5");
42
+ return (_jsxs("div", { "aria-hidden": true, className: "flex flex-col", children: [_jsxs("div", { className: `flex items-center gap-6 border-b border-line ${cell}`, children: [_jsx("span", { className: `h-2.5 w-20 ${BAR_QUIET}` }), _jsx("span", { className: `h-2.5 w-16 ${BAR_QUIET}` }), _jsx("span", { className: `h-2.5 w-14 ${BAR_QUIET}` }), _jsx("span", { className: `ml-auto h-2.5 w-14 ${BAR_QUIET}` })] }), Array.from({ length: rows }, (_, i) => (_jsxs("div", { className: `flex items-center gap-6 border-b border-line/60 ${cell}`, children: [_jsx("span", { className: `h-3.5 ${BAR} ${SKELETON_NAME[i % SKELETON_NAME.length]}` }), _jsx("span", { className: `h-3 w-16 ${BAR_QUIET}` }), _jsx("span", { className: `h-3 w-12 ${BAR_QUIET}` }), _jsx("span", { className: `ml-auto h-3 w-16 ${BAR}` })] }, i)))] }));
43
+ }
44
+ /* Cards of the grid's width: the picture's box at the tile's proportion, a name, a figure. */
45
+ function SkeletonTiles({ rows }) {
46
+ return (_jsx("div", { "aria-hidden": true, className: "grid grid-cols-(--grid-tiles-md) gap-3 p-3", children: Array.from({ length: rows }, (_, i) => (_jsxs("div", { className: "flex flex-col gap-2 rounded-ui-record-card border border-line p-2", children: [_jsx("span", { className: `aspect-(--aspect-tile) w-full ${BAR_QUIET}` }), _jsx("span", { className: `h-3.5 w-3/4 ${BAR}` }), _jsx("span", { className: `h-3 w-1/3 ${BAR_QUIET}` })] }, i))) }));
47
+ }
48
+ /* Three lanes with a few cards each — not the real count, the board's shape. */
49
+ function SkeletonBoard() {
50
+ const cards = [3, 2, 1];
51
+ return (_jsx("div", { "aria-hidden": true, className: "flex items-start gap-3 overflow-hidden p-3", children: cards.map((n, lane) => (_jsxs("div", { className: "flex w-(--container-lane) shrink-0 flex-col gap-2 rounded-box bg-ink/3 p-2", children: [_jsx("span", { className: `h-3 w-24 ${BAR}` }), Array.from({ length: n }, (_, i) => (_jsxs("div", { className: "flex flex-col gap-2 rounded-ui-record-card border border-line bg-surface p-3", children: [_jsx("span", { className: `h-3.5 ${BAR} ${SKELETON_NAME[(lane + i) % SKELETON_NAME.length]}` }), _jsx("span", { className: `h-3 w-20 ${BAR_QUIET}` })] }, i)))] }, lane))) }));
52
+ }
53
+ /** Quiet stand-in for what has not arrived, in ITS shape.
54
+ *
55
+ * Context: the bars are the content's scan held in place — a list's name and figure, a
56
+ * table's columns, a grid's cards, a board's lanes — so the page does not jump when the data
57
+ * lands. Rows for a grid of products was a jump from lines to boxes; each presentation now
58
+ * waits in its own shape (`List` picks it). There is no shimmer: a pulse already means «this
59
+ * state is alive» (`StatusDot`), a second one would spend motion on a wait. The sentence is for
60
+ * the screen reader — the bars are not the message. */
61
+ export function Skeleton({ rows = 6, label, shape = "rows", }) {
33
62
  return (
34
63
  /* It appears late (`animate-reveal-late`): a read faster than 200ms never shows it. */
35
- _jsxs("div", { "aria-busy": "true", className: "flex animate-reveal-late flex-col", children: [_jsx("span", { className: "sr-only", children: label }), Array.from({ length: rows }, (_, i) => (_jsxs("div", { "aria-hidden": true, className: `flex items-center ${byDensity(d, "gap-3 px-2 py-2", "gap-2 px-1.5 py-1")}`, children: [_jsx("span", { className: `h-3.5 rounded-control bg-ink/8 ${SKELETON_NAME[i % SKELETON_NAME.length]}` }), _jsx("span", { className: "ml-auto h-3 w-14 rounded-control bg-ink/5" })] }, i)))] }));
64
+ _jsxs("div", { "aria-busy": "true", "data-ui": "skeleton", "data-shape": shape, className: "flex animate-reveal-late flex-col", children: [_jsx("span", { className: "sr-only", children: label }), shape === "table" ? (_jsx(SkeletonTable, { rows: rows })) : shape === "tiles" ? (_jsx(SkeletonTiles, { rows: rows })) : shape === "board" ? (_jsx(SkeletonBoard, {})) : (_jsx(SkeletonRows, { rows: rows }))] }));
36
65
  }
37
- /** What is shown when there is nothing to show: a sentence, and the gesture
38
- * that resolves it if there is one. Never a drawing. */
39
- export function Empty({ sentence, action,
40
- /** Centered for an empty list; left-aligned inside a block, where centering it
41
- * detaches it from everything else. */
42
- align = "center", }) {
66
+ /**
67
+ * Nothing here yet — or the filter left nothing. It is NORMAL, and it says what to do.
68
+ *
69
+ * Context: two sizes from the same piece. Bare — a sentence and maybe a button — it is the
70
+ * quiet line inside a panel (an empty chart, no attachments), as it always was. With a `title`
71
+ * and an `icon` or an `illustration` it is the empty that IS the screen — a shop's empty cart,
72
+ * a portal's «no orders yet», a module the company has not used — where a lone grey sentence
73
+ * in the middle of a white page reads as broken. The picture is never the message: it is
74
+ * hidden from a screen reader, and the title says what the drawing shows.
75
+ */
76
+ export function Empty({ sentence, action, align = "center", title, icon: Icon, illustration, }) {
43
77
  const centered = align === "center";
44
- return (_jsxs("div", { className: `flex flex-wrap gap-3 px-4 py-10 ${centered ? "flex-col items-center text-center" : "items-center"}`, children: [_jsx("p", { className: "max-w-short text-body text-muted", children: sentence }), action] }));
78
+ const visual = illustration !== undefined ? (_jsx("div", { "aria-hidden": true, "data-ui": "empty.visual", className: "flex max-w-48 justify-center text-muted", children: illustration })) : Icon === undefined ? null : (_jsx("span", { "aria-hidden": true, "data-ui": "empty.visual", className: "flex size-14 items-center justify-center rounded-pill bg-ink/5 text-muted", children: _jsx(Icon, { className: "size-7", strokeWidth: 1.5 }) }));
79
+ /* The bare form keeps its old shape: a sentence and its action on one wrapping line. */
80
+ if (title === undefined && visual === null) {
81
+ return (_jsxs("div", { "data-ui": "empty", className: `flex flex-wrap gap-3 px-4 py-10 ${centered ? "flex-col items-center text-center" : "items-center"}`, children: [_jsx("p", { className: "max-w-short text-body text-muted", children: sentence }), action] }));
82
+ }
83
+ return (_jsxs("div", { "data-ui": "empty", "data-size": "page", className: `flex flex-col gap-3 px-4 py-12 ${centered ? "items-center text-center" : "items-start"}`, children: [visual, _jsxs("div", { className: `flex max-w-short flex-col gap-1 ${centered ? "items-center" : ""}`, children: [title === undefined ? null : (_jsx("p", { "data-ui": "empty.title", className: "text-lead font-semibold text-ink", children: title })), _jsx("p", { className: "text-body text-muted", children: sentence })] }), action === undefined ? null : (_jsx("div", { className: `flex flex-wrap gap-2 pt-1 ${centered ? "justify-center" : ""}`, children: action }))] }));
45
84
  }
46
85
  /**
47
86
  * The sentence the backend wrote, whole and verbatim.
@@ -0,0 +1,28 @@
1
+ import type { Tone } from "../../foundations/types.js";
2
+ import { type LucideIcon } from "lucide-react";
3
+ import type { ReactNode } from "react";
4
+ export type OutcomeProps = {
5
+ /** What happened, as a sentence: «Pedido confirmado». */
6
+ title: string;
7
+ /** The ONE thing to remember, big: the order's number, the change to hand back. */
8
+ figure?: ReactNode;
9
+ /** What the figure is, read before it — «Tu número». */
10
+ figureLabel?: string;
11
+ /** What follows: «Te llamamos en pantalla cuando esté listo». */
12
+ detail?: ReactNode;
13
+ /** The way on — «Nuevo pedido». Usually one button; the screen may also move on by itself. */
14
+ action?: ReactNode;
15
+ /** `good` for a success (the default), `warn` for «done, but…», `bad` for «it did not go». */
16
+ tone?: Tone;
17
+ icon?: LucideIcon;
18
+ };
19
+ /**
20
+ * The end of an operation, said big — the screen after paying, a kiosk's «tu número es 118».
21
+ *
22
+ * Context: a toast is enough for a cashier who keeps selling; it is not for the person at a
23
+ * kiosk who walks away, nor for a checkout whose end is the page. They need the end AS the
24
+ * screen: what happened, the one figure to remember, and the way on. It is a status
25
+ * (`role="status"`): a screen reader announces it when it appears, without moving the focus
26
+ * off the action that follows.
27
+ */
28
+ export declare function Outcome({ title, figure, figureLabel, detail, action, tone, icon, }: OutcomeProps): import("react").JSX.Element;
@@ -0,0 +1,28 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { useUiCopy } from "../../foundations/copy.js";
4
+ import { CircleAlert, CircleCheck } from "lucide-react";
5
+ /* The icon's tone — and only the icon's: the sentence stays ink, so it reads at 4.5:1 on any
6
+ surface. */
7
+ const ICON_TONE = {
8
+ neutral: "text-muted",
9
+ info: "text-info",
10
+ good: "text-good",
11
+ warn: "text-warn",
12
+ bad: "text-bad",
13
+ accent: "text-primary",
14
+ };
15
+ /**
16
+ * The end of an operation, said big — the screen after paying, a kiosk's «tu número es 118».
17
+ *
18
+ * Context: a toast is enough for a cashier who keeps selling; it is not for the person at a
19
+ * kiosk who walks away, nor for a checkout whose end is the page. They need the end AS the
20
+ * screen: what happened, the one figure to remember, and the way on. It is a status
21
+ * (`role="status"`): a screen reader announces it when it appears, without moving the focus
22
+ * off the action that follows.
23
+ */
24
+ export function Outcome({ title, figure, figureLabel, detail, action, tone = "good", icon, }) {
25
+ const copy = useUiCopy();
26
+ const Icon = icon ?? (tone === "bad" || tone === "warn" ? CircleAlert : CircleCheck);
27
+ return (_jsxs("div", { role: "status", "data-ui": "outcome", "data-tone": tone, className: "flex min-w-0 flex-col items-center gap-3 px-4 py-10 text-center", children: [_jsx(Icon, { "aria-hidden": true, className: `size-12 ${ICON_TONE[tone]}`, strokeWidth: 1.75 }), _jsx("p", { className: "text-title font-semibold text-ink", children: title }), figure === undefined ? null : (_jsxs("p", { "data-ui": "outcome.figure", className: "flex flex-col items-center gap-1", children: [_jsx("span", { className: "text-meta text-muted", children: figureLabel ?? copy.outcome.figure }), _jsx("span", { className: "text-hero leading-none font-semibold text-ink tabular-nums", children: figure })] })), detail === undefined ? null : (_jsx("p", { className: "max-w-short text-body text-muted", children: detail })), action === undefined ? null : (_jsx("div", { className: "flex flex-wrap justify-center gap-2 pt-2", children: action }))] }));
28
+ }
@@ -1,4 +1,7 @@
1
+ export { Banner, type BannerProps } from "./Banner.js";
1
2
  export { Callout, type CalloutProps } from "./Callout.js";
2
3
  export { Flag, type FlagProps, type FlagTone } from "./Flag.js";
3
- export { Empty, Failed, ICONO_ROTO, Missing, Skeleton, } from "./Notice.js";
4
+ export { Empty, type EmptyProps, Failed, ICONO_ROTO, Missing, Skeleton, type SkeletonShape, } from "./Notice.js";
5
+ export { Outcome, type OutcomeProps } from "./Outcome.js";
4
6
  export { ToastProvider, type ToastSpec, useToast, useToastIfAny, } from "./Toast.js";
7
+ export { type NoticeTone } from "./tones.js";
@@ -1,6 +1,11 @@
1
1
  /* How a view says that there is nothing, that it failed, or that nobody knows
2
2
  how to draw it. */
3
+ /* A notice about the whole application, across the top of the frame (`AppFrame banner`). */
4
+ export { Banner } from "./Banner.js";
3
5
  export { Callout } from "./Callout.js";
4
6
  export { Flag } from "./Flag.js";
5
7
  export { Empty, Failed, ICONO_ROTO, Missing, Skeleton, } from "./Notice.js";
8
+ /* The END of an operation, said big: a kiosk's «tu número es 118», a paid checkout. */
9
+ export { Outcome } from "./Outcome.js";
6
10
  export { ToastProvider, useToast, useToastIfAny, } from "./Toast.js";
11
+ export {} from "./tones.js";
@@ -0,0 +1,8 @@
1
+ import type { Tone } from "../../foundations/types.js";
2
+ import { type LucideIcon } from "lucide-react";
3
+ /** The four degrees of a notice that stays on screen — `Callout` inside a view, `Banner`
4
+ * across the whole application. */
5
+ export type NoticeTone = Extract<Tone, "info" | "warn" | "bad" | "good">;
6
+ export declare const NOTICE_ICON: Record<NoticeTone, LucideIcon>;
7
+ export declare const NOTICE_SKIN: Record<NoticeTone, string>;
8
+ export declare const NOTICE_DISMISS = "hit-target -mr-1 shrink-0 rounded-control p-0.5 text-muted transition-colors duration-(--duration-instant) hover:bg-ink/6 hover:text-ink focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-primary";
@@ -0,0 +1,22 @@
1
+ import { AlertTriangle, CheckCircle2, Info, OctagonAlert, } from "lucide-react";
2
+ /* Context: one table for both, so the same urgency is painted the same way in a view and
3
+ across the frame. The icon comes from the tone and is not chosen: a red notice with a green
4
+ tick inside is a contradiction someone will write if we let them. */
5
+ export const NOTICE_ICON = {
6
+ info: Info,
7
+ warn: AlertTriangle,
8
+ bad: OctagonAlert,
9
+ good: CheckCircle2,
10
+ };
11
+ /* The background is a layer of the colour over what is below and not a colour of its own: the
12
+ notice reads on the floor and on white paper without two sets of tokens, and keeps working
13
+ the day the palette changes. The text stays ink — the tone is on the icon and the edge. */
14
+ export const NOTICE_SKIN = {
15
+ info: "border-info/25 bg-info/8 text-info",
16
+ warn: "border-warn/30 bg-warn/10 text-warn",
17
+ bad: "border-bad/25 bg-bad/8 text-bad",
18
+ good: "border-good/25 bg-good/8 text-good",
19
+ };
20
+ /* The × answers to a whole target (`hit-target`) though it is drawn at 18px, and shows where
21
+ the focus is — it had no ring, so a keyboard reached it unseen. */
22
+ export const NOTICE_DISMISS = "hit-target -mr-1 shrink-0 rounded-control p-0.5 text-muted transition-colors duration-(--duration-instant) hover:bg-ink/6 hover:text-ink focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-primary";
@@ -18,6 +18,6 @@ import { useRef } from "react";
18
18
  export function CellCopy({ children, header, numeric = false, value, }) {
19
19
  const ui = useUiCopy();
20
20
  const shown = useRef(null);
21
- const button = (_jsx("span", { "data-copy-skip": "", className: "inline-flex shrink-0 opacity-0 transition-opacity duration-(--duration-instant) group-hover/cell:opacity-100 focus-within:opacity-100 pointer-coarse:opacity-100", children: _jsx(CopyButton, { label: fillCopy(ui.copyable.field, { label: header }), value: () => value ?? (shown.current === null ? "" : shownText(shown.current)) }) }));
21
+ const button = (_jsx("span", { "data-copy-skip": "", className: "inline-flex shrink-0 opacity-0 transition-opacity duration-(--duration-instant) group-hover/cell:opacity-100 focus-within:opacity-100 touch:opacity-100", children: _jsx(CopyButton, { label: fillCopy(ui.copyable.field, { label: header }), value: () => value ?? (shown.current === null ? "" : shownText(shown.current)) }) }));
22
22
  return (_jsxs("span", { className: `group/cell flex w-full min-w-0 items-center gap-1 ${numeric ? "justify-end" : ""}`, children: [numeric ? button : null, _jsx("span", { ref: shown, className: "min-w-0", children: children }), numeric ? null : button] }));
23
23
  }
@@ -68,7 +68,7 @@ function ReportLine({ row, columns, open, onToggle, compact, }) {
68
68
  onToggle(row.id);
69
69
  }, "aria-expanded": isOpen, "aria-label": fillCopy(isOpen ? copy.report.close : copy.report.open, {
70
70
  name: row.label,
71
- }), className: "-ml-1 inline-flex size-4 shrink-0 items-center justify-center rounded-pill text-muted transition-colors duration-(--duration-instant) hover:bg-ink/8 hover:text-ink focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-primary", children: _jsx(ChevronRight, { className: `size-(--size-icon-sm) transition-transform duration-(--duration-instant) ${isOpen ? "rotate-90" : ""}`, strokeWidth: 2 }) })) : (
71
+ }), className: "hit-target -ml-1 inline-flex size-4 shrink-0 items-center justify-center rounded-pill text-muted transition-colors duration-(--duration-instant) hover:bg-ink/8 hover:text-ink focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-primary", children: _jsx(ChevronRight, { className: `size-(--size-icon-sm) transition-transform duration-(--duration-instant) ${isOpen ? "rotate-90" : ""}`, strokeWidth: 2 }) })) : (
72
72
  /* The slot for the chevron is reserved anyway: without it, a leaf
73
73
  account and a collapsible one would start on different
74
74
  verticals and the hierarchy would stop reading. */
@@ -44,7 +44,7 @@ inline = 2, }) {
44
44
  return (
45
45
  /* The row's hairline runs under its actions too: without it the separators stopped one
46
46
  column short and the actions read as outside the table. */
47
- _jsx("td", { className: `w-0 border-b border-line py-1 pr-2 pl-1 align-middle whitespace-nowrap last:rounded-r-control ${wash}`, children: _jsxs("div", { onClick: (e) => e.stopPropagation(), className: "flex items-center justify-end gap-0.5 opacity-0 transition-opacity duration-(--duration-instant) group-hover/row:opacity-100 focus-within:opacity-100 pointer-coarse:opacity-100", children: [ways.length === 0 ? null : (_jsx("span", { "data-ui": "row.ways", "data-look": pill ? "pill" : "plain", className: `flex items-center gap-0.5 ${pill ? "rounded-pill border border-primary/20 bg-primary/8 p-0.5" : ""}`, children: ways.map((way) => (_jsx(WayButton, { way: way, pill: pill }, way.id))) })), inlineActions.map((a) => (_jsx(IconButton, { icon: a.icon, label: a.label, size: "sm", ...(a.tone === undefined ? {} : { tone: a.tone }), ...(a.disabled === undefined ? {} : { disabled: a.disabled }), onClick: a.onSelect }, a.id))), overflow.length === 0 ? null : (_jsx(Menu, { label: copy.selection.more, icon: MoreHorizontal, iconOnly: true, chevron: false, align: "end", groups: [
47
+ _jsx("td", { className: `w-0 border-b border-line py-1 pr-2 pl-1 align-middle whitespace-nowrap last:rounded-r-control ${wash}`, children: _jsxs("div", { onClick: (e) => e.stopPropagation(), className: "flex items-center justify-end gap-0.5 opacity-0 transition-opacity duration-(--duration-instant) group-hover/row:opacity-100 focus-within:opacity-100 touch:opacity-100", children: [ways.length === 0 ? null : (_jsx("span", { "data-ui": "row.ways", "data-look": pill ? "pill" : "plain", className: `flex items-center gap-0.5 ${pill ? "rounded-pill border border-primary/20 bg-primary/8 p-0.5" : ""}`, children: ways.map((way) => (_jsx(WayButton, { way: way, pill: pill }, way.id))) })), inlineActions.map((a) => (_jsx(IconButton, { icon: a.icon, label: a.label, size: "sm", ...(a.tone === undefined ? {} : { tone: a.tone }), ...(a.disabled === undefined ? {} : { disabled: a.disabled }), onClick: a.onSelect }, a.id))), overflow.length === 0 ? null : (_jsx(Menu, { label: copy.selection.more, icon: MoreHorizontal, iconOnly: true, chevron: false, align: "end", groups: [
48
48
  {
49
49
  options: overflow.map((a) => ({
50
50
  id: a.id,