@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,170 +1,188 @@
|
|
|
1
|
-
# rel-time-picker
|
|
2
|
-
|
|
3
|
-
Time selection field implementing the Figma "Time Picker" component (Reliability DS V1.0, node 8301:3771): an editable text field with a clock icon that opens a panel of Hour / Minute (/ Second / AM-PM) columns and a Now / Cancel / OK footer. Column picks are held as a draft until OK; the field also accepts free-form typed times ("930", "9:30 pm", "n" for now). The committed `value` is always 24-hour `"HH:mm"` (or `"HH:mm:ss"` with `seconds`) regardless of the display `format`. Use it for a single time of day; use `rel-date-picker` for dates and `rel-range-picker` for date ranges.
|
|
4
|
-
|
|
5
|
-
## Usage
|
|
6
|
-
|
|
7
|
-
```html
|
|
8
|
-
<!-- Basic (12-hour display, 5-minute steps) -->
|
|
9
|
-
<rel-time-picker></rel-time-picker>
|
|
10
|
-
|
|
11
|
-
<!-- Value is always 24-hour HH:mm; the field shows it per `format` -->
|
|
12
|
-
<rel-time-picker value="09:30" label="Start time"></rel-time-picker>
|
|
13
|
-
<rel-time-picker value="17:05" format="24h"></rel-time-picker>
|
|
14
|
-
|
|
15
|
-
<!-- Seconds column; value becomes HH:mm:ss -->
|
|
16
|
-
<rel-time-picker seconds value="17:05:30" format="24h"></rel-time-picker>
|
|
17
|
-
|
|
18
|
-
<!-- Minute granularity of the column (typed entry still accepts any minute) -->
|
|
19
|
-
<rel-time-picker minute-step="15"></rel-time-picker>
|
|
20
|
-
<rel-time-picker minute-step="1"></rel-time-picker>
|
|
21
|
-
|
|
22
|
-
<!-- Constrain to business hours (inclusive, HH:mm) -->
|
|
23
|
-
<rel-time-picker min-time="09:00" max-time="17:30" placeholder="Business hours only"></rel-time-picker>
|
|
24
|
-
|
|
25
|
-
<!-- Clear button, helper / error text, required -->
|
|
26
|
-
<rel-time-picker value="09:30" clearable></rel-time-picker>
|
|
27
|
-
<rel-time-picker label="Start time" helper-text="Local timezone"></rel-time-picker>
|
|
28
|
-
<rel-time-picker label="Start time" error error-message="Select a valid time"></rel-time-picker>
|
|
29
|
-
<rel-time-picker label="Start time" required></rel-time-picker>
|
|
30
|
-
|
|
31
|
-
<!-- States -->
|
|
32
|
-
<rel-time-picker value="09:30" disabled></rel-time-picker>
|
|
33
|
-
<rel-time-picker value="09:30" readonly></rel-time-picker>
|
|
34
|
-
|
|
35
|
-
<!-- Sizes (field 32 / 40 / 48px, panel 220 / 250 / 280px) and layout -->
|
|
36
|
-
<rel-time-picker size="small"></rel-time-picker>
|
|
37
|
-
<rel-time-picker size="medium"></rel-time-picker>
|
|
38
|
-
<rel-time-picker size="large"></rel-time-picker>
|
|
39
|
-
<rel-time-picker
|
|
40
|
-
|
|
41
|
-
<!-- Form integration: `name` renders a hidden input carrying the value -->
|
|
42
|
-
<form>
|
|
43
|
-
<rel-time-picker name="startTime" label="Start time" required></rel-time-picker>
|
|
44
|
-
</form>
|
|
45
|
-
|
|
46
|
-
<!-- Programmatic control -->
|
|
47
|
-
<rel-time-picker id="tp" clearable></rel-time-picker>
|
|
48
|
-
<script>
|
|
49
|
-
const picker = document.getElementById('tp');
|
|
50
|
-
picker.value = '14:30'; // always 24h
|
|
51
|
-
picker.open = true; // opens the panel and focuses the selected hour
|
|
52
|
-
|
|
53
|
-
picker.addEventListener('rel-change', (e) => {
|
|
54
|
-
console.log('time:', e.detail.value); // "14:30" | "14:30:00" | null (cleared)
|
|
55
|
-
});
|
|
56
|
-
picker.addEventListener('rel-open-change', (e) => {
|
|
57
|
-
console.log('open:', e.detail.open);
|
|
58
|
-
});
|
|
59
|
-
</script>
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
### Typed entry
|
|
63
|
-
|
|
64
|
-
Typing into the field and pressing `Enter` (or leaving the field) commits the text. Accepted forms are case- and whitespace-insensitive: `9` → 09:00, `930` / `0930` / `9:30` / `9.30` / `9 30` → 09:30, `093015` / `9:30:15` → 09:30:15, `9 pm` / `9:30p` → 21:00 / 21:30, `12am` → 00:00, `12 pm` → 12:00, and `n` / `now` → the current time. Unparseable text shows "Invalid time", a time outside `min-time` / `max-time` shows "Time out of range"; in both cases the text stays in the field for correction and the committed `value` is untouched.
|
|
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
|
-
|
|
132
|
-
|
|
133
|
-
|
|
|
134
|
-
|
|
|
135
|
-
|
|
136
|
-
##
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
|
152
|
-
|
|
|
153
|
-
| `
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
1
|
+
# rel-time-picker
|
|
2
|
+
|
|
3
|
+
Time selection field implementing the Figma "Time Picker" component (Reliability DS V1.0, node 8301:3771): an editable text field with a clock icon that opens a panel of Hour / Minute (/ Second / AM-PM) columns and a Now / Cancel / OK footer. Column picks are held as a draft until OK; the field also accepts free-form typed times ("930", "9:30 pm", "n" for now). The committed `value` is always 24-hour `"HH:mm"` (or `"HH:mm:ss"` with `seconds`) regardless of the display `format`. Use it for a single time of day; use `rel-date-picker` for dates and `rel-range-picker` for date ranges.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
```html
|
|
8
|
+
<!-- Basic (12-hour display, 5-minute steps) -->
|
|
9
|
+
<rel-time-picker></rel-time-picker>
|
|
10
|
+
|
|
11
|
+
<!-- Value is always 24-hour HH:mm; the field shows it per `format` -->
|
|
12
|
+
<rel-time-picker value="09:30" label="Start time"></rel-time-picker>
|
|
13
|
+
<rel-time-picker value="17:05" format="24h"></rel-time-picker>
|
|
14
|
+
|
|
15
|
+
<!-- Seconds column; value becomes HH:mm:ss -->
|
|
16
|
+
<rel-time-picker seconds value="17:05:30" format="24h"></rel-time-picker>
|
|
17
|
+
|
|
18
|
+
<!-- Minute granularity of the column (typed entry still accepts any minute) -->
|
|
19
|
+
<rel-time-picker minute-step="15"></rel-time-picker>
|
|
20
|
+
<rel-time-picker minute-step="1"></rel-time-picker>
|
|
21
|
+
|
|
22
|
+
<!-- Constrain to business hours (inclusive, HH:mm) -->
|
|
23
|
+
<rel-time-picker min-time="09:00" max-time="17:30" placeholder="Business hours only"></rel-time-picker>
|
|
24
|
+
|
|
25
|
+
<!-- Clear button, helper / error text, required -->
|
|
26
|
+
<rel-time-picker value="09:30" clearable></rel-time-picker>
|
|
27
|
+
<rel-time-picker label="Start time" helper-text="Local timezone"></rel-time-picker>
|
|
28
|
+
<rel-time-picker label="Start time" error error-message="Select a valid time"></rel-time-picker>
|
|
29
|
+
<rel-time-picker label="Start time" required></rel-time-picker>
|
|
30
|
+
|
|
31
|
+
<!-- States -->
|
|
32
|
+
<rel-time-picker value="09:30" disabled></rel-time-picker>
|
|
33
|
+
<rel-time-picker value="09:30" readonly></rel-time-picker>
|
|
34
|
+
|
|
35
|
+
<!-- Sizes (field 32 / 40 / 48px, panel 220 / 250 / 280px) and layout -->
|
|
36
|
+
<rel-time-picker size="small"></rel-time-picker>
|
|
37
|
+
<rel-time-picker size="medium"></rel-time-picker>
|
|
38
|
+
<rel-time-picker size="large"></rel-time-picker>
|
|
39
|
+
<rel-time-picker full-width label="Full width"></rel-time-picker>
|
|
40
|
+
|
|
41
|
+
<!-- Form integration: `name` renders a hidden input carrying the value -->
|
|
42
|
+
<form>
|
|
43
|
+
<rel-time-picker name="startTime" label="Start time" required></rel-time-picker>
|
|
44
|
+
</form>
|
|
45
|
+
|
|
46
|
+
<!-- Programmatic control -->
|
|
47
|
+
<rel-time-picker id="tp" clearable></rel-time-picker>
|
|
48
|
+
<script>
|
|
49
|
+
const picker = document.getElementById('tp');
|
|
50
|
+
picker.value = '14:30'; // always 24h
|
|
51
|
+
picker.open = true; // opens the panel and focuses the selected hour
|
|
52
|
+
|
|
53
|
+
picker.addEventListener('rel-change', (e) => {
|
|
54
|
+
console.log('time:', e.detail.value); // "14:30" | "14:30:00" | null (cleared)
|
|
55
|
+
});
|
|
56
|
+
picker.addEventListener('rel-open-change', (e) => {
|
|
57
|
+
console.log('open:', e.detail.open);
|
|
58
|
+
});
|
|
59
|
+
</script>
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### Typed entry
|
|
63
|
+
|
|
64
|
+
Typing into the field and pressing `Enter` (or leaving the field) commits the text. Accepted forms are case- and whitespace-insensitive: `9` → 09:00, `930` / `0930` / `9:30` / `9.30` / `9 30` → 09:30, `093015` / `9:30:15` → 09:30:15, `9 pm` / `9:30p` → 21:00 / 21:30, `12am` → 00:00, `12 pm` → 12:00, and `n` / `now` → the current time. Unparseable text shows "Invalid time", a time outside `min-time` / `max-time` shows "Time out of range"; in both cases the text stays in the field for correction and the committed `value` is untouched.
|
|
65
|
+
|
|
66
|
+
### Deprecated aliases
|
|
67
|
+
|
|
68
|
+
```html
|
|
69
|
+
<!-- fullwidth → full-width (since 1.5.0; still works, logs a one-time console notice, removed in 3.0) -->
|
|
70
|
+
<rel-time-picker fullwidth label="Old spelling"></rel-time-picker>
|
|
71
|
+
<rel-time-picker full-width label="Canonical"></rel-time-picker>
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
<!-- readme-gen:start -->
|
|
75
|
+
|
|
76
|
+
<!-- Generated from rel-time-picker.ts — do not edit; run readme-generate.mjs -->
|
|
77
|
+
|
|
78
|
+
## API
|
|
79
|
+
|
|
80
|
+
### Attributes / Properties
|
|
81
|
+
|
|
82
|
+
| Property | Attribute | Type | Default | Description |
|
|
83
|
+
| --- | --- | --- | --- | --- |
|
|
84
|
+
| `value` | `value` | `string \| null` | `null` | Committed time, 24-hour "HH:mm" or "HH:mm:ss" (e.g. "09:30", "17:05:30"). Reflected. |
|
|
85
|
+
| `placeholder` | `placeholder` | `string` | `"Select time"` | Placeholder shown in the field while no value is committed and nothing is typed. |
|
|
86
|
+
| `label` | `label` | `string \| null` | `null` | Field label rendered above the trigger; also the input's accessible name (unset → "Select time"). |
|
|
87
|
+
| `disabled` | `disabled` | `boolean` | `false` | Disables the field (no pointer events) and the panel cannot open. The field looks exactly like a disabled `rel-textfield`: the whole field at 0.65 opacity, an elevated-2 box with the accent border, the label in `--rel-text-label` and the value and placeholder in `--rel-text-caption` (changed in 1.5.0: they were `--rel-text-disabled` under the 0.65, which left them barely readable). Reflected. |
|
|
88
|
+
| `required` | `required` | `boolean` | `false` | Renders the `*` mark after the label and sets `aria-required`; not enforced by the component. |
|
|
89
|
+
| `readonly` | `readonly` | `boolean` | `false` | Shows the value but blocks typing and opening the panel. Reflected. |
|
|
90
|
+
| `format` | `format` | `"12h" \| "24h"` | `"12h"` | Display format of the trigger text and hour column. Value stays 24-hour. |
|
|
91
|
+
| `seconds` | `seconds` | `boolean` | `false` | Shows the seconds column; committed value becomes "HH:mm:ss". Reflected. |
|
|
92
|
+
| `minuteStep` | `minute-step` | `number` | `5` | Minute granularity of the minutes column (1, 5, 10, 15, 30, …). |
|
|
93
|
+
| `minTime` | `min-time` | `string \| null` | `null` | Earliest selectable time, "HH:mm" (inclusive). |
|
|
94
|
+
| `maxTime` | `max-time` | `string \| null` | `null` | Latest selectable time, "HH:mm" (inclusive). |
|
|
95
|
+
| `open` | `open` | `boolean` | `false` | Whether the panel is open. Settable from outside; opening resets the draft from `value` (programmatic changes do not fire `rel-open-change`). Reflected. |
|
|
96
|
+
| `clearable` | `clearable` | `boolean` | `false` | Shows a clear (×) button inside the field while a value is set; clearing commits `null`. |
|
|
97
|
+
| `error` | `error` | `boolean` | `false` | Error styling (danger border, `aria-invalid`) and shows `errorMessage` below the field. |
|
|
98
|
+
| `invalid` | `invalid` | `boolean` | `false` | Alias for `error` (requested-API compat); either flag applies error styling. |
|
|
99
|
+
| `errorMessage` | `error-message` | `string` | `undefined` | Text shown below the field while `error` / `invalid` is set (falls back to the typed-entry parse error, then `helperText`). |
|
|
100
|
+
| `helperText` | `helper-text` | `string` | `undefined` | Assistive text shown below the field when not in error. |
|
|
101
|
+
| `name` | `name` | `string` | `undefined` | When set, renders a hidden `<input name="…">` carrying `value` for native form submission. |
|
|
102
|
+
| `size` | `size` | `"small" \| "medium" \| "large"` | `"medium"` | Trigger height on the shared field scale — small 32 / medium 40 / large 48px border-box; also sets the panel width (220 / 250 / 280px) and option row height (32 / 36 / 40px). Small lowers the trigger min-width from 160 to 128px. |
|
|
103
|
+
| `variant` | `variant` | `"outlined"` | `"outlined"` | Visual style; only `"outlined"` exists today. Reflected. |
|
|
104
|
+
| `fullWidth` | `full-width` | `boolean` | `false` | Fills the parent width (the host is inline-block with intrinsic width otherwise). The attribute is `full-width`. Reflected (as `fullwidth` in 1.x). The `fullwidth` attribute spelling is deprecated (still works; removal targeted for 3.0). |
|
|
105
|
+
|
|
106
|
+
## Events
|
|
107
|
+
|
|
108
|
+
| Event | Detail | Bubbles / composed | Description |
|
|
109
|
+
| --- | --- | --- | --- |
|
|
110
|
+
| `rel-blur` | — | bubbles / composed | Fired when the text input loses focus (before any typed text is committed). No detail. |
|
|
111
|
+
| `rel-change` | `{ value: newValue } / { value: null }` | bubbles / composed | Fired when a time is committed (OK, Enter / blur on typed text, the Now shortcut) or cleared. Detail: `{ value: string \| null }` — 24-hour "HH:mm" / "HH:mm:ss", or `null` after a clear. |
|
|
112
|
+
| `rel-focus` | — | bubbles / composed | Fired when the text input receives focus. No detail. |
|
|
113
|
+
| `rel-open-change` | `{ open: this.open } / { open: false }` | bubbles / composed | Fired whenever the panel opens or closes through user interaction. Detail: `{ open: boolean }`. |
|
|
114
|
+
|
|
115
|
+
## Slots
|
|
116
|
+
|
|
117
|
+
| Slot | Description |
|
|
118
|
+
| --- | --- |
|
|
119
|
+
| — | This element has no slots. |
|
|
120
|
+
|
|
121
|
+
## CSS Parts
|
|
122
|
+
|
|
123
|
+
| Part | Description |
|
|
124
|
+
| --- | --- |
|
|
125
|
+
| `base` | Outer wrapper; carries the size / error / readonly classes |
|
|
126
|
+
| `label` | The field label above the trigger |
|
|
127
|
+
| `trigger` | The field box that anchors the panel (wraps the text input and the icons) |
|
|
128
|
+
| `value` | The editable text input showing the formatted time |
|
|
129
|
+
| `icon` | The trailing clock icon |
|
|
130
|
+
| `panel` | The popover panel (`role="dialog"`) |
|
|
131
|
+
| `shortcuts` | The typed-shortcut chip row at the top of the panel (N → Now) |
|
|
132
|
+
| `option` | Each hour / minute / second / AM-PM entry button |
|
|
133
|
+
| `footer` | The Now / Cancel / OK row |
|
|
134
|
+
| `helper` | The helper / error text live region under the field |
|
|
135
|
+
|
|
136
|
+
## Tokens / CSS Variables
|
|
137
|
+
|
|
138
|
+
### Component hooks
|
|
139
|
+
|
|
140
|
+
Set these on the host (or an ancestor) to customise the element without touching design tokens.
|
|
141
|
+
|
|
142
|
+
| Custom property | Default | Description |
|
|
143
|
+
| --- | --- | --- |
|
|
144
|
+
| `--rel-overlay-fallback-z` | `1001` | z-index of the panel on the **no-Popover-API fallback path only**. Wherever the browser top layer is available the panel is promoted into it and this value is inert, because top-layer elements are not in the page stacking order at all. Shared with the other overlays (select, autocomplete, the three pickers) so the whole family can be moved from one place. |
|
|
145
|
+
|
|
146
|
+
<!-- readme-gen:end -->
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
## CSS Custom Properties
|
|
150
|
+
|
|
151
|
+
| Custom property | Default | Description |
|
|
152
|
+
| --- | --- | --- |
|
|
153
|
+
| `--rel-overlay-fallback-z` | `1001` | z-index of the panel on the **no-Popover-API fallback path only**. Wherever the browser top layer is available the panel is promoted into it and this value is inert, because top-layer elements are not in the page stacking order at all. Shared with the other overlays (select, autocomplete, the three pickers) so the whole family can be moved from one place. |
|
|
154
|
+
## Accessibility
|
|
155
|
+
|
|
156
|
+
- The editable field is an `<input type="text" role="combobox">` with `aria-haspopup="dialog"`, `aria-expanded`, `aria-controls` pointing at the panel, `aria-required` (from `required`), `aria-invalid` (from `error` / `invalid` / a typed-entry error) and `aria-describedby` pointing at the helper / error text. Its accessible name is the `label` (via `aria-labelledby`), falling back to `aria-label="Select time"`.
|
|
157
|
+
- The clock icon is a button labelled "Open time panel" with its own `aria-expanded`; the optional clear button is labelled "Clear time". The required mark `*` is `aria-hidden`.
|
|
158
|
+
- The panel is `role="dialog"` `aria-label="Choose time"`, promoted to the browser top layer (`popover="manual"`) so a modal / drawer ancestor cannot clip it. Each column is a `role="listbox"` named "Hours", "Minutes", "Seconds" or "AM or PM"; entries are `role="option"` buttons with `aria-selected`, and out-of-range entries are native `disabled`. Each column uses a roving `tabindex` (the selected entry, else the first).
|
|
159
|
+
- The helper / error text (part `helper`) is a persistent `aria-live="polite"` region, so error messages and typed-entry errors are announced as they appear.
|
|
160
|
+
- Focus: opening with the clock icon, `ArrowDown`, `Enter` or by setting `open` moves focus to the selected (or first enabled) hour without scrolling the page; opening by clicking into the field keeps focus in the input so typing continues to work. Cancel, `Escape` and OK return focus to the field; an outside click closes without refocusing.
|
|
161
|
+
- Screen-reader announcement (shared `announce()` utility): "{formatted time} selected" when OK commits the draft.
|
|
162
|
+
|
|
163
|
+
| Key | Where | Action |
|
|
164
|
+
| --- | --- | --- |
|
|
165
|
+
| Typing | Field | Edits the free-form text (see Typed entry); clears any previous parse error |
|
|
166
|
+
| `Enter` | Field | Commit the typed text; if nothing was typed, open the panel (closed) or apply the draft (open) |
|
|
167
|
+
| `ArrowDown` | Field | Open the panel, or move focus into the columns when already open |
|
|
168
|
+
| `Escape` | Field | Revert uncommitted typed text; also closes the panel discarding the draft |
|
|
169
|
+
| Blur | Field | Commit the typed text when focus leaves the component (moving into the panel does not commit) |
|
|
170
|
+
| `ArrowUp` / `ArrowDown` | Column | Move to and select the previous / next enabled entry |
|
|
171
|
+
| `ArrowLeft` / `ArrowRight` | Column | Jump to the previous / next column (Hour → Minute → Second → AM/PM) |
|
|
172
|
+
| `Home` / `End` | Column | Select the first / last enabled entry |
|
|
173
|
+
| `Enter` | Column | Select the entry and apply (OK) |
|
|
174
|
+
| `N` | Panel | Commit the current time immediately (same as the "N → Now" chip) and close |
|
|
175
|
+
| `Escape` | Anywhere | Discard the draft and close |
|
|
176
|
+
|
|
177
|
+
## Notes / Edge Cases
|
|
178
|
+
|
|
179
|
+
- `value` is always 24-hour `"HH:mm"`, or `"HH:mm:ss"` when `seconds` is set; the `format` prop only changes the field text and the hour column (`12h` shows 01–12 plus an AM/PM column, `24h` shows 00–23). An unparseable `value` renders as empty.
|
|
180
|
+
- `min-time` / `max-time` are `"HH:mm"` (inclusive) and are compared at minute precision even with `seconds`. Hours with no in-range step minute and AM/PM periods with no enabled hour are disabled; picking an hour snaps the draft minute to the nearest in-range step.
|
|
181
|
+
- Draft model: column clicks only update the draft; **OK** commits and fires `rel-change`; **Cancel**, `Escape` or an outside click discard it (and fire `rel-open-change` with `open: false`). The OK button is disabled until an hour is chosen; picking an hour with no minute defaults the minute to `00`; picking a minute or second first defaults the hour to the first enabled one.
|
|
182
|
+
- Two "now" behaviours: the footer **Now** link sets the draft to the current time snapped to `minute-step` (and to the nearest enabled hour) — you still press OK; the `N` shortcut / typed `n` / the "N → Now" chip commit the current time immediately, clamped into `min-time` / `max-time`.
|
|
183
|
+
- Typed entry is not limited to `minute-step`: `9:07` commits `09:07` even with `minute-step="15"`. Typing an empty string and committing behaves like the clear button (`rel-change` with `value: null`).
|
|
184
|
+
- `minute-step` outside 1–60 falls back to 1; the seconds column is always step 1.
|
|
185
|
+
- `invalid` is a non-deprecated alias of `error`; either flag applies error styling. The text below the field is `error-message`, else the typed-entry error, else `helper-text`.
|
|
186
|
+
- Panel widths are fixed per `size` (220 / 250 / 280px, border-box) and capped to the viewport; it flips above the field when there is no room below and shrinks (columns scroll) rather than covering the field. On an outside scroll (since 1.5.0) it **stays open and moves with the field while the field is still visible**, and closes once the field scrolls out of the viewport or its scroll container, or under a sticky header — so the top-layer panel never paints over page furniture (the reason 1.4.9 closed it on every scroll). Only the window and the field's own scroll containers count, including ones inside shadow roots such as `rel-modal`'s body; scrolls of unrelated elements and of the panel itself are ignored, and a wheel or swipe over the panel never scrolls the page (`overscroll-behavior: contain`); that includes the hour / minute / period columns. Footer buttons are always small per the Figma spec; OK is narrowed to 60px min-width.
|
|
187
|
+
- Setting `open` programmatically opens the panel and resets the draft from `value`; it does not fire `rel-open-change` (only user interaction does).
|
|
188
|
+
- `fullWidth` (attribute `full-width`) still reflects as the lowercase `fullwidth` attribute in 1.x; the host is `inline-block` with intrinsic width otherwise.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# rel-toast
|
|
2
2
|
|
|
3
|
-
`<rel-toast>` is the transient notification of the Reliability Design System: a card anchored to one of six viewport positions (bottom centre by default) that shows a short message, an optional action button ("Undo", "Retry") and a dismiss button, then hides itself after `duration` milliseconds. It has
|
|
3
|
+
`<rel-toast>` is the transient notification of the Reliability Design System: a card anchored to one of six viewport positions (bottom centre by default) that shows a short message, an optional action button ("Undo", "Retry") and a dismiss button, then hides itself after `duration` milliseconds. It has four tones — `neutral` (default), `info`, `success` and `destructive`; the three filled ones use the same fill and text tokens as `<rel-alert appearance="solid">` — and is driven by the `show` property (or `open()` / `close()`). Use it for brief confirmations that need no reply; use `<rel-snackbar>` when you need a warning tone, a stacked layout or your own positioning, and `<rel-alert>` for messages that must stay on the page.
|
|
4
4
|
|
|
5
5
|
## Usage
|
|
6
6
|
|
|
@@ -14,8 +14,12 @@
|
|
|
14
14
|
<!-- Destructive tone: danger fill, announced assertively -->
|
|
15
15
|
<rel-toast id="failed" tone="destructive" message="Upload failed"></rel-toast>
|
|
16
16
|
|
|
17
|
-
<!--
|
|
18
|
-
<rel-toast id="
|
|
17
|
+
<!-- Success and info tones: success / info fill (same tokens as a solid rel-alert), announced politely -->
|
|
18
|
+
<rel-toast id="done" tone="success" message="Changes saved"></rel-toast>
|
|
19
|
+
<rel-toast id="note" tone="info" message="A new version is available"></rel-toast>
|
|
20
|
+
|
|
21
|
+
<!-- Action button -->
|
|
22
|
+
<rel-toast id="deleted" message="Item deleted" action-label="Undo"></rel-toast>
|
|
19
23
|
|
|
20
24
|
<!-- Longer and persistent toasts -->
|
|
21
25
|
<rel-toast id="slow" message="Download complete" duration="7000"></rel-toast>
|
|
@@ -56,6 +60,10 @@ rel-toast { --rel-toast-z: 10000; }
|
|
|
56
60
|
[rel-toast] "tone="error"" is deprecated and will be removed in 3.0 — use "tone="destructive"" instead. -->
|
|
57
61
|
<rel-toast tone="error" message="Upload failed"></rel-toast>
|
|
58
62
|
<rel-toast tone="danger" message="Upload failed"></rel-toast>
|
|
63
|
+
|
|
64
|
+
<!-- actionlabel → action-label (since 1.5.0; still works, logs a one-time console notice, removed in 3.0) -->
|
|
65
|
+
<rel-toast message="Item deleted" actionlabel="Undo"></rel-toast>
|
|
66
|
+
<rel-toast message="Item deleted" action-label="Undo"></rel-toast>
|
|
59
67
|
```
|
|
60
68
|
|
|
61
69
|
```css
|
|
@@ -74,11 +82,11 @@ rel-toast { --rel-z-toast: 10000; }
|
|
|
74
82
|
| Property | Attribute | Type | Default | Description |
|
|
75
83
|
| --- | --- | --- | --- | --- |
|
|
76
84
|
| `message` | `message` | `string` | `""` | Text of the toast. It is also announced to screen readers through the shared live-region announcer each time `show` becomes true. |
|
|
77
|
-
| `tone` | `tone` | `"neutral" \| "destructive" \| "default" \| "error" \| "danger" \| "critical"` | `undefined` | Semantic tone (Figma "Tone"): `"neutral"` (default: neutral surface) \| `"destructive"` (danger fill, announced assertively). `"default"` is a deprecated alias of `"neutral"`; `"error"`, `"danger"` and `"critical"` are deprecated aliases of `"destructive"`; each logs a one-time console notice. Takes precedence over the deprecated `type` prop. |
|
|
78
|
-
| `actionLabel` | `
|
|
85
|
+
| `tone` | `tone` | `"neutral" \| "info" \| "success" \| "destructive" \| "default" \| "error" \| "danger" \| "critical"` | `undefined` | Semantic tone (Figma "Tone"): `"neutral"` (default: neutral surface) \| `"info"` (info fill) \| `"success"` (success fill) \| `"destructive"` (danger fill, announced assertively). The three filled tones use the same fill and text tokens as rel-alert's solid style, so a toast matches an alert of the same tone; info and success are announced politely. The three filled tones show a 20px leading icon (`error`, `check-circle`, `info`; part `icon`, hidden from assistive technology); the neutral tone has none (new in 1.5.0). Figma's Toast has all four tones. An unknown value renders as `"neutral"`. `"default"` is a deprecated alias of `"neutral"`; `"error"`, `"danger"` and `"critical"` are deprecated aliases of `"destructive"`; each logs a one-time console notice. Takes precedence over the deprecated `type` prop. |
|
|
86
|
+
| `actionLabel` | `action-label` | `string` | `undefined` | Label of the optional action button rendered between the message and the dismiss button; the button is omitted when unset. Clicking it fires `action` and then closes the toast. The `actionlabel` attribute spelling is deprecated (still works; removal targeted for 3.0). |
|
|
79
87
|
| `duration` | `duration` | `number` | `4000` | Auto-dismiss delay in milliseconds, started each time `show` becomes true. `0` (or a negative value) disables auto-dismiss so the toast stays until `close()` or the dismiss button. Changing it while the toast is visible does not restart the running timer. |
|
|
80
88
|
| `show` | `show` | `boolean` | `false` | Whether the toast is visible. Set it to true (or call `open()`) to show the toast and start the auto-dismiss timer; it is set back to false by `close()`, the dismiss button, the action button and the timer. Reflected. |
|
|
81
|
-
| `dismissible` | `dismissible` | `boolean` | `true` | Shows the trailing dismiss button (Figma "Show Close Button"). Defaults to true;
|
|
89
|
+
| `dismissible` | `dismissible` | `boolean` | `true` | Shows the trailing dismiss button (Figma "Show Close Button"). Defaults to true; `dismissible="false"` (or the property set to `false`) hides the button. |
|
|
82
90
|
| `position` | `position` | `"top-left" \| "top-center" \| "top-right" \| "bottom-left" \| "bottom-center" \| "bottom-right"` | `"bottom-center"` | Where the toast is anchored: `bottom-center` (default, unchanged from before this prop existed), `bottom-left`, `bottom-right`, `top-left`, `top-center` or `top-right`. Top anchors also animate in from the top edge rather than upward from the bottom. Figma's Toast has axes Content / Show Button / Show Close Button / Tone and no position, so this axis is ours. Reflected. |
|
|
83
91
|
| `size` | `size` | `"small" \| "medium" \| "large" \| "sm" \| "md" \| "lg"` | `"medium"` | Toast scale: `small`, `medium` (default, unchanged) or `large`. `sm` / `md` / `lg` are alternative spellings and stay supported — normalised to the full words, not deprecated. Scales the padding, the inner gap, the message type role and the close icon. Figma has no Size axis on Toast. Reflected. |
|
|
84
92
|
| `maxVisible` | `max-visible` | `number` | `3` | How many toasts may be on screen at once AT THIS POSITION. Further ones wait their turn rather than being dropped — a notification the user never saw is worse than a late one — and each toast's `duration` only starts once it actually becomes visible, so a queued message cannot expire unseen. Default 3; unbounded stacking just fills the viewport. |
|
|
@@ -87,13 +95,13 @@ rel-toast { --rel-z-toast: 10000; }
|
|
|
87
95
|
|
|
88
96
|
| Property | Attribute | Type | Use instead |
|
|
89
97
|
| --- | --- | --- | --- |
|
|
90
|
-
| `type` | `type` | `"neutral" \| "destructive" \| "default" \| "error" \| "danger" \| "critical"` | Deprecated since 1.4.7 — alias of `tone`; use `tone`. Same values as `tone`; `type="error"` maps to `tone="destructive"` and `type="default"` to `tone="neutral"`. Ignored when `tone` is set. Logs a one-time console notice. |
|
|
98
|
+
| `type` | `type` | `"neutral" \| "info" \| "success" \| "destructive" \| "default" \| "error" \| "danger" \| "critical"` | Deprecated since 1.4.7 — alias of `tone`; use `tone`. Same values as `tone`; `type="error"` maps to `tone="destructive"` and `type="default"` to `tone="neutral"`. Ignored when `tone` is set. Logs a one-time console notice. |
|
|
91
99
|
|
|
92
100
|
### Public fields / accessors
|
|
93
101
|
|
|
94
102
|
| Name | Type | Description |
|
|
95
103
|
| --- | --- | --- |
|
|
96
|
-
| `resolvedTone` | `ToastTone` | Read-only canonical tone actually rendered: explicit `tone` wins, else `type`, else `"neutral"`; deprecated aliases are resolved to `"neutral"` / `"destructive"`. |
|
|
104
|
+
| `resolvedTone` | `ToastTone` | Read-only canonical tone actually rendered: explicit `tone` wins, else `type`, else `"neutral"`; deprecated aliases are resolved to `"neutral"` / `"destructive"`, and an unknown value to `"neutral"`. |
|
|
97
105
|
|
|
98
106
|
### Methods
|
|
99
107
|
|
|
@@ -120,8 +128,9 @@ rel-toast { --rel-z-toast: 10000; }
|
|
|
120
128
|
| Part | Description |
|
|
121
129
|
| --- | --- |
|
|
122
130
|
| `base` | The `role="status"` toast container that carries the tone class |
|
|
131
|
+
| `icon` | The 20px leading icon of a filled tone (`error` on destructive, `check-circle` on success, `info` on info); a neutral toast has none. New in 1.5.0 |
|
|
123
132
|
| `label` | The message text span |
|
|
124
|
-
| `action` | The action button; rendered only when `
|
|
133
|
+
| `action` | The action button; rendered only when `action-label` is set |
|
|
125
134
|
| `close-button` | The dismiss button; rendered while `dismissible` is true |
|
|
126
135
|
|
|
127
136
|
## Tokens / CSS Variables
|
|
@@ -138,8 +147,8 @@ Set these on the host (or an ancestor) to customise the element without touching
|
|
|
138
147
|
|
|
139
148
|
## Accessibility
|
|
140
149
|
|
|
141
|
-
- The toast container (part `base`) is always in the shadow DOM with `role="status"`, `aria-live="polite"` and `aria-atomic="true"`; it is hidden with `display: none` while `show` is false. Because toggling `display` is not reliably announced, the component also pushes `message` into the shared off-screen live-region announcer (`utils/announce`) every time `show` becomes true — politely for `
|
|
142
|
-
- Two native `<button>`s: the optional action button (labelled by `
|
|
150
|
+
- The toast container (part `base`) is always in the shadow DOM with `role="status"`, `aria-live="polite"` and `aria-atomic="true"`; it is hidden with `display: none` while `show` is false. Because toggling `display` is not reliably announced, the component also pushes `message` into the shared off-screen live-region announcer (`utils/announce`) every time `show` becomes true — politely for `neutral`, `info` and `success`, assertively for `destructive`. Focus is never moved.
|
|
151
|
+
- Two native `<button>`s: the optional action button (labelled by `action-label`) and the dismiss button with `aria-label="Dismiss"`. Both are in the Tab order; the component registers no key handlers (there is no Escape-to-close):
|
|
143
152
|
|
|
144
153
|
| Key | Action |
|
|
145
154
|
| --- | --- |
|
|
@@ -7,7 +7,7 @@ Hover/focus tooltip implementing the Figma "Tooltip" component: wraps a trigger
|
|
|
7
7
|
```html
|
|
8
8
|
<!-- Default: above the trigger -->
|
|
9
9
|
<rel-tooltip text="Save your changes">
|
|
10
|
-
<rel-button variant="primary">Save</rel-button>
|
|
10
|
+
<rel-button variant="primary" tone="brand">Save</rel-button>
|
|
11
11
|
</rel-tooltip>
|
|
12
12
|
|
|
13
13
|
<!-- Positions -->
|
|
@@ -24,7 +24,7 @@ Hover/focus tooltip implementing the Figma "Tooltip" component: wraps a trigger
|
|
|
24
24
|
<!-- With the pointing tail -->
|
|
25
25
|
<rel-tooltip text="Edit" show-tail>
|
|
26
26
|
<rel-button variant="ghost" icon-only aria-label="Edit">
|
|
27
|
-
<rel-icon name="
|
|
27
|
+
<rel-icon name="pencil"></rel-icon>
|
|
28
28
|
</rel-button>
|
|
29
29
|
</rel-tooltip>
|
|
30
30
|
|
|
@@ -75,7 +75,7 @@ Hover/focus tooltip implementing the Figma "Tooltip" component: wraps a trigger
|
|
|
75
75
|
|
|
76
76
|
| Slot | Description |
|
|
77
77
|
| --- | --- |
|
|
78
|
-
| (default) | The trigger element (one focusable element such as a button or icon button).
|
|
78
|
+
| (default) | The trigger element (one focusable element such as a button or icon button). The control that takes focus — the slotted element itself, or the focusable control inside a rel-* trigger such as rel-button — receives `text` as its `aria-description`, so screen readers announce it. |
|
|
79
79
|
|
|
80
80
|
## CSS Parts
|
|
81
81
|
|
|
@@ -98,7 +98,8 @@ Set these on the host (or an ancestor) to customise the element without touching
|
|
|
98
98
|
|
|
99
99
|
## Accessibility
|
|
100
100
|
|
|
101
|
-
-
|
|
101
|
+
- Screen readers read `text` as the trigger's **description**: it is set as `aria-description` on the control that takes focus — the first slotted element, or, when that is a rel-* component such as `<rel-button>`, the focusable control inside its shadow root. It is re-linked on `slotchange` and updated when `text` changes, and a swapped-out trigger loses the description it was given. (Up to 1.4.9 the trigger got `aria-describedby` pointing at the bubble's id inside this component's shadow root, a reference that cannot cross the shadow boundary, so nothing was announced.)
|
|
102
|
+
- The bubble keeps `role="tooltip"` but is `aria-hidden`: it stays in the DOM while hidden (opacity), so it would otherwise be read a second time as stray text.
|
|
102
103
|
- The bubble is shown while the host is hovered **or** has focus within (`:focus-within`), so keyboard users see it when the slotted trigger is focused. The trigger therefore must be focusable — wrap a button or link, not plain text.
|
|
103
104
|
- The bubble never takes focus and has `pointer-events: none`.
|
|
104
105
|
|