@jonmilner/ui 0.13.2 → 0.14.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/ColorField/client.d.mts +1 -1
- package/dist/Combobox/Combobox.css +1 -1
- package/dist/Combobox/Combobox.css.mjs +7 -7
- package/dist/Combobox/index.d.mts +2 -1
- package/dist/Combobox/index.mjs +42 -39
- package/dist/MultiSelect/MultiSelect.css +1 -1
- package/dist/MultiSelect/MultiSelect.css.mjs +2 -2
- package/dist/MultiSelect/index.d.mts +2 -1
- package/dist/MultiSelect/index.mjs +35 -32
- package/dist/RadioGroup/RadioGroup.css +1 -1
- package/dist/RadioGroup/RadioGroup.css.mjs +6 -6
- package/dist/RadioGroup/index.d.mts +2 -1
- package/dist/RadioGroup/index.mjs +57 -56
- package/dist/Select/Select.css +1 -1
- package/dist/Select/Select.css.mjs +2 -2
- package/dist/Select/index.d.mts +2 -1
- package/dist/Select/index.mjs +34 -31
- package/dist/TextField/index.d.mts +1 -1
- package/dist/base.css +1 -1
- package/dist/brands/default.mjs +55 -61
- package/dist/brands/forced-colors.mjs +3 -0
- package/dist/brands/neutral.mjs +40 -0
- package/dist/contrast/contrast.d.mts +1 -0
- package/dist/contrast/contrast.mjs +43 -34
- package/dist/docs/ColorField.md +1 -1
- package/dist/docs/Combobox.md +3 -1
- package/dist/docs/MultiSelect.md +3 -1
- package/dist/docs/RadioGroup.md +2 -1
- package/dist/docs/Select.md +3 -1
- package/dist/docs/TextField.md +1 -1
- package/dist/docs/Textarea.md +1 -1
- package/dist/docs/manifest.json +28 -2
- package/dist/docs/migrations/0.14.0.md +72 -0
- package/dist/docs/theming.md +6 -2
- package/dist/popup/listbox-base.mjs +2 -1
- package/dist/styles/atoms.css +1 -1
- package/dist/styles/atoms.css.d.mts +1 -1
- package/dist/styles/atoms.css.mjs +58 -55
- package/dist/theme/define-theme.mjs +27 -25
- package/dist/tokens/contract.d.mts +1 -1
- package/dist/tokens/roles.d.mts +1 -1
- package/dist/tokens/roles.mjs +6 -2
- package/package.json +1 -1
package/dist/Select/index.mjs
CHANGED
|
@@ -2,46 +2,49 @@ import { Field as e } from "../Field/index.mjs";
|
|
|
2
2
|
import { ListboxLabel as t, ListboxScope as n } from "../popup/listbox-base.mjs";
|
|
3
3
|
import { ListboxPopup as r, ListboxPortal as i, ListboxPositioner as a } from "../popup/listbox.mjs";
|
|
4
4
|
import { ListboxOptions as o } from "../popup/listbox-options.mjs";
|
|
5
|
-
import { check as s,
|
|
6
|
-
import { SelectRoot as
|
|
7
|
-
import { jsx as
|
|
5
|
+
import { check as s, hiddenLabel as c, item as l, popup as u } from "./Select.css.mjs";
|
|
6
|
+
import { SelectRoot as d, SelectTrigger as f } from "./client.mjs";
|
|
7
|
+
import { jsx as p, jsxs as m } from "react/jsx-runtime";
|
|
8
8
|
// src/Select/index.tsx
|
|
9
|
-
function
|
|
10
|
-
return /* @__PURE__ */
|
|
11
|
-
...
|
|
12
|
-
className:
|
|
13
|
-
disabled:
|
|
14
|
-
invalid:
|
|
15
|
-
style:
|
|
9
|
+
function h({ options: h, value: g, defaultValue: _, onValueChange: v, label: y, hideLabel: b = !1, description: x, error: S, placeholder: C = "Select", disabled: w = !1, required: T = !1, size: E = "med", name: D, className: O, style: k, ...A }) {
|
|
10
|
+
return /* @__PURE__ */ m(e, {
|
|
11
|
+
...A,
|
|
12
|
+
className: O,
|
|
13
|
+
disabled: w,
|
|
14
|
+
invalid: S != null && S !== !1 && S !== "",
|
|
15
|
+
style: k,
|
|
16
16
|
children: [
|
|
17
|
-
/* @__PURE__ */
|
|
18
|
-
defaultValue:
|
|
19
|
-
disabled:
|
|
20
|
-
name:
|
|
21
|
-
onValueChange:
|
|
22
|
-
required:
|
|
23
|
-
value:
|
|
17
|
+
/* @__PURE__ */ p(n, { children: /* @__PURE__ */ m(d, {
|
|
18
|
+
defaultValue: _,
|
|
19
|
+
disabled: w,
|
|
20
|
+
name: D,
|
|
21
|
+
onValueChange: v,
|
|
22
|
+
required: T,
|
|
23
|
+
value: g,
|
|
24
24
|
children: [
|
|
25
|
-
/* @__PURE__ */
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
options: m,
|
|
29
|
-
placeholder: x,
|
|
30
|
-
size: w
|
|
25
|
+
/* @__PURE__ */ p(t, {
|
|
26
|
+
className: b ? c : void 0,
|
|
27
|
+
children: y
|
|
31
28
|
}),
|
|
32
|
-
/* @__PURE__ */
|
|
33
|
-
|
|
34
|
-
|
|
29
|
+
/* @__PURE__ */ p(f, {
|
|
30
|
+
disabled: w,
|
|
31
|
+
options: h,
|
|
32
|
+
placeholder: C,
|
|
33
|
+
size: E
|
|
34
|
+
}),
|
|
35
|
+
/* @__PURE__ */ p(i, { children: /* @__PURE__ */ p(a, { children: /* @__PURE__ */ p(r, {
|
|
36
|
+
className: u,
|
|
37
|
+
children: /* @__PURE__ */ p(o, {
|
|
35
38
|
checkClassName: s,
|
|
36
|
-
itemClassName:
|
|
37
|
-
options:
|
|
39
|
+
itemClassName: l,
|
|
40
|
+
options: h
|
|
38
41
|
})
|
|
39
42
|
}) }) })
|
|
40
43
|
]
|
|
41
44
|
}) }),
|
|
42
|
-
|
|
43
|
-
/* @__PURE__ */
|
|
45
|
+
x != null && /* @__PURE__ */ p(e.Description, { children: x }),
|
|
46
|
+
/* @__PURE__ */ p(e.Error, { children: S })
|
|
44
47
|
]
|
|
45
48
|
});
|
|
46
49
|
}
|
|
47
|
-
export {
|
|
50
|
+
export { h as Select };
|
|
@@ -2,7 +2,7 @@ import { StyleProps } from "../Box/base.mjs";
|
|
|
2
2
|
import { SearchFieldInputProps } from "../SearchField/client.mjs";
|
|
3
3
|
import "../SearchField/index.mjs";
|
|
4
4
|
import { CSSProperties, ComponentPropsWithRef, ReactNode } from "react";
|
|
5
|
-
export type TextFieldInputProps = Pick<ComponentPropsWithRef<"input">, keyof SearchFieldInputProps | "
|
|
5
|
+
export type TextFieldInputProps = Pick<ComponentPropsWithRef<"input">, keyof SearchFieldInputProps | "inputMode" | "minLength" | "pattern">;
|
|
6
6
|
export type TextFieldProps = StyleProps & {
|
|
7
7
|
className?: string;
|
|
8
8
|
defaultValue?: string;
|
package/dist/base.css
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
@layer tokens, reset, atoms.base, atoms.sm, atoms.med, atoms.lg, atoms.xl, components.box, components.checkbox, components.clickable, components.icon, components.icon-button, components.inline, components.sidebar, components.sidebar-layout, components.stack, components.text, components.avatar, components.badge, components.button, components.chip, components.field, components.color-field, components.combobox, components.heading, components.dialog, components.alert-dialog, components.menu, components.multiselect, components.nav-list, components.radio-group, components.search-field, components.select, components.switch, components.tabs, components.tag, components.text-field, components.textarea, components.toast, components.tooltip, components.visually-hidden, components.table;
|
|
2
2
|
@layer tokens{:root{--space-0:0rem;--space-1:.0625rem;--space-2:.125rem;--space-4:.25rem;--space-6:.375rem;--space-8:.5rem;--space-12:.75rem;--space-16:1rem;--space-20:1.25rem;--space-24:1.5rem;--space-32:2rem;--space-40:2.5rem;--space-48:3rem;--space-64:4rem;--space-80:5rem;--space-96:6rem;--size-xs:1.5rem;--size-sm:2rem;--size-med:2.5rem;--size-lg:3rem;--size-xl:3.5rem;--container-sidebar:15rem;--container-rail:3.5rem;--container-prose:40rem;--container-page:64rem;--container-wide:80rem;--radius-none:0;--radius-sm:.25rem;--radius-med:.5rem;--radius-lg:.75rem;--radius-xl:1rem;--radius-full:9999px;--font-size-xs:.75rem;--font-size-sm:.875rem;--font-size-med:1rem;--font-size-lg:1.125rem;--font-size-xl:1.25rem;--font-size-2xl:1.5rem;--font-size-3xl:1.875rem;--font-size-4xl:2.25rem;--font-weight-regular:400;--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--line-height-sm:1.25;--line-height-med:1.5;--line-height-lg:1.75;--z-index-base:0;--z-index-raised:1;--z-index-dropdown:1000;--z-index-sticky:1100;--z-index-overlay:1200;--z-index-modal:1300;--z-index-popover:1400;--z-index-toast:1500;--z-index-tooltip:1600;--duration-fast:.12s;--duration-med:.2s;--duration-slow:.32s;--easing-standard:cubic-bezier(.2, 0, 0, 1);--easing-enter:cubic-bezier(0, 0, 0, 1);--easing-exit:cubic-bezier(.3, 0, 1, 1);--distance-sm:.25rem;--distance-med:.5rem;--distance-lg:1rem;--scale-sm:.02;--scale-med:.05;--scale-lg:.1}[data-brand]{--shadow-sm:0 1px 2px color-mix(in srgb, var(--color-shadow) 12%, transparent);--shadow-med:0 2px 8px color-mix(in srgb, var(--color-shadow) 14%, transparent), 0 1px 2px color-mix(in srgb, var(--color-shadow) 8%, transparent);--shadow-lg:0 8px 24px color-mix(in srgb, var(--color-shadow) 16%, transparent), 0 2px 6px color-mix(in srgb, var(--color-shadow) 8%, transparent)}[data-brand][data-mode=light]{color-scheme:light}[data-brand][data-mode=dark]{--shadow-sm:0 0 0 1px color-mix(in srgb, var(--color-fg) 10%, transparent), 0 1px 2px color-mix(in srgb, var(--color-shadow) 40%, transparent);--shadow-med:0 0 0 1px color-mix(in srgb, var(--color-fg) 10%, transparent), 0 2px 8px color-mix(in srgb, var(--color-shadow) 48%, transparent), 0 1px 2px color-mix(in srgb, var(--color-shadow) 32%, transparent);--shadow-lg:0 0 0 1px color-mix(in srgb, var(--color-fg) 10%, transparent), 0 8px 24px color-mix(in srgb, var(--color-shadow) 56%, transparent), 0 2px 6px color-mix(in srgb, var(--color-shadow) 32%, transparent);color-scheme:dark}[data-brand][data-mode=system]{color-scheme:light dark}:dir(ltr){--dir:1}:dir(rtl){--dir:-1}@media (prefers-color-scheme:dark){[data-brand][data-mode=system]{--shadow-sm:0 0 0 1px color-mix(in srgb, var(--color-fg) 10%, transparent), 0 1px 2px color-mix(in srgb, var(--color-shadow) 40%, transparent);--shadow-med:0 0 0 1px color-mix(in srgb, var(--color-fg) 10%, transparent), 0 2px 8px color-mix(in srgb, var(--color-shadow) 48%, transparent), 0 1px 2px color-mix(in srgb, var(--color-shadow) 32%, transparent);--shadow-lg:0 0 0 1px color-mix(in srgb, var(--color-fg) 10%, transparent), 0 8px 24px color-mix(in srgb, var(--color-shadow) 56%, transparent), 0 2px 6px color-mix(in srgb, var(--color-shadow) 32%, transparent)}}@media (prefers-reduced-motion:reduce){:root{--distance-sm:0rem;--distance-med:0rem;--distance-lg:0rem;--scale-sm:0;--scale-med:0;--scale-lg:0;--duration-fast:.12s;--duration-med:.12s;--duration-slow:.12s}}}
|
|
3
3
|
|
|
4
|
-
@font-face{src:local(Arial),local(ArialMT);font-weight:400;font-style:normal;size-adjust:101.568%;ascent-override:95.3892%;descent-override:23.7511%;line-gap-override:0%;font-family:Inter Fallback Arial}@font-face{src:local(Arial Bold),local(Arial-BoldMT);font-weight:700;font-style:normal;size-adjust:101.637%;ascent-override:95.3241%;descent-override:23.7349%;line-gap-override:0%;font-family:Inter Fallback Arial}@font-face{src:local(Arial Italic),local(Arial-ItalicMT);font-weight:400;font-style:italic;size-adjust:101.637%;ascent-override:95.3241%;descent-override:23.7349%;line-gap-override:0%;font-family:Inter Fallback Arial}@font-face{src:local(Arial Bold Italic),local(Arial-BoldItalicMT);font-weight:700;font-style:italic;size-adjust:101.706%;ascent-override:95.2591%;descent-override:23.7187%;line-gap-override:0%;font-family:Inter Fallback Arial}@font-face{src:local(Menlo Regular),local(Menlo-Regular);font-weight:400;font-style:normal;size-adjust:100.137%;ascent-override:101.871%;descent-override:29.9621%;line-gap-override:0%;font-family:JetBrains Mono Fallback Menlo}@font-face{src:local(Menlo Bold),local(Menlo-Bold);font-weight:700;font-style:normal;size-adjust:100.003%;ascent-override:102.007%;descent-override:30.0022%;line-gap-override:0%;font-family:JetBrains Mono Fallback Menlo}@font-face{src:local(Menlo Italic),local(Menlo-Italic);font-weight:400;font-style:italic;size-adjust:100.137%;ascent-override:101.871%;descent-override:29.9621%;line-gap-override:0%;font-family:JetBrains Mono Fallback Menlo}@font-face{src:local(Menlo Bold Italic),local(Menlo-BoldItalic);font-weight:700;font-style:italic;size-adjust:100.003%;ascent-override:102.007%;descent-override:30.0022%;line-gap-override:0%;font-family:JetBrains Mono Fallback Menlo}@font-face{src:local(Consolas);font-weight:400;font-style:normal;size-adjust:114.387%;ascent-override:89.1798%;descent-override:26.2293%;line-gap-override:0%;font-family:JetBrains Mono Fallback Consolas}@font-face{src:local(Consolas Bold),local(Consolas-Bold);font-weight:700;font-style:normal;size-adjust:114.387%;ascent-override:89.1798%;descent-override:26.2293%;line-gap-override:0%;font-family:JetBrains Mono Fallback Consolas}@font-face{src:local(Consolas Italic),local(Consolas-Italic);font-weight:400;font-style:italic;size-adjust:114.387%;ascent-override:89.1798%;descent-override:26.2293%;line-gap-override:0%;font-family:JetBrains Mono Fallback Consolas}@font-face{src:local(Consolas Bold Italic),local(Consolas-BoldItalic);font-weight:700;font-style:italic;size-adjust:114.387%;ascent-override:89.1798%;descent-override:26.2293%;line-gap-override:0%;font-family:JetBrains Mono Fallback Consolas}@font-face{src:local(Courier New),local(CourierNewPSMT);font-weight:400;font-style:normal;size-adjust:127.781%;ascent-override:79.8319%;descent-override:23.48%;line-gap-override:0%;font-family:JetBrains Mono Fallback Courier New}@font-face{src:local(Courier New Bold),local(CourierNewPS-BoldMT);font-weight:700;font-style:normal;size-adjust:123.353%;ascent-override:82.6977%;descent-override:24.3229%;line-gap-override:0%;font-family:JetBrains Mono Fallback Courier New}@font-face{src:local(Courier New Italic),local(CourierNewPS-ItalicMT);font-weight:400;font-style:italic;size-adjust:127.781%;ascent-override:79.8319%;descent-override:23.48%;line-gap-override:0%;font-family:JetBrains Mono Fallback Courier New}@font-face{src:local(Courier New Bold Italic),local(CourierNewPS-BoldItalicMT);font-weight:700;font-style:italic;size-adjust:123.353%;ascent-override:82.6977%;descent-override:24.3229%;line-gap-override:0%;font-family:JetBrains Mono Fallback Courier New}@layer tokens{[data-brand=default]{--color-bg:light-dark(oklch(100% 0 0),oklch(14.5% .006 265));--color-bg-muted:light-dark(oklch(96.8% .
|
|
4
|
+
@font-face{src:local(Arial),local(ArialMT);font-weight:400;font-style:normal;size-adjust:101.568%;ascent-override:95.3892%;descent-override:23.7511%;line-gap-override:0%;font-family:Inter Fallback Arial}@font-face{src:local(Arial Bold),local(Arial-BoldMT);font-weight:700;font-style:normal;size-adjust:101.637%;ascent-override:95.3241%;descent-override:23.7349%;line-gap-override:0%;font-family:Inter Fallback Arial}@font-face{src:local(Arial Italic),local(Arial-ItalicMT);font-weight:400;font-style:italic;size-adjust:101.637%;ascent-override:95.3241%;descent-override:23.7349%;line-gap-override:0%;font-family:Inter Fallback Arial}@font-face{src:local(Arial Bold Italic),local(Arial-BoldItalicMT);font-weight:700;font-style:italic;size-adjust:101.706%;ascent-override:95.2591%;descent-override:23.7187%;line-gap-override:0%;font-family:Inter Fallback Arial}@font-face{src:local(Menlo Regular),local(Menlo-Regular);font-weight:400;font-style:normal;size-adjust:100.137%;ascent-override:101.871%;descent-override:29.9621%;line-gap-override:0%;font-family:JetBrains Mono Fallback Menlo}@font-face{src:local(Menlo Bold),local(Menlo-Bold);font-weight:700;font-style:normal;size-adjust:100.003%;ascent-override:102.007%;descent-override:30.0022%;line-gap-override:0%;font-family:JetBrains Mono Fallback Menlo}@font-face{src:local(Menlo Italic),local(Menlo-Italic);font-weight:400;font-style:italic;size-adjust:100.137%;ascent-override:101.871%;descent-override:29.9621%;line-gap-override:0%;font-family:JetBrains Mono Fallback Menlo}@font-face{src:local(Menlo Bold Italic),local(Menlo-BoldItalic);font-weight:700;font-style:italic;size-adjust:100.003%;ascent-override:102.007%;descent-override:30.0022%;line-gap-override:0%;font-family:JetBrains Mono Fallback Menlo}@font-face{src:local(Consolas);font-weight:400;font-style:normal;size-adjust:114.387%;ascent-override:89.1798%;descent-override:26.2293%;line-gap-override:0%;font-family:JetBrains Mono Fallback Consolas}@font-face{src:local(Consolas Bold),local(Consolas-Bold);font-weight:700;font-style:normal;size-adjust:114.387%;ascent-override:89.1798%;descent-override:26.2293%;line-gap-override:0%;font-family:JetBrains Mono Fallback Consolas}@font-face{src:local(Consolas Italic),local(Consolas-Italic);font-weight:400;font-style:italic;size-adjust:114.387%;ascent-override:89.1798%;descent-override:26.2293%;line-gap-override:0%;font-family:JetBrains Mono Fallback Consolas}@font-face{src:local(Consolas Bold Italic),local(Consolas-BoldItalic);font-weight:700;font-style:italic;size-adjust:114.387%;ascent-override:89.1798%;descent-override:26.2293%;line-gap-override:0%;font-family:JetBrains Mono Fallback Consolas}@font-face{src:local(Courier New),local(CourierNewPSMT);font-weight:400;font-style:normal;size-adjust:127.781%;ascent-override:79.8319%;descent-override:23.48%;line-gap-override:0%;font-family:JetBrains Mono Fallback Courier New}@font-face{src:local(Courier New Bold),local(CourierNewPS-BoldMT);font-weight:700;font-style:normal;size-adjust:123.353%;ascent-override:82.6977%;descent-override:24.3229%;line-gap-override:0%;font-family:JetBrains Mono Fallback Courier New}@font-face{src:local(Courier New Italic),local(CourierNewPS-ItalicMT);font-weight:400;font-style:italic;size-adjust:127.781%;ascent-override:79.8319%;descent-override:23.48%;line-gap-override:0%;font-family:JetBrains Mono Fallback Courier New}@font-face{src:local(Courier New Bold Italic),local(CourierNewPS-BoldItalicMT);font-weight:700;font-style:italic;size-adjust:123.353%;ascent-override:82.6977%;descent-override:24.3229%;line-gap-override:0%;font-family:JetBrains Mono Fallback Courier New}@layer tokens{[data-brand=default]{--color-bg:light-dark(oklch(100% 0 0),oklch(14.5% .006 265));--color-bg-muted:light-dark(oklch(96.8% .006 265),oklch(27% .006 265));--color-bg-raised:light-dark(oklch(100% 0 0),oklch(20.5% .006 265));--color-bg-panel:light-dark(oklch(98.5% .006 265),oklch(17.7% .006 265));--color-fg:light-dark(oklch(14.5% .006 265),oklch(98.5% .006 265));--color-fg-muted:light-dark(oklch(44.5% .006 265),oklch(71% .006 265));--color-border:light-dark(oklch(92.5% .006 265),oklch(27% .006 265));--color-border-strong:oklch(55.5% .006 265);--color-hover:light-dark(oklch(14.5% .006 265/.04),oklch(98.5% .006 265/.04));--color-control-fill:light-dark(oklch(14.5% .006 265/.05),oklch(98.5% .006 265/.05));--color-selected:light-dark(oklch(14.5% .006 265/.07),oklch(98.5% .006 265/.07));--color-accent:light-dark(oklch(54.6% .19 258),oklch(70.7% .14 258));--color-accent-fg:light-dark(oklch(100% 0 0),oklch(14.5% .006 265));--color-accent-fill:light-dark(oklch(54.6% .19 258),oklch(48.8% .18 258));--color-accent-fill-fg:oklch(100% 0 0);--color-danger:light-dark(oklch(56% .2 25),oklch(70.4% .17 25));--color-danger-fg:light-dark(oklch(100% 0 0),oklch(14.5% .006 265));--color-success:light-dark(oklch(52% .135 150),oklch(76% .15 150));--color-success-fg:light-dark(oklch(100% 0 0),oklch(14.5% .006 265));--color-warning:light-dark(oklch(53% .11 75),oklch(81% .145 75));--color-warning-fg:light-dark(oklch(100% 0 0),oklch(14.5% .006 265));--color-done:light-dark(oklch(55% .2 295),oklch(72% .15 295));--color-done-fg:light-dark(oklch(100% 0 0),oklch(14.5% .006 265));--color-neutral-subtle:light-dark(oklch(96.8% .006 265),oklch(27% .006 265));--color-neutral-subtle-fg:light-dark(oklch(37% .006 265),oklch(87% .006 265));--color-accent-subtle:light-dark(oklch(93.2% .032 258),oklch(28.2% .09 258));--color-accent-subtle-fg:light-dark(oklch(48.8% .18 258),oklch(80.9% .095 258));--color-success-subtle:light-dark(oklch(94.5% .04 150),oklch(26% .06 150));--color-success-subtle-fg:light-dark(oklch(46.5% .12 150),oklch(84% .115 150));--color-warning-subtle:light-dark(oklch(95.5% .03 75),oklch(27% .05 75));--color-warning-subtle-fg:light-dark(oklch(47.5% .1 75),oklch(86% .105 75));--color-danger-subtle:light-dark(oklch(93.6% .032 25),oklch(25.8% .085 25));--color-danger-subtle-fg:light-dark(oklch(50.5% .19 25),oklch(80.8% .105 25));--color-done-subtle:light-dark(oklch(93.8% .032 295),oklch(28% .095 295));--color-done-subtle-fg:light-dark(oklch(49% .19 295),oklch(81.5% .1 295));--color-focus:light-dark(oklch(54.6% .19 258),oklch(70.7% .14 258));--color-shadow:light-dark(oklch(14.5% .006 265),oklch(0% 0 0));--font-body:"Inter", "Inter Fallback Arial", sans-serif;--font-heading:"Inter", "Inter Fallback Arial", sans-serif;--font-display:"Inter", "Inter Fallback Arial", sans-serif;--font-label:"Inter", "Inter Fallback Arial", sans-serif;--font-mono:"JetBrains Mono", "JetBrains Mono Fallback Menlo", "JetBrains Mono Fallback Consolas", "JetBrains Mono Fallback Courier New", monospace;--font-trim-body-cap:.36377;--font-trim-body-baseline:.36377;--font-trim-heading-cap:.36377;--font-trim-heading-baseline:.36377;--font-trim-display-cap:.36377;--font-trim-display-baseline:.36377;--font-trim-label-cap:.36377;--font-trim-label-baseline:.36377;--font-trim-mono-cap:.37;--font-trim-mono-baseline:.36}@media (forced-colors:active){[data-brand][data-brand]{--color-bg:Canvas;--color-bg-muted:Canvas;--color-bg-raised:Canvas;--color-bg-panel:Canvas;--color-fg:CanvasText;--color-fg-muted:CanvasText;--color-border:CanvasText;--color-border-strong:CanvasText;--color-hover:Highlight;--color-control-fill:ButtonFace;--color-selected:Highlight;--color-accent:LinkText;--color-accent-fg:Canvas;--color-accent-fill:LinkText;--color-accent-fill-fg:Canvas;--color-danger:CanvasText;--color-danger-fg:Canvas;--color-success:CanvasText;--color-success-fg:Canvas;--color-warning:CanvasText;--color-warning-fg:Canvas;--color-done:CanvasText;--color-done-fg:Canvas;--color-neutral-subtle:Canvas;--color-neutral-subtle-fg:CanvasText;--color-accent-subtle:Canvas;--color-accent-subtle-fg:CanvasText;--color-success-subtle:Canvas;--color-success-subtle-fg:CanvasText;--color-warning-subtle:Canvas;--color-warning-subtle-fg:CanvasText;--color-danger-subtle:Canvas;--color-danger-subtle-fg:CanvasText;--color-done-subtle:Canvas;--color-done-subtle-fg:CanvasText;--color-focus:Highlight;--color-shadow:CanvasText}}}
|
|
5
5
|
|
|
6
6
|
@layer reset{*,:before,:after{box-sizing:border-box}*{margin:0}html{-webkit-text-size-adjust:100%;-moz-text-size-adjust:100%;text-size-adjust:100%}body{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;min-block-size:100dvb;line-height:1.5}img,picture,video,canvas,svg{max-inline-size:100%;display:block}input,button,textarea,select{font:inherit;color:inherit}p,h1,h2,h3,h4,h5,h6{overflow-wrap:break-word}h1,h2,h3,h4,h5,h6{text-wrap:balance}}
|
package/dist/brands/default.mjs
CHANGED
|
@@ -1,20 +1,11 @@
|
|
|
1
1
|
import { lightDark as e } from "./brand.mjs";
|
|
2
2
|
import { arial as t, consolas as n, courierNew as r, inter as i, jetBrainsMono as a, menlo as o } from "./metrics.mjs";
|
|
3
|
+
import { neutralRamp as s, neutralRoles as c } from "./neutral.mjs";
|
|
3
4
|
// src/brands/default.ts
|
|
4
|
-
var
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
300: [.87, .008],
|
|
9
|
-
400: [.71, .012],
|
|
10
|
-
500: [.555, .014],
|
|
11
|
-
600: [.445, .014],
|
|
12
|
-
700: [.37, .013],
|
|
13
|
-
800: [.27, .01],
|
|
14
|
-
900: [.205, .008],
|
|
15
|
-
925: [.177, .007],
|
|
16
|
-
950: [.145, .006]
|
|
17
|
-
}), d = s(258, {
|
|
5
|
+
var l = (e, t) => Object.fromEntries(Object.entries(t).map(([t, [n, r]]) => [t, `oklch(${n} ${r} ${e})`])), u = "oklch(1 0 0)", d = {
|
|
6
|
+
hue: 265,
|
|
7
|
+
chroma: .006
|
|
8
|
+
}, f = s(d), p = l(258, {
|
|
18
9
|
50: [.97, .014],
|
|
19
10
|
100: [.932, .032],
|
|
20
11
|
200: [.882, .056],
|
|
@@ -26,7 +17,7 @@ var s = (e, t) => Object.fromEntries(Object.entries(t).map(([t, [n, r]]) => [t,
|
|
|
26
17
|
800: [.424, .155],
|
|
27
18
|
900: [.379, .135],
|
|
28
19
|
950: [.282, .09]
|
|
29
|
-
}),
|
|
20
|
+
}), m = l(25, {
|
|
30
21
|
50: [.971, .013],
|
|
31
22
|
100: [.936, .032],
|
|
32
23
|
200: [.885, .06],
|
|
@@ -38,7 +29,7 @@ var s = (e, t) => Object.fromEntries(Object.entries(t).map(([t, [n, r]]) => [t,
|
|
|
38
29
|
800: [.444, .16],
|
|
39
30
|
900: [.396, .13],
|
|
40
31
|
950: [.258, .085]
|
|
41
|
-
}),
|
|
32
|
+
}), h = l(150, {
|
|
42
33
|
50: [.975, .018],
|
|
43
34
|
100: [.945, .04],
|
|
44
35
|
200: [.9, .075],
|
|
@@ -50,7 +41,7 @@ var s = (e, t) => Object.fromEntries(Object.entries(t).map(([t, [n, r]]) => [t,
|
|
|
50
41
|
800: [.41, .1],
|
|
51
42
|
900: [.36, .085],
|
|
52
43
|
950: [.26, .06]
|
|
53
|
-
}),
|
|
44
|
+
}), g = l(75, {
|
|
54
45
|
50: [.98, .012],
|
|
55
46
|
100: [.955, .03],
|
|
56
47
|
200: [.915, .06],
|
|
@@ -62,7 +53,7 @@ var s = (e, t) => Object.fromEntries(Object.entries(t).map(([t, [n, r]]) => [t,
|
|
|
62
53
|
800: [.42, .085],
|
|
63
54
|
900: [.37, .07],
|
|
64
55
|
950: [.27, .05]
|
|
65
|
-
}),
|
|
56
|
+
}), _ = l(295, {
|
|
66
57
|
50: [.97, .014],
|
|
67
58
|
100: [.938, .032],
|
|
68
59
|
200: [.886, .06],
|
|
@@ -74,11 +65,11 @@ var s = (e, t) => Object.fromEntries(Object.entries(t).map(([t, [n, r]]) => [t,
|
|
|
74
65
|
800: [.425, .165],
|
|
75
66
|
900: [.38, .14],
|
|
76
67
|
950: [.28, .095]
|
|
77
|
-
}),
|
|
68
|
+
}), v = {
|
|
78
69
|
metrics: i,
|
|
79
70
|
fallback: t,
|
|
80
71
|
generic: "sans-serif"
|
|
81
|
-
},
|
|
72
|
+
}, y = {
|
|
82
73
|
metrics: a,
|
|
83
74
|
fallback: [
|
|
84
75
|
o,
|
|
@@ -86,50 +77,53 @@ var s = (e, t) => Object.fromEntries(Object.entries(t).map(([t, [n, r]]) => [t,
|
|
|
86
77
|
r
|
|
87
78
|
],
|
|
88
79
|
generic: "monospace"
|
|
89
|
-
},
|
|
80
|
+
}, b = c(d), x = {
|
|
90
81
|
name: "default",
|
|
91
82
|
color: {
|
|
92
|
-
bg:
|
|
93
|
-
bgMuted:
|
|
94
|
-
bgRaised:
|
|
95
|
-
bgPanel:
|
|
96
|
-
fg:
|
|
97
|
-
fgMuted:
|
|
98
|
-
border:
|
|
99
|
-
borderStrong:
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
83
|
+
bg: b.bg,
|
|
84
|
+
bgMuted: b.bgMuted,
|
|
85
|
+
bgRaised: b.bgRaised,
|
|
86
|
+
bgPanel: b.bgPanel,
|
|
87
|
+
fg: b.fg,
|
|
88
|
+
fgMuted: b.fgMuted,
|
|
89
|
+
border: b.border,
|
|
90
|
+
borderStrong: b.borderStrong,
|
|
91
|
+
hover: b.hover,
|
|
92
|
+
controlFill: b.controlFill,
|
|
93
|
+
selected: b.selected,
|
|
94
|
+
accent: e(p[600], p[400]),
|
|
95
|
+
accentFg: e(u, f[950]),
|
|
96
|
+
accentFill: e(p[600], p[700]),
|
|
97
|
+
accentFillFg: e(u, u),
|
|
98
|
+
danger: e(m[600], m[400]),
|
|
99
|
+
dangerFg: e(u, f[950]),
|
|
100
|
+
success: e(h[600], h[400]),
|
|
101
|
+
successFg: e(u, f[950]),
|
|
102
|
+
warning: e(g[600], g[400]),
|
|
103
|
+
warningFg: e(u, f[950]),
|
|
104
|
+
done: e(_[600], _[400]),
|
|
105
|
+
doneFg: e(u, f[950]),
|
|
106
|
+
neutralSubtle: b.neutralSubtle,
|
|
107
|
+
neutralSubtleFg: b.neutralSubtleFg,
|
|
108
|
+
accentSubtle: e(p[100], p[950]),
|
|
109
|
+
accentSubtleFg: e(p[700], p[300]),
|
|
110
|
+
successSubtle: e(h[100], h[950]),
|
|
111
|
+
successSubtleFg: e(h[700], h[300]),
|
|
112
|
+
warningSubtle: e(g[100], g[950]),
|
|
113
|
+
warningSubtleFg: e(g[700], g[300]),
|
|
114
|
+
dangerSubtle: e(m[100], m[950]),
|
|
115
|
+
dangerSubtleFg: e(m[700], m[300]),
|
|
116
|
+
doneSubtle: e(_[100], _[950]),
|
|
117
|
+
doneSubtleFg: e(_[700], _[300]),
|
|
118
|
+
focus: e(p[600], p[400]),
|
|
119
|
+
shadow: b.shadow
|
|
126
120
|
},
|
|
127
121
|
font: {
|
|
128
|
-
body:
|
|
129
|
-
heading:
|
|
130
|
-
display:
|
|
131
|
-
label:
|
|
132
|
-
mono:
|
|
122
|
+
body: v,
|
|
123
|
+
heading: v,
|
|
124
|
+
display: v,
|
|
125
|
+
label: v,
|
|
126
|
+
mono: y
|
|
133
127
|
}
|
|
134
128
|
};
|
|
135
|
-
export {
|
|
129
|
+
export { x as defaultBrand };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { lightDark as e } from "./brand.mjs";
|
|
2
|
+
// src/brands/neutral.ts
|
|
3
|
+
var t = {
|
|
4
|
+
50: .985,
|
|
5
|
+
100: .968,
|
|
6
|
+
200: .925,
|
|
7
|
+
300: .87,
|
|
8
|
+
400: .71,
|
|
9
|
+
500: .555,
|
|
10
|
+
600: .445,
|
|
11
|
+
700: .37,
|
|
12
|
+
800: .27,
|
|
13
|
+
900: .205,
|
|
14
|
+
925: .177,
|
|
15
|
+
950: .145
|
|
16
|
+
}, n = ({ hue: e, chroma: n }, r, i) => `oklch(${t[r]} ${n} ${e}${i === void 0 ? "" : ` / ${i}`})`, r = (e) => Object.fromEntries(Object.keys(t).map((t) => [t, n(e, Number(t))])), i = (t, r, i) => e(n(t, r, i), n(t, r === 950 ? 50 : 1e3 - r, i)), a = "oklch(1 0 0)", o = "oklch(0 0 0)", s = {
|
|
17
|
+
hover: .04,
|
|
18
|
+
controlFill: .05,
|
|
19
|
+
selected: .07
|
|
20
|
+
};
|
|
21
|
+
function c(t) {
|
|
22
|
+
let n = r(t);
|
|
23
|
+
return {
|
|
24
|
+
bg: e(a, n[950]),
|
|
25
|
+
bgMuted: e(n[100], n[800]),
|
|
26
|
+
bgRaised: e(a, n[900]),
|
|
27
|
+
bgPanel: e(n[50], n[925]),
|
|
28
|
+
fg: i(t, 950),
|
|
29
|
+
fgMuted: i(t, 600),
|
|
30
|
+
border: i(t, 200),
|
|
31
|
+
borderStrong: i(t, 500),
|
|
32
|
+
hover: i(t, 950, s.hover),
|
|
33
|
+
controlFill: i(t, 950, s.controlFill),
|
|
34
|
+
selected: i(t, 950, s.selected),
|
|
35
|
+
neutralSubtle: e(n[100], n[800]),
|
|
36
|
+
neutralSubtleFg: i(t, 700),
|
|
37
|
+
shadow: e(n[950], o)
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
export { r as neutralRamp, c as neutralRoles };
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import { subtleFills as e } from "../styles/subtle-fills.mjs";
|
|
2
2
|
import { decode as t, resolveColor as n } from "./color.mjs";
|
|
3
|
+
import { overlayRoles as r } from "../tokens/roles.mjs";
|
|
3
4
|
// src/contrast/contrast.ts
|
|
4
|
-
var
|
|
5
|
+
var i = [
|
|
5
6
|
"bg",
|
|
6
7
|
"bgMuted",
|
|
7
8
|
"bgRaised",
|
|
8
9
|
"bgPanel"
|
|
9
|
-
],
|
|
10
|
+
], a = (e, t, n) => e.flatMap((e) => t.map((t) => ({
|
|
10
11
|
fg: e,
|
|
11
12
|
bg: t,
|
|
12
13
|
min: n
|
|
13
|
-
}))),
|
|
14
|
-
...
|
|
14
|
+
}))), o = Object.values(e).map(({ color: e, backgroundColor: t }) => [e, t]), s = [
|
|
15
|
+
...a([
|
|
15
16
|
"fg",
|
|
16
17
|
"fgMuted",
|
|
17
18
|
"accent",
|
|
@@ -19,45 +20,53 @@ var r = [
|
|
|
19
20
|
"success",
|
|
20
21
|
"warning",
|
|
21
22
|
"done"
|
|
22
|
-
],
|
|
23
|
-
...
|
|
24
|
-
...
|
|
25
|
-
...
|
|
26
|
-
...
|
|
27
|
-
...
|
|
28
|
-
...
|
|
29
|
-
...
|
|
30
|
-
...
|
|
31
|
-
...
|
|
32
|
-
...
|
|
33
|
-
|
|
34
|
-
|
|
23
|
+
], i, 4.5),
|
|
24
|
+
...a(["accentFg"], ["accent"], 4.5),
|
|
25
|
+
...a(["accentFillFg"], ["accentFill"], 4.5),
|
|
26
|
+
...a(["dangerFg"], ["danger"], 4.5),
|
|
27
|
+
...a(["successFg"], ["success"], 4.5),
|
|
28
|
+
...a(["warningFg"], ["warning"], 4.5),
|
|
29
|
+
...a(["doneFg"], ["done"], 4.5),
|
|
30
|
+
...o.flatMap(([e, t]) => a([e], [t], 4.5)),
|
|
31
|
+
...a(["borderStrong", "focus"], i, 3),
|
|
32
|
+
...a(["focus"], o.map(([, e]) => e), 3),
|
|
33
|
+
...a(o.map(([e]) => e), ["bg"], 3),
|
|
34
|
+
...a(["fg", "fgMuted"], r, 4.5).flatMap((e) => i.map((t) => ({
|
|
35
|
+
...e,
|
|
36
|
+
over: t
|
|
37
|
+
})))
|
|
38
|
+
], c = ["light", "dark"];
|
|
39
|
+
function l({ r: e, g: n, b: r }) {
|
|
35
40
|
return .2126 * t(e) + .7152 * t(n) + .0722 * t(r);
|
|
36
41
|
}
|
|
37
|
-
function
|
|
38
|
-
return
|
|
42
|
+
function u(e, t, r = "light") {
|
|
43
|
+
return f(n(e, r), n(t, r), t);
|
|
39
44
|
}
|
|
40
|
-
function
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
r:
|
|
44
|
-
g:
|
|
45
|
-
b:
|
|
45
|
+
function d(e, t) {
|
|
46
|
+
let n = (t, n) => t * e.alpha + n * (1 - e.alpha);
|
|
47
|
+
return {
|
|
48
|
+
r: n(e.r, t.r),
|
|
49
|
+
g: n(e.g, t.g),
|
|
50
|
+
b: n(e.b, t.b),
|
|
46
51
|
alpha: 1
|
|
47
|
-
}
|
|
48
|
-
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
function f(e, t, n) {
|
|
55
|
+
if (t.alpha < 1) throw Error(`Contrast background must be opaque: ${n}`);
|
|
56
|
+
let [r, i] = [l(d(e, t)), l(t)].toSorted((e, t) => t - e);
|
|
57
|
+
return (r + .05) / (i + .05);
|
|
49
58
|
}
|
|
50
|
-
function
|
|
51
|
-
return
|
|
59
|
+
function p(e) {
|
|
60
|
+
return c.flatMap((t) => {
|
|
52
61
|
let r = /* @__PURE__ */ new Map(), i = (i) => r.get(i) ?? r.set(i, n(e.color[i], t)).get(i);
|
|
53
|
-
return
|
|
54
|
-
let r =
|
|
55
|
-
return
|
|
62
|
+
return s.flatMap((n) => {
|
|
63
|
+
let r = n.over ? d(i(n.bg), i(n.over)) : i(n.bg), a = f(i(n.fg), r, e.color[n.bg]);
|
|
64
|
+
return a < n.min ? [{
|
|
56
65
|
...n,
|
|
57
66
|
mode: t,
|
|
58
|
-
ratio:
|
|
67
|
+
ratio: a
|
|
59
68
|
}] : [];
|
|
60
69
|
});
|
|
61
70
|
});
|
|
62
71
|
}
|
|
63
|
-
export {
|
|
72
|
+
export { p as checkContrast, d as composite, s as contrastPairs, u as contrastRatio, i as surfaces };
|
package/dist/docs/ColorField.md
CHANGED
|
@@ -27,7 +27,7 @@ A form field for one colour as a `#rrggbb` string: a swatch, the browser's own c
|
|
|
27
27
|
- `disabled` disables both inputs: they leave the tab order and the hex does not submit, with dashed borders. `required` sets the hex input's native `required`.
|
|
28
28
|
- An uncontrolled field does not follow a native form reset; control it if the form resets.
|
|
29
29
|
- Style props, `className` and `style` go to the `Field` around the label, inputs and messages, not to an input.
|
|
30
|
-
- `inputProps` reach the hex input: `ref`, `id`, `autoFocus`, `autoComplete`, `spellCheck`, `enterKeyHint`, `maxLength`, `onKeyDown`, and the `aria-*` valid on a text box, as SearchField's set (ADR 0093, 0110). The field owns `pattern`, `type` and the value. Spell check is off unless you turn it on.
|
|
30
|
+
- `inputProps` reach the hex input: `ref`, `id`, `autoFocus`, `autoComplete`, `spellCheck`, `enterKeyHint`, `maxLength`, `onKeyDown`, and the `aria-*` valid on a text box, as SearchField's set (ADR 0093, 0110, 0154). The field owns `pattern`, `type` and the value. `aria-placeholder` is not among them: hint with `placeholder`, since the hex input has a native placeholder and ARIA says not to set both. Spell check is off unless you turn it on.
|
|
31
31
|
- The module has no hooks, so a server component can render it; `onValueChange`, and an `inputProps` `ref` or `onKeyDown`, must come from a client component.
|
|
32
32
|
|
|
33
33
|
## Do
|
package/dist/docs/Combobox.md
CHANGED
|
@@ -20,7 +20,8 @@ A form field for picking one value, or any number with `multiple`, from a list l
|
|
|
20
20
|
|
|
21
21
|
## Rules
|
|
22
22
|
|
|
23
|
-
- `label` is required and names the field
|
|
23
|
+
- `label` is required and names the field, even when the design shows none: pass `hideLabel` to keep it for assistive technology and hide it from sight, taking no room, so in a toolbar the trigger's top lines up with a `hideLabel` SearchField's input. Never pass an empty label, and never let `placeholder` stand in for one.
|
|
24
|
+
- `description` and `error` render below the trigger through `Field`; a non-empty `error` marks the field invalid and joins the trigger's `aria-describedby`.
|
|
24
25
|
- `options` is a list of `{ value, label, disabled? }`. `label` is plain text: it is what the filter matches, and it is shown in the list and in the trigger.
|
|
25
26
|
- `multiple` (default `false`) sets the value's type. Without it, `value` and `defaultValue` are an option value or `null` for none (`""` counts as none too), and `onValueChange` gets the new value. With it, they are arrays of option values, and `onValueChange` gets the new array. `value` with `onValueChange` controls it; `defaultValue` leaves it uncontrolled.
|
|
26
27
|
- The filter matches the query anywhere in the label, ignoring case, accents and punctuation (Base UI's default). It is empty each time the popup opens. With `multiple`, a pick keeps the query, so several matches can be picked in a row.
|
|
@@ -107,6 +108,7 @@ Generated from the TypeScript types.
|
|
|
107
108
|
| `emptyLabel` | `string` | no | |
|
|
108
109
|
| `error` | `ReactNode` | no | |
|
|
109
110
|
| `filterLabel` | `string` | no | |
|
|
111
|
+
| `hideLabel` | `boolean` | no | |
|
|
110
112
|
| `label` | `ReactNode` | yes | |
|
|
111
113
|
| `multiple` | `boolean` | no | |
|
|
112
114
|
| `name` | `string` | no | |
|
package/dist/docs/MultiSelect.md
CHANGED
|
@@ -20,7 +20,8 @@ A form field for picking any number of values from a list too long to show at on
|
|
|
20
20
|
|
|
21
21
|
## Rules
|
|
22
22
|
|
|
23
|
-
- `label` is required and names the field
|
|
23
|
+
- `label` is required and names the field, even when the design shows none: pass `hideLabel` to keep it for assistive technology and hide it from sight, taking no room, so in a toolbar the trigger's top lines up with a `hideLabel` SearchField's input. Never pass an empty label, and never let `placeholder` stand in for one.
|
|
24
|
+
- `description` and `error` render below the trigger through `Field`; a non-empty `error` marks the field invalid and joins the trigger's `aria-describedby`.
|
|
24
25
|
- `options` is a list of `{ value, label, disabled? }`. `label` is plain text: it is shown in the list and in the trigger summary.
|
|
25
26
|
- `value` with `onValueChange` controls it; `defaultValue` leaves it uncontrolled. Both are arrays of option values, and `onValueChange` gets the new array.
|
|
26
27
|
- `name` makes each selected value submit as its own `name=value` pair, as a `<select multiple>` does; read them with `formData.getAll(name)`. Nothing selected submits nothing.
|
|
@@ -110,6 +111,7 @@ Generated from the TypeScript types.
|
|
|
110
111
|
| `description` | `ReactNode` | no | |
|
|
111
112
|
| `disabled` | `boolean` | no | |
|
|
112
113
|
| `error` | `ReactNode` | no | |
|
|
114
|
+
| `hideLabel` | `boolean` | no | |
|
|
113
115
|
| `label` | `ReactNode` | yes | |
|
|
114
116
|
| `name` | `string` | no | |
|
|
115
117
|
| `onValueChange` | `((value: string[]) => void)` | no | |
|
package/dist/docs/RadioGroup.md
CHANGED
|
@@ -19,7 +19,7 @@ One choice among a few options, all shown at once. A form field built on Base UI
|
|
|
19
19
|
|
|
20
20
|
## Rules
|
|
21
21
|
|
|
22
|
-
- Pass `label`: it is the group's legend and its accessible name. `options` is data, not children: each is `{ value, label, description?, disabled? }`.
|
|
22
|
+
- Pass `label`: it is the group's legend and its accessible name, even when the design shows none: pass `hideLabel` to keep it for assistive technology and hide it from sight, taking no room. Never pass an empty label. `options` is data, not children: each is `{ value, label, description?, disabled? }`.
|
|
23
23
|
- `name` submits the checked option as `name=value`; with none checked, nothing is submitted. Put `name` on the RadioGroup.
|
|
24
24
|
- `value` with `onValueChange` controls it; `defaultValue` leaves it uncontrolled. A controlled `value` of `null` checks none, so start or reset a form with `null`, not `undefined`. `onValueChange` receives the value string only.
|
|
25
25
|
- To start with nothing checked, leave `defaultValue` unset. Pair that with `required` and `error` when an answer is mandatory.
|
|
@@ -108,6 +108,7 @@ Generated from the TypeScript types.
|
|
|
108
108
|
| `description` | `ReactNode` | no | |
|
|
109
109
|
| `disabled` | `boolean` | no | |
|
|
110
110
|
| `error` | `ReactNode` | no | |
|
|
111
|
+
| `hideLabel` | `boolean` | no | |
|
|
111
112
|
| `label` | `ReactNode` | yes | |
|
|
112
113
|
| `name` | `string` | no | |
|
|
113
114
|
| `onValueChange` | `((value: string) => void)` | no | |
|
package/dist/docs/Select.md
CHANGED
|
@@ -19,7 +19,8 @@ A form field for picking one value from a list too long to show as radios, with
|
|
|
19
19
|
|
|
20
20
|
## Rules
|
|
21
21
|
|
|
22
|
-
- `label` is required and names the field
|
|
22
|
+
- `label` is required and names the field, even when the design shows none: pass `hideLabel` to keep it for assistive technology and hide it from sight, taking no room, so in a toolbar the trigger's top lines up with a `hideLabel` SearchField's input. Never pass an empty label, and never let `placeholder` stand in for one.
|
|
23
|
+
- `description` and `error` render below the trigger through `Field`; a non-empty `error` marks the field invalid and joins the trigger's `aria-describedby`.
|
|
23
24
|
- `options` is a list of `{ value, label, disabled? }`. `label` is plain text: it is shown in the list and in the trigger.
|
|
24
25
|
- `value` with `onValueChange` controls it; `defaultValue` leaves it uncontrolled. Both are an option value or `null` for none (`""` counts as none too), and `onValueChange` gets the new value.
|
|
25
26
|
- A `value` that no option holds still shows in the trigger, as the raw value, so a stale or unknown value is seen rather than read as empty.
|
|
@@ -107,6 +108,7 @@ Generated from the TypeScript types.
|
|
|
107
108
|
| `description` | `ReactNode` | no | |
|
|
108
109
|
| `disabled` | `boolean` | no | |
|
|
109
110
|
| `error` | `ReactNode` | no | |
|
|
111
|
+
| `hideLabel` | `boolean` | no | |
|
|
110
112
|
| `label` | `ReactNode` | yes | |
|
|
111
113
|
| `name` | `string` | no | |
|
|
112
114
|
| `onValueChange` | `((value: string \| null) => void)` | no | |
|
package/dist/docs/TextField.md
CHANGED
|
@@ -28,7 +28,7 @@ A form field for one line of text that is not a search: an `<input>` (role `text
|
|
|
28
28
|
- `disabled` uses the native `disabled`: the input leaves the tab order and does not submit, with a dashed border. `required` sets the native `required`.
|
|
29
29
|
- `name` submits the value with its form. A native form reset puts an uncontrolled field back to its `defaultValue` but fires no change, so `onValueChange` misses it; control the field if the form resets and you track the value.
|
|
30
30
|
- Style props, `className` and `style` go to the `Field` around the label, input and messages, not to the input.
|
|
31
|
-
- `inputProps` reach the input: `ref`, `id`, `autoFocus`, `autoComplete`, `spellCheck`, `enterKeyHint`, `inputMode`, `maxLength`, `minLength`, `pattern`, `onKeyDown`, and only the `aria-*` valid on a text box (ADR 0110): `aria-controls`, `aria-activedescendant`, `aria-autocomplete`, `aria-
|
|
31
|
+
- `inputProps` reach the input: `ref`, `id`, `autoFocus`, `autoComplete`, `spellCheck`, `enterKeyHint`, `inputMode`, `maxLength`, `minLength`, `pattern`, `onKeyDown`, and only the `aria-*` valid on a text box (ADR 0110, 0154): `aria-controls`, `aria-activedescendant`, `aria-autocomplete`, `aria-details`, `aria-keyshortcuts`, `aria-owns`, `aria-flowto`, `aria-current`, `aria-roledescription`, `aria-busy`, `aria-live`, `aria-atomic` and `aria-relevant`. `label` owns the name, Field owns `aria-invalid`, `aria-describedby` and `aria-errormessage`, and `disabled` and `required` own their state, so those, `aria-readonly`, `aria-hidden` and the single-line input's `aria-multiline` are not among them. Neither is `aria-placeholder`: hint with `placeholder`, since the input has a native placeholder and ARIA says not to set both. The type closes the set, so an object literal with another `aria-*` is a type error; nothing strips one at runtime.
|
|
32
32
|
- The field handles no keys; a consumer `onKeyDown` is passed straight through.
|
|
33
33
|
- A consumer `ref` gets the input. A consumer `id` takes over from Field's generated one at hydration, and the label follows it.
|
|
34
34
|
- The module has no hooks, so a server component can render it; `onValueChange`, and an `inputProps` `ref` or `onKeyDown`, must come from a client component.
|
package/dist/docs/Textarea.md
CHANGED
|
@@ -26,7 +26,7 @@ A form field for several lines of free text: a `<textarea>` (role `textbox`, mul
|
|
|
26
26
|
- `name` submits the value with its form. A native form reset puts an uncontrolled field back to its `defaultValue` but fires no change, so `onValueChange` misses it; control the field if the form resets and you track the value.
|
|
27
27
|
- Enter adds a line; it never submits the form. Submitting on Mod+Enter is the app's choice, with its own `onKeyDown` in `inputProps`.
|
|
28
28
|
- Style props, `className` and `style` go to the `Field` around the label, textarea and messages, not to the textarea.
|
|
29
|
-
- `inputProps` reach the textarea: `ref`, `id`, `autoFocus`, `autoComplete`, `spellCheck`, `enterKeyHint`, `inputMode`, `maxLength`, `minLength`, `onKeyDown`, and only the `aria-*` valid on a text box (ADR 0110, 0136): `aria-controls`, `aria-activedescendant`, `aria-autocomplete`, `aria-
|
|
29
|
+
- `inputProps` reach the textarea: `ref`, `id`, `autoFocus`, `autoComplete`, `spellCheck`, `enterKeyHint`, `inputMode`, `maxLength`, `minLength`, `onKeyDown`, and only the `aria-*` valid on a text box (ADR 0110, 0136, 0154): `aria-controls`, `aria-activedescendant`, `aria-autocomplete`, `aria-details`, `aria-keyshortcuts`, `aria-owns`, `aria-flowto`, `aria-current`, `aria-roledescription`, `aria-busy`, `aria-live`, `aria-atomic` and `aria-relevant`. `label` owns the name, Field owns `aria-invalid`, `aria-describedby` and `aria-errormessage`, `disabled` and `required` own their state, and the native textarea is multi-line already, so those, `aria-readonly`, `aria-hidden` and `aria-multiline` are not among them. Neither is `aria-placeholder`: hint with `placeholder`, since the textarea has a native placeholder and ARIA says not to set both. The type closes the set, so an object literal with another `aria-*` is a type error; nothing strips one at runtime.
|
|
30
30
|
- The field handles no keys; a consumer `onKeyDown` is passed straight through.
|
|
31
31
|
- A consumer `ref` gets the textarea. A consumer `id` takes over from Field's generated one at hydration, and the label follows it.
|
|
32
32
|
- The module has no hooks, so a server component can render it; `onValueChange`, and an `inputProps` `ref` or `onKeyDown`, must come from a client component.
|