@m3ui-vue/m3ui-vue 0.8.8 → 0.9.1
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.
- package/README.md +25 -5
- package/dist/API.md +3661 -0
- package/dist/MIcon-CaEooCmZ.js.map +1 -1
- package/dist/{MMenuItem-5xojJYAL.js → MTextField-pJU1vFaR.js} +374 -364
- package/dist/MTextField-pJU1vFaR.js.map +1 -0
- package/dist/api.json +1 -0
- package/dist/barcode.js +9 -11
- package/dist/barcode.js.map +1 -1
- package/dist/chart.js.map +1 -1
- package/dist/code-editor.js +2 -2
- package/dist/code-editor.js.map +1 -1
- package/dist/components/MAbsolute.vue.d.ts +12 -0
- package/dist/components/MAlert.vue.d.ts +4 -0
- package/dist/components/MAppBar.vue.d.ts +12 -0
- package/dist/components/MAppLayout.vue.d.ts +2 -0
- package/dist/components/MAspectRatio.vue.d.ts +1 -0
- package/dist/components/MAutocomplete.vue.d.ts +18 -0
- package/dist/components/MAvatar.vue.d.ts +3 -0
- package/dist/components/MBadge.vue.d.ts +6 -0
- package/dist/components/MBar.vue.d.ts +5 -0
- package/dist/components/MBarcode.vue.d.ts +9 -0
- package/dist/components/MBottomSheet.vue.d.ts +3 -0
- package/dist/components/MBox.vue.d.ts +6 -0
- package/dist/components/MBreadcrumbs.vue.d.ts +2 -0
- package/dist/components/MButton.vue.d.ts +14 -4
- package/dist/components/MButtonGroup.vue.d.ts +7 -0
- package/dist/components/MCalendar.vue.d.ts +8 -0
- package/dist/components/MCard.vue.d.ts +17 -0
- package/dist/components/MCarousel.vue.d.ts +61 -36
- package/dist/components/MCenter.vue.d.ts +1 -0
- package/dist/components/MChart.vue.d.ts +7 -0
- package/dist/components/MChatBubble.vue.d.ts +10 -0
- package/dist/components/MCheckbox.vue.d.ts +5 -0
- package/dist/components/MChip.vue.d.ts +9 -0
- package/dist/components/MCircleProgressBar.vue.d.ts +7 -0
- package/dist/components/MCodeEditor.vue.d.ts +9 -0
- package/dist/components/MColorPicker.vue.d.ts +8 -0
- package/dist/components/MColorPickerModal.vue.d.ts +4 -0
- package/dist/components/MCommandPalette.vue.d.ts +8 -0
- package/dist/components/MConfirmDialog.vue.d.ts +7 -0
- package/dist/components/MContainer.vue.d.ts +4 -0
- package/dist/components/MContextMenu.vue.d.ts +3 -6
- package/dist/components/MCopyButton.vue.d.ts +10 -0
- package/dist/components/MDataTable.vue.d.ts +33 -12
- package/dist/components/MDatePicker.vue.d.ts +16 -0
- package/dist/components/MDatePickerModal.vue.d.ts +9 -0
- package/dist/components/MDateRangePicker.vue.d.ts +18 -0
- package/dist/components/MDateRangePickerModal.vue.d.ts +9 -0
- package/dist/components/MDialog.vue.d.ts +10 -6
- package/dist/components/MDivider.vue.d.ts +6 -0
- package/dist/components/MDragDropList.vue.d.ts +6 -0
- package/dist/components/MEmoji.vue.d.ts +6 -0
- package/dist/components/MEmojiButton.vue.d.ts +5 -0
- package/dist/components/MEmojiSelector.vue.d.ts +21 -5
- package/dist/components/MEmptyState.vue.d.ts +4 -0
- package/dist/components/MExpansionPanel.vue.d.ts +9 -0
- package/dist/components/MExportButton.vue.d.ts +8 -0
- package/dist/components/MFab.vue.d.ts +9 -0
- package/dist/components/MFabMenu.vue.d.ts +15 -1
- package/dist/components/MFileUpload.vue.d.ts +8 -0
- package/dist/components/MFixed.vue.d.ts +10 -0
- package/dist/components/MFlex.vue.d.ts +7 -1
- package/dist/components/MFooter.vue.d.ts +11 -0
- package/dist/components/MFullscreen.vue.d.ts +2 -0
- package/dist/components/MGrid.vue.d.ts +7 -0
- package/dist/components/MHotkeys.vue.d.ts +4 -0
- package/dist/components/MIcon.vue.d.ts +2 -0
- package/dist/components/MIconButton.vue.d.ts +10 -0
- package/dist/components/MInfiniteScroll.vue.d.ts +6 -0
- package/dist/components/MJsonEditor.vue.d.ts +8 -0
- package/dist/components/MJsonViewer.vue.d.ts +4 -0
- package/dist/components/MKanban.vue.d.ts +2 -0
- package/dist/components/MKbd.vue.d.ts +2 -0
- package/dist/components/MLightbox.vue.d.ts +19 -5
- package/dist/components/MList.vue.d.ts +7 -0
- package/dist/components/MListItem.vue.d.ts +24 -0
- package/dist/components/MListSubheader.vue.d.ts +6 -0
- package/dist/components/MLoadingIndicator.vue.d.ts +10 -0
- package/dist/components/MLoadingOverlay.vue.d.ts +5 -0
- package/dist/components/MMarkdown.vue.d.ts +3 -0
- package/dist/components/MMaskField.vue.d.ts +15 -0
- package/dist/components/MMasonry.vue.d.ts +5 -0
- package/dist/components/MMenu.vue.d.ts +3 -6
- package/dist/components/MMenuDivider.vue.d.ts +4 -0
- package/dist/components/MMenuItem.vue.d.ts +5 -0
- package/dist/components/MMultiAutocomplete.vue.d.ts +20 -0
- package/dist/components/MMultiSelect.vue.d.ts +21 -0
- package/dist/components/MNavigationBar.vue.d.ts +2 -0
- package/dist/components/MNavigationDrawer.vue.d.ts +11 -0
- package/dist/components/MNavigationRail.vue.d.ts +9 -6
- package/dist/components/MNavigationSuite.vue.d.ts +5 -3
- package/dist/components/MNumberField.vue.d.ts +17 -0
- package/dist/components/MOverlay.vue.d.ts +3 -0
- package/dist/components/MPageProgress.vue.d.ts +3 -0
- package/dist/components/MPagination.vue.d.ts +3 -0
- package/dist/components/MPasswordMeter.vue.d.ts +1 -0
- package/dist/components/MPinInput.vue.d.ts +11 -0
- package/dist/components/MProgressBar.vue.d.ts +6 -0
- package/dist/components/MPullToRefresh.vue.d.ts +8 -0
- package/dist/components/MQRCode.vue.d.ts +6 -0
- package/dist/components/MRadio.vue.d.ts +5 -0
- package/dist/components/MRadioGroup.vue.d.ts +6 -0
- package/dist/components/MRating.vue.d.ts +11 -0
- package/dist/components/MRelativeTime.vue.d.ts +1 -0
- package/dist/components/MResponsive.vue.d.ts +3 -0
- package/dist/components/MResult.vue.d.ts +6 -0
- package/dist/components/MRichTextEditor.vue.d.ts +8 -0
- package/dist/components/MScheduler.vue.d.ts +48 -1
- package/dist/components/MScrollable.vue.d.ts +3 -0
- package/dist/components/MSearchBar.vue.d.ts +6 -0
- package/dist/components/MSection.vue.d.ts +5 -0
- package/dist/components/MSegmentedButton.vue.d.ts +5 -0
- package/dist/components/MSelect.vue.d.ts +17 -0
- package/dist/components/MShader.vue.d.ts +1 -0
- package/dist/components/MShape.vue.d.ts +1 -1
- package/dist/components/MShortNavigationBar.vue.d.ts +8 -9
- package/dist/components/MSideSheet.vue.d.ts +3 -0
- package/dist/components/MSignaturePad.vue.d.ts +7 -0
- package/dist/components/MSimpleCarousel.vue.d.ts +12 -2
- package/dist/components/MSkeleton.vue.d.ts +8 -0
- package/dist/components/MSlider.vue.d.ts +15 -1
- package/dist/components/MSnackbar.vue.d.ts +1 -0
- package/dist/components/MSpinner.vue.d.ts +6 -0
- package/dist/components/MSplitButton.vue.d.ts +7 -0
- package/dist/components/MSplitter.vue.d.ts +4 -0
- package/dist/components/MSpotlightSearch.vue.d.ts +18 -0
- package/dist/components/MStack.vue.d.ts +8 -1
- package/dist/components/MStatCard.vue.d.ts +7 -0
- package/dist/components/MStepper.vue.d.ts +7 -0
- package/dist/components/MSticky.vue.d.ts +2 -0
- package/dist/components/MSubtitle.vue.d.ts +4 -0
- package/dist/components/MSwitch.vue.d.ts +5 -6
- package/dist/components/MTable.vue.d.ts +17 -4
- package/dist/components/MTabs.vue.d.ts +6 -0
- package/dist/components/MTagInput.vue.d.ts +17 -0
- package/dist/components/MTerminal.vue.d.ts +4 -0
- package/dist/components/MText.vue.d.ts +10 -0
- package/dist/components/MTextField.vue.d.ts +18 -0
- package/dist/components/MTimePicker.vue.d.ts +10 -0
- package/dist/components/MTimePickerModal.vue.d.ts +5 -0
- package/dist/components/MTimeline.vue.d.ts +3 -0
- package/dist/components/MTitle.vue.d.ts +4 -0
- package/dist/components/MToggleButton.vue.d.ts +4 -0
- package/dist/components/MToolbar.vue.d.ts +6 -1
- package/dist/components/MTooltip.vue.d.ts +7 -0
- package/dist/components/MTopAppBar.vue.d.ts +8 -0
- package/dist/components/MTour.vue.d.ts +5 -0
- package/dist/components/MTransferList.vue.d.ts +11 -0
- package/dist/components/MTree.vue.d.ts +11 -0
- package/dist/components/MTreeTable.vue.d.ts +7 -0
- package/dist/components/MVirtualTable.vue.d.ts +6 -0
- package/dist/components/MWindow.vue.d.ts +33 -1
- package/dist/composables/_carouselStrategy.d.ts +101 -0
- package/dist/composables/useLocale.d.ts +21 -0
- package/dist/data/emoji-names/emoji-names-de.d.ts +2 -0
- package/dist/data/emoji-names/emoji-names-en.d.ts +2 -0
- package/dist/data/emoji-names/emoji-names-es.d.ts +2 -0
- package/dist/data/emoji-names/emoji-names-fr.d.ts +2 -0
- package/dist/data/emoji-names/emoji-names-ja.d.ts +2 -0
- package/dist/data/emoji-names/emoji-names-ko.d.ts +2 -0
- package/dist/data/emoji-names/emoji-names-pt.d.ts +2 -0
- package/dist/data/emoji-names/emoji-names-zh.d.ts +2 -0
- package/dist/data/emojis.d.ts +7 -1
- package/dist/emoji-names-de-BphO5XpV.js +1877 -0
- package/dist/emoji-names-de-BphO5XpV.js.map +1 -0
- package/dist/emoji-names-en-9ZvMRvzi.js +1877 -0
- package/dist/emoji-names-en-9ZvMRvzi.js.map +1 -0
- package/dist/emoji-names-es-DvfWU3Pj.js +1877 -0
- package/dist/emoji-names-es-DvfWU3Pj.js.map +1 -0
- package/dist/emoji-names-fr-B-jhUlsP.js +1877 -0
- package/dist/emoji-names-fr-B-jhUlsP.js.map +1 -0
- package/dist/emoji-names-ja-l8cMFJo1.js +1877 -0
- package/dist/emoji-names-ja-l8cMFJo1.js.map +1 -0
- package/dist/emoji-names-ko-YP-o9G0c.js +1877 -0
- package/dist/emoji-names-ko-YP-o9G0c.js.map +1 -0
- package/dist/emoji-names-pt-DGj_Js4M.js +1877 -0
- package/dist/emoji-names-pt-DGj_Js4M.js.map +1 -0
- package/dist/emoji-names-zh-Dzecwtw_.js +1877 -0
- package/dist/emoji-names-zh-Dzecwtw_.js.map +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/locales/index.js +140 -7
- package/dist/locales/index.js.map +1 -1
- package/dist/m3ui-vue.css +1 -1
- package/dist/m3ui.js +6642 -5160
- package/dist/m3ui.js.map +1 -1
- package/dist/markdown.js +1 -1
- package/dist/markdown.js.map +1 -1
- package/dist/plugin.d.ts +6 -0
- package/dist/qrcode.js.map +1 -1
- package/dist/rich-text-editor.js +10 -10
- package/dist/rich-text-editor.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/terminal.js +34 -27
- package/dist/terminal.js.map +1 -1
- package/dist/{useLocale-D3ZWZ8jY.js → useLocale-Drihe5G2.js} +33 -11
- package/dist/useLocale-Drihe5G2.js.map +1 -0
- package/package.json +4 -2
- package/src/__tests__/MCarousel.test.ts +183 -21
- package/src/__tests__/MDialog.test.ts +18 -0
- package/src/__tests__/MEmojiSelector.test.ts +138 -0
- package/src/__tests__/MHotkeys.test.ts +57 -0
- package/src/__tests__/MLightbox.test.ts +313 -5
- package/src/__tests__/MScheduler.test.ts +122 -0
- package/src/__tests__/MTerminal.test.ts +63 -0
- package/src/__tests__/attrsFallthrough.test.ts +65 -0
- package/src/__tests__/hostLocale.test.ts +57 -0
- package/src/__tests__/plugin.test.ts +28 -1
- package/src/components/MAbsolute.vue +18 -0
- package/src/components/MAlert.vue +12 -0
- package/src/components/MAppBar.vue +12 -0
- package/src/components/MAppLayout.vue +11 -0
- package/src/components/MAspectRatio.vue +6 -0
- package/src/components/MAutocomplete.vue +24 -0
- package/src/components/MAvatar.vue +12 -1
- package/src/components/MBadge.vue +11 -0
- package/src/components/MBar.vue +19 -0
- package/src/components/MBarcode.vue +18 -2
- package/src/components/MBottomSheet.vue +13 -1
- package/src/components/MBox.vue +12 -0
- package/src/components/MBreadcrumbs.vue +7 -0
- package/src/components/MButton.vue +22 -4
- package/src/components/MButtonGroup.vue +13 -0
- package/src/components/MCalendar.vue +14 -0
- package/src/components/MCard.vue +26 -0
- package/src/components/MCarousel.vue +542 -200
- package/src/components/MCenter.vue +6 -0
- package/src/components/MChart.vue +12 -0
- package/src/components/MChatBubble.vue +17 -0
- package/src/components/MCheckbox.vue +11 -0
- package/src/components/MChip.vue +17 -0
- package/src/components/MCircleProgressBar.vue +13 -0
- package/src/components/MCodeEditor.vue +18 -2
- package/src/components/MColorPicker.vue +13 -0
- package/src/components/MColorPickerModal.vue +12 -0
- package/src/components/MCommandPalette.vue +17 -1
- package/src/components/MConfirmDialog.vue +15 -0
- package/src/components/MContainer.vue +9 -0
- package/src/components/MContextMenu.vue +20 -7
- package/src/components/MCopyButton.vue +16 -0
- package/src/components/MDataTable.vue +58 -12
- package/src/components/MDatePicker.vue +21 -0
- package/src/components/MDatePickerModal.vue +17 -1
- package/src/components/MDateRangePicker.vue +23 -0
- package/src/components/MDateRangePickerModal.vue +17 -1
- package/src/components/MDialog.vue +43 -10
- package/src/components/MDivider.vue +6 -0
- package/src/components/MDragDropList.vue +18 -0
- package/src/components/MEmoji.vue +6 -0
- package/src/components/MEmojiButton.vue +11 -0
- package/src/components/MEmojiSelector.vue +486 -78
- package/src/components/MEmptyState.vue +9 -0
- package/src/components/MExpansionPanel.vue +17 -0
- package/src/components/MExportButton.vue +15 -0
- package/src/components/MFab.vue +20 -1
- package/src/components/MFabMenu.vue +20 -0
- package/src/components/MFileUpload.vue +19 -0
- package/src/components/MFixed.vue +16 -0
- package/src/components/MFlex.vue +11 -0
- package/src/components/MFooter.vue +11 -0
- package/src/components/MFullscreen.vue +8 -0
- package/src/components/MGrid.vue +12 -0
- package/src/components/MHotkeys.vue +20 -13
- package/src/components/MIcon.vue +10 -1
- package/src/components/MIconButton.vue +13 -0
- package/src/components/MInfiniteScroll.vue +16 -0
- package/src/components/MJsonEditor.vue +13 -0
- package/src/components/MJsonViewer.vue +7 -0
- package/src/components/MKanban.vue +18 -0
- package/src/components/MKbd.vue +6 -0
- package/src/components/MLightbox.vue +766 -268
- package/src/components/MList.vue +15 -0
- package/src/components/MListDetail.vue +11 -0
- package/src/components/MListItem.vue +37 -0
- package/src/components/MListSubheader.vue +6 -0
- package/src/components/MLoadingIndicator.vue +15 -0
- package/src/components/MLoadingOverlay.vue +18 -1
- package/src/components/MMarkdown.vue +7 -0
- package/src/components/MMaskField.vue +21 -0
- package/src/components/MMasonry.vue +11 -0
- package/src/components/MMenu.vue +19 -7
- package/src/components/MMenuDivider.vue +4 -0
- package/src/components/MMenuItem.vue +16 -0
- package/src/components/MMultiAutocomplete.vue +26 -0
- package/src/components/MMultiSelect.vue +27 -0
- package/src/components/MNavigationBar.vue +7 -0
- package/src/components/MNavigationDrawer.vue +30 -1
- package/src/components/MNavigationRail.vue +27 -6
- package/src/components/MNavigationSuite.vue +20 -3
- package/src/components/MNotificationHost.vue +3 -0
- package/src/components/MNumberField.vue +24 -0
- package/src/components/MOverlay.vue +11 -0
- package/src/components/MPageProgress.vue +7 -0
- package/src/components/MPagination.vue +15 -1
- package/src/components/MPasswordMeter.vue +7 -0
- package/src/components/MPinInput.vue +19 -0
- package/src/components/MProgressBar.vue +9 -0
- package/src/components/MPullToRefresh.vue +17 -0
- package/src/components/MQRCode.vue +12 -0
- package/src/components/MRadio.vue +11 -0
- package/src/components/MRadioGroup.vue +11 -0
- package/src/components/MRating.vue +19 -0
- package/src/components/MRelative.vue +8 -0
- package/src/components/MRelativeTime.vue +6 -0
- package/src/components/MResponsive.vue +9 -0
- package/src/components/MResult.vue +14 -0
- package/src/components/MRichTextEditor.vue +14 -0
- package/src/components/MScheduler.vue +303 -115
- package/src/components/MScrollable.vue +8 -0
- package/src/components/MSearchBar.vue +17 -0
- package/src/components/MSection.vue +13 -0
- package/src/components/MSegmentedButton.vue +10 -0
- package/src/components/MSelect.vue +22 -0
- package/src/components/MShader.vue +13 -0
- package/src/components/MShape.vue +6 -0
- package/src/components/MShortNavigationBar.vue +23 -9
- package/src/components/MSideSheet.vue +14 -1
- package/src/components/MSignaturePad.vue +15 -0
- package/src/components/MSimpleCarousel.vue +18 -0
- package/src/components/MSkeleton.vue +8 -0
- package/src/components/MSlider.vue +21 -0
- package/src/components/MSnackbar.vue +5 -0
- package/src/components/MSpacer.vue +6 -0
- package/src/components/MSpinner.vue +10 -0
- package/src/components/MSplitButton.vue +17 -1
- package/src/components/MSplitter.vue +10 -0
- package/src/components/MSpotlightSearch.vue +28 -1
- package/src/components/MStack.vue +12 -0
- package/src/components/MStatCard.vue +13 -0
- package/src/components/MStepper.vue +12 -0
- package/src/components/MSticky.vue +7 -0
- package/src/components/MSubtitle.vue +9 -0
- package/src/components/MSupportingPane.vue +10 -0
- package/src/components/MSwitch.vue +14 -6
- package/src/components/MTable.vue +33 -4
- package/src/components/MTabs.vue +12 -0
- package/src/components/MTagInput.vue +23 -0
- package/src/components/MTerminal.vue +33 -10
- package/src/components/MText.vue +15 -0
- package/src/components/MTextField.vue +26 -0
- package/src/components/MTimePicker.vue +15 -0
- package/src/components/MTimePickerModal.vue +13 -1
- package/src/components/MTimeline.vue +7 -0
- package/src/components/MTitle.vue +9 -0
- package/src/components/MToggleButton.vue +12 -0
- package/src/components/MToolbar.vue +12 -0
- package/src/components/MTooltip.vue +18 -0
- package/src/components/MTopAppBar.vue +18 -0
- package/src/components/MTour.vue +15 -2
- package/src/components/MTransferList.vue +24 -0
- package/src/components/MTree.vue +11 -0
- package/src/components/MTreeTable.vue +15 -0
- package/src/components/MVirtualTable.vue +12 -0
- package/src/components/MWindow.vue +34 -0
- package/src/composables/_carouselStrategy.ts +712 -0
- package/src/composables/useLocale.ts +54 -3
- package/src/data/emoji-names/emoji-names-de.ts +1875 -0
- package/src/data/emoji-names/emoji-names-en.ts +1875 -0
- package/src/data/emoji-names/emoji-names-es.ts +1875 -0
- package/src/data/emoji-names/emoji-names-fr.ts +1875 -0
- package/src/data/emoji-names/emoji-names-ja.ts +1875 -0
- package/src/data/emoji-names/emoji-names-ko.ts +1875 -0
- package/src/data/emoji-names/emoji-names-pt.ts +1875 -0
- package/src/data/emoji-names/emoji-names-zh.ts +1875 -0
- package/src/data/emojis.ts +29 -198
- package/src/index.ts +2 -2
- package/src/locales/de.ts +19 -0
- package/src/locales/es.ts +19 -0
- package/src/locales/fr.ts +19 -0
- package/src/locales/ja.ts +19 -0
- package/src/locales/ko.ts +19 -0
- package/src/locales/pt.ts +19 -0
- package/src/locales/zh.ts +19 -0
- package/src/plugin.ts +14 -2
- package/dist/MMenuItem-5xojJYAL.js.map +0 -1
- package/dist/useLocale-D3ZWZ8jY.js.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { describe, it, expect, beforeEach, afterEach } from 'vitest'
|
|
2
2
|
import { createApp, defineComponent, h } from 'vue'
|
|
3
3
|
import { createM3UI } from '../plugin'
|
|
4
|
-
import { useColorPalette } from '../composables/useColorPalette'
|
|
4
|
+
import { useColorPalette, palettes } from '../composables/useColorPalette'
|
|
5
5
|
|
|
6
6
|
describe('createM3UI', () => {
|
|
7
7
|
beforeEach(() => {
|
|
@@ -52,4 +52,31 @@ describe('createM3UI', () => {
|
|
|
52
52
|
app.use(createM3UI({ palette: 'iron', persistPalette: false }))
|
|
53
53
|
expect(localStorage.getItem('m3-palette')).toBeNull()
|
|
54
54
|
})
|
|
55
|
+
|
|
56
|
+
describe('customPalettes', () => {
|
|
57
|
+
const builtIn = palettes.map((p) => ({ ...p }))
|
|
58
|
+
afterEach(() => {
|
|
59
|
+
palettes.splice(0, palettes.length, ...builtIn)
|
|
60
|
+
})
|
|
61
|
+
|
|
62
|
+
it('adds custom palettes to the list useColorPalette returns', () => {
|
|
63
|
+
const app = createApp(defineComponent({ render: () => h('div') }))
|
|
64
|
+
app.use(createM3UI({ customPalettes: [{ id: 'brand', label: 'Brand', seed: '#0b6e4f' }] }))
|
|
65
|
+
expect(useColorPalette().palettes).toHaveLength(builtIn.length + 1)
|
|
66
|
+
expect(useColorPalette().palettes.at(-1)).toEqual({ id: 'brand', label: 'Brand', seed: '#0b6e4f' })
|
|
67
|
+
})
|
|
68
|
+
|
|
69
|
+
it('replaces a built-in palette with the same id instead of duplicating it', () => {
|
|
70
|
+
const app = createApp(defineComponent({ render: () => h('div') }))
|
|
71
|
+
app.use(createM3UI({ customPalettes: [{ id: 'teal', label: 'Our teal', seed: '#008080' }] }))
|
|
72
|
+
expect(palettes).toHaveLength(builtIn.length)
|
|
73
|
+
expect(palettes.filter((p) => p.id === 'teal')).toEqual([{ id: 'teal', label: 'Our teal', seed: '#008080' }])
|
|
74
|
+
})
|
|
75
|
+
|
|
76
|
+
it('can be selected as the starting palette', () => {
|
|
77
|
+
const app = createApp(defineComponent({ render: () => h('div') }))
|
|
78
|
+
app.use(createM3UI({ palette: 'brand', customPalettes: [{ id: 'brand', label: 'Brand', seed: '#0b6e4f' }] }))
|
|
79
|
+
expect(document.documentElement.getAttribute('data-palette')).toBe('brand')
|
|
80
|
+
})
|
|
81
|
+
})
|
|
55
82
|
})
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* Declarative absolute positioning without Tailwind classes. Supports manual offsets, placement shortcuts, and
|
|
4
|
+
* per-axis control. Pair it with `MRelative` as the positioning parent.
|
|
5
|
+
*
|
|
6
|
+
* @slot default Content.
|
|
7
|
+
*/
|
|
2
8
|
import { computed } from 'vue'
|
|
3
9
|
|
|
4
10
|
export type Placement =
|
|
@@ -8,15 +14,27 @@ export type Placement =
|
|
|
8
14
|
|
|
9
15
|
const props = withDefaults(
|
|
10
16
|
defineProps<{
|
|
17
|
+
/** Preset corner/edge placement */
|
|
11
18
|
placement?: Placement
|
|
19
|
+
/** Distance from edges when using placement (applies to both axes) */
|
|
12
20
|
offset?: string | number
|
|
21
|
+
/** Horizontal offset — overrides offset for the X axis */
|
|
13
22
|
offsetX?: string | number
|
|
23
|
+
/** Vertical offset — overrides offset for the Y axis */
|
|
14
24
|
offsetY?: string | number
|
|
25
|
+
/**
|
|
26
|
+
* Top offset (number = px). Defaults to 8px when neither placement nor any of top/right/bottom/left is set
|
|
27
|
+
*/
|
|
15
28
|
top?: string | number
|
|
29
|
+
/** Right offset */
|
|
16
30
|
right?: string | number
|
|
31
|
+
/** Bottom offset */
|
|
17
32
|
bottom?: string | number
|
|
33
|
+
/** Left offset. Defaults to 8px when neither placement nor any of top/right/bottom/left is set */
|
|
18
34
|
left?: string | number
|
|
35
|
+
/** Set all sides to 0 */
|
|
19
36
|
inset?: boolean
|
|
37
|
+
/** Z-index value */
|
|
20
38
|
zIndex?: number
|
|
21
39
|
}>(),
|
|
22
40
|
{ inset: false, offset: 0 },
|
|
@@ -1,12 +1,24 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* An inline banner for contextual status messages — info, success, warning, or error.
|
|
4
|
+
*
|
|
5
|
+
* @slot default Alert body content
|
|
6
|
+
* @slot actions Optional row of action buttons rendered below the body
|
|
7
|
+
* @event close Emitted when the close button is clicked. The parent owns visibility — pair with v-if/v-else to
|
|
8
|
+
* actually hide the alert.
|
|
9
|
+
*/
|
|
2
10
|
import MIcon from './MIcon.vue'
|
|
3
11
|
import { useLocale } from '../composables/useLocale'
|
|
4
12
|
|
|
5
13
|
const props = withDefaults(
|
|
6
14
|
defineProps<{
|
|
15
|
+
/** Alert variant and color */
|
|
7
16
|
type?: 'info' | 'success' | 'warning' | 'error'
|
|
17
|
+
/** Bold title text */
|
|
8
18
|
title?: string
|
|
19
|
+
/** Show close button */
|
|
9
20
|
closeable?: boolean
|
|
21
|
+
/** Aria label for the close button (falls back to the locale string) */
|
|
10
22
|
closeAriaLabel?: string
|
|
11
23
|
}>(),
|
|
12
24
|
{
|
|
@@ -1,8 +1,20 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* A simple, generic slot-based app bar with leading, default, and trailing areas — a lighter-weight alternative
|
|
4
|
+
* to MTopAppBar for when you don't need its variant/title-row layouts.
|
|
5
|
+
*
|
|
6
|
+
* @slot leading Leading area (e.g. back button, menu icon)
|
|
7
|
+
* @slot default Main content (title text)
|
|
8
|
+
* @slot trailing Trailing action buttons
|
|
9
|
+
*/
|
|
2
10
|
withDefaults(defineProps<{
|
|
11
|
+
/** Background color */
|
|
3
12
|
color?: 'surface' | 'primary' | 'secondary' | 'tertiary'
|
|
13
|
+
/** Add shadow elevation */
|
|
4
14
|
elevated?: boolean
|
|
15
|
+
/** Compact height (48px vs 64px) */
|
|
5
16
|
dense?: boolean
|
|
17
|
+
/** Add a bottom border (border-outline-variant) */
|
|
6
18
|
bordered?: boolean
|
|
7
19
|
}>(), { color: 'surface' })
|
|
8
20
|
|
|
@@ -1,8 +1,19 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* Full app shell — drawer, header, content, footer, and fab slots.
|
|
4
|
+
*
|
|
5
|
+
* @slot drawer Side navigation (e.g. MNavigationDrawer). Use drawerRight prop to place it on the right.
|
|
6
|
+
* @slot header Top bar (e.g. MTopAppBar)
|
|
7
|
+
* @slot default Main scrollable content
|
|
8
|
+
* @slot footer Bottom bar or status area
|
|
9
|
+
* @slot fab Floating elements (e.g. MFab) rendered outside the scroll area
|
|
10
|
+
*/
|
|
2
11
|
import { computed } from 'vue'
|
|
3
12
|
|
|
4
13
|
const props = defineProps<{
|
|
14
|
+
/** Container height (CSS value). Use "100%" to fit inside a parent instead of the viewport. */
|
|
5
15
|
height?: string
|
|
16
|
+
/** Place the drawer slot on the right side of the layout */
|
|
6
17
|
drawerRight?: boolean
|
|
7
18
|
}>()
|
|
8
19
|
|
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* Maintains a consistent aspect ratio for media or containers.
|
|
4
|
+
*
|
|
5
|
+
* @slot default Content, sized to fill the box.
|
|
6
|
+
*/
|
|
2
7
|
import { computed } from 'vue'
|
|
3
8
|
|
|
4
9
|
const props = withDefaults(
|
|
5
10
|
defineProps<{
|
|
11
|
+
/** Aspect ratio (e.g. "16/9", "4/3", 1) — passed straight through to the CSS aspect-ratio property */
|
|
6
12
|
ratio?: string | number
|
|
7
13
|
}>(),
|
|
8
14
|
{ ratio: '16/9' },
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* Like MSelect but with a text input for filtering. Type to search, arrow keys to navigate, Enter to select.
|
|
4
|
+
*
|
|
5
|
+
* @event update:modelValue Emitted on selection — powers v-model
|
|
6
|
+
* @event debounced Emitted debounce ms after the user stops typing the search query (only when debounce > 0)
|
|
7
|
+
*/
|
|
2
8
|
import { computed, ref, useId, onMounted, onUnmounted, watch, nextTick } from 'vue'
|
|
3
9
|
import MIcon from './MIcon.vue'
|
|
4
10
|
import MIconButton from './MIconButton.vue'
|
|
@@ -13,21 +19,39 @@ defineOptions({ inheritAttrs: false })
|
|
|
13
19
|
|
|
14
20
|
const props = withDefaults(
|
|
15
21
|
defineProps<{
|
|
22
|
+
/** Selected value (v-model) */
|
|
16
23
|
modelValue: unknown
|
|
24
|
+
/** The options to choose from; see `SelectOption`. */
|
|
17
25
|
options: SelectOption[]
|
|
26
|
+
/** Floating label text */
|
|
18
27
|
label?: string
|
|
28
|
+
/** Input placeholder */
|
|
19
29
|
placeholder?: string
|
|
30
|
+
/** Field style */
|
|
20
31
|
variant?: 'filled' | 'outlined'
|
|
32
|
+
/** Dropdown mode: docked (inline) or modal (dialog) */
|
|
21
33
|
mode?: 'docked' | 'modal'
|
|
34
|
+
/** Disables the field */
|
|
22
35
|
disabled?: boolean
|
|
36
|
+
/** Error state */
|
|
23
37
|
error?: boolean
|
|
38
|
+
/** Error message shown when error is true */
|
|
24
39
|
errorLabel?: string
|
|
40
|
+
/** Helper text below field */
|
|
25
41
|
hint?: string
|
|
42
|
+
/** Marks as required — adds a red asterisk after the label */
|
|
26
43
|
required?: boolean
|
|
44
|
+
/** Material Symbol icon name */
|
|
27
45
|
leadingIcon?: string
|
|
46
|
+
/** Show a clear button */
|
|
28
47
|
clearable?: boolean
|
|
48
|
+
/**
|
|
49
|
+
* Overrides the auto-detected background color used to cut the floating label out of the outlined border
|
|
50
|
+
*/
|
|
29
51
|
fieldBg?: string
|
|
52
|
+
/** Text when no options match */
|
|
30
53
|
noResultsText?: string
|
|
54
|
+
/** Delay (ms) before filtering and firing @debounced. Selection is always instant */
|
|
31
55
|
debounce?: number
|
|
32
56
|
}>(),
|
|
33
57
|
{
|
|
@@ -1,7 +1,18 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* A circular initials avatar. There's no image-source prop — it always renders extracted initials or a fallback
|
|
4
|
+
* string, never a photo.
|
|
5
|
+
*/
|
|
2
6
|
import { computed } from 'vue'
|
|
3
7
|
|
|
4
|
-
const props = withDefaults(defineProps<{
|
|
8
|
+
const props = withDefaults(defineProps<{
|
|
9
|
+
/** Full name — initials are extracted automatically (first + last). Takes priority over fallback */
|
|
10
|
+
name?: string
|
|
11
|
+
/** Custom text shown when name is not provided (e.g. 'AJ'). Falls back to '?' if neither is set */
|
|
12
|
+
fallback?: string
|
|
13
|
+
/** Avatar size in px — also scales the font size proportionally (40%) */
|
|
14
|
+
size?: number
|
|
15
|
+
}>(), { size: 40 })
|
|
5
16
|
|
|
6
17
|
const initials = computed(() => {
|
|
7
18
|
if (props.name) {
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* A small numeric or dot indicator overlaid on another element, such as an icon button or avatar.
|
|
4
|
+
*
|
|
5
|
+
* @slot default The element the badge sits on.
|
|
6
|
+
*/
|
|
2
7
|
import { computed } from 'vue'
|
|
3
8
|
|
|
4
9
|
export type BadgePosition = 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left'
|
|
@@ -6,11 +11,17 @@ export type BadgeOverlap = 'inside' | 'outside' | 'edge'
|
|
|
6
11
|
|
|
7
12
|
const props = withDefaults(
|
|
8
13
|
defineProps<{
|
|
14
|
+
/** Numeric badge value */
|
|
9
15
|
count?: number
|
|
16
|
+
/** Show a small dot instead of a number */
|
|
10
17
|
dot?: boolean
|
|
18
|
+
/** Badge color */
|
|
11
19
|
color?: 'primary' | 'error' | 'secondary' | 'tertiary'
|
|
20
|
+
/** Max value before showing "N+" */
|
|
12
21
|
max?: number
|
|
22
|
+
/** Corner where the badge is placed */
|
|
13
23
|
position?: BadgePosition
|
|
24
|
+
/** How much the badge overlaps the content */
|
|
14
25
|
overlap?: BadgeOverlap
|
|
15
26
|
}>(),
|
|
16
27
|
{
|
package/src/components/MBar.vue
CHANGED
|
@@ -1,21 +1,40 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* A draggable Electron title bar for frameless windows (`frame: false`). Sets `-webkit-app-region: drag` on
|
|
4
|
+
* itself and carves out `no-drag` around the icon, controls, and slot content, so those stay clickable. It
|
|
5
|
+
* can't touch the real OS window — minimize/maximize/close just emit events for your app to forward over IPC.
|
|
6
|
+
*
|
|
7
|
+
* @slot icon Replaces the icon — e.g. an `<img>` logo instead of a Material Symbol
|
|
8
|
+
* @slot title Replaces the title text
|
|
9
|
+
* @slot default Extra content between the title and the trailing area (drag-adjacent, e.g. tabs)
|
|
10
|
+
* @slot trailing Action buttons right before minimize/maximize/close
|
|
11
|
+
* @event close Emitted when the close button is clicked
|
|
12
|
+
* @event minimize Emitted when the minimize button is clicked — forward to your Electron IPC call
|
|
13
|
+
* @event maximize Emitted when the maximize/restore button is clicked, or (with doubleClickMaximize) empty drag
|
|
14
|
+
* space is double-clicked
|
|
15
|
+
*/
|
|
2
16
|
import { computed } from 'vue'
|
|
3
17
|
import MIcon from './MIcon.vue'
|
|
4
18
|
|
|
5
19
|
const props = withDefaults(
|
|
6
20
|
defineProps<{
|
|
21
|
+
/** Window title text */
|
|
7
22
|
title?: string
|
|
8
23
|
/** Material Symbol name, or an image src (URL, data URI, or a path with a file extension) — detected automatically. */
|
|
9
24
|
icon?: string
|
|
25
|
+
/** Centered floats over the whole bar so it stays centered regardless of side content width */
|
|
10
26
|
titleAlign?: 'start' | 'center'
|
|
11
27
|
/** Show the minimize/maximize/close buttons as a group. Defaults to `true`, except on `platform="macos"` where the OS draws native traffic lights instead. */
|
|
12
28
|
controls?: boolean
|
|
13
29
|
/** Individually hide one control while keeping the others — e.g. a fixed-size window with no maximize button. */
|
|
14
30
|
minimizable?: boolean
|
|
31
|
+
/** Show the maximize/restore button on its own */
|
|
15
32
|
maximizable?: boolean
|
|
33
|
+
/** Show the close button on its own */
|
|
16
34
|
closable?: boolean
|
|
17
35
|
/** Reflects the real window state — the bar has no way to know it itself, the host app must read it from its Electron main process and pass it down. */
|
|
18
36
|
maximized?: boolean
|
|
37
|
+
/** 'macos' reserves space for the native traffic lights and hides the drawn controls by default */
|
|
19
38
|
platform?: 'windows' | 'macos'
|
|
20
39
|
/** Bar height in px. */
|
|
21
40
|
height?: number
|
|
@@ -1,19 +1,35 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* Renders a barcode as inline SVG. Available from the `/barcode` entry point.
|
|
4
|
+
*
|
|
5
|
+
* @slot error Shown instead of the SVG when value is invalid for the given format (e.g. a non-numeric EAN13)
|
|
6
|
+
*/
|
|
2
7
|
import { ref, watchEffect } from 'vue'
|
|
3
8
|
import JsBarcode from 'jsbarcode'
|
|
4
9
|
|
|
10
|
+
defineOptions({ inheritAttrs: false })
|
|
11
|
+
|
|
5
12
|
const props = withDefaults(
|
|
6
13
|
defineProps<{
|
|
14
|
+
/** Data to encode. Required — there is no default. */
|
|
7
15
|
value: string
|
|
8
16
|
/** Barcode symbology. Common values: 'CODE128', 'EAN13', 'EAN8', 'UPC', 'CODE39', 'ITF14', 'MSI', 'pharmacode', 'codabar'. */
|
|
9
17
|
format?: string
|
|
18
|
+
/** Width of the narrowest bar, in px */
|
|
10
19
|
width?: number
|
|
20
|
+
/** Bar height in px */
|
|
11
21
|
height?: number
|
|
22
|
+
/** Show the encoded text below the bars */
|
|
12
23
|
displayValue?: boolean
|
|
24
|
+
/** Bar color */
|
|
13
25
|
color?: string
|
|
26
|
+
/** Background color */
|
|
14
27
|
background?: string
|
|
28
|
+
/** Quiet zone around the barcode, in px */
|
|
15
29
|
margin?: number
|
|
30
|
+
/** Font size for the displayed value */
|
|
16
31
|
fontSize?: number
|
|
32
|
+
/** aria-label for the svg. Defaults to value */
|
|
17
33
|
label?: string
|
|
18
34
|
}>(),
|
|
19
35
|
{
|
|
@@ -54,8 +70,8 @@ watchEffect(() => {
|
|
|
54
70
|
</script>
|
|
55
71
|
|
|
56
72
|
<template>
|
|
57
|
-
<div v-if="error" class="flex items-center justify-center text-body-small text-error">
|
|
73
|
+
<div v-if="error" v-bind="$attrs" class="flex items-center justify-center text-body-small text-error">
|
|
58
74
|
<slot name="error">{{ error }}</slot>
|
|
59
75
|
</div>
|
|
60
|
-
<svg v-show="!error" ref="svgEl" role="img" :aria-label="label ?? value"></svg>
|
|
76
|
+
<svg v-show="!error" v-bind="error ? {} : $attrs" ref="svgEl" role="img" :aria-label="label ?? value"></svg>
|
|
61
77
|
</template>
|
|
@@ -1,10 +1,22 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* A sheet that slides up from the bottom of the screen, capped at a 640px max width and rounded top corners.
|
|
4
|
+
* Supports drag-to-dismiss via the handle bar, or tapping the scrim.
|
|
5
|
+
*
|
|
6
|
+
* @slot default Sheet body content (scrollable)
|
|
7
|
+
* @slot actions Footer action buttons, shown in a bordered strip below the content
|
|
8
|
+
* @event update:modelValue Emitted when the sheet closes (scrim click, drag-to-dismiss, or the close button) —
|
|
9
|
+
* powers v-model
|
|
10
|
+
*/
|
|
2
11
|
import MIcon from './MIcon.vue'
|
|
3
12
|
import { useSheetMotion } from '../composables/_useSheetMotion'
|
|
4
13
|
|
|
5
14
|
withDefaults(defineProps<{
|
|
15
|
+
/** Open/closed state (v-model) */
|
|
6
16
|
modelValue: boolean
|
|
17
|
+
/** Sheet header title */
|
|
7
18
|
title?: string
|
|
19
|
+
/** Use max-h-[92vh] instead of the default max-h-[60vh] */
|
|
8
20
|
fullHeight?: boolean
|
|
9
21
|
}>(), { fullHeight: false })
|
|
10
22
|
|
|
@@ -17,7 +29,7 @@ const motion = useSheetMotion('y', close)
|
|
|
17
29
|
|
|
18
30
|
<template>
|
|
19
31
|
<Teleport to="body">
|
|
20
|
-
<Transition :css="false" @enter="motion.onEnter" @leave="motion.onLeave">
|
|
32
|
+
<Transition :css="false" @enter="motion.onEnter" @leave="motion.onLeave" appear>
|
|
21
33
|
<div v-if="modelValue" class="fixed inset-0 z-200 flex flex-col justify-end">
|
|
22
34
|
<!-- Scrim -->
|
|
23
35
|
<div data-sheet-scrim class="absolute inset-0 bg-scrim/32" @click="close" />
|
package/src/components/MBox.vue
CHANGED
|
@@ -1,13 +1,25 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* Generic surface box with padding, radius, elevation, and border — a building block for ad-hoc layout that
|
|
4
|
+
* doesn't warrant a dedicated component.
|
|
5
|
+
*
|
|
6
|
+
* @slot default Content.
|
|
7
|
+
*/
|
|
2
8
|
import { computed } from 'vue'
|
|
3
9
|
|
|
4
10
|
const props = withDefaults(
|
|
5
11
|
defineProps<{
|
|
12
|
+
/** Surface color variant */
|
|
6
13
|
surface?: 'default' | 'container' | 'container-low' | 'container-high' | 'container-highest' | 'primary-container' | 'secondary-container' | 'tertiary-container' | 'inverse'
|
|
14
|
+
/** Padding size */
|
|
7
15
|
padding?: 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl'
|
|
16
|
+
/** Border radius */
|
|
8
17
|
rounded?: 'none' | 'sm' | 'md' | 'lg' | 'xl' | 'full'
|
|
18
|
+
/** Shadow elevation level */
|
|
9
19
|
elevation?: 0 | 1 | 2 | 3
|
|
20
|
+
/** Show border */
|
|
10
21
|
border?: boolean
|
|
22
|
+
/** HTML tag to render */
|
|
11
23
|
tag?: string
|
|
12
24
|
}>(),
|
|
13
25
|
{ padding: 'none', rounded: 'none', elevation: 0, border: false, tag: 'div' },
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* A navigation trail showing the current page's location within a hierarchy, with icons and custom separators.
|
|
4
|
+
*
|
|
5
|
+
* @event select Emitted when a non-last, non-disabled item is clicked
|
|
6
|
+
*/
|
|
2
7
|
import MIcon from './MIcon.vue'
|
|
3
8
|
|
|
4
9
|
export interface BreadcrumbItem {
|
|
@@ -9,7 +14,9 @@ export interface BreadcrumbItem {
|
|
|
9
14
|
}
|
|
10
15
|
|
|
11
16
|
withDefaults(defineProps<{
|
|
17
|
+
/** Breadcrumb items (see `BreadcrumbItem`) */
|
|
12
18
|
items: BreadcrumbItem[]
|
|
19
|
+
/** Material Symbol separator icon */
|
|
13
20
|
separator?: string
|
|
14
21
|
}>(), { separator: 'chevron_right' })
|
|
15
22
|
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* The standard M3 button — five variants, five expressive size tiers, and either color.
|
|
4
|
+
*
|
|
5
|
+
* @slot default The button's label.
|
|
6
|
+
*/
|
|
2
7
|
import { computed } from 'vue'
|
|
3
8
|
import MSpinner from './MSpinner.vue'
|
|
4
9
|
import MIcon from './MIcon.vue'
|
|
@@ -8,6 +13,7 @@ type NamedColor = (typeof NAMED_COLORS)[number]
|
|
|
8
13
|
|
|
9
14
|
const props = withDefaults(
|
|
10
15
|
defineProps<{
|
|
16
|
+
/** Visual style of the button */
|
|
11
17
|
variant?: 'filled' | 'tonal' | 'outlined' | 'text' | 'elevated'
|
|
12
18
|
/**
|
|
13
19
|
* Named semantic color ('primary' | 'error') OR any CSS color string
|
|
@@ -15,18 +21,30 @@ const props = withDefaults(
|
|
|
15
21
|
* When a CSS color is passed, --color-primary is overridden for this button.
|
|
16
22
|
*/
|
|
17
23
|
color?: string
|
|
24
|
+
/** HTML button type */
|
|
18
25
|
type?: 'button' | 'submit' | 'reset'
|
|
26
|
+
/** Disables interaction */
|
|
19
27
|
disabled?: boolean
|
|
28
|
+
/** Shows a spinner and disables the button */
|
|
20
29
|
loading?: boolean
|
|
30
|
+
/** Material Symbol icon name shown next to the label */
|
|
21
31
|
icon?: string
|
|
32
|
+
/** Which side of the label the icon renders on */
|
|
33
|
+
// Which side of the label `icon` renders on. Real M3 buttons support both via
|
|
34
|
+
// `ButtonDefaults.contentPaddingFor(hasStartIcon/hasEndIcon)` — padding ends up identical
|
|
35
|
+
// either way at every tier, so this only changes render order, not spacing.
|
|
36
|
+
iconPos?: 'leading' | 'trailing'
|
|
22
37
|
/**
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
* either way at every tier, so this only changes render order, not spacing.
|
|
38
|
+
* M3's 5-tier expressive button sizing (xs: 32px, sm: 40px, md: 56px, lg: 96px, xl: 136px) — lg/xl are
|
|
39
|
+
* meant for hero-style prominent buttons, not everyday UI
|
|
26
40
|
*/
|
|
27
|
-
iconPos?: 'leading' | 'trailing'
|
|
28
41
|
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl'
|
|
42
|
+
/**
|
|
43
|
+
* Button shape — rounded (pill, always) or squared (corner radius scales with size: 12px xs/sm, 16px md,
|
|
44
|
+
* 28px lg/xl)
|
|
45
|
+
*/
|
|
29
46
|
shape?: 'rounded' | 'squared'
|
|
47
|
+
/** Vue Router destination — renders as RouterLink instead of button */
|
|
30
48
|
to?: string | Record<string, any>
|
|
31
49
|
}>(),
|
|
32
50
|
{
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* A set of buttons that share selection state — standard (separated) or connected (joined into one pill),
|
|
4
|
+
* single or multi select, any value type.
|
|
5
|
+
*
|
|
6
|
+
* @event update:modelValue Emitted on selection change — powers v-model
|
|
7
|
+
*/
|
|
2
8
|
import { computed } from 'vue'
|
|
3
9
|
import MIcon from './MIcon.vue'
|
|
4
10
|
|
|
@@ -10,12 +16,19 @@ export interface ButtonGroupOption {
|
|
|
10
16
|
}
|
|
11
17
|
|
|
12
18
|
const props = withDefaults(defineProps<{
|
|
19
|
+
/** Selected value(s) — any type (v-model) */
|
|
13
20
|
modelValue: unknown
|
|
21
|
+
/** The options to choose from; see `ButtonGroupOption`. */
|
|
14
22
|
options: ButtonGroupOption[]
|
|
23
|
+
/** Standard (separated) or connected (joined) */
|
|
15
24
|
variant?: 'standard' | 'connected'
|
|
25
|
+
/** Button size */
|
|
16
26
|
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl'
|
|
27
|
+
/** Allow multiple selections */
|
|
17
28
|
multiSelect?: boolean
|
|
29
|
+
/** At least one must be selected */
|
|
18
30
|
selectionRequired?: boolean
|
|
31
|
+
/** Selected button color */
|
|
19
32
|
color?: 'primary' | 'secondary' | 'tertiary'
|
|
20
33
|
}>(), {
|
|
21
34
|
variant: 'standard',
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* A monthly calendar grid with color-coded, clickable events.
|
|
4
|
+
*
|
|
5
|
+
* @event dateClick Emitted when an empty part of a day cell is clicked
|
|
6
|
+
* @event eventClick Emitted when an event pill is clicked
|
|
7
|
+
*/
|
|
2
8
|
import { computed, ref } from 'vue'
|
|
3
9
|
import MIcon from './MIcon.vue'
|
|
4
10
|
import MIconButton from './MIconButton.vue'
|
|
@@ -13,10 +19,18 @@ export interface CalendarEvent {
|
|
|
13
19
|
}
|
|
14
20
|
|
|
15
21
|
const props = withDefaults(defineProps<{
|
|
22
|
+
/** Array of events to render on the grid (see `CalendarEvent`) */
|
|
16
23
|
events?: CalendarEvent[]
|
|
24
|
+
/**
|
|
25
|
+
* Locale for month/weekday names, via Intl.DateTimeFormat. Falls back to the app's configured locale
|
|
26
|
+
* (createM3UI({ locale })) — same pattern as MRelativeTime
|
|
27
|
+
*/
|
|
17
28
|
locale?: string
|
|
29
|
+
/** Label for the Today button — falls back to the locale's own string when unset */
|
|
18
30
|
todayLabel?: string
|
|
31
|
+
/** Aria label for the previous-month button — falls back to the locale's own string when unset */
|
|
19
32
|
prevMonthLabel?: string
|
|
33
|
+
/** Aria label for the next-month button — falls back to the locale's own string when unset */
|
|
20
34
|
nextMonthLabel?: string
|
|
21
35
|
}>(), {
|
|
22
36
|
events: () => [],
|
package/src/components/MCard.vue
CHANGED
|
@@ -1,17 +1,43 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* A flexible surface for grouping related content — three variants following the M3 elevation system, with
|
|
4
|
+
* optional header image, structured title/subtitle, and action buttons.
|
|
5
|
+
*
|
|
6
|
+
* @slot media Custom media content (alternative to the image prop)
|
|
7
|
+
* @slot header Custom header content (overrides title/subtitle props)
|
|
8
|
+
* @slot default Main content area (raw, no wrapper)
|
|
9
|
+
* @slot actions Bottom action buttons (flex row, right-aligned)
|
|
10
|
+
*/
|
|
2
11
|
import { computed } from 'vue'
|
|
3
12
|
|
|
4
13
|
const props = withDefaults(
|
|
5
14
|
defineProps<{
|
|
15
|
+
/** Card surface style */
|
|
6
16
|
variant?: 'elevated' | 'filled' | 'outlined'
|
|
17
|
+
/**
|
|
18
|
+
* Makes the card an interactive element — hover/press elevation (varies by variant per M3), a focus
|
|
19
|
+
* ring/border on keyboard focus, and reachable/activatable via Tab + Enter/Space, not just mouse
|
|
20
|
+
*/
|
|
7
21
|
clickable?: boolean
|
|
22
|
+
/**
|
|
23
|
+
* Shortcut that forces the elevated variant regardless of variant — true is equivalent to
|
|
24
|
+
* variant='elevated'
|
|
25
|
+
*/
|
|
8
26
|
elevated?: boolean
|
|
27
|
+
/**
|
|
28
|
+
* Disabled visual state (own per-variant color, not just a dimmed one) and, when combined with clickable,
|
|
29
|
+
* blocks interaction entirely
|
|
30
|
+
*/
|
|
9
31
|
disabled?: boolean
|
|
10
32
|
/** src URL for a full-bleed header image */
|
|
11
33
|
image?: string
|
|
34
|
+
/** Alt text for the header image */
|
|
12
35
|
imageAlt?: string
|
|
36
|
+
/** Tailwind height class for the image */
|
|
13
37
|
imageHeight?: string
|
|
38
|
+
/** Card title text */
|
|
14
39
|
title?: string
|
|
40
|
+
/** Supporting text below the title */
|
|
15
41
|
subtitle?: string
|
|
16
42
|
}>(),
|
|
17
43
|
{ variant: 'elevated', clickable: false, elevated: false, disabled: false },
|