@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,93 +1,97 @@
1
- # rel-badge
2
-
3
- ## Overview
4
- A simple notification badge component displaying numeric counts or dot indicators. Supports three sizes (sm, md, lg) and two variants (number, dot). Ideal for indicating counts, status, or notifications in UI elements.
5
-
6
- ## Usage
7
- ```html
8
- <!-- Number badges -->
9
- <rel-badge number="5"></rel-badge>
10
- <rel-badge number="12" size="md"></rel-badge>
11
- <rel-badge number="99+" size="lg"></rel-badge>
12
-
13
- <!-- Dot badges (no number shown) -->
14
- <rel-badge variant="dot" size="sm"></rel-badge>
15
- <rel-badge variant="dot" size="md"></rel-badge>
16
- <rel-badge variant="dot" size="lg"></rel-badge>
17
-
18
- <!-- Common use case: Badge on icon/button -->
19
- <div style="position: relative; display: inline-block;">
20
- <button>🔔 Notifications</button>
21
- <rel-badge number="3" size="sm" style="position: absolute; top: -8px; right: -8px;"></rel-badge>
22
- </div>
23
-
24
- <!-- Sizes comparison -->
25
- <rel-badge number="1" size="sm"></rel-badge>
26
- <rel-badge number="2" size="md"></rel-badge>
27
- <rel-badge number="3" size="lg"></rel-badge>
28
-
29
- <!-- Custom colors -->
30
- <rel-badge number="3" color="#7d7d7d"></rel-badge>
31
- <rel-badge number="3" color="teal" text-color="#1a1a1a"></rel-badge>
32
- <rel-badge variant="dot" color="lavender"></rel-badge>
33
- ```
34
-
35
- ## API
36
-
37
- ### Attributes/Properties
38
- | Name | Type | Default | Description |
39
- |------|------|---------|-------------|
40
- | `number` | `string` | `""` | Text to display in number variant (can be numeric or text like "99+") |
41
- | `size` | `"sm" \| "md" \| "lg"` (reflected) | `"md"` | Size variant |
42
- | `variant` | `"dot" \| "number"` (reflected) | `"number"` | Display mode (number shows text, dot shows indicator only) |
43
- | `color` | `string` (reflected) | `""` | Direct CSS color override for the badge background. Accepts any valid CSS color (hex, rgb, hsl, named, `var(...)`). Falls back to the default token when empty |
44
- | `text-color` | `string` (reflected) | `""` | Direct CSS color override for the badge text/icon color. Accepts any valid CSS color. Falls back to white when empty |
45
-
46
- ## Events
47
- None.
48
-
49
- ## Slots
50
- Default slot not used.
51
-
52
- ## CSS Parts
53
- None exposed.
54
-
55
- ## Tokens / CSS Variables
56
-
57
- ### Semantic Tokens
58
- - `--rel-fonts-font-family` - Font family
59
- - `--rel-fonts-weight-body-semibold` - Font weight (number variant)
60
- - `--rel-body-xs-regular-font-size`, `--rel-body-sm-regular-font-size`, `--rel-body-xl-regular-font-size` - Font sizes for number variant sizes
61
-
62
- ### Color Tokens
63
- - `--rel-bg-danger` - Background color
64
- - `--rel-bg-surface` - Text color
65
-
66
- ## Accessibility
67
- - Purely visual indicator (no ARIA roles)
68
- - For critical information, ensure accompanying text or ARIA labels on parent elements
69
- - Screen readers will not announce badge content unless used with proper labeling
70
-
71
- ### Keyboard Interactions
72
- - None (not focusable)
73
-
74
- ### Focus Behavior
75
- - Not focusable
76
-
77
- ## Notes / Edge Cases
78
- - **Number variant sizes**:
79
- - **sm**: 20px × 20px, 12px font
80
- - **md**: 28px × 28px, 14px font
81
- - **lg**: 40px × 40px, 20px font
82
- - **Dot variant sizes**:
83
- - **sm**: 8px × 8px
84
- - **md**: 10px × 10px
85
- - **lg**: 12px × 12px
86
- - All badges are circular (`border-radius: 50%`)
87
- - The `number` property accepts any string (e.g., "99+", "NEW", or numeric values)
88
- - In dot variant, the `number` property is ignored and nothing is rendered inside
89
- - The component is `display: inline-flex` for easy positioning
90
- - Badges use `justify-content: center` and `align-items: center` for centering content
91
- - `size` and `variant` are reflected attributes (appear in HTML when set)
92
- - Common pattern: position badges absolutely over parent elements (e.g., icons, avatar images)
93
- - For very large numbers, consider truncating or using "99+" format to avoid overflow
1
+ # rel-badge
2
+
3
+ `<rel-badge>` is the Figma "Badge" count indicator: a small `number` pill ("5", "99+") or an unlabeled `dot`, in four sizes (S/M/L/XL), filled with the danger token by default and overridable per instance through `color` / `text-color`. Use it to flag unread counts or unseen activity on an icon, tab, avatar or navigation item — you position it over the target yourself. It is not a text tag (use `rel-chip`) and not a status message (use `rel-alert` or `rel-toast`); it only carries a count or a "something is new" signal.
4
+
5
+ ## Usage
6
+
7
+ ```html
8
+ <!-- Number badges -->
9
+ <rel-badge number="5"></rel-badge>
10
+ <rel-badge number="12" size="md"></rel-badge>
11
+ <rel-badge number="99+" size="lg"></rel-badge>
12
+ <rel-badge number="120" size="xl"></rel-badge>
13
+
14
+ <!-- Dot badges (no text) -->
15
+ <rel-badge variant="dot"></rel-badge>
16
+
17
+ <!-- Positioned over an icon button -->
18
+ <div style="position: relative; display: inline-block;">
19
+ <button aria-label="Notifications">🔔</button>
20
+ <rel-badge number="3" size="sm" style="position: absolute; top: -8px; right: -8px;"></rel-badge>
21
+ </div>
22
+
23
+ <!-- Accessible-name control -->
24
+ <rel-badge number="3" suffix="unread messages"></rel-badge>
25
+ <rel-badge variant="dot" arialabel="New activity"></rel-badge>
26
+
27
+ <!-- Colour overrides: any CSS colour, including a token via var() -->
28
+ <rel-badge number="3" color="#7d7d7d"></rel-badge>
29
+ <rel-badge number="3" color="teal" text-color="#1a1a1a"></rel-badge>
30
+ <rel-badge variant="dot" color="seagreen"></rel-badge>
31
+ ```
32
+
33
+ <!-- readme-gen:start -->
34
+
35
+ <!-- Generated from rel-badge.ts — do not edit; run readme-generate.mjs -->
36
+
37
+ ## API
38
+
39
+ ### Attributes / Properties
40
+
41
+ | Property | Attribute | Type | Default | Description |
42
+ | --- | --- | --- | --- | --- |
43
+ | `number` | `number` | `string` | `""` | Text shown in the `number` variant (a count such as "5" or "99+"); not rendered by `variant="dot"` but still used to build the accessible name. |
44
+ | `ariaLabel` | `arialabel` | `string` | `""` | Explicit accessible name; when empty it is composed as "<number> <suffix>" or, with no number, "New <suffix>". Attribute is `arialabel`. |
45
+ | `suffix` | `suffix` | `string` | `"notifications"` | Noun appended to the count in the generated accessible name, e.g. "3 notifications". |
46
+ | `size` | `size` | `"small" \| "medium" \| "large" \| "extra-large" \| "sm" \| "md" \| "lg" \| "xl"` | `"medium"` | Badge scale (Figma Badge S/M/L/XL): number badges are 20 / 24 / 28 / 40px tall. `sm` / `md` / `lg` / `xl` are accepted and normalised to the full words. Ignored when `variant="dot"` — Figma models `Dot` as a fifth option of the same Size axis, so a dot has one size. Reflected. |
47
+ | `variant` | `variant` | `"dot" \| "number"` | `"number"` | `number` renders the `number` text in a pill that widens with its content; `dot` renders a 6px disc with no text (Figma `Size=Dot`), ignoring `size`. Reflected. |
48
+ | `color` | `color` | `string` | `""` | Direct CSS color override for the badge background. Accepts any valid CSS color value: hex, rgb(...), hsl(...), named color, or var(--token). Clear it (set to `''`) to fall back to the default token. Reflected. |
49
+ | `textColor` | `text-color` | `string` | `""` | Direct CSS color override for the badge text/icon color. Accepts any valid CSS color value: hex, rgb(...), hsl(...), named color, or var(--token). Clear it (set to `''`) to fall back to the default (white). Reflected. |
50
+
51
+ ## Events
52
+
53
+ | Event | Detail | Bubbles / composed | Description |
54
+ | --- | --- | --- | --- |
55
+ | — | — | — | This element emits no custom events. |
56
+
57
+ ## Slots
58
+
59
+ | Slot | Description |
60
+ | --- | --- |
61
+ | — | This element has no slots. |
62
+
63
+ ## CSS Parts
64
+
65
+ | Part | Description |
66
+ | --- | --- |
67
+ | `base` | The `role="status"` pill / dot that carries the size, variant and colour overrides |
68
+
69
+ ## Tokens / CSS Variables
70
+
71
+ ### Component hooks
72
+
73
+ Set these on the host (or an ancestor) to customise the element without touching design tokens.
74
+
75
+ | Custom property | Default | Description |
76
+ | --- | --- | --- |
77
+ | `--rel-badge-bg` | `var(--rel-bg-danger)` | Background colour of the badge; the `color` prop writes this on the host |
78
+ | `--rel-badge-color` | `var(--rel-text-static-light)` | Text colour of the count; the `text-color` prop writes this on the host |
79
+ | `--rel-badge-dot-size` | `6px` | Diameter of the `dot` variant; default 6px, the single dot size Figma draws. Set it to restore the larger discs shipped previously. |
80
+
81
+ <!-- readme-gen:end -->
82
+
83
+ ## Accessibility
84
+
85
+ - The pill (`base` part) renders with `role="status"` and an `aria-label`. The label is `ariaLabel` when set; otherwise it is composed as `"<number> <suffix>"` (e.g. "3 notifications") or, when `number` is empty (dot badges), `"New <suffix>"` (e.g. "New notifications"). Set `suffix` so the announcement names the right thing, or `arialabel` for full control.
86
+ - `role="status"` is an implicit polite live region, so a change to `number` may be announced without the badge ever taking focus; verify the behaviour with your target screen reader before relying on it.
87
+ - The host is not focusable and handles no keys. Interactive meaning ("open notifications") belongs to the element the badge decorates — give that element its own accessible name.
88
+ - A dot badge has no visible text; the generated name is the only thing a screen reader gets, and sighted users get colour alone. Pair it with nearby text when the meaning is not obvious from context.
89
+
90
+ ## Notes / Edge Cases
91
+
92
+ - Number badge heights are 20 / 24 / 28 / 40px for `sm` / `md` / `lg` / `xl`; dot badges are 8 / 10 / 12 / 12px (`lg` and `xl` dots are the same size). The number badge sets `min-width`, not `width`, so a two-digit count stays a circle while "999+" grows into a pill.
93
+ - The corner radius is a fixed `999px`, not `50%`, which is what lets wide content become a pill instead of clipping.
94
+ - In `variant="dot"` the `number` text is not rendered but still feeds the accessible name ("3 notifications" for a dot with `number="3"`).
95
+ - `color` and `text-color` are applied by writing `--rel-badge-bg` / `--rel-badge-color` as inline custom properties on the host; clearing the prop removes the inline value and falls back to whatever the hook resolves to (the danger / static-light tokens unless you set the hook in your own CSS).
96
+ - The accessible-name property is `ariaLabel` with the attribute `arialabel` (no hyphen). A plain `aria-label` attribute on the host is not read by the component, and because the host has no role it does not reach the `role="status"` element either — use `arialabel`.
97
+ - The host is `display: inline-flex`; the usual pattern is an absolutely positioned badge inside a `position: relative` wrapper around the decorated element.
@@ -1,102 +1,96 @@
1
- #rel-breadcrumbs
2
-
3
- ## Overview
4
- A breadcrumb navigation component that displays a hierarchical path of pages. Features accessible markup, automatic last-item detection, built-in chevron separators, and proper ARIA attributes. Automatically styles the last item as the current page.
5
-
6
- ## Usage
7
- ```html
8
- <!-- Basic breadcrumb -->
9
- <rel-breadcrumbs id="breadcrumb1"></rel-breadcrumbs>
10
- <script>
11
- const breadcrumb = document.getElementById('breadcrumb1');
12
- breadcrumb.items = [
13
- { label: 'Home', url: '/' },
14
- { label: 'Products', url: '/products' },
15
- { label: 'Electronics', url: '/products/electronics' },
16
- { label: 'Laptops' } // Last item has no URL
17
- ];
18
- </script>
19
-
20
- <!-- Simple path -->
21
- <rel-breadcrumbs id="breadcrumb2"></rel-breadcrumbs>
22
- <script>
23
- document.getElementById('breadcrumb2').items = [
24
- { label: 'Dashboard', url: '/dashboard' },
25
- { label: 'Settings' }
26
- ];
27
- </script>
28
-
29
- <!-- Deep nested path -->
30
- <rel-breadcrumbs id="breadcrumb3"></rel-breadcrumbs>
31
- <script>
32
- document.getElementById('breadcrumb3').items = [
33
- { label: 'Docs', url: '/docs' },
34
- { label: 'Components', url: '/docs/components' },
35
- { label: 'Navigation', url: '/docs/components/navigation' },
36
- { label: 'Breadcrumbs' }
37
- ];
38
- </script>
39
- ```
40
-
41
- ## API
42
-
43
- ### Attributes/Properties
44
- | Name | Type | Default | Description |
45
- |------|------|---------|-------------|
46
- | `items` | `BreadcrumbItem[]` | `[]` | Array of breadcrumb items (see BreadcrumbItem interface below) |
47
-
48
- ### BreadcrumbItem Interface
49
- ```typescript
50
- interface BreadcrumbItem {
51
- label: string; // Display text
52
- url?: string; // Optional link URL (omit for current/last page)
53
- }
54
- ```
55
-
56
- ## Events
57
- None.
58
-
59
- ## Slots
60
- Default slot not used.
61
-
62
- ## CSS Parts
63
- None exposed.
64
-
65
- ## Tokens / CSS Variables
66
-
67
- ### Semantic Tokens
68
- - `--rel-fonts-font-family` - Font family
69
- - `--rel-body-md-regular-font-size` - Font size
70
- - `--rel-fonts-weight-body-medium` - Font weight for links
71
- - `--rel-fonts-weight-body-semibold` - Font weight for current page
72
-
73
- ### Color Tokens
74
- - `--rel-text-default` - Base text color
75
- - `--rel-text-label` - Link and current page text color
76
- - `--rel-bg-info` - Link hover color and focus outline
77
-
78
- ## Accessibility
79
- - Uses semantic `<nav>` with `aria-label="Breadcrumb"`
80
- - Uses `<ol>` ordered list for proper structure
81
- - Last item has `aria-current="page"` to indicate current page
82
- - Links have focus visible states with blue outline
83
- - Chevron separator has `aria-hidden="true"` to hide from screen readers
84
-
85
- ### Keyboard Interactions
86
- - `Tab` - Navigate through breadcrumb links
87
- - `Enter` - Follow focused link
88
-
89
- ### Focus Behavior
90
- - Links show 2px blue outline with 2px offset when focused
91
- - Border radius applied to focus outline for visual consistency
92
-
93
- ## Notes / Edge Cases
94
- - The last item in `items` array is automatically treated as the current page
95
- - Last item renders as a `<span class="current">` instead of `<a>`, even if it has a `url`
96
- - Chevron separators (SVG chevron-right arrows) appear between all items except after the last one
97
- - Chevrons are 16px × 16px with 10px horizontal margins
98
- - Chevron color inherits `currentColor` from parent
99
- - Links have `text-decoration: none` by default, `underline` on hover
100
- - The current page label is bold and not clickable (`cursor: default`)
101
- - The component is `display: block` and takes full width
102
- - The ordered list uses `flex-wrap: wrap` to handle overflow gracefully
1
+ # rel-breadcrumbs
2
+
3
+ Breadcrumb trail (element `<rel-breadcrumbs>`, folder `rel-breadcrumb`): a `<nav aria-label="Breadcrumb">` ordered list built from an `items` array, with chevron separators and the last entry rendered as the non-link current page. Use it to show where the current page sits in a hierarchy and to jump back up it; do not use it as primary navigation or for a single-level site.
4
+
5
+ ## Usage
6
+
7
+ ```html
8
+ <!-- Basic trail: every item but the last is a link -->
9
+ <rel-breadcrumbs id="trail"></rel-breadcrumbs>
10
+ <script>
11
+ document.getElementById('trail').items = [
12
+ { label: 'Home', url: '/' },
13
+ { label: 'Products', url: '/products' },
14
+ { label: 'Electronics', url: '/products/electronics' },
15
+ { label: 'Laptops' } // current page — no url needed
16
+ ];
17
+ </script>
18
+
19
+ <!-- Two levels -->
20
+ <rel-breadcrumbs id="short"></rel-breadcrumbs>
21
+ <script>
22
+ document.getElementById('short').items = [
23
+ { label: 'Dashboard', url: '/dashboard' },
24
+ { label: 'Settings' }
25
+ ];
26
+ </script>
27
+
28
+ <!-- Restyle the current-page text through its part -->
29
+ <style>
30
+ .muted::part(label) {
31
+ color: gray;
32
+ }
33
+ </style>
34
+ <rel-breadcrumbs class="muted" id="muted"></rel-breadcrumbs>
35
+ <script>
36
+ document.getElementById('muted').items = [
37
+ { label: 'Docs', url: '/docs' },
38
+ { label: 'Components', url: '/docs/components' },
39
+ { label: 'Breadcrumbs' }
40
+ ];
41
+ </script>
42
+ ```
43
+
44
+ The `BreadcrumbItem` shape is `{ label: string; url?: string }`; the type is exported from the package.
45
+
46
+ <!-- readme-gen:start -->
47
+
48
+ <!-- Generated from rel-breadcrumb.ts — do not edit; run readme-generate.mjs -->
49
+
50
+ ## API
51
+
52
+ ### Attributes / Properties
53
+
54
+ | Property | Attribute | Type | Default | Description |
55
+ | --- | --- | --- | --- | --- |
56
+ | `items` | `items` | `BreadcrumbItem[]` | `[]` | Ordered trail, root first: `{ label: string; url?: string }[]`. Items with a `url` render as links except the last one, which is always the current page (and never a link). Set as a property — arrays do not survive attribute serialisation. |
57
+
58
+ ## Events
59
+
60
+ | Event | Detail | Bubbles / composed | Description |
61
+ | --- | --- | --- | --- |
62
+ | — | — | — | This element emits no custom events. |
63
+
64
+ ## Slots
65
+
66
+ | Slot | Description |
67
+ | --- | --- |
68
+ | — | This element has no slots. |
69
+
70
+ ## CSS Parts
71
+
72
+ | Part | Description |
73
+ | --- | --- |
74
+ | `base` | The `<nav>` landmark wrapping the ordered list. |
75
+ | `label` | The non-link current-page text (`aria-current="page"`), also used for any item without a `url`. |
76
+
77
+ <!-- readme-gen:end -->
78
+
79
+ ## Accessibility
80
+
81
+ - Semantic `<nav aria-label="Breadcrumb">` landmark (the `base` part) containing an `<ol>`, so the trail is announced as an ordered list within a named navigation region.
82
+ - The last item is a `<span aria-current="page">` (the `label` part), never a link, so the current page is identified without being actionable.
83
+ - Chevron separators are inline SVGs with `aria-hidden="true"`.
84
+ - Links show a 2px focus outline with 2px offset on `:focus-visible`.
85
+
86
+ | Key | Action |
87
+ | --- | --- |
88
+ | `Tab` / `Shift+Tab` | Move between the breadcrumb links |
89
+ | `Enter` | Follow the focused link (native anchor behaviour) |
90
+
91
+ ## Notes / Edge Cases
92
+
93
+ - **The last item is always the current page**, even if it has a `url` — it renders as text, not a link. Any earlier item *without* a `url` also renders as text (and reuses the `label` part and `aria-current="page"`, so give every ancestor a `url`).
94
+ - `items` must be assigned as a property (it is an array); setting an `items` attribute in HTML does not work.
95
+ - Separators are 16px chevrons with 10px horizontal margins inheriting `currentColor`; the list wraps onto new lines when it runs out of width.
96
+ - Links are plain anchors: navigation happens natively and no custom event is emitted. Intercept `click` on the host if you route client-side.