@sincpro/web-ui 2.12.0 → 2.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +42 -17
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +1 -0
- package/dist/components/listing/BoardColumns.js +10 -6
- package/dist/components/listing/Listing.js +3 -1
- package/dist/components/listing/ListingBar.d.ts +16 -94
- package/dist/components/listing/ListingBar.js +24 -2
- package/dist/components/listing/RecordCard.d.ts +41 -3
- package/dist/components/listing/RecordCard.js +63 -22
- package/dist/components/listing/Row.js +5 -2
- package/dist/components/listing/index.d.ts +2 -2
- package/dist/components/listing/index.js +2 -2
- package/dist/components/listing/set.d.ts +1 -1
- package/dist/components/receipt/Receipt.d.ts +51 -0
- package/dist/components/receipt/Receipt.js +23 -0
- package/dist/components/receipt/index.d.ts +1 -0
- package/dist/components/receipt/index.js +3 -0
- package/dist/components/search/CriteriaChips.js +5 -3
- package/dist/components/shell/KioskFrame.d.ts +35 -0
- package/dist/components/shell/KioskFrame.js +39 -0
- package/dist/components/shell/SearchEntry.js +1 -1
- package/dist/components/shell/index.d.ts +1 -0
- package/dist/components/shell/index.js +1 -0
- package/dist/foundations/clock.d.ts +3 -0
- package/dist/foundations/clock.js +41 -0
- package/dist/foundations/copy.es.js +26 -0
- package/dist/foundations/idle.d.ts +1 -0
- package/dist/foundations/idle.js +34 -0
- package/dist/foundations/index.d.ts +3 -0
- package/dist/foundations/index.js +7 -0
- package/dist/foundations/pointer.d.ts +25 -0
- package/dist/foundations/pointer.js +28 -0
- package/dist/foundations/uiCopy.d.ts +38 -0
- package/dist/foundations/uiCopy.js +26 -0
- package/dist/primitives/choice/RadioGroup.d.ts +8 -1
- package/dist/primitives/choice/RadioGroup.js +9 -1
- package/dist/primitives/choice/options.d.ts +3 -0
- package/dist/primitives/field/Keypad.d.ts +43 -0
- package/dist/primitives/field/Keypad.js +62 -0
- package/dist/primitives/field/Stepper.d.ts +28 -0
- package/dist/primitives/field/Stepper.js +52 -0
- package/dist/primitives/field/clipboard.js +1 -1
- package/dist/primitives/field/index.d.ts +3 -0
- package/dist/primitives/field/index.js +6 -0
- package/dist/primitives/field/keypadKeys.d.ts +24 -0
- package/dist/primitives/field/keypadKeys.js +80 -0
- package/dist/primitives/hint/Hint.js +1 -1
- package/dist/primitives/notice/Flag.js +1 -1
- package/dist/primitives/notice/Outcome.d.ts +28 -0
- package/dist/primitives/notice/Outcome.js +28 -0
- package/dist/primitives/notice/index.d.ts +1 -0
- package/dist/primitives/notice/index.js +2 -0
- package/dist/primitives/table/CellCopy.js +1 -1
- package/dist/primitives/table/ReportTable.js +1 -1
- package/dist/primitives/table/RowActions.js +1 -1
- package/dist/primitives/table/Table.js +9 -5
- package/dist/primitives/tag/Tags.d.ts +22 -1
- package/dist/primitives/tag/Tags.js +57 -14
- package/dist/primitives/tag/index.d.ts +1 -1
- package/dist/primitives/value/Elapsed.d.ts +16 -0
- package/dist/primitives/value/Elapsed.js +37 -0
- package/dist/primitives/value/elapsedTime.d.ts +26 -0
- package/dist/primitives/value/elapsedTime.js +32 -0
- package/dist/primitives/value/index.d.ts +2 -0
- package/dist/primitives/value/index.js +4 -0
- package/dist/tokens.css +87 -1
- package/dist/views/list/List.d.ts +11 -0
- package/dist/views/list/List.js +14 -3
- package/dist/views/list/ListView.d.ts +1 -1
- package/dist/views/list/ListView.js +26 -6
- package/dist/views/list/types.d.ts +7 -0
- package/dist/views/record/Record.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -265,22 +265,23 @@ follows:
|
|
|
265
265
|
}
|
|
266
266
|
```
|
|
267
267
|
|
|
268
|
-
| Component
|
|
269
|
-
|
|
|
270
|
-
| `Button`, `ButtonLink`
|
|
271
|
-
| `IconButton`, `IconLink`
|
|
272
|
-
| Inputs, selects, date and pickers' boxes
|
|
273
|
-
| Menus, lists, popovers, the cuts panel
|
|
274
|
-
| A row inside them (menu item, option)
|
|
275
|
-
| `Dialog`
|
|
276
|
-
| `Block`, `RecordCard`, `Metric`
|
|
277
|
-
| A
|
|
278
|
-
|
|
|
279
|
-
| `
|
|
280
|
-
|
|
|
281
|
-
|
|
|
282
|
-
|
|
|
283
|
-
|
|
|
268
|
+
| Component | Tokens |
|
|
269
|
+
| ------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------- |
|
|
270
|
+
| `Button`, `ButtonLink` | `--ui-button-radius` |
|
|
271
|
+
| `IconButton`, `IconLink` | `--ui-icon-button-radius` |
|
|
272
|
+
| Inputs, selects, date and pickers' boxes | `--ui-control-radius`, `--ui-control-bg`, `--ui-control-border` |
|
|
273
|
+
| Menus, lists, popovers, the cuts panel | `--ui-popover-radius`, `--ui-popover-bg`, `--ui-popover-border`, `--ui-popover-shadow` |
|
|
274
|
+
| A row inside them (menu item, option) | `--ui-option-radius`, `--ui-option-active-bg` |
|
|
275
|
+
| `Dialog` | `--ui-dialog-radius`, `--ui-dialog-bg` |
|
|
276
|
+
| `Block`, `RecordCard`, `Metric` | `--ui-card-radius`, `--ui-card-bg`, `--ui-card-border` |
|
|
277
|
+
| A record's card on a board or a grid (`RecordCard`, `RadioGroup look="cards"`) | `--ui-record-card-radius` (falls back to the card's, then to the control's corner) |
|
|
278
|
+
| A board's `BoardTile` and `BoardStat` | `--ui-tile-radius`, `--ui-tile-bg`, `--ui-tile-border` (fall back to the card's) |
|
|
279
|
+
| `Tag`, `Tags`, the search bar's chips | `--ui-tag-radius` |
|
|
280
|
+
| `SearchBar`'s field | `--ui-search-radius` (and the control's bg and border) |
|
|
281
|
+
| The sidebar on the canvas | `--ui-sidebar-bg`, `--ui-sidebar-border` |
|
|
282
|
+
| `NavigationTree` | `--ui-nav-radius`, `--ui-nav-current-bg` |
|
|
283
|
+
| Table headers (`DataTable`, `EditableTable`, `ReportTable`) | `--ui-table-head-bg` |
|
|
284
|
+
| `Guide` (a guided tour): its card and its veil | `--ui-guide-radius`, `--ui-guide-bg`, `--ui-guide-scrim` |
|
|
284
285
|
|
|
285
286
|
What a token does not cover, a **part** does. Every customizable piece names its root
|
|
286
287
|
`data-ui="<component>"` and its parts `data-ui="<component>.<part>"`, with its variant beside
|
|
@@ -297,7 +298,13 @@ of classes that change with the next refactor:
|
|
|
297
298
|
```
|
|
298
299
|
|
|
299
300
|
The parts: `button`, `icon-button`, `control`, `popover`, `menu`, `menu.trigger`,
|
|
300
|
-
`menu.section`, `menu.item`, `menu.fold`, `dialog`, `block`, `record-card
|
|
301
|
+
`menu.section`, `menu.item`, `menu.fold`, `dialog`, `block`, `record-card` (with `data-layout`
|
|
302
|
+
`card` | `compact` | `tile`), `record-card.title`, `record-card.figure`, `record-card.fields`,
|
|
303
|
+
`record-card.media`, `record-card.badge`, `record-card.footer`, `record-card.stripe`,
|
|
304
|
+
`board.lane`, `list.tiles`, `elapsed`, `keypad`, `keypad.key`, `keypad.screen`, `stepper`,
|
|
305
|
+
`radio-group`, `radio-group.card`, `tags.count`, `outcome`, `outcome.figure`, `receipt`,
|
|
306
|
+
`receipt.document`, `receipt.lines`, `receipt.totals`, `kiosk`, `kiosk.attract`,
|
|
307
|
+
`kiosk.content`, `kiosk.reach`, `board.tile`,
|
|
301
308
|
`board.stat`, `board.stat.value`, `activity.changes`, `file-list`, `file-list.file`, `file-value`, `metric`, `metric.detail`, `tag`, `tags.item`, `search`, `search.field`, `search.chip`,
|
|
302
309
|
`search.panel`, `search.suggestions`, `search.suggestion`, `search.record`, `search.advanced`,
|
|
303
310
|
`search.keys`, `search-entry`, `search-entry.keys`, `table`, `table.pile`, `yes-no`,
|
|
@@ -310,6 +317,24 @@ The parts: `button`, `icon-button`, `control`, `popover`, `menu`, `menu.trigger`
|
|
|
310
317
|
carries `data-key` too (`navigation.item`). Put your rules in a cascade layer above web-ui's, or
|
|
311
318
|
outside any layer.
|
|
312
319
|
|
|
320
|
+
#### Touch and the counter: a till, a kitchen, a kiosk, a shop
|
|
321
|
+
|
|
322
|
+
The same pieces as the ERP, drawn for a finger — no «POS» inside the package. The application
|
|
323
|
+
says what the person presses with, on `<html>` or on a zone (a till is a touch monitor with a
|
|
324
|
+
mouse plugged in, so the browser alone says «mouse»):
|
|
325
|
+
|
|
326
|
+
```tsx
|
|
327
|
+
<html {...pointerAttributes("touch")}> {/* data-pointer="touch" */}
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
Controls grow to 44 px, what is drawn small answers to `--size-target` (`hit-target`), and what
|
|
331
|
+
only shows on hover follows the `touch:` variant. Then: `List.Tiles` (a product grid),
|
|
332
|
+
`List.Filters` with `Tags size="md" | "lg"` and `count`, `RadioGroup look="cards"`, `Keypad`
|
|
333
|
+
(with `screen`), `Stepper`, `RecordCard elapsed`, `Outcome`, `Receipt`, and `KioskFrame` (an
|
|
334
|
+
attract screen, `idleAfter`, a reduced-height mode). The Storybook page «Táctil y mostrador»
|
|
335
|
+
orders them by what they solve; `5 · Plantillas/Mostrador` has the till, the express till, the
|
|
336
|
+
kitchen, the kiosk and the shop.
|
|
337
|
+
|
|
313
338
|
#### A form that explains itself: the «settings» style
|
|
314
339
|
|
|
315
340
|
The default form is the dense sheet of an ERP — label | control, two columns, help behind a
|
|
@@ -14,6 +14,7 @@ export * from "./lines/index.js";
|
|
|
14
14
|
export * from "./listing/index.js";
|
|
15
15
|
export * from "./navigation/index.js";
|
|
16
16
|
export * from "./preview/index.js";
|
|
17
|
+
export * from "./receipt/index.js";
|
|
17
18
|
export * from "./record/index.js";
|
|
18
19
|
export * from "./search/index.js";
|
|
19
20
|
export * from "./shell/index.js";
|
package/dist/components/index.js
CHANGED
|
@@ -15,6 +15,7 @@ export * from "./lines/index.js";
|
|
|
15
15
|
export * from "./listing/index.js";
|
|
16
16
|
export * from "./navigation/index.js";
|
|
17
17
|
export * from "./preview/index.js";
|
|
18
|
+
export * from "./receipt/index.js";
|
|
18
19
|
export * from "./record/index.js";
|
|
19
20
|
export * from "./search/index.js";
|
|
20
21
|
export * from "./shell/index.js";
|
|
@@ -41,7 +41,7 @@ function ProgressBar({ items, progress, }) {
|
|
|
41
41
|
const parts = PROGRESS_ORDER.filter((tone) => (counts.get(tone) ?? 0) > 0);
|
|
42
42
|
if (parts.length === 0)
|
|
43
43
|
return null;
|
|
44
|
-
return (_jsx("div", { role: "img", "aria-label": parts.map((tone) => `${tone}: ${counts.get(tone)}`).join(", "), className: "mx-1 flex h-1
|
|
44
|
+
return (_jsx("div", { role: "img", "aria-label": parts.map((tone) => `${tone}: ${counts.get(tone)}`).join(", "), className: "mx-1.5 flex h-1 overflow-hidden rounded-pill bg-ink/8", children: parts.map((tone) => (_jsx("span", { className: PROGRESS_FILL[tone], style: { width: `${((counts.get(tone) ?? 0) / items.length) * 100}%` } }, tone))) }));
|
|
45
45
|
}
|
|
46
46
|
/* ==================================================================== *
|
|
47
47
|
* THE BOARD BY STAGES — Odoo's kanban.
|
|
@@ -106,14 +106,18 @@ export function BoardColumns({ items, keyOf, stages, card, }) {
|
|
|
106
106
|
event.preventDefault();
|
|
107
107
|
move(keyOf(item), next.id);
|
|
108
108
|
};
|
|
109
|
-
return (
|
|
109
|
+
return (
|
|
110
|
+
/* The lanes are a wash on the canvas and not boxes: the card is the only box, so a board
|
|
111
|
+
reads as columns of records and not as boxes inside boxes. They share the width when
|
|
112
|
+
the stages fit (up to `--container-lane-max`) and scroll sideways when they do not. */
|
|
113
|
+
_jsxs("div", { className: "flex min-w-0 items-start gap-2 overflow-x-auto p-3", children: [columns.map((column) => {
|
|
110
114
|
const inside = items.filter((item) => of(item) === column.id);
|
|
111
115
|
if (folded.has(column.id)) {
|
|
112
116
|
/* Folded: a strip with its count and its name down the spine. Still a drop target —
|
|
113
117
|
dropping on «perdido» is how a lost deal is marked. */
|
|
114
|
-
return (_jsxs("section", { "aria-label": column.label, ...dropOn(column.id), className: `flex w-12 shrink-0 flex-col items-center gap-2 rounded-
|
|
118
|
+
return (_jsxs("section", { "aria-label": column.label, ...dropOn(column.id), className: `flex w-12 shrink-0 flex-col items-center gap-2 rounded-control py-2 ${over === column.id ? "bg-primary/8 ring-1 ring-primary/40" : "bg-ink/3"}`, children: [_jsx(IconButton, { icon: ChevronsLeftRight, label: fillCopy(copy.board.unfold, { column: column.label }), onClick: () => toggleFold(column.id) }), _jsx("span", { className: "text-micro text-muted tabular-nums", children: inside.length }), _jsx("span", { className: "text-vertical text-meta font-semibold text-ink", children: column.label })] }, column.id));
|
|
115
119
|
}
|
|
116
|
-
return (_jsxs("section", { "aria-label": column.label, ...dropOn(column.id), className: `flex w-(--container-lane) shrink-0 flex-col gap-
|
|
120
|
+
return (_jsxs("section", { "aria-label": column.label, ...dropOn(column.id), "data-ui": "board.lane", className: `flex max-w-(--container-lane-max) min-w-(--container-lane) flex-1 shrink-0 basis-(--container-lane) flex-col gap-1.5 rounded-control p-1.5 transition-colors duration-(--duration-instant) ${over === column.id ? "bg-primary/8 ring-1 ring-primary/40" : "bg-ink/3"}`, children: [_jsxs("header", { className: "flex min-w-0 items-center gap-1.5 px-1.5 pt-0.5", children: [_jsx("h3", { className: "min-w-0 flex-1 truncate text-meta font-semibold text-ink", children: column.tone === undefined ? (column.label) : (_jsx(StatusDot, { tone: column.tone, label: column.label })) }), _jsx("span", { className: "shrink-0 rounded-pill bg-ink/6 px-1.5 text-micro text-muted tabular-nums", children: inside.length }), total === undefined ? null : (_jsx("span", { className: "shrink-0 text-meta font-semibold text-ink tabular-nums", children: total(inside) })), onQuickCreate === undefined ? null : (_jsx(IconButton, { icon: Plus, label: fillCopy(copy.board.quickCreate, { column: column.label }), onClick: () => setCreating(column.id) })), _jsx(IconButton, { icon: ChevronsLeftRight, label: fillCopy(copy.board.fold, { column: column.label }), onClick: () => toggleFold(column.id) })] }), progress === undefined || inside.length === 0 ? null : (_jsx(ProgressBar, { items: inside, progress: progress })), creating === column.id && onQuickCreate !== undefined ? (_jsx(BoardInput, { label: fillCopy(copy.board.quickCreate, { column: column.label }), placeholder: copy.board.quickPlaceholder, onCommit: (name) => onQuickCreate(column.id, name), onClose: () => setCreating(null) })) : null, inside.length === 0 ? (_jsx("p", { className: "px-1 py-3 text-micro text-muted", children: copy.board.emptyLane })) : (_jsx("ul", { className: "flex min-w-0 flex-col gap-1.5", children: inside.map((item) => {
|
|
117
121
|
const id = keyOf(item);
|
|
118
122
|
return (_jsx("li", { ...(onMove === undefined
|
|
119
123
|
? {}
|
|
@@ -129,9 +133,9 @@ export function BoardColumns({ items, keyOf, stages, card, }) {
|
|
|
129
133
|
},
|
|
130
134
|
onDragEnd: () => setDragging(null),
|
|
131
135
|
onKeyDown: (event) => byKeyboard(event, item),
|
|
132
|
-
}), className: `flex min-w-0 flex-col rounded-
|
|
136
|
+
}), className: `flex min-w-0 flex-col rounded-ui-record-card focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary ${onMove === undefined ? "" : "cursor-grab active:cursor-grabbing"} ${dragging === id ? "opacity-50" : ""}`, children: card(item) }, id));
|
|
133
137
|
}) }))] }, column.id));
|
|
134
|
-
}), onAddColumn === undefined ? null : (_jsx("div", { className: "flex w-(--container-lane) shrink-0 flex-col gap-2 p-
|
|
138
|
+
}), onAddColumn === undefined ? null : (_jsx("div", { className: "flex w-(--container-lane) shrink-0 flex-col gap-2 p-1.5", children: adding ? (_jsx(BoardInput, { label: copy.board.addColumn, placeholder: copy.board.addColumnPlaceholder, onCommit: (label) => {
|
|
135
139
|
onAddColumn(label);
|
|
136
140
|
setAdding(false);
|
|
137
141
|
}, onClose: () => setAdding(false) })) : (_jsxs("button", { type: "button", onClick: () => setAdding(true), className: "flex h-(--size-control-md) items-center gap-1.5 rounded-control px-2 text-meta text-muted transition-colors duration-(--duration-instant) hover:bg-ink/5 hover:text-ink focus-visible:outline-2 focus-visible:outline-primary", children: [_jsx(Plus, { "aria-hidden": true, className: "size-(--size-icon-sm)", strokeWidth: 2 }), copy.board.addColumn] })) })), _jsx("span", { role: "status", className: "sr-only", children: said })] }));
|
|
@@ -84,5 +84,7 @@ export function Listing({ bar, metrics, sticky = false, surface, children, }) {
|
|
|
84
84
|
background is its white and its radius; a frame around a list that is
|
|
85
85
|
already inside a framed panel is a nested rectangle, and nested
|
|
86
86
|
rectangles are what make a product read like a cloud console. */
|
|
87
|
-
|
|
87
|
+
/* `isolate`: the list's sticky bar and floating pill stay over its rows, and under
|
|
88
|
+
whatever the host lays on the list — a workspace's modal (see `Record`). */
|
|
89
|
+
_jsxs("div", { className: `isolate flex min-w-0 flex-col ${byDensity(d, "gap-2.5", "gap-2")}`, children: [bar === undefined || bar === null ? null : inSlot ? (createPortal(bar, slot)) : (_jsx("div", { ref: band.ref, className: `min-w-0 ${pegada ? `sticky z-30 ${surface === "chrome" ? "bg-chrome" : "bg-ground"}` : ""}`, style: pegada ? band.self : undefined, children: bar })), inSlot && metrics !== undefined ? _jsx("div", { className: "pt-2", children: metrics }) : metrics, _jsx("div", { className: "min-w-0 overflow-clip rounded-box bg-surface", style: pegada && !inSlot ? band.below : undefined, children: children })] }));
|
|
88
90
|
}
|
|
@@ -1,91 +1,19 @@
|
|
|
1
|
-
import type { Surface } from "../../foundations/types.js";
|
|
1
|
+
import type { Surface, Tone } from "../../foundations/types.js";
|
|
2
2
|
import type { ViewStyle } from "../../foundations/viewStyle.js";
|
|
3
3
|
import type { ReactNode } from "react";
|
|
4
|
-
/**
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
* painted over each other the moment the window shrank.
|
|
18
|
-
*
|
|
19
|
-
* ── Why it is two lines tall ────────────────────────────────────────
|
|
20
|
-
*
|
|
21
|
-
* Because the three things that go on the left do not fit in one: a
|
|
22
|
-
* comfortable button is 34 px tall, a list title may have to wrap onto two
|
|
23
|
-
* lines, and below it goes a sentence saying what the list is made of. Forcing
|
|
24
|
-
* it into a single line means shrinking the button —the defect we already
|
|
25
|
-
* fixed— or truncating the title, which is worse: a list that cannot be named
|
|
26
|
-
* in full is indistinguishable from the one next to it.
|
|
27
|
-
*
|
|
28
|
-
* ── The selection transforms the bar, it does not add one ───────────
|
|
29
|
-
*
|
|
30
|
-
* When rows get selected, the identity zone turns into «3 elegidas ✕» plus the
|
|
31
|
-
* actions that apply. **In the same place and without pushing anything.** A
|
|
32
|
-
* bar that appears shifts the list downwards right when somebody is ticking
|
|
33
|
-
* checkboxes, and the row they were about to tick is no longer where it was.
|
|
34
|
-
*
|
|
35
|
-
* The actions on the left do NOT go away: «Nuevo» stays available with three
|
|
36
|
-
* rows selected, because selecting is not entering a mode.
|
|
37
|
-
*
|
|
38
|
-
* ── The modern style: the trail is the heading ──────────────────────
|
|
39
|
-
*
|
|
40
|
-
* ┌──────────────────────────────────────────────────────────────────┐
|
|
41
|
-
* │ Ventas › Andina › Pedidos ( 1–12 / 12 ‹ › ) │
|
|
42
|
-
* │ what it is made of 🔍 search… [sort][cols] [▤▦] │
|
|
43
|
-
* └──────────────────────────────────────────────────────────────────┘
|
|
44
|
-
* ( Pedidos │ Importar · Exportar ▾ · + Nueva cotización ) ← floats
|
|
45
|
-
*
|
|
46
|
-
* As a record in the modern style, WHERE I AM is the page's heading: the trail at the
|
|
47
|
-
* title's size (`Breadcrumb size="lg"`), its last crumb the list's name — so the title is
|
|
48
|
-
* not said twice —, and the page range at the other end, as the record's pager pill. Its
|
|
49
|
-
* counters are not here: beside the trail they read as more crumbs; the list draws them as
|
|
50
|
-
* mini stats under the bar (`List.Metrics`). The second row is how I look at the set: what
|
|
51
|
-
* it is made of (the description), the search centred, sort, columns and the faces. The
|
|
52
|
-
* list's actions float at the bottom of the screen in a pill named by the list
|
|
53
|
-
* (`List.Dock`), which turns into what is done to the chosen rows while some are chosen;
|
|
54
|
-
* given `placement="bar"`, or drawn by hand, they take the start of the second row and the
|
|
55
|
-
* description goes on demand (`Hint`) beside the heading. Without crumbs the title is the
|
|
56
|
-
* heading. Compact keeps the one bar below.
|
|
57
|
-
*
|
|
58
|
-
* ── Inside a record it is ONE line (`inline`) ────────────────────────
|
|
59
|
-
*
|
|
60
|
-
* ┌───────────────────────────────────────────────────────────────┐
|
|
61
|
-
* │ 🔍 search the lines… 12 records [sort][cols][▤▦] │
|
|
62
|
-
* └───────────────────────────────────────────────────────────────┘
|
|
63
|
-
* WHAT I LOOK FOR (fills) HOW MANY HOW I LOOK
|
|
64
|
-
*
|
|
65
|
-
* A collection that is a FIELD of a record — the lines of an order, the
|
|
66
|
-
* contacts of a customer, the journal items of an invoice — is not a screen.
|
|
67
|
-
* Everything the two rows above answer is already answered by the record
|
|
68
|
-
* around it: where I am (the record's crumbs), what this is (the tab it sits
|
|
69
|
-
* in), what I can do (the record's actions). Drawn with the page bar, it
|
|
70
|
-
* spent two rows and a rule on the one question left —the search, alone and
|
|
71
|
-
* centred on the first row; «Ordenar» and the switcher alone on the second—
|
|
72
|
-
* and pushed the rows, which are what the tab is for, below the fold.
|
|
73
|
-
*
|
|
74
|
-
* So it is a single line, and the order is the order of the questions: the
|
|
75
|
-
* search FILLS from the left (it is the only thing with variable content),
|
|
76
|
-
* then how many there are, then how they are looked at, then what starts a
|
|
77
|
-
* new one. No band, no padding, no hairline: it sits on the record's paper,
|
|
78
|
-
* aligned with the fields above it, and a light band inside a white sheet is
|
|
79
|
-
* a rectangle inside a rectangle.
|
|
80
|
-
*
|
|
81
|
-
* On a phone the line breaks by itself, with no threshold written anywhere:
|
|
82
|
-
* the search asks for `--container-name` before it gives up its place, so
|
|
83
|
-
* when the controls do not fit next to it they drop to a second line, pushed
|
|
84
|
-
* to the right, and the search keeps the whole first one.
|
|
85
|
-
*
|
|
86
|
-
* The count is a live region: typing in the search changes it, and somebody
|
|
87
|
-
* who cannot see the rows thin out hears how many are left. With
|
|
88
|
-
* `pagination` the page range replaces it — it already says how many. */
|
|
4
|
+
/**
|
|
5
|
+
* One count of what the list is made of — «64 cotizaciones». With `onClick` it also NARROWS
|
|
6
|
+
* the list to them (a quick filter that already says how many it will leave), and `active`
|
|
7
|
+
* says it is applied: a number that leads somewhere is pressed, as a `Metric` is.
|
|
8
|
+
*/
|
|
9
|
+
export type ListCounter = {
|
|
10
|
+
label: string;
|
|
11
|
+
value: number | string;
|
|
12
|
+
onClick?: () => void;
|
|
13
|
+
active?: boolean;
|
|
14
|
+
/** What the count means — overdue in `bad`. The figure takes it; the label stays muted. */
|
|
15
|
+
tone?: Tone;
|
|
16
|
+
};
|
|
89
17
|
export declare function ListingBar({ actions, title, description, counters, selection, search, pagination, views, crumbs, surface, inline, count, look, }: {
|
|
90
18
|
/** How the bar is drawn: `modern` makes the trail the heading and puts the search on the
|
|
91
19
|
* row of the controls (see the header). The list passes its view style. */
|
|
@@ -98,10 +26,7 @@ export declare function ListingBar({ actions, title, description, counters, sele
|
|
|
98
26
|
description?: string;
|
|
99
27
|
/** The totals per category. The ones in the pagination say how many there
|
|
100
28
|
* are; these say what they are made of, which is another question. */
|
|
101
|
-
counters?: readonly
|
|
102
|
-
label: string;
|
|
103
|
-
value: number | string;
|
|
104
|
-
}[];
|
|
29
|
+
counters?: readonly ListCounter[];
|
|
105
30
|
/** When there are selected rows. It replaces the identity, in the same place. */
|
|
106
31
|
selection?: {
|
|
107
32
|
count: number;
|
|
@@ -134,8 +59,5 @@ export declare function ListingBar({ actions, title, description, counters, sele
|
|
|
134
59
|
export type ListIdentity = {
|
|
135
60
|
title?: string;
|
|
136
61
|
description?: string;
|
|
137
|
-
counters?: readonly
|
|
138
|
-
label: string;
|
|
139
|
-
value: number | string;
|
|
140
|
-
}[];
|
|
62
|
+
counters?: readonly ListCounter[];
|
|
141
63
|
};
|
|
@@ -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) =>
|
|
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
|
|
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
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
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:
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
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 : (
|
|
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
|
|
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
|
|
@@ -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";
|