@moni-labs/moni-ui 0.2.0 → 0.3.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 (323) hide show
  1. package/README.md +52 -194
  2. package/custom-elements.json +1636 -350
  3. package/dist/actions/index.d.ts +6 -0
  4. package/dist/actions/index.d.ts.map +1 -1
  5. package/dist/actions/index.js +6 -0
  6. package/dist/components/_base/field-styles.d.ts +51 -16
  7. package/dist/components/_base/field-styles.d.ts.map +1 -1
  8. package/dist/components/_base/field-styles.js +164 -36
  9. package/dist/components/_base/index.d.ts +25 -0
  10. package/dist/components/_base/index.d.ts.map +1 -1
  11. package/dist/components/_base/index.js +25 -0
  12. package/dist/components/_base/interaction-styles.d.ts +39 -12
  13. package/dist/components/_base/interaction-styles.d.ts.map +1 -1
  14. package/dist/components/_base/interaction-styles.js +85 -33
  15. package/dist/components/_base/moni-element.d.ts +43 -8
  16. package/dist/components/_base/moni-element.d.ts.map +1 -1
  17. package/dist/components/_base/moni-element.js +43 -8
  18. package/dist/components/_base/shared-styles.d.ts +41 -17
  19. package/dist/components/_base/shared-styles.d.ts.map +1 -1
  20. package/dist/components/_base/shared-styles.js +113 -21
  21. package/dist/components/index.d.ts +6 -0
  22. package/dist/components/index.d.ts.map +1 -1
  23. package/dist/components/index.js +6 -0
  24. package/dist/components/loading-shapes.d.ts +6 -0
  25. package/dist/components/loading-shapes.d.ts.map +1 -1
  26. package/dist/components/loading-shapes.js +6 -0
  27. package/dist/components/moni-app-bar.d.ts +128 -33
  28. package/dist/components/moni-app-bar.d.ts.map +1 -1
  29. package/dist/components/moni-app-bar.js +121 -26
  30. package/dist/components/moni-badge.d.ts +122 -14
  31. package/dist/components/moni-badge.d.ts.map +1 -1
  32. package/dist/components/moni-badge.js +122 -14
  33. package/dist/components/moni-bottom-sheet.d.ts +120 -15
  34. package/dist/components/moni-bottom-sheet.d.ts.map +1 -1
  35. package/dist/components/moni-bottom-sheet.js +116 -12
  36. package/dist/components/moni-button-group.d.ts +53 -27
  37. package/dist/components/moni-button-group.d.ts.map +1 -1
  38. package/dist/components/moni-button-group.js +49 -23
  39. package/dist/components/moni-button-segment.d.ts +28 -8
  40. package/dist/components/moni-button-segment.d.ts.map +1 -1
  41. package/dist/components/moni-button-segment.js +27 -7
  42. package/dist/components/moni-button.d.ts +51 -32
  43. package/dist/components/moni-button.d.ts.map +1 -1
  44. package/dist/components/moni-button.js +50 -31
  45. package/dist/components/moni-card.d.ts +91 -31
  46. package/dist/components/moni-card.d.ts.map +1 -1
  47. package/dist/components/moni-card.js +86 -26
  48. package/dist/components/moni-carousel.d.ts +67 -17
  49. package/dist/components/moni-carousel.d.ts.map +1 -1
  50. package/dist/components/moni-carousel.js +59 -16
  51. package/dist/components/moni-checkbox.d.ts +122 -17
  52. package/dist/components/moni-checkbox.d.ts.map +1 -1
  53. package/dist/components/moni-checkbox.js +118 -14
  54. package/dist/components/moni-chip.d.ts +56 -30
  55. package/dist/components/moni-chip.d.ts.map +1 -1
  56. package/dist/components/moni-chip.js +51 -25
  57. package/dist/components/moni-color-field.d.ts +44 -6
  58. package/dist/components/moni-color-field.d.ts.map +1 -1
  59. package/dist/components/moni-color-field.js +43 -5
  60. package/dist/components/moni-context-menu.d.ts +44 -22
  61. package/dist/components/moni-context-menu.d.ts.map +1 -1
  62. package/dist/components/moni-context-menu.js +43 -21
  63. package/dist/components/moni-dialog.d.ts +107 -15
  64. package/dist/components/moni-dialog.d.ts.map +1 -1
  65. package/dist/components/moni-dialog.js +105 -14
  66. package/dist/components/moni-divider.d.ts +50 -15
  67. package/dist/components/moni-divider.d.ts.map +1 -1
  68. package/dist/components/moni-divider.js +49 -14
  69. package/dist/components/moni-expansion.d.ts +44 -8
  70. package/dist/components/moni-expansion.d.ts.map +1 -1
  71. package/dist/components/moni-expansion.js +43 -7
  72. package/dist/components/moni-fab-menu.d.ts +39 -20
  73. package/dist/components/moni-fab-menu.d.ts.map +1 -1
  74. package/dist/components/moni-fab-menu.js +38 -19
  75. package/dist/components/moni-fab.d.ts +49 -23
  76. package/dist/components/moni-fab.d.ts.map +1 -1
  77. package/dist/components/moni-fab.js +46 -20
  78. package/dist/components/moni-file-field.d.ts +54 -14
  79. package/dist/components/moni-file-field.d.ts.map +1 -1
  80. package/dist/components/moni-file-field.js +53 -13
  81. package/dist/components/moni-icon.d.ts +78 -11
  82. package/dist/components/moni-icon.d.ts.map +1 -1
  83. package/dist/components/moni-icon.js +77 -10
  84. package/dist/components/moni-list-item.d.ts +61 -30
  85. package/dist/components/moni-list-item.d.ts.map +1 -1
  86. package/dist/components/moni-list-item.js +55 -24
  87. package/dist/components/moni-list.d.ts +37 -13
  88. package/dist/components/moni-list.d.ts.map +1 -1
  89. package/dist/components/moni-list.js +36 -12
  90. package/dist/components/moni-loading-indicator.d.ts +38 -11
  91. package/dist/components/moni-loading-indicator.d.ts.map +1 -1
  92. package/dist/components/moni-loading-indicator.js +37 -10
  93. package/dist/components/moni-menu-item.d.ts +31 -8
  94. package/dist/components/moni-menu-item.d.ts.map +1 -1
  95. package/dist/components/moni-menu-item.js +30 -7
  96. package/dist/components/moni-menu.d.ts +58 -33
  97. package/dist/components/moni-menu.d.ts.map +1 -1
  98. package/dist/components/moni-menu.js +51 -26
  99. package/dist/components/moni-morph-modal.d.ts +7 -1
  100. package/dist/components/moni-morph-modal.d.ts.map +1 -1
  101. package/dist/components/moni-morph-modal.js +46 -24
  102. package/dist/components/moni-nav-item.d.ts +50 -10
  103. package/dist/components/moni-nav-item.d.ts.map +1 -1
  104. package/dist/components/moni-nav-item.js +48 -8
  105. package/dist/components/moni-nav.d.ts +57 -22
  106. package/dist/components/moni-nav.d.ts.map +1 -1
  107. package/dist/components/moni-nav.js +53 -18
  108. package/dist/components/moni-progress.d.ts +108 -20
  109. package/dist/components/moni-progress.d.ts.map +1 -1
  110. package/dist/components/moni-progress.js +104 -16
  111. package/dist/components/moni-radio.d.ts +106 -14
  112. package/dist/components/moni-radio.d.ts.map +1 -1
  113. package/dist/components/moni-radio.js +104 -13
  114. package/dist/components/moni-ripple.d.ts +121 -10
  115. package/dist/components/moni-ripple.d.ts.map +1 -1
  116. package/dist/components/moni-ripple.js +120 -9
  117. package/dist/components/moni-segmented-button.d.ts +31 -11
  118. package/dist/components/moni-segmented-button.d.ts.map +1 -1
  119. package/dist/components/moni-segmented-button.js +30 -10
  120. package/dist/components/moni-select-option.d.ts +43 -9
  121. package/dist/components/moni-select-option.d.ts.map +1 -1
  122. package/dist/components/moni-select-option.js +41 -7
  123. package/dist/components/moni-select.d.ts +59 -2
  124. package/dist/components/moni-select.d.ts.map +1 -1
  125. package/dist/components/moni-select.js +58 -1
  126. package/dist/components/moni-shape.d.ts +1 -1
  127. package/dist/components/moni-side-sheet.d.ts +56 -19
  128. package/dist/components/moni-side-sheet.d.ts.map +1 -1
  129. package/dist/components/moni-side-sheet.js +53 -16
  130. package/dist/components/moni-slider.d.ts +56 -25
  131. package/dist/components/moni-slider.d.ts.map +1 -1
  132. package/dist/components/moni-slider.js +55 -24
  133. package/dist/components/moni-snackbar.d.ts +86 -17
  134. package/dist/components/moni-snackbar.d.ts.map +1 -1
  135. package/dist/components/moni-snackbar.js +85 -16
  136. package/dist/components/moni-split-button.d.ts +38 -9
  137. package/dist/components/moni-split-button.d.ts.map +1 -1
  138. package/dist/components/moni-split-button.js +37 -8
  139. package/dist/components/moni-step.d.ts +42 -9
  140. package/dist/components/moni-step.d.ts.map +1 -1
  141. package/dist/components/moni-step.js +41 -8
  142. package/dist/components/moni-stepper.d.ts +43 -6
  143. package/dist/components/moni-stepper.d.ts.map +1 -1
  144. package/dist/components/moni-stepper.js +42 -5
  145. package/dist/components/moni-switch.d.ts +103 -16
  146. package/dist/components/moni-switch.d.ts.map +1 -1
  147. package/dist/components/moni-switch.js +99 -13
  148. package/dist/components/moni-tab.d.ts +35 -8
  149. package/dist/components/moni-tab.d.ts.map +1 -1
  150. package/dist/components/moni-tab.js +34 -7
  151. package/dist/components/moni-tabs.d.ts +51 -13
  152. package/dist/components/moni-tabs.d.ts.map +1 -1
  153. package/dist/components/moni-tabs.js +48 -10
  154. package/dist/components/moni-text-field.d.ts +55 -10
  155. package/dist/components/moni-text-field.d.ts.map +1 -1
  156. package/dist/components/moni-text-field.js +54 -9
  157. package/dist/components/moni-textarea.d.ts +51 -21
  158. package/dist/components/moni-textarea.d.ts.map +1 -1
  159. package/dist/components/moni-textarea.js +48 -18
  160. package/dist/components/moni-time-picker.d.ts +41 -11
  161. package/dist/components/moni-time-picker.d.ts.map +1 -1
  162. package/dist/components/moni-time-picker.js +40 -10
  163. package/dist/components/moni-toolbar.d.ts +43 -15
  164. package/dist/components/moni-toolbar.d.ts.map +1 -1
  165. package/dist/components/moni-toolbar.js +42 -14
  166. package/dist/components/moni-tooltip.d.ts +55 -25
  167. package/dist/components/moni-tooltip.d.ts.map +1 -1
  168. package/dist/components/moni-tooltip.js +54 -24
  169. package/dist/components/moni-typography.d.ts +43 -18
  170. package/dist/components/moni-typography.d.ts.map +1 -1
  171. package/dist/components/moni-typography.js +42 -17
  172. package/dist/index.d.ts +47 -0
  173. package/dist/index.d.ts.map +1 -1
  174. package/dist/index.js +59 -2
  175. package/dist/styles/tailwind.css +67 -0
  176. package/dist/styles/tokens.css +111 -99
  177. package/dist/utils/color.d.ts +181 -2
  178. package/dist/utils/color.d.ts.map +1 -1
  179. package/dist/utils/color.js +182 -4
  180. package/dist/utils/theme.svelte.d.ts +305 -2
  181. package/dist/utils/theme.svelte.d.ts.map +1 -1
  182. package/dist/utils/theme.svelte.js +331 -2
  183. package/dist/web-components.d.ts +28 -0
  184. package/dist/web-components.d.ts.map +1 -1
  185. package/dist/web-components.js +29 -2
  186. package/package.json +1 -1
  187. package/src/actions/index.ts +7 -0
  188. package/src/components/_base/field-styles.ts +165 -37
  189. package/src/components/_base/index.ts +27 -0
  190. package/src/components/_base/interaction-styles.ts +86 -33
  191. package/src/components/_base/moni-element.ts +44 -8
  192. package/src/components/_base/shared-styles.ts +114 -21
  193. package/src/components/index.ts +7 -0
  194. package/src/components/loading-shapes.ts +7 -0
  195. package/src/components/moni-app-bar.ts +127 -26
  196. package/src/components/moni-badge.ts +128 -14
  197. package/src/components/moni-bottom-sheet.ts +125 -13
  198. package/src/components/moni-button-group.ts +50 -23
  199. package/src/components/moni-button-segment.ts +28 -7
  200. package/src/components/moni-button.ts +51 -31
  201. package/src/components/moni-card.ts +90 -26
  202. package/src/components/moni-carousel.ts +67 -16
  203. package/src/components/moni-checkbox.ts +125 -14
  204. package/src/components/moni-chip.ts +52 -25
  205. package/src/components/moni-color-field.ts +44 -5
  206. package/src/components/moni-context-menu.ts +44 -21
  207. package/src/components/moni-dialog.ts +111 -14
  208. package/src/components/moni-divider.ts +50 -14
  209. package/src/components/moni-expansion.ts +44 -7
  210. package/src/components/moni-fab-menu.ts +39 -19
  211. package/src/components/moni-fab.ts +47 -20
  212. package/src/components/moni-file-field.ts +54 -13
  213. package/src/components/moni-icon.ts +80 -10
  214. package/src/components/moni-list-item.ts +56 -24
  215. package/src/components/moni-list.ts +37 -12
  216. package/src/components/moni-loading-indicator.ts +38 -10
  217. package/src/components/moni-menu-item.ts +31 -7
  218. package/src/components/moni-menu.ts +52 -26
  219. package/src/components/moni-morph-modal.ts +58 -24
  220. package/src/components/moni-nav-item.ts +49 -8
  221. package/src/components/moni-nav.ts +54 -18
  222. package/src/components/moni-progress.ts +109 -16
  223. package/src/components/moni-radio.ts +111 -13
  224. package/src/components/moni-ripple.ts +126 -9
  225. package/src/components/moni-segmented-button.ts +31 -10
  226. package/src/components/moni-select-option.ts +42 -7
  227. package/src/components/moni-select.ts +79 -1
  228. package/src/components/moni-side-sheet.ts +54 -16
  229. package/src/components/moni-slider.ts +56 -24
  230. package/src/components/moni-snackbar.ts +90 -16
  231. package/src/components/moni-split-button.ts +38 -8
  232. package/src/components/moni-step.ts +42 -8
  233. package/src/components/moni-stepper.ts +43 -5
  234. package/src/components/moni-switch.ts +106 -13
  235. package/src/components/moni-tab.ts +35 -7
  236. package/src/components/moni-tabs.ts +49 -10
  237. package/src/components/moni-text-field.ts +55 -9
  238. package/src/components/moni-textarea.ts +49 -18
  239. package/src/components/moni-time-picker.ts +41 -10
  240. package/src/components/moni-toolbar.ts +43 -14
  241. package/src/components/moni-tooltip.ts +55 -24
  242. package/src/components/moni-typography.ts +43 -17
  243. package/src/index.ts +67 -3
  244. package/src/styles/tailwind.css +67 -0
  245. package/src/styles/tokens.css +111 -99
  246. package/src/types/svelte-runes.d.ts +64 -2
  247. package/src/utils/color.ts +286 -5
  248. package/src/utils/theme.svelte.ts +411 -2
  249. package/src/web-components.ts +31 -2
  250. package/dist/assets/shapes/arch.svg +0 -1
  251. package/dist/assets/shapes/arrow.svg +0 -1
  252. package/dist/assets/shapes/boom.svg +0 -1
  253. package/dist/assets/shapes/burst.svg +0 -1
  254. package/dist/assets/shapes/circle.svg +0 -1
  255. package/dist/assets/shapes/clamshell.svg +0 -1
  256. package/dist/assets/shapes/diamond.svg +0 -1
  257. package/dist/assets/shapes/fan.svg +0 -1
  258. package/dist/assets/shapes/flower.svg +0 -1
  259. package/dist/assets/shapes/gem.svg +0 -1
  260. package/dist/assets/shapes/ghost-ish.svg +0 -1
  261. package/dist/assets/shapes/heart.svg +0 -1
  262. package/dist/assets/shapes/leaf-clover4.svg +0 -1
  263. package/dist/assets/shapes/leaf-clover8.svg +0 -1
  264. package/dist/assets/shapes/loading-indicator.svg +0 -1
  265. package/dist/assets/shapes/oval.svg +0 -1
  266. package/dist/assets/shapes/pentagon.svg +0 -1
  267. package/dist/assets/shapes/pill.svg +0 -1
  268. package/dist/assets/shapes/pixel-circle.svg +0 -1
  269. package/dist/assets/shapes/pixel-triangle.svg +0 -1
  270. package/dist/assets/shapes/puffy-diamond.svg +0 -1
  271. package/dist/assets/shapes/puffy.svg +0 -1
  272. package/dist/assets/shapes/semicircle.svg +0 -1
  273. package/dist/assets/shapes/sided-cookie12.svg +0 -1
  274. package/dist/assets/shapes/sided-cookie4.svg +0 -1
  275. package/dist/assets/shapes/sided-cookie6.svg +0 -1
  276. package/dist/assets/shapes/sided-cookie7.svg +0 -1
  277. package/dist/assets/shapes/sided-cookie9.svg +0 -1
  278. package/dist/assets/shapes/slanted.svg +0 -1
  279. package/dist/assets/shapes/soft-boom.svg +0 -1
  280. package/dist/assets/shapes/soft-burst.svg +0 -1
  281. package/dist/assets/shapes/square.svg +0 -1
  282. package/dist/assets/shapes/sunny.svg +0 -1
  283. package/dist/assets/shapes/triangle.svg +0 -1
  284. package/dist/assets/shapes/very-sunny.svg +0 -1
  285. package/dist/assets/shapes/wavy-circle.svg +0 -1
  286. package/dist/assets/shapes/wavy.svg +0 -1
  287. package/src/assets/shapes/arch.svg +0 -1
  288. package/src/assets/shapes/arrow.svg +0 -1
  289. package/src/assets/shapes/boom.svg +0 -1
  290. package/src/assets/shapes/burst.svg +0 -1
  291. package/src/assets/shapes/circle.svg +0 -1
  292. package/src/assets/shapes/clamshell.svg +0 -1
  293. package/src/assets/shapes/diamond.svg +0 -1
  294. package/src/assets/shapes/fan.svg +0 -1
  295. package/src/assets/shapes/flower.svg +0 -1
  296. package/src/assets/shapes/gem.svg +0 -1
  297. package/src/assets/shapes/ghost-ish.svg +0 -1
  298. package/src/assets/shapes/heart.svg +0 -1
  299. package/src/assets/shapes/leaf-clover4.svg +0 -1
  300. package/src/assets/shapes/leaf-clover8.svg +0 -1
  301. package/src/assets/shapes/loading-indicator.svg +0 -1
  302. package/src/assets/shapes/oval.svg +0 -1
  303. package/src/assets/shapes/pentagon.svg +0 -1
  304. package/src/assets/shapes/pill.svg +0 -1
  305. package/src/assets/shapes/pixel-circle.svg +0 -1
  306. package/src/assets/shapes/pixel-triangle.svg +0 -1
  307. package/src/assets/shapes/puffy-diamond.svg +0 -1
  308. package/src/assets/shapes/puffy.svg +0 -1
  309. package/src/assets/shapes/semicircle.svg +0 -1
  310. package/src/assets/shapes/sided-cookie12.svg +0 -1
  311. package/src/assets/shapes/sided-cookie4.svg +0 -1
  312. package/src/assets/shapes/sided-cookie6.svg +0 -1
  313. package/src/assets/shapes/sided-cookie7.svg +0 -1
  314. package/src/assets/shapes/sided-cookie9.svg +0 -1
  315. package/src/assets/shapes/slanted.svg +0 -1
  316. package/src/assets/shapes/soft-boom.svg +0 -1
  317. package/src/assets/shapes/soft-burst.svg +0 -1
  318. package/src/assets/shapes/square.svg +0 -1
  319. package/src/assets/shapes/sunny.svg +0 -1
  320. package/src/assets/shapes/triangle.svg +0 -1
  321. package/src/assets/shapes/very-sunny.svg +0 -1
  322. package/src/assets/shapes/wavy-circle.svg +0 -1
  323. package/src/assets/shapes/wavy.svg +0 -1
@@ -1,3 +1,10 @@
1
+ /**
2
+ * @file components/moni-button.ts
3
+ * @package @moni-labs/moni-ui
4
+ * @license MIT
5
+ * @contributors Moni Labs & Contributors
6
+ */
7
+
1
8
  import { html, css } from 'lit';
2
9
  import { customElement, property } from 'lit/decorators.js';
3
10
  import { ifDefined } from 'lit/directives/if-defined.js';
@@ -6,41 +13,54 @@ import './moni-icon.js';
6
13
  import './moni-progress.js';
7
14
 
8
15
  /**
9
- * Visual-only button. Renders a native `<button>` styled per Material 3 Expressive.
16
+ * Material Design 3 Button component.
17
+ *
18
+ * Buttons allow users to take actions and make choices with a single tap.
19
+ * This component provides all M3 button variants, sizes, and shape morphing
20
+ * capabilities (e.g. morphing to a pill shape on press or toggle).
21
+ *
22
+ * **M3 spec reference:** `m3-docs/components/buttons/specs.md`
23
+ *
24
+ * **Variants:**
25
+ * - `filled` (default) — High emphasis. Use for primary actions.
26
+ * - `tonal` — Medium emphasis. Secondary actions that still need to stand out.
27
+ * - `elevated` — Medium emphasis with shadow. Used when sitting on patterned backgrounds.
28
+ * - `outlined` — Medium emphasis, no fill. Secondary or tertiary actions.
29
+ * - `text` — Low emphasis. Tertiary actions (e.g. dialog cancel button).
30
+ *
31
+ * **Shape morphing (M3 Expressive feature):**
32
+ * - On press (active state): Round and square buttons morph to a slightly squarer
33
+ * "pressed" shape with specific M3 corner radii (e.g. XS/S 8dp, M 12dp).
34
+ * - On toggle (`active` attribute): The resting shape flips (e.g. round ↔ square).
35
+ *
36
+ * **Rendering as a link:**
37
+ * When the `href` attribute is provided, the component internally renders as
38
+ * an `<a>` element instead of a `<button>`, allowing native routing and
39
+ * middle-click (open in new tab) behaviors while maintaining button visuals.
40
+ *
41
+ * @example
42
+ * ```html
43
+ * <!-- Primary filled button -->
44
+ * <moni-button icon="add">Create new</moni-button>
45
+ *
46
+ * <!-- Outlined button -->
47
+ * <moni-button variant="outlined">Cancel</moni-button>
10
48
  *
11
- * **Shape morph on press** (`m3-docs/components/buttons/specs.md` § Shape morph):
12
- * round and square buttons both morph to the same pressed shape, with per-size
13
- * corner radii: XS 8dp, S 8dp, M 12dp, L 16dp, XL 16dp. The per-size rules
14
- * `.button.{xsmall,small,large,xlarge,extra}:active` override the default
15
- * `:active` rule by specificity (0,4,0 vs 0,3,0).
49
+ * <!-- Toggle button (toggles active state on click) -->
50
+ * <moni-button icon="favorite" active>Like</moni-button>
16
51
  *
17
- * **Shape morph on selected** (toggle): when `active` is true, the resting
18
- * shape flips (round ↔ square). See `render()`.
52
+ * <!-- Link button -->
53
+ * <moni-button href="/settings" icon="settings">Settings</moni-button>
54
+ * ```
19
55
  *
20
- * Attributes:
21
- * - variant: filled (default) | tonal | elevated | outlined | text | fill
22
- * - size: xsmall | small | medium (default) | large | xlarge
23
- * (legacy `extra` alias for `xlarge`, deprecated in v0.3.0)
24
- * - shape: round (default) | square | circle | no-round
25
- * | left-round | right-round | top-round | bottom-round
26
- * | left-round-flat | right-round-flat | top-round-flat
27
- * | bottom-round-flat | inner-round
28
- * (the `-flat` and `inner-round` shapes are Moni brand
29
- * extensions; not part of M3 — see WEB_COMPONENT_GUIDELINES.md)
30
- * - disabled: present → native disabled
31
- * - loading: present → shows an indeterminate circular progress
32
- * - active: present → toggle (selection) state; applies shape morph
33
- * (round↔square) and variant-specific color swap
34
- * - icon: Material Symbols name to prepend
35
- * - icon-trailing: Material Symbols name to append
36
- * - type: button (default) | submit | reset
37
- * - href: present → renders as `<a>` instead of `<button>`
38
- * - target: for `<a>` rendering
56
+ * @slot default - The button label text.
57
+ * @slot icon - Optional override for the leading icon.
58
+ * @slot icon-trailing - Optional override for the trailing icon.
39
59
  *
40
- * Slots:
41
- * - default: button label
42
- * - icon: optional override for the leading icon
43
- * - icon-trailing: optional override for the trailing icon
60
+ * @csspart button - The inner `<button>` or `<a>` element.
61
+ * @csspart icon - The leading icon container.
62
+ * @csspart label - The label container.
63
+ * @csspart trailing-icon - The trailing icon container.
44
64
  */
45
65
  @customElement('moni-button')
46
66
  export class MoniButton extends MoniElement {
@@ -1,45 +1,109 @@
1
+ /**
2
+ * @file components/moni-card.ts
3
+ * @package @moni-labs/moni-ui
4
+ * @license MIT
5
+ * @contributors Moni Labs & Contributors
6
+ */
7
+
1
8
  import { html, css } from 'lit';
2
9
  import { customElement, property } from 'lit/decorators.js';
3
10
  import { MoniElement, sharedStyles } from './_base/index.js';
4
11
 
5
12
  /**
6
- * Material 3 Card (`m3-docs/components/cards/specs.md`).
13
+ * Material Design 3 Card component.
14
+ *
15
+ * Cards display content and actions about a single subject. They are
16
+ * container surfaces that group related information together, making it
17
+ * easy for users to scan and interact with collections of related data.
18
+ *
19
+ * **M3 spec reference:** `m3-docs/components/cards/specs.md`
7
20
  *
8
- * Cards display content and actions on a single subject. Three variants:
9
- * - **elevated**: surface-container-low background + elevation 1 shadow.
10
- * Default for collections where the card needs separation from a
11
- * patterned background.
12
- * - **filled**: surface-container-highest background, no shadow.
13
- * Lowest emphasis; use when cards sit directly on the background.
14
- * - **outlined**: surface background + outline-variant 1dp stroke.
15
- * Highest emphasis without shadow; good on solid color backgrounds.
21
+ * **Variants:**
22
+ * - `elevated` (default) — `surface-container-low` background + `--elevate1` shadow.
23
+ * Best for collections where the card needs visual separation from a
24
+ * patterned or colored background. Gains shadow on hover/drag.
25
+ * - `filled` — `surface-container-highest` background, no shadow.
26
+ * Lowest emphasis; use when cards sit directly on the main background surface.
27
+ * - `outlined` — `surface` background + 1dp `outline-variant` stroke.
28
+ * Highest structural emphasis without casting a shadow. Best on solid backgrounds.
16
29
  *
17
- * M3 measurements:
18
- * - Container corner radius: **12dp**.
19
- * - Left/right padding: **16dp**.
20
- * - Padding between cards in a collection: max **8dp**.
21
- * - Headline text alignment: **start**.
30
+ * **M3 measurements:**
31
+ * - Container corner radius: 12dp.
32
+ * - Horizontal content padding: 16dp.
33
+ * - Gap between cards in a collection: max 8dp.
34
+ * - Headline text alignment: start.
22
35
  *
23
- * Slots:
24
- * - media: image or video at the top of the card.
25
- * - default: primary content (headline, subhead, supporting text).
26
- * - headline: shortcut for the H3-equivalent title (semantic).
27
- * - subhead: secondary title slot.
28
- * - supporting: supporting text slot.
29
- * - actions: action buttons row at the bottom of the card.
36
+ * **Interactive cards:**
37
+ * When `clickable=true`, the card renders M3 state layer overlays on hover,
38
+ * focus, and press via the `::before` pseudo-element. The consumer must handle
39
+ * the `click` event to implement navigation or selection logic.
30
40
  *
31
- * Attributes:
32
- * - variant: elevated (default) | filled | outlined
33
- * - clickable: present → apply hover/focus/pressed state layers
34
- * - draggable: present apply dragged state elevation (3)
35
- * - disabled: present reduced opacity + cursor not-allowed
41
+ * @example
42
+ * ```html
43
+ * <moni-card variant="outlined" clickable>
44
+ * <img slot="media" src="photo.jpg" alt="Card image" />
45
+ * <h3 slot="headline">Card Title</h3>
46
+ * <p slot="supporting">Supporting text that describes the card topic.</p>
47
+ * <div slot="actions">
48
+ * <moni-button variant="text">Cancel</moni-button>
49
+ * <moni-button>Confirm</moni-button>
50
+ * </div>
51
+ * </moni-card>
52
+ * ```
53
+ *
54
+ * @slot media - An image, video, or icon at the top of the card.
55
+ * @slot default - Primary body content (replaces all named slots if used).
56
+ * @slot headline - H3-equivalent title text.
57
+ * @slot subhead - Secondary title below the headline.
58
+ * @slot supporting - Descriptive supporting body text.
59
+ * @slot actions - Action buttons row at the bottom of the card.
60
+ *
61
+ * @csspart card - The outer card container.
62
+ * @csspart media - The media area wrapper.
63
+ * @csspart content - The content wrapper.
64
+ * @csspart actions - The actions row wrapper.
36
65
  */
37
66
  @customElement('moni-card')
38
67
  export class MoniCard extends MoniElement {
68
+ /**
69
+ * Visual variant of the card.
70
+ *
71
+ * - `'elevated'` (default) — Surface-low background + elevation shadow.
72
+ * - `'filled'` — Surface-highest background, no shadow.
73
+ * - `'outlined'` — Surface background + outline-variant stroke.
74
+ *
75
+ * @default 'elevated'
76
+ */
39
77
  @property({ reflect: true })
40
78
  variant: 'elevated' | 'filled' | 'outlined' = 'elevated';
79
+
80
+ /**
81
+ * When `true`, applies M3 state layer overlays (hover, focus, pressed)
82
+ * to communicate interactivity. The card background shifts slightly on hover.
83
+ *
84
+ * Use when the card itself is a clickable navigation or selection target.
85
+ *
86
+ * @default false
87
+ */
41
88
  @property({ type: Boolean, reflect: true }) clickable = false;
89
+
90
+ /**
91
+ * When `true`, applies `--elevate3` box-shadow to simulate the M3 "dragged"
92
+ * state as specified in the M3 card interaction spec.
93
+ *
94
+ * Consumers should toggle this attribute based on the drag state of the card
95
+ * (e.g. via a drag-and-drop library callback).
96
+ *
97
+ * @default false
98
+ */
42
99
  @property({ type: Boolean, reflect: true }) draggable = false;
100
+
101
+ /**
102
+ * When `true`, the card renders at 50% opacity with `cursor: not-allowed`,
103
+ * signaling that the card and its actions are unavailable.
104
+ *
105
+ * @default false
106
+ */
43
107
  @property({ type: Boolean, reflect: true }) disabled = false;
44
108
 
45
109
  static override styles = [
@@ -1,34 +1,85 @@
1
+ /**
2
+ * @file components/moni-carousel.ts
3
+ * @package @moni-labs/moni-ui
4
+ * @license MIT
5
+ * @contributors Moni Labs & Contributors
6
+ */
7
+
1
8
  import { html, css } from 'lit';
2
9
  import { customElement, property, query, state, queryAll } from 'lit/decorators.js';
3
10
  import { MoniElement, sharedStyles } from './_base/index.js';
4
11
  import { gsap } from 'gsap';
5
12
 
13
+ /**
14
+ * Data model for a single item in a `<moni-carousel>`.
15
+ */
6
16
  export interface CarouselItem {
17
+ /** Display title overlaid on the item. */
7
18
  title: string;
19
+ /** URL or path to the background image. */
8
20
  img: string;
21
+ /** Optional link target. If provided, the item renders as an `<a>` element. */
9
22
  href?: string;
23
+ /** Link target attribute (e.g. `'_blank'`). Only applies if `href` is set. */
10
24
  target?: string;
11
25
  }
12
26
 
13
27
  /**
14
28
  * Material Design 3 Expressive Carousel component.
15
- * Supports three layouts:
16
- * - `multi-browse`: Shows a collection of items (large, medium, and small items).
17
- * - `hero`: Focuses on one large item with a smaller item peeking.
18
- * - `uncontained`: Standard same-sized layout bleeding off the edges.
19
29
  *
20
- * Attributes:
21
- * - layout: 'multi-browse' | 'hero' | 'uncontained'
22
- * - auto: if true, dynamically calculates items sizes to fit the container without gaps.
23
- * - large-width: width of large items (used in non-auto mode or as a guideline).
24
- * - medium-width: width of medium items (multi-browse layout).
25
- * - small-width: width of small/peeking items.
26
- * - gap: spacing between elements (default 8px).
27
- * - padding: leading/trailing padding (default 16px).
28
- * - border-radius: radius of cards (default 28px).
29
- * - header-text: header title of the carousel.
30
- * - show-all: renders a "Show all" action button/link.
31
- * - show-all-text: customize the text for the "Show all" action.
30
+ * Carousels display a collection of related items in a scrollable, horizontal list.
31
+ * They allow users to quickly browse through items like images, cards, or products.
32
+ *
33
+ * **M3 spec reference:** `m3-docs/components/carousel/specs.md`
34
+ *
35
+ * **Layout variants:**
36
+ * - `multi-browse` (default) Shows a mix of large, medium, and small (peeking)
37
+ * items. Best for exploring a large number of items.
38
+ * - `hero` Focuses on one large primary item while showing a sliver of the
39
+ * next item. Best for featuring important content.
40
+ * - `uncontained` Standard layout where all items have the same width and
41
+ * bleed off the edges of the container.
42
+ *
43
+ * **Animation & Gestures:**
44
+ * This component uses GSAP for smooth drag, flick, and snap animations,
45
+ * mirroring the high-fidelity M3 Expressive motion specs. It handles touch
46
+ * gestures for mobile and mouse-drag for desktop.
47
+ *
48
+ * **Auto-sizing (`auto` mode):**
49
+ * When `auto=true` (default), the carousel measures its own width and
50
+ * dynamically calculates the optimal sizes for large, medium, and small items
51
+ * based on the active `layout` to ensure they fit perfectly without awkward gaps
52
+ * or clipping at the edges.
53
+ *
54
+ * @example
55
+ * ```html
56
+ * <!-- Declarative usage via DOM properties (recommended) -->
57
+ * <moni-carousel layout="hero"></moni-carousel>
58
+ * <script>
59
+ * const carousel = document.querySelector('moni-carousel');
60
+ * carousel.items = [
61
+ * { title: 'Item 1', img: '/img1.jpg', href: '/link1' },
62
+ * { title: 'Item 2', img: '/img2.jpg' }
63
+ * ];
64
+ * </script>
65
+ *
66
+ * <!-- Slot-based usage (for SSR or simple static content) -->
67
+ * <moni-carousel layout="uncontained">
68
+ * <div slot="item">
69
+ * <img src="/img1.jpg" />
70
+ * <h3>Static Item</h3>
71
+ * </div>
72
+ * </moni-carousel>
73
+ * ```
74
+ *
75
+ * @slot item - Alternative to the `items` property. Slot individual HTML elements
76
+ * instead of passing data objects.
77
+ *
78
+ * @csspart carousel - The outer wrapper.
79
+ * @csspart track - The scrolling track element.
80
+ * @csspart item - Individual carousel item containers.
81
+ * @csspart img - The image elements inside the items.
82
+ * @csspart title - The title text elements inside the items.
32
83
  */
33
84
  @customElement('moni-carousel')
34
85
  export class MoniCarousel extends MoniElement {
@@ -1,3 +1,10 @@
1
+ /**
2
+ * @file components/moni-checkbox.ts
3
+ * @package @moni-labs/moni-ui
4
+ * @license MIT
5
+ * @contributors Moni Labs & Contributors
6
+ */
7
+
1
8
  import { html, css } from 'lit';
2
9
  import { customElement, property, query } from 'lit/decorators.js';
3
10
  import { ifDefined } from 'lit/directives/if-defined.js';
@@ -5,35 +12,122 @@ import { live } from 'lit/directives/live.js';
5
12
  import { MoniElement, sharedStyles } from './_base/index.js';
6
13
 
7
14
  /**
8
- * Checkbox that faithfully ports BeerCSS's `.checkbox` styles.
15
+ * Material Design 3 Checkbox component.
16
+ *
17
+ * Checkboxes allow users to select one or more items from a set, or toggle
18
+ * a single binary option. They are visual-only shells — the consumer is
19
+ * responsible for wiring up form submission and validation logic.
20
+ *
21
+ * **Visual architecture (BeerCSS pattern):**
22
+ * The native `<input type="checkbox">` occupies real layout space (16×16 minimum)
23
+ * but is visually hidden via `opacity: 0`. A `<span>` sibling rendered after
24
+ * the input holds two pseudo-elements:
25
+ * - `::before` — the visible checkbox icon (Material Symbols ligature).
26
+ * - `::after` — the hover/focus state layer ripple ring.
27
+ *
28
+ * The `::before` content switches between:
29
+ * - `'check_box_outline_blank'` (unchecked)
30
+ * - `'check_box'` (checked)
31
+ * - `'indeterminate_check_box'` (native indeterminate state)
32
+ *
33
+ * **Form integration:**
34
+ * Setting `name` and `value` passes them to the native `<input>` element,
35
+ * enabling participation in HTML form submissions.
9
36
  *
10
- * BeerCSS architecture:
11
- * - `.checkbox` is inline-flex, aligns items center
12
- * - `input` has width/height = --_size, opacity: 0 (occupies real space, no absolute!)
13
- * - `span::before` is the visible checkbox box (position: absolute, inset from the input)
14
- * - `span::after` is the ripple hover effect
15
- * - Content is set via CSS: "check_box_outline_blank" / "check_box" (Material Symbols font)
37
+ * @fires change - Bubbles and is composed. Fired when the checkbox is toggled.
38
+ * The consumer can read `element.checked` for the new state.
16
39
  *
17
- * Attributes:
18
- * - label: text label
19
- * - checked: present input is checked
20
- * - disabled: present → input is disabled
21
- * - size: small | medium (default) | large | extra
22
- * - name: forwarded to input.name
23
- * - value: forwarded to input.value
40
+ * @example
41
+ * ```html
42
+ * <moni-checkbox label="Accept terms" name="terms" value="yes"></moni-checkbox>
43
+ *
44
+ * <script>
45
+ * document.querySelector('moni-checkbox').addEventListener('change', (e) => {
46
+ * console.log('checked:', e.target.checked);
47
+ * });
48
+ * </script>
49
+ * ```
50
+ *
51
+ * @csspart checkbox - The outer `<label>` element.
24
52
  */
25
53
  @customElement('moni-checkbox')
26
54
  export class MoniCheckbox extends MoniElement {
55
+ /**
56
+ * Text label displayed to the right of the checkbox icon.
57
+ *
58
+ * When non-empty, the label is rendered as a text node inside the `<span>`.
59
+ * When empty, the default slot is rendered instead, allowing slotted HTML.
60
+ *
61
+ * @default ''
62
+ */
27
63
  @property({ reflect: true }) label = '';
64
+
65
+ /**
66
+ * Whether the checkbox is currently checked.
67
+ *
68
+ * Reflected as an attribute so CSS attribute selectors and external state
69
+ * readers can observe the checked state without accessing the JS property.
70
+ * Synced to the native input via `updated()`.
71
+ *
72
+ * @default false
73
+ */
28
74
  @property({ type: Boolean, reflect: true }) checked = false;
75
+
76
+ /**
77
+ * When `true`, the native input is disabled: the checkbox is not interactive
78
+ * and renders at 50% opacity.
79
+ *
80
+ * @default false
81
+ */
29
82
  @property({ type: Boolean, reflect: true }) disabled = false;
83
+
84
+ /**
85
+ * Visual size of the checkbox icon.
86
+ *
87
+ * Maps to the `--_size` custom property which controls both the invisible
88
+ * input's hit area and the visible `::before` icon size.
89
+ *
90
+ * | Value | `--_size` |
91
+ * |------------|-----------|
92
+ * | `'small'` | 1rem |
93
+ * | `'medium'` | 1.5rem |
94
+ * | `'large'` | 2rem |
95
+ * | `'extra'` | 2.5rem |
96
+ *
97
+ * @default 'medium'
98
+ */
30
99
  @property({ reflect: true })
31
100
  size: 'small' | 'medium' | 'large' | 'extra' = 'medium';
101
+
102
+ /**
103
+ * Forwarded to the native `<input name>` attribute.
104
+ * Required for grouping checkboxes within a form.
105
+ *
106
+ * @default ''
107
+ */
32
108
  @property({ reflect: true }) name = '';
109
+
110
+ /**
111
+ * Forwarded to the native `<input value>` attribute.
112
+ * The value submitted in a form when this checkbox is checked.
113
+ *
114
+ * @default ''
115
+ */
33
116
  @property({ reflect: true }) value = '';
34
117
 
118
+ /** Direct reference to the native input element for programmatic access. */
35
119
  @query('input') private _input!: HTMLInputElement;
36
120
 
121
+ /**
122
+ * Syncs `checked` and `disabled` back to the native input element after
123
+ * Lit's render cycle, ensuring the DOM stays in sync with component state.
124
+ *
125
+ * This is necessary because Lit's `.property=${value}` binding updates the
126
+ * DOM property, but the `live()` directive and direct property assignment
127
+ * are more reliable for boolean inputs across browser implementations.
128
+ *
129
+ * @param changed - Map of changed property names to their previous values.
130
+ */
37
131
  override updated(changed: Map<string, unknown>) {
38
132
  if (this._input) {
39
133
  if (changed.has('checked')) this._input.checked = this.checked;
@@ -159,11 +253,28 @@ export class MoniCheckbox extends MoniElement {
159
253
  `
160
254
  ];
161
255
 
256
+ /**
257
+ * Handles the native input's `change` event.
258
+ *
259
+ * Reads the new checked state from the input and re-dispatches a composed
260
+ * `'change'` event so the signal crosses shadow DOM boundaries and can be
261
+ * heard by parent elements in the light DOM.
262
+ *
263
+ * @param e - The native `change` event from the hidden `<input>`.
264
+ */
162
265
  private _onChange(e: Event) {
163
266
  this.checked = (e.target as HTMLInputElement).checked;
164
267
  this.dispatchEvent(new Event('change', { bubbles: true, composed: true }));
165
268
  }
166
269
 
270
+ /**
271
+ * Renders the accessible checkbox label structure.
272
+ *
273
+ * The `<label>` wraps the hidden `<input>` and a `<span>` so that clicking
274
+ * anywhere on the label area (including the text) toggles the checkbox.
275
+ * The `has-label` class on the span adds left padding to separate the icon
276
+ * from the label text.
277
+ */
167
278
  override render() {
168
279
  return html`<label part="checkbox">
169
280
  <input
@@ -1,3 +1,10 @@
1
+ /**
2
+ * @file components/moni-chip.ts
3
+ * @package @moni-labs/moni-ui
4
+ * @license MIT
5
+ * @contributors Moni Labs & Contributors
6
+ */
7
+
1
8
  import { html, css, nothing } from 'lit';
2
9
  import { customElement, property, state } from 'lit/decorators.js';
3
10
  import { MoniElement, sharedStyles } from './_base/index.js';
@@ -5,35 +12,55 @@ import './moni-icon.js';
5
12
  import './moni-progress.js';
6
13
 
7
14
  /**
8
- * Visual-only chip. Renders a native `<button>` styled per Material 3 Expressive.
15
+ * Material Design 3 Chip component.
16
+ *
17
+ * Chips are compact, interactive elements that represent actions, filters,
18
+ * attributes, or user inputs. They are visual-only shells — the consumer
19
+ * owns all state management (selection, removal, active filter state).
20
+ *
21
+ * **M3 spec reference:** `m3-docs/components/chips/specs.md`
22
+ *
23
+ * **Variants:**
24
+ * - `assist` (default) — Smart or suggested actions. Uses `var(--outline)` border
25
+ * to ensure 3:1 contrast per the M3 accessibility spec. Alias: `outlined`.
26
+ * - `filter` — Filters for a content collection. Shows a leading checkmark when
27
+ * `selected`. Alias: `fill`.
28
+ * - `input` — Represents discrete user input (tags, tokens). Adds a trailing
29
+ * remove icon when `removable`.
30
+ * - `suggestion` — Product-generated suggestions. Outlined, no icons.
31
+ *
32
+ * **M3 measurements:**
33
+ * - Default height: 32dp (`small` size = M3 spec baseline).
34
+ * - Corner radius: 8dp.
35
+ * - Icon size: 18dp.
36
+ * - `medium` and `large` sizes are Moni extensions with larger touch targets.
37
+ *
38
+ * **Accessibility:**
39
+ * `assist` and `suggestion` chips use `var(--outline)` for their stroke to
40
+ * guarantee 3:1 contrast against the surface background at rest.
41
+ * `filter` and `input` use `outline-variant` at rest but achieve contrast
42
+ * through the `secondary-container` fill when selected.
43
+ *
44
+ * @fires remove - Bubbles and is composed. Fired when the trailing remove
45
+ * icon is clicked on an `input` chip with `removable`.
46
+ *
47
+ * @example
48
+ * ```html
49
+ * <!-- Filter chip with selected state -->
50
+ * <moni-chip variant="filter" selected>Technology</moni-chip>
9
51
  *
10
- * M3 spec (`m3-docs/components/chips/specs.md`) defines **4 variants**:
11
- * - **assist** — smart/automated actions; outlined; `outline` 1dp stroke.
12
- * - **filter** — filters for a collection; outlined; leading check when selected.
13
- * - **input** — discrete user input; outlined; trailing remove icon.
14
- * - **suggestion** — product-generated suggestions; outlined; no icons.
52
+ * <!-- Input chip (tag/token) -->
53
+ * <moni-chip variant="input" removable icon="label">TypeScript</moni-chip>
15
54
  *
16
- * All variants share M3 measurements: 32dp height, 8dp corner, 18dp icon.
17
- * Container height scales with `size` (`small` = 32dp = M3 default,
18
- * `medium`/`large` are Moni extensions with larger touch targets).
55
+ * <!-- Assist chip with icon -->
56
+ * <moni-chip icon="directions_car">Get directions</moni-chip>
57
+ * ```
19
58
  *
20
- * **A11y** `assist` and `suggestion` use `var(--outline)` for the
21
- * stroke to ensure 3:1 contrast (per `m3-docs/components/chips/accessibility.md`
22
- * § *Showing chip interactivity*). `filter` and `input` use `outline-variant`
23
- * for the resting state but show a clear `secondary-container` background
24
- * when selected, passing contrast.
59
+ * @slot default - The chip label text.
60
+ * @slot icon - Override for the leading icon (alternative to the `icon` attribute).
25
61
  *
26
- * Attributes:
27
- * - variant: assist (default) | filter | input | suggestion
28
- * | outlined (alias for assist) | fill (alias for filter)
29
- * - size: small (default, 32dp = M3) | medium | large
30
- * - shape: round (default) | square | circle | no-round
31
- * | left-round | right-round | top-round | bottom-round
32
- * - selected: present → background uses secondary-container (M3 filter/input)
33
- * - removable: present → adds a trailing ✕ icon (M3 input chip, visual only)
34
- * - disabled: present → native disabled
35
- * - loading: present → shows indeterminate circular progress
36
- * - icon: Material Symbols name (leading icon)
62
+ * @csspart chip - The inner `<button>` element.
63
+ * @csspart label - The label `<span>` element.
37
64
  */
38
65
  @customElement('moni-chip')
39
66
  export class MoniChip extends MoniElement {
@@ -1,3 +1,10 @@
1
+ /**
2
+ * @file components/moni-color-field.ts
3
+ * @package @moni-labs/moni-ui
4
+ * @license MIT
5
+ * @contributors Moni Labs & Contributors
6
+ */
7
+
1
8
  import { html, css, nothing } from 'lit';
2
9
  import { customElement, property, query } from 'lit/decorators.js';
3
10
  import { ifDefined } from 'lit/directives/if-defined.js';
@@ -5,12 +12,44 @@ import { classMap } from 'lit/directives/class-map.js';
5
12
  import { MoniElement, sharedStyles, fieldStyles } from './_base/index.js';
6
13
 
7
14
  /**
8
- * Visual-only color field. Renders a hidden `<input type="color">` plus a
9
- * preview swatch and a read-only text display of the current value.
15
+ * Material Design 3 Color Field component.
16
+ *
17
+ * A specialized text field for color input that combines a native
18
+ * `<input type="color">` with a read-only text display of the selected
19
+ * hex value, wrapped in the standard M3 field shell.
20
+ *
21
+ * **Visual architecture:**
22
+ * Extends the field styling pattern used by `<moni-text-field>`. The
23
+ * leading icon slot is replaced by a circular color swatch (`.swatch`)
24
+ * which is absolutely positioned over an invisible native color input.
25
+ * Clicking the swatch opens the system color picker. The text input portion
26
+ * displays the selected hex code and is strictly `readOnly`.
27
+ *
28
+ * **State syncing:**
29
+ * The component listens to the native `change` event on the color input,
30
+ * updates the `value` property, and re-dispatches a composed `'change'` event.
31
+ * It does not listen to `input` (continuous drag in the color picker) to avoid
32
+ * excessive event firing, but consumers can attach their own `input` listeners
33
+ * directly to the element if live preview is needed.
34
+ *
35
+ * @fires change - Bubbles and is composed. Fired when the color picker closes
36
+ * and the value is committed. Read `element.value`.
37
+ *
38
+ * @example
39
+ * ```html
40
+ * <moni-color-field
41
+ * label="Theme Color"
42
+ * name="primaryColor"
43
+ * value="#6750a4"
44
+ * variant="outlined"
45
+ * ></moni-color-field>
46
+ * ```
10
47
  *
11
- * Attributes:
12
- * - name, label, value, variant, size, shape, disabled, helper, error,
13
- * error-text, placeholder see moni-text-field.
48
+ * @csspart field - The outer `.field` div container.
49
+ * @csspart swatch - The circular color preview element.
50
+ * @csspart input-color - The native, visually hidden `<input type="color">`.
51
+ * @csspart input-text - The native `<input type="text">` displaying the hex code.
52
+ * @csspart label - The floating `<label>` element.
14
53
  */
15
54
  @customElement('moni-color-field')
16
55
  export class MoniColorField extends MoniElement {