@jonmilner/ui 0.21.1 → 0.22.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/THIRD_PARTY_NOTICES.md +1 -1
- package/dist/AlertDialog/index.d.mts +1 -1
- package/dist/Avatar/index.d.mts +1 -1
- package/dist/Avatar/index.mjs +5 -5
- package/dist/Badge/index.d.mts +1 -1
- package/dist/Badge/index.mjs +12 -12
- package/dist/Box/index.mjs +1 -1
- package/dist/Button/index.d.mts +1 -1
- package/dist/Button/index.mjs +22 -22
- package/dist/Checkbox/index.mjs +7 -7
- package/dist/Chip/index.mjs +35 -35
- package/dist/Clickable/index.d.mts +1 -1
- package/dist/Clickable/index.mjs +4 -4
- package/dist/ColorField/ColorField.css +1 -1
- package/dist/ColorField/client.mjs +6 -6
- package/dist/ColorField/index.mjs +14 -14
- package/dist/Combobox/Combobox.css +1 -1
- package/dist/Combobox/client.mjs +26 -26
- package/dist/Combobox/index.mjs +20 -20
- package/dist/Dialog/client.mjs +26 -26
- package/dist/Dialog/index.d.mts +1 -1
- package/dist/Dialog/index.mjs +19 -19
- package/dist/Field/client.mjs +6 -6
- package/dist/Field/index.mjs +29 -29
- package/dist/IconButton/IconButton.css +1 -1
- package/dist/IconButton/IconButton.css.mjs +2 -2
- package/dist/IconButton/index.d.mts +5 -2
- package/dist/IconButton/index.mjs +60 -21
- package/dist/Inline/index.d.mts +2 -2
- package/dist/Inline/index.mjs +4 -4
- package/dist/Menu/Menu.css +1 -1
- package/dist/Menu/Menu.css.mjs +2 -2
- package/dist/Menu/client.d.mts +1 -0
- package/dist/Menu/client.mjs +95 -53
- package/dist/Menu/index.d.mts +8 -0
- package/dist/Menu/index.mjs +123 -87
- package/dist/MultiSelect/MultiSelect.css +1 -1
- package/dist/MultiSelect/client.mjs +4 -4
- package/dist/MultiSelect/index.mjs +8 -8
- package/dist/NavList/NavList.css +1 -1
- package/dist/NavList/client.mjs +3 -3
- package/dist/NavList/index.d.mts +3 -3
- package/dist/NavList/index.mjs +67 -65
- package/dist/NumberField/NumberField.css +1 -1
- package/dist/NumberField/index.mjs +17 -17
- package/dist/RadioGroup/index.mjs +23 -23
- package/dist/SearchField/SearchField.css +1 -1
- package/dist/SearchField/client.mjs +13 -13
- package/dist/SearchField/index.mjs +16 -16
- package/dist/Select/Select.css +1 -1
- package/dist/Select/client.mjs +11 -11
- package/dist/Select/index.mjs +8 -8
- package/dist/Sidebar/index.d.mts +1 -1
- package/dist/Sidebar/index.mjs +21 -21
- package/dist/SidebarLayout/index.d.mts +1 -1
- package/dist/SidebarLayout/index.mjs +8 -8
- package/dist/Stack/index.d.mts +2 -2
- package/dist/Stack/index.mjs +4 -4
- package/dist/Switch/index.mjs +13 -13
- package/dist/Table/index.d.mts +1 -1
- package/dist/Table/index.mjs +59 -59
- package/dist/Tabs/index.mjs +26 -26
- package/dist/Tag/index.d.mts +1 -1
- package/dist/Tag/index.mjs +16 -16
- package/dist/Text/index.d.mts +2 -2
- package/dist/Text/index.mjs +4 -4
- package/dist/TextField/TextField.css +1 -1
- package/dist/TextField/index.mjs +16 -16
- package/dist/Textarea/Textarea.css +1 -1
- package/dist/Textarea/index.mjs +9 -9
- package/dist/Toast/client.d.mts +2 -1
- package/dist/Toast/client.mjs +62 -55
- package/dist/Tooltip/base.mjs +13 -13
- package/dist/contrast/contrast.d.mts +1 -1
- package/dist/contrast/contrast.mjs +9 -9
- package/dist/contrast/mixes.mjs +27 -27
- package/dist/docs/Combobox.md +1 -0
- package/dist/docs/IconButton.md +9 -1
- package/dist/docs/Menu.md +51 -3
- package/dist/docs/MultiSelect.md +1 -0
- package/dist/docs/NavList.md +2 -2
- package/dist/docs/Select.md +1 -0
- package/dist/docs/Toast.md +7 -0
- package/dist/docs/llms.txt +1 -1
- package/dist/docs/manifest.json +118 -1
- package/dist/docs/migrations/0.22.0.md +35 -0
- package/dist/icons/index.d.mts +3 -3
- package/dist/icons/index.mjs +33 -33
- package/dist/index.d.mts +16 -16
- package/dist/index.mjs +39 -39
- package/dist/lint/index.mjs +1 -0
- package/dist/popup/client.d.mts +1 -1
- package/dist/popup/client.mjs +49 -32
- package/dist/popup/direction.d.mts +1 -0
- package/dist/popup/direction.mjs +23 -0
- package/dist/popup/listbox-base.mjs +24 -24
- package/dist/popup/listbox-options.mjs +4 -4
- package/dist/popup/listbox-row.mjs +1 -0
- package/dist/popup/tooltip.d.mts +1 -0
- package/dist/popup/tooltip.mjs +48 -42
- package/dist/theme/define-theme.mjs +42 -42
- package/package.json +2 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { subtleFills as e } from "../styles/subtle-fills.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { overlayRoles as t } from "../tokens/roles.mjs";
|
|
3
|
+
import { decode as n, resolveColor as r } from "./color.mjs";
|
|
4
4
|
// src/contrast/contrast.ts
|
|
5
5
|
var i = [
|
|
6
6
|
"bg",
|
|
@@ -31,17 +31,17 @@ var i = [
|
|
|
31
31
|
...a(["borderStrong", "focus"], i, 3),
|
|
32
32
|
...a(["focus"], o.map(([, e]) => e), 3),
|
|
33
33
|
...a(o.map(([e]) => e), ["bg"], 3),
|
|
34
|
-
...a(["fg", "fgMuted"],
|
|
34
|
+
...a(["fg", "fgMuted"], t, 4.5).flatMap((e) => i.map((t) => ({
|
|
35
35
|
...e,
|
|
36
36
|
over: t
|
|
37
37
|
})))
|
|
38
38
|
], c = ["light", "dark"];
|
|
39
|
-
function l({ r: e, g:
|
|
40
|
-
return .2126 *
|
|
39
|
+
function l({ r: e, g: t, b: r }) {
|
|
40
|
+
return .2126 * n(e) + .7152 * n(t) + .0722 * n(r);
|
|
41
41
|
}
|
|
42
|
-
function u(e, t,
|
|
43
|
-
let a =
|
|
44
|
-
return f(
|
|
42
|
+
function u(e, t, n = "light", i) {
|
|
43
|
+
let a = r(t, n);
|
|
44
|
+
return f(r(e, n), i ? d(a, r(i, n)) : a, t);
|
|
45
45
|
}
|
|
46
46
|
function d(e, t) {
|
|
47
47
|
let n = (t, n) => t * e.alpha + n * (1 - e.alpha);
|
|
@@ -59,7 +59,7 @@ function f(e, t, n) {
|
|
|
59
59
|
}
|
|
60
60
|
function p(e) {
|
|
61
61
|
return c.flatMap((t) => {
|
|
62
|
-
let
|
|
62
|
+
let n = /* @__PURE__ */ new Map(), i = (i) => n.get(i) ?? n.set(i, r(e.color[i], t)).get(i);
|
|
63
63
|
return s.flatMap((n) => {
|
|
64
64
|
let r = n.over ? d(i(n.bg), i(n.over)) : i(n.bg), a = f(i(n.fg), r, e.color[n.bg]);
|
|
65
65
|
return a < n.min ? [{
|
package/dist/contrast/mixes.mjs
CHANGED
|
@@ -1,41 +1,41 @@
|
|
|
1
1
|
import { fills as e } from "../styles/button-fills.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
2
|
+
import { highlightFill as t, highlightText as n } from "../styles/highlight.mjs";
|
|
3
|
+
import { hoverFill as r } from "../styles/hover-tint.mjs";
|
|
4
|
+
import { subtleFills as i } from "../styles/subtle-fills.mjs";
|
|
5
|
+
import { overlayRoles as a } from "../tokens/roles.mjs";
|
|
6
|
+
import { contrastRatio as o, surfaces as s } from "./contrast.mjs";
|
|
7
7
|
// src/contrast/mixes.ts
|
|
8
|
-
var c = (e) =>
|
|
8
|
+
var c = (e) => a.includes(e), l = [
|
|
9
9
|
{
|
|
10
10
|
name: "Menu highlight",
|
|
11
|
-
fill:
|
|
12
|
-
text:
|
|
11
|
+
fill: t,
|
|
12
|
+
text: n,
|
|
13
13
|
min: 4.5
|
|
14
14
|
},
|
|
15
15
|
...Object.entries(e).flatMap(([e, { backgroundColor: t, color: n }]) => {
|
|
16
|
-
let
|
|
16
|
+
let i = [n];
|
|
17
17
|
return t && !c(t) ? [{
|
|
18
18
|
name: `${e} Button hover`,
|
|
19
|
-
fill: (e) =>
|
|
20
|
-
text:
|
|
19
|
+
fill: (e) => r(e.fg, e[t]),
|
|
20
|
+
text: i,
|
|
21
21
|
min: 4.5
|
|
22
|
-
}] :
|
|
22
|
+
}] : s.map((n) => ({
|
|
23
23
|
name: `${e} Button hover on ${n}`,
|
|
24
|
-
fill: (e) =>
|
|
24
|
+
fill: (e) => r(e.fg, e[t ?? n]),
|
|
25
25
|
...t && { over: n },
|
|
26
|
-
text:
|
|
26
|
+
text: i,
|
|
27
27
|
min: 4.5
|
|
28
28
|
}));
|
|
29
29
|
}),
|
|
30
30
|
{
|
|
31
31
|
name: "pressed Chip hover",
|
|
32
|
-
fill: (e) =>
|
|
32
|
+
fill: (e) => r(e.fg, e.accent),
|
|
33
33
|
text: ["accentFg"],
|
|
34
34
|
min: 4.5
|
|
35
35
|
},
|
|
36
|
-
...
|
|
36
|
+
...s.map((e) => ({
|
|
37
37
|
name: `Table row hover on ${e}`,
|
|
38
|
-
fill: (t) =>
|
|
38
|
+
fill: (t) => r(t.fg, t[e], "5%"),
|
|
39
39
|
text: e === "bgMuted" || e === "bgPanel" ? ["fg", "fgMuted"] : [
|
|
40
40
|
"fg",
|
|
41
41
|
"fgMuted",
|
|
@@ -47,24 +47,24 @@ var c = (e) => n.includes(e), l = [
|
|
|
47
47
|
],
|
|
48
48
|
min: 4.5
|
|
49
49
|
})),
|
|
50
|
-
...Object.entries(
|
|
50
|
+
...Object.entries(i).map(([e, { backgroundColor: t, color: n }]) => ({
|
|
51
51
|
name: `${e} Table row hover`,
|
|
52
|
-
fill: (e) =>
|
|
52
|
+
fill: (e) => r(e.fg, e[t], "5%"),
|
|
53
53
|
text: [n],
|
|
54
54
|
min: 4.5
|
|
55
55
|
}))
|
|
56
56
|
];
|
|
57
57
|
function u(e) {
|
|
58
|
-
return ["light", "dark"].flatMap((t) => l.flatMap(({ name: n, fill:
|
|
59
|
-
let c =
|
|
60
|
-
return
|
|
61
|
-
let
|
|
62
|
-
return
|
|
63
|
-
fg:
|
|
58
|
+
return ["light", "dark"].flatMap((t) => l.flatMap(({ name: n, fill: r, text: i, min: a, over: s }) => {
|
|
59
|
+
let c = r(e.color), l = s && e.color[s];
|
|
60
|
+
return i.flatMap((r) => {
|
|
61
|
+
let i = o(e.color[r], c, t, l);
|
|
62
|
+
return i < a ? [{
|
|
63
|
+
fg: r,
|
|
64
64
|
mix: n,
|
|
65
|
-
min:
|
|
65
|
+
min: a,
|
|
66
66
|
mode: t,
|
|
67
|
-
ratio:
|
|
67
|
+
ratio: i
|
|
68
68
|
}] : [];
|
|
69
69
|
});
|
|
70
70
|
}));
|
package/dist/docs/Combobox.md
CHANGED
|
@@ -32,6 +32,7 @@ A form field for picking one value, or any number with `multiple`, from a list l
|
|
|
32
32
|
- `disabled` disables the trigger and mutes the label. `required` marks the field required; report a missing value through `error`.
|
|
33
33
|
- The trigger, the popup and its listbox are named by `label`; the filter input by `filterLabel`.
|
|
34
34
|
- Style props, `className` and `style` go to the `Field` around the label, trigger and messages, not to the trigger or the popup.
|
|
35
|
+
- The popup stops 8px from the viewport's edges. A long option's label wraps, breaking inside a URL or hash if it has to, so there is no need to shorten labels or set a width to fit them.
|
|
35
36
|
- 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` `popover`, below the trigger by default, and flips when it would overflow the viewport. The input stays at its top while the options scroll.
|
|
36
37
|
- Never add key handlers or `tabIndex`; Base UI handles the keyboard.
|
|
37
38
|
- The module has no hooks, so a server component can render it; `onValueChange` must come from a client component.
|
package/dist/docs/IconButton.md
CHANGED
|
@@ -22,7 +22,8 @@ A compact button whose only visible content is an icon, for an action the icon m
|
|
|
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
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
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
|
-
- `disabled` renders `aria-disabled="true"` and a dashed border, never the native `disabled`. There is no
|
|
25
|
+
- `disabled` renders `aria-disabled="true"` and a dashed border, never the native `disabled`. There is no tooltip.
|
|
26
|
+
- `loading` shows Button's three pulsing dots in place of the icon, in the same square, and renders `aria-busy="true"`: the button stays focusable, keeps its size and `label`, and blocks click, Enter and Space. A raw `aria-busy` counts as `loading`. On the muted `ghost` the dots are `fg`, or the passed `color`. The dots hold still under `prefers-reduced-motion: reduce` (ADR 0179).
|
|
26
27
|
- 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
28
|
- 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
29
|
- `as="a"` with `href` for an icon-only link.
|
|
@@ -41,6 +42,10 @@ A compact button whose only visible content is an icon, for an action the icon m
|
|
|
41
42
|
</Inline>
|
|
42
43
|
```
|
|
43
44
|
|
|
45
|
+
```tsx
|
|
46
|
+
<IconButton label="Merge" icon={GitMergeIcon} loading={merging} onClick={merge} />
|
|
47
|
+
```
|
|
48
|
+
|
|
44
49
|
## Don't
|
|
45
50
|
|
|
46
51
|
```tsx
|
|
@@ -63,6 +68,7 @@ A compact button whose only visible content is an icon, for an action the icon m
|
|
|
63
68
|
- The `label` is announced as the button's name; the icon is hidden from assistive technology.
|
|
64
69
|
- 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
70
|
- 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.
|
|
71
|
+
- A loading IconButton is announced as busy under its `label`, stays in the tab order, and Enter and Space do nothing; the dots are hidden from assistive technology.
|
|
66
72
|
- 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
73
|
|
|
68
74
|
## Props
|
|
@@ -73,10 +79,12 @@ Generated from the TypeScript types.
|
|
|
73
79
|
|
|
74
80
|
| Prop | Type | Required | Description |
|
|
75
81
|
| --- | --- | --- | --- |
|
|
82
|
+
| `aria-busy` | `"false" \| "true" \| boolean` | no | |
|
|
76
83
|
| `as` | `ElementType` | no | |
|
|
77
84
|
| `disabled` | `boolean` | no | |
|
|
78
85
|
| `icon` | `ComponentType` | yes | |
|
|
79
86
|
| `label` | `string` | yes | |
|
|
87
|
+
| `loading` | `boolean` | no | |
|
|
80
88
|
| `size` | `"lg" \| "med" \| "sm"` | no | |
|
|
81
89
|
| `variant` | `"ghost" \| "primary" \| "secondary"` | no | |
|
|
82
90
|
|
package/dist/docs/Menu.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
## Purpose
|
|
4
4
|
|
|
5
|
-
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.
|
|
5
|
+
A list of actions that opens from a button: a row's "Edit, Duplicate, Delete", a toolbar's overflow. An entry can open a nested list. 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.
|
|
6
6
|
|
|
7
7
|
## When to use
|
|
8
8
|
|
|
@@ -19,7 +19,7 @@ A list of actions that opens from a button: a row's "Edit, Duplicate, Delete", a
|
|
|
19
19
|
|
|
20
20
|
## Rules
|
|
21
21
|
|
|
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.
|
|
22
|
+
- Compose the parts: `Menu` > `Menu.Trigger` + `Menu.Popup` > `Menu.Item`, `Menu.LinkItem`, `Menu.Separator`, `Menu.Group`, `Menu.SubmenuRoot`. `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
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
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.
|
|
@@ -32,7 +32,8 @@ A list of actions that opens from a button: a row's "Edit, Duplicate, Delete", a
|
|
|
32
32
|
- `Menu.Separator` draws a line inside its own padding (`paddingBlock="4"`, `paddingInline="8"`) and sets no margin. Change its spacing with `paddingBlock` and `paddingInline` (the `padding` shorthand loses to these defaults, decision 0065); a `margin*` prop adds space outside the padding. `style={{ borderBlockStartColor }}` recolours the line.
|
|
33
33
|
- 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`, or the popup is clipped or drawn under siblings. It sits on `zIndex` `popover`. A menu opened only through `open`, with no `Menu.Trigger`, has no provider to find and portals to `<body>`.
|
|
34
34
|
- Item and link item text is wrapped in `Text` (`label`, `sm`) for you. `iconStart` and `iconEnd` take an icon component (`iconStart={PencilIcon}`), rendered at the label's size, 4px from it and centred on its cap height, as on Button, Badge and Tag (ADR 0152); the item is as tall as without them. With a `description` they stay on the label's line. Never put an icon in the children: they are the label only.
|
|
35
|
-
- `side` (`bottom` by default) and `align` (`start`) place the popup against the trigger; it flips when it would overflow the viewport.
|
|
35
|
+
- `side` (`bottom` by default, `inline-end` for a submenu's popup) and `align` (`start`) place the popup against the trigger; it flips when it would overflow the viewport.
|
|
36
|
+
- For a nested menu, put `Menu.SubmenuRoot` in a `Menu.Popup`, holding `Menu.SubmenuTrigger` and a `Menu.Popup` of its own. The trigger is a row with `Menu.Item`'s tokens, highlight, disabled and focus looks and a trailing chevron that flips under `rtl`; it takes `iconStart` and `description`, and no `iconEnd`. Never style a Base UI `SubmenuTrigger` to look like an item. `disabled` goes on `Menu.SubmenuRoot`, which disables its trigger too. `Menu.SubmenuRoot` takes `open`, `defaultOpen`, `onOpenChange`, `disabled`, `loopFocus` and `closeParentOnEsc`, which makes Esc close the whole menu rather than the one level. It renders no element, so it takes no `className`, `style` or style props.
|
|
36
37
|
- Never add key handlers or `tabIndex` to the parts; Base UI handles the keyboard.
|
|
37
38
|
- The module has no hooks, so a server component can render the parts; `onClick` and other functions must come from a client component.
|
|
38
39
|
|
|
@@ -109,6 +110,23 @@ A list of actions that opens from a button: a row's "Edit, Duplicate, Delete", a
|
|
|
109
110
|
</Menu.Popup>
|
|
110
111
|
```
|
|
111
112
|
|
|
113
|
+
```tsx
|
|
114
|
+
// "Repo settings" opens a nested list of repos beside the row.
|
|
115
|
+
<Menu.Popup>
|
|
116
|
+
<Menu.Item onClick={newProject}>New project</Menu.Item>
|
|
117
|
+
<Menu.SubmenuRoot>
|
|
118
|
+
<Menu.SubmenuTrigger>Repo settings</Menu.SubmenuTrigger>
|
|
119
|
+
<Menu.Popup>
|
|
120
|
+
{repos.map((repo) => (
|
|
121
|
+
<Menu.Item key={repo.id} onClick={() => open(repo)}>
|
|
122
|
+
{repo.name}
|
|
123
|
+
</Menu.Item>
|
|
124
|
+
))}
|
|
125
|
+
</Menu.Popup>
|
|
126
|
+
</Menu.SubmenuRoot>
|
|
127
|
+
</Menu.Popup>
|
|
128
|
+
```
|
|
129
|
+
|
|
112
130
|
## Don't
|
|
113
131
|
|
|
114
132
|
```tsx
|
|
@@ -162,6 +180,7 @@ A list of actions that opens from a button: a row's "Edit, Duplicate, Delete", a
|
|
|
162
180
|
- The trigger has `aria-haspopup="menu"` and `aria-expanded`; the popup is `role="menu"` labelled by the trigger, items and link items are `role="menuitem"` (a link item is an `<a>` with an `href`, so the browser treats it as a link), groups are `role="group"` named by their label.
|
|
163
181
|
- Opening from the keyboard focuses the first item; from the pointer, the popup. Focus stays in the menu until it closes. Closed by Esc, an item or `open={false}`, focus returns at once to the trigger that opened it, so a Tab pressed while it fades goes on to the control after the trigger. A press outside, a Tab out, a hover menu the pointer left, or a popup with `finalFocus` leaves focus to Base UI, which places it when the fade ends.
|
|
164
182
|
- A closed menu stays on the page while it fades out, but is `inert` and `aria-hidden` from the moment it closes, so a menu opened during the fade (the next row's) is the only one a screen reader or a role query finds, and nothing in the fading one takes focus or a click.
|
|
183
|
+
- A submenu trigger is `role="menuitem"` with `aria-haspopup="menu"` and `aria-expanded`, which Base UI drops while a keyboard-opened submenu is open on Apple platforms, so VoiceOver, if running, reads the item that takes focus; its popup is a `role="menu"` named by it. ArrowRight, Enter or Space opens it and focuses its first item; ArrowLeft or Esc closes that level and returns focus to the trigger. Under `rtl` the popup and chevron mirror, but the arrow keys stay left to right, as in every Menu (ADR 0175). Hovering the trigger opens it, and the pointer can cross into it without closing it. The trigger keeps its fill while its submenu is open.
|
|
165
184
|
- The icon trigger's name is its `label`, as `aria-label`.
|
|
166
185
|
- An item's `description` is its accessible description (`aria-describedby`), read after its name; the name stays the label alone. An `aria-describedby` of the item's own is kept, read after the description. With plain-text children, typeahead matches the label alone, not the description; otherwise pass `label`.
|
|
167
186
|
- The popup is never wider than the viewport beside its trigger, so at 320 px and 200% text a long item wraps inside it (WCAG 1.4.10).
|
|
@@ -255,6 +274,35 @@ Also accepts the style props (see `manifest.json` `styleProps`).
|
|
|
255
274
|
|
|
256
275
|
Also accepts the style props (see `manifest.json` `styleProps`).
|
|
257
276
|
|
|
277
|
+
### Menu.SubmenuRoot
|
|
278
|
+
|
|
279
|
+
| Prop | Type | Required | Description |
|
|
280
|
+
| --- | --- | --- | --- |
|
|
281
|
+
| `children` | `ReactNode` | no | |
|
|
282
|
+
| `closeParentOnEsc` | `boolean` | no | When in a submenu, determines whether pressing the Escape key closes the entire menu, or only the current child menu. |
|
|
283
|
+
| `defaultOpen` | `boolean` | no | Whether the menu is initially open. To render a controlled menu, use the `open` prop instead. |
|
|
284
|
+
| `disabled` | `boolean` | no | Whether the component should ignore user interaction. |
|
|
285
|
+
| `loopFocus` | `boolean` | no | Whether to loop keyboard focus back to the first item when the end of the list is reached while using the arrow keys. |
|
|
286
|
+
| `onOpenChange` | `((open: boolean, eventDetails: MenuRootChangeEventDetails) => void)` | no | Event handler called when the menu is opened or closed. |
|
|
287
|
+
| `open` | `boolean` | no | Whether the menu is currently open. |
|
|
288
|
+
|
|
289
|
+
### Menu.SubmenuTrigger
|
|
290
|
+
|
|
291
|
+
| Prop | Type | Required | Description |
|
|
292
|
+
| --- | --- | --- | --- |
|
|
293
|
+
| `className` | `string` | no | |
|
|
294
|
+
| `closeDelay` | `number` | no | How long to wait before closing the menu that was opened on hover. Specified in milliseconds. Requires the `openOnHover` prop. |
|
|
295
|
+
| `delay` | `number` | no | How long to wait before the menu may be opened on hover. Specified in milliseconds. Requires the `openOnHover` prop. |
|
|
296
|
+
| `description` | `ReactNode` | no | |
|
|
297
|
+
| `iconStart` | `ComponentType` | no | |
|
|
298
|
+
| `id` | `string` | no | |
|
|
299
|
+
| `label` | `string` | no | Overrides the text used for keyboard text navigation and filtering. Falls back to the rendered text when not provided. |
|
|
300
|
+
| `onClick` | `((event: BaseUIEvent<MouseEvent<HTMLDivElement, MouseEvent>>) => void)` | no | |
|
|
301
|
+
| `openOnHover` | `boolean` | no | Whether the menu should also open when the trigger is hovered. |
|
|
302
|
+
| `style` | `CSSProperties` | no | |
|
|
303
|
+
|
|
304
|
+
Also accepts the style props (see `manifest.json` `styleProps`).
|
|
305
|
+
|
|
258
306
|
### Menu.Trigger
|
|
259
307
|
|
|
260
308
|
| Prop | Type | Required | Description |
|
package/dist/docs/MultiSelect.md
CHANGED
|
@@ -31,6 +31,7 @@ A form field for picking any number of values from a list too long to show at on
|
|
|
31
31
|
- `disabled` takes the trigger out of the tab order and mutes the label. `required` sets `aria-required` on the trigger; report a missing value through `error`.
|
|
32
32
|
- The trigger and the open listbox are both named by `label`.
|
|
33
33
|
- Style props, `className` and `style` go to the `Field` around the label, trigger and messages, not to the trigger or the popup.
|
|
34
|
+
- The popup stops 8px from the viewport's edges. A long option's label wraps, breaking inside a URL or hash if it has to, so there is no need to shorten labels or set a width to fit them.
|
|
34
35
|
- 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` `popover`, below the trigger by default, and flips when it would overflow the viewport.
|
|
35
36
|
- Never add key handlers or `tabIndex`; Base UI handles the keyboard.
|
|
36
37
|
- The module has no hooks, so a server component can render it; `onValueChange` must come from a client component.
|
package/dist/docs/NavList.md
CHANGED
|
@@ -30,10 +30,10 @@ A column of links to an app's pages, with the current page marked: a sidebar's o
|
|
|
30
30
|
- Inside a `Sidebar` rail (`collapsed`), group headings, labels and counts are visually hidden, an `action` is gone, 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.
|
|
31
31
|
- `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.
|
|
32
32
|
- `live` marks a page with something running behind it now (a job, a session, a sync): a 6px `success` dot with a soft halo before the count, or at the end of the row with no count. It is read after the label as `liveLabel`, "live" by default; give it the app's meaning (`liveLabel="session running"`) or its language. In the rail the inline dot hides and a dot sits on the icon's or avatar's top inline-end corner, ringed in `bgPanel`; the rail tooltip shows no dot. `count` is separate and unchanged.
|
|
33
|
-
- `action` takes one control for the row, rendered after the link inside the `li`, never inside it: pass a `Menu` whose `Menu.Trigger` is the icon trigger at `size="sm"` (`icon={EllipsisIcon}`, a 24px target) with its `Menu.Popup`. NavList names nothing, so name each trigger for its row: `label="Actions for jonmilner/ui"`, not a "More actions" repeated down the list. It sits at the row's inline end, `
|
|
33
|
+
- `action` takes one control for the row, rendered after the link inside the `li`, never inside it: pass a `Menu` whose `Menu.Trigger` is the icon trigger at `size="sm"` (`icon={EllipsisIcon}`, a 24px target) with its `Menu.Popup`. NavList names nothing, so name each trigger for its row: `label="Actions for jonmilner/ui"`, not a "More actions" repeated down the list. It sits at the row's inline end, `4` in from the edge, as far from the side as from the top, in the count's place: at rest it is transparent and the count shows; on hover over the row (where hover is real), focus inside the row, or while its menu is open, the action shows and the count goes transparent. Where there is no hover (`(hover: none), (pointer: coarse)`) it always shows, so on a phone or tablet that row's count is never in sight; the count stays in the link's name, but a count the user must see belongs in the label or on a row without an action. The slot holds one node at the inline end: put several actions in the one menu, never a second control or a leading one. A long label wraps before the action and never runs under it. An item with no action renders as before; `null`, `undefined`, a boolean or `""` is none, so `canEdit && <Menu>…` works; a number is not (`items.length && <Menu>…` renders `0` as the action), so make the condition a boolean.
|
|
34
34
|
- A collapsed `Sidebar`'s rail drops the action: it is `display: none` there, out of sight and the tab order, and the row stays the 40px square. Give the rail those actions another way (a menu on the selected page, the page's own header). In a SidebarLayout stacked below 48em the items show open and the action with them.
|
|
35
35
|
- Labels wrap onto a second line in a narrow column, breaking a long word if they must; they never truncate.
|
|
36
|
-
- Items are `sm` text in `fg`, with `6` block and `8` inline padding
|
|
36
|
+
- Items are `sm` text in `fg`, with `6` block and `8` inline padding (`6` at the inline start with an `avatar`), a `med` radius and at least the `sm` (32px) block size, as default style props; the consumer's win, except in the rail. A boxed element at either end of a row is inset as far from the side as from the top and bottom: a 20px avatar `6`, a 24px action `4`. An icon or no glyph keeps the link's `8`. A count keeps the link's `8` end padding like the label, with or without an action, since only boxed elements follow the rule. The `action` slot's direct child takes an `xs` radius inside the row, whatever its own and over a `borderRadius` prop, so its corners nest in the row's `med` (ADR 0178): pass the control itself, not a wrapper around it. The rail's 40px squares keep even padding and an `xs` radius, over `paddingInline` and `borderRadius` props. Hover tints a non-current item where hover is real (`(hover: hover)`).
|
|
37
37
|
- 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).
|
|
38
38
|
|
|
39
39
|
## Do
|
package/dist/docs/Select.md
CHANGED
|
@@ -31,6 +31,7 @@ A form field for picking one value from a list too long to show as radios, with
|
|
|
31
31
|
- `disabled` takes the trigger out of the tab order and mutes the label. `required` sets `aria-required` on the trigger; report a missing value through `error`.
|
|
32
32
|
- The trigger and the open listbox are both named by `label`.
|
|
33
33
|
- Style props, `className` and `style` go to the `Field` around the label, trigger and messages, not to the trigger or the popup.
|
|
34
|
+
- The popup stops 8px from the viewport's edges. A long option's label wraps, breaking inside a URL or hash if it has to, so there is no need to shorten labels or set a width to fit them.
|
|
34
35
|
- 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` `popover`, below the trigger by default, and flips when it would overflow the viewport.
|
|
35
36
|
- Never add key handlers or `tabIndex`; Base UI handles the keyboard.
|
|
36
37
|
- The module has no hooks, so a server component can render it; `onValueChange` must come from a client component.
|
package/dist/docs/Toast.md
CHANGED
|
@@ -26,6 +26,7 @@ Tells the user briefly about the result of an action without interrupting them:
|
|
|
26
26
|
- `variant` is `info` (the default), `success` or `error`. Each has its own icon, so the variant never rests on color alone. The icons are `fgMuted`, `success` and `danger`, on `bgRaised`.
|
|
27
27
|
- `action` takes a `label` and an `onClick`; there is at most one. Choosing it also closes the toast. Nothing essential goes there: Undo is fine when the user could also undo another way; "Retry" on an error is fine because an error stays until it is dismissed.
|
|
28
28
|
- `duration` is how long, in milliseconds, before the toast closes itself; `0` keeps it until the user dismisses it. It defaults to 5000, and to 0 for `error`, so the user always gets time to read an error.
|
|
29
|
+
- `onClose` is called once when the toast closes, however it closes: its close button, Escape, a swipe, its timer, its action, or `close(id)`. It takes no reason, so it cannot tell a user's dismissal from the app's own `close(id)`. Use it to remember a notice was seen, such as one that should not come back on reload.
|
|
29
30
|
- Every toast has a close button. `closeLabel` on the provider names it for every toast ("Dismiss" by default) and `regionLabel` names the stack's landmark ("Notifications" by default); translate both there.
|
|
30
31
|
- `limit` on the provider (3 by default) caps how many show at once: the newest. Older ones are hidden until a newer one leaves, so an error that stays until dismissed can be hidden by later toasts. The newest sits at the top, nearest the content.
|
|
31
32
|
- The stack portals into the provider's nearest `ThemeProvider`, so it keeps the brand and mode, and sits on `zIndex` `toast`, above modals. That provider must not clip or stack its content: wrap the app root. `className` and `style` on the provider reach the stack.
|
|
@@ -64,6 +65,12 @@ async function save() {
|
|
|
64
65
|
toast.add({ title: "Conversation archived", action: { label: "Undo", onClick: unarchive } });
|
|
65
66
|
```
|
|
66
67
|
|
|
68
|
+
```tsx
|
|
69
|
+
// A notice the user has seen stays gone on reload. `onClose` also runs when the app calls
|
|
70
|
+
// `close(id)`, so an app that closes this one itself marks it seen there too, or not at all.
|
|
71
|
+
toast.add({ title: "New screenshots ready", duration: 0, onClose: () => markSeen(batch.id) });
|
|
72
|
+
```
|
|
73
|
+
|
|
67
74
|
## Don't
|
|
68
75
|
|
|
69
76
|
```tsx
|
package/dist/docs/llms.txt
CHANGED
|
@@ -27,7 +27,7 @@
|
|
|
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
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
|
-
- [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.
|
|
30
|
+
- [Menu](Menu.md): A list of actions that opens from a button: a row's "Edit, Duplicate, Delete", a toolbar's overflow. An entry can open a nested list. 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).
|
|
32
32
|
- [NavList](NavList.md): A column of links to an app's pages, with the current page marked: a sidebar's or a settings page's navigation. The parts are `NavList` (a named `nav` around a list), `NavList.Group` (a heading over a run of items) and `NavList.Item` (one link, with an optional leading icon, live dot and trailing count, and an optional `action` beside the link: a control for that row, such as its ⋯ menu). Items are links, not buttons: an `<a>` by default, or a router's `Link` through `as`, which keeps the router's props typed (ADR 0149). The app says which item is current; NavList reads nothing from the URL.
|
|
33
33
|
- [NumberField](NumberField.md): A form field for a bounded number: a text input between a decrement button (inline start) and an increment button (inline end), with the number centred between them. Built on Base UI's `NumberField` (ADR 0003, 0161); it composes `Field` for its label, description and error (ADR 0026). Three sizes at Button's heights (`sm`, `med`, `lg`: 24, 32 and 40 px, ADR 0124); the input fills the Field's width.
|
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.22.0",
|
|
5
5
|
"components": [
|
|
6
6
|
{
|
|
7
7
|
"name": "AlertDialog",
|
|
@@ -1335,6 +1335,11 @@
|
|
|
1335
1335
|
"name": "IconButton",
|
|
1336
1336
|
"styleProps": true,
|
|
1337
1337
|
"props": [
|
|
1338
|
+
{
|
|
1339
|
+
"name": "aria-busy",
|
|
1340
|
+
"type": "\"false\" | \"true\" | boolean",
|
|
1341
|
+
"required": false
|
|
1342
|
+
},
|
|
1338
1343
|
{
|
|
1339
1344
|
"name": "as",
|
|
1340
1345
|
"type": "ElementType",
|
|
@@ -1355,6 +1360,11 @@
|
|
|
1355
1360
|
"type": "string",
|
|
1356
1361
|
"required": true
|
|
1357
1362
|
},
|
|
1363
|
+
{
|
|
1364
|
+
"name": "loading",
|
|
1365
|
+
"type": "boolean",
|
|
1366
|
+
"required": false
|
|
1367
|
+
},
|
|
1358
1368
|
{
|
|
1359
1369
|
"name": "size",
|
|
1360
1370
|
"type": "\"lg\" | \"med\" | \"sm\"",
|
|
@@ -1708,6 +1718,113 @@
|
|
|
1708
1718
|
}
|
|
1709
1719
|
]
|
|
1710
1720
|
},
|
|
1721
|
+
{
|
|
1722
|
+
"name": "Menu.SubmenuRoot",
|
|
1723
|
+
"styleProps": false,
|
|
1724
|
+
"props": [
|
|
1725
|
+
{
|
|
1726
|
+
"name": "children",
|
|
1727
|
+
"type": "ReactNode",
|
|
1728
|
+
"required": false
|
|
1729
|
+
},
|
|
1730
|
+
{
|
|
1731
|
+
"name": "closeParentOnEsc",
|
|
1732
|
+
"type": "boolean",
|
|
1733
|
+
"required": false,
|
|
1734
|
+
"description": "When in a submenu, determines whether pressing the Escape key\ncloses the entire menu, or only the current child menu."
|
|
1735
|
+
},
|
|
1736
|
+
{
|
|
1737
|
+
"name": "defaultOpen",
|
|
1738
|
+
"type": "boolean",
|
|
1739
|
+
"required": false,
|
|
1740
|
+
"description": "Whether the menu is initially open.\n\nTo render a controlled menu, use the `open` prop instead."
|
|
1741
|
+
},
|
|
1742
|
+
{
|
|
1743
|
+
"name": "disabled",
|
|
1744
|
+
"type": "boolean",
|
|
1745
|
+
"required": false,
|
|
1746
|
+
"description": "Whether the component should ignore user interaction."
|
|
1747
|
+
},
|
|
1748
|
+
{
|
|
1749
|
+
"name": "loopFocus",
|
|
1750
|
+
"type": "boolean",
|
|
1751
|
+
"required": false,
|
|
1752
|
+
"description": "Whether to loop keyboard focus back to the first item\nwhen the end of the list is reached while using the arrow keys."
|
|
1753
|
+
},
|
|
1754
|
+
{
|
|
1755
|
+
"name": "onOpenChange",
|
|
1756
|
+
"type": "((open: boolean, eventDetails: MenuRootChangeEventDetails) => void)",
|
|
1757
|
+
"required": false,
|
|
1758
|
+
"description": "Event handler called when the menu is opened or closed."
|
|
1759
|
+
},
|
|
1760
|
+
{
|
|
1761
|
+
"name": "open",
|
|
1762
|
+
"type": "boolean",
|
|
1763
|
+
"required": false,
|
|
1764
|
+
"description": "Whether the menu is currently open."
|
|
1765
|
+
}
|
|
1766
|
+
]
|
|
1767
|
+
},
|
|
1768
|
+
{
|
|
1769
|
+
"name": "Menu.SubmenuTrigger",
|
|
1770
|
+
"styleProps": true,
|
|
1771
|
+
"props": [
|
|
1772
|
+
{
|
|
1773
|
+
"name": "className",
|
|
1774
|
+
"type": "string",
|
|
1775
|
+
"required": false
|
|
1776
|
+
},
|
|
1777
|
+
{
|
|
1778
|
+
"name": "closeDelay",
|
|
1779
|
+
"type": "number",
|
|
1780
|
+
"required": false,
|
|
1781
|
+
"description": "How long to wait before closing the menu that was opened on hover.\nSpecified in milliseconds.\n\nRequires the `openOnHover` prop."
|
|
1782
|
+
},
|
|
1783
|
+
{
|
|
1784
|
+
"name": "delay",
|
|
1785
|
+
"type": "number",
|
|
1786
|
+
"required": false,
|
|
1787
|
+
"description": "How long to wait before the menu may be opened on hover. Specified in milliseconds.\n\nRequires the `openOnHover` prop."
|
|
1788
|
+
},
|
|
1789
|
+
{
|
|
1790
|
+
"name": "description",
|
|
1791
|
+
"type": "ReactNode",
|
|
1792
|
+
"required": false
|
|
1793
|
+
},
|
|
1794
|
+
{
|
|
1795
|
+
"name": "iconStart",
|
|
1796
|
+
"type": "ComponentType",
|
|
1797
|
+
"required": false
|
|
1798
|
+
},
|
|
1799
|
+
{
|
|
1800
|
+
"name": "id",
|
|
1801
|
+
"type": "string",
|
|
1802
|
+
"required": false
|
|
1803
|
+
},
|
|
1804
|
+
{
|
|
1805
|
+
"name": "label",
|
|
1806
|
+
"type": "string",
|
|
1807
|
+
"required": false,
|
|
1808
|
+
"description": "Overrides the text used for keyboard text navigation and filtering.\nFalls back to the rendered text when not provided."
|
|
1809
|
+
},
|
|
1810
|
+
{
|
|
1811
|
+
"name": "onClick",
|
|
1812
|
+
"type": "((event: BaseUIEvent<MouseEvent<HTMLDivElement, MouseEvent>>) => void)",
|
|
1813
|
+
"required": false
|
|
1814
|
+
},
|
|
1815
|
+
{
|
|
1816
|
+
"name": "openOnHover",
|
|
1817
|
+
"type": "boolean",
|
|
1818
|
+
"required": false,
|
|
1819
|
+
"description": "Whether the menu should also open when the trigger is hovered."
|
|
1820
|
+
},
|
|
1821
|
+
{
|
|
1822
|
+
"name": "style",
|
|
1823
|
+
"type": "CSSProperties",
|
|
1824
|
+
"required": false
|
|
1825
|
+
}
|
|
1826
|
+
]
|
|
1827
|
+
},
|
|
1711
1828
|
{
|
|
1712
1829
|
"name": "Menu.Trigger",
|
|
1713
1830
|
"styleProps": true,
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# 0.22.0
|
|
2
|
+
|
|
3
|
+
NavList rows inset their end elements by the room the row leaves and nest their corners around the action (decision 0178). Two style props stop applying as a result: `borderRadius` on the control in a row's `action`, which is now `xs`, and `borderRadius`, `paddingInline`, `paddingInlineStart` or `paddingInlineEnd` on a `NavList.Item` in a collapsed Sidebar's rail, which keeps `xs` and `8`.
|
|
4
|
+
|
|
5
|
+
## Find
|
|
6
|
+
|
|
7
|
+
In the app's source (`*.tsx`), every `NavList.Item` with a style-prop override: regex `<NavList\.Item[^>]*\b(borderRadius|paddingInline(Start|End)?)=`. A match matters only when the item renders in a collapsed `Sidebar`.
|
|
8
|
+
|
|
9
|
+
Every `borderRadius` on a control passed to `action`: regex `action=\{[\s\S]*?borderRadius=` in files that import `NavList`.
|
|
10
|
+
|
|
11
|
+
An app whose rows override the end insets by hand for the old values, such as a negative margin on an `Avatar` or a trigger in a row: regex `<NavList\.Item[\s\S]*?margin(Inline|InlineStart|InlineEnd)=` in those same files.
|
|
12
|
+
|
|
13
|
+
## Replace
|
|
14
|
+
|
|
15
|
+
Delete a `borderRadius` on the action's control. On a `NavList.Item`, delete the prop if it was set for the rail, since the rail has no prop to replace it. Keep it if the open row needs it: it still applies while the Sidebar is open.
|
|
16
|
+
|
|
17
|
+
```tsx
|
|
18
|
+
// before
|
|
19
|
+
<NavList.Item borderRadius="lg" href="/" icon={HomeIcon}>Home</NavList.Item>
|
|
20
|
+
// after
|
|
21
|
+
<NavList.Item href="/" icon={HomeIcon}>Home</NavList.Item>
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
```tsx
|
|
25
|
+
// before
|
|
26
|
+
action={<Menu><Menu.Trigger borderRadius="sm" icon={EllipsisIcon} label="Actions for ui" size="sm" /></Menu>}
|
|
27
|
+
// after
|
|
28
|
+
action={<Menu><Menu.Trigger icon={EllipsisIcon} label="Actions for ui" size="sm" /></Menu>}
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Pass the control as the direct child of `action`; a wrapper element takes the `xs` radius instead of the control. Delete a hand-written inset margin on an end element, since the row now places it.
|
|
32
|
+
|
|
33
|
+
## Verify
|
|
34
|
+
|
|
35
|
+
Run the app's typecheck and open a page with a NavList, with its Sidebar open and collapsed. An open row's avatar sits 6 from its start, a hovered row's action 4 from its end with `xs` corners, and rail items are 40px squares with their glyph centered.
|
package/dist/icons/index.d.mts
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import { CircleAlertIcon } from "./CircleAlertIcon.mjs";
|
|
2
|
-
import { CircleCheckIcon } from "./CircleCheckIcon.mjs";
|
|
3
|
-
import { InfoIcon } from "./InfoIcon.mjs";
|
|
4
1
|
import { ArrowDownIcon } from "./ArrowDownIcon.mjs";
|
|
5
2
|
import { ArrowLeftIcon } from "./ArrowLeftIcon.mjs";
|
|
6
3
|
import { ArrowRightIcon } from "./ArrowRightIcon.mjs";
|
|
@@ -8,6 +5,8 @@ import { ArrowUpIcon } from "./ArrowUpIcon.mjs";
|
|
|
8
5
|
import { CheckIcon } from "./CheckIcon.mjs";
|
|
9
6
|
import { ChevronDownIcon } from "./ChevronDownIcon.mjs";
|
|
10
7
|
import { ChevronRightIcon } from "./ChevronRightIcon.mjs";
|
|
8
|
+
import { CircleAlertIcon } from "./CircleAlertIcon.mjs";
|
|
9
|
+
import { CircleCheckIcon } from "./CircleCheckIcon.mjs";
|
|
11
10
|
import { CircleDotIcon } from "./CircleDotIcon.mjs";
|
|
12
11
|
import { CircleSlashIcon } from "./CircleSlashIcon.mjs";
|
|
13
12
|
import { EllipsisIcon } from "./EllipsisIcon.mjs";
|
|
@@ -16,6 +15,7 @@ import { GitPullRequestClosedIcon } from "./GitPullRequestClosedIcon.mjs";
|
|
|
16
15
|
import { GitPullRequestDraftIcon } from "./GitPullRequestDraftIcon.mjs";
|
|
17
16
|
import { GitPullRequestIcon } from "./GitPullRequestIcon.mjs";
|
|
18
17
|
import { InboxIcon } from "./InboxIcon.mjs";
|
|
18
|
+
import { InfoIcon } from "./InfoIcon.mjs";
|
|
19
19
|
import { LoaderCircleIcon } from "./LoaderCircleIcon.mjs";
|
|
20
20
|
import { LockOpenIcon } from "./LockOpenIcon.mjs";
|
|
21
21
|
import { MinusIcon } from "./MinusIcon.mjs";
|