@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,166 +1,186 @@
|
|
|
1
|
-
# rel-carousel
|
|
2
|
-
|
|
3
|
-
A
|
|
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-carousel
|
|
30
|
-
<
|
|
31
|
-
<
|
|
32
|
-
<
|
|
33
|
-
</rel-carousel>
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
</
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
<rel-carousel
|
|
50
|
-
<div>
|
|
51
|
-
<div>
|
|
52
|
-
<div>
|
|
53
|
-
</
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
carousel
|
|
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
|
-
|
|
1
|
+
# rel-carousel
|
|
2
|
+
|
|
3
|
+
A slide carousel implementing the Figma "Carousel" component and its three axes — `Type` (Default, Only Indicators, Side Arrows, Bottom Arrows), `Orientation` (Horizontal, Vertical) and `Multi Panels` — plus the `Show Dots` property. It shows one or more slotted slides at a time in a horizontal or vertical viewport and moves between them with arrows, dot indicators, pointer drag / swipe, the keyboard, or autoplay. Use it for a small, ordered set of equally important panels (hero images, onboarding cards, testimonials); do not use it as a substitute for tabs or for content the user must read in full — hidden slides are not reachable by page search or by screen readers until they are shown.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
```html
|
|
8
|
+
<!-- Default type: slides only — swipe, drag or use the arrow keys -->
|
|
9
|
+
<rel-carousel label="Product photos">
|
|
10
|
+
<img src="/photos/front.jpg" alt="Front view">
|
|
11
|
+
<img src="/photos/side.jpg" alt="Side view">
|
|
12
|
+
<img src="/photos/back.jpg" alt="Back view">
|
|
13
|
+
</rel-carousel>
|
|
14
|
+
|
|
15
|
+
<!-- Figma Type axis: overlaid arrows + dots -->
|
|
16
|
+
<rel-carousel type="side-arrows" label="Highlights">
|
|
17
|
+
<div><h3>Fast setup</h3><p>Up and running in minutes.</p></div>
|
|
18
|
+
<div><h3>Secure by default</h3><p>Encrypted at rest and in transit.</p></div>
|
|
19
|
+
<div><h3>Works everywhere</h3><p>One component, every framework.</p></div>
|
|
20
|
+
</rel-carousel>
|
|
21
|
+
|
|
22
|
+
<!-- Dots flanked by arrows under the slide -->
|
|
23
|
+
<rel-carousel type="bottom-arrows" label="Testimonials">
|
|
24
|
+
<blockquote>"Saved us a week." — Ada</blockquote>
|
|
25
|
+
<blockquote>"Zero regressions." — Grace</blockquote>
|
|
26
|
+
</rel-carousel>
|
|
27
|
+
|
|
28
|
+
<!-- Dots only -->
|
|
29
|
+
<rel-carousel type="only-indicators" label="Tips">
|
|
30
|
+
<p>Tip 1</p>
|
|
31
|
+
<p>Tip 2</p>
|
|
32
|
+
<p>Tip 3</p>
|
|
33
|
+
</rel-carousel>
|
|
34
|
+
|
|
35
|
+
<!-- Arrows on their own: show-dots="false" suppresses the dots the type implies -->
|
|
36
|
+
<rel-carousel type="side-arrows" show-dots="false" label="Highlights">
|
|
37
|
+
<div>Fast setup</div>
|
|
38
|
+
<div>Secure by default</div>
|
|
39
|
+
</rel-carousel>
|
|
40
|
+
|
|
41
|
+
<!-- Loop and autoplay (3 s), 16px between slides, start on the second slide -->
|
|
42
|
+
<rel-carousel type="side-arrows" loop autoplay interval="3000" gap="16" value="1" label="Promotions">
|
|
43
|
+
<div>Spring sale</div>
|
|
44
|
+
<div>Free shipping</div>
|
|
45
|
+
<div>New arrivals</div>
|
|
46
|
+
</rel-carousel>
|
|
47
|
+
|
|
48
|
+
<!-- Figma Multi Panels: 1.5 panels leaves the next slide peeking in -->
|
|
49
|
+
<rel-carousel type="side-arrows" panels="1.5" label="Related products">
|
|
50
|
+
<div>Product A</div>
|
|
51
|
+
<div>Product B</div>
|
|
52
|
+
<div>Product C</div>
|
|
53
|
+
<div>Product D</div>
|
|
54
|
+
</rel-carousel>
|
|
55
|
+
|
|
56
|
+
<!-- Two whole panels at a time, no peek -->
|
|
57
|
+
<rel-carousel type="only-indicators" panels="2" label="Case studies">
|
|
58
|
+
<div>Case A</div>
|
|
59
|
+
<div>Case B</div>
|
|
60
|
+
<div>Case C</div>
|
|
61
|
+
<div>Case D</div>
|
|
62
|
+
</rel-carousel>
|
|
63
|
+
|
|
64
|
+
<!-- Vertical: the viewport height comes from --rel-carousel-height -->
|
|
65
|
+
<rel-carousel orientation="vertical" type="side-arrows" label="Timeline" style="--rel-carousel-height: 240px">
|
|
66
|
+
<div>2024</div>
|
|
67
|
+
<div>2025</div>
|
|
68
|
+
<div>2026</div>
|
|
69
|
+
</rel-carousel>
|
|
70
|
+
|
|
71
|
+
<!-- Programmatic control -->
|
|
72
|
+
<rel-carousel id="gallery" type="bottom-arrows" label="Gallery">
|
|
73
|
+
<div>A</div>
|
|
74
|
+
<div>B</div>
|
|
75
|
+
<div>C</div>
|
|
76
|
+
</rel-carousel>
|
|
77
|
+
<script>
|
|
78
|
+
const gallery = document.getElementById('gallery');
|
|
79
|
+
gallery.value = 2; // jump to the third slide
|
|
80
|
+
gallery.pauseOnHover = false; // default-true booleans are switched off via the property
|
|
81
|
+
gallery.addEventListener('rel-change', (e) => {
|
|
82
|
+
console.log('Current slide:', e.detail.value);
|
|
83
|
+
});
|
|
84
|
+
</script>
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
<!-- readme-gen:start -->
|
|
88
|
+
|
|
89
|
+
<!-- Generated from rel-carousel.ts — do not edit; run readme-generate.mjs -->
|
|
90
|
+
|
|
91
|
+
## API
|
|
92
|
+
|
|
93
|
+
### Attributes / Properties
|
|
94
|
+
|
|
95
|
+
| Property | Attribute | Type | Default | Description |
|
|
96
|
+
| --- | --- | --- | --- | --- |
|
|
97
|
+
| `value` | `value` | `number` | `0` | Index of the current slide (0-based). Set it to jump; it is clamped to the slide count and reflected as an attribute. Reflected. |
|
|
98
|
+
| `loop` | `loop` | `boolean` | `false` | Wrap from the last slide to the first (and back) with a seamless clone transition instead of stopping at the ends. |
|
|
99
|
+
| `autoplay` | `autoplay` | `boolean` | `false` | Advance automatically every `interval` ms; implies looping and pauses while hovered (see `pause-on-hover`) or while focus is inside the carousel. |
|
|
100
|
+
| `interval` | `interval` | `number` | `5000` | Autoplay delay between slides, in milliseconds (default 5000). |
|
|
101
|
+
| `pauseOnHover` | `pause-on-hover` | `boolean` | `true` | Pause autoplay while the pointer is over the carousel or while dragging (default true; switch off via the property, e.g. `el.pauseOnHover = false`). |
|
|
102
|
+
| `showButtons` | `show-buttons` | `boolean` | `false` | Legacy toggle for the overlaid previous / next arrows; ignored whenever `type` is set. |
|
|
103
|
+
| `showDots` | `show-dots` | `boolean` | `undefined` | Figma "Show Dots" property. Tri-state: left off it defers to `type` (dots for every type except `default`, and nothing at all when `type` is unset too); `show-dots` turns them on; `show-dots="false"` turns them off even when `type` would have shown them. |
|
|
104
|
+
| `type` | `type` | `"default" \| "only-indicators" \| "side-arrows" \| "bottom-arrows"` | `undefined` | Figma "Type" axis. When set it drives which controls render: default = content only · only-indicators = dots · side-arrows = overlaid arrows + dots · bottom-arrows = dots flanked by arrows below the slide. When unset, the legacy show-buttons boolean applies unchanged. The dots a type implies can always be overridden by an explicit `show-dots`. Reflected. |
|
|
105
|
+
| `orientation` | `orientation` | `"horizontal" \| "vertical"` | `"horizontal"` | Slide axis: `horizontal` (default) translates the track left / right; `vertical` stacks slides in a fixed-height viewport (`--rel-carousel-height`) and translates up / down. Reflected. |
|
|
106
|
+
| `label` | `label` | `string` | `"Carousel"` | Accessible name of the carousel region (`aria-label` on the viewport); default "Carousel". |
|
|
107
|
+
| `gap` | `gap` | `number` | `8` | Space between consecutive slides in pixels (applied as the track `gap` and added to each slide step); default 8 (Figma `spacing/xs`), 0 = slides touch. |
|
|
108
|
+
| `panels` | `panels` | `number` | `1` | Figma "Multi Panels" axis, as a count: how many slides are visible at once (default 1). Fractions are allowed and produce a peek of the next slide — `panels="1.5"` reproduces the Figma Multi Panels=True variant. Navigation still advances one slide at a time. |
|
|
109
|
+
| `disabled` | `disabled` | `boolean` | `false` | Disables arrows, dots, drag and keyboard navigation, stops autoplay and renders the carousel at 60% opacity. Reflected. |
|
|
110
|
+
|
|
111
|
+
## Events
|
|
112
|
+
|
|
113
|
+
| Event | Detail | Bubbles / composed | Description |
|
|
114
|
+
| --- | --- | --- | --- |
|
|
115
|
+
| `rel-change` | `{ value: this.value }` | bubbles / composed | Fired whenever the current slide changes (arrows, dots, drag, keyboard, autoplay or a loop wrap). Detail: `{ value: number }` — the new 0-based slide index. |
|
|
116
|
+
|
|
117
|
+
## Slots
|
|
118
|
+
|
|
119
|
+
| Slot | Description |
|
|
120
|
+
| --- | --- |
|
|
121
|
+
| (default) | The slides: one light-DOM element per slide (each is sized to one panel and given `role="group"` / `aria-roledescription="slide"`). |
|
|
122
|
+
|
|
123
|
+
## CSS Parts
|
|
124
|
+
|
|
125
|
+
| Part | Description |
|
|
126
|
+
| --- | --- |
|
|
127
|
+
| `${direction}-button` | The two arrow buttons, exposed as `prev-button` and `next-button` (`type="side-arrows"` overlays them on the viewport; `type="bottom-arrows"` inlines them in the dots row). |
|
|
128
|
+
| `viewport` | The focusable `role="region"` box that clips the track (also the keyboard target). |
|
|
129
|
+
| `track` | The flex row / column that translates to reveal the current slide. |
|
|
130
|
+
| `dots` | The indicator row under the viewport (also hosts the arrows for `type="bottom-arrows"`). |
|
|
131
|
+
| `dot-group` | The row of dots inside `dots` (for `type="bottom-arrows"` it is the middle child, between the two arrows). |
|
|
132
|
+
| `dot` | One indicator button per reachable position (per slide at `panels="1"`); the active one carries the `active` class and `aria-current="true"`. |
|
|
133
|
+
|
|
134
|
+
## Tokens / CSS Variables
|
|
135
|
+
|
|
136
|
+
### Component hooks
|
|
137
|
+
|
|
138
|
+
Set these on the host (or an ancestor) to customise the element without touching design tokens.
|
|
139
|
+
|
|
140
|
+
| Custom property | Default | Description |
|
|
141
|
+
| --- | --- | --- |
|
|
142
|
+
| `--rel-carousel-dot-size` | `8px` | Diameter of an inactive dot (default 8px). |
|
|
143
|
+
| `--rel-carousel-dot-size-active` | `16px` | Width of the active (brand-coloured, pill-shaped) dot (default 16px). |
|
|
144
|
+
| `--rel-carousel-height` | `320px` | Viewport height in `orientation="vertical"` (default 320px); the horizontal viewport takes the height of its tallest slide. |
|
|
145
|
+
| `--rel-carousel-nav-size` | `32px` | Width / height of the arrow buttons (default 32px, matching Figma; applies to both side and bottom arrows). |
|
|
146
|
+
| `--rel-carousel-slide-bg` | `var(--rel-bg-neutral)` | — |
|
|
147
|
+
| `--rel-carousel-slide-height` | `100%` | Written by the component on its own host to the computed panel height (used for vertical slides); not meant to be set by consumers. |
|
|
148
|
+
| `--rel-carousel-slide-radius` | `var(--rel-border-radius-sm)` | — |
|
|
149
|
+
| `--rel-carousel-slide-width` | `100%` | Written by the component on its own host to the computed panel width (viewport width for `panels="1"`, a fraction of it above that); not meant to be set by consumers (an inline value is overwritten on resize). |
|
|
150
|
+
|
|
151
|
+
<!-- readme-gen:end -->
|
|
152
|
+
|
|
153
|
+
## Accessibility
|
|
154
|
+
|
|
155
|
+
- The viewport renders with `role="region"`, `aria-roledescription="carousel"` and `aria-label` set from the `label` prop (default "Carousel"); give every carousel a meaningful `label`.
|
|
156
|
+
- Each slotted slide is decorated with `role="group"`, `aria-roledescription="slide"` and `aria-label="n of N"`; the clone slides used for looping are `aria-hidden="true"`.
|
|
157
|
+
- The arrow buttons are labelled "Previous slide" / "Next slide" and their chevrons are `aria-hidden`; each dot is labelled "Go to slide n" and the active dot carries `aria-current="true"`.
|
|
158
|
+
- The viewport is a single Tab stop (`tabindex="0"`); the arrows and dots that are rendered are ordinary buttons and follow it in the Tab order.
|
|
159
|
+
- Every user-initiated slide change is announced through the shared live region as "Slide n of N"; autoplay ticks are deliberately silent.
|
|
160
|
+
- Autoplay pauses while the pointer is over the carousel (`pause-on-hover`, default on) and while keyboard focus is anywhere inside it (WCAG 2.2.2 Pause, Stop, Hide); it resumes when focus leaves.
|
|
161
|
+
- Track transitions are disabled under `prefers-reduced-motion: reduce`; drag still snaps to the nearest slide, just without animation.
|
|
162
|
+
|
|
163
|
+
| Key | Action |
|
|
164
|
+
| --- | --- |
|
|
165
|
+
| `ArrowLeft` / `ArrowUp` | Previous slide (wraps when `loop` or `autoplay` is set) |
|
|
166
|
+
| `ArrowRight` / `ArrowDown` | Next slide (wraps when `loop` or `autoplay` is set) |
|
|
167
|
+
| `Home` | First slide |
|
|
168
|
+
| `End` | Last slide |
|
|
169
|
+
| `Tab` | Move between the viewport, the arrows and the dots |
|
|
170
|
+
|
|
171
|
+
Keys are handled on the viewport (and anything focused inside it) and are ignored while `disabled`.
|
|
172
|
+
|
|
173
|
+
## Notes / Edge Cases
|
|
174
|
+
|
|
175
|
+
- `type` is the canonical control switch. When it is unset the legacy `show-buttons` boolean still decides whether arrows render; when it is set `show-buttons` is ignored (`type="default"` hides the arrows).
|
|
176
|
+
- `show-dots` is deliberately tri-state, because Figma's `Show Dots` is a property rather than part of the `Type` axis. Omit it and `type` decides, exactly as before; write `show-dots` to force the dots on; write `show-dots="false"` to force them off even for a `type` that would have shown them. Omitting it is what every pre-existing carousel does, so none of them change.
|
|
177
|
+
- `panels` implements the Figma `Multi Panels` axis. Each panel measures `(viewport − gap × (ceil(panels) − 1)) / panels` along the scroll axis — a viewport showing `n` panels contains `ceil(n) − 1` whole gaps, so at the Figma frame width of 350px with the default 8px gap, `panels="1.5"` yields exactly the 228px slide the design specifies.
|
|
178
|
+
- Navigation always advances one slide per step, never one page. Without `loop`, the track stops once the last slide is flush with the trailing edge instead of scrolling into empty space, so at `panels="1.5"` with three slides the reachable indices are `0` and `1`. The dot row follows that: one dot per reachable position, which is one per slide at `panels="1"` and whenever `loop` is on.
|
|
179
|
+
- Slides are sized by the component: every slotted element gets `width: var(--rel-carousel-slide-width)` (or the height equivalent in `orientation="vertical"`) with `!important`, where the variable is written on the host to the computed panel size. Style the inside of a slide freely, but do not rely on a slide's own `width` / `height`.
|
|
180
|
+
- `loop` and `autoplay` clone the edge slides into the shadow DOM so the wrap looks continuous — `ceil(panels)` of them at each end, since a viewport showing more than one panel would otherwise run out of slides mid-transition. `rel-change` still reports the real index (`0` … `N-1`) after the silent jump.
|
|
181
|
+
- Drag / swipe uses a 20% threshold of the panel size; shorter drags snap back. Dragging pauses autoplay (when `pause-on-hover` is on) and resumes it on release.
|
|
182
|
+
- `value` is clamped to the highest reachable index whenever the slot content changes; setting it out of range moves to the nearest valid slide.
|
|
183
|
+
- Arrows are 32px circles with a 16px chevron, matching Figma. Side arrows (`type="side-arrows"`) overlay the viewport at the vertical centre, inset 8px from the edge; bottom arrows (`type="bottom-arrows"`) sit inside the indicator row, 20px from the dots. Both are hand-rolled ghost-style buttons, not `<rel-button>`, and both are sized by `--rel-carousel-nav-size`. Per the published Figma set the arrows stay on the left and right edges in `orientation="vertical"` too.
|
|
184
|
+
- The active dot is a 16 × 8 fully-rounded brand pill and an inactive dot an 8px circle; `--rel-carousel-dot-size-active` and `--rel-carousel-dot-size` override them.
|
|
185
|
+
- The horizontal viewport takes the height of its tallest slide; the vertical viewport is a fixed `--rel-carousel-height` (320px) — set it to fit your content.
|
|
186
|
+
- Arrow buttons are exposed as `::part(prev-button)` and `::part(next-button)`; the indicator row is `::part(dots)`, the dots inside it `::part(dot-group)` and `::part(dot)`.
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
# rel-checkbox
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
A tri-state checkbox component supporting checked, unchecked, and indeterminate states. Includes label, optional supporting text, and optional label prefix icon, with built-in error and disabled states. Supports two sizes, two densities, and leading/trailing box alignment — matching the Figma Checkbox sheet vocabulary (Size, Density, Alignment) verbatim.
|
|
3
|
+
A tri-state checkbox implementing the Figma "Checkbox" sheet: a hidden native `<input type="checkbox">` behind a custom box, with a label, an optional label-prefix icon and optional supporting text. It exposes the sheet's vocabulary verbatim — `size` (small / medium / large / extra-large), `density` (compact / comfortable) and `alignment` (leading / trailing) — plus `state` for error and disabled styling. Use it for independent yes/no choices and for "select all" parents (via `status="indeterminate"`); for a single choice among several options use `rel-radio`, and for an immediate on/off setting use `rel-switch`.
|
|
5
4
|
|
|
6
5
|
## Usage
|
|
6
|
+
|
|
7
7
|
```html
|
|
8
|
-
<!-- Basic
|
|
8
|
+
<!-- Basic -->
|
|
9
9
|
<rel-checkbox label="Accept terms"></rel-checkbox>
|
|
10
10
|
|
|
11
11
|
<!-- Supporting text, compact density (default: text on its own line, indented past the box) -->
|
|
@@ -31,95 +31,116 @@ A tri-state checkbox component supporting checked, unchecked, and indeterminate
|
|
|
31
31
|
supportingtext="Weekly summary of load activity">
|
|
32
32
|
</rel-checkbox>
|
|
33
33
|
|
|
34
|
-
<!--
|
|
34
|
+
<!-- Sizes (medium is the default) -->
|
|
35
35
|
<rel-checkbox size="small" label="Include archived"></rel-checkbox>
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
<rel-checkbox size="large" label="I agree to the terms"></rel-checkbox>
|
|
37
|
+
|
|
38
|
+
<!-- Label prefix icon -->
|
|
39
|
+
<rel-checkbox icon="truck" label="Truckload only"></rel-checkbox>
|
|
40
|
+
|
|
41
|
+
<!-- Error and disabled states -->
|
|
42
|
+
<rel-checkbox state="error" label="Required consent"></rel-checkbox>
|
|
43
|
+
<rel-checkbox state="disabled" status="checked" label="Locked by admin"></rel-checkbox>
|
|
44
|
+
|
|
45
|
+
<!-- Indeterminate (programmatic-only; a user toggle resolves to checked/unchecked) -->
|
|
46
|
+
<rel-checkbox id="select-all" label="Select all" status="indeterminate"></rel-checkbox>
|
|
47
|
+
<script>
|
|
48
|
+
document.getElementById('select-all').addEventListener('rel-change', (e) => {
|
|
49
|
+
console.log(e.detail.checked, e.detail.value);
|
|
50
|
+
});
|
|
51
|
+
</script>
|
|
39
52
|
```
|
|
40
53
|
|
|
54
|
+
<!-- readme-gen:start -->
|
|
55
|
+
|
|
56
|
+
<!-- Generated from rel-checkbox.ts — do not edit; run readme-generate.mjs -->
|
|
57
|
+
|
|
41
58
|
## API
|
|
42
59
|
|
|
43
|
-
### Attributes/Properties
|
|
44
|
-
| Name | Type | Default | Description |
|
|
45
|
-
|------|------|---------|-------------|
|
|
46
|
-
| `label` | `string` | `"Label"` | Label text displayed next to the checkbox |
|
|
47
|
-
| `icon` | `string` | `""` | `rel-icon` name rendered between the checkbox and the label (label prefix icon; scales with `size`). Unset renders no icon and reserves no space |
|
|
48
|
-
| `supportingtext` | `string` | `""` | Helper text; placement depends on `density` |
|
|
49
|
-
| `state` | `"default" \| "error" \| "disabled"` | `"default"` | Visual and interaction state of the checkbox |
|
|
50
|
-
| `status` | `"unchecked" \| "checked" \| "indeterminate"` | `"unchecked"` | Current check state. Indeterminate is programmatic-only |
|
|
51
|
-
| `checked` | `boolean` (accessor) | `false` | Convenience accessor over `status` (used by the Angular CVA) |
|
|
52
|
-
| `size` | `"small" \| "medium"` | `"medium"` | Control scale: medium = 18px box, body-lg label, body-sm supporting text; small = 14px box, body-md label, body-xs supporting text (reflected) |
|
|
53
|
-
| `density` | `"compact" \| "comfortable"` | `"compact"` | Supporting-text layout: compact puts it on its own line under the row, indented past the box; comfortable stacks label + supporting text beside the box (reflected) |
|
|
54
|
-
| `alignment` | `"leading" \| "trailing"` | `"leading"` | Box position: leading = before the label; trailing = far edge of the row. Trailing always renders comfortable density — compact+trailing is "Not available" in the Figma sheet, and a dev-mode `console.warn` fires if requested (reflected) |
|
|
55
|
-
| `value` | `string` | `""` | Value reported in the `rel-change` event detail |
|
|
60
|
+
### Attributes / Properties
|
|
56
61
|
|
|
57
|
-
|
|
58
|
-
|
|
|
59
|
-
|
|
60
|
-
|
|
|
61
|
-
|
|
|
62
|
-
|
|
|
63
|
-
|
|
|
62
|
+
| Property | Attribute | Type | Default | Description |
|
|
63
|
+
| --- | --- | --- | --- | --- |
|
|
64
|
+
| `label` | `label` | `string` | `"Label"` | Label text rendered next to the box. |
|
|
65
|
+
| `icon` | `icon` | `string` | `""` | rel-icon name rendered between the checkbox and the label (label prefix icon); scales with `size`. Unset renders no icon and reserves no space. |
|
|
66
|
+
| `supportingtext` | `supportingtext` | `string` | `""` | Supporting text under or beside the label; where it renders depends on `density`. |
|
|
67
|
+
| `state` | `state` | `"default" \| "error" \| "disabled"` | `"default"` | Visual and interaction state (Figma State): `"error"` swaps in the danger colours, `"disabled"` blocks input and dims the whole control to 0.4 opacity (colours unchanged, as Figma specifies). |
|
|
68
|
+
| `status` | `status` | `"unchecked" \| "checked" \| "indeterminate"` | `"unchecked"` | Check state. `"indeterminate"` is programmatic-only — a user toggle always resolves to checked or unchecked. |
|
|
69
|
+
| `value` | `value` | `string` | `""` | Value reported in the `rel-change` event detail (it is not submitted with a form). |
|
|
70
|
+
| `size` | `size` | `"small" \| "medium" \| "large" \| "extra-large"` | `"medium"` | Control scale (Figma Size), on Figma's four-step ramp of control frames: `"small"` 16px / body-sm, `"medium"` (default) 18px / body-md, `"large"` 20px / body-lg, `"extra-large"` 24px / body-xl. The drawn square is inset to 80% of the frame, so the frame is the layout footprint (what the row gap and the compact indent measure from) rather than the visible square. Reflected. |
|
|
71
|
+
| `density` | `density` | `"compact" \| "comfortable"` | `"compact"` | Supporting-text layout (Figma Density). `"compact"` (default) puts the supporting text on its own line under the row, indented past the box; `"comfortable"` stacks label + supporting text beside the box. Reflected. |
|
|
72
|
+
| `alignment` | `alignment` | `"leading" \| "trailing"` | `"leading"` | Box position (Figma Alignment). `"leading"` (default) renders the box before the label; `"trailing"` pushes it to the far edge of the row. Trailing has no compact layout in the spec, so it always renders with comfortable density. Reflected. |
|
|
73
|
+
|
|
74
|
+
### Public fields / accessors
|
|
75
|
+
|
|
76
|
+
| Name | Type | Description |
|
|
77
|
+
| --- | --- | --- |
|
|
78
|
+
| `checked` | `boolean` | Boolean view of `status`: `true` when `status === "checked"`; setting it writes `"checked"` / `"unchecked"`. |
|
|
64
79
|
|
|
65
80
|
## Events
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
|
81
|
+
|
|
82
|
+
| Event | Detail | Bubbles / composed | Description |
|
|
83
|
+
| --- | --- | --- | --- |
|
|
84
|
+
| `rel-change` | `{ checked: this.status === "checked", value: this.value, }` | bubbles / composed | Fired after a user toggle. Detail: `{ checked: boolean, value: string }`. |
|
|
69
85
|
|
|
70
86
|
## Slots
|
|
71
|
-
|
|
87
|
+
|
|
88
|
+
| Slot | Description |
|
|
89
|
+
| --- | --- |
|
|
90
|
+
| — | This element has no slots. |
|
|
72
91
|
|
|
73
92
|
## CSS Parts
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
- `--rel-body-lg-regular-*` / `--rel-body-sm-regular-*` - Label and supporting text type (medium size)
|
|
83
|
-
- `--rel-body-md-regular-*` / `--rel-body-xs-regular-*` - Label and supporting text type (small size)
|
|
84
|
-
|
|
85
|
-
### Spacing Tokens
|
|
86
|
-
- `--rel-spacing-xs` - Gap between box, icon, and label
|
|
87
|
-
- `--rel-spacing-3xs` - Gap between label and supporting text (comfortable) / row and supporting text (compact)
|
|
88
|
-
|
|
89
|
-
### Color Tokens
|
|
90
|
-
- `--rel-text-default` - Box border and label text color (rest)
|
|
91
|
-
- `--rel-text-body` - Hover color for box, label, and icon
|
|
92
|
-
- `--rel-bg-neutral-inverse-2` - Checked box fill and indeterminate dash
|
|
93
|
-
- `--rel-text-inverse` - Checkmark color
|
|
94
|
-
- `--rel-text-caption` - Supporting text color
|
|
95
|
-
- `--rel-border-focus` - Focus outline color
|
|
96
|
-
- `--rel-border-danger` / `--rel-action-danger-fill` / `--rel-text-danger` - Error state colors
|
|
93
|
+
|
|
94
|
+
| Part | Description |
|
|
95
|
+
| --- | --- |
|
|
96
|
+
| `base` | The outer wrapper that carries the `state` / `status` classes |
|
|
97
|
+
| `label` | The visible label text |
|
|
98
|
+
| `helper` | The supporting text (rendered beside the box in comfortable density, under the row in compact) |
|
|
99
|
+
|
|
100
|
+
<!-- readme-gen:end -->
|
|
97
101
|
|
|
98
102
|
## Accessibility
|
|
99
|
-
- Uses visually hidden native checkbox input for screen reader support
|
|
100
|
-
- Custom visual checkbox with proper focus indicators
|
|
101
|
-
- Focus visible state with outline offset for keyboard users
|
|
102
|
-
- Label click targets the checkbox for larger interaction area (in trailing alignment the whole row is clickable)
|
|
103
|
-
- Disabled state communicated through opacity reduction and cursor change
|
|
104
103
|
|
|
105
|
-
|
|
106
|
-
- `
|
|
107
|
-
- `
|
|
104
|
+
- A visually hidden native `<input type="checkbox">` carries the semantics; the custom box is decorative. The input is wrapped in a `<label>`, so clicking anywhere on the row (label, icon or box — the whole row in trailing alignment) toggles it.
|
|
105
|
+
- `status="indeterminate"` sets the native `indeterminate` flag and `aria-checked="mixed"` on the input, so screen readers announce the mixed state.
|
|
106
|
+
- `state="disabled"` sets the native `disabled` attribute (the input leaves the tab order) and blocks pointer events on the whole element.
|
|
107
|
+
- Focus: `:focus-visible` on the hidden input draws a 2px `--rel-border-focus` outline with a 2px offset around the box.
|
|
108
|
+
- No live-region announcements are made; the native checkbox reports its own state changes.
|
|
108
109
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
110
|
+
| Key | Action |
|
|
111
|
+
| --- | --- |
|
|
112
|
+
| `Tab` / `Shift+Tab` | Move focus to / from the checkbox |
|
|
113
|
+
| `Space` | Toggle between checked and unchecked (native behaviour; indeterminate resolves to checked) |
|
|
112
114
|
|
|
113
115
|
## Notes / Edge Cases
|
|
114
|
-
|
|
115
|
-
-
|
|
116
|
-
-
|
|
117
|
-
-
|
|
118
|
-
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
-
|
|
122
|
-
-
|
|
123
|
-
- **
|
|
116
|
+
|
|
117
|
+
- User toggling is binary: indeterminate is never entered by interaction. Set `status="indeterminate"` programmatically (e.g. a Select-All parent driven by app state).
|
|
118
|
+
- `checked` is a convenience accessor over `status` (used by the Angular ControlValueAccessor wrapper); reading it is `status === "checked"`, writing it sets `"checked"` / `"unchecked"`.
|
|
119
|
+
- `alignment="trailing"` with `density="compact"` is "Not available" in the Figma sheet: the element renders comfortable density and logs `[rel-checkbox] density="compact" has no trailing layout; rendering comfortable density.` once per change.
|
|
120
|
+
- Comfortable density with no supporting text is visually identical to compact.
|
|
121
|
+
- The host is `display: block`, so a trailing checkbox stretches to its container width; constrain the parent to control row width.
|
|
122
|
+
- `value` is only reported in the `rel-change` detail — the element does not participate in native form submission.
|
|
123
|
+
- The hidden native input is absolutely positioned against the `.row` containing block; keep `position: relative` on `.row` (Tab-scroll page-jump fix, shared with rel-radio).
|
|
124
|
+
- Control frames are 16 / 18 / 20 / 24px for small / medium / large / extra-large, matching Figma. The frame is the layout footprint — the row gap and the compact indent measure from it — while the drawn square is inset to 80% of the frame (12.8 / 14.4 / 16 / 19.2px), as Figma draws it.
|
|
125
|
+
- The square's 2px border weight is **not** verified against Figma: the control is flattened artwork (a filled vector rather than a frame with a stroke), so the sheet gives the square's outer size but says nothing about its stroke. Carried forward from the previous implementation.
|
|
126
|
+
|
|
127
|
+
### Layout matrix (mirrors the Figma sheet)
|
|
128
|
+
|
|
129
|
+
| Size | Density | Leading | Trailing |
|
|
130
|
+
| --- | --- | --- | --- |
|
|
131
|
+
| M | Comfortable | yes | yes |
|
|
132
|
+
| M | Compact | yes (default) | renders comfortable |
|
|
133
|
+
| S | Comfortable | yes | yes |
|
|
134
|
+
| S | Compact | yes | renders comfortable |
|
|
135
|
+
| L | Comfortable | yes | yes |
|
|
136
|
+
| L | Compact | yes | renders comfortable |
|
|
137
|
+
| XL | Comfortable | yes | yes |
|
|
138
|
+
| XL | Compact | yes | renders comfortable |
|
|
139
|
+
|
|
140
|
+
### Recipes (intentionally not component props)
|
|
141
|
+
|
|
142
|
+
- **Selectable list row**: `alignment="trailing"` checkbox inside a padded, hover-highlighted container.
|
|
143
|
+
- **Select All / nested group**: parent checkbox with `status="indeterminate"` wired to children in app state.
|
|
144
|
+
- **Selectable card**: `rel-card` wrapping a checkbox; toggle a selected border on `rel-change`.
|
|
124
145
|
|
|
125
146
|
See the Storybook Checkbox stories for working recipe markup.
|