@umriss-ui/core 0.41.1 → 0.43.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 +50 -5
- package/README.md +234 -27
- package/dist/core.css +1 -1
- package/dist/core.js +3214 -3073
- package/dist/de.d.ts +7 -0
- package/dist/formats-BccAYWgq.js +80 -0
- package/dist/index.d.ts +159 -26
- package/dist/wording/de.js +1 -1
- package/docs/llms-full.md +517 -201
- package/package.json +5 -3
- package/dist/formats-BdlPZDzb.js +0 -63
package/CHANGELOG.md
CHANGED
|
@@ -4,11 +4,12 @@ This document describes what changes for **callers** of the package: exports,
|
|
|
4
4
|
props, behaviour.
|
|
5
5
|
|
|
6
6
|
**The numbers.** The middle digit rises when something is added; the last one
|
|
7
|
-
when something is repaired.
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
when something is repaired. The six packages are released in step, and a rename
|
|
8
|
+
keeps its old name for one further minor, with a warning, before the minor after
|
|
9
|
+
it removes the name ([the upgrade promise, ADR-0066](../../docs/adr/0066-one-number-peers-over-the-minor-a-rename-lives-one-minor.md)).
|
|
10
|
+
**Whatever changes existing behaviour stands under a heading "Changed" of its
|
|
11
|
+
own**, no matter which digit rose, with a `Migration:` line. Whoever reads only
|
|
12
|
+
one section before an upgrade reads that one.
|
|
12
13
|
|
|
13
14
|
From 0.34.0 the packages share one number - five, and six from 0.40.0, when the dashboard joined: they are released together, and a package without a change of its own still gets a heading for it.
|
|
14
15
|
|
|
@@ -26,12 +27,56 @@ package stood at `0.1.0` the whole time, because it had exactly one caller and t
|
|
|
26
27
|
caller lay in the same repository — and are grouped by unit of delivery, not by
|
|
27
28
|
commit.
|
|
28
29
|
|
|
30
|
+
## 0.43.0 – One root contract, and a finger as a pointer (Oct. 2026)
|
|
31
|
+
|
|
32
|
+
### Added
|
|
33
|
+
|
|
34
|
+
- **`useContextMenuTrigger(open)`** opens a `ContextMenu` the same way on every device: on a right-click at the pointer, on the context-menu key or Shift+F10 at the target's box, and on a long press with a finger at the finger - the only way on iOS. Spread its result on the target; the click and the `contextmenu` that end a long press do not reach it.
|
|
35
|
+
- **A held finger shows a Tooltip.** A touch held 500 ms within 10 px shows an icon button's name, which hides 1.5 s after the lift; mouse and pen keep the hover delay (ADR-0070).
|
|
36
|
+
- **`createLongPress(onPress, onEnd?)`** - the long-press detector the Tooltip and `useContextMenuTrigger` use, a plain function over pointer events: it fires once, with the finger's point, when a touch pointer is held 500 ms within 10 px, and it swallows the click that ends the press.
|
|
37
|
+
- **A number format is Intl's options** (ADR-0069): `NumberFormat` is `"percent" | "count" | NumberOptions`, where `NumberOptions` are `Intl.NumberFormat`'s options plus `decimals`. `writeNumber(formats, n, format?)` writes a number by it, and `Formats.numberWith(options)` is cached by the options' content. `NumberInput` takes `grouping` (default `true`), so a year reads 2024.
|
|
38
|
+
- **A tab list with more tabs than room scrolls sideways** within its width, with no bar, and keeps the selected and the focused tab in view by its own scroll position, never the page's.
|
|
39
|
+
- **Clear of the safe area:** under `viewport-fit=cover` the toasts, a full-window Modal, the Drawer and the CommandPalette add each edge's hardware inset to their room. Without that viewport setting the insets are zero and nothing moves.
|
|
40
|
+
- **The CommandPalette shows a close cross under a finger**, and the on-screen keyboard is told what Enter does (`enterkeyhint`) in the palette, Combobox, MultiSelect's search and TreeSearch, with `autocomplete="off"`; a caller's own value wins where the field passes attributes through.
|
|
41
|
+
- **More contrast on request:** under `prefers-contrast: more` the secondary and muted text reach 7:1 and the edges and hairlines 3:1, in both themes.
|
|
42
|
+
|
|
43
|
+
### Changed
|
|
44
|
+
|
|
45
|
+
- **`md` controls are 44 px under a coarse pointer** - a phone, a tablet, a touch kiosk (ADR-0070). A touch laptop with a trackpad stays at 32; `sm` and `xs` are unchanged.
|
|
46
|
+
- Migration: nothing to change; to keep 32 px under a finger, set `--u-control-height: 32px` in your own `@media (pointer: coarse)` block.
|
|
47
|
+
- **Under a finger nothing core draws is a target smaller than 24 px.** A box grows where a pad cannot reach: the free Checkbox and Switch, a radio option, the TreeView fold key, the Splitter strip, the Slider range and the NumberInput steps; a button is at least 24 px wide. The Tag remove, Alert close, FileInput remove, MultiSelect chips, Breadcrumb link, Card fold key, a SegmentedControl segment and the clear crosses take an invisible pad that changes no layout.
|
|
48
|
+
- Migration: nothing to change; under touch emulation or on a touch device, look at a layout that counted on those controls' size.
|
|
49
|
+
- **Combobox, MultiSelect, DatePicker, DateTimePicker, DateRangePicker and DateTimeRangePicker are fields** (ADR-0068): class and style stay on the wrapper, and the ref and the rest land on the control that takes the focus - an `HTMLInputElement` for Combobox, an `HTMLButtonElement` for the others. The clause that sent `aria-label`, `aria-labelledby` and `aria-describedby` there separately is gone. No old form is kept, since an attribute stands on one element.
|
|
50
|
+
- Migration: a ref typed `HTMLDivElement` or `HTMLSpanElement` is a type error - type it for the input or the button; a selector or test that found `data-*` or `id` on the wrapper finds it on the control.
|
|
51
|
+
- **`ariaLabel` on TreeView, Popover and ContextMenu is renamed `aria-label`** (ADR-0068). `ariaLabel` stays as a deprecated alias and warns once in development; 0.44.0 removes it.
|
|
52
|
+
- Migration: write `aria-label`.
|
|
53
|
+
- **The built-in number formats no longer write a negative zero:** -0.0004 at one place reads "0.0", not "-0.0".
|
|
54
|
+
- Migration: nothing to change; a test that expected "-0" reads "0".
|
|
55
|
+
|
|
56
|
+
## 0.42.0 – Tested in Vitest and Jest, themed from one file (Oct. 2026)
|
|
57
|
+
|
|
58
|
+
### Added
|
|
59
|
+
|
|
60
|
+
- **Core loads in Vitest and Jest with the lines its README gives.** The new "Testing" section holds `vitest.config.ts`, `jest.config.cjs` with its CSS stub and Babel config, and `umriss.setup.js` with the five polyfills jsdom lacks; `.` and `./wording/de` carry a `default` condition for Jest's resolver. The release check installs the packed package into a scratch project and runs a test from those very blocks under both runners.
|
|
61
|
+
- **Six tokens where a value was written into a component:** `--u-modal-width-sm`, `--u-modal-width-md` and `--u-modal-width-lg` (400, 520 and 720 px), `--u-transform-caps` (`uppercase`, read by every text in spaced capitals - Card's eyebrow, Divider's label, the caps style, the DatePicker's weekdays, the CommandPalette, the table's head and the dashboard's mode label), `--u-button-press-scale` (0.98) and `--u-label-size` (a FormField label's size, `--u-text-sm`). Each defaults to the value it replaces.
|
|
62
|
+
- **A brand file to copy** in the README's Styles section: the font, the six accent tokens and the charts' palette, each light and dark; a unit test holds it to the stylesheets and the contrast pairs. Type on the accent surface joins the contrast pairs at 4.5:1.
|
|
63
|
+
- **The layer order for Tailwind v4 and for a wrapper library** stands in the Styles section, with the one declaration each needs; it holds in either load order.
|
|
64
|
+
- **A "Server Components" section** says what a Server Component may do with core: render its components with props React can serialise (ADR-0067).
|
|
65
|
+
- **TypeScript 5.4 or newer**, stated in the Install section (the declarations use `NoInfer`); the release check compiles a strict consumer under 5.4 as well as the current TypeScript.
|
|
66
|
+
|
|
67
|
+
### Changed
|
|
68
|
+
|
|
69
|
+
- **`useFormats()` writes no date or time until the page has hydrated.** On a server and in the hydration render its instant formats (`date`, `dateShort`, `month`, `dateLong`, `time`, `dateTime`, `offset`) return an empty text; a client-only render never sees them empty. A server in another zone than the reader's no longer raises React's hydration error #418 (ADR-0060, amended). The pickers measure their field with the real formats, so their width does not jump.
|
|
70
|
+
- Migration: nothing to change in an application that renders in the browser; a test that renders to a string and expects a date finds an empty text - render it in the DOM instead.
|
|
71
|
+
|
|
29
72
|
## 0.41.1 – The documentation runs where the code is (Oct. 2026)
|
|
30
73
|
|
|
31
74
|
### Changed
|
|
32
75
|
|
|
33
76
|
- **The documentation is no longer hosted.** The site on GitHub Pages is gone, and the package's `homepage` now names its README on GitHub. The running documentation of this version opens from a checkout of the tag `core-v0.41.1` with `pnpm install` and `pnpm start`, at `http://localhost:4170/umriss-ui/` - the repository README says how, under "See it running".
|
|
77
|
+
- Migration: nothing to change; a bookmark or link to the old hosted site no longer resolves - open the documentation from a checkout of the tag, as described above.
|
|
34
78
|
- **`docs/llms-full.md` in the package stands on its own:** a link to another page points at that page's heading in the same file, a link to a place on the site that the file does not hold keeps only its text, and ADR-0032 is linked at this version's tag.
|
|
79
|
+
- Migration: nothing to change; look at any tool that read `docs/llms-full.md` and followed its links to the site, which now find the heading in the same file.
|
|
35
80
|
|
|
36
81
|
## 0.41.0 – Colours survive a modern build (Oct. 2026)
|
|
37
82
|
|
package/README.md
CHANGED
|
@@ -28,15 +28,58 @@ In an application:
|
|
|
28
28
|
import { Button, Card } from "@umriss-ui/core";
|
|
29
29
|
```
|
|
30
30
|
|
|
31
|
-
Nothing else is required. React 19 or newer as a peer.
|
|
31
|
+
Nothing else is required. React 19 or newer as a peer. TypeScript 5.4 or newer (the declarations use `NoInfer`).
|
|
32
32
|
|
|
33
33
|
The package ships ES2022 syntax; an application that serves older browsers
|
|
34
34
|
transpiles it itself.
|
|
35
35
|
|
|
36
36
|
Every entry, `./wording/de` included, begins with `"use client"`, the directive a framework
|
|
37
|
-
with Server Components reads to treat a module as client code.
|
|
38
|
-
|
|
39
|
-
|
|
37
|
+
with Server Components reads to treat a module as client code. Core's components render from a
|
|
38
|
+
Server Component with props React can serialise; a function prop (a handler, a render prop) is
|
|
39
|
+
callable only in a client file. No test runs inside such a framework: the package is rendered to a
|
|
40
|
+
string in a test, and the fields' widths a server writes into the markup are checked there.
|
|
41
|
+
|
|
42
|
+
### Server Components
|
|
43
|
+
|
|
44
|
+
A Server Component fetches the data and hands it to a Client Component. The views - table, chart,
|
|
45
|
+
schedule, dashboard - are declared by their hook, so the declaration stays in a client file next to
|
|
46
|
+
them, with its `rowKey`, columns and formatters. Only the rows cross the boundary:
|
|
47
|
+
|
|
48
|
+
```tsx
|
|
49
|
+
// app/orders/page.tsx - a Server Component
|
|
50
|
+
import { OrdersTable } from "./orders-table";
|
|
51
|
+
import { loadOrders } from "@/lib/orders";
|
|
52
|
+
|
|
53
|
+
export default async function Page() {
|
|
54
|
+
return <OrdersTable rows={await loadOrders()} />;
|
|
55
|
+
}
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
```tsx
|
|
59
|
+
// app/orders/orders-table.tsx
|
|
60
|
+
"use client";
|
|
61
|
+
import { useTable } from "@umriss-ui/table";
|
|
62
|
+
import type { Order } from "@/lib/orders";
|
|
63
|
+
|
|
64
|
+
export function OrdersTable({ rows }: { rows: Order[] }) {
|
|
65
|
+
const { Table, Column } = useTable(rows, { rowKey: (o) => o.number });
|
|
66
|
+
|
|
67
|
+
return (
|
|
68
|
+
<Table aria-label="Orders">
|
|
69
|
+
<Column value="number" label="Order" rowHeader />
|
|
70
|
+
<Column value="customer" label="Customer" />
|
|
71
|
+
<Column value="quantity" label="Quantity" />
|
|
72
|
+
</Table>
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
On a server, and until the page has hydrated, a date or time is empty, because only the browser
|
|
78
|
+
knows the reader's zone.
|
|
79
|
+
|
|
80
|
+
The calculation is the one view a Server Component writes itself: its tree is read where it is
|
|
81
|
+
written (see `@umriss-ui/calculation`). The reasons are in
|
|
82
|
+
[ADR-0067](../../docs/adr/0067-a-server-component-hands-umriss-its-data-and-writes-only-a-calculation.md).
|
|
40
83
|
|
|
41
84
|
### What an import costs
|
|
42
85
|
|
|
@@ -55,6 +98,11 @@ manifest marks CSS as a side effect, so a bundler keeps it. The stylesheet stays
|
|
|
55
98
|
exported as `@umriss-ui/core/styles.css` for setups that link stylesheets by
|
|
56
99
|
hand; nobody has to import it.
|
|
57
100
|
|
|
101
|
+
**On a phone the safe area is honoured.** Under `viewport-fit=cover` the toasts,
|
|
102
|
+
a full-window `Modal`, a `Drawer` and the `CommandPalette` keep clear of a notch
|
|
103
|
+
and a home indicator, each edge's inset added to its room. Without
|
|
104
|
+
`viewport-fit=cover` nothing moves.
|
|
105
|
+
|
|
58
106
|
**They touch nothing else** (ADR-0021). No rule selects `html`, `body`, `*` or a
|
|
59
107
|
native element of the page, and the only rules on `:root` declare the tokens.
|
|
60
108
|
Each component carries what it needs itself: its type, `box-sizing` on its own
|
|
@@ -65,13 +113,60 @@ elements, a focus ring on what it makes focusable. A caller's content inside
|
|
|
65
113
|
layers, `umriss.tokens`, `umriss.base` and `umriss.components`, and CSS written
|
|
66
114
|
outside a layer wins over all of them, whatever the order of loading:
|
|
67
115
|
|
|
68
|
-
|
|
116
|
+
A brand is one file to copy and edit. It sets the font, the whole accent and
|
|
117
|
+
the charts' palette, each colour with a light and a dark value, so that no part
|
|
118
|
+
of the interface stays petrol; the values are an example (indigo), not the
|
|
119
|
+
defaults:
|
|
120
|
+
|
|
121
|
+
```css brand.css
|
|
69
122
|
:root {
|
|
70
123
|
--u-font-sans: "Inter", system-ui, sans-serif;
|
|
71
|
-
|
|
124
|
+
|
|
125
|
+
--u-color-accent: light-dark(#4338ca, #818cf8);
|
|
126
|
+
--u-color-accent-hover: light-dark(#3730a3, #a5b4fc);
|
|
127
|
+
--u-color-accent-subtle: light-dark(#eef0fb, #1e1f3d);
|
|
128
|
+
--u-color-accent-subtle-pressed: light-dark(#dfe2f7, #282a52);
|
|
129
|
+
--u-color-accent-text: light-dark(#4338ca, #a5b4fc);
|
|
130
|
+
--u-color-on-accent: light-dark(#ffffff, #1e1b4b);
|
|
131
|
+
|
|
132
|
+
--u-chart-1: light-dark(#4338ca, #818cf8);
|
|
133
|
+
--u-chart-2: light-dark(#db2777, #f472b6);
|
|
134
|
+
--u-chart-3: light-dark(#059669, #34d399);
|
|
135
|
+
--u-chart-4: light-dark(#d97706, #fbbf24);
|
|
136
|
+
--u-chart-5: light-dark(#0891b2, #22d3ee);
|
|
137
|
+
--u-chart-6: light-dark(#7c3aed, #a78bfa);
|
|
72
138
|
}
|
|
73
139
|
```
|
|
74
140
|
|
|
141
|
+
A brand may also change the neutrals, the radius, `--u-transform-caps` with
|
|
142
|
+
`--u-tracking-caps`, `--u-button-press-scale`, `--u-label-size` and the modal
|
|
143
|
+
widths; the Theming page's table lists every token.
|
|
144
|
+
|
|
145
|
+
**Denser or roomier.** An application sets the type steps, the spaces and the
|
|
146
|
+
small control heights. A table and a calculation follow them, and the
|
|
147
|
+
provider's `density` chooses regular or compact on top.
|
|
148
|
+
|
|
149
|
+
**Layered CSS of your own.** The order of the layers decides who wins, so
|
|
150
|
+
declare it before anything else is read.
|
|
151
|
+
|
|
152
|
+
- Tailwind v4: this line as the first CSS the page reads, before
|
|
153
|
+
`@import "tailwindcss"`. Utilities then win over umriss, and Tailwind's
|
|
154
|
+
preflight stays below it.
|
|
155
|
+
|
|
156
|
+
```css
|
|
157
|
+
@layer theme, base, umriss.tokens, umriss.base, umriss.components, components, utilities;
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
- A wrapper library: this line as the first statement of its stylesheet,
|
|
161
|
+
with its own layer in place of `acme`. It holds in either load order.
|
|
162
|
+
|
|
163
|
+
```css
|
|
164
|
+
@layer umriss.tokens, umriss.base, umriss.components, acme;
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
Unlayered CSS always wins. A classic unlayered reset (Bootstrap and the like) is
|
|
168
|
+
not fixed by layer order.
|
|
169
|
+
|
|
75
170
|
**Light and dark follow the application's `color-scheme`.** Every token with
|
|
76
171
|
two values is written `light-dark(<light>, <dark>)`. An application that
|
|
77
172
|
switches its mode with a theme library usually sets `color-scheme` already;
|
|
@@ -104,6 +199,108 @@ token away.
|
|
|
104
199
|
older nowhere; an older browser discards the tokens and shows the interface
|
|
105
200
|
unstyled.
|
|
106
201
|
|
|
202
|
+
## Testing
|
|
203
|
+
|
|
204
|
+
Tested: Vitest 5 and Jest 30 (with babel-jest), both on jsdom. happy-dom and Jest 29 may work and are
|
|
205
|
+
not promised. `check:dist` runs a test of the installed package in a Vitest project and a Jest project
|
|
206
|
+
that hold exactly the files below.
|
|
207
|
+
|
|
208
|
+
**Vitest** needs one line, `server.deps.inline`: Vitest hands a dependency to Node, and Node cannot
|
|
209
|
+
import the stylesheet that the package's JavaScript imports (`Unknown file extension ".css"`). Inlined,
|
|
210
|
+
Vitest's own pipeline handles it.
|
|
211
|
+
|
|
212
|
+
```ts vitest.config.ts
|
|
213
|
+
import { defineConfig } from "vitest/config";
|
|
214
|
+
|
|
215
|
+
export default defineConfig({
|
|
216
|
+
test: {
|
|
217
|
+
environment: "jsdom",
|
|
218
|
+
globals: true,
|
|
219
|
+
setupFiles: ["./umriss.setup.js"],
|
|
220
|
+
server: { deps: { inline: [/@umriss-ui/] } },
|
|
221
|
+
},
|
|
222
|
+
});
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
**Jest** needs two settings: `moduleNameMapper` maps every stylesheet to an empty module, and
|
|
226
|
+
`transformIgnorePatterns` lets babel-jest compile the package, which ships ES modules. Babel's config
|
|
227
|
+
must apply to `node_modules`, so it is a root `babel.config.*`, not a `.babelrc`.
|
|
228
|
+
|
|
229
|
+
```js jest.config.cjs
|
|
230
|
+
module.exports = {
|
|
231
|
+
testEnvironment: "jsdom",
|
|
232
|
+
setupFilesAfterEnv: ["<rootDir>/umriss.setup.js"],
|
|
233
|
+
moduleNameMapper: { "\\.css$": "<rootDir>/css-stub.cjs" },
|
|
234
|
+
transformIgnorePatterns: ["/node_modules/(?!(@umriss-ui)/)"],
|
|
235
|
+
};
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
```js css-stub.cjs
|
|
239
|
+
module.exports = {};
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
```js babel.config.cjs
|
|
243
|
+
module.exports = {
|
|
244
|
+
presets: [
|
|
245
|
+
["@babel/preset-env", { targets: { node: "current" } }],
|
|
246
|
+
["@babel/preset-react", { runtime: "automatic" }],
|
|
247
|
+
],
|
|
248
|
+
};
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
**Next.js** with `next/jest`: put the umriss packages in `transpilePackages`; the preset stubs the
|
|
252
|
+
stylesheets and compiles the packages itself.
|
|
253
|
+
|
|
254
|
+
**The setup file** gives jsdom the five browser APIs that core's components use. It is the same file
|
|
255
|
+
for both runners:
|
|
256
|
+
|
|
257
|
+
```js umriss.setup.js
|
|
258
|
+
globalThis.ResizeObserver ??= class {
|
|
259
|
+
observe() {}
|
|
260
|
+
unobserve() {}
|
|
261
|
+
disconnect() {}
|
|
262
|
+
};
|
|
263
|
+
|
|
264
|
+
globalThis.IntersectionObserver ??= class {
|
|
265
|
+
observe() {}
|
|
266
|
+
unobserve() {}
|
|
267
|
+
disconnect() {}
|
|
268
|
+
takeRecords() {
|
|
269
|
+
return [];
|
|
270
|
+
}
|
|
271
|
+
};
|
|
272
|
+
|
|
273
|
+
window.matchMedia ??= (query) => ({
|
|
274
|
+
matches: false,
|
|
275
|
+
media: query,
|
|
276
|
+
onchange: null,
|
|
277
|
+
addEventListener() {},
|
|
278
|
+
removeEventListener() {},
|
|
279
|
+
addListener() {},
|
|
280
|
+
removeListener() {},
|
|
281
|
+
dispatchEvent: () => false,
|
|
282
|
+
});
|
|
283
|
+
|
|
284
|
+
Element.prototype.scrollIntoView ??= function () {};
|
|
285
|
+
|
|
286
|
+
/* jsdom knows <dialog> but not showModal() and close(). */
|
|
287
|
+
HTMLDialogElement.prototype.showModal ??= function () {
|
|
288
|
+
this.setAttribute("open", "");
|
|
289
|
+
};
|
|
290
|
+
HTMLDialogElement.prototype.close ??= function (value) {
|
|
291
|
+
if (!this.hasAttribute("open")) return;
|
|
292
|
+
this.removeAttribute("open");
|
|
293
|
+
if (value !== undefined) this.returnValue = value;
|
|
294
|
+
this.dispatchEvent(new Event("close"));
|
|
295
|
+
};
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
**End-to-end suites.** The motion follows `prefers-reduced-motion`, so a Playwright suite turns it off
|
|
299
|
+
with `reducedMotion: 'reduce'` in `use`. A tool without that switch sets, on `:root`, the tokens the
|
|
300
|
+
reduced-motion block sets to `0ms`: `--u-transition`, `--u-duration-press`, `--u-duration-fast`,
|
|
301
|
+
`--u-duration-medium`, `--u-duration-draw`, `--u-delay-draw`, `--u-duration-exit-fast`,
|
|
302
|
+
`--u-duration-exit` and `--u-duration-exit-collapse`.
|
|
303
|
+
|
|
107
304
|
## Wording
|
|
108
305
|
|
|
109
306
|
English is the default wording. German ships as well, as the subpath export
|
|
@@ -197,23 +394,32 @@ The table is not part of this package. It lives in
|
|
|
197
394
|
|
|
198
395
|
## Principles for new components
|
|
199
396
|
|
|
200
|
-
1.
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
397
|
+
1. Every component has one of four shapes (ADR-0068), and `ref` is always an
|
|
398
|
+
element - never a handle. The other packages follow the same contract.
|
|
399
|
+
- **An element**: `ref`, `className`, `style` and the rest reach the root
|
|
400
|
+
element. Most of core: `Button`, `Card`, `Stack`, `Stat`, `TreeView` (its
|
|
401
|
+
`role="tree"` list), the `<dialog>` of `Modal`, `Drawer`, `ConfirmDialog`
|
|
402
|
+
and `CommandPalette`, and the rest that render a root.
|
|
403
|
+
- **A field**: the class and the style reach the wrapper, which a caller
|
|
404
|
+
dresses and sizes (ADR-0041); `ref` and the rest reach the control that
|
|
405
|
+
takes the focus. In core: `Checkbox`, `Switch`, `Slider`, `NumberInput`,
|
|
406
|
+
`Select`, `FileInput`, `Input`, `Textarea` and `TreeSearch` (the native
|
|
407
|
+
control), `Combobox` (its input), and `MultiSelect`, `DatePicker`,
|
|
408
|
+
`DateTimePicker`, `DateRangePicker` and `DateTimeRangePicker` (the trigger
|
|
409
|
+
button). So `data-testid` on a `Combobox` finds the input, and a
|
|
410
|
+
`<label htmlFor>` names a picker. `SplitButton` keeps its class on the
|
|
411
|
+
group and its style and rest on the main action.
|
|
412
|
+
- **A composite** - a frame that holds several parts, with the name routed to
|
|
413
|
+
the part that carries the role: core has none; the table, the chart, the
|
|
414
|
+
schedule and the calculation are the ones.
|
|
415
|
+
- **No element of its own**, each with its reason: `Popover` renders into a
|
|
416
|
+
portal, `Tooltip` wraps the caller's child, `Menu` and `ContextMenu` are
|
|
417
|
+
composed of other parts, `ToastProvider` is a context with a portal, and the
|
|
418
|
+
providers render no element at all.
|
|
419
|
+
|
|
420
|
+
The component's own `role`, the `aria-*` it computes and its handlers are not
|
|
421
|
+
replaced by `rest`: a caller's handler runs first and can `preventDefault`.
|
|
422
|
+
Held by `tests-unit/passthrough.test.tsx`, which renders every export.
|
|
217
423
|
2. Support controlled **and** uncontrolled use (`value`/`defaultValue`).
|
|
218
424
|
Deliberately controlled only: `Combobox` and `MultiSelect` – the field keeps
|
|
219
425
|
no second state beside the caller's – as well as `Modal`, `Drawer` and
|
|
@@ -225,9 +431,9 @@ The table is not part of this package. It lives in
|
|
|
225
431
|
selector reaches beyond the component's own elements, and every rule lies in
|
|
226
432
|
a layer (ADR-0021; the guards in `tests-unit/stylesheets.test.ts` hold it).
|
|
227
433
|
6. Everything is English – identifiers, props and prose (ADR-0018, which
|
|
228
|
-
reversed ADR-0015).
|
|
229
|
-
|
|
230
|
-
|
|
434
|
+
reversed ADR-0015). The accessible name is spelled `aria-label` everywhere
|
|
435
|
+
(ADR-0068). `ariaLabel` on `TreeView`, `Popover` and `ContextMenu` is a
|
|
436
|
+
deprecated alias for one further minor.
|
|
231
437
|
7. A field's root composes `extent` from `#own-styles`: it fills the place
|
|
232
438
|
that gives it a width, is its natural width where the place asks, and is
|
|
233
439
|
never wider than its place; what it shows never moves it (ADR-0041). A field
|
|
@@ -247,7 +453,8 @@ The table is not part of this package. It lives in
|
|
|
247
453
|
The core scope is complete, and so are the command palette, the
|
|
248
454
|
danger text tone, the pass-through of rules 1 and 2 above, the six basic
|
|
249
455
|
components and the layout extras, forced colours, the listbox
|
|
250
|
-
announcements,
|
|
456
|
+
announcements, the fields' widths and sizes (ADR-0041), the four shapes of a
|
|
457
|
+
root (ADR-0068) and the targets under a finger (ADR-0070).
|
|
251
458
|
|
|
252
459
|
What core will not build at all stands in
|
|
253
460
|
[ADR-0032](../../docs/adr/0032-what-umriss-is-not.md). Validation is the
|