@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,800 @@
1
+ import { html, css, PropertyValues } from 'lit';
2
+ import { customElement, property, state, query } from 'lit/decorators.js';
3
+ import { MoniElement, sharedStyles } from './_base/index.js';
4
+ import './moni-icon.js';
5
+ import './moni-button.js';
6
+
7
+ /**
8
+ * Material Design 3 Time Picker Component.
9
+ * Supports interactive clock face (dial) and manual keyboard input.
10
+ *
11
+ * Attributes:
12
+ * - value: Time value in "HH:MM" 24h format (default "00:00")
13
+ * - use24Hour: If true, uses 24-hour mode without AM/PM toggle (default false)
14
+ * - mode: "dial" | "input" (default "dial")
15
+ *
16
+ * Events:
17
+ * - change: Fired when value changes (detail: { value })
18
+ * - cancel: Fired when cancel button is clicked
19
+ * - ok: Fired when OK button is clicked (detail: { value })
20
+ */
21
+ @customElement('moni-time-picker')
22
+ export class MoniTimePicker extends MoniElement {
23
+ @property({ reflect: true }) value = '00:00';
24
+ @property({ type: Boolean, reflect: true, attribute: 'use-24-hour' }) use24Hour = false;
25
+ @property({ reflect: true }) mode: 'dial' | 'input' = 'dial';
26
+ @property({ reflect: true }) orientation: 'vertical' | 'horizontal' | 'auto' = 'auto';
27
+
28
+ @state() private activeSelection: 'hour' | 'minute' = 'hour';
29
+ @state() private period: 'AM' | 'PM' = 'AM';
30
+
31
+ @state() private currentHour = 0; // 0-23
32
+ @state() private currentMinute = 0; // 0-59
33
+
34
+ @query('.clock-face') private clockFaceEl?: HTMLDivElement;
35
+
36
+ private isDragging = false;
37
+
38
+ protected override willUpdate(changedProperties: PropertyValues) {
39
+ if (changedProperties.has('value') || changedProperties.has('use24Hour')) {
40
+ this.parseValue();
41
+ }
42
+ }
43
+
44
+ private parseValue() {
45
+ const parts = this.value.split(':');
46
+ let h = parseInt(parts[0], 10);
47
+ let m = parseInt(parts[1], 10);
48
+
49
+ if (isNaN(h) || h < 0 || h > 23) h = 0;
50
+ if (isNaN(m) || m < 0 || m > 59) m = 0;
51
+
52
+ this.currentHour = h;
53
+ this.currentMinute = m;
54
+
55
+ if (!this.use24Hour) {
56
+ if (h >= 12) {
57
+ this.period = 'PM';
58
+ } else {
59
+ this.period = 'AM';
60
+ }
61
+ }
62
+ }
63
+
64
+ private updateValue() {
65
+ let h = this.currentHour;
66
+ const m = this.currentMinute;
67
+
68
+ if (!this.use24Hour) {
69
+ if (this.period === 'PM') {
70
+ if (h < 12) h += 12;
71
+ } else {
72
+ if (h === 12) h = 0;
73
+ else if (h > 12) h -= 12; // Adjust if out of bounds
74
+ }
75
+ }
76
+
77
+ const formattedHour = String(h).padStart(2, '0');
78
+ const formattedMinute = String(m).padStart(2, '0');
79
+ this.value = `${formattedHour}:${formattedMinute}`;
80
+
81
+ this.dispatchEvent(new CustomEvent('change', {
82
+ detail: { value: this.value },
83
+ bubbles: true,
84
+ composed: true
85
+ }));
86
+ }
87
+
88
+ private toggleMode() {
89
+ this.mode = this.mode === 'dial' ? 'input' : 'dial';
90
+ }
91
+
92
+ private setSelection(type: 'hour' | 'minute') {
93
+ this.activeSelection = type;
94
+ }
95
+
96
+ private setPeriod(p: 'AM' | 'PM') {
97
+ this.period = p;
98
+ this.updateValue();
99
+ }
100
+
101
+ // Clock Math and Interaction
102
+ private handleClockPointerDown(e: PointerEvent) {
103
+ if (!this.clockFaceEl) return;
104
+ this.isDragging = true;
105
+ this.clockFaceEl.classList.add('dragging');
106
+ this.clockFaceEl.setPointerCapture(e.pointerId);
107
+ this.handleClockPointerMove(e);
108
+ }
109
+
110
+ private handleClockPointerMove(e: PointerEvent) {
111
+ if (!this.isDragging || !this.clockFaceEl) return;
112
+ const rect = this.clockFaceEl.getBoundingClientRect();
113
+ const centerX = rect.left + rect.width / 2;
114
+ const centerY = rect.top + rect.height / 2;
115
+
116
+ const dx = e.clientX - centerX;
117
+ const dy = e.clientY - centerY;
118
+ const distance = Math.sqrt(dx * dx + dy * dy);
119
+
120
+ // Calculate angle in degrees from 12 o'clock position (clockwise)
121
+ let angle = Math.atan2(dy, dx) * (180 / Math.PI) + 90;
122
+ if (angle < 0) angle += 360;
123
+
124
+ if (this.activeSelection === 'hour') {
125
+ if (this.use24Hour) {
126
+ // Outer circle for 13-00, inner circle for 1-12
127
+ const isInner = distance < rect.width * 0.32;
128
+ let hour = Math.round(angle / 30) % 12;
129
+ if (hour === 0) hour = 12;
130
+
131
+ if (isInner) {
132
+ // Inner circle: 1 to 12
133
+ this.currentHour = hour;
134
+ } else {
135
+ // Outer circle: 13 to 00/24
136
+ this.currentHour = hour === 12 ? 0 : hour + 12;
137
+ }
138
+ } else {
139
+ // 12-hour face: 1 to 12
140
+ let hour = Math.round(angle / 30) % 12;
141
+ if (hour === 0) hour = 12;
142
+ this.currentHour = hour;
143
+ }
144
+ } else {
145
+ // Minutes: 0 to 59
146
+ const minute = Math.round(angle / 6) % 60;
147
+ this.currentMinute = minute;
148
+ }
149
+
150
+ this.updateValue();
151
+ }
152
+
153
+ private handleClockPointerUp() {
154
+ if (this.isDragging) {
155
+ this.isDragging = false;
156
+ this.clockFaceEl?.classList.remove('dragging');
157
+ if (this.activeSelection === 'hour') {
158
+ // Automatically switch to minute selection after choosing hour
159
+ setTimeout(() => {
160
+ this.activeSelection = 'minute';
161
+ }, 300);
162
+ }
163
+ }
164
+ }
165
+
166
+ private handleHourInputChange(e: Event) {
167
+ const target = e.target as HTMLInputElement;
168
+ let val = parseInt(target.value, 10);
169
+ if (isNaN(val)) val = 0;
170
+
171
+ if (this.use24Hour) {
172
+ if (val < 0) val = 0;
173
+ if (val > 23) val = 23;
174
+ this.currentHour = val;
175
+ } else {
176
+ if (val < 1) val = 1;
177
+ if (val > 12) val = 12;
178
+ this.currentHour = val;
179
+ }
180
+ this.updateValue();
181
+ }
182
+
183
+ private handleMinuteInputChange(e: Event) {
184
+ const target = e.target as HTMLInputElement;
185
+ let val = parseInt(target.value, 10);
186
+ if (isNaN(val)) val = 0;
187
+ if (val < 0) val = 0;
188
+ if (val > 59) val = 59;
189
+ this.currentMinute = val;
190
+ this.updateValue();
191
+ }
192
+
193
+
194
+
195
+ static override styles = [
196
+ sharedStyles,
197
+ css`
198
+ :host {
199
+ display: inline-flex;
200
+ flex-direction: column;
201
+ background-color: transparent;
202
+ inline-size: 20.5rem;
203
+ color: var(--on-surface);
204
+ font-family: var(--font);
205
+ user-select: none;
206
+ }
207
+
208
+ /* Forced orientations */
209
+ :host([orientation="vertical"]) {
210
+ inline-size: 20.5rem;
211
+ }
212
+ :host([orientation="vertical"]) .main-content {
213
+ flex-direction: column;
214
+ }
215
+
216
+ :host([orientation="horizontal"]) {
217
+ inline-size: auto;
218
+ }
219
+ :host([orientation="horizontal"]) .main-content {
220
+ flex-direction: row;
221
+ align-items: center;
222
+ gap: 2rem;
223
+ }
224
+ :host([orientation="horizontal"]) .left-pane {
225
+ display: flex;
226
+ flex-direction: column;
227
+ justify-content: center;
228
+ }
229
+
230
+ /* Main Content (Default vertical) */
231
+ .main-content {
232
+ display: flex;
233
+ flex-direction: column;
234
+ gap: 1rem;
235
+ }
236
+
237
+ /* Auto Responsive Layout */
238
+ @media (min-width: 32rem) {
239
+ :host([orientation="auto"]) .main-content,
240
+ :host(:not([orientation])) .main-content {
241
+ flex-direction: row;
242
+ align-items: center;
243
+ gap: 2rem;
244
+ }
245
+ :host([orientation="auto"]),
246
+ :host(:not([orientation])) {
247
+ inline-size: auto;
248
+ }
249
+ :host([orientation="auto"]) .left-pane,
250
+ :host(:not([orientation])) .left-pane {
251
+ display: flex;
252
+ flex-direction: column;
253
+ justify-content: center;
254
+ }
255
+ }
256
+
257
+ @keyframes fadeInScale {
258
+ from {
259
+ opacity: 0;
260
+ transform: scale(0.92);
261
+ }
262
+ to {
263
+ opacity: 1;
264
+ transform: scale(1);
265
+ }
266
+ }
267
+
268
+ .clock-container,
269
+ .time-display-container,
270
+ .input-labels,
271
+ .display-box {
272
+ animation: fadeInScale var(--speed3) var(--ease-standard) forwards;
273
+ }
274
+
275
+ .picker-header {
276
+ font-size: 0.75rem;
277
+ font-weight: 500;
278
+ margin-bottom: 1.25rem;
279
+ color: var(--on-surface-variant);
280
+ text-transform: uppercase;
281
+ letter-spacing: 0.1em;
282
+ }
283
+
284
+ /* Display Panel (Time box inputs/views) */
285
+ .time-display-container {
286
+ display: flex;
287
+ align-items: center;
288
+ justify-content: space-between;
289
+ margin-bottom: 1.5rem;
290
+ gap: 0.75rem;
291
+ }
292
+
293
+ .time-display {
294
+ display: flex;
295
+ align-items: center;
296
+ flex: 1;
297
+ background-color: transparent;
298
+ }
299
+
300
+ .display-box {
301
+ display: flex;
302
+ align-items: center;
303
+ justify-content: center;
304
+ width: 6rem;
305
+ height: 5rem;
306
+ border-radius: 0.5rem;
307
+ background-color: var(--surface-container-highest);
308
+ font-size: 3.5rem;
309
+ font-weight: 400;
310
+ color: var(--on-surface);
311
+ cursor: pointer;
312
+ transition: background-color var(--speed2);
313
+ border: 0.125rem solid transparent;
314
+ text-align: center;
315
+ }
316
+
317
+ :host([use-24-hour]) .display-box {
318
+ width: 7.125rem;
319
+ }
320
+
321
+ .display-box:hover:not(.active) {
322
+ background-color: var(--active);
323
+ }
324
+
325
+ .display-box.active {
326
+ background-color: var(--primary-container);
327
+ color: var(--on-primary-container);
328
+ border-color: var(--primary);
329
+ }
330
+
331
+ .display-box input {
332
+ width: 100%;
333
+ height: 100%;
334
+ border: none;
335
+ background: transparent;
336
+ text-align: center;
337
+ font-size: inherit;
338
+ font-family: inherit;
339
+ color: inherit;
340
+ outline: none;
341
+ padding: 0;
342
+ }
343
+
344
+ /* Remove input spinners */
345
+ .display-box input::-webkit-outer-spin-button,
346
+ .display-box input::-webkit-inner-spin-button {
347
+ -webkit-appearance: none;
348
+ margin: 0;
349
+ }
350
+ .display-box input[type=number] {
351
+ -moz-appearance: textfield;
352
+ }
353
+
354
+ .separator {
355
+ font-size: 3rem;
356
+ font-weight: 400;
357
+ color: var(--on-surface);
358
+ width: 1.5rem;
359
+ text-align: center;
360
+ line-height: 5rem;
361
+ }
362
+
363
+ /* AM/PM Toggle */
364
+ .ampm-toggle {
365
+ display: flex;
366
+ flex-direction: column;
367
+ border: 0.0625rem solid var(--outline);
368
+ border-radius: 0.5rem;
369
+ overflow: hidden;
370
+ height: 5rem;
371
+ width: 3.25rem;
372
+ }
373
+
374
+ .ampm-btn {
375
+ flex: 1;
376
+ background-color: transparent;
377
+ border: none;
378
+ font-size: 0.875rem;
379
+ font-weight: 500;
380
+ color: var(--on-surface-variant);
381
+ cursor: pointer;
382
+ transition: background-color var(--speed1), color var(--speed1);
383
+ }
384
+
385
+ .ampm-btn.active {
386
+ background-color: var(--tertiary-container);
387
+ color: var(--on-tertiary-container);
388
+ }
389
+
390
+ .ampm-btn:first-child {
391
+ border-bottom: 0.0625rem solid var(--outline);
392
+ }
393
+
394
+ /* Clock Face */
395
+ .clock-container {
396
+ display: flex;
397
+ justify-content: center;
398
+ align-items: center;
399
+ margin-block: 0.5rem 1.5rem;
400
+ }
401
+
402
+ .clock-face {
403
+ position: relative;
404
+ width: 16rem;
405
+ height: 16rem;
406
+ border-radius: 50%;
407
+ background-color: var(--surface-container-highest);
408
+ touch-action: none;
409
+ cursor: pointer;
410
+ }
411
+
412
+ /* Center dot */
413
+ .clock-center {
414
+ position: absolute;
415
+ left: calc(50% - 0.25rem);
416
+ top: calc(50% - 0.25rem);
417
+ width: 0.5rem;
418
+ height: 0.5rem;
419
+ border-radius: 50%;
420
+ background-color: var(--primary);
421
+ }
422
+
423
+ /* Clock hand line */
424
+ .clock-hand {
425
+ position: absolute;
426
+ left: calc(50% - 0.0625rem);
427
+ bottom: 50%;
428
+ width: 0.125rem;
429
+ background-color: var(--primary);
430
+ transform-origin: bottom center;
431
+ z-index: 1;
432
+ pointer-events: none;
433
+ transition: transform var(--speed3) var(--ease-standard), height var(--speed3) var(--ease-standard);
434
+ }
435
+
436
+ /* Hand tip circle selection inside the hand */
437
+ .clock-hand-selector {
438
+ position: absolute;
439
+ top: 0;
440
+ left: 50%;
441
+ width: 3rem;
442
+ height: 3rem;
443
+ border-radius: 50%;
444
+ background-color: var(--primary);
445
+ opacity: 0.3;
446
+ transform: translate(-50%, -50%) scale(1);
447
+ z-index: 1;
448
+ pointer-events: none;
449
+ transition: transform var(--speed2) var(--ease-standard);
450
+ }
451
+
452
+ /* Disable transition during active drag but keep scale transform animation */
453
+ .clock-face.dragging .clock-hand,
454
+ .clock-face:active .clock-hand {
455
+ transition: none !important;
456
+ }
457
+
458
+ /* Selector handle expands/grows when pressed or dragging */
459
+ .clock-face.dragging .clock-hand-selector,
460
+ .clock-face:active .clock-hand-selector {
461
+ transform: translate(-50%, -50%) scale(1.2);
462
+ }
463
+
464
+ .clock-hand-dot {
465
+ position: absolute;
466
+ left: calc(50% - 0.25rem);
467
+ top: -2rem;
468
+ width: 0.5rem;
469
+ height: 0.5rem;
470
+ border-radius: 50%;
471
+ background-color: var(--on-primary);
472
+ z-index: 2;
473
+ pointer-events: none;
474
+ }
475
+
476
+ @keyframes numberEntrance {
477
+ from {
478
+ opacity: 0;
479
+ transform: translate(-50%, -50%) scale(0.85);
480
+ }
481
+ to {
482
+ opacity: 1;
483
+ transform: translate(-50%, -50%) scale(1);
484
+ }
485
+ }
486
+
487
+ /* Clock dial numbers */
488
+ .clock-number {
489
+ position: absolute;
490
+ width: 2.25rem;
491
+ height: 2.25rem;
492
+ display: flex;
493
+ align-items: center;
494
+ justify-content: center;
495
+ font-size: 0.875rem;
496
+ font-weight: 500;
497
+ color: var(--on-surface);
498
+ border-radius: 50%;
499
+ transform: translate(-50%, -50%);
500
+ transition: background-color var(--speed2), color var(--speed2);
501
+ z-index: 2;
502
+ pointer-events: auto;
503
+ cursor: pointer;
504
+ animation: numberEntrance var(--speed3) var(--ease-standard) forwards;
505
+ }
506
+
507
+ .clock-number:hover {
508
+ background-color: var(--active);
509
+ }
510
+
511
+ .clock-number.selected {
512
+ background-color: var(--primary);
513
+ color: var(--on-primary);
514
+ font-weight: bold;
515
+ }
516
+
517
+ .clock-number.selected:hover {
518
+ background-color: var(--primary);
519
+ }
520
+
521
+ /* Manual Input Mode specific styling */
522
+ .input-labels {
523
+ display: flex;
524
+ justify-content: space-between;
525
+ gap: 0.75rem;
526
+ margin-top: -1rem;
527
+ margin-bottom: 1.5rem;
528
+ color: var(--on-surface-variant);
529
+ font-size: 0.75rem;
530
+ font-weight: 400;
531
+ padding-inline-end: 4rem; /* Leave room for AM/PM offset */
532
+ }
533
+
534
+ .input-labels > span {
535
+ flex: 1;
536
+ text-align: center;
537
+ }
538
+
539
+ /* Bottom bar */
540
+ .bottom-actions {
541
+ display: flex;
542
+ justify-content: space-between;
543
+ align-items: center;
544
+ }
545
+
546
+ .mode-toggle-btn {
547
+ background: none;
548
+ border: none;
549
+ color: var(--primary);
550
+ cursor: pointer;
551
+ padding: 0.5rem;
552
+ display: flex;
553
+ align-items: center;
554
+ justify-content: center;
555
+ border-radius: 50%;
556
+ transition: background-color var(--speed1);
557
+ }
558
+
559
+ .mode-toggle-btn:hover {
560
+ background-color: var(--active);
561
+ }
562
+
563
+ .action-buttons {
564
+ display: flex;
565
+ gap: 0.5rem;
566
+ }
567
+ `
568
+ ];
569
+
570
+ private renderDialClockFace() {
571
+ const isHour = this.activeSelection === 'hour';
572
+ let degrees = 0;
573
+ let handLength = '6.25rem';
574
+
575
+ if (isHour) {
576
+ let h = this.currentHour;
577
+ if (!this.use24Hour) {
578
+ if (h > 12) h -= 12;
579
+ if (h === 0) h = 12;
580
+ degrees = h * 30;
581
+ } else {
582
+ // 24 hour mode
583
+ if (h > 12 || h === 0) {
584
+ // Outer circle: 13-00
585
+ const outerHour = h === 0 ? 12 : h > 12 ? h - 12 : h;
586
+ degrees = outerHour * 30;
587
+ handLength = '6.5rem';
588
+ } else {
589
+ // Inner circle: 1-12
590
+ degrees = h * 30;
591
+ handLength = '4.5rem';
592
+ }
593
+ }
594
+ } else {
595
+ degrees = this.currentMinute * 6;
596
+ }
597
+
598
+ // Calculate numbers placement
599
+ const numbers: { val: number; label: string; x: string; y: string; selected: boolean }[] = [];
600
+ const r = 16 * 16; // 16rem = 256px
601
+ const center = r / 2;
602
+
603
+ if (isHour) {
604
+ if (this.use24Hour) {
605
+ // Outer circle: 13-00
606
+ const outerRadius = center - 24;
607
+ for (let i = 1; i <= 12; i++) {
608
+ const hVal = i === 12 ? 0 : i + 12;
609
+ const angle = (i * 30 - 90) * (Math.PI / 180);
610
+ const x = center + outerRadius * Math.cos(angle);
611
+ const y = center + outerRadius * Math.sin(angle);
612
+ numbers.push({
613
+ val: hVal,
614
+ label: String(hVal === 0 ? '00' : hVal),
615
+ x: `${x / 16}rem`,
616
+ y: `${y / 16}rem`,
617
+ selected: this.currentHour === hVal
618
+ });
619
+ }
620
+
621
+ // Inner circle: 1-12
622
+ const innerRadius = center - 56;
623
+ for (let i = 1; i <= 12; i++) {
624
+ const angle = (i * 30 - 90) * (Math.PI / 180);
625
+ const x = center + innerRadius * Math.cos(angle);
626
+ const y = center + innerRadius * Math.sin(angle);
627
+ numbers.push({
628
+ val: i,
629
+ label: String(i),
630
+ x: `${x / 16}rem`,
631
+ y: `${y / 16}rem`,
632
+ selected: this.currentHour === i
633
+ });
634
+ }
635
+ } else {
636
+ // 12-hour: 1-12
637
+ const radius = center - 28;
638
+ for (let i = 1; i <= 12; i++) {
639
+ const angle = (i * 30 - 90) * (Math.PI / 180);
640
+ const x = center + radius * Math.cos(angle);
641
+ const y = center + radius * Math.sin(angle);
642
+ let hVal = this.currentHour;
643
+ if (hVal > 12) hVal -= 12;
644
+ if (hVal === 0) hVal = 12;
645
+ numbers.push({
646
+ val: i,
647
+ label: String(i),
648
+ x: `${x / 16}rem`,
649
+ y: `${y / 16}rem`,
650
+ selected: hVal === i
651
+ });
652
+ }
653
+ }
654
+ } else {
655
+ // Minutes: 0, 5, 10... 55
656
+ const radius = center - 28;
657
+ for (let i = 0; i < 12; i++) {
658
+ const mVal = i * 5;
659
+ const angle = (i * 30 - 90) * (Math.PI / 180);
660
+ const x = center + radius * Math.cos(angle);
661
+ const y = center + radius * Math.sin(angle);
662
+ numbers.push({
663
+ val: mVal,
664
+ label: String(mVal).padStart(2, '0'),
665
+ x: `${x / 16}rem`,
666
+ y: `${y / 16}rem`,
667
+ selected: this.currentMinute === mVal
668
+ });
669
+ }
670
+ }
671
+
672
+ return html`
673
+ <div class="clock-container">
674
+ <div
675
+ class="clock-face"
676
+ @pointerdown=${this.handleClockPointerDown}
677
+ @pointermove=${this.handleClockPointerMove}
678
+ @pointerup=${this.handleClockPointerUp}
679
+ @pointercancel=${this.handleClockPointerUp}
680
+ >
681
+ <div class="clock-center"></div>
682
+ <div
683
+ class="clock-hand"
684
+ style="transform: rotate(${degrees}deg); height: ${handLength};"
685
+ >
686
+ <div class="clock-hand-selector"></div>
687
+ ${isHour && this.use24Hour && this.currentHour <= 12 && this.currentHour > 0
688
+ ? html`<div class="clock-hand-dot"></div>`
689
+ : ''}
690
+ </div>
691
+ ${numbers.map(
692
+ (n) => html`
693
+ <div
694
+ class="clock-number ${n.selected ? 'selected' : ''}"
695
+ style="left: ${n.x}; top: ${n.y};"
696
+ >
697
+ ${n.label}
698
+ </div>
699
+ `
700
+ )}
701
+ </div>
702
+ </div>
703
+ `;
704
+ }
705
+
706
+ override render() {
707
+ const hourVal = !this.use24Hour
708
+ ? String(this.currentHour > 12 ? this.currentHour - 12 : this.currentHour === 0 ? 12 : this.currentHour).padStart(2, '0')
709
+ : String(this.currentHour).padStart(2, '0');
710
+ const minuteVal = String(this.currentMinute).padStart(2, '0');
711
+
712
+ return html`
713
+ <div class="main-content">
714
+ <div class="left-pane">
715
+ <div class="picker-header">
716
+ ${this.mode === 'dial' ? 'Select time' : 'Enter time'}
717
+ </div>
718
+
719
+ <div class="time-display-container">
720
+ <div class="time-display">
721
+ <div
722
+ class="display-box ${this.activeSelection === 'hour' ? 'active' : ''}"
723
+ @click=${() => this.setSelection('hour')}
724
+ >
725
+ ${this.mode === 'input'
726
+ ? html`<input
727
+ type="number"
728
+ .value=${hourVal}
729
+ @change=${this.handleHourInputChange}
730
+ min=${this.use24Hour ? 0 : 1}
731
+ max=${this.use24Hour ? 23 : 12}
732
+ />`
733
+ : hourVal}
734
+ </div>
735
+ <div class="separator">:</div>
736
+ <div
737
+ class="display-box ${this.activeSelection === 'minute' ? 'active' : ''}"
738
+ @click=${() => this.setSelection('minute')}
739
+ >
740
+ ${this.mode === 'input'
741
+ ? html`<input
742
+ type="number"
743
+ .value=${minuteVal}
744
+ @change=${this.handleMinuteInputChange}
745
+ min="0"
746
+ max="59"
747
+ />`
748
+ : minuteVal}
749
+ </div>
750
+ </div>
751
+
752
+ ${!this.use24Hour
753
+ ? html`
754
+ <div class="ampm-toggle">
755
+ <button
756
+ class="ampm-btn ${this.period === 'AM' ? 'active' : ''}"
757
+ @click=${() => this.setPeriod('AM')}
758
+ >
759
+ AM
760
+ </button>
761
+ <button
762
+ class="ampm-btn ${this.period === 'PM' ? 'active' : ''}"
763
+ @click=${() => this.setPeriod('PM')}
764
+ >
765
+ PM
766
+ </button>
767
+ </div>
768
+ `
769
+ : ''}
770
+ </div>
771
+
772
+ ${this.mode === 'input'
773
+ ? html`
774
+ <div class="input-labels">
775
+ <span>Hour</span>
776
+ <span>Minute</span>
777
+ </div>
778
+ `
779
+ : ''}
780
+ </div>
781
+
782
+ ${this.mode === 'dial' ? this.renderDialClockFace() : ''}
783
+ </div>
784
+
785
+ <div class="bottom-actions">
786
+ <button class="mode-toggle-btn" @click=${this.toggleMode} aria-label="Toggle input mode">
787
+ <moni-icon name=${this.mode === 'dial' ? 'keyboard' : 'schedule'}></moni-icon>
788
+ </button>
789
+ </div>
790
+ `;
791
+ }
792
+ }
793
+
794
+ declare global {
795
+ interface HTMLElementTagNameMap {
796
+ 'moni-time-picker': MoniTimePicker;
797
+ }
798
+ }
799
+
800
+ export default MoniTimePicker;