@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.
Files changed (148) hide show
  1. package/CHANGELOG.md +246 -49
  2. package/dist/components/rel-accordion/README.md +133 -132
  3. package/dist/components/rel-alert/README.md +145 -141
  4. package/dist/components/rel-autocomplete/README.md +172 -61
  5. package/dist/components/rel-avatar/README.md +118 -130
  6. package/dist/components/rel-badge/README.md +97 -93
  7. package/dist/components/rel-breadcrumb/README.md +96 -102
  8. package/dist/components/rel-button/README.md +190 -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 +186 -166
  13. package/dist/components/rel-checkbox/README.md +96 -75
  14. package/dist/components/rel-chip/README.md +138 -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 +88 -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-layout/README.md +34 -0
  21. package/dist/components/rel-menu/README.md +180 -151
  22. package/dist/components/rel-menubar/README.md +218 -329
  23. package/dist/components/rel-otp/README.md +171 -440
  24. package/dist/components/rel-pagination/README.md +100 -424
  25. package/dist/components/rel-popover/README.md +203 -568
  26. package/dist/components/rel-progress/README.md +88 -110
  27. package/dist/components/rel-radio/README.md +131 -138
  28. package/dist/components/rel-range-picker/README.md +165 -0
  29. package/dist/components/rel-resizable/README.md +199 -140
  30. package/dist/components/rel-segmented-button/README.md +156 -141
  31. package/dist/components/rel-select/README.md +156 -93
  32. package/dist/components/rel-sheet/README.md +168 -224
  33. package/dist/components/rel-skeleton/README.md +104 -0
  34. package/dist/components/rel-slider/README.md +131 -135
  35. package/dist/components/rel-snackbar/README.md +168 -134
  36. package/dist/components/rel-stepper/README.md +162 -160
  37. package/dist/components/rel-switch/README.md +117 -102
  38. package/dist/components/rel-tab/README.md +173 -163
  39. package/dist/components/rel-textfield/README.md +176 -69
  40. package/dist/components/rel-time-picker/README.md +122 -157
  41. package/dist/components/rel-toast/README.md +165 -148
  42. package/dist/components/rel-tooltip/README.md +119 -111
  43. package/dist/components/rel-upload/README.md +220 -0
  44. package/dist/index.d.mts +1726 -447
  45. package/dist/index.d.ts +1726 -447
  46. package/dist/index.js +13715 -10870
  47. package/dist/index.js.map +1 -1
  48. package/dist/index.mjs +14018 -11163
  49. package/dist/index.mjs.map +1 -1
  50. package/dist/styles/focus-ring.ts +84 -0
  51. package/dist/styles/vars.css +892 -866
  52. package/dist/{vars-XNMTSRVN.css → vars-DXX6QOAG.css} +892 -866
  53. package/package.json +3 -2
  54. package/dist/components/rel-accordion/rel-accordion.ts +0 -336
  55. package/dist/components/rel-alert/rel-alert.ts +0 -305
  56. package/dist/components/rel-autocomplete/rel-autocomplete.ts +0 -720
  57. package/dist/components/rel-avatar/rel-avatar.ts +0 -142
  58. package/dist/components/rel-badge/rel-badge.ts +0 -175
  59. package/dist/components/rel-breadcrumb/rel-breadcrumb.ts +0 -106
  60. package/dist/components/rel-button/rel-button.ts +0 -560
  61. package/dist/components/rel-calendar/index.ts +0 -1
  62. package/dist/components/rel-calendar/rel-calendar.ts +0 -565
  63. package/dist/components/rel-card/rel-card.ts +0 -88
  64. package/dist/components/rel-cardmedia/rel-cardmedia.ts +0 -88
  65. package/dist/components/rel-carousel/index.ts +0 -1
  66. package/dist/components/rel-carousel/rel-carousel.ts +0 -723
  67. package/dist/components/rel-chart/README.md +0 -286
  68. package/dist/components/rel-chart/index.ts +0 -1
  69. package/dist/components/rel-chart/rel-chart.ts +0 -754
  70. package/dist/components/rel-checkbox/rel-checkbox.ts +0 -382
  71. package/dist/components/rel-chip/rel-chip.ts +0 -483
  72. package/dist/components/rel-container/rel-container.ts +0 -95
  73. package/dist/components/rel-date-picker/date-format.test.ts +0 -43
  74. package/dist/components/rel-date-picker/date-format.ts +0 -47
  75. package/dist/components/rel-date-picker/date-parse.test.ts +0 -116
  76. package/dist/components/rel-date-picker/date-parse.ts +0 -178
  77. package/dist/components/rel-date-picker/index.ts +0 -1
  78. package/dist/components/rel-date-picker/rel-date-picker.ts +0 -1676
  79. package/dist/components/rel-divider/rel-divider.ts +0 -54
  80. package/dist/components/rel-drawer/index.ts +0 -1
  81. package/dist/components/rel-drawer/rel-drawer-footer.ts +0 -27
  82. package/dist/components/rel-drawer/rel-drawer.ts +0 -607
  83. package/dist/components/rel-kbd/rel-kbd.ts +0 -188
  84. package/dist/components/rel-layout/rel-layout.ts +0 -49
  85. package/dist/components/rel-menu/rel-menu.ts +0 -541
  86. package/dist/components/rel-menubar/index.ts +0 -2
  87. package/dist/components/rel-menubar/rel-menubar-menu.css +0 -3
  88. package/dist/components/rel-menubar/rel-menubar-menu.ts +0 -17
  89. package/dist/components/rel-menubar/rel-menubar.ts +0 -777
  90. package/dist/components/rel-nav-menu/README.md +0 -289
  91. package/dist/components/rel-nav-menu/index.ts +0 -3
  92. package/dist/components/rel-nav-menu/rel-nav-menu-item.ts +0 -243
  93. package/dist/components/rel-nav-menu/rel-nav-menu-panel.ts +0 -72
  94. package/dist/components/rel-nav-menu/rel-nav-menu.ts +0 -270
  95. package/dist/components/rel-navbar/README.md +0 -126
  96. package/dist/components/rel-navbar/rel-navbar.ts +0 -105
  97. package/dist/components/rel-otp/index.ts +0 -1
  98. package/dist/components/rel-otp/rel-otp.ts +0 -527
  99. package/dist/components/rel-pagination/index.ts +0 -1
  100. package/dist/components/rel-pagination/rel-pagination.ts +0 -522
  101. package/dist/components/rel-popover/index.ts +0 -2
  102. package/dist/components/rel-popover/rel-popover-content.ts +0 -81
  103. package/dist/components/rel-popover/rel-popover.ts +0 -475
  104. package/dist/components/rel-progress/rel-progress.ts +0 -234
  105. package/dist/components/rel-radio/rel-radio.ts +0 -481
  106. package/dist/components/rel-range-picker/rel-range-picker.ts +0 -1688
  107. package/dist/components/rel-resizable/index.ts +0 -3
  108. package/dist/components/rel-resizable/rel-resizable-group.ts +0 -405
  109. package/dist/components/rel-resizable/rel-resizable-handle.ts +0 -150
  110. package/dist/components/rel-resizable/rel-resizable-panel.ts +0 -58
  111. package/dist/components/rel-segmented-button/rel-segmented-button.ts +0 -217
  112. package/dist/components/rel-select/rel-select.ts +0 -1416
  113. package/dist/components/rel-sheet/rel-sheet.ts +0 -610
  114. package/dist/components/rel-sidebar/README.md +0 -209
  115. package/dist/components/rel-sidebar/rel-sidebar.ts +0 -1191
  116. package/dist/components/rel-skeleton/rel-skeleton.ts +0 -143
  117. package/dist/components/rel-slider/rel-slider.ts +0 -673
  118. package/dist/components/rel-snackbar/rel-snackbar.ts +0 -329
  119. package/dist/components/rel-stepper/rel-stepper.ts +0 -567
  120. package/dist/components/rel-switch/rel-switch.ts +0 -199
  121. package/dist/components/rel-tab/rel-tab.ts +0 -264
  122. package/dist/components/rel-table/README.md +0 -178
  123. package/dist/components/rel-table/rel-table-body.ts +0 -22
  124. package/dist/components/rel-table/rel-table-caption.ts +0 -30
  125. package/dist/components/rel-table/rel-table-cell.ts +0 -43
  126. package/dist/components/rel-table/rel-table-footer.ts +0 -24
  127. package/dist/components/rel-table/rel-table-head.ts +0 -47
  128. package/dist/components/rel-table/rel-table-header.ts +0 -22
  129. package/dist/components/rel-table/rel-table-row.ts +0 -37
  130. package/dist/components/rel-table/rel-table.ts +0 -62
  131. package/dist/components/rel-textfield/rel-textfield.ts +0 -1054
  132. package/dist/components/rel-time-picker/rel-time-picker.ts +0 -1482
  133. package/dist/components/rel-time-picker/time-parse.test.ts +0 -67
  134. package/dist/components/rel-time-picker/time-parse.ts +0 -85
  135. package/dist/components/rel-toast/rel-toast.ts +0 -206
  136. package/dist/components/rel-tooltip/rel-tooltip.ts +0 -193
  137. package/dist/components/rel-topbar/rel-topbar-actions.ts +0 -27
  138. package/dist/components/rel-topbar/rel-topbar-brand.ts +0 -54
  139. package/dist/components/rel-topbar/rel-topbar-dropdown-item.ts +0 -69
  140. package/dist/components/rel-topbar/rel-topbar-dropdown.ts +0 -31
  141. package/dist/components/rel-topbar/rel-topbar-item.ts +0 -324
  142. package/dist/components/rel-topbar/rel-topbar-mobile-panel.ts +0 -27
  143. package/dist/components/rel-topbar/rel-topbar-profile.ts +0 -243
  144. package/dist/components/rel-topbar/rel-topbar-utilities.ts +0 -27
  145. package/dist/components/rel-topbar/rel-topbar.ts +0 -446
  146. package/dist/components/rel-upload/UPLOAD-DESIGN-CHANGES.md +0 -134
  147. package/dist/components/rel-upload/rel-upload-actions.ts +0 -163
  148. package/dist/components/rel-upload/rel-upload.ts +0 -968
@@ -1,121 +1,138 @@
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="medium" 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="destructive"></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="small"></rel-chip>
22
+ <rel-chip label="Medium" size="medium"></rel-chip>
23
+ <rel-chip label="Large" size="large"></rel-chip>
24
+
25
+ <!-- Deprecated aliases — these still render, but prefer the canonical spellings above.
26
+ tone="danger" is an alias of tone="destructive" and logs a one-time console notice.
27
+ size="sm" / "md" / "lg" are alternative spellings (NOT deprecated, no notice). -->
28
+ <rel-chip label="Error" tone="danger"></rel-chip>
29
+ <rel-chip label="Small" size="sm"></rel-chip>
30
+
31
+ <!-- Fully rounded corners -->
32
+ <rel-chip label="Rounded" border="rounded"></rel-chip>
33
+
34
+ <!-- Leading / trailing icons (icon dictionary names, rendered via <rel-icon>) -->
35
+ <rel-chip label="Settings" leading-icon="settings"></rel-chip>
36
+ <rel-chip label="Next" trailing-icon="chevron-right"></rel-chip>
37
+
38
+ <!-- Initials avatar (takes precedence over leading-icon) -->
39
+ <rel-chip label="John Doe" avatar="JD"></rel-chip>
40
+
41
+ <!-- Removable chip -->
42
+ <rel-chip id="removableChip" label="Removable" removable></rel-chip>
43
+ <script>
44
+ document.getElementById("removableChip").addEventListener("removed", () => {
45
+ console.log("Chip was removed");
46
+ });
47
+ </script>
48
+
49
+ <!-- Draggable chip: native drag-and-drop plus Left/Right arrow reordering -->
50
+ <rel-chip id="dragChip" label="Reorder me" draggable-chip></rel-chip>
51
+ <script>
52
+ document.getElementById("dragChip").addEventListener("chip-move", (e) => {
53
+ console.log("move", e.detail.direction); // -1 = left, 1 = right
54
+ });
55
+ </script>
56
+ ```
57
+
58
+ <!-- readme-gen:start -->
59
+
60
+ <!-- Generated from rel-chip.ts — do not edit; run readme-generate.mjs -->
61
+
62
+ ## API
63
+
64
+ ### Attributes / Properties
65
+
66
+ | Property | Attribute | Type | Default | Description |
67
+ | --- | --- | --- | --- | --- |
68
+ | `label` | `label` | `string` | `"Label"` | Text shown in the chip; also its accessible name and the drag payload. |
69
+ | `tone` | `tone` | `"neutral" \| "destructive" \| "warning" \| "success" \| "info" \| "danger"` | `"neutral"` | Colour tone (Figma Tone): `neutral`, `destructive`, `warning`, `success` or `info`. Combined with `variant`. `"danger"` is a deprecated alias of `"destructive"`: it keeps working, logs a one-time console notice, and is normalised to `"destructive"` on the property and the reflected attribute. Reflected. |
70
+ | `variant` | `variant` | `"fill" \| "subtle" \| "primary" \| "secondary"` | `"fill"` | Emphasis (Figma Style): `fill` = solid tone background, `subtle` = tinted background with tone-coloured text. Figma's own spellings `primary` and `secondary` are accepted and normalised to `fill` / `subtle`. Reflected. |
71
+ | `size` | `size` | `"small" \| "medium" \| "large" \| "sm" \| "md" \| "lg"` | `"medium"` | Height scale (Figma Size): `small` 24px / body-sm, `medium` 28px / body-md, `large` 32px / body-lg. Icon size follows (12 / 14 / 16px). `sm` / `md` / `lg` are accepted and normalised to the full words. Reflected. |
72
+ | `border` | `border` | `"default" \| "rounded"` | `"default"` | Corner shape (Figma Border): `default` = 4px radius, `rounded` = fully rounded with 12px horizontal padding. Reflected. |
73
+ | `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. |
74
+ | `trailingIcon` | `trailing-icon` | `string` | `undefined` | Icon name from the generated icon dictionary, rendered after the label. |
75
+ | `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). |
76
+ | `removable` | `removable` | `boolean` | `false` | Shows a remove (close) button after the label; clicking it sets `removed` and fires `removed`. |
77
+ | `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. |
78
+ | `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`. |
79
+
80
+ ## Events
81
+
82
+ | Event | Detail | Bubbles / composed | Description |
83
+ | --- | --- | --- | --- |
84
+ | `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). |
85
+ | `removed` | — | bubbles / composed | Fired when the chip is removed via its remove button or Delete/Backspace (after `removed` is set to `true`). No detail. |
86
+
87
+ ## Slots
88
+
89
+ | Slot | Description |
90
+ | --- | --- |
91
+ | — | This element has no slots. |
92
+
93
+ ## CSS Parts
94
+
95
+ | Part | Description |
96
+ | --- | --- |
97
+ | `base` | The chip body (`.chip`) that carries size, tone, variant and border styling |
98
+ | `icon` | The leading `<rel-icon>` (rendered only when `leading-icon` is set and no avatar) |
99
+ | `label` | The label text |
100
+
101
+ ## Tokens / CSS Variables
102
+
103
+ ### Component hooks
104
+
105
+ Set these on the host (or an ancestor) to customise the element without touching design tokens.
106
+
107
+ | Custom property | Default | Description |
108
+ | --- | --- | --- |
109
+ | `--rel-chip-focus-ring` | `var(--rel-border-focus)` | Colour of the keyboard focus outline; default `var(--rel-border-focus)` |
110
+
111
+ <!-- readme-gen:end -->
112
+
113
+ ## Accessibility
114
+
115
+ - 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.
116
+ - The remove control is a real `<button>` labelled `Remove {label}`; it is a second Tab stop after the chip body.
117
+ - 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.
118
+ - Icons and the avatar are decorative; the accessible name comes only from `label`.
119
+
120
+ | Key | Action |
121
+ |-----|--------|
122
+ | `Tab` | Focus the chip body, then the remove button (when `removable`) |
123
+ | `Enter` / `Space` | Re-dispatches a `click` on the host so consumer `click` handlers run |
124
+ | `Delete` / `Backspace` | Removes the chip when `removable` (sets `removed`, fires `removed`) |
125
+ | `ArrowLeft` / `ArrowRight` | Fires `chip-move` with `direction: -1` / `1` when `draggable-chip` is set |
126
+
127
+ 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.
128
+
129
+ ## Notes / Edge Cases
130
+
131
+ - `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).
132
+ - The trailing icon has no CSS part; only the leading icon is exposed as `icon`.
133
+ - 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.
134
+ - `border="rounded"` also widens the horizontal padding to 12px at every size, per the Figma spec.
135
+ - `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.
136
+ - `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`.
137
+ - The remove button has no hover state of its own; the hover/pressed colours belong to the whole chip (per-tone action tokens).
138
+ - 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="small">
16
+ <p>Compact section on the raised surface.</p>
17
+ </rel-container>
18
+
19
+ <!-- Large padding with shadow -->
20
+ <rel-container padding="large" 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="extra-large">
27
+ <div>Content with no background.</div>
28
+ </rel-container>
29
+
30
+ <!-- Everything combined -->
31
+ <rel-container surface="default" padding="medium" 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="small">
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` | `"small" \| "medium" \| "large" \| "extra-large" \| "sm" \| "md" \| "lg" \| "xl"` | `"medium"` | Inner padding step: `small` = spacing-xs, `medium` = spacing-md, `large` = spacing-lg. `extra-large` = spacing-2xl is a code-only extension — Figma publishes only the three steps above — and is supported, not deprecated. `sm` / `md` / `lg` / `xl` are alternative spellings and stay supported, normalised to the full words. 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: `small` = `--rel-spacing-xs`, `medium` = `--rel-spacing-md`, `large` = `--rel-spacing-lg`. `extra-large` = `--rel-spacing-2xl` is a code-only extension: Figma's Container publishes only three padding steps, and it is supported rather than deprecated. The short spellings `sm` / `md` / `lg` / `xl` keep working and normalise to the full words.
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-md`.
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.