@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
@@ -91,6 +91,14 @@ import { X } from "lucide-react";
91
91
  * The count is a live region: typing in the search changes it, and somebody
92
92
  * who cannot see the rows thin out hears how many are left. With
93
93
  * `pagination` the page range replaces it — it already says how many. */
94
+ /* A count's figure in its tone — text on the canvas, so the readable ones. */
95
+ const COUNTER_TONE = {
96
+ info: "text-info",
97
+ good: "text-good",
98
+ warn: "text-warn",
99
+ bad: "text-bad",
100
+ accent: "text-ink",
101
+ };
94
102
  export function ListingBar({ actions, title, description, counters, selection, search, pagination, views, crumbs, surface, inline = false, count, look = "traditional", }) {
95
103
  const selecting = selection !== undefined && selection.count > 0;
96
104
  const d = useDensity();
@@ -109,7 +117,7 @@ export function ListingBar({ actions, title, description, counters, selection, s
109
117
  Views used to sit next to the pagination. On a narrow window the search
110
118
  field and «1–80 / 211» painted over each other; columns and the switcher
111
119
  were the extra weight on a line that only needed how MANY. */
112
- const center = selecting ? (_jsxs("div", { className: "flex min-w-0 items-center gap-x-2", children: [_jsxs("span", { className: `inline-flex h-(--size-control-md) shrink-0 items-center gap-1.5 rounded-control pr-1 pl-2.5 text-meta font-medium ${isChrome ? "bg-chrome-ink/14 text-chrome-ink" : "bg-ink/8 text-ink"}`, children: [_jsx("span", { className: "tabular-nums", children: selection?.count.toLocaleString(copy.locale) }), copy.selection.chosen, _jsx("button", { type: "button", onClick: selection?.onClear, "aria-label": copy.selection.clear, title: copy.selection.clear, className: `inline-flex size-5 items-center justify-center rounded-pill transition-colors duration-(--duration-instant) ${isChrome ? "hover:bg-chrome-ink/20" : "hover:bg-primary/20"}`, children: _jsx(X, { className: "size-3", strokeWidth: 2.5 }) })] }), selection?.matching === undefined ||
120
+ const center = selecting ? (_jsxs("div", { className: "flex min-w-0 items-center gap-x-2", children: [_jsxs("span", { className: `inline-flex h-(--size-control-md) shrink-0 items-center gap-1.5 rounded-control pr-1 pl-2.5 text-meta font-medium ${isChrome ? "bg-chrome-ink/14 text-chrome-ink" : "bg-ink/8 text-ink"}`, children: [_jsx("span", { className: "tabular-nums", children: selection?.count.toLocaleString(copy.locale) }), copy.selection.chosen, _jsx("button", { type: "button", onClick: selection?.onClear, "aria-label": copy.selection.clear, title: copy.selection.clear, className: `hit-target inline-flex size-5 items-center justify-center rounded-pill transition-colors duration-(--duration-instant) ${isChrome ? "hover:bg-chrome-ink/20" : "hover:bg-primary/20"}`, children: _jsx(X, { className: "size-3", strokeWidth: 2.5 }) })] }), selection?.matching === undefined ||
113
121
  selection.matching.total <= selection.count ? null : (_jsx("button", { type: "button", onClick: selection.matching.onSelect, className: `shrink-0 rounded-control px-1 text-meta font-medium underline-offset-4 hover:underline focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-primary ${isChrome ? "text-chrome-link" : "text-primary"}`, children: fillCopy(copy.selection.allMatching, {
114
122
  count: selection.matching.total.toLocaleString(copy.locale),
115
123
  }) })), selection?.actions === undefined ? null : (_jsx("div", { className: "flex min-w-0 items-center gap-1.5", children: selection.actions }))] })) : search === undefined ? null : (
@@ -145,7 +153,21 @@ export function ListingBar({ actions, title, description, counters, selection, s
145
153
  const heading = title === undefined ? null : (_jsx("h2", { className: `text-title leading-tight font-semibold ${isChrome ? "text-chrome-ink" : "text-ink"}`, children: title }));
146
154
  /* What the list is made of: its counters and its sentence. Under the title in the
147
155
  traditional bar; at the start of the controls' row in the modern one. */
148
- const about = description === undefined && counters === undefined ? null : (_jsxs("div", { className: "flex min-w-0 flex-wrap items-baseline gap-x-3 gap-y-0.5", children: [counters?.map((c) => (_jsxs("span", { className: "flex items-baseline gap-1", children: [_jsx("span", { className: `text-meta font-medium tabular-nums ${isChrome ? "text-chrome-ink" : "text-ink"}`, children: typeof c.value === "number" ? c.value.toLocaleString(copy.locale) : c.value }), _jsx("span", { className: `text-micro ${isChrome ? "text-chrome-muted" : "text-muted"}`, children: c.label })] }, c.label))), description === undefined ? null : (_jsx("span", { className: `min-w-0 text-micro ${isChrome ? "text-chrome-muted" : "text-muted"}`, children: description }))] }));
156
+ const about = description === undefined && counters === undefined ? null : (_jsxs("div", { className: "flex min-w-0 flex-wrap items-baseline gap-x-3 gap-y-0.5", children: [counters?.map((c) => {
157
+ const inside = (_jsxs(_Fragment, { children: [_jsx("span", { className: `text-meta font-medium tabular-nums ${c.active === true
158
+ ? isChrome
159
+ ? "text-chrome-link"
160
+ : "text-primary"
161
+ : c.tone !== undefined && c.tone !== "neutral" && !isChrome
162
+ ? COUNTER_TONE[c.tone]
163
+ : isChrome
164
+ ? "text-chrome-ink"
165
+ : "text-ink"}`, children: typeof c.value === "number" ? c.value.toLocaleString(copy.locale) : c.value }), _jsx("span", { className: `text-micro ${isChrome ? "text-chrome-muted" : "text-muted"}`, children: c.label })] }));
166
+ return c.onClick === undefined ? (_jsx("span", { className: "flex items-baseline gap-1", children: inside }, c.label)) : (
167
+ /* Pressed like a link and not like a button: it sits in a sentence about the
168
+ list. Applied, it says so in the primary and with `aria-pressed`. */
169
+ _jsx("button", { type: "button", onClick: c.onClick, "aria-pressed": c.active === true, className: `hit-target flex items-baseline gap-1 rounded-control underline-offset-4 hover:underline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary ${c.active === true ? "underline" : ""}`, children: inside }, c.label));
170
+ }), description === undefined ? null : (_jsx("span", { className: `min-w-0 text-micro ${isChrome ? "text-chrome-muted" : "text-muted"}`, children: description }))] }));
149
171
  const bottomRow = actions === undefined && !withIdentity && views === undefined ? null : (
150
172
  /* On a narrow list (a phone, a drawer) the name and its counters take the whole first
151
173
  line and the action and the controls go below: squeezed between them, the
@@ -1,7 +1,9 @@
1
+ import type { Tone } from "../../foundations/types.js";
2
+ import { type ElapsedProps } from "../../primitives/value/Elapsed.js";
1
3
  import type { LucideIcon } from "lucide-react";
2
4
  import type { ReactNode } from "react";
3
5
  /**
4
- * One record as a card — the board presentation of a list.
6
+ * One record as a card — the board presentation of a list, a product on a till's grid.
5
7
  *
6
8
  * Context: the board drew this card inline, and a list that wanted its own card wrote its
7
9
  * own `div` — which looked the same and could not be opened: the default card was a button
@@ -11,8 +13,27 @@ import type { ReactNode } from "react";
11
13
  *
12
14
  * Its hierarchy is the row's: the state first (what it is), the name as the entry point,
13
15
  * the facts below in the quiet size.
16
+ *
17
+ * ── Three shapes, for three ways of looking ─────────────────────────
18
+ *
19
+ * card a board's card: the name in up to two lines (a figure beside it never cuts
20
+ * it), what it is about, N facts, its controls at the foot
21
+ * compact two lines, for a pipeline of sixty: name and figure, then one line of facts
22
+ * tile a product on a grid: the picture on top, the name, the price — the whole tile
23
+ * is pressed, as a till's or a shop's is
24
+ *
25
+ * It was one box of 16px padding and 12px corners inside a lane that was another box: two
26
+ * borders and two roundings around every card, and the figure on the name's line cut the
27
+ * name to «Certificación ISO 9…». The padding now follows the density, the corners are the
28
+ * control's (`--ui-record-card-radius`), and the name wraps before it is cut.
14
29
  */
15
- export declare function RecordCard({ title, subtitle, tags, meta, figure, media, footer, onOpen, }: {
30
+ export type RecordCardLayout = "card" | "compact" | "tile";
31
+ /** One fact of the record: «Cierre · 30/11», «Probabilidad · 60 %». */
32
+ export type RecordCardField = {
33
+ label: string;
34
+ value: ReactNode;
35
+ };
36
+ export declare function RecordCard({ title, subtitle, tags, meta, figure, media, footer, onOpen, layout, fields, badge, selected, disabled, tone, elapsed, }: {
16
37
  title: ReactNode;
17
38
  /** Who or what it is about, under the title: the customer of an opportunity. */
18
39
  subtitle?: ReactNode;
@@ -21,7 +42,7 @@ export declare function RecordCard({ title, subtitle, tags, meta, figure, media,
21
42
  figure?: ReactNode;
22
43
  /** The picture of the record. A product's is a square (`Thumb`); a PERSON's is round, with
23
44
  * the initials when there is no photo — `person`, like `RelationCard`'s. `alt` names the
24
- * person when the title is not plain text. */
45
+ * person when the title is not plain text. In a `tile` it is the cover. */
25
46
  media?: {
26
47
  src?: string;
27
48
  alt?: string;
@@ -32,4 +53,21 @@ export declare function RecordCard({ title, subtitle, tags, meta, figure, media,
32
53
  * avatar — each its own button, pressable without opening the card. */
33
54
  footer?: ReactNode;
34
55
  onOpen?: () => void;
56
+ layout?: RecordCardLayout;
57
+ /** N facts as label and value — as many as the record needs to be told apart on a board.
58
+ * More than four and it is a form: open the record. */
59
+ fields?: readonly RecordCardField[];
60
+ /** A count on the corner: how many of this product are already in the ticket. */
61
+ badge?: ReactNode;
62
+ /** It is chosen — the ticket's line being edited, the order being bumped. */
63
+ selected?: boolean;
64
+ /** It cannot be chosen now — out of stock. Shown (it exists) but quiet and not pressed; say
65
+ * why in `meta` («Sin stock»). */
66
+ disabled?: boolean;
67
+ /** What the record's state says before it is read: a stripe on its edge in that tone —
68
+ * blocked, overdue. `elapsed` with thresholds paints it by itself. */
69
+ tone?: Tone;
70
+ /** How long it has been waiting, live — a kitchen's ticket, a case under an SLA. With
71
+ * `warnAfter` / `badAfter` (minutes) the time and the card's edge turn amber, then red. */
72
+ elapsed?: Omit<ElapsedProps, "now">;
35
73
  }): import("react").JSX.Element;
@@ -1,31 +1,72 @@
1
1
  "use client";
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { useNow } from "../../foundations/clock.js";
4
+ import { byDensity, useDensity } from "../../foundations/density.js";
3
5
  import { Thumb } from "../../primitives/cell/CellStack.js";
4
6
  import { Avatar } from "../../primitives/value/Avatar.js";
5
- /**
6
- * One record as a card — the board presentation of a list.
7
- *
8
- * Context: the board drew this card inline, and a list that wanted its own card wrote its
9
- * own `div` — which looked the same and could not be opened: the default card was a button
10
- * with `onOpen`, the custom one was not. A card is the record's door in the board the way a
11
- * row is in the table, so it is a component and it is always pressable when there is
12
- * somewhere to go.
13
- *
14
- * Its hierarchy is the row's: the state first (what it is), the name as the entry point,
15
- * the facts below in the quiet size.
16
- */
17
- export function RecordCard({ title, subtitle, tags, meta, figure, media, footer, onOpen, }) {
7
+ import { Elapsed } from "../../primitives/value/Elapsed.js";
8
+ import { elapsedMillis, elapsedTone } from "../../primitives/value/elapsedTime.js";
9
+ /* The stripe on a card's edge in its tone: what it says about the record, before reading it. */
10
+ const STRIPE = {
11
+ info: "bg-info",
12
+ good: "bg-good",
13
+ warn: "bg-warn",
14
+ bad: "bg-bad",
15
+ accent: "bg-accent",
16
+ };
17
+ function Stripe({ tone }) {
18
+ if (tone === undefined || tone === "neutral")
19
+ return null;
20
+ return (_jsx("span", { "aria-hidden": true, "data-ui": "record-card.stripe", "data-tone": tone, className: `pointer-events-none absolute inset-y-0 left-0 w-1 rounded-l-ui-record-card ${STRIPE[tone]}` }));
21
+ }
22
+ /* The live stripe of a waiting record — its own component so only the card that waits
23
+ re-renders with the clock, not every card of the board. */
24
+ function WaitingStripe({ elapsed }) {
25
+ const now = useNow();
26
+ if (now === null)
27
+ return null;
28
+ return _jsx(Stripe, { tone: elapsedTone(elapsedMillis(elapsed.since, now), elapsed) });
29
+ }
30
+ export function RecordCard({ title, subtitle, tags, meta, figure, media, footer, onOpen, layout = "card", fields, badge, selected = false, disabled = false, tone, elapsed, }) {
31
+ const density = useDensity();
32
+ const pressable = onOpen !== undefined && !disabled;
18
33
  /* The card is a box, and the TITLE is the button that opens it, stretched over the whole
19
34
  card (`after:inset-0`). It used to be a `<button>` around everything: a priority star or a
20
35
  kanban state inside it would be a control inside a control, which is invalid and which a
21
36
  screen reader announces as one thing. The footer's controls sit above the stretch. */
22
- const titleText = _jsx("span", { className: "min-w-0 truncate", children: title });
23
- return (_jsxs("div", { "data-ui": "record-card", className: `relative flex w-full min-w-0 flex-col gap-2 rounded-ui-card border border-ui-card-border bg-ui-card p-4 text-left ${onOpen === undefined
24
- ? ""
25
- : "transition-colors duration-(--duration-instant) focus-within:border-line-strong hover:border-line-strong"}`, children: [media === undefined ? null : media.person === true ? (
26
- /* The name is written right below it: the photo's `alt` would say it twice. */
27
- _jsx("span", { "aria-hidden": true, className: "flex shrink-0", children: _jsx(Avatar, { name: media.alt ?? (typeof title === "string" ? title : ""), size: "xl", ...(media.src === undefined ? {} : { src: media.src }) }) })) : (_jsx(Thumb, { size: "lg", ...(media.src === undefined ? {} : { src: media.src }), ...(media.alt === undefined ? {} : { alt: media.alt }), ...(media.icon === undefined ? {} : { icon: media.icon }) })), tags === undefined ? null : _jsx("div", { className: "flex flex-wrap gap-1.5", children: tags }), _jsxs("div", { className: "flex min-w-0 items-baseline justify-between gap-3", children: [onOpen === undefined ? (_jsx("p", { className: "flex min-w-0 text-lead font-medium text-ink", children: titleText })) : (_jsx("button", { type: "button", onClick: onOpen, className: "flex min-w-0 text-left text-lead font-medium text-ink outline-none after:absolute after:inset-0 after:rounded-box focus-visible:after:outline-2 focus-visible:after:outline-primary", children: titleText })), figure === undefined ? null : (_jsx("p", { className: "shrink-0 text-lead font-semibold tabular-nums text-ink", children: figure }))] }), subtitle === undefined ? null : (
28
- /* Above the stretched title, at its own width: the subtitle may be a link to ANOTHER
29
- record (the customer), which must open that one and not the card. */
30
- _jsx("p", { className: "relative z-10 -mt-1.5 w-fit max-w-full min-w-0 truncate text-meta text-muted", children: subtitle })), meta === undefined ? null : (_jsx("p", { className: "text-micro tabular-nums text-muted", children: meta })), footer === undefined ? null : (_jsx("div", { className: "relative z-10 flex min-w-0 items-center gap-1.5", children: footer }))] }));
37
+ const titleText = (_jsx("span", { "data-ui": "record-card.title", className: `min-w-0 ${layout === "compact" ? "truncate" : "line-clamp-2"}`, children: title }));
38
+ const titleSize = layout === "card" ? "text-lead" : "text-body";
39
+ const name = pressable ? (_jsx("button", { type: "button", onClick: onOpen, ...(selected ? { "aria-current": true } : {}), className: `flex min-w-0 flex-1 text-left ${titleSize} font-medium text-ink outline-none after:absolute after:inset-0 after:rounded-ui-record-card focus-visible:after:outline-2 focus-visible:after:outline-primary`, children: titleText })) : (_jsx("p", { className: `flex min-w-0 flex-1 ${titleSize} font-medium text-ink`, children: titleText }));
40
+ const shell = `relative flex w-full min-w-0 flex-col rounded-ui-record-card border bg-ui-card text-left ${selected
41
+ ? "border-primary ring-1 ring-primary"
42
+ : `border-ui-card-border ${pressable
43
+ ? "transition-colors duration-(--duration-instant) focus-within:border-line-strong hover:border-line-strong"
44
+ : ""}`}`;
45
+ const stripe = tone !== undefined ? (_jsx(Stripe, { tone: tone })) : elapsed === undefined ? null : (_jsx(WaitingStripe, { elapsed: elapsed }));
46
+ const corner = badge === undefined ? null : (_jsx("span", { "data-ui": "record-card.badge", className: "pointer-events-none absolute -top-2 -right-2 z-20 inline-flex h-6 min-w-6 items-center justify-center rounded-pill bg-primary px-1.5 text-meta font-semibold text-surface tabular-nums shadow-raised", children: badge }));
47
+ const timer = elapsed === undefined ? null : (_jsx(Elapsed, { since: elapsed.since, ...(elapsed.warnAfter === undefined ? {} : { warnAfter: elapsed.warnAfter }), ...(elapsed.badAfter === undefined ? {} : { badAfter: elapsed.badAfter }) }));
48
+ const factList = fields === undefined || fields.length === 0 ? null : (_jsx("dl", { "data-ui": "record-card.fields", className: "flex min-w-0 flex-col gap-0.5 text-meta", children: fields.map((one) => (_jsxs("div", { className: "flex min-w-0 items-baseline justify-between gap-3", children: [_jsx("dt", { className: "shrink-0 text-muted", children: one.label }), _jsx("dd", { className: "min-w-0 truncate text-right text-ink tabular-nums", children: one.value })] }, one.label))) }));
49
+ const sub = subtitle === undefined ? null : (
50
+ /* Above the stretched title, at its own width: the subtitle may be a link to ANOTHER
51
+ record (the customer), which must open that one and not the card. */
52
+ _jsx("p", { className: "relative z-10 w-fit max-w-full min-w-0 truncate text-meta text-muted", children: subtitle }));
53
+ const quiet = meta === undefined ? null : (_jsx("p", { className: "min-w-0 truncate text-micro tabular-nums text-muted", children: meta }));
54
+ const foot = footer === undefined ? null : (_jsx("div", { "data-ui": "record-card.footer", className: "relative z-10 flex min-w-0 items-center gap-1.5", children: footer }));
55
+ if (layout === "tile") {
56
+ /* The tile is pressed whole and its picture is the first thing read: on a till the hand
57
+ goes to the photo, not to the name. Without a picture, the icon on a tinted square
58
+ keeps the grid even. */
59
+ const Icon = media?.icon;
60
+ return (_jsxs("div", { "data-ui": "record-card", "data-layout": "tile", ...(selected ? { "data-selected": "" } : {}), ...(disabled ? { "data-disabled": "" } : {}), className: shell, children: [stripe, corner, _jsx("div", { "data-ui": "record-card.media", className: `flex aspect-tile w-full items-center justify-center overflow-hidden rounded-t-ui-record-card bg-ink/5 text-muted ${disabled ? "opacity-40 grayscale" : ""}`, children: media?.src !== undefined ? (_jsx("img", { src: media.src, alt: media.alt ?? "", loading: "lazy", className: "size-full object-cover" })) : Icon === undefined ? null : (_jsx(Icon, { "aria-hidden": true, className: "size-8", strokeWidth: 1.5 })) }), _jsxs("div", { className: `flex min-w-0 flex-1 flex-col ${byDensity(density, "gap-1 p-3", "gap-0.5 p-2")}`, children: [tags === undefined ? null : _jsx("div", { className: "flex flex-wrap gap-1", children: tags }), name, sub, _jsxs("div", { className: "mt-auto flex min-w-0 items-baseline justify-between gap-2 pt-1", children: [figure === undefined ? null : (_jsx("p", { "data-ui": "record-card.figure", className: "shrink-0 text-lead font-semibold tabular-nums text-ink", children: figure })), quiet] }), timer, foot] })] }));
61
+ }
62
+ const picture = media === undefined ? null : media.person === true ? (
63
+ /* The name is written right beside it: the photo's `alt` would say it twice. */
64
+ _jsx("span", { "aria-hidden": true, className: "flex shrink-0", children: _jsx(Avatar, { name: media.alt ?? (typeof title === "string" ? title : ""), size: layout === "compact" ? "md" : "lg", ...(media.src === undefined ? {} : { src: media.src }) }) })) : (_jsx(Thumb, { size: layout === "compact" ? "md" : "lg", ...(media.src === undefined ? {} : { src: media.src }), ...(media.alt === undefined ? {} : { alt: media.alt }), ...(media.icon === undefined ? {} : { icon: media.icon }) }));
65
+ const head = (_jsxs("div", { className: "flex min-w-0 items-start justify-between gap-3", children: [name, figure === undefined && timer === null ? null : (_jsxs("div", { className: "flex shrink-0 flex-col items-end gap-0.5", children: [timer, figure === undefined ? null : (_jsx("p", { "data-ui": "record-card.figure", className: `font-semibold tabular-nums text-ink ${layout === "compact" ? "text-body" : "text-lead"}`, children: figure }))] }))] }));
66
+ return (_jsxs("div", { "data-ui": "record-card", "data-layout": layout, ...(selected ? { "data-selected": "" } : {}), ...(disabled ? { "data-disabled": "" } : {}), className: `${shell} ${layout === "compact"
67
+ ? byDensity(density, "gap-0.5 px-3 py-2", "gap-0.5 px-2 py-1.5")
68
+ : byDensity(density, "gap-1.5 p-3", "gap-1 p-2.5")}`, children: [stripe, corner, layout === "compact" || tags === undefined ? null : (
69
+ /* In a row of their own and at their own width: as a flex child of the card a tag
70
+ stretched to the card's width. */
71
+ _jsx("div", { className: "flex flex-wrap gap-1", children: tags })), _jsxs("div", { className: "flex min-w-0 items-start gap-3", children: [picture, _jsxs("div", { className: "flex min-w-0 flex-1 flex-col gap-0.5", children: [head, sub] })] }), layout === "compact" ? null : factList, quiet, foot] }));
31
72
  }
@@ -68,13 +68,16 @@ export function Row({ icon: Icon, avatar, name, onOpen, onPeek, click = "peek",
68
68
  just the same by clicking anywhere on the row, not only on the
69
69
  name. With the preview turned off (`PeekLayer.tsx`) this is today the
70
70
  case for everyone: a click on the row opens, plain and simple. */
71
- onClick: click === "open" ? (onOpen ?? onPeek) : (onPeek ?? onOpen), role: "presentation", children: [onSelectedChange === undefined ? null : (_jsx("input", { type: "checkbox", checked: selected ?? false, "aria-label": fillCopy(copy.selection.named, { name }), onChange: (e) => onSelectedChange(e.target.checked), onClick: (e) => e.stopPropagation(), className: "size-3.5 shrink-0 cursor-pointer accent-primary" })), avatar !== undefined ? (_jsx(Avatar, { name: avatar.name, size: "sm", ...(avatar.src === undefined ? {} : { src: avatar.src }) })) : Icon === undefined ? null : (_jsx(Icon, { className: "size-(--size-icon-md) shrink-0 text-muted", strokeWidth: 1.75, "aria-hidden": true })), _jsx("div", { className: "@container/row min-w-0 grow", children: _jsxs("div", { className: `flex min-w-0 items-center gap-y-1 @max-row-split/row:flex-wrap ${byDensity(d, "gap-x-3", "gap-x-2")}`, children: [_jsxs("span", { "data-slot": "row-text", className: "flex min-w-0 shrink grow basis-(--container-name) flex-col @row-split/row:max-w-(--container-row-text)", children: [_jsx(RecordLink, { ...((onOpen ?? onPeek) === undefined
71
+ onClick: click === "open" ? (onOpen ?? onPeek) : (onPeek ?? onOpen), role: "presentation", children: [onSelectedChange === undefined ? null : (
72
+ /* Drawn small, answering to `--size-target` (44px under a finger) — and a tap on
73
+ the target chooses the row, it never opens it. */
74
+ _jsx("label", { className: "hit-target inline-flex shrink-0 cursor-pointer", onClick: (e) => e.stopPropagation(), children: _jsx("input", { type: "checkbox", checked: selected ?? false, "aria-label": fillCopy(copy.selection.named, { name }), onChange: (e) => onSelectedChange(e.target.checked), onClick: (e) => e.stopPropagation(), className: "size-3.5 shrink-0 cursor-pointer accent-primary touch:size-5" }) })), avatar !== undefined ? (_jsx(Avatar, { name: avatar.name, size: "sm", ...(avatar.src === undefined ? {} : { src: avatar.src }) })) : Icon === undefined ? null : (_jsx(Icon, { className: "size-(--size-icon-md) shrink-0 text-muted", strokeWidth: 1.75, "aria-hidden": true })), _jsx("div", { className: "@container/row min-w-0 grow", children: _jsxs("div", { className: `flex min-w-0 items-center gap-y-1 @max-row-split/row:flex-wrap ${byDensity(d, "gap-x-3", "gap-x-2")}`, children: [_jsxs("span", { "data-slot": "row-text", className: "flex min-w-0 shrink grow basis-(--container-name) flex-col @row-split/row:max-w-(--container-row-text)", children: [_jsx(RecordLink, { ...((onOpen ?? onPeek) === undefined
72
75
  ? {}
73
76
  : { onClick: (onOpen ?? onPeek) }), title: name, children: name }), meta === undefined ? null : (
74
77
  /* It truncates instead of wrapping into itself: three lines per row in a
75
78
  480 px drawer means three rows fit on screen. In mono figures: under the
76
79
  name, row after row, the dates and amounts line up. */
77
- _jsx("span", { className: "min-w-0 truncate text-micro tabular-nums text-muted", children: meta }))] }), tags === undefined ? null : (_jsx("span", { "data-slot": "row-tags", className: "flex min-w-fit shrink-0 basis-(--container-tags) flex-wrap items-center gap-1.5 @max-row-split/row:basis-full", children: tags }))] }) }), _jsx("span", { className: "flex shrink-0 items-center gap-1 opacity-0 transition-opacity duration-(--duration-instant) group-hover/row:opacity-100 focus-within:opacity-100 pointer-coarse:opacity-100", children: _jsx(Trail, { name: name, openAs: openAs, ...(actions === undefined ? {} : { actions }), copy: copyAs, ...(onPeek === undefined || !openers ? {} : { onPeek }), ...(onOpen === undefined || !openers ? {} : { onOpen }), ...(more === undefined ? {} : { more }), ...(onMoreSelect === undefined ? {} : { onMoreSelect }) }) })] }) }));
80
+ _jsx("span", { className: "min-w-0 truncate text-micro tabular-nums text-muted", children: meta }))] }), tags === undefined ? null : (_jsx("span", { "data-slot": "row-tags", className: "flex min-w-fit shrink-0 basis-(--container-tags) flex-wrap items-center gap-1.5 @max-row-split/row:basis-full", children: tags }))] }) }), _jsx("span", { className: "flex shrink-0 items-center gap-1 opacity-0 transition-opacity duration-(--duration-instant) group-hover/row:opacity-100 focus-within:opacity-100 touch:opacity-100", children: _jsx(Trail, { name: name, openAs: openAs, ...(actions === undefined ? {} : { actions }), copy: copyAs, ...(onPeek === undefined || !openers ? {} : { onPeek }), ...(onOpen === undefined || !openers ? {} : { onOpen }), ...(more === undefined ? {} : { more }), ...(onMoreSelect === undefined ? {} : { onMoreSelect }) }) })] }) }));
78
81
  if (children === undefined)
79
82
  return row;
80
83
  /* What the resource produced, hanging below. The indent reaches up to where
@@ -20,6 +20,9 @@ export type ColumnControl = {
20
20
  optional: readonly ColumnSpec[];
21
21
  required: readonly ColumnSpec[];
22
22
  hasOptional: boolean;
23
+ /** The visible set is not the view's default: the person added or took a column away. What
24
+ * the columns menu marks itself for — a column the view hides by default is not a choice. */
25
+ changed: boolean;
23
26
  };
24
27
  export type { ColumnSpec };
25
28
  export { defaultVisibleIds, isRequiredColumn, reconcileVisible, toggleColumn, visibleColumns, };
@@ -2,6 +2,9 @@
2
2
  import { defaultVisibleIds, isRequiredColumn, reconcileVisible, toggleColumn, visibleColumns, } from "./columnSpecs.js";
3
3
  import { useCallback, useState } from "react";
4
4
  export { defaultVisibleIds, isRequiredColumn, reconcileVisible, toggleColumn, visibleColumns, };
5
+ function sameSet(a, b) {
6
+ return a.length === b.length && a.every((id) => b.includes(id));
7
+ }
5
8
  export function useColumnControl(columns, options = {}) {
6
9
  const signature = columns.map((column) => column.id).join("\0");
7
10
  const [owned, setOwned] = useState(() => defaultVisibleIds(columns));
@@ -31,5 +34,6 @@ export function useColumnControl(columns, options = {}) {
31
34
  optional,
32
35
  required,
33
36
  hasOptional: optional.length > 0,
37
+ changed: !sameSet(visibleIds, defaultVisibleIds(columns)),
34
38
  };
35
39
  }
@@ -3,7 +3,7 @@ export { type ColumnControl, useColumnControl, } from "./columns.js";
3
3
  export { ColumnsMenu } from "./ColumnsMenu.js";
4
4
  export { type ColumnSpec, defaultVisibleIds, reconcileVisible, specsFromColumns, toggleColumn, visibleColumns, } from "./columnSpecs.js";
5
5
  export { Listing } from "./Listing.js";
6
- export { type ListIdentity, ListingBar } from "./ListingBar.js";
6
+ export { type ListCounter, type ListIdentity, ListingBar, } from "./ListingBar.js";
7
7
  export { type ModelCellKind } from "./modelCells.js";
8
8
  export { type ClaimedField, claimedFields, columnsFromModel, modelCellKind, readModelValue, } from "./modelColumns.js";
9
9
  export { type CursorSource, type Pages, type PaginationBridge, type ServerPage, useCursorPagination, usePagination, } from "./pages.js";
@@ -22,5 +22,5 @@ export { type GroupingControl, useGroupingControl, } from "./grouping.js";
22
22
  export { GroupingLevels, type GroupingLevelsProps, } from "./GroupingLevels.js";
23
23
  export { levelId, levelLabeler } from "./levels.js";
24
24
  export { PivotExplorer, type PivotExplorerProps, } from "./PivotExplorer.js";
25
- export { RecordCard } from "./RecordCard.js";
25
+ export { RecordCard, type RecordCardField, type RecordCardLayout, } from "./RecordCard.js";
26
26
  export { type SortField, SortMenu, type SortMenuProps, } from "./SortMenu.js";
@@ -8,7 +8,7 @@ export { useColumnControl, } from "./columns.js";
8
8
  export { ColumnsMenu } from "./ColumnsMenu.js";
9
9
  export { defaultVisibleIds, reconcileVisible, specsFromColumns, toggleColumn, visibleColumns, } from "./columnSpecs.js";
10
10
  export { Listing } from "./Listing.js";
11
- export { ListingBar } from "./ListingBar.js";
11
+ export { ListingBar, } from "./ListingBar.js";
12
12
  export {} from "./modelCells.js";
13
13
  export { claimedFields, columnsFromModel, modelCellKind, readModelValue, } from "./modelColumns.js";
14
14
  export { useCursorPagination, usePagination, } from "./pages.js";
@@ -28,5 +28,5 @@ export { useGroupingControl, } from "./grouping.js";
28
28
  export { GroupingLevels, } from "./GroupingLevels.js";
29
29
  export { levelId, levelLabeler } from "./levels.js";
30
30
  export { PivotExplorer, } from "./PivotExplorer.js";
31
- export { RecordCard } from "./RecordCard.js";
31
+ export { RecordCard, } from "./RecordCard.js";
32
32
  export { SortMenu, } from "./SortMenu.js";
@@ -35,7 +35,7 @@ import { type Pages } from "./pages.js";
35
35
  * chart the same pivot, drawn: bars, lines or pie. The
36
36
  * first grouping is the axis and the second, the series.
37
37
  */
38
- export type BuiltInPresent = "rows" | "table" | "board" | "sheet" | "report" | "pivot" | "chart" | "calendar" | "gantt" | "timeline";
38
+ export type BuiltInPresent = "rows" | "table" | "board" | "tiles" | "sheet" | "report" | "pivot" | "chart" | "calendar" | "gantt" | "timeline";
39
39
  /** A presentation of a list: one the package draws, or the `id` of a `List.Present` the
40
40
  * application wrote. `string & {}` keeps the built-in names in autocomplete. */
41
41
  export type ListPresent = BuiltInPresent | (string & {});
@@ -0,0 +1,43 @@
1
+ import { type PriceProps } from "../../primitives/value/Price.js";
2
+ import type { ReactNode } from "react";
3
+ export type PlanFeature = {
4
+ label: string;
5
+ /** `false` draws it as NOT included — kept in the list so plans compare line by line. */
6
+ included?: boolean;
7
+ };
8
+ export type PlanCardProps = {
9
+ name: string;
10
+ /** Who it is for, in one line: «Para una empresa con un local». */
11
+ description?: string;
12
+ /** The price as `Price` takes it — usually with `per` («mes») and, on a yearly offer, the
13
+ * monthly price before as `compareAt`. Absent for «a convenir». */
14
+ price?: Omit<PriceProps, "size">;
15
+ /** What is written where the price would be when there is none: «A convenir». */
16
+ priceLabel?: string;
17
+ features?: readonly PlanFeature[];
18
+ /** The button that takes it — the recommended plan's is the screen's one primary; the rest
19
+ * are secondary. The application decides. */
20
+ action?: ReactNode;
21
+ /** A word over the card that sets it apart: «Recomendado», «Más elegido». */
22
+ highlight?: string;
23
+ /** The plan the person is on: a tag says so, and its action usually goes away. */
24
+ current?: boolean;
25
+ };
26
+ /**
27
+ * One plan of an offer: a subscription in a portal, a membership in a shop, the licences of an
28
+ * ERP — the name, who it is for, the price, what it includes, and the button that takes it.
29
+ *
30
+ * Context: plans are COMPARED, so every card has the same anatomy in the same order and a
31
+ * feature a plan lacks stays in its list, marked «no incluye» — a list that just gets shorter
32
+ * makes the reader do the diff. Included and not are an icon AND a word for a screen reader,
33
+ * never a colour alone. The highlighted plan is framed in the selection's navy, not the gold:
34
+ * the gold is its button, the one primary of the screen. Placed in `Plans`, the cards share
35
+ * their height, so the buttons line up at the bottom.
36
+ */
37
+ export declare function PlanCard({ name, description, price, priceLabel, features, action, highlight, current, }: PlanCardProps): import("react").JSX.Element;
38
+ /** The plans of an offer side by side, as many as the row takes, each as tall as the tallest
39
+ * — stacked on a phone. Its name says what is being chosen: «Planes de Quipu». */
40
+ export declare function Plans({ label, children }: {
41
+ label: string;
42
+ children: ReactNode;
43
+ }): import("react").JSX.Element;
@@ -0,0 +1,35 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { useUiCopy } from "../../foundations/copy.js";
4
+ import { Tag } from "../../primitives/tag/Tag.js";
5
+ import { Price } from "../../primitives/value/Price.js";
6
+ import { Check, Minus } from "lucide-react";
7
+ /**
8
+ * One plan of an offer: a subscription in a portal, a membership in a shop, the licences of an
9
+ * ERP — the name, who it is for, the price, what it includes, and the button that takes it.
10
+ *
11
+ * Context: plans are COMPARED, so every card has the same anatomy in the same order and a
12
+ * feature a plan lacks stays in its list, marked «no incluye» — a list that just gets shorter
13
+ * makes the reader do the diff. Included and not are an icon AND a word for a screen reader,
14
+ * never a colour alone. The highlighted plan is framed in the selection's navy, not the gold:
15
+ * the gold is its button, the one primary of the screen. Placed in `Plans`, the cards share
16
+ * their height, so the buttons line up at the bottom.
17
+ */
18
+ export function PlanCard({ name, description, price, priceLabel, features, action, highlight, current = false, }) {
19
+ const copy = useUiCopy();
20
+ return (_jsxs("article", { "data-ui": "plan", ...(highlight === undefined ? {} : { "data-highlight": "" }), ...(current ? { "data-current": "" } : {}), "aria-label": name, className: `relative flex min-w-0 flex-col gap-4 rounded-ui-card border bg-ui-card p-5 ${highlight === undefined
21
+ ? "border-ui-card-border"
22
+ : "border-primary ring-1 ring-primary"}`, children: [highlight === undefined ? null : (_jsx("span", { "data-ui": "plan.highlight", className: "absolute -top-3 left-5 rounded-pill bg-primary px-2.5 py-0.5 text-micro font-semibold text-surface", children: highlight })), _jsxs("header", { className: "flex min-w-0 flex-col gap-1", children: [_jsxs("div", { className: "flex min-w-0 flex-wrap items-center gap-2", children: [_jsx("h3", { className: "text-title font-semibold text-ink", children: name }), current ? _jsx(Tag, { tone: "info", children: copy.plans.current }) : null] }), description === undefined ? null : (_jsx("p", { className: "text-meta text-muted", children: description }))] }), _jsx("div", { "data-ui": "plan.price", className: "min-h-16", children: price === undefined ? (_jsx("p", { className: "text-display font-semibold text-ink", children: priceLabel ?? copy.plans.onRequest })) : (_jsx(Price, { ...price, size: "lg" })) }), features === undefined || features.length === 0 ? null : (_jsx("ul", { "data-ui": "plan.features", className: "flex flex-col gap-2", children: features.map((feature) => {
23
+ const included = feature.included !== false;
24
+ const Icon = included ? Check : Minus;
25
+ return (_jsxs("li", { className: `flex min-w-0 items-start gap-2 text-meta ${included ? "text-ink" : "text-muted"}`, children: [_jsx(Icon, { "aria-hidden": true, strokeWidth: 2.25, className: `mt-0.5 size-(--size-icon-md) shrink-0 ${included ? "text-good" : "text-muted"}` }), _jsxs("span", { className: "min-w-0", children: [_jsxs("span", { className: "sr-only", children: [included ? copy.plans.included : copy.plans.excluded, ":", " "] }), feature.label] })] }, feature.label));
26
+ }) })), action === undefined ? null : (
27
+ /* At the bottom whatever the list's length: in `Plans` every card is as tall as the
28
+ tallest, so the buttons line up. */
29
+ _jsx("div", { "data-ui": "plan.action", className: "mt-auto flex flex-col pt-2 *:w-full", children: action }))] }));
30
+ }
31
+ /** The plans of an offer side by side, as many as the row takes, each as tall as the tallest
32
+ * — stacked on a phone. Its name says what is being chosen: «Planes de Quipu». */
33
+ export function Plans({ label, children }) {
34
+ return (_jsx("section", { "aria-label": label, "data-ui": "plans", className: "grid min-w-0 grid-cols-(--grid-plans) items-stretch gap-x-4 gap-y-6 pt-3", children: children }));
35
+ }
@@ -0,0 +1 @@
1
+ export { PlanCard, type PlanCardProps, type PlanFeature, Plans, } from "./PlanCard.js";
@@ -0,0 +1,2 @@
1
+ /* PLANS — an offer to choose from: a subscription, a membership, the licences of an ERP. */
2
+ export { PlanCard, Plans, } from "./PlanCard.js";
@@ -0,0 +1,51 @@
1
+ import type { ReactNode } from "react";
2
+ /** One line of the ticket: how many, of what, for how much (already written). */
3
+ export type ReceiptLine = {
4
+ quantity: number | string;
5
+ name: string;
6
+ /** The line's amount, written for the person: «Bs 40,00». */
7
+ amount: ReactNode;
8
+ /** A note under it: «sin cebolla», «2 × Bs 20,00». */
9
+ note?: string;
10
+ };
11
+ /** A fact or a total: «Subtotal · Bs 76,00». `total` is the line that closes it, bigger. */
12
+ export type ReceiptRow = {
13
+ label: string;
14
+ value: ReactNode;
15
+ total?: boolean;
16
+ };
17
+ export type ReceiptProps = {
18
+ /** Who sells: the business name on top, big. */
19
+ issuer: string;
20
+ /** Under it, small and centred: the tax id, the address, the branch. */
21
+ issuerLines?: readonly string[];
22
+ /** The document's name — «FACTURA», «NOTA DE VENTA», «PEDIDO» — between rules. */
23
+ document: string;
24
+ /** Its facts: number, date, cashier, customer and tax id. */
25
+ facts?: readonly ReceiptRow[];
26
+ lines: readonly ReceiptLine[];
27
+ totals: readonly ReceiptRow[];
28
+ /** The closing words: the legend the law asks for, «¡Gracias por su compra!». */
29
+ footer?: readonly string[];
30
+ /** Something to scan or copy under everything — a QR the application draws, a control
31
+ * code. Drawn centred. */
32
+ code?: ReactNode;
33
+ /**
34
+ * `paper` is the printed ticket: the width of an 80 mm roll, monospaced figures, what a
35
+ * thermal printer gives. `screen` is the same document read on a screen across the counter
36
+ * (a customer display, a kiosk's summary): bigger, in the system's type.
37
+ */
38
+ look?: "paper" | "screen";
39
+ };
40
+ /**
41
+ * The ticket a till prints — a sale note, an invoice, a kitchen order — and the same document
42
+ * shown on a screen.
43
+ *
44
+ * Context: a POS reprints, a customer asks for the receipt by email, a kiosk shows what was
45
+ * ordered before paying. Each drew its own ticket, and a ticket is a fixed form people already
46
+ * know how to read: who sells, which document, the lines (how many, what, how much), the
47
+ * totals, the legend. It is a document, so it prints as itself — `print:` drops the rest of
48
+ * the page's chrome (`AppFrame` already does) and the ticket keeps its width. No domain: the
49
+ * application writes the words (a Bolivian invoice's legend, a control code).
50
+ */
51
+ export declare function Receipt({ issuer, issuerLines, document, facts, lines, totals, footer, code, look, }: ReceiptProps): import("react").JSX.Element;
@@ -0,0 +1,23 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ /**
4
+ * The ticket a till prints — a sale note, an invoice, a kitchen order — and the same document
5
+ * shown on a screen.
6
+ *
7
+ * Context: a POS reprints, a customer asks for the receipt by email, a kiosk shows what was
8
+ * ordered before paying. Each drew its own ticket, and a ticket is a fixed form people already
9
+ * know how to read: who sells, which document, the lines (how many, what, how much), the
10
+ * totals, the legend. It is a document, so it prints as itself — `print:` drops the rest of
11
+ * the page's chrome (`AppFrame` already does) and the ticket keeps its width. No domain: the
12
+ * application writes the words (a Bolivian invoice's legend, a control code).
13
+ */
14
+ export function Receipt({ issuer, issuerLines = [], document, facts = [], lines, totals, footer = [], code, look = "paper", }) {
15
+ const paper = look === "paper";
16
+ const text = paper ? "text-micro" : "text-body";
17
+ const rule = paper ? "border-dashed border-line-strong" : "border-line";
18
+ return (_jsxs("article", { "data-ui": "receipt", "data-look": look, className: `mx-auto flex w-full min-w-0 flex-col gap-2 bg-surface text-ink ${paper
19
+ ? "max-w-(--container-receipt) border border-line px-4 py-5 font-mono shadow-raised print:border-0 print:shadow-none"
20
+ : "max-w-(--container-short) px-1 py-2"}`, children: [_jsxs("header", { className: "flex flex-col items-center gap-0.5 text-center", children: [_jsx("h3", { className: `${paper ? "text-body" : "text-title"} font-semibold`, children: issuer }), issuerLines.map((one) => (_jsx("p", { className: `${text} text-muted`, children: one }, one)))] }), _jsx("p", { "data-ui": "receipt.document", className: `border-y py-1 text-center ${text} font-semibold tracking-wide ${rule}`, children: document }), facts.length === 0 ? null : (_jsx("dl", { className: `flex flex-col gap-0.5 ${text}`, children: facts.map((one) => (_jsxs("div", { className: "flex min-w-0 justify-between gap-3", children: [_jsx("dt", { className: "shrink-0 text-muted", children: one.label }), _jsx("dd", { className: "min-w-0 truncate text-right", children: one.value })] }, one.label))) })), _jsx("ul", { "data-ui": "receipt.lines", className: `flex flex-col gap-1 border-t pt-2 ${text} ${rule}`, children: lines.map((one, at) => (_jsxs("li", { className: "flex min-w-0 flex-col", children: [_jsxs("span", { className: "flex min-w-0 items-baseline gap-2", children: [_jsx("span", { className: "shrink-0 tabular-nums", children: one.quantity }), _jsx("span", { className: "min-w-0 flex-1", children: one.name }), _jsx("span", { className: "shrink-0 tabular-nums", children: one.amount })] }), one.note === undefined ? null : (_jsx("span", { className: "pl-6 text-muted", children: one.note }))] }, `${one.name}-${at}`))) }), _jsx("dl", { "data-ui": "receipt.totals", className: `flex flex-col gap-0.5 border-t pt-2 ${rule}`, children: totals.map((one) => (_jsxs("div", { className: `flex min-w-0 items-baseline justify-between gap-3 ${one.total === true
21
+ ? `${paper ? "text-body" : "text-title"} font-semibold`
22
+ : `${text} text-muted`}`, children: [_jsx("dt", { className: "shrink-0", children: one.label }), _jsx("dd", { className: "min-w-0 truncate text-right text-ink tabular-nums", children: one.value })] }, one.label))) }), code === undefined ? null : (_jsx("div", { className: `flex justify-center border-t pt-2 ${rule}`, children: code })), footer.length === 0 ? null : (_jsx("footer", { className: `flex flex-col items-center gap-0.5 pt-1 text-center ${text} text-muted`, children: footer.map((one) => (_jsx("p", { children: one }, one))) }))] }));
23
+ }
@@ -0,0 +1 @@
1
+ export { Receipt, type ReceiptLine, type ReceiptProps, type ReceiptRow, } from "./Receipt.js";
@@ -0,0 +1,3 @@
1
+ /* THE TICKET — what a till prints (a sale note, an invoice, a kitchen order), and the same
2
+ document read on a screen across the counter. */
3
+ export { Receipt, } from "./Receipt.js";
@@ -1,4 +1,5 @@
1
1
  import { type CriteriaJoin, type CriteriaPath, type SearchCriteria } from "./criteria.js";
2
+ import { type QueryField } from "./query.js";
2
3
  import type { Surface } from "../../foundations/types.js";
3
4
  export type CriteriaChipsProps = {
4
5
  /** What the bar has set. Groups and filters mixed: here they are separated. */
@@ -22,6 +23,18 @@ export type CriteriaChipsProps = {
22
23
  /** How many facets show before the rest fold into «+N» (the grouping chain counts as one).
23
24
  * Below `@md` of the bar only the first one shows. `Infinity` never folds. */
24
25
  collapseAfter?: number;
26
+ /** The fields the bar asks about. With them a chip the bar wrote reads in its parts — field,
27
+ * comparison, value — and each part is touched on its own (see `chipParts`). */
28
+ fields?: readonly QueryField[];
29
+ /** One instance changed in place: a chip's comparison or value, edited on the chip. */
30
+ onReplace?: (path: CriteriaPath, next: SearchCriteria) => void;
31
+ /** The piece marked from the keyboard, by its place in `facetPaths`: ringed, never folded. */
32
+ marked?: number;
33
+ /** The piece whose value is being edited in place — Enter on a marked chip. */
34
+ editing?: number;
35
+ /** The edit in place ended — set or given up. `giveBack`: it ended from the keyboard (Enter,
36
+ * Escape) and the focus goes back to whoever owns it; a blur went somewhere on purpose. */
37
+ onEdited?: (giveBack: boolean) => void;
25
38
  surface?: Surface;
26
39
  };
27
- export declare function CriteriaChips({ criteria, onOpen, onJoin, onRemove, onRemoveMany, open, collapseAfter, surface, }: CriteriaChipsProps): import("react").JSX.Element;
40
+ export declare function CriteriaChips({ criteria, onOpen, onJoin, onRemove, onRemoveMany, open, collapseAfter, fields, onReplace, marked, editing, onEdited, surface, }: CriteriaChipsProps): import("react").JSX.Element;