@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,32 +1,140 @@
1
+ /**
2
+ * @file components/moni-badge.ts
3
+ * @package @moni-labs/moni-ui
4
+ * @license MIT
5
+ * @contributors Moni Labs & Contributors
6
+ */
1
7
  import { MoniElement } from './_base/index.js';
2
8
  /**
3
- * Badge that faithfully ports BeerCSS's `.badge` styles.
9
+ * Material Design 3 Badge component.
10
+ *
11
+ * Badges are small status descriptors anchored to a parent element, used to
12
+ * convey supplementary information such as a notification count, online
13
+ * status, or selection indicator.
14
+ *
15
+ * **Positioning contract:**
16
+ * The badge uses `position: absolute` and anchors to the parent element.
17
+ * On `connectedCallback`, if the parent's computed `position` is `'static'`,
18
+ * the badge automatically sets `parent.style.position = 'relative'`.
19
+ * Consumers do not need to manually add `position: relative` to the parent.
20
+ *
21
+ * **Rendering model:**
22
+ * The `:host` displays as `contents`, making it transparent to layout.
23
+ * Only the inner `.badge` span is visually rendered. This allows the badge
24
+ * to be dropped inside any element without affecting its layout flow.
4
25
  *
5
- * BeerCSS `.badge` uses:
6
- * - `position: absolute; inset: 50% auto auto 50%; transform: translate(var(--_x), var(--_y))`
7
- * - Default: --_x: 0, --_y: -100% top-right corner
26
+ * @example
27
+ * ```html
28
+ * <!-- Notification badge on a button -->
29
+ * <div style="position: relative; display: inline-flex;">
30
+ * <moni-button icon="notifications" variant="text"></moni-button>
31
+ * <moni-badge value="5"></moni-badge>
32
+ * </div>
33
+ * ```
8
34
  *
9
- * The parent element MUST have `position: relative` for the badge to anchor correctly.
10
- * We ensure this in connectedCallback.
35
+ * @example
36
+ * ```html
37
+ * <!-- Inline dot badge for status -->
38
+ * <moni-badge shape="min" color="primary" inline></moni-badge>
39
+ * Online
40
+ * ```
11
41
  *
12
- * Attributes:
13
- * - value: text content (also accepts slotted content)
14
- * - position: '' (top-right default) | top | bottom | left | right | none
15
- * - shape: '' (round) | circle | square | min
16
- * - color: error (default) | primary | secondary | tertiary
17
- * - border: present → outlined badge (BeerCSS .badge.border)
18
- * - inline: present → badge becomes inline (BeerCSS .badge.none)
42
+ * @csspart badge - The badge `<span>` element. Override `background-color`,
43
+ * `color`, or `border-radius` to customize appearance.
19
44
  */
20
45
  export declare class MoniBadge extends MoniElement {
46
+ /**
47
+ * Text content of the badge label.
48
+ *
49
+ * Also accepts slotted content — the default slot inside the badge span
50
+ * falls back to this value when no children are slotted.
51
+ * Use an empty string with `shape="min"` to render a dot-only badge.
52
+ *
53
+ * @default ''
54
+ */
21
55
  value: string;
56
+ /**
57
+ * Anchor position relative to the parent element's edges.
58
+ *
59
+ * Uses `inset: 50% auto auto 50%` as the base and adjusts translation:
60
+ * - `''` (default) — top-right corner (translate: 0, -100%).
61
+ * - `'top'` — same as default, explicit alias.
62
+ * - `'bottom'` — bottom-right corner (translate: 0, 0).
63
+ * - `'left'` — top-left corner (translate: -100%, -100%).
64
+ * - `'right'` — top-right corner (translate: 0, -100%).
65
+ * - `'none'` — disables absolute positioning; see also the `inline` attribute.
66
+ *
67
+ * @default ''
68
+ */
22
69
  position: 'top' | 'bottom' | 'left' | 'right' | 'none' | '';
70
+ /**
71
+ * Shape of the badge container.
72
+ *
73
+ * - `''` (default) — Rounded pill shape (border-radius: 1rem).
74
+ * - `'circle'` — Alias for pill; the badge is always circular when the
75
+ * content is a single character or absent.
76
+ * - `'square'` — No border-radius (angular badge).
77
+ * - `'min'` — Dot only; content is hidden via `display: none` and the
78
+ * shape is clipped to a small circle via `clip-path`.
79
+ *
80
+ * @default ''
81
+ */
23
82
  shape: 'circle' | 'square' | 'min' | '';
83
+ /**
84
+ * Semantic color role of the badge.
85
+ *
86
+ * Maps to the M3 color palette roles:
87
+ * - `'error'` (default) — Red; standard for notification counts and alerts.
88
+ * - `'primary'` — Brand primary color; for selection or active states.
89
+ * - `'secondary'` — Secondary accent; for supplementary indicators.
90
+ * - `'tertiary'` — Tertiary accent; for decorative or informational badges.
91
+ *
92
+ * @default 'error'
93
+ */
24
94
  color: 'primary' | 'secondary' | 'tertiary' | 'error';
95
+ /**
96
+ * When `true`, the badge renders inline (resets `position: absolute` to
97
+ * `position: relative`) rather than anchoring to the parent.
98
+ *
99
+ * Equivalent to BeerCSS's `.badge.none` class. Use for inline status
100
+ * indicators that flow within text or flex containers.
101
+ *
102
+ * @default false
103
+ */
25
104
  inline: boolean;
105
+ /**
106
+ * When present, renders the badge with an outlined style:
107
+ * - Background becomes `--surface` (same as the page background).
108
+ * - Border and text color use the palette color token (e.g. `--error`).
109
+ *
110
+ * Equivalent to BeerCSS's `.badge.border` class.
111
+ *
112
+ * @default false
113
+ */
26
114
  border: boolean;
115
+ /**
116
+ * Ensures the parent element can contain the absolutely-positioned badge.
117
+ *
118
+ * Reads the parent's computed `position` via `getComputedStyle`. If it is
119
+ * `'static'` (the browser default), sets `parent.style.position = 'relative'`
120
+ * so the badge anchors correctly. This is a convenience that avoids requiring
121
+ * consumers to remember to add `position: relative` to the parent themselves.
122
+ */
27
123
  connectedCallback(): void;
28
124
  static styles: import("lit").CSSResult[];
29
- render(): import("lit-html").TemplateResult<1>;
125
+ /**
126
+ * Renders the badge span with the computed class list.
127
+ *
128
+ * Class composition:
129
+ * - `'badge'` — always present (base styles).
130
+ * - `this.position` — position variant class (e.g. `'bottom'`, `'left'`).
131
+ * - `this.shape` — shape variant class (e.g. `'min'`, `'square'`).
132
+ * - `'none'` — added when `inline=true` to reset absolute positioning.
133
+ *
134
+ * Falsy values are filtered out so no extra spaces appear in the class string.
135
+ * The default slot falls back to the `value` attribute text node.
136
+ */
137
+ render(): import("lit").TemplateResult<1>;
30
138
  }
31
139
  declare global {
32
140
  interface HTMLElementTagNameMap {
@@ -1 +1 @@
1
- {"version":3,"file":"moni-badge.d.ts","sourceRoot":"","sources":["../../src/components/moni-badge.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAgB,MAAM,kBAAkB,CAAC;AAE7D;;;;;;;;;;;;;;;;;GAiBG;AACH,qBACa,SAAU,SAAQ,WAAW;IACZ,KAAK,SAAM;IAExC,QAAQ,EAAE,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,EAAE,CAAM;IAEjE,KAAK,EAAE,QAAQ,GAAG,QAAQ,GAAG,KAAK,GAAG,EAAE,CAAM;IAE7C,KAAK,EAAE,SAAS,GAAG,WAAW,GAAG,UAAU,GAAG,OAAO,CAAW;IACpB,MAAM,UAAS;IACf,MAAM,UAAS;IAElD,iBAAiB;IAY1B,OAAgB,MAAM,4BAqEpB;IAEO,MAAM;CAYf;AAED,OAAO,CAAC,MAAM,CAAC;IACd,UAAU,qBAAqB;QAC9B,YAAY,EAAE,SAAS,CAAC;KACxB;CACD;AAED,eAAe,SAAS,CAAC"}
1
+ {"version":3,"file":"moni-badge.d.ts","sourceRoot":"","sources":["../../src/components/moni-badge.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EAAE,WAAW,EAAgB,MAAM,kBAAkB,CAAC;AAE7D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,qBACa,SAAU,SAAQ,WAAW;IACzC;;;;;;;;OAQG;IAC0B,KAAK,SAAM;IAExC;;;;;;;;;;;;OAYG;IAEH,QAAQ,EAAE,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,EAAE,CAAM;IAEjE;;;;;;;;;;;OAWG;IAEH,KAAK,EAAE,QAAQ,GAAG,QAAQ,GAAG,KAAK,GAAG,EAAE,CAAM;IAE7C;;;;;;;;;;OAUG;IAEH,KAAK,EAAE,SAAS,GAAG,WAAW,GAAG,UAAU,GAAG,OAAO,CAAW;IAEhE;;;;;;;;OAQG;IACyC,MAAM,UAAS;IAE3D;;;;;;;;OAQG;IACyC,MAAM,UAAS;IAE3D;;;;;;;OAOG;IACM,iBAAiB;IAY1B,OAAgB,MAAM,4BAqEpB;IAEF;;;;;;;;;;;OAWG;IACM,MAAM;CAYf;AAED,OAAO,CAAC,MAAM,CAAC;IACd,UAAU,qBAAqB;QAC9B,YAAY,EAAE,SAAS,CAAC;KACxB;CACD;AAED,eAAe,SAAS,CAAC"}
@@ -1,3 +1,9 @@
1
+ /**
2
+ * @file components/moni-badge.ts
3
+ * @package @moni-labs/moni-ui
4
+ * @license MIT
5
+ * @contributors Moni Labs & Contributors
6
+ */
1
7
  var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
8
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
9
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -8,36 +14,126 @@ import { html, css } from 'lit';
8
14
  import { customElement, property } from 'lit/decorators.js';
9
15
  import { MoniElement, sharedStyles } from './_base/index.js';
10
16
  /**
11
- * Badge that faithfully ports BeerCSS's `.badge` styles.
17
+ * Material Design 3 Badge component.
18
+ *
19
+ * Badges are small status descriptors anchored to a parent element, used to
20
+ * convey supplementary information such as a notification count, online
21
+ * status, or selection indicator.
22
+ *
23
+ * **Positioning contract:**
24
+ * The badge uses `position: absolute` and anchors to the parent element.
25
+ * On `connectedCallback`, if the parent's computed `position` is `'static'`,
26
+ * the badge automatically sets `parent.style.position = 'relative'`.
27
+ * Consumers do not need to manually add `position: relative` to the parent.
28
+ *
29
+ * **Rendering model:**
30
+ * The `:host` displays as `contents`, making it transparent to layout.
31
+ * Only the inner `.badge` span is visually rendered. This allows the badge
32
+ * to be dropped inside any element without affecting its layout flow.
12
33
  *
13
- * BeerCSS `.badge` uses:
14
- * - `position: absolute; inset: 50% auto auto 50%; transform: translate(var(--_x), var(--_y))`
15
- * - Default: --_x: 0, --_y: -100% top-right corner
34
+ * @example
35
+ * ```html
36
+ * <!-- Notification badge on a button -->
37
+ * <div style="position: relative; display: inline-flex;">
38
+ * <moni-button icon="notifications" variant="text"></moni-button>
39
+ * <moni-badge value="5"></moni-badge>
40
+ * </div>
41
+ * ```
16
42
  *
17
- * The parent element MUST have `position: relative` for the badge to anchor correctly.
18
- * We ensure this in connectedCallback.
43
+ * @example
44
+ * ```html
45
+ * <!-- Inline dot badge for status -->
46
+ * <moni-badge shape="min" color="primary" inline></moni-badge>
47
+ * Online
48
+ * ```
19
49
  *
20
- * Attributes:
21
- * - value: text content (also accepts slotted content)
22
- * - position: '' (top-right default) | top | bottom | left | right | none
23
- * - shape: '' (round) | circle | square | min
24
- * - color: error (default) | primary | secondary | tertiary
25
- * - border: present → outlined badge (BeerCSS .badge.border)
26
- * - inline: present → badge becomes inline (BeerCSS .badge.none)
50
+ * @csspart badge - The badge `<span>` element. Override `background-color`,
51
+ * `color`, or `border-radius` to customize appearance.
27
52
  */
28
53
  let MoniBadge = class MoniBadge extends MoniElement {
29
54
  constructor() {
30
55
  super(...arguments);
56
+ /**
57
+ * Text content of the badge label.
58
+ *
59
+ * Also accepts slotted content — the default slot inside the badge span
60
+ * falls back to this value when no children are slotted.
61
+ * Use an empty string with `shape="min"` to render a dot-only badge.
62
+ *
63
+ * @default ''
64
+ */
31
65
  this.value = '';
66
+ /**
67
+ * Anchor position relative to the parent element's edges.
68
+ *
69
+ * Uses `inset: 50% auto auto 50%` as the base and adjusts translation:
70
+ * - `''` (default) — top-right corner (translate: 0, -100%).
71
+ * - `'top'` — same as default, explicit alias.
72
+ * - `'bottom'` — bottom-right corner (translate: 0, 0).
73
+ * - `'left'` — top-left corner (translate: -100%, -100%).
74
+ * - `'right'` — top-right corner (translate: 0, -100%).
75
+ * - `'none'` — disables absolute positioning; see also the `inline` attribute.
76
+ *
77
+ * @default ''
78
+ */
32
79
  this.position = '';
80
+ /**
81
+ * Shape of the badge container.
82
+ *
83
+ * - `''` (default) — Rounded pill shape (border-radius: 1rem).
84
+ * - `'circle'` — Alias for pill; the badge is always circular when the
85
+ * content is a single character or absent.
86
+ * - `'square'` — No border-radius (angular badge).
87
+ * - `'min'` — Dot only; content is hidden via `display: none` and the
88
+ * shape is clipped to a small circle via `clip-path`.
89
+ *
90
+ * @default ''
91
+ */
33
92
  this.shape = '';
93
+ /**
94
+ * Semantic color role of the badge.
95
+ *
96
+ * Maps to the M3 color palette roles:
97
+ * - `'error'` (default) — Red; standard for notification counts and alerts.
98
+ * - `'primary'` — Brand primary color; for selection or active states.
99
+ * - `'secondary'` — Secondary accent; for supplementary indicators.
100
+ * - `'tertiary'` — Tertiary accent; for decorative or informational badges.
101
+ *
102
+ * @default 'error'
103
+ */
34
104
  this.color = 'error';
105
+ /**
106
+ * When `true`, the badge renders inline (resets `position: absolute` to
107
+ * `position: relative`) rather than anchoring to the parent.
108
+ *
109
+ * Equivalent to BeerCSS's `.badge.none` class. Use for inline status
110
+ * indicators that flow within text or flex containers.
111
+ *
112
+ * @default false
113
+ */
35
114
  this.inline = false;
115
+ /**
116
+ * When present, renders the badge with an outlined style:
117
+ * - Background becomes `--surface` (same as the page background).
118
+ * - Border and text color use the palette color token (e.g. `--error`).
119
+ *
120
+ * Equivalent to BeerCSS's `.badge.border` class.
121
+ *
122
+ * @default false
123
+ */
36
124
  this.border = false;
37
125
  }
126
+ /**
127
+ * Ensures the parent element can contain the absolutely-positioned badge.
128
+ *
129
+ * Reads the parent's computed `position` via `getComputedStyle`. If it is
130
+ * `'static'` (the browser default), sets `parent.style.position = 'relative'`
131
+ * so the badge anchors correctly. This is a convenience that avoids requiring
132
+ * consumers to remember to add `position: relative` to the parent themselves.
133
+ */
38
134
  connectedCallback() {
39
135
  super.connectedCallback();
40
- // BeerCSS requirement: parent must be position:relative for badge to anchor
136
+ // Ensure the badge's absolutely-positioned anchor point is correct.
41
137
  const parent = this.parentElement;
42
138
  if (parent) {
43
139
  const computed = getComputedStyle(parent);
@@ -116,6 +212,18 @@ let MoniBadge = class MoniBadge extends MoniElement {
116
212
  .badge.min { clip-path: circle(18.75% at 50% 50%); }
117
213
  `
118
214
  ]; }
215
+ /**
216
+ * Renders the badge span with the computed class list.
217
+ *
218
+ * Class composition:
219
+ * - `'badge'` — always present (base styles).
220
+ * - `this.position` — position variant class (e.g. `'bottom'`, `'left'`).
221
+ * - `this.shape` — shape variant class (e.g. `'min'`, `'square'`).
222
+ * - `'none'` — added when `inline=true` to reset absolute positioning.
223
+ *
224
+ * Falsy values are filtered out so no extra spaces appear in the class string.
225
+ * The default slot falls back to the `value` attribute text node.
226
+ */
119
227
  render() {
120
228
  const classes = [
121
229
  'badge',
@@ -1,30 +1,135 @@
1
+ /**
2
+ * @file components/moni-bottom-sheet.ts
3
+ * @package @moni-labs/moni-ui
4
+ * @license MIT
5
+ * @contributors Moni Labs & Contributors
6
+ */
1
7
  import { MoniElement } from './_base/index.js';
2
8
  /**
3
- * Visual-only bottom sheet. Renders a `<dialog>` that the consumer opens
4
- * by calling `dialog.showModal()` from the light DOM. The `open` attribute
5
- * mirrors that state.
6
- *
7
- * Attributes:
8
- * - open: present → visibility on
9
- * - size: small | medium (default) | large | auto
10
- * - modal: present → backdrop rendered
11
- * - title: heading text
12
- *
13
- * Slots:
14
- * - handle: grab handle
15
- * - default: body
16
- * - footer: action buttons
9
+ * Material Design 3 Bottom Sheet component.
10
+ *
11
+ * Bottom sheets are surfaces anchored to the bottom of the screen that
12
+ * supplement the main view. They display supplementary content, contextual
13
+ * actions, or task flows without fully obscuring the primary content.
14
+ *
15
+ * **M3 spec reference:** `m3-docs/components/sheets-bottom/specs.md`
16
+ *
17
+ * **Implementation note — native `<dialog>` element:**
18
+ * Like `<moni-dialog>`, this component wraps the native `<dialog>` element.
19
+ * The `open` property drives `dialog.showModal()` / `dialog.close()`. When
20
+ * `modal=true` (default), a `::backdrop` scrim is rendered automatically.
21
+ *
22
+ * **Teleportation (body-level mounting):**
23
+ * When `positioning="body"` (default), the component moves itself to
24
+ * `document.body` on `connectedCallback` so the fixed-bottom dialog renders
25
+ * above all stacking contexts. On `disconnectedCallback`, it is moved back
26
+ * to its original DOM position. This avoids clipping by `overflow: hidden`
27
+ * or `transform` ancestors.
28
+ *
29
+ * **Sizes:**
30
+ * - `small` — Compact sheet; suitable for simple action menus.
31
+ * - `medium` — Standard height (default).
32
+ * - `large` — Expanded height (`expandedHeight` controls the max block-size).
33
+ * - `auto` — Content-driven height.
34
+ *
35
+ * @example
36
+ * ```html
37
+ * <moni-bottom-sheet title="Share">
38
+ * <moni-list-item icon="share">Copy link</moni-list-item>
39
+ * <moni-list-item icon="mail">Send via email</moni-list-item>
40
+ * </moni-bottom-sheet>
41
+ *
42
+ * <script>
43
+ * document.querySelector('moni-bottom-sheet').open = true;
44
+ * </script>
45
+ * ```
46
+ *
47
+ * @slot default - The body content of the bottom sheet.
48
+ * @slot handle - The drag handle area at the top of the sheet.
49
+ * @slot footer - Action buttons at the bottom of the sheet.
50
+ *
51
+ * @csspart dialog - The native `<dialog>` element.
52
+ * @csspart header - The header container with title and close button.
53
+ * @csspart body - The scrollable body content area.
54
+ * @csspart footer - The footer action buttons area.
17
55
  */
18
56
  export declare class MoniBottomSheet extends MoniElement {
57
+ /**
58
+ * Controls the open/closed state of the bottom sheet.
59
+ *
60
+ * When set to `true`, calls `dialog.showModal()` or `dialog.show()`
61
+ * depending on the `modal` property. When set to `false`, calls `dialog.close()`.
62
+ *
63
+ * @default false
64
+ */
19
65
  open: boolean;
66
+ /**
67
+ * Height variant of the sheet container.
68
+ *
69
+ * - `'small'` — Compact; suitable for quick confirmations.
70
+ * - `'medium'` — Standard height (default).
71
+ * - `'large'` — Fills `expandedHeight` of the viewport.
72
+ * - `'auto'` — Content-driven; height adapts to the slotted content.
73
+ *
74
+ * @default 'medium'
75
+ */
20
76
  size: 'small' | 'medium' | 'large' | 'auto';
77
+ /**
78
+ * When `true` (default), the sheet opens as a modal dialog with a backdrop
79
+ * scrim. When `false`, it opens as a non-modal overlay with no scrim.
80
+ *
81
+ * @default true
82
+ */
21
83
  modal: boolean;
84
+ /**
85
+ * Heading text displayed in the sheet's header area.
86
+ *
87
+ * @default ''
88
+ */
22
89
  title: string;
90
+ /**
91
+ * Controls how the sheet is positioned in the document.
92
+ *
93
+ * - `'body'` (default) — Teleports the element to `document.body` so
94
+ * the fixed overlay renders above all stacking contexts.
95
+ * - `'fixed'` — Fixed positioning within its current DOM subtree.
96
+ * - `'absolute'` — Absolute within the nearest positioned ancestor.
97
+ * - `'static'` — Static flow (rarely needed; for testing only).
98
+ *
99
+ * @default 'fixed'
100
+ */
23
101
  positioning: 'body' | 'fixed' | 'absolute' | 'static';
102
+ /**
103
+ * Maximum block-size (height) of the sheet when `size="large"`.
104
+ *
105
+ * Accepts any valid CSS `max-block-size` value (e.g. `'85%'`, `'600px'`).
106
+ * Defaults to `'85%'` which is the M3-recommended maximum for bottom sheets
107
+ * on compact screens.
108
+ *
109
+ * @default '85%'
110
+ */
24
111
  expandedHeight: string;
112
+ /**
113
+ * Optional maximum inline-size (width) constraint for the sheet.
114
+ *
115
+ * When set (e.g. `'640px'`), the sheet will not exceed this width even on
116
+ * wide displays. Useful for tablet/desktop breakpoints where a centered
117
+ * modal is preferred over a full-width sheet.
118
+ *
119
+ * @default '' (no constraint)
120
+ */
25
121
  maxWidth: string;
122
+ /**
123
+ * Original parent node before teleportation to `document.body`.
124
+ * Used to restore the element's DOM position in `disconnectedCallback`.
125
+ */
26
126
  private _originalParent;
127
+ /**
128
+ * Original next sibling before teleportation to `document.body`.
129
+ * Used alongside `_originalParent` to restore the exact DOM position.
130
+ */
27
131
  private _originalSibling;
132
+ /** Direct reference to the native `<dialog>` element. */
28
133
  private _dialog;
29
134
  private _isDragging;
30
135
  private _startY;
@@ -41,7 +146,7 @@ export declare class MoniBottomSheet extends MoniElement {
41
146
  updated(changed: Map<string, unknown>): void;
42
147
  disconnectedCallback(): void;
43
148
  static styles: import("lit").CSSResult[];
44
- render(): import("lit-html").TemplateResult<1>;
149
+ render(): import("lit").TemplateResult<1>;
45
150
  }
46
151
  declare global {
47
152
  interface HTMLElementTagNameMap {
@@ -1 +1 @@
1
- {"version":3,"file":"moni-bottom-sheet.d.ts","sourceRoot":"","sources":["../../src/components/moni-bottom-sheet.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAgB,MAAM,kBAAkB,CAAC;AAE7D;;;;;;;;;;;;;;;GAeG;AACH,qBACa,eAAgB,SAAQ,WAAW;IACH,IAAI,UAAS;IAEzD,IAAI,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,GAAG,MAAM,CAAY;IACX,KAAK,UAAQ;IAC5B,KAAK,SAAM;IAExC,WAAW,EAAE,MAAM,GAAG,OAAO,GAAG,UAAU,GAAG,QAAQ,CAAW;IAEhE,cAAc,SAAS;IAEvB,QAAQ,SAAM;IAEd,OAAO,CAAC,eAAe,CAAqB;IAC5C,OAAO,CAAC,gBAAgB,CAAqB;IAE5B,OAAO,CAAC,OAAO,CAAqB;IAErD,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,OAAO,CAAK;IACpB,OAAO,CAAC,oBAAoB,CAAK;IACjC,OAAO,CAAC,YAAY,CAAK;IACzB,OAAO,CAAC,cAAc,CAAK;IAC3B,OAAO,CAAC,YAAY,CAAS;IAE7B,OAAO,CAAC,eAAe;IAcvB,OAAO,CAAC,cAAc;IAkBtB,OAAO,CAAC,cAAc;IAkCtB,OAAO,CAAC,YAAY;IAwFpB,OAAO,CAAC,gBAAgB;IAWxB,OAAO,CAAC,cAAc;IAyBb,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC;IA4BrC,oBAAoB;IAO7B,OAAgB,MAAM,4BAyHpB;IAEO,MAAM;CAsBf;AAED,OAAO,CAAC,MAAM,CAAC;IACd,UAAU,qBAAqB;QAC9B,mBAAmB,EAAE,eAAe,CAAC;KACrC;CACD;AAED,eAAe,eAAe,CAAC"}
1
+ {"version":3,"file":"moni-bottom-sheet.d.ts","sourceRoot":"","sources":["../../src/components/moni-bottom-sheet.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EAAE,WAAW,EAAgB,MAAM,kBAAkB,CAAC;AAE7D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AACH,qBACa,eAAgB,SAAQ,WAAW;IAC/C;;;;;;;OAOG;IACyC,IAAI,UAAS;IAEzD;;;;;;;;;OASG;IAEH,IAAI,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,GAAG,MAAM,CAAY;IAEvD;;;;;OAKG;IACyC,KAAK,UAAQ;IAEzD;;;;OAIG;IAC0B,KAAK,SAAM;IAExC;;;;;;;;;;OAUG;IAEH,WAAW,EAAE,MAAM,GAAG,OAAO,GAAG,UAAU,GAAG,QAAQ,CAAW;IAEhE;;;;;;;;OAQG;IAEH,cAAc,SAAS;IAEvB;;;;;;;;OAQG;IAEH,QAAQ,SAAM;IAEd;;;OAGG;IACH,OAAO,CAAC,eAAe,CAAqB;IAE5C;;;OAGG;IACH,OAAO,CAAC,gBAAgB,CAAqB;IAE7C,yDAAyD;IACxC,OAAO,CAAC,OAAO,CAAqB;IACrD,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,OAAO,CAAK;IACpB,OAAO,CAAC,oBAAoB,CAAK;IACjC,OAAO,CAAC,YAAY,CAAK;IACzB,OAAO,CAAC,cAAc,CAAK;IAC3B,OAAO,CAAC,YAAY,CAAS;IAE7B,OAAO,CAAC,eAAe;IAcvB,OAAO,CAAC,cAAc;IAkBtB,OAAO,CAAC,cAAc;IAkCtB,OAAO,CAAC,YAAY;IAwFpB,OAAO,CAAC,gBAAgB;IAWxB,OAAO,CAAC,cAAc;IAyBb,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC;IA4BrC,oBAAoB;IAO7B,OAAgB,MAAM,4BAyHpB;IAEO,MAAM;CAsBf;AAED,OAAO,CAAC,MAAM,CAAC;IACd,UAAU,qBAAqB;QAC9B,mBAAmB,EAAE,eAAe,CAAC;KACrC;CACD;AAED,eAAe,eAAe,CAAC"}
@@ -1,3 +1,9 @@
1
+ /**
2
+ * @file components/moni-bottom-sheet.ts
3
+ * @package @moni-labs/moni-ui
4
+ * @license MIT
5
+ * @contributors Moni Labs & Contributors
6
+ */
1
7
  var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
8
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
9
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -8,32 +14,130 @@ import { html, css } from 'lit';
8
14
  import { customElement, property, query } from 'lit/decorators.js';
9
15
  import { MoniElement, sharedStyles } from './_base/index.js';
10
16
  /**
11
- * Visual-only bottom sheet. Renders a `<dialog>` that the consumer opens
12
- * by calling `dialog.showModal()` from the light DOM. The `open` attribute
13
- * mirrors that state.
17
+ * Material Design 3 Bottom Sheet component.
18
+ *
19
+ * Bottom sheets are surfaces anchored to the bottom of the screen that
20
+ * supplement the main view. They display supplementary content, contextual
21
+ * actions, or task flows without fully obscuring the primary content.
22
+ *
23
+ * **M3 spec reference:** `m3-docs/components/sheets-bottom/specs.md`
24
+ *
25
+ * **Implementation note — native `<dialog>` element:**
26
+ * Like `<moni-dialog>`, this component wraps the native `<dialog>` element.
27
+ * The `open` property drives `dialog.showModal()` / `dialog.close()`. When
28
+ * `modal=true` (default), a `::backdrop` scrim is rendered automatically.
29
+ *
30
+ * **Teleportation (body-level mounting):**
31
+ * When `positioning="body"` (default), the component moves itself to
32
+ * `document.body` on `connectedCallback` so the fixed-bottom dialog renders
33
+ * above all stacking contexts. On `disconnectedCallback`, it is moved back
34
+ * to its original DOM position. This avoids clipping by `overflow: hidden`
35
+ * or `transform` ancestors.
36
+ *
37
+ * **Sizes:**
38
+ * - `small` — Compact sheet; suitable for simple action menus.
39
+ * - `medium` — Standard height (default).
40
+ * - `large` — Expanded height (`expandedHeight` controls the max block-size).
41
+ * - `auto` — Content-driven height.
42
+ *
43
+ * @example
44
+ * ```html
45
+ * <moni-bottom-sheet title="Share">
46
+ * <moni-list-item icon="share">Copy link</moni-list-item>
47
+ * <moni-list-item icon="mail">Send via email</moni-list-item>
48
+ * </moni-bottom-sheet>
49
+ *
50
+ * <script>
51
+ * document.querySelector('moni-bottom-sheet').open = true;
52
+ * </script>
53
+ * ```
14
54
  *
15
- * Attributes:
16
- * - open: present visibility on
17
- * - size: small | medium (default) | large | auto
18
- * - modal: present → backdrop rendered
19
- * - title: heading text
55
+ * @slot default - The body content of the bottom sheet.
56
+ * @slot handle - The drag handle area at the top of the sheet.
57
+ * @slot footer - Action buttons at the bottom of the sheet.
20
58
  *
21
- * Slots:
22
- * - handle: grab handle
23
- * - default: body
24
- * - footer: action buttons
59
+ * @csspart dialog - The native `<dialog>` element.
60
+ * @csspart header - The header container with title and close button.
61
+ * @csspart body - The scrollable body content area.
62
+ * @csspart footer - The footer action buttons area.
25
63
  */
26
64
  let MoniBottomSheet = class MoniBottomSheet extends MoniElement {
27
65
  constructor() {
28
66
  super(...arguments);
67
+ /**
68
+ * Controls the open/closed state of the bottom sheet.
69
+ *
70
+ * When set to `true`, calls `dialog.showModal()` or `dialog.show()`
71
+ * depending on the `modal` property. When set to `false`, calls `dialog.close()`.
72
+ *
73
+ * @default false
74
+ */
29
75
  this.open = false;
76
+ /**
77
+ * Height variant of the sheet container.
78
+ *
79
+ * - `'small'` — Compact; suitable for quick confirmations.
80
+ * - `'medium'` — Standard height (default).
81
+ * - `'large'` — Fills `expandedHeight` of the viewport.
82
+ * - `'auto'` — Content-driven; height adapts to the slotted content.
83
+ *
84
+ * @default 'medium'
85
+ */
30
86
  this.size = 'medium';
87
+ /**
88
+ * When `true` (default), the sheet opens as a modal dialog with a backdrop
89
+ * scrim. When `false`, it opens as a non-modal overlay with no scrim.
90
+ *
91
+ * @default true
92
+ */
31
93
  this.modal = true;
94
+ /**
95
+ * Heading text displayed in the sheet's header area.
96
+ *
97
+ * @default ''
98
+ */
32
99
  this.title = '';
100
+ /**
101
+ * Controls how the sheet is positioned in the document.
102
+ *
103
+ * - `'body'` (default) — Teleports the element to `document.body` so
104
+ * the fixed overlay renders above all stacking contexts.
105
+ * - `'fixed'` — Fixed positioning within its current DOM subtree.
106
+ * - `'absolute'` — Absolute within the nearest positioned ancestor.
107
+ * - `'static'` — Static flow (rarely needed; for testing only).
108
+ *
109
+ * @default 'fixed'
110
+ */
33
111
  this.positioning = 'fixed';
112
+ /**
113
+ * Maximum block-size (height) of the sheet when `size="large"`.
114
+ *
115
+ * Accepts any valid CSS `max-block-size` value (e.g. `'85%'`, `'600px'`).
116
+ * Defaults to `'85%'` which is the M3-recommended maximum for bottom sheets
117
+ * on compact screens.
118
+ *
119
+ * @default '85%'
120
+ */
34
121
  this.expandedHeight = '85%';
122
+ /**
123
+ * Optional maximum inline-size (width) constraint for the sheet.
124
+ *
125
+ * When set (e.g. `'640px'`), the sheet will not exceed this width even on
126
+ * wide displays. Useful for tablet/desktop breakpoints where a centered
127
+ * modal is preferred over a full-width sheet.
128
+ *
129
+ * @default '' (no constraint)
130
+ */
35
131
  this.maxWidth = '';
132
+ /**
133
+ * Original parent node before teleportation to `document.body`.
134
+ * Used to restore the element's DOM position in `disconnectedCallback`.
135
+ */
36
136
  this._originalParent = null;
137
+ /**
138
+ * Original next sibling before teleportation to `document.body`.
139
+ * Used alongside `_originalParent` to restore the exact DOM position.
140
+ */
37
141
  this._originalSibling = null;
38
142
  this._isDragging = false;
39
143
  this._startY = 0;