@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,11 +1,23 @@
1
1
  <script setup lang="ts">
2
+ /**
3
+ * Two resizable panels divided by a draggable bar with M3's drag handle (MDragHandle) on it. The bar is also a
4
+ * keyboard separator: arrow keys move it (Shift for 10%), Home/End jump to the limits.
5
+ *
6
+ * @slot first Content for the first (left/top) panel
7
+ * @slot second Content for the second (right/bottom) panel
8
+ */
2
9
  import { ref, computed, onBeforeUnmount } from 'vue'
10
+ import MDragHandle from './MDragHandle.vue'
3
11
 
4
12
  const props = withDefaults(
5
13
  defineProps<{
14
+ /** Split direction */
6
15
  direction?: 'horizontal' | 'vertical'
16
+ /** Initial split percentage */
7
17
  initialSplit?: number
18
+ /** Minimum panel percentage */
8
19
  min?: number
20
+ /** Maximum panel percentage */
9
21
  max?: number
10
22
  }>(),
11
23
  { direction: 'horizontal', initialSplit: 50, min: 10, max: 90 },
@@ -30,8 +42,23 @@ const panelBStyle = computed(() =>
30
42
  )
31
43
 
32
44
  function onPointerDown(e: PointerEvent) {
45
+ if (e.button !== 0) return
33
46
  dragging.value = true
34
- ;(e.target as HTMLElement).setPointerCapture(e.pointerId)
47
+ ;(e.currentTarget as HTMLElement).setPointerCapture?.(e.pointerId)
48
+ }
49
+
50
+ function onKeydown(e: KeyboardEvent) {
51
+ const step = e.shiftKey ? 10 : 1
52
+ const back = isHorizontal.value ? 'ArrowLeft' : 'ArrowUp'
53
+ const fwd = isHorizontal.value ? 'ArrowRight' : 'ArrowDown'
54
+ let next: number
55
+ if (e.key === back) next = split.value - step
56
+ else if (e.key === fwd) next = split.value + step
57
+ else if (e.key === 'Home') next = props.min
58
+ else if (e.key === 'End') next = props.max
59
+ else return
60
+ e.preventDefault()
61
+ split.value = Math.min(props.max, Math.max(props.min, next))
35
62
  }
36
63
 
37
64
  function onPointerMove(e: PointerEvent) {
@@ -73,22 +100,28 @@ onBeforeUnmount(() => {
73
100
  </div>
74
101
 
75
102
  <div
76
- class="z-10 flex shrink-0 items-center justify-center transition-colors"
103
+ role="separator"
104
+ tabindex="0"
105
+ :aria-orientation="isHorizontal ? 'vertical' : 'horizontal'"
106
+ :aria-valuenow="Math.round(split)"
107
+ :aria-valuemin="min"
108
+ :aria-valuemax="max"
109
+ class="group z-10 flex shrink-0 items-center justify-center outline-none transition-colors"
77
110
  :class="[
78
- isHorizontal
79
- ? 'w-2 cursor-col-resize flex-col'
80
- : 'h-2 cursor-row-resize flex-row',
81
- dragging ? 'bg-primary/20' : 'bg-outline-variant/40 hover:bg-primary/12',
111
+ isHorizontal ? 'w-2 cursor-col-resize' : 'h-2 cursor-row-resize',
112
+ dragging ? 'bg-primary/20' : 'bg-outline-variant/40 hover:bg-primary/12 focus-visible:bg-primary/12',
82
113
  ]"
83
114
  style="touch-action: none"
84
115
  @pointerdown="onPointerDown"
85
116
  @pointermove="onPointerMove"
86
117
  @pointerup="onPointerUp"
87
118
  @pointercancel="onPointerUp"
119
+ @keydown="onKeydown"
88
120
  >
89
- <div
90
- class="rounded-full bg-outline"
91
- :class="isHorizontal ? 'h-6 w-1' : 'h-1 w-6'"
121
+ <MDragHandle
122
+ :orientation="isHorizontal ? 'vertical' : 'horizontal'"
123
+ :dragging="dragging"
124
+ class="rounded-md group-focus-visible:outline-2 group-focus-visible:outline-offset-2 group-focus-visible:outline-primary"
92
125
  />
93
126
  </div>
94
127
 
@@ -1,4 +1,13 @@
1
1
  <script setup lang="ts">
2
+ /**
3
+ * A spotlight-style search overlay. Unlike MCommandPalette, it doesn't filter internally — you own the results
4
+ * array and update it from the search event, which makes it a natural fit for async/remote search.
5
+ *
6
+ * @event update:modelValue Emitted on open/close — powers v-model
7
+ * @event select Emitted when a result is chosen (click, or Enter)
8
+ * @event search Emitted as the query changes (debounced by the debounce prop) — drive your own filtering and
9
+ * update results in response
10
+ */
2
11
  import { ref, computed, watch, nextTick, onMounted, onBeforeUnmount } from 'vue'
3
12
  import MIcon from './MIcon.vue'
4
13
  import MSpinner from './MSpinner.vue'
@@ -16,15 +25,33 @@ export interface SpotlightResult {
16
25
 
17
26
  const props = withDefaults(
18
27
  defineProps<{
28
+ /** Open/closed state (v-model). Required — there is no default. */
19
29
  modelValue: boolean
30
+ /**
31
+ * Results to render — the component does no filtering itself, it just displays whatever you pass via the
32
+ * search event handler
33
+ */
20
34
  results?: SpotlightResult[]
35
+ /** Search input placeholder — falls back to the locale's own string when unset */
21
36
  placeholder?: string
37
+ /** Shows a spinner in place of the clear button, e.g. while an async search is in flight */
22
38
  loading?: boolean
39
+ /** Empty-state text — falls back to the locale's own string when unset */
23
40
  noResultsText?: string
41
+ /**
42
+ * Global keyboard shortcut key (no modifier) to open the search — ignored while focus is in a text
43
+ * input/textarea/contenteditable
44
+ */
24
45
  hotkey?: string
46
+ /**
47
+ * Delay in ms before the search event fires after the query changes; 0 fires immediately on every keystroke
48
+ */
25
49
  debounce?: number
50
+ /** Footer hint text for the arrow keys — falls back to the locale's own string when unset */
26
51
  navigateHint?: string
52
+ /** Footer hint text for Enter — falls back to the locale's own string when unset */
27
53
  openHint?: string
54
+ /** Footer hint text for Escape — falls back to the locale's own string when unset */
28
55
  closeHint?: string
29
56
  }>(),
30
57
  {
@@ -1,14 +1,26 @@
1
1
  <script setup lang="ts">
2
+ /**
3
+ * Flex stack with gap, alignment, and optional dividers between items.
4
+ *
5
+ * @slot default The stacked items.
6
+ */
2
7
  import { computed } from 'vue'
3
8
 
4
9
  const props = withDefaults(
5
10
  defineProps<{
11
+ /** Stack direction */
6
12
  direction?: 'column' | 'row'
13
+ /** Gap between items (ignored when divider is true) */
7
14
  gap?: 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl'
15
+ /** Cross-axis alignment */
8
16
  align?: 'start' | 'center' | 'end' | 'stretch' | 'baseline'
17
+ /** Main-axis alignment */
9
18
  justify?: 'start' | 'center' | 'end' | 'between' | 'around' | 'evenly'
19
+ /** Allow items to wrap */
10
20
  wrap?: boolean
21
+ /** Show dividers between items instead of a gap */
11
22
  divider?: boolean
23
+ /** Use inline-flex */
12
24
  inline?: boolean
13
25
  }>(),
14
26
  { direction: 'column', gap: 'md', align: 'stretch', justify: 'start', wrap: false, divider: false, inline: false },
@@ -1,14 +1,27 @@
1
1
  <script setup lang="ts">
2
+ /**
3
+ * A compact metric card — title, value, optional icon, and a trend indicator, with a built-in loading skeleton.
4
+ *
5
+ * @slot footer Extra content appended after the trend indicator/label row (only rendered when trend,
6
+ * trendLabel, or this slot is present)
7
+ */
2
8
  import { computed } from 'vue'
3
9
  import MIcon from './MIcon.vue'
4
10
 
5
11
  const props = withDefaults(defineProps<{
12
+ /** Stat label text — required */
6
13
  title: string
14
+ /** Main stat value — required */
7
15
  value: string | number
16
+ /** Material Symbol icon shown in a colored container on the right */
8
17
  icon?: string
18
+ /** Percentage change — positive shows green/up, negative red/down, zero neutral/flat */
9
19
  trend?: number
20
+ /** Text next to the trend indicator (e.g. "vs last month") */
10
21
  trendLabel?: string
22
+ /** Icon container color */
11
23
  color?: 'primary' | 'secondary' | 'tertiary' | 'error' | 'success'
24
+ /** Show a skeleton placeholder instead of the value */
12
25
  loading?: boolean
13
26
  }>(), { color: 'primary' })
14
27
 
@@ -1,4 +1,9 @@
1
1
  <script setup lang="ts">
2
+ /**
3
+ * A multi-step wizard, horizontal or vertical, with icons, descriptions, and optional/error states.
4
+ *
5
+ * @event update:modelValue Emitted with the new current step index.
6
+ */
2
7
  import { computed } from 'vue'
3
8
  import MIcon from './MIcon.vue'
4
9
 
@@ -11,9 +16,16 @@ export interface StepItem {
11
16
  }
12
17
 
13
18
  const props = withDefaults(defineProps<{
19
+ /** Step definitions (see `StepItem`) */
14
20
  steps: StepItem[]
21
+ /** Active step index (0-based), v-model */
15
22
  modelValue: number
23
+ /** Layout direction */
16
24
  direction?: 'horizontal' | 'vertical'
25
+ /**
26
+ * When true, steps are not clickable — only the active step changes via v-model from outside. When false, any
27
+ * non-active step can be clicked to jump to it.
28
+ */
17
29
  linear?: boolean
18
30
  }>(), { direction: 'horizontal', linear: true })
19
31
 
@@ -1,9 +1,16 @@
1
1
  <script setup lang="ts">
2
+ /**
3
+ * Sticks content to the top of its scroll container using `position: sticky`.
4
+ *
5
+ * @slot default The content that sticks.
6
+ */
2
7
  import { computed } from 'vue'
3
8
 
4
9
  const props = withDefaults(
5
10
  defineProps<{
11
+ /** Sticky offset from top (number = px) */
6
12
  top?: string | number
13
+ /** Z-index value */
7
14
  zIndex?: number
8
15
  }>(),
9
16
  { top: 0, zIndex: 40 },
@@ -1,13 +1,22 @@
1
1
  <script setup lang="ts">
2
+ /**
3
+ * Secondary text component with muted color by default — a thin wrapper around `MText`.
4
+ *
5
+ * @slot default The subtitle text.
6
+ */
2
7
  import { computed } from 'vue'
3
8
  import MText from './MText.vue'
4
9
  import type { TextVariant } from './MText.vue'
5
10
 
6
11
  const props = withDefaults(
7
12
  defineProps<{
13
+ /** Subtitle size (maps to body-large/medium/small) */
8
14
  size?: 'large' | 'medium' | 'small'
15
+ /** Text color */
9
16
  color?: 'on-surface' | 'on-surface-variant' | 'primary' | 'secondary' | 'tertiary' | 'error' | 'inherit'
17
+ /** Text alignment */
10
18
  align?: 'left' | 'center' | 'right'
19
+ /** Truncate text with ellipsis on overflow */
11
20
  truncate?: boolean
12
21
  }>(),
13
22
  { size: 'large', color: 'on-surface-variant' },
@@ -1,4 +1,14 @@
1
1
  <script setup lang="ts">
2
+ /**
3
+ * Material 3's supporting pane layout: main content plus a narrower pane that supports it, like related videos
4
+ * next to a player, a cart next to a product or comments next to a document. With room for two panes (840px and
5
+ * up) the supporting pane sits beside the main one; on smaller screens it moves under it, or into a bottom
6
+ * sheet with `single-pane="sheet"`. It measures its own width, not the window's.
7
+ *
8
+ * @slot main The main content
9
+ * @slot supporting Content that supports the main pane: related items, a summary, details, tools
10
+ * @event update:open Emitted when the sheet is dismissed, or closed because both panes fit again
11
+ */
2
12
  import { computed, ref, watch } from 'vue'
3
13
  import MBottomSheet from './MBottomSheet.vue'
4
14
  import { useWindowSizeClass } from '../composables/useWindowSizeClass'
@@ -0,0 +1,247 @@
1
+ <script setup lang="ts">
2
+ /**
3
+ * Content that can be swiped left or right to dismiss it, uncovering a background behind it (a port of
4
+ * Compose's `SwipeToDismissBox`), typically a list item with "archive" and "delete" behind. Once swiped away it
5
+ * stays there until you reset it (`v-model` back to `'settled'`, or `reset()`), so you decide what happens:
6
+ * remove the item, or undo.
7
+ *
8
+ * @slot default The content that moves
9
+ * @slot background What the swipe uncovers. Receives `{ direction, target, progress }`: the side being
10
+ * swiped (`'start-to-end'`, `'end-to-start'` or `'settled'`), the state it would settle in if released now,
11
+ * and how far it has moved (0 to 1)
12
+ * @event update:modelValue Emitted when it settles in a new state — powers v-model
13
+ * @event dismiss Emitted with the direction when the content is swiped away
14
+ */
15
+ import { computed, getCurrentInstance, nextTick, onMounted, onUnmounted, ref, watch } from 'vue'
16
+ import { fastOutSlowIn } from '../composables/_useSpring'
17
+
18
+ export type SwipeToDismissValue = 'settled' | 'start-to-end' | 'end-to-start'
19
+
20
+ const props = withDefaults(defineProps<{
21
+ /** State (v-model): `'settled'`, or dismissed towards `'start-to-end'` / `'end-to-start'`. Set it to animate there. */
22
+ modelValue?: SwipeToDismissValue
23
+ /** Allow dismissing by swiping in the reading direction (right in LTR) */
24
+ startToEnd?: boolean
25
+ /** Allow dismissing by swiping against the reading direction (left in LTR) */
26
+ endToStart?: boolean
27
+ /** Turns the swipe gesture off (setting v-model still works) */
28
+ disabled?: boolean
29
+ /** How far, in px, the content has to move before releasing dismisses it (SwipeToDismissBoxDefaults: 56dp) */
30
+ threshold?: number
31
+ }>(), {
32
+ modelValue: 'settled',
33
+ startToEnd: true,
34
+ endToStart: true,
35
+ disabled: false,
36
+ threshold: 56,
37
+ })
38
+
39
+ const emit = defineEmits<{
40
+ 'update:modelValue': [SwipeToDismissValue]
41
+ dismiss: [Exclude<SwipeToDismissValue, 'settled'>]
42
+ }>()
43
+
44
+ const vnodeProps = getCurrentInstance()?.vnode.props ?? {}
45
+ const controlled = 'onUpdate:modelValue' in vnodeProps
46
+ const rootEl = ref<HTMLElement>()
47
+ const contentEl = ref<HTMLElement>()
48
+ // Offset in px along the reading direction (positive = towards the end)
49
+ const offset = ref(0)
50
+ const width = ref(0)
51
+ const settled = ref<SwipeToDismissValue>(props.modelValue)
52
+ let rtl = false
53
+
54
+ const anchorOf = (v: SwipeToDismissValue) => (v === 'start-to-end' ? width.value : v === 'end-to-start' ? -width.value : 0)
55
+
56
+ const direction = computed<SwipeToDismissValue>(() =>
57
+ offset.value > 0 ? 'start-to-end' : offset.value < 0 ? 'end-to-start' : 'settled')
58
+ // targetValue without a fling: the closest anchor once past the threshold from where the drag started
59
+ const target = computed<SwipeToDismissValue>(() => {
60
+ if (settled.value !== 'settled') return settled.value
61
+ if (offset.value >= props.threshold && props.startToEnd) return 'start-to-end'
62
+ if (offset.value <= -props.threshold && props.endToStart) return 'end-to-start'
63
+ return 'settled'
64
+ })
65
+ const progress = computed(() => (width.value ? Math.min(1, Math.abs(offset.value) / width.value) : 0))
66
+
67
+ function write() {
68
+ if (contentEl.value) contentEl.value.style.transform = offset.value ? `translateX(${rtl ? -offset.value : offset.value}px)` : ''
69
+ }
70
+ watch(offset, write)
71
+
72
+ // ── Settling: AnchoredDraggableDefaults.SnapAnimationSpec is tween() (300ms, FastOutSlowIn) ─────
73
+ let raf = 0
74
+ function animateTo(value: SwipeToDismissValue) {
75
+ cancelAnimationFrame(raf)
76
+ width.value = rootEl.value?.offsetWidth ?? width.value
77
+ const from = offset.value
78
+ const to = anchorOf(value)
79
+ const start = performance.now()
80
+ const step = (now: number) => {
81
+ const t = Math.min(1, (now - start) / 300)
82
+ offset.value = from + (to - from) * fastOutSlowIn(t)
83
+ if (t < 1) raf = requestAnimationFrame(step)
84
+ else settle(value)
85
+ }
86
+ if (from === to) settle(value)
87
+ else raf = requestAnimationFrame(step)
88
+ }
89
+
90
+ function settle(value: SwipeToDismissValue) {
91
+ raf = 0
92
+ offset.value = anchorOf(value)
93
+ if (settled.value === value) return
94
+ settled.value = value
95
+ emit('update:modelValue', value)
96
+ if (value !== 'settled') emit('dismiss', value)
97
+ // With v-model, a parent that sets it straight back (inside @dismiss, say) leaves the prop unchanged, so
98
+ // the watcher below never fires: compare once the parent has updated
99
+ if (controlled) nextTick(() => { if (props.modelValue !== settled.value) animateTo(props.modelValue) })
100
+ }
101
+
102
+ watch(() => props.modelValue, (v) => { if (v !== settled.value) animateTo(v) })
103
+
104
+ // ── Gesture ─────────────────────────────────────────────────────────────────────────────────────
105
+ // Touch keeps vertical scrolling (touch-action: pan-y); a drag only starts once the pointer has moved
106
+ // sideways more than it has vertically.
107
+ const SLOP = 8
108
+ // AnchoredDraggableMinFlingVelocity
109
+ const FLING_VELOCITY = 125
110
+ let pointerId: number | null = null
111
+ let startX = 0
112
+ let startY = 0
113
+ let startOffset = 0
114
+ let dragging = false
115
+ let samples: { t: number; x: number }[] = []
116
+ let suppressClick = false
117
+
118
+ function onPointerDown(e: PointerEvent) {
119
+ // Gestures are off while dismissed, as in SwipeToDismissBox
120
+ if (props.disabled || settled.value !== 'settled' || e.button !== 0) return
121
+ pointerId = e.pointerId
122
+ startX = e.clientX
123
+ startY = e.clientY
124
+ startOffset = offset.value
125
+ dragging = false
126
+ window.addEventListener('pointermove', onPointerMove)
127
+ window.addEventListener('pointerup', onPointerUp)
128
+ window.addEventListener('pointercancel', onPointerUp)
129
+ }
130
+
131
+ function along(e: PointerEvent) {
132
+ return rtl ? startX - e.clientX : e.clientX - startX
133
+ }
134
+
135
+ function onPointerMove(e: PointerEvent) {
136
+ if (e.pointerId !== pointerId) return
137
+ const dx = e.clientX - startX
138
+ const dy = e.clientY - startY
139
+ if (!dragging) {
140
+ if (Math.abs(dy) > SLOP && Math.abs(dy) > Math.abs(dx)) return release()
141
+ if (Math.abs(dx) <= SLOP) return
142
+ dragging = true
143
+ cancelAnimationFrame(raf)
144
+ raf = 0
145
+ width.value = rootEl.value?.offsetWidth ?? 0
146
+ document.body.style.userSelect = 'none'
147
+ }
148
+ const min = props.endToStart ? -width.value : 0
149
+ const max = props.startToEnd ? width.value : 0
150
+ offset.value = Math.min(max, Math.max(min, startOffset + along(e)))
151
+ samples.push({ t: e.timeStamp, x: rtl ? -e.clientX : e.clientX })
152
+ samples = samples.filter((s) => e.timeStamp - s.t < 100)
153
+ }
154
+
155
+ function onPointerUp(e: PointerEvent) {
156
+ if (e.pointerId !== pointerId) return
157
+ if (!dragging) return release()
158
+ const velocity = releaseVelocity(e.timeStamp)
159
+ suppressClick = true
160
+ release()
161
+ animateTo(computeTarget(velocity))
162
+ }
163
+
164
+ // Like Compose's VelocityTracker: the last 100ms of movement, and no velocity at all if the pointer had
165
+ // stopped (AssumePointerMoveStoppedMilliseconds = 40) before it was released
166
+ function releaseVelocity(upTime: number) {
167
+ const recent = samples.filter((s) => upTime - s.t < 100)
168
+ const first = recent[0]
169
+ const last = recent[recent.length - 1]
170
+ if (!first || !last || upTime - last.t > 40) return 0
171
+ const dt = (last.t - first.t) / 1000
172
+ return dt > 0 ? (last.x - first.x) / dt : 0
173
+ }
174
+
175
+ // AnchoredDraggable's computeTarget(): at rest the closest anchor; a fast fling goes to the next anchor in
176
+ // its direction; otherwise the next anchor once past the positional threshold from the previous one.
177
+ function computeTarget(velocity: number): SwipeToDismissValue {
178
+ const anchors: [SwipeToDismissValue, number][] = [['settled', 0]]
179
+ if (props.startToEnd) anchors.push(['start-to-end', width.value])
180
+ if (props.endToStart) anchors.push(['end-to-start', -width.value])
181
+ anchors.sort((a, b) => a[1] - b[1])
182
+ const x = offset.value
183
+ if (velocity === 0) {
184
+ return anchors.reduce((best, a) => (Math.abs(a[1] - x) < Math.abs(best[1] - x) ? a : best))[0]
185
+ }
186
+ const forward = velocity > 0
187
+ const below = [...anchors].reverse().find((a) => a[1] <= x) ?? anchors[0]!
188
+ const above = anchors.find((a) => a[1] >= x) ?? anchors[anchors.length - 1]!
189
+ if (Math.abs(velocity) >= FLING_VELOCITY) return (forward ? above : below)[0]
190
+ const from = forward ? below : above
191
+ return Math.abs(x - from[1]) >= props.threshold ? (forward ? above : below)[0] : from[0]
192
+ }
193
+
194
+ function release() {
195
+ pointerId = null
196
+ dragging = false
197
+ samples = []
198
+ document.body.style.userSelect = ''
199
+ window.removeEventListener('pointermove', onPointerMove)
200
+ window.removeEventListener('pointerup', onPointerUp)
201
+ window.removeEventListener('pointercancel', onPointerUp)
202
+ }
203
+
204
+ // A drag that ends over a button inside the content shouldn't also click it
205
+ function onClickCapture(e: MouseEvent) {
206
+ if (!suppressClick) return
207
+ suppressClick = false
208
+ e.stopPropagation()
209
+ e.preventDefault()
210
+ }
211
+
212
+ let resizeObserver: ResizeObserver | undefined
213
+ onMounted(() => {
214
+ rtl = rootEl.value ? getComputedStyle(rootEl.value).direction === 'rtl' : false
215
+ width.value = rootEl.value?.offsetWidth ?? 0
216
+ offset.value = anchorOf(settled.value)
217
+ write()
218
+ resizeObserver = new ResizeObserver(() => {
219
+ width.value = rootEl.value?.offsetWidth ?? 0
220
+ if (!dragging && !raf) offset.value = anchorOf(settled.value)
221
+ })
222
+ if (rootEl.value) resizeObserver.observe(rootEl.value)
223
+ })
224
+ onUnmounted(() => {
225
+ cancelAnimationFrame(raf)
226
+ release()
227
+ resizeObserver?.disconnect()
228
+ })
229
+
230
+ defineExpose({
231
+ /** Animates back to `'settled'` */
232
+ reset: () => animateTo('settled'),
233
+ /** Animates away in the given direction */
234
+ dismiss: (dir: Exclude<SwipeToDismissValue, 'settled'>) => animateTo(dir),
235
+ })
236
+ </script>
237
+
238
+ <template>
239
+ <div ref="rootEl" class="relative touch-pan-y overflow-hidden" @pointerdown="onPointerDown" @click.capture="onClickCapture">
240
+ <div class="absolute inset-0 flex">
241
+ <slot name="background" :direction="direction" :target="target" :progress="progress" />
242
+ </div>
243
+ <div ref="contentEl" class="relative">
244
+ <slot />
245
+ </div>
246
+ </div>
247
+ </template>
@@ -1,19 +1,27 @@
1
1
  <script setup lang="ts">
2
+ /**
3
+ * A toggle switch with an optional label, 4 semantic colors, and both M3 icon variants.
4
+ *
5
+ * @event update:modelValue Emitted with the new on/off state.
6
+ */
2
7
  import { computed, ref } from 'vue'
3
8
  import MIcon from './MIcon.vue'
4
9
 
5
10
  const props = withDefaults(
6
11
  defineProps<{
12
+ /** Toggle state (v-model) */
7
13
  modelValue: boolean
14
+ /** Disables the switch */
8
15
  disabled?: boolean
16
+ /** Label text */
9
17
  label?: string
18
+ /** Track/thumb color when on */
10
19
  color?: 'primary' | 'secondary' | 'tertiary' | 'error'
11
- /**
12
- * M3 officially has two Switch variants: with a check icon inside the thumb (the
13
- * `thumbContent` slot filled), and without (Compose's actual default — `thumbContent`
14
- * defaults to `null`). Defaults to `true` here to keep this component's existing look;
15
- * pass `false` for the plain/no-icon variant.
16
- */
20
+ /** Shows a check icon in the thumb while on. Set to `false` for M3's plain switch without an icon. */
21
+ // M3 officially has two Switch variants: with a check icon inside the thumb (the
22
+ // `thumbContent` slot filled), and without (Compose's actual default — `thumbContent`
23
+ // defaults to `null`). Defaults to `true` here to keep this component's existing look;
24
+ // pass `false` for the plain/no-icon variant.
17
25
  icon?: boolean
18
26
  }>(),
19
27
  { disabled: false, color: 'primary', icon: true },
@@ -1,4 +1,17 @@
1
1
  <script setup lang="ts">
2
+ /**
3
+ * A simple, general-purpose data table — sortable columns, built-in search, pagination, and optional row
4
+ * selection, with an escape hatch to delegate all three to your backend via serverSide.
5
+ *
6
+ * @slot toolbar Extra content in the toolbar next to the search input (filters, buttons, etc.)
7
+ * @slot empty Custom empty-state content, replaces the default icon + text
8
+ * @slot row-actions Per-row action buttons — rendering this slot adds a trailing actions column
9
+ * @event update:modelValue Emitted when the selection changes — powers v-model
10
+ * @event update:page Emitted when the page changes — powers v-model:page
11
+ * @event rowClick Emitted with the row's data when you click a row (unless `selectOnRowClick` makes the click
12
+ * select it).
13
+ * @event fetch Emitted instead of filtering locally when serverSide is true
14
+ */
2
15
  import { computed, onMounted, ref, watch } from 'vue'
3
16
  import MCheckbox from './MCheckbox.vue'
4
17
  import MIcon from './MIcon.vue'
@@ -28,25 +41,41 @@ const SKEL = [65, 80, 50, 75, 90, 55, 70, 85, 60, 78, 88, 52, 70, 83, 58]
28
41
 
29
42
  const props = withDefaults(
30
43
  defineProps<{
44
+ /** Column definitions: { key, label, sortable?, width?, align? } */
31
45
  columns: TableColumn[]
46
+ /** Table data rows */
32
47
  rows: Record<string, any>[]
48
+ /** Show skeleton loading state */
33
49
  loading?: boolean
50
+ /** Text when no rows (defaults to the locale string) */
34
51
  emptyText?: string
52
+ /** Unique key field in each row */
35
53
  rowKey?: string
36
- selectable?: boolean
37
- /** Con `selectable`, que el click en cualquier parte de la fila la marque/desmarque (en vez de
38
- * emitir `rowClick`). Default false: sólo el checkbox selecciona y el click en la fila emite
39
- * `rowClick`, así una tabla puede seleccionar filas y a la vez abrirlas al click.
54
+ /**
55
+ * Enable row selection with checkboxes (by default only the checkbox toggles a row; clicking the row itself
56
+ * still emits row-click)
40
57
  */
58
+ selectable?: boolean
59
+ /** With selectable, clicking anywhere on a row toggles its selection instead of emitting row-click */
60
+ // Con `selectable`, que el click en cualquier parte de la fila la marque/desmarque (en vez de
61
+ // emitir `rowClick`). Default false: sólo el checkbox selecciona y el click en la fila emite
62
+ // `rowClick`, así una tabla puede seleccionar filas y a la vez abrirlas al click.
41
63
  selectOnRowClick?: boolean
64
+ /** Selected rows (v-model) */
42
65
  modelValue?: Record<string, any>[]
66
+ /** Rows per page */
43
67
  perPage?: number
68
+ /** Show search input */
44
69
  searchable?: boolean
45
70
  /** Emit `fetch` instead of filtering locally. Requires :total. */
46
71
  serverSide?: boolean
72
+ /** Total rows (for server-side pagination) */
47
73
  total?: number
74
+ /** Current page (v-model via update:page) */
48
75
  page?: number
76
+ /** Placeholder for search input (defaults to the locale string) */
49
77
  searchPlaceholder?: string
78
+ /** Text for selected count badge, pluralized with 's' (defaults to the locale string) */
50
79
  selectedText?: string
51
80
  }>(),
52
81
  {
@@ -1,4 +1,10 @@
1
1
  <script setup lang="ts">
2
+ /**
3
+ * Switches between different views or content sections. The indicator animates via two independent springs
4
+ * (offset and width), not a CSS transition — see the component source for details.
5
+ *
6
+ * @event update:modelValue Emitted with the value of the tab you picked.
7
+ */
2
8
  import { nextTick, onMounted, onUnmounted, ref, watch } from 'vue'
3
9
  import MIcon from './MIcon.vue'
4
10
 
@@ -10,8 +16,14 @@ interface Tab {
10
16
  }
11
17
 
12
18
  const props = withDefaults(defineProps<{
19
+ /** Active tab value (v-model) */
13
20
  modelValue: string | number
21
+ /** Tab definitions */
14
22
  tabs: Tab[]
23
+ /**
24
+ * Primary: short sliding underline shorter than the tab with a stretch animation. Secondary: full-width
25
+ * underline spanning the entire tab, text-only.
26
+ */
15
27
  variant?: 'primary' | 'secondary'
16
28
  /** Fixed (default, M3 `TabRow`): tabs evenly share the available width, no scrolling — use for 2-5 tabs. Scrollable (M3 `ScrollableTabRow`): tabs keep their natural width and the row scrolls horizontally when they overflow — use for many tabs. */
17
29
  scrollable?: boolean