@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,121 +1,132 @@
|
|
|
1
|
-
# rel-chip
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
```html
|
|
8
|
-
<!-- Basic chip -->
|
|
9
|
-
<rel-chip label="Active"></rel-chip>
|
|
10
|
-
|
|
11
|
-
<!--
|
|
12
|
-
<rel-chip label="Info" tone="
|
|
13
|
-
<rel-chip label="Warning" tone="
|
|
14
|
-
<rel-chip label="Error" tone="
|
|
15
|
-
<rel-chip label="Success" tone="
|
|
16
|
-
|
|
17
|
-
<!--
|
|
18
|
-
<rel-chip label="
|
|
19
|
-
|
|
20
|
-
<!--
|
|
21
|
-
<rel-chip label="Small" size="sm"
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
<
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
-
|
|
1
|
+
# rel-chip
|
|
2
|
+
|
|
3
|
+
`<rel-chip>` is the compact chip from the Figma "Chip" component: a short label with tone × variant colouring, an optional leading icon or initials avatar, an optional trailing icon, a remove control and opt-in drag-and-drop. Use it for tags, active filters, selected values in a multi-select and small status labels. Do not use it as a general button (use `rel-button`) or for status counts (use `rel-badge`); for long-lived toggles use `rel-switch` or `rel-checkbox`.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
```html
|
|
8
|
+
<!-- Basic chip (tone="neutral" variant="fill" size="md" border="default") -->
|
|
9
|
+
<rel-chip label="Active"></rel-chip>
|
|
10
|
+
|
|
11
|
+
<!-- Tones -->
|
|
12
|
+
<rel-chip label="Info" tone="info"></rel-chip>
|
|
13
|
+
<rel-chip label="Warning" tone="warning"></rel-chip>
|
|
14
|
+
<rel-chip label="Error" tone="danger"></rel-chip>
|
|
15
|
+
<rel-chip label="Success" tone="success"></rel-chip>
|
|
16
|
+
|
|
17
|
+
<!-- Subtle variant: tinted background, tone-coloured text -->
|
|
18
|
+
<rel-chip label="Subtle" tone="info" variant="subtle"></rel-chip>
|
|
19
|
+
|
|
20
|
+
<!-- Sizes -->
|
|
21
|
+
<rel-chip label="Small" size="sm"></rel-chip>
|
|
22
|
+
<rel-chip label="Medium" size="md"></rel-chip>
|
|
23
|
+
<rel-chip label="Large" size="lg"></rel-chip>
|
|
24
|
+
|
|
25
|
+
<!-- Fully rounded corners -->
|
|
26
|
+
<rel-chip label="Rounded" border="rounded"></rel-chip>
|
|
27
|
+
|
|
28
|
+
<!-- Leading / trailing icons (icon dictionary names, rendered via <rel-icon>) -->
|
|
29
|
+
<rel-chip label="Settings" leading-icon="settings"></rel-chip>
|
|
30
|
+
<rel-chip label="Next" trailing-icon="chevron-right"></rel-chip>
|
|
31
|
+
|
|
32
|
+
<!-- Initials avatar (takes precedence over leading-icon) -->
|
|
33
|
+
<rel-chip label="John Doe" avatar="JD"></rel-chip>
|
|
34
|
+
|
|
35
|
+
<!-- Removable chip -->
|
|
36
|
+
<rel-chip id="removableChip" label="Removable" removable></rel-chip>
|
|
37
|
+
<script>
|
|
38
|
+
document.getElementById("removableChip").addEventListener("removed", () => {
|
|
39
|
+
console.log("Chip was removed");
|
|
40
|
+
});
|
|
41
|
+
</script>
|
|
42
|
+
|
|
43
|
+
<!-- Draggable chip: native drag-and-drop plus Left/Right arrow reordering -->
|
|
44
|
+
<rel-chip id="dragChip" label="Reorder me" draggable-chip></rel-chip>
|
|
45
|
+
<script>
|
|
46
|
+
document.getElementById("dragChip").addEventListener("chip-move", (e) => {
|
|
47
|
+
console.log("move", e.detail.direction); // -1 = left, 1 = right
|
|
48
|
+
});
|
|
49
|
+
</script>
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
<!-- readme-gen:start -->
|
|
53
|
+
|
|
54
|
+
<!-- Generated from rel-chip.ts — do not edit; run readme-generate.mjs -->
|
|
55
|
+
|
|
56
|
+
## API
|
|
57
|
+
|
|
58
|
+
### Attributes / Properties
|
|
59
|
+
|
|
60
|
+
| Property | Attribute | Type | Default | Description |
|
|
61
|
+
| --- | --- | --- | --- | --- |
|
|
62
|
+
| `label` | `label` | `string` | `"Label"` | Text shown in the chip; also its accessible name and the drag payload. |
|
|
63
|
+
| `tone` | `tone` | `"neutral" \| "danger" \| "warning" \| "success" \| "info"` | `"neutral"` | Colour tone (Figma Tone): `neutral`, `danger`, `warning`, `success` or `info`. Combined with `variant`. Reflected. |
|
|
64
|
+
| `variant` | `variant` | `"fill" \| "subtle"` | `"fill"` | Emphasis (Figma Variant): `fill` = solid tone background, `subtle` = tinted background with tone-coloured text. Reflected. |
|
|
65
|
+
| `size` | `size` | `"sm" \| "md" \| "lg"` | `"md"` | Height scale (Figma Size): `sm` 24px / body-sm, `md` 28px / body-md, `lg` 32px / body-lg. Icon size follows (12 / 14 / 16px). Reflected. |
|
|
66
|
+
| `border` | `border` | `"default" \| "rounded"` | `"default"` | Corner shape (Figma Border): `default` = 4px radius, `rounded` = fully rounded with 12px horizontal padding. Reflected. |
|
|
67
|
+
| `leadingIcon` | `leading-icon` | `string` | `undefined` | Icon name from the generated icon dictionary (e.g. "settings") — rendered via <rel-icon> before the label. Ignored when `avatar` is set. |
|
|
68
|
+
| `trailingIcon` | `trailing-icon` | `string` | `undefined` | Icon name from the generated icon dictionary, rendered after the label. |
|
|
69
|
+
| `avatar` | `avatar` | `string` | `undefined` | Initials text for the avatar (e.g. "JD"), rendered as a `<rel-avatar type="text">` before the label. Mutually exclusive with leadingIcon (avatar wins). |
|
|
70
|
+
| `removable` | `removable` | `boolean` | `false` | Shows a remove (close) button after the label; clicking it sets `removed` and fires `removed`. |
|
|
71
|
+
| `removed` | `removed` | `boolean` | `false` | `true` once the chip has been removed — the host is hidden via `:host([removed])`. Reflected so CSS and Angular can see it; reset to `false` to show the chip again. Reflected. |
|
|
72
|
+
| `draggableChip` | `draggable-chip` | `boolean` | `false` | Opt-in native drag-and-drop: sets `draggable="true"` on the host, shows the Figma "Dragged" state during a real drag gesture, and makes Left/Right arrow keys fire `chip-move`. |
|
|
73
|
+
|
|
74
|
+
## Events
|
|
75
|
+
|
|
76
|
+
| Event | Detail | Bubbles / composed | Description |
|
|
77
|
+
| --- | --- | --- | --- |
|
|
78
|
+
| `chip-move` | `{ direction: e.key === "ArrowLeft" ? -1 : 1 }` | bubbles / composed | Fired on Left/Right arrow keys when `draggable-chip` is set — the keyboard alternative to drag-and-drop; the container should reorder the chip. Detail: `{ direction: -1 \| 1 }` (-1 = left, 1 = right). |
|
|
79
|
+
| `removed` | — | bubbles / composed | Fired when the chip is removed via its remove button or Delete/Backspace (after `removed` is set to `true`). No detail. |
|
|
80
|
+
|
|
81
|
+
## Slots
|
|
82
|
+
|
|
83
|
+
| Slot | Description |
|
|
84
|
+
| --- | --- |
|
|
85
|
+
| — | This element has no slots. |
|
|
86
|
+
|
|
87
|
+
## CSS Parts
|
|
88
|
+
|
|
89
|
+
| Part | Description |
|
|
90
|
+
| --- | --- |
|
|
91
|
+
| `base` | The chip body (`.chip`) that carries size, tone, variant and border styling |
|
|
92
|
+
| `icon` | The leading `<rel-icon>` (rendered only when `leading-icon` is set and no avatar) |
|
|
93
|
+
| `label` | The label text |
|
|
94
|
+
|
|
95
|
+
## Tokens / CSS Variables
|
|
96
|
+
|
|
97
|
+
### Component hooks
|
|
98
|
+
|
|
99
|
+
Set these on the host (or an ancestor) to customise the element without touching design tokens.
|
|
100
|
+
|
|
101
|
+
| Custom property | Default | Description |
|
|
102
|
+
| --- | --- | --- |
|
|
103
|
+
| `--rel-chip-focus-ring` | `var(--rel-border-focus)` | Colour of the keyboard focus outline; default `var(--rel-border-focus)` |
|
|
104
|
+
|
|
105
|
+
<!-- readme-gen:end -->
|
|
106
|
+
|
|
107
|
+
## Accessibility
|
|
108
|
+
|
|
109
|
+
- The chip body is a `<span role="button" tabindex="0">` whose `aria-label` is the `label` text. The shadow root uses `delegatesFocus`, so calling `focus()` on the host focuses that inner span.
|
|
110
|
+
- The remove control is a real `<button>` labelled `Remove {label}`; it is a second Tab stop after the chip body.
|
|
111
|
+
- Removing a chip (button or keyboard) calls the shared `announce()` helper with `"{label} removed"`, so screen readers hear the removal even though the chip disappears.
|
|
112
|
+
- Icons and the avatar are decorative; the accessible name comes only from `label`.
|
|
113
|
+
|
|
114
|
+
| Key | Action |
|
|
115
|
+
|-----|--------|
|
|
116
|
+
| `Tab` | Focus the chip body, then the remove button (when `removable`) |
|
|
117
|
+
| `Enter` / `Space` | Re-dispatches a `click` on the host so consumer `click` handlers run |
|
|
118
|
+
| `Delete` / `Backspace` | Removes the chip when `removable` (sets `removed`, fires `removed`) |
|
|
119
|
+
| `ArrowLeft` / `ArrowRight` | Fires `chip-move` with `direction: -1` / `1` when `draggable-chip` is set |
|
|
120
|
+
|
|
121
|
+
Focus is shown as a 1.5px outline in `--rel-chip-focus-ring` (defaults to `--rel-border-focus`) around the whole chip, plus an inner `--rel-border-focus-inner` ring, only for keyboard focus (`:focus-visible`). The remove button gets its own `currentColor` outline.
|
|
122
|
+
|
|
123
|
+
## Notes / Edge Cases
|
|
124
|
+
|
|
125
|
+
- `avatar` and `leading-icon` are mutually exclusive: when both are set the avatar wins and a console warning is logged. The avatar is a `rel-avatar type="text"` sized to fill the chip's content box — 16 / 20 / 24px for `sm` / `md` / `lg`, driven through `--rel-avatar-size` rather than the avatar's own `size` presets (the small chip needs 16px, below the 20px `xs` floor).
|
|
126
|
+
- The trailing icon has no CSS part; only the leading icon is exposed as `icon`.
|
|
127
|
+
- The remove `✕` is drawn at the same size as the leading/trailing icons (12 / 14 / 16px) and in the same colour as the label — it carries no opacity dulling, so it keeps the label's contrast ratio on the `subtle` tones.
|
|
128
|
+
- `border="rounded"` also widens the horizontal padding to 12px at every size, per the Figma spec.
|
|
129
|
+
- `removed` is reflected: once `true` the host is `display: none` via `:host([removed])`. Set it back to `false` to show the chip again. Clicking the remove button stops propagation, so chip-level `click` handlers do not fire on removal.
|
|
130
|
+
- `draggable-chip` sets the native `draggable="true"` attribute on the host and puts the label in `dataTransfer` as `text/plain`. During a real drag the host carries a `dragging` attribute that maps to the Figma "Dragged" state; the same look is used for `:active`. The component does not reorder anything itself — the container must handle `drop` / `chip-move`.
|
|
131
|
+
- The remove button has no hover state of its own; the hover/pressed colours belong to the whole chip (per-tone action tokens).
|
|
132
|
+
- The host is `display: inline-flex` with `flex: 0 0 auto`, so chips flow inline and never stretch in a flex row.
|
|
@@ -1,99 +1,107 @@
|
|
|
1
|
-
# rel-container
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
```html
|
|
8
|
-
<!-- Default
|
|
9
|
-
<rel-container>
|
|
10
|
-
<h2>Section
|
|
11
|
-
<p>Content goes here
|
|
12
|
-
</rel-container>
|
|
13
|
-
|
|
14
|
-
<!--
|
|
15
|
-
<rel-container
|
|
16
|
-
<p>Compact section
|
|
17
|
-
</rel-container>
|
|
18
|
-
|
|
19
|
-
<!-- Large padding with shadow -->
|
|
20
|
-
<rel-container padding="lg" shadow>
|
|
21
|
-
<h1>Hero
|
|
22
|
-
<p>With shadow elevation
|
|
23
|
-
</rel-container>
|
|
24
|
-
|
|
25
|
-
<!-- Transparent
|
|
26
|
-
<rel-container
|
|
27
|
-
<div>Content with
|
|
28
|
-
</rel-container>
|
|
29
|
-
|
|
30
|
-
<!--
|
|
31
|
-
<rel-container
|
|
32
|
-
<h3>Card-like
|
|
33
|
-
<p>
|
|
34
|
-
</rel-container>
|
|
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
|
-
- The
|
|
98
|
-
-
|
|
99
|
-
|
|
1
|
+
# rel-container
|
|
2
|
+
|
|
3
|
+
`<rel-container>` is the Figma "Container" surface block: a full-width, rounded wrapper with a `surface` fill (`default` page surface, `elevated` raised surface or `transparent`), a `padding` step and an optional `shadow`, plus default heading and paragraph typography for what you slot into it. Use it to group a section of a page or a settings panel on a consistent surface. It is a static layout primitive — for a bordered content card use `rel-card`, and for anything transient use `rel-modal` or `rel-drawer`.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
```html
|
|
8
|
+
<!-- Default: page surface, medium padding -->
|
|
9
|
+
<rel-container>
|
|
10
|
+
<h2>Section title</h2>
|
|
11
|
+
<p>Content goes here.</p>
|
|
12
|
+
</rel-container>
|
|
13
|
+
|
|
14
|
+
<!-- Elevated surface with small padding -->
|
|
15
|
+
<rel-container surface="elevated" padding="sm">
|
|
16
|
+
<p>Compact section on the raised surface.</p>
|
|
17
|
+
</rel-container>
|
|
18
|
+
|
|
19
|
+
<!-- Large padding with shadow -->
|
|
20
|
+
<rel-container padding="lg" shadow>
|
|
21
|
+
<h1>Hero section</h1>
|
|
22
|
+
<p>With shadow elevation.</p>
|
|
23
|
+
</rel-container>
|
|
24
|
+
|
|
25
|
+
<!-- Transparent surface: spacing only, no fill -->
|
|
26
|
+
<rel-container surface="transparent" padding="xl">
|
|
27
|
+
<div>Content with no background.</div>
|
|
28
|
+
</rel-container>
|
|
29
|
+
|
|
30
|
+
<!-- Everything combined -->
|
|
31
|
+
<rel-container surface="default" padding="md" shadow>
|
|
32
|
+
<h3>Card-like container</h3>
|
|
33
|
+
<p>Page surface, medium padding, shadow.</p>
|
|
34
|
+
</rel-container>
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### Deprecated aliases
|
|
38
|
+
|
|
39
|
+
```html
|
|
40
|
+
<!-- background="white|light|none" is the deprecated 1.4.6 spelling of surface="default|elevated|transparent".
|
|
41
|
+
Still supported; logs once per page:
|
|
42
|
+
[rel-container] "background" is deprecated and will be removed in 3.0 — use "surface" instead. Map: white → "default", light → "elevated", none → "transparent". -->
|
|
43
|
+
<rel-container background="light" padding="sm">
|
|
44
|
+
<p>Same as surface="elevated".</p>
|
|
45
|
+
</rel-container>
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
<!-- readme-gen:start -->
|
|
49
|
+
|
|
50
|
+
<!-- Generated from rel-container.ts — do not edit; run readme-generate.mjs -->
|
|
51
|
+
|
|
52
|
+
## API
|
|
53
|
+
|
|
54
|
+
### Attributes / Properties
|
|
55
|
+
|
|
56
|
+
| Property | Attribute | Type | Default | Description |
|
|
57
|
+
| --- | --- | --- | --- | --- |
|
|
58
|
+
| `padding` | `padding` | `"sm" \| "md" \| "lg" \| "xl"` | `"md"` | Inner padding step: `sm` = spacing-xs, `md` = spacing-md, `lg` = spacing-xl, `xl` = spacing-2xl. Reflected. |
|
|
59
|
+
| `shadow` | `shadow` | `boolean` | `false` | Adds the shadow-300 elevation box-shadow to the surface. |
|
|
60
|
+
| `surface` | `surface` | `"default" \| "elevated" \| "transparent"` | `undefined` | Surface fill: default (page surface) \| elevated (raised surface) \| transparent. Takes precedence over the deprecated `background` prop. Reflected. |
|
|
61
|
+
|
|
62
|
+
#### Deprecated (still supported — removal targeted for 3.0)
|
|
63
|
+
|
|
64
|
+
| Property | Attribute | Type | Use instead |
|
|
65
|
+
| --- | --- | --- | --- |
|
|
66
|
+
| `background` | `background` | `"light" \| "white" \| "none"` | Deprecated since 1.4.7 — use `surface` (white→default, light→elevated, none→transparent). |
|
|
67
|
+
|
|
68
|
+
### Public fields / accessors
|
|
69
|
+
|
|
70
|
+
| Name | Type | Description |
|
|
71
|
+
| --- | --- | --- |
|
|
72
|
+
| `resolvedSurface` | `ContainerSurface` | Resolved surface: explicit `surface` wins, else mapped `background`, else "default". |
|
|
73
|
+
|
|
74
|
+
## Events
|
|
75
|
+
|
|
76
|
+
| Event | Detail | Bubbles / composed | Description |
|
|
77
|
+
| --- | --- | --- | --- |
|
|
78
|
+
| — | — | — | This element emits no custom events. |
|
|
79
|
+
|
|
80
|
+
## Slots
|
|
81
|
+
|
|
82
|
+
| Slot | Description |
|
|
83
|
+
| --- | --- |
|
|
84
|
+
| (default) | Section content; slotted `h1`–`h4` get the headings-sm role and `p` the body-md role |
|
|
85
|
+
|
|
86
|
+
## CSS Parts
|
|
87
|
+
|
|
88
|
+
| Part | Description |
|
|
89
|
+
| --- | --- |
|
|
90
|
+
| `base` | The padded surface `<div>` (same element as `container`) |
|
|
91
|
+
| `container` | Alias of `base`, kept for existing `::part(container)` selectors |
|
|
92
|
+
|
|
93
|
+
<!-- readme-gen:end -->
|
|
94
|
+
|
|
95
|
+
## Accessibility
|
|
96
|
+
|
|
97
|
+
- The container sets no ARIA role and is not focusable; it is a generic `display: block` region with no keyboard handling. The accessible structure comes entirely from the slotted content, so use real headings and paragraphs (they also pick up the container typography) and wrap the whole thing in a `<section>` / `<article>` with a heading when it forms a landmark.
|
|
98
|
+
- `surface` and `shadow` are purely visual; nothing about the fill or elevation is conveyed to assistive technology.
|
|
99
|
+
|
|
100
|
+
## Notes / Edge Cases
|
|
101
|
+
|
|
102
|
+
- Padding steps map to spacing tokens: `sm` = `--rel-spacing-xs`, `md` = `--rel-spacing-md`, `lg` = `--rel-spacing-xl`, `xl` = `--rel-spacing-2xl`.
|
|
103
|
+
- Surface fills: `default` = `--rel-bg-surface`, `elevated` = `--rel-bg-surface-elevated`, `transparent` = no fill. The corner radius (`--rel-border-radius-sm`) is applied regardless of surface, and `shadow` adds `--rel-shadows-shadow-300`.
|
|
104
|
+
- `resolvedSurface` tells you which fill is in effect: an explicit `surface` wins, otherwise the deprecated `background` value is mapped (white → default, light → elevated, none → transparent), otherwise `default`.
|
|
105
|
+
- The inner `<div>` keeps the legacy class names `bg-white` / `bg-light` / `bg-none` for the three surfaces so existing test selectors keep matching; `::part(base)` and `::part(container)` both target that same element.
|
|
106
|
+
- Slotted `h1`–`h4` receive the headings-sm role with a bottom margin of `--rel-spacing-lg`; slotted `p` receives the body-md role with zero margin. Wrap other content in your own elements to style it.
|
|
107
|
+
- The host is `display: block; width: 100%` with `box-sizing: border-box`, so it fills its parent; constrain the parent, not the container.
|