@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,315 @@
1
+ import { css, html, nothing } from 'lit';
2
+ import { ReatomLitElement } from '../reatom-lit/ReatomLitElement.js';
3
+ import { CVIcon } from './cv-icon.js';
4
+ import { CVSpinner } from './cv-spinner.js';
5
+ export class CVToast extends ReatomLitElement {
6
+ static elementName = 'cv-toast';
7
+ static get properties() {
8
+ return {
9
+ level: { type: String, reflect: true },
10
+ closable: { type: Boolean, reflect: true },
11
+ toastId: { type: String, attribute: 'toast-id' },
12
+ title: { type: String },
13
+ message: { type: String },
14
+ iconName: { type: String, attribute: 'icon' },
15
+ progress: { type: Boolean, reflect: true },
16
+ paused: { type: Boolean, reflect: true },
17
+ durationMs: { type: Number, attribute: false },
18
+ actions: { attribute: false },
19
+ };
20
+ }
21
+ constructor() {
22
+ super();
23
+ this.level = 'info';
24
+ this.closable = true;
25
+ this.toastId = '';
26
+ this.title = '';
27
+ this.message = '';
28
+ this.iconName = '';
29
+ this.progress = false;
30
+ this.paused = false;
31
+ this.durationMs = 5000;
32
+ this.actions = [];
33
+ }
34
+ static styles = [
35
+ css `
36
+ :host {
37
+ display: block;
38
+ }
39
+
40
+ [part='base'] {
41
+ display: grid;
42
+ grid-template-columns: auto 1fr auto;
43
+ align-items: start;
44
+ gap: var(--cv-toast-gap, var(--cv-space-2, 8px));
45
+ padding: var(--cv-toast-padding-block, var(--cv-space-3, 12px))
46
+ var(--cv-toast-padding-inline, var(--cv-space-4, 16px));
47
+ border-radius: var(--cv-toast-border-radius, var(--cv-radius-md, 10px));
48
+ border: 1px solid var(--cv-toast-border-color, var(--cv-color-border, #2a3245));
49
+ background: var(--cv-toast-background, var(--cv-color-surface-elevated, #1d2432));
50
+ box-shadow: var(--cv-toast-shadow, var(--cv-shadow-1, 0 2px 8px rgba(0, 0, 0, 0.24)));
51
+ color: var(--cv-toast-color, var(--cv-color-text, #e8ecf6));
52
+ position: relative;
53
+ overflow: hidden;
54
+ }
55
+
56
+ [part='base'][data-level='success'] {
57
+ border-color: color-mix(
58
+ in oklab,
59
+ var(--cv-color-success, #6ef7c8) 45%,
60
+ var(--cv-color-border, #2a3245)
61
+ );
62
+ }
63
+
64
+ [part='base'][data-level='warning'] {
65
+ border-color: color-mix(
66
+ in oklab,
67
+ var(--cv-color-warning, #ffd36e) 45%,
68
+ var(--cv-color-border, #2a3245)
69
+ );
70
+ }
71
+
72
+ [part='base'][data-level='error'] {
73
+ border-color: color-mix(
74
+ in oklab,
75
+ var(--cv-color-danger, #ff7d86) 45%,
76
+ var(--cv-color-border, #2a3245)
77
+ );
78
+ }
79
+
80
+ [part='base'][data-level='loading'] {
81
+ border-color: color-mix(
82
+ in oklab,
83
+ var(--cv-color-primary, #65d7ff) 40%,
84
+ var(--cv-color-border, #2a3245)
85
+ );
86
+ }
87
+
88
+ [part='icon-wrap'] {
89
+ display: inline-flex;
90
+ align-items: center;
91
+ justify-content: center;
92
+ color: var(--cv-toast-accent, var(--cv-color-primary, #65d7ff));
93
+ margin-top: 1px;
94
+ }
95
+
96
+ [part='base'][data-level='success'] [part='icon-wrap'] {
97
+ --cv-toast-accent: var(--cv-color-success, #6ef7c8);
98
+ }
99
+
100
+ [part='base'][data-level='warning'] [part='icon-wrap'] {
101
+ --cv-toast-accent: var(--cv-color-warning, #ffd36e);
102
+ }
103
+
104
+ [part='base'][data-level='error'] [part='icon-wrap'] {
105
+ --cv-toast-accent: var(--cv-color-danger, #ff7d86);
106
+ }
107
+
108
+ [part='content'] {
109
+ display: grid;
110
+ gap: var(--cv-space-1, 4px);
111
+ min-inline-size: 0;
112
+ }
113
+
114
+ [part='title'] {
115
+ font-size: var(--cv-font-size-sm, 0.875rem);
116
+ font-weight: var(--cv-font-weight-semibold, 600);
117
+ color: var(--cv-color-text, #e8ecf6);
118
+ }
119
+
120
+ [part='dismiss'] {
121
+ border: 1px solid transparent;
122
+ border-radius: var(--cv-radius-sm, 6px);
123
+ background: transparent;
124
+ color: var(--cv-color-text-muted, #9aa6bf);
125
+ cursor: pointer;
126
+ padding: 0 var(--cv-space-2, 8px);
127
+ }
128
+
129
+ [part='dismiss']:hover {
130
+ color: var(--cv-color-text, #e8ecf6);
131
+ border-color: var(--cv-color-border, #2a3245);
132
+ }
133
+
134
+ [part='dismiss']:focus-visible {
135
+ outline: 2px solid var(--cv-color-primary, #65d7ff);
136
+ outline-offset: 1px;
137
+ }
138
+
139
+ [part='label'] {
140
+ color: var(--cv-color-text-muted, #9aa6bf);
141
+ line-height: 1.45;
142
+ word-break: break-word;
143
+ }
144
+
145
+ [part='actions'] {
146
+ display: flex;
147
+ flex-wrap: wrap;
148
+ gap: var(--cv-space-2, 8px);
149
+ margin-top: var(--cv-space-1, 4px);
150
+ }
151
+
152
+ [part='action'] {
153
+ border: 1px solid var(--cv-color-border, #2a3245);
154
+ background: color-mix(in oklab, var(--cv-color-surface-elevated, #1d2432) 88%, white 4%);
155
+ color: var(--cv-color-text, #e8ecf6);
156
+ font: inherit;
157
+ font-size: var(--cv-font-size-xs, 0.75rem);
158
+ font-weight: var(--cv-font-weight-semibold, 600);
159
+ padding: 4px 10px;
160
+ border-radius: var(--cv-radius-sm, 6px);
161
+ cursor: pointer;
162
+ }
163
+
164
+ [part='action']:hover {
165
+ border-color: var(--cv-color-primary, #65d7ff);
166
+ color: var(--cv-color-primary, #65d7ff);
167
+ }
168
+
169
+ [part='action']:focus-visible {
170
+ outline: 2px solid var(--cv-color-primary, #65d7ff);
171
+ outline-offset: 2px;
172
+ }
173
+
174
+ [part='progress'] {
175
+ position: absolute;
176
+ inset-inline: 0;
177
+ inset-block-end: 0;
178
+ block-size: var(--cv-toast-progress-height, 3px);
179
+ background: linear-gradient(
180
+ 90deg,
181
+ var(--cv-toast-accent, var(--cv-color-primary, #65d7ff)) 0%,
182
+ color-mix(in oklab, var(--cv-toast-accent, var(--cv-color-primary, #65d7ff)) 70%, white) 100%
183
+ );
184
+ transform-origin: left center;
185
+ }
186
+
187
+ :host([progress]) [part='progress'] {
188
+ animation: cv-toast-progress var(--cv-toast-progress-duration, 5000ms) linear forwards;
189
+ animation-play-state: var(--cv-toast-progress-play-state, running);
190
+ opacity: 0.85;
191
+ }
192
+
193
+ :host([paused]) {
194
+ --cv-toast-progress-play-state: paused;
195
+ }
196
+
197
+ cv-spinner {
198
+ --cv-spinner-size: 18px;
199
+ --cv-spinner-track-width: 2px;
200
+ color: currentColor;
201
+ }
202
+
203
+ cv-icon,
204
+ ::slotted([slot='icon']) {
205
+ inline-size: 18px;
206
+ block-size: 18px;
207
+ }
208
+
209
+ @keyframes cv-toast-progress {
210
+ from {
211
+ transform: scaleX(1);
212
+ }
213
+ to {
214
+ transform: scaleX(0);
215
+ }
216
+ }
217
+ `,
218
+ ];
219
+ static define() {
220
+ CVIcon.define();
221
+ CVSpinner.define();
222
+ if (!customElements.get(this.elementName)) {
223
+ customElements.define(this.elementName, this);
224
+ }
225
+ }
226
+ getRole() {
227
+ return this.level === 'warning' || this.level === 'error' ? 'alert' : 'status';
228
+ }
229
+ handleDismiss() {
230
+ this.dispatchEvent(new CustomEvent('cv-close', {
231
+ detail: { id: this.toastId },
232
+ bubbles: true,
233
+ composed: true,
234
+ }));
235
+ }
236
+ handleActionClick(event) {
237
+ const button = event.currentTarget;
238
+ if (!button)
239
+ return;
240
+ const index = Number(button.dataset['actionIndex']);
241
+ const action = this.actions[index];
242
+ action?.onClick?.();
243
+ }
244
+ updated(changedProperties) {
245
+ super.updated(changedProperties);
246
+ if (changedProperties.has('durationMs')) {
247
+ this.style.setProperty('--cv-toast-progress-duration', `${Math.max(this.durationMs, 0)}ms`);
248
+ }
249
+ }
250
+ renderFallbackIcon() {
251
+ if (this.level === 'loading') {
252
+ return html `
253
+ <cv-spinner label="Loading"></cv-spinner>
254
+ `;
255
+ }
256
+ if (this.iconName) {
257
+ return html `<cv-icon name=${this.iconName} aria-hidden="true"></cv-icon>`;
258
+ }
259
+ return nothing;
260
+ }
261
+ render() {
262
+ const role = this.getRole();
263
+ const hasActions = this.actions.length > 0;
264
+ const hasTitle = this.title.length > 0;
265
+ const hasMessage = this.message.length > 0;
266
+ return html `
267
+ <div part="base" role=${role} data-level=${this.level}>
268
+ <span part="icon-wrap"><slot name="icon">${this.renderFallbackIcon()}</slot></span>
269
+ <div part="content">
270
+ ${hasTitle ? html `<span part="title">${this.title}</span>` : nothing}
271
+ <span part="label">${hasMessage
272
+ ? this.message
273
+ : html `
274
+ <slot></slot>
275
+ `}</span>
276
+ ${hasActions
277
+ ? html `
278
+ <div part="actions">
279
+ ${this.actions.map((action, index) => html `
280
+ <button
281
+ part="action"
282
+ type="button"
283
+ data-action-index=${String(index)}
284
+ @click=${this.handleActionClick}
285
+ >
286
+ ${action.label}
287
+ </button>
288
+ `)}
289
+ </div>
290
+ `
291
+ : nothing}
292
+ </div>
293
+ ${this.closable
294
+ ? html `
295
+ <button
296
+ part="dismiss"
297
+ type="button"
298
+ role="button"
299
+ tabindex="0"
300
+ aria-label="Dismiss notification"
301
+ @click=${this.handleDismiss}
302
+ >
303
+ ×
304
+ </button>
305
+ `
306
+ : nothing}
307
+ ${this.progress && this.durationMs > 0
308
+ ? html `
309
+ <span part="progress"></span>
310
+ `
311
+ : nothing}
312
+ </div>
313
+ `;
314
+ }
315
+ }
@@ -0,0 +1,25 @@
1
+ import { LitElement } from 'lit';
2
+ export declare class CVToolbarItem extends LitElement {
3
+ static elementName: string;
4
+ static get properties(): {
5
+ value: {
6
+ type: StringConstructor;
7
+ reflect: boolean;
8
+ };
9
+ disabled: {
10
+ type: BooleanConstructor;
11
+ reflect: boolean;
12
+ };
13
+ active: {
14
+ type: BooleanConstructor;
15
+ reflect: boolean;
16
+ };
17
+ };
18
+ value: string;
19
+ disabled: boolean;
20
+ active: boolean;
21
+ constructor();
22
+ static styles: import("lit").CSSResult[];
23
+ static define(): void;
24
+ protected render(): import("lit").TemplateResult<1>;
25
+ }
@@ -0,0 +1,72 @@
1
+ import { LitElement, css, html } from 'lit';
2
+ export class CVToolbarItem extends LitElement {
3
+ static elementName = 'cv-toolbar-item';
4
+ static get properties() {
5
+ return {
6
+ value: { type: String, reflect: true },
7
+ disabled: { type: Boolean, reflect: true },
8
+ active: { type: Boolean, reflect: true },
9
+ };
10
+ }
11
+ constructor() {
12
+ super();
13
+ this.value = '';
14
+ this.disabled = false;
15
+ this.active = false;
16
+ }
17
+ static styles = [
18
+ css `
19
+ :host {
20
+ display: inline-block;
21
+ outline: none;
22
+ }
23
+
24
+ :host([hidden]) {
25
+ display: none;
26
+ }
27
+
28
+ .item {
29
+ display: inline-flex;
30
+ align-items: center;
31
+ justify-content: center;
32
+ min-block-size: var(--cv-toolbar-item-min-height, 32px);
33
+ padding: 0 var(--cv-toolbar-item-padding-inline, var(--cv-space-3, 12px));
34
+ border-radius: var(--cv-toolbar-item-border-radius, var(--cv-radius-sm, 6px));
35
+ border: 1px solid var(--cv-color-border, #2a3245);
36
+ background: var(--cv-color-surface, #141923);
37
+ color: var(--cv-color-text, #e8ecf6);
38
+ transition:
39
+ border-color var(--cv-duration-fast, 120ms) var(--cv-easing-standard, ease),
40
+ background var(--cv-duration-fast, 120ms) var(--cv-easing-standard, ease);
41
+ }
42
+
43
+ :host([active]) .item {
44
+ border-color: var(--cv-color-primary, #65d7ff);
45
+ background: color-mix(
46
+ in oklab,
47
+ var(--cv-color-primary, #65d7ff) 22%,
48
+ var(--cv-color-surface, #141923)
49
+ );
50
+ }
51
+
52
+ :host([disabled]) .item {
53
+ opacity: 0.55;
54
+ }
55
+
56
+ :host(:focus-visible) .item {
57
+ outline: 2px solid var(--cv-color-primary, #65d7ff);
58
+ outline-offset: 1px;
59
+ }
60
+ `,
61
+ ];
62
+ static define() {
63
+ if (!customElements.get(this.elementName)) {
64
+ customElements.define(this.elementName, this);
65
+ }
66
+ }
67
+ render() {
68
+ return html `
69
+ <div class="item" part="base"><slot></slot></div>
70
+ `;
71
+ }
72
+ }
@@ -0,0 +1,25 @@
1
+ import { LitElement } from 'lit';
2
+ export declare class CVToolbarSeparator extends LitElement {
3
+ static elementName: string;
4
+ static get properties(): {
5
+ value: {
6
+ type: StringConstructor;
7
+ reflect: boolean;
8
+ };
9
+ separatorRole: {
10
+ type: StringConstructor;
11
+ attribute: boolean;
12
+ };
13
+ separatorOrientation: {
14
+ type: StringConstructor;
15
+ attribute: boolean;
16
+ };
17
+ };
18
+ value: string;
19
+ separatorRole: string;
20
+ separatorOrientation: string;
21
+ constructor();
22
+ static styles: import("lit").CSSResult[];
23
+ static define(): void;
24
+ protected render(): import("lit").TemplateResult<1>;
25
+ }
@@ -0,0 +1,45 @@
1
+ import { LitElement, css, html } from 'lit';
2
+ export class CVToolbarSeparator extends LitElement {
3
+ static elementName = 'cv-toolbar-separator';
4
+ static get properties() {
5
+ return {
6
+ value: { type: String, reflect: true },
7
+ separatorRole: { type: String, attribute: false },
8
+ separatorOrientation: { type: String, attribute: false },
9
+ };
10
+ }
11
+ constructor() {
12
+ super();
13
+ this.value = '';
14
+ this.separatorRole = 'separator';
15
+ this.separatorOrientation = 'vertical';
16
+ }
17
+ static styles = [
18
+ css `
19
+ :host {
20
+ display: block;
21
+ pointer-events: none;
22
+ }
23
+
24
+ [part='base'] {
25
+ background: var(--cv-toolbar-separator-color, var(--cv-color-border, #2a3245));
26
+ margin: var(--cv-toolbar-separator-margin, var(--cv-space-1, 4px));
27
+ width: var(--cv-toolbar-separator-size, 1px);
28
+ align-self: stretch;
29
+ }
30
+
31
+ [part='base'][aria-orientation='horizontal'] {
32
+ width: auto;
33
+ height: var(--cv-toolbar-separator-size, 1px);
34
+ }
35
+ `,
36
+ ];
37
+ static define() {
38
+ if (!customElements.get(this.elementName)) {
39
+ customElements.define(this.elementName, this);
40
+ }
41
+ }
42
+ render() {
43
+ return html `<div part="base" role=${this.separatorRole} aria-orientation=${this.separatorOrientation}></div>`;
44
+ }
45
+ }
@@ -0,0 +1,63 @@
1
+ import { type CompositeNavigationOrientation } from '@chromvoid/headless-ui/interactions/composite-navigation';
2
+ import type { PropertyValues } from 'lit';
3
+ import { ReatomLitElement } from '../reatom-lit/ReatomLitElement.js';
4
+ export interface CVToolbarEventDetail {
5
+ activeId: string | null;
6
+ }
7
+ export declare class CVToolbar extends ReatomLitElement {
8
+ static elementName: string;
9
+ static get properties(): {
10
+ value: {
11
+ type: StringConstructor;
12
+ reflect: boolean;
13
+ };
14
+ orientation: {
15
+ type: StringConstructor;
16
+ reflect: boolean;
17
+ };
18
+ wrap: {
19
+ type: BooleanConstructor;
20
+ reflect: boolean;
21
+ };
22
+ ariaLabel: {
23
+ type: StringConstructor;
24
+ attribute: string;
25
+ };
26
+ };
27
+ value: string;
28
+ orientation: CompositeNavigationOrientation;
29
+ wrap: boolean;
30
+ ariaLabel: string;
31
+ private readonly idBase;
32
+ private itemRecords;
33
+ private separatorRecords;
34
+ private itemListeners;
35
+ private hasFocus;
36
+ private model;
37
+ constructor();
38
+ static styles: import("lit").CSSResult[];
39
+ static define(): void;
40
+ connectedCallback(): void;
41
+ disconnectedCallback(): void;
42
+ willUpdate(changedProperties: PropertyValues): void;
43
+ updated(changedProperties: PropertyValues): void;
44
+ private getItemElements;
45
+ private getSeparatorElements;
46
+ private ensureItemValue;
47
+ private ensureSeparatorValue;
48
+ private rebuildModelFromSlot;
49
+ private detachItemListeners;
50
+ private attachItemListeners;
51
+ private syncItemElements;
52
+ private syncSeparatorElements;
53
+ private dispatchInput;
54
+ private dispatchChange;
55
+ private focusActiveItem;
56
+ private applyInteractionResult;
57
+ private handleItemFocus;
58
+ private handleToolbarKeyDown;
59
+ private handleSlotChange;
60
+ private handleFocusIn;
61
+ private handleFocusOut;
62
+ protected render(): import("lit").TemplateResult<1>;
63
+ }