@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,280 @@
1
+ import { createBadge } from '@chromvoid/headless-ui/badge';
2
+ import { css, html, nothing } from 'lit';
3
+ import { ReatomLitElement } from '../reatom-lit/ReatomLitElement.js';
4
+ export class CVBadge extends ReatomLitElement {
5
+ static elementName = 'cv-badge';
6
+ static get properties() {
7
+ return {
8
+ variant: { type: String, reflect: true },
9
+ size: { type: String, reflect: true },
10
+ dot: { type: Boolean, reflect: true },
11
+ pulse: { type: Boolean, reflect: true },
12
+ pill: { type: Boolean, reflect: true },
13
+ dynamic: { type: Boolean, reflect: true },
14
+ decorative: { type: Boolean, reflect: true },
15
+ _ariaLabel: { type: String, attribute: 'aria-label', reflect: false },
16
+ };
17
+ }
18
+ model;
19
+ constructor() {
20
+ super();
21
+ this.variant = 'neutral';
22
+ this.size = 'medium';
23
+ this.dot = false;
24
+ this.pulse = false;
25
+ this.pill = false;
26
+ this.dynamic = false;
27
+ this.decorative = false;
28
+ this._ariaLabel = null;
29
+ this.model = this.createModel();
30
+ }
31
+ static styles = [
32
+ css `
33
+ :host {
34
+ display: inline-block;
35
+ --cv-badge-height: 24px;
36
+ --cv-badge-padding-inline: var(--cv-space-2, 8px);
37
+ --cv-badge-border-radius: var(--cv-radius-sm, 6px);
38
+ --cv-badge-gap: var(--cv-space-1, 4px);
39
+ --cv-badge-font-size: 12px;
40
+ --cv-badge-dot-size: 8px;
41
+ }
42
+
43
+ [part='base'] {
44
+ display: inline-flex;
45
+ align-items: center;
46
+ justify-content: center;
47
+ gap: var(--cv-badge-gap);
48
+ padding-inline: var(--cv-badge-padding-inline);
49
+ height: var(--cv-badge-height);
50
+ font-size: var(--cv-badge-font-size);
51
+ border-radius: var(--cv-badge-border-radius);
52
+ border: 1px solid var(--cv-color-border, #2a3245);
53
+ background: var(--cv-color-surface, #141923);
54
+ color: var(--cv-color-text, #e8ecf6);
55
+ user-select: none;
56
+ white-space: nowrap;
57
+ line-height: 1;
58
+ box-sizing: border-box;
59
+ transition:
60
+ background var(--cv-duration-fast, 120ms) var(--cv-easing-standard, ease),
61
+ border-color var(--cv-duration-fast, 120ms) var(--cv-easing-standard, ease),
62
+ color var(--cv-duration-fast, 120ms) var(--cv-easing-standard, ease);
63
+ }
64
+
65
+ [part='label'] {
66
+ display: inline-flex;
67
+ align-items: center;
68
+ justify-content: center;
69
+ gap: var(--cv-badge-gap);
70
+ }
71
+
72
+ [part='prefix'],
73
+ [part='suffix'] {
74
+ display: inline-flex;
75
+ align-items: center;
76
+ justify-content: center;
77
+ }
78
+
79
+ /* --- variant: neutral (default) --- */
80
+ :host([variant='neutral']) [part='base'] {
81
+ border-color: var(--cv-color-border, #2a3245);
82
+ background: var(--cv-color-surface, #141923);
83
+ }
84
+
85
+ /* --- variant: primary --- */
86
+ :host([variant='primary']) [part='base'] {
87
+ border-color: color-mix(
88
+ in oklab,
89
+ var(--cv-color-primary, #65d7ff) 52%,
90
+ var(--cv-color-border, #2a3245)
91
+ );
92
+ background: color-mix(
93
+ in oklab,
94
+ var(--cv-color-primary, #65d7ff) 22%,
95
+ var(--cv-color-surface, #141923)
96
+ );
97
+ }
98
+
99
+ /* --- variant: success --- */
100
+ :host([variant='success']) [part='base'] {
101
+ border-color: color-mix(
102
+ in oklab,
103
+ var(--cv-color-success, #5beba0) 52%,
104
+ var(--cv-color-border, #2a3245)
105
+ );
106
+ background: color-mix(
107
+ in oklab,
108
+ var(--cv-color-success, #5beba0) 22%,
109
+ var(--cv-color-surface, #141923)
110
+ );
111
+ }
112
+
113
+ /* --- variant: warning --- */
114
+ :host([variant='warning']) [part='base'] {
115
+ border-color: color-mix(
116
+ in oklab,
117
+ var(--cv-color-warning, #ffc857) 52%,
118
+ var(--cv-color-border, #2a3245)
119
+ );
120
+ background: color-mix(
121
+ in oklab,
122
+ var(--cv-color-warning, #ffc857) 22%,
123
+ var(--cv-color-surface, #141923)
124
+ );
125
+ }
126
+
127
+ /* --- variant: danger --- */
128
+ :host([variant='danger']) [part='base'] {
129
+ border-color: color-mix(
130
+ in oklab,
131
+ var(--cv-color-danger, #ff7d86) 52%,
132
+ var(--cv-color-border, #2a3245)
133
+ );
134
+ background: color-mix(
135
+ in oklab,
136
+ var(--cv-color-danger, #ff7d86) 22%,
137
+ var(--cv-color-surface, #141923)
138
+ );
139
+ }
140
+
141
+ /* --- pill modifier --- */
142
+ :host([pill]) {
143
+ --cv-badge-border-radius: 999px;
144
+ }
145
+
146
+ /* --- dot mode --- */
147
+ :host([dot]) [part='base'] {
148
+ padding: 0;
149
+ width: var(--cv-badge-dot-size);
150
+ height: var(--cv-badge-dot-size);
151
+ min-width: var(--cv-badge-dot-size);
152
+ min-height: var(--cv-badge-dot-size);
153
+ border-radius: 999px;
154
+ }
155
+
156
+ :host([dot]) [part='label'],
157
+ :host([dot]) [part='prefix'],
158
+ :host([dot]) [part='suffix'] {
159
+ display: none;
160
+ }
161
+
162
+ /* --- dot variant colors --- */
163
+ :host([dot][variant='neutral']) [part='base'] {
164
+ background: var(--cv-color-border, #2a3245);
165
+ border-color: var(--cv-color-border, #2a3245);
166
+ }
167
+
168
+ :host([dot][variant='primary']) [part='base'] {
169
+ background: var(--cv-color-primary, #65d7ff);
170
+ border-color: var(--cv-color-primary, #65d7ff);
171
+ }
172
+
173
+ :host([dot][variant='success']) [part='base'] {
174
+ background: var(--cv-color-success, #5beba0);
175
+ border-color: var(--cv-color-success, #5beba0);
176
+ }
177
+
178
+ :host([dot][variant='warning']) [part='base'] {
179
+ background: var(--cv-color-warning, #ffc857);
180
+ border-color: var(--cv-color-warning, #ffc857);
181
+ }
182
+
183
+ :host([dot][variant='danger']) [part='base'] {
184
+ background: var(--cv-color-danger, #ff7d86);
185
+ border-color: var(--cv-color-danger, #ff7d86);
186
+ }
187
+
188
+ /* --- pulse animation --- */
189
+ :host([pulse]) [part='base'] {
190
+ animation: cv-badge-pulse 1.5s ease-in-out infinite;
191
+ }
192
+
193
+ @keyframes cv-badge-pulse {
194
+ 0%,
195
+ 100% {
196
+ opacity: 1;
197
+ transform: scale(1);
198
+ }
199
+ 50% {
200
+ opacity: 0.7;
201
+ transform: scale(1.05);
202
+ }
203
+ }
204
+
205
+ /* --- sizes --- */
206
+ :host([size='small']) {
207
+ --cv-badge-height: 20px;
208
+ --cv-badge-padding-inline: var(--cv-space-1, 4px);
209
+ --cv-badge-font-size: 11px;
210
+ --cv-badge-dot-size: 6px;
211
+ }
212
+
213
+ :host([size='large']) {
214
+ --cv-badge-height: 28px;
215
+ --cv-badge-padding-inline: var(--cv-space-3, 12px);
216
+ --cv-badge-font-size: 14px;
217
+ --cv-badge-dot-size: 10px;
218
+ }
219
+ `,
220
+ ];
221
+ static define() {
222
+ if (!customElements.get(this.elementName)) {
223
+ customElements.define(this.elementName, this);
224
+ }
225
+ }
226
+ willUpdate(changedProperties) {
227
+ super.willUpdate(changedProperties);
228
+ if (changedProperties.has('variant')) {
229
+ this.model.actions.setVariant(this.variant);
230
+ }
231
+ if (changedProperties.has('size')) {
232
+ this.model.actions.setSize(this.size);
233
+ }
234
+ if (changedProperties.has('dot')) {
235
+ this.model.actions.setDot(this.dot);
236
+ }
237
+ if (changedProperties.has('pulse')) {
238
+ this.model.actions.setPulse(this.pulse);
239
+ }
240
+ if (changedProperties.has('pill')) {
241
+ this.model.actions.setPill(this.pill);
242
+ }
243
+ if (changedProperties.has('dynamic')) {
244
+ this.model.actions.setDynamic(this.dynamic);
245
+ }
246
+ if (changedProperties.has('decorative')) {
247
+ this.model.actions.setDecorative(this.decorative);
248
+ }
249
+ }
250
+ createModel() {
251
+ return createBadge({
252
+ variant: this.variant,
253
+ size: this.size,
254
+ dot: this.dot,
255
+ pulse: this.pulse,
256
+ pill: this.pill,
257
+ isDynamic: this.dynamic,
258
+ isDecorative: this.decorative,
259
+ });
260
+ }
261
+ render() {
262
+ const props = this.model.contracts.getBadgeProps();
263
+ const isDot = this.dot;
264
+ const ariaLabel = this._ariaLabel ?? props['aria-label'];
265
+ return html `
266
+ <div
267
+ part="base"
268
+ role=${props.role ?? nothing}
269
+ aria-live=${props['aria-live'] ?? nothing}
270
+ aria-atomic=${props['aria-atomic'] ?? nothing}
271
+ aria-hidden=${props['aria-hidden'] ?? nothing}
272
+ aria-label=${ariaLabel ?? nothing}
273
+ >
274
+ <span part="prefix" ?hidden=${isDot}><slot name="prefix"></slot></span>
275
+ <span part="label" ?hidden=${isDot}><slot></slot></span>
276
+ <span part="suffix" ?hidden=${isDot}><slot name="suffix"></slot></span>
277
+ </div>
278
+ `;
279
+ }
280
+ }
@@ -0,0 +1,35 @@
1
+ import { LitElement } from 'lit';
2
+ export declare class CVBreadcrumbItem extends LitElement {
3
+ static elementName: string;
4
+ static get properties(): {
5
+ value: {
6
+ type: StringConstructor;
7
+ reflect: boolean;
8
+ };
9
+ href: {
10
+ type: StringConstructor;
11
+ reflect: boolean;
12
+ };
13
+ current: {
14
+ type: BooleanConstructor;
15
+ reflect: boolean;
16
+ };
17
+ showSeparator: {
18
+ type: BooleanConstructor;
19
+ attribute: string;
20
+ reflect: boolean;
21
+ };
22
+ linkId: {
23
+ attribute: boolean;
24
+ };
25
+ };
26
+ value: string;
27
+ href: string;
28
+ current: boolean;
29
+ showSeparator: boolean;
30
+ linkId: string;
31
+ constructor();
32
+ static styles: import("lit").CSSResult[];
33
+ static define(): void;
34
+ protected render(): import("lit").TemplateResult<1>;
35
+ }
@@ -0,0 +1,64 @@
1
+ import { LitElement, css, html, nothing } from 'lit';
2
+ export class CVBreadcrumbItem extends LitElement {
3
+ static elementName = 'cv-breadcrumb-item';
4
+ static get properties() {
5
+ return {
6
+ value: { type: String, reflect: true },
7
+ href: { type: String, reflect: true },
8
+ current: { type: Boolean, reflect: true },
9
+ showSeparator: { type: Boolean, attribute: 'show-separator', reflect: true },
10
+ linkId: { attribute: false },
11
+ };
12
+ }
13
+ constructor() {
14
+ super();
15
+ this.value = '';
16
+ this.href = '';
17
+ this.current = false;
18
+ this.showSeparator = true;
19
+ this.linkId = '';
20
+ }
21
+ static styles = [
22
+ css `
23
+ :host {
24
+ display: inline-flex;
25
+ align-items: center;
26
+ gap: var(--cv-space-2, 8px);
27
+ }
28
+
29
+ [part='link'] {
30
+ color: var(--cv-color-text, #e8ecf6);
31
+ text-decoration: none;
32
+ }
33
+
34
+ :host([current]) [part='link'] {
35
+ font-weight: 600;
36
+ }
37
+
38
+ [part='separator'] {
39
+ color: color-mix(in oklab, var(--cv-color-text, #e8ecf6) 60%, transparent);
40
+ }
41
+
42
+ [part='separator'][hidden] {
43
+ display: none;
44
+ }
45
+ `,
46
+ ];
47
+ static define() {
48
+ if (!customElements.get(this.elementName)) {
49
+ customElements.define(this.elementName, this);
50
+ }
51
+ }
52
+ render() {
53
+ return html `
54
+ <span part="prefix"><slot name="prefix"></slot></span>
55
+ <a id=${this.linkId || nothing} role="link" href=${this.href} aria-current=${this.current ? 'page' : nothing} part="link">
56
+ <slot></slot>
57
+ </a>
58
+ <span part="suffix"><slot name="suffix"></slot></span>
59
+ <span aria-hidden="true" ?hidden=${!this.showSeparator} part="separator">
60
+ <slot name="separator">/</slot>
61
+ </span>
62
+ `;
63
+ }
64
+ }
@@ -0,0 +1,39 @@
1
+ import type { PropertyValues } from 'lit';
2
+ import { ReatomLitElement } from '../reatom-lit/ReatomLitElement.js';
3
+ export declare class CVBreadcrumb extends ReatomLitElement {
4
+ static elementName: string;
5
+ static get properties(): {
6
+ value: {
7
+ type: StringConstructor;
8
+ reflect: boolean;
9
+ };
10
+ ariaLabel: {
11
+ type: StringConstructor;
12
+ attribute: string;
13
+ };
14
+ ariaLabelledBy: {
15
+ type: StringConstructor;
16
+ attribute: string;
17
+ };
18
+ };
19
+ value: string;
20
+ ariaLabel: string;
21
+ ariaLabelledBy: string;
22
+ private readonly idBase;
23
+ private itemRecords;
24
+ private model;
25
+ constructor();
26
+ static styles: import("lit").CSSResult[];
27
+ static define(): void;
28
+ connectedCallback(): void;
29
+ willUpdate(changedProperties: PropertyValues): void;
30
+ updated(changedProperties: PropertyValues): void;
31
+ get items(): string[];
32
+ private getItemElements;
33
+ private ensureItemValue;
34
+ private ensureItemHref;
35
+ private rebuildModelFromSlot;
36
+ private syncItemElements;
37
+ private handleSlotChange;
38
+ protected render(): import("lit").TemplateResult<1>;
39
+ }
@@ -0,0 +1,160 @@
1
+ import { createBreadcrumb } from '@chromvoid/headless-ui/breadcrumb';
2
+ import { css, html, nothing } from 'lit';
3
+ import { ReatomLitElement } from '../reatom-lit/ReatomLitElement.js';
4
+ import { CVBreadcrumbItem } from './cv-breadcrumb-item.js';
5
+ let cvBreadcrumbNonce = 0;
6
+ export class CVBreadcrumb extends ReatomLitElement {
7
+ static elementName = 'cv-breadcrumb';
8
+ static get properties() {
9
+ return {
10
+ value: { type: String, reflect: true },
11
+ ariaLabel: { type: String, attribute: 'aria-label' },
12
+ ariaLabelledBy: { type: String, attribute: 'aria-labelledby' },
13
+ };
14
+ }
15
+ idBase = `cv-breadcrumb-${++cvBreadcrumbNonce}`;
16
+ itemRecords = [];
17
+ model;
18
+ constructor() {
19
+ super();
20
+ this.value = '';
21
+ this.ariaLabel = '';
22
+ this.ariaLabelledBy = '';
23
+ this.model = createBreadcrumb({
24
+ idBase: this.idBase,
25
+ items: [],
26
+ });
27
+ }
28
+ static styles = [
29
+ css `
30
+ :host {
31
+ display: block;
32
+ }
33
+
34
+ [part='base'] {
35
+ display: block;
36
+ }
37
+
38
+ [part='list'] {
39
+ display: flex;
40
+ flex-wrap: wrap;
41
+ align-items: center;
42
+ gap: var(--cv-space-2, 8px);
43
+ margin: 0;
44
+ padding: 0;
45
+ list-style: none;
46
+ }
47
+ `,
48
+ ];
49
+ static define() {
50
+ if (!customElements.get(this.elementName)) {
51
+ customElements.define(this.elementName, this);
52
+ }
53
+ }
54
+ connectedCallback() {
55
+ super.connectedCallback();
56
+ this.rebuildModelFromSlot(false, false, this.value.trim() || null);
57
+ }
58
+ willUpdate(changedProperties) {
59
+ super.willUpdate(changedProperties);
60
+ if (changedProperties.has('ariaLabel') || changedProperties.has('ariaLabelledBy')) {
61
+ this.rebuildModelFromSlot(true, false);
62
+ return;
63
+ }
64
+ if (changedProperties.has('value')) {
65
+ const normalized = this.value.trim();
66
+ if (this.value !== normalized) {
67
+ this.value = normalized;
68
+ }
69
+ this.rebuildModelFromSlot(true, false, normalized || null);
70
+ }
71
+ }
72
+ updated(changedProperties) {
73
+ super.updated(changedProperties);
74
+ if (!changedProperties.has('value')) {
75
+ this.syncItemElements();
76
+ }
77
+ }
78
+ get items() {
79
+ return this.itemRecords.map((item) => item.id);
80
+ }
81
+ getItemElements() {
82
+ return Array.from(this.children).filter((element) => element.tagName.toLowerCase() === CVBreadcrumbItem.elementName);
83
+ }
84
+ ensureItemValue(item, index) {
85
+ const normalized = item.value?.trim();
86
+ if (normalized)
87
+ return normalized;
88
+ const fallback = `item-${index + 1}`;
89
+ item.value = fallback;
90
+ return fallback;
91
+ }
92
+ ensureItemHref(item) {
93
+ const normalized = item.href?.trim();
94
+ if (normalized)
95
+ return normalized;
96
+ item.href = '#';
97
+ return '#';
98
+ }
99
+ rebuildModelFromSlot(preserveCurrent, requestRender = true, forcedCurrentId = null) {
100
+ const itemElements = this.getItemElements();
101
+ const previousCurrentId = preserveCurrent ? this.model.state.currentId() : null;
102
+ this.itemRecords = itemElements.map((element, index) => ({
103
+ id: this.ensureItemValue(element, index),
104
+ label: element.textContent?.trim() || element.value || `item-${index + 1}`,
105
+ href: this.ensureItemHref(element),
106
+ current: element.current,
107
+ element,
108
+ }));
109
+ const preferredCurrentId = forcedCurrentId ?? previousCurrentId;
110
+ this.model = createBreadcrumb({
111
+ idBase: this.idBase,
112
+ ariaLabel: this.ariaLabel || undefined,
113
+ ariaLabelledBy: this.ariaLabelledBy || undefined,
114
+ items: this.itemRecords.map((record) => ({
115
+ id: record.id,
116
+ label: record.label,
117
+ href: record.href,
118
+ isCurrent: preferredCurrentId ? record.id === preferredCurrentId : record.current,
119
+ })),
120
+ });
121
+ this.syncItemElements();
122
+ this.value = this.model.state.currentId() ?? '';
123
+ if (requestRender) {
124
+ this.requestUpdate();
125
+ }
126
+ }
127
+ syncItemElements() {
128
+ for (const [index, record] of this.itemRecords.entries()) {
129
+ const itemProps = this.model.contracts.getItemProps(record.id);
130
+ const linkProps = this.model.contracts.getLinkProps(record.id);
131
+ const separatorProps = this.model.contracts.getSeparatorProps(record.id);
132
+ record.element.id = itemProps.id;
133
+ record.element.linkId = linkProps.id;
134
+ record.element.href = linkProps.href;
135
+ record.element.current = linkProps['aria-current'] === 'page';
136
+ record.element.showSeparator =
137
+ index < this.itemRecords.length - 1 && separatorProps['aria-hidden'] === 'true';
138
+ record.element.setAttribute('data-current', itemProps['data-current']);
139
+ }
140
+ }
141
+ handleSlotChange() {
142
+ this.rebuildModelFromSlot(true, true);
143
+ }
144
+ render() {
145
+ const rootProps = this.model.contracts.getRootProps();
146
+ const listProps = this.model.contracts.getListProps();
147
+ return html `
148
+ <nav
149
+ role=${rootProps.role}
150
+ aria-label=${rootProps['aria-label'] ?? nothing}
151
+ aria-labelledby=${rootProps['aria-labelledby'] ?? nothing}
152
+ part="base"
153
+ >
154
+ <ol role=${listProps.role ?? nothing} part="list">
155
+ <slot @slotchange=${this.handleSlotChange}></slot>
156
+ </ol>
157
+ </nav>
158
+ `;
159
+ }
160
+ }
@@ -0,0 +1,83 @@
1
+ import type { PropertyValues } from 'lit';
2
+ import { FormAssociatedReatomElement } from '../form-associated/FormAssociatedReatomElement.js';
3
+ type CVButtonVariant = 'default' | 'primary' | 'danger' | 'ghost';
4
+ type CVButtonSize = 'small' | 'medium' | 'large';
5
+ type CVButtonType = 'button' | 'submit' | 'reset';
6
+ export interface CVButtonInputDetail {
7
+ pressed: boolean;
8
+ toggle: boolean;
9
+ }
10
+ export interface CVButtonChangeDetail {
11
+ pressed: boolean;
12
+ }
13
+ export declare class CVButton extends FormAssociatedReatomElement {
14
+ static elementName: string;
15
+ static get properties(): {
16
+ disabled: {
17
+ type: BooleanConstructor;
18
+ reflect: boolean;
19
+ };
20
+ toggle: {
21
+ type: BooleanConstructor;
22
+ reflect: boolean;
23
+ };
24
+ pressed: {
25
+ type: BooleanConstructor;
26
+ reflect: boolean;
27
+ };
28
+ loading: {
29
+ type: BooleanConstructor;
30
+ reflect: boolean;
31
+ };
32
+ variant: {
33
+ type: StringConstructor;
34
+ reflect: boolean;
35
+ };
36
+ outline: {
37
+ type: BooleanConstructor;
38
+ reflect: boolean;
39
+ };
40
+ pill: {
41
+ type: BooleanConstructor;
42
+ reflect: boolean;
43
+ };
44
+ size: {
45
+ type: StringConstructor;
46
+ reflect: boolean;
47
+ };
48
+ type: {
49
+ type: StringConstructor;
50
+ reflect: boolean;
51
+ };
52
+ };
53
+ disabled: boolean;
54
+ toggle: boolean;
55
+ pressed: boolean;
56
+ loading: boolean;
57
+ variant: CVButtonVariant;
58
+ outline: boolean;
59
+ pill: boolean;
60
+ size: CVButtonSize;
61
+ type: CVButtonType;
62
+ private model;
63
+ private suppressKeyboardClick;
64
+ constructor();
65
+ static styles: import("lit").CSSResult[];
66
+ static define(): void;
67
+ willUpdate(changedProperties: PropertyValues): void;
68
+ private createModel;
69
+ private dispatchInput;
70
+ private dispatchChange;
71
+ private handlePress;
72
+ private getButtonType;
73
+ protected isFormAssociatedDisabled(): boolean;
74
+ protected getFormAssociatedValue(): string | File | FormData | null;
75
+ private triggerFormAction;
76
+ private handleClick;
77
+ private handleKeyDown;
78
+ private handleKeyUp;
79
+ private handleContentSlotChange;
80
+ private hasSlotContent;
81
+ protected render(): import("lit").TemplateResult<1>;
82
+ }
83
+ export {};