@reliability-design/web 1.0.3 → 1.1.1
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/dist/components/rel-accordion/README.md +132 -0
- package/dist/components/rel-accordion/rel-accordion.ts +47 -16
- package/dist/components/rel-alert/README.md +141 -0
- package/dist/components/rel-alert/rel-alert.ts +101 -20
- package/dist/components/rel-avatar/README.md +119 -0
- package/dist/components/rel-avatar/rel-avatar.ts +3 -2
- package/dist/components/rel-badge/README.md +86 -0
- package/dist/components/rel-badge/rel-badge.ts +11 -7
- package/dist/components/rel-breadcrumb/README.md +102 -0
- package/dist/components/rel-breadcrumb/rel-breadcrumb.ts +12 -6
- package/dist/components/rel-button/README.md +130 -0
- package/dist/components/rel-button/rel-button.ts +64 -8
- package/dist/components/rel-calendar/README.md +109 -0
- package/dist/components/rel-calendar/index.ts +1 -0
- package/dist/components/rel-calendar/rel-calendar.ts +467 -0
- package/dist/components/rel-card/README.md +94 -0
- package/dist/components/rel-card/rel-card.ts +12 -3
- package/dist/components/rel-cardmedia/README.md +127 -0
- package/dist/components/rel-cardmedia/rel-cardmedia.ts +14 -4
- package/dist/components/rel-carousel/README.md +166 -0
- package/dist/components/rel-carousel/index.ts +1 -0
- package/dist/components/rel-carousel/rel-carousel.ts +468 -0
- package/dist/components/rel-chart/README.md +286 -0
- package/dist/components/rel-chart/index.ts +1 -0
- package/dist/components/rel-chart/rel-chart.ts +736 -0
- package/dist/components/rel-checkbox/README.md +77 -0
- package/dist/components/rel-checkbox/rel-checkbox.ts +51 -12
- package/dist/components/rel-chip/README.md +114 -0
- package/dist/components/rel-chip/rel-chip.ts +83 -9
- package/dist/components/rel-container/README.md +99 -0
- package/dist/components/rel-date-picker/README.md +253 -0
- package/dist/components/rel-date-picker/index.ts +1 -0
- package/dist/components/rel-date-picker/rel-date-picker.ts +916 -0
- package/dist/components/rel-divider/README.md +100 -0
- package/dist/components/rel-divider/rel-divider.ts +9 -0
- package/dist/components/rel-drawer/README.md +200 -0
- package/dist/components/rel-drawer/index.ts +1 -0
- package/dist/components/rel-drawer/rel-drawer-footer.ts +29 -0
- package/dist/components/rel-drawer/rel-drawer.ts +612 -0
- package/dist/components/rel-kbd/README.md +151 -0
- package/dist/components/rel-kbd/rel-kbd.ts +118 -0
- package/dist/components/rel-layout/README.md +88 -0
- package/dist/components/rel-menu/README.md +151 -0
- package/dist/components/rel-menu/rel-menu.ts +64 -24
- package/dist/components/rel-menubar/README.md +329 -0
- package/dist/components/rel-menubar/index.ts +2 -0
- package/dist/components/rel-menubar/rel-menubar-menu.ts +16 -0
- package/dist/components/rel-menubar/rel-menubar.ts +605 -0
- package/dist/components/rel-nav-menu/README.md +289 -0
- package/dist/components/rel-nav-menu/index.ts +3 -0
- package/dist/components/rel-nav-menu/rel-nav-menu-item.ts +240 -0
- package/dist/components/rel-nav-menu/rel-nav-menu-panel.ts +53 -0
- package/dist/components/rel-nav-menu/rel-nav-menu.ts +227 -0
- package/dist/components/rel-navbar/README.md +126 -0
- package/dist/components/rel-navbar/rel-navbar.ts +104 -0
- package/dist/components/rel-otp/README.md +440 -0
- package/dist/components/rel-otp/index.ts +1 -0
- package/dist/components/rel-otp/rel-otp.ts +504 -0
- package/dist/components/rel-pagination/README.md +410 -0
- package/dist/components/rel-pagination/index.ts +1 -0
- package/dist/components/rel-pagination/rel-pagination.ts +381 -0
- package/dist/components/rel-popover/README.md +568 -0
- package/dist/components/rel-popover/index.ts +2 -0
- package/dist/components/rel-popover/rel-popover-content.ts +55 -0
- package/dist/components/rel-popover/rel-popover.ts +330 -0
- package/dist/components/rel-progress/README.md +110 -0
- package/dist/components/rel-progress/rel-progress.ts +32 -5
- package/dist/components/rel-radio/README.md +120 -0
- package/dist/components/rel-radio/rel-radio.ts +31 -6
- package/dist/components/rel-resizable/README.md +140 -0
- package/dist/components/rel-resizable/index.ts +3 -0
- package/dist/components/rel-resizable/rel-resizable-group.ts +374 -0
- package/dist/components/rel-resizable/rel-resizable-handle.ts +145 -0
- package/dist/components/rel-resizable/rel-resizable-panel.ts +47 -0
- package/dist/components/rel-segmented-button/README.md +141 -0
- package/dist/components/rel-segmented-button/rel-segmented-button.ts +18 -13
- package/dist/components/rel-select/README.md +107 -0
- package/dist/components/rel-select/rel-select.ts +28 -14
- package/dist/components/rel-sheet/README.md +224 -0
- package/dist/components/rel-sheet/rel-sheet.ts +684 -0
- package/dist/components/rel-sidebar/README.md +209 -0
- package/dist/components/rel-sidebar/rel-sidebar.ts +1166 -0
- package/dist/components/rel-slider/README.md +135 -0
- package/dist/components/rel-slider/rel-slider.ts +44 -9
- package/dist/components/rel-snackbar/README.md +134 -0
- package/dist/components/rel-snackbar/rel-snackbar.ts +109 -14
- package/dist/components/rel-stepper/README.md +160 -0
- package/dist/components/rel-stepper/rel-stepper.ts +38 -27
- package/dist/components/rel-switch/README.md +102 -0
- package/dist/components/rel-switch/rel-switch.ts +34 -12
- package/dist/components/rel-tab/README.md +163 -0
- package/dist/components/rel-tab/rel-tab.ts +79 -23
- package/dist/components/rel-table/README.md +178 -0
- package/dist/components/rel-table/rel-table-body.ts +21 -0
- package/dist/components/rel-table/rel-table-caption.ts +27 -0
- package/dist/components/rel-table/rel-table-cell.ts +42 -0
- package/dist/components/rel-table/rel-table-footer.ts +23 -0
- package/dist/components/rel-table/rel-table-head.ts +45 -0
- package/dist/components/rel-table/rel-table-header.ts +21 -0
- package/dist/components/rel-table/rel-table-row.ts +36 -0
- package/dist/components/rel-table/rel-table.ts +53 -0
- package/dist/components/rel-textfield/README.md +90 -0
- package/dist/components/rel-textfield/rel-textfield.ts +55 -39
- package/dist/components/rel-toast/README.md +148 -0
- package/dist/components/rel-toast/rel-toast.ts +63 -24
- package/dist/components/rel-tooltip/README.md +103 -0
- package/dist/components/rel-tooltip/rel-tooltip.ts +123 -80
- package/dist/components/rel-topbar/rel-topbar-actions.ts +23 -0
- package/dist/components/rel-topbar/rel-topbar-brand.ts +46 -0
- package/dist/components/rel-topbar/rel-topbar-dropdown-item.ts +33 -0
- package/dist/components/rel-topbar/rel-topbar-dropdown.ts +28 -0
- package/dist/components/rel-topbar/rel-topbar-item.ts +315 -0
- package/dist/components/rel-topbar/rel-topbar-mobile-panel.ts +23 -0
- package/dist/components/rel-topbar/rel-topbar-profile.ts +248 -0
- package/dist/components/rel-topbar/rel-topbar-utilities.ts +23 -0
- package/dist/components/rel-topbar/rel-topbar.ts +329 -0
- package/dist/index.d.mts +831 -7
- package/dist/index.d.ts +831 -7
- package/dist/index.js +9500 -1564
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +9240 -1344
- package/dist/index.mjs.map +1 -1
- package/dist/styles/vars.css +187 -25
- package/dist/vars-TBB4BMSD.css +346 -0
- package/package.json +2 -1
- package/dist/vars-6ZIUPIU4.css +0 -184
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
# rel-card
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
A simple, versatile card container component with built-in elevation shadow and hover lift effect. Provides a clean, elevated surface for grouping related content. Respects user motion preferences by disabling animations when requested.
|
|
5
|
+
|
|
6
|
+
## Usage
|
|
7
|
+
```html
|
|
8
|
+
<!-- Basic card with text content -->
|
|
9
|
+
<rel-card>
|
|
10
|
+
<h3>Card Title</h3>
|
|
11
|
+
<p>This is some content inside the card.</p>
|
|
12
|
+
</rel-card>
|
|
13
|
+
|
|
14
|
+
<!-- Card with mixed content -->
|
|
15
|
+
<rel-card>
|
|
16
|
+
<h2>Product Name</h2>
|
|
17
|
+
<img src="product.jpg" alt="Product" style="width: 100%; border-radius: 8px;">
|
|
18
|
+
<p>Product description goes here.</p>
|
|
19
|
+
<button>Add to Cart</button>
|
|
20
|
+
</rel-card>
|
|
21
|
+
|
|
22
|
+
<!-- Multiple cards in a grid -->
|
|
23
|
+
<div style="display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px;">
|
|
24
|
+
<rel-card>
|
|
25
|
+
<h4>Feature 1</h4>
|
|
26
|
+
<p>Description of feature 1</p>
|
|
27
|
+
</rel-card>
|
|
28
|
+
<rel-card>
|
|
29
|
+
<h4>Feature 2</h4>
|
|
30
|
+
<p>Description of feature 2</p>
|
|
31
|
+
</rel-card>
|
|
32
|
+
<rel-card>
|
|
33
|
+
<h4>Feature 3</h4>
|
|
34
|
+
<p>Description of feature 3</p>
|
|
35
|
+
</rel-card>
|
|
36
|
+
</div>
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## API
|
|
40
|
+
|
|
41
|
+
### Attributes/Properties
|
|
42
|
+
None. This component is purely presentational and controlled via slots.
|
|
43
|
+
|
|
44
|
+
## Events
|
|
45
|
+
None.
|
|
46
|
+
|
|
47
|
+
## Slots
|
|
48
|
+
| Slot | Description |
|
|
49
|
+
|------|-------------|
|
|
50
|
+
| (default) | Card content (any HTML elements) |
|
|
51
|
+
|
|
52
|
+
## CSS Parts
|
|
53
|
+
None exposed.
|
|
54
|
+
|
|
55
|
+
## Tokens / CSS Variables
|
|
56
|
+
|
|
57
|
+
### Semantic Tokens
|
|
58
|
+
- `--rel-fontFamilies-primary` - Font family
|
|
59
|
+
|
|
60
|
+
### Color Tokens
|
|
61
|
+
- `--rel-colors-white` - Card background color
|
|
62
|
+
- `--rel-text-primary` - Text color
|
|
63
|
+
|
|
64
|
+
### Shadow Tokens
|
|
65
|
+
- `--rel-shadows-shadow-200` - Default elevation shadow
|
|
66
|
+
- `--rel-shadows-shadow-300` - Hover elevation shadow (larger)
|
|
67
|
+
|
|
68
|
+
### Border Tokens
|
|
69
|
+
- `--rel-borders-radius-border-radius-300` - Card border radius
|
|
70
|
+
|
|
71
|
+
### Spacing Tokens
|
|
72
|
+
- `--rel-spacing-space-md` - Internal padding
|
|
73
|
+
|
|
74
|
+
## Accessibility
|
|
75
|
+
- The card itself has no specific ARIA role (it's a generic container)
|
|
76
|
+
- Ensure slotted content includes proper semantic HTML and ARIA attributes where needed
|
|
77
|
+
- Hover effect is purely visual and does not affect accessibility
|
|
78
|
+
|
|
79
|
+
### Keyboard Interactions
|
|
80
|
+
- None (purely presentational container)
|
|
81
|
+
|
|
82
|
+
### Focus Behavior
|
|
83
|
+
- Does not receive focus (container only)
|
|
84
|
+
- Ensure slotted interactive elements are keyboard accessible
|
|
85
|
+
|
|
86
|
+
## Notes / Edge Cases
|
|
87
|
+
- The card is `display: block` and takes full width of its container by default
|
|
88
|
+
- **Hover effect**: Translates the card upward by 3px (`translateY(-3px)`) and increases shadow depth
|
|
89
|
+
- **Animation**: Uses `transition: transform 0.2s ease, box-shadow 0.2s ease`
|
|
90
|
+
- **Motion preferences**: When `prefers-reduced-motion: reduce`, both hover transform and transitions are disabled
|
|
91
|
+
- The card has consistent padding on all sides via `--rel-spacing-space-md`
|
|
92
|
+
- The internal `.card` wrapper is where all styling is applied
|
|
93
|
+
- The component provides no default content styling—you control the layout of slotted elements
|
|
94
|
+
- Works well with CSS Grid or Flexbox for creating card layouts
|
|
@@ -6,14 +6,14 @@ export class RelCard extends LitElement {
|
|
|
6
6
|
static styles = css`
|
|
7
7
|
:host {
|
|
8
8
|
display: block;
|
|
9
|
-
font-family: var(--rel-fontFamilies-primary);
|
|
9
|
+
font-family: var(--rel-fontFamilies-primary, sans-serif);
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
.card {
|
|
13
|
-
background-color: var(--rel-colors-white);
|
|
13
|
+
background-color: var(--rel-colors-white, #fff);
|
|
14
|
+
color: var(--rel-text-primary, #333);
|
|
14
15
|
border-radius: var(--rel-borders-radius-border-radius-300);
|
|
15
16
|
padding: var(--rel-spacing-space-md);
|
|
16
|
-
|
|
17
17
|
box-shadow: var(--rel-shadows-shadow-200);
|
|
18
18
|
transition: transform 0.2s ease, box-shadow 0.2s ease;
|
|
19
19
|
}
|
|
@@ -22,6 +22,15 @@ export class RelCard extends LitElement {
|
|
|
22
22
|
transform: translateY(-3px);
|
|
23
23
|
box-shadow: var(--rel-shadows-shadow-300);
|
|
24
24
|
}
|
|
25
|
+
|
|
26
|
+
@media (prefers-reduced-motion: reduce) {
|
|
27
|
+
.card {
|
|
28
|
+
transition: none;
|
|
29
|
+
}
|
|
30
|
+
.card:hover {
|
|
31
|
+
transform: none;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
25
34
|
`;
|
|
26
35
|
|
|
27
36
|
render() {
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
# rel-card-media
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
A media-rich card component combining an image, title, subtitle, and custom content area. Features automatic image sizing with object-fit, enhanced hover lift effect (4px), and semantic heading structure. Ideal for blog posts, product listings, or media galleries.
|
|
5
|
+
|
|
6
|
+
## Usage
|
|
7
|
+
```html
|
|
8
|
+
<!-- Basic media card -->
|
|
9
|
+
<rel-card-media
|
|
10
|
+
imageSrc="./photo.jpg"
|
|
11
|
+
imageAlt="Beautiful landscape"
|
|
12
|
+
title="Card Title"
|
|
13
|
+
subtitle="Card subtitle or description">
|
|
14
|
+
</rel-card-media>
|
|
15
|
+
|
|
16
|
+
<!-- With custom slotted content -->
|
|
17
|
+
<rel-card-media
|
|
18
|
+
imageSrc="./product.jpg"
|
|
19
|
+
imageAlt="Product image"
|
|
20
|
+
title="Premium Product"
|
|
21
|
+
subtitle="$99.99">
|
|
22
|
+
<p>Additional product details go here.</p>
|
|
23
|
+
<button>Buy Now</button>
|
|
24
|
+
</rel-card-media>
|
|
25
|
+
|
|
26
|
+
<!-- Without image -->
|
|
27
|
+
<rel-card-media
|
|
28
|
+
title="Text-Only Card"
|
|
29
|
+
subtitle="No image provided">
|
|
30
|
+
<p>This card has no image, just title, subtitle, and content.</p>
|
|
31
|
+
</rel-card-media>
|
|
32
|
+
|
|
33
|
+
<!-- With title only -->
|
|
34
|
+
<rel-card-media
|
|
35
|
+
imageSrc="./banner.jpg"
|
|
36
|
+
imageAlt="Banner"
|
|
37
|
+
title="Event Title">
|
|
38
|
+
<p>Event description and details.</p>
|
|
39
|
+
</rel-card-media>
|
|
40
|
+
|
|
41
|
+
<!-- Gallery layout -->
|
|
42
|
+
<div style="display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px;">
|
|
43
|
+
<rel-card-media
|
|
44
|
+
imageSrc="./img1.jpg"
|
|
45
|
+
title="Gallery Item 1">
|
|
46
|
+
</rel-card-media>
|
|
47
|
+
<rel-card-media
|
|
48
|
+
imageSrc="./img2.jpg"
|
|
49
|
+
title="Gallery Item 2">
|
|
50
|
+
</rel-card-media>
|
|
51
|
+
<rel-card-media
|
|
52
|
+
imageSrc="./img3.jpg"
|
|
53
|
+
title="Gallery Item 3">
|
|
54
|
+
</rel-card-media>
|
|
55
|
+
</div>
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## API
|
|
59
|
+
|
|
60
|
+
### Attributes/Properties
|
|
61
|
+
| Name | Type | Default | Description |
|
|
62
|
+
|------|------|---------|-------------|
|
|
63
|
+
| `imageSrc` | `string` | `""` | URL of the card image (optional) |
|
|
64
|
+
| `imageAlt` | `string` | `"Card image"` | Alt text for the image (for accessibility) |
|
|
65
|
+
| `title` | `string` | `""` | Card title displayed as `<h3>` (optional) |
|
|
66
|
+
| `subtitle` | `string` | `""` | Card subtitle displayed as `<p>` (optional) |
|
|
67
|
+
|
|
68
|
+
## Events
|
|
69
|
+
None.
|
|
70
|
+
|
|
71
|
+
## Slots
|
|
72
|
+
| Slot | Description |
|
|
73
|
+
|------|-------------|
|
|
74
|
+
| (default) | Additional content rendered below title and subtitle |
|
|
75
|
+
|
|
76
|
+
## CSS Parts
|
|
77
|
+
None exposed.
|
|
78
|
+
|
|
79
|
+
## Tokens / CSS Variables
|
|
80
|
+
|
|
81
|
+
### Semantic Tokens
|
|
82
|
+
- `--rel-fontFamilies-primary` - Font family
|
|
83
|
+
- `--rel-fontSizes-md` - Title font size
|
|
84
|
+
- `--rel-fontSizes-sm` - Subtitle font size
|
|
85
|
+
- `--rel-fontWeights-semibold` - Title font weight
|
|
86
|
+
|
|
87
|
+
### Color Tokens
|
|
88
|
+
- `--rel-colors-white` - Card background color
|
|
89
|
+
- `--rel-text-primary` - General text color
|
|
90
|
+
- `--rel-text-heading` - Title color
|
|
91
|
+
|
|
92
|
+
### Shadow Tokens
|
|
93
|
+
- `--rel-shadows-shadow-200` - Default elevation shadow
|
|
94
|
+
- `--rel-shadows-shadow-300` - Hover elevation shadow (larger)
|
|
95
|
+
|
|
96
|
+
### Border Tokens
|
|
97
|
+
- `--rel-borders-radius-border-radius-300` - Card border radius
|
|
98
|
+
|
|
99
|
+
### Spacing Tokens
|
|
100
|
+
- `--rel-spacing-space-md` - Content area padding
|
|
101
|
+
|
|
102
|
+
## Accessibility
|
|
103
|
+
- Image has `alt` attribute for screen reader support
|
|
104
|
+
- Title uses semantic `<h3>` heading
|
|
105
|
+
- Subtitle uses `<p>` for proper text hierarchy
|
|
106
|
+
- Hover effect is purely visual and does not affect accessibility
|
|
107
|
+
|
|
108
|
+
### Keyboard Interactions
|
|
109
|
+
- None (purely presentational container)
|
|
110
|
+
- Ensure slotted interactive elements are keyboard accessible
|
|
111
|
+
|
|
112
|
+
### Focus Behavior
|
|
113
|
+
- Does not receive focus (container only)
|
|
114
|
+
|
|
115
|
+
## Notes / Edge Cases
|
|
116
|
+
- **Image rendering**: If `imageSrc` is not provided or empty, the image section is not rendered
|
|
117
|
+
- **Image sizing**: The image uses `width: 100%`, `height: auto`, and `object-fit: cover` for responsive scaling
|
|
118
|
+
- The image is `display: block` to remove default inline spacing
|
|
119
|
+
- **Title and subtitle**: Both are optional; if not provided, their respective elements are not rendered
|
|
120
|
+
- Title has `margin: 0 0 4px 0` for spacing from subtitle
|
|
121
|
+
- Subtitle has `margin: 0 0 8px 0` for spacing from slotted content
|
|
122
|
+
- **Hover effect**: Translates the card upward by 4px (`translateY(-4px)`) and increases shadow depth (1px more than rel-card)
|
|
123
|
+
- **Animation**: Uses `transition: transform 0.2s ease, box-shadow 0.2s ease`
|
|
124
|
+
- **Motion preferences**: When `prefers-reduced-motion: reduce`, both hover transform and transitions are disabled
|
|
125
|
+
- The card uses `overflow: hidden` to ensure image respects border radius
|
|
126
|
+
- The `.card-content` wrapper provides consistent padding for title, subtitle, and slotted content
|
|
127
|
+
- The component is `display: block` and takes full width of its container
|
|
@@ -11,11 +11,12 @@ export class RelCardMedia extends LitElement {
|
|
|
11
11
|
static styles = css`
|
|
12
12
|
:host {
|
|
13
13
|
display: block;
|
|
14
|
-
font-family: var(--rel-fontFamilies-primary);
|
|
14
|
+
font-family: var(--rel-fontFamilies-primary, sans-serif);
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
.card-media {
|
|
18
|
-
background-color: var(--rel-colors-white);
|
|
18
|
+
background-color: var(--rel-colors-white, #fff);
|
|
19
|
+
color: var(--rel-text-primary, #333);
|
|
19
20
|
border-radius: var(--rel-borders-radius-border-radius-300);
|
|
20
21
|
overflow: hidden;
|
|
21
22
|
box-shadow: var(--rel-shadows-shadow-200);
|
|
@@ -27,6 +28,15 @@ export class RelCardMedia extends LitElement {
|
|
|
27
28
|
box-shadow: var(--rel-shadows-shadow-300);
|
|
28
29
|
}
|
|
29
30
|
|
|
31
|
+
@media (prefers-reduced-motion: reduce) {
|
|
32
|
+
.card-media {
|
|
33
|
+
transition: none;
|
|
34
|
+
}
|
|
35
|
+
.card-media:hover {
|
|
36
|
+
transform: none;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
30
40
|
.card-image img {
|
|
31
41
|
display: block;
|
|
32
42
|
width: 100%;
|
|
@@ -42,13 +52,13 @@ export class RelCardMedia extends LitElement {
|
|
|
42
52
|
margin: 0 0 4px 0;
|
|
43
53
|
font-size: var(--rel-fontSizes-md);
|
|
44
54
|
font-weight: var(--rel-fontWeights-semibold);
|
|
45
|
-
color: var(--rel-
|
|
55
|
+
color: var(--rel-text-heading, #2b2b2b);
|
|
46
56
|
}
|
|
47
57
|
|
|
48
58
|
.card-content p {
|
|
49
59
|
margin: 0 0 8px 0;
|
|
50
60
|
font-size: var(--rel-fontSizes-sm);
|
|
51
|
-
color: var(--rel-
|
|
61
|
+
color: var(--rel-text-primary, #333);
|
|
52
62
|
}
|
|
53
63
|
`;
|
|
54
64
|
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
# rel-carousel
|
|
2
|
+
|
|
3
|
+
A fully accessible carousel component built with Lit for the Reliability Design System.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- Horizontal sliding carousel
|
|
8
|
+
- Touch/mouse drag support
|
|
9
|
+
- Keyboard navigation
|
|
10
|
+
- Optional autoplay
|
|
11
|
+
- Navigation buttons and dot indicators
|
|
12
|
+
- Loop mode
|
|
13
|
+
- Smooth transitions with reduced motion support
|
|
14
|
+
- Full ARIA support
|
|
15
|
+
|
|
16
|
+
## Usage
|
|
17
|
+
|
|
18
|
+
```html
|
|
19
|
+
<rel-carousel>
|
|
20
|
+
<div>Slide 1</div>
|
|
21
|
+
<div>Slide 2</div>
|
|
22
|
+
<div>Slide 3</div>
|
|
23
|
+
</rel-carousel>
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### With Loop
|
|
27
|
+
|
|
28
|
+
```html
|
|
29
|
+
<rel-carousel loop>
|
|
30
|
+
<div>Slide 1</div>
|
|
31
|
+
<div>Slide 2</div>
|
|
32
|
+
<div>Slide 3</div>
|
|
33
|
+
</rel-carousel>
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### With Autoplay
|
|
37
|
+
|
|
38
|
+
```html
|
|
39
|
+
<rel-carousel autoplay interval="3000">
|
|
40
|
+
<div>Slide 1</div>
|
|
41
|
+
<div>Slide 2</div>
|
|
42
|
+
<div>Slide 3</div>
|
|
43
|
+
</rel-carousel>
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### Without Navigation
|
|
47
|
+
|
|
48
|
+
```html
|
|
49
|
+
<rel-carousel show-buttons="false" show-dots="false">
|
|
50
|
+
<div>Slide 1</div>
|
|
51
|
+
<div>Slide 2</div>
|
|
52
|
+
<div>Slide 3</div>
|
|
53
|
+
</rel-carousel>
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### Programmatic Control (JavaScript)
|
|
57
|
+
|
|
58
|
+
```javascript
|
|
59
|
+
const carousel = document.querySelector('rel-carousel');
|
|
60
|
+
|
|
61
|
+
// Navigate to specific slide
|
|
62
|
+
carousel.value = 2;
|
|
63
|
+
|
|
64
|
+
// Listen to changes
|
|
65
|
+
carousel.addEventListener('rel-change', (e) => {
|
|
66
|
+
console.log('Current slide:', e.detail.value);
|
|
67
|
+
});
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Attributes
|
|
71
|
+
|
|
72
|
+
| Attribute | Type | Default | Description |
|
|
73
|
+
|-----------|------|---------|-------------|
|
|
74
|
+
| `value` | `number` | `0` | Current slide index (0-based) |
|
|
75
|
+
| `loop` | `boolean` | `false` | Enable infinite loop |
|
|
76
|
+
| `autoplay` | `boolean` | `false` | Enable automatic slide advancement |
|
|
77
|
+
| `interval` | `number` | `5000` | Autoplay interval in milliseconds |
|
|
78
|
+
| `pause-on-hover` | `boolean` | `true` | Pause autoplay on mouse hover |
|
|
79
|
+
| `show-buttons` | `boolean` | `true` | Show prev/next navigation buttons |
|
|
80
|
+
| `show-dots` | `boolean` | `true` | Show dot indicators |
|
|
81
|
+
| `orientation` | `"horizontal" \| "vertical"` | `"horizontal"` | Carousel orientation (v1: horizontal only) |
|
|
82
|
+
| `align` | `"start" \| "center" \| "end"` | `"center"` | Slide alignment in viewport |
|
|
83
|
+
| `slides-per-view` | `number` | `1` | Number of slides visible at once (v1: 1 only) |
|
|
84
|
+
| `gap` | `number` | - | Gap between slides in pixels (optional) |
|
|
85
|
+
| `disabled` | `boolean` | `false` | Disable all interactions |
|
|
86
|
+
|
|
87
|
+
## Events
|
|
88
|
+
|
|
89
|
+
| Event | Detail | Description |
|
|
90
|
+
|-------|--------|-------------|
|
|
91
|
+
| `rel-change` | `{ value: number }` | Fired when active slide changes |
|
|
92
|
+
|
|
93
|
+
## Keyboard Navigation
|
|
94
|
+
|
|
95
|
+
- **Arrow Left**: Go to previous slide
|
|
96
|
+
- **Arrow Right**: Go to next slide
|
|
97
|
+
- **Home**: Go to first slide
|
|
98
|
+
- **End**: Go to last slide
|
|
99
|
+
- **Tab**: Navigate through carousel controls
|
|
100
|
+
|
|
101
|
+
## CSS Parts
|
|
102
|
+
|
|
103
|
+
Use `::part()` to customize carousel appearance:
|
|
104
|
+
|
|
105
|
+
```css
|
|
106
|
+
rel-carousel::part(viewport) {
|
|
107
|
+
border-radius: 12px;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
rel-carousel::part(prev-button),
|
|
111
|
+
rel-carousel::part(next-button) {
|
|
112
|
+
background: rgba(0, 0, 0, 0.5);
|
|
113
|
+
color: white;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
rel-carousel::part(dot) {
|
|
117
|
+
width: 10px;
|
|
118
|
+
height: 10px;
|
|
119
|
+
}
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
Available parts:
|
|
123
|
+
- `viewport` - The carousel viewport container
|
|
124
|
+
- `track` - The sliding track container
|
|
125
|
+
- `prev-button` - Previous navigation button
|
|
126
|
+
- `next-button` - Next navigation button
|
|
127
|
+
- `dots` - Dots container
|
|
128
|
+
- `dot` - Individual dot indicator
|
|
129
|
+
|
|
130
|
+
## Accessibility
|
|
131
|
+
|
|
132
|
+
- Carousel uses `role="region"` with `aria-roledescription="carousel"`
|
|
133
|
+
- Each slide has proper ARIA labels
|
|
134
|
+
- Navigation buttons have descriptive `aria-label` attributes
|
|
135
|
+
- Supports keyboard navigation
|
|
136
|
+
- Respects `prefers-reduced-motion` user preference
|
|
137
|
+
|
|
138
|
+
## Styling
|
|
139
|
+
|
|
140
|
+
The component uses design tokens from the Reliability Design System. All colors, spacing, and typography are inherited from CSS variables.
|
|
141
|
+
|
|
142
|
+
Key tokens used:
|
|
143
|
+
- `--rel-colors-*` for colors
|
|
144
|
+
- `--rel-spacing-*` for spacing
|
|
145
|
+
- `--rel-shadows-*` for shadows
|
|
146
|
+
- `--rel-border-*` for borders
|
|
147
|
+
- Focus outline uses `--rel-colors-blue-primary`
|
|
148
|
+
- Active dot uses `--rel-colors-green-primary`
|
|
149
|
+
|
|
150
|
+
## Interaction
|
|
151
|
+
|
|
152
|
+
### Mouse/Touch Drag
|
|
153
|
+
- Click and drag to swipe between slides
|
|
154
|
+
- Threshold-based snap: swipe 20% of slide width to trigger navigation
|
|
155
|
+
- Smooth animation on release
|
|
156
|
+
|
|
157
|
+
### Autoplay
|
|
158
|
+
- Automatically advances slides at specified interval
|
|
159
|
+
- Pauses on hover (configurable via `pause-on-hover`)
|
|
160
|
+
- Pauses during manual interaction
|
|
161
|
+
- Resumes after interaction ends
|
|
162
|
+
|
|
163
|
+
### Reduced Motion
|
|
164
|
+
- Component respects `prefers-reduced-motion` media query
|
|
165
|
+
- Disables or reduces transitions when user prefers reduced motion
|
|
166
|
+
- Drag interactions remain functional but with instant snap
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./rel-carousel";
|