@reliability-design/web 1.4.6 → 1.4.8
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 +246 -49
- package/dist/components/rel-accordion/README.md +133 -132
- package/dist/components/rel-alert/README.md +145 -141
- package/dist/components/rel-autocomplete/README.md +172 -61
- package/dist/components/rel-avatar/README.md +118 -130
- package/dist/components/rel-badge/README.md +97 -93
- package/dist/components/rel-breadcrumb/README.md +96 -102
- package/dist/components/rel-button/README.md +190 -130
- package/dist/components/rel-calendar/README.md +109 -109
- package/dist/components/rel-card/README.md +75 -94
- package/dist/components/rel-cardmedia/README.md +100 -127
- package/dist/components/rel-carousel/README.md +186 -166
- package/dist/components/rel-checkbox/README.md +96 -75
- package/dist/components/rel-chip/README.md +138 -121
- package/dist/components/rel-container/README.md +107 -99
- package/dist/components/rel-date-picker/README.md +200 -289
- package/dist/components/rel-divider/README.md +88 -100
- package/dist/components/rel-drawer/README.md +187 -200
- package/dist/components/rel-kbd/README.md +141 -151
- package/dist/components/rel-layout/README.md +34 -0
- package/dist/components/rel-menu/README.md +180 -151
- package/dist/components/rel-menubar/README.md +218 -329
- package/dist/components/rel-otp/README.md +171 -440
- package/dist/components/rel-pagination/README.md +100 -424
- package/dist/components/rel-popover/README.md +203 -568
- package/dist/components/rel-progress/README.md +88 -110
- package/dist/components/rel-radio/README.md +131 -138
- package/dist/components/rel-range-picker/README.md +165 -0
- package/dist/components/rel-resizable/README.md +199 -140
- package/dist/components/rel-segmented-button/README.md +156 -141
- package/dist/components/rel-select/README.md +156 -93
- package/dist/components/rel-sheet/README.md +168 -224
- package/dist/components/rel-skeleton/README.md +104 -0
- package/dist/components/rel-slider/README.md +131 -135
- package/dist/components/rel-snackbar/README.md +168 -134
- package/dist/components/rel-stepper/README.md +162 -160
- package/dist/components/rel-switch/README.md +117 -102
- package/dist/components/rel-tab/README.md +173 -163
- package/dist/components/rel-textfield/README.md +176 -69
- package/dist/components/rel-time-picker/README.md +122 -157
- package/dist/components/rel-toast/README.md +165 -148
- package/dist/components/rel-tooltip/README.md +119 -111
- package/dist/components/rel-upload/README.md +220 -0
- package/dist/index.d.mts +1726 -447
- package/dist/index.d.ts +1726 -447
- package/dist/index.js +13715 -10870
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +14018 -11163
- package/dist/index.mjs.map +1 -1
- package/dist/styles/focus-ring.ts +84 -0
- package/dist/styles/vars.css +892 -866
- package/dist/{vars-XNMTSRVN.css → vars-DXX6QOAG.css} +892 -866
- package/package.json +3 -2
- package/dist/components/rel-accordion/rel-accordion.ts +0 -336
- package/dist/components/rel-alert/rel-alert.ts +0 -305
- package/dist/components/rel-autocomplete/rel-autocomplete.ts +0 -720
- package/dist/components/rel-avatar/rel-avatar.ts +0 -142
- package/dist/components/rel-badge/rel-badge.ts +0 -175
- package/dist/components/rel-breadcrumb/rel-breadcrumb.ts +0 -106
- package/dist/components/rel-button/rel-button.ts +0 -560
- package/dist/components/rel-calendar/index.ts +0 -1
- package/dist/components/rel-calendar/rel-calendar.ts +0 -565
- package/dist/components/rel-card/rel-card.ts +0 -88
- package/dist/components/rel-cardmedia/rel-cardmedia.ts +0 -88
- package/dist/components/rel-carousel/index.ts +0 -1
- package/dist/components/rel-carousel/rel-carousel.ts +0 -723
- package/dist/components/rel-chart/README.md +0 -286
- package/dist/components/rel-chart/index.ts +0 -1
- package/dist/components/rel-chart/rel-chart.ts +0 -754
- package/dist/components/rel-checkbox/rel-checkbox.ts +0 -382
- package/dist/components/rel-chip/rel-chip.ts +0 -483
- package/dist/components/rel-container/rel-container.ts +0 -95
- package/dist/components/rel-date-picker/date-format.test.ts +0 -43
- package/dist/components/rel-date-picker/date-format.ts +0 -47
- package/dist/components/rel-date-picker/date-parse.test.ts +0 -116
- package/dist/components/rel-date-picker/date-parse.ts +0 -178
- package/dist/components/rel-date-picker/index.ts +0 -1
- package/dist/components/rel-date-picker/rel-date-picker.ts +0 -1676
- package/dist/components/rel-divider/rel-divider.ts +0 -54
- package/dist/components/rel-drawer/index.ts +0 -1
- package/dist/components/rel-drawer/rel-drawer-footer.ts +0 -27
- package/dist/components/rel-drawer/rel-drawer.ts +0 -607
- package/dist/components/rel-kbd/rel-kbd.ts +0 -188
- package/dist/components/rel-layout/rel-layout.ts +0 -49
- package/dist/components/rel-menu/rel-menu.ts +0 -541
- package/dist/components/rel-menubar/index.ts +0 -2
- package/dist/components/rel-menubar/rel-menubar-menu.css +0 -3
- package/dist/components/rel-menubar/rel-menubar-menu.ts +0 -17
- package/dist/components/rel-menubar/rel-menubar.ts +0 -777
- package/dist/components/rel-nav-menu/README.md +0 -289
- package/dist/components/rel-nav-menu/index.ts +0 -3
- package/dist/components/rel-nav-menu/rel-nav-menu-item.ts +0 -243
- package/dist/components/rel-nav-menu/rel-nav-menu-panel.ts +0 -72
- package/dist/components/rel-nav-menu/rel-nav-menu.ts +0 -270
- package/dist/components/rel-navbar/README.md +0 -126
- package/dist/components/rel-navbar/rel-navbar.ts +0 -105
- package/dist/components/rel-otp/index.ts +0 -1
- package/dist/components/rel-otp/rel-otp.ts +0 -527
- package/dist/components/rel-pagination/index.ts +0 -1
- package/dist/components/rel-pagination/rel-pagination.ts +0 -522
- package/dist/components/rel-popover/index.ts +0 -2
- package/dist/components/rel-popover/rel-popover-content.ts +0 -81
- package/dist/components/rel-popover/rel-popover.ts +0 -475
- package/dist/components/rel-progress/rel-progress.ts +0 -234
- package/dist/components/rel-radio/rel-radio.ts +0 -481
- package/dist/components/rel-range-picker/rel-range-picker.ts +0 -1688
- package/dist/components/rel-resizable/index.ts +0 -3
- package/dist/components/rel-resizable/rel-resizable-group.ts +0 -405
- package/dist/components/rel-resizable/rel-resizable-handle.ts +0 -150
- package/dist/components/rel-resizable/rel-resizable-panel.ts +0 -58
- package/dist/components/rel-segmented-button/rel-segmented-button.ts +0 -217
- package/dist/components/rel-select/rel-select.ts +0 -1416
- package/dist/components/rel-sheet/rel-sheet.ts +0 -610
- package/dist/components/rel-sidebar/README.md +0 -209
- package/dist/components/rel-sidebar/rel-sidebar.ts +0 -1191
- package/dist/components/rel-skeleton/rel-skeleton.ts +0 -143
- package/dist/components/rel-slider/rel-slider.ts +0 -673
- package/dist/components/rel-snackbar/rel-snackbar.ts +0 -329
- package/dist/components/rel-stepper/rel-stepper.ts +0 -567
- package/dist/components/rel-switch/rel-switch.ts +0 -199
- package/dist/components/rel-tab/rel-tab.ts +0 -264
- package/dist/components/rel-table/README.md +0 -178
- package/dist/components/rel-table/rel-table-body.ts +0 -22
- package/dist/components/rel-table/rel-table-caption.ts +0 -30
- package/dist/components/rel-table/rel-table-cell.ts +0 -43
- package/dist/components/rel-table/rel-table-footer.ts +0 -24
- package/dist/components/rel-table/rel-table-head.ts +0 -47
- package/dist/components/rel-table/rel-table-header.ts +0 -22
- package/dist/components/rel-table/rel-table-row.ts +0 -37
- package/dist/components/rel-table/rel-table.ts +0 -62
- package/dist/components/rel-textfield/rel-textfield.ts +0 -1054
- package/dist/components/rel-time-picker/rel-time-picker.ts +0 -1482
- package/dist/components/rel-time-picker/time-parse.test.ts +0 -67
- package/dist/components/rel-time-picker/time-parse.ts +0 -85
- package/dist/components/rel-toast/rel-toast.ts +0 -206
- package/dist/components/rel-tooltip/rel-tooltip.ts +0 -193
- package/dist/components/rel-topbar/rel-topbar-actions.ts +0 -27
- package/dist/components/rel-topbar/rel-topbar-brand.ts +0 -54
- package/dist/components/rel-topbar/rel-topbar-dropdown-item.ts +0 -69
- package/dist/components/rel-topbar/rel-topbar-dropdown.ts +0 -31
- package/dist/components/rel-topbar/rel-topbar-item.ts +0 -324
- package/dist/components/rel-topbar/rel-topbar-mobile-panel.ts +0 -27
- package/dist/components/rel-topbar/rel-topbar-profile.ts +0 -243
- package/dist/components/rel-topbar/rel-topbar-utilities.ts +0 -27
- package/dist/components/rel-topbar/rel-topbar.ts +0 -446
- package/dist/components/rel-upload/UPLOAD-DESIGN-CHANGES.md +0 -134
- package/dist/components/rel-upload/rel-upload-actions.ts +0 -163
- package/dist/components/rel-upload/rel-upload.ts +0 -968
|
@@ -1,132 +1,133 @@
|
|
|
1
|
-
# rel-accordion
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
```html
|
|
8
|
-
<!-- Basic
|
|
9
|
-
<rel-accordion title="
|
|
10
|
-
<p>
|
|
11
|
-
</rel-accordion>
|
|
12
|
-
|
|
13
|
-
<!-- Initially open -->
|
|
14
|
-
<rel-accordion title="
|
|
15
|
-
<p>
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
<
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
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
|
-
|
|
132
|
-
-
|
|
1
|
+
# rel-accordion
|
|
2
|
+
|
|
3
|
+
`<rel-accordion>` is a single collapsible section of the Reliability Design System (Figma "Accordion", 6021:1085): a clickable header with a title and a chevron that expands or collapses the slotted body. Each element is independent — stack several to build an FAQ or a settings list, and nothing closes automatically when another opens. Use it for progressive disclosure of secondary content; do not use it to switch between peer views (use tabs) or to hide primary actions.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
```html
|
|
8
|
+
<!-- Basic: closed by default, opens on click / Enter / Space -->
|
|
9
|
+
<rel-accordion title="Shipping">
|
|
10
|
+
<p>Orders ship within two business days.</p>
|
|
11
|
+
</rel-accordion>
|
|
12
|
+
|
|
13
|
+
<!-- Initially open -->
|
|
14
|
+
<rel-accordion title="Returns" open>
|
|
15
|
+
<p>Free returns within 30 days.</p>
|
|
16
|
+
</rel-accordion>
|
|
17
|
+
|
|
18
|
+
<!-- Header scale: 56 / 48 / 44 px -->
|
|
19
|
+
<rel-accordion size="large" title="Large"></rel-accordion>
|
|
20
|
+
<rel-accordion size="medium" title="Medium"></rel-accordion>
|
|
21
|
+
<rel-accordion size="small" title="Small"></rel-accordion>
|
|
22
|
+
|
|
23
|
+
<!-- Plain style: square corners and a 1px border instead of the shadow card -->
|
|
24
|
+
<rel-accordion appearance="plain" title="Plain"></rel-accordion>
|
|
25
|
+
|
|
26
|
+
<!-- Action type: leading rotating chevron + static trailing arrow-expansion, body indented -->
|
|
27
|
+
<rel-accordion type="action" title="Filters">
|
|
28
|
+
<p>Filter options…</p>
|
|
29
|
+
</rel-accordion>
|
|
30
|
+
|
|
31
|
+
<!-- Action type with a custom leading icon (slotted icons never rotate) -->
|
|
32
|
+
<rel-accordion type="action" title="Preferences">
|
|
33
|
+
<rel-icon slot="icon" name="settings"></rel-icon>
|
|
34
|
+
<p>Preference options…</p>
|
|
35
|
+
</rel-accordion>
|
|
36
|
+
|
|
37
|
+
<!-- Custom trailing icon on the default type -->
|
|
38
|
+
<rel-accordion title="More">
|
|
39
|
+
<rel-icon slot="trailing-icon" name="plus"></rel-icon>
|
|
40
|
+
<p>Extra content…</p>
|
|
41
|
+
</rel-accordion>
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
```js
|
|
45
|
+
const accordion = document.querySelector("rel-accordion");
|
|
46
|
+
|
|
47
|
+
accordion.addEventListener("open-change", (e) => {
|
|
48
|
+
e.detail; // true when the body was just expanded, false when collapsed
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
// Programmatic toggle (does not fire open-change)
|
|
52
|
+
accordion.open = true;
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### Deprecated aliases
|
|
56
|
+
|
|
57
|
+
```html
|
|
58
|
+
<!-- size="md" → size="large", size="sm" → size="medium". Both still work; no console notice is logged. -->
|
|
59
|
+
<rel-accordion size="md" title="Legacy large"></rel-accordion>
|
|
60
|
+
<rel-accordion size="sm" title="Legacy medium"></rel-accordion>
|
|
61
|
+
<!-- canonical -->
|
|
62
|
+
<rel-accordion size="large" title="Large"></rel-accordion>
|
|
63
|
+
<rel-accordion size="medium" title="Medium"></rel-accordion>
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
<!-- readme-gen:start -->
|
|
67
|
+
|
|
68
|
+
<!-- Generated from rel-accordion.ts — do not edit; run readme-generate.mjs -->
|
|
69
|
+
|
|
70
|
+
## API
|
|
71
|
+
|
|
72
|
+
### Attributes / Properties
|
|
73
|
+
|
|
74
|
+
| Property | Attribute | Type | Default | Description |
|
|
75
|
+
| --- | --- | --- | --- | --- |
|
|
76
|
+
| `title` | `title` | `string` | `"Accordion"` | Header text. Note it is also the native HTML `title` attribute, so browsers show it as a tooltip on hover. |
|
|
77
|
+
| `open` | `open` | `boolean` | `false` | Whether the body is expanded; toggled by the header and reported via `open-change`. Setting it from code does not fire the event. Reflected. |
|
|
78
|
+
| `size` | `size` | `"md" \| "sm" \| "large" \| "medium" \| "small"` | `"md"` | Header scale (Figma "Size"): `large` = 56px header / heading-md title, `medium` = 48px / heading-sm, `small` = 44px / heading-xs (new in 1.4.7). The historical spellings stay supported as aliases: `md` = large (the default), `sm` = medium. Reflected. |
|
|
79
|
+
| `type` | `type` | `"default" \| "action"` | `"default"` | Header layout (Figma "Type"): `default` = title + trailing rotating chevron; `action` = leading icon slot (rotating chevron by default) + static trailing arrow-expansion icon, with the body indented under the title. DELIBERATE DIVERGENCE — do not "fix" this to a button. For `Type=Action` Figma draws the trailing affordance as a full ghost icon Button instance (Size=Medium 40x40, Size=Small 32x32, Style=Ghost, Type=Icon Only); the code keeps a bare icon. Ruled by the user: our behaviour stands and the DESIGN FILE follows our docs here, not the other way round. The whole header is the click target, so a nested button would add a second focusable control inside it and two competing hit areas. Reflected. |
|
|
80
|
+
| `appearance` | `appearance` | `"shadow" \| "plain"` | `"shadow"` | Figma "Style" axis — named appearance because `style` collides with the HTML style attribute. `shadow` = 4px-radius card with the shadow-sm effect and no border; `plain` = square corners with a 1px border-subtle stroke and no elevation. Reflected. |
|
|
81
|
+
| `disabled` | `disabled` | `boolean` | `false` | Figma "State=Disabled": dims the whole component to 40% and blocks toggling by pointer and keyboard. The header keeps its fill and stroke — the dulling is opacity alone, as Figma specifies. Reflected. |
|
|
82
|
+
|
|
83
|
+
## Events
|
|
84
|
+
|
|
85
|
+
| Event | Detail | Bubbles / composed | Description |
|
|
86
|
+
| --- | --- | --- | --- |
|
|
87
|
+
| `open-change` | `open` | bubbles / composed | Fired when the header toggles the accordion (click, Enter or Space). Detail: the new `open` state (boolean). Not fired when `open` is set programmatically. |
|
|
88
|
+
|
|
89
|
+
## Slots
|
|
90
|
+
|
|
91
|
+
| Slot | Description |
|
|
92
|
+
| --- | --- |
|
|
93
|
+
| (default) | Body content, revealed when `open` |
|
|
94
|
+
| `icon` | Leading icon in the header (`type="action"` only); replaces the default rotating chevron-down |
|
|
95
|
+
| `trailing-icon` | Trailing icon in the header; replaces the default chevron-down (default type) or arrow-expansion (action type) |
|
|
96
|
+
|
|
97
|
+
## CSS Parts
|
|
98
|
+
|
|
99
|
+
| Part | Description |
|
|
100
|
+
| --- | --- |
|
|
101
|
+
| `base` | The outer card (`.accordion`) carrying the appearance border / shadow |
|
|
102
|
+
| `trigger` | The `role="button"` header row |
|
|
103
|
+
| `label` | The title row (leading icon + title text) |
|
|
104
|
+
| `icon` | The trailing icon wrapper |
|
|
105
|
+
| `content` | The `role="region"` body that holds the default slot |
|
|
106
|
+
|
|
107
|
+
<!-- readme-gen:end -->
|
|
108
|
+
|
|
109
|
+
## Accessibility
|
|
110
|
+
|
|
111
|
+
- The header (part `trigger`) is a `role="button"` with `tabindex="0"`, `aria-expanded` mirroring `open`, and `aria-controls` pointing at the body.
|
|
112
|
+
- The body (part `content`) is a `role="region"` labelled by the header (`aria-labelledby`). While closed it carries the `inert` attribute, so collapsed content is removed from the Tab order and from the accessibility tree — not merely hidden visually.
|
|
113
|
+
- The slotted `icon` / `trailing-icon` content and the built-in `rel-icon` chevrons are decorative; the accessible name of the header is the `title` text.
|
|
114
|
+
- Keyboard focus is shown as a 2px `--rel-border-focus` outline inset 2px inside the header (it follows the card radius so it is not clipped).
|
|
115
|
+
- No live-region announcements are made; the `aria-expanded` change is what screen readers report.
|
|
116
|
+
|
|
117
|
+
| Key (header focused) | Action |
|
|
118
|
+
| --- | --- |
|
|
119
|
+
| Enter | Toggle open / closed (fires `open-change`) |
|
|
120
|
+
| Space | Toggle open / closed (fires `open-change`) |
|
|
121
|
+
| Tab / Shift + Tab | Move to the next / previous focusable element; the body's content is only reachable while open |
|
|
122
|
+
|
|
123
|
+
## Notes / Edge Cases
|
|
124
|
+
|
|
125
|
+
- `size` defaults to the legacy spelling `"md"`, which renders the Figma Large (56px) header; `"sm"` renders Medium (48px). The full-word values are the canonical ones — see Deprecated aliases.
|
|
126
|
+
- `title` is also the element's native `title` attribute, so browsers show it as a hover tooltip on the whole component.
|
|
127
|
+
- `open-change` fires only from user toggles (click, Enter, Space). Setting `open` from code updates the UI silently.
|
|
128
|
+
- The body stays in the DOM when closed; it is collapsed with `max-height: 0` / `overflow: hidden` and `inert`. When open the cap is `max-height: 1000px`, so content taller than 1000px is clipped.
|
|
129
|
+
- Rotation on open applies only to the built-in fallback icons (`chevron-down` in the trailing slot for `type="default"`, in the leading slot for `type="action"`). Anything you slot into `icon` or `trailing-icon` stays static, and the Action type's trailing `arrow-expansion` never rotates (Figma audit 1b).
|
|
130
|
+
- `type="action"` indents the open body under the title: 56px at `large`, 48px at `medium` / `small`. The leading icon wrapper is 40px / 18px icon at `large` and 32px / 16px at the other sizes; the trailing icon wrapper follows the same tiers.
|
|
131
|
+
- Header hover / pressed use the `--rel-action-overlay-hover` / `--rel-action-overlay-pressed` tokens. `appearance="shadow"` uses `--rel-shadows-sm` with a transparent border; `appearance="plain"` uses `--rel-border-subtle` with no shadow and zero radius.
|
|
132
|
+
- Transitions (chevron rotation, body max-height and padding) are disabled under `prefers-reduced-motion: reduce`.
|
|
133
|
+
- The host is `display: block; width: 100%`; wrap it to constrain the width.
|
|
@@ -1,141 +1,145 @@
|
|
|
1
|
-
# rel-alert
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
```html
|
|
8
|
-
<!--
|
|
9
|
-
<rel-alert
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
<rel-alert
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
<!--
|
|
22
|
-
<rel-alert
|
|
23
|
-
|
|
24
|
-
message1="
|
|
25
|
-
message2="
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
<rel-alert
|
|
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
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
-
|
|
135
|
-
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
- `
|
|
140
|
-
- The
|
|
141
|
-
-
|
|
1
|
+
# rel-alert
|
|
2
|
+
|
|
3
|
+
`<rel-alert>` is the inline status banner of the Reliability Design System (Figma "Alert"). It renders a tone-coloured box with a leading status icon, a bold title (`message1`), optional supporting text (`message2`), an optional inline link and an optional dismiss button, in the Figma Tone (neutral / info / success / warning / destructive) and Style (subtle / solid / outline) variants. Use it for persistent, in-flow messages about a page or section — form-level validation, degraded-service notices, onboarding hints. For transient feedback that disappears on its own use `<rel-toast>` or `<rel-snackbar>`; for blocking decisions use `<rel-modal>`.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
```html
|
|
8
|
+
<!-- Neutral (default tone, subtle appearance) -->
|
|
9
|
+
<rel-alert message1="Scheduled maintenance on Sunday 02:00–04:00 UTC"></rel-alert>
|
|
10
|
+
|
|
11
|
+
<!-- Tones -->
|
|
12
|
+
<rel-alert tone="info" message1="Update available" message2="Version 2.3 adds offline mode."></rel-alert>
|
|
13
|
+
<rel-alert tone="success" message1="Changes saved" message2="Your profile is up to date."></rel-alert>
|
|
14
|
+
<rel-alert tone="warning" message1="Storage almost full" message2="You have used 95% of your quota."></rel-alert>
|
|
15
|
+
<rel-alert tone="destructive" message1="Upload failed" message2="The file exceeds the 25 MB limit."></rel-alert>
|
|
16
|
+
|
|
17
|
+
<!-- Appearance: subtle (default) | solid | outline -->
|
|
18
|
+
<rel-alert tone="info" appearance="solid" message1="Solid alert"></rel-alert>
|
|
19
|
+
<rel-alert tone="info" appearance="outline" message1="Outline alert"></rel-alert>
|
|
20
|
+
|
|
21
|
+
<!-- Inline link: both url-text and url-href are required for it to render -->
|
|
22
|
+
<rel-alert
|
|
23
|
+
tone="info"
|
|
24
|
+
message1="Release notes"
|
|
25
|
+
message2="See what changed in this version."
|
|
26
|
+
url-text="Read more"
|
|
27
|
+
url-href="https://example.com/release-notes"
|
|
28
|
+
></rel-alert>
|
|
29
|
+
|
|
30
|
+
<!-- Non-dismissible: the boolean must be cleared from script (see the js block) -->
|
|
31
|
+
<rel-alert id="locked" tone="warning" message1="Action required"></rel-alert>
|
|
32
|
+
|
|
33
|
+
<!-- Listen for dismissal -->
|
|
34
|
+
<rel-alert id="saved" tone="success" message1="Saved"></rel-alert>
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
```js
|
|
38
|
+
// A Lit boolean attribute is true whenever present, so dismissible="false" does NOT work.
|
|
39
|
+
document.getElementById("locked").dismissible = false;
|
|
40
|
+
|
|
41
|
+
const saved = document.getElementById("saved");
|
|
42
|
+
saved.addEventListener("dismiss", () => {
|
|
43
|
+
saved.dismissed; // true — the host is now display: none
|
|
44
|
+
});
|
|
45
|
+
// Show it again later:
|
|
46
|
+
saved.dismissed = false;
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Deprecated aliases
|
|
50
|
+
|
|
51
|
+
```html
|
|
52
|
+
<!-- type= is the deprecated alias of tone= (tone wins when both are set). Logs once per page:
|
|
53
|
+
[rel-alert] "type" is deprecated and will be removed in 3.0 — use "tone" instead. Note: tone="destructive" replaces type="error". -->
|
|
54
|
+
<rel-alert type="error" message1="Upload failed"></rel-alert>
|
|
55
|
+
|
|
56
|
+
<!-- tone="error" | "danger" | "critical" are deprecated spellings of tone="destructive". Logs once per spelling:
|
|
57
|
+
[rel-alert] "tone="error"" is deprecated and will be removed in 3.0 — use "tone="destructive"" instead. -->
|
|
58
|
+
<rel-alert tone="error" message1="Upload failed"></rel-alert>
|
|
59
|
+
<rel-alert tone="critical" message1="Upload failed"></rel-alert>
|
|
60
|
+
|
|
61
|
+
<!-- appearance="filled" is the deprecated alias of appearance="solid" (no console notice). -->
|
|
62
|
+
<rel-alert tone="info" appearance="filled" message1="Solid alert"></rel-alert>
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
<!-- readme-gen:start -->
|
|
66
|
+
|
|
67
|
+
<!-- Generated from rel-alert.ts — do not edit; run readme-generate.mjs -->
|
|
68
|
+
|
|
69
|
+
## API
|
|
70
|
+
|
|
71
|
+
### Attributes / Properties
|
|
72
|
+
|
|
73
|
+
| Property | Attribute | Type | Default | Description |
|
|
74
|
+
| --- | --- | --- | --- | --- |
|
|
75
|
+
| `tone` | `tone` | `"neutral" \| "info" \| "success" \| "warning" \| "destructive" \| "error" \| "danger" \| "critical"` | `undefined` | Semantic tone (Figma "Tone"): `"neutral"` (default) \| `"info"` \| `"success"` \| `"warning"` \| `"destructive"`. Drives the fill/border colour, the title colour and the leading icon (info, check-circle, alert-circle, error). `"error"`, `"danger"` and `"critical"` are deprecated aliases of `"destructive"` and log a one-time console notice. Takes precedence over the deprecated `type` prop. |
|
|
76
|
+
| `appearance` | `appearance` | `"solid" \| "subtle" \| "outline" \| "filled"` | `"subtle"` | Visual treatment (Figma "Style"): `"subtle"` (default: tone-light fill, no border) \| `"solid"` (tone fill, inverse text, `--rel-shadows-md` elevation) \| `"outline"` (transparent fill, tone border). `"filled"` is a deprecated alias of `"solid"` (no console notice). Reflected. |
|
|
77
|
+
| `message1` | `message1` | `string` | `""` | Primary message (title), rendered in body-lg medium weight in the tone colour. |
|
|
78
|
+
| `message2` | `message2` | `string` | `undefined` | Optional secondary message rendered under the title in body-md at 90% opacity; omitted when unset. |
|
|
79
|
+
| `urlText` | `url-text` | `string` | `undefined` | Text of the inline link rendered under the messages. The link appears only when both `urlText` and `urlHref` are set. |
|
|
80
|
+
| `urlHref` | `url-href` | `string` | `undefined` | `href` of the inline link. The link appears only when both `urlText` and `urlHref` are set. |
|
|
81
|
+
| `dismissible` | `dismissible` | `boolean` | `true` | Shows the dismiss (✕) button. Defaults to true; because it is a Lit boolean, `dismissible="false"` is still true — set the property to `false` from script to hide the button. |
|
|
82
|
+
| `dismissed` | `dismissed` | `boolean` | `false` | True once the alert has been dismissed; hides the host via `:host([dismissed]) { display: none }`. Set it back to `false` to show the alert again. Reflected. |
|
|
83
|
+
|
|
84
|
+
#### Deprecated (still supported — removal targeted for 3.0)
|
|
85
|
+
|
|
86
|
+
| Property | Attribute | Type | Use instead |
|
|
87
|
+
| --- | --- | --- | --- |
|
|
88
|
+
| `type` | `type` | `"neutral" \| "info" \| "success" \| "warning" \| "destructive" \| "error" \| "danger" \| "critical"` | Deprecated since 1.4.7 — alias of `tone`; use `tone`. Same values as `tone`; `type="error"` maps to `tone="destructive"`. Ignored when `tone` is set. Logs a one-time console notice. |
|
|
89
|
+
|
|
90
|
+
### Public fields / accessors
|
|
91
|
+
|
|
92
|
+
| Name | Type | Description |
|
|
93
|
+
| --- | --- | --- |
|
|
94
|
+
| `resolvedTone` | `AlertTone` | Read-only canonical tone actually rendered: explicit `tone` wins, else `type`, else `"neutral"`; deprecated aliases are resolved to `"destructive"`. |
|
|
95
|
+
|
|
96
|
+
## Events
|
|
97
|
+
|
|
98
|
+
| Event | Detail | Bubbles / composed | Description |
|
|
99
|
+
| --- | --- | --- | --- |
|
|
100
|
+
| `dismiss` | — | bubbles / composed | Fired when the user clicks the dismiss button, after `dismissed` has been set to true. No detail. |
|
|
101
|
+
|
|
102
|
+
## Slots
|
|
103
|
+
|
|
104
|
+
| Slot | Description |
|
|
105
|
+
| --- | --- |
|
|
106
|
+
| — | This element has no slots. |
|
|
107
|
+
|
|
108
|
+
## CSS Parts
|
|
109
|
+
|
|
110
|
+
| Part | Description |
|
|
111
|
+
| --- | --- |
|
|
112
|
+
| `base` | The `role="alert"` container that carries the tone and appearance styling |
|
|
113
|
+
| `icon` | Wrapper around the leading status `<rel-icon>` |
|
|
114
|
+
| `content` | Column that stacks the title, helper text and link |
|
|
115
|
+
| `label` | The primary message (`message1`) paragraph |
|
|
116
|
+
| `helper` | The secondary message (`message2`) paragraph; rendered only when `message2` is set |
|
|
117
|
+
| `action` | The inline link; rendered only when both `url-text` and `url-href` are set |
|
|
118
|
+
| `close-button` | The dismiss (✕) button; rendered only while `dismissible` is true |
|
|
119
|
+
|
|
120
|
+
<!-- readme-gen:end -->
|
|
121
|
+
|
|
122
|
+
## Accessibility
|
|
123
|
+
|
|
124
|
+
- The container (part `base`) has `role="alert"` and `aria-atomic="true"`, so screen readers announce the whole message assertively when the element enters the DOM or its text changes. Because of that, reserve it for messages that warrant an interruption; render a `<rel-alert>` only when there is something to say rather than keeping an empty one mounted.
|
|
125
|
+
- The leading status `<rel-icon>` renders `aria-hidden="true"`; the tone is not conveyed to assistive technology except through the text, so put the meaning in `message1` / `message2`.
|
|
126
|
+
- The dismiss control is a native `<button>` with `aria-label="Dismiss"`. The inline link is a plain `<a href>`. Both are in the Tab order; the component adds no key handlers of its own:
|
|
127
|
+
|
|
128
|
+
| Key | Action |
|
|
129
|
+
| --- | --- |
|
|
130
|
+
| Tab / Shift + Tab | Move between the inline link (if any) and the dismiss button (if any) |
|
|
131
|
+
| Enter / Space | Activate the focused dismiss button (fires `dismiss`, sets `dismissed`) |
|
|
132
|
+
| Enter | Follow the focused link |
|
|
133
|
+
|
|
134
|
+
- Keyboard focus on the dismiss button is a 2px `currentColor` outline with 2px offset (`:focus-visible` only).
|
|
135
|
+
- Dismissing hides the host with `display: none`; focus is not moved, so if the dismiss button had focus the browser drops focus to `<body>`. Move focus yourself in the `dismiss` handler when the alert sits in the middle of a form.
|
|
136
|
+
|
|
137
|
+
## Notes / Edge Cases
|
|
138
|
+
|
|
139
|
+
- `tone` and `appearance` are independent axes; every tone renders in every appearance. Solid uses inverse text and carries the `--rel-shadows-md` elevation; subtle and outline have no shadow.
|
|
140
|
+
- The status icon is fixed per tone (`info` for neutral and info, `check-circle`, `alert-circle`, `error`) and cannot be replaced or removed — there are no slots.
|
|
141
|
+
- The alert has `min-width: 360px`; it stretches to its container (`display: block`) but never shrinks below that.
|
|
142
|
+
- The link renders only when both `url-text` and `url-href` are set; it opens in the same tab (no `target`).
|
|
143
|
+
- `dismissible` and `dismissed` are Lit booleans: any attribute value (including `"false"`) counts as true. Toggle them as properties from script.
|
|
144
|
+
- `dismissed` only hides the host; the element stays in the DOM and keeps its state. Resetting `dismissed = false` shows it again without re-firing `dismiss`.
|
|
145
|
+
- `resolvedTone` is the tone actually rendered after alias resolution; use it (not `tone` / `type`) if you branch on tone in script.
|