@vaam-apps/ui 0.1.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/CHANGELOG.md +104 -0
- package/LICENSE +21 -0
- package/README.md +286 -0
- package/dist/components/data/code.d.ts +37 -0
- package/dist/components/data/code.d.ts.map +1 -0
- package/dist/components/data/code.js +37 -0
- package/dist/components/data/code.js.map +1 -0
- package/dist/components/data/copy-button.d.ts +39 -0
- package/dist/components/data/copy-button.d.ts.map +1 -0
- package/dist/components/data/copy-button.js +50 -0
- package/dist/components/data/copy-button.js.map +1 -0
- package/dist/components/data/detail-row.d.ts +69 -0
- package/dist/components/data/detail-row.d.ts.map +1 -0
- package/dist/components/data/detail-row.js +27 -0
- package/dist/components/data/detail-row.js.map +1 -0
- package/dist/components/data/id-display.d.ts +33 -0
- package/dist/components/data/id-display.d.ts.map +1 -0
- package/dist/components/data/id-display.js +25 -0
- package/dist/components/data/id-display.js.map +1 -0
- package/dist/components/data/masked-value.d.ts +47 -0
- package/dist/components/data/masked-value.d.ts.map +1 -0
- package/dist/components/data/masked-value.js +46 -0
- package/dist/components/data/masked-value.js.map +1 -0
- package/dist/components/data/money.d.ts +28 -0
- package/dist/components/data/money.d.ts.map +1 -0
- package/dist/components/data/money.js +22 -0
- package/dist/components/data/money.js.map +1 -0
- package/dist/components/data/phone-display.d.ts +45 -0
- package/dist/components/data/phone-display.d.ts.map +1 -0
- package/dist/components/data/phone-display.js +23 -0
- package/dist/components/data/phone-display.js.map +1 -0
- package/dist/components/data/stat-tile.d.ts +33 -0
- package/dist/components/data/stat-tile.d.ts.map +1 -0
- package/dist/components/data/stat-tile.js +18 -0
- package/dist/components/data/stat-tile.js.map +1 -0
- package/dist/components/data/timestamp-display.d.ts +14 -0
- package/dist/components/data/timestamp-display.d.ts.map +1 -0
- package/dist/components/data/timestamp-display.js +77 -0
- package/dist/components/data/timestamp-display.js.map +1 -0
- package/dist/components/patterns/inline-banner.d.ts +22 -0
- package/dist/components/patterns/inline-banner.d.ts.map +1 -0
- package/dist/components/patterns/inline-banner.js +11 -0
- package/dist/components/patterns/inline-banner.js.map +1 -0
- package/dist/components/patterns/inline-empty-state.d.ts +20 -0
- package/dist/components/patterns/inline-empty-state.d.ts.map +1 -0
- package/dist/components/patterns/inline-empty-state.js +11 -0
- package/dist/components/patterns/inline-empty-state.js.map +1 -0
- package/dist/components/patterns/live-row.d.ts +23 -0
- package/dist/components/patterns/live-row.d.ts.map +1 -0
- package/dist/components/patterns/live-row.js +48 -0
- package/dist/components/patterns/live-row.js.map +1 -0
- package/dist/components/patterns/payload-inspector.d.ts +25 -0
- package/dist/components/patterns/payload-inspector.d.ts.map +1 -0
- package/dist/components/patterns/payload-inspector.js +33 -0
- package/dist/components/patterns/payload-inspector.js.map +1 -0
- package/dist/components/patterns/route-skeleton.d.ts +15 -0
- package/dist/components/patterns/route-skeleton.d.ts.map +1 -0
- package/dist/components/patterns/route-skeleton.js +7 -0
- package/dist/components/patterns/route-skeleton.js.map +1 -0
- package/dist/components/patterns/screen-layout.d.ts +14 -0
- package/dist/components/patterns/screen-layout.d.ts.map +1 -0
- package/dist/components/patterns/screen-layout.js +11 -0
- package/dist/components/patterns/screen-layout.js.map +1 -0
- package/dist/components/patterns/stale-write-banner.d.ts +26 -0
- package/dist/components/patterns/stale-write-banner.d.ts.map +1 -0
- package/dist/components/patterns/stale-write-banner.js +28 -0
- package/dist/components/patterns/stale-write-banner.js.map +1 -0
- package/dist/components/patterns/state-timeline.d.ts +58 -0
- package/dist/components/patterns/state-timeline.d.ts.map +1 -0
- package/dist/components/patterns/state-timeline.js +103 -0
- package/dist/components/patterns/state-timeline.js.map +1 -0
- package/dist/components/primitives/badge.d.ts +27 -0
- package/dist/components/primitives/badge.d.ts.map +1 -0
- package/dist/components/primitives/badge.js +33 -0
- package/dist/components/primitives/badge.js.map +1 -0
- package/dist/components/primitives/button.d.ts +12 -0
- package/dist/components/primitives/button.d.ts.map +1 -0
- package/dist/components/primitives/button.js +42 -0
- package/dist/components/primitives/button.js.map +1 -0
- package/dist/components/primitives/calendar.d.ts +39 -0
- package/dist/components/primitives/calendar.d.ts.map +1 -0
- package/dist/components/primitives/calendar.js +102 -0
- package/dist/components/primitives/calendar.js.map +1 -0
- package/dist/components/primitives/card.d.ts +24 -0
- package/dist/components/primitives/card.d.ts.map +1 -0
- package/dist/components/primitives/card.js +28 -0
- package/dist/components/primitives/card.js.map +1 -0
- package/dist/components/primitives/checkbox.d.ts +42 -0
- package/dist/components/primitives/checkbox.d.ts.map +1 -0
- package/dist/components/primitives/checkbox.js +31 -0
- package/dist/components/primitives/checkbox.js.map +1 -0
- package/dist/components/primitives/chip-select.d.ts +38 -0
- package/dist/components/primitives/chip-select.d.ts.map +1 -0
- package/dist/components/primitives/chip-select.js +25 -0
- package/dist/components/primitives/chip-select.js.map +1 -0
- package/dist/components/primitives/command-menu.d.ts +54 -0
- package/dist/components/primitives/command-menu.d.ts.map +1 -0
- package/dist/components/primitives/command-menu.js +24 -0
- package/dist/components/primitives/command-menu.js.map +1 -0
- package/dist/components/primitives/confirm-dialog.d.ts +52 -0
- package/dist/components/primitives/confirm-dialog.d.ts.map +1 -0
- package/dist/components/primitives/confirm-dialog.js +30 -0
- package/dist/components/primitives/confirm-dialog.js.map +1 -0
- package/dist/components/primitives/date-picker.d.ts +68 -0
- package/dist/components/primitives/date-picker.d.ts.map +1 -0
- package/dist/components/primitives/date-picker.js +107 -0
- package/dist/components/primitives/date-picker.js.map +1 -0
- package/dist/components/primitives/dialog.d.ts +50 -0
- package/dist/components/primitives/dialog.d.ts.map +1 -0
- package/dist/components/primitives/dialog.js +90 -0
- package/dist/components/primitives/dialog.js.map +1 -0
- package/dist/components/primitives/drawer.d.ts +71 -0
- package/dist/components/primitives/drawer.d.ts.map +1 -0
- package/dist/components/primitives/drawer.js +93 -0
- package/dist/components/primitives/drawer.js.map +1 -0
- package/dist/components/primitives/dropdown-menu.d.ts +40 -0
- package/dist/components/primitives/dropdown-menu.d.ts.map +1 -0
- package/dist/components/primitives/dropdown-menu.js +53 -0
- package/dist/components/primitives/dropdown-menu.js.map +1 -0
- package/dist/components/primitives/form-field.d.ts +94 -0
- package/dist/components/primitives/form-field.d.ts.map +1 -0
- package/dist/components/primitives/form-field.js +27 -0
- package/dist/components/primitives/form-field.js.map +1 -0
- package/dist/components/primitives/inline-confirm.d.ts +62 -0
- package/dist/components/primitives/inline-confirm.d.ts.map +1 -0
- package/dist/components/primitives/inline-confirm.js +11 -0
- package/dist/components/primitives/inline-confirm.js.map +1 -0
- package/dist/components/primitives/input.d.ts +4 -0
- package/dist/components/primitives/input.d.ts.map +1 -0
- package/dist/components/primitives/input.js +13 -0
- package/dist/components/primitives/input.js.map +1 -0
- package/dist/components/primitives/label.d.ts +26 -0
- package/dist/components/primitives/label.d.ts.map +1 -0
- package/dist/components/primitives/label.js +33 -0
- package/dist/components/primitives/label.js.map +1 -0
- package/dist/components/primitives/pagination.d.ts +54 -0
- package/dist/components/primitives/pagination.d.ts.map +1 -0
- package/dist/components/primitives/pagination.js +31 -0
- package/dist/components/primitives/pagination.js.map +1 -0
- package/dist/components/primitives/popover.d.ts +12 -0
- package/dist/components/primitives/popover.d.ts.map +1 -0
- package/dist/components/primitives/popover.js +22 -0
- package/dist/components/primitives/popover.js.map +1 -0
- package/dist/components/primitives/progress.d.ts +25 -0
- package/dist/components/primitives/progress.d.ts.map +1 -0
- package/dist/components/primitives/progress.js +25 -0
- package/dist/components/primitives/progress.js.map +1 -0
- package/dist/components/primitives/radio-group.d.ts +47 -0
- package/dist/components/primitives/radio-group.d.ts.map +1 -0
- package/dist/components/primitives/radio-group.js +11 -0
- package/dist/components/primitives/radio-group.js.map +1 -0
- package/dist/components/primitives/select.d.ts +39 -0
- package/dist/components/primitives/select.d.ts.map +1 -0
- package/dist/components/primitives/select.js +142 -0
- package/dist/components/primitives/select.js.map +1 -0
- package/dist/components/primitives/separator.d.ts +9 -0
- package/dist/components/primitives/separator.d.ts.map +1 -0
- package/dist/components/primitives/separator.js +16 -0
- package/dist/components/primitives/separator.js.map +1 -0
- package/dist/components/primitives/side-nav.d.ts +65 -0
- package/dist/components/primitives/side-nav.d.ts.map +1 -0
- package/dist/components/primitives/side-nav.js +100 -0
- package/dist/components/primitives/side-nav.js.map +1 -0
- package/dist/components/primitives/skeleton.d.ts +22 -0
- package/dist/components/primitives/skeleton.d.ts.map +1 -0
- package/dist/components/primitives/skeleton.js +25 -0
- package/dist/components/primitives/skeleton.js.map +1 -0
- package/dist/components/primitives/spinner.d.ts +20 -0
- package/dist/components/primitives/spinner.d.ts.map +1 -0
- package/dist/components/primitives/spinner.js +21 -0
- package/dist/components/primitives/spinner.js.map +1 -0
- package/dist/components/primitives/switch.d.ts +29 -0
- package/dist/components/primitives/switch.d.ts.map +1 -0
- package/dist/components/primitives/switch.js +24 -0
- package/dist/components/primitives/switch.js.map +1 -0
- package/dist/components/primitives/table.d.ts +23 -0
- package/dist/components/primitives/table.d.ts.map +1 -0
- package/dist/components/primitives/table.js +81 -0
- package/dist/components/primitives/table.js.map +1 -0
- package/dist/components/primitives/tabs.d.ts +38 -0
- package/dist/components/primitives/tabs.d.ts.map +1 -0
- package/dist/components/primitives/tabs.js +84 -0
- package/dist/components/primitives/tabs.js.map +1 -0
- package/dist/components/primitives/textarea.d.ts +4 -0
- package/dist/components/primitives/textarea.d.ts.map +1 -0
- package/dist/components/primitives/textarea.js +11 -0
- package/dist/components/primitives/textarea.js.map +1 -0
- package/dist/components/primitives/toast.d.ts +24 -0
- package/dist/components/primitives/toast.d.ts.map +1 -0
- package/dist/components/primitives/toast.js +58 -0
- package/dist/components/primitives/toast.js.map +1 -0
- package/dist/components/primitives/tooltip.d.ts +30 -0
- package/dist/components/primitives/tooltip.d.ts.map +1 -0
- package/dist/components/primitives/tooltip.js +6 -0
- package/dist/components/primitives/tooltip.js.map +1 -0
- package/dist/components/status/state-chip.d.ts +53 -0
- package/dist/components/status/state-chip.d.ts.map +1 -0
- package/dist/components/status/state-chip.js +8 -0
- package/dist/components/status/state-chip.js.map +1 -0
- package/dist/components/status/state-mark.d.ts +21 -0
- package/dist/components/status/state-mark.d.ts.map +1 -0
- package/dist/components/status/state-mark.js +90 -0
- package/dist/components/status/state-mark.js.map +1 -0
- package/dist/components/status/status-pill.d.ts +62 -0
- package/dist/components/status/status-pill.d.ts.map +1 -0
- package/dist/components/status/status-pill.js +65 -0
- package/dist/components/status/status-pill.js.map +1 -0
- package/dist/components/status/status-tokens.d.ts +110 -0
- package/dist/components/status/status-tokens.d.ts.map +1 -0
- package/dist/components/status/status-tokens.js +102 -0
- package/dist/components/status/status-tokens.js.map +1 -0
- package/dist/index.d.ts +76 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +95 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/cn.d.ts +11 -0
- package/dist/lib/cn.d.ts.map +1 -0
- package/dist/lib/cn.js +78 -0
- package/dist/lib/cn.js.map +1 -0
- package/dist/lib/money.d.ts +73 -0
- package/dist/lib/money.d.ts.map +1 -0
- package/dist/lib/money.js +123 -0
- package/dist/lib/money.js.map +1 -0
- package/dist/lib/omit-undefined.d.ts +17 -0
- package/dist/lib/omit-undefined.d.ts.map +1 -0
- package/dist/lib/omit-undefined.js +24 -0
- package/dist/lib/omit-undefined.js.map +1 -0
- package/package.json +100 -0
- package/src/components/data/code.tsx +43 -0
- package/src/components/data/copy-button.tsx +97 -0
- package/src/components/data/detail-row.tsx +113 -0
- package/src/components/data/id-display.tsx +49 -0
- package/src/components/data/masked-value.tsx +96 -0
- package/src/components/data/money.tsx +46 -0
- package/src/components/data/phone-display.tsx +60 -0
- package/src/components/data/stat-tile.tsx +68 -0
- package/src/components/data/timestamp-display.tsx +106 -0
- package/src/components/patterns/inline-banner.tsx +60 -0
- package/src/components/patterns/inline-empty-state.tsx +45 -0
- package/src/components/patterns/live-row.tsx +75 -0
- package/src/components/patterns/payload-inspector.tsx +157 -0
- package/src/components/patterns/route-skeleton.tsx +77 -0
- package/src/components/patterns/screen-layout.tsx +44 -0
- package/src/components/patterns/stale-write-banner.tsx +44 -0
- package/src/components/patterns/state-timeline.tsx +229 -0
- package/src/components/primitives/badge.tsx +40 -0
- package/src/components/primitives/button.tsx +54 -0
- package/src/components/primitives/calendar.tsx +136 -0
- package/src/components/primitives/card.tsx +70 -0
- package/src/components/primitives/checkbox.tsx +101 -0
- package/src/components/primitives/chip-select.tsx +105 -0
- package/src/components/primitives/command-menu.tsx +92 -0
- package/src/components/primitives/confirm-dialog.tsx +109 -0
- package/src/components/primitives/date-picker.tsx +271 -0
- package/src/components/primitives/dialog.tsx +195 -0
- package/src/components/primitives/drawer.tsx +326 -0
- package/src/components/primitives/dropdown-menu.tsx +128 -0
- package/src/components/primitives/form-field.tsx +136 -0
- package/src/components/primitives/inline-confirm.tsx +118 -0
- package/src/components/primitives/input.tsx +21 -0
- package/src/components/primitives/label.tsx +43 -0
- package/src/components/primitives/pagination.tsx +110 -0
- package/src/components/primitives/popover.tsx +41 -0
- package/src/components/primitives/progress.tsx +66 -0
- package/src/components/primitives/radio-group.tsx +90 -0
- package/src/components/primitives/select.tsx +254 -0
- package/src/components/primitives/separator.tsx +49 -0
- package/src/components/primitives/side-nav.tsx +253 -0
- package/src/components/primitives/skeleton.tsx +25 -0
- package/src/components/primitives/spinner.tsx +39 -0
- package/src/components/primitives/switch.tsx +74 -0
- package/src/components/primitives/table.tsx +157 -0
- package/src/components/primitives/tabs.tsx +163 -0
- package/src/components/primitives/textarea.tsx +21 -0
- package/src/components/primitives/toast.tsx +117 -0
- package/src/components/primitives/tooltip.tsx +38 -0
- package/src/components/status/state-chip.tsx +70 -0
- package/src/components/status/state-mark.tsx +154 -0
- package/src/components/status/status-pill.tsx +153 -0
- package/src/components/status/status-tokens.ts +173 -0
- package/src/index.ts +96 -0
- package/src/lib/cn.ts +168 -0
- package/src/lib/money.ts +164 -0
- package/src/lib/omit-undefined.ts +25 -0
- package/src/styles/theme.css +381 -0
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from "../../lib/cn.js";
|
|
3
|
+
// Geometry per design doc §4.3, at a 16x16 viewBox: circle r=6 centred at
|
|
4
|
+
// (8,8), stroke 1.5; the progress wedge/ring inset 1.5 from that stroke
|
|
5
|
+
// (r=4.5); diamond = square rotated 45deg, circumradius 7; square = 10x10
|
|
6
|
+
// centred, corner radius 1. All at stroke-width 1.5.
|
|
7
|
+
const CX = 8;
|
|
8
|
+
const CY = 8;
|
|
9
|
+
const R = 6;
|
|
10
|
+
const R_INNER = 4.5;
|
|
11
|
+
/** Clockwise pie wedge from 12 o'clock, `sweepDeg` degrees, radius `r`. */
|
|
12
|
+
function pieWedgePath(sweepDeg, r) {
|
|
13
|
+
const rad = (sweepDeg * Math.PI) / 180;
|
|
14
|
+
const x = CX + r * Math.sin(rad);
|
|
15
|
+
const y = CY - r * Math.cos(rad);
|
|
16
|
+
const largeArc = sweepDeg > 180 ? 1 : 0;
|
|
17
|
+
return `M${CX},${CY} L${CX},${CY - r} A${r},${r} 0 ${largeArc},1 ${round(x)},${round(y)} Z`;
|
|
18
|
+
}
|
|
19
|
+
function round(n) {
|
|
20
|
+
return Math.round(n * 100) / 100;
|
|
21
|
+
}
|
|
22
|
+
const DIAMOND_POINTS = `${CX},${CY - 7} ${CX + 7},${CY} ${CX},${CY + 7} ${CX - 7},${CY}`;
|
|
23
|
+
function Silhouette({ meta }) {
|
|
24
|
+
const fill = meta.filled ? "currentColor" : "none";
|
|
25
|
+
const stroke = "currentColor";
|
|
26
|
+
switch (meta.silhouette) {
|
|
27
|
+
case "circle":
|
|
28
|
+
return _jsx("circle", { cx: CX, cy: CY, r: R, fill: fill, stroke: stroke, strokeWidth: 1.5 });
|
|
29
|
+
case "diamond":
|
|
30
|
+
return _jsx("polygon", { points: DIAMOND_POINTS, fill: fill, stroke: stroke, strokeWidth: 1.5 });
|
|
31
|
+
case "square":
|
|
32
|
+
return (_jsx("rect", { x: 3, y: 3, width: 10, height: 10, rx: 1, fill: fill, stroke: stroke, strokeWidth: 1.5 }));
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Terminal states (delivered/cancelled/expired/rejected/failed) render a
|
|
37
|
+
* solid, filled silhouette (design doc §4.3: "is it over?" is readable from
|
|
38
|
+
* fill alone). The interior mark then has to cut through that fill to stay
|
|
39
|
+
* legible — this is the one place `StateMark` is not literally
|
|
40
|
+
* single-tone: the mark strokes in `--state-mark-knockout` (default: the
|
|
41
|
+
* page canvas colour) rather than `currentColor`, since a currentColor
|
|
42
|
+
* stroke on a currentColor fill would be invisible. Non-terminal marks
|
|
43
|
+
* (pie wedges, the submitted ring, the uncertain "?", the undelivered
|
|
44
|
+
* pause bars) stay `currentColor` throughout, on an unfilled silhouette.
|
|
45
|
+
*/
|
|
46
|
+
function InteriorMark({ mark, knockout }) {
|
|
47
|
+
const stroke = knockout ? "var(--state-mark-knockout, var(--color-base-100))" : "currentColor";
|
|
48
|
+
const common = {
|
|
49
|
+
stroke,
|
|
50
|
+
strokeWidth: 1.5,
|
|
51
|
+
strokeLinecap: "round",
|
|
52
|
+
fill: "none",
|
|
53
|
+
};
|
|
54
|
+
switch (mark) {
|
|
55
|
+
case "pie-1":
|
|
56
|
+
return _jsx("path", { d: pieWedgePath(90, R_INNER), fill: "currentColor" });
|
|
57
|
+
case "pie-2":
|
|
58
|
+
return _jsx("path", { d: pieWedgePath(180, R_INNER), fill: "currentColor" });
|
|
59
|
+
case "pie-3":
|
|
60
|
+
return _jsx("path", { d: pieWedgePath(270, R_INNER), fill: "currentColor" });
|
|
61
|
+
case "ring":
|
|
62
|
+
return (_jsx("circle", { cx: CX, cy: CY, r: R_INNER, fill: "none", stroke: "currentColor", strokeWidth: 1.5 }));
|
|
63
|
+
case "check":
|
|
64
|
+
return _jsx("polyline", { points: "5.4,8.3 7.2,10.2 11,5.8", strokeLinejoin: "round", ...common });
|
|
65
|
+
case "cross":
|
|
66
|
+
return (_jsxs("g", { ...common, children: [_jsx("line", { x1: 5.6, y1: 5.6, x2: 10.4, y2: 10.4 }), _jsx("line", { x1: 10.4, y1: 5.6, x2: 5.6, y2: 10.4 })] }));
|
|
67
|
+
case "slash":
|
|
68
|
+
return _jsx("line", { x1: 5.6, y1: 10.4, x2: 10.4, y2: 5.6, ...common });
|
|
69
|
+
case "bar":
|
|
70
|
+
return _jsx("line", { x1: 5, y1: 8, x2: 11, y2: 8, ...common });
|
|
71
|
+
case "clock":
|
|
72
|
+
return (_jsxs("g", { ...common, children: [_jsx("line", { x1: 8, y1: 8, x2: 8, y2: 5.4 }), _jsx("line", { x1: 8, y1: 8, x2: 10.1, y2: 8.9 })] }));
|
|
73
|
+
case "question":
|
|
74
|
+
return (_jsxs("g", { ...common, children: [_jsx("path", { d: "M6.2 6.6c0-1.1 0.9-1.9 1.9-1.9s1.9 0.7 1.9 1.7c0 1.3-1.9 1.3-1.9 2.9" }), _jsx("circle", { cx: 8, cy: 10.7, r: 0.15, fill: "currentColor", stroke: "none" })] }));
|
|
75
|
+
case "pause":
|
|
76
|
+
return (_jsxs("g", { ...common, children: [_jsx("line", { x1: 6.3, y1: 5.5, x2: 6.3, y2: 10.5 }), _jsx("line", { x1: 9.7, y1: 5.5, x2: 9.7, y2: 10.5 })] }));
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* The status-glyph SVG primitive: silhouette × interior mark × fill.
|
|
81
|
+
*
|
|
82
|
+
* Parameterised on a raw [`StatusMeta`] rather than on any particular
|
|
83
|
+
* state enum, so every state machine's pill renders through this one
|
|
84
|
+
* geometry instead of forking it. Pure, and `aria-hidden` — the
|
|
85
|
+
* accessible name belongs on the wrapping pill, which has the label.
|
|
86
|
+
*/
|
|
87
|
+
export function StateMark({ meta, size = 14, className, ...props }) {
|
|
88
|
+
return (_jsxs("svg", { viewBox: "0 0 16 16", width: size, height: size, "aria-hidden": "true", className: cn("shrink-0", className), ...props, children: [_jsx(Silhouette, { meta: meta }), _jsx(InteriorMark, { mark: meta.mark, knockout: meta.filled })] }));
|
|
89
|
+
}
|
|
90
|
+
//# sourceMappingURL=state-mark.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"state-mark.js","sourceRoot":"","sources":["../../../src/components/status/state-mark.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AAalC,0EAA0E;AAC1E,wEAAwE;AACxE,0EAA0E;AAC1E,qDAAqD;AACrD,MAAM,EAAE,GAAG,CAAC,CAAC;AACb,MAAM,EAAE,GAAG,CAAC,CAAC;AACb,MAAM,CAAC,GAAG,CAAC,CAAC;AACZ,MAAM,OAAO,GAAG,GAAG,CAAC;AAEpB,2EAA2E;AAC3E,SAAS,YAAY,CAAC,QAAgB,EAAE,CAAS;IAC/C,MAAM,GAAG,GAAG,CAAC,QAAQ,GAAG,IAAI,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC;IACvC,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACjC,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACjC,MAAM,QAAQ,GAAG,QAAQ,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACxC,OAAO,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,QAAQ,MAAM,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC;AAC9F,CAAC;AAED,SAAS,KAAK,CAAC,CAAS;IACtB,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC;AACnC,CAAC;AAED,M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AC1B,KAAC,YAAY,IAAC,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,CAAC,MAAM,GAAI,IACpD,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type { ComponentType, ReactNode } from "react";
|
|
2
|
+
import { type StatusMeta, type StatusSystem } from "./status-tokens.js";
|
|
3
|
+
export interface StatusPillProps {
|
|
4
|
+
/** One state's presentation, e.g. `MY_STATUS_SYSTEM[state]`. */
|
|
5
|
+
meta: StatusMeta;
|
|
6
|
+
/** The raw enum literal, shown when `showLiteral` is set and used in the
|
|
7
|
+
* accessible name. Optional: a pill for a state machine whose literals
|
|
8
|
+
* are not user-facing can omit it. */
|
|
9
|
+
literal?: string | undefined;
|
|
10
|
+
/** Default `'auto'`: resolved from the state's own `attention` field. */
|
|
11
|
+
variant?: "auto" | "quiet" | "loud";
|
|
12
|
+
size?: "sm" | "md";
|
|
13
|
+
/** Render the mono enum literal beside the label. True in detail views,
|
|
14
|
+
* false in tables, where the label alone is enough and the literal is
|
|
15
|
+
* noise repeated down the column. */
|
|
16
|
+
showLiteral?: boolean;
|
|
17
|
+
/** Short mono qualifier, e.g. `failed · 4xx`. */
|
|
18
|
+
detail?: ReactNode;
|
|
19
|
+
/** Optimistic-transition case: dimmed + dashed, held until the server
|
|
20
|
+
* confirms. Never use it to mean "we think this is probably the state" —
|
|
21
|
+
* only for a transition this client has itself just requested. */
|
|
22
|
+
pending?: boolean;
|
|
23
|
+
interactive?: boolean;
|
|
24
|
+
onClick?: (() => void) | undefined;
|
|
25
|
+
className?: string | undefined;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* The canonical status representation: glyph + label + attention
|
|
29
|
+
* treatment. Typically the single most-reused component in an operator
|
|
30
|
+
* console — every screen showing a state renders through it.
|
|
31
|
+
*
|
|
32
|
+
* Takes a [`StatusMeta`] rather than a state literal, so one
|
|
33
|
+
* implementation serves every state machine in an application.
|
|
34
|
+
* [`createStatusPill`] is the ergonomic wrapper; reach for this directly
|
|
35
|
+
* only when the meta comes from somewhere other than a fixed table.
|
|
36
|
+
*/
|
|
37
|
+
export declare function StatusPill({ meta, literal, variant, size, showLiteral, detail, pending, interactive, onClick, className, }: StatusPillProps): import("react").JSX.Element;
|
|
38
|
+
export type TypedStatusPillProps<S extends string> = Omit<StatusPillProps, "meta" | "literal"> & {
|
|
39
|
+
state: S;
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* Binds a [`StatusSystem`] to a pill component whose `state` prop accepts
|
|
43
|
+
* exactly that system's states and nothing else.
|
|
44
|
+
*
|
|
45
|
+
* ```tsx
|
|
46
|
+
* export const OrderStatusPill = createStatusPill(ORDER_STATUS);
|
|
47
|
+
* <OrderStatusPill state="refunded" showLiteral />
|
|
48
|
+
* ```
|
|
49
|
+
*
|
|
50
|
+
* This replaced three hand-written, near-identical pill components — one
|
|
51
|
+
* per state machine — that differed only in which table they indexed and
|
|
52
|
+
* had already drifted apart in small ways (one set `role="img"`, one did
|
|
53
|
+
* not; one supported `interactive`, two did not). Their own doc comments
|
|
54
|
+
* each argued for staying separate on the grounds that the state machines
|
|
55
|
+
* genuinely differ in meaning — which is true, and is preserved here:
|
|
56
|
+
* each machine still has its own table and its own component identity,
|
|
57
|
+
* and `state` is still typed to one machine's literals, so a `JobState`
|
|
58
|
+
* cannot be passed to an order pill. What they do not need is three
|
|
59
|
+
* copies of the rendering.
|
|
60
|
+
*/
|
|
61
|
+
export declare function createStatusPill<S extends string>(system: StatusSystem<S>): ComponentType<TypedStatusPillProps<S>>;
|
|
62
|
+
//# sourceMappingURL=status-pill.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"status-pill.d.ts","sourceRoot":"","sources":["../../../src/components/status/status-pill.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGtD,OAAO,EAAe,KA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2
|
+
import { cn } from "../../lib/cn.js";
|
|
3
|
+
import { StateMark } from "./state-mark.js";
|
|
4
|
+
import { HUE_CLASSES } from "./status-tokens.js";
|
|
5
|
+
/**
|
|
6
|
+
* The canonical status representation: glyph + label + attention
|
|
7
|
+
* treatment. Typically the single most-reused component in an operator
|
|
8
|
+
* console — every screen showing a state renders through it.
|
|
9
|
+
*
|
|
10
|
+
* Takes a [`StatusMeta`] rather than a state literal, so one
|
|
11
|
+
* implementation serves every state machine in an application.
|
|
12
|
+
* [`createStatusPill`] is the ergonomic wrapper; reach for this directly
|
|
13
|
+
* only when the meta comes from somewhere other than a fixed table.
|
|
14
|
+
*/
|
|
15
|
+
export function StatusPill({ meta, literal, variant = "auto", size = "sm", showLiteral = false, detail, pending = false, interactive = false, onClick, className, }) {
|
|
16
|
+
const resolvedVariant = variant === "auto" ? meta.attention : variant;
|
|
17
|
+
const loud = resolvedVariant === "loud";
|
|
18
|
+
const hue = HUE_CLASSES[meta.hue];
|
|
19
|
+
const markSize = size === "md" ? 16 : 14;
|
|
20
|
+
const Comp = interactive ? "button" : "span";
|
|
21
|
+
return (_jsxs(Comp, { type: interactive ? "button" : undefined, onClick: interactive ? onClick : undefined, title: meta.tooltip,
|
|
22
|
+
// A non-interactive pill is an image of a state, not a label for
|
|
23
|
+
// one; without `role="img"` the `aria-label` on a `<span>` is
|
|
24
|
+
// ignored by several screen readers.
|
|
25
|
+
role: interactive ? undefined : "img", "aria-label": literal === undefined ? meta.label : `${literal} — ${meta.label}`, className: cn("inline-flex items-center gap-[5px] whitespace-nowrap align-middle", "text-caption", loud && [hue.bg, hue.border, "rounded-sm border py-0.5 pr-1.5 pl-[5px] font-medium"],
|
|
26
|
+
// A dashed outline, and NOT dimming. `pending` used to be
|
|
27
|
+
// `opacity-60`, which took its own text to 2.71:1 against the
|
|
28
|
+
// page — below AA, and unreadable at exactly the moment a reader
|
|
29
|
+
// most wants to know what is happening. Measured before changing
|
|
30
|
+
// it: the opacity that keeps this text at AA is 0.90, by which
|
|
31
|
+
// point the dimming conveys nothing. So the state says so with a
|
|
32
|
+
// border instead, at full text contrast.
|
|
33
|
+
//
|
|
34
|
+
// A quiet pill has no border to dash, so it grows the same box a
|
|
35
|
+
// loud one has — otherwise `pending` would be invisible on the
|
|
36
|
+
// majority of pills.
|
|
37
|
+
pending && "border-dashed", pending && !loud && "rounded-sm border border-edge-strong py-0.5 pr-1.5 pl-[5px]", interactive && "cursor-pointer", className), children: [_jsx(StateMark, { meta: meta, size: markSize, className: hue.fg }), _jsx("span", { className: loud ? hue.fg : "text-muted-foreground", children: meta.label }), showLiteral && literal !== undefined && (_jsx("span", { className: cn("font-mono text-micro", loud ? "text-muted-foreground" : "text-subtle-foreground"), children: literal })), detail != null && (_jsx("span", { className: cn("font-mono", loud ? "text-muted-foreground" : "text-subtle-foreground"), children: detail }))] }));
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Binds a [`StatusSystem`] to a pill component whose `state` prop accepts
|
|
41
|
+
* exactly that system's states and nothing else.
|
|
42
|
+
*
|
|
43
|
+
* ```tsx
|
|
44
|
+
* export const OrderStatusPill = createStatusPill(ORDER_STATUS);
|
|
45
|
+
* <OrderStatusPill state="refunded" showLiteral />
|
|
46
|
+
* ```
|
|
47
|
+
*
|
|
48
|
+
* This replaced three hand-written, near-identical pill components — one
|
|
49
|
+
* per state machine — that differed only in which table they indexed and
|
|
50
|
+
* had already drifted apart in small ways (one set `role="img"`, one did
|
|
51
|
+
* not; one supported `interactive`, two did not). Their own doc comments
|
|
52
|
+
* each argued for staying separate on the grounds that the state machines
|
|
53
|
+
* genuinely differ in meaning — which is true, and is preserved here:
|
|
54
|
+
* each machine still has its own table and its own component identity,
|
|
55
|
+
* and `state` is still typed to one machine's literals, so a `JobState`
|
|
56
|
+
* cannot be passed to an order pill. What they do not need is three
|
|
57
|
+
* copies of the rendering.
|
|
58
|
+
*/
|
|
59
|
+
export function createStatusPill(system) {
|
|
60
|
+
function BoundStatusPill({ state, ...props }) {
|
|
61
|
+
return _jsx(StatusPill, { meta: system[state], literal: state, ...props });
|
|
62
|
+
}
|
|
63
|
+
return BoundStatusPill;
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=status-pill.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"status-pill.js","sourceRoot":"","sources":["../../../src/components/status/status-pill.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AAClC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,WAAW,EAAsC,MAAM,iBAAiB,CAAC;AA2BlF;;;;;;;;;GASG;AACH,MAAM,UAAU,UAAU,CAAC,EACzB,IAAI,EACJ,OAAO,EACP,OAAO,GAAG,MAAM,EAChB,IAAI,GAAG,IAAI,EACX,WAAW,GAAG,KAAK,EACnB,MAAM,EACN,OAAO,GAAG,KAAK,EACf,WAAW,GAAG,KAAK,EACnB,OAAO,EACP,SAAS,GACO;IAChB,MAAM,eAAe,GAAG,OAAO,KAAK,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC;IACtE,MAAM,IAAI,GAAG,eAAe,KAAK,MAAM,CAAC;IACxC,MAAM,GAAG,GAAG,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAClC,MAAM,QAAQ,GAAG,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IAEzC,MAAM,IAAI,GAAG,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC;IAE7C,OAAO,CACL,MAAC,IAAI,IACH,IAAI,EAAE,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,EACxC,OAAO,EAAE,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,EAC1C,KAAK,EAAE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M,GACF,CACR,IACI,CACR,CAAC;AACJ,CAAC;AAMD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,UAAU,gBAAgB,CAC9B,MAAuB;IAEvB,SAAS,eAAe,CAAC,EAAE,KAAK,EAAE,GAAG,KAAK,EAA2B;QACnE,OAAO,KAAC,UAAU,IAAC,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,EAAE,OAAO,EAAE,KAAK,KAAM,KAAK,GAAI,CAAC;IACxE,CAAC;IACD,OAAO,eAAe,CAAC;AACzB,CAAC"}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The vocabulary of a status-glyph system — types and shared classes only,
|
|
3
|
+
* no domain data.
|
|
4
|
+
*
|
|
5
|
+
* # What this is
|
|
6
|
+
*
|
|
7
|
+
* A *status system* is one state machine's presentation: a table mapping
|
|
8
|
+
* every state that machine can be in to a glyph, a hue, an attention level
|
|
9
|
+
* and human copy. This module owns the vocabulary and the rendering; the
|
|
10
|
+
* table itself belongs to whoever owns the state machine, which is never
|
|
11
|
+
* this package.
|
|
12
|
+
*
|
|
13
|
+
* ```tsx
|
|
14
|
+
* const ORDER_STATUS = defineStatusSystem({
|
|
15
|
+
* pending: { family: "in-flight", silhouette: "circle", mark: "pie-1",
|
|
16
|
+
* hue: "neutral", filled: false, attention: "quiet",
|
|
17
|
+
* label: "Pending", tooltip: "Awaiting payment." },
|
|
18
|
+
* paid: { family: "terminal", silhouette: "circle", mark: "check",
|
|
19
|
+
* hue: "success", filled: true, attention: "quiet",
|
|
20
|
+
* label: "Paid", tooltip: "Settled." },
|
|
21
|
+
* refunded: { family: "terminal", silhouette: "circle", mark: "bar",
|
|
22
|
+
* hue: "neutral", filled: true, attention: "quiet",
|
|
23
|
+
* label: "Refunded", tooltip: "Returned to the payer." },
|
|
24
|
+
* });
|
|
25
|
+
*
|
|
26
|
+
* const OrderStatusPill = createStatusPill(ORDER_STATUS);
|
|
27
|
+
* <OrderStatusPill state="paid" />
|
|
28
|
+
* ```
|
|
29
|
+
*
|
|
30
|
+
* # Every field here is PRESENTATIONAL
|
|
31
|
+
*
|
|
32
|
+
* Never use `family` — or anything else in a `StatusMeta` — to decide
|
|
33
|
+
* whether an action is permitted. Terminality is data, and the server
|
|
34
|
+
* owns it: a UI that greys out "cancel" because its own table says
|
|
35
|
+
* `terminal` will be wrong the first time the state machine changes and
|
|
36
|
+
* nobody remembers this table exists. Propose the action and let the
|
|
37
|
+
* server refuse it.
|
|
38
|
+
*
|
|
39
|
+
* # Why a glyph and not just colour
|
|
40
|
+
*
|
|
41
|
+
* Colour alone fails for the ~8% of men with a colour-vision deficiency,
|
|
42
|
+
* and fails completely in a screenshot pasted into a monochrome ticket.
|
|
43
|
+
* Each state therefore differs in *silhouette* (circle / diamond /
|
|
44
|
+
* square), *interior mark*, and *fill* as well as hue — three redundant
|
|
45
|
+
* channels, so no single one is load-bearing.
|
|
46
|
+
*/
|
|
47
|
+
/**
|
|
48
|
+
* The three-way split every state machine this system has met so far
|
|
49
|
+
* reduces to: still moving, stopped somewhere that needs a human, or done.
|
|
50
|
+
*
|
|
51
|
+
* `unresolved` is the one worth naming explicitly — it is not a failure
|
|
52
|
+
* and not a success, and systems that only model two outcomes end up
|
|
53
|
+
* calling it whichever is more convenient, which is how "we never learned
|
|
54
|
+
* the outcome" gets reported to a user as "delivered".
|
|
55
|
+
*/
|
|
56
|
+
export type StatusFamily = "in-flight" | "unresolved" | "terminal";
|
|
57
|
+
export type StatusSilhouette = "circle" | "diamond" | "square";
|
|
58
|
+
/**
|
|
59
|
+
* The interior mark drawn inside the silhouette. `pie-1`..`pie-3` are the
|
|
60
|
+
* quarter-fill progress wedge; `ring` is a completed stroke with a hollow
|
|
61
|
+
* centre (handed off, awaiting an external answer).
|
|
62
|
+
*/
|
|
63
|
+
export type StatusMark = "pie-1" | "pie-2" | "pie-3" | "ring" | "check" | "bar" | "clock" | "slash" | "cross" | "question" | "pause";
|
|
64
|
+
/**
|
|
65
|
+
* The saturated hues a status may take.
|
|
66
|
+
*
|
|
67
|
+
* `warning` and `uncertain` are deliberately distinct despite both reading
|
|
68
|
+
* as "attention": `uncertain` means the outcome is unknown, `warning`
|
|
69
|
+
* means a recoverable condition needs a human. `expired` and `parked` are
|
|
70
|
+
* separated from `neutral` for the same reason — a state nobody needs to
|
|
71
|
+
* act on and a state waiting for someone should not look identical.
|
|
72
|
+
*/
|
|
73
|
+
export type StatusHue = "neutral" | "success" | "warning" | "danger" | "uncertain" | "expired" | "parked";
|
|
74
|
+
/** Quiet: glyph only, no fill. Loud: tinted background + border. */
|
|
75
|
+
export type StatusAttention = "quiet" | "loud";
|
|
76
|
+
export interface StatusMeta {
|
|
77
|
+
family: StatusFamily;
|
|
78
|
+
silhouette: StatusSilhouette;
|
|
79
|
+
mark: StatusMark;
|
|
80
|
+
hue: StatusHue;
|
|
81
|
+
/** Terminal marks sit on a filled silhouette; in-flight/unresolved marks are stroked-only. */
|
|
82
|
+
filled: boolean;
|
|
83
|
+
attention: StatusAttention;
|
|
84
|
+
/** Human-facing name. Sentence case, not the raw enum literal. */
|
|
85
|
+
label: string;
|
|
86
|
+
/** One or two sentences saying what this state means and what happens next. */
|
|
87
|
+
tooltip: string;
|
|
88
|
+
}
|
|
89
|
+
/** One state machine's complete presentation table. */
|
|
90
|
+
export type StatusSystem<S extends string> = Readonly<Record<S, StatusMeta>>;
|
|
91
|
+
/**
|
|
92
|
+
* Identity at runtime; exists for inference. Without it a caller must
|
|
93
|
+
* write `const X: StatusSystem<"a" | "b"> = {…}` and repeat every key in
|
|
94
|
+
* the type annotation; with it, `S` is inferred from the object's own keys
|
|
95
|
+
* and `createStatusPill(X)` then accepts exactly those keys and no others.
|
|
96
|
+
*/
|
|
97
|
+
export declare function defineStatusSystem<S extends string>(system: StatusSystem<S>): StatusSystem<S>;
|
|
98
|
+
/**
|
|
99
|
+
* Whether a state is terminal *according to its own table* — a
|
|
100
|
+
* presentational question ("should this row stop animating"), never an
|
|
101
|
+
* authorisation one. See this module's own warning above.
|
|
102
|
+
*/
|
|
103
|
+
export declare function isTerminalStatus<S extends string>(system: StatusSystem<S>, state: S): boolean;
|
|
104
|
+
/** Hue → the token classes every status surface renders through. */
|
|
105
|
+
export declare const HUE_CLASSES: Record<StatusHue, {
|
|
106
|
+
fg: string;
|
|
107
|
+
bg: string;
|
|
108
|
+
border: string;
|
|
109
|
+
}>;
|
|
110
|
+
//# sourceMappingURL=status-tokens.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"status-tokens.d.ts","sourceRoot":"","sources":["../../../src/components/status/status-tokens.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AAEH;;;;;;;;GAQG;AACH,MAAM,MAAM,YAAY,GAAG,WAAW,GAAG,YAAY,GAAG,UAAU,CAAC;AAEnE,MAAM,MAAM,gBAAgB,GAAG,QAAQ,GAAG,SAAS,GAAG,QAAQ,CAAC;AAE/D;;;;GAIG;AACH,MAAM,MAAM,UAAU,GAClB,OAAO,GACP,OAAO,GACP,OAAO,GACP,MAAM,GACN,OAAO,GACP,KAAK,GACL,OAAO,GACP,OAAO,GACP,OAAO,GACP,UAAU,GACV,OAAO,CAAC;AAEZ;;;;;;;;GAQG;AACH,MAAM,MAAM,SAAS,GACjB,SAAS,GACT,SAAS,GACT,SAAS,GACT,QAAQ,GACR,WAAW,GACX,SAAS,GACT,QAAQ,CAAC;AAEb,oEAAoE;AACpE,MAAM,MAAM,eAAe,GAAG,OAAO,GAAG,MAAM,CAAC;AAE/C,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,YAAY,CAAC;IACrB,UAAU,EAAE,gBAAgB,CAAC;IAC7B,IAAI,EAAE,UAAU,CAAC;IACjB,GAAG,EAAE,SAAS,CAAC;IACf,8FAA8F;IAC9F,MAAM,EAAE,OAAO,CAAC;IAChB,SAAS,EAAE,eAAe,CAAC;IAC3B,kEAAkE;IAClE,KAAK,EAAE,MAAM,CAAC;IACd,+EAA+E;IAC/E,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,uDAAuD;AACvD,MAAM,MAAM,YAAY,CAAC,CAAC,SAAS,MAAM,IAAI,QAAQ,CAAC,MAAM,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC;AAE7E;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,SAAS,MAAM,EAAE,MAAM,EAAE,YAAY,CAAC,CAAC,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC,CAE7F;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,SAAS,MAAM,EAAE,MAAM,EAAE,YAAY,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,OAAO,CAE7F;AAED,oEAAoE;AACpE,eAAO,MAAM,WAAW,EAAE,MAAM,CAAC,SAAS,EAAE;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAoCrF,CAAC"}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The vocabulary of a status-glyph system — types and shared classes only,
|
|
3
|
+
* no domain data.
|
|
4
|
+
*
|
|
5
|
+
* # What this is
|
|
6
|
+
*
|
|
7
|
+
* A *status system* is one state machine's presentation: a table mapping
|
|
8
|
+
* every state that machine can be in to a glyph, a hue, an attention level
|
|
9
|
+
* and human copy. This module owns the vocabulary and the rendering; the
|
|
10
|
+
* table itself belongs to whoever owns the state machine, which is never
|
|
11
|
+
* this package.
|
|
12
|
+
*
|
|
13
|
+
* ```tsx
|
|
14
|
+
* const ORDER_STATUS = defineStatusSystem({
|
|
15
|
+
* pending: { family: "in-flight", silhouette: "circle", mark: "pie-1",
|
|
16
|
+
* hue: "neutral", filled: false, attention: "quiet",
|
|
17
|
+
* label: "Pending", tooltip: "Awaiting payment." },
|
|
18
|
+
* paid: { family: "terminal", silhouette: "circle", mark: "check",
|
|
19
|
+
* hue: "success", filled: true, attention: "quiet",
|
|
20
|
+
* label: "Paid", tooltip: "Settled." },
|
|
21
|
+
* refunded: { family: "terminal", silhouette: "circle", mark: "bar",
|
|
22
|
+
* hue: "neutral", filled: true, attention: "quiet",
|
|
23
|
+
* label: "Refunded", tooltip: "Returned to the payer." },
|
|
24
|
+
* });
|
|
25
|
+
*
|
|
26
|
+
* const OrderStatusPill = createStatusPill(ORDER_STATUS);
|
|
27
|
+
* <OrderStatusPill state="paid" />
|
|
28
|
+
* ```
|
|
29
|
+
*
|
|
30
|
+
* # Every field here is PRESENTATIONAL
|
|
31
|
+
*
|
|
32
|
+
* Never use `family` — or anything else in a `StatusMeta` — to decide
|
|
33
|
+
* whether an action is permitted. Terminality is data, and the server
|
|
34
|
+
* owns it: a UI that greys out "cancel" because its own table says
|
|
35
|
+
* `terminal` will be wrong the first time the state machine changes and
|
|
36
|
+
* nobody remembers this table exists. Propose the action and let the
|
|
37
|
+
* server refuse it.
|
|
38
|
+
*
|
|
39
|
+
* # Why a glyph and not just colour
|
|
40
|
+
*
|
|
41
|
+
* Colour alone fails for the ~8% of men with a colour-vision deficiency,
|
|
42
|
+
* and fails completely in a screenshot pasted into a monochrome ticket.
|
|
43
|
+
* Each state therefore differs in *silhouette* (circle / diamond /
|
|
44
|
+
* square), *interior mark*, and *fill* as well as hue — three redundant
|
|
45
|
+
* channels, so no single one is load-bearing.
|
|
46
|
+
*/
|
|
47
|
+
/**
|
|
48
|
+
* Identity at runtime; exists for inference. Without it a caller must
|
|
49
|
+
* write `const X: StatusSystem<"a" | "b"> = {…}` and repeat every key in
|
|
50
|
+
* the type annotation; with it, `S` is inferred from the object's own keys
|
|
51
|
+
* and `createStatusPill(X)` then accepts exactly those keys and no others.
|
|
52
|
+
*/
|
|
53
|
+
export function defineStatusSystem(system) {
|
|
54
|
+
return system;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Whether a state is terminal *according to its own table* — a
|
|
58
|
+
* presentational question ("should this row stop animating"), never an
|
|
59
|
+
* authorisation one. See this module's own warning above.
|
|
60
|
+
*/
|
|
61
|
+
export function isTerminalStatus(system, state) {
|
|
62
|
+
return system[state].family === "terminal";
|
|
63
|
+
}
|
|
64
|
+
/** Hue → the token classes every status surface renders through. */
|
|
65
|
+
export const HUE_CLASSES = {
|
|
66
|
+
neutral: {
|
|
67
|
+
fg: "text-state-neutral-fg",
|
|
68
|
+
bg: "bg-state-neutral-bg",
|
|
69
|
+
border: "border-state-neutral-border",
|
|
70
|
+
},
|
|
71
|
+
success: {
|
|
72
|
+
fg: "text-state-success-fg",
|
|
73
|
+
bg: "bg-state-success-bg",
|
|
74
|
+
border: "border-state-success-border",
|
|
75
|
+
},
|
|
76
|
+
warning: {
|
|
77
|
+
fg: "text-state-warning-fg",
|
|
78
|
+
bg: "bg-state-warning-bg",
|
|
79
|
+
border: "border-state-warning-border",
|
|
80
|
+
},
|
|
81
|
+
danger: {
|
|
82
|
+
fg: "text-state-danger-fg",
|
|
83
|
+
bg: "bg-state-danger-bg",
|
|
84
|
+
border: "border-state-danger-border",
|
|
85
|
+
},
|
|
86
|
+
uncertain: {
|
|
87
|
+
fg: "text-state-uncertain-fg",
|
|
88
|
+
bg: "bg-state-uncertain-bg",
|
|
89
|
+
border: "border-state-uncertain-border",
|
|
90
|
+
},
|
|
91
|
+
expired: {
|
|
92
|
+
fg: "text-state-expired-fg",
|
|
93
|
+
bg: "bg-state-expired-bg",
|
|
94
|
+
border: "border-state-expired-border",
|
|
95
|
+
},
|
|
96
|
+
parked: {
|
|
97
|
+
fg: "text-state-parked-fg",
|
|
98
|
+
bg: "bg-state-parked-bg",
|
|
99
|
+
border: "border-state-parked-border",
|
|
100
|
+
},
|
|
101
|
+
};
|
|
102
|
+
//# sourceMappingURL=status-tokens.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"status-tokens.js","sourceRoot":"","sources":["../../../src/components/status/status-tokens.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AAuEH;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB,CAAmB,MAAuB;IAC1E,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAAmB,MAAuB,EAAE,KAAQ;IAClF,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC,MAAM,KAAK,UAAU,CAAC;AAC7C,CAAC;AAED,oEAAoE;AACpE,MAAM,CAAC,MAAM,WAAW,GAAkE;IACxF,OAAO,EAAE;QACP,EAAE,EAAE,uBAAuB;QAC3B,EAAE,EAAE,qBAAqB;QACzB,MAAM,EAAE,6BAA6B;KACtC;IACD,OAAO,EAAE;QACP,EAAE,EAAE,uBAAuB;QAC3B,EAAE,EAAE,qBAAqB;QACzB,MAAM,EAAE,6BAA6B;KACtC;IACD,OAAO,EAAE;QACP,EAAE,EAAE,uBAAuB;QAC3B,EAAE,EAAE,qBAAqB;QACzB,MAAM,EAAE,6BAA6B;KACtC;IACD,MAAM,EAAE;QACN,EAAE,EAAE,sBAAsB;QAC1B,EAAE,EAAE,oBAAoB;QACxB,MAAM,EAAE,4BAA4B;KACrC;IACD,SAAS,EAAE;QACT,EAAE,EAAE,yBAAyB;QAC7B,EAAE,EAAE,uBAAuB;QAC3B,MAAM,EAAE,+BAA+B;KACxC;IACD,OAAO,EAAE;QACP,EAAE,EAAE,uBAAuB;QAC3B,EAAE,EAAE,qBAAqB;QACzB,MAAM,EAAE,6BAA6B;KACtC;IACD,MAAM,EAAE;QACN,EAAE,EAAE,sBAAsB;QAC1B,EAAE,EAAE,oBAAoB;QACxB,MAAM,EAAE,4BAA4B;KACrC;CACF,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@vaam-apps/ui` — a dark-first React component library for operator
|
|
3
|
+
* consoles: daisyUI for styling, Headless UI for behaviour, and a
|
|
4
|
+
* parameterised status-glyph system for state machines.
|
|
5
|
+
*
|
|
6
|
+
* Import the token layer **once**, from the app's own global stylesheet,
|
|
7
|
+
* after loading Tailwind and the daisyUI plugin:
|
|
8
|
+
*
|
|
9
|
+
* ```css
|
|
10
|
+
* @import "tailwindcss";
|
|
11
|
+
* @plugin "daisyui";
|
|
12
|
+
* @import "@vaam-apps/ui/styles/theme.css";
|
|
13
|
+
* @source "../node_modules/@vaam-apps/ui/dist";
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* The `@source` line is not optional: Tailwind v4 only generates the
|
|
17
|
+
* utilities it can see used, and it does not look inside `node_modules`
|
|
18
|
+
* by default. Omit it and every component renders unstyled — a silent
|
|
19
|
+
* failure that is miserable to debug.
|
|
20
|
+
*/
|
|
21
|
+
export * from "./components/data/code.js";
|
|
22
|
+
export * from "./components/data/copy-button.js";
|
|
23
|
+
export * from "./components/data/detail-row.js";
|
|
24
|
+
export * from "./components/data/id-display.js";
|
|
25
|
+
export * from "./components/data/masked-value.js";
|
|
26
|
+
export * from "./components/data/money.js";
|
|
27
|
+
export * from "./components/data/phone-display.js";
|
|
28
|
+
export * from "./components/data/stat-tile.js";
|
|
29
|
+
export * from "./components/data/timestamp-display.js";
|
|
30
|
+
export * from "./components/patterns/inline-banner.js";
|
|
31
|
+
export * from "./components/patterns/inline-empty-state.js";
|
|
32
|
+
export * from "./components/patterns/live-row.js";
|
|
33
|
+
export * from "./components/patterns/payload-inspector.js";
|
|
34
|
+
export * from "./components/patterns/route-skeleton.js";
|
|
35
|
+
export * from "./components/patterns/screen-layout.js";
|
|
36
|
+
export * from "./components/patterns/stale-write-banner.js";
|
|
37
|
+
export * from "./components/patterns/state-timeline.js";
|
|
38
|
+
export * from "./components/primitives/badge.js";
|
|
39
|
+
export * from "./components/primitives/button.js";
|
|
40
|
+
export * from "./components/primitives/calendar.js";
|
|
41
|
+
export * from "./components/primitives/card.js";
|
|
42
|
+
export * from "./components/primitives/checkbox.js";
|
|
43
|
+
export * from "./components/primitives/chip-select.js";
|
|
44
|
+
export * from "./components/primitives/command-menu.js";
|
|
45
|
+
export * from "./components/primitives/confirm-dialog.js";
|
|
46
|
+
export * from "./components/primitives/date-picker.js";
|
|
47
|
+
export * from "./components/primitives/dialog.js";
|
|
48
|
+
export * from "./components/primitives/drawer.js";
|
|
49
|
+
export * from "./components/primitives/dropdown-menu.js";
|
|
50
|
+
export * from "./components/primitives/form-field.js";
|
|
51
|
+
export * from "./components/primitives/inline-confirm.js";
|
|
52
|
+
export * from "./components/primitives/input.js";
|
|
53
|
+
export * from "./components/primitives/label.js";
|
|
54
|
+
export * from "./components/primitives/pagination.js";
|
|
55
|
+
export * from "./components/primitives/popover.js";
|
|
56
|
+
export * from "./components/primitives/progress.js";
|
|
57
|
+
export * from "./components/primitives/radio-group.js";
|
|
58
|
+
export * from "./components/primitives/select.js";
|
|
59
|
+
export * from "./components/primitives/separator.js";
|
|
60
|
+
export * from "./components/primitives/side-nav.js";
|
|
61
|
+
export * from "./components/primitives/skeleton.js";
|
|
62
|
+
export * from "./components/primitives/spinner.js";
|
|
63
|
+
export * from "./components/primitives/switch.js";
|
|
64
|
+
export * from "./components/primitives/table.js";
|
|
65
|
+
export * from "./components/primitives/tabs.js";
|
|
66
|
+
export * from "./components/primitives/textarea.js";
|
|
67
|
+
export * from "./components/primitives/toast.js";
|
|
68
|
+
export * from "./components/primitives/tooltip.js";
|
|
69
|
+
export * from "./components/status/state-chip.js";
|
|
70
|
+
export * from "./components/status/state-mark.js";
|
|
71
|
+
export * from "./components/status/status-pill.js";
|
|
72
|
+
export * from "./components/status/status-tokens.js";
|
|
73
|
+
export { cn } from "./lib/cn.js";
|
|
74
|
+
export * from "./lib/money.js";
|
|
75
|
+
export { omitUndefined } from "./lib/omit-undefined.js";
|
|
76
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.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AC;AAC/C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,kCAAkC,CAAC;AACjD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,iCAAiC,CAAC;AAMhD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,iCAAiC,CAAC;AAChD,cAAc,mCAAmC,CAAC;AAKlD,OAAO,EAAE,EAAE,EAAE,MAAM,UAAU,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@vaam-apps/ui` — a dark-first React component library for operator
|
|
3
|
+
* consoles: daisyUI for styling, Headless UI for behaviour, and a
|
|
4
|
+
* parameterised status-glyph system for state machines.
|
|
5
|
+
*
|
|
6
|
+
* Import the token layer **once**, from the app's own global stylesheet,
|
|
7
|
+
* after loading Tailwind and the daisyUI plugin:
|
|
8
|
+
*
|
|
9
|
+
* ```css
|
|
10
|
+
* @import "tailwindcss";
|
|
11
|
+
* @plugin "daisyui";
|
|
12
|
+
* @import "@vaam-apps/ui/styles/theme.css";
|
|
13
|
+
* @source "../node_modules/@vaam-apps/ui/dist";
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* The `@source` line is not optional: Tailwind v4 only generates the
|
|
17
|
+
* utilities it can see used, and it does not look inside `node_modules`
|
|
18
|
+
* by default. Omit it and every component renders unstyled — a silent
|
|
19
|
+
* failure that is miserable to debug.
|
|
20
|
+
*/
|
|
21
|
+
// ---------------------------------------------------------------------------
|
|
22
|
+
// Data display — consistency is the deliverable, so these are components
|
|
23
|
+
// rather than ad hoc per-screen formatting.
|
|
24
|
+
// ---------------------------------------------------------------------------
|
|
25
|
+
export * from "./components/data/code.js";
|
|
26
|
+
export * from "./components/data/copy-button.js";
|
|
27
|
+
export * from "./components/data/detail-row.js";
|
|
28
|
+
export * from "./components/data/id-display.js";
|
|
29
|
+
export * from "./components/data/masked-value.js";
|
|
30
|
+
export * from "./components/data/money.js";
|
|
31
|
+
export * from "./components/data/phone-display.js";
|
|
32
|
+
export * from "./components/data/stat-tile.js";
|
|
33
|
+
export * from "./components/data/timestamp-display.js";
|
|
34
|
+
// ---------------------------------------------------------------------------
|
|
35
|
+
// Patterns — composed screen-level building blocks. Still domain-free,
|
|
36
|
+
// but opinionated about layout in a way the primitives are not.
|
|
37
|
+
// ---------------------------------------------------------------------------
|
|
38
|
+
export * from "./components/patterns/inline-banner.js";
|
|
39
|
+
export * from "./components/patterns/inline-empty-state.js";
|
|
40
|
+
export * from "./components/patterns/live-row.js";
|
|
41
|
+
export * from "./components/patterns/payload-inspector.js";
|
|
42
|
+
export * from "./components/patterns/route-skeleton.js";
|
|
43
|
+
export * from "./components/patterns/screen-layout.js";
|
|
44
|
+
export * from "./components/patterns/stale-write-banner.js";
|
|
45
|
+
export * from "./components/patterns/state-timeline.js";
|
|
46
|
+
// ---------------------------------------------------------------------------
|
|
47
|
+
// Primitives
|
|
48
|
+
// ---------------------------------------------------------------------------
|
|
49
|
+
export * from "./components/primitives/badge.js";
|
|
50
|
+
export * from "./components/primitives/button.js";
|
|
51
|
+
export * from "./components/primitives/calendar.js";
|
|
52
|
+
export * from "./components/primitives/card.js";
|
|
53
|
+
export * from "./components/primitives/checkbox.js";
|
|
54
|
+
export * from "./components/primitives/chip-select.js";
|
|
55
|
+
export * from "./components/primitives/command-menu.js";
|
|
56
|
+
export * from "./components/primitives/confirm-dialog.js";
|
|
57
|
+
export * from "./components/primitives/date-picker.js";
|
|
58
|
+
export * from "./components/primitives/dialog.js";
|
|
59
|
+
export * from "./components/primitives/drawer.js";
|
|
60
|
+
export * from "./components/primitives/dropdown-menu.js";
|
|
61
|
+
export * from "./components/primitives/form-field.js";
|
|
62
|
+
export * from "./components/primitives/inline-confirm.js";
|
|
63
|
+
export * from "./components/primitives/input.js";
|
|
64
|
+
export * from "./components/primitives/label.js";
|
|
65
|
+
export * from "./components/primitives/pagination.js";
|
|
66
|
+
export * from "./components/primitives/popover.js";
|
|
67
|
+
export * from "./components/primitives/progress.js";
|
|
68
|
+
export * from "./components/primitives/radio-group.js";
|
|
69
|
+
export * from "./components/primitives/select.js";
|
|
70
|
+
export * from "./components/primitives/separator.js";
|
|
71
|
+
export * from "./components/primitives/side-nav.js";
|
|
72
|
+
export * from "./components/primitives/skeleton.js";
|
|
73
|
+
export * from "./components/primitives/spinner.js";
|
|
74
|
+
export * from "./components/primitives/switch.js";
|
|
75
|
+
export * from "./components/primitives/table.js";
|
|
76
|
+
export * from "./components/primitives/tabs.js";
|
|
77
|
+
export * from "./components/primitives/textarea.js";
|
|
78
|
+
export * from "./components/primitives/toast.js";
|
|
79
|
+
export * from "./components/primitives/tooltip.js";
|
|
80
|
+
// ---------------------------------------------------------------------------
|
|
81
|
+
// Status — the most-reused surface in an operator console. Read
|
|
82
|
+
// `status-tokens.ts` first: the tables live in the consuming application,
|
|
83
|
+
// not here.
|
|
84
|
+
// ---------------------------------------------------------------------------
|
|
85
|
+
export * from "./components/status/state-chip.js";
|
|
86
|
+
export * from "./components/status/state-mark.js";
|
|
87
|
+
export * from "./components/status/status-pill.js";
|
|
88
|
+
export * from "./components/status/status-tokens.js";
|
|
89
|
+
// ---------------------------------------------------------------------------
|
|
90
|
+
// Utilities
|
|
91
|
+
// ---------------------------------------------------------------------------
|
|
92
|
+
export { cn } from "./lib/cn.js";
|
|
93
|
+
export * from "./lib/money.js";
|
|
94
|
+
export { omitUndefined } from "./lib/omit-undefined.js";
|
|
95
|
+
//# sourceMappingURL=index.js.map
|