@sincpro/web-ui 2.2.0 → 2.3.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 +69 -3
- package/dist/components/board/Board.js +1 -1
- package/dist/components/listing/GroupingLevels.js +11 -9
- package/dist/components/listing/RecordCard.js +1 -1
- package/dist/components/navigation/NavigationTree.js +36 -9
- package/dist/components/search/CriteriaBuilder.js +3 -2
- package/dist/components/search/CriteriaChips.js +6 -5
- package/dist/components/search/JoinWord.js +1 -1
- package/dist/components/search/SearchBar.js +41 -25
- package/dist/components/shell/AppFrame.d.ts +10 -1
- package/dist/components/shell/AppFrame.js +53 -10
- package/dist/components/shell/Sidebar.d.ts +8 -3
- package/dist/components/shell/Sidebar.js +36 -11
- package/dist/components/shell/TopBar.d.ts +8 -1
- package/dist/components/shell/TopBar.js +6 -5
- package/dist/components/shell/brandMark.d.ts +17 -0
- package/dist/components/shell/brandMark.js +9 -0
- package/dist/components/shell/index.d.ts +1 -0
- package/dist/components/shell/index.js +2 -0
- package/dist/foundations/copy.es.js +3 -3
- package/dist/foundations/copy.js +3 -3
- package/dist/foundations/variants.js +19 -2
- package/dist/primitives/block/Block.js +1 -1
- package/dist/primitives/button/Button.d.ts +3 -1
- package/dist/primitives/button/Button.js +6 -6
- package/dist/primitives/choice/SegmentedControl.d.ts +4 -1
- package/dist/primitives/choice/SegmentedControl.js +35 -7
- package/dist/primitives/dialog/Dialog.d.ts +1 -1
- package/dist/primitives/dialog/Dialog.js +2 -2
- package/dist/primitives/field/CardNumberInput.js +1 -1
- package/dist/primitives/field/Checks.d.ts +14 -0
- package/dist/primitives/field/Checks.js +12 -4
- package/dist/primitives/field/DurationInput.js +1 -1
- package/dist/primitives/field/Field.js +7 -7
- package/dist/primitives/field/PatternInput.js +1 -1
- package/dist/primitives/field/RichTextEditor.js +2 -2
- package/dist/primitives/field/SignatureInput.js +1 -1
- package/dist/primitives/field/aria.d.ts +2 -2
- package/dist/primitives/field/aria.js +5 -5
- package/dist/primitives/field/index.d.ts +1 -1
- package/dist/primitives/field/index.js +1 -1
- package/dist/primitives/menu/Menu.d.ts +23 -7
- package/dist/primitives/menu/Menu.js +76 -22
- package/dist/primitives/overlay/Popover.js +2 -2
- package/dist/primitives/picker/Picker.js +3 -3
- package/dist/primitives/picker/TagsField.js +1 -1
- package/dist/primitives/table/EditableTable.js +2 -2
- package/dist/primitives/table/ReportTable.js +1 -1
- package/dist/primitives/table/Table.js +2 -2
- package/dist/primitives/tag/Tag.d.ts +9 -0
- package/dist/primitives/tag/Tag.js +14 -1
- package/dist/primitives/tag/Tags.js +6 -7
- package/dist/primitives/value/Metric.js +4 -4
- package/dist/tokens.css +163 -36
- package/package.json +1 -1
|
@@ -819,9 +819,9 @@ groupTotal, height, layout = "auto", onOpen, onDiscard, bands, adds, flag, onReo
|
|
|
819
819
|
return (
|
|
820
820
|
/* A collection is many controls, each named by its column: no enclosing `Field`
|
|
821
821
|
reaches inside (see `FieldBoundary`). */
|
|
822
|
-
_jsx(FieldBoundary, { children: _jsxs("div", { ref: frame, className: "min-w-0", children: [_jsx("div", { ref: box.ref, tabIndex: box.tabIndex, className: `min-w-0 focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-primary ${box.className}`, style: box.style, children: stacked ? (list) : (_jsxs("table", { className: "w-full border-separate border-spacing-0 px-1 text-left", ...(view.on
|
|
822
|
+
_jsx(FieldBoundary, { children: _jsxs("div", { ref: frame, className: "min-w-0", children: [_jsx("div", { ref: box.ref, tabIndex: box.tabIndex, className: `min-w-0 focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-primary ${box.className}`, style: box.style, children: stacked ? (list) : (_jsxs("table", { "data-ui": "table", className: "w-full border-separate border-spacing-0 px-1 text-left", ...(view.on
|
|
823
823
|
? { "aria-rowcount": 1 + drawn.length + (totals === undefined ? 0 : 1) }
|
|
824
|
-
: {}), children: [_jsx("thead", { className: "sticky z-10 bg-
|
|
824
|
+
: {}), children: [_jsx("thead", { className: "sticky z-10 bg-ui-table-head", style: stickyTop, "data-ui": "table.head", children: _jsxs("tr", { ...(view.on ? { "aria-rowindex": 1 } : {}), children: [reorderable ? _jsx("td", { className: "w-0 border-b border-line-strong" }) : null, columns.map((c) => c.header === "" ? (_jsx("td", { className: "w-0 border-b border-line-strong" }, c.id)) : (_jsx("th", { scope: "col", style: c.width === undefined ? undefined : { width: c.width },
|
|
825
825
|
/* A column of figures takes its figures' width (`w-0` in an auto
|
|
826
826
|
table is «as narrow as its content») and the text takes the rest:
|
|
827
827
|
the product name was cut while «Cantidad» had room for ten digits. */
|
|
@@ -104,5 +104,5 @@ defaultOpen, caption, height, }) {
|
|
|
104
104
|
bar's offset and ended up pushed 68 px into its
|
|
105
105
|
own box — a blank band on top and column titles falling between
|
|
106
106
|
the rows. */
|
|
107
|
-
_jsx("div", { ref: caja.ref, tabIndex: caja.tabIndex, className: `min-w-0 focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-primary ${caja.className}`, style: caja.style, children: _jsxs("table", { className: "w-full border-collapse px-1", children: [caption === undefined ? null : (_jsx("caption", { className: `text-left text-meta text-muted ${byDensity(d, "px-3 pb-2", "px-2 pb-1.5")}`, children: caption })), _jsx("thead", { className: "sticky z-20 bg-
|
|
107
|
+
_jsx("div", { ref: caja.ref, tabIndex: caja.tabIndex, className: `min-w-0 focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-primary ${caja.className}`, style: caja.style, children: _jsxs("table", { "data-ui": "table", className: "w-full border-collapse px-1", children: [caption === undefined ? null : (_jsx("caption", { className: `text-left text-meta text-muted ${byDensity(d, "px-3 pb-2", "px-2 pb-1.5")}`, children: caption })), _jsx("thead", { className: "sticky z-20 bg-ui-table-head", style: stickyTop, "data-ui": "table.head", children: _jsxs("tr", { className: "border-b border-line-strong", children: [_jsx("th", { className: `sticky left-0 z-10 bg-ground text-left ${compact ? "px-2 py-1.5" : "px-3 py-2"}`, children: _jsx("span", { className: "sr-only", children: copy.report.concept }) }), columns.map((c) => (_jsx("th", { scope: "col", className: `text-right ${HEADER_TEXT} ${compact ? "px-2 py-1.5" : "px-3 py-2"}`, children: c.header }, c.id))), _jsx("td", { className: "w-0" })] }) }), _jsx("tbody", { children: rows.map((r) => (_jsx(ReportLine, { row: r, columns: columns, open: open, onToggle: toggle, compact: compact }, r.id))) })] }) }));
|
|
108
108
|
}
|
|
@@ -51,7 +51,7 @@ height, rowCount, }) {
|
|
|
51
51
|
`useScrollBox`: the whole dilemma lives there, and so does its explanation. The
|
|
52
52
|
three tables of the system solved it with three copies of the same
|
|
53
53
|
measurement. */
|
|
54
|
-
_jsx("div", { ref: caja.ref, tabIndex: caja.tabIndex, className: `min-w-0 focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-primary ${caja.className}`, style: caja.style, children: _jsx("table", { "aria-rowcount": rowCount, className: "w-full border-separate border-spacing-0 px-1 text-left", children: children }) }));
|
|
54
|
+
_jsx("div", { ref: caja.ref, tabIndex: caja.tabIndex, className: `min-w-0 focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-primary ${caja.className}`, style: caja.style, children: _jsx("table", { "data-ui": "table", "aria-rowcount": rowCount, className: "w-full border-separate border-spacing-0 px-1 text-left", children: children }) }));
|
|
55
55
|
}
|
|
56
56
|
/** The text of a column header, shared by every table of the family. Ink and semibold, not
|
|
57
57
|
* muted: in grey at the cells' weight the names of the columns read as one more row. */
|
|
@@ -62,7 +62,7 @@ export function THead({ children, rowIndex, }) {
|
|
|
62
62
|
list's— and not at `top: 0`, which tucked it behind both. Without a height on
|
|
63
63
|
`Table` the page is what scrolls, and there the difference is exactly
|
|
64
64
|
what made the column names disappear. See `system/sticky.tsx`. */
|
|
65
|
-
_jsx("thead", { className: "sticky z-10 bg-
|
|
65
|
+
_jsx("thead", { className: "sticky z-10 bg-ui-table-head", style: stickyTop, "data-ui": "table.head", children: _jsx("tr", { "aria-rowindex": rowIndex, children: children }) }));
|
|
66
66
|
}
|
|
67
67
|
/** A column. If it gets a `sortKey`, it can be sorted.
|
|
68
68
|
*
|
|
@@ -4,6 +4,15 @@ export type { Tone };
|
|
|
4
4
|
/** The classes of a tone on a surface — the capsule's colors, shared with the chips of
|
|
5
5
|
* `Tags` so a classification reads the same as a value and as a removable chip. */
|
|
6
6
|
export declare function tagTone(tone: Tone, surface: "canvas" | "chrome"): string;
|
|
7
|
+
/**
|
|
8
|
+
* The capsule of something SET: an applied filter, a grouping level, a chip of the draft.
|
|
9
|
+
*
|
|
10
|
+
* Context: a selection, so it wears the selection's family — the navy on the canvas, the
|
|
11
|
+
* link on the chrome — as the current row of a `NavigationTree` does. It was the gold, and a
|
|
12
|
+
* bar of six gold chips drowned the one action the gold is kept for (PRINCIPLES §3: «the
|
|
13
|
+
* accent only for the action»).
|
|
14
|
+
*/
|
|
15
|
+
export declare function chosenTone(surface: "canvas" | "chrome"): string;
|
|
7
16
|
export declare function Tag({ children, tone, surface,
|
|
8
17
|
/** Context: a one-word classification sometimes needs a sentence that does not
|
|
9
18
|
* fit. The sentence goes into the `title` and not underneath, because the
|
|
@@ -36,12 +36,25 @@ const TAG_TONE = {
|
|
|
36
36
|
export function tagTone(tone, surface) {
|
|
37
37
|
return TAG_TONE[tone][surface];
|
|
38
38
|
}
|
|
39
|
+
/**
|
|
40
|
+
* The capsule of something SET: an applied filter, a grouping level, a chip of the draft.
|
|
41
|
+
*
|
|
42
|
+
* Context: a selection, so it wears the selection's family — the navy on the canvas, the
|
|
43
|
+
* link on the chrome — as the current row of a `NavigationTree` does. It was the gold, and a
|
|
44
|
+
* bar of six gold chips drowned the one action the gold is kept for (PRINCIPLES §3: «the
|
|
45
|
+
* accent only for the action»).
|
|
46
|
+
*/
|
|
47
|
+
export function chosenTone(surface) {
|
|
48
|
+
return surface === "chrome"
|
|
49
|
+
? "border border-chrome-link/40 bg-chrome-link/20 text-chrome-ink"
|
|
50
|
+
: "border border-primary/30 bg-primary/8 text-ink";
|
|
51
|
+
}
|
|
39
52
|
export function Tag({ children, tone = "neutral", surface = "canvas",
|
|
40
53
|
/** Context: a one-word classification sometimes needs a sentence that does not
|
|
41
54
|
* fit. The sentence goes into the `title` and not underneath, because the
|
|
42
55
|
* line below is taken up by the row's metadata. */
|
|
43
56
|
title, }) {
|
|
44
|
-
return (_jsx("span", { title: title, className: `inline-flex shrink-0 items-center rounded-
|
|
57
|
+
return (_jsx("span", { title: title, "data-ui": "tag", "data-tone": tone, className: `inline-flex shrink-0 items-center rounded-ui-tag px-2 py-0.5 text-micro font-medium whitespace-nowrap ${TAG_TONE[tone][surface]}`, children: children }));
|
|
45
58
|
}
|
|
46
59
|
const DOT_TONE = {
|
|
47
60
|
neutral: { canvas: "bg-muted", chrome: "bg-chrome-muted" },
|
|
@@ -3,7 +3,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
3
3
|
import { AriaLocale } from "../../foundations/aria.js";
|
|
4
4
|
import { bySurface, useSurface } from "../../foundations/surface.js";
|
|
5
5
|
import { cn, focusRing } from "../../foundations/variants.js";
|
|
6
|
-
import { tagTone } from "./Tag.js";
|
|
6
|
+
import { chosenTone, tagTone } from "./Tag.js";
|
|
7
7
|
import { Avatar } from "../value/Person.js";
|
|
8
8
|
import { X } from "lucide-react";
|
|
9
9
|
import { Button as AriaButton, Tag as AriaTag, TagGroup, TagList, } from "react-aria-components";
|
|
@@ -21,7 +21,7 @@ const STACK = "flex min-w-0 flex-col items-stretch gap-0.5";
|
|
|
21
21
|
/** A strip nobody presses: text in a row, a list only when it is named. */
|
|
22
22
|
function StillStrip({ items, surface, label, stack, }) {
|
|
23
23
|
const listed = label !== undefined;
|
|
24
|
-
return (_jsx("span", { className: stack ? STACK : STRIP, ...(listed ? { role: "list", "aria-label": label } : {}), children: items.map((item) => (_jsx("span", { ...(listed ? { role: "listitem" } : {}), ...(item.title === undefined ? {} : { title: item.title }), className: shell({ item, surface, stack, removable: false, pressable: false }), children: _jsx(Inside, { item: item }) }, item.id))) }));
|
|
24
|
+
return (_jsx("span", { className: stack ? STACK : STRIP, ...(listed ? { role: "list", "aria-label": label } : {}), children: items.map((item) => (_jsx("span", { "data-ui": "tags.item", ...(listed ? { role: "listitem" } : {}), ...(item.title === undefined ? {} : { title: item.title }), className: shell({ item, surface, stack, removable: false, pressable: false }), children: _jsx(Inside, { item: item }) }, item.id))) }));
|
|
25
25
|
}
|
|
26
26
|
function ChipGroup({ items, surface, label, labelledBy, stack, multiple, }) {
|
|
27
27
|
const byId = new Map(items.map((item) => [item.id, item]));
|
|
@@ -65,7 +65,7 @@ function ChipGroup({ items, surface, label, labelledBy, stack, multiple, }) {
|
|
|
65
65
|
: {}),
|
|
66
66
|
/* Escape belongs to whatever holds the strip — the popover it lives in closes with it —
|
|
67
67
|
and not to «clear the selection», which would erase the choice without a word. */
|
|
68
|
-
escapeKeyBehavior: "none", className: "min-w-0", children: _jsx(TagList, { items: items, className: stack ? STACK : STRIP, children: (item) => (_jsxs(AriaTag, { id: item.id, textValue: item.note === undefined ? item.label : `${item.label} ${item.note}`, ...(!selecting && item.onSelect !== undefined
|
|
68
|
+
escapeKeyBehavior: "none", className: "min-w-0", children: _jsx(TagList, { items: items, className: stack ? STACK : STRIP, children: (item) => (_jsxs(AriaTag, { "data-ui": "tags.item", id: item.id, textValue: item.note === undefined ? item.label : `${item.label} ${item.note}`, ...(!selecting && item.onSelect !== undefined
|
|
69
69
|
? { onAction: item.onSelect }
|
|
70
70
|
: {}), ...(item.title === undefined ? {} : { title: item.title }), className: ({ isFocusVisible, isHovered }) => cn(shell({
|
|
71
71
|
item,
|
|
@@ -81,9 +81,8 @@ function paint(item, surface) {
|
|
|
81
81
|
if (item.active === true) {
|
|
82
82
|
return bySurface(surface, "border border-primary bg-primary text-surface", "border border-chrome-link bg-chrome-link text-chrome");
|
|
83
83
|
}
|
|
84
|
-
if (item.selected === true)
|
|
85
|
-
return
|
|
86
|
-
}
|
|
84
|
+
if (item.selected === true)
|
|
85
|
+
return chosenTone(surface);
|
|
87
86
|
if (item.tone !== undefined && item.tone !== "neutral")
|
|
88
87
|
return tagTone(item.tone, surface);
|
|
89
88
|
return bySurface(surface, "border border-line-strong bg-ink/5 text-ink", "border border-chrome-muted/30 bg-chrome-ink/12 text-chrome-ink");
|
|
@@ -92,7 +91,7 @@ function paint(item, surface) {
|
|
|
92
91
|
read as a list, it reads as a mess — and the blank on the right is what lets it be
|
|
93
92
|
pressed without aiming. */
|
|
94
93
|
function shell({ item, surface, stack, removable, pressable, }) {
|
|
95
|
-
return cn(stack ? "flex w-full justify-start" : "inline-flex shrink-0", "min-w-0 items-center gap-1 rounded-
|
|
94
|
+
return cn(stack ? "flex w-full justify-start" : "inline-flex shrink-0", "min-w-0 items-center gap-1 rounded-ui-tag py-0.5 text-micro transition-colors duration-(--duration-instant)", paint(item, surface), removable ? "pr-0.5 pl-2" : "px-2", pressable ? "cursor-pointer" : "cursor-default");
|
|
96
95
|
}
|
|
97
96
|
function Inside({ item }) {
|
|
98
97
|
const Icon = item.icon;
|
|
@@ -28,8 +28,8 @@ export function Metric({ value, label, tone = "neutral", icon: Icon, onClick, ac
|
|
|
28
28
|
there the color says which one is applied. */
|
|
29
29
|
const skin = active
|
|
30
30
|
? `${t.background} ${t.edge}`
|
|
31
|
-
: bySurface(sup, "bg-
|
|
32
|
-
const box = `flex min-w-(--container-metric) shrink-0 flex-col justify-center gap-0.5 rounded-
|
|
31
|
+
: bySurface(sup, "bg-ui-card border-ui-card-border", "bg-chrome-ink/6 border-chrome-ink/15");
|
|
32
|
+
const box = `flex min-w-(--container-metric) shrink-0 flex-col justify-center gap-0.5 rounded-ui-card border px-3.5 py-2 text-left transition-colors duration-(--duration-instant) ${skin} ${onClick === undefined
|
|
33
33
|
? ""
|
|
34
34
|
: "cursor-pointer hover:border-line-strong focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary"}`;
|
|
35
35
|
const figure = value === undefined
|
|
@@ -42,9 +42,9 @@ export function Metric({ value, label, tone = "neutral", icon: Icon, onClick, ac
|
|
|
42
42
|
be. It appears late, like every skeleton: a fast read never shows it. */
|
|
43
43
|
_jsx("span", { "aria-hidden": true, className: `inline-block h-lh w-16 animate-reveal-late rounded-control ${bySurface(sup, "bg-ink/8", "bg-chrome-ink/12")}` })) : (figure)] }), _jsx("span", { className: `text-micro ${bySurface(sup, "text-muted", "text-chrome-muted")}`, children: label }), change === undefined || loading ? null : (_jsx(Change, { change: change, format: percent.format }))] }));
|
|
44
44
|
if (onClick === undefined) {
|
|
45
|
-
return (_jsx("div", { className: box, "aria-label": loading ? `${label}: ${copy.failed.loading}` : `${figure} ${label}`, ...(loading ? { "aria-busy": true } : {}), children: content }));
|
|
45
|
+
return (_jsx("div", { "data-ui": "metric", className: box, "aria-label": loading ? `${label}: ${copy.failed.loading}` : `${figure} ${label}`, ...(loading ? { "aria-busy": true } : {}), children: content }));
|
|
46
46
|
}
|
|
47
|
-
return (_jsxs("button", { type: "button", onClick: onClick, "aria-pressed": active, ...(loading ? { "aria-busy": true } : {}), className: box, children: [content, loading ? _jsx("span", { className: "sr-only", children: copy.failed.loading }) : null] }));
|
|
47
|
+
return (_jsxs("button", { type: "button", onClick: onClick, "aria-pressed": active, ...(loading ? { "aria-busy": true } : {}), "data-ui": "metric", className: box, children: [content, loading ? _jsx("span", { className: "sr-only", children: copy.failed.loading }) : null] }));
|
|
48
48
|
}
|
|
49
49
|
function Change({ change, format, }) {
|
|
50
50
|
const copy = useUiCopy();
|
package/dist/tokens.css
CHANGED
|
@@ -56,26 +56,29 @@
|
|
|
56
56
|
/* WARM white, not pure white: #FFFFFF on a full screen tires the eye and
|
|
57
57
|
cheapens the piece. It is called `ground` and not `base` because
|
|
58
58
|
`text-base` is already a Tailwind font size and the name would clash. */
|
|
59
|
-
--color-ground: #faf9f7;
|
|
59
|
+
--color-ground: var(--brand-ground, #faf9f7);
|
|
60
60
|
|
|
61
61
|
/* The raised surface IS white — that is what separates it from the ground.
|
|
62
62
|
Elevation here is done with a hairline border, not with a shadow: a shadow
|
|
63
63
|
on a light background is dirty grey. */
|
|
64
|
-
--color-surface: #ffffff;
|
|
64
|
+
--color-surface: var(--brand-surface, #ffffff);
|
|
65
65
|
|
|
66
66
|
/* The two hairlines. WARM grey — a neutral grey against a warm ground looks
|
|
67
67
|
bluish. They are not text: 1.26:1 and 1.49:1 on the ground, which is
|
|
68
68
|
exactly what a line that separates without shouting should measure. */
|
|
69
|
-
--color-line: #e4dfd7; /* 1.26:1 — common separator */
|
|
70
|
-
--color-line-strong:
|
|
69
|
+
--color-line: var(--brand-line, #e4dfd7); /* 1.26:1 — common separator */
|
|
70
|
+
--color-line-strong: var(
|
|
71
|
+
--brand-line-strong,
|
|
72
|
+
#d5cec2
|
|
73
|
+
); /* 1.49:1 — border of a box, table header */
|
|
71
74
|
|
|
72
75
|
/* Text: warm near-black. 16.96:1 on the ground, 17.85:1 on white. */
|
|
73
|
-
--color-ink: #1a1714;
|
|
76
|
+
--color-ink: var(--brand-ink, #1a1714);
|
|
74
77
|
|
|
75
78
|
/* Faint text — labels, metadata, units. 5.56:1 on the ground and 5.85:1 on
|
|
76
79
|
white: it passes AA for small text, which is exactly where it is used. The
|
|
77
80
|
#8A8178 from the dark theme gave 3.63:1 here and was discarded. */
|
|
78
|
-
--color-muted: #6b6459;
|
|
81
|
+
--color-muted: var(--brand-muted, #6b6459);
|
|
79
82
|
|
|
80
83
|
/* ---------------------------------------------------------------- *
|
|
81
84
|
* THE GOLD — and the rule that governs it on light.
|
|
@@ -352,23 +355,35 @@
|
|
|
352
355
|
* radius scale read as intentional:
|
|
353
356
|
* mark — a glyph-sized box. At 8px a 16px checkbox is already a circle
|
|
354
357
|
* control — what you touch and what measures one line of text
|
|
355
|
-
* box — a content box, a panel, a band
|
|
356
|
-
*
|
|
358
|
+
* box — a content box, a panel, a band — and what DROPS from a
|
|
359
|
+
* control: a menu, a list, the cuts panel
|
|
360
|
+
* panel — a window: a dialog, a notice, the workspace's frames
|
|
357
361
|
* pill — what is round because it is a capsule, not a box
|
|
358
362
|
*
|
|
359
363
|
* **The measured step.** 6/10/14 still read as the dense console. The median
|
|
360
364
|
* control across measured production systems is 8px, and the button shares
|
|
361
365
|
* it with the field: surveyed systems match those three (button, input,
|
|
362
366
|
* select) instead of rounding the button alone. The surface still grows.
|
|
363
|
-
* 12 is the next published peak and the modal step; 16 is
|
|
367
|
+
* 12 is the next published peak and the modal step; 16 is a window.
|
|
364
368
|
* The pill stays a capsule — a tag, a switch, an icon-only target — and
|
|
365
369
|
* is not a labeled button.
|
|
370
|
+
*
|
|
371
|
+
* **A dropdown is concentric with its rows.** A menu wraps 8px rows in
|
|
372
|
+
* 4px of padding, so its corner is 8 + 4 = 12. At 16 the outer curve ran
|
|
373
|
+
* away from the rows' and a 220px menu read as a balloon — «muy redondo»,
|
|
374
|
+
* said of the bar's menus, and measured: 16 outside, 8 inside, 4 between.
|
|
375
|
+
*
|
|
376
|
+
* **A brand turns ONE knob.** `--brand-radius` multiplies the whole scale,
|
|
377
|
+
* so the steps keep their proportion — and the dropdowns stay concentric:
|
|
378
|
+
* `0` is square everywhere (the pill too: «todo recto» means all of it),
|
|
379
|
+
* `1` is this scale, `1.5` rounder. A single step can still be set on its
|
|
380
|
+
* own (`--brand-radius-control: 6px`). Set on `:root`, like the colours.
|
|
366
381
|
* ------------------------------------------------------------------- */
|
|
367
|
-
--radius-mark: 4px;
|
|
368
|
-
--radius-control: 8px;
|
|
369
|
-
--radius-box: 12px;
|
|
370
|
-
--radius-panel: 16px;
|
|
371
|
-
--radius-pill: 9999px;
|
|
382
|
+
--radius-mark: var(--brand-radius-mark, calc(4px * var(--brand-radius, 1)));
|
|
383
|
+
--radius-control: var(--brand-radius-control, calc(8px * var(--brand-radius, 1)));
|
|
384
|
+
--radius-box: var(--brand-radius-box, calc(12px * var(--brand-radius, 1)));
|
|
385
|
+
--radius-panel: var(--brand-radius-panel, calc(16px * var(--brand-radius, 1)));
|
|
386
|
+
--radius-pill: var(--brand-radius-pill, calc(9999px * var(--brand-radius, 1)));
|
|
372
387
|
|
|
373
388
|
/* ---------------------------------------------------------------- *
|
|
374
389
|
* ELEVATION
|
|
@@ -703,6 +718,90 @@
|
|
|
703
718
|
--animate-reveal-late: reveal var(--duration-quick) var(--ease-out) 200ms both;
|
|
704
719
|
}
|
|
705
720
|
|
|
721
|
+
/* ==================================================================== *
|
|
722
|
+
* COMPONENT TOKENS — a component's look, open without forking it.
|
|
723
|
+
*
|
|
724
|
+
* The system tokens above decide the whole product. A product sometimes
|
|
725
|
+
* wants ONE piece different — square buttons for a till, a cooler menu, the
|
|
726
|
+
* cards without a border — and before this it had no way but to write its
|
|
727
|
+
* own component. Now each of the most-used components reads its look from
|
|
728
|
+
* a `--ui-<component>-<property>` variable first, and falls back to the
|
|
729
|
+
* system's token:
|
|
730
|
+
*
|
|
731
|
+
* :root {
|
|
732
|
+
* --ui-button-radius: 0; every button, square
|
|
733
|
+
* --ui-popover-bg: #f7f8fa; every menu and dropdown
|
|
734
|
+
* }
|
|
735
|
+
* .till {
|
|
736
|
+
* --ui-control-radius: 0; only inside this zone
|
|
737
|
+
* }
|
|
738
|
+
*
|
|
739
|
+
* `@theme inline` and not `@theme`: Tailwind writes the WHOLE chain into the
|
|
740
|
+
* utility (`border-radius: var(--ui-button-radius, var(--radius-control))`),
|
|
741
|
+
* so it resolves on the element itself. Declared on `:root`, the fallback
|
|
742
|
+
* would freeze the light palette there, and a dark subtree would inherit it.
|
|
743
|
+
* Set nothing and every piece looks exactly as it did.
|
|
744
|
+
*
|
|
745
|
+
* What a token does not cover, a PART does: every customizable piece carries
|
|
746
|
+
* `data-ui="<component>"` on its root and `data-ui="<component>.<part>"` on
|
|
747
|
+
* its parts, plus its variant (`data-role`, `data-size`, `data-surface`) —
|
|
748
|
+
* the stable names an application's CSS selects, instead of a class that
|
|
749
|
+
* changes with the next refactor. The list is in the README («Customizing a
|
|
750
|
+
* component») and `tests/componentTokens.test.tsx` holds both.
|
|
751
|
+
* ==================================================================== */
|
|
752
|
+
@theme inline {
|
|
753
|
+
/* Button and IconButton. */
|
|
754
|
+
--radius-ui-button: var(--ui-button-radius, var(--radius-control));
|
|
755
|
+
--radius-ui-icon-button: var(--ui-icon-button-radius, var(--radius-pill));
|
|
756
|
+
|
|
757
|
+
/* What is written into or chosen from: inputs, selects, pickers. */
|
|
758
|
+
--radius-ui-control: var(--ui-control-radius, var(--radius-control));
|
|
759
|
+
--color-ui-control: var(--ui-control-bg, var(--color-surface));
|
|
760
|
+
--color-ui-control-border: var(--ui-control-border, var(--color-line-strong));
|
|
761
|
+
|
|
762
|
+
/* Everything that drops from a control: menus, lists, the cuts panel, a popover. */
|
|
763
|
+
--radius-ui-popover: var(--ui-popover-radius, var(--radius-box));
|
|
764
|
+
--color-ui-popover: var(--ui-popover-bg, var(--color-surface));
|
|
765
|
+
--color-ui-popover-border: var(--ui-popover-border, var(--color-line-strong));
|
|
766
|
+
--shadow-ui-popover: var(--ui-popover-shadow, var(--shadow-float));
|
|
767
|
+
|
|
768
|
+
/* A row inside one of them: a menu item, an option. */
|
|
769
|
+
--radius-ui-option: var(--ui-option-radius, var(--radius-control));
|
|
770
|
+
--color-ui-option-active: var(
|
|
771
|
+
--ui-option-active-bg,
|
|
772
|
+
color-mix(in srgb, var(--color-primary) 8%, transparent)
|
|
773
|
+
);
|
|
774
|
+
|
|
775
|
+
/* A window: a dialog, a confirmation. */
|
|
776
|
+
--radius-ui-dialog: var(--ui-dialog-radius, var(--radius-panel));
|
|
777
|
+
--color-ui-dialog: var(--ui-dialog-bg, var(--color-surface));
|
|
778
|
+
|
|
779
|
+
/* A box of content: a block, a card of a list, a board tile, a metric. */
|
|
780
|
+
--radius-ui-card: var(--ui-card-radius, var(--radius-box));
|
|
781
|
+
--color-ui-card: var(--ui-card-bg, var(--color-surface));
|
|
782
|
+
--color-ui-card-border: var(--ui-card-border, var(--color-line));
|
|
783
|
+
|
|
784
|
+
/* A capsule: a tag, a chip of the search bar. */
|
|
785
|
+
--radius-ui-tag: var(--ui-tag-radius, var(--radius-pill));
|
|
786
|
+
|
|
787
|
+
/* The search bar's field. */
|
|
788
|
+
--radius-ui-search: var(--ui-search-radius, var(--radius-box));
|
|
789
|
+
|
|
790
|
+
/* The sidebar on the canvas (on the chrome it is the brand's `--brand-chrome`). */
|
|
791
|
+
--color-ui-sidebar: var(--ui-sidebar-bg, var(--color-ground));
|
|
792
|
+
--color-ui-sidebar-border: var(--ui-sidebar-border, var(--color-line));
|
|
793
|
+
|
|
794
|
+
/* A row of the navigation tree, and the one you are on. */
|
|
795
|
+
--radius-ui-nav: var(--ui-nav-radius, var(--radius-control));
|
|
796
|
+
--color-ui-nav-current: var(
|
|
797
|
+
--ui-nav-current-bg,
|
|
798
|
+
color-mix(in srgb, var(--color-primary) 10%, transparent)
|
|
799
|
+
);
|
|
800
|
+
|
|
801
|
+
/* A table's header band. */
|
|
802
|
+
--color-ui-table-head: var(--ui-table-head-bg, var(--color-ground));
|
|
803
|
+
}
|
|
804
|
+
|
|
706
805
|
@keyframes reveal {
|
|
707
806
|
from {
|
|
708
807
|
opacity: 0;
|
|
@@ -754,16 +853,23 @@
|
|
|
754
853
|
*
|
|
755
854
|
* ── A BRAND: set it once, every theme follows ───────────────────────
|
|
756
855
|
*
|
|
757
|
-
* The colours a brand owns — the
|
|
758
|
-
*
|
|
759
|
-
*
|
|
760
|
-
*
|
|
856
|
+
* The colours a brand owns — the canvas (`ground`, `surface`, `line`,
|
|
857
|
+
* `line-strong`, `ink`, `muted`), the action (`accent`, `accent-hover`,
|
|
858
|
+
* `on-accent`), the link and current place (`primary`, `primary-hover`), and the
|
|
859
|
+
* bar (`chrome`, `chrome-raised`, `chrome-edge`, `chrome-accent`, `chrome-link`)
|
|
860
|
+
* — read a `--brand-*` variable first, and fall back to the system's value:
|
|
761
861
|
*
|
|
762
862
|
* :root {
|
|
763
863
|
* --brand-accent: #d4a73a; --brand-dark-accent: #e0b850;
|
|
764
864
|
* --brand-chrome: #10203f; --brand-dark-chrome: #0a1428;
|
|
865
|
+
* --brand-ground: #f7f8fa; --brand-dark-ground: #121417;
|
|
866
|
+
* --brand-radius: 0.5; (the corners: 0 square · 1 · 1.5 rounder)
|
|
765
867
|
* }
|
|
766
868
|
*
|
|
869
|
+
* The canvas is brandable because a product's paper is part of its look — a
|
|
870
|
+
* cool white, a warmer grey. Before, a brand overrode `--color-ink` and
|
|
871
|
+
* `--color-line` directly, and lost them in the dark theme.
|
|
872
|
+
*
|
|
767
873
|
* `--brand-<token>` is the light palette's, `--brand-dark-<token>` the dark's.
|
|
768
874
|
* Set on `:root`, a variable is INHERITED by every subtree — so the four blocks
|
|
769
875
|
* that define a palette (`@theme`, the media query, `[data-theme="dark"]` and
|
|
@@ -782,12 +888,21 @@
|
|
|
782
888
|
@media (prefers-color-scheme: dark) {
|
|
783
889
|
:root:not([data-theme="light"]) {
|
|
784
890
|
color-scheme: dark;
|
|
785
|
-
--color-ground:
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
--color-
|
|
790
|
-
|
|
891
|
+
--color-ground: var(
|
|
892
|
+
--brand-dark-ground,
|
|
893
|
+
#181614
|
|
894
|
+
); /* the canvas: warm near-black, not #000 */
|
|
895
|
+
--color-surface: var(
|
|
896
|
+
--brand-dark-surface,
|
|
897
|
+
#221f1c
|
|
898
|
+
); /* 1.10:1 above the ground — in the dark, raised is LIGHTER */
|
|
899
|
+
--color-line: var(--brand-dark-line, #302c28); /* 1.30:1 — common separator */
|
|
900
|
+
--color-line-strong: var(
|
|
901
|
+
--brand-dark-line-strong,
|
|
902
|
+
#443f38
|
|
903
|
+
); /* 1.73:1 — border of a box, table header */
|
|
904
|
+
--color-ink: var(--brand-dark-ink, #ece8e1); /* 14.78:1 */
|
|
905
|
+
--color-muted: var(--brand-dark-muted, #a39b90); /* 6.57:1 */
|
|
791
906
|
--color-accent: var(
|
|
792
907
|
--brand-dark-accent,
|
|
793
908
|
#c89b3c
|
|
@@ -847,12 +962,21 @@
|
|
|
847
962
|
|
|
848
963
|
[data-theme="dark"] {
|
|
849
964
|
color-scheme: dark;
|
|
850
|
-
--color-ground:
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
--color-
|
|
855
|
-
|
|
965
|
+
--color-ground: var(
|
|
966
|
+
--brand-dark-ground,
|
|
967
|
+
#181614
|
|
968
|
+
); /* the canvas: warm near-black, not #000 */
|
|
969
|
+
--color-surface: var(
|
|
970
|
+
--brand-dark-surface,
|
|
971
|
+
#221f1c
|
|
972
|
+
); /* 1.10:1 above the ground — in the dark, raised is LIGHTER */
|
|
973
|
+
--color-line: var(--brand-dark-line, #302c28); /* 1.30:1 — common separator */
|
|
974
|
+
--color-line-strong: var(
|
|
975
|
+
--brand-dark-line-strong,
|
|
976
|
+
#443f38
|
|
977
|
+
); /* 1.73:1 — border of a box, table header */
|
|
978
|
+
--color-ink: var(--brand-dark-ink, #ece8e1); /* 14.78:1 */
|
|
979
|
+
--color-muted: var(--brand-dark-muted, #a39b90); /* 6.57:1 */
|
|
856
980
|
--color-accent: var(
|
|
857
981
|
--brand-dark-accent,
|
|
858
982
|
#c89b3c
|
|
@@ -911,12 +1035,15 @@
|
|
|
911
1035
|
`tests/tokens.test.ts` keeps it equal to `@theme`. */
|
|
912
1036
|
[data-theme="light"] {
|
|
913
1037
|
color-scheme: light;
|
|
914
|
-
--color-ground: #faf9f7;
|
|
915
|
-
--color-surface: #ffffff;
|
|
916
|
-
--color-line: #e4dfd7; /* 1.26:1 — common separator */
|
|
917
|
-
--color-line-strong:
|
|
918
|
-
|
|
919
|
-
|
|
1038
|
+
--color-ground: var(--brand-ground, #faf9f7);
|
|
1039
|
+
--color-surface: var(--brand-surface, #ffffff);
|
|
1040
|
+
--color-line: var(--brand-line, #e4dfd7); /* 1.26:1 — common separator */
|
|
1041
|
+
--color-line-strong: var(
|
|
1042
|
+
--brand-line-strong,
|
|
1043
|
+
#d5cec2
|
|
1044
|
+
); /* 1.49:1 — border of a box, table header */
|
|
1045
|
+
--color-ink: var(--brand-ink, #1a1714);
|
|
1046
|
+
--color-muted: var(--brand-muted, #6b6459);
|
|
920
1047
|
--color-accent: var(--brand-accent, #c89b3c); /* 2.43:1 on the ground → NEVER text */
|
|
921
1048
|
--color-accent-hover: var(
|
|
922
1049
|
--brand-accent-hover,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sincpro/web-ui",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.0",
|
|
4
4
|
"description": "An enterprise web design system for business software — ERPs, back offices, management tools — in React and Tailwind: tokens, primitives, components and the two views every management screen is made of.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|