@m3ui-vue/m3ui-vue 0.9.0 → 0.9.2

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 (364) hide show
  1. package/README.md +53 -2
  2. package/dist/API.md +3806 -0
  3. package/dist/MIcon-CaEooCmZ.js.map +1 -1
  4. package/dist/{MTextField-B0wGv1Mx.js → MTextField-Ck0oWDMk.js} +9 -3
  5. package/dist/MTextField-Ck0oWDMk.js.map +1 -0
  6. package/dist/api.json +1 -0
  7. package/dist/barcode.js.map +1 -1
  8. package/dist/chart.js.map +1 -1
  9. package/dist/code-editor.js +2 -2
  10. package/dist/code-editor.js.map +1 -1
  11. package/dist/components/MAbsolute.vue.d.ts +12 -0
  12. package/dist/components/MAlert.vue.d.ts +4 -0
  13. package/dist/components/MAppBar.vue.d.ts +12 -0
  14. package/dist/components/MAppLayout.vue.d.ts +2 -0
  15. package/dist/components/MAspectRatio.vue.d.ts +1 -0
  16. package/dist/components/MAutocomplete.vue.d.ts +18 -0
  17. package/dist/components/MAvatar.vue.d.ts +3 -0
  18. package/dist/components/MBadge.vue.d.ts +6 -0
  19. package/dist/components/MBar.vue.d.ts +5 -0
  20. package/dist/components/MBarcode.vue.d.ts +9 -0
  21. package/dist/components/MBottomSheet.vue.d.ts +3 -0
  22. package/dist/components/MBox.vue.d.ts +8 -2
  23. package/dist/components/MBreadcrumbs.vue.d.ts +2 -0
  24. package/dist/components/MButton.vue.d.ts +14 -4
  25. package/dist/components/MButtonGroup.vue.d.ts +7 -0
  26. package/dist/components/MCalendar.vue.d.ts +8 -0
  27. package/dist/components/MCard.vue.d.ts +17 -0
  28. package/dist/components/MCarousel.vue.d.ts +7 -1
  29. package/dist/components/MCenter.vue.d.ts +1 -0
  30. package/dist/components/MChart.vue.d.ts +7 -0
  31. package/dist/components/MChatBubble.vue.d.ts +10 -0
  32. package/dist/components/MCheckbox.vue.d.ts +5 -0
  33. package/dist/components/MChip.vue.d.ts +9 -0
  34. package/dist/components/MCircleProgressBar.vue.d.ts +7 -0
  35. package/dist/components/MCodeEditor.vue.d.ts +9 -0
  36. package/dist/components/MColorPicker.vue.d.ts +20 -0
  37. package/dist/components/MColorPickerModal.vue.d.ts +16 -0
  38. package/dist/components/MCommandPalette.vue.d.ts +8 -0
  39. package/dist/components/MConfirmDialog.vue.d.ts +7 -0
  40. package/dist/components/MContainer.vue.d.ts +4 -0
  41. package/dist/components/MContextMenu.vue.d.ts +3 -6
  42. package/dist/components/MCopyButton.vue.d.ts +10 -0
  43. package/dist/components/MDataTable.vue.d.ts +33 -12
  44. package/dist/components/MDatePicker.vue.d.ts +16 -0
  45. package/dist/components/MDatePickerModal.vue.d.ts +9 -0
  46. package/dist/components/MDateRangePicker.vue.d.ts +18 -0
  47. package/dist/components/MDateRangePickerModal.vue.d.ts +9 -0
  48. package/dist/components/MDialog.vue.d.ts +9 -7
  49. package/dist/components/MDivider.vue.d.ts +6 -0
  50. package/dist/components/MDragDropList.vue.d.ts +6 -0
  51. package/dist/components/MDragHandle.vue.d.ts +12 -0
  52. package/dist/components/MEmoji.vue.d.ts +6 -0
  53. package/dist/components/MEmojiButton.vue.d.ts +5 -0
  54. package/dist/components/MEmojiSelector.vue.d.ts +1 -1
  55. package/dist/components/MEmptyState.vue.d.ts +4 -0
  56. package/dist/components/MExpansionPanel.vue.d.ts +9 -0
  57. package/dist/components/MExportButton.vue.d.ts +8 -0
  58. package/dist/components/MFab.vue.d.ts +10 -1
  59. package/dist/components/MFabMenu.vue.d.ts +15 -1
  60. package/dist/components/MFileUpload.vue.d.ts +8 -0
  61. package/dist/components/MFixed.vue.d.ts +10 -0
  62. package/dist/components/MFlex.vue.d.ts +6 -0
  63. package/dist/components/MFooter.vue.d.ts +11 -0
  64. package/dist/components/MFullscreen.vue.d.ts +2 -0
  65. package/dist/components/MGrid.vue.d.ts +7 -0
  66. package/dist/components/MHotkeys.vue.d.ts +4 -0
  67. package/dist/components/MIcon.vue.d.ts +2 -0
  68. package/dist/components/MIconButton.vue.d.ts +10 -0
  69. package/dist/components/MInfiniteScroll.vue.d.ts +6 -0
  70. package/dist/components/MJsonEditor.vue.d.ts +8 -0
  71. package/dist/components/MJsonViewer.vue.d.ts +4 -0
  72. package/dist/components/MKanban.vue.d.ts +2 -0
  73. package/dist/components/MKbd.vue.d.ts +2 -0
  74. package/dist/components/MLightbox.vue.d.ts +4 -0
  75. package/dist/components/MList.vue.d.ts +7 -0
  76. package/dist/components/MListItem.vue.d.ts +29 -5
  77. package/dist/components/MListSubheader.vue.d.ts +6 -0
  78. package/dist/components/MLoadingIndicator.vue.d.ts +10 -0
  79. package/dist/components/MLoadingOverlay.vue.d.ts +5 -0
  80. package/dist/components/MMarkdown.vue.d.ts +3 -0
  81. package/dist/components/MMaskField.vue.d.ts +15 -0
  82. package/dist/components/MMasonry.vue.d.ts +5 -0
  83. package/dist/components/MMenu.vue.d.ts +3 -6
  84. package/dist/components/MMenuDivider.vue.d.ts +4 -0
  85. package/dist/components/MMenuItem.vue.d.ts +5 -0
  86. package/dist/components/MMultiAutocomplete.vue.d.ts +20 -0
  87. package/dist/components/MMultiSelect.vue.d.ts +21 -0
  88. package/dist/components/MNavigationBar.vue.d.ts +2 -0
  89. package/dist/components/MNavigationDrawer.vue.d.ts +11 -0
  90. package/dist/components/MNavigationRail.vue.d.ts +9 -6
  91. package/dist/components/MNavigationSuite.vue.d.ts +5 -3
  92. package/dist/components/MNumberField.vue.d.ts +17 -0
  93. package/dist/components/MOverlay.vue.d.ts +4 -1
  94. package/dist/components/MPageProgress.vue.d.ts +3 -0
  95. package/dist/components/MPagination.vue.d.ts +3 -0
  96. package/dist/components/MPasswordMeter.vue.d.ts +1 -0
  97. package/dist/components/MPinInput.vue.d.ts +11 -0
  98. package/dist/components/MProgressBar.vue.d.ts +6 -0
  99. package/dist/components/MPullToRefresh.vue.d.ts +8 -0
  100. package/dist/components/MQRCode.vue.d.ts +6 -0
  101. package/dist/components/MRadio.vue.d.ts +5 -0
  102. package/dist/components/MRadioGroup.vue.d.ts +6 -0
  103. package/dist/components/MRating.vue.d.ts +11 -0
  104. package/dist/components/MRelativeTime.vue.d.ts +1 -0
  105. package/dist/components/MResponsive.vue.d.ts +3 -0
  106. package/dist/components/MResult.vue.d.ts +6 -0
  107. package/dist/components/MRichTextEditor.vue.d.ts +8 -0
  108. package/dist/components/MScheduler.vue.d.ts +10 -0
  109. package/dist/components/MScrollField.vue.d.ts +40 -0
  110. package/dist/components/MScrollable.vue.d.ts +12 -0
  111. package/dist/components/MSearchBar.vue.d.ts +6 -0
  112. package/dist/components/MSection.vue.d.ts +5 -0
  113. package/dist/components/MSegmentedButton.vue.d.ts +5 -0
  114. package/dist/components/MSelect.vue.d.ts +17 -0
  115. package/dist/components/MShader.vue.d.ts +1 -0
  116. package/dist/components/MShortNavigationBar.vue.d.ts +8 -9
  117. package/dist/components/MSideSheet.vue.d.ts +3 -0
  118. package/dist/components/MSignaturePad.vue.d.ts +7 -0
  119. package/dist/components/MSimpleCarousel.vue.d.ts +10 -0
  120. package/dist/components/MSkeleton.vue.d.ts +8 -0
  121. package/dist/components/MSlider.vue.d.ts +14 -0
  122. package/dist/components/MSnackbar.vue.d.ts +1 -0
  123. package/dist/components/MSpinner.vue.d.ts +6 -0
  124. package/dist/components/MSplitButton.vue.d.ts +7 -0
  125. package/dist/components/MSplitter.vue.d.ts +6 -2
  126. package/dist/components/MSpotlightSearch.vue.d.ts +18 -0
  127. package/dist/components/MStack.vue.d.ts +7 -0
  128. package/dist/components/MStatCard.vue.d.ts +7 -0
  129. package/dist/components/MStepper.vue.d.ts +7 -0
  130. package/dist/components/MSticky.vue.d.ts +2 -0
  131. package/dist/components/MSubtitle.vue.d.ts +4 -0
  132. package/dist/components/MSwipeToDismiss.vue.d.ts +49 -0
  133. package/dist/components/MSwitch.vue.d.ts +5 -6
  134. package/dist/components/MTable.vue.d.ts +17 -4
  135. package/dist/components/MTabs.vue.d.ts +6 -0
  136. package/dist/components/MTagInput.vue.d.ts +17 -0
  137. package/dist/components/MTerminal.vue.d.ts +4 -0
  138. package/dist/components/MText.vue.d.ts +10 -0
  139. package/dist/components/MTextField.vue.d.ts +18 -0
  140. package/dist/components/MTimePicker.vue.d.ts +10 -0
  141. package/dist/components/MTimePickerModal.vue.d.ts +5 -0
  142. package/dist/components/MTimeline.vue.d.ts +3 -0
  143. package/dist/components/MTitle.vue.d.ts +4 -0
  144. package/dist/components/MToggleButton.vue.d.ts +4 -0
  145. package/dist/components/MToolbar.vue.d.ts +5 -0
  146. package/dist/components/MTooltip.vue.d.ts +7 -0
  147. package/dist/components/MTopAppBar.vue.d.ts +8 -0
  148. package/dist/components/MTour.vue.d.ts +5 -0
  149. package/dist/components/MTransferList.vue.d.ts +11 -0
  150. package/dist/components/MTransition.vue.d.ts +34 -0
  151. package/dist/components/MTree.vue.d.ts +11 -0
  152. package/dist/components/MTreeTable.vue.d.ts +7 -0
  153. package/dist/components/MVirtualTable.vue.d.ts +6 -0
  154. package/dist/components/MWindow.vue.d.ts +33 -1
  155. package/dist/components/_MColorPanel.vue.d.ts +18 -0
  156. package/dist/composables/_colorUtils.d.ts +34 -0
  157. package/dist/composables/_themeColor.d.ts +1 -0
  158. package/dist/composables/_useSpring.d.ts +15 -0
  159. package/dist/composables/dynamicColor.d.ts +18 -0
  160. package/dist/composables/useColorPalette.d.ts +27 -0
  161. package/dist/composables/useLocale.d.ts +12 -0
  162. package/dist/index.d.ts +9 -1
  163. package/dist/locales/index.js +70 -0
  164. package/dist/locales/index.js.map +1 -1
  165. package/dist/m3ui-vue.css +1 -1
  166. package/dist/m3ui.js +6456 -5273
  167. package/dist/m3ui.js.map +1 -1
  168. package/dist/markdown.js +1 -1
  169. package/dist/markdown.js.map +1 -1
  170. package/dist/material-color-utilities-Cktu8DBU.js +3160 -0
  171. package/dist/material-color-utilities-Cktu8DBU.js.map +1 -0
  172. package/dist/plugin.d.ts +18 -0
  173. package/dist/qrcode.js.map +1 -1
  174. package/dist/rich-text-editor.js +3 -3
  175. package/dist/rich-text-editor.js.map +1 -1
  176. package/dist/styles/palettes.css +546 -0
  177. package/dist/styles/theme.css +77 -0
  178. package/dist/styles.css +1 -1
  179. package/dist/terminal.js.map +1 -1
  180. package/dist/{useLocale-CmI675Ab.js → useLocale-CFW8cIzL.js} +23 -10
  181. package/dist/useLocale-CFW8cIzL.js.map +1 -0
  182. package/package.json +5 -2
  183. package/src/__tests__/MButtonGroup.test.ts +51 -0
  184. package/src/__tests__/MColorPicker.test.ts +141 -0
  185. package/src/__tests__/MDragHandle.test.ts +57 -0
  186. package/src/__tests__/MHotkeys.test.ts +57 -0
  187. package/src/__tests__/MListItemShape.test.ts +76 -0
  188. package/src/__tests__/MScrollField.test.ts +41 -0
  189. package/src/__tests__/MScrollable.test.ts +42 -0
  190. package/src/__tests__/MSwipeToDismiss.test.ts +104 -0
  191. package/src/__tests__/MTransition.test.ts +27 -0
  192. package/src/__tests__/dynamicColor.test.ts +191 -0
  193. package/src/__tests__/hostLocale.test.ts +57 -0
  194. package/src/components/MAbsolute.vue +18 -0
  195. package/src/components/MAlert.vue +12 -0
  196. package/src/components/MAppBar.vue +12 -0
  197. package/src/components/MAppLayout.vue +11 -0
  198. package/src/components/MAspectRatio.vue +6 -0
  199. package/src/components/MAutocomplete.vue +24 -0
  200. package/src/components/MAvatar.vue +12 -1
  201. package/src/components/MBadge.vue +11 -0
  202. package/src/components/MBar.vue +19 -0
  203. package/src/components/MBarcode.vue +14 -0
  204. package/src/components/MBottomSheet.vue +12 -0
  205. package/src/components/MBox.vue +15 -1
  206. package/src/components/MBreadcrumbs.vue +7 -0
  207. package/src/components/MButton.vue +22 -4
  208. package/src/components/MButtonGroup.vue +129 -35
  209. package/src/components/MCalendar.vue +14 -0
  210. package/src/components/MCard.vue +26 -0
  211. package/src/components/MCarousel.vue +17 -1
  212. package/src/components/MCenter.vue +6 -0
  213. package/src/components/MChart.vue +12 -0
  214. package/src/components/MChatBubble.vue +17 -0
  215. package/src/components/MCheckbox.vue +11 -0
  216. package/src/components/MChip.vue +17 -0
  217. package/src/components/MCircleProgressBar.vue +13 -0
  218. package/src/components/MCodeEditor.vue +15 -0
  219. package/src/components/MColorPicker.vue +124 -207
  220. package/src/components/MColorPickerModal.vue +58 -247
  221. package/src/components/MCommandPalette.vue +16 -0
  222. package/src/components/MConfirmDialog.vue +15 -0
  223. package/src/components/MContainer.vue +9 -0
  224. package/src/components/MContextMenu.vue +17 -6
  225. package/src/components/MCopyButton.vue +16 -0
  226. package/src/components/MDataTable.vue +58 -12
  227. package/src/components/MDatePicker.vue +21 -0
  228. package/src/components/MDatePickerModal.vue +16 -0
  229. package/src/components/MDateRangePicker.vue +23 -0
  230. package/src/components/MDateRangePickerModal.vue +16 -0
  231. package/src/components/MDialog.vue +27 -7
  232. package/src/components/MDivider.vue +6 -0
  233. package/src/components/MDragDropList.vue +18 -0
  234. package/src/components/MDragHandle.vue +54 -0
  235. package/src/components/MEmoji.vue +6 -0
  236. package/src/components/MEmojiButton.vue +11 -0
  237. package/src/components/MEmojiSelector.vue +7 -0
  238. package/src/components/MEmptyState.vue +9 -0
  239. package/src/components/MExpansionPanel.vue +17 -0
  240. package/src/components/MExportButton.vue +15 -0
  241. package/src/components/MFab.vue +17 -0
  242. package/src/components/MFabMenu.vue +20 -0
  243. package/src/components/MFileUpload.vue +19 -0
  244. package/src/components/MFixed.vue +16 -0
  245. package/src/components/MFlex.vue +11 -0
  246. package/src/components/MFooter.vue +11 -0
  247. package/src/components/MFullscreen.vue +8 -0
  248. package/src/components/MGrid.vue +12 -0
  249. package/src/components/MHotkeys.vue +20 -13
  250. package/src/components/MIcon.vue +10 -1
  251. package/src/components/MIconButton.vue +13 -0
  252. package/src/components/MInfiniteScroll.vue +16 -0
  253. package/src/components/MJsonEditor.vue +13 -0
  254. package/src/components/MJsonViewer.vue +7 -0
  255. package/src/components/MKanban.vue +18 -0
  256. package/src/components/MKbd.vue +6 -0
  257. package/src/components/MLightbox.vue +16 -0
  258. package/src/components/MList.vue +48 -3
  259. package/src/components/MListDetail.vue +11 -0
  260. package/src/components/MListItem.vue +112 -5
  261. package/src/components/MListSubheader.vue +6 -0
  262. package/src/components/MLoadingIndicator.vue +15 -0
  263. package/src/components/MLoadingOverlay.vue +12 -0
  264. package/src/components/MMarkdown.vue +7 -0
  265. package/src/components/MMaskField.vue +21 -0
  266. package/src/components/MMasonry.vue +11 -0
  267. package/src/components/MMenu.vue +16 -6
  268. package/src/components/MMenuDivider.vue +4 -0
  269. package/src/components/MMenuItem.vue +16 -0
  270. package/src/components/MMultiAutocomplete.vue +26 -0
  271. package/src/components/MMultiSelect.vue +27 -0
  272. package/src/components/MNavigationBar.vue +7 -0
  273. package/src/components/MNavigationDrawer.vue +25 -0
  274. package/src/components/MNavigationRail.vue +24 -6
  275. package/src/components/MNavigationSuite.vue +20 -3
  276. package/src/components/MNotificationHost.vue +3 -0
  277. package/src/components/MNumberField.vue +24 -0
  278. package/src/components/MOverlay.vue +10 -0
  279. package/src/components/MPageProgress.vue +7 -0
  280. package/src/components/MPagination.vue +15 -1
  281. package/src/components/MPasswordMeter.vue +7 -0
  282. package/src/components/MPinInput.vue +19 -0
  283. package/src/components/MProgressBar.vue +9 -0
  284. package/src/components/MPullToRefresh.vue +17 -0
  285. package/src/components/MQRCode.vue +12 -0
  286. package/src/components/MRadio.vue +11 -0
  287. package/src/components/MRadioGroup.vue +11 -0
  288. package/src/components/MRating.vue +19 -0
  289. package/src/components/MRelative.vue +8 -0
  290. package/src/components/MRelativeTime.vue +6 -0
  291. package/src/components/MResponsive.vue +9 -0
  292. package/src/components/MResult.vue +14 -0
  293. package/src/components/MRichTextEditor.vue +14 -0
  294. package/src/components/MScheduler.vue +21 -0
  295. package/src/components/MScrollField.vue +302 -0
  296. package/src/components/MScrollable.vue +167 -4
  297. package/src/components/MSearchBar.vue +17 -0
  298. package/src/components/MSection.vue +13 -0
  299. package/src/components/MSegmentedButton.vue +10 -0
  300. package/src/components/MSelect.vue +22 -0
  301. package/src/components/MShader.vue +13 -0
  302. package/src/components/MShape.vue +6 -0
  303. package/src/components/MShortNavigationBar.vue +23 -9
  304. package/src/components/MSideSheet.vue +13 -0
  305. package/src/components/MSignaturePad.vue +15 -0
  306. package/src/components/MSimpleCarousel.vue +18 -0
  307. package/src/components/MSkeleton.vue +8 -0
  308. package/src/components/MSlider.vue +21 -0
  309. package/src/components/MSnackbar.vue +5 -0
  310. package/src/components/MSpacer.vue +6 -0
  311. package/src/components/MSpinner.vue +10 -0
  312. package/src/components/MSplitButton.vue +14 -0
  313. package/src/components/MSplitter.vue +42 -9
  314. package/src/components/MSpotlightSearch.vue +27 -0
  315. package/src/components/MStack.vue +12 -0
  316. package/src/components/MStatCard.vue +13 -0
  317. package/src/components/MStepper.vue +12 -0
  318. package/src/components/MSticky.vue +7 -0
  319. package/src/components/MSubtitle.vue +9 -0
  320. package/src/components/MSupportingPane.vue +10 -0
  321. package/src/components/MSwipeToDismiss.vue +247 -0
  322. package/src/components/MSwitch.vue +14 -6
  323. package/src/components/MTable.vue +33 -4
  324. package/src/components/MTabs.vue +12 -0
  325. package/src/components/MTagInput.vue +23 -0
  326. package/src/components/MTerminal.vue +11 -0
  327. package/src/components/MText.vue +15 -0
  328. package/src/components/MTextField.vue +26 -0
  329. package/src/components/MTimePicker.vue +15 -0
  330. package/src/components/MTimePickerModal.vue +12 -0
  331. package/src/components/MTimeline.vue +7 -0
  332. package/src/components/MTitle.vue +9 -0
  333. package/src/components/MToggleButton.vue +12 -0
  334. package/src/components/MToolbar.vue +12 -0
  335. package/src/components/MTooltip.vue +15 -0
  336. package/src/components/MTopAppBar.vue +18 -0
  337. package/src/components/MTour.vue +13 -0
  338. package/src/components/MTransferList.vue +24 -0
  339. package/src/components/MTransition.vue +149 -0
  340. package/src/components/MTree.vue +11 -0
  341. package/src/components/MTreeTable.vue +15 -0
  342. package/src/components/MVirtualTable.vue +12 -0
  343. package/src/components/MWindow.vue +34 -0
  344. package/src/components/_MColorPanel.vue +478 -0
  345. package/src/composables/_colorUtils.ts +107 -0
  346. package/src/composables/_themeColor.ts +33 -0
  347. package/src/composables/_useSpring.ts +89 -0
  348. package/src/composables/dynamicColor.ts +85 -0
  349. package/src/composables/useColorPalette.ts +171 -25
  350. package/src/composables/useFieldBg.ts +6 -0
  351. package/src/composables/useLocale.ts +38 -3
  352. package/src/index.ts +9 -1
  353. package/src/locales/de.ts +10 -0
  354. package/src/locales/es.ts +10 -0
  355. package/src/locales/fr.ts +10 -0
  356. package/src/locales/ja.ts +10 -0
  357. package/src/locales/ko.ts +10 -0
  358. package/src/locales/pt.ts +10 -0
  359. package/src/locales/zh.ts +10 -0
  360. package/src/plugin.ts +30 -8
  361. package/src/styles/palettes.css +546 -0
  362. package/src/styles/theme.css +77 -0
  363. package/dist/MTextField-B0wGv1Mx.js.map +0 -1
  364. package/dist/useLocale-CmI675Ab.js.map +0 -1
@@ -1,13 +1,30 @@
1
1
  <script setup lang="ts">
2
+ /**
3
+ * Wraps its own scrollable container and fires a refresh event when the user pulls past a threshold at the very
4
+ * top of the scroll.
5
+ *
6
+ * @slot default The scrollable content. A pull starts only when it's scrolled to the top; otherwise touch
7
+ * scrolls it normally
8
+ * @event refresh Emitted when the user drags past threshold and releases. Set refreshing to true in the
9
+ * handler, then back to false once the fetch resolves.
10
+ */
2
11
  import { ref, watch, onMounted, onBeforeUnmount } from "vue";
3
12
  import MLoadingIndicator from "./MLoadingIndicator.vue";
4
13
 
5
14
  const props = withDefaults(
6
15
  defineProps<{
16
+ /**
17
+ * Controlled loading state — set it to true in your @refresh handler and back to false once the fetch
18
+ * resolves; the indicator settles and releases accordingly, same pattern as MInfiniteScroll's loading prop
19
+ */
7
20
  refreshing?: boolean;
21
+ /** Disables the pull gesture */
8
22
  disabled?: boolean;
23
+ /** Pull distance in px required to trigger a refresh on release */
9
24
  threshold?: number;
25
+ /** Indicator size in px */
10
26
  size?: number;
27
+ /** Indicator color */
11
28
  color?: "primary" | "secondary" | "tertiary" | "error";
12
29
  }>(),
13
30
  { refreshing: false, disabled: false, threshold: 64, size: 36, color: "primary" },
@@ -1,16 +1,28 @@
1
1
  <script setup lang="ts">
2
+ /**
3
+ * Renders a QR code as inline SVG — crisp at any size, no canvas or image assets. Available from the `/qrcode`
4
+ * entry point, so it never adds weight to the main bundle.
5
+ *
6
+ * @slot error Shown instead of the SVG when value is too large to encode at the given errorCorrectionLevel
7
+ */
2
8
  import { computed } from 'vue'
3
9
  import QRCode from 'qrcode-generator'
4
10
 
5
11
  const props = withDefaults(
6
12
  defineProps<{
13
+ /** Data to encode. Required — there is no default. */
7
14
  value: string
15
+ /** Width/height in pixels (square) */
8
16
  size?: number
9
17
  /** Quiet zone around the code, in modules. */
10
18
  margin?: number
19
+ /** Higher levels tolerate more damage/obstruction at the cost of a denser code */
11
20
  errorCorrectionLevel?: 'L' | 'M' | 'Q' | 'H'
21
+ /** Dark module color */
12
22
  color?: string
23
+ /** Light module / background color */
13
24
  background?: string
25
+ /** aria-label for the svg. Defaults to value */
14
26
  label?: string
15
27
  /** Rounds the outer container corners. */
16
28
  rounded?: boolean
@@ -1,12 +1,23 @@
1
1
  <script setup lang="ts">
2
+ /**
3
+ * A single radio button, for when you lay out the options yourself. It's selected when `modelValue` equals its
4
+ * `value`; for a plain list of options, MRadioGroup is simpler.
5
+ *
6
+ * @event update:modelValue Emitted with `value` when the radio is selected.
7
+ */
2
8
  import { computed, useId } from "vue";
3
9
 
4
10
  const props = withDefaults(
5
11
  defineProps<{
12
+ /** The group's current value (v-model); share one ref between the radios of a group. */
6
13
  modelValue: unknown;
14
+ /** The value this radio stands for; selecting it sets the v-model to it. */
7
15
  value: unknown;
16
+ /** Text next to the radio. Clicking it selects the radio too. */
8
17
  label?: string;
18
+ /** Grays the radio out and ignores clicks. */
9
19
  disabled?: boolean;
20
+ /** Color role of the selected radio. */
10
21
  color?: "primary" | "secondary" | "tertiary" | "error";
11
22
  }>(),
12
23
  { disabled: false, color: "primary" },
@@ -1,4 +1,9 @@
1
1
  <script setup lang="ts">
2
+ /**
3
+ * A group of radio buttons sharing a single selection, column or row layout.
4
+ *
5
+ * @event update:modelValue Emitted with the selected option's value.
6
+ */
2
7
  import MRadio from './MRadio.vue'
3
8
 
4
9
  interface Option {
@@ -8,11 +13,17 @@ interface Option {
8
13
  }
9
14
 
10
15
  const props = withDefaults(defineProps<{
16
+ /** Selected value (v-model) */
11
17
  modelValue: unknown
18
+ /** Radio options */
12
19
  options: Option[]
20
+ /** Group label */
13
21
  label?: string
22
+ /** Layout direction */
14
23
  direction?: 'column' | 'row'
24
+ /** Disables all radios */
15
25
  disabled?: boolean
26
+ /** Radio color */
16
27
  color?: 'primary' | 'secondary' | 'tertiary' | 'error'
17
28
  }>(), { direction: 'column', disabled: false, color: 'primary' })
18
29
 
@@ -1,4 +1,12 @@
1
1
  <script setup lang="ts">
2
+ /**
3
+ * A star rating input with half increments and any Material Symbol icon. Not part of the official M3 spec, so
4
+ * it's built from M3 primitives: filled/outlined icon pairs, a state layer on hover/press, and a focus ring.
5
+ * Click or drag to rate (drag past the first icon to clear), or use the arrow keys, Home and End when focused.
6
+ *
7
+ * @event update:modelValue Emitted when the user rates by click, drag or keyboard (v-model). Dragging past the
8
+ * first icon emits 0
9
+ */
2
10
  import { computed, ref } from 'vue'
3
11
  import MIcon from './MIcon.vue'
4
12
 
@@ -6,13 +14,24 @@ import MIcon from './MIcon.vue'
6
14
  // Material Symbol pairs, on-surface-variant for the unselected icon, a 40px circular
7
15
  // hover/press state layer (8%/10%) tinted with the active color, and a secondary focus ring.
8
16
  const props = withDefaults(defineProps<{
17
+ /** Current rating (v-model) */
9
18
  modelValue: number
19
+ /** Maximum stars */
10
20
  max?: number
21
+ /** Star size in px */
11
22
  size?: number
23
+ /** Display-only: not focusable, exposed as role="img" with the value as its label */
12
24
  readonly?: boolean
25
+ /** Disables interaction */
13
26
  disabled?: boolean
27
+ /** One of the 4 M3 roles ('primary' | 'secondary' | 'tertiary' | 'error'), or any other CSS color string */
14
28
  color?: string
29
+ /** Material Symbol icon */
15
30
  icon?: string
31
+ /**
32
+ * Allow half-star values (click the left half of an icon). Fractional values always render exactly, with or
33
+ * without this prop
34
+ */
16
35
  halfIncrements?: boolean
17
36
  }>(), { max: 5, size: 28, color: 'primary', icon: 'star', halfIncrements: false })
18
37
 
@@ -1,3 +1,11 @@
1
+ <!--
2
+ /**
3
+ * Wrapper that sets `position: relative` on a container. Use it as the positioning parent for MAbsolute
4
+ * children.
5
+ *
6
+ * @slot default Content; absolutely positioned children are placed relative to it.
7
+ */
8
+ -->
1
9
  <template>
2
10
  <div class="relative">
3
11
  <slot />
@@ -1,9 +1,15 @@
1
1
  <script setup lang="ts">
2
+ /**
3
+ * Renders a timestamp as human-readable relative text ("5 minutes ago", "in 2 hours") that keeps itself up to
4
+ * date, formatted with the native Intl.RelativeTimeFormat. It renders a semantic `<time>` element, and hovering
5
+ * it shows the full absolute date.
6
+ */
2
7
  import { computed, onUnmounted, ref, watch } from 'vue'
3
8
  import { useLocale } from '../composables/useLocale'
4
9
 
5
10
  const props = withDefaults(
6
11
  defineProps<{
12
+ /** Required. The timestamp to format: an ISO string, epoch milliseconds, or a Date */
7
13
  value: string | number | Date
8
14
  /** BCP-47 locale tag (e.g. 'es-ES'). Defaults to the app's locale (via createM3UI/useLocale), then the browser's locale. */
9
15
  locale?: string
@@ -1,12 +1,21 @@
1
1
  <script setup lang="ts">
2
+ /**
3
+ * Shows or hides content at specific breakpoints using pure CSS (Tailwind's `hidden`/`block` utilities) — no JS
4
+ * resize listener.
5
+ *
6
+ * @slot default Content.
7
+ */
2
8
  import { computed } from 'vue'
3
9
 
4
10
  type Breakpoint = 'sm-up' | 'md-up' | 'lg-up' | 'xl-up' | 'sm-down' | 'md-down' | 'lg-down' | 'xl-down'
5
11
 
6
12
  const props = withDefaults(
7
13
  defineProps<{
14
+ /** Show content only at this breakpoint range */
8
15
  show?: Breakpoint
16
+ /** Hide content at this breakpoint range */
9
17
  hide?: Breakpoint
18
+ /** HTML tag to render */
10
19
  tag?: string
11
20
  }>(),
12
21
  { tag: 'div' },
@@ -1,11 +1,25 @@
1
1
  <script setup lang="ts">
2
+ /**
3
+ * A full result screen for the end of a flow: success, errors, empty states and HTTP error pages. Each status
4
+ * comes with its own icon, colors, title and description, and you can override any of them. The default texts
5
+ * come from the active locale (`useLocale`), so they follow the language passed to `createM3UI({ locale })`.
6
+ *
7
+ * @slot actions Action buttons, in a centered row below the description
8
+ * @slot default Extra content below the actions row, e.g. a secondary link or fine print
9
+ */
2
10
  import { computed } from 'vue'
3
11
  import MIcon from './MIcon.vue'
4
12
  import { useLocale, type M3Locale } from '../composables/useLocale'
5
13
 
6
14
  const props = withDefaults(defineProps<{
15
+ /**
16
+ * Required. Picks the icon, its colors, and the default title/description. The three HTTP statuses also show
17
+ * the code in large type above the icon
18
+ */
7
19
  status: 'success' | 'error' | 'warning' | 'info' | '404' | '403' | '500'
20
+ /** Custom title, replaces the status default */
8
21
  title?: string
22
+ /** Custom description, replaces the status default */
9
23
  description?: string
10
24
  }>(), {})
11
25
 
@@ -1,4 +1,10 @@
1
1
  <script setup lang="ts">
2
+ /**
3
+ * A WYSIWYG editor built on tiptap, with a formatting toolbar covering text styles, lists, alignment, links,
4
+ * and images.
5
+ *
6
+ * @event update:modelValue Emitted with the editor HTML on every content change — powers v-model
7
+ */
2
8
  import { ref, watch, onMounted, onBeforeUnmount, shallowRef, computed } from 'vue'
3
9
  import MIcon from './MIcon.vue'
4
10
  import MMenu from './MMenu.vue'
@@ -40,10 +46,18 @@ const locale = useLocale()
40
46
 
41
47
  const props = withDefaults(
42
48
  defineProps<{
49
+ /** HTML content (v-model) */
43
50
  modelValue: string
51
+ /** Placeholder text shown on an empty document */
44
52
  placeholder?: string
53
+ /** Disables editing */
45
54
  disabled?: boolean
55
+ /** Minimum editor height */
46
56
  minHeight?: string
57
+ /**
58
+ * Object with all toolbar/dialog label overrides for i18n (see `RichTextEditorLabels`) — defaults come from
59
+ * useLocale()
60
+ */
47
61
  labels?: RichTextEditorLabels
48
62
  }>(),
49
63
  { disabled: false, minHeight: '200px' },
@@ -1,4 +1,15 @@
1
1
  <script setup lang="ts">
2
+ /**
3
+ * A week or day calendar grid. Events sit at their exact times, overlapping ones share the width, and anything
4
+ * that lasts all day or spans several days runs across the all-day row. Click a day header to open that day.
5
+ * Dates and times follow the app's locale.
6
+ *
7
+ * @slot event Content of each event block; allDay is true in the all-day row
8
+ * @event eventClick An event (in the grid or the all-day row) was clicked
9
+ * @event slotClick An empty spot in the grid was clicked
10
+ * @event update:date Navigation changed the date shown (YYYY-MM-DD)
11
+ * @event update:view The Day/Week toggle (or a day header) changed the view
12
+ */
2
13
  import { computed, onBeforeUnmount, onMounted, ref, watch } from 'vue'
3
14
  import MIconButton from './MIconButton.vue'
4
15
  import { useLocale } from '../composables/useLocale'
@@ -22,12 +33,15 @@ export interface SchedulerEvent {
22
33
 
23
34
  const props = withDefaults(
24
35
  defineProps<{
36
+ /** Events to show (see `SchedulerEvent`) */
25
37
  events?: SchedulerEvent[]
26
38
  /** 'week' or 'day'; use v-model:view to follow the header's toggle. */
27
39
  view?: 'week' | 'day'
28
40
  /** The date shown (`YYYY-MM-DD`), today by default; use v-model:date to follow navigation. */
29
41
  date?: string
42
+ /** First visible hour */
30
43
  startHour?: number
44
+ /** Hour the grid ends at */
31
45
  endHour?: number
32
46
  /** First day of the week: 0 = Sunday, 1 = Monday. */
33
47
  weekStartsOn?: 0 | 1
@@ -35,12 +49,19 @@ const props = withDefaults(
35
49
  hourHeight?: number
36
50
  /** A line across today's column at the current time. */
37
51
  nowIndicator?: boolean
52
+ /** Locale for dates and times (Intl). Falls back to the app's configured locale */
38
53
  locale?: string
54
+ /** Aria label of the previous button (defaults to the locale string) */
39
55
  prevLabel?: string
56
+ /** Aria label of the next button (defaults to the locale string) */
40
57
  nextLabel?: string
58
+ /** Label of the Today button (defaults to the locale string) */
41
59
  todayLabel?: string
60
+ /** Label of the Day toggle (defaults to the locale string) */
42
61
  dayViewLabel?: string
62
+ /** Label of the Week toggle (defaults to the locale string) */
43
63
  weekViewLabel?: string
64
+ /** Label of the all-day row (defaults to the locale string) */
44
65
  allDayLabel?: string
45
66
  }>(),
46
67
  {
@@ -0,0 +1,302 @@
1
+ <script setup lang="ts">
2
+ /**
3
+ * An endless wheel to pick a number or option by scrolling (M3 Expressive's ScrollField, a port of Compose's
4
+ * `ScrollField`): the centered item is the selected one. Drag, flick, use the mouse wheel, the arrow keys, or
5
+ * click an item. Put two side by side for a time (hours and minutes).
6
+ *
7
+ * @slot item Custom content for each item, instead of the formatted number. Receives `{ index, selected }`.
8
+ * @event update:modelValue Emitted with the index of the centered item, as it changes while scrolling
9
+ */
10
+ import { computed, nextTick, onMounted, onUnmounted, ref, shallowRef, watch } from 'vue'
11
+
12
+ const props = withDefaults(defineProps<{
13
+ /** Index of the selected item, 0 to count - 1 (v-model) */
14
+ modelValue: number
15
+ /** Number of items; the wheel wraps around after the last one */
16
+ count: number
17
+ /**
18
+ * Accessible name of the field. Include the range when it isn't obvious ("Select year between 2000 and
19
+ * 2025"): the wheel wraps, so screen readers can't tell where it ends.
20
+ */
21
+ label?: string
22
+ /** Text for each item (also what screen readers announce). Defaults to the index with at least 2 digits. */
23
+ format?: (index: number) => string
24
+ /** Height in px; three items fit in the default 200 (ScrollFieldDefaults.ScrollFieldHeight) */
25
+ height?: number
26
+ /** Disables the field */
27
+ disabled?: boolean
28
+ }>(), {
29
+ format: (index: number) => String(index).padStart(2, '0'),
30
+ height: 200,
31
+ disabled: false,
32
+ })
33
+
34
+ const emit = defineEmits<{ 'update:modelValue': [number] }>()
35
+ const slots = defineSlots<{ item?: (props: { index: number; selected: boolean }) => unknown }>()
36
+ const custom = computed(() => !!slots.item)
37
+
38
+ // Pager pages are a fixed ScrollFieldHeight / 3, whatever the field's own height
39
+ const ITEM = 200 / 3
40
+ // PagerDefaults: the snap after a fling is spring(StiffnessMediumLow); animateScrollToPage uses spring()
41
+ const SNAP = { stiffness: 400, dampingRatio: 1 }
42
+ const SCROLL_TO = { stiffness: 1500, dampingRatio: 1 }
43
+ // Item text emphasis: MotionScheme.fastSpatialSpec() (Standard)
44
+ const EMPHASIS = { stiffness: 1400, dampingRatio: 0.9 }
45
+ // PagerDefaults' snapVelocityThreshold (400dp/s)
46
+ const FLING_VELOCITY = 400
47
+
48
+ const mod = (n: number) => ((n % props.count) + props.count) % props.count
49
+
50
+ // ── Position (in items, not wrapped) ──────────────────────────────────────────────────────────
51
+ let pos = props.count > 0 ? mod(props.modelValue) : 0
52
+ let vel = 0
53
+ let target: number | null = null
54
+ let spec = SNAP
55
+ const selectedPage = ref(Math.round(pos))
56
+ const range = computed(() => Math.ceil(props.height / 2 / ITEM) + 1)
57
+ const pages = shallowRef<number[]>([])
58
+
59
+ function updatePages() {
60
+ const base = Math.round(pos)
61
+ if (pages.value[range.value] === base) return
62
+ pages.value = Array.from({ length: range.value * 2 + 1 }, (_, i) => base - range.value + i)
63
+ }
64
+ updatePages()
65
+
66
+ // ── Per-item emphasis (0 → 1 as an item becomes the selected one) ───────────────────────────────
67
+ const emphasis = new Map<number, { f: number; v: number }>()
68
+ const itemEls = new Map<number, HTMLElement>()
69
+
70
+ function setItemEl(page: number, el: unknown) {
71
+ if (el instanceof HTMLElement) itemEls.set(page, el)
72
+ else itemEls.delete(page)
73
+ }
74
+
75
+ function write() {
76
+ const center = props.height / 2 - ITEM / 2
77
+ for (const [page, el] of itemEls) {
78
+ el.style.transform = `translateY(${center + (page - pos) * ITEM}px)`
79
+ if (custom.value) continue
80
+ const f = emphasis.get(page)?.f ?? (page === selectedPage.value ? 1 : 0)
81
+ const text = el.firstElementChild as HTMLElement | null
82
+ if (!text) continue
83
+ // displayMedium (45/52, regular) → displayLargeEmphasized (57/64, medium)
84
+ text.style.fontSize = `${45 + 12 * f}px`
85
+ text.style.lineHeight = `${52 + 12 * f}px`
86
+ text.style.fontWeight = String(Math.round(400 + 100 * f))
87
+ text.style.letterSpacing = '0'
88
+ text.style.color = props.disabled
89
+ ? ''
90
+ : `color-mix(in srgb, var(--color-on-surface) ${Math.round(f * 100)}%, var(--color-outline))`
91
+ }
92
+ }
93
+
94
+ // ── Animation loop ──────────────────────────────────────────────────────────────────────────────
95
+ let raf = 0
96
+ let last = 0
97
+ let dragging = false
98
+
99
+ function setSelected() {
100
+ const page = Math.round(pos)
101
+ if (page === selectedPage.value) return
102
+ selectedPage.value = page
103
+ updatePages()
104
+ if (props.count > 0) emit('update:modelValue', mod(page))
105
+ }
106
+
107
+ function frame(now: number) {
108
+ let dt = Math.min((now - last) / 1000, 1 / 30)
109
+ last = now
110
+ let busy = false
111
+ while (dt > 0) {
112
+ const h = Math.min(dt, 0.004)
113
+ dt -= h
114
+ if (target !== null && !dragging) {
115
+ const c = 2 * spec.dampingRatio * Math.sqrt(spec.stiffness)
116
+ vel += (-spec.stiffness * (pos - target) - c * vel) * h
117
+ pos += vel * h
118
+ }
119
+ for (const [page, e] of emphasis) {
120
+ const goal = page === selectedPage.value ? 1 : 0
121
+ const c = 2 * EMPHASIS.dampingRatio * Math.sqrt(EMPHASIS.stiffness)
122
+ e.v += (-EMPHASIS.stiffness * (e.f - goal) - c * e.v) * h
123
+ e.f += e.v * h
124
+ }
125
+ }
126
+ if (target !== null && !dragging) {
127
+ if (Math.abs(pos - target) < 0.001 && Math.abs(vel) < 0.01) {
128
+ pos = target
129
+ vel = 0
130
+ target = null
131
+ } else busy = true
132
+ }
133
+ for (const [page, e] of emphasis) {
134
+ const goal = page === selectedPage.value ? 1 : 0
135
+ if (Math.abs(e.f - goal) < 0.002 && Math.abs(e.v) < 0.01) {
136
+ e.f = goal
137
+ e.v = 0
138
+ if (goal === 0) emphasis.delete(page)
139
+ } else busy = true
140
+ }
141
+ setSelected()
142
+ write()
143
+ raf = busy || dragging ? requestAnimationFrame(frame) : 0
144
+ }
145
+
146
+ function kick() {
147
+ if (raf) return
148
+ last = performance.now()
149
+ raf = requestAnimationFrame(frame)
150
+ }
151
+
152
+ function animateTo(page: number, s = SCROLL_TO) {
153
+ target = page
154
+ spec = s
155
+ kick()
156
+ }
157
+
158
+ watch(selectedPage, (page, prev) => {
159
+ // Both the item leaving and the one arriving animate their emphasis
160
+ if (!emphasis.has(prev)) emphasis.set(prev, { f: 1, v: 0 })
161
+ if (!emphasis.has(page)) emphasis.set(page, { f: 0, v: 0 })
162
+ kick()
163
+ })
164
+
165
+ // Outside changes take the short way around the wheel
166
+ watch(() => props.modelValue, (v) => {
167
+ if (props.count <= 0) return
168
+ const current = target ?? Math.round(pos)
169
+ let d = mod(v) - mod(current)
170
+ if (d > props.count / 2) d -= props.count
171
+ if (d < -props.count / 2) d += props.count
172
+ if (d !== 0) animateTo(current + d)
173
+ })
174
+
175
+ watch(pages, () => nextTick(write))
176
+ watch(() => [props.height, props.disabled], () => { updatePages(); nextTick(write) })
177
+
178
+ // ── Pointer ─────────────────────────────────────────────────────────────────────────────────────
179
+ const rootEl = ref<HTMLElement>()
180
+ let startY = 0
181
+ let startPos = 0
182
+ let moved = false
183
+ let samples: { t: number; y: number }[] = []
184
+
185
+ function onPointerDown(e: PointerEvent) {
186
+ if (props.disabled || e.button !== 0) return
187
+ rootEl.value?.setPointerCapture?.(e.pointerId)
188
+ dragging = true
189
+ moved = false
190
+ startY = e.clientY
191
+ startPos = pos
192
+ target = null
193
+ vel = 0
194
+ samples = [{ t: e.timeStamp, y: e.clientY }]
195
+ kick()
196
+ }
197
+
198
+ function onPointerMove(e: PointerEvent) {
199
+ if (!dragging) return
200
+ if (Math.abs(e.clientY - startY) > 4) moved = true
201
+ pos = startPos - (e.clientY - startY) / ITEM
202
+ samples.push({ t: e.timeStamp, y: e.clientY })
203
+ samples = samples.filter((s) => e.timeStamp - s.t < 100)
204
+ }
205
+
206
+ function onPointerUp(e: PointerEvent) {
207
+ if (!dragging) return
208
+ dragging = false
209
+ if (!moved) {
210
+ // A click scrolls the clicked item to the center
211
+ const rect = rootEl.value!.getBoundingClientRect()
212
+ animateTo(Math.round(pos + (e.clientY - rect.top - props.height / 2) / ITEM))
213
+ return
214
+ }
215
+ // VelocityTracker: the last 100ms of movement, none if the pointer had stopped for 40ms before release
216
+ const recent = samples.filter((s) => e.timeStamp - s.t < 100)
217
+ const first = recent[0]
218
+ const lastSample = recent[recent.length - 1]
219
+ const dt = first && lastSample && e.timeStamp - lastSample.t <= 40 ? (lastSample.t - first.t) / 1000 : 0
220
+ const vy = dt > 0 ? (lastSample!.y - first!.y) / dt : 0
221
+ vel = -vy / ITEM
222
+ // PagerSnapDistance.atMost(1): a fling moves on to the next item in its direction, no further
223
+ let page: number
224
+ if (Math.abs(vy) > FLING_VELOCITY) page = vy < 0 ? Math.floor(pos) + 1 : Math.ceil(pos) - 1
225
+ else page = Math.round(pos)
226
+ animateTo(page, SNAP)
227
+ }
228
+
229
+ // ── Wheel and keys ──────────────────────────────────────────────────────────────────────────────
230
+ let wheelAcc = 0
231
+ function onWheel(e: WheelEvent) {
232
+ if (props.disabled) return
233
+ e.preventDefault()
234
+ wheelAcc += e.deltaMode === 1 ? e.deltaY * 16 : e.deltaY
235
+ const steps = Math.trunc(wheelAcc / 40)
236
+ if (!steps) return
237
+ wheelAcc -= steps * 40
238
+ animateTo((target ?? Math.round(pos)) + steps)
239
+ }
240
+
241
+ function onKeydown(e: KeyboardEvent) {
242
+ if (props.disabled) return
243
+ const step = e.key === 'ArrowDown' ? 1 : e.key === 'ArrowUp' ? -1 : 0
244
+ if (!step) return
245
+ e.preventDefault()
246
+ animateTo((target ?? Math.round(pos)) + step)
247
+ }
248
+
249
+ onMounted(() => {
250
+ rootEl.value?.addEventListener('wheel', onWheel, { passive: false })
251
+ write()
252
+ })
253
+ onUnmounted(() => {
254
+ cancelAnimationFrame(raf)
255
+ rootEl.value?.removeEventListener('wheel', onWheel)
256
+ })
257
+
258
+ const selectedIndex = computed(() => (props.count > 0 ? mod(selectedPage.value) : 0))
259
+ // The widest label sets the width (the first and last are the longest for numbers)
260
+ const sizer = computed(() => {
261
+ if (props.count <= 0) return ''
262
+ const a = props.format(0)
263
+ const b = props.format(props.count - 1)
264
+ return a.length >= b.length ? a : b
265
+ })
266
+ </script>
267
+
268
+ <template>
269
+ <div
270
+ ref="rootEl"
271
+ role="slider"
272
+ :tabindex="disabled ? -1 : 0"
273
+ :aria-label="label"
274
+ :aria-valuenow="selectedIndex"
275
+ aria-valuemin="0"
276
+ :aria-valuemax="Math.max(count - 1, 0)"
277
+ :aria-valuetext="count > 0 ? format(selectedIndex) : undefined"
278
+ :aria-disabled="disabled || undefined"
279
+ class="relative inline-block touch-none overflow-hidden rounded-lg outline-none select-none focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary"
280
+ :class="disabled ? 'cursor-default bg-surface-container-lowest/38 text-on-surface/38' : 'cursor-grab bg-surface-container-lowest'"
281
+ :style="{ height: `${height}px` }"
282
+ @pointerdown="onPointerDown"
283
+ @pointermove="onPointerMove"
284
+ @pointerup="onPointerUp"
285
+ @pointercancel="onPointerUp"
286
+ @keydown="onKeydown"
287
+ >
288
+ <!-- Sets the width: the widest label in the selected style -->
289
+ <span v-if="!custom" aria-hidden="true" class="invisible block px-4 font-medium" style="font-size: 57px; line-height: 0; height: 0">{{ sizer }}</span>
290
+ <div
291
+ v-for="page in pages"
292
+ :key="page"
293
+ :ref="(el) => setItemEl(page, el)"
294
+ aria-hidden="true"
295
+ class="pointer-events-none absolute inset-x-0 top-0 flex items-center justify-center"
296
+ :style="{ height: `${ITEM}px` }"
297
+ >
298
+ <slot v-if="custom" name="item" :index="mod(page)" :selected="page === selectedPage" />
299
+ <span v-else class="font-sans tabular-nums">{{ count > 0 ? format(mod(page)) : '' }}</span>
300
+ </div>
301
+ </div>
302
+ </template>