@reliability-design/web 1.4.9 → 1.4.10
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 +155 -2
- package/custom-elements.json +18600 -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 +20 -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 +1602 -624
- package/dist/index.d.ts +1602 -624
- package/dist/index.js +11755 -6673
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +10955 -5880
- package/dist/index.mjs.map +1 -1
- 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 +60 -37
- package/dist/styles/focus-ring.ts +0 -84
|
@@ -1,206 +1,221 @@
|
|
|
1
|
-
# rel-date-picker
|
|
2
|
-
|
|
3
|
-
`<rel-date-picker>` is the single-date form field of the Reliability Design System (Figma "Date Picker"). It is a text field you can type a date into, with a popover calendar whose header pills drill into month and year grids, above Today / Tomorrow / Yesterday shortcut chips. The committed `value` is always an ISO `YYYY-MM-DD` string; the visible text follows `locale`, `display-format` or a `formatDate` callback. Use it wherever a form needs one date. For a from/to range use `<rel-range-picker>`, for an always-visible grid use `<rel-calendar>`, for a time of day use `<rel-time-picker>`.
|
|
4
|
-
|
|
5
|
-
## Usage
|
|
6
|
-
|
|
7
|
-
```html
|
|
8
|
-
<!-- Basic labelled field -->
|
|
9
|
-
<rel-date-picker label="Start date"></rel-date-picker>
|
|
10
|
-
|
|
11
|
-
<!-- Preselected, clearable, required (adds * to the label and aria-required) -->
|
|
12
|
-
<rel-date-picker label="Appointment" value="2026-01-16" clearable required></rel-date-picker>
|
|
13
|
-
|
|
14
|
-
<!-- Bounded to 2026, Monday-first grid -->
|
|
15
|
-
<rel-date-picker label="Delivery" min-date="2026-01-01" max-date="2026-12-31" week-start="mon"></rel-date-picker>
|
|
16
|
-
|
|
17
|
-
<!-- Field heights 32 / 40 / 48;
|
|
18
|
-
<rel-date-picker size="small" label="Small"></rel-date-picker>
|
|
19
|
-
<rel-date-picker size="medium" label="Medium" variant="outlined"></rel-date-picker>
|
|
20
|
-
<rel-date-picker size="large" label="Large"
|
|
21
|
-
|
|
22
|
-
<!-- Hide the Today / Tomorrow / Yesterday chip row (on by default) -->
|
|
23
|
-
<rel-date-picker label="Due" show-shortcuts="false"></rel-date-picker>
|
|
24
|
-
|
|
25
|
-
<!-- Helper and error text below the field -->
|
|
26
|
-
<rel-date-picker label="Due" helper-text="Defaults to the next business day"></rel-date-picker>
|
|
27
|
-
<rel-date-picker label="Due" error error-message="Pick a date after today"></rel-date-picker>
|
|
28
|
-
|
|
29
|
-
<!-- Fixed display format and locale (value stays ISO) -->
|
|
30
|
-
<rel-date-picker value="2026-07-21" display-format="DD/MM/YYYY"></rel-date-picker>
|
|
31
|
-
<rel-date-picker value="2026-07-21" locale="es-ES"></rel-date-picker>
|
|
32
|
-
|
|
33
|
-
<!-- Read-only, disabled, and native form submission via a hidden input -->
|
|
34
|
-
<rel-date-picker label="Created" value="2026-01-16" readonly></rel-date-picker>
|
|
35
|
-
<rel-date-picker label="Archived" value="2026-01-16" disabled></rel-date-picker>
|
|
36
|
-
<rel-date-picker name="start" label="Start" placeholder="YYYY-MM-DD"></rel-date-picker>
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
```js
|
|
40
|
-
const picker = document.querySelector("rel-date-picker");
|
|
41
|
-
|
|
42
|
-
// Disable individual days on top of min-date/max-date (property only)
|
|
43
|
-
picker.isDateDisabled = (date) => date.getDay() === 0 || date.getDay() === 6;
|
|
44
|
-
|
|
45
|
-
// Full control of the visible text; wins over display-format
|
|
46
|
-
picker.formatDate = (date) => `Q${Math.floor(date.getMonth() / 3) + 1} ${date.getFullYear()}`;
|
|
47
|
-
|
|
48
|
-
// Keep the popover open after a pick (
|
|
49
|
-
picker.closeOnSelect = false;
|
|
50
|
-
|
|
51
|
-
picker.addEventListener("rel-change", (e) => {
|
|
52
|
-
e.detail.value; // "2026-01-16" or null when cleared
|
|
53
|
-
e.detail.date; // Date at local midnight, or null
|
|
54
|
-
});
|
|
55
|
-
picker.addEventListener("rel-open-change", (e) => e.detail.open);
|
|
56
|
-
picker.addEventListener("rel-blur", () => {/* run validation */});
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
### Typed entry
|
|
60
|
-
|
|
61
|
-
The field is editable. Typed text is committed on Enter or when focus leaves the component; the parser (`date-parse.ts`) accepts ISO `2026-07-21`, numeric `21/7/2026` / `7/21/26`, month names `21 Jul 2026` / `July 21, 2026`, partial `21/7` (current year) or `21` (current month), and `20260721`. Two-digit years map to `20YY`. When day/month order is ambiguous (`3/4`), the order in `display-format` decides, else the locale's default numeric order. Shortcuts `t` / `today`, `t+7`, `t-3` resolve relative to today. Unparseable text shows "Invalid date", a date outside `min-date`/`max-date`/`isDateDisabled` shows "Date not available" — in both cases the text stays for correction and `value` is untouched; Escape reverts the text. Committing an empty field clears the value like the clear button does.
|
|
62
|
-
|
|
63
|
-
### Display format
|
|
64
|
-
|
|
65
|
-
Without `display-format` or `formatDate` the field shows the locale long date (`July 21, 2026`, `21 de julio de 2026` for `es-ES`). `display-format` tokens (`date-format.ts`), matched longest-first with other characters passed through and literal text in `[ ]`: `YYYY` 2026 · `YY` 26 · `MMMM` July · `MMM` Jul · `MM` 07 · `M` 7 · `DD` 21 · `D` 21. Named-month tokens follow `locale`.
|
|
66
|
-
|
|
67
|
-
### Deprecated aliases
|
|
68
|
-
|
|
69
|
-
```html
|
|
70
|
-
<!-- min / max → min-date / max-date. Both still work; min-date/max-date win when both are set. No console notice is logged. -->
|
|
71
|
-
<rel-date-picker min="2026-01-01" max="2026-12-31"></rel-date-picker>
|
|
72
|
-
<!-- canonical -->
|
|
73
|
-
<rel-date-picker min-date="2026-01-01" max-date="2026-12-31"></rel-date-picker>
|
|
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
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
|
181
|
-
|
|
|
182
|
-
|
|
183
|
-
|
|
|
184
|
-
|
|
|
185
|
-
|
|
|
186
|
-
|
|
187
|
-
|
|
|
188
|
-
|
|
|
189
|
-
|
|
|
190
|
-
|
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
1
|
+
# rel-date-picker
|
|
2
|
+
|
|
3
|
+
`<rel-date-picker>` is the single-date form field of the Reliability Design System (Figma "Date Picker"). It is a text field you can type a date into, with a popover calendar whose header pills drill into month and year grids, above Today / Tomorrow / Yesterday shortcut chips. The committed `value` is always an ISO `YYYY-MM-DD` string; the visible text follows `locale`, `display-format` or a `formatDate` callback. Use it wherever a form needs one date. For a from/to range use `<rel-range-picker>`, for an always-visible grid use `<rel-calendar>`, for a time of day use `<rel-time-picker>`.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
```html
|
|
8
|
+
<!-- Basic labelled field -->
|
|
9
|
+
<rel-date-picker label="Start date"></rel-date-picker>
|
|
10
|
+
|
|
11
|
+
<!-- Preselected, clearable, required (adds * to the label and aria-required) -->
|
|
12
|
+
<rel-date-picker label="Appointment" value="2026-01-16" clearable required></rel-date-picker>
|
|
13
|
+
|
|
14
|
+
<!-- Bounded to 2026, Monday-first grid -->
|
|
15
|
+
<rel-date-picker label="Delivery" min-date="2026-01-01" max-date="2026-12-31" week-start="mon"></rel-date-picker>
|
|
16
|
+
|
|
17
|
+
<!-- Field heights 32 / 40 / 48; full-width fills the parent -->
|
|
18
|
+
<rel-date-picker size="small" label="Small"></rel-date-picker>
|
|
19
|
+
<rel-date-picker size="medium" label="Medium" variant="outlined"></rel-date-picker>
|
|
20
|
+
<rel-date-picker size="large" label="Large" full-width></rel-date-picker>
|
|
21
|
+
|
|
22
|
+
<!-- Hide the Today / Tomorrow / Yesterday chip row (on by default) -->
|
|
23
|
+
<rel-date-picker label="Due" show-shortcuts="false"></rel-date-picker>
|
|
24
|
+
|
|
25
|
+
<!-- Helper and error text below the field -->
|
|
26
|
+
<rel-date-picker label="Due" helper-text="Defaults to the next business day"></rel-date-picker>
|
|
27
|
+
<rel-date-picker label="Due" error error-message="Pick a date after today"></rel-date-picker>
|
|
28
|
+
|
|
29
|
+
<!-- Fixed display format and locale (value stays ISO) -->
|
|
30
|
+
<rel-date-picker value="2026-07-21" display-format="DD/MM/YYYY"></rel-date-picker>
|
|
31
|
+
<rel-date-picker value="2026-07-21" locale="es-ES"></rel-date-picker>
|
|
32
|
+
|
|
33
|
+
<!-- Read-only, disabled, and native form submission via a hidden input -->
|
|
34
|
+
<rel-date-picker label="Created" value="2026-01-16" readonly></rel-date-picker>
|
|
35
|
+
<rel-date-picker label="Archived" value="2026-01-16" disabled></rel-date-picker>
|
|
36
|
+
<rel-date-picker name="start" label="Start" placeholder="YYYY-MM-DD"></rel-date-picker>
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
```js
|
|
40
|
+
const picker = document.querySelector("rel-date-picker");
|
|
41
|
+
|
|
42
|
+
// Disable individual days on top of min-date/max-date (property only)
|
|
43
|
+
picker.isDateDisabled = (date) => date.getDay() === 0 || date.getDay() === 6;
|
|
44
|
+
|
|
45
|
+
// Full control of the visible text; wins over display-format
|
|
46
|
+
picker.formatDate = (date) => `Q${Math.floor(date.getMonth() / 3) + 1} ${date.getFullYear()}`;
|
|
47
|
+
|
|
48
|
+
// Keep the popover open after a pick (same as close-on-select="false" in markup)
|
|
49
|
+
picker.closeOnSelect = false;
|
|
50
|
+
|
|
51
|
+
picker.addEventListener("rel-change", (e) => {
|
|
52
|
+
e.detail.value; // "2026-01-16" or null when cleared
|
|
53
|
+
e.detail.date; // Date at local midnight, or null
|
|
54
|
+
});
|
|
55
|
+
picker.addEventListener("rel-open-change", (e) => e.detail.open);
|
|
56
|
+
picker.addEventListener("rel-blur", () => {/* run validation */});
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### Typed entry
|
|
60
|
+
|
|
61
|
+
The field is editable. Typed text is committed on Enter or when focus leaves the component; the parser (`date-parse.ts`) accepts ISO `2026-07-21`, numeric `21/7/2026` / `7/21/26`, month names `21 Jul 2026` / `July 21, 2026`, partial `21/7` (current year) or `21` (current month), and `20260721`. Two-digit years map to `20YY`. When day/month order is ambiguous (`3/4`), the order in `display-format` decides, else the locale's default numeric order. Shortcuts `t` / `today`, `t+7`, `t-3` resolve relative to today. Unparseable text shows "Invalid date", a date outside `min-date`/`max-date`/`isDateDisabled` shows "Date not available" — in both cases the text stays for correction and `value` is untouched; Escape reverts the text. Committing an empty field clears the value like the clear button does.
|
|
62
|
+
|
|
63
|
+
### Display format
|
|
64
|
+
|
|
65
|
+
Without `display-format` or `formatDate` the field shows the locale long date (`July 21, 2026`, `21 de julio de 2026` for `es-ES`). `display-format` tokens (`date-format.ts`), matched longest-first with other characters passed through and literal text in `[ ]`: `YYYY` 2026 · `YY` 26 · `MMMM` July · `MMM` Jul · `MM` 07 · `M` 7 · `DD` 21 · `D` 21. Named-month tokens follow `locale`.
|
|
66
|
+
|
|
67
|
+
### Deprecated aliases
|
|
68
|
+
|
|
69
|
+
```html
|
|
70
|
+
<!-- min / max → min-date / max-date. Both still work; min-date/max-date win when both are set. No console notice is logged. -->
|
|
71
|
+
<rel-date-picker min="2026-01-01" max="2026-12-31"></rel-date-picker>
|
|
72
|
+
<!-- canonical -->
|
|
73
|
+
<rel-date-picker min-date="2026-01-01" max-date="2026-12-31"></rel-date-picker>
|
|
74
|
+
|
|
75
|
+
<!-- fullwidth → full-width (since 1.5.0; still works, logs a one-time console notice, removed in 3.0) -->
|
|
76
|
+
<rel-date-picker label="Old spelling" fullwidth></rel-date-picker>
|
|
77
|
+
<rel-date-picker label="Canonical" full-width></rel-date-picker>
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
<!-- readme-gen:start -->
|
|
81
|
+
|
|
82
|
+
<!-- Generated from rel-date-picker.ts — do not edit; run readme-generate.mjs -->
|
|
83
|
+
|
|
84
|
+
## API
|
|
85
|
+
|
|
86
|
+
### Attributes / Properties
|
|
87
|
+
|
|
88
|
+
| Property | Attribute | Type | Default | Description |
|
|
89
|
+
| --- | --- | --- | --- | --- |
|
|
90
|
+
| `value` | `value` | `string \| null` | `null` | Selected date as an ISO `YYYY-MM-DD` string, or `null` when empty; setting it also moves the popover to that month. Reflected. |
|
|
91
|
+
| `placeholder` | `placeholder` | `string` | `"Select date"` | Placeholder text shown while the field is empty (visual only; the accessible name comes from `label`, or "Select date" when unset). |
|
|
92
|
+
| `label` | `label` | `string \| null` | `null` | Visible label rendered above the field and wired to the input via `aria-labelledby`; `null` renders no label. |
|
|
93
|
+
| `disabled` | `disabled` | `boolean` | `false` | Disables the field, the icons and the popover. 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. |
|
|
94
|
+
| `required` | `required` | `boolean` | `false` | Appends a `*` to the label and sets `aria-required`; no validation is performed. |
|
|
95
|
+
| `readonly` | `readonly` | `boolean` | `false` | Makes the input read-only and stops the field, icon, Enter and ArrowDown from opening the popover. Reflected. |
|
|
96
|
+
| `minDate` | `min-date` | `string \| null` | `null` | Earliest selectable date (ISO `YYYY-MM-DD`); earlier days are disabled and typed dates before it are rejected. Wins over the deprecated `min`. |
|
|
97
|
+
| `maxDate` | `max-date` | `string \| null` | `null` | Latest selectable date (ISO `YYYY-MM-DD`); later days are disabled and typed dates after it are rejected. Wins over the deprecated `max`. |
|
|
98
|
+
| `weekStart` | `week-start` | `"sun" \| "mon"` | `"sun"` | First column of the calendar grid: `"sun"` (default) or `"mon"`. |
|
|
99
|
+
| `locale` | `locale` | `string` | `"en-US"` | BCP 47 locale for weekday/month names, the default long-date display, and day/month order when parsing ambiguous typed input. |
|
|
100
|
+
| `displayFormat` | `display-format` | `string \| null` | `null` | Token pattern for the displayed value (`YYYY`, `YY`, `MMMM`, `MMM`, `MM`, `M`, `DD`, `D`; literal text in `[ ]`), e.g. `DD/MM/YYYY`. Unset → the locale long date. Affects only the visible text, never `value`. |
|
|
101
|
+
| `formatDate` | — | `(date: Date) => string` | `undefined` | Callback with full control over the displayed value; wins over `displayFormat`. Assign it from JavaScript; it stays reactive so setting it after render re-renders the field. The Date it receives is at local midnight. Property only. |
|
|
102
|
+
| `open` | `open` | `boolean` | `false` | Whether the calendar popover is open; set it directly to open/close programmatically (focus then moves into the grid). Reflected. |
|
|
103
|
+
| `closeOnSelect` | `close-on-select` | `boolean` | `true` | Closes the popover after a day is picked in the grid (default `true`). |
|
|
104
|
+
| `clearable` | `clearable` | `boolean` | `false` | Shows a clear (×) icon while a value is set; clearing fires `rel-change` with `value: null`. |
|
|
105
|
+
| `showShortcuts` | `show-shortcuts` | `boolean` | `true` | Figma ".Date Picker Calendar" Show Shortcuts: renders the Today / Tomorrow / Yesterday chip row and its divider at the top of the popover. On by default — write `show-shortcuts="false"` to hide both (a plain boolean attribute could not express a default of `true`). The typed `T` / `T±N` shortcuts and the in-panel `T` key keep working either way. |
|
|
106
|
+
| `error` | `error` | `boolean` | `false` | Forces the error style (danger border, `aria-invalid`) and shows `errorMessage` below the field. Typed-entry parse errors set the same style on their own. |
|
|
107
|
+
| `errorMessage` | `error-message` | `string` | `undefined` | Text shown below the field while `error` is set (or a typed date failed to parse); falls back to `helperText`. |
|
|
108
|
+
| `helperText` | `helper-text` | `string` | `undefined` | Supporting text shown below the field when there is no error. |
|
|
109
|
+
| `name` | `name` | `string` | `undefined` | When set, renders a hidden `<input name>` carrying the ISO value so the picker submits with a native form. |
|
|
110
|
+
| `size` | `size` | `"small" \| "medium" \| "large"` | `"medium"` | Field height scale shared with rel-textfield / rel-select: `small` 32px, `medium` 40px (default), `large` 48px. |
|
|
111
|
+
| `variant` | `variant` | `"outlined"` | `"outlined"` | Visual style of the field; `outlined` is the only variant today. Reflected. |
|
|
112
|
+
| `fullWidth` | `full-width` | `boolean` | `false` | Stretches the host to fill its parent's width (attribute `full-width`); off by default so the field keeps its intrinsic inline width. Reflected (as `fullwidth` in 1.x). The `fullwidth` attribute spelling is deprecated (still works; removal targeted for 3.0). |
|
|
113
|
+
|
|
114
|
+
#### Deprecated (still supported — removal targeted for 3.0)
|
|
115
|
+
|
|
116
|
+
| Property | Attribute | Type | Use instead |
|
|
117
|
+
| --- | --- | --- | --- |
|
|
118
|
+
| `min` | `min` | `string \| null` | use minDate |
|
|
119
|
+
| `max` | `max` | `string \| null` | use maxDate |
|
|
120
|
+
|
|
121
|
+
### Public fields / accessors
|
|
122
|
+
|
|
123
|
+
| Name | Type | Description |
|
|
124
|
+
| --- | --- | --- |
|
|
125
|
+
| `isDateDisabled` | `(date: Date) => boolean` | Custom predicate that disables individual days (return `true` to disable); applied on top of `minDate`/`maxDate` and also rejects typed input. Property only — assign it from JavaScript. |
|
|
126
|
+
|
|
127
|
+
## Events
|
|
128
|
+
|
|
129
|
+
| Event | Detail | Bubbles / composed | Description |
|
|
130
|
+
| --- | --- | --- | --- |
|
|
131
|
+
| `rel-blur` | — | bubbles / composed | Fired when the text input loses focus (before any typed text is committed). No detail. |
|
|
132
|
+
| `rel-change` | `{ value: newValue, date: new Date(date), } / { value: null, date: null, } / { value: null, date: null }` | bubbles / composed | Fired when the value changes — grid pick, typed entry, shortcut, or clear. Detail: `{ value: string \| null, date: Date \| null }` (ISO `YYYY-MM-DD` and a local-midnight Date; both `null` when cleared). |
|
|
133
|
+
| `rel-open-change` | `{ open: this.open } / { open: false }` | bubbles / composed | Fired when the calendar popover opens or closes. Detail: `{ open: boolean }`. |
|
|
134
|
+
|
|
135
|
+
## Slots
|
|
136
|
+
|
|
137
|
+
| Slot | Description |
|
|
138
|
+
| --- | --- |
|
|
139
|
+
| — | This element has no slots. |
|
|
140
|
+
|
|
141
|
+
## CSS Parts
|
|
142
|
+
|
|
143
|
+
| Part | Description |
|
|
144
|
+
| --- | --- |
|
|
145
|
+
| `unavailable` | Day cells that cannot be picked (outside `min-date` / `max-date`, or blocked by `isDateDisabled`). They are `aria-disabled` and stay focusable, so `:disabled` does not match them; style them with `::part(unavailable)` |
|
|
146
|
+
| `base` | Outer wrapper carrying the size class (`small` / `medium` / `large`) |
|
|
147
|
+
| `label` | The visible field label (rendered only when `label` is set) |
|
|
148
|
+
| `trigger` | The field box that wraps the text input and the clear/calendar icons |
|
|
149
|
+
| `value` | The editable text input inside the trigger |
|
|
150
|
+
| `shortcuts` | The Today / Tomorrow / Yesterday chip row at the top of the popover |
|
|
151
|
+
|
|
152
|
+
## Tokens / CSS Variables
|
|
153
|
+
|
|
154
|
+
### Component hooks
|
|
155
|
+
|
|
156
|
+
Set these on the host (or an ancestor) to customise the element without touching design tokens.
|
|
157
|
+
|
|
158
|
+
| Custom property | Default | Description |
|
|
159
|
+
| --- | --- | --- |
|
|
160
|
+
| `--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. |
|
|
161
|
+
|
|
162
|
+
<!-- readme-gen:end -->
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
## CSS Custom Properties
|
|
166
|
+
|
|
167
|
+
| Custom property | Default | Description |
|
|
168
|
+
| --- | --- | --- |
|
|
169
|
+
| `--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. |
|
|
170
|
+
## Accessibility
|
|
171
|
+
|
|
172
|
+
- The text input is a `role="combobox"` with `aria-haspopup="dialog"`, `aria-expanded`, `aria-controls` pointing at the panel, `aria-required` from `required`, `aria-invalid` when `error` is set or typed text failed to parse, and `aria-describedby` pointing at the helper/error line. Its name is the `label` (via `aria-labelledby`) or the fixed string "Select date" when no label is set; the required `*` is `aria-hidden`.
|
|
173
|
+
- The icons are real buttons: "Clear date" (only while `clearable` and a value is set) and "Open calendar" (carries `aria-expanded`).
|
|
174
|
+
- The popover is a `role="dialog"` named "Choose date". While it is open, Tab and Shift+Tab are trapped inside it (`trapTabKey`), and Escape closes it from anywhere in the document.
|
|
175
|
+
- The month and year pills are buttons carrying `aria-expanded`; pressing one swaps the panel body for a `role="grid"` of `role="gridcell"` cells ("Select month" / "Select year") with `aria-selected` on the current value. Every view is 252 px tall, so the panel never resizes as the user drills in.
|
|
176
|
+
- The day grid is `role="grid"` named "<Month> <Year>"; weeks are `role="row"`; each day is a `<button role="gridcell">` with the full long date as `aria-label`, `aria-selected`, `aria-current="date"` on today and `aria-disabled="true"` for unavailable days (changed, unreleased — they used to be native `disabled`, which could not take focus). Exactly one cell is a Tab stop: the day last interacted with (arrowed to, clicked or tabbed onto), else the selected day, else today, else the first enabled day — so Shift+Tab then Tab returns to the day you left. The arrow keys move by date, not by grid position, so they stay on the right day when the view flips month (unreleased fix: Sep 27 + ArrowDown used to land on Nov 1 instead of Oct 4). The key map is shared with `rel-range-picker`.
|
|
177
|
+
- Focus: opening from the calendar icon, Enter, ArrowDown or by setting `open` moves focus into the grid (onto that Tab-stop cell) after 100 ms; opening by clicking into the text keeps focus in the input so typing keeps working. Closing via Escape, a pick or a shortcut returns focus to the input; an outside click closes without refocusing.
|
|
178
|
+
- Screen readers hear "<Month> <Year>" through the shared `announce()` region (`utils/announce.ts`) on every month/year change (chevrons, a month or year cell, PageUp/PageDown, arrowing across a month boundary), and the first and last year of the page (e.g. "2020 to 2031") when the years page changes. The helper/error line is a persistent `aria-live="polite"` region, so parse errors are read as they appear.
|
|
179
|
+
|
|
180
|
+
| Key (in the field) | Action |
|
|
181
|
+
| --- | --- |
|
|
182
|
+
| Enter | Nothing typed: open the popover. Text typed: commit it |
|
|
183
|
+
| ArrowDown | Open the popover; if already open, move focus into the grid |
|
|
184
|
+
| Escape | Revert uncommitted text and close the popover |
|
|
185
|
+
| Tab (popover open) | Cycle through the popover's controls |
|
|
186
|
+
|
|
187
|
+
| Key (in the grid) | Action |
|
|
188
|
+
| --- | --- |
|
|
189
|
+
| ArrowLeft / ArrowRight | Previous / next day (switches month at the edge) |
|
|
190
|
+
| ArrowUp / ArrowDown | Same weekday one week earlier / later |
|
|
191
|
+
| Home / End | First / last day of the week, honouring `week-start` (switches month if that day is in the adjacent month) |
|
|
192
|
+
| PageUp / PageDown | Same day previous / next month (clamped to the month's last day, e.g. 31 Jan → 28 Feb) |
|
|
193
|
+
| Shift + PageUp / Shift + PageDown | Same day previous / next year |
|
|
194
|
+
| Enter / Space | Select the day; closes the popover unless `closeOnSelect` is false. Does nothing on an unavailable day — the arrows land on those days rather than skipping them |
|
|
195
|
+
| T (anywhere in the popover, no modifier) | Select today |
|
|
196
|
+
| Escape | Close and return focus to the input |
|
|
197
|
+
|
|
198
|
+
| Key (month / year grid) | Action |
|
|
199
|
+
| --- | --- |
|
|
200
|
+
| Enter / Space on a pill | Open that grid; press the same pill again to return to the days |
|
|
201
|
+
| ArrowLeft / ArrowRight | Previous / next cell |
|
|
202
|
+
| ArrowUp / ArrowDown | Same column, one row up / down |
|
|
203
|
+
| Home / End | First / last cell of the grid |
|
|
204
|
+
| Enter / Space | Choose the cell — a year drills into the months, a month returns to the days |
|
|
205
|
+
| Escape | Back to the days grid, keeping the popover open |
|
|
206
|
+
|
|
207
|
+
## Notes / Edge Cases
|
|
208
|
+
|
|
209
|
+
- `value` is always ISO `YYYY-MM-DD`; `display-format` and `formatDate` change only the visible text. The `Date` given to `formatDate`, `isDateDisabled` and `rel-change` is at local midnight — read it with `getFullYear()`/`getMonth()`/`getDate()`, never `toISOString()` (which can shift the day by the UTC offset). For a plain ISO display use `display-format="YYYY-MM-DD"`.
|
|
210
|
+
- `min`/`max` are deprecated aliases of `min-date`/`max-date`; when both spellings are present the canonical one wins. No runtime notice is logged.
|
|
211
|
+
- Leading and trailing cells of adjacent months are interactive, as in `rel-calendar` (changed, unreleased — they used to be disabled): they hover, focus and select like any other day, and `min-date` / `max-date` / `isDateDisabled` disable them exactly as they would an in-month day. Their label, like a weekend's, uses the caption colour (`--rel-text-caption`) unless selected (1.5.0; it used to fade to 40%, weekends to 70%). Picking one with `closeOnSelect = false` moves the view to that day's month and focus to the new selection.
|
|
212
|
+
- The years grid shows one 12-year page at a time, anchored so the year in view sits in the seventh cell; the chevrons page by 12. In the months grid the chevrons step a year, and in the days grid a month. A month or year cell is disabled only when *every* day it covers falls outside `min-date`/`max-date`.
|
|
213
|
+
- The panel always reopens on the days grid, whichever view was showing when it closed.
|
|
214
|
+
- The field is Figma's TextField instance: `border-radius: xs` (4 px), 12 px inline padding at `medium`, a 4 px label gap and an 18 px suffix icon — the same geometry `rel-textfield` uses, so the two line up in a shared form row. Icon and inline padding step with `size` (16/18/20 px and 8/12/16 px).
|
|
215
|
+
- The panel is promoted to the browser top layer (`popover="manual"`), so it renders above `rel-modal` / `rel-drawer` and transformed or `overflow: hidden` ancestors. It repositions on resize. 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`). It flips above the trigger when there is no room below, stays 8 px inside the viewport, is capped at 600 px tall (scrolls) and never wider than the viewport.
|
|
216
|
+
- Below-field text resolves as `errorMessage ?? typed-entry error ?? helperText` while in error, else `helperText`. A typed-entry error styles the field like `error` without setting the property.
|
|
217
|
+
- `readonly` and `disabled` both stop the popover from opening (field click, icon, Enter, ArrowDown); `disabled` also blocks all pointer events.
|
|
218
|
+
- `closeOnSelect` defaults to true; turn it off with `close-on-select="false"` (since 1.5.0) or `picker.closeOnSelect = false`. It affects grid picks only — typed entry and shortcuts always close the popover.
|
|
219
|
+
- The `name` hidden input submits an empty string while `value` is null.
|
|
220
|
+
- `size` is applied as a class on part `base` (not reflected); `variant` currently has the single value `outlined`.
|
|
221
|
+
- The host is `inline-block` with an intrinsic width (min 200 px) by default; `full-width` switches it to a block that fills the parent.
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
<rel-drawer id="filters" title="Filters" description="Narrow down the results.">
|
|
12
12
|
<p>Filter controls go here.</p>
|
|
13
13
|
<rel-button slot="footer" variant="secondary" id="reset">Reset</rel-button>
|
|
14
|
-
<rel-button slot="footer" variant="primary" id="apply">Apply</rel-button>
|
|
14
|
+
<rel-button slot="footer" variant="primary" tone="brand" id="apply">Apply</rel-button>
|
|
15
15
|
</rel-drawer>
|
|
16
16
|
|
|
17
17
|
<script>
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
<!-- Standalone actions row using the same layout as the drawer footer -->
|
|
57
57
|
<rel-drawer-footer>
|
|
58
58
|
<rel-button variant="secondary">Cancel</rel-button>
|
|
59
|
-
<rel-button variant="primary">Save</rel-button>
|
|
59
|
+
<rel-button variant="primary" tone="brand">Save</rel-button>
|
|
60
60
|
</rel-drawer-footer>
|
|
61
61
|
```
|
|
62
62
|
|
|
@@ -104,7 +104,7 @@
|
|
|
104
104
|
| Slot | Description |
|
|
105
105
|
| --- | --- |
|
|
106
106
|
| (default) | Body content of the drawer |
|
|
107
|
-
| `footer` | Actions row; rendered inside a `<rel-drawer-footer>` (right-aligned, 8px gap) |
|
|
107
|
+
| `footer` | Actions row; rendered inside a `<rel-drawer-footer>` (right-aligned, 8px gap). The footer only renders when this slot has content; its top divider shows only while the body scrolls |
|
|
108
108
|
|
|
109
109
|
### CSS Parts
|
|
110
110
|
|
|
@@ -183,5 +183,5 @@ Set these on the host (or an ancestor) to customise the element without touching
|
|
|
183
183
|
- `width` is written to the panel as an inline `--rel-drawer-width`, so it wins over a `--rel-drawer-width` set on the host. Leave it empty to use the per-side defaults.
|
|
184
184
|
- `max-height` is written to the panel as `--drawer-max-height` but no rule reads it yet; size bottom drawers with `--rel-drawer-height` instead.
|
|
185
185
|
- After a left/right drawer finishes sliding in, its `transform` is dropped so `position: fixed` descendants (select menus, popovers, tooltips, date pickers) are no longer clipped to the panel. Bottom drawers keep their transform because it centres them.
|
|
186
|
-
- The
|
|
186
|
+
- The header always has a bottom border. The footer wrapper only renders when the `footer` slot has content (the host gains a `has-footer` attribute while it does), so a drawer without actions has no empty footer band. Its top divider shows only while the body scrolls (the host gains `body-scrolls`); short content has no footer divider. Scrolling is re-measured when the body or any slotted child resizes, so content added after opening, children growing in place, images loading and window resizes all update it.
|
|
187
187
|
- Legacy hook aliases still honoured: `--drawer-width`, `--drawer-height`, `--drawer-transition-duration` and `--drawer-transition-timing` are read as fallbacks of the `--rel-drawer-*` hooks. `--rel-drawer-scrim-opacity` has no legacy alias.
|