@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,99 @@
|
|
|
1
|
+
# rel-container
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
A versatile container component providing configurable padding, background colors, and optional shadow. Ideal for wrapping content sections with consistent spacing and theming.
|
|
5
|
+
|
|
6
|
+
## Usage
|
|
7
|
+
```html
|
|
8
|
+
<!-- Default container (white background, medium padding) -->
|
|
9
|
+
<rel-container>
|
|
10
|
+
<h2>Section Title</h2>
|
|
11
|
+
<p>Content goes here</p>
|
|
12
|
+
</rel-container>
|
|
13
|
+
|
|
14
|
+
<!-- Light background with small padding -->
|
|
15
|
+
<rel-container background="light" padding="sm">
|
|
16
|
+
<p>Compact section with light background</p>
|
|
17
|
+
</rel-container>
|
|
18
|
+
|
|
19
|
+
<!-- Large padding with shadow -->
|
|
20
|
+
<rel-container padding="lg" shadow>
|
|
21
|
+
<h1>Hero Section</h1>
|
|
22
|
+
<p>With shadow elevation</p>
|
|
23
|
+
</rel-container>
|
|
24
|
+
|
|
25
|
+
<!-- Transparent background -->
|
|
26
|
+
<rel-container background="none">
|
|
27
|
+
<div>Content with transparent background</div>
|
|
28
|
+
</rel-container>
|
|
29
|
+
|
|
30
|
+
<!-- All options combined -->
|
|
31
|
+
<rel-container background="white" padding="md" shadow>
|
|
32
|
+
<h3>Card-like Container</h3>
|
|
33
|
+
<p>White background, medium padding, with shadow</p>
|
|
34
|
+
</rel-container>
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## API
|
|
38
|
+
|
|
39
|
+
### Attributes/Properties
|
|
40
|
+
| Name | Type | Default | Description |
|
|
41
|
+
|------|------|---------|-------------|
|
|
42
|
+
| `padding` | `"sm" \| "md" \| "lg"` | `"md"` | Padding size variant |
|
|
43
|
+
| `shadow` | `boolean` | `false` | Enable box shadow |
|
|
44
|
+
| `background` | `"light" \| "white" \| "none"` | `"white"` | Background color variant |
|
|
45
|
+
|
|
46
|
+
## Events
|
|
47
|
+
None.
|
|
48
|
+
|
|
49
|
+
## Slots
|
|
50
|
+
| Slot | Description |
|
|
51
|
+
|------|-------------|
|
|
52
|
+
| (default) | Container content (any HTML elements) |
|
|
53
|
+
|
|
54
|
+
## CSS Parts
|
|
55
|
+
None exposed.
|
|
56
|
+
|
|
57
|
+
## Tokens / CSS Variables
|
|
58
|
+
|
|
59
|
+
### Color Tokens
|
|
60
|
+
- `--rel-colors-white` - White background color
|
|
61
|
+
- `--rel-colors-gray-light` - Light background color
|
|
62
|
+
|
|
63
|
+
### Shadow Tokens
|
|
64
|
+
- `--rel-shadows-shadow-300` - Shadow when `shadow` is true
|
|
65
|
+
|
|
66
|
+
### Border Tokens
|
|
67
|
+
- `--rel-borders-radius-border-radius-200` - Container border radius
|
|
68
|
+
|
|
69
|
+
### Spacing Tokens
|
|
70
|
+
- `--rel-spacing-space-xs` - Small padding
|
|
71
|
+
- `--rel-spacing-space-md` - Medium padding
|
|
72
|
+
- `--rel-spacing-space-2xl` - Large padding
|
|
73
|
+
|
|
74
|
+
## Accessibility
|
|
75
|
+
- Purely presentational container, no specific accessibility features
|
|
76
|
+
- Ensure slotted content includes proper semantic HTML
|
|
77
|
+
|
|
78
|
+
### Keyboard Interactions
|
|
79
|
+
- None (purely presentational container)
|
|
80
|
+
|
|
81
|
+
### Focus Behavior
|
|
82
|
+
- No specific focus handling
|
|
83
|
+
|
|
84
|
+
## Notes / Edge Cases
|
|
85
|
+
- **Padding variants**:
|
|
86
|
+
- **sm**: Uses `--rel-spacing-space-xs`
|
|
87
|
+
- **md**: Uses `--rel-spacing-space-md`
|
|
88
|
+
- **lg**: Uses `--rel-spacing-space-2xl`
|
|
89
|
+
|
|
90
|
+
- **Background variants**:
|
|
91
|
+
- **white**: White background (`--rel-colors-white`)
|
|
92
|
+
- **light**: Light gray background (`--rel-colors-gray-light`)
|
|
93
|
+
- **none**: Transparent background
|
|
94
|
+
|
|
95
|
+
- The component is `display: block` and `width: 100%` with `box-sizing: border-box`
|
|
96
|
+
- All styles are applied to an internal `.reliability-container` div
|
|
97
|
+
- The border-radius is always applied regardless of background variant
|
|
98
|
+
- The shadow is applied via the `--rel-shadows-shadow-300` token when `shadow` is true
|
|
99
|
+
- Slotted content inherits the padding and background from the container
|
|
@@ -4,9 +4,7 @@ import { customElement, property } from "lit/decorators.js";
|
|
|
4
4
|
@customElement("rel-container")
|
|
5
5
|
export class RelContainer extends LitElement {
|
|
6
6
|
@property({ type: String }) padding: "sm" | "md" | "lg" = "md";
|
|
7
|
-
|
|
8
|
-
@property({ type: Boolean }) shadow: boolean = false;
|
|
9
|
-
|
|
7
|
+
@property({ type: Boolean }) shadow = false;
|
|
10
8
|
@property({ type: String }) background: "light" | "white" | "none" = "white";
|
|
11
9
|
|
|
12
10
|
static styles = css`
|
|
@@ -23,7 +21,6 @@ export class RelContainer extends LitElement {
|
|
|
23
21
|
box-sizing: border-box;
|
|
24
22
|
}
|
|
25
23
|
|
|
26
|
-
/* Background Variants */
|
|
27
24
|
.bg-white {
|
|
28
25
|
background-color: var(--rel-colors-white);
|
|
29
26
|
}
|
|
@@ -36,7 +33,6 @@ export class RelContainer extends LitElement {
|
|
|
36
33
|
background: transparent;
|
|
37
34
|
}
|
|
38
35
|
|
|
39
|
-
/* Padding Variants */
|
|
40
36
|
.padding-sm {
|
|
41
37
|
padding: var(--rel-spacing-space-xs);
|
|
42
38
|
}
|
|
@@ -49,7 +45,6 @@ export class RelContainer extends LitElement {
|
|
|
49
45
|
padding: var(--rel-spacing-space-2xl);
|
|
50
46
|
}
|
|
51
47
|
|
|
52
|
-
/* Shadow */
|
|
53
48
|
.shadow {
|
|
54
49
|
box-shadow: var(--rel-shadows-shadow-300);
|
|
55
50
|
}
|
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
# rel-date-picker
|
|
2
|
+
|
|
3
|
+
A fully accessible date picker component built with Lit for the Reliability Design System. Features a trigger button with calendar popover including month/year dropdowns.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- Trigger button with calendar popover
|
|
8
|
+
- Month and year dropdowns for easy navigation
|
|
9
|
+
- Single date selection
|
|
10
|
+
- Optional clear button
|
|
11
|
+
- Min/max date constraints
|
|
12
|
+
- Custom disabled date predicate
|
|
13
|
+
- Keyboard navigation
|
|
14
|
+
- Full ARIA support
|
|
15
|
+
- Token-driven styling
|
|
16
|
+
|
|
17
|
+
## Usage
|
|
18
|
+
|
|
19
|
+
### Basic
|
|
20
|
+
|
|
21
|
+
```html
|
|
22
|
+
<rel-date-picker></rel-date-picker>
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### With Value
|
|
26
|
+
|
|
27
|
+
```html
|
|
28
|
+
<rel-date-picker value="2026-01-16"></rel-date-picker>
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### With Label
|
|
32
|
+
|
|
33
|
+
```html
|
|
34
|
+
<rel-date-picker label="Select appointment date"></rel-date-picker>
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### With Min/Max
|
|
38
|
+
|
|
39
|
+
```html
|
|
40
|
+
<rel-date-picker
|
|
41
|
+
min="2026-01-01"
|
|
42
|
+
max="2026-12-31"
|
|
43
|
+
placeholder="Select a date in 2026"
|
|
44
|
+
></rel-date-picker>
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Clearable
|
|
48
|
+
|
|
49
|
+
```html
|
|
50
|
+
<rel-date-picker value="2026-01-16" clearable></rel-date-picker>
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Disabled
|
|
54
|
+
|
|
55
|
+
```html
|
|
56
|
+
<rel-date-picker value="2026-01-16" disabled></rel-date-picker>
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### Programmatic Control (JavaScript)
|
|
60
|
+
|
|
61
|
+
```javascript
|
|
62
|
+
const picker = document.querySelector('rel-date-picker');
|
|
63
|
+
|
|
64
|
+
// Set value
|
|
65
|
+
picker.value = '2026-01-16';
|
|
66
|
+
|
|
67
|
+
// Open programmatically
|
|
68
|
+
picker.open = true;
|
|
69
|
+
|
|
70
|
+
// Custom disabled dates (e.g., disable weekends)
|
|
71
|
+
picker.isDateDisabled = (date) => {
|
|
72
|
+
const day = date.getDay();
|
|
73
|
+
return day === 0 || day === 6; // Sunday or Saturday
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
// Listen to changes
|
|
77
|
+
picker.addEventListener('rel-change', (e) => {
|
|
78
|
+
console.log('Selected date:', e.detail.value); // "2026-01-16"
|
|
79
|
+
console.log('Date object:', e.detail.date); // Date object
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
// Listen to popover open/close
|
|
83
|
+
picker.addEventListener('rel-open-change', (e) => {
|
|
84
|
+
console.log('Popover open:', e.detail.open); // boolean
|
|
85
|
+
});
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## Attributes
|
|
89
|
+
|
|
90
|
+
| Attribute | Type | Default | Description |
|
|
91
|
+
|-----------|------|---------|-------------|
|
|
92
|
+
| `value` | `string \| null` | `null` | Selected date in ISO format (YYYY-MM-DD) |
|
|
93
|
+
| `placeholder` | `string` | `"Select date"` | Placeholder text when no date selected |
|
|
94
|
+
| `label` | `string \| null` | `null` | Accessible label for the date picker |
|
|
95
|
+
| `disabled` | `boolean` | `false` | Disables all interaction |
|
|
96
|
+
| `required` | `boolean` | `false` | Sets aria-required (no validation logic) |
|
|
97
|
+
| `min` | `string \| null` | `null` | Minimum selectable date (ISO format) |
|
|
98
|
+
| `max` | `string \| null` | `null` | Maximum selectable date (ISO format) |
|
|
99
|
+
| `week-start` | `"sun" \| "mon"` | `"sun"` | First day of the week |
|
|
100
|
+
| `locale` | `string` | `"en-US"` | Locale for month names (uses Intl.DateTimeFormat) |
|
|
101
|
+
| `open` | `boolean` | `false` | Controls popover open state |
|
|
102
|
+
| `close-on-select` | `boolean` | `true` | Close popover after selecting a date |
|
|
103
|
+
| `clearable` | `boolean` | `false` | Show clear button when date is selected |
|
|
104
|
+
|
|
105
|
+
## Properties
|
|
106
|
+
|
|
107
|
+
| Property | Type | Description |
|
|
108
|
+
|----------|------|-------------|
|
|
109
|
+
| `isDateDisabled` | `(date: Date) => boolean` | Custom function to disable specific dates |
|
|
110
|
+
|
|
111
|
+
## Events
|
|
112
|
+
|
|
113
|
+
| Event | Detail | Description |
|
|
114
|
+
|-------|--------|-------------|
|
|
115
|
+
| `rel-change` | `{ value: string \| null, date: Date \| null }` | Fired when selected date changes |
|
|
116
|
+
| `rel-open-change` | `{ open: boolean }` | Fired when popover opens/closes |
|
|
117
|
+
|
|
118
|
+
## Keyboard Navigation
|
|
119
|
+
|
|
120
|
+
### Trigger Button
|
|
121
|
+
- **Enter/Space**: Opens the popover
|
|
122
|
+
- **Arrow Down**: Opens the popover
|
|
123
|
+
|
|
124
|
+
### Inside Calendar
|
|
125
|
+
- **Arrow keys**: Navigate days (left/right) and weeks (up/down)
|
|
126
|
+
- **Home/End**: Jump to week start/end
|
|
127
|
+
- **PageUp/PageDown**: Change month
|
|
128
|
+
- **Shift + PageUp/PageDown**: Change year
|
|
129
|
+
- **Enter/Space**: Select focused day
|
|
130
|
+
- **Escape**: Close popover
|
|
131
|
+
|
|
132
|
+
### Month/Year Dropdowns
|
|
133
|
+
- **Tab**: Navigate between dropdowns
|
|
134
|
+
- **Click**: Select month or year
|
|
135
|
+
|
|
136
|
+
## Calendar Features
|
|
137
|
+
|
|
138
|
+
### Month Dropdown
|
|
139
|
+
- Lists all 12 months localized to the specified locale
|
|
140
|
+
- Scroll through months quickly
|
|
141
|
+
- Current month is highlighted
|
|
142
|
+
|
|
143
|
+
### Year Dropdown
|
|
144
|
+
- Scrollable list of years
|
|
145
|
+
- Range automatically calculated:
|
|
146
|
+
- With min/max: Uses constrained range with buffer
|
|
147
|
+
- Without: Defaults to [currentYear - 100, currentYear + 10]
|
|
148
|
+
- Current year is highlighted
|
|
149
|
+
|
|
150
|
+
## Custom Disabled Dates
|
|
151
|
+
|
|
152
|
+
Use the `isDateDisabled` property to implement custom logic:
|
|
153
|
+
|
|
154
|
+
```javascript
|
|
155
|
+
const picker = document.querySelector('rel-date-picker');
|
|
156
|
+
|
|
157
|
+
// Disable weekends
|
|
158
|
+
picker.isDateDisabled = (date) => {
|
|
159
|
+
const day = date.getDay();
|
|
160
|
+
return day === 0 || day === 6;
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
// Disable specific dates
|
|
164
|
+
const blackoutDates = ['2026-01-15', '2026-01-20', '2026-01-25'];
|
|
165
|
+
picker.isDateDisabled = (date) => {
|
|
166
|
+
const iso = date.toISOString().split('T')[0];
|
|
167
|
+
return blackoutDates.includes(iso);
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
// Disable dates before today
|
|
171
|
+
picker.isDateDisabled = (date) => {
|
|
172
|
+
const today = new Date();
|
|
173
|
+
today.setHours(0, 0, 0, 0);
|
|
174
|
+
return date < today;
|
|
175
|
+
};
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
## Complete Example
|
|
179
|
+
|
|
180
|
+
```html
|
|
181
|
+
<rel-date-picker
|
|
182
|
+
id="appointment-picker"
|
|
183
|
+
label="Appointment Date"
|
|
184
|
+
placeholder="Choose a date"
|
|
185
|
+
min="2026-01-01"
|
|
186
|
+
max="2026-12-31"
|
|
187
|
+
clearable
|
|
188
|
+
required
|
|
189
|
+
></rel-date-picker>
|
|
190
|
+
|
|
191
|
+
<script>
|
|
192
|
+
const picker = document.getElementById('appointment-picker');
|
|
193
|
+
|
|
194
|
+
// Disable weekends
|
|
195
|
+
picker.isDateDisabled = (date) => {
|
|
196
|
+
const day = date.getDay();
|
|
197
|
+
return day === 0 || day === 6;
|
|
198
|
+
};
|
|
199
|
+
|
|
200
|
+
// Handle selection
|
|
201
|
+
picker.addEventListener('rel-change', (e) => {
|
|
202
|
+
if (e.detail.value) {
|
|
203
|
+
console.log('Appointment scheduled for:', e.detail.value);
|
|
204
|
+
} else {
|
|
205
|
+
console.log('Appointment cleared');
|
|
206
|
+
}
|
|
207
|
+
});
|
|
208
|
+
|
|
209
|
+
// Handle popover state
|
|
210
|
+
picker.addEventListener('rel-open-change', (e) => {
|
|
211
|
+
console.log('Calendar', e.detail.open ? 'opened' : 'closed');
|
|
212
|
+
});
|
|
213
|
+
</script>
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
## Accessibility
|
|
217
|
+
|
|
218
|
+
- Trigger button has proper `aria-haspopup`, `aria-expanded`, and `aria-label`
|
|
219
|
+
- Calendar popover uses `role="dialog"`
|
|
220
|
+
- Day buttons use `role="gridcell"` with proper `aria-label` and `aria-selected`
|
|
221
|
+
- All interactive elements are keyboard accessible
|
|
222
|
+
- Focus management:
|
|
223
|
+
- Opening popover focuses first day
|
|
224
|
+
- Closing popover returns focus to trigger
|
|
225
|
+
- Visible focus rings on all interactive elements
|
|
226
|
+
- Respects user's locale for month names and date formatting
|
|
227
|
+
|
|
228
|
+
## Styling
|
|
229
|
+
|
|
230
|
+
The component uses design tokens from the Reliability Design System. All colors, spacing, and typography are inherited from CSS variables.
|
|
231
|
+
|
|
232
|
+
Key tokens used:
|
|
233
|
+
- `--rel-colors-*` for all colors
|
|
234
|
+
- `--rel-spacing-*` for spacing
|
|
235
|
+
- `--rel-fontSizes-*`, `--rel-fontWeights-*` for typography
|
|
236
|
+
- `--rel-borders-*` for borders and radius
|
|
237
|
+
- `--rel-shadows-*` for popover shadow
|
|
238
|
+
- Selected date: `--rel-colors-green-primary`
|
|
239
|
+
- Today indicator: `--rel-colors-blue-primary`
|
|
240
|
+
- Focus rings: `--rel-colors-blue-primary`
|
|
241
|
+
|
|
242
|
+
## Date Format
|
|
243
|
+
|
|
244
|
+
- **Input/Output**: ISO 8601 format (YYYY-MM-DD)
|
|
245
|
+
- **Display**: Localized format based on `locale` attribute
|
|
246
|
+
- **Example**:
|
|
247
|
+
- Value: `"2026-01-16"`
|
|
248
|
+
- Display (en-US): `"January 16, 2026"`
|
|
249
|
+
- Display (es-ES): `"16 de enero de 2026"`
|
|
250
|
+
|
|
251
|
+
## Browser Support
|
|
252
|
+
|
|
253
|
+
Works in all modern browsers with ES2020 support and native Web Components.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./rel-date-picker";
|