snice 1.14.3 → 2.1.0

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 (185) hide show
  1. package/bin/templates/base/tsconfig.json +5 -4
  2. package/components/accordion/demo.html +403 -0
  3. package/components/accordion/snice-accordion-item.css +85 -0
  4. package/components/accordion/snice-accordion-item.ts +226 -0
  5. package/components/accordion/snice-accordion.css +31 -0
  6. package/components/accordion/snice-accordion.ts +182 -0
  7. package/components/accordion/snice-accordion.types.ts +32 -0
  8. package/components/alert/demo.html +445 -0
  9. package/components/alert/snice-alert.css +195 -0
  10. package/components/alert/snice-alert.ts +141 -0
  11. package/components/alert/snice-alert.types.ts +12 -0
  12. package/components/avatar/demo.html +598 -0
  13. package/components/avatar/snice-avatar.css +131 -0
  14. package/components/avatar/snice-avatar.ts +136 -0
  15. package/components/avatar/snice-avatar.types.ts +13 -0
  16. package/components/badge/demo.html +523 -0
  17. package/components/badge/snice-badge.css +161 -0
  18. package/components/badge/snice-badge.ts +117 -0
  19. package/components/badge/snice-badge.types.ts +16 -0
  20. package/components/breadcrumbs/demo.html +404 -0
  21. package/components/breadcrumbs/snice-breadcrumbs.css +133 -0
  22. package/components/breadcrumbs/snice-breadcrumbs.ts +191 -0
  23. package/components/breadcrumbs/snice-breadcrumbs.types.ts +26 -0
  24. package/components/breadcrumbs/snice-crumb.ts +26 -0
  25. package/components/button/demo.html +42 -0
  26. package/components/button/snice-button.css +230 -0
  27. package/components/button/snice-button.ts +169 -0
  28. package/components/button/snice-button.types.ts +25 -0
  29. package/components/card/demo.html +525 -0
  30. package/components/card/snice-card.css +140 -0
  31. package/components/card/snice-card.ts +102 -0
  32. package/components/card/snice-card.types.ts +10 -0
  33. package/components/checkbox/demo.html +253 -0
  34. package/components/checkbox/snice-checkbox.css +164 -0
  35. package/components/checkbox/snice-checkbox.ts +223 -0
  36. package/components/checkbox/snice-checkbox.types.ts +22 -0
  37. package/components/chip/demo.html +383 -0
  38. package/components/chip/snice-chip.css +195 -0
  39. package/components/chip/snice-chip.ts +139 -0
  40. package/components/chip/snice-chip.types.ts +15 -0
  41. package/components/date-picker/README.md +233 -0
  42. package/components/date-picker/demo.html +191 -0
  43. package/components/date-picker/snice-date-picker.css +330 -0
  44. package/components/date-picker/snice-date-picker.ts +777 -0
  45. package/components/date-picker/snice-date-picker.types.ts +83 -0
  46. package/components/divider/demo.html +233 -0
  47. package/components/divider/snice-divider.css +155 -0
  48. package/components/divider/snice-divider.ts +69 -0
  49. package/components/divider/snice-divider.types.ts +15 -0
  50. package/components/drawer/demo.html +328 -0
  51. package/components/drawer/snice-drawer.css +476 -0
  52. package/components/drawer/snice-drawer.ts +287 -0
  53. package/components/drawer/snice-drawer.types.ts +17 -0
  54. package/components/global.d.ts +14 -0
  55. package/components/input/demo.html +303 -0
  56. package/components/input/snice-input.css +257 -0
  57. package/components/input/snice-input.ts +442 -0
  58. package/components/input/snice-input.types.ts +59 -0
  59. package/components/input/test.html +77 -0
  60. package/components/layout/README.md +260 -0
  61. package/components/layout/demo.html +538 -0
  62. package/components/layout/snice-layout-blog.css +129 -0
  63. package/components/layout/snice-layout-blog.ts +48 -0
  64. package/components/layout/snice-layout-card.css +104 -0
  65. package/components/layout/snice-layout-card.ts +35 -0
  66. package/components/layout/snice-layout-centered.css +51 -0
  67. package/components/layout/snice-layout-centered.ts +22 -0
  68. package/components/layout/snice-layout-dashboard.css +98 -0
  69. package/components/layout/snice-layout-dashboard.ts +45 -0
  70. package/components/layout/snice-layout-fullscreen.css +72 -0
  71. package/components/layout/snice-layout-fullscreen.ts +34 -0
  72. package/components/layout/snice-layout-landing.css +92 -0
  73. package/components/layout/snice-layout-landing.ts +47 -0
  74. package/components/layout/snice-layout-minimal.css +16 -0
  75. package/components/layout/snice-layout-minimal.ts +19 -0
  76. package/components/layout/snice-layout-sidebar.css +117 -0
  77. package/components/layout/snice-layout-sidebar.ts +48 -0
  78. package/components/layout/snice-layout-split.css +103 -0
  79. package/components/layout/snice-layout-split.ts +29 -0
  80. package/components/layout/snice-layout.css +72 -0
  81. package/components/layout/snice-layout.ts +35 -0
  82. package/components/layout/snice-layout.types.ts +5 -0
  83. package/components/login/demo-auth-controller.ts +185 -0
  84. package/components/login/demo.html +470 -0
  85. package/components/login/snice-login.css +204 -0
  86. package/components/login/snice-login.ts +337 -0
  87. package/components/login/snice-login.types.ts +34 -0
  88. package/components/modal/demo.html +291 -0
  89. package/components/modal/snice-modal.css +203 -0
  90. package/components/modal/snice-modal.ts +233 -0
  91. package/components/modal/snice-modal.types.ts +21 -0
  92. package/components/pagination/demo.html +395 -0
  93. package/components/pagination/snice-pagination.ts +333 -0
  94. package/components/pagination/snice-pagination.types.ts +21 -0
  95. package/components/progress/demo.html +510 -0
  96. package/components/progress/snice-progress.css +267 -0
  97. package/components/progress/snice-progress.ts +247 -0
  98. package/components/progress/snice-progress.types.ts +19 -0
  99. package/components/radio/demo.html +287 -0
  100. package/components/radio/snice-radio.css +171 -0
  101. package/components/radio/snice-radio.ts +218 -0
  102. package/components/radio/snice-radio.types.ts +21 -0
  103. package/components/select/demo.html +511 -0
  104. package/components/select/snice-option.ts +52 -0
  105. package/components/select/snice-option.types.ts +14 -0
  106. package/components/select/snice-select.css +392 -0
  107. package/components/select/snice-select.ts +796 -0
  108. package/components/select/snice-select.types.ts +55 -0
  109. package/components/skeleton/demo.html +514 -0
  110. package/components/skeleton/snice-skeleton.css +109 -0
  111. package/components/skeleton/snice-skeleton.ts +126 -0
  112. package/components/skeleton/snice-skeleton.types.ts +11 -0
  113. package/components/switch/demo.html +284 -0
  114. package/components/switch/snice-switch.css +221 -0
  115. package/components/switch/snice-switch.ts +229 -0
  116. package/components/switch/snice-switch.types.ts +23 -0
  117. package/components/symbols.ts +23 -0
  118. package/components/table/demo-table-controller.ts +100 -0
  119. package/components/table/demo.html +480 -0
  120. package/components/table/snice-cell-boolean.ts +112 -0
  121. package/components/table/snice-cell-date.ts +210 -0
  122. package/components/table/snice-cell-duration.ts +91 -0
  123. package/components/table/snice-cell-filesize.ts +90 -0
  124. package/components/table/snice-cell-number.ts +165 -0
  125. package/components/table/snice-cell-progress.ts +83 -0
  126. package/components/table/snice-cell-rating.ts +82 -0
  127. package/components/table/snice-cell-sparkline.ts +253 -0
  128. package/components/table/snice-cell-text.ts +125 -0
  129. package/components/table/snice-cell.css +296 -0
  130. package/components/table/snice-cell.ts +473 -0
  131. package/components/table/snice-column.ts +353 -0
  132. package/components/table/snice-header.css +243 -0
  133. package/components/table/snice-header.ts +261 -0
  134. package/components/table/snice-progress.ts +66 -0
  135. package/components/table/snice-rating.ts +45 -0
  136. package/components/table/snice-row.css +255 -0
  137. package/components/table/snice-row.ts +331 -0
  138. package/components/table/snice-table.css +241 -0
  139. package/components/table/snice-table.ts +737 -0
  140. package/components/table/snice-table.types.ts +158 -0
  141. package/components/tabs/demo.html +487 -0
  142. package/components/tabs/snice-tab-panel.css +264 -0
  143. package/components/tabs/snice-tab-panel.ts +47 -0
  144. package/components/tabs/snice-tab.css +96 -0
  145. package/components/tabs/snice-tab.ts +65 -0
  146. package/components/tabs/snice-tabs.css +189 -0
  147. package/components/tabs/snice-tabs.ts +332 -0
  148. package/components/tabs/snice-tabs.types.ts +28 -0
  149. package/components/theme/theme.css +234 -0
  150. package/components/toast/demo.html +329 -0
  151. package/components/toast/snice-toast-container.ts +256 -0
  152. package/components/toast/snice-toast.css +213 -0
  153. package/components/toast/snice-toast.ts +276 -0
  154. package/components/toast/snice-toast.types.ts +35 -0
  155. package/components/tooltip/demo.html +350 -0
  156. package/components/tooltip/snice-tooltip-portal.css +79 -0
  157. package/components/tooltip/snice-tooltip.css +117 -0
  158. package/components/tooltip/snice-tooltip.ts +612 -0
  159. package/components/tooltip/snice-tooltip.types.ts +32 -0
  160. package/components/transitions.ts +94 -0
  161. package/components/tsconfig.json +18 -0
  162. package/dist/index.cjs +441 -329
  163. package/dist/index.cjs.map +1 -1
  164. package/dist/index.cjs.min.map +1 -1
  165. package/dist/index.esm.js +441 -329
  166. package/dist/index.esm.js.map +1 -1
  167. package/dist/index.esm.min.js +3 -3
  168. package/dist/index.esm.min.js.map +1 -1
  169. package/dist/index.iife.js +441 -329
  170. package/dist/index.iife.js.map +1 -1
  171. package/dist/index.iife.min.js +3 -3
  172. package/dist/index.iife.min.js.map +1 -1
  173. package/dist/symbols.esm.js +1 -1
  174. package/dist/transitions.esm.js +1 -1
  175. package/dist/types/controller.d.ts +1 -1
  176. package/dist/types/element.d.ts +10 -10
  177. package/dist/types/events.d.ts +2 -2
  178. package/dist/types/index.d.ts +1 -1
  179. package/dist/types/observe.d.ts +1 -1
  180. package/dist/types/request-response.d.ts +2 -3
  181. package/dist/types/router.d.ts +1 -1
  182. package/package.json +9 -3
  183. package/dist/index.cjs.min +0 -15
  184. package/dist/symbols.cjs +0 -103
  185. package/dist/transitions.cjs +0 -219
@@ -0,0 +1,195 @@
1
+ :host {
2
+ display: inline-block;
3
+ --chip-height: 2rem; /* 32px */
4
+ --chip-padding: 0 0.75rem; /* 0 12px */
5
+ --chip-font-size: 0.875rem; /* 14px */
6
+ --chip-border-radius: 16px;
7
+ }
8
+
9
+ .chip {
10
+ display: inline-flex;
11
+ align-items: center;
12
+ height: var(--chip-height);
13
+ padding: var(--chip-padding);
14
+ border-radius: var(--chip-border-radius);
15
+ font-size: var(--chip-font-size);
16
+ font-weight: 500;
17
+ cursor: pointer;
18
+ user-select: none;
19
+ transition: box-shadow 0.2s ease, opacity 0.2s ease, transform 0.1s ease;
20
+ position: relative;
21
+ gap: 0.375rem; /* 6px */
22
+ white-space: nowrap;
23
+ outline: none;
24
+ }
25
+
26
+ .chip:focus-visible {
27
+ box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.4);
28
+ }
29
+
30
+ .chip[aria-disabled="true"] {
31
+ opacity: 0.5;
32
+ cursor: not-allowed;
33
+ }
34
+
35
+ /* Sizes */
36
+ :host([size="small"]) {
37
+ --chip-height: 24px;
38
+ --chip-padding: 0 8px;
39
+ --chip-font-size: 12px;
40
+ --chip-border-radius: 12px;
41
+ }
42
+
43
+ :host([size="large"]) {
44
+ --chip-height: 40px;
45
+ --chip-padding: 0 16px;
46
+ --chip-font-size: 16px;
47
+ --chip-border-radius: 20px;
48
+ }
49
+
50
+ /* Variants */
51
+ :host([variant="default"]) .chip,
52
+ :host(:not([variant])) .chip {
53
+ background: #f3f4f6;
54
+ color: #374151;
55
+ }
56
+
57
+ :host([variant="default"]) .chip:hover:not([aria-disabled="true"]):not(.chip--selected),
58
+ :host(:not([variant])) .chip:hover:not([aria-disabled="true"]):not(.chip--selected) {
59
+ background: #e5e7eb;
60
+ }
61
+
62
+ :host([variant="default"]) .chip--selected,
63
+ :host(:not([variant])) .chip--selected {
64
+ background: #374151;
65
+ color: white;
66
+ text-shadow: 0 0 3px rgba(0, 0, 0, 0.6), 0 1px 2px rgba(0, 0, 0, 0.4);
67
+ }
68
+
69
+ :host([variant="primary"]) .chip {
70
+ background: #dbeafe;
71
+ color: #1e40af;
72
+ }
73
+
74
+ :host([variant="primary"]) .chip:hover:not([aria-disabled="true"]):not(.chip--selected) {
75
+ background: #bfdbfe;
76
+ }
77
+
78
+ :host([variant="primary"]) .chip--selected {
79
+ background: #3b82f6;
80
+ color: white;
81
+ text-shadow: 0 0 3px rgba(0, 0, 0, 0.6), 0 1px 2px rgba(0, 0, 0, 0.4);
82
+ }
83
+
84
+ :host([variant="success"]) .chip {
85
+ background: #d1fae5;
86
+ color: #065f46;
87
+ }
88
+
89
+ :host([variant="success"]) .chip:hover:not([aria-disabled="true"]):not(.chip--selected) {
90
+ background: #a7f3d0;
91
+ }
92
+
93
+ :host([variant="success"]) .chip--selected {
94
+ background: #10b981;
95
+ color: white;
96
+ text-shadow: 0 0 3px rgba(0, 0, 0, 0.6), 0 1px 2px rgba(0, 0, 0, 0.4);
97
+ }
98
+
99
+ :host([variant="warning"]) .chip {
100
+ background: #fed7aa;
101
+ color: #92400e;
102
+ }
103
+
104
+ :host([variant="warning"]) .chip:hover:not([aria-disabled="true"]):not(.chip--selected) {
105
+ background: #fde68a;
106
+ }
107
+
108
+ :host([variant="warning"]) .chip--selected {
109
+ background: #f59e0b;
110
+ color: white;
111
+ text-shadow: 0 0 3px rgba(0, 0, 0, 0.6), 0 1px 2px rgba(0, 0, 0, 0.4);
112
+ }
113
+
114
+ :host([variant="error"]) .chip {
115
+ background: #fee2e2;
116
+ color: #991b1b;
117
+ }
118
+
119
+ :host([variant="error"]) .chip:hover:not([aria-disabled="true"]):not(.chip--selected) {
120
+ background: #fecaca;
121
+ }
122
+
123
+ :host([variant="error"]) .chip--selected {
124
+ background: #ef4444;
125
+ color: white;
126
+ text-shadow: 0 0 3px rgba(0, 0, 0, 0.6), 0 1px 2px rgba(0, 0, 0, 0.4);
127
+ }
128
+
129
+ :host([variant="info"]) .chip {
130
+ background: #e0e7ff;
131
+ color: #3730a3;
132
+ }
133
+
134
+ :host([variant="info"]) .chip:hover:not([aria-disabled="true"]):not(.chip--selected) {
135
+ background: #c7d2fe;
136
+ }
137
+
138
+ :host([variant="info"]) .chip--selected {
139
+ background: #6366f1;
140
+ color: white;
141
+ text-shadow: 0 0 3px rgba(0, 0, 0, 0.6), 0 1px 2px rgba(0, 0, 0, 0.4);
142
+ }
143
+
144
+ /* Avatar */
145
+ .chip-avatar {
146
+ width: calc(var(--chip-height) - 8px);
147
+ height: calc(var(--chip-height) - 8px);
148
+ border-radius: 50%;
149
+ object-fit: cover;
150
+ margin-left: -6px;
151
+ }
152
+
153
+ /* Icon */
154
+ .chip-icon {
155
+ display: flex;
156
+ align-items: center;
157
+ justify-content: center;
158
+ width: 18px;
159
+ height: 18px;
160
+ margin-left: -4px;
161
+ }
162
+
163
+ /* Label */
164
+ .chip-label {
165
+ flex: 1;
166
+ line-height: 1;
167
+ }
168
+
169
+ /* Remove button */
170
+ .chip-remove {
171
+ display: flex;
172
+ align-items: center;
173
+ justify-content: center;
174
+ width: 18px;
175
+ height: 18px;
176
+ margin-right: -6px;
177
+ margin-left: 4px;
178
+ padding: 0;
179
+ background: none;
180
+ border: none;
181
+ border-radius: 50%;
182
+ cursor: pointer;
183
+ opacity: 0.7;
184
+ transition: opacity 0.2s ease;
185
+ color: inherit;
186
+ }
187
+
188
+ .chip-remove:hover {
189
+ opacity: 1;
190
+ }
191
+
192
+ .chip-remove svg {
193
+ width: 12px;
194
+ height: 12px;
195
+ }
@@ -0,0 +1,139 @@
1
+ import { element, property, watch, query, on, dispatch } from 'snice';
2
+ import css from './snice-chip.css?inline';
3
+ import type { ChipVariant, ChipSize, SniceChipElement } from './snice-chip.types';
4
+
5
+ @element('snice-chip')
6
+ export class SniceChip extends HTMLElement implements SniceChipElement {
7
+ @property({ reflect: true })
8
+ label = '';
9
+
10
+ @property({ reflect: true })
11
+ variant: ChipVariant = 'default';
12
+
13
+ @property({ reflect: true })
14
+ size: ChipSize = 'medium';
15
+
16
+ @property({ type: Boolean, reflect: true })
17
+ removable = false;
18
+
19
+ @property({ type: Boolean, reflect: true })
20
+ selected = false;
21
+
22
+ @property({ type: Boolean, reflect: true })
23
+ disabled = false;
24
+
25
+ @property({ reflect: true })
26
+ icon = '';
27
+
28
+ @property({ reflect: true })
29
+ avatar = '';
30
+
31
+ @query('.chip')
32
+ chipElement?: HTMLElement;
33
+
34
+ @query('.chip-remove')
35
+ removeButton?: HTMLButtonElement;
36
+
37
+ html() {
38
+ return /*html*/`
39
+ <div class="chip ${this.selected ? 'chip--selected' : ''}"
40
+ role="${this.removable ? 'button' : 'status'}"
41
+ tabindex="${this.disabled ? '-1' : '0'}"
42
+ aria-disabled="${this.disabled}"
43
+ aria-selected="${this.selected}">
44
+ ${this.avatar ? /*html*/`
45
+ <img class="chip-avatar" src="${this.avatar}" alt="">
46
+ ` : this.icon ? /*html*/`
47
+ <span class="chip-icon">${this.icon}</span>
48
+ ` : ''}
49
+ <span class="chip-label">${this.label}</span>
50
+ ${this.removable && !this.disabled ? /*html*/`
51
+ <button class="chip-remove"
52
+ type="button"
53
+ tabindex="-1"
54
+ aria-label="Remove ${this.label}">
55
+ <svg width="14" height="14" viewBox="0 0 14 14" fill="currentColor">
56
+ <path d="M14 1.41L12.59 0L7 5.59L1.41 0L0 1.41L5.59 7L0 12.59L1.41 14L7 8.41L12.59 14L14 12.59L8.41 7L14 1.41Z"/>
57
+ </svg>
58
+ </button>
59
+ ` : ''}
60
+ </div>
61
+ `;
62
+ }
63
+
64
+ css() {
65
+ return css;
66
+ }
67
+
68
+ @on('click', '.chip')
69
+ @dispatch('chip-click')
70
+ handleClick(event: MouseEvent) {
71
+ if (this.disabled) return;
72
+ if ((event.target as HTMLElement).closest('.chip-remove')) return;
73
+
74
+ if (!this.removable) {
75
+ this.selected = !this.selected;
76
+ }
77
+
78
+ return {
79
+ label: this.label,
80
+ selected: this.selected
81
+ };
82
+ }
83
+
84
+ @on('click', '.chip-remove')
85
+ @dispatch('chip-remove')
86
+ handleRemove(event: MouseEvent) {
87
+ event.stopPropagation();
88
+ if (this.disabled) return;
89
+
90
+ return { label: this.label };
91
+ }
92
+
93
+ @on(['keydown:Enter', 'keydown:Space'], '.chip')
94
+ handleKeyPress(event: KeyboardEvent) {
95
+ event.preventDefault();
96
+ if (this.disabled) return;
97
+
98
+ if (!this.removable) {
99
+ this.selected = !this.selected;
100
+ this.dispatchChipClick();
101
+ }
102
+ }
103
+
104
+ @on(['keydown:Delete', 'keydown:Backspace'], '.chip')
105
+ handleDelete(event: KeyboardEvent) {
106
+ if (this.disabled || !this.removable) return;
107
+ event.preventDefault();
108
+ this.dispatchChipRemove();
109
+ }
110
+
111
+ @watch('selected')
112
+ updateSelected() {
113
+ if (this.chipElement) {
114
+ this.chipElement.classList.toggle('chip--selected', this.selected);
115
+ this.chipElement.setAttribute('aria-selected', String(this.selected));
116
+ }
117
+ }
118
+
119
+ @watch('disabled')
120
+ updateDisabled() {
121
+ if (this.chipElement) {
122
+ this.chipElement.setAttribute('aria-disabled', String(this.disabled));
123
+ this.chipElement.setAttribute('tabindex', this.disabled ? '-1' : '0');
124
+ }
125
+ }
126
+
127
+ @dispatch('chip-click')
128
+ private dispatchChipClick() {
129
+ return {
130
+ label: this.label,
131
+ selected: this.selected
132
+ };
133
+ }
134
+
135
+ @dispatch('chip-remove')
136
+ private dispatchChipRemove() {
137
+ return { label: this.label };
138
+ }
139
+ }
@@ -0,0 +1,15 @@
1
+ export type ChipVariant = 'default' | 'primary' | 'success' | 'warning' | 'error' | 'info';
2
+ export type ChipSize = 'small' | 'medium' | 'large';
3
+
4
+ export interface SniceChipElement extends HTMLElement {
5
+ label: string;
6
+ variant: ChipVariant;
7
+ size: ChipSize;
8
+ removable: boolean;
9
+ selected: boolean;
10
+ disabled: boolean;
11
+ icon: string;
12
+ avatar: string;
13
+ onClick?: () => void;
14
+ onRemove?: () => void;
15
+ }
@@ -0,0 +1,233 @@
1
+ # Snice Date Picker
2
+
3
+ A comprehensive calendar-based date selection component built with Snice framework.
4
+
5
+ ## Features
6
+
7
+ - ✅ **Calendar-based date selection** with month navigation
8
+ - ✅ **Multiple date formats** (MM/DD/YYYY, DD/MM/YYYY, YYYY-MM-DD, etc.)
9
+ - ✅ **Keyboard navigation** and accessibility support
10
+ - ✅ **Min/max date constraints** for date range validation
11
+ - ✅ **Multiple sizes** (small, medium, large) and variants (outlined, filled, underlined)
12
+ - ✅ **Input validation** with custom error messages
13
+ - ✅ **Clearable** with optional clear button
14
+ - ✅ **Imperative API** for programmatic control
15
+ - ✅ **Custom events** for integration with forms and controllers
16
+
17
+ ## Basic Usage
18
+
19
+ ```html
20
+ <snice-date-picker
21
+ label="Select Date"
22
+ placeholder="Choose a date"
23
+ clearable>
24
+ </snice-date-picker>
25
+ ```
26
+
27
+ ## Properties
28
+
29
+ | Property | Type | Default | Description |
30
+ |----------|------|---------|-------------|
31
+ | `size` | `'small' \| 'medium' \| 'large'` | `'medium'` | Size of the component |
32
+ | `variant` | `'outlined' \| 'filled' \| 'underlined'` | `'outlined'` | Visual style variant |
33
+ | `value` | `string` | `''` | Current date value (in specified format) |
34
+ | `format` | `'mm/dd/yyyy' \| 'dd/mm/yyyy' \| 'yyyy-mm-dd' \| etc.` | `'mm/dd/yyyy'` | Date display format |
35
+ | `placeholder` | `string` | `''` | Input placeholder text |
36
+ | `label` | `string` | `''` | Input label |
37
+ | `helper-text` | `string` | `''` | Helper text below input |
38
+ | `error-text` | `string` | `''` | Error message (shows when invalid=true) |
39
+ | `disabled` | `boolean` | `false` | Disable the component |
40
+ | `readonly` | `boolean` | `false` | Make input read-only |
41
+ | `required` | `boolean` | `false` | Mark as required field |
42
+ | `invalid` | `boolean` | `false` | Show error state |
43
+ | `clearable` | `boolean` | `false` | Show clear button |
44
+ | `min` | `string` | `''` | Minimum allowed date (YYYY-MM-DD) |
45
+ | `max` | `string` | `''` | Maximum allowed date (YYYY-MM-DD) |
46
+ | `name` | `string` | `''` | Form field name |
47
+ | `first-day-of-week` | `number` | `0` | First day of week (0=Sunday, 1=Monday, etc.) |
48
+
49
+ ## Methods
50
+
51
+ | Method | Parameters | Description |
52
+ |--------|------------|-------------|
53
+ | `focus()` | - | Focus the input field |
54
+ | `blur()` | - | Blur the input field |
55
+ | `clear()` | - | Clear the selected date |
56
+ | `open()` | - | Open the calendar popup |
57
+ | `close()` | - | Close the calendar popup |
58
+ | `selectDate(date)` | `Date` | Select a specific date |
59
+ | `goToMonth(year, month)` | `number, number` | Navigate to specific month |
60
+ | `goToToday()` | - | Select today's date |
61
+ | `checkValidity()` | - | Check if current value is valid |
62
+ | `reportValidity()` | - | Report validity state |
63
+ | `setCustomValidity(message)` | `string` | Set custom validation message |
64
+
65
+ ## Events
66
+
67
+ | Event | Detail | Description |
68
+ |-------|--------|-------------|
69
+ | `@snice/datepicker-change` | `{ value, date, formatted, iso, datePicker }` | Fired when date value changes |
70
+ | `@snice/datepicker-input` | `{ value, datePicker }` | Fired on input changes |
71
+ | `@snice/datepicker-select` | `{ date, formatted, iso, datePicker }` | Fired when date is selected from calendar |
72
+ | `@snice/datepicker-focus` | `{ datePicker }` | Fired when input gains focus |
73
+ | `@snice/datepicker-blur` | `{ datePicker }` | Fired when input loses focus |
74
+ | `@snice/datepicker-open` | `{ datePicker }` | Fired when calendar opens |
75
+ | `@snice/datepicker-close` | `{ datePicker }` | Fired when calendar closes |
76
+ | `@snice/datepicker-clear` | `{ datePicker }` | Fired when date is cleared |
77
+
78
+ ## Examples
79
+
80
+ ### Different Formats
81
+
82
+ ```html
83
+ <!-- US Format -->
84
+ <snice-date-picker
85
+ label="US Date"
86
+ format="mm/dd/yyyy">
87
+ </snice-date-picker>
88
+
89
+ <!-- European Format -->
90
+ <snice-date-picker
91
+ label="European Date"
92
+ format="dd/mm/yyyy">
93
+ </snice-date-picker>
94
+
95
+ <!-- ISO Format -->
96
+ <snice-date-picker
97
+ label="ISO Date"
98
+ format="yyyy-mm-dd">
99
+ </snice-date-picker>
100
+ ```
101
+
102
+ ### With Constraints
103
+
104
+ ```html
105
+ <snice-date-picker
106
+ label="Date Range"
107
+ min="2024-01-01"
108
+ max="2024-12-31"
109
+ helper-text="Select a date in 2024">
110
+ </snice-date-picker>
111
+ ```
112
+
113
+ ### Different Sizes and Variants
114
+
115
+ ```html
116
+ <!-- Small filled -->
117
+ <snice-date-picker
118
+ size="small"
119
+ variant="filled"
120
+ label="Small Date">
121
+ </snice-date-picker>
122
+
123
+ <!-- Large underlined -->
124
+ <snice-date-picker
125
+ size="large"
126
+ variant="underlined"
127
+ label="Large Date">
128
+ </snice-date-picker>
129
+ ```
130
+
131
+ ### Form Integration
132
+
133
+ ```html
134
+ <form>
135
+ <snice-date-picker
136
+ name="startDate"
137
+ label="Start Date"
138
+ required
139
+ min="2024-01-01">
140
+ </snice-date-picker>
141
+
142
+ <snice-date-picker
143
+ name="endDate"
144
+ label="End Date"
145
+ required>
146
+ </snice-date-picker>
147
+ </form>
148
+ ```
149
+
150
+ ### Event Handling
151
+
152
+ ```javascript
153
+ // Listen for date changes
154
+ document.addEventListener('@snice/datepicker-change', (e) => {
155
+ console.log('New date:', e.detail.date);
156
+ console.log('Formatted:', e.detail.formatted);
157
+ console.log('ISO:', e.detail.iso);
158
+ });
159
+
160
+ // Programmatic control
161
+ const datePicker = document.querySelector('snice-date-picker');
162
+ datePicker.selectDate(new Date(2024, 11, 25)); // Select Christmas
163
+ datePicker.goToToday(); // Jump to today
164
+ ```
165
+
166
+ ### With Controllers
167
+
168
+ ```typescript
169
+ import { controller, on } from 'snice';
170
+
171
+ @controller('date-form')
172
+ class DateFormController {
173
+ element!: HTMLElement;
174
+
175
+ @on('@snice/datepicker-change')
176
+ handleDateChange(e: CustomEvent) {
177
+ const { date, formatted } = e.detail;
178
+ console.log(`Date changed to: ${formatted}`);
179
+
180
+ // Validate date range, update other fields, etc.
181
+ this.validateDateRange();
182
+ }
183
+
184
+ private validateDateRange() {
185
+ const startPicker = this.element.querySelector('[name="startDate"]');
186
+ const endPicker = this.element.querySelector('[name="endDate"]');
187
+ // Add validation logic
188
+ }
189
+ }
190
+ ```
191
+
192
+ ## Accessibility
193
+
194
+ The date picker includes comprehensive accessibility support:
195
+
196
+ - **ARIA labels** for all interactive elements
197
+ - **Keyboard navigation** (Tab, Enter, Escape, Arrow keys)
198
+ - **Screen reader** announcements
199
+ - **Focus management** within calendar
200
+ - **Semantic HTML** structure
201
+
202
+ ## Keyboard Navigation
203
+
204
+ | Key | Action |
205
+ |-----|--------|
206
+ | `Tab` | Navigate between elements |
207
+ | `Enter` / `Space` | Open calendar or select date |
208
+ | `Escape` | Close calendar |
209
+ | `Arrow Keys` | Navigate calendar days |
210
+ | `Page Up/Down` | Navigate months |
211
+ | `Home/End` | Go to start/end of week |
212
+
213
+ ## Customization
214
+
215
+ The component uses CSS custom properties for easy theming:
216
+
217
+ ```css
218
+ snice-date-picker {
219
+ --border-color: #e5e7eb;
220
+ --focus-color: #2563eb;
221
+ --background: white;
222
+ --text-color: #374151;
223
+ --error-color: #ef4444;
224
+ }
225
+ ```
226
+
227
+ ## Browser Support
228
+
229
+ - ✅ Chrome/Edge 88+
230
+ - ✅ Firefox 87+
231
+ - ✅ Safari 14+
232
+ - ✅ iOS Safari 14+
233
+ - ✅ Chrome Android 88+