@moni-labs/moni-ui 0.2.0 → 0.3.1

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 +1709 -338
  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 +80 -17
  49. package/dist/components/moni-carousel.d.ts.map +1 -1
  50. package/dist/components/moni-carousel.js +258 -34
  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 +282 -34
  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,37 +1,111 @@
1
+ /**
2
+ * @file components/moni-snackbar.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
  import './moni-icon.js';
5
12
 
6
13
  /**
7
- * Snackbar that faithfully ports BeerCSS's `.snackbar` styles.
14
+ * Material Design 3 Snackbar component.
15
+ *
16
+ * Snackbars provide brief messages about app processes at the bottom of the
17
+ * screen. They disappear automatically and do not require user action,
18
+ * but may contain a single optional action.
19
+ *
20
+ * **M3 spec reference:** `m3-docs/components/snackbar/specs.md`
21
+ *
22
+ * **Positioning model:**
23
+ * The snackbar uses `position: fixed` so it renders in the viewport
24
+ * regardless of which element it is placed in the DOM. The host element
25
+ * displays as `block` rather than `contents` to ensure `position: fixed`
26
+ * inside the shadow root anchors to the viewport (not to a stacking context
27
+ * created by a transformed ancestor).
8
28
  *
9
- * BeerCSS uses `.snackbar` with `position: fixed; inset: auto auto 6rem 50%;`
10
- * and `.snackbar.active` / `.snackbar:popover-open` to show it.
29
+ * **Show/hide mechanism:**
30
+ * Visibility is controlled by `:host([active]) .snackbar` via CSS
31
+ * `opacity`, `visibility`, and `transform`. This mirrors BeerCSS's
32
+ * `.snackbar.active` pattern and allows CSS transition animations.
11
33
  *
12
- * We use :host([active]) .snackbar with visibility/opacity/transform — same as BeerCSS.
13
- * The host is display:block so the fixed snackbar inside is part of the stacking context
14
- * of the document body (not clipped by any shadow root overflow).
34
+ * **M3 text truncation:**
35
+ * The message text is clamped to `maxLines` lines with `-webkit-line-clamp`.
36
+ * The M3 spec requires a maximum of 2 lines; consumers can override this
37
+ * via the `max-lines` attribute.
15
38
  *
16
- * Material 3 spec (`m3-docs/components/snackbar/specs.md`): the message text
17
- * must truncate at **2 lines** with ellipsis when too long. The container
18
- * width adapts to the screen size (full width on compact, 40% on expanded).
39
+ * @example
40
+ * ```ts
41
+ * const snackbar = document.querySelector('moni-snackbar') as MoniSnackbar;
19
42
  *
20
- * Attributes:
21
- * - text: message
22
- * - action: action label (visual only)
23
- * - placement: bottom (default) | top
24
- * - active: present visible
25
- * - max-lines: 2 (default) | number — clamp text to N lines with ellipsis
43
+ * // Show for 3 seconds
44
+ * snackbar.text = 'Item deleted';
45
+ * snackbar.action = 'Undo';
46
+ * snackbar.active = true;
47
+ * setTimeout(() => { snackbar.active = false; }, 3000);
48
+ * ```
49
+ *
50
+ * @slot default - Additional content placed inside the snackbar container.
51
+ *
52
+ * @csspart snackbar - The inner snackbar container element.
53
+ * @csspart text - The message text element.
54
+ * @csspart action - The action button element.
26
55
  */
27
56
  @customElement('moni-snackbar')
28
57
  export class MoniSnackbar extends MoniElement {
58
+ /**
59
+ * The main message text displayed in the snackbar.
60
+ *
61
+ * Clamped to `maxLines` lines. Long messages are truncated with `…`.
62
+ * Per M3 spec, keep messages short and informative (under 60 characters).
63
+ *
64
+ * @default ''
65
+ */
29
66
  @property({ reflect: true }) text = '';
67
+
68
+ /**
69
+ * Label for the optional action button.
70
+ *
71
+ * When non-empty, renders a text button on the trailing edge of the snackbar.
72
+ * The component dispatches a `'action'` event when the action is clicked.
73
+ * This is a visual-only label — the consumer handles the action logic.
74
+ *
75
+ * @default ''
76
+ */
30
77
  @property({ reflect: true }) action = '';
78
+
79
+ /**
80
+ * Vertical placement of the snackbar on the screen.
81
+ *
82
+ * - `'bottom'` (default) — Fixed 6rem from the bottom, centered horizontally.
83
+ * - `'top'` — Fixed 6rem from the top, centered horizontally.
84
+ *
85
+ * @default 'bottom'
86
+ */
31
87
  @property({ reflect: true })
32
88
  placement: 'bottom' | 'top' = 'bottom';
89
+
90
+ /**
91
+ * When `true`, the snackbar is visible.
92
+ *
93
+ * Toggle this attribute to show/hide the snackbar. The CSS transition
94
+ * handles the fade-in/slide-up animation automatically.
95
+ * Consumers are responsible for implementing the auto-dismiss timer.
96
+ *
97
+ * @default false
98
+ */
33
99
  @property({ type: Boolean, reflect: true }) active = false;
34
- /** M3 spec: clamp the message text to N lines (default 2). */
100
+
101
+ /**
102
+ * Maximum number of lines of message text before it is clamped.
103
+ *
104
+ * Uses `-webkit-line-clamp` with `display: -webkit-box` for cross-browser
105
+ * multi-line truncation. The M3 spec recommends a maximum of 2 lines.
106
+ *
107
+ * @default 2
108
+ */
35
109
  @property({ type: Number, reflect: true, attribute: 'max-lines' })
36
110
  maxLines = 2;
37
111
 
@@ -1,18 +1,48 @@
1
+ /**
2
+ * @file components/moni-split-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, queryAssignedElements } from 'lit/decorators.js';
3
10
  import { MoniElement, sharedStyles } from './_base/index.js';
4
11
 
5
12
  /**
6
- * Visual-only split button. Combines a primary action button and a dropdown menu trigger.
13
+ * Material Design 3 Split Button component.
14
+ *
15
+ * A split button combines a primary action button with a secondary dropdown
16
+ * button. The two buttons sit flush against each other, typically sharing
17
+ * a background color and elevation, but separated by a distinct border.
18
+ *
19
+ * **Visual architecture:**
20
+ * The component acts as a layout container (`display: inline-flex`) that
21
+ * groups two standard buttons. It overrides the margins of the trailing
22
+ * button to create the "connected" look (similar to connected button groups).
23
+ *
24
+ * **Usage:**
25
+ * Consumers must provide exactly two buttons via the named slots:
26
+ * - `slot="leading-button"` — The primary action (usually text or text+icon).
27
+ * - `slot="trailing-button"` — The secondary action (usually just a dropdown icon).
28
+ *
29
+ * Both buttons should be standard `<moni-button>` or `<moni-icon-button>`
30
+ * elements configured with matching variants for a cohesive appearance.
31
+ *
32
+ * @example
33
+ * ```html
34
+ * <moni-split-button variant="filled">
35
+ * <moni-button slot="leading-button" icon="send">Send</moni-button>
36
+ * <moni-button slot="trailing-button" icon="arrow_drop_down" id="schedule-trigger"></moni-button>
37
+ * </moni-split-button>
7
38
  *
8
- * Attributes:
9
- * - variant: filled (default) | tonal | outlined | elevated
10
- * - size: small | medium (default) | large | extra
11
- * - gap: custom gap space (e.g. "8px" or "1rem")
39
+ * <moni-menu id="schedule-menu" placement="bottom">
40
+ * <moni-menu-item>Schedule send...</moni-menu-item>
41
+ * </moni-menu>
42
+ * ```
12
43
  *
13
- * Slots:
14
- * - leading-button: The main action button
15
- * - trailing-button: The menu dropdown button
44
+ * @slot leading-button - The primary action button on the left.
45
+ * @slot trailing-button - The secondary action (dropdown trigger) on the right.
16
46
  */
17
47
  @customElement('moni-split-button')
18
48
  export class MoniSplitButton extends MoniElement {
@@ -1,18 +1,52 @@
1
+ /**
2
+ * @file components/moni-step.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
  import './moni-icon.js';
5
12
 
6
13
  /**
7
- * Visual-only step. Renders an icon/number, a title, and a description.
14
+ * Material Design 3 Step component.
15
+ *
16
+ * An individual step within a `<moni-stepper>`. Steps display progress through
17
+ * a sequence of logical and numbered operations.
18
+ *
19
+ * **M3 spec reference:** `m3-docs/components/progress-indicators/specs.md` (Stepper pattern)
20
+ *
21
+ * **Anatomy & Visuals:**
22
+ * A step renders a circular indicator containing either its sequence number
23
+ * (automatically injected by the parent stepper) or a custom icon. Below or
24
+ * beside the indicator (depending on the parent's `orientation`), it renders
25
+ * the `title` and an optional `description`.
26
+ *
27
+ * **State management:**
28
+ * The parent `<moni-stepper>` automatically calculates and injects the `index`,
29
+ * `active`, and `completed` properties based on its current state.
30
+ * - **Active:** Highlighted with the primary color, indicating the current step.
31
+ * - **Completed:** Displayed with a solid primary background and a checkmark
32
+ * icon (`completed` state overrides the numeric index).
33
+ *
34
+ * @example
35
+ * ```html
36
+ * <!-- Typically used inside a stepper -->
37
+ * <moni-stepper current="1">
38
+ * <moni-step title="Shipping" description="Enter address"></moni-step>
39
+ * <moni-step title="Payment" description="Credit card details"></moni-step>
40
+ * <moni-step title="Review" description="Confirm order"></moni-step>
41
+ * </moni-stepper>
42
+ *
43
+ * <!-- Overriding the icon -->
44
+ * <moni-step title="Done" icon="celebration"></moni-step>
45
+ * ```
8
46
  *
9
- * Attributes:
10
- * - title: step heading
11
- * - description: step secondary text
12
- * - active: present → primary color highlight
13
- * - completed: present → filled circle with check
14
- * - icon: Material Symbols name (overrides the number)
15
- * - index: numeric label (auto-set by parent stepper, optional)
47
+ * @csspart step-indicator - The circular badge containing the number/icon.
48
+ * @csspart title - The main title text.
49
+ * @csspart description - The secondary description text.
16
50
  */
17
51
  @customElement('moni-step')
18
52
  export class MoniStep extends MoniElement {
@@ -1,15 +1,53 @@
1
+ /**
2
+ * @file components/moni-stepper.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, queryAssignedElements } from 'lit/decorators.js';
3
10
  import { MoniElement, sharedStyles } from './_base/index.js';
4
11
  import type { MoniStep } from './moni-step.js';
5
12
 
6
13
  /**
7
- * Visual-only stepper. Wraps a list of <moni-step> children, propagates the
8
- * `current` index to each child, and styles the connectors between them.
14
+ * Material Design 3 Stepper component.
15
+ *
16
+ * A container for a linear progression of `<moni-step>` elements. Steppers
17
+ * convey progress through numbered steps and indicate the user's current
18
+ * position within a flow.
19
+ *
20
+ * **M3 spec reference:** `m3-docs/components/progress-indicators/specs.md`
21
+ *
22
+ * **Orchestration:**
23
+ * This component acts as the orchestrator for its slotted `<moni-step>` children.
24
+ * Whenever the `current` property changes, or children are added/removed, the
25
+ * stepper iterates over all child steps and injects their state:
26
+ * - Assigns the sequential `index` (0-based) to each step.
27
+ * - Sets `active=true` on the step matching the `current` index.
28
+ * - Sets `completed=true` on all steps prior to the `current` index.
29
+ *
30
+ * **Visual layout:**
31
+ * The stepper manages the layout (flex row or column based on `orientation`)
32
+ * and ensures the connector lines between steps are rendered correctly via
33
+ * CSS pseudo-elements defined in the child `<moni-step>` styling.
34
+ *
35
+ * @example
36
+ * ```html
37
+ * <moni-stepper current="1" orientation="horizontal">
38
+ * <moni-step title="Step 1"></moni-step>
39
+ * <moni-step title="Step 2"></moni-step>
40
+ * <moni-step title="Step 3"></moni-step>
41
+ * </moni-stepper>
42
+ *
43
+ * <script>
44
+ * const stepper = document.querySelector('moni-stepper');
45
+ * // Move to next step
46
+ * stepper.current = 2;
47
+ * </script>
48
+ * ```
9
49
  *
10
- * Attributes:
11
- * - orientation: horizontal (default) | vertical
12
- * - current: zero-based index of the active step
50
+ * @slot default - `<moni-step>` elements.
13
51
  */
14
52
  @customElement('moni-stepper')
15
53
  export class MoniStepper extends MoniElement {
@@ -1,3 +1,10 @@
1
+ /**
2
+ * @file components/moni-switch.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,33 +12,111 @@ import { MoniElement, sharedStyles } from './_base/index.js';
5
12
  import './moni-icon.js';
6
13
 
7
14
  /**
8
- * Switch styled per Material Design 3 specs.
15
+ * Material Design 3 Switch component.
16
+ *
17
+ * Switches toggle the state of a single setting on or off. They are the
18
+ * binary on/off equivalent of a checkbox, but optimized for toggling a
19
+ * single state rather than selecting from a list.
20
+ *
21
+ * **M3 spec reference:** `m3-docs/components/switch/specs.md`
22
+ *
23
+ * **M3 measurements:**
24
+ * - Track: 52dp × 32dp, 2dp border, full-radius pill shape.
25
+ * - Handle (thumb): 16dp unselected → 24dp selected → 28dp pressed.
26
+ * - State layer: 40dp circular ripple on hover/focus/pressed states.
27
+ * - Icon (optional): 16dp icon rendered inside the thumb when `icon` is set.
28
+ *
29
+ * **Visual architecture:**
30
+ * Like `<moni-checkbox>`, the native `<input type="checkbox" role="switch">`
31
+ * occupies real layout space but is visually hidden via `opacity: 0`. Two
32
+ * `<span>` pseudo-elements render the track (`::after`) and thumb (`::before`).
33
+ * When `icon=true`, `<i>` elements render `close` and `check` glyphs inside
34
+ * the thumb, with visibility toggled via CSS based on the checked state.
9
35
  *
10
- * M3 measurements (`m3-docs/components/switch/specs.md`):
11
- * - Track: 52dp × 32dp, 2dp outline, full corner radius
12
- * - Handle (thumb): 16dp unselected, 24dp selected, 28dp pressed
13
- * - State layer: 40dp circular ripple on hover/focus/pressed
14
- * - Icon (optional): 16dp on selected and/or unselected handle
36
+ * @fires change - Bubbles and is composed. Fired when the switch is toggled.
37
+ * Read `element.checked` for the new state.
15
38
  *
16
- * Attributes:
17
- * - label: text label (displayed to the right of the switch)
18
- * - checked: present
19
- * - disabled: present
20
- * - icon: present → renders check/close icons inside the thumb
21
- * - name: forwarded to input.name
22
- * - value: forwarded to input.value
39
+ * @example
40
+ * ```html
41
+ * <moni-switch label="Dark mode" name="dark-mode"></moni-switch>
42
+ * <moni-switch icon checked label="Notifications"></moni-switch>
43
+ *
44
+ * <script>
45
+ * document.querySelector('moni-switch').addEventListener('change', (e) => {
46
+ * console.log('enabled:', e.target.checked);
47
+ * });
48
+ * </script>
49
+ * ```
50
+ *
51
+ * @csspart switch - The outer `<label>` element containing the switch.
23
52
  */
24
53
  @customElement('moni-switch')
25
54
  export class MoniSwitch extends MoniElement {
55
+ /**
56
+ * Text label displayed to the right of the switch.
57
+ *
58
+ * When non-empty, renders as a padded text span after the track.
59
+ * When empty, the default slot is rendered, allowing custom HTML labels.
60
+ *
61
+ * @default ''
62
+ */
26
63
  @property({ reflect: true }) label = '';
64
+
65
+ /**
66
+ * Whether the switch is in the "on" (checked) state.
67
+ *
68
+ * When `true`:
69
+ * - Track fills with `--primary` color.
70
+ * - Thumb grows from 16dp to 24dp and slides to the trailing edge.
71
+ * - Thumb color changes to `--on-primary`.
72
+ *
73
+ * @default false
74
+ */
27
75
  @property({ type: Boolean, reflect: true }) checked = false;
76
+
77
+ /**
78
+ * When `true`, the switch is non-interactive and renders at 50% opacity.
79
+ *
80
+ * @default false
81
+ */
28
82
  @property({ type: Boolean, reflect: true }) disabled = false;
83
+
84
+ /**
85
+ * When `true`, renders icon glyphs inside the thumb.
86
+ *
87
+ * Uses Material Symbols ligatures:
88
+ * - Unchecked state: `close` icon.
89
+ * - Checked state: `check` icon.
90
+ *
91
+ * The icon size (16dp) is set via the `--_thumb` CSS custom property.
92
+ *
93
+ * @default false
94
+ */
29
95
  @property({ type: Boolean, reflect: true }) icon = false;
96
+
97
+ /**
98
+ * Forwarded to the native `<input name>` attribute for form participation.
99
+ *
100
+ * @default ''
101
+ */
30
102
  @property({ reflect: true }) name = '';
103
+
104
+ /**
105
+ * Forwarded to the native `<input value>` attribute.
106
+ * The value submitted in a form when this switch is checked.
107
+ *
108
+ * @default ''
109
+ */
31
110
  @property({ reflect: true }) value = '';
32
111
 
112
+ /** Direct reference to the native input element for programmatic access. */
33
113
  @query('input') private _input!: HTMLInputElement;
34
114
 
115
+ /**
116
+ * Syncs `checked` and `disabled` imperatively to the native input after render.
117
+ *
118
+ * @param changed - Map of changed property names to their previous values.
119
+ */
35
120
  override updated(changed: Map<string, unknown>) {
36
121
  if (this._input) {
37
122
  if (changed.has('checked')) this._input.checked = this.checked;
@@ -39,6 +124,14 @@ export class MoniSwitch extends MoniElement {
39
124
  }
40
125
  }
41
126
 
127
+ /**
128
+ * Handles the native input `change` event.
129
+ *
130
+ * Updates `this.checked` and re-dispatches a composed `'change'` event
131
+ * so it bubbles across shadow DOM boundaries.
132
+ *
133
+ * @param e - The native `change` event from the hidden `<input>`.
134
+ */
42
135
  private _onChange(e: Event) {
43
136
  this.checked = (e.target as HTMLInputElement).checked;
44
137
  this.dispatchEvent(new Event('change', { bubbles: true, composed: true }));
@@ -1,17 +1,45 @@
1
+ /**
2
+ * @file components/moni-tab.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
  import './moni-icon.js';
5
12
 
6
13
  /**
7
- * Visual-only tab. Renders an `<a>` styled with the BeerCSS `.tabs > a`
8
- * helper.
14
+ * Material Design 3 Tab component.
15
+ *
16
+ * An individual interactive tab element designed to be placed inside a
17
+ * `<moni-tabs>` container. Tabs organize content across different screens,
18
+ * data sets, and other interactions.
19
+ *
20
+ * **M3 spec reference:** `m3-docs/components/tabs/specs.md`
21
+ *
22
+ * **Visual layout & interaction:**
23
+ * Internally renders as an `<a>` element to support native link behavior when
24
+ * an `href` is provided, but behaves visually as a tab button. It displays a
25
+ * text label and an optional Material icon. If the parent `<moni-tabs>` has the
26
+ * `vertical` attribute set, the layout automatically adjusts to stack the icon
27
+ * above the text.
28
+ *
29
+ * **State:**
30
+ * The `active` attribute highlights the tab, applying the primary color to the
31
+ * text and rendering the active indicator line (handled via CSS in the parent
32
+ * container or pseudo-elements).
33
+ *
34
+ * @example
35
+ * ```html
36
+ * <moni-tabs>
37
+ * <moni-tab active icon="home" label="Home"></moni-tab>
38
+ * <moni-tab icon="settings" label="Settings" href="/settings"></moni-tab>
39
+ * </moni-tabs>
40
+ * ```
9
41
  *
10
- * Attributes:
11
- * - active: present → active style
12
- * - icon: Material Symbols name
13
- * - label: tab text
14
- * - href: link target
42
+ * @csspart tab - The inner `<a>` element acting as the tab button.
15
43
  */
16
44
  @customElement('moni-tab')
17
45
  export class MoniTab extends MoniElement {
@@ -1,20 +1,59 @@
1
+ /**
2
+ * @file components/moni-tabs.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
- * Visual-only tab bar. Renders a `<nav>` styled with the BeerCSS `.tabs`
7
- * helper.
13
+ * Material Design 3 Tabs container component.
14
+ *
15
+ * A navigational container that groups multiple `<moni-tab>` elements. Tabs
16
+ * organize content into high-level categories and allow the user to switch
17
+ * between them.
18
+ *
19
+ * **M3 spec reference:** `m3-docs/components/tabs/specs.md`
20
+ *
21
+ * **Modes (Primary vs Secondary):**
22
+ * - `primary` (default): Used for top-level navigation at the highest hierarchy,
23
+ * often placed directly below a top app bar. They span the full width and
24
+ * feature a prominent active indicator.
25
+ * - `secondary`: Used for deeper content hierarchies within a specific area
26
+ * or page. They are typically more subtle.
27
+ *
28
+ * **Layout & Alignment:**
29
+ * - `scrollable`: If the number of tabs exceeds the container width, this
30
+ * enables horizontal scrolling (`overflow-x: auto`) rather than squishing.
31
+ * - `align`: Controls how the tabs are distributed (`default` space-around,
32
+ * `left`, `center`, or `right`).
33
+ * - `vertical`: Stacks the icon above the text label inside the child tabs.
34
+ *
35
+ * **Active Indicator:**
36
+ * The `indicator-size` attribute allows customizing the width of the active
37
+ * underline indicator (`default` fits the tab content, `min` is narrow, `max`
38
+ * fills the full tab width).
39
+ *
40
+ * @example
41
+ * ```html
42
+ * <!-- Primary, scrollable tabs -->
43
+ * <moni-tabs scrollable>
44
+ * <moni-tab active label="Flights"></moni-tab>
45
+ * <moni-tab label="Trips"></moni-tab>
46
+ * <moni-tab label="Explore"></moni-tab>
47
+ * </moni-tabs>
8
48
  *
9
- * Attributes:
10
- * - mode: primary (default) | secondary
11
- * - scrollable: present → overflow-x: auto
12
- * - align: default (space-around) | left | center | right
13
- * - indicator: default (full) | min | max
14
- * - vertical: present → icon above label
49
+ * <!-- Secondary, centered tabs with vertical layout -->
50
+ * <moni-tabs mode="secondary" align="center" vertical>
51
+ * <moni-tab active icon="video_camera_front" label="Video"></moni-tab>
52
+ * <moni-tab icon="photo_camera" label="Photo"></moni-tab>
53
+ * </moni-tabs>
54
+ * ```
15
55
  *
16
- * Slots:
17
- * - default: <moni-tab> children
56
+ * @slot default - `<moni-tab>` child elements.
18
57
  */
19
58
  @customElement('moni-tabs')
20
59
  export class MoniTabs extends MoniElement {
@@ -1,3 +1,10 @@
1
+ /**
2
+ * @file components/moni-text-field.ts
3
+ * @package @moni-labs/moni-ui
4
+ * @license MIT
5
+ * @contributors Moni Labs & Contributors
6
+ */
7
+
1
8
  import { html, nothing } from 'lit';
2
9
  import { customElement, property, query } from 'lit/decorators.js';
3
10
  import { ifDefined } from 'lit/directives/if-defined.js';
@@ -7,17 +14,56 @@ import './moni-icon.js';
7
14
  import './moni-progress.js';
8
15
 
9
16
  /**
10
- * Visual-only text field. Renders the `.field` family of BeerCSS helpers
11
- * with a native `<input>`.
17
+ * Material Design 3 Text Field component.
18
+ *
19
+ * A full-featured input field that wraps a native `<input>` inside the M3
20
+ * field shell (`.field` class from `fieldStyles`). Supports floating labels,
21
+ * filled and outlined variants, leading/trailing icons, helper text, and
22
+ * error states.
23
+ *
24
+ * **M3 spec reference:** `m3-docs/components/text-fields/specs.md`
25
+ *
26
+ * **Visual architecture:**
27
+ * Uses `fieldStyles` for the complete CSS field shell. The field container
28
+ * is a `<div class="field [modifiers]">` wrapping:
29
+ * 1. Optional leading icon.
30
+ * 2. Native `<input>` element.
31
+ * 3. Floating `<label>` (when `label` is set).
32
+ * 4. Optional trailing icon or loading spinner.
33
+ * 5. `<output>` for helper/error text.
34
+ *
35
+ * **Visual-only contract:**
36
+ * This component does **not** listen to `@input` events to sync the `value`
37
+ * attribute back from the underlying `<input>`. Consumers must either:
38
+ * - Submit the native form (the `<input name>` participates in form submission).
39
+ * - Listen to `change` or `input` events via standard DOM event handling.
40
+ * - Use a framework binding (e.g. `bind:value` in Svelte, `v-model` in Vue).
41
+ *
42
+ * @example
43
+ * ```html
44
+ * <moni-text-field
45
+ * label="Email address"
46
+ * type="email"
47
+ * name="email"
48
+ * icon="mail"
49
+ * variant="outlined"
50
+ * helper="We'll never share your email."
51
+ * ></moni-text-field>
12
52
  *
13
- * This component is **visual-only**: it does NOT listen to `@input` to
14
- * sync the `value` attribute back from the underlying input. Consumers
15
- * either use form submission or wire their own change handling.
53
+ * <moni-text-field
54
+ * label="Amount"
55
+ * type="number"
56
+ * prefix="$"
57
+ * error
58
+ * error-text="Value must be positive"
59
+ * ></moni-text-field>
60
+ * ```
16
61
  *
17
- * Attributes:
18
- * - name, label, value, variant, size, shape, type, icon, trailing-icon,
19
- * prefix, suffix, helper, error, error-text, disabled, placeholder see below.
20
- * - loading: present shows indeterminate circular progress
62
+ * @csspart field - The outer `.field` div container.
63
+ * @csspart input - The native `<input>` element.
64
+ * @csspart label - The floating `<label>` element.
65
+ * @csspart helper - The helper `<output>` element.
66
+ * @csspart error-output - The error `<output>` element.
21
67
  */
22
68
  @customElement('moni-text-field')
23
69
  export class MoniTextField extends MoniElement {