@chromvoid/uikit 0.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 (246) hide show
  1. package/LICENSE +8 -0
  2. package/README.md +96 -0
  3. package/dist/components/cv-accordion-item.d.ts +69 -0
  4. package/dist/components/cv-accordion-item.js +176 -0
  5. package/dist/components/cv-accordion.d.ts +79 -0
  6. package/dist/components/cv-accordion.js +310 -0
  7. package/dist/components/cv-alert-dialog.d.ts +86 -0
  8. package/dist/components/cv-alert-dialog.js +393 -0
  9. package/dist/components/cv-alert.d.ts +48 -0
  10. package/dist/components/cv-alert.js +156 -0
  11. package/dist/components/cv-badge.d.ts +56 -0
  12. package/dist/components/cv-badge.js +280 -0
  13. package/dist/components/cv-breadcrumb-item.d.ts +35 -0
  14. package/dist/components/cv-breadcrumb-item.js +64 -0
  15. package/dist/components/cv-breadcrumb.d.ts +39 -0
  16. package/dist/components/cv-breadcrumb.js +160 -0
  17. package/dist/components/cv-button.d.ts +83 -0
  18. package/dist/components/cv-button.js +541 -0
  19. package/dist/components/cv-callout.d.ts +32 -0
  20. package/dist/components/cv-callout.js +221 -0
  21. package/dist/components/cv-card.d.ts +48 -0
  22. package/dist/components/cv-card.js +269 -0
  23. package/dist/components/cv-carousel-slide.d.ts +25 -0
  24. package/dist/components/cv-carousel-slide.js +51 -0
  25. package/dist/components/cv-carousel.d.ts +96 -0
  26. package/dist/components/cv-carousel.js +457 -0
  27. package/dist/components/cv-checkbox.d.ts +84 -0
  28. package/dist/components/cv-checkbox.js +274 -0
  29. package/dist/components/cv-combobox-group.d.ts +15 -0
  30. package/dist/components/cv-combobox-group.js +34 -0
  31. package/dist/components/cv-combobox-option.d.ts +30 -0
  32. package/dist/components/cv-combobox-option.js +66 -0
  33. package/dist/components/cv-combobox.d.ts +135 -0
  34. package/dist/components/cv-combobox.js +834 -0
  35. package/dist/components/cv-command-item.d.ts +30 -0
  36. package/dist/components/cv-command-item.js +68 -0
  37. package/dist/components/cv-command-palette.d.ts +105 -0
  38. package/dist/components/cv-command-palette.js +578 -0
  39. package/dist/components/cv-context-menu.d.ts +98 -0
  40. package/dist/components/cv-context-menu.js +515 -0
  41. package/dist/components/cv-copy-button.d.ts +61 -0
  42. package/dist/components/cv-copy-button.js +318 -0
  43. package/dist/components/cv-date-picker.d.ts +161 -0
  44. package/dist/components/cv-date-picker.js +803 -0
  45. package/dist/components/cv-dialog.d.ts +89 -0
  46. package/dist/components/cv-dialog.js +459 -0
  47. package/dist/components/cv-disclosure.d.ts +57 -0
  48. package/dist/components/cv-disclosure.js +241 -0
  49. package/dist/components/cv-drawer.d.ts +102 -0
  50. package/dist/components/cv-drawer.js +595 -0
  51. package/dist/components/cv-feed-article.d.ts +26 -0
  52. package/dist/components/cv-feed-article.js +52 -0
  53. package/dist/components/cv-feed.d.ts +62 -0
  54. package/dist/components/cv-feed.js +310 -0
  55. package/dist/components/cv-grid-cell.d.ts +30 -0
  56. package/dist/components/cv-grid-cell.js +57 -0
  57. package/dist/components/cv-grid-column.d.ts +30 -0
  58. package/dist/components/cv-grid-column.js +43 -0
  59. package/dist/components/cv-grid-row.d.ts +30 -0
  60. package/dist/components/cv-grid-row.js +42 -0
  61. package/dist/components/cv-grid.d.ts +119 -0
  62. package/dist/components/cv-grid.js +567 -0
  63. package/dist/components/cv-icon.d.ts +57 -0
  64. package/dist/components/cv-icon.js +352 -0
  65. package/dist/components/cv-input.d.ts +127 -0
  66. package/dist/components/cv-input.js +482 -0
  67. package/dist/components/cv-landmark.d.ts +32 -0
  68. package/dist/components/cv-landmark.js +62 -0
  69. package/dist/components/cv-link.d.ts +22 -0
  70. package/dist/components/cv-link.js +99 -0
  71. package/dist/components/cv-listbox-group.d.ts +15 -0
  72. package/dist/components/cv-listbox-group.js +42 -0
  73. package/dist/components/cv-listbox.d.ts +81 -0
  74. package/dist/components/cv-listbox.js +388 -0
  75. package/dist/components/cv-menu-button.d.ts +118 -0
  76. package/dist/components/cv-menu-button.js +822 -0
  77. package/dist/components/cv-menu-group.d.ts +20 -0
  78. package/dist/components/cv-menu-group.js +48 -0
  79. package/dist/components/cv-menu-item.d.ts +52 -0
  80. package/dist/components/cv-menu-item.js +105 -0
  81. package/dist/components/cv-menu.d.ts +62 -0
  82. package/dist/components/cv-menu.js +414 -0
  83. package/dist/components/cv-meter.d.ts +66 -0
  84. package/dist/components/cv-meter.js +154 -0
  85. package/dist/components/cv-number.d.ts +139 -0
  86. package/dist/components/cv-number.js +553 -0
  87. package/dist/components/cv-option.d.ts +30 -0
  88. package/dist/components/cv-option.js +84 -0
  89. package/dist/components/cv-popover.d.ts +87 -0
  90. package/dist/components/cv-popover.js +373 -0
  91. package/dist/components/cv-progress-ring.d.ts +45 -0
  92. package/dist/components/cv-progress-ring.js +169 -0
  93. package/dist/components/cv-progress.d.ts +45 -0
  94. package/dist/components/cv-progress.js +148 -0
  95. package/dist/components/cv-radio-group.d.ts +79 -0
  96. package/dist/components/cv-radio-group.js +398 -0
  97. package/dist/components/cv-radio.d.ts +36 -0
  98. package/dist/components/cv-radio.js +123 -0
  99. package/dist/components/cv-select-group.d.ts +15 -0
  100. package/dist/components/cv-select-group.js +44 -0
  101. package/dist/components/cv-select-option.d.ts +30 -0
  102. package/dist/components/cv-select-option.js +66 -0
  103. package/dist/components/cv-select.d.ts +128 -0
  104. package/dist/components/cv-select.js +666 -0
  105. package/dist/components/cv-sidebar-item.d.ts +26 -0
  106. package/dist/components/cv-sidebar-item.js +142 -0
  107. package/dist/components/cv-sidebar.d.ts +171 -0
  108. package/dist/components/cv-sidebar.js +767 -0
  109. package/dist/components/cv-slider-multi-thumb.d.ts +73 -0
  110. package/dist/components/cv-slider-multi-thumb.js +374 -0
  111. package/dist/components/cv-slider.d.ts +84 -0
  112. package/dist/components/cv-slider.js +328 -0
  113. package/dist/components/cv-spinbutton.d.ts +121 -0
  114. package/dist/components/cv-spinbutton.js +486 -0
  115. package/dist/components/cv-spinner.d.ts +18 -0
  116. package/dist/components/cv-spinner.js +95 -0
  117. package/dist/components/cv-switch.d.ts +81 -0
  118. package/dist/components/cv-switch.js +285 -0
  119. package/dist/components/cv-tab-panel.d.ts +20 -0
  120. package/dist/components/cv-tab-panel.js +37 -0
  121. package/dist/components/cv-tab.d.ts +40 -0
  122. package/dist/components/cv-tab.js +132 -0
  123. package/dist/components/cv-table-cell.d.ts +31 -0
  124. package/dist/components/cv-table-cell.js +49 -0
  125. package/dist/components/cv-table-column.d.ts +37 -0
  126. package/dist/components/cv-table-column.js +63 -0
  127. package/dist/components/cv-table-row.d.ts +30 -0
  128. package/dist/components/cv-table-row.js +45 -0
  129. package/dist/components/cv-table.d.ts +147 -0
  130. package/dist/components/cv-table.js +607 -0
  131. package/dist/components/cv-tabs.d.ts +70 -0
  132. package/dist/components/cv-tabs.js +524 -0
  133. package/dist/components/cv-textarea.d.ts +108 -0
  134. package/dist/components/cv-textarea.js +328 -0
  135. package/dist/components/cv-toast-region.d.ts +39 -0
  136. package/dist/components/cv-toast-region.js +162 -0
  137. package/dist/components/cv-toast.d.ts +67 -0
  138. package/dist/components/cv-toast.js +315 -0
  139. package/dist/components/cv-toolbar-item.d.ts +25 -0
  140. package/dist/components/cv-toolbar-item.js +72 -0
  141. package/dist/components/cv-toolbar-separator.d.ts +25 -0
  142. package/dist/components/cv-toolbar-separator.js +45 -0
  143. package/dist/components/cv-toolbar.d.ts +63 -0
  144. package/dist/components/cv-toolbar.js +295 -0
  145. package/dist/components/cv-tooltip.d.ts +83 -0
  146. package/dist/components/cv-tooltip.js +455 -0
  147. package/dist/components/cv-treegrid-cell.d.ts +30 -0
  148. package/dist/components/cv-treegrid-cell.js +57 -0
  149. package/dist/components/cv-treegrid-column.d.ts +37 -0
  150. package/dist/components/cv-treegrid-column.js +53 -0
  151. package/dist/components/cv-treegrid-row.d.ts +55 -0
  152. package/dist/components/cv-treegrid-row.js +90 -0
  153. package/dist/components/cv-treegrid.d.ts +96 -0
  154. package/dist/components/cv-treegrid.js +632 -0
  155. package/dist/components/cv-treeitem.d.ts +58 -0
  156. package/dist/components/cv-treeitem.js +144 -0
  157. package/dist/components/cv-treeview.d.ts +70 -0
  158. package/dist/components/cv-treeview.js +396 -0
  159. package/dist/components/cv-window-splitter.d.ts +79 -0
  160. package/dist/components/cv-window-splitter.js +316 -0
  161. package/dist/components/index.d.ts +94 -0
  162. package/dist/components/index.js +79 -0
  163. package/dist/dialog/create-dialog-controller.d.ts +31 -0
  164. package/dist/dialog/create-dialog-controller.js +320 -0
  165. package/dist/dialog/index.d.ts +2 -0
  166. package/dist/dialog/index.js +1 -0
  167. package/dist/form-associated/FormAssociatedReatomElement.d.ts +25 -0
  168. package/dist/form-associated/FormAssociatedReatomElement.js +70 -0
  169. package/dist/form-associated/withFormAssociated.d.ts +5 -0
  170. package/dist/form-associated/withFormAssociated.js +1 -0
  171. package/dist/index.d.ts +10 -0
  172. package/dist/index.js +9 -0
  173. package/dist/reatom-lit/ReatomLitElement.d.ts +27 -0
  174. package/dist/reatom-lit/ReatomLitElement.js +118 -0
  175. package/dist/reatom-lit/html.d.ts +4 -0
  176. package/dist/reatom-lit/html.js +10 -0
  177. package/dist/reatom-lit/index.d.ts +4 -0
  178. package/dist/reatom-lit/index.js +4 -0
  179. package/dist/reatom-lit/watch.d.ts +15 -0
  180. package/dist/reatom-lit/watch.js +40 -0
  181. package/dist/reatom-lit/withReatomElement.d.ts +4 -0
  182. package/dist/reatom-lit/withReatomElement.js +57 -0
  183. package/dist/register.d.ts +1 -0
  184. package/dist/register.js +84 -0
  185. package/dist/styles/component-styles.d.ts +4 -0
  186. package/dist/styles/component-styles.js +78 -0
  187. package/dist/theme/cv-theme-provider.d.ts +32 -0
  188. package/dist/theme/cv-theme-provider.js +110 -0
  189. package/dist/theme/index.d.ts +4 -0
  190. package/dist/theme/index.js +2 -0
  191. package/dist/theme/theme-engine.d.ts +4 -0
  192. package/dist/theme/theme-engine.js +67 -0
  193. package/dist/theme/tokens.css +265 -0
  194. package/dist/theme/types.d.ts +7 -0
  195. package/dist/theme/types.js +1 -0
  196. package/dist/toast/create-toast-controller.d.ts +12 -0
  197. package/dist/toast/create-toast-controller.js +12 -0
  198. package/dist/toast/index.d.ts +2 -0
  199. package/dist/toast/index.js +1 -0
  200. package/package.json +146 -0
  201. package/specs/_template.md +110 -0
  202. package/specs/components/accordion.md +207 -0
  203. package/specs/components/alert.md +83 -0
  204. package/specs/components/badge.md +183 -0
  205. package/specs/components/breadcrumb.md +152 -0
  206. package/specs/components/button.md +227 -0
  207. package/specs/components/callout.md +153 -0
  208. package/specs/components/card.md +192 -0
  209. package/specs/components/carousel.md +232 -0
  210. package/specs/components/checkbox.md +141 -0
  211. package/specs/components/combobox.md +427 -0
  212. package/specs/components/context-menu.md +375 -0
  213. package/specs/components/copy-button.md +236 -0
  214. package/specs/components/date-picker.md +290 -0
  215. package/specs/components/dialog.md +184 -0
  216. package/specs/components/disclosure.md +151 -0
  217. package/specs/components/drawer.md +216 -0
  218. package/specs/components/feed.md +266 -0
  219. package/specs/components/grid.md +423 -0
  220. package/specs/components/input.md +237 -0
  221. package/specs/components/landmark.md +92 -0
  222. package/specs/components/link.md +117 -0
  223. package/specs/components/listbox.md +327 -0
  224. package/specs/components/menu.md +508 -0
  225. package/specs/components/meter.md +148 -0
  226. package/specs/components/number.md +268 -0
  227. package/specs/components/option.md +167 -0
  228. package/specs/components/popover.md +207 -0
  229. package/specs/components/progress-ring.md +134 -0
  230. package/specs/components/progress.md +110 -0
  231. package/specs/components/radio.md +208 -0
  232. package/specs/components/select.md +305 -0
  233. package/specs/components/sidebar.md +204 -0
  234. package/specs/components/spinbutton.md +157 -0
  235. package/specs/components/spinner.md +83 -0
  236. package/specs/components/switch.md +145 -0
  237. package/specs/components/table.md +372 -0
  238. package/specs/components/tabs.md +242 -0
  239. package/specs/components/textarea.md +166 -0
  240. package/specs/components/theme.md +364 -0
  241. package/specs/components/toast.md +198 -0
  242. package/specs/components/toolbar.md +258 -0
  243. package/specs/components/tooltip.md +152 -0
  244. package/specs/components/treegrid.md +363 -0
  245. package/specs/components/treeview.md +263 -0
  246. package/specs/components/window-splitter.md +225 -0
@@ -0,0 +1,318 @@
1
+ import { createCopyButton, } from '@chromvoid/headless-ui/copy-button';
2
+ import { css, html, nothing } from 'lit';
3
+ import { ReatomLitElement } from '../reatom-lit/ReatomLitElement.js';
4
+ // Default SVG icons
5
+ const copyIcon = html `
6
+ <svg
7
+ xmlns="http://www.w3.org/2000/svg"
8
+ viewBox="0 0 24 24"
9
+ fill="none"
10
+ stroke="currentColor"
11
+ stroke-width="2"
12
+ stroke-linecap="round"
13
+ stroke-linejoin="round"
14
+ >
15
+ <rect x="9" y="9" width="13" height="13" rx="2" ry="2" />
16
+ <path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1" />
17
+ </svg>
18
+ `;
19
+ const successIcon = html `
20
+ <svg
21
+ xmlns="http://www.w3.org/2000/svg"
22
+ viewBox="0 0 24 24"
23
+ fill="none"
24
+ stroke="currentColor"
25
+ stroke-width="2"
26
+ stroke-linecap="round"
27
+ stroke-linejoin="round"
28
+ >
29
+ <polyline points="20 6 9 17 4 12" />
30
+ </svg>
31
+ `;
32
+ const errorIcon = html `
33
+ <svg
34
+ xmlns="http://www.w3.org/2000/svg"
35
+ viewBox="0 0 24 24"
36
+ fill="none"
37
+ stroke="currentColor"
38
+ stroke-width="2"
39
+ stroke-linecap="round"
40
+ stroke-linejoin="round"
41
+ >
42
+ <line x1="18" y1="6" x2="6" y2="18" />
43
+ <line x1="6" y1="6" x2="18" y2="18" />
44
+ </svg>
45
+ `;
46
+ export class CVCopyButton extends ReatomLitElement {
47
+ static elementName = 'cv-copy-button';
48
+ static get properties() {
49
+ return {
50
+ value: { attribute: false },
51
+ disabled: { type: Boolean, reflect: true },
52
+ feedbackDuration: { type: Number, reflect: true, attribute: 'feedback-duration' },
53
+ size: { type: String, reflect: true },
54
+ };
55
+ }
56
+ __clipboard;
57
+ model;
58
+ /** @internal Overridable clipboard adapter for testing */
59
+ get _clipboard() {
60
+ return this.__clipboard;
61
+ }
62
+ set _clipboard(clip) {
63
+ this.__clipboard = clip;
64
+ this.model = this._createModel();
65
+ this.requestUpdate();
66
+ }
67
+ constructor() {
68
+ super();
69
+ this.value = '';
70
+ this.disabled = false;
71
+ this.feedbackDuration = 1500;
72
+ this.size = 'medium';
73
+ this.model = this._createModel();
74
+ }
75
+ static styles = [
76
+ css `
77
+ :host {
78
+ display: inline-block;
79
+ --cv-copy-button-size: 36px;
80
+ --cv-copy-button-border-radius: var(--cv-radius-sm, 6px);
81
+ --cv-copy-button-success-color: var(--cv-color-success, #4ade80);
82
+ --cv-copy-button-error-color: var(--cv-color-danger, #ff7d86);
83
+ }
84
+
85
+ [part='base'] {
86
+ display: inline-flex;
87
+ align-items: center;
88
+ justify-content: center;
89
+ width: var(--cv-copy-button-size);
90
+ height: var(--cv-copy-button-size);
91
+ border-radius: var(--cv-copy-button-border-radius);
92
+ border: 1px solid var(--cv-color-border, #2a3245);
93
+ background: var(--cv-color-surface, #141923);
94
+ color: var(--cv-color-text, #e8ecf6);
95
+ cursor: pointer;
96
+ user-select: none;
97
+ padding: 0;
98
+ position: relative;
99
+ transition:
100
+ background var(--cv-duration-fast, 120ms) var(--cv-easing-standard, ease),
101
+ border-color var(--cv-duration-fast, 120ms) var(--cv-easing-standard, ease),
102
+ color var(--cv-duration-fast, 120ms) var(--cv-easing-standard, ease);
103
+ }
104
+
105
+ [part='base']:hover {
106
+ border-color: var(--cv-color-primary, #65d7ff);
107
+ }
108
+
109
+ [part='base']:focus-visible {
110
+ outline: 2px solid var(--cv-color-primary, #65d7ff);
111
+ outline-offset: 2px;
112
+ }
113
+
114
+ [part='copy-icon'],
115
+ [part='success-icon'],
116
+ [part='error-icon'] {
117
+ display: inline-flex;
118
+ align-items: center;
119
+ justify-content: center;
120
+ width: 100%;
121
+ height: 100%;
122
+ position: absolute;
123
+ top: 0;
124
+ left: 0;
125
+ }
126
+
127
+ [part='copy-icon'] svg,
128
+ [part='success-icon'] svg,
129
+ [part='error-icon'] svg,
130
+ [part='copy-icon'] ::slotted(svg),
131
+ [part='success-icon'] ::slotted(svg),
132
+ [part='error-icon'] ::slotted(svg) {
133
+ width: 50%;
134
+ height: 50%;
135
+ }
136
+
137
+ [part='status'] {
138
+ position: absolute;
139
+ width: 1px;
140
+ height: 1px;
141
+ padding: 0;
142
+ margin: -1px;
143
+ overflow: hidden;
144
+ clip: rect(0, 0, 0, 0);
145
+ white-space: nowrap;
146
+ border-width: 0;
147
+ }
148
+
149
+ /* --- disabled --- */
150
+ :host([disabled]) {
151
+ opacity: 0.55;
152
+ cursor: not-allowed;
153
+ }
154
+
155
+ :host([disabled]) [part='base'] {
156
+ cursor: not-allowed;
157
+ pointer-events: none;
158
+ }
159
+
160
+ /* --- status: idle --- */
161
+ :host([status='idle']) [part='success-icon'],
162
+ :host([status='idle']) [part='error-icon'] {
163
+ display: none;
164
+ }
165
+
166
+ /* --- status: success --- */
167
+ :host([status='success']) [part='base'] {
168
+ color: var(--cv-copy-button-success-color);
169
+ border-color: var(--cv-copy-button-success-color);
170
+ }
171
+
172
+ :host([status='success']) [part='copy-icon'],
173
+ :host([status='success']) [part='error-icon'] {
174
+ display: none;
175
+ }
176
+
177
+ /* --- status: error --- */
178
+ :host([status='error']) [part='base'] {
179
+ color: var(--cv-copy-button-error-color);
180
+ border-color: var(--cv-copy-button-error-color);
181
+ }
182
+
183
+ :host([status='error']) [part='copy-icon'],
184
+ :host([status='error']) [part='success-icon'] {
185
+ display: none;
186
+ }
187
+
188
+ /* --- copying --- */
189
+ :host([copying]) {
190
+ cursor: progress;
191
+ }
192
+
193
+ :host([copying]) [part='base'] {
194
+ cursor: progress;
195
+ }
196
+
197
+ /* --- sizes --- */
198
+ :host([size='small']) {
199
+ --cv-copy-button-size: 30px;
200
+ }
201
+
202
+ :host([size='large']) {
203
+ --cv-copy-button-size: 42px;
204
+ }
205
+ `,
206
+ ];
207
+ static define() {
208
+ if (!customElements.get(this.elementName)) {
209
+ customElements.define(this.elementName, this);
210
+ }
211
+ }
212
+ _createModel() {
213
+ return createCopyButton({
214
+ value: this.value,
215
+ isDisabled: this.disabled,
216
+ feedbackDuration: this.feedbackDuration,
217
+ clipboard: this.__clipboard,
218
+ onCopy: (value) => {
219
+ this.dispatchEvent(new CustomEvent('cv-copy', {
220
+ detail: { value },
221
+ bubbles: true,
222
+ composed: true,
223
+ }));
224
+ },
225
+ onError: (error) => {
226
+ this.dispatchEvent(new CustomEvent('cv-error', {
227
+ detail: { error },
228
+ bubbles: true,
229
+ composed: true,
230
+ }));
231
+ },
232
+ });
233
+ }
234
+ willUpdate(changedProperties) {
235
+ super.willUpdate(changedProperties);
236
+ if (changedProperties.has('disabled')) {
237
+ this.model.actions.setDisabled(this.disabled);
238
+ }
239
+ if (changedProperties.has('feedbackDuration')) {
240
+ this.model.actions.setFeedbackDuration(this.feedbackDuration);
241
+ }
242
+ if (changedProperties.has('value')) {
243
+ this.model.actions.setValue(this.value);
244
+ }
245
+ }
246
+ _syncHostAttributes() {
247
+ const status = this.model.state.status();
248
+ const isCopying = this.model.state.isCopying();
249
+ // Reflect status attribute
250
+ this.setAttribute('status', status);
251
+ // Reflect copying attribute
252
+ if (isCopying) {
253
+ this.setAttribute('copying', '');
254
+ }
255
+ else {
256
+ this.removeAttribute('copying');
257
+ }
258
+ }
259
+ handleClick(e) {
260
+ this.model.contracts.getButtonProps().onClick(e);
261
+ }
262
+ handleKeyDown(e) {
263
+ this.model.contracts.getButtonProps().onKeyDown(e);
264
+ }
265
+ handleKeyUp(e) {
266
+ this.model.contracts.getButtonProps().onKeyUp(e);
267
+ }
268
+ render() {
269
+ this._syncHostAttributes();
270
+ const buttonProps = this.model.contracts.getButtonProps();
271
+ const statusProps = this.model.contracts.getStatusProps();
272
+ const copyIconProps = this.model.contracts.getIconContainerProps('copy');
273
+ const successIconProps = this.model.contracts.getIconContainerProps('success');
274
+ const errorIconProps = this.model.contracts.getIconContainerProps('error');
275
+ const statusText = this.model.state.status();
276
+ const statusAnnouncement = statusText === 'success' ? 'Copied' : statusText === 'error' ? 'Copy failed' : nothing;
277
+ return html `
278
+ <div
279
+ part="base"
280
+ role=${buttonProps.role}
281
+ tabindex=${buttonProps.tabindex}
282
+ aria-disabled=${buttonProps['aria-disabled']}
283
+ aria-label=${buttonProps['aria-label'] ?? nothing}
284
+ @click=${this.handleClick}
285
+ @keydown=${this.handleKeyDown}
286
+ @keyup=${this.handleKeyUp}
287
+ >
288
+ <span
289
+ part="copy-icon"
290
+ aria-hidden=${copyIconProps['aria-hidden']}
291
+ .hidden=${copyIconProps.hidden ?? false}
292
+ >
293
+ <slot name="copy-icon">${copyIcon}</slot>
294
+ </span>
295
+ <span
296
+ part="success-icon"
297
+ aria-hidden=${successIconProps['aria-hidden']}
298
+ .hidden=${successIconProps.hidden ?? false}
299
+ >
300
+ <slot name="success-icon">${successIcon}</slot>
301
+ </span>
302
+ <span
303
+ part="error-icon"
304
+ aria-hidden=${errorIconProps['aria-hidden']}
305
+ .hidden=${errorIconProps.hidden ?? false}
306
+ >
307
+ <slot name="error-icon">${errorIcon}</slot>
308
+ </span>
309
+ <span
310
+ part="status"
311
+ role=${statusProps.role}
312
+ aria-live=${statusProps['aria-live']}
313
+ aria-atomic=${statusProps['aria-atomic']}
314
+ >${statusAnnouncement}</span>
315
+ </div>
316
+ `;
317
+ }
318
+ }
@@ -0,0 +1,161 @@
1
+ import { type DatePickerTimeZone } from '@chromvoid/headless-ui/date-picker';
2
+ import type { PropertyValues } from 'lit';
3
+ import { FormAssociatedReatomElement } from '../form-associated/FormAssociatedReatomElement.js';
4
+ import type { FormAssociatedValidity } from '../form-associated/withFormAssociated.js';
5
+ export interface CVDatePickerInputEventDetail {
6
+ value: string;
7
+ inputValue: string;
8
+ open: boolean;
9
+ invalid: boolean;
10
+ }
11
+ export interface CVDatePickerChangeEventDetail {
12
+ value: string;
13
+ previousValue: string;
14
+ source: 'input' | 'dialog';
15
+ }
16
+ type CVDatePickerSize = 'small' | 'medium' | 'large';
17
+ export declare class CVDatePicker extends FormAssociatedReatomElement {
18
+ static elementName: string;
19
+ static get properties(): {
20
+ name: {
21
+ type: StringConstructor;
22
+ };
23
+ value: {
24
+ type: StringConstructor;
25
+ reflect: boolean;
26
+ };
27
+ open: {
28
+ type: BooleanConstructor;
29
+ reflect: boolean;
30
+ };
31
+ disabled: {
32
+ type: BooleanConstructor;
33
+ reflect: boolean;
34
+ };
35
+ readonly: {
36
+ type: BooleanConstructor;
37
+ reflect: boolean;
38
+ };
39
+ required: {
40
+ type: BooleanConstructor;
41
+ reflect: boolean;
42
+ };
43
+ placeholder: {
44
+ type: StringConstructor;
45
+ };
46
+ size: {
47
+ type: StringConstructor;
48
+ reflect: boolean;
49
+ };
50
+ locale: {
51
+ type: StringConstructor;
52
+ };
53
+ timeZone: {
54
+ type: StringConstructor;
55
+ attribute: string;
56
+ reflect: boolean;
57
+ };
58
+ min: {
59
+ type: StringConstructor;
60
+ };
61
+ max: {
62
+ type: StringConstructor;
63
+ };
64
+ minuteStep: {
65
+ type: NumberConstructor;
66
+ attribute: string;
67
+ };
68
+ hourCycle: {
69
+ type: NumberConstructor;
70
+ attribute: string;
71
+ };
72
+ closeOnEscape: {
73
+ type: BooleanConstructor;
74
+ attribute: string;
75
+ reflect: boolean;
76
+ };
77
+ ariaLabel: {
78
+ type: StringConstructor;
79
+ attribute: string;
80
+ };
81
+ inputInvalid: {
82
+ type: BooleanConstructor;
83
+ attribute: string;
84
+ reflect: boolean;
85
+ };
86
+ hasValue: {
87
+ type: BooleanConstructor;
88
+ attribute: string;
89
+ reflect: boolean;
90
+ };
91
+ };
92
+ name: string;
93
+ value: string;
94
+ open: boolean;
95
+ disabled: boolean;
96
+ readonly: boolean;
97
+ required: boolean;
98
+ placeholder: string;
99
+ size: CVDatePickerSize;
100
+ locale: string;
101
+ timeZone: DatePickerTimeZone;
102
+ min: string;
103
+ max: string;
104
+ minuteStep: number;
105
+ hourCycle: 12 | 24;
106
+ closeOnEscape: boolean;
107
+ ariaLabel: string;
108
+ inputInvalid: boolean;
109
+ hasValue: boolean;
110
+ private readonly idBase;
111
+ private model;
112
+ private pendingCommitSource;
113
+ private readonly documentPointerDownListener;
114
+ private defaultValue;
115
+ private didCaptureDefaultValue;
116
+ constructor();
117
+ static styles: import("lit").CSSResult[];
118
+ static define(): void;
119
+ connectedCallback(): void;
120
+ disconnectedCallback(): void;
121
+ willUpdate(changedProperties: PropertyValues): void;
122
+ updated(changedProperties: PropertyValues): void;
123
+ private createModel;
124
+ private rebuildModel;
125
+ private toNullable;
126
+ private syncModelFromExternalValue;
127
+ private syncHostStateFromModel;
128
+ private dispatchInput;
129
+ private dispatchChange;
130
+ private handleHeadlessInput;
131
+ private handleHeadlessCommit;
132
+ private syncOutsidePointerListener;
133
+ private handleDocumentPointerDown;
134
+ private handleInputEvent;
135
+ private handleInputKeyDown;
136
+ private handleInputFocus;
137
+ private handleInputBlur;
138
+ private handleDialogKeyDown;
139
+ private handleGridKeyDown;
140
+ private handleDayClick;
141
+ private handleDayMouseEnter;
142
+ private handleMonthPrevClick;
143
+ private handleMonthNextClick;
144
+ private handleYearPrevClick;
145
+ private handleYearNextClick;
146
+ private handleTimeInput;
147
+ private handleTimeKeyDown;
148
+ private handleApplyClick;
149
+ private handleCancelClick;
150
+ private handleClearClick;
151
+ protected onFormDisabledChanged(_disabled: boolean): void;
152
+ protected onFormReset(): void;
153
+ protected onFormStateRestore(state: string | File | FormData | null): void;
154
+ protected isFormAssociatedDisabled(): boolean;
155
+ protected getFormAssociatedValue(): string | File | FormData | null;
156
+ protected getFormAssociatedValidity(): FormAssociatedValidity;
157
+ private isEffectivelyDisabled;
158
+ private formatMonthLabel;
159
+ protected render(): import("lit").TemplateResult<1>;
160
+ }
161
+ export {};