@newtone-dev/ui-react-web 0.2.0 → 0.6.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 +41 -15
- package/dist/accordion/accordion.css +5 -3
- package/dist/action/action.css +64 -5
- package/dist/action/action.d.ts +22 -1
- package/dist/action/action.d.ts.map +1 -1
- package/dist/action/action.js +16 -2
- package/dist/action/action.js.map +1 -1
- package/dist/bar-list/bar-list.css +95 -0
- package/dist/bar-list/bar-list.d.ts +28 -0
- package/dist/bar-list/bar-list.d.ts.map +1 -0
- package/dist/bar-list/bar-list.js +9 -0
- package/dist/bar-list/bar-list.js.map +1 -0
- package/dist/bar-list/index.d.ts +4 -0
- package/dist/bar-list/index.d.ts.map +1 -0
- package/dist/bar-list/index.js +3 -0
- package/dist/bar-list/index.js.map +1 -0
- package/dist/button/button.css +81 -5
- package/dist/button/button.d.ts +24 -1
- package/dist/button/button.d.ts.map +1 -1
- package/dist/button/button.js +12 -2
- package/dist/button/button.js.map +1 -1
- package/dist/chart-key/chart-key.css +33 -0
- package/dist/chart-key/chart-key.d.ts +15 -0
- package/dist/chart-key/chart-key.d.ts.map +1 -0
- package/dist/chart-key/chart-key.js +6 -0
- package/dist/chart-key/chart-key.js.map +1 -0
- package/dist/chart-key/index.d.ts +4 -0
- package/dist/chart-key/index.d.ts.map +1 -0
- package/dist/chart-key/index.js +3 -0
- package/dist/chart-key/index.js.map +1 -0
- package/dist/color/seeds.d.ts +7 -0
- package/dist/color/seeds.d.ts.map +1 -1
- package/dist/color/seeds.js +21 -0
- package/dist/color/seeds.js.map +1 -1
- package/dist/column-chart/column-chart.css +89 -0
- package/dist/column-chart/column-chart.d.ts +30 -0
- package/dist/column-chart/column-chart.d.ts.map +1 -0
- package/dist/column-chart/column-chart.js +11 -0
- package/dist/column-chart/column-chart.js.map +1 -0
- package/dist/column-chart/index.d.ts +4 -0
- package/dist/column-chart/index.d.ts.map +1 -0
- package/dist/column-chart/index.js +3 -0
- package/dist/column-chart/index.js.map +1 -0
- package/dist/control/control.css +49 -23
- package/dist/control/control.d.ts +33 -9
- package/dist/control/control.d.ts.map +1 -1
- package/dist/control/control.js +31 -17
- package/dist/control/control.js.map +1 -1
- package/dist/count-up/count-up.css +8 -0
- package/dist/count-up/count-up.d.ts +30 -0
- package/dist/count-up/count-up.d.ts.map +1 -0
- package/dist/count-up/count-up.js +92 -0
- package/dist/count-up/count-up.js.map +1 -0
- package/dist/count-up/index.d.ts +4 -0
- package/dist/count-up/index.d.ts.map +1 -0
- package/dist/count-up/index.js +3 -0
- package/dist/count-up/index.js.map +1 -0
- package/dist/figure/figure.css +11 -0
- package/dist/figure/figure.d.ts +17 -0
- package/dist/figure/figure.d.ts.map +1 -0
- package/dist/figure/figure.js +7 -0
- package/dist/figure/figure.js.map +1 -0
- package/dist/figure/index.d.ts +4 -0
- package/dist/figure/index.d.ts.map +1 -0
- package/dist/figure/index.js +3 -0
- package/dist/figure/index.js.map +1 -0
- package/dist/index.d.ts +15 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -1
- package/dist/navbar/link/drawer/drawer.css +4 -3
- package/dist/navbar/link/link.css +15 -3
- package/dist/navbar/menu-button/menu-button.css +10 -3
- package/dist/navbar/navbar.css +186 -4
- package/dist/navbar/navbar.d.ts +33 -1
- package/dist/navbar/navbar.d.ts.map +1 -1
- package/dist/navbar/navbar.js +4 -2
- package/dist/navbar/navbar.js.map +1 -1
- package/dist/page/band.d.ts +52 -0
- package/dist/page/band.d.ts.map +1 -0
- package/dist/page/band.js +36 -0
- package/dist/page/band.js.map +1 -0
- package/dist/page/index.d.ts +4 -0
- package/dist/page/index.d.ts.map +1 -0
- package/dist/page/index.js +8 -0
- package/dist/page/index.js.map +1 -0
- package/dist/page/page.css +240 -0
- package/dist/page/page.d.ts +137 -0
- package/dist/page/page.d.ts.map +1 -0
- package/dist/page/page.js +29 -0
- package/dist/page/page.js.map +1 -0
- package/dist/quick-action/quick-action.css +36 -7
- package/dist/quick-action/quick-action.d.ts +26 -6
- package/dist/quick-action/quick-action.d.ts.map +1 -1
- package/dist/quick-action/quick-action.js +11 -7
- package/dist/quick-action/quick-action.js.map +1 -1
- package/dist/segmented-control/segmented-control.css +2 -2
- package/dist/split-bar/index.d.ts +4 -0
- package/dist/split-bar/index.d.ts.map +1 -0
- package/dist/split-bar/index.js +3 -0
- package/dist/split-bar/index.js.map +1 -0
- package/dist/split-bar/split-bar.css +86 -0
- package/dist/split-bar/split-bar.d.ts +27 -0
- package/dist/split-bar/split-bar.d.ts.map +1 -0
- package/dist/split-bar/split-bar.js +7 -0
- package/dist/split-bar/split-bar.js.map +1 -0
- package/dist/text/text.css +69 -0
- package/dist/text/text.d.ts +6 -4
- package/dist/text/text.d.ts.map +1 -1
- package/dist/text/text.js.map +1 -1
- package/dist/wrapper/wrapper.d.ts +11 -2
- package/dist/wrapper/wrapper.d.ts.map +1 -1
- package/dist/wrapper/wrapper.js +5 -1
- package/dist/wrapper/wrapper.js.map +1 -1
- package/package.json +36 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button.js","sourceRoot":"","sources":["../../src/button/button.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"button.js","sourceRoot":"","sources":["../../src/button/button.tsx"],"names":[],"mappings":";AAyDA;;;;;;;GAOG;AACH,MAAM,UAAU,MAAM,CAAC,EACnB,OAAO,GAAG,SAAS,EACnB,IAAI,GAAG,IAAI,EACX,QAAQ,EACR,SAAS,EACT,GAAG,IAAI,EACG;IACV,8FAA8F;IAC9F,4FAA4F;IAC5F,EAAE;IACF,gGAAgG;IAChG,6FAA6F;IAC7F,8FAA8F;IAC9F,0DAA0D;IAC1D,MAAM,OAAO,GAAG;QACZ,gBAAgB;QAChB,mBAAmB,OAAO,EAAE;QAC5B,mBAAmB,IAAI,EAAE;QACzB,SAAS;KACZ;SACI,MAAM,CAAC,OAAO,CAAC;SACf,IAAI,CAAC,GAAG,CAAC,CAAA;IAEd,IAAI,IAAI,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;QAC1B,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,EAAE,GAAG,IAG3B,CAAA;QACD,OAAO,CACH,YAAG,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,KAAM,MAAM,YACxC,QAAQ,GACT,CACP,CAAA;IACL,CAAC;IAED,+FAA+F;IAC/F,0FAA0F;IAC1F,OAAO,CACH,iBACI,IAAI,EAAC,QAAQ,EACb,SAAS,EAAE,OAAO,KACb,IAAgD,YAEpD,QAAQ,GACJ,CACZ,CAAA;AACL,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/* ChartKey -- blueprint components/chart-key.md. */
|
|
2
|
+
|
|
3
|
+
.newtone-chart-key {
|
|
4
|
+
display: flex;
|
|
5
|
+
flex-wrap: wrap;
|
|
6
|
+
gap: var(--newtone-space-2) var(--newtone-space-6);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.newtone-chart-key-item {
|
|
10
|
+
display: flex;
|
|
11
|
+
align-items: center;
|
|
12
|
+
gap: var(--newtone-space-2);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.newtone-chart-key-swatch {
|
|
16
|
+
flex: none;
|
|
17
|
+
width: 0.875rem;
|
|
18
|
+
height: 0.875rem;
|
|
19
|
+
border-radius: var(--newtone-chart-radius);
|
|
20
|
+
background: var(--newtone-chart-mark);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.newtone-chart-key-swatch[data-tone='muted'] {
|
|
24
|
+
background: var(--newtone-chart-mark-muted);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.newtone-chart-key-swatch[data-tone='off'] {
|
|
28
|
+
background: var(--newtone-chart-mark-off);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.newtone-chart-key-label {
|
|
32
|
+
color: var(--newtone-chart-label);
|
|
33
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* The legend for a chart whose colours mean something it cannot label in place. From 0.6.0,
|
|
4
|
+
* 2026-09-25. Blueprint components/chart-key.md. A separate part on purpose: where a reader finds the
|
|
5
|
+
* key belongs to the page.
|
|
6
|
+
*/
|
|
7
|
+
export interface ChartKeyItem {
|
|
8
|
+
label: ReactNode;
|
|
9
|
+
tone: 'mark' | 'muted' | 'off';
|
|
10
|
+
}
|
|
11
|
+
export interface ChartKeyProps extends HTMLAttributes<HTMLDivElement> {
|
|
12
|
+
items: ChartKeyItem[];
|
|
13
|
+
}
|
|
14
|
+
export declare function ChartKey({ items, className, ...rest }: ChartKeyProps): import("react").JSX.Element;
|
|
15
|
+
//# sourceMappingURL=chart-key.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chart-key.d.ts","sourceRoot":"","sources":["../../src/chart-key/chart-key.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAGtD;;;;GAIG;AACH,MAAM,WAAW,YAAY;IACzB,KAAK,EAAE,SAAS,CAAA;IAChB,IAAI,EAAE,MAAM,GAAG,OAAO,GAAG,KAAK,CAAA;CACjC;AAED,MAAM,WAAW,aAAc,SAAQ,cAAc,CAAC,cAAc,CAAC;IACjE,KAAK,EAAE,YAAY,EAAE,CAAA;CACxB;AAED,wBAAgB,QAAQ,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,IAAI,EAAE,EAAE,aAAa,+BAoBpE"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Text } from '../text/index.js';
|
|
3
|
+
export function ChartKey({ items, className, ...rest }) {
|
|
4
|
+
return (_jsx("div", { className: className ? `newtone-chart-key ${className}` : 'newtone-chart-key', ...rest, children: items.map((item, i) => (_jsxs("div", { className: "newtone-chart-key-item", children: [_jsx("span", { className: "newtone-chart-key-swatch", "data-tone": item.tone, "aria-hidden": "true" }), _jsx(Text, { as: "span", scale: "body-sm", className: "newtone-chart-key-label", children: item.label })] }, i))) }));
|
|
5
|
+
}
|
|
6
|
+
//# sourceMappingURL=chart-key.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chart-key.js","sourceRoot":"","sources":["../../src/chart-key/chart-key.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAA;AAgBvC,MAAM,UAAU,QAAQ,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,IAAI,EAAiB;IACjE,OAAO,CACH,cACI,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC,qBAAqB,SAAS,EAAE,CAAC,CAAC,CAAC,mBAAmB,KACzE,IAAI,YAEP,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC,CACpB,eAAa,SAAS,EAAC,wBAAwB,aAC3C,eACI,SAAS,EAAC,0BAA0B,eACzB,IAAI,CAAC,IAAI,iBACR,MAAM,GACpB,EACF,KAAC,IAAI,IAAC,EAAE,EAAC,MAAM,EAAC,KAAK,EAAC,SAAS,EAAC,SAAS,EAAC,yBAAyB,YAC9D,IAAI,CAAC,KAAK,GACR,KARD,CAAC,CASL,CACT,CAAC,GACA,CACT,CAAA;AACL,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/chart-key/index.ts"],"names":[],"mappings":"AAAA,mDAAmD;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACzC,YAAY,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/chart-key/index.ts"],"names":[],"mappings":"AAAA,mDAAmD;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA"}
|
package/dist/color/seeds.d.ts
CHANGED
|
@@ -8,6 +8,13 @@
|
|
|
8
8
|
* There is no lightness, because lightness is a property of the job a colour is doing and
|
|
9
9
|
* the job is not known until a role asks for it. There is no `key` either: a key selects
|
|
10
10
|
* which step a role reads, and roles are references resolved at build time.
|
|
11
|
+
*
|
|
12
|
+
* **`h` and `c` are both narrower than `number`, and the narrowing is not here.** contracts/seeds.md
|
|
13
|
+
* section 1.1: a hue is a whole number of degrees and a saturation carries at most two decimal
|
|
14
|
+
* places. TypeScript cannot say either of those about a `number`, and anything it could say would
|
|
15
|
+
* be erased the moment a seed arrives through `JSON.parse` or an identity API -- which is how every
|
|
16
|
+
* seed in this house arrives. **So `validateSeeds` below is the type**, and asked to "fix the type"
|
|
17
|
+
* this is the honest answer: the interface names the fields, the validator names the values.
|
|
11
18
|
*/
|
|
12
19
|
export interface Seed {
|
|
13
20
|
h: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"seeds.d.ts","sourceRoot":"","sources":["../../src/color/seeds.ts"],"names":[],"mappings":"AAcA
|
|
1
|
+
{"version":3,"file":"seeds.d.ts","sourceRoot":"","sources":["../../src/color/seeds.ts"],"names":[],"mappings":"AAcA;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,WAAW,IAAI;IACjB,CAAC,EAAE,MAAM,CAAA;IACT,CAAC,EAAE,MAAM,CAAA;CACZ;AAED,MAAM,MAAM,SAAS,GAAG,QAAQ,GAAG,QAAQ,CAAA;AAE3C,mFAAmF;AACnF,MAAM,MAAM,KAAK,GAAG,OAAO,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC,CAAA;AA+FpE;;;;;;;;;;;GAWG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,EAAE,CA0CpD;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,UAAiB,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAuB1F"}
|
package/dist/color/seeds.js
CHANGED
|
@@ -80,6 +80,18 @@ const inRange = (v, [lo, hi]) => typeof v === 'number' && v >= lo && v <= hi;
|
|
|
80
80
|
// Echoed as the person typed it. Re-rendering someone's input in a different shape makes a
|
|
81
81
|
// message harder to match against the file it came from -- 0.21, never 0.2100.
|
|
82
82
|
const fmt = (v) => (typeof v === 'number' ? String(v) : JSON.stringify(v));
|
|
83
|
+
// contracts/seeds.md section 1.1. A hue is a whole number of degrees; a saturation carries at most
|
|
84
|
+
// two decimal places. Refusals rather than roundings, here for the same reason as in the build: a
|
|
85
|
+
// value nothing can render is a value somebody typed by mistake, and silently fixing it hides the
|
|
86
|
+
// mistake. One JND in OKLab is about 0.002; one degree of hue buys at most 0.0044 of difference and
|
|
87
|
+
// one 0.01 step of c between 0.0013 and 0.0031.
|
|
88
|
+
//
|
|
89
|
+
// THE SATURATION PREDICATE IS `c === Number(c.toFixed(2))`, NOT `Math.round(c * 100) === c * 100`.
|
|
90
|
+
// The second is wrong and rejects 0.14, because `0.14 * 100` is `14.000000000000002` -- along with
|
|
91
|
+
// 0.07, 0.29, 0.57 and 0.58. Both implementations carry the same warning because both would have
|
|
92
|
+
// reached for the same wrong form.
|
|
93
|
+
const isWholeDegree = (n) => Number.isInteger(n);
|
|
94
|
+
const isTwoDecimals = (n) => typeof n === 'number' && n === Number(n.toFixed(2));
|
|
83
95
|
/**
|
|
84
96
|
* Every way this seed set breaks the contract, as the build's own message strings.
|
|
85
97
|
*
|
|
@@ -100,10 +112,17 @@ export function validateSeeds(seeds) {
|
|
|
100
112
|
errs.push(`unknown system palette "${name}"`);
|
|
101
113
|
continue;
|
|
102
114
|
}
|
|
115
|
+
// Range first, granularity as an `else if`. A value that is both out of range and badly
|
|
116
|
+
// grained reports the range only -- the precision of a number nobody should be looking at
|
|
117
|
+
// yet is not the thing to tell them. Same shape as the build's checkKey.
|
|
103
118
|
if (!inRange(seed?.h, rule.h))
|
|
104
119
|
errs.push(`seed color.${name}.h ${fmt(seed?.h)} outside [${rule.h[0]}, ${rule.h[1]}]`);
|
|
120
|
+
else if (!isWholeDegree(seed?.h))
|
|
121
|
+
errs.push(`seed color.${name}.h ${fmt(seed?.h)} is not a whole degree`);
|
|
105
122
|
if (!inRange(seed?.c, rule.c))
|
|
106
123
|
errs.push(`seed color.${name}.c ${fmt(seed?.c)} outside [${rule.c[0].toFixed(3)}, ${rule.c[1].toFixed(3)}]`);
|
|
124
|
+
else if (!isTwoDecimals(seed?.c))
|
|
125
|
+
errs.push(`seed color.${name}.c ${fmt(seed?.c)} is finer than two decimals`);
|
|
107
126
|
}
|
|
108
127
|
for (const [name, seed] of Object.entries(seeds.custom ?? {})) {
|
|
109
128
|
const range = CUSTOM[name];
|
|
@@ -113,6 +132,8 @@ export function validateSeeds(seeds) {
|
|
|
113
132
|
}
|
|
114
133
|
if (!inRange(seed?.h, range))
|
|
115
134
|
errs.push(`seed color.custom.${name}.h ${fmt(seed?.h)} outside [${range[0]}, ${range[1]}]`);
|
|
135
|
+
else if (!isWholeDegree(seed?.h))
|
|
136
|
+
errs.push(`seed color.custom.${name}.h ${fmt(seed?.h)} is not a whole degree`);
|
|
116
137
|
// The rule section 7 could not put in the build's list, and said so: a custom palette is
|
|
117
138
|
// "the group you customise" along ONE axis. Hue is the person's; saturation and key are ours.
|
|
118
139
|
if (seed?.c !== undefined)
|
package/dist/color/seeds.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"seeds.js","sourceRoot":"","sources":["../../src/color/seeds.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,EAAE;AACF,6EAA6E;AAC7E,sEAAsE;AACtE,EAAE;AACF,sEAAsE;AAEtE,OAAO,EAAE,SAAS,EAAE,MAAM,YAA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AI,IAAI,IAAI,IAAI,EAAE,CAAC,GAAG,IAAI;oBACpD,CAAC,CAAC,SAAS,SAAS,CAAC,KAAK,CAAC,CAAC,GAAG,GAAG,CAAC,KAAK,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG;oBACnF,CAAC,CAAC,IAAI,CAAA;YACd,CAAC;QACL,CAAC;IACL,CAAC;IACD,OAAO,KAAK,CAAA;AAChB,CAAC"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/* ColumnChart -- blueprint components/column-chart.md. Columns 1px apart on one baseline, tops at
|
|
2
|
+
chart.radius, growing up from the baseline (a transform: nothing rides a column's end). */
|
|
3
|
+
|
|
4
|
+
.newtone-column-chart {
|
|
5
|
+
display: flex;
|
|
6
|
+
flex-direction: column;
|
|
7
|
+
gap: var(--newtone-space-2);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.newtone-column-chart-plot {
|
|
11
|
+
display: flex;
|
|
12
|
+
align-items: flex-end;
|
|
13
|
+
gap: 1px;
|
|
14
|
+
height: 20rem;
|
|
15
|
+
border-bottom: 1px solid var(--newtone-chart-axis);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/* Filling a container is a wide-screen behaviour: below `stack` a container is not stretched, and a plot
|
|
19
|
+
that took "the height left" would take none. The fixed heights hold there. */
|
|
20
|
+
@media (min-width: 40.001rem) {
|
|
21
|
+
.newtone-column-chart[data-fill] {
|
|
22
|
+
height: 100%;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.newtone-column-chart[data-fill] .newtone-column-chart-plot {
|
|
26
|
+
flex: 1;
|
|
27
|
+
min-height: 0;
|
|
28
|
+
height: auto;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.newtone-column-chart-column {
|
|
33
|
+
flex: 1;
|
|
34
|
+
display: flex;
|
|
35
|
+
flex-direction: column;
|
|
36
|
+
justify-content: flex-end;
|
|
37
|
+
height: calc(var(--_column-chart-share) * 100%);
|
|
38
|
+
overflow: hidden;
|
|
39
|
+
border-radius: var(--newtone-chart-radius) var(--newtone-chart-radius) 0 0;
|
|
40
|
+
background: var(--newtone-chart-mark);
|
|
41
|
+
transform-origin: bottom;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.newtone-column-chart-column[data-tone='muted'] {
|
|
45
|
+
background: var(--newtone-chart-mark-muted);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.newtone-column-chart-column[data-tone='off'] {
|
|
49
|
+
background: var(--newtone-chart-mark-off);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.newtone-column-chart-inner {
|
|
53
|
+
flex: none;
|
|
54
|
+
height: calc(var(--_column-chart-inner) * 100%);
|
|
55
|
+
background: var(--newtone-chart-mark);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.newtone-column-chart-ticks {
|
|
59
|
+
position: relative;
|
|
60
|
+
height: var(--newtone-space-5);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.newtone-column-chart-tick {
|
|
64
|
+
position: absolute;
|
|
65
|
+
left: calc(var(--_column-chart-at) * 100%);
|
|
66
|
+
transform: translateX(-50%);
|
|
67
|
+
color: var(--newtone-chart-label);
|
|
68
|
+
white-space: nowrap;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
@keyframes newtone-column-chart-grow {
|
|
72
|
+
from {
|
|
73
|
+
transform: scaleY(0);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
@media screen and (prefers-reduced-motion: no-preference) {
|
|
78
|
+
.newtone-column-chart-column {
|
|
79
|
+
animation: newtone-column-chart-grow var(--newtone-motion-duration-reveal)
|
|
80
|
+
var(--newtone-motion-easing-reveal) both;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
@media (max-width: 40rem) {
|
|
85
|
+
.newtone-column-chart-plot {
|
|
86
|
+
gap: 0;
|
|
87
|
+
height: 12rem;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Vertical columns on one baseline, one per category, with an optional inner layer. From 0.6.0,
|
|
4
|
+
* 2026-09-25. Blueprint components/column-chart.md.
|
|
5
|
+
*
|
|
6
|
+
* Every column is as tall as its value against the largest, with no value axis. `tone` is `mark`,
|
|
7
|
+
* `muted` or `off`; `inner` (0-1) draws that share of the column in `chart.mark` from its base. Ticks
|
|
8
|
+
* sit centred under the column they name. Columns grow up from the baseline on the reveal clock.
|
|
9
|
+
*/
|
|
10
|
+
export interface ColumnChartColumn {
|
|
11
|
+
value: number;
|
|
12
|
+
tone?: 'mark' | 'muted' | 'off';
|
|
13
|
+
/** 0-1: the share of the column drawn in `chart.mark`, from its base. */
|
|
14
|
+
inner?: number;
|
|
15
|
+
}
|
|
16
|
+
export interface ColumnChartTick {
|
|
17
|
+
/** The index of the column the label names. */
|
|
18
|
+
at: number;
|
|
19
|
+
label: ReactNode;
|
|
20
|
+
}
|
|
21
|
+
export interface ColumnChartProps extends HTMLAttributes<HTMLDivElement> {
|
|
22
|
+
columns: ColumnChartColumn[];
|
|
23
|
+
ticks?: ColumnChartTick[];
|
|
24
|
+
/** The chart's accessible name. */
|
|
25
|
+
label: string;
|
|
26
|
+
/** The plot takes the height of the chart's container. */
|
|
27
|
+
fill?: boolean;
|
|
28
|
+
}
|
|
29
|
+
export declare function ColumnChart({ columns, ticks, label, fill, className, ...rest }: ColumnChartProps): import("react").JSX.Element;
|
|
30
|
+
//# sourceMappingURL=column-chart.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"column-chart.d.ts","sourceRoot":"","sources":["../../src/column-chart/column-chart.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAiB,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAGrE;;;;;;;GAOG;AACH,MAAM,WAAW,iBAAiB;IAC9B,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,KAAK,CAAA;IAC/B,yEAAyE;IACzE,KAAK,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,MAAM,WAAW,eAAe;IAC5B,+CAA+C;IAC/C,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,SAAS,CAAA;CACnB;AAED,MAAM,WAAW,gBAAiB,SAAQ,cAAc,CAAC,cAAc,CAAC;IACpE,OAAO,EAAE,iBAAiB,EAAE,CAAA;IAC5B,KAAK,CAAC,EAAE,eAAe,EAAE,CAAA;IACzB,mCAAmC;IACnC,KAAK,EAAE,MAAM,CAAA;IACb,0DAA0D;IAC1D,IAAI,CAAC,EAAE,OAAO,CAAA;CACjB;AAED,wBAAgB,WAAW,CAAC,EACxB,OAAO,EACP,KAAK,EACL,KAAK,EACL,IAAY,EACZ,SAAS,EACT,GAAG,IAAI,EACV,EAAE,gBAAgB,+BAkDlB"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Text } from '../text/index.js';
|
|
3
|
+
export function ColumnChart({ columns, ticks, label, fill = false, className, ...rest }) {
|
|
4
|
+
const top = Math.max(...columns.map((c) => c.value));
|
|
5
|
+
return (_jsxs("div", { className: className ? `newtone-column-chart ${className}` : 'newtone-column-chart', "data-fill": fill ? '' : undefined, ...rest, children: [_jsx("div", { className: "newtone-column-chart-plot", role: "img", "aria-label": label, children: columns.map((c, i) => (_jsx("div", { className: "newtone-column-chart-column", "data-tone": c.tone ?? 'mark', style: {
|
|
6
|
+
'--_column-chart-share': top > 0 ? c.value / top : 0,
|
|
7
|
+
}, children: c.inner !== undefined ? (_jsx("div", { className: "newtone-column-chart-inner", style: { '--_column-chart-inner': c.inner } })) : null }, i))) }), ticks ? (_jsx("div", { className: "newtone-column-chart-ticks", "aria-hidden": "true", children: ticks.map((t) => (_jsx(Text, { as: "span", scale: "body-sm", className: "newtone-column-chart-tick", style: {
|
|
8
|
+
'--_column-chart-at': (t.at + 0.5) / columns.length,
|
|
9
|
+
}, children: t.label }, t.at))) })) : null] }));
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=column-chart.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"column-chart.js","sourceRoot":"","sources":["../../src/column-chart/column-chart.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAA;AAgCvC,MAAM,UAAU,WAAW,CAAC,EACxB,OAAO,EACP,KAAK,EACL,KAAK,EACL,IAAI,GAAG,KAAK,EACZ,SAAS,EACT,GAAG,IAAI,EACQ;IACf,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAA;IACpD,OAAO,CACH,eACI,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC,wBAAwB,SAAS,EAAE,CAAC,CAAC,CAAC,sBAAsB,eACxE,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,KAC5B,IAAI,aAER,cAAK,SAAS,EAAC,2BAA2B,EAAC,IAAI,EAAC,KAAK,gBAAa,KAAK,YAClE,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CACnB,cAEI,SAAS,EAAC,6BAA6B,eAC5B,CAAC,CAAC,IAAI,IAAI,MAAM,EAC3B,KAAK,EACD;wBACI,uBAAuB,EAAE,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;qBACtC,YAGrB,CAAC,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,CACrB,cACI,SAAS,EAAC,4BAA4B,EACtC,KAAK,EAAE,EAAE,uBAAuB,EAAE,CAAC,CAAC,KAAK,EAAmB,GAC9D,CACL,CAAC,CAAC,CAAC,IAAI,IAdH,CAAC,CAeJ,CACT,CAAC,GACA,EACL,KAAK,CAAC,CAAC,CAAC,CACL,cAAK,SAAS,EAAC,4BAA4B,iBAAa,MAAM,YACzD,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CACd,KAAC,IAAI,IAED,EAAE,EAAC,MAAM,EACT,KAAK,EAAC,SAAS,EACf,SAAS,EAAC,2BAA2B,EACrC,KAAK,EACD;wBACI,oBAAoB,EAAE,CAAC,CAAC,CAAC,EAAE,GAAG,GAAG,CAAC,GAAG,OAAO,CAAC,MAAM;qBACrC,YAGrB,CAAC,CAAC,KAAK,IAVH,CAAC,CAAC,EAAE,CAWN,CACV,CAAC,GACA,CACT,CAAC,CAAC,CAAC,IAAI,IACN,CACT,CAAA;AACL,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/column-chart/index.ts"],"names":[],"mappings":"AAAA,mDAAmD;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAC/C,YAAY,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/column-chart/index.ts"],"names":[],"mappings":"AAAA,mDAAmD;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA"}
|
package/dist/control/control.css
CHANGED
|
@@ -3,15 +3,16 @@
|
|
|
3
3
|
*
|
|
4
4
|
* ---- the box is square when it is bare, and a row when it is labelled -----
|
|
5
5
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* pair is two numbers that can stop agreeing.
|
|
6
|
+
* THE PADDING IS ONE VALUE PER RUNG rather than an x/y pair: equal padding around one glyph is what
|
|
7
|
+
* makes a bare control square, and a pair is two numbers that can stop agreeing. The glyph is 20 at
|
|
8
|
+
* every rung, so the padding alone moves the box -- 8, 10 and 12 give 36, 40 and 44.
|
|
10
9
|
*
|
|
11
|
-
* **
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
10
|
+
* **Those three are rungs of a closed ladder** -- 36, 40, 44, 48, 56, contracts/button.md, *Sizes* --
|
|
11
|
+
* and they replaced a 44px FLOOR on 2026-09-21. A floor only refuses what is under it, so 41 and 47
|
|
12
|
+
* were conformant and neither is a decision; a closed set can ask the question a floor cannot, which
|
|
13
|
+
* is *is this number one of five*. `sm` at 36 is the size this component refused at 28, and 28 is
|
|
14
|
+
* still refused -- for the better reason that it is not on the ladder.
|
|
15
|
+
* newtone_ui_react-web.md section 5 carries the amended invariant.
|
|
15
16
|
*
|
|
16
17
|
* A labelled control keeps the same block padding and gains the label plus a gap, so it grows along
|
|
17
18
|
* the inline axis only -- the height is the size, whether or not there is a word in it.
|
|
@@ -74,9 +75,21 @@
|
|
|
74
75
|
gap: var(--newtone-control-gap);
|
|
75
76
|
font-family: var(--newtone-control-label-family);
|
|
76
77
|
font-weight: var(--newtone-control-label-weight);
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
*
|
|
78
|
+
|
|
79
|
+
/* THE PAIR AND THE PADDING ARRIVE FROM THE RUNG BELOW, by way of three local properties. Each
|
|
80
|
+
* rung takes a whole step -- all three are 14/20 today -- and a step is the pair that matches
|
|
81
|
+
* the glyph beside it. Reading a size here and a leading somewhere else is the half-a-pair this
|
|
82
|
+
* component shipped once already. */
|
|
83
|
+
padding: calc(var(--newtone-control-pad) - 1px);
|
|
84
|
+
font-size: var(--newtone-control-text-size);
|
|
85
|
+
line-height: var(--newtone-control-text-leading);
|
|
86
|
+
|
|
87
|
+
/* PUBLISHED, NEVER DECLARED. The box is the padding plus the leading plus the border; stating
|
|
88
|
+
* a height as well would be a second copy of that sum, free to drift from it. This is what the
|
|
89
|
+
* box CAME TO, in a property a neighbouring control or a row can read -- issues/open/156.
|
|
90
|
+
* Read it; writing it changes no geometry. */
|
|
91
|
+
--newtone-control-height: calc(var(--newtone-control-text-leading) + 2 * var(--newtone-control-pad));
|
|
92
|
+
|
|
80
93
|
border: 1px solid;
|
|
81
94
|
border-radius: var(--newtone-control-radius);
|
|
82
95
|
cursor: pointer;
|
|
@@ -86,24 +99,37 @@
|
|
|
86
99
|
block-size: fit-content;
|
|
87
100
|
}
|
|
88
101
|
|
|
89
|
-
/*
|
|
90
|
-
*
|
|
102
|
+
/* ---- the rungs ----------------------------------------------------------
|
|
103
|
+
*
|
|
104
|
+
* 36, 40, 44 -- three of the ladder's five, and a rung below Button at every position.
|
|
105
|
+
* contracts/button.md, *Sizes*.
|
|
91
106
|
*
|
|
92
|
-
*
|
|
93
|
-
*
|
|
94
|
-
*
|
|
107
|
+
* THE BORDER IS SUBTRACTED ONCE HERE so each rung states only its padding VALUE and the classes
|
|
108
|
+
* describe the OUTER box: 20 + 2x8 = 36, 20 + 2x10 = 40, 20 + 2x12 = 44. The glyph is 20 at every
|
|
109
|
+
* rung because every rung takes 14/20, so the padding alone moves the box.
|
|
95
110
|
*
|
|
96
|
-
*
|
|
111
|
+
* `--newtone-control-pad` IS SET PER RUNG AND READ BY THE BASE RULE, so a rung is three
|
|
112
|
+
* declarations rather than a copy of the box. The published height below needs the two numbers by
|
|
113
|
+
* one name in any case.
|
|
114
|
+
*
|
|
115
|
+
* EACH RUNG NAMES BOTH LEAVES OF ONE STEP. Taking a size from one group and a leading from another
|
|
116
|
+
* is what put a 24px glyph against 14/16.8 here on the day this component landed. */
|
|
117
|
+
.newtone-control--sm {
|
|
118
|
+
--newtone-control-pad: var(--newtone-control-size-sm-padding);
|
|
119
|
+
--newtone-control-text-size: var(--newtone-control-size-sm-label-size);
|
|
120
|
+
--newtone-control-text-leading: var(--newtone-control-size-sm-label-line-height);
|
|
121
|
+
}
|
|
122
|
+
|
|
97
123
|
.newtone-control--md {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
124
|
+
--newtone-control-pad: var(--newtone-control-size-md-padding);
|
|
125
|
+
--newtone-control-text-size: var(--newtone-control-size-md-label-size);
|
|
126
|
+
--newtone-control-text-leading: var(--newtone-control-size-md-label-line-height);
|
|
101
127
|
}
|
|
102
128
|
|
|
103
129
|
.newtone-control--lg {
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
130
|
+
--newtone-control-pad: var(--newtone-control-size-lg-padding);
|
|
131
|
+
--newtone-control-text-size: var(--newtone-control-size-lg-label-size);
|
|
132
|
+
--newtone-control-text-leading: var(--newtone-control-size-lg-label-line-height);
|
|
107
133
|
}
|
|
108
134
|
|
|
109
135
|
/* A bare control needs NO rule of its own to be square, and the first draft of this sheet wrote two.
|
|
@@ -1,14 +1,29 @@
|
|
|
1
1
|
import type { AnchorHTMLAttributes, ButtonHTMLAttributes } from 'react';
|
|
2
2
|
export type ControlVariant = 'primary' | 'secondary';
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Three rungs of the ladder's five: **36, 40, 44**.
|
|
5
|
+
*
|
|
6
|
+
* A CONTROL SITS A RUNG BELOW A BUTTON AT EVERY POSITION, and that is the design rather than an
|
|
7
|
+
* accident of porting. A control is chrome -- a back arrow, a pager, a close -- and a page's Button
|
|
8
|
+
* is the page speaking. contracts/button.md, *Sizes*.
|
|
9
|
+
*
|
|
10
|
+
* `lg` WAS 56 AND `md` WAS 44 UNTIL 2026-09-21, so every existing Control gets smaller unless its
|
|
11
|
+
* call site moves up a rung. `sm` at 36 is the size this component refused at 28 and has now
|
|
12
|
+
* gained from the other end: not by lowering a floor, but because the floor became a closed set of
|
|
13
|
+
* five heights -- newtone_ui_react-web.md section 5.
|
|
14
|
+
*/
|
|
15
|
+
export type ControlSize = 'sm' | 'md' | 'lg';
|
|
4
16
|
interface ControlCommon {
|
|
5
17
|
/** A Material Symbols ligature -- `arrow_back`, `chevron_right`, `close`. */
|
|
6
18
|
icon: string;
|
|
7
19
|
/** `primary` is the soft outline, `secondary` the ghost. Neither is ever the accent. */
|
|
8
20
|
variant?: ControlVariant;
|
|
9
21
|
/**
|
|
10
|
-
*
|
|
11
|
-
*
|
|
22
|
+
* Which rung: 36, 40 or 44. Defaults to `md`, which is 40.
|
|
23
|
+
*
|
|
24
|
+
* **`md` was 44 and `lg` was 56 until 2026-09-21**, so this default renders four pixels shorter
|
|
25
|
+
* than it used to and `lg` twelve. A call site that wanted the old `md` now asks for `lg`; a
|
|
26
|
+
* call site that wanted the old `lg` has no rung here and wants an `Action`.
|
|
12
27
|
*/
|
|
13
28
|
size?: ControlSize;
|
|
14
29
|
/** Fill the glyph (the family's `FILL` axis). Defaults to outlined. */
|
|
@@ -91,13 +106,22 @@ export type ControlProps = ControlCommon & ControlName & ControlElement;
|
|
|
91
106
|
* draws *Previous* and *Next* beside the glyphs. Both breaks are argued in
|
|
92
107
|
* `components/control.md`; neither is a rule that was copied past without being read.
|
|
93
108
|
*
|
|
94
|
-
* ----
|
|
109
|
+
* ---- `sm` came back at 36, and not by lowering a floor ---------------------
|
|
110
|
+
*
|
|
111
|
+
* The reference ships `sm` at **28px**. `icon-link.tsx` in this library argues that 44px is a floor
|
|
112
|
+
* rather than a taste -- the smallest target a finger reliably hits, the same number on every
|
|
113
|
+
* platform -- and draws a 2.75rem box for it. **A library cannot hold both sentences**, so this one
|
|
114
|
+
* shipped nothing under 44 and carried a trigger for a call site that could say why the floor did
|
|
115
|
+
* not apply to it.
|
|
116
|
+
*
|
|
117
|
+
* THAT TRIGGER NEVER FIRED. What changed on 2026-09-21 is that the floor became a LADDER -- five
|
|
118
|
+
* heights, closed -- and this component's three rungs on it are 36, 40 and 44. **28 is still
|
|
119
|
+
* refused, and for a better reason than before**: it is not on the ladder. A floor only refuses
|
|
120
|
+
* what is under it, so 41 and 47 were conformant and neither is a decision; a closed set can ask
|
|
121
|
+
* the question a floor cannot, which is *is this number one of five*.
|
|
95
122
|
*
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
* every platform -- and draws a 2.75rem box for it. **A library cannot hold both sentences.** `md`
|
|
99
|
-
* is 48 and `lg` is 64, and a control smaller than the floor needs a call site that can say why the
|
|
100
|
-
* floor does not apply to it.
|
|
123
|
+
* newtone_ui_react-web.md section 5 carries the amended invariant and why 44 (WCAG 2.5.5, AAA) gave
|
|
124
|
+
* way to 36 (clear of 2.5.8's 24x24, AA).
|
|
101
125
|
*
|
|
102
126
|
* ---- no transition, and that is a vocabulary this library does not have ----
|
|
103
127
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"control.d.ts","sourceRoot":"","sources":["../../src/control/control.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,OAAO,CAAA;AAGvE,MAAM,MAAM,cAAc,GAAG,SAAS,GAAG,WAAW,CAAA;AACpD,MAAM,MAAM,WAAW,GAAG,IAAI,GAAG,IAAI,CAAA;
|
|
1
|
+
{"version":3,"file":"control.d.ts","sourceRoot":"","sources":["../../src/control/control.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,OAAO,CAAA;AAGvE,MAAM,MAAM,cAAc,GAAG,SAAS,GAAG,WAAW,CAAA;AACpD;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,WAAW,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAA;AA+B5C,UAAU,aAAa;IACnB,6EAA6E;IAC7E,IAAI,EAAE,MAAM,CAAA;IACZ,wFAAwF;IACxF,OAAO,CAAC,EAAE,cAAc,CAAA;IACxB;;;;;;OAMG;IACH,IAAI,CAAC,EAAE,WAAW,CAAA;IAClB,uEAAuE;IACvE,IAAI,CAAC,EAAE,OAAO,CAAA;IACd;;;;;;;;;;;;;;;OAeG;IACH,OAAO,CAAC,EAAE,OAAO,CAAA;CACpB;AAED;;;;;;;;;GASG;AACH,KAAK,WAAW,GACV;IACI,+FAA+F;IAC/F,KAAK,EAAE,MAAM,CAAA;IACb,SAAS,CAAC,EAAE,MAAM,CAAA;CACrB,GACD;IACI,KAAK,CAAC,EAAE,SAAS,CAAA;IACjB,yFAAyF;IACzF,SAAS,EAAE,MAAM,CAAA;CACpB,CAAA;AAEP;;;;;GAKG;AACH,KAAK,cAAc,GACb,CAAC,IAAI,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EAAE,UAAU,GAAG,YAAY,CAAC,GAAG;IACxE,uEAAuE;IACvE,IAAI,CAAC,EAAE,SAAS,CAAA;CACnB,CAAC,GACF,CAAC,IAAI,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EAAE,UAAU,GAAG,MAAM,GAAG,YAAY,CAAC,GAAG;IACjF,qFAAqF;IACrF,IAAI,EAAE,MAAM,CAAA;CACf,CAAC,CAAA;AAER,MAAM,MAAM,YAAY,GAAG,aAAa,GAAG,WAAW,GAAG,cAAc,CAAA;AAEvE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AACH,wBAAgB,OAAO,CAAC,EACpB,IAAI,EACJ,OAAmB,EACnB,IAAW,EACX,KAAK,EACL,SAAS,EACT,IAAY,EACZ,OAAe,EACf,SAAS,EACT,GAAG,IAAI,EACV,EAAE,YAAY,+BAkEd"}
|
package/dist/control/control.js
CHANGED
|
@@ -3,9 +3,12 @@ import { Icon } from '../icon/index.js';
|
|
|
3
3
|
/**
|
|
4
4
|
* THE GLYPH SIZE THAT PAIRS WITH EACH CONTROL SIZE'S LABEL LEADING. Read the map, not the letter.
|
|
5
5
|
*
|
|
6
|
-
*
|
|
7
|
-
* sized to the leading of the text it sits with, so 20px goes with 14/20 and 24px with
|
|
8
|
-
* governance/code/an-icon-and-the-text-beside-it-share-one-size-and-leading-pair.md.
|
|
6
|
+
* EVERY RUNG IS 20px FROM 2026-09-21, and the map is kept rather than collapsed to a constant. A
|
|
7
|
+
* glyph is sized to the leading of the text it sits with, so 20px goes with 14/20 and 24px with
|
|
8
|
+
* 16/24 -- governance/code/an-icon-and-the-text-beside-it-share-one-size-and-leading-pair.md. All
|
|
9
|
+
* three of this component's rungs take 14/20, so all three take the 20px mark; the map stays
|
|
10
|
+
* because the pairing is the fact, and a fourth rung at 48 would take 16/24 and a 24px mark. A
|
|
11
|
+
* constant here would have to be re-derived into a map on that day.
|
|
9
12
|
*
|
|
10
13
|
* IT WAS `{ md: 'md', lg: 'lg' }` -- 24px and 32px -- AND THAT PAIRED NOTHING. The label was
|
|
11
14
|
* `typography.size.sm` (14) with `typography.line-height.tight` (1.2), so a 24px mark stood against
|
|
@@ -13,16 +16,18 @@ import { Icon } from '../icon/index.js';
|
|
|
13
16
|
* expressed at all until `typography.step` existed, because four ratios across nine sizes let 14px
|
|
14
17
|
* reach 16.8, 18.9, 21 or 23.8 and never 20. contracts/typography.md section 7.2.
|
|
15
18
|
*
|
|
16
|
-
* THE BOX
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
19
|
+
* THE BOX IS EQUAL PADDING AROUND ONE GLYPH, so with the glyph fixed at 20 the padding alone moves
|
|
20
|
+
* the box: 20 + 2x8 = 36, 20 + 2x10 = 40, 20 + 2x12 = 44. Those are three rungs of the ladder in
|
|
21
|
+
* contracts/button.md, *Sizes*, and 10 is the one padding value the quarter-rem `space` scale did
|
|
22
|
+
* not have -- `space.2-5` arrived with them.
|
|
20
23
|
*
|
|
21
|
-
* NO PAIR EXISTS FOR A 32px GLYPH and none was invented
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
+
* NO PAIR EXISTS FOR A 32px GLYPH and none was invented when `lg` was 56. Nothing had ever rendered
|
|
25
|
+
* a non-media `lg`, so it was the cheapest size in the library to move, and it has now moved twice:
|
|
26
|
+
* 32 to 24 on 2026-09-16, 24 to 20 on 2026-09-21. A 22/32 step is one line the day a call site asks
|
|
27
|
+
* -- and a more expensive line than it was, since contracts/typography.md section 7.2.1 closed the
|
|
28
|
+
* set at two and a third pair now has to say which rung spends it.
|
|
24
29
|
*/
|
|
25
|
-
const GLYPH = { md: 'sm', lg: '
|
|
30
|
+
const GLYPH = { sm: 'sm', md: 'sm', lg: 'sm' };
|
|
26
31
|
/**
|
|
27
32
|
* A glyph you press to move around a page rather than to act on it: a deck's previous and next, a
|
|
28
33
|
* step back, a panel opened.
|
|
@@ -50,13 +55,22 @@ const GLYPH = { md: 'sm', lg: 'md' };
|
|
|
50
55
|
* draws *Previous* and *Next* beside the glyphs. Both breaks are argued in
|
|
51
56
|
* `components/control.md`; neither is a rule that was copied past without being read.
|
|
52
57
|
*
|
|
53
|
-
* ----
|
|
58
|
+
* ---- `sm` came back at 36, and not by lowering a floor ---------------------
|
|
54
59
|
*
|
|
55
|
-
* The reference ships `sm` at **28px**. `icon-link.tsx` in this library
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
+
* The reference ships `sm` at **28px**. `icon-link.tsx` in this library argues that 44px is a floor
|
|
61
|
+
* rather than a taste -- the smallest target a finger reliably hits, the same number on every
|
|
62
|
+
* platform -- and draws a 2.75rem box for it. **A library cannot hold both sentences**, so this one
|
|
63
|
+
* shipped nothing under 44 and carried a trigger for a call site that could say why the floor did
|
|
64
|
+
* not apply to it.
|
|
65
|
+
*
|
|
66
|
+
* THAT TRIGGER NEVER FIRED. What changed on 2026-09-21 is that the floor became a LADDER -- five
|
|
67
|
+
* heights, closed -- and this component's three rungs on it are 36, 40 and 44. **28 is still
|
|
68
|
+
* refused, and for a better reason than before**: it is not on the ladder. A floor only refuses
|
|
69
|
+
* what is under it, so 41 and 47 were conformant and neither is a decision; a closed set can ask
|
|
70
|
+
* the question a floor cannot, which is *is this number one of five*.
|
|
71
|
+
*
|
|
72
|
+
* newtone_ui_react-web.md section 5 carries the amended invariant and why 44 (WCAG 2.5.5, AAA) gave
|
|
73
|
+
* way to 36 (clear of 2.5.8's 24x24, AA).
|
|
60
74
|
*
|
|
61
75
|
* ---- no transition, and that is a vocabulary this library does not have ----
|
|
62
76
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"control.js","sourceRoot":"","sources":["../../src/control/control.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,IAAI,EAAiB,MAAM,kBAAkB,CAAA;
|
|
1
|
+
{"version":3,"file":"control.js","sourceRoot":"","sources":["../../src/control/control.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,IAAI,EAAiB,MAAM,kBAAkB,CAAA;AAiBtD;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,KAAK,GAAkC,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,CAAA;AA4E7E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AACH,MAAM,UAAU,OAAO,CAAC,EACpB,IAAI,EACJ,OAAO,GAAG,SAAS,EACnB,IAAI,GAAG,IAAI,EACX,KAAK,EACL,SAAS,EACT,IAAI,GAAG,KAAK,EACZ,OAAO,GAAG,KAAK,EACf,SAAS,EACT,GAAG,IAAI,EACI;IACX,6FAA6F;IAC7F,4FAA4F;IAC5F,6FAA6F;IAC7F,MAAM,OAAO,GAAG;QACZ,iBAAiB;QACjB,oBAAoB,OAAO,EAAE;QAC7B,oBAAoB,IAAI,EAAE;QAC1B,6FAA6F;QAC7F,2FAA2F;QAC3F,kEAAkE;QAClE,OAAO,CAAC,CAAC,CAAC,2BAA2B,CAAC,CAAC,CAAC,IAAI;QAC5C,SAAS;KACZ;SACI,MAAM,CAAC,OAAO,CAAC;SACf,IAAI,CAAC,GAAG,CAAC,CAAA;IAEd,6FAA6F;IAC7F,8FAA8F;IAC9F,oCAAoC;IACpC,EAAE;IACF,+FAA+F;I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