@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.
- package/README.md +53 -2
- package/dist/API.md +3806 -0
- package/dist/MIcon-CaEooCmZ.js.map +1 -1
- package/dist/{MTextField-B0wGv1Mx.js → MTextField-Ck0oWDMk.js} +9 -3
- package/dist/MTextField-Ck0oWDMk.js.map +1 -0
- package/dist/api.json +1 -0
- 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 +8 -2
- 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 +7 -1
- 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 +20 -0
- package/dist/components/MColorPickerModal.vue.d.ts +16 -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 +9 -7
- package/dist/components/MDivider.vue.d.ts +6 -0
- package/dist/components/MDragDropList.vue.d.ts +6 -0
- package/dist/components/MDragHandle.vue.d.ts +12 -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 +1 -1
- 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 +10 -1
- 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 +6 -0
- 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 +4 -0
- package/dist/components/MList.vue.d.ts +7 -0
- package/dist/components/MListItem.vue.d.ts +29 -5
- 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 +4 -1
- 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 +10 -0
- package/dist/components/MScrollField.vue.d.ts +40 -0
- package/dist/components/MScrollable.vue.d.ts +12 -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/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 +10 -0
- package/dist/components/MSkeleton.vue.d.ts +8 -0
- package/dist/components/MSlider.vue.d.ts +14 -0
- 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 +6 -2
- package/dist/components/MSpotlightSearch.vue.d.ts +18 -0
- package/dist/components/MStack.vue.d.ts +7 -0
- 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/MSwipeToDismiss.vue.d.ts +49 -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 +5 -0
- 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/MTransition.vue.d.ts +34 -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/components/_MColorPanel.vue.d.ts +18 -0
- package/dist/composables/_colorUtils.d.ts +34 -0
- package/dist/composables/_themeColor.d.ts +1 -0
- package/dist/composables/_useSpring.d.ts +15 -0
- package/dist/composables/dynamicColor.d.ts +18 -0
- package/dist/composables/useColorPalette.d.ts +27 -0
- package/dist/composables/useLocale.d.ts +12 -0
- package/dist/index.d.ts +9 -1
- package/dist/locales/index.js +70 -0
- package/dist/locales/index.js.map +1 -1
- package/dist/m3ui-vue.css +1 -1
- package/dist/m3ui.js +6456 -5273
- package/dist/m3ui.js.map +1 -1
- package/dist/markdown.js +1 -1
- package/dist/markdown.js.map +1 -1
- package/dist/material-color-utilities-Cktu8DBU.js +3160 -0
- package/dist/material-color-utilities-Cktu8DBU.js.map +1 -0
- package/dist/plugin.d.ts +18 -0
- package/dist/qrcode.js.map +1 -1
- package/dist/rich-text-editor.js +3 -3
- package/dist/rich-text-editor.js.map +1 -1
- package/dist/styles/palettes.css +546 -0
- package/dist/styles/theme.css +77 -0
- package/dist/styles.css +1 -1
- package/dist/terminal.js.map +1 -1
- package/dist/{useLocale-CmI675Ab.js → useLocale-CFW8cIzL.js} +23 -10
- package/dist/useLocale-CFW8cIzL.js.map +1 -0
- package/package.json +5 -2
- package/src/__tests__/MButtonGroup.test.ts +51 -0
- package/src/__tests__/MColorPicker.test.ts +141 -0
- package/src/__tests__/MDragHandle.test.ts +57 -0
- package/src/__tests__/MHotkeys.test.ts +57 -0
- package/src/__tests__/MListItemShape.test.ts +76 -0
- package/src/__tests__/MScrollField.test.ts +41 -0
- package/src/__tests__/MScrollable.test.ts +42 -0
- package/src/__tests__/MSwipeToDismiss.test.ts +104 -0
- package/src/__tests__/MTransition.test.ts +27 -0
- package/src/__tests__/dynamicColor.test.ts +191 -0
- package/src/__tests__/hostLocale.test.ts +57 -0
- 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 +14 -0
- package/src/components/MBottomSheet.vue +12 -0
- package/src/components/MBox.vue +15 -1
- package/src/components/MBreadcrumbs.vue +7 -0
- package/src/components/MButton.vue +22 -4
- package/src/components/MButtonGroup.vue +129 -35
- package/src/components/MCalendar.vue +14 -0
- package/src/components/MCard.vue +26 -0
- package/src/components/MCarousel.vue +17 -1
- 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 +15 -0
- package/src/components/MColorPicker.vue +124 -207
- package/src/components/MColorPickerModal.vue +58 -247
- package/src/components/MCommandPalette.vue +16 -0
- package/src/components/MConfirmDialog.vue +15 -0
- package/src/components/MContainer.vue +9 -0
- package/src/components/MContextMenu.vue +17 -6
- 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 +16 -0
- package/src/components/MDateRangePicker.vue +23 -0
- package/src/components/MDateRangePickerModal.vue +16 -0
- package/src/components/MDialog.vue +27 -7
- package/src/components/MDivider.vue +6 -0
- package/src/components/MDragDropList.vue +18 -0
- package/src/components/MDragHandle.vue +54 -0
- package/src/components/MEmoji.vue +6 -0
- package/src/components/MEmojiButton.vue +11 -0
- package/src/components/MEmojiSelector.vue +7 -0
- 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 +17 -0
- 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 +16 -0
- package/src/components/MList.vue +48 -3
- package/src/components/MListDetail.vue +11 -0
- package/src/components/MListItem.vue +112 -5
- package/src/components/MListSubheader.vue +6 -0
- package/src/components/MLoadingIndicator.vue +15 -0
- package/src/components/MLoadingOverlay.vue +12 -0
- 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 +16 -6
- 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 +25 -0
- package/src/components/MNavigationRail.vue +24 -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 +10 -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 +21 -0
- package/src/components/MScrollField.vue +302 -0
- package/src/components/MScrollable.vue +167 -4
- 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 +13 -0
- 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 +14 -0
- package/src/components/MSplitter.vue +42 -9
- package/src/components/MSpotlightSearch.vue +27 -0
- 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/MSwipeToDismiss.vue +247 -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 +11 -0
- 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 +12 -0
- 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 +15 -0
- package/src/components/MTopAppBar.vue +18 -0
- package/src/components/MTour.vue +13 -0
- package/src/components/MTransferList.vue +24 -0
- package/src/components/MTransition.vue +149 -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/components/_MColorPanel.vue +478 -0
- package/src/composables/_colorUtils.ts +107 -0
- package/src/composables/_themeColor.ts +33 -0
- package/src/composables/_useSpring.ts +89 -0
- package/src/composables/dynamicColor.ts +85 -0
- package/src/composables/useColorPalette.ts +171 -25
- package/src/composables/useFieldBg.ts +6 -0
- package/src/composables/useLocale.ts +38 -3
- package/src/index.ts +9 -1
- package/src/locales/de.ts +10 -0
- package/src/locales/es.ts +10 -0
- package/src/locales/fr.ts +10 -0
- package/src/locales/ja.ts +10 -0
- package/src/locales/ko.ts +10 -0
- package/src/locales/pt.ts +10 -0
- package/src/locales/zh.ts +10 -0
- package/src/plugin.ts +30 -8
- package/src/styles/palettes.css +546 -0
- package/src/styles/theme.css +77 -0
- package/dist/MTextField-B0wGv1Mx.js.map +0 -1
- package/dist/useLocale-CmI675Ab.js.map +0 -1
|
@@ -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,6 +1,13 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
|
|
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
|
+
*/
|
|
8
|
+
import { computed, ref } from 'vue'
|
|
3
9
|
import MIcon from './MIcon.vue'
|
|
10
|
+
import { FAST_SPATIAL, useSpring } from '../composables/_useSpring'
|
|
4
11
|
|
|
5
12
|
export interface ButtonGroupOption {
|
|
6
13
|
value: unknown
|
|
@@ -10,12 +17,19 @@ export interface ButtonGroupOption {
|
|
|
10
17
|
}
|
|
11
18
|
|
|
12
19
|
const props = withDefaults(defineProps<{
|
|
20
|
+
/** Selected value(s) — any type (v-model) */
|
|
13
21
|
modelValue: unknown
|
|
22
|
+
/** The options to choose from; see `ButtonGroupOption`. */
|
|
14
23
|
options: ButtonGroupOption[]
|
|
24
|
+
/** Standard (separated) or connected (joined) */
|
|
15
25
|
variant?: 'standard' | 'connected'
|
|
26
|
+
/** Button size */
|
|
16
27
|
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl'
|
|
28
|
+
/** Allow multiple selections */
|
|
17
29
|
multiSelect?: boolean
|
|
30
|
+
/** At least one must be selected */
|
|
18
31
|
selectionRequired?: boolean
|
|
32
|
+
/** Selected button color */
|
|
19
33
|
color?: 'primary' | 'secondary' | 'tertiary'
|
|
20
34
|
}>(), {
|
|
21
35
|
variant: 'standard',
|
|
@@ -60,26 +74,20 @@ function toggle(opt: ButtonGroupOption) {
|
|
|
60
74
|
}
|
|
61
75
|
}
|
|
62
76
|
|
|
77
|
+
// pad: ButtonDefaults content padding per tier, also the most a neighbor can be compressed by (animateWidth's
|
|
78
|
+
// default compressionLimit). checked/pressed: ToggleButtonDefaults.shapesFor() radii, as in MToggleButton (the
|
|
79
|
+
// standard group's items are ToggleButtons). The button group spec only has the small tier; lg/xl are library
|
|
80
|
+
// sizes and reuse the medium radii.
|
|
63
81
|
const sizeMap = {
|
|
64
|
-
xs: { h: 'h-8', px: 'px-3', text: 'text-label-medium', icon: 16, check: 14 },
|
|
65
|
-
sm: { h: 'h-10', px: 'px-4', text: 'text-label-large', icon: 18, check: 16 },
|
|
66
|
-
md: { h: 'h-14', px: 'px-6', text: 'text-title-medium', icon: 20, check: 18 },
|
|
67
|
-
lg: { h: 'h-16', px: 'px-7', text: 'text-title-large', icon: 22, check: 20 },
|
|
68
|
-
xl: { h: 'h-20', px: 'px-8', text: 'text-headline-small', icon: 24, check: 22 },
|
|
82
|
+
xs: { h: 'h-8', px: 'px-3', text: 'text-label-medium', icon: 16, check: 14, height: 32, pad: 12, checked: 12, pressed: 8 },
|
|
83
|
+
sm: { h: 'h-10', px: 'px-4', text: 'text-label-large', icon: 18, check: 16, height: 40, pad: 16, checked: 12, pressed: 6 },
|
|
84
|
+
md: { h: 'h-14', px: 'px-6', text: 'text-title-medium', icon: 20, check: 18, height: 56, pad: 24, checked: 16, pressed: 12 },
|
|
85
|
+
lg: { h: 'h-16', px: 'px-7', text: 'text-title-large', icon: 22, check: 20, height: 64, pad: 28, checked: 16, pressed: 12 },
|
|
86
|
+
xl: { h: 'h-20', px: 'px-8', text: 'text-headline-small', icon: 24, check: 22, height: 80, pad: 32, checked: 16, pressed: 12 },
|
|
69
87
|
}
|
|
70
88
|
|
|
71
89
|
const s = computed(() => sizeMap[props.size] ?? sizeMap.sm)
|
|
72
90
|
|
|
73
|
-
const fullRadius = computed(() => {
|
|
74
|
-
const hMap = { xs: '16px', sm: '20px', md: '28px', lg: '32px', xl: '40px' }
|
|
75
|
-
return hMap[props.size] ?? '20px'
|
|
76
|
-
})
|
|
77
|
-
|
|
78
|
-
const transitionMs = computed(() => {
|
|
79
|
-
const msMap = { xs: 350, sm: 300, md: 250, lg: 200, xl: 180 }
|
|
80
|
-
return msMap[props.size] ?? 250
|
|
81
|
-
})
|
|
82
|
-
|
|
83
91
|
const selectedColors = computed(() => {
|
|
84
92
|
const map = {
|
|
85
93
|
primary: 'bg-primary text-on-primary',
|
|
@@ -102,25 +110,108 @@ function createRipple(event: PointerEvent) {
|
|
|
102
110
|
el.addEventListener('animationend', () => el.remove(), { once: true })
|
|
103
111
|
}
|
|
104
112
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
if (
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
113
|
+
const buttons: (HTMLElement | null)[] = []
|
|
114
|
+
const pressedIndex = ref(-1)
|
|
115
|
+
|
|
116
|
+
function onPointerDown(e: PointerEvent, i: number) {
|
|
117
|
+
createRipple(e)
|
|
118
|
+
if (e.button !== 0 || props.options[i]?.disabled) return
|
|
119
|
+
measureWidths()
|
|
120
|
+
pressedIndex.value = i
|
|
121
|
+
}
|
|
122
|
+
function onPointerUp() {
|
|
123
|
+
pressedIndex.value = -1
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
// ── Shapes ──────────────────────────────────────────────────────────────────────────────────
|
|
127
|
+
// Both variants morph like ToggleButton's shapeByInteraction(): pressed > checked > resting, on
|
|
128
|
+
// MotionSchemeKeyTokens.FastSpatial.
|
|
129
|
+
// Standard: ToggleButtonDefaults shapes, a pill that squares off when checked and more when pressed.
|
|
130
|
+
// Connected (ButtonGroupDefaults.connected*ButtonShapes, ConnectedButtonGroupSmallTokens): outer corners
|
|
131
|
+
// full, inner corners InnerCornerCornerSize (8dp) → PressedInnerCornerCornerSize (4dp) while pressed, and a
|
|
132
|
+
// checked button becomes a full pill (connectedButtonCheckedShape = CornerFull).
|
|
133
|
+
const CONNECTED_INNER = 8
|
|
134
|
+
const CONNECTED_PRESSED_INNER = 4
|
|
135
|
+
|
|
136
|
+
function radiiFor(i: number): number[] {
|
|
137
|
+
const full = s.value.height / 2
|
|
138
|
+
const pressed = pressedIndex.value === i
|
|
139
|
+
const checked = isSelected(props.options[i]!.value)
|
|
140
|
+
if (props.variant === 'standard') {
|
|
141
|
+
const r = pressed ? s.value.pressed : checked ? s.value.checked : full
|
|
142
|
+
return [r, r, r, r]
|
|
115
143
|
}
|
|
116
|
-
return
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
144
|
+
if (!pressed && checked) return [full, full, full, full]
|
|
145
|
+
const inner = pressed ? CONNECTED_PRESSED_INNER : CONNECTED_INNER
|
|
146
|
+
const start = i === 0 ? full : inner
|
|
147
|
+
const end = i === props.options.length - 1 ? full : inner
|
|
148
|
+
return [start, end, end, start]
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
useSpring(
|
|
152
|
+
() => props.options.flatMap((_, i) => radiiFor(i)),
|
|
153
|
+
(v) => {
|
|
154
|
+
buttons.forEach((el, i) => {
|
|
155
|
+
if (el) el.style.borderRadius = `${v[i * 4]}px ${v[i * 4 + 1]}px ${v[i * 4 + 2]}px ${v[i * 4 + 3]}px`
|
|
156
|
+
})
|
|
157
|
+
},
|
|
158
|
+
FAST_SPATIAL,
|
|
159
|
+
)
|
|
160
|
+
|
|
161
|
+
// ── Width: the pressed button grows, its neighbors give way (standard only) ──────────────────
|
|
162
|
+
// ButtonGroup's layout with ButtonGroupScope.animateWidth: the pressed item grows by expandedRatio
|
|
163
|
+
// (ButtonGroupDefaults.ExpandedRatio = 0.15) of its width, taken from its neighbors and capped by how much
|
|
164
|
+
// each can be compressed (its content padding). A middle item splits the growth between both sides.
|
|
165
|
+
// The connected samples don't use animateWidth, so the connected variant keeps its widths.
|
|
166
|
+
const EXPANDED_RATIO = 0.15
|
|
167
|
+
let natural: number[] = []
|
|
168
|
+
let widthsActive = false
|
|
169
|
+
|
|
170
|
+
function measureWidths() {
|
|
171
|
+
if (widthsActive) return
|
|
172
|
+
natural = props.options.map((_, i) => buttons[i]?.offsetWidth ?? 0)
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
function widthsFor(progress: readonly number[]): number[] {
|
|
176
|
+
const w = [...natural]
|
|
177
|
+
const pad = s.value.pad
|
|
178
|
+
const last = w.length - 1
|
|
179
|
+
for (let i = 0; i < w.length; i++) {
|
|
180
|
+
const p = progress[i] ?? 0
|
|
181
|
+
if (p === 0) continue
|
|
182
|
+
let growth: number
|
|
183
|
+
if (i > 0 && i < last) {
|
|
184
|
+
const g = Math.round(p * Math.min((EXPANDED_RATIO * w[i]!) / 2, pad))
|
|
185
|
+
const left = Math.min(g, w[i - 1]!)
|
|
186
|
+
const right = Math.min(g, w[i + 1]!)
|
|
187
|
+
w[i - 1]! -= left
|
|
188
|
+
w[i + 1]! -= right
|
|
189
|
+
growth = left + right
|
|
190
|
+
} else if (i === 0) {
|
|
191
|
+
const g = Math.round(p * Math.min(EXPANDED_RATIO * w[i]!, pad))
|
|
192
|
+
growth = Math.min(g, w[i + 1]!)
|
|
193
|
+
w[i + 1]! -= growth
|
|
194
|
+
} else {
|
|
195
|
+
const g = Math.round(p * Math.min(EXPANDED_RATIO * w[i]!, pad))
|
|
196
|
+
growth = Math.min(g, w[i - 1]!)
|
|
197
|
+
w[i - 1]! -= growth
|
|
198
|
+
}
|
|
199
|
+
w[i]! += growth
|
|
122
200
|
}
|
|
201
|
+
return w
|
|
123
202
|
}
|
|
203
|
+
|
|
204
|
+
useSpring(
|
|
205
|
+
() => props.options.map((_, i) => (props.variant === 'standard' && props.options.length > 1 && pressedIndex.value === i ? 1 : 0)),
|
|
206
|
+
(progress) => {
|
|
207
|
+
widthsActive = progress.some((p) => p !== 0)
|
|
208
|
+
const w = widthsActive && natural.length === props.options.length ? widthsFor(progress) : null
|
|
209
|
+
buttons.forEach((el, i) => {
|
|
210
|
+
if (el) el.style.width = w ? `${w[i]}px` : ''
|
|
211
|
+
})
|
|
212
|
+
},
|
|
213
|
+
FAST_SPATIAL,
|
|
214
|
+
)
|
|
124
215
|
</script>
|
|
125
216
|
|
|
126
217
|
<template>
|
|
@@ -133,16 +224,19 @@ function btnStyle(i: number, selected: boolean) {
|
|
|
133
224
|
v-for="(opt, i) in options"
|
|
134
225
|
:key="String(opt.value)"
|
|
135
226
|
type="button"
|
|
136
|
-
|
|
227
|
+
:ref="(el) => { buttons[i] = el as HTMLElement | null }"
|
|
228
|
+
class="btn-group-item relative inline-flex shrink-0 items-center justify-center gap-2 overflow-hidden font-medium whitespace-nowrap transition-[background-color,color] duration-200"
|
|
137
229
|
:class="[
|
|
138
230
|
s.h, s.px, s.text,
|
|
139
231
|
opt.disabled ? 'cursor-not-allowed opacity-[0.38]' : 'cursor-pointer',
|
|
140
232
|
isSelected(opt.value) ? selectedColors : unselectedColors,
|
|
141
233
|
]"
|
|
142
|
-
:style="btnStyle(i, isSelected(opt.value))"
|
|
143
234
|
:disabled="opt.disabled"
|
|
144
235
|
:aria-pressed="isSelected(opt.value)"
|
|
145
|
-
@pointerdown="
|
|
236
|
+
@pointerdown="onPointerDown($event, i)"
|
|
237
|
+
@pointerup="onPointerUp"
|
|
238
|
+
@pointerleave="onPointerUp"
|
|
239
|
+
@pointercancel="onPointerUp"
|
|
146
240
|
@click="toggle(opt)"
|
|
147
241
|
>
|
|
148
242
|
<MIcon
|
|
@@ -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 },
|
|
@@ -10,6 +10,16 @@ export type CarouselFlingBehavior = 'single-advance' | 'multi-browse' | 'no-snap
|
|
|
10
10
|
</script>
|
|
11
11
|
|
|
12
12
|
<script setup lang="ts" generic="T = CarouselItem">
|
|
13
|
+
/**
|
|
14
|
+
* The Material 3 carousel, with its four layouts. Items keep one size and are laid out side by side; as you
|
|
15
|
+
* scroll, each one is masked down to the space it has, so items grow as they reach the focal position and
|
|
16
|
+
* shrink as they leave. Drag it (touch or mouse), scroll it with a trackpad or a horizontal wheel, or focus it
|
|
17
|
+
* and use the arrow keys. For fixed-width slides with arrows and autoplay, see MSimpleCarousel.
|
|
18
|
+
*
|
|
19
|
+
* @slot item Content of each item, filling its full (unmasked) box. Replaces the default image and label
|
|
20
|
+
* @event update:modelValue The current item changed
|
|
21
|
+
* @event itemClick An item was clicked (not dragged). A partly visible item also scrolls into focus
|
|
22
|
+
*/
|
|
13
23
|
/*
|
|
14
24
|
* M3 carousel, ported from Compose Material3 (carousel/Carousel.kt and the keyline engine in
|
|
15
25
|
* ../composables/_carouselStrategy.ts). Like Compose's pager-based Carousel, every item has the
|
|
@@ -45,10 +55,13 @@ import {
|
|
|
45
55
|
|
|
46
56
|
const props = withDefaults(
|
|
47
57
|
defineProps<{
|
|
58
|
+
/** Items to render, required. CarouselItem by default; any type with an #item slot */
|
|
48
59
|
items: T[]
|
|
49
60
|
/** Index of the current (snapped) item; use with v-model to follow or drive it. */
|
|
50
61
|
modelValue?: number
|
|
62
|
+
/** Carousel layout */
|
|
51
63
|
variant?: CarouselVariant
|
|
64
|
+
/** Scroll axis */
|
|
52
65
|
orientation?: 'horizontal' | 'vertical'
|
|
53
66
|
/**
|
|
54
67
|
* Size of large items along the scroll axis, in px. Multi-browse and hero treat it as the
|
|
@@ -56,14 +69,17 @@ const props = withDefaults(
|
|
|
56
69
|
* without it fills the container minus its small items; full-screen ignores it.
|
|
57
70
|
*/
|
|
58
71
|
itemSize?: number
|
|
59
|
-
/** Space between items, in px
|
|
72
|
+
/** Space between items, in px (M3 uses 8). */
|
|
60
73
|
itemSpacing?: number
|
|
61
74
|
/** Padding at both ends of the scroll axis, in px. Items scroll under it. */
|
|
62
75
|
contentPadding?: number
|
|
76
|
+
/** Smallest size a small item can take (multi-browse, hero) */
|
|
63
77
|
minSmallItemSize?: number
|
|
78
|
+
/** Largest size a small item can take (multi-browse, hero) */
|
|
64
79
|
maxSmallItemSize?: number
|
|
65
80
|
/** What a release does. Defaults to 'no-snap' for uncontained, 'single-advance' otherwise. */
|
|
66
81
|
flingBehavior?: CarouselFlingBehavior
|
|
82
|
+
/** Allow dragging, wheel and keyboard scrolling */
|
|
67
83
|
userScrollEnabled?: boolean
|
|
68
84
|
/** Height of the carousel. Defaults to 205px for a horizontal carousel that isn't full-screen. */
|
|
69
85
|
height?: string
|
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* Centers its children both horizontally and vertically.
|
|
4
|
+
*
|
|
5
|
+
* @slot default Content, centered.
|
|
6
|
+
*/
|
|
2
7
|
import { computed } from 'vue'
|
|
3
8
|
|
|
4
9
|
const props = withDefaults(
|
|
5
10
|
defineProps<{
|
|
11
|
+
/** Use inline-flex instead of flex */
|
|
6
12
|
inline?: boolean
|
|
7
13
|
}>(),
|
|
8
14
|
{ inline: false },
|
|
@@ -1,13 +1,25 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* A thin Chart.js wrapper — line, bar, pie, doughnut, and radar types, with legend/tooltip/axis colors that
|
|
4
|
+
* automatically track the active M3 theme (light/dark, and any palette swap). Available from the `/chart` entry
|
|
5
|
+
* point.
|
|
6
|
+
*/
|
|
2
7
|
import { computed, ref, watch, onMounted, onBeforeUnmount, shallowRef, type Component } from 'vue'
|
|
3
8
|
|
|
4
9
|
type ChartType = 'line' | 'bar' | 'pie' | 'doughnut' | 'radar'
|
|
5
10
|
|
|
6
11
|
const props = withDefaults(
|
|
7
12
|
defineProps<{
|
|
13
|
+
/** Chart type. Required — there is no default. */
|
|
8
14
|
type: ChartType
|
|
15
|
+
/** Chart.js data object with labels and datasets. Required — there is no default. */
|
|
9
16
|
data: Record<string, any>
|
|
17
|
+
/**
|
|
18
|
+
* Chart.js options, deep-merged on top of MChart's own M3-themed defaults (legend/tooltip/axis colors that
|
|
19
|
+
* track the active theme automatically)
|
|
20
|
+
*/
|
|
10
21
|
options?: Record<string, any>
|
|
22
|
+
/** Chart height */
|
|
11
23
|
height?: string
|
|
12
24
|
}>(),
|
|
13
25
|
{ height: '300px' },
|
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* A chat message bubble — sender name, avatar, timestamp, and read status, for left (received) or right (sent)
|
|
4
|
+
* messages.
|
|
5
|
+
*
|
|
6
|
+
* @slot default Custom content inside the bubble, replacing the text prop — images, files, buttons, or any
|
|
7
|
+
* layout
|
|
8
|
+
*/
|
|
2
9
|
import { computed } from 'vue'
|
|
3
10
|
import MAvatar from './MAvatar.vue'
|
|
4
11
|
import MIcon from './MIcon.vue'
|
|
@@ -6,15 +13,25 @@ import { useLocale } from '../composables/useLocale'
|
|
|
6
13
|
|
|
7
14
|
const props = withDefaults(
|
|
8
15
|
defineProps<{
|
|
16
|
+
/** Message text (or use the default slot for custom content) */
|
|
9
17
|
text?: string
|
|
18
|
+
/** Sender name shown above the bubble (left-side only) */
|
|
10
19
|
sender?: string
|
|
20
|
+
/** Timestamp string (e.g. "10:32") */
|
|
11
21
|
time?: string
|
|
22
|
+
/** Left = received, right = sent */
|
|
12
23
|
side?: 'left' | 'right'
|
|
24
|
+
/** Avatar name — shows an MAvatar with these initials (left-side only) */
|
|
13
25
|
avatar?: string
|
|
26
|
+
/** Message status icon next to the timestamp (right-side only) */
|
|
14
27
|
status?: 'sent' | 'delivered' | 'read'
|
|
28
|
+
/** Bubble color for sent (right-side) messages */
|
|
15
29
|
color?: 'primary' | 'secondary' | 'tertiary'
|
|
30
|
+
/** Show the bubble tail (a sharper corner on the side nearest the sender) */
|
|
16
31
|
tail?: boolean
|
|
32
|
+
/** Text size (body-small / body-medium / body-large) */
|
|
17
33
|
size?: 'small' | 'medium' | 'large'
|
|
34
|
+
/** Max bubble width (px, %, or var()) — supports a CSS variable for responsive control */
|
|
18
35
|
maxWidth?: string
|
|
19
36
|
/** Shows a live indicator instead of the content: bouncing dots while the other person types, or a mic with a moving waveform while they record audio. */
|
|
20
37
|
typing?: 'text' | 'audio'
|
|
@@ -1,12 +1,23 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* A checkbox with checked, indeterminate, and disabled states, and 4 semantic color options.
|
|
4
|
+
*
|
|
5
|
+
* @slot default Custom label content — overrides the label prop when provided
|
|
6
|
+
* @event update:modelValue Emitted with the new checked state.
|
|
7
|
+
*/
|
|
2
8
|
import MIcon from "./MIcon.vue";
|
|
3
9
|
|
|
4
10
|
withDefaults(
|
|
5
11
|
defineProps<{
|
|
12
|
+
/** Checked state (v-model) */
|
|
6
13
|
modelValue: boolean;
|
|
14
|
+
/** Indeterminate state */
|
|
7
15
|
indeterminate?: boolean;
|
|
16
|
+
/** Disables the checkbox */
|
|
8
17
|
disabled?: boolean;
|
|
18
|
+
/** Label text — overridden by the default slot when present */
|
|
9
19
|
label?: string;
|
|
20
|
+
/** Checked/indeterminate color */
|
|
10
21
|
color?: "primary" | "secondary" | "tertiary" | "error";
|
|
11
22
|
/** Accessible name for the input when there's no visible label (e.g. a list row's checkbox). */
|
|
12
23
|
ariaLabel?: string;
|
package/src/components/MChip.vue
CHANGED
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* Compact elements for filters, input, or actions — named semantic tones or any CSS color, with optional icon,
|
|
4
|
+
* click, selection, and removal support.
|
|
5
|
+
*
|
|
6
|
+
* @slot default The chip's label.
|
|
7
|
+
* @event click Emitted when a clickable, non-disabled chip is clicked
|
|
8
|
+
* @event remove Emitted when the remove (X) button is clicked (removable only)
|
|
9
|
+
*/
|
|
2
10
|
import { computed } from 'vue'
|
|
3
11
|
import MIcon from './MIcon.vue'
|
|
4
12
|
|
|
@@ -7,11 +15,20 @@ type NamedTone = (typeof NAMED_TONES)[number]
|
|
|
7
15
|
|
|
8
16
|
const props = withDefaults(
|
|
9
17
|
defineProps<{
|
|
18
|
+
/** Color tone or any CSS color string */
|
|
10
19
|
tone?: string // named tone OR CSS color string
|
|
20
|
+
/** Selected/active state — the chip's shape morphs from a rounded rect to a full pill when selected */
|
|
11
21
|
selected?: boolean
|
|
22
|
+
/** Show a remove (X) button */
|
|
12
23
|
removable?: boolean
|
|
24
|
+
/**
|
|
25
|
+
* Makes the chip an interactive `<button>` with hover/press/focus feedback (otherwise renders as a plain
|
|
26
|
+
* `<span>`)
|
|
27
|
+
*/
|
|
13
28
|
clickable?: boolean
|
|
29
|
+
/** Disables interaction */
|
|
14
30
|
disabled?: boolean
|
|
31
|
+
/** Leading Material Symbol icon */
|
|
15
32
|
icon?: string
|
|
16
33
|
}>(),
|
|
17
34
|
{
|
|
@@ -1,14 +1,27 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* A circular progress indicator — a smooth arc, or the M3 Expressive wavy ring that fades between a circle and
|
|
4
|
+
* a bumpy wave near the extremes.
|
|
5
|
+
*
|
|
6
|
+
* @slot default Custom content centered inside the ring. When provided, the percentage label is hidden.
|
|
7
|
+
*/
|
|
2
8
|
import { computed, ref, watch, onMounted, onUnmounted, useId } from "vue";
|
|
3
9
|
|
|
4
10
|
const props = withDefaults(
|
|
5
11
|
defineProps<{
|
|
12
|
+
/** Progress 0–100 (omit when indeterminate) */
|
|
6
13
|
value?: number;
|
|
14
|
+
/** Spinning arc — no value needed. Identical for both variants. */
|
|
7
15
|
indeterminate?: boolean;
|
|
16
|
+
/** Ring color */
|
|
8
17
|
color?: "primary" | "secondary" | "tertiary" | "error";
|
|
18
|
+
/** wavy: animated bumpy ring that fades to circle near 0% and 100%; circle: smooth arc */
|
|
9
19
|
variant?: "circle" | "wavy";
|
|
20
|
+
/** Label text below the circle */
|
|
10
21
|
label?: string;
|
|
22
|
+
/** Diameter in px — matches the real M3 WaveSize/Size tokens per variant */
|
|
11
23
|
size?: number;
|
|
24
|
+
/** Stroke width of the ring/wave in px, matching the real M3 token */
|
|
12
25
|
thickness?: number;
|
|
13
26
|
}>(),
|
|
14
27
|
{
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* A syntax-highlighted code editor built on CodeMirror 6, with a header bar, line numbers, and a copy button.
|
|
4
|
+
*
|
|
5
|
+
* @slot actions Extra controls rendered in the header bar, before the built-in copy button
|
|
6
|
+
* @event update:modelValue Emitted on every document change — powers v-model
|
|
7
|
+
*/
|
|
2
8
|
import { ref, watch, onMounted, onBeforeUnmount, computed } from 'vue'
|
|
3
9
|
import MIcon from './MIcon.vue'
|
|
4
10
|
|
|
@@ -6,14 +12,23 @@ type Language = 'javascript' | 'typescript' | 'json' | 'html' | 'css' | 'python'
|
|
|
6
12
|
|
|
7
13
|
const props = withDefaults(
|
|
8
14
|
defineProps<{
|
|
15
|
+
/** Editor content (v-model) */
|
|
9
16
|
modelValue: string
|
|
17
|
+
/** Syntax language */
|
|
10
18
|
language?: Language
|
|
19
|
+
/** Read-only mode */
|
|
11
20
|
readonly?: boolean
|
|
21
|
+
/** Show line numbers */
|
|
12
22
|
lineNumbers?: boolean
|
|
23
|
+
/** Color theme */
|
|
13
24
|
theme?: 'light' | 'dark'
|
|
25
|
+
/** Minimum editor height */
|
|
14
26
|
minHeight?: string
|
|
27
|
+
/** Maximum editor height */
|
|
15
28
|
maxHeight?: string
|
|
29
|
+
/** Placeholder text shown via CodeMirror when the editor is empty */
|
|
16
30
|
placeholder?: string
|
|
31
|
+
/** Word wrap */
|
|
17
32
|
wrap?: boolean
|
|
18
33
|
}>(),
|
|
19
34
|
{
|