@jonmilner/ui 0.16.1 → 0.18.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/dist/Badge/Badge.css +1 -1
- package/dist/Badge/Badge.css.mjs +6 -9
- package/dist/Badge/index.mjs +11 -4
- package/dist/Button/Button.css +1 -1
- package/dist/Button/Button.css.mjs +1 -1
- package/dist/Button/index.d.mts +2 -1
- package/dist/Button/index.mjs +21 -21
- package/dist/Checkbox/Checkbox.css +1 -1
- package/dist/ColorField/ColorField.css +1 -1
- package/dist/Combobox/Combobox.css +1 -1
- package/dist/IconButton/IconButton.css +1 -1
- package/dist/IconButton/IconButton.css.mjs +2 -2
- package/dist/IconButton/index.d.mts +1 -1
- package/dist/IconButton/index.mjs +5 -4
- package/dist/Menu/client.d.mts +1 -0
- package/dist/Menu/index.mjs +2 -2
- package/dist/MultiSelect/MultiSelect.css +1 -1
- package/dist/NavList/index.mjs +1 -1
- package/dist/Select/Select.css +1 -1
- package/dist/Tag/Tag.css +1 -1
- package/dist/Tag/Tag.css.mjs +3 -3
- package/dist/Tag/index.mjs +9 -4
- package/dist/Toast/client.mjs +1 -1
- package/dist/Tooltip/base.mjs +1 -1
- package/dist/base.css +1 -1
- package/dist/contrast/contrast.d.mts +1 -1
- package/dist/contrast/contrast.mjs +3 -2
- package/dist/contrast/mixes.mjs +32 -22
- package/dist/docs/AlertDialog.md +1 -0
- package/dist/docs/Badge.md +2 -2
- package/dist/docs/Button.md +10 -8
- package/dist/docs/Dialog.md +3 -1
- package/dist/docs/IconButton.md +5 -5
- package/dist/docs/Menu.md +3 -2
- package/dist/docs/NavList.md +1 -1
- package/dist/docs/Tag.md +2 -2
- package/dist/docs/Tooltip.md +5 -4
- package/dist/docs/llms.txt +3 -3
- package/dist/docs/manifest.json +35 -3
- package/dist/docs/migrations/0.17.0.md +47 -0
- package/dist/docs/migrations/0.18.0.md +65 -0
- package/dist/docs/theming.md +4 -0
- package/dist/popup/client.d.mts +1 -1
- package/dist/popup/client.mjs +6 -5
- package/dist/popup/listbox-row.mjs +1 -1
- package/dist/styles/atoms.css +1 -1
- package/dist/styles/atoms.css.d.mts +1 -1
- package/dist/styles/atoms.css.mjs +30 -29
- package/dist/styles/button-fills.mjs +1 -1
- package/dist/theme/define-theme.mjs +1 -1
- package/dist/tokens/contract.d.mts +1 -0
- package/dist/tokens/scales.d.mts +1 -0
- package/dist/tokens/scales.mjs +2 -1
- package/package.json +1 -1
package/dist/contrast/mixes.mjs
CHANGED
|
@@ -1,31 +1,41 @@
|
|
|
1
1
|
import { fills as e } from "../styles/button-fills.mjs";
|
|
2
2
|
import { subtleFills as t } from "../styles/subtle-fills.mjs";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
3
|
+
import { overlayRoles as n } from "../tokens/roles.mjs";
|
|
4
|
+
import { contrastRatio as r, surfaces as i } from "./contrast.mjs";
|
|
5
|
+
import { highlightFill as a, highlightText as o } from "../styles/highlight.mjs";
|
|
6
|
+
import { hoverFill as s } from "../styles/hover-tint.mjs";
|
|
6
7
|
// src/contrast/mixes.ts
|
|
7
|
-
var
|
|
8
|
+
var c = (e) => n.includes(e), l = [
|
|
8
9
|
{
|
|
9
10
|
name: "Menu highlight",
|
|
10
|
-
fill:
|
|
11
|
-
text:
|
|
11
|
+
fill: a,
|
|
12
|
+
text: o,
|
|
12
13
|
min: 4.5
|
|
13
14
|
},
|
|
14
|
-
...Object.entries(e).flatMap(([e, { backgroundColor: t, color: n }]) =>
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
...Object.entries(e).flatMap(([e, { backgroundColor: t, color: n }]) => {
|
|
16
|
+
let r = [n];
|
|
17
|
+
return t && !c(t) ? [{
|
|
18
|
+
name: `${e} Button hover`,
|
|
19
|
+
fill: (e) => s(e.fg, e[t]),
|
|
20
|
+
text: r,
|
|
21
|
+
min: 4.5
|
|
22
|
+
}] : i.map((n) => ({
|
|
23
|
+
name: `${e} Button hover on ${n}`,
|
|
24
|
+
fill: (e) => s(e.fg, e[t ?? n]),
|
|
25
|
+
...t && { over: n },
|
|
26
|
+
text: r,
|
|
27
|
+
min: 4.5
|
|
28
|
+
}));
|
|
29
|
+
}),
|
|
20
30
|
{
|
|
21
31
|
name: "pressed Chip hover",
|
|
22
|
-
fill: (e) =>
|
|
32
|
+
fill: (e) => s(e.fg, e.accent),
|
|
23
33
|
text: ["accentFg"],
|
|
24
34
|
min: 4.5
|
|
25
35
|
},
|
|
26
|
-
...
|
|
36
|
+
...i.map((e) => ({
|
|
27
37
|
name: `Table row hover on ${e}`,
|
|
28
|
-
fill: (t) =>
|
|
38
|
+
fill: (t) => s(t.fg, t[e], "5%"),
|
|
29
39
|
text: e === "bgMuted" || e === "bgPanel" ? ["fg", "fgMuted"] : [
|
|
30
40
|
"fg",
|
|
31
41
|
"fgMuted",
|
|
@@ -39,19 +49,19 @@ var s = [
|
|
|
39
49
|
})),
|
|
40
50
|
...Object.entries(t).map(([e, { backgroundColor: t, color: n }]) => ({
|
|
41
51
|
name: `${e} Table row hover`,
|
|
42
|
-
fill: (e) =>
|
|
52
|
+
fill: (e) => s(e.fg, e[t], "5%"),
|
|
43
53
|
text: [n],
|
|
44
54
|
min: 4.5
|
|
45
55
|
}))
|
|
46
56
|
];
|
|
47
|
-
function
|
|
48
|
-
return ["light", "dark"].flatMap((t) =>
|
|
49
|
-
let
|
|
57
|
+
function u(e) {
|
|
58
|
+
return ["light", "dark"].flatMap((t) => l.flatMap(({ name: n, fill: i, text: a, min: o, over: s }) => {
|
|
59
|
+
let c = i(e.color), l = s && e.color[s];
|
|
50
60
|
return a.flatMap((i) => {
|
|
51
|
-
let a =
|
|
61
|
+
let a = r(e.color[i], c, t, l);
|
|
52
62
|
return a < o ? [{
|
|
53
63
|
fg: i,
|
|
54
|
-
mix:
|
|
64
|
+
mix: n,
|
|
55
65
|
min: o,
|
|
56
66
|
mode: t,
|
|
57
67
|
ratio: a
|
|
@@ -59,4 +69,4 @@ function c(e) {
|
|
|
59
69
|
});
|
|
60
70
|
}));
|
|
61
71
|
}
|
|
62
|
-
export {
|
|
72
|
+
export { u as checkMixes, l as contrastMixes };
|
package/dist/docs/AlertDialog.md
CHANGED
|
@@ -109,6 +109,7 @@ Generated from the TypeScript types.
|
|
|
109
109
|
| `id` | `string` | no | ID of the trigger. In addition to being forwarded to the rendered element, it is also used to specify the active trigger for the dialog in controlled mode (with the DialogRoot `triggerId` prop). |
|
|
110
110
|
| `payload` | `unknown` | no | A payload to pass to the dialog when it is opened. |
|
|
111
111
|
| `size` | `"lg" \| "med" \| "sm"` | no | |
|
|
112
|
+
| `uppercase` | `boolean` | no | |
|
|
112
113
|
| `variant` | `"ghost" \| "primary" \| "secondary"` | no | |
|
|
113
114
|
|
|
114
115
|
Also accepts the style props (see `manifest.json` `styleProps`).
|
package/dist/docs/Badge.md
CHANGED
|
@@ -23,7 +23,7 @@ A static label that states the status of, or a short fact about, the thing besid
|
|
|
23
23
|
|
|
24
24
|
- `variant`: `neutral` (default, `fgMuted` on `bgMuted`) for most statuses and facts; `accent` (`accentFg` on `accent`) to draw the eye; `success` (`successFg` on `success`) for a passing or healthy state; `warning` (`warningFg` on `warning`) for one that needs attention soon; `danger` (`dangerFg` on `danger`) for a failure or a blocked state; `done` (`doneFg` on `done`, violet) for finished work, such as a merged PR or a closed issue.
|
|
25
25
|
- `subtle`: `false` (default) is the solid fill above; `true` swaps it for the variant's tint, `<variant>SubtleFg` on `<variant>Subtle` (`neutralSubtleFg` on `neutralSubtle` and so on). Use subtle where many badges sit together, such as a list or a board, so each one stays calm and the color still means one thing; keep solid for the one status that should stand out.
|
|
26
|
-
- `size`: `xs`, `sm` or `med` (default),
|
|
26
|
+
- `size`: `xs`, `sm` or `med` (default). `xs` and `sm` set meta text, a 12/16 medium label with 6px inline padding (ADR 0157, 0164); `xs` has 2px block padding and `sm` 4px, so `xs` is the shorter pill. `med` is a 16px label, 8px by 6px. Use `xs` in dense rows and narrow table cells, such as a board column of status pills; `sm` beside meta text, such as counts and timestamps; `med` elsewhere. 12px is the smallest readable label.
|
|
27
27
|
- The label states the state. Color is never the only cue (WCAG 1.4.1): under forced colors every variant, `success` and `warning` included, is the same outlined box, and some readers cannot tell the fills apart (green from red above all). Write "Failed" or "Passed", not a red or green badge reading "3".
|
|
28
28
|
- `iconStart` and `iconEnd` take an icon component (a generated `GitMergeIcon` from `@jonmilner/ui/icons`, or a component that renders `Icon`), not an element. Badge renders it inline in the label at the badge's text step, spaced from the words and centred on their cap height, so the badge keeps the height it has without one (ADR 0044, 0152). The icons are decorative (`aria-hidden`); the label states the state. Do not put an `Icon` in the children: it renders as a block and breaks the line.
|
|
29
29
|
- Keep it to one or two words; it never wraps. A cap, `maxInlineSize` as the style prop or in `style` (Tag's rule: a step, `full`, or a `style` length), cuts the label to one line with an ellipsis; the end icon stays in view after it. A badge has no hover or focus, so a cut label never shows its whole text: cap one only where the full text is also elsewhere. With no children it renders nothing.
|
|
@@ -61,7 +61,7 @@ A static label that states the status of, or a short fact about, the thing besid
|
|
|
61
61
|
```
|
|
62
62
|
|
|
63
63
|
```tsx
|
|
64
|
-
// A narrow board column or table cell: xs is the
|
|
64
|
+
// A narrow board column or table cell: xs is the shorter pill, 12px with 2px block padding.
|
|
65
65
|
<Badge size="xs" subtle variant="warning">
|
|
66
66
|
Changes requested
|
|
67
67
|
</Badge>
|
package/dist/docs/Button.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
## Purpose
|
|
4
4
|
|
|
5
|
-
The labelled action: a `<button type="button">` with the house look, or a link styled as one with `as="a"` (or a router's link). Four variants (`primary`, `secondary`, `ghost`, `danger`), three sizes (`sm`, `med`, `lg`, 24, 32 and 40 px high, ADR 0124), a `loading` state that keeps its width, and icon slots before and after the label. It
|
|
5
|
+
The labelled action: a `<button type="button">` with the house look, or a link styled as one with `as="a"` (or a router's link). Four variants (`primary`, `secondary`, `ghost`, `danger`), three sizes (`sm`, `med`, `lg`, 24, 32 and 40 px high, ADR 0124), a `loading` state that keeps its width, and icon slots before and after the label. It takes the control radius (`sm`, 6px, ADR 0162) and a sentence-case label at weight 500; only `primary` glows, softly in its fill (ADR 0131, 0163). It is built on `Clickable`, so it has the shared focus ring, the 24px minimum target and `aria-disabled` / `aria-busy` states that block activation while the button stays focusable.
|
|
6
6
|
|
|
7
7
|
## When to use
|
|
8
8
|
|
|
@@ -19,17 +19,18 @@ The labelled action: a `<button type="button">` with the house look, or a link s
|
|
|
19
19
|
## Rules
|
|
20
20
|
|
|
21
21
|
- `primary` marks the one action a view or dialog exists for; everything else is `secondary`, the default. One primary per group. Its fill is `accentFill` with `accentFillFg` text (ADR 0119): light text on a solid accent in both modes, 4.5:1 at rest and on hover.
|
|
22
|
-
- `secondary` is
|
|
22
|
+
- `secondary` is the quiet look: the `controlFill` overlay (`fg` at 5% over whatever surface is below) with `fg` text inside a 1px `border`, and no glow. It reads on `bg`, `bgMuted`, `bgRaised` and `bgPanel` alike.
|
|
23
23
|
- `ghost` is the tertiary action: no fill, no border, no glow, only the hover tint. Use it beside a `secondary` for the least important action ("Skip", "Clear"), or inside another control that already frames it. Its text sits on the surface behind it, so place it on `bg`, `bgMuted` or `bgRaised`.
|
|
24
|
-
- `danger` (`dangerFg` on `danger`, ADR 0060) replaces `primary` when that action destroys data or cannot be undone, such as a confirm dialog's "Delete project". It takes `primary`'s place, so a group has one `primary` or one `danger`, not both. The label names the consequence ("Delete project", not "OK"): under forced colors `danger` looks like `primary`, so the word carries the meaning, not the color. Confirm before an irreversible action runs; `danger` does not.
|
|
24
|
+
- `danger` (`dangerFg` on `danger`, ADR 0060), with no glow, replaces `primary` when that action destroys data or cannot be undone, such as a confirm dialog's "Delete project". It takes `primary`'s place, so a group has one `primary` or one `danger`, not both. The label names the consequence ("Delete project", not "OK"): under forced colors `danger` looks like `primary`, so the word carries the meaning, not the color. Confirm before an irreversible action runs; `danger` does not.
|
|
25
25
|
- Sizes are `sm`, `med` (default) and `lg`, never `md`. `sm`, `med` and `lg` are 24, 32 and 40px high; the label and the icons take the `fontSize` step one below the `size` (`xs`, `sm`, `med`: 12, 14 and 16px).
|
|
26
26
|
- `loading` renders `aria-busy="true"`, blocks clicks, Enter and Space, and swaps the label for three pulsing dots in the same space: the width never changes, and the label stays the accessible name. A label narrower than the dots (one character, such as a page number) widens by a few pixels; give such buttons a fixed `minInlineSize`. Announce the outcome elsewhere (a toast or a status message); `aria-busy` alone is not announced.
|
|
27
27
|
- `disabled` renders `aria-disabled="true"` and a dashed border, never the native `disabled`: the button stays focusable and announced. Say why it is disabled nearby when it is not obvious.
|
|
28
28
|
- `iconStart` and `iconEnd` take an icon component (a generated `ArrowRightIcon`, or a component that renders `Icon`), not an element: Button renders it at its text size. The icons are decorative; the label names the button.
|
|
29
|
-
- Children are the label, rendered inside
|
|
30
|
-
-
|
|
31
|
-
-
|
|
32
|
-
-
|
|
29
|
+
- Children are the label, rendered inside `Text` at weight 500 (`medium`); pass a string in sentence case, not your own `Text` or `Icon`.
|
|
30
|
+
- `uppercase` opts into an uppercase label, cased in CSS only: the DOM text, and so Testing Library queries such as `getByRole`, keep the source case. Chromium's accessibility tree exposes the uppercase text, so a screen reader there may spell out a short label such as "OK"; prefer a word. The default is sentence case (ADR 0163).
|
|
31
|
+
- Fill (`backgroundColor`), text color (`color`), height (`minBlockSize`), `paddingBlock` (which keeps a wrapped label off the border), `paddingInline`, `borderRadius` (`sm`) and `gap` (between icons and label) are default style props: pass one to change it. Hover tints whatever the fill is (not under forced colors, where hover keeps only the pointer cue); the disabled look is component CSS keyed off `aria-disabled`, so it wins over a custom fill. A custom fill needs a text color that passes 4.5:1 on it.
|
|
32
|
+
- `primary`'s glow is soft at rest and stronger on hover, on keyboard focus and while open; a disabled button has none. It is a `box-shadow` below the style props, so a `boxShadow` prop replaces it. The other variants have none.
|
|
33
|
+
- With `aria-expanded="true"` (a Menu or Dialog trigger while its popup is open, or your own disclosure button), a live button holds the hover tint and draws a 1px inset ring in its text color, inside `primary`'s strong glow: a shape cue, kept under forced colors, that takes no layout space (ADR 0063). While open, the ring (and `primary`'s glow) replace a custom `boxShadow`.
|
|
33
34
|
- `type="submit"` for a form's submit button; otherwise it is `type="button"`.
|
|
34
35
|
- Server-safe: Button has no hooks; `Clickable` inside it is the client boundary.
|
|
35
36
|
|
|
@@ -77,7 +78,7 @@ The labelled action: a `<button type="button">` with the house look, or a link s
|
|
|
77
78
|
|
|
78
79
|
- A button that goes somewhere is a link (`as="a"` with `href`); one that does something is a button.
|
|
79
80
|
- Disabled and loading buttons stay in the tab order, so keyboard and screen reader users find them; Enter and Space do nothing while either is set. The blocked click still bubbles to an ancestor's `onClick` (see Clickable's Rules).
|
|
80
|
-
- State is never color alone: disabled adds a dashed border, loading shows the dots. Under forced colors the button keeps its system colors (`LinkText` fill for `primary` and `danger`, a `
|
|
81
|
+
- State is never color alone: disabled adds a dashed border, loading shows the dots. Under forced colors the button keeps its system colors (`LinkText` fill for `primary` and `danger`, a `ButtonFace` fill with `ButtonText` text and a `CanvasText` border for `secondary`, a `CanvasText` border for `ghost`) and a disabled one is `GrayText`. Hover draws no tint and `primary`'s glow is gone there, so the system pairs keep their contrast.
|
|
81
82
|
- Under reduced motion the dots hold still.
|
|
82
83
|
- Text on every variant passes 4.5:1 at rest and on hover in light and dark modes.
|
|
83
84
|
|
|
@@ -96,6 +97,7 @@ Generated from the TypeScript types.
|
|
|
96
97
|
| `iconStart` | `ComponentType` | no | |
|
|
97
98
|
| `loading` | `boolean` | no | |
|
|
98
99
|
| `size` | `"lg" \| "med" \| "sm"` | no | |
|
|
100
|
+
| `uppercase` | `boolean` | no | |
|
|
99
101
|
| `variant` | `"danger" \| "ghost" \| "primary" \| "secondary"` | no | |
|
|
100
102
|
|
|
101
103
|
Also accepts every `<button>` attribute (change the element with `as`) and the style props (see `manifest.json` `styleProps`).
|
package/dist/docs/Dialog.md
CHANGED
|
@@ -24,7 +24,7 @@ A modal panel over the page for one short task: edit a name, fill a small form,
|
|
|
24
24
|
- `size` (`sm`, `med`, `lg`; `med` by default) sets the width, 384, 512 or 640 px at the default font size; the panel never gets wider than the viewport less a 16 px edge.
|
|
25
25
|
- Put the content in `Dialog.Body`. When the dialog outgrows the viewport the whole popup scrolls; keep the content short so the actions stay close.
|
|
26
26
|
- `Dialog.Actions` end-aligns its buttons and wraps them on a narrow screen. Put `Dialog.Close` first, then one primary `Button`. A dialog with no buttons still closes on Esc and the backdrop, but give it a `Dialog.Close` so a pointer user sees the way out.
|
|
27
|
-
- `Dialog.Trigger` and `Dialog.Close` are bare `Clickable`s. Pass Button's `variant`, `size`, `iconStart` or `
|
|
27
|
+
- `Dialog.Trigger` and `Dialog.Close` are bare `Clickable`s. Pass Button's `variant`, `size`, `iconStart`, `iconEnd` or `uppercase` for a button look (`variant="secondary"` on Close); they render a `Button` with its fill, border and height, and keep the part's behavior and `aria-disabled`. Without them, style them with style props and give them an accessible name.
|
|
28
28
|
- `disabled` on the trigger keeps it focusable and announced, and stops it opening.
|
|
29
29
|
- Control it with `open` and `onOpenChange` to close it after a save or keep it open on an error. `onOpenChangeComplete` runs once the exit transition ends.
|
|
30
30
|
- The popup portals into the trigger's nearest `ThemeProvider`, so it keeps the brand and mode. That provider must not clip or stack its content: wrap the app root, and keep a nested provider off elements with `overflow: hidden`, a `transform` or their own `z-index`. It sits on `zIndex` `modal`. A dialog opened only through `open`, with no `Dialog.Trigger`, has no provider to find and portals to `<body>`.
|
|
@@ -136,6 +136,7 @@ Also accepts the style props (see `manifest.json` `styleProps`).
|
|
|
136
136
|
| `iconEnd` | `ComponentType` | no | |
|
|
137
137
|
| `iconStart` | `ComponentType` | no | |
|
|
138
138
|
| `size` | `"lg" \| "med" \| "sm"` | no | |
|
|
139
|
+
| `uppercase` | `boolean` | no | |
|
|
139
140
|
| `variant` | `"ghost" \| "primary" \| "secondary"` | no | |
|
|
140
141
|
|
|
141
142
|
Also accepts the style props (see `manifest.json` `styleProps`).
|
|
@@ -162,6 +163,7 @@ Also accepts the style props (see `manifest.json` `styleProps`).
|
|
|
162
163
|
| `id` | `string` | no | ID of the trigger. In addition to being forwarded to the rendered element, it is also used to specify the active trigger for the dialog in controlled mode (with the DialogRoot `triggerId` prop). |
|
|
163
164
|
| `payload` | `unknown` | no | A payload to pass to the dialog when it is opened. |
|
|
164
165
|
| `size` | `"lg" \| "med" \| "sm"` | no | |
|
|
166
|
+
| `uppercase` | `boolean` | no | |
|
|
165
167
|
| `variant` | `"ghost" \| "primary" \| "secondary"` | no | |
|
|
166
168
|
|
|
167
169
|
Also accepts the style props (see `manifest.json` `styleProps`).
|
package/dist/docs/IconButton.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
## Purpose
|
|
4
4
|
|
|
5
|
-
A compact button whose only visible content is an icon, for an action the icon makes plain: close, edit, refresh. A required `label` names it for assistive technology (`aria-label`); the icon is decorative. It is a `<button type="button">` on `Clickable`, so it has the shared focus ring, the 24px minimum target and `aria-disabled` that blocks activation while the button stays focusable. Three variants from Button's fills (`
|
|
5
|
+
A compact button whose only visible content is an icon, for an action the icon makes plain: close, edit, refresh. A required `label` names it for assistive technology (`aria-label`); the icon is decorative. It is a `<button type="button">` on `Clickable`, so it has the shared focus ring, the 24px minimum target and `aria-disabled` that blocks activation while the button stays focusable. Three variants from Button's fills (`ghost`, the default, `secondary` and `primary`), each a square at the control radius (`sm`, 6px, ADR 0162), with Button's glow on `primary` only (ADR 0131, 0163), and three sizes at Button's heights (`sm`, `med`, `lg`: 24, 32 and 40 px, ADR 0124).
|
|
6
6
|
|
|
7
7
|
## When to use
|
|
8
8
|
|
|
@@ -20,11 +20,11 @@ A compact button whose only visible content is an icon, for an action the icon m
|
|
|
20
20
|
|
|
21
21
|
- `label` is required and is the accessible name: say what the button does ("Close dialog", "Refresh results"), not what the icon shows ("X", "Arrows"). Never pass an empty string: the button would have no name. `aria-label`, `aria-labelledby` and children are not props; a raw one is ignored.
|
|
22
22
|
- `icon` takes an icon component (a generated `XIcon`, or a component that renders `Icon`), not an element: IconButton renders it at the `fontSize` step one below its `size` (12, 14 and 16px at `sm`, `med`, `lg`), as Button's icons, `aria-hidden`.
|
|
23
|
-
- `variant`: `
|
|
24
|
-
- `size`: `sm`, `med` (default) or `lg`, never `md`. Each is a
|
|
23
|
+
- `variant`: `ghost` (default), a muted ghost: no fill, border or glow, an `fgMuted` icon that turns `fg` on hover, keyboard focus and while open, for most icon actions, toolbars and controls that already frame it (SearchField's clear button). `secondary`, Button's quiet `controlFill` look, for an icon action that needs a visible frame; `primary` for the one action a view or dialog exists for. There is no `tone` and no `danger`: a destructive action deserves a labelled `Button` (ADR 0163).
|
|
24
|
+
- `size`: `sm`, `med` (default) or `lg`, never `md`. Each is a square as wide as Button's height of the same name (24, 32 and 40px), so an IconButton lines up with a Button beside it.
|
|
25
25
|
- `disabled` renders `aria-disabled="true"` and a dashed border, never the native `disabled`. There is no `loading` and no tooltip in v0.1.
|
|
26
26
|
- With `aria-expanded="true"`, as a Dialog trigger sets it, it holds the hover tint and an inset ring while the popup is open, as Button does.
|
|
27
|
-
- Fill (`backgroundColor`), text color (`color`), width (`minInlineSize`), height (`minBlockSize`) and `borderRadius` (`
|
|
27
|
+
- Fill (`backgroundColor`), text color (`color`), width (`minInlineSize`), height (`minBlockSize`) and `borderRadius` (`sm`) are default style props: pass one to change it. Change width and height together to keep the square. A `color` replaces the muted ghost's `fgMuted` and its `fg` on hover. `primary`'s glow gives way to a `boxShadow` prop, as on Button. Hover tints whatever the fill is; a custom fill needs an icon color that passes 3:1 on it (4.5:1 to match Button).
|
|
28
28
|
- `as="a"` with `href` for an icon-only link.
|
|
29
29
|
- Server-safe: IconButton has no hooks; `Clickable` inside it is the client boundary.
|
|
30
30
|
|
|
@@ -63,7 +63,7 @@ A compact button whose only visible content is an icon, for an action the icon m
|
|
|
63
63
|
- The `label` is announced as the button's name; the icon is hidden from assistive technology.
|
|
64
64
|
- The label is not shown on hover or focus. Sighted users who don't recognise the icon get no text, so keep IconButton to widely understood icons.
|
|
65
65
|
- A disabled IconButton stays in the tab order, and Enter and Space do nothing; the blocked click still bubbles to an ancestor's `onClick` (see Clickable's Rules). State is never color alone: disabled adds a dashed border.
|
|
66
|
-
- Every size is at least 24 by 24 CSS px (WCAG 2.2 target size); the icon on each variant passes 4.5:1 at rest and on hover in light and dark modes. Under forced colors it keeps Button's system colors, `ghost`'s `CanvasText` border included, and drops
|
|
66
|
+
- Every size is at least 24 by 24 CSS px (WCAG 2.2 target size); the icon on each variant passes 4.5:1 at rest and on hover in light and dark modes. Under forced colors it keeps Button's system colors, `ghost`'s `CanvasText` border included, and drops `primary`'s glow.
|
|
67
67
|
|
|
68
68
|
## Props
|
|
69
69
|
|
package/dist/docs/Menu.md
CHANGED
|
@@ -21,8 +21,8 @@ A list of actions that opens from a button: a row's "Edit, Duplicate, Delete", a
|
|
|
21
21
|
|
|
22
22
|
- Compose the parts: `Menu` > `Menu.Trigger` + `Menu.Popup` > `Menu.Item`, `Menu.LinkItem`, `Menu.Separator`, `Menu.Group`. `Menu` holds the open state and renders no element, so it takes no `className` or `style`; every other part does, plus style props.
|
|
23
23
|
- `Menu.Trigger` is a bare `Clickable`: give it its look with style props (or your own class), and an accessible name.
|
|
24
|
-
- For an icon-only trigger ("More actions"), pass `icon` and `label`: it renders an `IconButton`, the same square as one at each `size` (`sm`, `med`, `lg`; `med` by default), named by `label`, with IconButton's `variant` (`
|
|
25
|
-
- For a trigger that reads as a button ("Actions", "New"), pass Button's `variant`, `size`, `iconStart` or `
|
|
24
|
+
- For an icon-only trigger ("More actions"), pass `icon` and `label`: it renders an `IconButton`, the same square as one at each `size` (`sm`, `med`, `lg`; `med` by default), named by `label`, with IconButton's `variant` (the muted `ghost` by default, ADR 0163) and the open look below. It takes no children, `iconStart`, `iconEnd` or `aria-label` (ADR 0123). Never build one from `iconStart` and `aria-label`: Button's padding makes it wider than the IconButtons beside it.
|
|
25
|
+
- For a trigger that reads as a button ("Actions", "New"), pass Button's `variant`, `size`, `iconStart`, `iconEnd` or `uppercase` (a `ChevronDownIcon` for "Actions ▾"): it renders a `Button`, with its fill, border and height, and keeps the trigger's behavior and `aria-disabled`. While the menu is open it shows Button's open look, a held tint and an inset ring (ADR 0063); a bare trigger has none, so style it yourself off `aria-expanded`. Style props still override the defaults.
|
|
26
26
|
- `Menu.Item` runs its `onClick` on click, Enter and Space, then the menu closes. Pass `closeOnClick={false}` to keep it open.
|
|
27
27
|
- `Menu.LinkItem` is a real `<a role="menuitem">` for an entry that goes somewhere. `href` is required; `target`, `rel` and `download` pass through. Hover shows the URL, Cmd/Ctrl-click and middle-click open a new tab, and a click, Enter or Space follows it and closes the menu. Never navigate from a `Menu.Item`'s `onClick` (`location.assign`, a router's `navigate`): it loses all of that. Router-aware (client-side) links are not offered. It takes no `variant`.
|
|
28
28
|
- `variant="danger"` marks a destructive item. It still runs on one click, so open a confirm dialog from it (Cancel focused first) before anything irreversible happens.
|
|
@@ -250,6 +250,7 @@ Also accepts the style props (see `manifest.json` `styleProps`).
|
|
|
250
250
|
| `openOnHover` | `boolean` | no | Whether the menu should also open when the trigger is hovered. |
|
|
251
251
|
| `payload` | `unknown` | no | A payload to pass to the menu when it is opened. |
|
|
252
252
|
| `size` | `"lg" \| "med" \| "sm"` | no | |
|
|
253
|
+
| `uppercase` | `boolean` | no | |
|
|
253
254
|
| `variant` | `"ghost" \| "primary" \| "secondary"` | no | |
|
|
254
255
|
|
|
255
256
|
Also accepts the style props (see `manifest.json` `styleProps`).
|
package/dist/docs/NavList.md
CHANGED
|
@@ -29,7 +29,7 @@ A column of links to an app's pages, with the current page marked: a sidebar's o
|
|
|
29
29
|
- Inside a `Sidebar` rail (`collapsed`), group headings, labels and counts are visually hidden and each item is a 40px square around its icon or avatar, centered. Their text stays in the accessible names. Every item in a rail needs an icon or an avatar. In a SidebarLayout stacked below 48em a collapsed Sidebar is no rail: the items show open (ADR 0156). In the rail, hover or keyboard focus on an item shows its label and count in a tooltip past its inline end (right, or left right to left); Esc, blur and pointer leave close it, and the pointer can move onto it. Items in one NavList share the tooltip delay: once one has opened, the next opens at once. Outside a rail no tooltip shows (ADR 0159). The tooltip repeats the item's children, so keep them to text and a count: content with an `id` would repeat it.
|
|
30
30
|
- `count` is a trailing subtle `Badge` at `xs`. It is part of the link's accessible name, read after the label, so a bare number says nothing ("Issues 12"). Give it its meaning with `VisuallyHidden`: `count={<>12<VisuallyHidden> open issues</VisuallyHidden></>}`. A nullish or empty count renders nothing.
|
|
31
31
|
- Labels wrap onto a second line in a narrow column, breaking a long word if they must; they never truncate.
|
|
32
|
-
- Items are `sm` text in `fg`, with `6` block and `8` inline padding,
|
|
32
|
+
- Items are `sm` text in `fg`, with `6` block and `8` inline padding, an `xs` radius and at least the `xs` (24px) block size, as default style props; the consumer's win. Hover tints a non-current item where hover is real (`(hover: hover)`).
|
|
33
33
|
- A server component can render the whole list, router `Link` included. `NavList` and `NavList.Group` have no hooks; each `NavList.Item` renders its link inside a client part, the rail tooltip (ADR 0159).
|
|
34
34
|
|
|
35
35
|
## Do
|
package/dist/docs/Tag.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
## Purpose
|
|
4
4
|
|
|
5
|
-
A label that puts content in a category: a topic, a label, a user-made category. A `span` with a subtle tone fill (gray by default) and an `
|
|
5
|
+
A label that puts content in a category: a topic, a label, a user-made category. A `span` with a subtle tone fill (gray by default) and an `xs` (4px) radius (a small mark's step in `docs/shape.md`, so wrapped lines stay inside the fill) around a `Text` in the `label` font. It can be read-only, a link, or removable.
|
|
6
6
|
|
|
7
7
|
## When to use
|
|
8
8
|
|
|
@@ -20,7 +20,7 @@ A label that puts content in a category: a topic, a label, a user-made category.
|
|
|
20
20
|
|
|
21
21
|
## Rules
|
|
22
22
|
|
|
23
|
-
- `size`: `sm` or `med` (default),
|
|
23
|
+
- `size`: `sm` or `med` (default). `sm` sets meta text, a 12/16 medium label with 6px inline padding (ADR 0157, 0164), for dense lists and beside meta text; `med` is a 16px label with 8px inline padding. Both are 24px tall on one line.
|
|
24
24
|
- `iconStart` and `iconEnd` take an icon component (a generated `InboxIcon` from `@jonmilner/ui/icons`, or a component that renders `Icon`), not an element. Tag renders it inline in the label (inside the link, with `href`) at the label's text step, spaced from the words and centred on their cap height, so the tag keeps the height it has without one (ADR 0044, 0152). The icons are decorative (`aria-hidden`): they are not in the link's or the remove button's name. A truncated label keeps its end icon in view after the ellipsis.
|
|
25
25
|
- `variant`: the tone's subtle fill, `<variant>SubtleFg` on `<variant>Subtle`. `neutral` (default) for most categories; `accent`, `success`, `warning`, `danger` and `done` only where the category has a meaning those colors already carry in the app, as Badge's variants do. Tag has no solid fills: a category label stays calm (ADR 0121). The tone is never the only cue: the label names the category.
|
|
26
26
|
- Read-only is the default. `href` makes the label a link (a `Clickable` `<a>` around the text, underlined). The tag itself stays a `span`, so a remove button never nests in the link.
|
package/dist/docs/Tooltip.md
CHANGED
|
@@ -22,7 +22,7 @@ A short hint about a control that shows on hover after a delay and at once on ke
|
|
|
22
22
|
|
|
23
23
|
- Compose the parts: `Tooltip` > `Tooltip.Trigger` + `Tooltip.Popup`. `Tooltip` holds the open state (`open`, `defaultOpen`, `onOpenChange`, `disabled`) and renders no element, so it takes no `className` or `style`; the trigger and popup take both, plus style props.
|
|
24
24
|
- `disabled` on `Tooltip` switches the tooltip off: it never opens, and the trigger drops its `aria-describedby`, so a screen reader hears no description a sighted user cannot open.
|
|
25
|
-
- `Tooltip.Trigger` is a bare `Clickable`, a `<button>` around your content: style it with style props or your own class. A button holds only inline content, so give a `Text` in it `as="span"`. With Button's `variant`, `size`, `iconStart` or `
|
|
25
|
+
- `Tooltip.Trigger` is a bare `Clickable`, a `<button>` around your content: style it with style props or your own class. A button holds only inline content, so give a `Text` in it `as="span"`. With Button's `variant`, `size`, `iconStart`, `iconEnd` or `uppercase` it renders a `Button`. It needs its own accessible name (its text, or `aria-label`); the tooltip is its description, never its name.
|
|
26
26
|
- `disabled` on the trigger renders `aria-disabled`: it stays focusable and its tooltip still shows, so it can say why the control is disabled.
|
|
27
27
|
- `delay` (600ms by default) and `closeDelay` on the trigger change the hover timing. Focus always opens it at once.
|
|
28
28
|
- The trigger's `aria-describedby` names the popup first, then any you pass. The popup's `id` and `role` are the Tooltip's own, not props.
|
|
@@ -30,7 +30,7 @@ A short hint about a control that shows on hover after a delay and at once on ke
|
|
|
30
30
|
- Wrap a group of triggers (a toolbar, a row of status pills) in `Tooltip.Provider`: once one tooltip has opened, the next opens at once as the pointer moves along. Pass `delay` to the provider to change the group's.
|
|
31
31
|
- Children with a string or number among them (`{failed} of {total} checks failed`, a sentence with a `<strong>`) render in one `Text size="sm"`. Anything else renders as given: a lone `<strong>`, a fragment or a component that returns text needs its own `Text size="sm"`. For rows, pass `Stack` and `Inline` with `Text size="sm"` and no bare text; they are read as one description, so keep them few.
|
|
32
32
|
- `side` (`top` by default) and `align` (`center`) place the popup against the trigger; it flips when it would overflow the viewport, and never grows wider than the space beside the trigger.
|
|
33
|
-
- Fill (`backgroundColor`, `bgRaised`), `borderRadius` (`
|
|
33
|
+
- Fill (`backgroundColor`, `bgRaised`), `borderRadius` (`xs`), `boxShadow` (`med`), `paddingBlock` (`4`) and `paddingInline` (`8`) are default style props on the popup: pass one to change it.
|
|
34
34
|
- The popup portals into the trigger's nearest `ThemeProvider`, so it keeps the brand and mode, and sits on `zIndex` `tooltip`, above popovers and dialogs. That provider must not clip its content (see Menu).
|
|
35
35
|
- Never add key handlers or `tabIndex` to the parts; Base UI handles the keyboard.
|
|
36
36
|
- The module has no hooks, so a server component can render the parts; `onOpenChange` must come from a client component.
|
|
@@ -39,7 +39,7 @@ A short hint about a control that shows on hover after a delay and at once on ke
|
|
|
39
39
|
|
|
40
40
|
```tsx
|
|
41
41
|
<Tooltip>
|
|
42
|
-
<Tooltip.Trigger borderRadius="
|
|
42
|
+
<Tooltip.Trigger borderRadius="xs" paddingInline="4">
|
|
43
43
|
<Badge variant="danger">Checks failed</Badge>
|
|
44
44
|
</Tooltip.Trigger>
|
|
45
45
|
<Tooltip.Popup>2 of 5 checks failed on the last push</Tooltip.Popup>
|
|
@@ -57,7 +57,7 @@ A short hint about a control that shows on hover after a delay and at once on ke
|
|
|
57
57
|
|
|
58
58
|
```tsx
|
|
59
59
|
<Tooltip>
|
|
60
|
-
<Tooltip.Trigger borderRadius="
|
|
60
|
+
<Tooltip.Trigger borderRadius="xs">
|
|
61
61
|
<Text as="span" size="sm">
|
|
62
62
|
Running 12m
|
|
63
63
|
</Text>
|
|
@@ -170,6 +170,7 @@ Also accepts the style props (see `manifest.json` `styleProps`).
|
|
|
170
170
|
| `iconEnd` | `ComponentType` | no | |
|
|
171
171
|
| `iconStart` | `ComponentType` | no | |
|
|
172
172
|
| `size` | `"lg" \| "med" \| "sm"` | no | |
|
|
173
|
+
| `uppercase` | `boolean` | no | |
|
|
173
174
|
| `variant` | `"ghost" \| "primary" \| "secondary"` | no | |
|
|
174
175
|
|
|
175
176
|
Also accepts the style props (see `manifest.json` `styleProps`).
|
package/dist/docs/llms.txt
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
- [Avatar](Avatar.md): Identifies a person, project or account by one or two letters in a circle, tinted by a hue or filled with a colour of the consumer's choosing, or on a neutral fill. A `span` with `role="img"`, named by `label`, around a `Text` in the `label` font. It is never focusable.
|
|
16
16
|
- [Badge](Badge.md): A static label that states the status of, or a short fact about, the thing beside it: "Draft", "Failed", "Beta". A `span` with a fill from the color roles around a `Text` in the `label` font. It has no role and is never focusable.
|
|
17
17
|
- [Box](Box.md): The base element every component builds on: one element, chosen with `as`, styled with style props. Style props are the token-backed classes from `@layer atoms`: layout (`display`, flex, `gap`, logical padding, margin and sizing), color roles, `borderRadius`, `boxShadow`, `position`, `zIndex`, `overflow` and `textAlign`.
|
|
18
|
-
- [Button](Button.md): The labelled action: a `<button type="button">` with the house look, or a link styled as one with `as="a"` (or a router's link). Four variants (`primary`, `secondary`, `ghost`, `danger`), three sizes (`sm`, `med`, `lg`, 24, 32 and 40 px high, ADR 0124), a `loading` state that keeps its width, and icon slots before and after the label. It
|
|
18
|
+
- [Button](Button.md): The labelled action: a `<button type="button">` with the house look, or a link styled as one with `as="a"` (or a router's link). Four variants (`primary`, `secondary`, `ghost`, `danger`), three sizes (`sm`, `med`, `lg`, 24, 32 and 40 px high, ADR 0124), a `loading` state that keeps its width, and icon slots before and after the label. It takes the control radius (`sm`, 6px, ADR 0162) and a sentence-case label at weight 500; only `primary` glows, softly in its fill (ADR 0131, 0163). It is built on `Clickable`, so it has the shared focus ring, the 24px minimum target and `aria-disabled` / `aria-busy` states that block activation while the button stays focusable.
|
|
19
19
|
- [Checkbox](Checkbox.md): A two-state choice, with a third mixed state for a "select all" over a partly selected list. Built on Base UI `Checkbox` (ADR 0003, 0046): a `span` with `role="checkbox"` and `aria-checked`, plus a hidden `<input type="checkbox">` that submits with the form. The span is a 24 by 24 CSS px target (WCAG 2.2) with the shared focus ring; the 16px box inside fills and shows a tick when checked, a dash when mixed. It composes `Field` for its label, description and error (ADR 0026).
|
|
20
20
|
- [Chip](Chip.md): A toggle that filters content or picks an option: "Unread", "Starred", "Medium". A `<button>` with `aria-pressed` on `Clickable`, built on Base UI `Toggle`; `ChipGroup` is a Base UI `ToggleGroup` of chips that share one state. If it changes state when clicked, it's a chip.
|
|
21
21
|
- [Clickable](Clickable.md): The low-level base for everything a user presses: a `<button type="button">` by default, or a link with `as="a"` (or a router's link component). It brings the shared focus ring, a 24 by 24 CSS px minimum target (WCAG 2.2), `disabled` and `busy` states as ARIA attributes, and no look of its own: the button and link chrome is stripped. `Button`, `IconButton` and link components are built on it.
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
- [Field](Field.md): Wires one form control to its label, description and error: ids, `htmlFor`, `aria-describedby` and `aria-invalid`. It is input-agnostic: the control inside is Base UI's `Field.Control` or a Base UI control (Checkbox, Combobox), and Base UI does the wiring. The parts are `Field` (the root, a flex column), `Field.Label`, `Field.Description` and `Field.Error`. Built on Base UI `Field` (ADR 0003, 0026, 0046); `@base-ui/react` is a peer dependency, so the app's Base UI controls and Field share one copy of its contexts.
|
|
26
26
|
- [Heading](Heading.md): Section and page headings. A `Text` with heading defaults: the `heading` font role, `semibold`, `sm` leading, and balanced line wrapping. The level (`as`) and the look (`size`) are separate, so the outline stays right whatever the design calls for.
|
|
27
27
|
- [Icon](Icon.md): The base for every icon: an `<svg>` on a 24-unit grid that draws its children with round 2-unit strokes in `currentColor`. Generated icons from `@jonmilner/ui/icons` (`ArrowRightIcon`, …) wrap it and take the same props, less `children` and `viewBox`. `size` takes a `fontSize` step, so an icon matches the `Text` beside it; `color` takes a color role.
|
|
28
|
-
- [IconButton](IconButton.md): A compact button whose only visible content is an icon, for an action the icon makes plain: close, edit, refresh. A required `label` names it for assistive technology (`aria-label`); the icon is decorative. It is a `<button type="button">` on `Clickable`, so it has the shared focus ring, the 24px minimum target and `aria-disabled` that blocks activation while the button stays focusable. Three variants from Button's fills (`
|
|
28
|
+
- [IconButton](IconButton.md): A compact button whose only visible content is an icon, for an action the icon makes plain: close, edit, refresh. A required `label` names it for assistive technology (`aria-label`); the icon is decorative. It is a `<button type="button">` on `Clickable`, so it has the shared focus ring, the 24px minimum target and `aria-disabled` that blocks activation while the button stays focusable. Three variants from Button's fills (`ghost`, the default, `secondary` and `primary`), each a square at the control radius (`sm`, 6px, ADR 0162), with Button's glow on `primary` only (ADR 0131, 0163), and three sizes at Button's heights (`sm`, `med`, `lg`: 24, 32 and 40 px, ADR 0124).
|
|
29
29
|
- [Inline](Inline.md): A horizontal row of children that wraps onto new lines, with even space between them on both axes. `Inline` is a `Box` with `display="flex"`, `flexDirection="row"`, `flexWrap="wrap"` and `alignItems="center"` as default style props, spaced by a required `gap`. Children render as they are: no wrapper per child.
|
|
30
30
|
- [Menu](Menu.md): A list of actions that opens from a button: a row's "Edit, Duplicate, Delete", a toolbar's overflow. It may mix in links ("Open invoice", "Download PDF") as `Menu.LinkItem`, real anchors that keep the browser's link behavior. Built on Base UI's Menu, which owns the keyboard and focus: arrow keys, Home and End move through the items, typing jumps to a matching item, Esc and an outside click close it, and focus returns to the trigger. The parts add the look: a raised surface with a border and shadow, a highlighted item, a zoom-and-fade that is a plain fade under reduced motion.
|
|
31
31
|
- [MultiSelect](MultiSelect.md): A form field for picking any number of values from a list too long to show at once. A trigger styled as Button's secondary look opens a listbox of options; each selected option shows a check mark, and the trigger summarises the selection as the joined labels, or a count ("3 selected") once the labels would not fit. Built on Base UI's `Select` in multiple mode (ADR 0003), which owns the keyboard and focus: arrow keys, Home and End move through the options, typing jumps to a match, Esc and an outside click close it, and focus returns to the trigger. It composes `Field` for its label, description and error (ADR 0026).
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
- [Switch](Switch.md): Turns one setting on or off, and the change applies the moment it flips. Built on Base UI `Switch` (ADR 0003, 0137): a `span` with `role="switch"` and `aria-checked`, plus a hidden checkbox input that submits with a form. The span is a 24 px target with the shared focus ring around a pill track: off is an outlined track with the thumb at the start, on a filled `accent` track with the thumb at the end. It composes `Field` for its label, description and error (ADR 0026), with the label after the switch.
|
|
41
41
|
- [Table](Table.md): Records in rows that share named columns, so a reader can scan and compare them: transactions, members, invoices. A native `table` with parts for each element (`Table.Head`, `Table.Body`, `Table.Foot`, `Table.Row`, `Table.HeaderCell`, `Table.Cell`, `Table.ColumnGroup`, `Table.Column`), and `Table.ScrollArea` for a table wider than its container. It has no `grid` role and no roving focus: a link, `Checkbox` or `Menu` in a cell keeps the page's tab order, and a screen reader's table commands work as on any table.
|
|
42
42
|
- [Tabs](Tabs.md): Switches between views that share one place on the page. The parts are `Tabs` (the root, a flex column; a row when vertical), `Tabs.List` (the `tablist`), `Tabs.Tab` (a `tab` button on `Clickable`) and `Tabs.Panel` (the `tabpanel`). Built on Base UI `Tabs` (ADR 0003, 0046): it owns the selection, one tab stop with arrow-key roving, `aria-selected`, and the ids that tie each tab to its panel. The selected tab shows an accent bar that fades and grows in (ADR 0049).
|
|
43
|
-
- [Tag](Tag.md): A label that puts content in a category: a topic, a label, a user-made category. A `span` with a subtle tone fill (gray by default) and an `
|
|
43
|
+
- [Tag](Tag.md): A label that puts content in a category: a topic, a label, a user-made category. A `span` with a subtle tone fill (gray by default) and an `xs` (4px) radius (a small mark's step in `docs/shape.md`, so wrapped lines stay inside the fill) around a `Text` in the `label` font. It can be read-only, a link, or removable.
|
|
44
44
|
- [Text](Text.md): The base of all visible text, and the primitive every text component builds on. Its box is trimmed to the cap height and the baseline, so the gap around text is the visible space and text sits centred in a padded control. It takes every Box style prop (`color`, `textAlign`, margins), plus `size`, `font`, `weight`, `leading`, `truncate` and `wrap`.
|
|
45
45
|
- [TextField](TextField.md): A form field for one line of text that is not a search: an `<input>` (role `textbox`) with SearchField's look and no icon or button over it. `type` picks `text`, `email`, `url` or `tel`. Built on Base UI's `Input` (ADR 0003); it composes `Field` for its label, description and error (ADR 0026, 0110). Three sizes at Button's heights (`sm`, `med`, `lg`: 24, 32 and 40 px, ADR 0124).
|
|
46
46
|
- [Textarea](Textarea.md): A form field for several lines of free text: a `<textarea>` (role `textbox`, multi-line) with TextField's look. Built on Base UI's `Input` rendered as a textarea (ADR 0003); it composes `Field` for its label, description and error (ADR 0026, 0136). `rows` sets its starting height, three by default, and the user can drag it taller or shorter. Three sizes (`sm`, `med`, `lg`) set TextField's text size and padding, so the first line sits where a TextField's text does (ADR 0124).
|
package/dist/docs/manifest.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "./manifest.schema.json",
|
|
3
3
|
"package": "@jonmilner/ui",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.18.0",
|
|
5
5
|
"components": [
|
|
6
6
|
{
|
|
7
7
|
"name": "AlertDialog",
|
|
@@ -114,6 +114,11 @@
|
|
|
114
114
|
"sm"
|
|
115
115
|
]
|
|
116
116
|
},
|
|
117
|
+
{
|
|
118
|
+
"name": "uppercase",
|
|
119
|
+
"type": "boolean",
|
|
120
|
+
"required": false
|
|
121
|
+
},
|
|
117
122
|
{
|
|
118
123
|
"name": "variant",
|
|
119
124
|
"type": "\"ghost\" | \"primary\" | \"secondary\"",
|
|
@@ -271,6 +276,11 @@
|
|
|
271
276
|
"sm"
|
|
272
277
|
]
|
|
273
278
|
},
|
|
279
|
+
{
|
|
280
|
+
"name": "uppercase",
|
|
281
|
+
"type": "boolean",
|
|
282
|
+
"required": false
|
|
283
|
+
},
|
|
274
284
|
{
|
|
275
285
|
"name": "variant",
|
|
276
286
|
"type": "\"danger\" | \"ghost\" | \"primary\" | \"secondary\"",
|
|
@@ -721,6 +731,11 @@
|
|
|
721
731
|
"sm"
|
|
722
732
|
]
|
|
723
733
|
},
|
|
734
|
+
{
|
|
735
|
+
"name": "uppercase",
|
|
736
|
+
"type": "boolean",
|
|
737
|
+
"required": false
|
|
738
|
+
},
|
|
724
739
|
{
|
|
725
740
|
"name": "variant",
|
|
726
741
|
"type": "\"ghost\" | \"primary\" | \"secondary\"",
|
|
@@ -813,6 +828,11 @@
|
|
|
813
828
|
"sm"
|
|
814
829
|
]
|
|
815
830
|
},
|
|
831
|
+
{
|
|
832
|
+
"name": "uppercase",
|
|
833
|
+
"type": "boolean",
|
|
834
|
+
"required": false
|
|
835
|
+
},
|
|
816
836
|
{
|
|
817
837
|
"name": "variant",
|
|
818
838
|
"type": "\"ghost\" | \"primary\" | \"secondary\"",
|
|
@@ -1735,6 +1755,11 @@
|
|
|
1735
1755
|
"sm"
|
|
1736
1756
|
]
|
|
1737
1757
|
},
|
|
1758
|
+
{
|
|
1759
|
+
"name": "uppercase",
|
|
1760
|
+
"type": "boolean",
|
|
1761
|
+
"required": false
|
|
1762
|
+
},
|
|
1738
1763
|
{
|
|
1739
1764
|
"name": "variant",
|
|
1740
1765
|
"type": "\"ghost\" | \"primary\" | \"secondary\"",
|
|
@@ -3468,6 +3493,11 @@
|
|
|
3468
3493
|
"sm"
|
|
3469
3494
|
]
|
|
3470
3495
|
},
|
|
3496
|
+
{
|
|
3497
|
+
"name": "uppercase",
|
|
3498
|
+
"type": "boolean",
|
|
3499
|
+
"required": false
|
|
3500
|
+
},
|
|
3471
3501
|
{
|
|
3472
3502
|
"name": "variant",
|
|
3473
3503
|
"type": "\"ghost\" | \"primary\" | \"secondary\"",
|
|
@@ -3588,7 +3618,7 @@
|
|
|
3588
3618
|
},
|
|
3589
3619
|
{
|
|
3590
3620
|
"name": "borderRadius",
|
|
3591
|
-
"type": "\"full\" | \"lg\" | \"med\" | \"none\" | \"sm\" | \"xl\"",
|
|
3621
|
+
"type": "\"full\" | \"lg\" | \"med\" | \"none\" | \"sm\" | \"xl\" | \"xs\"",
|
|
3592
3622
|
"required": false,
|
|
3593
3623
|
"values": [
|
|
3594
3624
|
"full",
|
|
@@ -3596,7 +3626,8 @@
|
|
|
3596
3626
|
"med",
|
|
3597
3627
|
"none",
|
|
3598
3628
|
"sm",
|
|
3599
|
-
"xl"
|
|
3629
|
+
"xl",
|
|
3630
|
+
"xs"
|
|
3600
3631
|
]
|
|
3601
3632
|
},
|
|
3602
3633
|
{
|
|
@@ -4298,6 +4329,7 @@
|
|
|
4298
4329
|
"container.page": "var(--container-page)",
|
|
4299
4330
|
"container.wide": "var(--container-wide)",
|
|
4300
4331
|
"radius.none": "var(--radius-none)",
|
|
4332
|
+
"radius.xs": "var(--radius-xs)",
|
|
4301
4333
|
"radius.sm": "var(--radius-sm)",
|
|
4302
4334
|
"radius.med": "var(--radius-med)",
|
|
4303
4335
|
"radius.lg": "var(--radius-lg)",
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# 0.17.0
|
|
2
|
+
|
|
3
|
+
The radius scale gains a 6px step (decision 0162): `xs` is 4px, the old `sm`, and `sm` is now 6px. An app that passes `sm` still type-checks but its corners grow from 4px to 6px. Library components look the same.
|
|
4
|
+
|
|
5
|
+
## Find
|
|
6
|
+
|
|
7
|
+
In every source and style file the app owns (`*.ts`, `*.tsx`, `*.js`, `*.jsx`, `*.mjs`, `*.cjs`, `*.mdx`, `*.css`, `*.scss`):
|
|
8
|
+
|
|
9
|
+
- The style prop, as a JSX prop, an object key or a default parameter (`borderRadius = "sm"`): regex `borderRadius\s*[=:]\s*\{?\s*["']sm["']`.
|
|
10
|
+
- The token, by dot or bracket: regex `radius(\.sm\b|\[\s*["']sm["']\s*\])`.
|
|
11
|
+
- The CSS variable, in CSS or inside a string: regex `--radius-sm\b`.
|
|
12
|
+
- A conditional or computed value on a radius line (`borderRadius={dense ? "sm" : "med"}`): regex `[Rr]adius.*["']sm["']`. It also matches lines where `sm` is another prop's value, such as `size="sm"`; skip those.
|
|
13
|
+
- A value that reaches the radius through a variable or the app's own prop (`const r = "sm"; <Box borderRadius={r} />`): no regex finds it. Review each `"sm"` the app passes on to a `borderRadius`.
|
|
14
|
+
|
|
15
|
+
## Replace
|
|
16
|
+
|
|
17
|
+
Rename each match to `xs`, which is the same 4px:
|
|
18
|
+
|
|
19
|
+
```tsx
|
|
20
|
+
// before
|
|
21
|
+
<Box borderRadius="sm" />;
|
|
22
|
+
function Pill({ borderRadius = "sm" }) {}
|
|
23
|
+
style({ borderRadius: vars.radius.sm });
|
|
24
|
+
// after
|
|
25
|
+
<Box borderRadius="xs" />;
|
|
26
|
+
function Pill({ borderRadius = "xs" }) {}
|
|
27
|
+
style({ borderRadius: vars.radius.xs });
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
```css
|
|
31
|
+
/* before */
|
|
32
|
+
border-radius: var(--radius-sm);
|
|
33
|
+
/* after */
|
|
34
|
+
border-radius: var(--radius-xs);
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Verify
|
|
38
|
+
|
|
39
|
+
From the app's root, this prints nothing, or only lines where `sm` is not a radius:
|
|
40
|
+
|
|
41
|
+
```sh
|
|
42
|
+
grep -rnE --include='*.ts' --include='*.tsx' --include='*.js' --include='*.jsx' --include='*.mjs' --include='*.cjs' --include='*.mdx' --include='*.css' --include='*.scss' \
|
|
43
|
+
-e 'borderRadius\s*[=:]\s*\{?\s*["'"'"']sm["'"'"']' -e 'radius(\.sm\b|\[\s*["'"'"']sm["'"'"']\s*\])' -e '--radius-sm\b' -e '[Rr]adius.*["'"'"']sm["'"'"']' \
|
|
44
|
+
--exclude-dir=node_modules --exclude-dir=dist .
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Then the app's visual baselines pass unchanged.
|