@reliability-design/web 1.4.6 → 1.4.7
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 +211 -49
- package/dist/components/rel-accordion/README.md +132 -132
- package/dist/components/rel-alert/README.md +145 -141
- package/dist/components/rel-autocomplete/README.md +156 -61
- package/dist/components/rel-avatar/README.md +116 -130
- package/dist/components/rel-badge/README.md +98 -93
- package/dist/components/rel-breadcrumb/README.md +96 -102
- package/dist/components/rel-button/README.md +160 -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 +184 -166
- package/dist/components/rel-checkbox/README.md +93 -75
- package/dist/components/rel-chip/README.md +132 -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 +78 -100
- package/dist/components/rel-drawer/README.md +187 -200
- package/dist/components/rel-kbd/README.md +141 -151
- package/dist/components/rel-menu/README.md +178 -151
- package/dist/components/rel-menubar/README.md +218 -329
- package/dist/components/rel-otp/README.md +170 -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 +162 -0
- package/dist/components/rel-resizable/README.md +199 -140
- package/dist/components/rel-segmented-button/README.md +155 -141
- package/dist/components/rel-select/README.md +154 -93
- package/dist/components/rel-sheet/README.md +168 -224
- package/dist/components/rel-skeleton/README.md +103 -0
- package/dist/components/rel-slider/README.md +130 -135
- package/dist/components/rel-snackbar/README.md +162 -134
- package/dist/components/rel-stepper/README.md +158 -160
- package/dist/components/rel-switch/README.md +108 -102
- package/dist/components/rel-tab/README.md +171 -163
- package/dist/components/rel-textfield/README.md +159 -69
- package/dist/components/rel-time-picker/README.md +122 -157
- package/dist/components/rel-toast/README.md +157 -148
- package/dist/components/rel-tooltip/README.md +108 -111
- package/dist/components/rel-upload/README.md +220 -0
- package/dist/index.d.mts +1147 -340
- package/dist/index.d.ts +1147 -340
- package/dist/index.js +3451 -3163
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3416 -3118
- package/dist/index.mjs.map +1 -1
- package/dist/styles/vars.css +877 -866
- package/dist/{vars-XNMTSRVN.css → vars-JHTUGNRG.css} +877 -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,100 +1,78 @@
|
|
|
1
|
-
# rel-divider
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
```html
|
|
8
|
-
<!-- Horizontal
|
|
9
|
-
<
|
|
10
|
-
<
|
|
11
|
-
<p>
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
<
|
|
15
|
-
<
|
|
16
|
-
<
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
<
|
|
24
|
-
<
|
|
25
|
-
<rel-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
|
47
|
-
|
|
48
|
-
| `orientation` | `"horizontal" \| "vertical"` | `"horizontal"` |
|
|
49
|
-
|
|
50
|
-
## Events
|
|
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
|
-
- None (non-interactive element)
|
|
80
|
-
|
|
81
|
-
### Focus Behavior
|
|
82
|
-
- Does not receive focus
|
|
83
|
-
|
|
84
|
-
## Notes / Edge Cases
|
|
85
|
-
- **Horizontal orientation**:
|
|
86
|
-
- `width: 100%`
|
|
87
|
-
- `height: var(--rel-stroke-sm)`
|
|
88
|
-
- `margin: var(--rel-spacing-md) 0` (vertical margin)
|
|
89
|
-
|
|
90
|
-
- **Vertical orientation**:
|
|
91
|
-
- `width: var(--rel-stroke-sm)`
|
|
92
|
-
- `height: 100%`
|
|
93
|
-
- `margin: 0 var(--rel-spacing-md)` (horizontal margin)
|
|
94
|
-
- Uses `align-self: stretch` to fill parent height
|
|
95
|
-
|
|
96
|
-
- The divider is purely visual and has `background: transparent` on the host element
|
|
97
|
-
- The actual divider line is rendered by an internal `.rel-divider` div
|
|
98
|
-
- For vertical dividers to work properly, the parent must have a defined height
|
|
99
|
-
- Vertical dividers use `align-self: stretch` to match the parent's height
|
|
100
|
-
- The divider is `display: block` on the host element
|
|
1
|
+
# rel-divider
|
|
2
|
+
|
|
3
|
+
A thin separator rule, horizontal or vertical, drawn with the neutral elevated background token at the small stroke width and padded by the medium spacing token. Use it to visually split sections, list groups or toolbar clusters. Do not use it purely as a spacer — use layout gaps for that.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
```html
|
|
8
|
+
<!-- Horizontal (default): full width, vertical margin -->
|
|
9
|
+
<section>
|
|
10
|
+
<h2>Section A</h2>
|
|
11
|
+
<p>Content A</p>
|
|
12
|
+
</section>
|
|
13
|
+
<rel-divider></rel-divider>
|
|
14
|
+
<section>
|
|
15
|
+
<h2>Section B</h2>
|
|
16
|
+
<p>Content B</p>
|
|
17
|
+
</section>
|
|
18
|
+
|
|
19
|
+
<!-- Vertical: give the parent a height or use a flex row -->
|
|
20
|
+
<div style="display: flex; align-items: center; height: 40px;">
|
|
21
|
+
<rel-button variant="ghost">Cut</rel-button>
|
|
22
|
+
<rel-divider orientation="vertical"></rel-divider>
|
|
23
|
+
<rel-button variant="ghost">Copy</rel-button>
|
|
24
|
+
<rel-divider orientation="vertical"></rel-divider>
|
|
25
|
+
<rel-button variant="ghost">Paste</rel-button>
|
|
26
|
+
</div>
|
|
27
|
+
|
|
28
|
+
<!-- Restyle through the part -->
|
|
29
|
+
<style>
|
|
30
|
+
.thick::part(base) {
|
|
31
|
+
height: 2px;
|
|
32
|
+
margin: 24px 0;
|
|
33
|
+
}
|
|
34
|
+
</style>
|
|
35
|
+
<rel-divider class="thick"></rel-divider>
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
<!-- readme-gen:start -->
|
|
39
|
+
|
|
40
|
+
<!-- Generated from rel-divider.ts — do not edit; run readme-generate.mjs -->
|
|
41
|
+
|
|
42
|
+
## API
|
|
43
|
+
|
|
44
|
+
### Attributes / Properties
|
|
45
|
+
|
|
46
|
+
| Property | Attribute | Type | Default | Description |
|
|
47
|
+
| --- | --- | --- | --- | --- |
|
|
48
|
+
| `orientation` | `orientation` | `"horizontal" \| "vertical"` | `"horizontal"` | Axis of the rule: `horizontal` spans the full width with vertical margin; `vertical` is a full-height line with horizontal margin (the parent needs a defined height or a flex row). Mirrored to `aria-orientation` on the host. |
|
|
49
|
+
|
|
50
|
+
## Events
|
|
51
|
+
|
|
52
|
+
| Event | Detail | Bubbles / composed | Description |
|
|
53
|
+
| --- | --- | --- | --- |
|
|
54
|
+
| — | — | — | This element emits no custom events. |
|
|
55
|
+
|
|
56
|
+
## Slots
|
|
57
|
+
|
|
58
|
+
| Slot | Description |
|
|
59
|
+
| --- | --- |
|
|
60
|
+
| — | This element has no slots. |
|
|
61
|
+
|
|
62
|
+
## CSS Parts
|
|
63
|
+
|
|
64
|
+
| Part | Description |
|
|
65
|
+
| --- | --- |
|
|
66
|
+
| `base` | The rendered rule (`role="separator"` div) — restyle thickness, colour or margin here. |
|
|
67
|
+
|
|
68
|
+
<!-- readme-gen:end -->
|
|
69
|
+
|
|
70
|
+
## Accessibility
|
|
71
|
+
|
|
72
|
+
- The host receives `role="separator"` when connected and `aria-orientation` (`horizontal` or `vertical`) on every update, so screen readers announce it as a separator in the right axis. The inner rule also carries `role="separator"`.
|
|
73
|
+
- Not focusable; no keyboard interaction.
|
|
74
|
+
|
|
75
|
+
## Notes / Edge Cases
|
|
76
|
+
|
|
77
|
+
- **Vertical dividers need a height.** The vertical rule is `height: 100%` with `align-self: stretch`; inside a flex row it stretches to the row, otherwise the parent must have a definite height or the rule collapses to 0px.
|
|
78
|
+
- The host is `display: block` with a transparent background; the visible line is the inner `base` part. Override thickness, colour or margin via `::part(base)` rather than on the host.
|
|
@@ -1,200 +1,187 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
##
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
-
|
|
10
|
-
|
|
11
|
-
-
|
|
12
|
-
|
|
13
|
-
-
|
|
14
|
-
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
</rel-drawer>
|
|
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
|
-
|
|
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
|
-
### Vue
|
|
190
|
-
|
|
191
|
-
```vue
|
|
192
|
-
<rel-drawer
|
|
193
|
-
:open="isOpen"
|
|
194
|
-
@rel-close="isOpen = false"
|
|
195
|
-
side="bottom"
|
|
196
|
-
>
|
|
197
|
-
<template #title>Options</template>
|
|
198
|
-
<OptionsPanel />
|
|
199
|
-
</rel-drawer>
|
|
200
|
-
```
|
|
1
|
+
# rel-drawer
|
|
2
|
+
|
|
3
|
+
`<rel-drawer>` implements the Figma **Drawer** component (5699:6844): a panel that slides in from the bottom, left or right edge over a scrim, with an optional drag-to-close handle on bottom drawers, a title/description header, a scrollable body and a footer. The folder also registers `<rel-drawer-footer>`, the right-aligned actions row the drawer uses for its `footer` slot, which can be reused standalone. Use a drawer for side navigation, filter panels and secondary editing flows that should stay attached to a viewport edge; use `<rel-modal>` for confirmations and short dialogs, and `<rel-popover>` for small contextual content anchored to a trigger.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
```html
|
|
8
|
+
<!-- Bottom drawer (default) with header, body and footer actions -->
|
|
9
|
+
<rel-button id="open-filters">Filters</rel-button>
|
|
10
|
+
|
|
11
|
+
<rel-drawer id="filters" title="Filters" description="Narrow down the results.">
|
|
12
|
+
<p>Filter controls go here.</p>
|
|
13
|
+
<rel-button slot="footer" variant="secondary" id="reset">Reset</rel-button>
|
|
14
|
+
<rel-button slot="footer" variant="primary" id="apply">Apply</rel-button>
|
|
15
|
+
</rel-drawer>
|
|
16
|
+
|
|
17
|
+
<script>
|
|
18
|
+
const drawer = document.getElementById('filters');
|
|
19
|
+
document.getElementById('open-filters').addEventListener('click', () => { drawer.open = true; });
|
|
20
|
+
document.getElementById('apply').addEventListener('click', () => { drawer.open = false; });
|
|
21
|
+
drawer.addEventListener('rel-open-change', (e) => {
|
|
22
|
+
console.log('open =', e.detail.open);
|
|
23
|
+
});
|
|
24
|
+
</script>
|
|
25
|
+
|
|
26
|
+
<!-- Right side panel with an explicit width -->
|
|
27
|
+
<rel-drawer side="right" width="360px" title="Settings">
|
|
28
|
+
<p>Account settings.</p>
|
|
29
|
+
</rel-drawer>
|
|
30
|
+
|
|
31
|
+
<!-- Left navigation drawer -->
|
|
32
|
+
<rel-drawer side="left" title="Menu">
|
|
33
|
+
<nav>
|
|
34
|
+
<a href="/home">Home</a>
|
|
35
|
+
<a href="/reports">Reports</a>
|
|
36
|
+
</nav>
|
|
37
|
+
</rel-drawer>
|
|
38
|
+
|
|
39
|
+
<!-- Bottom drawer that closes after a longer drag -->
|
|
40
|
+
<rel-drawer snap-threshold="0.5" title="Share">
|
|
41
|
+
<p>Drag the handle down past half the panel to close.</p>
|
|
42
|
+
</rel-drawer>
|
|
43
|
+
|
|
44
|
+
<!-- Non-modal, persistent side panel (no scrim, no focus trap, not dismissible) -->
|
|
45
|
+
<rel-drawer id="sidebar" side="left" open>
|
|
46
|
+
<p>Always-on sidebar content.</p>
|
|
47
|
+
</rel-drawer>
|
|
48
|
+
<script>
|
|
49
|
+
// Boolean props that default to true can only be switched off from JS —
|
|
50
|
+
// an absent attribute leaves the default in place.
|
|
51
|
+
const sidebar = document.getElementById('sidebar');
|
|
52
|
+
sidebar.modal = false;
|
|
53
|
+
sidebar.dismissible = false;
|
|
54
|
+
</script>
|
|
55
|
+
|
|
56
|
+
<!-- Standalone actions row using the same layout as the drawer footer -->
|
|
57
|
+
<rel-drawer-footer>
|
|
58
|
+
<rel-button variant="secondary">Cancel</rel-button>
|
|
59
|
+
<rel-button variant="primary">Save</rel-button>
|
|
60
|
+
</rel-drawer-footer>
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
<!-- readme-gen:start -->
|
|
64
|
+
|
|
65
|
+
<!-- Generated from rel-drawer.ts, rel-drawer-footer.ts — do not edit; run readme-generate.mjs -->
|
|
66
|
+
|
|
67
|
+
## Elements
|
|
68
|
+
|
|
69
|
+
| Element | Class | Source |
|
|
70
|
+
| --- | --- | --- |
|
|
71
|
+
| `<rel-drawer>` | `RelDrawer` | `rel-drawer.ts` |
|
|
72
|
+
| `<rel-drawer-footer>` | `RelDrawerFooter` | `rel-drawer-footer.ts` |
|
|
73
|
+
|
|
74
|
+
## API
|
|
75
|
+
|
|
76
|
+
### `<rel-drawer>`
|
|
77
|
+
|
|
78
|
+
#### Attributes / Properties
|
|
79
|
+
|
|
80
|
+
| Property | Attribute | Type | Default | Description |
|
|
81
|
+
| --- | --- | --- | --- | --- |
|
|
82
|
+
| `open` | `open` | `boolean` | `false` | Whether the drawer is shown. Toggle it to open/close; every change fires `rel-open-change`. Reflected. |
|
|
83
|
+
| `side` | `side` | `"bottom" \| "left" \| "right"` | `"bottom"` | Edge the panel slides in from. `bottom` is centred horizontally and supports the drag handle; `left`/`right` are full-height side panels. |
|
|
84
|
+
| `dismissible` | `dismissible` | `boolean` | `true` | When false the close button is hidden and backdrop clicks / Escape are ignored (drag-to-close still works). |
|
|
85
|
+
| `modal` | `modal` | `boolean` | `true` | Modal mode: renders the scrim, sets `role="dialog"` + `aria-modal`, traps Tab inside the panel and moves focus in on open. When false the panel is a `region` with no scrim and no focus trap. |
|
|
86
|
+
| `closeOnBackdrop` | `close-on-backdrop` | `boolean` | `true` | Close when the scrim is clicked. Only effective while `dismissible` is true. |
|
|
87
|
+
| `closeOnEscape` | `close-on-escape` | `boolean` | `true` | Close on the Escape key. Only effective while `dismissible` is true. |
|
|
88
|
+
| `showHandle` | `show-handle` | `boolean` | `true` | Show the grab bar above the header. Only rendered when `side="bottom"` and `draggable` is true. |
|
|
89
|
+
| `draggable` | `draggable` | `boolean` | `true` | Enable drag-to-close on the handle (pointer or touch). Bottom drawers only. |
|
|
90
|
+
| `snapThreshold` | `snap-threshold` | `number` | `0.25` | Fraction (0–1) of the panel height the user must drag down before release closes the drawer; shorter drags snap back. |
|
|
91
|
+
| `maxHeight` | `max-height` | `string` | `"80vh"` | Written to the panel as the `--drawer-max-height` custom property (any CSS length). No built-in rule reads it yet; use `--rel-drawer-height` to size a bottom drawer. |
|
|
92
|
+
| `width` | `width` | `string` | `""` | Explicit panel width (any CSS length). Empty by default, which uses the per-side `--rel-drawer-width` default. |
|
|
93
|
+
| `title` | `title` | `string` | `""` | Heading text (rendered as an `<h2>`, linked via `aria-labelledby`). |
|
|
94
|
+
| `description` | `description` | `string` | `""` | Supporting text under the title (linked via `aria-describedby`). |
|
|
95
|
+
|
|
96
|
+
### Events
|
|
97
|
+
|
|
98
|
+
| Event | Detail | Bubbles / composed | Description |
|
|
99
|
+
| --- | --- | --- | --- |
|
|
100
|
+
| `rel-open-change` | `{ open: true } / { open: false }` | bubbles / composed | Fired whenever `open` changes, from any cause (prop set, close button, backdrop, Escape, drag). Detail: `{ open: boolean }`. |
|
|
101
|
+
|
|
102
|
+
### Slots
|
|
103
|
+
|
|
104
|
+
| Slot | Description |
|
|
105
|
+
| --- | --- |
|
|
106
|
+
| (default) | Body content of the drawer |
|
|
107
|
+
| `footer` | Actions row; rendered inside a `<rel-drawer-footer>` (right-aligned, 8px gap) |
|
|
108
|
+
|
|
109
|
+
### CSS Parts
|
|
110
|
+
|
|
111
|
+
| Part | Description |
|
|
112
|
+
| --- | --- |
|
|
113
|
+
| `overlay` | The full-viewport scrim behind the panel |
|
|
114
|
+
| `panel` | The sliding panel (role="dialog") |
|
|
115
|
+
| `handle` | The drag-to-close grab bar (bottom drawers only) |
|
|
116
|
+
| `header` | Header block holding title, description and close button |
|
|
117
|
+
| `close-button` | The "X" close button |
|
|
118
|
+
| `content` | Scrollable body wrapper around the default slot |
|
|
119
|
+
| `footer` | Footer wrapper around the `footer` slot |
|
|
120
|
+
|
|
121
|
+
### Tokens / CSS Variables
|
|
122
|
+
|
|
123
|
+
#### Component hooks
|
|
124
|
+
|
|
125
|
+
Set these on the host (or an ancestor) to customise the element without touching design tokens.
|
|
126
|
+
|
|
127
|
+
| Custom property | Default | Description |
|
|
128
|
+
| --- | --- | --- |
|
|
129
|
+
| `--rel-drawer-height` | `var(--drawer-height, clamp(360px, 49vh, 600px))` | Panel height for `side="bottom"`; default `clamp(360px, 49vh, 600px)`. Left/right drawers are always full height |
|
|
130
|
+
| `--rel-drawer-scrim-opacity` | `1` | Opacity of the scrim while open; default `1` |
|
|
131
|
+
| `--rel-drawer-transition-duration` | `var(--drawer-transition-duration)` | Slide/scrim animation duration; default `0.3s` |
|
|
132
|
+
| `--rel-drawer-transition-timing` | `var(--drawer-transition-timing)` | Slide/scrim animation easing; default `cubic-bezier(0.32, 0.72, 0, 1)` |
|
|
133
|
+
| `--rel-drawer-width` | `var(--drawer-width, clamp(640px, 66vw, 952px))` | Panel width. Default `clamp(640px, 66vw, 952px)` for `side="bottom"`, `clamp(280px, 24vw, 420px)` for left/right. The `width` prop sets this on the panel and wins over a host value |
|
|
134
|
+
|
|
135
|
+
### `<rel-drawer-footer>`
|
|
136
|
+
|
|
137
|
+
#### Attributes / Properties
|
|
138
|
+
|
|
139
|
+
| Property | Attribute | Type | Default | Description |
|
|
140
|
+
| --- | --- | --- | --- | --- |
|
|
141
|
+
| — | — | — | — | No public properties. |
|
|
142
|
+
|
|
143
|
+
### Events
|
|
144
|
+
|
|
145
|
+
| Event | Detail | Bubbles / composed | Description |
|
|
146
|
+
| --- | --- | --- | --- |
|
|
147
|
+
| — | — | — | This element emits no custom events. |
|
|
148
|
+
|
|
149
|
+
### Slots
|
|
150
|
+
|
|
151
|
+
| Slot | Description |
|
|
152
|
+
| --- | --- |
|
|
153
|
+
| (default) | Footer actions (typically `<rel-button>`s) |
|
|
154
|
+
|
|
155
|
+
### CSS Parts
|
|
156
|
+
|
|
157
|
+
| Part | Description |
|
|
158
|
+
| --- | --- |
|
|
159
|
+
| — | None exposed. |
|
|
160
|
+
|
|
161
|
+
<!-- readme-gen:end -->
|
|
162
|
+
|
|
163
|
+
## Accessibility
|
|
164
|
+
|
|
165
|
+
- The panel is `role="dialog"` with `aria-modal="true"` while `modal` is on; with `modal` off it becomes a `role="region"` without scrim or focus trap.
|
|
166
|
+
- `aria-labelledby` points at the rendered `<h2>` when `title` is set, otherwise the panel carries `aria-label="Drawer"`; `aria-describedby` points at the description paragraph when `description` is set.
|
|
167
|
+
- The close button is a real `<button>` with `aria-label="Close"`. It is rendered whenever `dismissible` is on.
|
|
168
|
+
- Focus: on open in modal mode focus moves to the first focusable element inside the panel, or to the panel itself (`tabindex="-1"`). On close focus always returns to the element that was active before opening — resolved through shadow roots, so a `<rel-button>` opener gets focus back.
|
|
169
|
+
- Body scroll is locked while open; the scrollbar width is added as body padding so the page does not shift.
|
|
170
|
+
- The drag handle is pointer-only (`touch-action: none`); keyboard users close with `Escape` or the close button.
|
|
171
|
+
- `prefers-reduced-motion: reduce` removes the slide/fade transitions and hides the closed panel outright.
|
|
172
|
+
|
|
173
|
+
| Key | Action |
|
|
174
|
+
| --- | --- |
|
|
175
|
+
| `Escape` | Closes the drawer when `dismissible` and `close-on-escape` are on. |
|
|
176
|
+
| `Tab` / `Shift+Tab` | Cycles focus inside the panel while `modal` is on (focus trap); wraps at either end. |
|
|
177
|
+
|
|
178
|
+
## Notes / Edge Cases
|
|
179
|
+
|
|
180
|
+
- Drag-to-close only exists for `side="bottom"` and only when `draggable` is on; the handle is additionally hidden when `show-handle` is off. Dragging is one-directional (down); release past `snap-threshold` × panel height closes, shorter drags snap back. The scrim fades in proportion to the drag. Drag still closes the drawer when `dismissible` is off.
|
|
181
|
+
- `rel-open-change` is the only event; it fires for every `open` change including programmatic ones. The exported `DrawerCloseReason` type is used internally only — the event detail does not carry a reason.
|
|
182
|
+
- Boolean props default to `true` (`dismissible`, `modal`, `close-on-backdrop`, `close-on-escape`, `show-handle`, `draggable`); an absent attribute keeps the default, so switch them off from JavaScript (`drawer.modal = false`).
|
|
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
|
+
- `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
|
+
- 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 footer wrapper (padding + top border) is always rendered, even when the `footer` slot is empty.
|
|
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.
|