@reliability-design/web 1.0.2 → 1.0.6
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 +61 -29
- package/dist/components/rel-alert/README.md +141 -0
- package/dist/components/rel-alert/rel-alert.ts +110 -67
- package/dist/components/rel-avatar/README.md +119 -0
- package/dist/components/rel-avatar/rel-avatar.ts +8 -15
- package/dist/components/rel-badge/README.md +86 -0
- package/dist/components/rel-badge/rel-badge.ts +28 -21
- package/dist/components/rel-breadcrumb/README.md +102 -0
- package/dist/components/rel-breadcrumb/rel-breadcrumb.ts +24 -18
- package/dist/components/rel-button/README.md +130 -0
- package/dist/components/rel-button/rel-button.ts +39 -59
- 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 +21 -11
- package/dist/components/rel-cardmedia/README.md +127 -0
- package/dist/components/rel-cardmedia/rel-cardmedia.ts +22 -18
- 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 +469 -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 +36 -45
- package/dist/components/rel-chip/README.md +114 -0
- package/dist/components/rel-chip/rel-chip.ts +47 -122
- package/dist/components/rel-container/README.md +99 -0
- package/dist/components/rel-container/rel-container.ts +1 -6
- 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 +37 -37
- 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.ts +621 -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-layout/rel-layout.ts +12 -14
- package/dist/components/rel-menu/README.md +151 -0
- package/dist/components/rel-menu/rel-menu.ts +18 -10
- 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 +576 -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 +143 -0
- package/dist/components/rel-nav-menu/rel-nav-menu-panel.ts +53 -0
- package/dist/components/rel-nav-menu/rel-nav-menu.ts +331 -0
- package/dist/components/rel-navbar/README.md +126 -0
- package/dist/components/rel-navbar/rel-navbar.ts +91 -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 +376 -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 +327 -0
- package/dist/components/rel-progress/README.md +110 -0
- package/dist/components/rel-progress/rel-progress.ts +58 -20
- package/dist/components/rel-quote-page/README.md +166 -0
- package/dist/components/rel-quote-page/rel-quote-page.ts +816 -0
- package/dist/components/rel-radio/README.md +120 -0
- package/dist/components/rel-radio/rel-radio.ts +41 -73
- 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 +149 -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 +14 -14
- package/dist/components/rel-sheet/README.md +224 -0
- package/dist/components/rel-sheet/rel-sheet.ts +683 -0
- package/dist/components/rel-sidebar/README.md +209 -0
- package/dist/components/rel-sidebar/rel-sidebar.ts +1158 -0
- package/dist/components/rel-slider/README.md +135 -0
- package/dist/components/rel-slider/rel-slider.ts +19 -7
- package/dist/components/rel-snackbar/README.md +134 -0
- package/dist/components/rel-snackbar/rel-snackbar.ts +73 -2
- package/dist/components/rel-stepper/README.md +160 -0
- package/dist/components/rel-stepper/rel-stepper.ts +29 -8
- package/dist/components/rel-switch/README.md +102 -0
- package/dist/components/rel-switch/rel-switch.ts +22 -11
- package/dist/components/rel-tab/README.md +163 -0
- package/dist/components/rel-tab/rel-tab.ts +46 -22
- package/dist/components/rel-table/README.md +178 -0
- package/dist/components/rel-table/rel-table-body.ts +16 -0
- package/dist/components/rel-table/rel-table-caption.ts +22 -0
- package/dist/components/rel-table/rel-table-cell.ts +49 -0
- package/dist/components/rel-table/rel-table-footer.ts +18 -0
- package/dist/components/rel-table/rel-table-head.ts +33 -0
- package/dist/components/rel-table/rel-table-header.ts +16 -0
- package/dist/components/rel-table/rel-table-row.ts +32 -0
- package/dist/components/rel-table/rel-table.ts +47 -0
- package/dist/components/rel-textfield/README.md +90 -0
- package/dist/components/rel-textfield/rel-textfield.ts +37 -21
- package/dist/components/rel-toast/README.md +148 -0
- package/dist/components/rel-toast/rel-toast.ts +32 -14
- package/dist/components/rel-tooltip/README.md +103 -0
- package/dist/components/rel-tooltip/rel-tooltip.ts +9 -9
- package/dist/index.d.mts +846 -7
- package/dist/index.d.ts +846 -7
- package/dist/index.js +10860 -1803
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +10820 -1809
- package/dist/index.mjs.map +1 -1
- package/dist/styles/vars.css +293 -183
- package/dist/vars-ITL2K3KO.css +294 -0
- package/package.json +2 -2
- package/dist/components/rel-accordion/rel-accordion.stories.ts +0 -313
- package/dist/components/rel-alert/rel-alert.stories.ts +0 -412
- package/dist/components/rel-avatar/rel-avatar.stories.ts +0 -327
- package/dist/components/rel-badge/rel-badge.stories.ts +0 -350
- package/dist/components/rel-breadcrumb/rel-breadcrumb.stories.ts +0 -306
- package/dist/components/rel-button/rel-button.stories.ts +0 -356
- package/dist/components/rel-card/rel-card.stories.ts +0 -299
- package/dist/components/rel-cardmedia/rel-cardmedia.stories.ts +0 -368
- package/dist/components/rel-checkbox/rel-checkbox.stories.ts +0 -414
- package/dist/components/rel-chip/rel-chip.stories.ts +0 -552
- package/dist/components/rel-container/rel-container.stories.ts +0 -239
- package/dist/components/rel-divider/rel-divider.stories.ts +0 -229
- package/dist/components/rel-layout/rel-layout.stories.ts +0 -713
- package/dist/components/rel-menu/rel-menu.stories.ts +0 -910
- package/dist/components/rel-progress/rel-progress.stories.ts +0 -817
- package/dist/components/rel-radio/rel-radio.stories.ts +0 -1048
- package/dist/components/rel-segmented-button/rel-segmented-button.stories.ts +0 -1079
- package/dist/components/rel-select/rel-select.stories.ts +0 -1201
- package/dist/components/rel-slider/rel-slider.stories.ts +0 -730
- package/dist/components/rel-snackbar/rel-snackbar.stories.ts +0 -808
- package/dist/components/rel-stepper/rel-stepper.stories.ts +0 -752
- package/dist/components/rel-switch/rel-switch.stories.ts +0 -441
- package/dist/components/rel-tab/rel-tab.stories.ts +0 -492
- package/dist/components/rel-textfield/rel-textfield.stories.ts +0 -710
- package/dist/components/rel-toast/rel-toast.stories.ts +0 -394
- package/dist/components/rel-tooltip/rel-tooltip.stories.ts +0 -364
|
@@ -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
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
import { LitElement, html, css } from "lit";
|
|
2
2
|
import { customElement, property } from "lit/decorators.js";
|
|
3
3
|
|
|
4
|
-
interface BreadcrumbItem {
|
|
4
|
+
export interface BreadcrumbItem {
|
|
5
5
|
label: string;
|
|
6
6
|
url?: string;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
@customElement("rel-breadcrumbs")
|
|
10
10
|
export class RelBreadcrumbs extends LitElement {
|
|
11
|
-
@property({ type: Array })
|
|
11
|
+
@property({ type: Array })
|
|
12
|
+
items: BreadcrumbItem[] = [];
|
|
12
13
|
|
|
13
14
|
static styles = css`
|
|
14
15
|
:host {
|
|
15
16
|
display: block;
|
|
16
|
-
font-family: var(--rel-fontFamilies-primary);
|
|
17
|
+
font-family: var(--rel-fontFamilies-primary, sans-serif);
|
|
17
18
|
font-size: var(--rel-fontSizes-md);
|
|
18
|
-
color: var(--rel-
|
|
19
|
+
color: var(--rel-text-primary, #333);
|
|
19
20
|
}
|
|
20
21
|
|
|
21
22
|
nav {
|
|
22
|
-
display: block;
|
|
23
23
|
width: 100%;
|
|
24
24
|
}
|
|
25
25
|
|
|
@@ -39,23 +39,29 @@ 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
|
|
|
57
63
|
svg {
|
|
58
|
-
stroke:
|
|
64
|
+
stroke: currentColor;
|
|
59
65
|
width: 16px;
|
|
60
66
|
height: 16px;
|
|
61
67
|
margin: 0 10px;
|
|
@@ -67,26 +73,26 @@ export class RelBreadcrumbs extends LitElement {
|
|
|
67
73
|
<nav aria-label="Breadcrumb">
|
|
68
74
|
<ol>
|
|
69
75
|
${this.items.map((item, index) => {
|
|
70
|
-
const
|
|
76
|
+
const isLast = index === this.items.length - 1;
|
|
77
|
+
|
|
71
78
|
return html`
|
|
72
79
|
<li>
|
|
73
|
-
${item.url && !
|
|
74
|
-
? html`<a href
|
|
75
|
-
: html`<span class="current">${item.label}</span>`}
|
|
76
|
-
${!
|
|
80
|
+
${item.url && !isLast
|
|
81
|
+
? html`<a href=${item.url}>${item.label}</a>`
|
|
82
|
+
: html`<span class="current" aria-current="page">${item.label}</span>`}
|
|
83
|
+
${!isLast
|
|
77
84
|
? html`
|
|
78
|
-
<svg viewBox="0 0 24 24">
|
|
85
|
+
<svg viewBox="0 0 24 24" aria-hidden="true">
|
|
79
86
|
<polyline
|
|
80
87
|
points="9 18 15 12 9 6"
|
|
81
88
|
fill="none"
|
|
82
|
-
stroke="currentColor"
|
|
83
89
|
stroke-width="2"
|
|
84
90
|
stroke-linecap="round"
|
|
85
91
|
stroke-linejoin="round"
|
|
86
|
-
|
|
92
|
+
/>
|
|
87
93
|
</svg>
|
|
88
94
|
`
|
|
89
|
-
:
|
|
95
|
+
: null}
|
|
90
96
|
</li>
|
|
91
97
|
`;
|
|
92
98
|
})}
|
|
@@ -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
|
|
@@ -3,23 +3,19 @@ import { customElement, property } from "lit/decorators.js";
|
|
|
3
3
|
|
|
4
4
|
@customElement("rel-button")
|
|
5
5
|
export class RelButton extends LitElement {
|
|
6
|
-
@property({ type: String })
|
|
7
|
-
|
|
8
|
-
| "primary"
|
|
9
|
-
| "secondary"
|
|
10
|
-
| "text"
|
|
11
|
-
| "link"
|
|
12
|
-
| "icon" = "default";
|
|
13
|
-
|
|
14
|
-
@property({ type: String }) tone: "default" | "critical" | "success" =
|
|
6
|
+
@property({ type: String })
|
|
7
|
+
variant: "default" | "primary" | "secondary" | "text" | "link" | "icon" =
|
|
15
8
|
"default";
|
|
16
9
|
|
|
17
|
-
@property({ type: String })
|
|
10
|
+
@property({ type: String })
|
|
11
|
+
tone: "default" | "critical" | "success" = "default";
|
|
18
12
|
|
|
19
|
-
@property({ type: String })
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
13
|
+
@property({ type: String })
|
|
14
|
+
size: "small" | "medium" | "large" = "medium";
|
|
15
|
+
|
|
16
|
+
@property({ type: String })
|
|
17
|
+
border: "corner-radius" | "small-corner-radius" | "no-corner-radius" =
|
|
18
|
+
"corner-radius";
|
|
23
19
|
|
|
24
20
|
@property({ type: Boolean, reflect: true }) disabled = false;
|
|
25
21
|
|
|
@@ -41,9 +37,7 @@ export class RelButton extends LitElement {
|
|
|
41
37
|
outline: none;
|
|
42
38
|
}
|
|
43
39
|
|
|
44
|
-
/*
|
|
45
|
-
SIZES (Figma)
|
|
46
|
-
-------------------------- */
|
|
40
|
+
/* Sizes */
|
|
47
41
|
.size-small {
|
|
48
42
|
height: 32px;
|
|
49
43
|
padding: 0 var(--rel-spacing-space-md);
|
|
@@ -62,9 +56,7 @@ export class RelButton extends LitElement {
|
|
|
62
56
|
font-size: var(--rel-fontSizes-lg);
|
|
63
57
|
}
|
|
64
58
|
|
|
65
|
-
/*
|
|
66
|
-
BORDER RADII (Tokens)
|
|
67
|
-
-------------------------- */
|
|
59
|
+
/* Borders */
|
|
68
60
|
.border-corner-radius {
|
|
69
61
|
border-radius: var(--rel-borders-radius-border-radius-500);
|
|
70
62
|
}
|
|
@@ -77,24 +69,15 @@ export class RelButton extends LitElement {
|
|
|
77
69
|
border-radius: var(--rel-borders-radius-border-radius-0);
|
|
78
70
|
}
|
|
79
71
|
|
|
80
|
-
/*
|
|
81
|
-
|
|
82
|
-
-------------------------- */
|
|
83
|
-
:host([disabled]) button,
|
|
84
|
-
button:disabled {
|
|
72
|
+
/* Disabled */
|
|
73
|
+
:host([disabled]) button {
|
|
85
74
|
cursor: not-allowed;
|
|
86
75
|
background-color: var(--rel-colors-gray-border) !important;
|
|
87
76
|
color: var(--rel-colors-gray-disabled-text) !important;
|
|
88
|
-
border-color: var(--rel-colors-gray-border) !important;
|
|
89
|
-
opacity: 1;
|
|
90
77
|
pointer-events: none;
|
|
91
78
|
}
|
|
92
79
|
|
|
93
|
-
/*
|
|
94
|
-
VARIANTS & TONES
|
|
95
|
-
-------------------------- */
|
|
96
|
-
|
|
97
|
-
/* DEFAULT */
|
|
80
|
+
/* Variants & tones (unchanged) */
|
|
98
81
|
.btn-default.tone-default {
|
|
99
82
|
background: var(--rel-colors-gray-primary);
|
|
100
83
|
color: var(--rel-colors-white);
|
|
@@ -108,7 +91,6 @@ export class RelButton extends LitElement {
|
|
|
108
91
|
color: var(--rel-colors-white);
|
|
109
92
|
}
|
|
110
93
|
|
|
111
|
-
/* PRIMARY */
|
|
112
94
|
.btn-primary.tone-default {
|
|
113
95
|
background: var(--rel-colors-green-primary);
|
|
114
96
|
color: var(--rel-colors-black);
|
|
@@ -122,27 +104,23 @@ export class RelButton extends LitElement {
|
|
|
122
104
|
color: var(--rel-colors-white);
|
|
123
105
|
}
|
|
124
106
|
|
|
125
|
-
/* SECONDARY */
|
|
126
107
|
.btn-secondary {
|
|
127
108
|
background: var(--rel-colors-white);
|
|
128
109
|
border: 1px solid var(--rel-colors-black);
|
|
129
110
|
color: var(--rel-colors-black);
|
|
130
111
|
}
|
|
131
112
|
|
|
132
|
-
/* TEXT */
|
|
133
113
|
.btn-text {
|
|
134
114
|
background: transparent;
|
|
135
115
|
color: var(--rel-colors-black);
|
|
136
116
|
}
|
|
137
117
|
|
|
138
|
-
/* LINK */
|
|
139
118
|
.btn-link {
|
|
140
119
|
background: transparent;
|
|
141
120
|
color: var(--rel-colors-blue-primary);
|
|
142
121
|
text-decoration: underline;
|
|
143
122
|
}
|
|
144
123
|
|
|
145
|
-
/* ICON */
|
|
146
124
|
.btn-icon {
|
|
147
125
|
width: 40px;
|
|
148
126
|
height: 40px;
|
|
@@ -152,32 +130,14 @@ export class RelButton extends LitElement {
|
|
|
152
130
|
color: var(--rel-colors-black);
|
|
153
131
|
}
|
|
154
132
|
|
|
155
|
-
|
|
156
|
-
STATES: Hover / Active
|
|
157
|
-
-------------------------- */
|
|
158
|
-
button:hover:not(.btn-disabled) {
|
|
133
|
+
button:hover:not(:disabled) {
|
|
159
134
|
filter: brightness(0.92);
|
|
160
135
|
}
|
|
161
136
|
|
|
162
|
-
button:active:not(
|
|
137
|
+
button:active:not(:disabled) {
|
|
163
138
|
transform: scale(0.97);
|
|
164
139
|
}
|
|
165
140
|
|
|
166
|
-
/* TEXT BUTTON — hover border */
|
|
167
|
-
.btn-text:not(.btn-disabled):hover {
|
|
168
|
-
border: 1px solid var(--rel-colors-black);
|
|
169
|
-
text-decoration: none;
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
/* LINK BUTTON — hover border */
|
|
173
|
-
.btn-link:not(.btn-disabled):hover {
|
|
174
|
-
border: 1px solid var(--rel-colors-blue-primary);
|
|
175
|
-
text-decoration: underline;
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
/* -------------------------
|
|
179
|
-
FOCUS RING
|
|
180
|
-
-------------------------- */
|
|
181
141
|
button:focus-visible {
|
|
182
142
|
outline: 2px solid var(--rel-colors-blue-primary);
|
|
183
143
|
outline-offset: 2px;
|
|
@@ -190,13 +150,33 @@ export class RelButton extends LitElement {
|
|
|
190
150
|
`tone-${this.tone}`,
|
|
191
151
|
`size-${this.size}`,
|
|
192
152
|
`border-${this.border}`,
|
|
193
|
-
this.disabled ? "btn-disabled" : "",
|
|
194
153
|
].join(" ");
|
|
195
154
|
}
|
|
196
155
|
|
|
156
|
+
private handleClick(e: MouseEvent) {
|
|
157
|
+
if (this.disabled) {
|
|
158
|
+
e.preventDefault();
|
|
159
|
+
e.stopImmediatePropagation();
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
// Re-emit click from host (Angular-friendly)
|
|
164
|
+
this.dispatchEvent(
|
|
165
|
+
new MouseEvent("click", {
|
|
166
|
+
bubbles: true,
|
|
167
|
+
composed: true,
|
|
168
|
+
})
|
|
169
|
+
);
|
|
170
|
+
}
|
|
171
|
+
|
|
197
172
|
render() {
|
|
198
173
|
return html`
|
|
199
|
-
<button
|
|
174
|
+
<button
|
|
175
|
+
class="${this.classes}"
|
|
176
|
+
?disabled=${this.disabled}
|
|
177
|
+
@click=${this.handleClick}
|
|
178
|
+
aria-disabled=${this.disabled}
|
|
179
|
+
>
|
|
200
180
|
<slot></slot>
|
|
201
181
|
</button>
|
|
202
182
|
`;
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
# rel-calendar
|
|
2
|
+
|
|
3
|
+
A fully accessible calendar component built with Lit for the Reliability Design System.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- Single date selection
|
|
8
|
+
- Month navigation
|
|
9
|
+
- Keyboard navigation support (arrow keys, Home/End, PageUp/PageDown)
|
|
10
|
+
- Min/max date constraints
|
|
11
|
+
- Custom disabled date predicate
|
|
12
|
+
- Configurable week start (Sunday or Monday)
|
|
13
|
+
- Locale-aware month names
|
|
14
|
+
- Today indicator
|
|
15
|
+
- Full ARIA support
|
|
16
|
+
|
|
17
|
+
## Usage
|
|
18
|
+
|
|
19
|
+
```html
|
|
20
|
+
<rel-calendar></rel-calendar>
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
### With value
|
|
24
|
+
|
|
25
|
+
```html
|
|
26
|
+
<rel-calendar value="2026-01-16"></rel-calendar>
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### With min/max
|
|
30
|
+
|
|
31
|
+
```html
|
|
32
|
+
<rel-calendar
|
|
33
|
+
min="2026-01-01"
|
|
34
|
+
max="2026-12-31"
|
|
35
|
+
></rel-calendar>
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### Week starting Monday
|
|
39
|
+
|
|
40
|
+
```html
|
|
41
|
+
<rel-calendar week-start="mon"></rel-calendar>
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### Disabled
|
|
45
|
+
|
|
46
|
+
```html
|
|
47
|
+
<rel-calendar disabled></rel-calendar>
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### Custom disabled dates (JavaScript)
|
|
51
|
+
|
|
52
|
+
```javascript
|
|
53
|
+
const calendar = document.querySelector('rel-calendar');
|
|
54
|
+
|
|
55
|
+
// Disable weekends
|
|
56
|
+
calendar.isDateDisabled = (date) => {
|
|
57
|
+
const day = date.getDay();
|
|
58
|
+
return day === 0 || day === 6; // Sunday or Saturday
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
// Listen to changes
|
|
62
|
+
calendar.addEventListener('rel-change', (e) => {
|
|
63
|
+
console.log('Selected date:', e.detail.value); // "2026-01-16"
|
|
64
|
+
console.log('Selected date object:', e.detail.date); // Date object
|
|
65
|
+
});
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Attributes
|
|
69
|
+
|
|
70
|
+
| Attribute | Type | Default | Description |
|
|
71
|
+
|-----------|------|---------|-------------|
|
|
72
|
+
| `value` | `string \| null` | `null` | Selected date in ISO format (YYYY-MM-DD) |
|
|
73
|
+
| `min` | `string \| null` | `null` | Minimum selectable date (ISO format) |
|
|
74
|
+
| `max` | `string \| null` | `null` | Maximum selectable date (ISO format) |
|
|
75
|
+
| `disabled` | `boolean` | `false` | Disables all interaction |
|
|
76
|
+
| `week-start` | `"sun" \| "mon"` | `"sun"` | First day of the week |
|
|
77
|
+
| `locale` | `string` | `"en-US"` | Locale for month names (uses Intl.DateTimeFormat) |
|
|
78
|
+
|
|
79
|
+
## Properties
|
|
80
|
+
|
|
81
|
+
| Property | Type | Description |
|
|
82
|
+
|----------|------|-------------|
|
|
83
|
+
| `isDateDisabled` | `(date: Date) => boolean` | Custom function to disable specific dates |
|
|
84
|
+
|
|
85
|
+
## Events
|
|
86
|
+
|
|
87
|
+
| Event | Detail | Description |
|
|
88
|
+
|-------|--------|-------------|
|
|
89
|
+
| `rel-change` | `{ value: string \| null, date: Date \| null }` | Fired when selection changes |
|
|
90
|
+
|
|
91
|
+
## Keyboard Navigation
|
|
92
|
+
|
|
93
|
+
- **Arrow keys**: Move focus by day (left/right) and week (up/down)
|
|
94
|
+
- **Home/End**: Jump to start/end of current week
|
|
95
|
+
- **PageUp/PageDown**: Change month
|
|
96
|
+
- **Shift + PageUp/PageDown**: Change year
|
|
97
|
+
- **Enter/Space**: Select focused day
|
|
98
|
+
|
|
99
|
+
## Styling
|
|
100
|
+
|
|
101
|
+
The component uses design tokens from the Reliability Design System. All colors, spacing, and typography are inherited from CSS variables.
|
|
102
|
+
|
|
103
|
+
Key tokens used:
|
|
104
|
+
- `--rel-colors-*` for colors
|
|
105
|
+
- `--rel-spacing-*` for spacing
|
|
106
|
+
- `--rel-fontSizes-*`, `--rel-fontWeights-*` for typography
|
|
107
|
+
- `--rel-borders-radius-*` for border radius
|
|
108
|
+
- Focus outline uses `--rel-colors-blue-primary`
|
|
109
|
+
- Selected state uses `--rel-colors-green-primary`
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./rel-calendar";
|