@reliability-design/web 1.4.9 → 1.4.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +161 -2
- package/custom-elements.json +18604 -0
- package/dist/components/rel-accordion/README.md +9 -2
- package/dist/components/rel-alert/README.md +4 -7
- package/dist/components/rel-autocomplete/README.md +209 -209
- package/dist/components/rel-avatar/README.md +228 -118
- package/dist/components/rel-breadcrumb/README.md +1 -0
- package/dist/components/rel-button/README.md +9 -9
- package/dist/components/rel-calendar/README.md +111 -109
- package/dist/components/rel-cardmedia/README.md +1 -1
- package/dist/components/rel-carousel/README.md +187 -187
- package/dist/components/rel-checkbox/README.md +159 -147
- package/dist/components/rel-chip/README.md +141 -138
- package/dist/components/rel-container/README.md +1 -1
- package/dist/components/rel-date-picker/README.md +221 -206
- package/dist/components/rel-drawer/README.md +4 -4
- package/dist/components/rel-kbd/README.md +188 -141
- package/dist/components/rel-layout/README.md +34 -34
- package/dist/components/rel-menu/README.md +17 -10
- package/dist/components/rel-menubar/README.md +218 -218
- package/dist/components/rel-otp/README.md +4 -8
- package/dist/components/rel-pagination/README.md +141 -100
- package/dist/components/rel-popover/README.md +220 -203
- package/dist/components/rel-radio/README.md +142 -131
- package/dist/components/rel-range-picker/README.md +194 -171
- package/dist/components/rel-resizable/README.md +220 -199
- package/dist/components/rel-segmented-button/README.md +158 -157
- package/dist/components/rel-select/README.md +21 -17
- package/dist/components/rel-sheet/README.md +3 -2
- package/dist/components/rel-signature-pad/README.md +161 -0
- package/dist/components/rel-slider/README.md +140 -131
- package/dist/components/rel-snackbar/README.md +170 -168
- package/dist/components/rel-split-button/README.md +129 -0
- package/dist/components/rel-stepper/README.md +171 -171
- package/dist/components/rel-switch/README.md +122 -117
- package/dist/components/rel-tab/README.md +184 -174
- package/dist/components/rel-textfield/README.md +21 -28
- package/dist/components/rel-time-picker/README.md +188 -170
- package/dist/components/rel-toast/README.md +20 -11
- package/dist/components/rel-tooltip/README.md +5 -4
- package/dist/components/rel-tree/README.md +157 -0
- package/dist/components/rel-upload/README.md +8 -5
- package/dist/index.d.mts +1608 -624
- package/dist/index.d.ts +1608 -624
- package/dist/index.js +11933 -6802
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +11009 -5885
- package/dist/index.mjs.map +1 -1
- package/dist/styles/ag-grid.css +274 -0
- package/dist/styles/motion.css +31 -0
- package/dist/styles/motion.tokens.json +38 -0
- package/dist/styles/vars.css +88 -64
- package/dist/{vars-DXX6QOAG.css → vars-E22LYFMV.css} +88 -64
- package/package.json +61 -37
- package/dist/styles/focus-ring.ts +0 -84
|
@@ -1,131 +1,142 @@
|
|
|
1
|
-
# rel-radio
|
|
2
|
-
|
|
3
|
-
`<rel-radio>` is the single-select radio group of the Reliability Design System (Figma "Radio"). One element is one group: it renders a native radio input for every entry in `options`, with optional supporting text and an icon or avatar prefix, in the Figma Size (S/M/L), Density (compact / comfortable) and Layout (leading / trailing) variants, plus error and disabled states. Use it when the user must pick exactly one of a few visible choices (2–7). For long lists use `<rel-select>`, for independent on/off choices use `<rel-checkbox>` or `<rel-switch>`.
|
|
4
|
-
|
|
5
|
-
## Usage
|
|
6
|
-
|
|
7
|
-
```html
|
|
8
|
-
<!-- Basic group; options as a JSON attribute, preselected via
|
|
9
|
-
<rel-radio
|
|
10
|
-
name="color"
|
|
11
|
-
field-aria-label="Colour"
|
|
12
|
-
options='[{"value":"red","label":"Red"},{"value":"blue","label":"Blue"},{"value":"green","label":"Green"}]'
|
|
13
|
-
|
|
14
|
-
></rel-radio>
|
|
15
|
-
|
|
16
|
-
<!-- Two independent groups on one page: give each its own name -->
|
|
17
|
-
<rel-radio id="plan" name="plan" field-aria-label="Plan"></rel-radio>
|
|
18
|
-
<rel-radio id="billing" name="billing" field-aria-label="Billing cycle" orientation="horizontal"></rel-radio>
|
|
19
|
-
|
|
20
|
-
<!-- Sizes (S and M share the 20px control; L is 24px) -->
|
|
21
|
-
<rel-radio id="small" name="size-small" size="small"></rel-radio>
|
|
22
|
-
<rel-radio id="medium" name="size-medium" size="medium"></rel-radio>
|
|
23
|
-
<rel-radio id="large" name="size-large" size="large"></rel-radio>
|
|
24
|
-
|
|
25
|
-
<!-- Supporting text beside the control instead of on its own line -->
|
|
26
|
-
<rel-radio id="comfortable" name="tier" density="comfortable"></rel-radio>
|
|
27
|
-
|
|
28
|
-
<!-- Control on the far edge of each row (always comfortable density) -->
|
|
29
|
-
<rel-radio id="trailing" name="notify" alignment="trailing"></rel-radio>
|
|
30
|
-
|
|
31
|
-
<!-- Error state with a message; disabled group -->
|
|
32
|
-
<rel-radio id="consent" name="consent" error
|
|
33
|
-
<rel-radio id="locked" name="locked" disabled></rel-radio>
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
```js
|
|
37
|
-
const plan = document.getElementById("plan");
|
|
38
|
-
plan.options = [
|
|
39
|
-
{ value: "basic", label: "Basic", supportingText: "$9.99 / month" },
|
|
40
|
-
{ value: "pro", label: "Pro", supportingText: "$19.99 / month", icon: "settings" },
|
|
41
|
-
{ value: "team", label: "Team", avatar: "TM" },
|
|
42
|
-
{ value: "enterprise", label: "Enterprise", supportingText: "Contact sales", disabled: true },
|
|
43
|
-
];
|
|
44
|
-
plan.selectedValue = "basic";
|
|
45
|
-
|
|
46
|
-
plan.addEventListener("rel-change", (e) => {
|
|
47
|
-
e.detail.value; // "pro" — the selected option's value
|
|
48
|
-
e.detail.checked; // always true
|
|
49
|
-
plan.selectedValue === e.detail.value; // already updated
|
|
50
|
-
});
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
|
71
|
-
|
|
|
72
|
-
| `
|
|
73
|
-
| `
|
|
74
|
-
| `
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
|
79
|
-
|
|
|
80
|
-
| `
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
|
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
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
1
|
+
# rel-radio
|
|
2
|
+
|
|
3
|
+
`<rel-radio>` is the single-select radio group of the Reliability Design System (Figma "Radio"). One element is one group: it renders a native radio input for every entry in `options`, with optional supporting text and an icon or avatar prefix, in the Figma Size (S/M/L), Density (compact / comfortable) and Layout (leading / trailing) variants, plus error and disabled states. Use it when the user must pick exactly one of a few visible choices (2–7). For long lists use `<rel-select>`, for independent on/off choices use `<rel-checkbox>` or `<rel-switch>`.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
```html
|
|
8
|
+
<!-- Basic group; options as a JSON attribute, preselected via selected-value -->
|
|
9
|
+
<rel-radio
|
|
10
|
+
name="color"
|
|
11
|
+
field-aria-label="Colour"
|
|
12
|
+
options='[{"value":"red","label":"Red"},{"value":"blue","label":"Blue"},{"value":"green","label":"Green"}]'
|
|
13
|
+
selected-value="blue"
|
|
14
|
+
></rel-radio>
|
|
15
|
+
|
|
16
|
+
<!-- Two independent groups on one page: give each its own name -->
|
|
17
|
+
<rel-radio id="plan" name="plan" field-aria-label="Plan"></rel-radio>
|
|
18
|
+
<rel-radio id="billing" name="billing" field-aria-label="Billing cycle" orientation="horizontal"></rel-radio>
|
|
19
|
+
|
|
20
|
+
<!-- Sizes (S and M share the 20px control; L is 24px) -->
|
|
21
|
+
<rel-radio id="small" name="size-small" size="small"></rel-radio>
|
|
22
|
+
<rel-radio id="medium" name="size-medium" size="medium"></rel-radio>
|
|
23
|
+
<rel-radio id="large" name="size-large" size="large"></rel-radio>
|
|
24
|
+
|
|
25
|
+
<!-- Supporting text beside the control instead of on its own line -->
|
|
26
|
+
<rel-radio id="comfortable" name="tier" density="comfortable"></rel-radio>
|
|
27
|
+
|
|
28
|
+
<!-- Control on the far edge of each row (always comfortable density) -->
|
|
29
|
+
<rel-radio id="trailing" name="notify" alignment="trailing"></rel-radio>
|
|
30
|
+
|
|
31
|
+
<!-- Error state with a message; disabled group -->
|
|
32
|
+
<rel-radio id="consent" name="consent" error error-message="Choose one option to continue"></rel-radio>
|
|
33
|
+
<rel-radio id="locked" name="locked" disabled></rel-radio>
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
```js
|
|
37
|
+
const plan = document.getElementById("plan");
|
|
38
|
+
plan.options = [
|
|
39
|
+
{ value: "basic", label: "Basic", supportingText: "$9.99 / month" },
|
|
40
|
+
{ value: "pro", label: "Pro", supportingText: "$19.99 / month", icon: "settings" },
|
|
41
|
+
{ value: "team", label: "Team", avatar: "TM" },
|
|
42
|
+
{ value: "enterprise", label: "Enterprise", supportingText: "Contact sales", disabled: true },
|
|
43
|
+
];
|
|
44
|
+
plan.selectedValue = "basic";
|
|
45
|
+
|
|
46
|
+
plan.addEventListener("rel-change", (e) => {
|
|
47
|
+
e.detail.value; // "pro" — the selected option's value
|
|
48
|
+
e.detail.checked; // always true
|
|
49
|
+
plan.selectedValue === e.detail.value; // already updated
|
|
50
|
+
});
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Deprecated aliases
|
|
54
|
+
|
|
55
|
+
```html
|
|
56
|
+
<!-- selectedvalue / errormessage → selected-value / error-message (since 1.5.0; still work, log a
|
|
57
|
+
one-time console notice, removed in 3.0). selectedValue still reflects as selectedvalue in 1.x. -->
|
|
58
|
+
<rel-radio name="old" selectedvalue="blue" error errormessage="Pick one"></rel-radio>
|
|
59
|
+
<rel-radio name="new" selected-value="blue" error error-message="Pick one"></rel-radio>
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
<!-- readme-gen:start -->
|
|
63
|
+
|
|
64
|
+
<!-- Generated from rel-radio.ts — do not edit; run readme-generate.mjs -->
|
|
65
|
+
|
|
66
|
+
## API
|
|
67
|
+
|
|
68
|
+
### Attributes / Properties
|
|
69
|
+
|
|
70
|
+
| Property | Attribute | Type | Default | Description |
|
|
71
|
+
| --- | --- | --- | --- | --- |
|
|
72
|
+
| `options` | `options` | `RadioOption[]` | `[]` | The options to render, in order. Each entry is a `RadioOption` (`value`, `label`, optional `supportingText`, `disabled`, `icon` or `avatar`). Set as a property (`.options=`) or as a JSON attribute. |
|
|
73
|
+
| `name` | `name` | `string` | `"radio-group"` | `name` given to every native radio input inside this element. It scopes native radio-group behaviour (arrow-key movement, mutual exclusion) to this group, so give each group on a page a distinct name. |
|
|
74
|
+
| `orientation` | `orientation` | `"horizontal" \| "vertical"` | `"vertical"` | Layout axis of the option list. `"vertical"` (default) stacks options in a column; `"horizontal"` lays them out in a wrapping row. Reflected. |
|
|
75
|
+
| `size` | `size` | `"small" \| "medium" \| "large" \| "sm" \| "md" \| "lg"` | `"medium"` | Control scale, matching Figma's Size axis. `"small"` and `"medium"` (default) both draw a 20px control — they differ by TYPE, body-md labels against body-lg — and `"large"` steps the control to 24px with body-xl labels. Supporting text sits one body step below the label at every size (body-sm / md / lg, i.e. 12 / 14 / 16px). `sm` / `md` / `lg` are alternative spellings and stay supported — normalised to the full words, not deprecated. Small and Medium sharing a control is Figma's design, not an oversight: verified against the live Published DS file on 2026-09-25, `.Radio Control` measures 20x20 in all 15 Small variants and all 15 Medium ones. v1.4.8 briefly gave Small its own 16px control on the mistaken premise that the ramp was 16/20/24; 1.4.9 reverts that. Reflected. |
|
|
76
|
+
| `density` | `density` | `"compact" \| "comfortable"` | `"compact"` | Supporting-text layout (Figma Density). `"compact"` (default) puts the supporting text on its own line under the row, indented past the control; `"comfortable"` stacks label + supporting text beside the control. Reflected. |
|
|
77
|
+
| `alignment` | `alignment` | `"leading" \| "trailing"` | `"leading"` | Control position (Figma Layout). `"leading"` (default) renders the control before the label; `"trailing"` pushes it to the far edge of the row. Trailing has no compact layout in the spec, so it always renders with comfortable density. Meant for vertical orientation — trailing options stretch to the group's full width. Reflected. |
|
|
78
|
+
| `selectedValue` | `selected-value` | `string \| null` | `null` | `value` of the currently selected option, or `null` when nothing is selected. Set it to preselect an option; it is updated on every user selection. Reflected (as `selectedvalue` in 1.x). The `selectedvalue` attribute spelling is deprecated (still works; removal targeted for 3.0). |
|
|
79
|
+
| `disabled` | `disabled` | `boolean` | `false` | Disables every option (Figma State=Disabled: the whole group at 40% opacity). Individual options can also be disabled via `RadioOption.disabled`. An ancestor `<fieldset disabled>` disables the group the same way, without changing this property. |
|
|
80
|
+
| `error` | `error` | `boolean` | `false` | Error state (Figma State=Error): rings, dots and supporting text turn danger. Applies to every option while nothing is selected, and only to the selected option once a choice is made. Selection is still allowed. |
|
|
81
|
+
| `errorMessage` | `error-message` | `string` | `""` | Message rendered under the group (live region) while `error` is set; hidden when `error` is false or the text is empty. The `errormessage` attribute spelling is deprecated (still works; removal targeted for 3.0). |
|
|
82
|
+
| `fieldAriaLabel` | `field-aria-label` | `string` | `undefined` | Accessible name for the radiogroup (it renders no visible group label). Unset, an outer `<label>` (wrapping the group, or `for=`) names it instead. |
|
|
83
|
+
| `value` | `value` | `string` | `""` | Value reported to the Angular forms bridge (`registerOnChange` callback) on each change and compared by `writeValue`. Not used for rendering; read `selectedValue` or the `rel-change` detail for the selected option. |
|
|
84
|
+
|
|
85
|
+
### Public fields / accessors
|
|
86
|
+
|
|
87
|
+
| Name | Type | Description |
|
|
88
|
+
| --- | --- | --- |
|
|
89
|
+
| `checked` | `boolean` | Set by the Angular forms bridge (`writeValue`) to whether the written form value equals `value`. Not used for rendering — read `selectedValue` for the selection. |
|
|
90
|
+
|
|
91
|
+
## Events
|
|
92
|
+
|
|
93
|
+
| Event | Detail | Bubbles / composed | Description |
|
|
94
|
+
| --- | --- | --- | --- |
|
|
95
|
+
| `rel-change` | `{ value, checked: true }` | bubbles / composed | Fired when the user selects an option (after `selectedValue` is updated). Detail: `{ value: string, checked: true }` — `value` is the selected option's value. |
|
|
96
|
+
|
|
97
|
+
## Slots
|
|
98
|
+
|
|
99
|
+
| Slot | Description |
|
|
100
|
+
| --- | --- |
|
|
101
|
+
| — | This element has no slots. |
|
|
102
|
+
|
|
103
|
+
## CSS Parts
|
|
104
|
+
|
|
105
|
+
| Part | Description |
|
|
106
|
+
| --- | --- |
|
|
107
|
+
| `label` | The visible label text of each option |
|
|
108
|
+
| `base` | The `role="radiogroup"` container that lays out the options |
|
|
109
|
+
|
|
110
|
+
<!-- readme-gen:end -->
|
|
111
|
+
|
|
112
|
+
## Accessibility
|
|
113
|
+
|
|
114
|
+
- The option container (part `base`) is a `role="radiogroup"` with `aria-orientation` = `orientation`, `aria-label` = `field-aria-label` (the group renders no visible legend, so name it with this or an outer `<label>`) and `aria-describedby` pointing at the error line.
|
|
115
|
+
- An outer `<label>` (`<label for="plan">Plan</label><rel-radio id="plan">`, or wrapped around the group) names the GROUP: the element is form-associated, and the label's text is copied into the radiogroup's `aria-label` when `field-aria-label` is unset. Clicking the label does not select anything. It moves focus onto the selected option, or the first enabled one when nothing is selected (where Tab would land), with no `rel-change`; then the arrow keys choose. A disabled group ignores the click. Clicking an option inside a wrapping label behaves as it always has.
|
|
116
|
+
- Every option is a native `<input type="radio">` inside a `<label>`, so the whole row (control, label, supporting text) is the click target and the input's accessible name is the option label. The input is visually hidden (`opacity: 0`, absolutely positioned over the row) but stays in the Tab order; the drawn ring / dot mirror its `:checked` state.
|
|
117
|
+
- Disabled options get the native `disabled` attribute (skipped by Tab and arrow keys) and render at 40% opacity; `disabled` on the host disables all of them.
|
|
118
|
+
- The error message is a persistent `aria-live="polite"` region under the group, so a message that appears after submission is read out.
|
|
119
|
+
- Avatar chips are `aria-hidden`; a prefix icon is a `<rel-icon>` and decorative.
|
|
120
|
+
- Keyboard focus is shown as a 1.5px `--rel-border-focus` outline, flush (no offset), around the focused option; it appears only for `:focus-visible` (keyboard) focus.
|
|
121
|
+
- In forced-colors mode (Windows High Contrast) the ring is drawn as a 1px `CanvasText` border and the selected dot is painted `CanvasText`, because the normal ring (an inset box-shadow) and the dot's background are not painted there.
|
|
122
|
+
- Keyboard behaviour is the browser's native radio behaviour — the component adds no key handlers of its own:
|
|
123
|
+
|
|
124
|
+
| Key | Action |
|
|
125
|
+
| --- | --- |
|
|
126
|
+
| Tab / Shift + Tab | Enter the group (on the checked option, else the first enabled one) or leave it |
|
|
127
|
+
| ArrowDown / ArrowRight | Move to the next enabled option and select it (fires `rel-change`) |
|
|
128
|
+
| ArrowUp / ArrowLeft | Move to the previous enabled option and select it (fires `rel-change`) |
|
|
129
|
+
| Space | Select the focused option if it is not yet selected |
|
|
130
|
+
|
|
131
|
+
## Notes / Edge Cases
|
|
132
|
+
|
|
133
|
+
- `RadioOption` shape: `{ value: string; label: string; supportingText?: string; disabled?: boolean; icon?: string; avatar?: string }`. `icon` is a `rel-icon` name rendered before the label (Figma Has Icon/Avatar, Type=Icon); `avatar` is 1–2 initials rendered as a circular chip and is ignored when `icon` is also set.
|
|
134
|
+
- `rel-change` fires only on user selection. Setting `selectedValue` from code (or via the `selected-value` attribute) updates the UI silently.
|
|
135
|
+
- Grouping by `name`: the native inputs of one `<rel-radio>` share `name`, which is what gives arrow-key movement and mutual exclusion; they live in the element's shadow root, so they are not submitted with a surrounding `<form>`. The element itself is form-associated (for the outer `<label>`) but sets no form value, so that does not change; it does now appear in `form.elements`. Read `selectedValue` or listen to `rel-change` to collect the value. Give every group on a page its own `name` so the intent is unambiguous.
|
|
136
|
+
- Error rules: while nothing is selected, every option shows the danger ring; once an option is selected only that option does. Labels keep their default colour; rings, dots and supporting text turn `--rel-text-danger`. Error never blocks selection.
|
|
137
|
+
- `alignment="trailing"` always renders comfortable density. Combining it with `density="compact"` logs `[rel-radio] density="compact" has no trailing layout; rendering comfortable density.` (a `console.warn`, every time either prop changes).
|
|
138
|
+
- Compact supporting text is indented past the control box: 28px (S/M) and 32px (L). Comfortable density widens the control-to-label gap from 8px to 12px.
|
|
139
|
+
- Hover shifts the ring and dot from `--rel-text-default` to `--rel-text-body`, and the label and prefix icon to `--rel-text-label`, on enabled, non-error options.
|
|
140
|
+
- `value` and `checked` exist for the Angular forms bridge (`registerOnChange` / `registerOnTouched` / `writeValue`, which are internal API). The bridge callback receives the `value` property, not the selected option — plain DOM consumers should ignore both and use `selectedValue` / `rel-change`.
|
|
141
|
+
- `<rel-menu type="select-option">` renders an `inert`, `aria-hidden` `<rel-radio>` inside each row purely as a visual control; that usage does not fire `rel-change`.
|
|
142
|
+
- The hidden native input is absolutely positioned inside a `position: relative` row on purpose — without that containing block, tabbing to it scrolls the wrong ancestor and jumps the page (shared fix with `rel-checkbox`).
|