@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,94 +1,75 @@
|
|
|
1
|
-
# rel-card
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
```html
|
|
8
|
-
<!--
|
|
9
|
-
<rel-card>
|
|
10
|
-
<h3>
|
|
11
|
-
<p>
|
|
12
|
-
</rel-card>
|
|
13
|
-
|
|
14
|
-
<!--
|
|
15
|
-
<rel-card>
|
|
16
|
-
<
|
|
17
|
-
<
|
|
18
|
-
<p>
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
<
|
|
24
|
-
<rel-card>
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
## Slots
|
|
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
|
-
- The card
|
|
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-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
|
|
1
|
+
# rel-card
|
|
2
|
+
|
|
3
|
+
`<rel-card>` is an elevated, padded surface that groups related content — the Figma "Card" component. `type="custom"` (the default) pads whatever you slot in and applies the Figma card typography to slotted headings and paragraphs; `type="media"` adds a flush media region above the body, meant for a `<rel-card-media>` image header. Use it for dashboard tiles, summary blocks and list items that pair a title with body copy. It is a static container with no interaction of its own — for transient content use `rel-modal` or `rel-drawer` instead, and for a surface with its own tone/elevation variants use `rel-container`.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
```html
|
|
8
|
+
<!-- Default type: padded body -->
|
|
9
|
+
<rel-card>
|
|
10
|
+
<h3>Shipment 4821</h3>
|
|
11
|
+
<p>Departed Dallas · ETA Thursday 14:00</p>
|
|
12
|
+
</rel-card>
|
|
13
|
+
|
|
14
|
+
<!-- Media type: flush image header via <rel-card-media> in the "media" slot -->
|
|
15
|
+
<rel-card type="media">
|
|
16
|
+
<rel-card-media slot="media" image-src="/img/warehouse.jpg" image-alt="Warehouse floor"></rel-card-media>
|
|
17
|
+
<h3>Dallas hub</h3>
|
|
18
|
+
<p>12 dock doors · 24/7 operations</p>
|
|
19
|
+
</rel-card>
|
|
20
|
+
|
|
21
|
+
<!-- Cards in a grid -->
|
|
22
|
+
<div style="display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px;">
|
|
23
|
+
<rel-card><h4>On time</h4><p>98.2%</p></rel-card>
|
|
24
|
+
<rel-card><h4>Damage-free</h4><p>99.7%</p></rel-card>
|
|
25
|
+
<rel-card><h4>Claims</h4><p>3 open</p></rel-card>
|
|
26
|
+
</div>
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
<!-- readme-gen:start -->
|
|
30
|
+
|
|
31
|
+
<!-- Generated from rel-card.ts — do not edit; run readme-generate.mjs -->
|
|
32
|
+
|
|
33
|
+
## API
|
|
34
|
+
|
|
35
|
+
### Attributes / Properties
|
|
36
|
+
|
|
37
|
+
| Property | Attribute | Type | Default | Description |
|
|
38
|
+
| --- | --- | --- | --- | --- |
|
|
39
|
+
| `type` | `type` | `"custom" \| "media"` | `"custom"` | Figma "Type" axis: custom (default) renders slotted content with card padding; media adds a flush media region (slot name="media") above the content — pair it with <rel-card-media>. Reflected. |
|
|
40
|
+
|
|
41
|
+
## Events
|
|
42
|
+
|
|
43
|
+
| Event | Detail | Bubbles / composed | Description |
|
|
44
|
+
| --- | --- | --- | --- |
|
|
45
|
+
| — | — | — | This element emits no custom events. |
|
|
46
|
+
|
|
47
|
+
## Slots
|
|
48
|
+
|
|
49
|
+
| Slot | Description |
|
|
50
|
+
| --- | --- |
|
|
51
|
+
| (default) | Card body; slotted headings and paragraphs receive the Figma card typography |
|
|
52
|
+
| `media` | Flush media region above the body; rendered only when `type="media"` |
|
|
53
|
+
|
|
54
|
+
## CSS Parts
|
|
55
|
+
|
|
56
|
+
| Part | Description |
|
|
57
|
+
| --- | --- |
|
|
58
|
+
| `base` | The outer elevated card surface |
|
|
59
|
+
| `header` | The media region wrapper (present only when `type="media"`) |
|
|
60
|
+
| `content` | The padded body that wraps the default slot |
|
|
61
|
+
|
|
62
|
+
<!-- readme-gen:end -->
|
|
63
|
+
|
|
64
|
+
## Accessibility
|
|
65
|
+
|
|
66
|
+
- The card sets no ARIA role — it is a generic container (`display: block`), so the accessible structure comes entirely from the slotted content. Use real headings (`<h2>`–`<h4>`) and paragraphs inside it; they also pick up the card typography.
|
|
67
|
+
- The host is not focusable and has no keyboard handling. Interactive children (links, `rel-button`) keep their own focus order and must be keyboard-reachable on their own.
|
|
68
|
+
- A `<rel-card-media>` in the `media` slot carries the image's alt text via its `image-alt` attribute; leave it empty only for purely decorative imagery.
|
|
69
|
+
|
|
70
|
+
## Notes / Edge Cases
|
|
71
|
+
|
|
72
|
+
- `type="media"` removes the card's own padding and clips overflow so the media sits flush against the rounded border; the body (`content` part) keeps the standard padding. Content placed in the `media` slot without `type="media"` is not rendered, because the slot only exists in that mode.
|
|
73
|
+
- The `header` part exists only while `type="media"`; `::part(header)` matches nothing otherwise.
|
|
74
|
+
- Slotted `h1`–`h4` and `p` elements get the Figma card roles (heading md / body lg) with their default margins reset; wrap other content in your own elements to style it.
|
|
75
|
+
- The card is elevated with Figma's `shadow/sm` and draws no border, in both light and dark themes. There is no hover lift or transition.
|
|
@@ -1,127 +1,100 @@
|
|
|
1
|
-
# rel-card-media
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
```html
|
|
8
|
-
<!--
|
|
9
|
-
<rel-card-media
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
title="
|
|
13
|
-
subtitle="
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
<!-- With
|
|
17
|
-
<rel-card-media
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
title="
|
|
21
|
-
subtitle="$99.99"
|
|
22
|
-
|
|
23
|
-
<
|
|
24
|
-
</rel-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
<rel-card-media
|
|
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
|
-
## 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
|
|
1
|
+
# rel-card-media
|
|
2
|
+
|
|
3
|
+
Media card (element `<rel-card-media>`, folder `rel-cardmedia`): a bordered surface with an optional full-width image on top, then a title (`<h3>`), a subtitle and a slotted body inside a padded content area. Use it for previews that lead with an image — articles, products, gallery tiles. Use `rel-card` when you need a free-form layout or no image section.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
```html
|
|
8
|
+
<!-- Image, title, subtitle -->
|
|
9
|
+
<rel-card-media
|
|
10
|
+
image-src="/images/lake.jpg"
|
|
11
|
+
image-alt="A mountain lake at sunrise"
|
|
12
|
+
title="Alpine lakes"
|
|
13
|
+
subtitle="12 photos"
|
|
14
|
+
></rel-card-media>
|
|
15
|
+
|
|
16
|
+
<!-- With slotted body content -->
|
|
17
|
+
<rel-card-media
|
|
18
|
+
image-src="/images/headphones.jpg"
|
|
19
|
+
image-alt="Over-ear headphones"
|
|
20
|
+
title="Studio headphones"
|
|
21
|
+
subtitle="$99.99"
|
|
22
|
+
>
|
|
23
|
+
<p>Closed-back, 40 mm drivers, detachable cable.</p>
|
|
24
|
+
<rel-button variant="primary" size="small">Add to cart</rel-button>
|
|
25
|
+
</rel-card-media>
|
|
26
|
+
|
|
27
|
+
<!-- No image: just the content area -->
|
|
28
|
+
<rel-card-media title="Text-only card" subtitle="No image provided">
|
|
29
|
+
<p>Body copy goes in the default slot.</p>
|
|
30
|
+
</rel-card-media>
|
|
31
|
+
|
|
32
|
+
<!-- Gallery grid -->
|
|
33
|
+
<div style="display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px;">
|
|
34
|
+
<rel-card-media image-src="/images/1.jpg" image-alt="" title="Item 1"></rel-card-media>
|
|
35
|
+
<rel-card-media image-src="/images/2.jpg" image-alt="" title="Item 2"></rel-card-media>
|
|
36
|
+
<rel-card-media image-src="/images/3.jpg" image-alt="" title="Item 3"></rel-card-media>
|
|
37
|
+
</div>
|
|
38
|
+
|
|
39
|
+
<!-- Restyle through parts -->
|
|
40
|
+
<style>
|
|
41
|
+
.flat::part(base) {
|
|
42
|
+
border: none;
|
|
43
|
+
}
|
|
44
|
+
.flat::part(content) {
|
|
45
|
+
padding: 24px;
|
|
46
|
+
}
|
|
47
|
+
</style>
|
|
48
|
+
<rel-card-media class="flat" title="Flat card"></rel-card-media>
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
<!-- readme-gen:start -->
|
|
52
|
+
|
|
53
|
+
<!-- Generated from rel-cardmedia.ts — do not edit; run readme-generate.mjs -->
|
|
54
|
+
|
|
55
|
+
## API
|
|
56
|
+
|
|
57
|
+
### Attributes / Properties
|
|
58
|
+
|
|
59
|
+
| Property | Attribute | Type | Default | Description |
|
|
60
|
+
| --- | --- | --- | --- | --- |
|
|
61
|
+
| `imageSrc` | `image-src` | `string` | `""` | URL of the hero image shown full-width at the top of the card. Empty (the default) omits the image section entirely. |
|
|
62
|
+
| `imageAlt` | `image-alt` | `string` | `"Card image"` | Alternative text for the hero image. Replace the generic default with a real description, or an empty string for purely decorative images. |
|
|
63
|
+
| `title` | `title` | `string` | `""` | Heading rendered as an `<h3>` above the subtitle; empty omits it. Note this is also the native `title` attribute, so a value shows as a browser tooltip on hover. |
|
|
64
|
+
| `subtitle` | `subtitle` | `string` | `""` | Secondary line rendered as a paragraph under the title; empty omits it. |
|
|
65
|
+
|
|
66
|
+
## Events
|
|
67
|
+
|
|
68
|
+
| Event | Detail | Bubbles / composed | Description |
|
|
69
|
+
| --- | --- | --- | --- |
|
|
70
|
+
| — | — | — | This element emits no custom events. |
|
|
71
|
+
|
|
72
|
+
## Slots
|
|
73
|
+
|
|
74
|
+
| Slot | Description |
|
|
75
|
+
| --- | --- |
|
|
76
|
+
| (default) | Body content rendered inside the padded content area below the title and subtitle. |
|
|
77
|
+
|
|
78
|
+
## CSS Parts
|
|
79
|
+
|
|
80
|
+
| Part | Description |
|
|
81
|
+
| --- | --- |
|
|
82
|
+
| `base` | The outer bordered card surface (background, border, radius, overflow clip). |
|
|
83
|
+
| `icon` | The image wrapper above the content, rendered only when `image-src` is set. |
|
|
84
|
+
| `content` | The padded area holding the title, subtitle and slotted body. |
|
|
85
|
+
|
|
86
|
+
<!-- readme-gen:end -->
|
|
87
|
+
|
|
88
|
+
## Accessibility
|
|
89
|
+
|
|
90
|
+
- The image renders as an `<img>` whose `alt` is `image-alt`; the default "Card image" is a placeholder — supply a real description, or an empty `image-alt=""` when the picture is decorative.
|
|
91
|
+
- The title is a real `<h3>`; make sure that fits the page's heading outline (there is no way to change the level).
|
|
92
|
+
- The card itself is a non-focusable container with no keyboard handling. Slotted controls (buttons, links) keep their own focus and keyboard behaviour.
|
|
93
|
+
|
|
94
|
+
## Notes / Edge Cases
|
|
95
|
+
|
|
96
|
+
- **Attribute spellings are kebab-case**: `image-src` and `image-alt`. Setting `imageSrc="…"` as an HTML attribute does nothing; use the property in code (`el.imageSrc = …`).
|
|
97
|
+
- **`title` is also the native tooltip attribute.** Because the property maps to the global `title` attribute, hovering the card shows the title text as a browser tooltip.
|
|
98
|
+
- The image section (`icon` part) is omitted entirely when `image-src` is empty; the title and subtitle are likewise omitted when empty, so the content area may hold only slotted children.
|
|
99
|
+
- The image is `width: 100%; height: auto; object-fit: cover` and the card clips overflow, so the top corners follow the card radius.
|
|
100
|
+
- The card is static: no hover lift, shadow or transition is applied.
|