@reliability-design/web 1.0.3 → 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 +43 -16
- package/dist/components/rel-alert/README.md +141 -0
- package/dist/components/rel-alert/rel-alert.ts +18 -7
- package/dist/components/rel-avatar/README.md +119 -0
- package/dist/components/rel-badge/README.md +86 -0
- package/dist/components/rel-badge/rel-badge.ts +6 -6
- 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-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 +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 +18 -10
- package/dist/components/rel-chip/README.md +114 -0
- package/dist/components/rel-chip/rel-chip.ts +20 -4
- 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-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-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 +32 -5
- 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 +13 -5
- 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 +67 -2
- package/dist/components/rel-stepper/README.md +160 -0
- package/dist/components/rel-stepper/rel-stepper.ts +6 -6
- package/dist/components/rel-switch/README.md +102 -0
- package/dist/components/rel-switch/rel-switch.ts +15 -6
- package/dist/components/rel-tab/README.md +163 -0
- package/dist/components/rel-tab/rel-tab.ts +36 -14
- 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 +35 -19
- 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 +836 -1
- package/dist/index.d.ts +836 -1
- package/dist/index.js +10658 -1493
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +10616 -1499
- package/dist/index.mjs.map +1 -1
- package/dist/styles/vars.css +293 -183
- package/dist/{vars-6ZIUPIU4.css → vars-ITL2K3KO.css} +293 -183
- package/package.json +1 -1
|
@@ -20,10 +20,10 @@ export class RelBadge extends LitElement {
|
|
|
20
20
|
display: inline-flex;
|
|
21
21
|
align-items: center;
|
|
22
22
|
justify-content: center;
|
|
23
|
-
font-family: var(--rel-fontFamilies-primary);
|
|
24
|
-
font-weight: 600;
|
|
23
|
+
font-family: var(--rel-fontFamilies-primary, sans-serif);
|
|
24
|
+
font-weight: var(--rel-fontWeights-semibold, 600);
|
|
25
25
|
background-color: var(--rel-colors-red-primary);
|
|
26
|
-
color: var(--rel-colors-white);
|
|
26
|
+
color: var(--rel-colors-white, #fff);
|
|
27
27
|
border-radius: 50%;
|
|
28
28
|
}
|
|
29
29
|
|
|
@@ -31,19 +31,19 @@ export class RelBadge extends LitElement {
|
|
|
31
31
|
.badge-sm {
|
|
32
32
|
width: 20px;
|
|
33
33
|
height: 20px;
|
|
34
|
-
font-size: 12px;
|
|
34
|
+
font-size: var(--rel-fontSizes-xs, 12px);
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
.badge-md {
|
|
38
38
|
width: 28px;
|
|
39
39
|
height: 28px;
|
|
40
|
-
font-size: 14px;
|
|
40
|
+
font-size: var(--rel-fontSizes-sm, 14px);
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
.badge-lg {
|
|
44
44
|
width: 40px;
|
|
45
45
|
height: 40px;
|
|
46
|
-
font-size: 20px;
|
|
46
|
+
font-size: var(--rel-fontSizes-lg, 20px);
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
/* DOT BADGES */
|
|
@@ -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
|
|
@@ -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";
|