@reliability-design/web 1.0.3 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/rel-accordion/README.md +132 -0
- package/dist/components/rel-accordion/rel-accordion.ts +47 -16
- package/dist/components/rel-alert/README.md +141 -0
- package/dist/components/rel-alert/rel-alert.ts +101 -20
- package/dist/components/rel-avatar/README.md +119 -0
- package/dist/components/rel-avatar/rel-avatar.ts +3 -2
- package/dist/components/rel-badge/README.md +86 -0
- package/dist/components/rel-badge/rel-badge.ts +11 -7
- package/dist/components/rel-breadcrumb/README.md +102 -0
- package/dist/components/rel-breadcrumb/rel-breadcrumb.ts +12 -6
- package/dist/components/rel-button/README.md +130 -0
- package/dist/components/rel-button/rel-button.ts +64 -8
- package/dist/components/rel-calendar/README.md +109 -0
- package/dist/components/rel-calendar/index.ts +1 -0
- package/dist/components/rel-calendar/rel-calendar.ts +467 -0
- package/dist/components/rel-card/README.md +94 -0
- package/dist/components/rel-card/rel-card.ts +12 -3
- package/dist/components/rel-cardmedia/README.md +127 -0
- package/dist/components/rel-cardmedia/rel-cardmedia.ts +14 -4
- package/dist/components/rel-carousel/README.md +166 -0
- package/dist/components/rel-carousel/index.ts +1 -0
- package/dist/components/rel-carousel/rel-carousel.ts +468 -0
- package/dist/components/rel-chart/README.md +286 -0
- package/dist/components/rel-chart/index.ts +1 -0
- package/dist/components/rel-chart/rel-chart.ts +736 -0
- package/dist/components/rel-checkbox/README.md +77 -0
- package/dist/components/rel-checkbox/rel-checkbox.ts +51 -12
- package/dist/components/rel-chip/README.md +114 -0
- package/dist/components/rel-chip/rel-chip.ts +83 -9
- package/dist/components/rel-container/README.md +99 -0
- package/dist/components/rel-date-picker/README.md +253 -0
- package/dist/components/rel-date-picker/index.ts +1 -0
- package/dist/components/rel-date-picker/rel-date-picker.ts +916 -0
- package/dist/components/rel-divider/README.md +100 -0
- package/dist/components/rel-divider/rel-divider.ts +9 -0
- package/dist/components/rel-drawer/README.md +200 -0
- package/dist/components/rel-drawer/index.ts +1 -0
- package/dist/components/rel-drawer/rel-drawer-footer.ts +29 -0
- package/dist/components/rel-drawer/rel-drawer.ts +612 -0
- package/dist/components/rel-kbd/README.md +151 -0
- package/dist/components/rel-kbd/rel-kbd.ts +118 -0
- package/dist/components/rel-layout/README.md +88 -0
- package/dist/components/rel-menu/README.md +151 -0
- package/dist/components/rel-menu/rel-menu.ts +64 -24
- package/dist/components/rel-menubar/README.md +329 -0
- package/dist/components/rel-menubar/index.ts +2 -0
- package/dist/components/rel-menubar/rel-menubar-menu.ts +16 -0
- package/dist/components/rel-menubar/rel-menubar.ts +605 -0
- package/dist/components/rel-nav-menu/README.md +289 -0
- package/dist/components/rel-nav-menu/index.ts +3 -0
- package/dist/components/rel-nav-menu/rel-nav-menu-item.ts +240 -0
- package/dist/components/rel-nav-menu/rel-nav-menu-panel.ts +53 -0
- package/dist/components/rel-nav-menu/rel-nav-menu.ts +227 -0
- package/dist/components/rel-navbar/README.md +126 -0
- package/dist/components/rel-navbar/rel-navbar.ts +104 -0
- package/dist/components/rel-otp/README.md +440 -0
- package/dist/components/rel-otp/index.ts +1 -0
- package/dist/components/rel-otp/rel-otp.ts +504 -0
- package/dist/components/rel-pagination/README.md +410 -0
- package/dist/components/rel-pagination/index.ts +1 -0
- package/dist/components/rel-pagination/rel-pagination.ts +381 -0
- package/dist/components/rel-popover/README.md +568 -0
- package/dist/components/rel-popover/index.ts +2 -0
- package/dist/components/rel-popover/rel-popover-content.ts +55 -0
- package/dist/components/rel-popover/rel-popover.ts +330 -0
- package/dist/components/rel-progress/README.md +110 -0
- package/dist/components/rel-progress/rel-progress.ts +32 -5
- package/dist/components/rel-radio/README.md +120 -0
- package/dist/components/rel-radio/rel-radio.ts +31 -6
- package/dist/components/rel-resizable/README.md +140 -0
- package/dist/components/rel-resizable/index.ts +3 -0
- package/dist/components/rel-resizable/rel-resizable-group.ts +374 -0
- package/dist/components/rel-resizable/rel-resizable-handle.ts +145 -0
- package/dist/components/rel-resizable/rel-resizable-panel.ts +47 -0
- package/dist/components/rel-segmented-button/README.md +141 -0
- package/dist/components/rel-segmented-button/rel-segmented-button.ts +18 -13
- package/dist/components/rel-select/README.md +107 -0
- package/dist/components/rel-select/rel-select.ts +28 -14
- package/dist/components/rel-sheet/README.md +224 -0
- package/dist/components/rel-sheet/rel-sheet.ts +684 -0
- package/dist/components/rel-sidebar/README.md +209 -0
- package/dist/components/rel-sidebar/rel-sidebar.ts +1166 -0
- package/dist/components/rel-slider/README.md +135 -0
- package/dist/components/rel-slider/rel-slider.ts +44 -9
- package/dist/components/rel-snackbar/README.md +134 -0
- package/dist/components/rel-snackbar/rel-snackbar.ts +109 -14
- package/dist/components/rel-stepper/README.md +160 -0
- package/dist/components/rel-stepper/rel-stepper.ts +38 -27
- package/dist/components/rel-switch/README.md +102 -0
- package/dist/components/rel-switch/rel-switch.ts +34 -12
- package/dist/components/rel-tab/README.md +163 -0
- package/dist/components/rel-tab/rel-tab.ts +79 -23
- package/dist/components/rel-table/README.md +178 -0
- package/dist/components/rel-table/rel-table-body.ts +21 -0
- package/dist/components/rel-table/rel-table-caption.ts +27 -0
- package/dist/components/rel-table/rel-table-cell.ts +42 -0
- package/dist/components/rel-table/rel-table-footer.ts +23 -0
- package/dist/components/rel-table/rel-table-head.ts +45 -0
- package/dist/components/rel-table/rel-table-header.ts +21 -0
- package/dist/components/rel-table/rel-table-row.ts +36 -0
- package/dist/components/rel-table/rel-table.ts +53 -0
- package/dist/components/rel-textfield/README.md +90 -0
- package/dist/components/rel-textfield/rel-textfield.ts +55 -39
- package/dist/components/rel-toast/README.md +148 -0
- package/dist/components/rel-toast/rel-toast.ts +63 -24
- package/dist/components/rel-tooltip/README.md +103 -0
- package/dist/components/rel-tooltip/rel-tooltip.ts +123 -80
- package/dist/components/rel-topbar/rel-topbar-actions.ts +23 -0
- package/dist/components/rel-topbar/rel-topbar-brand.ts +46 -0
- package/dist/components/rel-topbar/rel-topbar-dropdown-item.ts +33 -0
- package/dist/components/rel-topbar/rel-topbar-dropdown.ts +28 -0
- package/dist/components/rel-topbar/rel-topbar-item.ts +315 -0
- package/dist/components/rel-topbar/rel-topbar-mobile-panel.ts +23 -0
- package/dist/components/rel-topbar/rel-topbar-profile.ts +248 -0
- package/dist/components/rel-topbar/rel-topbar-utilities.ts +23 -0
- package/dist/components/rel-topbar/rel-topbar.ts +329 -0
- package/dist/index.d.mts +831 -7
- package/dist/index.d.ts +831 -7
- package/dist/index.js +9500 -1564
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +9240 -1344
- package/dist/index.mjs.map +1 -1
- package/dist/styles/vars.css +187 -25
- package/dist/vars-TBB4BMSD.css +346 -0
- package/package.json +2 -1
- package/dist/vars-6ZIUPIU4.css +0 -184
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
# rel-avatar
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
A circular avatar component supporting three display types: image, text initials, or custom icon content. Provides four size variants with automatic text transformation and SVG sizing for icons.
|
|
5
|
+
|
|
6
|
+
## Usage
|
|
7
|
+
```html
|
|
8
|
+
<!-- Image avatar -->
|
|
9
|
+
<rel-avatar
|
|
10
|
+
type="image"
|
|
11
|
+
src="./user-photo.jpg"
|
|
12
|
+
alt="John Doe">
|
|
13
|
+
</rel-avatar>
|
|
14
|
+
|
|
15
|
+
<!-- Text initials avatar -->
|
|
16
|
+
<rel-avatar
|
|
17
|
+
type="text"
|
|
18
|
+
text="JD">
|
|
19
|
+
</rel-avatar>
|
|
20
|
+
|
|
21
|
+
<!-- Icon avatar with slotted SVG -->
|
|
22
|
+
<rel-avatar type="icon">
|
|
23
|
+
<svg viewBox="0 0 24 24" fill="currentColor">
|
|
24
|
+
<path d="M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z"/>
|
|
25
|
+
</svg>
|
|
26
|
+
</rel-avatar>
|
|
27
|
+
|
|
28
|
+
<!-- Different sizes -->
|
|
29
|
+
<rel-avatar type="text" text="XS" size="xs"></rel-avatar>
|
|
30
|
+
<rel-avatar type="text" text="SM" size="sm"></rel-avatar>
|
|
31
|
+
<rel-avatar type="text" text="MD" size="md"></rel-avatar>
|
|
32
|
+
<rel-avatar type="text" text="LG" size="lg"></rel-avatar>
|
|
33
|
+
|
|
34
|
+
<!-- User list with avatars -->
|
|
35
|
+
<div style="display: flex; gap: 8px; align-items: center;">
|
|
36
|
+
<rel-avatar type="image" src="user1.jpg" size="sm"></rel-avatar>
|
|
37
|
+
<span>John Doe</span>
|
|
38
|
+
</div>
|
|
39
|
+
|
|
40
|
+
<!-- Avatar group -->
|
|
41
|
+
<div style="display: flex; margin-left: -8px;">
|
|
42
|
+
<rel-avatar type="text" text="A" size="md" style="margin-left: -8px;"></rel-avatar>
|
|
43
|
+
<rel-avatar type="text" text="B" size="md" style="margin-left: -8px;"></rel-avatar>
|
|
44
|
+
<rel-avatar type="text" text="C" size="md" style="margin-left: -8px;"></rel-avatar>
|
|
45
|
+
</div>
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## API
|
|
49
|
+
|
|
50
|
+
### Attributes/Properties
|
|
51
|
+
| Name | Type | Default | Description |
|
|
52
|
+
|------|------|---------|-------------|
|
|
53
|
+
| `size` (reflected) | `"lg" \| "md" \| "sm" \| "xs"` | `"md"` | Avatar size variant |
|
|
54
|
+
| `type` (reflected) | `"image" \| "text" \| "icon"` | `"image"` | Display type |
|
|
55
|
+
| `src` | `string` | `""` | Image URL (for `type="image"`) |
|
|
56
|
+
| `text` | `string` | `""` | Text content (for `type="text"`, usually initials) |
|
|
57
|
+
| `alt` | `string` | `"Avatar"` | Alt text for the image |
|
|
58
|
+
|
|
59
|
+
## Events
|
|
60
|
+
None.
|
|
61
|
+
|
|
62
|
+
## Slots
|
|
63
|
+
| Slot | Description |
|
|
64
|
+
|------|-------------|
|
|
65
|
+
| (default) | Custom icon content (for `type="icon"`, typically an SVG) |
|
|
66
|
+
|
|
67
|
+
## CSS Parts
|
|
68
|
+
None exposed.
|
|
69
|
+
|
|
70
|
+
## Tokens / CSS Variables
|
|
71
|
+
|
|
72
|
+
### Semantic Tokens
|
|
73
|
+
- `--rel-fontFamilies-primary` - Font family
|
|
74
|
+
|
|
75
|
+
### Font Tokens
|
|
76
|
+
- `--rel-fontSizes-xl` - Large avatar text size
|
|
77
|
+
- `--rel-fontSizes-lg` - Medium avatar text size
|
|
78
|
+
- `--rel-fontSizes-md` - Small avatar text size
|
|
79
|
+
- `--rel-fontSizes-xs` - Extra small avatar text size
|
|
80
|
+
- `--rel-fontWeights-bold` - Text font weight
|
|
81
|
+
|
|
82
|
+
### Color Tokens
|
|
83
|
+
- `--rel-colors-gray-heading` - Avatar background color
|
|
84
|
+
- `--rel-colors-white` - Text/icon color
|
|
85
|
+
|
|
86
|
+
## Accessibility
|
|
87
|
+
- Image avatars include `alt` attribute for screen readers
|
|
88
|
+
- Text is automatically uppercased for consistency
|
|
89
|
+
- Ensure meaningful `alt` text is provided for image avatars
|
|
90
|
+
|
|
91
|
+
### Keyboard Interactions
|
|
92
|
+
- None (purely presentational)
|
|
93
|
+
|
|
94
|
+
### Focus Behavior
|
|
95
|
+
- Does not receive focus
|
|
96
|
+
|
|
97
|
+
## Notes / Edge Cases
|
|
98
|
+
- **Size variants**:
|
|
99
|
+
- **lg**: 40px × 40px, font-size: `--rel-fontSizes-xl`
|
|
100
|
+
- **md**: 32px × 32px, font-size: `--rel-fontSizes-lg`
|
|
101
|
+
- **sm**: 24px × 24px, font-size: `--rel-fontSizes-md`
|
|
102
|
+
- **xs**: 18px × 18px, font-size: `--rel-fontSizes-xs`
|
|
103
|
+
|
|
104
|
+
- **Display types**:
|
|
105
|
+
- **image**: Displays an `<img>` with `src` and `alt`
|
|
106
|
+
- Uses `object-fit: cover` for proper image scaling
|
|
107
|
+
- Image is `width: 100%`, `height: 100%`
|
|
108
|
+
- **text**: Displays the `text` property in a `<span>`
|
|
109
|
+
- Text is automatically uppercased via `text-transform: uppercase`
|
|
110
|
+
- **icon**: Displays slotted content (typically SVG)
|
|
111
|
+
- Slotted SVGs are automatically sized to 50% of the avatar size
|
|
112
|
+
|
|
113
|
+
- The avatar is always circular via `border-radius: 50%`
|
|
114
|
+
- The avatar uses `overflow: hidden` to clip images to circle shape
|
|
115
|
+
- Text and icons are centered using flexbox
|
|
116
|
+
- The avatar is `inline-flex` for easy inline usage with text
|
|
117
|
+
- The `size` and `type` attributes are reflected in HTML
|
|
118
|
+
- The component uses `user-select: none` to prevent text selection
|
|
119
|
+
- If `type` is `image` but `src` is empty, nothing is displayed (no fallback)
|
|
@@ -26,8 +26,8 @@ export class RelAvatar extends LitElement {
|
|
|
26
26
|
border-radius: 50%;
|
|
27
27
|
overflow: hidden;
|
|
28
28
|
|
|
29
|
-
background-color:
|
|
30
|
-
color:
|
|
29
|
+
background-color: #9E9E9E;
|
|
30
|
+
color: #ffffff;
|
|
31
31
|
font-weight: var(--rel-fontWeights-bold);
|
|
32
32
|
|
|
33
33
|
user-select: none;
|
|
@@ -71,6 +71,7 @@ export class RelAvatar extends LitElement {
|
|
|
71
71
|
display: inline-flex;
|
|
72
72
|
align-items: center;
|
|
73
73
|
justify-content: center;
|
|
74
|
+
color: #ffffff;
|
|
74
75
|
}
|
|
75
76
|
|
|
76
77
|
.icon-slot ::slotted(svg) {
|
|
@@ -0,0 +1,86 @@
|
|
|
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
|
+
|
|
30
|
+
## API
|
|
31
|
+
|
|
32
|
+
### Attributes/Properties
|
|
33
|
+
| Name | Type | Default | Description |
|
|
34
|
+
|------|------|---------|-------------|
|
|
35
|
+
| `number` | `string` | `""` | Text to display in number variant (can be numeric or text like "99+") |
|
|
36
|
+
| `size` | `"sm" \| "md" \| "lg"` (reflected) | `"md"` | Size variant |
|
|
37
|
+
| `variant` | `"dot" \| "number"` (reflected) | `"number"` | Display mode (number shows text, dot shows indicator only) |
|
|
38
|
+
|
|
39
|
+
## Events
|
|
40
|
+
None.
|
|
41
|
+
|
|
42
|
+
## Slots
|
|
43
|
+
Default slot not used.
|
|
44
|
+
|
|
45
|
+
## CSS Parts
|
|
46
|
+
None exposed.
|
|
47
|
+
|
|
48
|
+
## Tokens / CSS Variables
|
|
49
|
+
|
|
50
|
+
### Semantic Tokens
|
|
51
|
+
- `--rel-fontFamilies-primary` - Font family
|
|
52
|
+
- `--rel-fontWeights-semibold` - Font weight (number variant)
|
|
53
|
+
- `--rel-fontSizes-xs`, `--rel-fontSizes-sm`, `--rel-fontSizes-lg` - Font sizes for number variant sizes
|
|
54
|
+
|
|
55
|
+
### Color Tokens
|
|
56
|
+
- `--rel-colors-red-primary` - Background color
|
|
57
|
+
- `--rel-colors-white` - Text color
|
|
58
|
+
|
|
59
|
+
## Accessibility
|
|
60
|
+
- Purely visual indicator (no ARIA roles)
|
|
61
|
+
- For critical information, ensure accompanying text or ARIA labels on parent elements
|
|
62
|
+
- Screen readers will not announce badge content unless used with proper labeling
|
|
63
|
+
|
|
64
|
+
### Keyboard Interactions
|
|
65
|
+
- None (not focusable)
|
|
66
|
+
|
|
67
|
+
### Focus Behavior
|
|
68
|
+
- Not focusable
|
|
69
|
+
|
|
70
|
+
## Notes / Edge Cases
|
|
71
|
+
- **Number variant sizes**:
|
|
72
|
+
- **sm**: 20px × 20px, 12px font
|
|
73
|
+
- **md**: 28px × 28px, 14px font
|
|
74
|
+
- **lg**: 40px × 40px, 20px font
|
|
75
|
+
- **Dot variant sizes**:
|
|
76
|
+
- **sm**: 8px × 8px
|
|
77
|
+
- **md**: 10px × 10px
|
|
78
|
+
- **lg**: 12px × 12px
|
|
79
|
+
- All badges are circular (`border-radius: 50%`)
|
|
80
|
+
- The `number` property accepts any string (e.g., "99+", "NEW", or numeric values)
|
|
81
|
+
- In dot variant, the `number` property is ignored and nothing is rendered inside
|
|
82
|
+
- The component is `display: inline-flex` for easy positioning
|
|
83
|
+
- Badges use `justify-content: center` and `align-items: center` for centering content
|
|
84
|
+
- `size` and `variant` are reflected attributes (appear in HTML when set)
|
|
85
|
+
- Common pattern: position badges absolutely over parent elements (e.g., icons, avatar images)
|
|
86
|
+
- For very large numbers, consider truncating or using "99+" format to avoid overflow
|
|
@@ -5,6 +5,10 @@ import { customElement, property } from "lit/decorators.js";
|
|
|
5
5
|
export class RelBadge extends LitElement {
|
|
6
6
|
@property({ type: String }) number = "";
|
|
7
7
|
|
|
8
|
+
@property({ type: String }) ariaLabel: string = "";
|
|
9
|
+
|
|
10
|
+
@property({ type: String }) suffix: string = "notifications";
|
|
11
|
+
|
|
8
12
|
@property({ type: String, reflect: true })
|
|
9
13
|
size: "sm" | "md" | "lg" = "md";
|
|
10
14
|
|
|
@@ -20,10 +24,10 @@ export class RelBadge extends LitElement {
|
|
|
20
24
|
display: inline-flex;
|
|
21
25
|
align-items: center;
|
|
22
26
|
justify-content: center;
|
|
23
|
-
font-family: var(--rel-fontFamilies-primary);
|
|
24
|
-
font-weight: 600;
|
|
27
|
+
font-family: var(--rel-fontFamilies-primary, sans-serif);
|
|
28
|
+
font-weight: var(--rel-fontWeights-semibold, 600);
|
|
25
29
|
background-color: var(--rel-colors-red-primary);
|
|
26
|
-
color:
|
|
30
|
+
color: #ffffff;
|
|
27
31
|
border-radius: 50%;
|
|
28
32
|
}
|
|
29
33
|
|
|
@@ -31,19 +35,19 @@ export class RelBadge extends LitElement {
|
|
|
31
35
|
.badge-sm {
|
|
32
36
|
width: 20px;
|
|
33
37
|
height: 20px;
|
|
34
|
-
font-size: 12px;
|
|
38
|
+
font-size: var(--rel-fontSizes-xs, 12px);
|
|
35
39
|
}
|
|
36
40
|
|
|
37
41
|
.badge-md {
|
|
38
42
|
width: 28px;
|
|
39
43
|
height: 28px;
|
|
40
|
-
font-size: 14px;
|
|
44
|
+
font-size: var(--rel-fontSizes-sm, 14px);
|
|
41
45
|
}
|
|
42
46
|
|
|
43
47
|
.badge-lg {
|
|
44
48
|
width: 40px;
|
|
45
49
|
height: 40px;
|
|
46
|
-
font-size: 20px;
|
|
50
|
+
font-size: var(--rel-fontSizes-lg, 20px);
|
|
47
51
|
}
|
|
48
52
|
|
|
49
53
|
/* DOT BADGES */
|
|
@@ -69,7 +73,7 @@ export class RelBadge extends LitElement {
|
|
|
69
73
|
|
|
70
74
|
render() {
|
|
71
75
|
return html`
|
|
72
|
-
<span class="${this.classes}">
|
|
76
|
+
<span class="${this.classes}" aria-label=${this.ariaLabel || `${this.number} ${this.suffix}`}>
|
|
73
77
|
${this.variant === "number" ? this.number : null}
|
|
74
78
|
</span>
|
|
75
79
|
`;
|
|
@@ -0,0 +1,102 @@
|
|
|
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-fontFamilies-primary` - Font family
|
|
69
|
+
- `--rel-fontSizes-md` - Font size
|
|
70
|
+
- `--rel-fontWeights-medium` - Font weight for links
|
|
71
|
+
- `--rel-fontWeights-bold` - Font weight for current page
|
|
72
|
+
|
|
73
|
+
### Color Tokens
|
|
74
|
+
- `--rel-text-primary` - Base text color
|
|
75
|
+
- `--rel-text-heading` - Link and current page text color
|
|
76
|
+
- `--rel-colors-blue-primary` - 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
|
|
@@ -14,9 +14,9 @@ export class RelBreadcrumbs extends LitElement {
|
|
|
14
14
|
static styles = css`
|
|
15
15
|
:host {
|
|
16
16
|
display: block;
|
|
17
|
-
font-family: var(--rel-fontFamilies-primary);
|
|
17
|
+
font-family: var(--rel-fontFamilies-primary, sans-serif);
|
|
18
18
|
font-size: var(--rel-fontSizes-md);
|
|
19
|
-
color: var(--rel-
|
|
19
|
+
color: var(--rel-text-primary, #333);
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
nav {
|
|
@@ -39,18 +39,24 @@ export class RelBreadcrumbs extends LitElement {
|
|
|
39
39
|
a {
|
|
40
40
|
text-decoration: none;
|
|
41
41
|
font-weight: var(--rel-fontWeights-medium);
|
|
42
|
-
color: var(--rel-
|
|
42
|
+
color: var(--rel-text-heading, #2b2b2b);
|
|
43
43
|
transition: color 0.2s ease;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
a:hover {
|
|
47
47
|
text-decoration: underline;
|
|
48
|
-
color: var(--rel-colors-primary);
|
|
48
|
+
color: var(--rel-colors-blue-primary, #0091ea);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
a:focus-visible {
|
|
52
|
+
outline: 2px solid var(--rel-colors-blue-primary, #0091ea);
|
|
53
|
+
outline-offset: 2px;
|
|
54
|
+
border-radius: 2px;
|
|
49
55
|
}
|
|
50
56
|
|
|
51
57
|
.current {
|
|
52
58
|
font-weight: var(--rel-fontWeights-bold);
|
|
53
|
-
color: var(--rel-
|
|
59
|
+
color: var(--rel-text-heading, #2b2b2b);
|
|
54
60
|
cursor: default;
|
|
55
61
|
}
|
|
56
62
|
|
|
@@ -73,7 +79,7 @@ export class RelBreadcrumbs extends LitElement {
|
|
|
73
79
|
<li>
|
|
74
80
|
${item.url && !isLast
|
|
75
81
|
? html`<a href=${item.url}>${item.label}</a>`
|
|
76
|
-
: html`<span class="current">${item.label}</span>`}
|
|
82
|
+
: html`<span class="current" aria-current="page">${item.label}</span>`}
|
|
77
83
|
${!isLast
|
|
78
84
|
? html`
|
|
79
85
|
<svg viewBox="0 0 24 24" aria-hidden="true">
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
# rel-button
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
A versatile button component with six variants (default, primary, secondary, text, link, icon), three tone options, three sizes, and configurable border radius. Features hover, active, and focus states with smooth transitions. Slots support custom content including text, icons, or combinations.
|
|
5
|
+
|
|
6
|
+
## Usage
|
|
7
|
+
```html
|
|
8
|
+
<!-- Basic variants -->
|
|
9
|
+
<rel-button variant="default">Default Button</rel-button>
|
|
10
|
+
<rel-button variant="primary">Primary Button</rel-button>
|
|
11
|
+
<rel-button variant="secondary">Secondary Button</rel-button>
|
|
12
|
+
<rel-button variant="text">Text Button</rel-button>
|
|
13
|
+
<rel-button variant="link">Link Style</rel-button>
|
|
14
|
+
|
|
15
|
+
<!-- Icon button -->
|
|
16
|
+
<rel-button variant="icon">⚙️</rel-button>
|
|
17
|
+
|
|
18
|
+
<!-- Tones (affect color scheme) -->
|
|
19
|
+
<rel-button variant="primary" tone="default">Default Tone</rel-button>
|
|
20
|
+
<rel-button variant="primary" tone="critical">Critical Action</rel-button>
|
|
21
|
+
<rel-button variant="primary" tone="success">Success Action</rel-button>
|
|
22
|
+
|
|
23
|
+
<!-- Sizes -->
|
|
24
|
+
<rel-button size="small">Small</rel-button>
|
|
25
|
+
<rel-button size="medium">Medium</rel-button>
|
|
26
|
+
<rel-button size="large">Large</rel-button>
|
|
27
|
+
|
|
28
|
+
<!-- Border radius options -->
|
|
29
|
+
<rel-button border="corner-radius">Rounded</rel-button>
|
|
30
|
+
<rel-button border="small-corner-radius">Small Rounded</rel-button>
|
|
31
|
+
<rel-button border="no-corner-radius">Sharp</rel-button>
|
|
32
|
+
|
|
33
|
+
<!-- Disabled -->
|
|
34
|
+
<rel-button disabled>Disabled Button</rel-button>
|
|
35
|
+
|
|
36
|
+
<!-- With icon and text (using slot) -->
|
|
37
|
+
<rel-button variant="primary">
|
|
38
|
+
<svg width="16" height="16" viewBox="0 0 16 16"><path d="M8 0l3 6h6l-5 4 2 6-6-4-6 4 2-6-5-4h6z"/></svg>
|
|
39
|
+
Save
|
|
40
|
+
</rel-button>
|
|
41
|
+
|
|
42
|
+
<!-- Listen for click -->
|
|
43
|
+
<rel-button id="actionBtn" variant="primary">Click Me</rel-button>
|
|
44
|
+
<script>
|
|
45
|
+
document.getElementById('actionBtn').addEventListener('click', () => {
|
|
46
|
+
console.log('Button clicked');
|
|
47
|
+
});
|
|
48
|
+
</script>
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## API
|
|
52
|
+
|
|
53
|
+
### Attributes/Properties
|
|
54
|
+
| Name | Type | Default | Description |
|
|
55
|
+
|------|------|---------|-------------|
|
|
56
|
+
| `variant` | `"default" \| "primary" \| "secondary" \| "text" \| "link" \| "icon"` | `"default"` | Visual style variant |
|
|
57
|
+
| `tone` | `"default" \| "critical" \| "success"` | `"default"` | Color tone (affects default/primary variants) |
|
|
58
|
+
| `size` | `"small" \| "medium" \| "large"` | `"medium"` | Button size |
|
|
59
|
+
| `border` | `"corner-radius" \| "small-corner-radius" \| "no-corner-radius"` | `"corner-radius"` | Border radius style |
|
|
60
|
+
| `disabled` | `boolean` (reflected) | `false` | Disables interaction and applies disabled styling |
|
|
61
|
+
|
|
62
|
+
## Events
|
|
63
|
+
| Event | Detail | Description |
|
|
64
|
+
|-------|--------|-------------|
|
|
65
|
+
| `click` | `MouseEvent` | Re-dispatched from the internal button (for framework compatibility) |
|
|
66
|
+
|
|
67
|
+
## Slots
|
|
68
|
+
| Slot | Description |
|
|
69
|
+
|------|-------------|
|
|
70
|
+
| (default) | Button content (text, icons, or combination) |
|
|
71
|
+
|
|
72
|
+
## CSS Parts
|
|
73
|
+
None exposed.
|
|
74
|
+
|
|
75
|
+
## Tokens / CSS Variables
|
|
76
|
+
|
|
77
|
+
### Semantic Tokens
|
|
78
|
+
- `--rel-fontFamilies-primary` - Font family
|
|
79
|
+
- `--rel-fontWeights-semibold` - Font weight
|
|
80
|
+
- `--rel-fontSizes-sm`, `--rel-fontSizes-md`, `--rel-fontSizes-lg` - Font sizes for sizes
|
|
81
|
+
|
|
82
|
+
### Spacing Tokens
|
|
83
|
+
- `--rel-spacing-space-2xs` - Internal gap between elements
|
|
84
|
+
- `--rel-spacing-space-md`, `--rel-spacing-space-lg`, `--rel-spacing-space-xl` - Horizontal padding by size
|
|
85
|
+
|
|
86
|
+
### Color Tokens (by variant/tone)
|
|
87
|
+
- **default + default tone**: `--rel-colors-gray-primary` (bg), `--rel-colors-white` (text)
|
|
88
|
+
- **default + critical tone**: `--rel-colors-red-primary` (bg), `--rel-colors-white` (text)
|
|
89
|
+
- **default + success tone**: `--rel-colors-green-success` (bg), `--rel-colors-white` (text)
|
|
90
|
+
- **primary + default tone**: `--rel-colors-green-primary` (bg), `--rel-colors-black` (text)
|
|
91
|
+
- **primary + critical tone**: `--rel-colors-red-primary` (bg), `--rel-colors-white` (text)
|
|
92
|
+
- **primary + success tone**: `--rel-colors-green-success` (bg), `--rel-colors-white` (text)
|
|
93
|
+
- **secondary**: `--rel-colors-white` (bg), `--rel-colors-black` (text + border)
|
|
94
|
+
- **text**: transparent (bg), `--rel-colors-black` (text)
|
|
95
|
+
- **link**: transparent (bg), `--rel-colors-blue-primary` (text), underlined
|
|
96
|
+
- **icon**: `--rel-colors-gray-light` (bg), `--rel-colors-black` (text), circular (40px × 40px)
|
|
97
|
+
- **disabled**: `--rel-colors-gray-border` (bg), `--rel-colors-gray-disabled-text` (text)
|
|
98
|
+
|
|
99
|
+
### Border Tokens
|
|
100
|
+
- `--rel-borders-radius-border-radius-500` - Large corner radius
|
|
101
|
+
- `--rel-borders-radius-border-radius-200` - Small corner radius
|
|
102
|
+
- `--rel-borders-radius-border-radius-0` - No corner radius
|
|
103
|
+
|
|
104
|
+
## Accessibility
|
|
105
|
+
- Uses native `<button>` element for proper semantics
|
|
106
|
+
- `aria-disabled` attribute set on disabled buttons
|
|
107
|
+
- Focus visible state with blue outline
|
|
108
|
+
- Keyboard accessible (Space/Enter activation)
|
|
109
|
+
|
|
110
|
+
### Keyboard Interactions
|
|
111
|
+
- `Tab` - Focus the button
|
|
112
|
+
- `Space/Enter` - Activate the button
|
|
113
|
+
|
|
114
|
+
### Focus Behavior
|
|
115
|
+
- Blue 2px outline with 2px offset on focus-visible
|
|
116
|
+
- Focus outline works across all variants
|
|
117
|
+
|
|
118
|
+
## Notes / Edge Cases
|
|
119
|
+
- **Icon variant** is always circular (40px × 40px), ignores size property, and has no padding
|
|
120
|
+
- **Link variant** has `text-decoration: underline`
|
|
121
|
+
- **Secondary variant** includes a 1px border matching the text color
|
|
122
|
+
- Hover effect applies `filter: brightness(0.92)` to darken
|
|
123
|
+
- Active (pressed) effect applies `transform: scale(0.97)` for tactile feedback
|
|
124
|
+
- Disabled buttons have `pointer-events: none` and use `!important` to override theming
|
|
125
|
+
- The component re-dispatches click events to ensure framework compatibility (e.g., Angular)
|
|
126
|
+
- Clicking a disabled button prevents default and stops propagation
|
|
127
|
+
- Size variants affect height (32px/40px/48px) and horizontal padding
|
|
128
|
+
- The button has `display: inline-flex` with `align-items: center` and `justify-content: center`
|
|
129
|
+
- Internal gap of `var(--rel-spacing-space-2xs)` allows icons + text combinations
|
|
130
|
+
- Transitions are `0.15s ease` for all visual changes
|