@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.
Files changed (114) hide show
  1. package/dist/components/rel-accordion/README.md +132 -0
  2. package/dist/components/rel-accordion/rel-accordion.ts +43 -16
  3. package/dist/components/rel-alert/README.md +141 -0
  4. package/dist/components/rel-alert/rel-alert.ts +18 -7
  5. package/dist/components/rel-avatar/README.md +119 -0
  6. package/dist/components/rel-badge/README.md +86 -0
  7. package/dist/components/rel-badge/rel-badge.ts +6 -6
  8. package/dist/components/rel-breadcrumb/README.md +102 -0
  9. package/dist/components/rel-breadcrumb/rel-breadcrumb.ts +12 -6
  10. package/dist/components/rel-button/README.md +130 -0
  11. package/dist/components/rel-calendar/README.md +109 -0
  12. package/dist/components/rel-calendar/index.ts +1 -0
  13. package/dist/components/rel-calendar/rel-calendar.ts +467 -0
  14. package/dist/components/rel-card/README.md +94 -0
  15. package/dist/components/rel-card/rel-card.ts +12 -3
  16. package/dist/components/rel-cardmedia/README.md +127 -0
  17. package/dist/components/rel-cardmedia/rel-cardmedia.ts +14 -4
  18. package/dist/components/rel-carousel/README.md +166 -0
  19. package/dist/components/rel-carousel/index.ts +1 -0
  20. package/dist/components/rel-carousel/rel-carousel.ts +469 -0
  21. package/dist/components/rel-chart/README.md +286 -0
  22. package/dist/components/rel-chart/index.ts +1 -0
  23. package/dist/components/rel-chart/rel-chart.ts +736 -0
  24. package/dist/components/rel-checkbox/README.md +77 -0
  25. package/dist/components/rel-checkbox/rel-checkbox.ts +18 -10
  26. package/dist/components/rel-chip/README.md +114 -0
  27. package/dist/components/rel-chip/rel-chip.ts +20 -4
  28. package/dist/components/rel-container/README.md +99 -0
  29. package/dist/components/rel-date-picker/README.md +253 -0
  30. package/dist/components/rel-date-picker/index.ts +1 -0
  31. package/dist/components/rel-date-picker/rel-date-picker.ts +916 -0
  32. package/dist/components/rel-divider/README.md +100 -0
  33. package/dist/components/rel-drawer/README.md +200 -0
  34. package/dist/components/rel-drawer/index.ts +1 -0
  35. package/dist/components/rel-drawer/rel-drawer.ts +621 -0
  36. package/dist/components/rel-kbd/README.md +151 -0
  37. package/dist/components/rel-kbd/rel-kbd.ts +118 -0
  38. package/dist/components/rel-layout/README.md +88 -0
  39. package/dist/components/rel-menu/README.md +151 -0
  40. package/dist/components/rel-menu/rel-menu.ts +18 -10
  41. package/dist/components/rel-menubar/README.md +329 -0
  42. package/dist/components/rel-menubar/index.ts +2 -0
  43. package/dist/components/rel-menubar/rel-menubar-menu.ts +16 -0
  44. package/dist/components/rel-menubar/rel-menubar.ts +576 -0
  45. package/dist/components/rel-nav-menu/README.md +289 -0
  46. package/dist/components/rel-nav-menu/index.ts +3 -0
  47. package/dist/components/rel-nav-menu/rel-nav-menu-item.ts +143 -0
  48. package/dist/components/rel-nav-menu/rel-nav-menu-panel.ts +53 -0
  49. package/dist/components/rel-nav-menu/rel-nav-menu.ts +331 -0
  50. package/dist/components/rel-navbar/README.md +126 -0
  51. package/dist/components/rel-navbar/rel-navbar.ts +91 -0
  52. package/dist/components/rel-otp/README.md +440 -0
  53. package/dist/components/rel-otp/index.ts +1 -0
  54. package/dist/components/rel-otp/rel-otp.ts +504 -0
  55. package/dist/components/rel-pagination/README.md +410 -0
  56. package/dist/components/rel-pagination/index.ts +1 -0
  57. package/dist/components/rel-pagination/rel-pagination.ts +376 -0
  58. package/dist/components/rel-popover/README.md +568 -0
  59. package/dist/components/rel-popover/index.ts +2 -0
  60. package/dist/components/rel-popover/rel-popover-content.ts +55 -0
  61. package/dist/components/rel-popover/rel-popover.ts +327 -0
  62. package/dist/components/rel-progress/README.md +110 -0
  63. package/dist/components/rel-progress/rel-progress.ts +32 -5
  64. package/dist/components/rel-quote-page/README.md +166 -0
  65. package/dist/components/rel-quote-page/rel-quote-page.ts +816 -0
  66. package/dist/components/rel-radio/README.md +120 -0
  67. package/dist/components/rel-radio/rel-radio.ts +13 -5
  68. package/dist/components/rel-resizable/README.md +140 -0
  69. package/dist/components/rel-resizable/index.ts +3 -0
  70. package/dist/components/rel-resizable/rel-resizable-group.ts +374 -0
  71. package/dist/components/rel-resizable/rel-resizable-handle.ts +149 -0
  72. package/dist/components/rel-resizable/rel-resizable-panel.ts +47 -0
  73. package/dist/components/rel-segmented-button/README.md +141 -0
  74. package/dist/components/rel-segmented-button/rel-segmented-button.ts +18 -13
  75. package/dist/components/rel-select/README.md +107 -0
  76. package/dist/components/rel-select/rel-select.ts +14 -14
  77. package/dist/components/rel-sheet/README.md +224 -0
  78. package/dist/components/rel-sheet/rel-sheet.ts +683 -0
  79. package/dist/components/rel-sidebar/README.md +209 -0
  80. package/dist/components/rel-sidebar/rel-sidebar.ts +1158 -0
  81. package/dist/components/rel-slider/README.md +135 -0
  82. package/dist/components/rel-slider/rel-slider.ts +19 -7
  83. package/dist/components/rel-snackbar/README.md +134 -0
  84. package/dist/components/rel-snackbar/rel-snackbar.ts +67 -2
  85. package/dist/components/rel-stepper/README.md +160 -0
  86. package/dist/components/rel-stepper/rel-stepper.ts +6 -6
  87. package/dist/components/rel-switch/README.md +102 -0
  88. package/dist/components/rel-switch/rel-switch.ts +15 -6
  89. package/dist/components/rel-tab/README.md +163 -0
  90. package/dist/components/rel-tab/rel-tab.ts +36 -14
  91. package/dist/components/rel-table/README.md +178 -0
  92. package/dist/components/rel-table/rel-table-body.ts +16 -0
  93. package/dist/components/rel-table/rel-table-caption.ts +22 -0
  94. package/dist/components/rel-table/rel-table-cell.ts +49 -0
  95. package/dist/components/rel-table/rel-table-footer.ts +18 -0
  96. package/dist/components/rel-table/rel-table-head.ts +33 -0
  97. package/dist/components/rel-table/rel-table-header.ts +16 -0
  98. package/dist/components/rel-table/rel-table-row.ts +32 -0
  99. package/dist/components/rel-table/rel-table.ts +47 -0
  100. package/dist/components/rel-textfield/README.md +90 -0
  101. package/dist/components/rel-textfield/rel-textfield.ts +35 -19
  102. package/dist/components/rel-toast/README.md +148 -0
  103. package/dist/components/rel-toast/rel-toast.ts +32 -14
  104. package/dist/components/rel-tooltip/README.md +103 -0
  105. package/dist/components/rel-tooltip/rel-tooltip.ts +9 -9
  106. package/dist/index.d.mts +836 -1
  107. package/dist/index.d.ts +836 -1
  108. package/dist/index.js +10658 -1493
  109. package/dist/index.js.map +1 -1
  110. package/dist/index.mjs +10616 -1499
  111. package/dist/index.mjs.map +1 -1
  112. package/dist/styles/vars.css +293 -183
  113. package/dist/{vars-6ZIUPIU4.css → vars-ITL2K3KO.css} +293 -183
  114. package/package.json +1 -1
@@ -0,0 +1,77 @@
1
+ # rel-checkbox
2
+
3
+ ## Overview
4
+ A tri-state checkbox component supporting checked, unchecked, and indeterminate states. Includes label and supporting text with built-in error and disabled states for form validation scenarios.
5
+
6
+ ## Usage
7
+ ```html
8
+ <!-- Basic example -->
9
+ <rel-checkbox label="Accept terms"></rel-checkbox>
10
+
11
+ <!-- Example with common options -->
12
+ <rel-checkbox
13
+ label="Subscribe to newsletter"
14
+ supportingtext="We'll send you weekly updates"
15
+ status="unchecked"
16
+ state="default">
17
+ </rel-checkbox>
18
+ ```
19
+
20
+ ## API
21
+
22
+ ### Attributes/Properties
23
+ | Name | Type | Default | Description |
24
+ |------|------|---------|-------------|
25
+ | `label` | `string` | `"Label"` | Label text displayed next to the checkbox |
26
+ | `supportingtext` | `string` | `""` | Helper text displayed below the checkbox and label |
27
+ | `state` | `"default" \| "error" \| "disabled"` | `"default"` | Visual and interaction state of the checkbox |
28
+ | `status` | `"unchecked" \| "checked" \| "indeterminate"` | `"unchecked"` | Current checked state of the checkbox |
29
+
30
+ ## Events
31
+ | Event | Detail | Description |
32
+ |-------|--------|-------------|
33
+ | `change` | `{ checked: boolean, indeterminate: boolean }` | Fired when checkbox state changes through user interaction |
34
+
35
+ ## Slots
36
+ Default slot not used.
37
+
38
+ ## CSS Parts
39
+ None exposed.
40
+
41
+ ## Tokens / CSS Variables
42
+
43
+ ### Semantic Tokens
44
+ - `--rel-fontFamilies-primary` - Font family
45
+ - `--rel-fontSizes-md`, `--rel-fontSizes-sm` - Font sizes for label and supporting text
46
+ - `--rel-fontWeights-medium` - Font weight for label
47
+
48
+ ### Color Tokens
49
+ - `--rel-text-heading` - Checkbox border and checked background color
50
+ - `--rel-colors-white` - Checkbox background and checkmark color
51
+ - `--rel-text-primary` - Label text color
52
+ - `--rel-text-placeholder` - Supporting text color
53
+ - `--rel-colors-red-primary` - Error state border and background color
54
+ - `--rel-border-info` - Focus outline color
55
+
56
+ ## Accessibility
57
+ - Uses visually hidden native checkbox input for screen reader support
58
+ - Custom visual checkbox with proper focus indicators
59
+ - Focus visible state with outline offset for keyboard users
60
+ - Label click targets the checkbox for larger interaction area
61
+ - Disabled state communicated through opacity reduction and cursor change
62
+
63
+ ### Keyboard Interactions
64
+ - `Space` - Toggle checkbox state
65
+ - `Tab` - Move focus to/from checkbox
66
+
67
+ ### Focus Behavior
68
+ - Focus outline appears with offset around the custom checkbox box
69
+ - Uses info border color for high contrast
70
+
71
+ ## Notes / Edge Cases
72
+ - Clicking cycles through three states in order: unchecked → checked → indeterminate → unchecked (repeating)
73
+ - When `state="disabled"`, click events are blocked and opacity is reduced to 0.55
74
+ - The indeterminate state displays a horizontal line instead of a checkmark
75
+ - In error state, the checkbox border and checked background use error color
76
+ - Supporting text is positioned below with left padding to align with checkbox content
77
+ - Native checkbox input is visually hidden but maintains accessibility features
@@ -40,12 +40,18 @@ export class RelCheckbox extends LitElement {
40
40
  width: 18px;
41
41
  height: 18px;
42
42
  border-radius: 4px;
43
- border: 2px solid var(--rel-colors-gray-heading);
44
- background: var(--rel-colors-white);
43
+ border: 2px solid var(--rel-text-heading, #2b2b2b);
44
+ background: var(--rel-colors-white, #fff);
45
45
  display: flex;
46
46
  align-items: center;
47
47
  justify-content: center;
48
48
  transition: all 0.2s;
49
+ flex-shrink: 0;
50
+ }
51
+
52
+ input:focus-visible + .box {
53
+ outline: 2px solid var(--rel-border-info, #0091ea);
54
+ outline-offset: 2px;
49
55
  }
50
56
 
51
57
  svg {
@@ -56,8 +62,8 @@ export class RelCheckbox extends LitElement {
56
62
 
57
63
  .checked .box,
58
64
  .indeterminate .box {
59
- background: var(--rel-colors-gray-heading);
60
- border-color: var(--rel-colors-gray-heading);
65
+ background: var(--rel-text-heading, #2b2b2b);
66
+ border-color: var(--rel-text-heading, #2b2b2b);
61
67
  }
62
68
 
63
69
  .checked .check-icon {
@@ -84,13 +90,15 @@ export class RelCheckbox extends LitElement {
84
90
  }
85
91
 
86
92
  .label {
87
- font-size: var(--rel-fontSizes-md);
88
- font-weight: var(--rel-fontWeights-medium);
93
+ font-size: var(--rel-fontSizes-md, 14px);
94
+ font-weight: var(--rel-fontWeights-medium, 500);
95
+ color: var(--rel-text-primary, #333);
89
96
  }
90
97
 
91
98
  .text {
92
- font-size: var(--rel-fontSizes-sm);
93
- color: var(--rel-colors-gray-text);
99
+ font-size: var(--rel-fontSizes-sm, 12px);
100
+ color: var(--rel-text-placeholder, #a9a9a9);
101
+ padding-left: 28px;
94
102
  }
95
103
  `;
96
104
 
@@ -124,13 +132,13 @@ export class RelCheckbox extends LitElement {
124
132
  />
125
133
 
126
134
  <span class="box">
127
- <svg class="check-icon" viewBox="0 0 18 14" fill="white">
135
+ <svg class="check-icon" viewBox="0 0 18 14" fill="var(--rel-colors-white, #fff)">
128
136
  <path
129
137
  d="M6.44 14L0.5 7.36l1.49-1.66L6.44 10.68 16.01 0 17.5 1.66z"
130
138
  />
131
139
  </svg>
132
140
 
133
- <svg class="indeterminate-icon" viewBox="0 0 16 2" fill="white">
141
+ <svg class="indeterminate-icon" viewBox="0 0 16 2" fill="var(--rel-colors-white, #fff)">
134
142
  <rect width="16" height="2" />
135
143
  </svg>
136
144
  </span>
@@ -0,0 +1,114 @@
1
+ # rel-chip
2
+
3
+ ## Overview
4
+ A compact chip component for displaying tags, labels, or selected options. Supports multiple color tones, avatar/icon decorations, outline variants, and removable functionality. Automatically hides when removed via the `removed` reflected attribute.
5
+
6
+ ## Usage
7
+ ```html
8
+ <!-- Basic chip -->
9
+ <rel-chip label="Active"></rel-chip>
10
+
11
+ <!-- Colored tones -->
12
+ <rel-chip label="Info" tone="blue"></rel-chip>
13
+ <rel-chip label="Warning" tone="yellow"></rel-chip>
14
+ <rel-chip label="Error" tone="red"></rel-chip>
15
+ <rel-chip label="Success" tone="green"></rel-chip>
16
+
17
+ <!-- Outline variant -->
18
+ <rel-chip label="Outline Style" tone="blue" outline></rel-chip>
19
+
20
+ <!-- With avatar -->
21
+ <rel-chip id="avatarChip" label="John Doe" avatar="./user.jpg"></rel-chip>
22
+
23
+ <!-- With leading icon (SVG string via JS) -->
24
+ <rel-chip id="iconChip" label="Tagged"></rel-chip>
25
+ <script>
26
+ const chip = document.getElementById('iconChip');
27
+ chip.leadingIcon = '<svg viewBox="0 0 16 16"><path d="M8 0l2 6h6l-5 4 2 6-5-4-5 4 2-6-5-4h6z"/></svg>';
28
+ </script>
29
+
30
+ <!-- Removable chip -->
31
+ <rel-chip id="removableChip" label="Removable" removable></rel-chip>
32
+ <script>
33
+ const removableChip = document.getElementById('removableChip');
34
+ removableChip.addEventListener('removed', () => {
35
+ console.log('Chip was removed');
36
+ });
37
+ </script>
38
+ ```
39
+
40
+ ## API
41
+
42
+ ### Attributes/Properties
43
+ | Name | Type | Default | Description |
44
+ |------|------|---------|-------------|
45
+ | `label` | `string` | `"Label"` | Text displayed on the chip |
46
+ | `tone` | `"default" \| "blue" \| "yellow" \| "red" \| "green"` | `"default"` | Color tone variant |
47
+ | `leadingIcon` | `string` | - | SVG or HTML string for leading icon |
48
+ | `trailingIcon` | `string` | - | SVG or HTML string for trailing icon |
49
+ | `avatar` | `string` | - | Image URL for avatar (circular image before label) |
50
+ | `removable` | `boolean` | `false` | Shows a remove button (✕) |
51
+ | `outline` | `boolean` | `false` | Applies outline styling (transparent background) |
52
+ | `removed` | `boolean` (reflected) | `false` | When true, component hides via `:host([removed])` |
53
+
54
+ ## Events
55
+ | Event | Detail | Description |
56
+ |-------|--------|-------------|
57
+ | `removed` | None | Fired when the remove button is clicked (sets `removed` to true) |
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
71
+
72
+ ### Spacing Tokens
73
+ - `--rel-spacing-space-2xs` - Padding and internal gaps
74
+ - `--rel-spacing-space-sm` - Horizontal padding
75
+ - `--rel-spacing-space-3xs` - Remove button margin
76
+
77
+ ### Color Tokens (by tone)
78
+ - **default**: `--rel-colors-gray-border` (background), `--rel-colors-black` (text)
79
+ - **blue**: `--rel-colors-blue-tertiary` (background), `--rel-colors-white` (text)
80
+ - **yellow**: `--rel-colors-yellow-pending` (background), `--rel-colors-black` (text)
81
+ - **red**: `--rel-colors-red-secondary` (background), `--rel-colors-white` (text)
82
+ - **green**: `--rel-colors-green-success` (background), `--rel-colors-white` (text)
83
+
84
+ ### Border & Shadow Tokens
85
+ - `--rel-borders-radius-border-radius-500` - Border radius (pill shape)
86
+ - `--rel-borders-width-stroke-100` - Border width (used in outline mode)
87
+ - `--rel-shadows-shadow-100` - Hover shadow
88
+ - `--rel-colors-blue-primary` - Focus outline color
89
+
90
+ ## Accessibility
91
+ - Uses `role="button"` and `tabindex="0"` on the main chip element
92
+ - `aria-label` set to the chip's label
93
+ - Remove button has proper `aria-label="Remove {label}"`
94
+ - Focus visible states on chip and remove button with distinct outlines
95
+ - Remove button focus uses white outline for contrast against colored backgrounds
96
+
97
+ ### Keyboard Interactions
98
+ - `Tab` - Focus the chip (or remove button if present)
99
+ - No built-in activation behavior on Enter/Space (purely informational/decorative)
100
+
101
+ ### Focus Behavior
102
+ - Chip focus: 2px blue outline with 2px offset
103
+ - Remove button focus: 2px white outline with 1px offset
104
+
105
+ ## Notes / Edge Cases
106
+ - Icons (`leadingIcon`, `trailingIcon`) must be passed as raw HTML/SVG strings via JavaScript (see examples)
107
+ - Icons are injected using `renderIcon()` which creates a template element and clones the content
108
+ - Avatar images are 20px × 20px circular (`border-radius: 50%`, `object-fit: cover`)
109
+ - When `removed` is set to `true`, the component applies `display: none` via `:host([removed])`
110
+ - `removed` is a reflected attribute, meaning it appears in the HTML when true
111
+ - Clicking the remove button stops propagation to prevent triggering chip-level click handlers
112
+ - **Outline mode** removes the background color but keeps the same text color
113
+ - Hover effect applies `filter: brightness(0.92)` and box-shadow
114
+ - The component is `display: inline-block`, so chips flow inline by default
@@ -48,6 +48,11 @@ export class RelChip extends LitElement {
48
48
  box-shadow: var(--rel-shadows-shadow-100);
49
49
  }
50
50
 
51
+ .chip:focus-visible {
52
+ outline: 2px solid var(--rel-colors-blue-primary, #0091ea);
53
+ outline-offset: 2px;
54
+ }
55
+
51
56
  /* TONES */
52
57
  .chip-default {
53
58
  background: var(--rel-colors-gray-border);
@@ -97,11 +102,23 @@ export class RelChip extends LitElement {
97
102
  margin-left: var(--rel-spacing-space-3xs);
98
103
  cursor: pointer;
99
104
  opacity: 0.7;
105
+ background: none;
106
+ border: none;
107
+ color: inherit;
108
+ font: inherit;
109
+ padding: 0;
110
+ line-height: 1;
100
111
  }
101
112
 
102
113
  .chip-remove:hover {
103
114
  opacity: 1;
104
115
  }
116
+
117
+ .chip-remove:focus-visible {
118
+ outline: 2px solid var(--rel-colors-white, #fff);
119
+ outline-offset: 1px;
120
+ border-radius: 2px;
121
+ }
105
122
  `;
106
123
 
107
124
  private get classes() {
@@ -149,14 +166,13 @@ export class RelChip extends LitElement {
149
166
  </span>`
150
167
  : null}
151
168
  ${this.removable
152
- ? html`<span
169
+ ? html`<button
153
170
  class="chip-remove"
154
- role="button"
155
- aria-label="Remove chip"
171
+ aria-label="Remove ${this.label}"
156
172
  @click=${this.handleRemove}
157
173
  >
158
174
  ✕
159
- </span>`
175
+ </button>`
160
176
  : null}
161
177
  </span>
162
178
  `;
@@ -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
@@ -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";