@moni-labs/moni-ui 0.2.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 (451) hide show
  1. package/LICENSE +34 -0
  2. package/README.md +264 -0
  3. package/custom-elements.json +12510 -0
  4. package/dist/actions/index.d.ts +2 -0
  5. package/dist/actions/index.d.ts.map +1 -0
  6. package/dist/actions/index.js +1 -0
  7. package/dist/assets/arch.svg +1 -0
  8. package/dist/assets/arrow.svg +1 -0
  9. package/dist/assets/boom.svg +1 -0
  10. package/dist/assets/bun.svg +1 -0
  11. package/dist/assets/burst.svg +1 -0
  12. package/dist/assets/circle.svg +1 -0
  13. package/dist/assets/clamshell.svg +1 -0
  14. package/dist/assets/diamond.svg +1 -0
  15. package/dist/assets/fan.svg +1 -0
  16. package/dist/assets/flower.svg +1 -0
  17. package/dist/assets/gem.svg +1 -0
  18. package/dist/assets/ghost-ish.svg +1 -0
  19. package/dist/assets/heart.svg +1 -0
  20. package/dist/assets/leaf-clover4.svg +1 -0
  21. package/dist/assets/leaf-clover8.svg +1 -0
  22. package/dist/assets/loading-indicator.svg +1 -0
  23. package/dist/assets/material-symbols-rounded.woff2 +0 -0
  24. package/dist/assets/material-symbols-subset.woff2 +0 -0
  25. package/dist/assets/oval.svg +1 -0
  26. package/dist/assets/pentagon.svg +1 -0
  27. package/dist/assets/pill.svg +1 -0
  28. package/dist/assets/pixel-circle.svg +1 -0
  29. package/dist/assets/pixel-triangle.svg +1 -0
  30. package/dist/assets/puffy-diamond.svg +1 -0
  31. package/dist/assets/puffy.svg +1 -0
  32. package/dist/assets/semicircle.svg +1 -0
  33. package/dist/assets/shapes/arch.svg +1 -0
  34. package/dist/assets/shapes/arrow.svg +1 -0
  35. package/dist/assets/shapes/boom.svg +1 -0
  36. package/dist/assets/shapes/burst.svg +1 -0
  37. package/dist/assets/shapes/circle.svg +1 -0
  38. package/dist/assets/shapes/clamshell.svg +1 -0
  39. package/dist/assets/shapes/diamond.svg +1 -0
  40. package/dist/assets/shapes/fan.svg +1 -0
  41. package/dist/assets/shapes/flower.svg +1 -0
  42. package/dist/assets/shapes/gem.svg +1 -0
  43. package/dist/assets/shapes/ghost-ish.svg +1 -0
  44. package/dist/assets/shapes/heart.svg +1 -0
  45. package/dist/assets/shapes/leaf-clover4.svg +1 -0
  46. package/dist/assets/shapes/leaf-clover8.svg +1 -0
  47. package/dist/assets/shapes/loading-indicator.svg +1 -0
  48. package/dist/assets/shapes/oval.svg +1 -0
  49. package/dist/assets/shapes/pentagon.svg +1 -0
  50. package/dist/assets/shapes/pill.svg +1 -0
  51. package/dist/assets/shapes/pixel-circle.svg +1 -0
  52. package/dist/assets/shapes/pixel-triangle.svg +1 -0
  53. package/dist/assets/shapes/puffy-diamond.svg +1 -0
  54. package/dist/assets/shapes/puffy.svg +1 -0
  55. package/dist/assets/shapes/semicircle.svg +1 -0
  56. package/dist/assets/shapes/sided-cookie12.svg +1 -0
  57. package/dist/assets/shapes/sided-cookie4.svg +1 -0
  58. package/dist/assets/shapes/sided-cookie6.svg +1 -0
  59. package/dist/assets/shapes/sided-cookie7.svg +1 -0
  60. package/dist/assets/shapes/sided-cookie9.svg +1 -0
  61. package/dist/assets/shapes/slanted.svg +1 -0
  62. package/dist/assets/shapes/soft-boom.svg +1 -0
  63. package/dist/assets/shapes/soft-burst.svg +1 -0
  64. package/dist/assets/shapes/square.svg +1 -0
  65. package/dist/assets/shapes/sunny.svg +1 -0
  66. package/dist/assets/shapes/triangle.svg +1 -0
  67. package/dist/assets/shapes/very-sunny.svg +1 -0
  68. package/dist/assets/shapes/wavy-circle.svg +1 -0
  69. package/dist/assets/shapes/wavy.svg +1 -0
  70. package/dist/assets/sided-cookie12.svg +1 -0
  71. package/dist/assets/sided-cookie4.svg +1 -0
  72. package/dist/assets/sided-cookie6.svg +1 -0
  73. package/dist/assets/sided-cookie7.svg +1 -0
  74. package/dist/assets/sided-cookie9.svg +1 -0
  75. package/dist/assets/slanted.svg +1 -0
  76. package/dist/assets/soft-boom.svg +1 -0
  77. package/dist/assets/soft-burst.svg +1 -0
  78. package/dist/assets/square.svg +1 -0
  79. package/dist/assets/star.svg +1 -0
  80. package/dist/assets/sunny.svg +1 -0
  81. package/dist/assets/triangle.svg +1 -0
  82. package/dist/assets/very-sunny.svg +1 -0
  83. package/dist/assets/wavy-circle.svg +1 -0
  84. package/dist/assets/wavy.svg +1 -0
  85. package/dist/components/_base/field-styles.d.ts +24 -0
  86. package/dist/components/_base/field-styles.d.ts.map +1 -0
  87. package/dist/components/_base/field-styles.js +504 -0
  88. package/dist/components/_base/index.d.ts +4 -0
  89. package/dist/components/_base/index.d.ts.map +1 -0
  90. package/dist/components/_base/index.js +3 -0
  91. package/dist/components/_base/interaction-styles.d.ts +22 -0
  92. package/dist/components/_base/interaction-styles.d.ts.map +1 -0
  93. package/dist/components/_base/interaction-styles.js +123 -0
  94. package/dist/components/_base/moni-element.d.ts +18 -0
  95. package/dist/components/_base/moni-element.d.ts.map +1 -0
  96. package/dist/components/_base/moni-element.js +19 -0
  97. package/dist/components/_base/shared-styles.d.ts +22 -0
  98. package/dist/components/_base/shared-styles.d.ts.map +1 -0
  99. package/dist/components/_base/shared-styles.js +146 -0
  100. package/dist/components/index.d.ts +42 -0
  101. package/dist/components/index.d.ts.map +1 -0
  102. package/dist/components/index.js +43 -0
  103. package/dist/components/loading-shapes.d.ts +10 -0
  104. package/dist/components/loading-shapes.d.ts.map +1 -0
  105. package/dist/components/loading-shapes.js +9 -0
  106. package/dist/components/moni-app-bar.d.ts +52 -0
  107. package/dist/components/moni-app-bar.d.ts.map +1 -0
  108. package/dist/components/moni-app-bar.js +207 -0
  109. package/dist/components/moni-badge.d.ts +37 -0
  110. package/dist/components/moni-badge.d.ts.map +1 -0
  111. package/dist/components/moni-badge.js +153 -0
  112. package/dist/components/moni-bottom-sheet.d.ts +52 -0
  113. package/dist/components/moni-bottom-sheet.d.ts.map +1 -0
  114. package/dist/components/moni-bottom-sheet.js +440 -0
  115. package/dist/components/moni-button-group.d.ts +55 -0
  116. package/dist/components/moni-button-group.d.ts.map +1 -0
  117. package/dist/components/moni-button-group.js +278 -0
  118. package/dist/components/moni-button-segment.d.ts +29 -0
  119. package/dist/components/moni-button-segment.d.ts.map +1 -0
  120. package/dist/components/moni-button-segment.js +300 -0
  121. package/dist/components/moni-button.d.ts +70 -0
  122. package/dist/components/moni-button.d.ts.map +1 -0
  123. package/dist/components/moni-button.js +727 -0
  124. package/dist/components/moni-card.d.ts +48 -0
  125. package/dist/components/moni-card.d.ts.map +1 -0
  126. package/dist/components/moni-card.js +216 -0
  127. package/dist/components/moni-carousel.d.ts +111 -0
  128. package/dist/components/moni-carousel.d.ts.map +1 -0
  129. package/dist/components/moni-carousel.js +1007 -0
  130. package/dist/components/moni-checkbox.d.ts +39 -0
  131. package/dist/components/moni-checkbox.d.ts.map +1 -0
  132. package/dist/components/moni-checkbox.js +212 -0
  133. package/dist/components/moni-chip.d.ts +57 -0
  134. package/dist/components/moni-chip.d.ts.map +1 -0
  135. package/dist/components/moni-chip.js +340 -0
  136. package/dist/components/moni-color-field.d.ts +33 -0
  137. package/dist/components/moni-color-field.d.ts.map +1 -0
  138. package/dist/components/moni-color-field.js +170 -0
  139. package/dist/components/moni-context-menu.d.ts +55 -0
  140. package/dist/components/moni-context-menu.d.ts.map +1 -0
  141. package/dist/components/moni-context-menu.js +184 -0
  142. package/dist/components/moni-dialog.d.ts +37 -0
  143. package/dist/components/moni-dialog.d.ts.map +1 -0
  144. package/dist/components/moni-dialog.js +257 -0
  145. package/dist/components/moni-divider.d.ts +33 -0
  146. package/dist/components/moni-divider.d.ts.map +1 -0
  147. package/dist/components/moni-divider.js +81 -0
  148. package/dist/components/moni-expansion.d.ts +25 -0
  149. package/dist/components/moni-expansion.d.ts.map +1 -0
  150. package/dist/components/moni-expansion.js +94 -0
  151. package/dist/components/moni-fab-menu.d.ts +58 -0
  152. package/dist/components/moni-fab-menu.d.ts.map +1 -0
  153. package/dist/components/moni-fab-menu.js +247 -0
  154. package/dist/components/moni-fab.d.ts +48 -0
  155. package/dist/components/moni-fab.d.ts.map +1 -0
  156. package/dist/components/moni-fab.js +284 -0
  157. package/dist/components/moni-file-field.d.ts +47 -0
  158. package/dist/components/moni-file-field.d.ts.map +1 -0
  159. package/dist/components/moni-file-field.js +189 -0
  160. package/dist/components/moni-icon.d.ts +30 -0
  161. package/dist/components/moni-icon.d.ts.map +1 -0
  162. package/dist/components/moni-icon.js +107 -0
  163. package/dist/components/moni-list-item.d.ts +51 -0
  164. package/dist/components/moni-list-item.d.ts.map +1 -0
  165. package/dist/components/moni-list-item.js +239 -0
  166. package/dist/components/moni-list.d.ts +32 -0
  167. package/dist/components/moni-list.d.ts.map +1 -0
  168. package/dist/components/moni-list.js +67 -0
  169. package/dist/components/moni-loading-indicator.d.ts +32 -0
  170. package/dist/components/moni-loading-indicator.d.ts.map +1 -0
  171. package/dist/components/moni-loading-indicator.js +189 -0
  172. package/dist/components/moni-menu-item.d.ts +27 -0
  173. package/dist/components/moni-menu-item.d.ts.map +1 -0
  174. package/dist/components/moni-menu-item.js +99 -0
  175. package/dist/components/moni-menu.d.ts +55 -0
  176. package/dist/components/moni-menu.d.ts.map +1 -0
  177. package/dist/components/moni-menu.js +295 -0
  178. package/dist/components/moni-morph-modal.d.ts +78 -0
  179. package/dist/components/moni-morph-modal.d.ts.map +1 -0
  180. package/dist/components/moni-morph-modal.js +1223 -0
  181. package/dist/components/moni-nav-item.d.ts +38 -0
  182. package/dist/components/moni-nav-item.d.ts.map +1 -0
  183. package/dist/components/moni-nav-item.js +262 -0
  184. package/dist/components/moni-nav.d.ts +46 -0
  185. package/dist/components/moni-nav.d.ts.map +1 -0
  186. package/dist/components/moni-nav.js +272 -0
  187. package/dist/components/moni-progress.d.ts +45 -0
  188. package/dist/components/moni-progress.d.ts.map +1 -0
  189. package/dist/components/moni-progress.js +333 -0
  190. package/dist/components/moni-radio.d.ts +38 -0
  191. package/dist/components/moni-radio.d.ts.map +1 -0
  192. package/dist/components/moni-radio.js +218 -0
  193. package/dist/components/moni-ripple.d.ts +35 -0
  194. package/dist/components/moni-ripple.d.ts.map +1 -0
  195. package/dist/components/moni-ripple.js +156 -0
  196. package/dist/components/moni-segmented-button.d.ts +52 -0
  197. package/dist/components/moni-segmented-button.d.ts.map +1 -0
  198. package/dist/components/moni-segmented-button.js +208 -0
  199. package/dist/components/moni-select-option.d.ts +27 -0
  200. package/dist/components/moni-select-option.d.ts.map +1 -0
  201. package/dist/components/moni-select-option.js +102 -0
  202. package/dist/components/moni-select.d.ts +76 -0
  203. package/dist/components/moni-select.d.ts.map +1 -0
  204. package/dist/components/moni-select.js +1136 -0
  205. package/dist/components/moni-shape.d.ts +30 -0
  206. package/dist/components/moni-shape.d.ts.map +1 -0
  207. package/dist/components/moni-shape.js +146 -0
  208. package/dist/components/moni-side-sheet.d.ts +62 -0
  209. package/dist/components/moni-side-sheet.d.ts.map +1 -0
  210. package/dist/components/moni-side-sheet.js +576 -0
  211. package/dist/components/moni-slider.d.ts +73 -0
  212. package/dist/components/moni-slider.d.ts.map +1 -0
  213. package/dist/components/moni-slider.js +422 -0
  214. package/dist/components/moni-snackbar.d.ts +40 -0
  215. package/dist/components/moni-snackbar.d.ts.map +1 -0
  216. package/dist/components/moni-snackbar.js +161 -0
  217. package/dist/components/moni-split-button.d.ts +33 -0
  218. package/dist/components/moni-split-button.d.ts.map +1 -0
  219. package/dist/components/moni-split-button.js +122 -0
  220. package/dist/components/moni-step.d.ts +30 -0
  221. package/dist/components/moni-step.d.ts.map +1 -0
  222. package/dist/components/moni-step.js +175 -0
  223. package/dist/components/moni-stepper.d.ts +35 -0
  224. package/dist/components/moni-stepper.d.ts.map +1 -0
  225. package/dist/components/moni-stepper.js +101 -0
  226. package/dist/components/moni-switch.d.ts +39 -0
  227. package/dist/components/moni-switch.d.ts.map +1 -0
  228. package/dist/components/moni-switch.js +258 -0
  229. package/dist/components/moni-tab.d.ts +27 -0
  230. package/dist/components/moni-tab.d.ts.map +1 -0
  231. package/dist/components/moni-tab.js +147 -0
  232. package/dist/components/moni-tabs.d.ts +31 -0
  233. package/dist/components/moni-tabs.d.ts.map +1 -0
  234. package/dist/components/moni-tabs.js +106 -0
  235. package/dist/components/moni-text-field.d.ts +46 -0
  236. package/dist/components/moni-text-field.d.ts.map +1 -0
  237. package/dist/components/moni-text-field.js +190 -0
  238. package/dist/components/moni-textarea.d.ts +57 -0
  239. package/dist/components/moni-textarea.d.ts.map +1 -0
  240. package/dist/components/moni-textarea.js +228 -0
  241. package/dist/components/moni-time-picker.d.ts +51 -0
  242. package/dist/components/moni-time-picker.d.ts.map +1 -0
  243. package/dist/components/moni-time-picker.js +823 -0
  244. package/dist/components/moni-toolbar.d.ts +35 -0
  245. package/dist/components/moni-toolbar.d.ts.map +1 -0
  246. package/dist/components/moni-toolbar.js +128 -0
  247. package/dist/components/moni-tooltip.d.ts +65 -0
  248. package/dist/components/moni-tooltip.d.ts.map +1 -0
  249. package/dist/components/moni-tooltip.js +320 -0
  250. package/dist/components/moni-typography.d.ts +42 -0
  251. package/dist/components/moni-typography.d.ts.map +1 -0
  252. package/dist/components/moni-typography.js +205 -0
  253. package/dist/index.d.ts +7 -0
  254. package/dist/index.d.ts.map +1 -0
  255. package/dist/index.js +7 -0
  256. package/dist/styles/animations.css +46 -0
  257. package/dist/styles/base.css +248 -0
  258. package/dist/styles/index.css +3 -0
  259. package/dist/styles/tokens.css +190 -0
  260. package/dist/utils/color.d.ts +51 -0
  261. package/dist/utils/color.d.ts.map +1 -0
  262. package/dist/utils/color.js +107 -0
  263. package/dist/utils/theme.svelte.d.ts +45 -0
  264. package/dist/utils/theme.svelte.d.ts.map +1 -0
  265. package/dist/utils/theme.svelte.js +168 -0
  266. package/dist/web-components.d.ts +3 -0
  267. package/dist/web-components.d.ts.map +1 -0
  268. package/dist/web-components.js +4 -0
  269. package/package.json +76 -0
  270. package/src/actions/index.ts +2 -0
  271. package/src/assets/arch.svg +1 -0
  272. package/src/assets/arrow.svg +1 -0
  273. package/src/assets/boom.svg +1 -0
  274. package/src/assets/bun.svg +1 -0
  275. package/src/assets/burst.svg +1 -0
  276. package/src/assets/circle.svg +1 -0
  277. package/src/assets/clamshell.svg +1 -0
  278. package/src/assets/diamond.svg +1 -0
  279. package/src/assets/fan.svg +1 -0
  280. package/src/assets/flower.svg +1 -0
  281. package/src/assets/gem.svg +1 -0
  282. package/src/assets/ghost-ish.svg +1 -0
  283. package/src/assets/heart.svg +1 -0
  284. package/src/assets/leaf-clover4.svg +1 -0
  285. package/src/assets/leaf-clover8.svg +1 -0
  286. package/src/assets/loading-indicator.svg +1 -0
  287. package/src/assets/material-symbols-rounded.woff2 +0 -0
  288. package/src/assets/material-symbols-subset.woff2 +0 -0
  289. package/src/assets/oval.svg +1 -0
  290. package/src/assets/pentagon.svg +1 -0
  291. package/src/assets/pill.svg +1 -0
  292. package/src/assets/pixel-circle.svg +1 -0
  293. package/src/assets/pixel-triangle.svg +1 -0
  294. package/src/assets/puffy-diamond.svg +1 -0
  295. package/src/assets/puffy.svg +1 -0
  296. package/src/assets/semicircle.svg +1 -0
  297. package/src/assets/shapes/arch.svg +1 -0
  298. package/src/assets/shapes/arrow.svg +1 -0
  299. package/src/assets/shapes/boom.svg +1 -0
  300. package/src/assets/shapes/burst.svg +1 -0
  301. package/src/assets/shapes/circle.svg +1 -0
  302. package/src/assets/shapes/clamshell.svg +1 -0
  303. package/src/assets/shapes/diamond.svg +1 -0
  304. package/src/assets/shapes/fan.svg +1 -0
  305. package/src/assets/shapes/flower.svg +1 -0
  306. package/src/assets/shapes/gem.svg +1 -0
  307. package/src/assets/shapes/ghost-ish.svg +1 -0
  308. package/src/assets/shapes/heart.svg +1 -0
  309. package/src/assets/shapes/leaf-clover4.svg +1 -0
  310. package/src/assets/shapes/leaf-clover8.svg +1 -0
  311. package/src/assets/shapes/loading-indicator.svg +1 -0
  312. package/src/assets/shapes/oval.svg +1 -0
  313. package/src/assets/shapes/pentagon.svg +1 -0
  314. package/src/assets/shapes/pill.svg +1 -0
  315. package/src/assets/shapes/pixel-circle.svg +1 -0
  316. package/src/assets/shapes/pixel-triangle.svg +1 -0
  317. package/src/assets/shapes/puffy-diamond.svg +1 -0
  318. package/src/assets/shapes/puffy.svg +1 -0
  319. package/src/assets/shapes/semicircle.svg +1 -0
  320. package/src/assets/shapes/sided-cookie12.svg +1 -0
  321. package/src/assets/shapes/sided-cookie4.svg +1 -0
  322. package/src/assets/shapes/sided-cookie6.svg +1 -0
  323. package/src/assets/shapes/sided-cookie7.svg +1 -0
  324. package/src/assets/shapes/sided-cookie9.svg +1 -0
  325. package/src/assets/shapes/slanted.svg +1 -0
  326. package/src/assets/shapes/soft-boom.svg +1 -0
  327. package/src/assets/shapes/soft-burst.svg +1 -0
  328. package/src/assets/shapes/square.svg +1 -0
  329. package/src/assets/shapes/sunny.svg +1 -0
  330. package/src/assets/shapes/triangle.svg +1 -0
  331. package/src/assets/shapes/very-sunny.svg +1 -0
  332. package/src/assets/shapes/wavy-circle.svg +1 -0
  333. package/src/assets/shapes/wavy.svg +1 -0
  334. package/src/assets/sided-cookie12.svg +1 -0
  335. package/src/assets/sided-cookie4.svg +1 -0
  336. package/src/assets/sided-cookie6.svg +1 -0
  337. package/src/assets/sided-cookie7.svg +1 -0
  338. package/src/assets/sided-cookie9.svg +1 -0
  339. package/src/assets/slanted.svg +1 -0
  340. package/src/assets/soft-boom.svg +1 -0
  341. package/src/assets/soft-burst.svg +1 -0
  342. package/src/assets/square.svg +1 -0
  343. package/src/assets/star.svg +1 -0
  344. package/src/assets/sunny.svg +1 -0
  345. package/src/assets/triangle.svg +1 -0
  346. package/src/assets/very-sunny.svg +1 -0
  347. package/src/assets/wavy-circle.svg +1 -0
  348. package/src/assets/wavy.svg +1 -0
  349. package/src/assets.d.ts +12 -0
  350. package/src/components/_base/field-styles.ts +507 -0
  351. package/src/components/_base/index.ts +3 -0
  352. package/src/components/_base/interaction-styles.ts +125 -0
  353. package/src/components/_base/moni-element.ts +21 -0
  354. package/src/components/_base/shared-styles.ts +148 -0
  355. package/src/components/index.ts +45 -0
  356. package/src/components/loading-shapes.ts +9 -0
  357. package/src/components/moni-app-bar.test.ts +86 -0
  358. package/src/components/moni-app-bar.ts +190 -0
  359. package/src/components/moni-badge.ts +138 -0
  360. package/src/components/moni-bottom-sheet.test.ts +420 -0
  361. package/src/components/moni-bottom-sheet.ts +425 -0
  362. package/src/components/moni-button-group.test.ts +148 -0
  363. package/src/components/moni-button-group.ts +277 -0
  364. package/src/components/moni-button-segment.ts +291 -0
  365. package/src/components/moni-button.test.ts +166 -0
  366. package/src/components/moni-button.ts +709 -0
  367. package/src/components/moni-card.test.ts +83 -0
  368. package/src/components/moni-card.ts +203 -0
  369. package/src/components/moni-carousel.test.ts +238 -0
  370. package/src/components/moni-carousel.ts +1027 -0
  371. package/src/components/moni-checkbox.test.ts +78 -0
  372. package/src/components/moni-checkbox.ts +192 -0
  373. package/src/components/moni-chip.test.ts +168 -0
  374. package/src/components/moni-chip.ts +335 -0
  375. package/src/components/moni-color-field.test.ts +56 -0
  376. package/src/components/moni-color-field.ts +135 -0
  377. package/src/components/moni-context-menu.test.ts +99 -0
  378. package/src/components/moni-context-menu.ts +166 -0
  379. package/src/components/moni-dialog.ts +240 -0
  380. package/src/components/moni-divider.test.ts +42 -0
  381. package/src/components/moni-divider.ts +77 -0
  382. package/src/components/moni-expansion.ts +86 -0
  383. package/src/components/moni-fab-menu.test.ts +118 -0
  384. package/src/components/moni-fab-menu.ts +237 -0
  385. package/src/components/moni-fab.test.ts +128 -0
  386. package/src/components/moni-fab.ts +262 -0
  387. package/src/components/moni-file-field.test.ts +81 -0
  388. package/src/components/moni-file-field.ts +149 -0
  389. package/src/components/moni-icon.test.ts +70 -0
  390. package/src/components/moni-icon.ts +97 -0
  391. package/src/components/moni-list-item.test.ts +114 -0
  392. package/src/components/moni-list-item.ts +222 -0
  393. package/src/components/moni-list.ts +59 -0
  394. package/src/components/moni-loading-indicator.test.ts +41 -0
  395. package/src/components/moni-loading-indicator.ts +188 -0
  396. package/src/components/moni-menu-item.ts +85 -0
  397. package/src/components/moni-menu.test.ts +87 -0
  398. package/src/components/moni-menu.ts +287 -0
  399. package/src/components/moni-morph-modal.test.ts +286 -0
  400. package/src/components/moni-morph-modal.ts +1312 -0
  401. package/src/components/moni-nav-item.ts +243 -0
  402. package/src/components/moni-nav.test.ts +139 -0
  403. package/src/components/moni-nav.ts +266 -0
  404. package/src/components/moni-progress.test.ts +90 -0
  405. package/src/components/moni-progress.ts +322 -0
  406. package/src/components/moni-radio.test.ts +86 -0
  407. package/src/components/moni-radio.ts +196 -0
  408. package/src/components/moni-ripple.ts +146 -0
  409. package/src/components/moni-segmented-button.test.ts +99 -0
  410. package/src/components/moni-segmented-button.ts +220 -0
  411. package/src/components/moni-select-option.ts +85 -0
  412. package/src/components/moni-select.test.ts +210 -0
  413. package/src/components/moni-select.ts +1107 -0
  414. package/src/components/moni-shape.ts +128 -0
  415. package/src/components/moni-side-sheet.test.ts +128 -0
  416. package/src/components/moni-side-sheet.ts +544 -0
  417. package/src/components/moni-slider.test.ts +82 -0
  418. package/src/components/moni-slider.ts +387 -0
  419. package/src/components/moni-snackbar.test.ts +82 -0
  420. package/src/components/moni-snackbar.ts +146 -0
  421. package/src/components/moni-split-button.ts +121 -0
  422. package/src/components/moni-step.test.ts +57 -0
  423. package/src/components/moni-step.ts +155 -0
  424. package/src/components/moni-stepper.test.ts +116 -0
  425. package/src/components/moni-stepper.ts +100 -0
  426. package/src/components/moni-switch.test.ts +117 -0
  427. package/src/components/moni-switch.ts +237 -0
  428. package/src/components/moni-tab.test.ts +54 -0
  429. package/src/components/moni-tab.ts +133 -0
  430. package/src/components/moni-tabs.ts +92 -0
  431. package/src/components/moni-text-field.test.ts +115 -0
  432. package/src/components/moni-text-field.ts +149 -0
  433. package/src/components/moni-textarea.test.ts +147 -0
  434. package/src/components/moni-textarea.ts +176 -0
  435. package/src/components/moni-time-picker.test.ts +61 -0
  436. package/src/components/moni-time-picker.ts +800 -0
  437. package/src/components/moni-toolbar.test.ts +93 -0
  438. package/src/components/moni-toolbar.ts +119 -0
  439. package/src/components/moni-tooltip.test.ts +122 -0
  440. package/src/components/moni-tooltip.ts +324 -0
  441. package/src/components/moni-typography.test.ts +119 -0
  442. package/src/components/moni-typography.ts +195 -0
  443. package/src/index.ts +65 -0
  444. package/src/styles/animations.css +46 -0
  445. package/src/styles/base.css +248 -0
  446. package/src/styles/index.css +3 -0
  447. package/src/styles/tokens.css +190 -0
  448. package/src/types/svelte-runes.d.ts +7 -0
  449. package/src/utils/color.ts +170 -0
  450. package/src/utils/theme.svelte.ts +206 -0
  451. package/src/web-components.ts +5 -0
@@ -0,0 +1,90 @@
1
+ import { describe, it, expect, beforeEach, afterEach } from 'vitest';
2
+ import './moni-progress.js';
3
+ import type { MoniProgress } from './moni-progress.js';
4
+
5
+ describe('moni-progress', () => {
6
+ let el: MoniProgress;
7
+
8
+ beforeEach(() => {
9
+ el = document.createElement('moni-progress') as MoniProgress;
10
+ document.body.appendChild(el);
11
+ });
12
+
13
+ afterEach(() => {
14
+ el.remove();
15
+ });
16
+
17
+ it('renders a progress bar container', async () => {
18
+ await el.updateComplete;
19
+ const progress = el.shadowRoot?.querySelector('[role="progressbar"]');
20
+ expect(progress).toBeTruthy();
21
+ });
22
+
23
+ it('applies the indeterminate class to the progress bar container', async () => {
24
+ el.indeterminate = true;
25
+ await el.updateComplete;
26
+ const progress = el.shadowRoot?.querySelector('[role="progressbar"]');
27
+ expect(progress?.classList.contains('indeterminate')).toBe(true);
28
+ });
29
+
30
+ it('does not apply the indeterminate class by default', async () => {
31
+ await el.updateComplete;
32
+ const progress = el.shadowRoot?.querySelector('[role="progressbar"]');
33
+ expect(progress?.classList.contains('indeterminate')).toBe(false);
34
+ });
35
+
36
+ it('forwards value and max via aria attributes on progressbar', async () => {
37
+ el.value = 42;
38
+ el.max = 100;
39
+ await el.updateComplete;
40
+ const progress = el.shadowRoot?.querySelector(
41
+ '[role="progressbar"]'
42
+ ) as HTMLElement;
43
+ expect(progress.getAttribute('aria-valuenow')).toBe('42');
44
+ expect(progress.getAttribute('aria-valuemax')).toBe('100');
45
+ });
46
+
47
+ it('clamps the rendered percentage between 0 and 100', async () => {
48
+ el.value = 150;
49
+ el.max = 100;
50
+ await el.updateComplete;
51
+ const style = el.shadowRoot
52
+ ?.querySelector('[role="progressbar"]')
53
+ ?.getAttribute('style');
54
+ expect(style).toContain('--_p: 100');
55
+
56
+ el.value = -10;
57
+ await el.updateComplete;
58
+ const style2 = el.shadowRoot
59
+ ?.querySelector('[role="progressbar"]')
60
+ ?.getAttribute('style');
61
+ expect(style2).toContain('--_p: 0');
62
+ });
63
+
64
+ it('renders the progress-circular container for circular variant', async () => {
65
+ el.variant = 'circular';
66
+ await el.updateComplete;
67
+ const progress = el.shadowRoot?.querySelector('[role="progressbar"]');
68
+ expect(progress?.classList.contains('progress-circular')).toBe(true);
69
+ });
70
+
71
+ it('renders circle wavy for circular-wavy variant', async () => {
72
+ el.variant = 'circular-wavy';
73
+ await el.updateComplete;
74
+ const progress = el.shadowRoot?.querySelector('[role="progressbar"]');
75
+ expect(progress?.classList.contains('progress-circular')).toBe(true);
76
+ });
77
+
78
+ it('renders progress-wavy container for wavy variant', async () => {
79
+ el.variant = 'wavy';
80
+ await el.updateComplete;
81
+ const progress = el.shadowRoot?.querySelector('[role="progressbar"]');
82
+ expect(progress?.classList.contains('progress-wavy')).toBe(true);
83
+ });
84
+
85
+ it('reflects the size attribute', async () => {
86
+ el.size = 'large';
87
+ await el.updateComplete;
88
+ expect(el.getAttribute('size')).toBe('large');
89
+ });
90
+ });
@@ -0,0 +1,322 @@
1
+ import { html, css, svg, nothing } from 'lit';
2
+ import { customElement, property, state } from 'lit/decorators.js';
3
+ import { MoniElement, sharedStyles } from './_base/index.js';
4
+
5
+ /**
6
+ * Progress indicator that faithfully ports BeerCSS's progress styles.
7
+ *
8
+ * BeerCSS uses the native <progress> element with `::after`, `::before` and
9
+ * `mask-image` pseudo-elements. Those don't work inside Shadow DOM because:
10
+ * - `<progress>` native pseudo-elements (::webkit-progress-value, ::after)
11
+ * are blocked by the UA shadow root in Chrome/Firefox within a custom shadow.
12
+ * - `mask-image` on those pseudo-elements doesn't apply at all in shadows.
13
+ *
14
+ * Solution: use a plain <div> wrapper that replicates BeerCSS's visual rules
15
+ * exactly, and an SVG for the circular variant (matching BeerCSS's conic-gradient
16
+ * approach but with SVG stroke for better cross-browser support).
17
+ *
18
+ * Attributes:
19
+ * - value: 0..max (omit for indeterminate)
20
+ * - max: upper bound (default 100)
21
+ * - variant: linear (default) | circular | wavy | circular-wavy
22
+ * - size: small | medium (default) | large
23
+ * - indeterminate: present → infinite animation
24
+ */
25
+ @customElement('moni-progress')
26
+ export class MoniProgress extends MoniElement {
27
+ @property({ type: Number, reflect: true }) value = 0;
28
+ @property({ type: Number, reflect: true }) max = 100;
29
+ @property({ reflect: true })
30
+ variant: 'linear' | 'circular' | 'wavy' | 'circular-wavy' = 'linear';
31
+ @property({ reflect: true })
32
+ size: 'small' | 'medium' | 'large' = 'medium';
33
+ @property({ type: Boolean, reflect: true }) indeterminate = false;
34
+
35
+ /** Computed fill percentage (0-100) used in styles/SVG */
36
+ @state() private _pct = 0;
37
+
38
+ override willUpdate(changed: Map<string, unknown>) {
39
+ if (changed.has('value') || changed.has('max') || changed.has('indeterminate')) {
40
+ this._pct = this.indeterminate
41
+ ? 50
42
+ : Math.max(0, Math.min(100, (this.value / Math.max(1, this.max)) * 100));
43
+ }
44
+ }
45
+
46
+ static override styles = [
47
+ sharedStyles,
48
+ css`
49
+ /* ─── Keyframes — identical to BeerCSS ─── */
50
+ @keyframes to-linear-progress {
51
+ 0% { inset-inline-start: -50%; inline-size: 50%; }
52
+ 25% { inset-inline-start: 30%; inline-size: 60%; }
53
+ 100% { inset-inline-start: 110%; inline-size: 10%; }
54
+ }
55
+
56
+ @keyframes to-rotate {
57
+ 0% { transform: rotate(0deg); }
58
+ 100% { transform: rotate(360deg); }
59
+ }
60
+
61
+ :host {
62
+ --_size: 0.25rem;
63
+ --_circular-size: 2.5rem;
64
+ display: inline-flex;
65
+ align-items: center;
66
+ justify-content: center;
67
+ inline-size: 100%;
68
+ color: var(--primary);
69
+ }
70
+
71
+ :host([variant='circular']),
72
+ :host([variant='circular-wavy']) {
73
+ inline-size: var(--_circular-size);
74
+ block-size: var(--_circular-size);
75
+ }
76
+
77
+ :host([size='small']) { --_size: 0.25rem; --_circular-size: 1.5rem; }
78
+ :host([size='large']) { --_size: 0.45rem; --_circular-size: 3.5rem; }
79
+
80
+ /* ─── Linear / Wavy wrapper ─── */
81
+ .progress-linear {
82
+ position: relative;
83
+ inline-size: 100%;
84
+ block-size: var(--_size);
85
+ background-color: var(--active);
86
+ border-radius: 1rem;
87
+ overflow: hidden;
88
+ }
89
+
90
+ .progress-linear > .value {
91
+ position: absolute;
92
+ inset-block: 0;
93
+ inset-inline-start: 0;
94
+ inline-size: calc(var(--_p, 0) * 1%);
95
+ background-color: currentColor;
96
+ border-radius: inherit;
97
+ transition: inline-size var(--speed2) ease;
98
+ }
99
+
100
+ /* Indeterminate linear: sliding bar via absolute animation */
101
+ .progress-linear.indeterminate > .value {
102
+ inline-size: 50%;
103
+ animation: to-linear-progress 3.2s ease infinite;
104
+ transition: none;
105
+ }
106
+
107
+ /* ─── Wavy ─── */
108
+ .progress-wavy {
109
+ position: relative;
110
+ inline-size: 100%;
111
+ block-size: calc(var(--_size) * 2);
112
+ background: none;
113
+ overflow: visible;
114
+ }
115
+
116
+ /* Wavy uses an SVG filter for the wave shape */
117
+ .progress-wavy > svg {
118
+ position: absolute;
119
+ inset: 0;
120
+ inline-size: 100%;
121
+ block-size: 100%;
122
+ }
123
+
124
+ /* ─── Circular: SVG ─── */
125
+ .progress-circular {
126
+ inline-size: var(--_circular-size);
127
+ block-size: var(--_circular-size);
128
+ position: relative;
129
+ display: inline-flex;
130
+ align-items: center;
131
+ justify-content: center;
132
+ }
133
+
134
+ .progress-circular > svg {
135
+ inline-size: 100%;
136
+ block-size: 100%;
137
+ transform: rotate(-90deg);
138
+ }
139
+
140
+ .progress-circular.indeterminate {
141
+ animation: to-rotate 1s linear infinite;
142
+ }
143
+
144
+ .progress-circular .track {
145
+ fill: none;
146
+ stroke: var(--active);
147
+ stroke-width: 4;
148
+ }
149
+
150
+ .progress-circular .value {
151
+ fill: none;
152
+ stroke: currentColor;
153
+ stroke-width: 4;
154
+ stroke-linecap: round;
155
+ transition: stroke-dashoffset var(--speed2) ease;
156
+ }
157
+
158
+ /* Indeterminate circular: large visible arc that rotates */
159
+ .progress-circular.indeterminate .value {
160
+ stroke-dasharray: 80 100;
161
+ transition: none;
162
+ }
163
+
164
+ /* ─── part exposure ─── */
165
+ .progress-linear,
166
+ .progress-wavy,
167
+ .progress-circular {
168
+ flex: none;
169
+ }
170
+ `
171
+ ];
172
+
173
+ private _renderLinear() {
174
+ const isIndet = this.indeterminate;
175
+ return html`
176
+ <div
177
+ class="progress-linear${isIndet ? ' indeterminate' : ''}"
178
+ part="progress"
179
+ role="progressbar"
180
+ aria-valuenow=${isIndet ? nothing : this.value}
181
+ aria-valuemin="0"
182
+ aria-valuemax=${this.max}
183
+ style="--_p: ${this._pct};"
184
+ >
185
+ <div class="value"></div>
186
+ </div>
187
+ `;
188
+ }
189
+
190
+ private _renderWavy() {
191
+ // BeerCSS wavy uses an SVG mask. We replicate with an SVG clipPath wave.
192
+ const isIndet = this.indeterminate;
193
+ const w = 200;
194
+ const h = 8;
195
+ const fill = this.indeterminate ? 50 : this._pct;
196
+ const trackW = (w * 1).toFixed(1);
197
+ const fillW = ((w * fill) / 100).toFixed(1);
198
+ return html`
199
+ <div
200
+ class="progress-wavy"
201
+ part="progress"
202
+ role="progressbar"
203
+ aria-valuenow=${isIndet ? nothing : this.value}
204
+ aria-valuemin="0"
205
+ aria-valuemax=${this.max}
206
+ style="--_p: ${this._pct};"
207
+ >
208
+ <svg
209
+ xmlns="http://www.w3.org/2000/svg"
210
+ viewBox="0 0 ${w} ${h}"
211
+ preserveAspectRatio="none"
212
+ aria-hidden="true"
213
+ >
214
+ <!-- Track wave (background) -->
215
+ <path
216
+ d="M0,4 Q5,0 10,4 Q15,8 20,4 Q25,0 30,4 Q35,8 40,4 Q45,0 50,4 Q55,8 60,4 Q65,0 70,4 Q75,8 80,4 Q85,0 90,4 Q95,8 100,4 Q105,0 110,4 Q115,8 120,4 Q125,0 130,4 Q135,8 140,4 Q145,0 150,4 Q155,8 160,4 Q165,0 170,4 Q175,8 180,4 Q185,0 190,4 Q195,8 200,4"
217
+ fill="none"
218
+ stroke="var(--active)"
219
+ stroke-width="3"
220
+ />
221
+ <!-- Value wave (fill) — clipped to fill width -->
222
+ <clipPath id="wavy-clip-${this._instanceId}">
223
+ <rect x="0" y="0" width="${isIndet ? trackW : fillW}" height="${h}">
224
+ ${isIndet
225
+ ? svg`<animate
226
+ attributeName="x"
227
+ from="-${w}"
228
+ to="${w}"
229
+ dur="3.2s"
230
+ repeatCount="indefinite"
231
+ />`
232
+ : nothing}
233
+ </rect>
234
+ </clipPath>
235
+ <path
236
+ d="M0,4 Q5,0 10,4 Q15,8 20,4 Q25,0 30,4 Q35,8 40,4 Q45,0 50,4 Q55,8 60,4 Q65,0 70,4 Q75,8 80,4 Q85,0 90,4 Q95,8 100,4 Q105,0 110,4 Q115,8 120,4 Q125,0 130,4 Q135,8 140,4 Q145,0 150,4 Q155,8 160,4 Q165,0 170,4 Q175,8 180,4 Q185,0 190,4 Q195,8 200,4"
237
+ fill="none"
238
+ stroke="currentColor"
239
+ stroke-width="3"
240
+ clip-path="url(#wavy-clip-${this._instanceId})"
241
+ />
242
+ </svg>
243
+ </div>
244
+ `;
245
+ }
246
+
247
+ private _renderCircular(withWavy = false) {
248
+ const isIndet = this.indeterminate;
249
+ // SVG circle math: r=20, circumference = 2π*20 ≈ 125.66
250
+ const r = 20;
251
+ const circ = 2 * Math.PI * r;
252
+ const dashOffset = isIndet
253
+ ? circ * 0.5 // show ~50% arc for indeterminate
254
+ : circ * (1 - this._pct / 100);
255
+
256
+ return html`
257
+ <div
258
+ class="progress-circular${isIndet ? ' indeterminate' : ''}"
259
+ part="progress"
260
+ role="progressbar"
261
+ aria-valuenow=${isIndet ? nothing : this.value}
262
+ aria-valuemin="0"
263
+ aria-valuemax=${this.max}
264
+ >
265
+ <svg
266
+ xmlns="http://www.w3.org/2000/svg"
267
+ viewBox="0 0 48 48"
268
+ aria-hidden="true"
269
+ >
270
+ ${withWavy
271
+ ? svg`
272
+ <!-- Circular wavy uses a scalloped clip path to emulate BeerCSS wavy-circle mask -->
273
+ <defs>
274
+ <clipPath id="wavy-circle-clip-${this._instanceId}">
275
+ <path d="M24,4 Q28,2 32,4 Q36,2 40,4 Q44,6 44,10 Q46,14 44,18 Q46,22 44,26 Q46,30 44,34 Q44,38 40,40 Q36,44 32,44 Q28,46 24,44 Q20,46 16,44 Q12,44 8,40 Q4,38 4,34 Q2,30 4,26 Q2,22 4,18 Q2,14 4,10 Q4,6 8,4 Q12,2 16,4 Q20,2 24,4Z"/>
276
+ </clipPath>
277
+ </defs>
278
+ <circle class="track" cx="24" cy="24" r="${r}" clip-path="url(#wavy-circle-clip-${this._instanceId})"/>
279
+ <circle
280
+ class="value"
281
+ cx="24" cy="24" r="${r}"
282
+ stroke-dasharray="${isIndet ? `${circ * 0.5} ${circ * 0.5}` : `${circ - dashOffset} ${dashOffset}`}"
283
+ stroke-dashoffset="0"
284
+ clip-path="url(#wavy-circle-clip-${this._instanceId})"
285
+ />`
286
+ : svg`
287
+ <circle class="track" cx="24" cy="24" r="${r}"/>
288
+ <circle
289
+ class="value"
290
+ cx="24" cy="24" r="${r}"
291
+ stroke-dasharray="${isIndet ? `${circ * 0.5} ${circ * 0.5}` : `${circ - dashOffset} ${dashOffset}`}"
292
+ stroke-dashoffset="0"
293
+ />`}
294
+ </svg>
295
+ </div>
296
+ `;
297
+ }
298
+
299
+ /** Unique ID per instance for SVG clipPath IDs */
300
+ private readonly _instanceId = Math.random().toString(36).slice(2, 8);
301
+
302
+ override render() {
303
+ switch (this.variant) {
304
+ case 'circular':
305
+ return this._renderCircular(false);
306
+ case 'circular-wavy':
307
+ return this._renderCircular(true);
308
+ case 'wavy':
309
+ return this._renderWavy();
310
+ default:
311
+ return this._renderLinear();
312
+ }
313
+ }
314
+ }
315
+
316
+ declare global {
317
+ interface HTMLElementTagNameMap {
318
+ 'moni-progress': MoniProgress;
319
+ }
320
+ }
321
+
322
+ export default MoniProgress;
@@ -0,0 +1,86 @@
1
+ import { describe, it, expect, beforeEach, afterEach } from 'vitest';
2
+ import './moni-radio.js';
3
+ import type { MoniRadio } from './moni-radio.js';
4
+
5
+ describe('moni-radio', () => {
6
+ let el: MoniRadio;
7
+
8
+ beforeEach(() => {
9
+ el = document.createElement('moni-radio') as MoniRadio;
10
+ document.body.appendChild(el);
11
+ });
12
+
13
+ afterEach(() => {
14
+ el.remove();
15
+ });
16
+
17
+ it('renders an input and a span for visual styling', async () => {
18
+ await el.updateComplete;
19
+ const input = el.shadowRoot?.querySelector('input');
20
+ const span = el.shadowRoot?.querySelector('span');
21
+ expect(input).toBeTruthy();
22
+ expect(span).toBeTruthy();
23
+ });
24
+
25
+ it('forwards checked state to the input', async () => {
26
+ el.checked = true;
27
+ await el.updateComplete;
28
+ const input = el.shadowRoot?.querySelector(
29
+ 'input'
30
+ ) as HTMLInputElement;
31
+ expect(input.checked).toBe(true);
32
+
33
+ el.checked = false;
34
+ await el.updateComplete;
35
+ expect(input.checked).toBe(false);
36
+ });
37
+
38
+ it('input is contained in the label (for click handling)', async () => {
39
+ await el.updateComplete;
40
+ const input = el.shadowRoot?.querySelector(
41
+ 'input'
42
+ ) as HTMLInputElement;
43
+ const label = el.shadowRoot?.querySelector('label');
44
+ expect(label?.contains(input)).toBe(true);
45
+ });
46
+
47
+ it('renders a label span when label attribute is set', async () => {
48
+ el.label = 'Option A';
49
+ await el.updateComplete;
50
+ const span = el.shadowRoot?.querySelector('span');
51
+ expect(span?.textContent?.trim()).toBe('Option A');
52
+ });
53
+
54
+ it('forwards disabled to the input', async () => {
55
+ el.disabled = true;
56
+ await el.updateComplete;
57
+ const input = el.shadowRoot?.querySelector(
58
+ 'input'
59
+ ) as HTMLInputElement;
60
+ expect(input.disabled).toBe(true);
61
+ });
62
+
63
+ it('reflects the checked attribute', async () => {
64
+ el.checked = true;
65
+ await el.updateComplete;
66
+ expect(el.hasAttribute('checked')).toBe(true);
67
+ });
68
+
69
+ it('forwards name to the input', async () => {
70
+ el.name = 'group1';
71
+ await el.updateComplete;
72
+ const input = el.shadowRoot?.querySelector(
73
+ 'input'
74
+ ) as HTMLInputElement;
75
+ expect(input.name).toBe('group1');
76
+ });
77
+
78
+ it('forwards value to the input', async () => {
79
+ el.value = 'a';
80
+ await el.updateComplete;
81
+ const input = el.shadowRoot?.querySelector(
82
+ 'input'
83
+ ) as HTMLInputElement;
84
+ expect(input.value).toBe('a');
85
+ });
86
+ });
@@ -0,0 +1,196 @@
1
+ import { html, css } from 'lit';
2
+ import { customElement, property, query } from 'lit/decorators.js';
3
+ import { ifDefined } from 'lit/directives/if-defined.js';
4
+ import { live } from 'lit/directives/live.js';
5
+ import { MoniElement, sharedStyles } from './_base/index.js';
6
+
7
+ /**
8
+ * Radio that faithfully ports BeerCSS's `.radio` styles.
9
+ *
10
+ * BeerCSS architecture:
11
+ * - `.radio` is inline-flex, aligns items center
12
+ * - `input` has width/height = --_size, opacity: 0 (real layout space, not absolute)
13
+ * - `span::before` shows "radio_button_unchecked" / "radio_button_checked" via Material Symbols font
14
+ * - `span::after` is the ripple hover effect
15
+ *
16
+ * Attributes:
17
+ * - label: text label
18
+ * - checked: present
19
+ * - disabled: present
20
+ * - size: small | medium (default) | large | extra
21
+ * - name: forwarded to input.name (group radios by name)
22
+ * - value: forwarded to input.value
23
+ */
24
+ @customElement('moni-radio')
25
+ export class MoniRadio extends MoniElement {
26
+ @property({ reflect: true }) label = '';
27
+ @property({ type: Boolean, reflect: true }) checked = false;
28
+ @property({ type: Boolean, reflect: true }) disabled = false;
29
+ @property({ reflect: true })
30
+ size: 'small' | 'medium' | 'large' | 'extra' = 'medium';
31
+ @property({ reflect: true }) name = '';
32
+ @property({ reflect: true }) value = '';
33
+
34
+ @query('input') private _input!: HTMLInputElement;
35
+
36
+ override updated(changed: Map<string, unknown>) {
37
+ if (this._input) {
38
+ if (changed.has('checked')) this._input.checked = this.checked;
39
+ if (changed.has('disabled')) this._input.disabled = this.disabled;
40
+ }
41
+ }
42
+
43
+ static override styles = [
44
+ sharedStyles,
45
+ css`
46
+ :host {
47
+ --_size: 1.5rem;
48
+ display: inline-flex;
49
+ font-family: var(--font);
50
+ }
51
+ :host([size='small']) { --_size: 1rem; }
52
+ :host([size='large']) { --_size: 2rem; }
53
+ :host([size='extra']) { --_size: 2.5rem; }
54
+
55
+ /* BeerCSS .radio */
56
+ label {
57
+ inline-size: auto;
58
+ block-size: auto;
59
+ line-height: normal;
60
+ white-space: nowrap;
61
+ cursor: pointer;
62
+ display: inline-flex;
63
+ align-items: center;
64
+ }
65
+
66
+ /* BeerCSS: input has real size, opacity 0 */
67
+ input {
68
+ inline-size: var(--_size);
69
+ block-size: var(--_size);
70
+ opacity: 0;
71
+ cursor: pointer;
72
+ flex: none;
73
+ }
74
+
75
+ /* BeerCSS: span wraps visible indicator + label */
76
+ span {
77
+ display: inline-flex;
78
+ align-items: center;
79
+ color: var(--on-surface);
80
+ font-size: 0.875rem;
81
+ position: relative;
82
+ }
83
+
84
+ /* BeerCSS: span::before = radio icon (overlaid on input via negative inset) */
85
+ span::before {
86
+ --_size: inherit;
87
+ content: 'radio_button_unchecked';
88
+ inline-size: var(--_size);
89
+ block-size: var(--_size);
90
+ box-sizing: border-box;
91
+ margin: 0 auto;
92
+ outline: none;
93
+ color: var(--on-surface-variant);
94
+ position: absolute;
95
+ inset: auto auto auto calc(var(--_size) * -1);
96
+ border-radius: 50%;
97
+ user-select: none;
98
+ z-index: 1;
99
+ font-family: var(--font-icon);
100
+ font-size: var(--_size);
101
+ display: flex;
102
+ align-items: center;
103
+ justify-content: center;
104
+ }
105
+
106
+ /* Checked: filled radio icon */
107
+ input:checked + span::before {
108
+ content: 'radio_button_checked';
109
+ color: var(--primary);
110
+ }
111
+
112
+ /* BeerCSS: span::after = hover ripple */
113
+ span::after {
114
+ --_size: inherit;
115
+ content: '';
116
+ inline-size: var(--_size);
117
+ block-size: var(--_size);
118
+ box-sizing: border-box;
119
+ margin: 0 auto;
120
+ position: absolute;
121
+ inset: auto auto auto calc(var(--_size) * -1);
122
+ border-radius: 50%;
123
+ user-select: none;
124
+ transition: all var(--speed1);
125
+ background-color: currentColor;
126
+ box-shadow: 0 0 0 0 currentColor;
127
+ opacity: 0;
128
+ }
129
+
130
+ label:hover > input:not(:disabled) + span::after,
131
+ input:not(:disabled):focus + span::after {
132
+ box-shadow: 0 0 0 0.5rem currentColor;
133
+ opacity: 0.1;
134
+ }
135
+
136
+ /* Label padding */
137
+ span.has-label {
138
+ padding-inline-start: 0.25rem;
139
+ }
140
+
141
+ /* Disabled */
142
+ input:disabled + span {
143
+ opacity: 0.5;
144
+ cursor: not-allowed;
145
+ }
146
+
147
+ /* Focus ring */
148
+ input:focus-visible + span::before {
149
+ outline: 0.125rem solid var(--primary);
150
+ outline-offset: 0.375rem;
151
+ }
152
+ `
153
+ ];
154
+
155
+ private _onChange(e: Event) {
156
+ this.checked = (e.target as HTMLInputElement).checked;
157
+ if (this.checked && this.name) {
158
+ const root = this.getRootNode() as Document | ShadowRoot;
159
+ if (root) {
160
+ const siblings = root.querySelectorAll(`moni-radio[name="${this.name}"]`);
161
+ siblings.forEach((sibling) => {
162
+ if (sibling !== this && sibling instanceof MoniRadio) {
163
+ sibling.checked = false;
164
+ }
165
+ });
166
+ }
167
+ }
168
+ this.dispatchEvent(new Event('change', { bubbles: true, composed: true }));
169
+ }
170
+
171
+ override render() {
172
+ return html`<label part="radio">
173
+ <input
174
+ type="radio"
175
+ .checked=${live(this.checked)}
176
+ ?disabled=${this.disabled}
177
+ name=${ifDefined(this.name || undefined)}
178
+ value=${ifDefined(this.value || undefined)}
179
+ @change=${this._onChange}
180
+ />
181
+ <span class=${this.label ? 'has-label' : ''}>
182
+ ${this.label
183
+ ? html`${this.label}`
184
+ : html`<slot></slot>`}
185
+ </span>
186
+ </label>`;
187
+ }
188
+ }
189
+
190
+ declare global {
191
+ interface HTMLElementTagNameMap {
192
+ 'moni-radio': MoniRadio;
193
+ }
194
+ }
195
+
196
+ export default MoniRadio;