@sincpro/web-ui 2.12.0 → 2.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (137) hide show
  1. package/README.md +56 -21
  2. package/dist/components/gallery/Gallery.d.ts +29 -0
  3. package/dist/components/gallery/Gallery.js +78 -0
  4. package/dist/components/gallery/Lightbox.d.ts +28 -0
  5. package/dist/components/gallery/Lightbox.js +59 -0
  6. package/dist/components/gallery/index.d.ts +2 -0
  7. package/dist/components/gallery/index.js +3 -0
  8. package/dist/components/index.d.ts +3 -0
  9. package/dist/components/index.js +3 -0
  10. package/dist/components/listing/BoardColumns.js +10 -6
  11. package/dist/components/listing/ColumnsMenu.js +4 -2
  12. package/dist/components/listing/Listing.js +3 -1
  13. package/dist/components/listing/ListingBar.d.ts +16 -94
  14. package/dist/components/listing/ListingBar.js +24 -2
  15. package/dist/components/listing/RecordCard.d.ts +41 -3
  16. package/dist/components/listing/RecordCard.js +63 -22
  17. package/dist/components/listing/Row.js +5 -2
  18. package/dist/components/listing/columns.d.ts +3 -0
  19. package/dist/components/listing/columns.js +4 -0
  20. package/dist/components/listing/index.d.ts +2 -2
  21. package/dist/components/listing/index.js +2 -2
  22. package/dist/components/listing/set.d.ts +1 -1
  23. package/dist/components/plans/PlanCard.d.ts +43 -0
  24. package/dist/components/plans/PlanCard.js +35 -0
  25. package/dist/components/plans/index.d.ts +1 -0
  26. package/dist/components/plans/index.js +2 -0
  27. package/dist/components/receipt/Receipt.d.ts +51 -0
  28. package/dist/components/receipt/Receipt.js +23 -0
  29. package/dist/components/receipt/index.d.ts +1 -0
  30. package/dist/components/receipt/index.js +3 -0
  31. package/dist/components/search/CriteriaChips.d.ts +14 -1
  32. package/dist/components/search/CriteriaChips.js +123 -13
  33. package/dist/components/search/JoinWord.js +8 -14
  34. package/dist/components/search/SearchBar.d.ts +10 -1
  35. package/dist/components/search/SearchBar.js +715 -176
  36. package/dist/components/search/WordChoice.d.ts +19 -0
  37. package/dist/components/search/WordChoice.js +8 -0
  38. package/dist/components/search/criteria.d.ts +27 -0
  39. package/dist/components/search/criteria.js +33 -0
  40. package/dist/components/search/index.d.ts +2 -2
  41. package/dist/components/search/index.js +2 -2
  42. package/dist/components/search/query.d.ts +24 -0
  43. package/dist/components/search/query.js +29 -0
  44. package/dist/components/shell/AppFrame.d.ts +4 -0
  45. package/dist/components/shell/AppFrame.js +4 -1
  46. package/dist/components/shell/Inbox.d.ts +53 -0
  47. package/dist/components/shell/Inbox.js +55 -0
  48. package/dist/components/shell/KioskFrame.d.ts +35 -0
  49. package/dist/components/shell/KioskFrame.js +39 -0
  50. package/dist/components/shell/SearchEntry.js +2 -3
  51. package/dist/components/shell/TopBar.d.ts +4 -2
  52. package/dist/components/shell/TopBar.js +3 -3
  53. package/dist/components/shell/index.d.ts +2 -0
  54. package/dist/components/shell/index.js +4 -0
  55. package/dist/foundations/clock.d.ts +3 -0
  56. package/dist/foundations/clock.js +41 -0
  57. package/dist/foundations/copy.es.js +86 -1
  58. package/dist/foundations/form.d.ts +7 -0
  59. package/dist/foundations/form.js +1 -0
  60. package/dist/foundations/idle.d.ts +1 -0
  61. package/dist/foundations/idle.js +34 -0
  62. package/dist/foundations/index.d.ts +3 -0
  63. package/dist/foundations/index.js +7 -0
  64. package/dist/foundations/pointer.d.ts +25 -0
  65. package/dist/foundations/pointer.js +28 -0
  66. package/dist/foundations/uiCopy.d.ts +123 -2
  67. package/dist/foundations/uiCopy.js +86 -1
  68. package/dist/primitives/choice/RadioGroup.d.ts +8 -1
  69. package/dist/primitives/choice/RadioGroup.js +38 -1
  70. package/dist/primitives/choice/Rating.d.ts +32 -0
  71. package/dist/primitives/choice/Rating.js +75 -0
  72. package/dist/primitives/choice/Slider.d.ts +19 -0
  73. package/dist/primitives/choice/Slider.js +27 -2
  74. package/dist/primitives/choice/index.d.ts +2 -1
  75. package/dist/primitives/choice/index.js +4 -1
  76. package/dist/primitives/choice/options.d.ts +7 -0
  77. package/dist/primitives/field/Field.js +1 -0
  78. package/dist/primitives/field/Keypad.d.ts +43 -0
  79. package/dist/primitives/field/Keypad.js +62 -0
  80. package/dist/primitives/field/Stepper.d.ts +28 -0
  81. package/dist/primitives/field/Stepper.js +52 -0
  82. package/dist/primitives/field/clipboard.js +1 -1
  83. package/dist/primitives/field/index.d.ts +3 -0
  84. package/dist/primitives/field/index.js +6 -0
  85. package/dist/primitives/field/keypadKeys.d.ts +24 -0
  86. package/dist/primitives/field/keypadKeys.js +80 -0
  87. package/dist/primitives/hint/Hint.js +1 -1
  88. package/dist/primitives/hint/Kbd.d.ts +23 -0
  89. package/dist/primitives/hint/Kbd.js +23 -0
  90. package/dist/primitives/hint/index.d.ts +1 -0
  91. package/dist/primitives/hint/index.js +2 -0
  92. package/dist/primitives/menu/ContextMenu.d.ts +29 -0
  93. package/dist/primitives/menu/ContextMenu.js +74 -0
  94. package/dist/primitives/menu/Menu.d.ts +4 -1
  95. package/dist/primitives/menu/Menu.js +2 -2
  96. package/dist/primitives/menu/index.d.ts +1 -0
  97. package/dist/primitives/menu/index.js +2 -0
  98. package/dist/primitives/notice/Banner.d.ts +27 -0
  99. package/dist/primitives/notice/Banner.js +21 -0
  100. package/dist/primitives/notice/Callout.d.ts +4 -4
  101. package/dist/primitives/notice/Callout.js +8 -19
  102. package/dist/primitives/notice/Flag.js +1 -1
  103. package/dist/primitives/notice/Notice.d.ts +38 -10
  104. package/dist/primitives/notice/Notice.js +48 -9
  105. package/dist/primitives/notice/Outcome.d.ts +28 -0
  106. package/dist/primitives/notice/Outcome.js +28 -0
  107. package/dist/primitives/notice/index.d.ts +4 -1
  108. package/dist/primitives/notice/index.js +5 -0
  109. package/dist/primitives/notice/tones.d.ts +8 -0
  110. package/dist/primitives/notice/tones.js +22 -0
  111. package/dist/primitives/table/CellCopy.js +1 -1
  112. package/dist/primitives/table/ReportTable.js +1 -1
  113. package/dist/primitives/table/RowActions.js +1 -1
  114. package/dist/primitives/table/Table.js +9 -5
  115. package/dist/primitives/tag/Tags.d.ts +22 -1
  116. package/dist/primitives/tag/Tags.js +57 -14
  117. package/dist/primitives/tag/index.d.ts +1 -1
  118. package/dist/primitives/value/Elapsed.d.ts +16 -0
  119. package/dist/primitives/value/Elapsed.js +37 -0
  120. package/dist/primitives/value/Price.d.ts +31 -0
  121. package/dist/primitives/value/Price.js +32 -0
  122. package/dist/primitives/value/QrCode.d.ts +32 -0
  123. package/dist/primitives/value/QrCode.js +53 -0
  124. package/dist/primitives/value/elapsedTime.d.ts +26 -0
  125. package/dist/primitives/value/elapsedTime.js +32 -0
  126. package/dist/primitives/value/index.d.ts +5 -0
  127. package/dist/primitives/value/index.js +10 -0
  128. package/dist/primitives/value/priceFormat.d.ts +12 -0
  129. package/dist/primitives/value/priceFormat.js +22 -0
  130. package/dist/tokens.css +126 -1
  131. package/dist/views/list/List.d.ts +11 -0
  132. package/dist/views/list/List.js +14 -3
  133. package/dist/views/list/ListView.d.ts +1 -1
  134. package/dist/views/list/ListView.js +48 -9
  135. package/dist/views/list/types.d.ts +15 -0
  136. package/dist/views/record/Record.js +1 -1
  137. package/package.json +3 -2
@@ -0,0 +1,19 @@
1
+ export interface WordOption<K extends string> {
2
+ id: K;
3
+ label: string;
4
+ /** What tells it apart when the word alone does not: «<=» beside «como mucho». */
5
+ note?: string;
6
+ }
7
+ export declare function WordChoice<K extends string>({ value, options, onChange, label, word, className, }: {
8
+ value: K;
9
+ options: readonly WordOption<K>[];
10
+ onChange: (next: K) => void;
11
+ /** What the word decides — the trigger's and the list's name. */
12
+ label: string;
13
+ /** The word as it reads in the bar —«como mucho», «todas»—. It STARTS the trigger's name
14
+ * («como mucho, comparar total de otra manera»): a name that does not hold what is seen
15
+ * fails whoever drives the screen by voice, saying the word they read. */
16
+ word: string;
17
+ /** How the word looks; the trigger is a button and takes the focus ring from here. */
18
+ className: string;
19
+ }): import("react").JSX.Element;
@@ -0,0 +1,8 @@
1
+ "use client";
2
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { Popover } from "../../primitives/overlay/Popover.js";
4
+ import { Check } from "lucide-react";
5
+ import { Button as AriaButton, Menu as AriaMenu, MenuItem, MenuTrigger, } from "react-aria-components";
6
+ export function WordChoice({ value, options, onChange, label, word, className, }) {
7
+ return (_jsxs(MenuTrigger, { children: [_jsx(AriaButton, { "aria-label": `${word}, ${label.toLocaleLowerCase()}`, className: className, children: word }), _jsx(Popover, { placement: "bottom start", className: "min-w-36 p-1", children: _jsx(AriaMenu, { "aria-label": label, selectionMode: "single", selectedKeys: [value], disallowEmptySelection: true, autoFocus: "first", onAction: (key) => onChange(String(key)), className: "flex max-h-72 flex-col gap-0.5 overflow-y-auto outline-0", children: options.map((one) => (_jsx(MenuItem, { id: one.id, textValue: one.label, className: "flex cursor-pointer items-center gap-2 rounded-ui-option px-2 py-1 text-meta text-ink outline-0 transition-colors duration-(--duration-instant) data-focused:bg-ui-option-active", children: ({ isSelected }) => (_jsxs(_Fragment, { children: [_jsx("span", { className: "flex size-(--size-icon-sm) shrink-0 items-center justify-center", children: isSelected ? (_jsx(Check, { className: "size-(--size-icon-sm) text-primary", strokeWidth: 2.5, "aria-hidden": true })) : null }), _jsx("span", { className: `min-w-0 flex-1 truncate ${isSelected ? "font-medium" : ""}`, children: one.label }), one.note === undefined ? null : (_jsx("span", { className: "shrink-0 font-mono text-micro text-muted", children: one.note }))] })) }, one.id))) }) })] }));
8
+ }
@@ -121,6 +121,14 @@ export type GroupCriteria = Extract<SearchCriteria, {
121
121
  export declare function groupsOf(all: readonly SearchCriteria[]): GroupCriteria[];
122
122
  /** The filter ones, which are the ones that nest. */
123
123
  export declare function filtersOf(all: readonly SearchCriteria[]): SearchCriteria[];
124
+ /**
125
+ * The PIECES the bar draws, in its order, each with the top-level paths it covers: the
126
+ * grouping chain first —every level in ONE piece—, then each filter on top.
127
+ *
128
+ * It is what the keyboard walks: ← on the empty bar marks the last piece, and removing a
129
+ * piece removes everything it covers — the whole chain, or one filter with its nesting.
130
+ */
131
+ export declare function facetPaths(all: readonly SearchCriteria[]): CriteriaPath[][];
124
132
  /** The instance at that path, if there is one. */
125
133
  export declare function at(all: readonly SearchCriteria[], path: CriteriaPath): SearchCriteria | undefined;
126
134
  /** The same tree with one instance changed. Returning a new one and not touching the
@@ -133,6 +141,25 @@ export declare function replaceAt(all: readonly SearchCriteria[], path: Criteria
133
141
  * parenthesis around nothing, and leaving it forces reading a group that does not group.
134
142
  */
135
143
  export declare function removeAt(all: readonly SearchCriteria[], path: CriteriaPath): SearchCriteria[];
144
+ /** What was removed, and how to put it back: «Quitado: cliente contiene andina · Deshacer». */
145
+ export type Removal = {
146
+ label: string;
147
+ removed: readonly {
148
+ path: CriteriaPath;
149
+ node: SearchCriteria;
150
+ }[];
151
+ before: readonly SearchCriteria[];
152
+ after: readonly SearchCriteria[];
153
+ };
154
+ /**
155
+ * What was removed, back in the list as it is NOW.
156
+ *
157
+ * A removed piece on top goes back to its place even if something was set after it — undoing
158
+ * one chip must not take away the next one. A piece removed from inside a group can only go
159
+ * back while nothing changed since: its group may be gone (`removeAt` dismantles a group left
160
+ * with one), and guessing where it lands is worse than not offering it.
161
+ */
162
+ export declare function restoreRemoval(current: readonly SearchCriteria[], removal: Removal): SearchCriteria[] | null;
136
163
  /** How a node's instances are joined: `all` → `any` → `not` and round again. It is
137
164
  * the same wheel the selector shows open, for whoever prefers the
138
165
  * shortcut. */
@@ -7,6 +7,18 @@ export function groupsOf(all) {
7
7
  export function filtersOf(all) {
8
8
  return all.filter((one) => one.kind !== "group");
9
9
  }
10
+ /**
11
+ * The PIECES the bar draws, in its order, each with the top-level paths it covers: the
12
+ * grouping chain first —every level in ONE piece—, then each filter on top.
13
+ *
14
+ * It is what the keyboard walks: ← on the empty bar marks the last piece, and removing a
15
+ * piece removes everything it covers — the whole chain, or one filter with its nesting.
16
+ */
17
+ export function facetPaths(all) {
18
+ const groups = all.flatMap((one, index) => (one.kind === "group" ? [[index]] : []));
19
+ const filters = all.flatMap((one, index) => (one.kind === "group" ? [] : [[[index]]]));
20
+ return [...(groups.length === 0 ? [] : [groups]), ...filters];
21
+ }
10
22
  /** The instance at that path, if there is one. */
11
23
  export function at(all, path) {
12
24
  const [head, ...rest] = path;
@@ -56,6 +68,27 @@ export function removeAt(all, path) {
56
68
  return [{ ...one, of: inside }];
57
69
  });
58
70
  }
71
+ /**
72
+ * What was removed, back in the list as it is NOW.
73
+ *
74
+ * A removed piece on top goes back to its place even if something was set after it — undoing
75
+ * one chip must not take away the next one. A piece removed from inside a group can only go
76
+ * back while nothing changed since: its group may be gone (`removeAt` dismantles a group left
77
+ * with one), and guessing where it lands is worse than not offering it.
78
+ */
79
+ export function restoreRemoval(current, removal) {
80
+ if (removal.removed.every((one) => one.path.length === 1)) {
81
+ const next = [...current];
82
+ const ordered = [...removal.removed].sort((a, b) => (a.path[0] ?? 0) - (b.path[0] ?? 0));
83
+ for (const one of ordered) {
84
+ if (next.some((each) => each.id === one.node.id))
85
+ continue;
86
+ next.splice(Math.min(one.path[0] ?? next.length, next.length), 0, one.node);
87
+ }
88
+ return next;
89
+ }
90
+ return current === removal.after ? [...removal.before] : null;
91
+ }
59
92
  /** How a node's instances are joined: `all` → `any` → `not` and round again. It is
60
93
  * the same wheel the selector shows open, for whoever prefers the
61
94
  * shortcut. */
@@ -7,10 +7,10 @@ export { formatJson } from "./formatJson.js";
7
7
  export { JsonEditor } from "./JsonEditor.js";
8
8
  export { createModelCache, type FieldPathStep, type FieldPathValue, isRelation, isToMany, type LoadModel, type ModelCache, pathLabel, peekLabels, resolvePath, } from "./paths.js";
9
9
  export { SearchBar, type SearchBarProps, type SearchFacet, } from "./SearchBar.js";
10
- export { at, criteriaId, type CriteriaJoin, type CriteriaPath, filterCriteria, filtersOf, type GroupCriteria, groupCriteria, groupsOf, hasNamed, levelsOf, nextJoin, type RecordKey, type RecordOption, removeAt, replaceAt, type SearchCriteria, selectionOf, toggleNamed, withLevels, } from "./criteria.js";
10
+ export { at, criteriaId, type CriteriaJoin, type CriteriaPath, facetPaths, filterCriteria, filtersOf, type GroupCriteria, groupCriteria, groupsOf, hasNamed, levelsOf, nextJoin, type RecordKey, type RecordOption, type Removal, removeAt, replaceAt, restoreRemoval, type SearchCriteria, selectionOf, toggleNamed, withLevels, } from "./criteria.js";
11
11
  export { CriteriaChips, type CriteriaChipsProps, } from "./CriteriaChips.js";
12
12
  export { choiceLabel, type FieldDefinition, fieldLabel, filterableNames, isFilterable, isNumericType, type ModelDefinition, type ModelTranslations, } from "./model.js";
13
- export { answers, choiceValues, conditionCriteria, defaultOp, describeCondition, fieldKey, globToLike, opLabel, type QueryDraft, type QueryField, queryField, queryFields, type QueryKind, type QuerySuggestion, readTyped, sayValues, suggest, type TypedValue, valueFor, valueLabel, valuesCriteria, type ValueShape, valuesSelection, withoutValue, withValue, } from "./query.js";
13
+ export { answers, type ChipParts, chipParts, choiceValues, conditionCriteria, defaultOp, describeCondition, fieldKey, globToLike, opLabel, type QueryDraft, type QueryField, queryField, queryFields, type QueryKind, type QuerySuggestion, readTyped, sayValues, suggest, type TypedValue, valueFor, valueLabel, valuesCriteria, type ValueShape, valuesSelection, withoutValue, withParts, withValue, } from "./query.js";
14
14
  export { SearchProvider, type SearchSettings, useSearchSettings, type ValueEditor, type ValueEditorProps, } from "./context.js";
15
15
  export { type BrowseRecords, type RecordBrowse, type RecordSearch, recordsFilter, recordsOf, type RecordTarget, recordTarget, sameKey, type SearchRecords, } from "./records.js";
16
16
  export { RuleValue } from "./RuleValue.js";
@@ -15,7 +15,7 @@ export { SearchBar, } from "./SearchBar.js";
15
15
  /* WHAT THE BAR HAS SET: instances. A single thing for both kinds
16
16
  —group and filter—, with their UI metadata outside and the engine's object
17
17
  inside, intact. */
18
- export { at, criteriaId, filterCriteria, filtersOf, groupCriteria, groupsOf, hasNamed, levelsOf, nextJoin, removeAt, replaceAt, selectionOf, toggleNamed, withLevels, } from "./criteria.js";
18
+ export { at, criteriaId, facetPaths, filterCriteria, filtersOf, groupCriteria, groupsOf, hasNamed, levelsOf, nextJoin, removeAt, replaceAt, restoreRemoval, selectionOf, toggleNamed, withLevels, } from "./criteria.js";
19
19
  export { CriteriaChips, } from "./CriteriaChips.js";
20
20
  /* THE MODEL'S VOCABULARY — what the server publishes about its fields. The
21
21
  filter builder, the criteria builder and the search bar speak it, so
@@ -23,7 +23,7 @@ export { CriteriaChips, } from "./CriteriaChips.js";
23
23
  export { choiceLabel, fieldLabel, filterableNames, isFilterable, isNumericType, } from "./model.js";
24
24
  /* THE BAR'S GRAMMAR: what can be asked about a model, and with what.
25
25
  Three steps —field, operator, value— that can be written as one. */
26
- export { answers, choiceValues, conditionCriteria, defaultOp, describeCondition, fieldKey, globToLike, opLabel, queryField, queryFields, readTyped, sayValues, suggest, valueFor, valueLabel, valuesCriteria, valuesSelection, withoutValue, withValue, } from "./query.js";
26
+ export { answers, chipParts, choiceValues, conditionCriteria, defaultOp, describeCondition, fieldKey, globToLike, opLabel, queryField, queryFields, readTyped, sayValues, suggest, valueFor, valueLabel, valuesCriteria, valuesSelection, withoutValue, withParts, withValue, } from "./query.js";
27
27
  /* THE RECORDS OF A RELATION: chosen by name, sent by key. The application gives ONE search
28
28
  (`searchRecords`) — by prop, or once for every bar and builder with `SearchProvider` — and
29
29
  its own value controls (`valueEditor`) for the fields it draws its way. */
@@ -236,6 +236,30 @@ export declare function describeCondition(field: QueryField, op: string, value:
236
236
  /** The question about one field as a chip — what the bar puts when a condition is chosen:
237
237
  * «nombre contiene test». */
238
238
  export declare function conditionCriteria(field: QueryField, op: string, value: string): SearchCriteria;
239
+ /**
240
+ * A chip's PARTS — the field, the comparison and the value —, when the chip is a question the
241
+ * bar itself writes.
242
+ *
243
+ * Context: «total como mucho 1000» read at one weight, and changing 1000 to 2000 meant opening
244
+ * the whole builder. Split, the chip reads the way the eye scans it —the field quiet, the
245
+ * comparison a small word, the value strong— and each part is touched on its own. Only a chip
246
+ * that DESCRIBES itself splits: a declared one keeps its name («sólo vencidas») and is one
247
+ * piece, since that name is somebody's decision and not the condition read aloud.
248
+ */
249
+ export type ChipParts = {
250
+ kind: "condition";
251
+ field: QueryField;
252
+ op: string;
253
+ value: string;
254
+ } | {
255
+ kind: "values";
256
+ field: QueryField;
257
+ values: readonly RecordOption[];
258
+ };
259
+ export declare function chipParts(node: SearchCriteria, fields: readonly QueryField[]): ChipParts | undefined;
260
+ /** The same chip asking with another comparison or value — its identity (`id`) kept, so it
261
+ * stays where it was and nothing that points at it loses it. */
262
+ export declare function withParts(node: SearchCriteria, field: QueryField, op: string, value: string): SearchCriteria;
239
263
  /** What asks for these values of a field: records of a relation by their key (see
240
264
  * `recordsFilter`), values of an enum or of any column with `=` / `in`. */
241
265
  export declare function valuesSelection(field: QueryField, values: readonly RecordOption[]): BuiltCondition | BuiltFilter;
@@ -617,6 +617,35 @@ export function conditionCriteria(field, op, value) {
617
617
  «está vacío»: sending it the empty string would be asking for the field that is "". */
618
618
  { field: field.field, operator: op, value: withoutValue(op) ? true : value }, describeCondition(field, op, value));
619
619
  }
620
+ export function chipParts(node, fields) {
621
+ if (node.kind !== "filter" || node.selection === undefined)
622
+ return undefined;
623
+ if (node.values !== undefined) {
624
+ const field = fields.find((one) => node.id === `v:${fieldKey(one)}`);
625
+ return field === undefined || node.values.length === 0
626
+ ? undefined
627
+ : { kind: "values", field, values: node.values };
628
+ }
629
+ const selection = node.selection;
630
+ if (!("operator" in selection))
631
+ return undefined;
632
+ const op = selection.operator;
633
+ const raw = selection.value;
634
+ const value = withoutValue(op)
635
+ ? ""
636
+ : typeof raw === "string" || typeof raw === "number"
637
+ ? String(raw)
638
+ : undefined;
639
+ if (value === undefined)
640
+ return undefined;
641
+ const field = fields.find((one) => one.field === selection.field && node.label === describeCondition(one, op, value));
642
+ return field === undefined ? undefined : { kind: "condition", field, op, value };
643
+ }
644
+ /** The same chip asking with another comparison or value — its identity (`id`) kept, so it
645
+ * stays where it was and nothing that points at it loses it. */
646
+ export function withParts(node, field, op, value) {
647
+ return { ...conditionCriteria(field, op, value), id: node.id };
648
+ }
620
649
  /** What asks for these values of a field: records of a relation by their key (see
621
650
  * `recordsFilter`), values of an enum or of any column with `=` / `in`. */
622
651
  export function valuesSelection(field, values) {
@@ -1,6 +1,9 @@
1
1
  import type { Surface } from "../../foundations/types.js";
2
2
  import { type ReactNode } from "react";
3
3
  export declare function AppFrame({
4
+ /** A notice about the whole application — a `Banner` — above the bar, edge to edge. It
5
+ * scrolls away with the page: stuck on top it would take a line from every screen. */
6
+ banner,
4
7
  /** The bar at the top. It stays in view while scrolling. */
5
8
  menu,
6
9
  /** The band at the bottom. It goes AFTER the content, not pinned to the
@@ -20,6 +23,7 @@ sidebarSurface,
20
23
  /** Who scrolls. `page` (the default): the whole page, with the bars stuck on top. `view`:
21
24
  * the frame is the window's height and the view scrolls inside itself — a workspace. */
22
25
  scroll, children, }: {
26
+ banner?: ReactNode;
23
27
  menu?: ReactNode;
24
28
  status?: ReactNode;
25
29
  sidebar?: ReactNode;
@@ -134,6 +134,9 @@ function SidebarDrawerPanel({ id, open, onClose, surface, children, }) {
134
134
  }, isDismissable: true, className: ({ isEntering, isExiting }) => `fixed inset-0 z-50 bg-scrim/40 transition-opacity duration-(--duration-quick) ease-(--ease-out) sm:hidden print:hidden ${isEntering || isExiting ? "opacity-0" : ""}`, children: _jsx(Modal, { className: ({ isEntering, isExiting }) => `fixed inset-y-0 start-0 flex w-(--container-drawer) flex-col border-e shadow-window outline-0 transition-[translate] duration-(--duration-panel) ease-(--ease-out) ${bySurface(surface, "border-line-strong bg-ground", "border-chrome-edge bg-chrome")} ${isEntering || isExiting ? "-translate-x-full rtl:translate-x-full" : ""}`, children: _jsx(AriaDialog, { id: id, "aria-label": copy.shell.navigation, className: "flex min-h-0 flex-1 flex-col outline-0", children: _jsxs(SurfaceProvider, { value: surface, children: [_jsx("div", { className: "flex shrink-0 justify-end px-2 pt-2", children: _jsx(IconButton, { icon: X, label: copy.shell.close, onClick: onClose }) }), _jsx("div", { className: "flex min-h-0 flex-1 flex-col overflow-y-auto", onClickCapture: closeOnLink(onClose), children: children })] }) }) }) }));
135
135
  }
136
136
  export function AppFrame({
137
+ /** A notice about the whole application — a `Banner` — above the bar, edge to edge. It
138
+ * scrolls away with the page: stuck on top it would take a line from every screen. */
139
+ banner,
137
140
  /** The bar at the top. It stays in view while scrolling. */
138
141
  menu,
139
142
  /** The band at the bottom. It goes AFTER the content, not pinned to the
@@ -201,7 +204,7 @@ scroll = "page", children, }) {
201
204
  for both made the navigation read as part of the list bar. On the chrome it wears the
202
205
  brand's colour. On a phone it is hidden: the drawer shows it. */
203
206
  const aside = sidebar === undefined ? null : (_jsx("aside", { className: `sticky w-(--container-sidebar) shrink-0 self-start overflow-y-auto overscroll-contain border-r max-sm:hidden print:hidden ${bySurface(sidebarSurface, "border-ui-sidebar-border bg-ui-sidebar", "border-chrome-edge bg-chrome")}`, style: { ...stickyTop, height: "calc(100dvh - var(--sticky-top, 0px))" }, "data-ui": "frame.sidebar", children: _jsx(SurfaceProvider, { value: sidebarSurface, children: sidebar }) }));
204
- return (_jsx(SidebarDrawerContext, { value: drawer, children: _jsxs("div", { className: `relative flex min-w-0 flex-col bg-ground ${fills ? "h-dvh overflow-hidden print:h-auto print:overflow-visible" : "min-h-dvh"}`, "data-ui": "frame", "data-scroll": scroll, children: [top === undefined ? null : (
207
+ return (_jsx(SidebarDrawerContext, { value: drawer, children: _jsxs("div", { className: `relative flex min-w-0 flex-col bg-ground ${fills ? "h-dvh overflow-hidden print:h-auto print:overflow-visible" : "min-h-dvh"}`, "data-ui": "frame", "data-scroll": scroll, children: [banner === undefined ? null : (_jsx("div", { className: "shrink-0", "data-ui": "frame.banner", children: banner })), top === undefined ? null : (
205
208
  /* Hidden on a wide screen when it is only the phone's bar: it measures 0 there, so
206
209
  nothing below is pushed down by it. */
207
210
  _jsx("div", { ref: bar.ref, className: `sticky top-0 z-40 print:hidden ${sidebarIsChrome ? "sm:hidden" : ""}`, "data-ui": "frame.bar", children: top })), sidebar === undefined ? (_jsx("main", { className: `flex min-w-0 flex-1 flex-col ${mainScroll}`, style: fills ? stickyReset() : bar.below, "data-ui": "frame.main", children: children })) : sidebarIsChrome ? (_jsxs("div", { className: `flex min-w-0 flex-1 items-start ${region}`, style: bar.below, children: [aside, _jsx("main", { className: `flex min-w-0 flex-1 flex-col self-stretch ${mainScroll}`, ...(fills ? { style: stickyReset() } : {}), "data-ui": "frame.main", children: children })] })) : (_jsx(HeaderSlotContext, { value: slot, children: _jsxs("div", { className: `flex min-w-0 flex-1 flex-col ${region}`, style: bar.below, children: [_jsx("div", { ref: (node) => {
@@ -0,0 +1,53 @@
1
+ import type { Tone } from "../../foundations/types.js";
2
+ import { type LucideIcon } from "lucide-react";
3
+ export type InboxItem = {
4
+ id: string;
5
+ /** What happened, in a line: «Tu pedido 0047 salió a reparto». */
6
+ title: string;
7
+ /** The rest, two lines at most. */
8
+ detail?: string;
9
+ when: Date | string;
10
+ /** Not seen yet: a dot, the title in bold, and said. */
11
+ unread?: boolean;
12
+ /** When it is a notice of a degree — a payment rejected (`bad`), a stock low (`warn`). Its
13
+ * icon comes with it, as in a `Callout`. */
14
+ tone?: Extract<Tone, "info" | "warn" | "bad" | "good">;
15
+ /** An icon of its own (a truck, a message) when it is not a notice of a degree. */
16
+ icon?: LucideIcon;
17
+ };
18
+ export type InboxListProps = {
19
+ items: readonly InboxItem[];
20
+ /** Pressing one: the application opens what it is about (and marks it read). */
21
+ onOpen?: (id: string) => void;
22
+ /** «Marcar todo como leído» — drawn while something is unread. */
23
+ onMarkAllRead?: () => void;
24
+ /** «Ver todas» — the page with the whole history, when the application has one. */
25
+ onSeeAll?: () => void;
26
+ /** «Notificaciones» by default. */
27
+ title?: string;
28
+ /** The clock the times are read against; now by default (a test passes a fixed one). */
29
+ now?: Date;
30
+ };
31
+ /**
32
+ * The notifications themselves, as a list: in the bar's popover (`Inbox`), or as the whole
33
+ * page of a portal's «Notificaciones».
34
+ *
35
+ * Context: unread is not only a colour — the dot goes with the title in bold and with the word
36
+ * said to a screen reader. The time is relative while it is recent («hace 5 minutos») and a
37
+ * date after a week, the way the activity writes it. The newest first is the application's
38
+ * order: it is passed already sorted, as a list is.
39
+ */
40
+ export declare function InboxList({ items, onOpen, onMarkAllRead, onSeeAll, title, now, }: InboxListProps): import("react").JSX.Element;
41
+ export type InboxProps = InboxListProps & {
42
+ /** The bell by default. */
43
+ icon?: LucideIcon;
44
+ };
45
+ /**
46
+ * The notifications, from the bar: a bell with how many are unread, and the list in a
47
+ * popover — the portal's «tu pedido salió», the ERP's «te asignaron una tarea».
48
+ *
49
+ * Context: the bell is a `SystrayButton` — zero is not drawn, past 99 it says «99+», and the
50
+ * number is in its name — and the list is `InboxList` on the paper even under the navy bar.
51
+ * Opening one closes the popover: what it is about takes the screen.
52
+ */
53
+ export declare function Inbox({ icon, onOpen, ...list }: InboxProps): import("react").JSX.Element;
@@ -0,0 +1,55 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { SystrayButton } from "./TopBar.js";
4
+ import { fillCopy, useUiCopy } from "../../foundations/copy.js";
5
+ import { SurfaceProvider } from "../../foundations/surface.js";
6
+ import { Button } from "../../primitives/button/Button.js";
7
+ import { Empty } from "../../primitives/notice/Notice.js";
8
+ import { NOTICE_ICON } from "../../primitives/notice/tones.js";
9
+ import { Popover } from "../../primitives/overlay/Popover.js";
10
+ import { formatRelative } from "../../primitives/value/format.js";
11
+ import { Bell } from "lucide-react";
12
+ import { useState } from "react";
13
+ import { Dialog, DialogTrigger, Heading, Pressable } from "react-aria-components";
14
+ const ICON_TONE = {
15
+ info: "text-info",
16
+ good: "text-good",
17
+ warn: "text-warn",
18
+ bad: "text-bad",
19
+ };
20
+ /**
21
+ * The notifications themselves, as a list: in the bar's popover (`Inbox`), or as the whole
22
+ * page of a portal's «Notificaciones».
23
+ *
24
+ * Context: unread is not only a colour — the dot goes with the title in bold and with the word
25
+ * said to a screen reader. The time is relative while it is recent («hace 5 minutos») and a
26
+ * date after a week, the way the activity writes it. The newest first is the application's
27
+ * order: it is passed already sorted, as a list is.
28
+ */
29
+ export function InboxList({ items, onOpen, onMarkAllRead, onSeeAll, title, now, }) {
30
+ const copy = useUiCopy();
31
+ const unread = items.filter((item) => item.unread === true).length;
32
+ return (_jsxs("div", { "data-ui": "inbox", className: "flex min-w-0 flex-col", children: [_jsxs("div", { className: "flex items-center justify-between gap-3 border-b border-line px-3 py-2", children: [_jsxs(Heading, { slot: "title", level: 2, className: "text-meta font-semibold text-ink", children: [title ?? copy.inbox.label, unread === 0 ? null : (_jsx("span", { className: "ml-1.5 font-normal text-muted tabular-nums", children: fillCopy(copy.inbox.unreadCount, { count: unread }) }))] }), onMarkAllRead === undefined || unread === 0 ? null : (_jsx(Button, { role: "ghost", size: "sm", onClick: onMarkAllRead, children: copy.inbox.markAllRead }))] }), items.length === 0 ? (_jsx(Empty, { sentence: copy.inbox.empty })) : (_jsx("ul", { className: "flex flex-col divide-y divide-line", children: items.map((item) => {
33
+ const Icon = item.icon ?? (item.tone === undefined ? undefined : NOTICE_ICON[item.tone]);
34
+ const fresh = item.unread === true;
35
+ return (_jsx("li", { children: _jsxs("button", { type: "button", "data-ui": "inbox.item", "data-unread": fresh ? "" : undefined, onClick: () => onOpen?.(item.id), className: `flex w-full items-start gap-3 px-3 py-2.5 text-left transition-colors duration-(--duration-instant) hover:bg-ink/4 focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-primary ${fresh ? "bg-primary/4" : ""}`, children: [Icon === undefined ? null : (_jsx(Icon, { "aria-hidden": true, strokeWidth: 2, className: `mt-0.5 size-(--size-icon-md) shrink-0 ${item.tone === undefined ? "text-muted" : ICON_TONE[item.tone]}` })), _jsxs("span", { className: "flex min-w-0 flex-1 flex-col gap-0.5", children: [_jsxs("span", { className: `text-meta text-ink ${fresh ? "font-semibold" : "font-normal"}`, children: [fresh ? _jsxs("span", { className: "sr-only", children: [copy.inbox.unread, ": "] }) : null, item.title] }), item.detail === undefined ? null : (_jsx("span", { className: "line-clamp-2 text-meta text-muted", children: item.detail })), _jsx("span", { className: "text-micro text-muted tabular-nums", children: formatRelative(new Date(item.when), now, copy) })] }), fresh ? (_jsx("span", { "aria-hidden": true, className: "mt-1.5 size-2 shrink-0 rounded-pill bg-primary" })) : null] }) }, item.id));
36
+ }) })), onSeeAll === undefined ? null : (_jsx("div", { className: "border-t border-line px-1 py-1", children: _jsx(Button, { role: "ghost", size: "sm", onClick: onSeeAll, children: copy.inbox.seeAll }) }))] }));
37
+ }
38
+ /**
39
+ * The notifications, from the bar: a bell with how many are unread, and the list in a
40
+ * popover — the portal's «tu pedido salió», the ERP's «te asignaron una tarea».
41
+ *
42
+ * Context: the bell is a `SystrayButton` — zero is not drawn, past 99 it says «99+», and the
43
+ * number is in its name — and the list is `InboxList` on the paper even under the navy bar.
44
+ * Opening one closes the popover: what it is about takes the screen.
45
+ */
46
+ export function Inbox({ icon = Bell, onOpen, ...list }) {
47
+ const copy = useUiCopy();
48
+ const [open, setOpen] = useState(false);
49
+ const unread = list.items.filter((item) => item.unread === true).length;
50
+ const label = list.title ?? copy.inbox.label;
51
+ return (_jsxs(DialogTrigger, { isOpen: open, onOpenChange: setOpen, children: [_jsx(Pressable, { children: _jsx(SystrayButton, { icon: icon, label: label, count: unread, active: open, "aria-haspopup": "dialog", "aria-expanded": open }) }), _jsx(Popover, { placement: "bottom end", children: _jsx(Dialog, { "aria-label": label, className: "max-h-[inherit] w-(--container-inbox) overflow-auto outline-0", children: _jsx(SurfaceProvider, { value: "canvas", children: _jsx(InboxList, { ...list, onOpen: (id) => {
52
+ setOpen(false);
53
+ onOpen?.(id);
54
+ } }) }) }) })] }));
55
+ }
@@ -0,0 +1,35 @@
1
+ import { type LucideIcon } from "lucide-react";
2
+ import { type ReactNode } from "react";
3
+ export type KioskFrameProps = {
4
+ /** The self-service flow: the menu, the steps, the payment. */
5
+ children: ReactNode;
6
+ /** The screen that waits for someone: a title that invites, a line under it, and the call
7
+ * — «Tocá para pedir». Pressing anywhere on it starts. */
8
+ attract: {
9
+ title: string;
10
+ subtitle?: string;
11
+ call?: string;
12
+ icon?: LucideIcon;
13
+ };
14
+ /** Seconds without a touch before the kiosk goes back to `attract` and calls `onIdle` (to
15
+ * drop the abandoned order). 0 never. */
16
+ idleAfter?: number;
17
+ onIdle?: () => void;
18
+ /** Controlled: whether the attract screen is showing. Uncontrolled it starts on it. */
19
+ waiting?: boolean;
20
+ onWaitingChange?: (waiting: boolean) => void;
21
+ /** Who runs the kiosk, in its corner: the brand. */
22
+ brand?: ReactNode;
23
+ };
24
+ /**
25
+ * The frame of a self-service screen — a kiosk at a café, a check-in totem, a pickup point.
26
+ *
27
+ * Context: a kiosk is not an application someone opens: it waits for a stranger, is used once
28
+ * standing up, and is left half-way. So the frame does three things no screen inside should
29
+ * have to: it WAITS (an attract screen, pressed anywhere to start), it FORGETS (after
30
+ * `idleAfter` seconds without a touch it goes back and tells the application to drop the
31
+ * order), and it REACHES (a button in the corner brings the content down to the lower half
32
+ * for someone seated, the way the big chains' kiosks do). It says «touch» for its whole area
33
+ * (`data-pointer`): a kiosk's screen may report a mouse.
34
+ */
35
+ export declare function KioskFrame({ children, attract, idleAfter, onIdle, waiting: controlled, onWaitingChange, brand, }: KioskFrameProps): import("react").JSX.Element;
@@ -0,0 +1,39 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
+ import { useUiCopy } from "../../foundations/copy.js";
4
+ import { useIdle } from "../../foundations/idle.js";
5
+ import { POINTER_ATTRIBUTE } from "../../foundations/pointer.js";
6
+ import { buttonClasses } from "../../primitives/button/classes.js";
7
+ import { Accessibility, Hand } from "lucide-react";
8
+ import { useState } from "react";
9
+ /**
10
+ * The frame of a self-service screen — a kiosk at a café, a check-in totem, a pickup point.
11
+ *
12
+ * Context: a kiosk is not an application someone opens: it waits for a stranger, is used once
13
+ * standing up, and is left half-way. So the frame does three things no screen inside should
14
+ * have to: it WAITS (an attract screen, pressed anywhere to start), it FORGETS (after
15
+ * `idleAfter` seconds without a touch it goes back and tells the application to drop the
16
+ * order), and it REACHES (a button in the corner brings the content down to the lower half
17
+ * for someone seated, the way the big chains' kiosks do). It says «touch» for its whole area
18
+ * (`data-pointer`): a kiosk's screen may report a mouse.
19
+ */
20
+ export function KioskFrame({ children, attract, idleAfter = 90, onIdle, waiting: controlled, onWaitingChange, brand, }) {
21
+ const copy = useUiCopy();
22
+ const [own, setOwn] = useState(true);
23
+ const waiting = controlled ?? own;
24
+ const [low, setLow] = useState(false);
25
+ const setWaiting = (next) => {
26
+ if (controlled === undefined)
27
+ setOwn(next);
28
+ onWaitingChange?.(next);
29
+ };
30
+ useIdle(idleAfter, () => {
31
+ setWaiting(true);
32
+ setLow(false);
33
+ onIdle?.();
34
+ }, !waiting);
35
+ const Icon = attract.icon ?? Hand;
36
+ return (_jsx("div", { "data-ui": "kiosk", [POINTER_ATTRIBUTE]: "touch", className: "relative flex h-dvh min-h-0 min-w-0 flex-col bg-ground", children: waiting ? (
37
+ /* The whole screen is the button: a stranger does not look for a target. */
38
+ _jsxs("button", { type: "button", "data-ui": "kiosk.attract", onClick: () => setWaiting(false), className: "flex min-h-0 flex-1 cursor-pointer flex-col items-center justify-center gap-4 px-6 text-center outline-none focus-visible:outline-4 focus-visible:-outline-offset-8 focus-visible:outline-primary", children: [brand === undefined ? null : _jsx("span", { className: "text-meta text-muted", children: brand }), _jsx("span", { className: "text-hero leading-tight font-semibold text-ink", children: attract.title }), attract.subtitle === undefined ? null : (_jsx("span", { className: "max-w-short text-lead text-muted", children: attract.subtitle })), _jsxs("span", { className: `${buttonClasses("primary", "lg")} mt-6 gap-3`, children: [_jsx(Icon, { "aria-hidden": true, className: "size-(--size-icon-lg)" }), attract.call ?? copy.kiosk.start] })] })) : (_jsxs(_Fragment, { children: [low ? _jsx("div", { "aria-hidden": true, className: "h-(--size-kiosk-reach) shrink-0" }) : null, _jsx("div", { "data-ui": "kiosk.content", className: "flex min-h-0 min-w-0 flex-1 flex-col overflow-y-auto", children: children }), _jsx("button", { type: "button", "data-ui": "kiosk.reach", "aria-pressed": low, onClick: () => setLow((now) => !now), title: low ? copy.kiosk.reachOff : copy.kiosk.reach, "aria-label": low ? copy.kiosk.reachOff : copy.kiosk.reach, className: `${buttonClasses("secondary", "lg")} absolute bottom-4 left-4 z-30 aspect-square rounded-pill px-0 shadow-float`, children: _jsx(Accessibility, { "aria-hidden": true, className: "size-(--size-icon-lg)" }) })] })) }));
39
+ }
@@ -4,15 +4,14 @@ import { useSidebarDrawer } from "./sidebarDrawer.js";
4
4
  import { useUiCopy } from "../../foundations/copy.js";
5
5
  import { modShortcut, useKeyboardPlatform } from "../../foundations/shortcut.js";
6
6
  import { useSurface } from "../../foundations/surface.js";
7
+ import { Kbd } from "../../primitives/hint/Kbd.js";
7
8
  import { Search } from "lucide-react";
8
9
  const SKIN = {
9
10
  canvas: {
10
11
  box: "border-ui-control-border bg-ui-control text-muted hover:border-line-strong hover:text-ink focus-visible:outline-primary",
11
- keys: "border-line text-muted",
12
12
  },
13
13
  chrome: {
14
14
  box: "border-chrome-ink/15 bg-chrome-ink/6 text-chrome-muted hover:bg-chrome-ink/10 hover:text-chrome-ink focus-visible:outline-chrome-link",
15
- keys: "border-chrome-ink/20 text-chrome-muted",
16
15
  },
17
16
  };
18
17
  export function SearchEntry({ onSearch, label, shortcut = "K", layout = "row", surface, }) {
@@ -30,5 +29,5 @@ export function SearchEntry({ onSearch, label, shortcut = "K", layout = "row", s
30
29
  }, ...(keys === null ? {} : { "aria-keyshortcuts": keys.aria }), className: `flex h-(--size-control-sm) min-w-0 cursor-pointer items-center gap-2 rounded-ui-control border px-2 text-meta transition-colors duration-(--duration-instant) focus-visible:outline-2 focus-visible:outline-offset-2 ${bar ? "shrink-0 max-sm:w-(--size-control-sm) max-sm:justify-center" : "w-full"} ${skin.box}`, "data-ui": "search-entry", "data-surface": sup, children: [_jsx(Search, { className: "size-(--size-icon-md) shrink-0", strokeWidth: 2, "aria-hidden": true }), _jsx("span", { className: `min-w-0 flex-1 truncate text-left ${bar ? "max-sm:sr-only" : ""}`, children: label ?? copy.shell.search }), keys === null ? null : (
31
30
  /* Seen, not heard: `aria-keyshortcuts` already tells a screen reader, and «⌘K» read
32
31
  aloud is noise after the name. Not drawn for a finger: a phone has no ⌘. */
33
- _jsx("kbd", { "aria-hidden": true, className: `shrink-0 rounded-control border px-1.5 font-mono text-micro pointer-coarse:hidden ${bar ? "max-sm:hidden" : ""} ${skin.keys}`, "data-ui": "search-entry.keys", children: keys.label }))] }));
32
+ _jsx("span", { className: `inline-flex shrink-0 ${bar ? "max-sm:hidden" : ""}`, "data-ui": "search-entry.keys", children: _jsx(Kbd, { surface: sup, children: keys.label }) }))] }));
34
33
  }
@@ -2,7 +2,7 @@ import { type BrandLogo } from "./brandMark.js";
2
2
  import { type SearchEntryProps } from "./SearchEntry.js";
3
3
  import { type MenuGroup } from "../../primitives/menu/Menu.js";
4
4
  import { type LucideIcon } from "lucide-react";
5
- import { type ReactNode } from "react";
5
+ import { type ButtonHTMLAttributes, type ReactNode, type Ref } from "react";
6
6
  export interface AppEntry {
7
7
  id: string;
8
8
  label: string;
@@ -68,13 +68,15 @@ export declare function AppSwitcher({ apps, current, onSelect, }: {
68
68
  * Zero is NOT drawn: a bell with a «0» next to it forces you to read a number
69
69
  * to discover there is nothing. With no count you can already see there is
70
70
  * nothing. */
71
- export declare function SystrayButton({ icon: Icon, label, count, tone, onClick, active, }: {
71
+ export declare function SystrayButton({ icon: Icon, label, count, tone, onClick, active, ref, ...native }: Omit<ButtonHTMLAttributes<HTMLButtonElement>, "children" | "type" | "onClick"> & {
72
72
  icon: LucideIcon;
73
73
  label: string;
74
74
  count?: number;
75
75
  tone?: "info" | "warn" | "bad";
76
76
  onClick?: () => void;
77
77
  active?: boolean;
78
+ /** Forwarded, with the native props, so a popover or a menu can open from it — `Inbox`. */
79
+ ref?: Ref<HTMLButtonElement>;
78
80
  }): import("react").JSX.Element;
79
81
  /** Who I am and how I leave. The name is drawn when there is width; when narrow
80
82
  * only the avatar stays, which is what gets recognised without reading. */
@@ -9,7 +9,7 @@ import { Menu } from "../../primitives/menu/Menu.js";
9
9
  import { Count, countText } from "../../primitives/tag/Count.js";
10
10
  import { Avatar } from "../../primitives/value/Person.js";
11
11
  import { Grid3x3 } from "lucide-react";
12
- import { useMemo, useState } from "react";
12
+ import { useMemo, useState, } from "react";
13
13
  export function TopBar({ app, apps, currentApp, onAppSelect, menus, currentMenu, onMenuSelect, search, systray, user, onUserSelect, userGroups, }) {
14
14
  const copy = useUiCopy();
15
15
  const actual = apps?.find((a) => a.id === currentApp);
@@ -42,13 +42,13 @@ const SYSTRAY_MAX = 99;
42
42
  * Zero is NOT drawn: a bell with a «0» next to it forces you to read a number
43
43
  * to discover there is nothing. With no count you can already see there is
44
44
  * nothing. */
45
- export function SystrayButton({ icon: Icon, label, count = 0, tone = "info", onClick, active = false, }) {
45
+ export function SystrayButton({ icon: Icon, label, count = 0, tone = "info", onClick, active = false, ref, ...native }) {
46
46
  const copy = useUiCopy();
47
47
  const number = useMemo(() => new Intl.NumberFormat(copy.locale), [copy.locale]);
48
48
  /* The button says the number in its name, so the badge is only seen — and both say the
49
49
  same «99+», not a badge that is cut and a name that is not. */
50
50
  const said = countText(count, number.format, SYSTRAY_MAX);
51
- return (_jsxs("button", { type: "button", onClick: onClick, title: count > 0 ? `${label} (${said})` : label, "aria-label": count > 0 ? `${label}: ${said}` : label, className: `relative inline-flex size-(--size-control-md) items-center justify-center rounded-pill transition-colors duration-(--duration-instant) focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-chrome-link ${active
51
+ return (_jsxs("button", { ...native, ref: ref, type: "button", onClick: onClick, title: count > 0 ? `${label} (${said})` : label, "aria-label": count > 0 ? `${label}: ${said}` : label, className: `relative inline-flex size-(--size-control-md) items-center justify-center rounded-pill transition-colors duration-(--duration-instant) focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-chrome-link ${active
52
52
  ? "bg-chrome-ink/12 text-chrome-ink"
53
53
  : "text-chrome-muted hover:bg-chrome-ink/10 hover:text-chrome-ink"}`, children: [_jsx(Icon, { className: "size-(--size-icon-md)", strokeWidth: 2, "aria-hidden": true }), count <= 0 ? null : (_jsx("span", { className: "absolute -top-0.5 -right-0.5 flex", children: _jsx(Count, { value: count, tone: tone, solid: true, max: SYSTRAY_MAX, surface: "chrome", "aria-hidden": true }) }))] }));
54
54
  }
@@ -4,4 +4,6 @@ export { Sidebar, type SidebarAction, type SidebarProps, } from "./Sidebar.js";
4
4
  export { SearchEntry, type SearchEntryProps, } from "./SearchEntry.js";
5
5
  export { type SidebarDrawer, SidebarToggle, useSidebarDrawer, } from "./sidebarDrawer.js";
6
6
  export { type AppEntry, SystrayButton, TopBar, type TopMenu, } from "./TopBar.js";
7
+ export { Inbox, type InboxItem, InboxList, type InboxListProps, type InboxProps, } from "./Inbox.js";
8
+ export { KioskFrame, type KioskFrameProps, } from "./KioskFrame.js";
7
9
  export { Pane, Panes } from "./Panes.js";
@@ -10,5 +10,9 @@ export { SearchEntry, } from "./SearchEntry.js";
10
10
  /* The sidebar's phone drawer, for a bar an application writes itself. */
11
11
  export { SidebarToggle, useSidebarDrawer, } from "./sidebarDrawer.js";
12
12
  export { SystrayButton, TopBar, } from "./TopBar.js";
13
+ /* The notifications: a bell with how many are unread and the list in a popover — or the list
14
+ alone, as a portal's page. */
15
+ export { Inbox, InboxList, } from "./Inbox.js";
13
16
  /* A screen of N sets side by side — the reconciliation: each pane scrolls on its own. */
17
+ export { KioskFrame, } from "./KioskFrame.js";
14
18
  export { Pane, Panes } from "./Panes.js";
@@ -0,0 +1,3 @@
1
+ /** The time now, in epoch milliseconds, refreshed every `every` ms (a second by default) — or
2
+ * `null` on the server and while hydrating. */
3
+ export declare function useNow(every?: number): number | null;
@@ -0,0 +1,41 @@
1
+ "use client";
2
+ import { useCallback, useSyncExternalStore } from "react";
3
+ const tickers = new Map();
4
+ function tickerOf(every) {
5
+ let ticker = tickers.get(every);
6
+ if (ticker === undefined) {
7
+ ticker = { now: Date.now(), listeners: new Set() };
8
+ tickers.set(every, ticker);
9
+ }
10
+ return ticker;
11
+ }
12
+ function subscribe(every, listener) {
13
+ const ticker = tickerOf(every);
14
+ ticker.listeners.add(listener);
15
+ if (ticker.timer === undefined) {
16
+ /* «now» moves only on a tick: changing it while subscribing would change the snapshot
17
+ React just read, and it would render, resubscribe and change it again, forever. */
18
+ ticker.timer = setInterval(() => {
19
+ ticker.now = Date.now();
20
+ for (const one of ticker.listeners)
21
+ one();
22
+ }, every);
23
+ }
24
+ return () => {
25
+ ticker.listeners.delete(listener);
26
+ if (ticker.listeners.size === 0 && ticker.timer !== undefined) {
27
+ clearInterval(ticker.timer);
28
+ ticker.timer = undefined;
29
+ }
30
+ };
31
+ }
32
+ /** The time now, in epoch milliseconds, refreshed every `every` ms (a second by default) — or
33
+ * `null` on the server and while hydrating. */
34
+ export function useNow(every = 1000) {
35
+ /* Stable per interval: a new `subscribe` on every render makes React unsubscribe and
36
+ subscribe again on each one. */
37
+ const listen = useCallback((listener) => subscribe(every, listener), [every]);
38
+ const read = useCallback(() => tickerOf(every).now, [every]);
39
+ return useSyncExternalStore(listen, read, serverNow);
40
+ }
41
+ const serverNow = () => null;