@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.
Files changed (146) hide show
  1. package/CHANGELOG.md +211 -49
  2. package/dist/components/rel-accordion/README.md +132 -132
  3. package/dist/components/rel-alert/README.md +145 -141
  4. package/dist/components/rel-autocomplete/README.md +156 -61
  5. package/dist/components/rel-avatar/README.md +116 -130
  6. package/dist/components/rel-badge/README.md +98 -93
  7. package/dist/components/rel-breadcrumb/README.md +96 -102
  8. package/dist/components/rel-button/README.md +160 -130
  9. package/dist/components/rel-calendar/README.md +109 -109
  10. package/dist/components/rel-card/README.md +75 -94
  11. package/dist/components/rel-cardmedia/README.md +100 -127
  12. package/dist/components/rel-carousel/README.md +184 -166
  13. package/dist/components/rel-checkbox/README.md +93 -75
  14. package/dist/components/rel-chip/README.md +132 -121
  15. package/dist/components/rel-container/README.md +107 -99
  16. package/dist/components/rel-date-picker/README.md +200 -289
  17. package/dist/components/rel-divider/README.md +78 -100
  18. package/dist/components/rel-drawer/README.md +187 -200
  19. package/dist/components/rel-kbd/README.md +141 -151
  20. package/dist/components/rel-menu/README.md +178 -151
  21. package/dist/components/rel-menubar/README.md +218 -329
  22. package/dist/components/rel-otp/README.md +170 -440
  23. package/dist/components/rel-pagination/README.md +100 -424
  24. package/dist/components/rel-popover/README.md +203 -568
  25. package/dist/components/rel-progress/README.md +88 -110
  26. package/dist/components/rel-radio/README.md +131 -138
  27. package/dist/components/rel-range-picker/README.md +162 -0
  28. package/dist/components/rel-resizable/README.md +199 -140
  29. package/dist/components/rel-segmented-button/README.md +155 -141
  30. package/dist/components/rel-select/README.md +154 -93
  31. package/dist/components/rel-sheet/README.md +168 -224
  32. package/dist/components/rel-skeleton/README.md +103 -0
  33. package/dist/components/rel-slider/README.md +130 -135
  34. package/dist/components/rel-snackbar/README.md +162 -134
  35. package/dist/components/rel-stepper/README.md +158 -160
  36. package/dist/components/rel-switch/README.md +108 -102
  37. package/dist/components/rel-tab/README.md +171 -163
  38. package/dist/components/rel-textfield/README.md +159 -69
  39. package/dist/components/rel-time-picker/README.md +122 -157
  40. package/dist/components/rel-toast/README.md +157 -148
  41. package/dist/components/rel-tooltip/README.md +108 -111
  42. package/dist/components/rel-upload/README.md +220 -0
  43. package/dist/index.d.mts +1147 -340
  44. package/dist/index.d.ts +1147 -340
  45. package/dist/index.js +3451 -3163
  46. package/dist/index.js.map +1 -1
  47. package/dist/index.mjs +3416 -3118
  48. package/dist/index.mjs.map +1 -1
  49. package/dist/styles/vars.css +877 -866
  50. package/dist/{vars-XNMTSRVN.css → vars-JHTUGNRG.css} +877 -866
  51. package/package.json +3 -2
  52. package/dist/components/rel-accordion/rel-accordion.ts +0 -336
  53. package/dist/components/rel-alert/rel-alert.ts +0 -305
  54. package/dist/components/rel-autocomplete/rel-autocomplete.ts +0 -720
  55. package/dist/components/rel-avatar/rel-avatar.ts +0 -142
  56. package/dist/components/rel-badge/rel-badge.ts +0 -175
  57. package/dist/components/rel-breadcrumb/rel-breadcrumb.ts +0 -106
  58. package/dist/components/rel-button/rel-button.ts +0 -560
  59. package/dist/components/rel-calendar/index.ts +0 -1
  60. package/dist/components/rel-calendar/rel-calendar.ts +0 -565
  61. package/dist/components/rel-card/rel-card.ts +0 -88
  62. package/dist/components/rel-cardmedia/rel-cardmedia.ts +0 -88
  63. package/dist/components/rel-carousel/index.ts +0 -1
  64. package/dist/components/rel-carousel/rel-carousel.ts +0 -723
  65. package/dist/components/rel-chart/README.md +0 -286
  66. package/dist/components/rel-chart/index.ts +0 -1
  67. package/dist/components/rel-chart/rel-chart.ts +0 -754
  68. package/dist/components/rel-checkbox/rel-checkbox.ts +0 -382
  69. package/dist/components/rel-chip/rel-chip.ts +0 -483
  70. package/dist/components/rel-container/rel-container.ts +0 -95
  71. package/dist/components/rel-date-picker/date-format.test.ts +0 -43
  72. package/dist/components/rel-date-picker/date-format.ts +0 -47
  73. package/dist/components/rel-date-picker/date-parse.test.ts +0 -116
  74. package/dist/components/rel-date-picker/date-parse.ts +0 -178
  75. package/dist/components/rel-date-picker/index.ts +0 -1
  76. package/dist/components/rel-date-picker/rel-date-picker.ts +0 -1676
  77. package/dist/components/rel-divider/rel-divider.ts +0 -54
  78. package/dist/components/rel-drawer/index.ts +0 -1
  79. package/dist/components/rel-drawer/rel-drawer-footer.ts +0 -27
  80. package/dist/components/rel-drawer/rel-drawer.ts +0 -607
  81. package/dist/components/rel-kbd/rel-kbd.ts +0 -188
  82. package/dist/components/rel-layout/rel-layout.ts +0 -49
  83. package/dist/components/rel-menu/rel-menu.ts +0 -541
  84. package/dist/components/rel-menubar/index.ts +0 -2
  85. package/dist/components/rel-menubar/rel-menubar-menu.css +0 -3
  86. package/dist/components/rel-menubar/rel-menubar-menu.ts +0 -17
  87. package/dist/components/rel-menubar/rel-menubar.ts +0 -777
  88. package/dist/components/rel-nav-menu/README.md +0 -289
  89. package/dist/components/rel-nav-menu/index.ts +0 -3
  90. package/dist/components/rel-nav-menu/rel-nav-menu-item.ts +0 -243
  91. package/dist/components/rel-nav-menu/rel-nav-menu-panel.ts +0 -72
  92. package/dist/components/rel-nav-menu/rel-nav-menu.ts +0 -270
  93. package/dist/components/rel-navbar/README.md +0 -126
  94. package/dist/components/rel-navbar/rel-navbar.ts +0 -105
  95. package/dist/components/rel-otp/index.ts +0 -1
  96. package/dist/components/rel-otp/rel-otp.ts +0 -527
  97. package/dist/components/rel-pagination/index.ts +0 -1
  98. package/dist/components/rel-pagination/rel-pagination.ts +0 -522
  99. package/dist/components/rel-popover/index.ts +0 -2
  100. package/dist/components/rel-popover/rel-popover-content.ts +0 -81
  101. package/dist/components/rel-popover/rel-popover.ts +0 -475
  102. package/dist/components/rel-progress/rel-progress.ts +0 -234
  103. package/dist/components/rel-radio/rel-radio.ts +0 -481
  104. package/dist/components/rel-range-picker/rel-range-picker.ts +0 -1688
  105. package/dist/components/rel-resizable/index.ts +0 -3
  106. package/dist/components/rel-resizable/rel-resizable-group.ts +0 -405
  107. package/dist/components/rel-resizable/rel-resizable-handle.ts +0 -150
  108. package/dist/components/rel-resizable/rel-resizable-panel.ts +0 -58
  109. package/dist/components/rel-segmented-button/rel-segmented-button.ts +0 -217
  110. package/dist/components/rel-select/rel-select.ts +0 -1416
  111. package/dist/components/rel-sheet/rel-sheet.ts +0 -610
  112. package/dist/components/rel-sidebar/README.md +0 -209
  113. package/dist/components/rel-sidebar/rel-sidebar.ts +0 -1191
  114. package/dist/components/rel-skeleton/rel-skeleton.ts +0 -143
  115. package/dist/components/rel-slider/rel-slider.ts +0 -673
  116. package/dist/components/rel-snackbar/rel-snackbar.ts +0 -329
  117. package/dist/components/rel-stepper/rel-stepper.ts +0 -567
  118. package/dist/components/rel-switch/rel-switch.ts +0 -199
  119. package/dist/components/rel-tab/rel-tab.ts +0 -264
  120. package/dist/components/rel-table/README.md +0 -178
  121. package/dist/components/rel-table/rel-table-body.ts +0 -22
  122. package/dist/components/rel-table/rel-table-caption.ts +0 -30
  123. package/dist/components/rel-table/rel-table-cell.ts +0 -43
  124. package/dist/components/rel-table/rel-table-footer.ts +0 -24
  125. package/dist/components/rel-table/rel-table-head.ts +0 -47
  126. package/dist/components/rel-table/rel-table-header.ts +0 -22
  127. package/dist/components/rel-table/rel-table-row.ts +0 -37
  128. package/dist/components/rel-table/rel-table.ts +0 -62
  129. package/dist/components/rel-textfield/rel-textfield.ts +0 -1054
  130. package/dist/components/rel-time-picker/rel-time-picker.ts +0 -1482
  131. package/dist/components/rel-time-picker/time-parse.test.ts +0 -67
  132. package/dist/components/rel-time-picker/time-parse.ts +0 -85
  133. package/dist/components/rel-toast/rel-toast.ts +0 -206
  134. package/dist/components/rel-tooltip/rel-tooltip.ts +0 -193
  135. package/dist/components/rel-topbar/rel-topbar-actions.ts +0 -27
  136. package/dist/components/rel-topbar/rel-topbar-brand.ts +0 -54
  137. package/dist/components/rel-topbar/rel-topbar-dropdown-item.ts +0 -69
  138. package/dist/components/rel-topbar/rel-topbar-dropdown.ts +0 -31
  139. package/dist/components/rel-topbar/rel-topbar-item.ts +0 -324
  140. package/dist/components/rel-topbar/rel-topbar-mobile-panel.ts +0 -27
  141. package/dist/components/rel-topbar/rel-topbar-profile.ts +0 -243
  142. package/dist/components/rel-topbar/rel-topbar-utilities.ts +0 -27
  143. package/dist/components/rel-topbar/rel-topbar.ts +0 -446
  144. package/dist/components/rel-upload/UPLOAD-DESIGN-CHANGES.md +0 -134
  145. package/dist/components/rel-upload/rel-upload-actions.ts +0 -163
  146. package/dist/components/rel-upload/rel-upload.ts +0 -968
@@ -1,121 +1,132 @@
1
- # rel-chip
2
-
3
- ## Overview
4
- A compact chip component for displaying tags, labels, or selected options. Supports multiple color tones, avatar/icon decorations, outline variants, and removable functionality. Automatically hides when removed via the `removed` reflected attribute.
5
-
6
- ## Usage
7
- ```html
8
- <!-- Basic chip -->
9
- <rel-chip label="Active"></rel-chip>
10
-
11
- <!-- Colored tones -->
12
- <rel-chip label="Info" tone="blue"></rel-chip>
13
- <rel-chip label="Warning" tone="yellow"></rel-chip>
14
- <rel-chip label="Error" tone="red"></rel-chip>
15
- <rel-chip label="Success" tone="green"></rel-chip>
16
-
17
- <!-- Outline variant -->
18
- <rel-chip label="Outline Style" tone="blue" outline></rel-chip>
19
-
20
- <!-- Small size variant -->
21
- <rel-chip label="Small" size="sm" tone="blue"></rel-chip>
22
-
23
- <!-- With avatar -->
24
- <rel-chip id="avatarChip" label="John Doe" avatar="./user.jpg"></rel-chip>
25
-
26
- <!-- With leading icon (SVG string via JS) -->
27
- <rel-chip id="iconChip" label="Tagged"></rel-chip>
28
- <script>
29
- const chip = document.getElementById('iconChip');
30
- chip.leadingIcon = '<svg viewBox="0 0 16 16"><path d="M8 0l2 6h6l-5 4 2 6-5-4-5 4 2-6-5-4h6z"/></svg>';
31
- </script>
32
-
33
- <!-- Removable chip -->
34
- <rel-chip id="removableChip" label="Removable" removable></rel-chip>
35
- <script>
36
- const removableChip = document.getElementById('removableChip');
37
- removableChip.addEventListener('removed', () => {
38
- console.log('Chip was removed');
39
- });
40
- </script>
41
- ```
42
-
43
- ## API
44
-
45
- ### Attributes/Properties
46
- | Name | Type | Default | Description |
47
- |------|------|---------|-------------|
48
- | `label` | `string` | `"Label"` | Text displayed on the chip |
49
- | `size` (reflected) | `"sm" \| "md"` | `"md"` | Chip size variant |
50
- | `tone` | `"default" \| "blue" \| "yellow" \| "red" \| "green"` | `"default"` | Color tone variant |
51
- | `leadingIcon` | `string` | - | SVG or HTML string for leading icon |
52
- | `trailingIcon` | `string` | - | SVG or HTML string for trailing icon |
53
- | `avatar` | `string` | - | Image URL for avatar (circular image before label) |
54
- | `removable` | `boolean` | `false` | Shows a remove button (✕) |
55
- | `outline` | `boolean` | `false` | Applies outline styling (transparent background) |
56
- | `removed` | `boolean` (reflected) | `false` | When true, component hides via `:host([removed])` |
57
-
58
- ## Events
59
- | Event | Detail | Description |
60
- |-------|--------|-------------|
61
- | `removed` | None | Fired when the remove button is clicked (sets `removed` to true) |
62
-
63
- ## Slots
64
- Default slot not used.
65
-
66
- ## CSS Parts
67
- None exposed.
68
-
69
- ## Tokens / CSS Variables
70
-
71
- ### Semantic Tokens
72
- - `--rel-fonts-font-family` - Font family
73
- - `--rel-body-md-regular-font-size` - Font size
74
- - `--rel-fonts-weight-body-medium` - Font weight
75
-
76
- ### Spacing Tokens
77
- - `--rel-spacing-2xs` - Padding and internal gaps
78
- - `--rel-spacing-sm` - Horizontal padding
79
- - `--rel-spacing-3xs` - Remove button margin
80
-
81
- ### Color Tokens (by tone)
82
- - **default**: `--rel-border-default` (background), `--rel-text-default` (text)
83
- - **blue**: `--rel-text-info` (background), `--rel-bg-surface` (text)
84
- - **yellow**: `--rel-bg-warning` (background), `--rel-text-default` (text)
85
- - **red**: `--rel-text-danger` (background), `--rel-bg-surface` (text)
86
- - **green**: `--rel-text-success` (background), `--rel-bg-surface` (text)
87
-
88
- ### Border & Shadow Tokens
89
- - `--rel-border-radius-full-rounded` - Border radius (pill shape)
90
- - `--rel-stroke-sm` - Border width (used in outline mode)
91
- - `--rel-shadows-shadow-100` - Hover shadow
92
- - `--rel-bg-info` - Focus outline color
93
-
94
- ## Accessibility
95
- - Uses `role="button"` and `tabindex="0"` on the main chip element
96
- - `aria-label` set to the chip's label
97
- - Remove button has proper `aria-label="Remove {label}"`
98
- - Focus visible states on chip and remove button with distinct outlines
99
- - Remove button focus uses white outline for contrast against colored backgrounds
100
-
101
- ### Keyboard Interactions
102
- - `Tab` - Focus the chip (or remove button if present)
103
- - No built-in activation behavior on Enter/Space (purely informational/decorative)
104
-
105
- ### Focus Behavior
106
- - Chip focus: 2px blue outline with 2px offset
107
- - Remove button focus: 2px white outline with 1px offset
108
-
109
- ## Notes / Edge Cases
110
- - **Size variants**:
111
- - **md** (default): `--rel-body-md-regular-font-size` text, `--rel-spacing-2xs`/`--rel-spacing-xs` padding, 20px × 20px avatar, 16px × 16px icons
112
- - **sm**: `--rel-body-sm-regular-font-size` text, `--rel-spacing-3xs`/`--rel-spacing-2xs` padding, 16px × 16px avatar, 12px × 12px icons
113
- - Icons (`leadingIcon`, `trailingIcon`) must be passed as raw HTML/SVG strings via JavaScript (see examples)
114
- - Icons are injected using `renderIcon()` which creates a template element and clones the content
115
- - Avatar images are 20px × 20px circular (`border-radius: 50%`, `object-fit: cover`)
116
- - When `removed` is set to `true`, the component applies `display: none` via `:host([removed])`
117
- - `removed` is a reflected attribute, meaning it appears in the HTML when true
118
- - Clicking the remove button stops propagation to prevent triggering chip-level click handlers
119
- - **Outline mode** removes the background color but keeps the same text color
120
- - Hover effect applies `filter: brightness(0.92)` and box-shadow
121
- - The component is `display: inline-block`, so chips flow inline by default
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
- ## Overview
4
- A versatile container component providing configurable padding, background colors, and optional shadow. Ideal for wrapping content sections with consistent spacing and theming.
5
-
6
- ## Usage
7
- ```html
8
- <!-- Default container (white background, medium padding) -->
9
- <rel-container>
10
- <h2>Section Title</h2>
11
- <p>Content goes here</p>
12
- </rel-container>
13
-
14
- <!-- Light background with small padding -->
15
- <rel-container background="light" padding="sm">
16
- <p>Compact section with light background</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 background -->
26
- <rel-container background="none">
27
- <div>Content with transparent background</div>
28
- </rel-container>
29
-
30
- <!-- All options combined -->
31
- <rel-container background="white" padding="md" shadow>
32
- <h3>Card-like Container</h3>
33
- <p>White background, medium padding, with shadow</p>
34
- </rel-container>
35
- ```
36
-
37
- ## API
38
-
39
- ### Attributes/Properties
40
- | Name | Type | Default | Description |
41
- |------|------|---------|-------------|
42
- | `padding` | `"sm" \| "md" \| "lg"` | `"md"` | Padding size variant |
43
- | `shadow` | `boolean` | `false` | Enable box shadow |
44
- | `background` | `"light" \| "white" \| "none"` | `"white"` | Background color variant |
45
-
46
- ## Events
47
- None.
48
-
49
- ## Slots
50
- | Slot | Description |
51
- |------|-------------|
52
- | (default) | Container content (any HTML elements) |
53
-
54
- ## CSS Parts
55
- None exposed.
56
-
57
- ## Tokens / CSS Variables
58
-
59
- ### Color Tokens
60
- - `--rel-bg-surface` - White background color
61
- - `--rel-bg-surface-elevated` - Light background color
62
-
63
- ### Shadow Tokens
64
- - `--rel-shadows-shadow-300` - Shadow when `shadow` is true
65
-
66
- ### Border Tokens
67
- - `--rel-border-radius-sm` - Container border radius
68
-
69
- ### Spacing Tokens
70
- - `--rel-spacing-xs` - Small padding
71
- - `--rel-spacing-md` - Medium padding
72
- - `--rel-spacing-2xl` - Large padding
73
-
74
- ## Accessibility
75
- - Purely presentational container, no specific accessibility features
76
- - Ensure slotted content includes proper semantic HTML
77
-
78
- ### Keyboard Interactions
79
- - None (purely presentational container)
80
-
81
- ### Focus Behavior
82
- - No specific focus handling
83
-
84
- ## Notes / Edge Cases
85
- - **Padding variants**:
86
- - **sm**: Uses `--rel-spacing-xs`
87
- - **md**: Uses `--rel-spacing-md`
88
- - **lg**: Uses `--rel-spacing-2xl`
89
-
90
- - **Background variants**:
91
- - **white**: White background (`--rel-bg-surface`)
92
- - **light**: Light gray background (`--rel-bg-surface-elevated`)
93
- - **none**: Transparent background
94
-
95
- - The component is `display: block` and `width: 100%` with `box-sizing: border-box`
96
- - All styles are applied to an internal `.reliability-container` div
97
- - The border-radius is always applied regardless of background variant
98
- - The shadow is applied via the `--rel-shadows-shadow-300` token when `shadow` is true
99
- - Slotted content inherits the padding and background from the container
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.