@sincpro/web-ui 2.11.0 → 2.13.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 (207) hide show
  1. package/README.md +77 -20
  2. package/dist/components/activity/Messages.d.ts +3 -23
  3. package/dist/components/activity/Messages.js +3 -17
  4. package/dist/components/activity/index.d.ts +2 -1
  5. package/dist/components/activity/index.js +2 -1
  6. package/dist/components/activity/messageKind.d.ts +23 -0
  7. package/dist/components/activity/messageKind.js +17 -0
  8. package/dist/components/assist/assist.d.ts +1 -1
  9. package/dist/components/assist/assist.js +1 -1
  10. package/dist/components/frame/model.js +1 -1
  11. package/dist/components/guide/index.d.ts +2 -1
  12. package/dist/components/guide/index.js +2 -1
  13. package/dist/components/guide/selector.d.ts +25 -0
  14. package/dist/components/guide/selector.js +14 -0
  15. package/dist/components/guide/target.d.ts +3 -25
  16. package/dist/components/guide/target.js +2 -14
  17. package/dist/components/index.d.ts +1 -0
  18. package/dist/components/index.js +1 -0
  19. package/dist/components/listing/AxisLevels.d.ts +2 -5
  20. package/dist/components/listing/AxisLevels.js +5 -22
  21. package/dist/components/listing/BoardColumns.js +10 -6
  22. package/dist/components/listing/ColumnsMenu.d.ts +3 -7
  23. package/dist/components/listing/ColumnsMenu.js +4 -8
  24. package/dist/components/listing/Listing.js +3 -1
  25. package/dist/components/listing/ListingBar.d.ts +16 -94
  26. package/dist/components/listing/ListingBar.js +24 -2
  27. package/dist/components/listing/RecordCard.d.ts +41 -3
  28. package/dist/components/listing/RecordCard.js +63 -22
  29. package/dist/components/listing/Row.js +5 -2
  30. package/dist/components/listing/collapsed.d.ts +2 -0
  31. package/dist/components/listing/collapsed.js +8 -0
  32. package/dist/components/listing/columnSpecs.d.ts +34 -0
  33. package/dist/components/listing/columnSpecs.js +54 -0
  34. package/dist/components/listing/columns.d.ts +3 -21
  35. package/dist/components/listing/columns.js +2 -39
  36. package/dist/components/listing/index.d.ts +11 -7
  37. package/dist/components/listing/index.js +15 -8
  38. package/dist/components/listing/levels.d.ts +9 -0
  39. package/dist/components/listing/levels.js +27 -0
  40. package/dist/components/listing/pageSizes.d.ts +9 -0
  41. package/dist/components/listing/pageSizes.js +11 -0
  42. package/dist/components/listing/pages.d.ts +2 -9
  43. package/dist/components/listing/pages.js +5 -9
  44. package/dist/components/listing/set.d.ts +1 -1
  45. package/dist/components/listing/tree.d.ts +2 -1
  46. package/dist/components/listing/tree.js +4 -5
  47. package/dist/components/preview/FilePreview.d.ts +3 -3
  48. package/dist/components/preview/FilePreview.js +3 -15
  49. package/dist/components/preview/index.d.ts +2 -1
  50. package/dist/components/preview/index.js +2 -1
  51. package/dist/components/preview/previewKind.d.ts +3 -0
  52. package/dist/components/preview/previewKind.js +17 -0
  53. package/dist/components/receipt/Receipt.d.ts +51 -0
  54. package/dist/components/receipt/Receipt.js +23 -0
  55. package/dist/components/receipt/index.d.ts +1 -0
  56. package/dist/components/receipt/index.js +3 -0
  57. package/dist/components/search/CriteriaChips.js +5 -3
  58. package/dist/components/search/FilterBuilder.d.ts +5 -139
  59. package/dist/components/search/FilterBuilder.js +5 -579
  60. package/dist/components/search/JsonEditor.d.ts +2 -8
  61. package/dist/components/search/JsonEditor.js +5 -15
  62. package/dist/components/search/RuleValue.d.ts +2 -2
  63. package/dist/components/search/RuleValue.js +5 -4
  64. package/dist/components/search/datePeriods.js +1 -1
  65. package/dist/components/search/filterTree.d.ts +183 -0
  66. package/dist/components/search/filterTree.js +570 -0
  67. package/dist/components/search/formatJson.d.ts +8 -0
  68. package/dist/components/search/formatJson.js +17 -0
  69. package/dist/components/search/index.d.ts +5 -3
  70. package/dist/components/search/index.js +7 -3
  71. package/dist/components/search/query.js +1 -1
  72. package/dist/components/shell/KioskFrame.d.ts +35 -0
  73. package/dist/components/shell/KioskFrame.js +39 -0
  74. package/dist/components/shell/SearchEntry.js +1 -1
  75. package/dist/components/shell/index.d.ts +1 -0
  76. package/dist/components/shell/index.js +1 -0
  77. package/dist/foundations/calendar.js +1 -1
  78. package/dist/foundations/catalog.d.ts +7 -8
  79. package/dist/foundations/catalog.js +10 -35
  80. package/dist/foundations/chart.js +1 -1
  81. package/dist/foundations/clock.d.ts +3 -0
  82. package/dist/foundations/clock.js +41 -0
  83. package/dist/foundations/controlName.d.ts +12 -0
  84. package/dist/foundations/controlName.js +14 -0
  85. package/dist/foundations/copy.d.ts +3 -1130
  86. package/dist/foundations/copy.es.d.ts +1 -1
  87. package/dist/foundations/copy.es.js +26 -0
  88. package/dist/foundations/copy.js +13 -747
  89. package/dist/foundations/copyStore.d.ts +21 -0
  90. package/dist/foundations/copyStore.js +47 -0
  91. package/dist/foundations/density.d.ts +4 -8
  92. package/dist/foundations/density.js +2 -9
  93. package/dist/foundations/form.d.ts +2 -12
  94. package/dist/foundations/form.js +4 -14
  95. package/dist/foundations/idle.d.ts +1 -0
  96. package/dist/foundations/idle.js +34 -0
  97. package/dist/foundations/index.d.ts +21 -11
  98. package/dist/foundations/index.js +28 -11
  99. package/dist/foundations/keys.d.ts +8 -0
  100. package/dist/foundations/keys.js +6 -0
  101. package/dist/foundations/pickBy.d.ts +16 -0
  102. package/dist/foundations/pickBy.js +17 -0
  103. package/dist/foundations/pivotSheet.js +0 -0
  104. package/dist/foundations/pointer.d.ts +25 -0
  105. package/dist/foundations/pointer.js +28 -0
  106. package/dist/foundations/shortcut.d.ts +3 -9
  107. package/dist/foundations/shortcut.js +2 -7
  108. package/dist/foundations/sticky.d.ts +2 -6
  109. package/dist/foundations/sticky.js +5 -8
  110. package/dist/foundations/stickyStyle.d.ts +12 -0
  111. package/dist/foundations/stickyStyle.js +13 -0
  112. package/dist/foundations/surface.d.ts +2 -2
  113. package/dist/foundations/surface.js +4 -2
  114. package/dist/foundations/theme.d.ts +3 -13
  115. package/dist/foundations/theme.js +2 -15
  116. package/dist/foundations/themeChoice.d.ts +19 -0
  117. package/dist/foundations/themeChoice.js +22 -0
  118. package/dist/foundations/types.d.ts +3 -0
  119. package/dist/foundations/uiCopy.d.ts +1173 -0
  120. package/dist/foundations/uiCopy.js +775 -0
  121. package/dist/foundations/xlsx.d.ts +4 -10
  122. package/dist/foundations/xlsx.js +0 -0
  123. package/dist/foundations/xlsxDownload.d.ts +8 -0
  124. package/dist/foundations/xlsxDownload.js +28 -0
  125. package/dist/primitives/button/Button.d.ts +3 -15
  126. package/dist/primitives/button/Button.js +2 -65
  127. package/dist/primitives/button/classes.d.ts +21 -0
  128. package/dist/primitives/button/classes.js +65 -0
  129. package/dist/primitives/button/index.d.ts +2 -1
  130. package/dist/primitives/button/index.js +3 -1
  131. package/dist/primitives/choice/RadioGroup.d.ts +8 -1
  132. package/dist/primitives/choice/RadioGroup.js +9 -1
  133. package/dist/primitives/choice/options.d.ts +3 -0
  134. package/dist/primitives/field/Field.d.ts +2 -6
  135. package/dist/primitives/field/Field.js +4 -10
  136. package/dist/primitives/field/Keypad.d.ts +43 -0
  137. package/dist/primitives/field/Keypad.js +62 -0
  138. package/dist/primitives/field/Stepper.d.ts +28 -0
  139. package/dist/primitives/field/Stepper.js +52 -0
  140. package/dist/primitives/field/classes.d.ts +6 -0
  141. package/dist/primitives/field/classes.js +13 -0
  142. package/dist/primitives/field/clipboard.js +1 -1
  143. package/dist/primitives/field/index.d.ts +5 -1
  144. package/dist/primitives/field/index.js +9 -1
  145. package/dist/primitives/field/keypadKeys.d.ts +24 -0
  146. package/dist/primitives/field/keypadKeys.js +80 -0
  147. package/dist/primitives/hint/Hint.js +1 -1
  148. package/dist/primitives/menu/Menu.d.ts +2 -19
  149. package/dist/primitives/menu/Menu.js +4 -30
  150. package/dist/primitives/menu/classes.d.ts +18 -0
  151. package/dist/primitives/menu/classes.js +33 -0
  152. package/dist/primitives/menu/index.d.ts +2 -1
  153. package/dist/primitives/menu/index.js +3 -1
  154. package/dist/primitives/notice/Flag.js +1 -1
  155. package/dist/primitives/notice/Outcome.d.ts +28 -0
  156. package/dist/primitives/notice/Outcome.js +28 -0
  157. package/dist/primitives/notice/index.d.ts +1 -0
  158. package/dist/primitives/notice/index.js +2 -0
  159. package/dist/primitives/table/CellCopy.js +1 -1
  160. package/dist/primitives/table/EditableTable.d.ts +3 -37
  161. package/dist/primitives/table/EditableTable.js +2 -47
  162. package/dist/primitives/table/ReportTable.js +1 -1
  163. package/dist/primitives/table/RowActions.js +1 -1
  164. package/dist/primitives/table/Table.d.ts +2 -4
  165. package/dist/primitives/table/Table.js +13 -16
  166. package/dist/primitives/table/cellTone.d.ts +5 -0
  167. package/dist/primitives/table/cellTone.js +13 -0
  168. package/dist/primitives/table/editRules.d.ts +43 -0
  169. package/dist/primitives/table/editRules.js +53 -0
  170. package/dist/primitives/table/index.d.ts +4 -2
  171. package/dist/primitives/table/index.js +4 -2
  172. package/dist/primitives/tag/Count.d.ts +2 -3
  173. package/dist/primitives/tag/Count.js +4 -5
  174. package/dist/primitives/tag/Tags.d.ts +22 -1
  175. package/dist/primitives/tag/Tags.js +57 -14
  176. package/dist/primitives/tag/countText.d.ts +3 -0
  177. package/dist/primitives/tag/countText.js +7 -0
  178. package/dist/primitives/tag/index.d.ts +3 -2
  179. package/dist/primitives/tag/index.js +2 -1
  180. package/dist/primitives/value/DateValue.d.ts +2 -5
  181. package/dist/primitives/value/DateValue.js +6 -44
  182. package/dist/primitives/value/Elapsed.d.ts +16 -0
  183. package/dist/primitives/value/Elapsed.js +37 -0
  184. package/dist/primitives/value/Meter.d.ts +3 -8
  185. package/dist/primitives/value/Meter.js +2 -9
  186. package/dist/primitives/value/RichText.d.ts +2 -4
  187. package/dist/primitives/value/RichText.js +5 -20
  188. package/dist/primitives/value/Value.d.ts +10 -7
  189. package/dist/primitives/value/Value.js +7 -24
  190. package/dist/primitives/value/elapsedTime.d.ts +26 -0
  191. package/dist/primitives/value/elapsedTime.js +32 -0
  192. package/dist/primitives/value/format.d.ts +16 -0
  193. package/dist/primitives/value/format.js +81 -0
  194. package/dist/primitives/value/index.d.ts +9 -4
  195. package/dist/primitives/value/index.js +13 -4
  196. package/dist/primitives/value/meterLevel.d.ts +10 -0
  197. package/dist/primitives/value/meterLevel.js +12 -0
  198. package/dist/primitives/value/richTextPlain.d.ts +4 -0
  199. package/dist/primitives/value/richTextPlain.js +23 -0
  200. package/dist/tokens.css +87 -1
  201. package/dist/views/list/List.d.ts +11 -0
  202. package/dist/views/list/List.js +14 -3
  203. package/dist/views/list/ListView.d.ts +1 -1
  204. package/dist/views/list/ListView.js +26 -6
  205. package/dist/views/list/types.d.ts +7 -0
  206. package/dist/views/record/Record.js +1 -1
  207. package/package.json +1 -1
@@ -10,16 +10,24 @@ export { CardCodeInput, CardExpiryInput, CardNumberInput, } from "./CardNumberIn
10
10
  /* An address to reach someone: typed with its keyboard, read as a link. */
11
11
  export { Checkbox, CheckList, CheckMark, } from "./Checks.js";
12
12
  export { CodeInput } from "./CodeInput.js";
13
+ /* THE PAD — a till's or a kiosk's on-screen numbers. Its rules are pure (`keypadKeys.ts`), so a
14
+ physical keyboard or a test applies the same. */
13
15
  export { ColorInput } from "./ColorInput.js";
14
16
  export { emailHref, isEmail, isUrl, telHref, urlHref, urlLabel, whatsappHref, } from "./contact.js";
15
17
  export { EmailInput, PhoneInput, UrlInput, } from "./ContactInputs.js";
18
+ export { Keypad } from "./Keypad.js";
19
+ /* A QUANTITY pressed, not typed — a cart's line, a kiosk's item. */
20
+ export { applyKey, isKeypadKey, keyOfKeyboard, } from "./keypadKeys.js";
21
+ export { Stepper } from "./Stepper.js";
16
22
  /* The copy button every field carries by its label — on by default, off by field or by form. */
17
23
  export { FieldCopyProvider, shownText, useFieldCopy, } from "./clipboard.js";
18
24
  export { DropZone } from "./DropZone.js";
19
25
  /* A duration in hours, read «8:30». */
20
26
  export { formatDuration, parseDuration } from "./duration.js";
21
27
  export { DurationInput } from "./DurationInput.js";
22
- export { controlClasses, DataField, Field, NumberInput, ReadValue, Select, TextArea, TextInput, } from "./Field.js";
28
+ /* The look every control shares, without `"use client"`: a server component calls it. */
29
+ export { controlClasses } from "./classes.js";
30
+ export { DataField, Field, NumberInput, ReadValue, Select, TextArea, TextInput, } from "./Field.js";
23
31
  /* An image the record holds (chosen, dropped, pasted, cropped) and a signature (drawn or typed). */
24
32
  export { ImageInput } from "./ImageInput.js";
25
33
  export { FieldLayoutProvider, useSheetLayout, } from "./layout.js";
@@ -0,0 +1,24 @@
1
+ /**
2
+ * WHAT A KEY OF THE PAD DOES TO THE NUMBER BEING TYPED — pure, so a test, a server or a
3
+ * keyboard handler applies the same rules as the on-screen pad (`Keypad`).
4
+ *
5
+ * Context: a till types quantities, discounts and prices with a thumb. The text is kept in
6
+ * the machine's form — digits, one «.», an optional leading «-» — and the screen formats it
7
+ * in the person's locale: what travels is «1250.5», what is read is «1.250,5». The rules
8
+ * are the ones a cashier expects from a calculator: «0» then «5» is «5», not «05»; a second
9
+ * decimal point does nothing; past the allowed decimals a digit does nothing; ⌫ on «-» leaves
10
+ * nothing.
11
+ */
12
+ export type KeypadKey = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "00" | "decimal" | "backspace" | "clear" | "sign";
13
+ export type KeypadRules = {
14
+ /** How many decimals the number takes — `0` for a quantity of units, `2` for money. A
15
+ * digit past them does nothing. Without it, any. */
16
+ decimals?: number;
17
+ };
18
+ /** True for a key of the pad: what comes from a physical keyboard is a string. */
19
+ export declare function isKeypadKey(key: string): key is KeypadKey;
20
+ /** The text after pressing `key`. */
21
+ export declare function applyKey(text: string, key: KeypadKey, rules?: KeypadRules): string;
22
+ /** The key a physical keyboard's key stands for, or `null`: digits, «.» and «,» (the decimal
23
+ * point whatever the locale), Backspace, Delete / Escape (clear), «-» (sign). */
24
+ export declare function keyOfKeyboard(key: string): KeypadKey | null;
@@ -0,0 +1,80 @@
1
+ /**
2
+ * WHAT A KEY OF THE PAD DOES TO THE NUMBER BEING TYPED — pure, so a test, a server or a
3
+ * keyboard handler applies the same rules as the on-screen pad (`Keypad`).
4
+ *
5
+ * Context: a till types quantities, discounts and prices with a thumb. The text is kept in
6
+ * the machine's form — digits, one «.», an optional leading «-» — and the screen formats it
7
+ * in the person's locale: what travels is «1250.5», what is read is «1.250,5». The rules
8
+ * are the ones a cashier expects from a calculator: «0» then «5» is «5», not «05»; a second
9
+ * decimal point does nothing; past the allowed decimals a digit does nothing; ⌫ on «-» leaves
10
+ * nothing.
11
+ */
12
+ const DIGITS = new Set(["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]);
13
+ /** True for a key of the pad: what comes from a physical keyboard is a string. */
14
+ export function isKeypadKey(key) {
15
+ return (DIGITS.has(key) ||
16
+ key === "00" ||
17
+ key === "decimal" ||
18
+ key === "backspace" ||
19
+ key === "clear" ||
20
+ key === "sign");
21
+ }
22
+ function appendDigits(text, digits, rules) {
23
+ let next = text;
24
+ for (const digit of digits) {
25
+ const sign = next.startsWith("-") ? "-" : "";
26
+ const body = next.slice(sign.length);
27
+ const point = body.indexOf(".");
28
+ if (point >= 0 &&
29
+ rules.decimals !== undefined &&
30
+ body.length - point - 1 >= rules.decimals) {
31
+ return next;
32
+ }
33
+ /* A lone zero is replaced, not prefixed: «0» then «5» is «5». */
34
+ next = body === "0" ? `${sign}${digit}` : `${next}${digit}`;
35
+ }
36
+ return next;
37
+ }
38
+ /** The text after pressing `key`. */
39
+ export function applyKey(text, key, rules = {}) {
40
+ if (key === "clear")
41
+ return "";
42
+ if (key === "backspace") {
43
+ const next = text.slice(0, -1);
44
+ return next === "-" ? "" : next;
45
+ }
46
+ if (key === "sign") {
47
+ if (text === "")
48
+ return text;
49
+ return text.startsWith("-") ? text.slice(1) : `-${text}`;
50
+ }
51
+ if (key === "decimal") {
52
+ if (rules.decimals === 0 || text.includes("."))
53
+ return text;
54
+ const sign = text.startsWith("-") ? "-" : "";
55
+ const body = text.slice(sign.length);
56
+ return `${sign}${body === "" ? "0" : body}.`;
57
+ }
58
+ if (key === "00") {
59
+ /* Two zeros on nothing is still nothing typed: «00» is how a cashier writes hundreds. */
60
+ if (text === "" || text === "-" || text === "0")
61
+ return text;
62
+ return appendDigits(text, "00", rules);
63
+ }
64
+ return appendDigits(text, key, rules);
65
+ }
66
+ /** The key a physical keyboard's key stands for, or `null`: digits, «.» and «,» (the decimal
67
+ * point whatever the locale), Backspace, Delete / Escape (clear), «-» (sign). */
68
+ export function keyOfKeyboard(key) {
69
+ if (DIGITS.has(key))
70
+ return key;
71
+ if (key === "." || key === ",")
72
+ return "decimal";
73
+ if (key === "Backspace")
74
+ return "backspace";
75
+ if (key === "Delete" || key === "Escape")
76
+ return "clear";
77
+ if (key === "-")
78
+ return "sign";
79
+ return null;
80
+ }
@@ -6,7 +6,7 @@ import { CircleHelp } from "lucide-react";
6
6
  import { useId } from "react";
7
7
  import { Button, Dialog, DialogTrigger } from "react-aria-components";
8
8
  const mark = tv({
9
- base: "inline-flex size-4 shrink-0 cursor-help items-center justify-center rounded-pill text-muted outline-0 transition-colors duration-(--duration-instant) hover:bg-ink/8 hover:text-ink aria-expanded:bg-ink/8 aria-expanded:text-ink forced-colors:text-[ButtonText]",
9
+ base: "hit-target inline-flex size-4 shrink-0 cursor-help items-center justify-center rounded-pill text-muted outline-0 transition-colors duration-(--duration-instant) hover:bg-ink/8 hover:text-ink aria-expanded:bg-ink/8 aria-expanded:text-ink forced-colors:text-[ButtonText]",
10
10
  variants: {
11
11
  isFocusVisible: {
12
12
  true: "outline-2 outline-offset-1 outline-primary forced-colors:outline-[Highlight]",
@@ -1,4 +1,5 @@
1
1
  import { type ButtonRole, type ButtonSize } from "../button/Button.js";
2
+ import { menuTriggerClasses } from "./classes.js";
2
3
  import type { LucideIcon } from "lucide-react";
3
4
  import { type ReactNode } from "react";
4
5
  import { type Key } from "react-aria-components";
@@ -74,24 +75,7 @@ declare const WIDTH: {
74
75
  /** Every option of the tree by id, children included: a submenu is a separate React Aria
75
76
  * menu with its own `onAction`, and both have to reach the same handlers. */
76
77
  export declare function indexOptions(options: readonly MenuOption[], into?: Map<string, MenuOption>): Map<string, MenuOption>;
77
- /**
78
- * The look of a list control's trigger — «Filtros ▾», «Columnas ▾», «Ordenar ▾» — without
79
- * the menu.
80
- *
81
- * Context: a control of the bar that opens a PANEL and not a list of options (the sort
82
- * criteria) still has to look like its neighbours; copying these classes is how the third
83
- * trigger ends up one pixel off. Same reason `buttonClasses` exists.
84
- */
85
- export declare function menuTriggerClasses({ variant, surface, active, current, open, focusVisible, iconOnly, }: {
86
- variant?: "button" | "text";
87
- surface?: "canvas" | "chrome";
88
- active?: boolean;
89
- /** The screen on view is inside this menu: a bar under the label. */
90
- current?: boolean;
91
- open?: boolean;
92
- focusVisible?: boolean;
93
- iconOnly?: boolean;
94
- }): string;
78
+ export { menuTriggerClasses };
95
79
  export declare function Menu({ label, groups, onSelect, surface, align, icon: Trigger,
96
80
  /** The menu as a control of a list ("filters ▾") carries the chevron; the
97
81
  * actions `⋯` does not, because the icon already says there is more. */
@@ -164,4 +148,3 @@ export declare function MenuList({ label, groups, onAction, closeOnSelect, empty
164
148
  /** `false` shows every `collapsible` section open — under a search box. */
165
149
  foldable?: boolean;
166
150
  }): import("react").JSX.Element;
167
- export {};
@@ -2,6 +2,7 @@
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { useUiCopy } from "../../foundations/copy.js";
4
4
  import { buttonClasses, } from "../button/Button.js";
5
+ import { menuTriggerClasses } from "./classes.js";
5
6
  import { Popover } from "../overlay/Popover.js";
6
7
  import { Count } from "../tag/Count.js";
7
8
  import { Check, ChevronDown, ChevronRight } from "lucide-react";
@@ -39,36 +40,9 @@ export function indexOptions(options, into = new Map()) {
39
40
  }
40
41
  return into;
41
42
  }
42
- /**
43
- * The look of a list control's trigger — «Filtros ▾», «Columnas ▾», «Ordenar ▾» — without
44
- * the menu.
45
- *
46
- * Context: a control of the bar that opens a PANEL and not a list of options (the sort
47
- * criteria) still has to look like its neighbours; copying these classes is how the third
48
- * trigger ends up one pixel off. Same reason `buttonClasses` exists.
49
- */
50
- export function menuTriggerClasses({ variant = "button", surface = "canvas", active = false, current = false, open = false, focusVisible = false, iconOnly = false, }) {
51
- /* `text` is the menu of a BAR: no frame and no background, just the highlight
52
- on hover. Five bordered menus on top of an application are five buttons
53
- competing with the ones in the view, and the bar stops reading as an index.
54
- `button` is the menu of a CONTROL —"filters ▾", "group ▾"—, and there the
55
- frame is what says it can be pressed. */
56
- const tone = variant === "text"
57
- ? surface === "chrome"
58
- ? `border-transparent text-chrome-muted hover:bg-chrome-ink/12 hover:text-chrome-ink ${active || open ? "bg-chrome-ink/12 text-chrome-ink" : ""}`
59
- : `border-transparent text-muted hover:bg-ink/6 hover:text-ink ${active || open ? "bg-ink/6 text-ink" : ""}`
60
- : surface === "chrome"
61
- ? `border-chrome-muted/35 bg-chrome-raised text-chrome-ink hover:border-chrome-accent/45 ${active ? "border-chrome-accent/60" : ""}`
62
- : `border-line-strong bg-surface hover:border-primary/45 hover:bg-primary/5 ${active ? "border-primary/60 text-primary" : "text-ink"}`;
63
- /* «Here» is a SHAPE under the label, in the colour that marks the place on each surface:
64
- the gold on the chrome (where it is legible, 6.70:1), the navy on the canvas. */
65
- const here = current
66
- ? `relative after:absolute after:inset-x-2.5 after:bottom-0.5 after:h-0.5 after:rounded-pill ${surface === "chrome"
67
- ? "text-chrome-ink after:bg-chrome-accent"
68
- : "text-ink after:bg-primary"}`
69
- : "";
70
- return `inline-flex h-(--size-control-sm) shrink-0 cursor-default items-center gap-1.5 border text-micro font-medium whitespace-nowrap outline-0 transition-colors duration-(--duration-instant) ${focusVisible ? "outline-2 outline-offset-2 outline-primary" : ""} ${iconOnly ? "w-(--size-control-sm) justify-center rounded-pill" : "rounded-control px-2.5"} ${tone} ${here}`;
71
- }
43
+ /* `menuTriggerClasses` is a plain function (`classes.ts`), without the directive, so a server
44
+ component reads it; re-exported so every path that read it here keeps reading it. */
45
+ export { menuTriggerClasses };
72
46
  export function Menu({ label, groups, onSelect, surface = "canvas", align = "start", icon: Trigger,
73
47
  /** The menu as a control of a list ("filters ▾") carries the chevron; the
74
48
  * actions `⋯` does not, because the icon already says there is more. */
@@ -0,0 +1,18 @@
1
+ /**
2
+ * The look of a list control's trigger — «Filtros ▾», «Columnas ▾», «Ordenar ▾» — without
3
+ * the menu.
4
+ *
5
+ * Context: a control of the bar that opens a PANEL and not a list of options (the sort
6
+ * criteria) still has to look like its neighbours; copying these classes is how the third
7
+ * trigger ends up one pixel off. Same reason `buttonClasses` exists.
8
+ */
9
+ export declare function menuTriggerClasses({ variant, surface, active, current, open, focusVisible, iconOnly, }: {
10
+ variant?: "button" | "text";
11
+ surface?: "canvas" | "chrome";
12
+ active?: boolean;
13
+ /** The screen on view is inside this menu: a bar under the label. */
14
+ current?: boolean;
15
+ open?: boolean;
16
+ focusVisible?: boolean;
17
+ iconOnly?: boolean;
18
+ }): string;
@@ -0,0 +1,33 @@
1
+ /* Without `"use client"`: `Menu.tsx` carries it, and a React Server Components bundler turns
2
+ every export of a client module into a client reference — a class string asked for on the
3
+ server came back as a reference. */
4
+ /**
5
+ * The look of a list control's trigger — «Filtros ▾», «Columnas ▾», «Ordenar ▾» — without
6
+ * the menu.
7
+ *
8
+ * Context: a control of the bar that opens a PANEL and not a list of options (the sort
9
+ * criteria) still has to look like its neighbours; copying these classes is how the third
10
+ * trigger ends up one pixel off. Same reason `buttonClasses` exists.
11
+ */
12
+ export function menuTriggerClasses({ variant = "button", surface = "canvas", active = false, current = false, open = false, focusVisible = false, iconOnly = false, }) {
13
+ /* `text` is the menu of a BAR: no frame and no background, just the highlight
14
+ on hover. Five bordered menus on top of an application are five buttons
15
+ competing with the ones in the view, and the bar stops reading as an index.
16
+ `button` is the menu of a CONTROL —"filters ▾", "group ▾"—, and there the
17
+ frame is what says it can be pressed. */
18
+ const tone = variant === "text"
19
+ ? surface === "chrome"
20
+ ? `border-transparent text-chrome-muted hover:bg-chrome-ink/12 hover:text-chrome-ink ${active || open ? "bg-chrome-ink/12 text-chrome-ink" : ""}`
21
+ : `border-transparent text-muted hover:bg-ink/6 hover:text-ink ${active || open ? "bg-ink/6 text-ink" : ""}`
22
+ : surface === "chrome"
23
+ ? `border-chrome-muted/35 bg-chrome-raised text-chrome-ink hover:border-chrome-accent/45 ${active ? "border-chrome-accent/60" : ""}`
24
+ : `border-line-strong bg-surface hover:border-primary/45 hover:bg-primary/5 ${active ? "border-primary/60 text-primary" : "text-ink"}`;
25
+ /* «Here» is a SHAPE under the label, in the colour that marks the place on each surface:
26
+ the gold on the chrome (where it is legible, 6.70:1), the navy on the canvas. */
27
+ const here = current
28
+ ? `relative after:absolute after:inset-x-2.5 after:bottom-0.5 after:h-0.5 after:rounded-pill ${surface === "chrome"
29
+ ? "text-chrome-ink after:bg-chrome-accent"
30
+ : "text-ink after:bg-primary"}`
31
+ : "";
32
+ return `inline-flex h-(--size-control-sm) shrink-0 cursor-default items-center gap-1.5 border text-micro font-medium whitespace-nowrap outline-0 transition-colors duration-(--duration-instant) ${focusVisible ? "outline-2 outline-offset-2 outline-primary" : ""} ${iconOnly ? "w-(--size-control-sm) justify-center rounded-pill" : "rounded-control px-2.5"} ${tone} ${here}`;
33
+ }
@@ -1 +1,2 @@
1
- export { Menu, type MenuGroup, type MenuOption, menuTriggerClasses, } from "./Menu.js";
1
+ export { Menu, type MenuGroup, type MenuOption } from "./Menu.js";
2
+ export { menuTriggerClasses } from "./classes.js";
@@ -1,2 +1,4 @@
1
1
  /* A data-driven dropdown: the actions `⋯` and "+ Create". */
2
- export { Menu, menuTriggerClasses, } from "./Menu.js";
2
+ export { Menu } from "./Menu.js";
3
+ /* A trigger's look without the menu, without `"use client"`: a server component calls it. */
4
+ export { menuTriggerClasses } from "./classes.js";
@@ -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",
@@ -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,5 @@
1
1
  export { Callout, type CalloutProps } from "./Callout.js";
2
2
  export { Flag, type FlagProps, type FlagTone } from "./Flag.js";
3
3
  export { Empty, Failed, ICONO_ROTO, Missing, Skeleton, } from "./Notice.js";
4
+ export { Outcome, type OutcomeProps } from "./Outcome.js";
4
5
  export { ToastProvider, type ToastSpec, useToast, useToastIfAny, } from "./Toast.js";
@@ -3,4 +3,6 @@
3
3
  export { Callout } from "./Callout.js";
4
4
  export { Flag } from "./Flag.js";
5
5
  export { Empty, Failed, ICONO_ROTO, Missing, Skeleton, } from "./Notice.js";
6
+ /* The END of an operation, said big: a kiosk's «tu número es 118», a paid checkout. */
7
+ export { Outcome } from "./Outcome.js";
6
8
  export { ToastProvider, useToast, useToastIfAny, } from "./Toast.js";
@@ -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
  }
@@ -1,10 +1,10 @@
1
1
  import { type Grouping } from "../../foundations/grouping.js";
2
2
  import { type FlagProps } from "../notice/Flag.js";
3
+ import { sectionLines, type StackPlace, stackPlaces, type TabTarget, tabTarget } from "./editRules.js";
3
4
  import { type WindowedRow } from "./rowWindow.js";
4
5
  import { type ReactNode } from "react";
5
- /** Where a column goes when the row is drawn as a stacked card (a narrow box).
6
- * `trail` sits at the top right, beside the title — a state, the row's buttons. */
7
- export type StackPlace = "title" | "detail" | "amount" | "trail" | "hidden";
6
+ export type { StackPlace, TabTarget };
7
+ export { sectionLines, stackPlaces, tabTarget };
8
8
  /** How the rows are drawn: `auto` measures the box and stacks them below
9
9
  * `--container-handheld`; `table` and `stacked` force one — a side panel that is
10
10
  * always narrow, a test that has no box to measure. */
@@ -84,43 +84,9 @@ export type EditAdd = {
84
84
  /** As `onAdd`: return the new row's id and it opens. */
85
85
  onAdd: () => string | void | Promise<string | void>;
86
86
  };
87
- /** The lines each section heads: the rows after it up to the next section. Notes do not
88
- * cut a section, and are not lines. */
89
- export declare function sectionLines<T>(rows: readonly T[], getRowId: (row: T) => string, kind: (row: T) => "section" | "note" | null): Map<string, T[]>;
90
- /**
91
- * Where each column goes in the stacked card, defaults resolved: a declared `stack`
92
- * wins; otherwise the first undeclared column is the title (unless one was declared),
93
- * the last undeclared numeric one is the amount (unless one was declared), and the rest
94
- * are detail.
95
- */
96
- export declare function stackPlaces(columns: readonly {
97
- stack?: StackPlace;
98
- numeric?: boolean;
99
- }[]): StackPlace[];
100
87
  /** The first control of a row being edited: the first one in an editable cell, else
101
88
  * anything focusable in the row (a column without `edit` may still hold a button). */
102
89
  export declare function firstControl(row: HTMLElement): HTMLElement | null;
103
- /** Where `Tab` goes from the edge of an edited row: the next or previous row opened, a new
104
- * row added, or out of the table the browser's way. */
105
- export type TabTarget = {
106
- kind: "row";
107
- id: string;
108
- } | {
109
- kind: "add";
110
- } | {
111
- kind: "leave";
112
- };
113
- /**
114
- * Where `Tab` past the last control (`next`) or `Shift+Tab` before the first (`prev`) of
115
- * the edited row `from` goes, over the rows in the order they are drawn.
116
- *
117
- * Past the last row it adds one when the table can — unless `from` is itself a row just
118
- * added and still blank: one more `Tab` there means «I am done», not «another blank line».
119
- */
120
- export declare function tabTarget(order: readonly string[], from: string, direction: "next" | "prev", { canAdd, blank }: {
121
- canAdd: boolean;
122
- blank: boolean;
123
- }): TabTarget;
124
90
  export type RowKey = "ArrowDown" | "ArrowUp" | "Home" | "End";
125
91
  /**
126
92
  * One body row. Its own component so that it can hold React Aria's `useKeyboard`
@@ -9,42 +9,13 @@ import { stickyTop, useScrollBox } from "../../foundations/sticky.js";
9
9
  import { IconButton } from "../button/Button.js";
10
10
  import { NoteCard, NoteRegistryContext, } from "../field/note.js";
11
11
  import { Flag } from "../notice/Flag.js";
12
+ import { sectionLines, stackPlaces, tabTarget, } from "./editRules.js";
12
13
  import { useRowWindow } from "./rowWindow.js";
13
14
  import { HEADER_TEXT } from "./Table.js";
14
15
  import { AlertCircle, GripVertical, Plus, Trash2 } from "lucide-react";
15
16
  import { Fragment, useContext, useEffect, useId, useLayoutEffect, useMemo, useRef, useState, } from "react";
16
17
  import { useKeyboard } from "react-aria";
17
- /** The lines each section heads: the rows after it up to the next section. Notes do not
18
- * cut a section, and are not lines. */
19
- export function sectionLines(rows, getRowId, kind) {
20
- const out = new Map();
21
- let current = null;
22
- for (const row of rows) {
23
- const k = kind(row);
24
- if (k === "section") {
25
- current = [];
26
- out.set(getRowId(row), current);
27
- }
28
- else if (k === null)
29
- current?.push(row);
30
- }
31
- return out;
32
- }
33
- /**
34
- * Where each column goes in the stacked card, defaults resolved: a declared `stack`
35
- * wins; otherwise the first undeclared column is the title (unless one was declared),
36
- * the last undeclared numeric one is the amount (unless one was declared), and the rest
37
- * are detail.
38
- */
39
- export function stackPlaces(columns) {
40
- const titleAt = columns.some((c) => c.stack === "title")
41
- ? -1
42
- : columns.findIndex((c) => c.stack === undefined);
43
- const amountAt = columns.some((c) => c.stack === "amount")
44
- ? -1
45
- : columns.findLastIndex((c, i) => c.stack === undefined && c.numeric === true && i !== titleAt);
46
- return columns.map((c, i) => c.stack ?? (i === titleAt ? "title" : i === amountAt ? "amount" : "detail"));
47
- }
18
+ export { sectionLines, stackPlaces, tabTarget };
48
19
  /** A brief that says nothing is left out of the line, separator included. */
49
20
  function says(node) {
50
21
  return node !== null && node !== undefined && node !== false && node !== "";
@@ -107,22 +78,6 @@ export function firstControl(row) {
107
78
  function lastControl(row) {
108
79
  return editStops(row).at(-1) ?? stopsIn(row, FOCUSABLE).at(-1) ?? null;
109
80
  }
110
- /**
111
- * Where `Tab` past the last control (`next`) or `Shift+Tab` before the first (`prev`) of
112
- * the edited row `from` goes, over the rows in the order they are drawn.
113
- *
114
- * Past the last row it adds one when the table can — unless `from` is itself a row just
115
- * added and still blank: one more `Tab` there means «I am done», not «another blank line».
116
- */
117
- export function tabTarget(order, from, direction, { canAdd, blank }) {
118
- const at = order.indexOf(from);
119
- if (at === -1)
120
- return { kind: "leave" };
121
- const to = order[direction === "next" ? at + 1 : at - 1];
122
- if (to !== undefined)
123
- return { kind: "row", id: to };
124
- return direction === "next" && canAdd && !blank ? { kind: "add" } : { kind: "leave" };
125
- }
126
81
  /** Keys a control inside the row already answers with `Enter`: a button presses, a
127
82
  * link follows, a text area breaks the line, an open list picks its option. */
128
83
  function ownsEnter(target) {
@@ -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,
@@ -1,4 +1,5 @@
1
1
  import type { Tone } from "../../foundations/types.js";
2
+ import { CELL_TONE } from "./cellTone.js";
2
3
  import type { WindowedRow } from "./rowWindow.js";
3
4
  import { type SortState } from "./sorting.js";
4
5
  import { type ReactNode } from "react";
@@ -76,10 +77,7 @@ export declare function TrDetail({ children, detail, open, onToggle, columns, la
76
77
  label: string;
77
78
  selected?: boolean;
78
79
  }): import("react").JSX.Element;
79
- /** The background of a cell, by tone. It replaces the row wash on that cell:
80
- * a hovered row and a painted cell are two signals, and stacking them reads
81
- * as a third color. */
82
- export declare const CELL_TONE: Record<Tone, string>;
80
+ export { CELL_TONE };
83
81
  /** The wash of the row a cell sits in: for cells drawn outside `Td`, like the row's actions. */
84
82
  export declare function useRowWash(): string;
85
83
  export declare function Td({ children, numeric, align,
@@ -2,6 +2,7 @@
2
2
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
3
  import { fillCopy, useUiCopy } from "../../foundations/copy.js";
4
4
  import { stickyTop, useScrollBox } from "../../foundations/sticky.js";
5
+ import { CELL_TONE } from "./cellTone.js";
5
6
  import { pressSort, sortPosition, } from "./sorting.js";
6
7
  import { ArrowDown, ArrowUp, ChevronRight, ChevronsUpDown } from "lucide-react";
7
8
  import { createContext, useContext, useId } from "react";
@@ -127,19 +128,11 @@ export function TrDetail({ children, detail, open, onToggle, columns, label, sel
127
128
  return (_jsx(RowMark.Provider, { value: { selected, interactive: true }, children: _jsxs(_Fragment, { children: [_jsxs("tr", { onClick: onToggle, className: "group/row cursor-pointer", children: [_jsx("td", { className: `border-b border-line py-1.5 pr-0 pl-2.5 align-middle first:rounded-l-control ${rowWash({ selected, interactive: true })}`, children: _jsx("button", { type: "button", onClick: (e) => {
128
129
  e.stopPropagation();
129
130
  onToggle();
130
- }, "aria-expanded": open, "aria-controls": id, "aria-label": label, className: "inline-flex size-5 items-center justify-center rounded-pill text-muted transition-colors duration-(--duration-instant) hover:bg-ink/6 hover:text-ink focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary", children: _jsx(ChevronRight, { className: `size-(--size-icon-sm) transition-transform duration-(--duration-instant) ${open ? "rotate-90" : ""}`, strokeWidth: 2 }) }) }), children] }), _jsx("tr", { id: id, hidden: !open, children: _jsx("td", { colSpan: columns + 1, className: "border-b border-line bg-ground px-3 py-3", children: detail }) })] }) }));
131
+ }, "aria-expanded": open, "aria-controls": id, "aria-label": label, className: "hit-target inline-flex size-5 items-center justify-center rounded-pill text-muted transition-colors duration-(--duration-instant) hover:bg-ink/6 hover:text-ink focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary", children: _jsx(ChevronRight, { className: `size-(--size-icon-sm) transition-transform duration-(--duration-instant) ${open ? "rotate-90" : ""}`, strokeWidth: 2 }) }) }), children] }), _jsx("tr", { id: id, hidden: !open, children: _jsx("td", { colSpan: columns + 1, className: "border-b border-line bg-ground px-3 py-3", children: detail }) })] }) }));
131
132
  }
132
- /** The background of a cell, by tone. It replaces the row wash on that cell:
133
- * a hovered row and a painted cell are two signals, and stacking them reads
134
- * as a third color. */
135
- export const CELL_TONE = {
136
- neutral: "bg-ink/6",
137
- info: "bg-info/12",
138
- good: "bg-good/12",
139
- warn: "bg-warn/15",
140
- bad: "bg-bad/12",
141
- accent: "bg-accent/20",
142
- };
133
+ /* `CELL_TONE` is a plain table (`cellTone.ts`), without the directive, so a server component
134
+ reads it; re-exported so every path that read it here keeps reading it. */
135
+ export { CELL_TONE };
143
136
  /** The wash of the row a cell sits in: for cells drawn outside `Td`, like the row's actions. */
144
137
  export function useRowWash() {
145
138
  return rowWash(useContext(RowMark));
@@ -166,8 +159,12 @@ tone, title, }) {
166
159
  * three of forty rows selected lies in both directions — empty says «none»
167
160
  * and filled says «all». */
168
161
  export function SelectBox({ checked, indeterminate = false, onChange, label, }) {
169
- return (_jsx("input", { type: "checkbox", checked: checked, "aria-label": label, ref: (el) => {
170
- if (el !== null)
171
- el.indeterminate = indeterminate && !checked;
172
- }, onChange: (e) => onChange?.(e.target.checked), onClick: (e) => e.stopPropagation(), className: "size-3.5 shrink-0 cursor-pointer accent-primary" }));
162
+ return (
163
+ /* The box is drawn small so a list keeps its density, and it answers to `--size-target`
164
+ around it (44px under a finger): the label is the target. A tap on it never reaches the
165
+ row, which would open the record instead of choosing it. */
166
+ _jsx("label", { className: "hit-target inline-flex shrink-0 cursor-pointer", onClick: (e) => e.stopPropagation(), children: _jsx("input", { type: "checkbox", checked: checked, "aria-label": label, ref: (el) => {
167
+ if (el !== null)
168
+ el.indeterminate = indeterminate && !checked;
169
+ }, onChange: (e) => onChange?.(e.target.checked), onClick: (e) => e.stopPropagation(), className: "size-3.5 shrink-0 cursor-pointer accent-primary touch:size-5" }) }));
173
170
  }
@@ -0,0 +1,5 @@
1
+ import type { Tone } from "../../foundations/types.js";
2
+ /** The background of a cell, by tone. It replaces the row wash on that cell:
3
+ * a hovered row and a painted cell are two signals, and stacking them reads
4
+ * as a third color. */
5
+ export declare const CELL_TONE: Record<Tone, string>;