@m3ui-vue/m3ui-vue 0.9.0 → 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 +12 -2
- package/dist/API.md +3661 -0
- package/dist/MIcon-CaEooCmZ.js.map +1 -1
- package/dist/{MTextField-B0wGv1Mx.js → MTextField-pJU1vFaR.js} +3 -3
- package/dist/MTextField-pJU1vFaR.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 +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 +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 +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 +9 -7
- 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/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 +14 -0
- 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 +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 +10 -0
- 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/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 +4 -0
- 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/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/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 +32 -0
- package/dist/composables/useLocale.d.ts +2 -0
- package/dist/m3ui-vue.css +1 -1
- package/dist/m3ui.js +5239 -5242
- package/dist/m3ui.js.map +1 -1
- package/dist/markdown.js +1 -1
- package/dist/markdown.js.map +1 -1
- 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.css +1 -1
- package/dist/terminal.js.map +1 -1
- package/dist/{useLocale-CmI675Ab.js → useLocale-Drihe5G2.js} +13 -10
- package/dist/useLocale-Drihe5G2.js.map +1 -0
- package/package.json +4 -2
- package/src/__tests__/MHotkeys.test.ts +57 -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 +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 +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 +13 -0
- package/src/components/MColorPickerModal.vue +12 -0
- 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/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 +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 +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/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 +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 +10 -0
- 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/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/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/useLocale.ts +16 -3
- package/src/plugin.ts +2 -1
- package/dist/MTextField-B0wGv1Mx.js.map +0 -1
- package/dist/useLocale-CmI675Ab.js.map +0 -1
|
@@ -1,4 +1,18 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* A feature-rich data table — everything MTable has, plus column resize/pin/toggle, row grouping, striped/dense
|
|
4
|
+
* density, sticky header, expandable rows, and CSV export.
|
|
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
|
+
* @slot row-expand Expanded-row detail content, shown when expandable is true and the row is toggled open
|
|
10
|
+
* @event update:modelValue Emitted when the selection changes — powers v-model
|
|
11
|
+
* @event update:page Emitted when the page changes — powers v-model:page
|
|
12
|
+
* @event rowClick Emitted with the row's data when you click a row (unless `selectOnRowClick` makes the click
|
|
13
|
+
* select it).
|
|
14
|
+
* @event fetch Emitted instead of filtering locally when serverSide is true
|
|
15
|
+
*/
|
|
2
16
|
import { computed, ref, useSlots, watch, onMounted } from 'vue'
|
|
3
17
|
import MCheckbox from './MCheckbox.vue'
|
|
4
18
|
import MIcon from './MIcon.vue'
|
|
@@ -30,46 +44,78 @@ export interface DataTableGroup {
|
|
|
30
44
|
const SKEL = [65, 80, 50, 75, 90, 55, 70, 85, 60, 78]
|
|
31
45
|
|
|
32
46
|
const props = withDefaults(defineProps<{
|
|
47
|
+
/** Column definitions; see `DataTableColumn` */
|
|
33
48
|
columns: DataTableColumn[]
|
|
49
|
+
/** Table data rows */
|
|
34
50
|
rows: Record<string, any>[]
|
|
51
|
+
/** Show skeleton loading state */
|
|
35
52
|
loading?: boolean
|
|
53
|
+
/** Text when no rows (defaults to the locale string) */
|
|
36
54
|
emptyText?: string
|
|
55
|
+
/** Unique key field in each row */
|
|
37
56
|
rowKey?: string
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
*
|
|
41
|
-
* `rowClick`, así una tabla puede seleccionar filas y a la vez abrirlas al click.
|
|
57
|
+
/**
|
|
58
|
+
* Enable row selection with checkboxes (by default only the checkbox toggles a row; clicking the row itself
|
|
59
|
+
* still emits row-click)
|
|
42
60
|
*/
|
|
61
|
+
selectable?: boolean
|
|
62
|
+
/** With selectable, clicking anywhere on a row toggles its selection instead of emitting row-click */
|
|
63
|
+
// Con `selectable`, que el click en cualquier parte de la fila la marque/desmarque (en vez de
|
|
64
|
+
// emitir `rowClick`). Default false: sólo el checkbox selecciona y el click en la fila emite
|
|
65
|
+
// `rowClick`, así una tabla puede seleccionar filas y a la vez abrirlas al click.
|
|
43
66
|
selectOnRowClick?: boolean
|
|
67
|
+
/** Selected rows (v-model) */
|
|
44
68
|
modelValue?: Record<string, any>[]
|
|
69
|
+
/** Rows per page */
|
|
45
70
|
perPage?: number
|
|
71
|
+
/** Show search input */
|
|
46
72
|
searchable?: boolean
|
|
73
|
+
/** Enable row expansion (requires the row-expand slot) */
|
|
47
74
|
expandable?: boolean
|
|
75
|
+
/** Alternate row colors */
|
|
48
76
|
striped?: boolean
|
|
77
|
+
/** Compact row height */
|
|
49
78
|
dense?: boolean
|
|
79
|
+
/** Sticky table header */
|
|
50
80
|
stickyHeader?: boolean
|
|
81
|
+
/** Group rows by this column key */
|
|
51
82
|
groupBy?: string
|
|
83
|
+
/** Allow hiding/showing columns from a menu */
|
|
52
84
|
columnToggle?: boolean
|
|
85
|
+
/** Show an export-to-CSV button */
|
|
53
86
|
exportable?: boolean
|
|
87
|
+
/** Emit fetch instead of local filtering. Requires :total. */
|
|
54
88
|
serverSide?: boolean
|
|
89
|
+
/** Total rows (for server-side pagination) */
|
|
55
90
|
total?: number
|
|
91
|
+
/** Current page (v-model via update:page) */
|
|
56
92
|
page?: number
|
|
93
|
+
/** Placeholder for search input (defaults to the locale string) */
|
|
57
94
|
searchPlaceholder?: string
|
|
95
|
+
/** Text for selected count badge (defaults to the locale string) */
|
|
58
96
|
selectedText?: string
|
|
97
|
+
/** Text for total records count (defaults to the locale string) */
|
|
59
98
|
recordsText?: string
|
|
99
|
+
/** Aria label for the expand button (defaults to the locale string) */
|
|
60
100
|
expandLabel?: string
|
|
101
|
+
/** Label for the column-toggle button (defaults to the locale string) */
|
|
61
102
|
columnsLabel?: string
|
|
103
|
+
/** Label for the export button (defaults to the locale string) */
|
|
62
104
|
exportLabel?: string
|
|
105
|
+
/** Text for the ungrouped-rows bucket (defaults to the locale string) */
|
|
63
106
|
noGroupText?: string
|
|
64
|
-
/**
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
* (default), la tabla vuelve a su comportamiento natural: alto según la cantidad real de filas,
|
|
68
|
-
* sin piso reservado — usalo sólo en tablas puntuales que necesiten ese piso (p. ej. una agenda
|
|
69
|
-
* diaria que suele tener pocos o cero elementos y no debería verse minúscula al filtrar a un día
|
|
70
|
-
* vacío). El estado vacío siempre reserva un mínimo propio independientemente de este prop, ver
|
|
71
|
-
* `emptyStateMinHeight`.
|
|
107
|
+
/**
|
|
108
|
+
* Reserves a fixed min-height for the table area (any valid CSS min-height value) so switching between
|
|
109
|
+
* loading/empty/loaded doesn't visibly resize the table. Off by default.
|
|
72
110
|
*/
|
|
111
|
+
// Alto mínimo del área de la tabla (cualquier valor CSS válido para `min-height`) — reserva
|
|
112
|
+
// espacio fijo para que pasar de "cargando" (skeleton) a "pocos o cero resultados" (o
|
|
113
|
+
// viceversa, al cambiar de filtro/página) no encoja/agrande la tabla visiblemente. Sin valor
|
|
114
|
+
// (default), la tabla vuelve a su comportamiento natural: alto según la cantidad real de filas,
|
|
115
|
+
// sin piso reservado — usalo sólo en tablas puntuales que necesiten ese piso (p. ej. una agenda
|
|
116
|
+
// diaria que suele tener pocos o cero elementos y no debería verse minúscula al filtrar a un día
|
|
117
|
+
// vacío). El estado vacío siempre reserva un mínimo propio independientemente de este prop, ver
|
|
118
|
+
// `emptyStateMinHeight`.
|
|
73
119
|
minHeight?: string
|
|
74
120
|
}>(), {
|
|
75
121
|
loading: false,
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* An inline, dropdown-anchored calendar date picker with locale support and min/max range clamping.
|
|
4
|
+
*
|
|
5
|
+
* @event update:modelValue Emitted with the picked date.
|
|
6
|
+
*/
|
|
2
7
|
import { computed, onMounted, onUnmounted, ref, watch } from 'vue'
|
|
3
8
|
import MIcon from './MIcon.vue'
|
|
4
9
|
import MIconButton from './MIconButton.vue'
|
|
@@ -6,18 +11,34 @@ import { useFieldBg } from '../composables/useFieldBg'
|
|
|
6
11
|
import { useLocale } from '../composables/useLocale'
|
|
7
12
|
|
|
8
13
|
const props = defineProps<{
|
|
14
|
+
/** Selected date (YYYY-MM-DD, v-model) */
|
|
9
15
|
modelValue: string | null
|
|
16
|
+
/** Field label */
|
|
10
17
|
label?: string
|
|
18
|
+
/** Placeholder shown when no date is selected — falls back to label, then the current locale's string */
|
|
11
19
|
placeholder?: string
|
|
20
|
+
/** Minimum selectable date (YYYY-MM-DD) */
|
|
12
21
|
min?: string
|
|
22
|
+
/** Maximum selectable date (YYYY-MM-DD) */
|
|
13
23
|
max?: string
|
|
24
|
+
/** Disables the picker */
|
|
14
25
|
disabled?: boolean
|
|
26
|
+
/** Error state */
|
|
15
27
|
error?: boolean
|
|
28
|
+
/** Error message shown when error is true */
|
|
16
29
|
errorLabel?: string
|
|
30
|
+
/** Hint text below the field */
|
|
17
31
|
hint?: string
|
|
32
|
+
/**
|
|
33
|
+
* Locale for month/day names. Falls back to the app's configured locale (createM3UI({ locale })) — same
|
|
34
|
+
* pattern as MRelativeTime
|
|
35
|
+
*/
|
|
18
36
|
locale?: string
|
|
37
|
+
/** Overrides the auto-detected background color used to cut the floating label out of the border */
|
|
19
38
|
fieldBg?: string
|
|
39
|
+
/** Aria label for the previous-month button — defaults to the current locale's string */
|
|
20
40
|
prevMonthLabel?: string
|
|
41
|
+
/** Aria label for the next-month button — defaults to the current locale's string */
|
|
21
42
|
nextMonthLabel?: string
|
|
22
43
|
}>()
|
|
23
44
|
|
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* A modal, centered date picker with calendar and keyboard input modes. For a field that opens a dropdown
|
|
4
|
+
* calendar, use MDatePicker.
|
|
5
|
+
*
|
|
6
|
+
* @event update:modelValue Emitted when a date is confirmed — powers v-model
|
|
7
|
+
* @event update:show Emitted when the dialog opens or closes — powers v-model:show
|
|
8
|
+
*/
|
|
2
9
|
import { computed, ref, watch } from 'vue'
|
|
3
10
|
import MButton from './MButton.vue'
|
|
4
11
|
import MIconButton from './MIconButton.vue'
|
|
@@ -6,11 +13,20 @@ import MIcon from './MIcon.vue'
|
|
|
6
13
|
import { useLocale } from '../composables/useLocale'
|
|
7
14
|
|
|
8
15
|
const props = withDefaults(defineProps<{
|
|
16
|
+
/** Selected date in YYYY-MM-DD format (v-model) */
|
|
9
17
|
modelValue: string | null
|
|
18
|
+
/** Controls dialog visibility (v-model:show) */
|
|
10
19
|
show?: boolean
|
|
20
|
+
/** Minimum selectable date (YYYY-MM-DD) */
|
|
11
21
|
min?: string
|
|
22
|
+
/** Maximum selectable date (YYYY-MM-DD) */
|
|
12
23
|
max?: string
|
|
24
|
+
/**
|
|
25
|
+
* Locale for month/day names. Falls back to the app's configured locale (createM3UI({ locale })) — same
|
|
26
|
+
* pattern as MRelativeTime
|
|
27
|
+
*/
|
|
13
28
|
locale?: string
|
|
29
|
+
/** Dialog title */
|
|
14
30
|
title?: string
|
|
15
31
|
}>(), {
|
|
16
32
|
modelValue: null,
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* An inline, dropdown-anchored calendar for selecting a start and end date, with range highlighting.
|
|
4
|
+
*
|
|
5
|
+
* @event update:modelValue Emitted with the picked range.
|
|
6
|
+
*/
|
|
2
7
|
import { computed, onMounted, onUnmounted, ref, watch } from 'vue'
|
|
3
8
|
import MIcon from './MIcon.vue'
|
|
4
9
|
import MIconButton from './MIconButton.vue'
|
|
@@ -11,20 +16,38 @@ export interface DateRange {
|
|
|
11
16
|
}
|
|
12
17
|
|
|
13
18
|
const props = defineProps<{
|
|
19
|
+
/** Selected date range (v-model); see `DateRange` */
|
|
14
20
|
modelValue: DateRange
|
|
21
|
+
/** Field label */
|
|
15
22
|
label?: string
|
|
23
|
+
/** Placeholder shown when no range is selected — falls back to label, then the current locale's string */
|
|
16
24
|
placeholder?: string
|
|
25
|
+
/** Minimum date (YYYY-MM-DD) */
|
|
17
26
|
min?: string
|
|
27
|
+
/** Maximum date (YYYY-MM-DD) */
|
|
18
28
|
max?: string
|
|
29
|
+
/** Disables the picker */
|
|
19
30
|
disabled?: boolean
|
|
31
|
+
/** Error state */
|
|
20
32
|
error?: boolean
|
|
33
|
+
/** Error message shown when error is true */
|
|
21
34
|
errorLabel?: string
|
|
35
|
+
/** Hint text below the field */
|
|
22
36
|
hint?: string
|
|
37
|
+
/**
|
|
38
|
+
* Locale for month/day names. Falls back to the app's configured locale (createM3UI({ locale })) — same
|
|
39
|
+
* pattern as MRelativeTime
|
|
40
|
+
*/
|
|
23
41
|
locale?: string
|
|
42
|
+
/** Overrides the auto-detected background color used to cut the floating label out of the border */
|
|
24
43
|
fieldBg?: string
|
|
44
|
+
/** Aria label for the previous-month button — defaults to the current locale's string */
|
|
25
45
|
prevMonthLabel?: string
|
|
46
|
+
/** Aria label for the next-month button — defaults to the current locale's string */
|
|
26
47
|
nextMonthLabel?: string
|
|
48
|
+
/** Header text shown while picking the start date — defaults to the current locale's string */
|
|
27
49
|
pickStartText?: string
|
|
50
|
+
/** Header text shown while picking the end date — defaults to the current locale's string */
|
|
28
51
|
pickEndText?: string
|
|
29
52
|
}>()
|
|
30
53
|
|
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* A modal, centered date range picker with range highlighting — the sibling of MDateRangePicker, a fully
|
|
4
|
+
* separate component rather than a shared internal.
|
|
5
|
+
*
|
|
6
|
+
* @event update:modelValue Emitted when the end date is confirmed — powers v-model
|
|
7
|
+
* @event update:show Emitted when the dialog opens or closes — powers v-model:show
|
|
8
|
+
*/
|
|
2
9
|
import { computed, ref, watch } from 'vue'
|
|
3
10
|
import MButton from './MButton.vue'
|
|
4
11
|
import MIconButton from './MIconButton.vue'
|
|
@@ -10,11 +17,20 @@ export interface DateRange {
|
|
|
10
17
|
}
|
|
11
18
|
|
|
12
19
|
const props = withDefaults(defineProps<{
|
|
20
|
+
/** Selected date range (v-model) — see `DateRange` */
|
|
13
21
|
modelValue: DateRange
|
|
22
|
+
/** Controls dialog visibility (v-model:show) */
|
|
14
23
|
show?: boolean
|
|
24
|
+
/** Minimum selectable date (YYYY-MM-DD) */
|
|
15
25
|
min?: string
|
|
26
|
+
/** Maximum selectable date (YYYY-MM-DD) */
|
|
16
27
|
max?: string
|
|
28
|
+
/**
|
|
29
|
+
* Locale for month/day names. Falls back to the app's configured locale (createM3UI({ locale })) — same
|
|
30
|
+
* pattern as MRelativeTime
|
|
31
|
+
*/
|
|
17
32
|
locale?: string
|
|
33
|
+
/** Dialog title */
|
|
18
34
|
title?: string
|
|
19
35
|
}>(), {
|
|
20
36
|
show: false,
|
|
@@ -1,29 +1,49 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* The generic M3 modal shell — Escape, scroll lock, and Teleport are handled internally. Supports a centered
|
|
4
|
+
* card, a full-screen variant, and an optional icon that centers the title per spec.
|
|
5
|
+
*
|
|
6
|
+
* @slot icon M3 AlertDialog's optional icon (Secondary color, 24dp expected). Its presence also centers the
|
|
7
|
+
* title, per spec.
|
|
8
|
+
* @slot title Overrides the title prop with custom markup
|
|
9
|
+
* @slot default Dialog body content — scrolls independently when taller than maxHeight
|
|
10
|
+
* @slot actions Row of action buttons — wraps to a new line instead of overflowing when labels are long
|
|
11
|
+
* @event update:modelValue Emitted when the dialog should open/close — powers v-model
|
|
12
|
+
*/
|
|
2
13
|
import { computed, nextTick, onUnmounted, ref, watch } from 'vue'
|
|
3
14
|
import MIconButton from './MIconButton.vue'
|
|
4
15
|
import { useLocale } from '../composables/useLocale'
|
|
5
16
|
|
|
6
17
|
const props = withDefaults(
|
|
7
18
|
defineProps<{
|
|
19
|
+
/** Open/closed state (v-model) */
|
|
8
20
|
modelValue: boolean
|
|
21
|
+
/** Dialog title (overridable via the #title slot) */
|
|
9
22
|
title?: string
|
|
10
23
|
/** A Tailwind class (`max-w-sm`) or a CSS value (`420px`, `min(90vw, 40rem)`). */
|
|
11
24
|
maxWidth?: string
|
|
12
25
|
/**
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* viewport-relative cap, not a spec value.
|
|
26
|
+
* Maximum height: a Tailwind class (`max-h-[60vh]`) or a CSS value (`480px`, `calc(100dvh - 4rem)`). When the
|
|
27
|
+
* content is taller, the body scrolls and a divider appears above the actions.
|
|
16
28
|
*/
|
|
29
|
+
// A Tailwind class (`max-h-[80vh]`) or a CSS value (`600px`). M3's `AlertDialogDefaults` has
|
|
30
|
+
// no max-height token at all (only `DialogMaxWidth`) — the default here is a library-chosen
|
|
31
|
+
// viewport-relative cap, not a spec value.
|
|
17
32
|
maxHeight?: string
|
|
33
|
+
/** Prevent closing by clicking the scrim, pressing Escape, or the X button */
|
|
18
34
|
persistent?: boolean
|
|
35
|
+
/** Full-screen variant — slides up from the bottom, covers the entire viewport */
|
|
19
36
|
fullscreen?: boolean
|
|
37
|
+
/** Aria label for the close (X) button — falls back to the locale string when omitted */
|
|
20
38
|
closeLabel?: string
|
|
21
39
|
/**
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
* deliberate library extension on top of the spec, kept opt-out (default `true`, matching
|
|
25
|
-
* this component's existing behavior) rather than added unconditionally.
|
|
40
|
+
* Show the header close (X) button — a library addition, not part of the M3 AlertDialog spec, so it can be
|
|
41
|
+
* turned off
|
|
26
42
|
*/
|
|
43
|
+
// Whether the header shows a close ("X") icon button. M3's `AlertDialog` spec has no such
|
|
44
|
+
// button — it expects only a Cancel/Confirm text button in the actions row — so this is a
|
|
45
|
+
// deliberate library extension on top of the spec, kept opt-out (default `true`, matching
|
|
46
|
+
// this component's existing behavior) rather than added unconditionally.
|
|
27
47
|
closable?: boolean
|
|
28
48
|
}>(),
|
|
29
49
|
{
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* A thin separator line, horizontal or vertical, with an optional centered label.
|
|
4
|
+
*/
|
|
2
5
|
withDefaults(defineProps<{
|
|
6
|
+
/** Render as a vertical divider (fills the height of a flex container) */
|
|
3
7
|
vertical?: boolean
|
|
8
|
+
/** Text label in the middle of the divider (horizontal only) */
|
|
4
9
|
label?: string
|
|
10
|
+
/** Add left margin (ml-16) to align with content that has a leading icon */
|
|
5
11
|
inset?: boolean
|
|
6
12
|
}>(), { vertical: false, inset: false })
|
|
7
13
|
</script>
|
|
@@ -1,4 +1,16 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* A reorderable list: v-model the array and render each row with the #default slot. Works with a mouse, a
|
|
4
|
+
* finger and the keyboard. The dragged row lifts with M3's dragged-item elevation and the rest slide out of its
|
|
5
|
+
* way.
|
|
6
|
+
*
|
|
7
|
+
* @slot default Content of each row (or the whole row with bare). Falls back to item.id. Controls inside it
|
|
8
|
+
* (checkboxes, switches, buttons, links) keep working and never start a drag. dragging is true while the row
|
|
9
|
+
* is lifted; handleProps (with handle) goes on your own grip element via v-bind
|
|
10
|
+
* @event update:modelValue Emitted with the reordered array (v-model)
|
|
11
|
+
* @event reorder Emitted alongside update:modelValue with the source and destination indices. Useful for saving
|
|
12
|
+
* the new order to a backend
|
|
13
|
+
*/
|
|
2
14
|
import { ref, onBeforeUpdate, onUpdated, onMounted, onBeforeUnmount } from 'vue'
|
|
3
15
|
import MIcon from './MIcon.vue'
|
|
4
16
|
import { useLocale } from '../composables/useLocale'
|
|
@@ -10,8 +22,14 @@ export interface DragDropItem {
|
|
|
10
22
|
|
|
11
23
|
const props = withDefaults(
|
|
12
24
|
defineProps<{
|
|
25
|
+
/** Array of items with a unique id (v-model) */
|
|
13
26
|
modelValue: DragDropItem[]
|
|
27
|
+
/**
|
|
28
|
+
* Drag only from a handle button at the start of each row. Touch drags start right away from the handle;
|
|
29
|
+
* without it, a whole row starts dragging after a long press so swipes still scroll the page
|
|
30
|
+
*/
|
|
14
31
|
handle?: boolean
|
|
32
|
+
/** Turns reordering off (pointer and keyboard) and dims the list */
|
|
15
33
|
disabled?: boolean
|
|
16
34
|
/**
|
|
17
35
|
* Drops the row's own look (padding, min height, hover/dragged state layer, background)
|
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* Renders a single emoji character at a fixed pixel size, with optional accessible labeling.
|
|
4
|
+
*/
|
|
2
5
|
const props = withDefaults(
|
|
3
6
|
defineProps<{
|
|
7
|
+
/** The emoji character to display — required */
|
|
4
8
|
emoji: string
|
|
9
|
+
/** Size in pixels (sets font-size, width, and height) */
|
|
5
10
|
size?: number
|
|
11
|
+
/** Accessible label — when set, adds role="img" and aria-label */
|
|
6
12
|
label?: string
|
|
7
13
|
}>(),
|
|
8
14
|
{ size: 24 },
|
|
@@ -1,15 +1,26 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* A single emoji button that cycles through a random pool on hover (Discord-style) and emits whichever emoji is
|
|
4
|
+
* showing when clicked.
|
|
5
|
+
*
|
|
6
|
+
* @event click Emitted on click with the currently displayed emoji (whatever hover last cycled to)
|
|
7
|
+
*/
|
|
2
8
|
import { ref } from 'vue'
|
|
3
9
|
import { allEmojis, emojiCategories, randomEmoji } from '../data/emojis'
|
|
4
10
|
|
|
5
11
|
const props = withDefaults(
|
|
6
12
|
defineProps<{
|
|
13
|
+
/** Default/current emoji shown before any hover cycling or click */
|
|
7
14
|
emoji?: string
|
|
15
|
+
/** Emoji font size in pixels (the button itself is size + 12px) */
|
|
8
16
|
size?: number
|
|
17
|
+
/** Accessible label — defaults to 'Emoji {emoji}' */
|
|
9
18
|
label?: string
|
|
19
|
+
/** Cycle to a random emoji on hover (Discord-style) */
|
|
10
20
|
randomOnHover?: boolean
|
|
11
21
|
/** Limit random pool to a category id (e.g. 'smileys', 'animals') */
|
|
12
22
|
category?: string
|
|
23
|
+
/** Disables interaction */
|
|
13
24
|
disabled?: boolean
|
|
14
25
|
}>(),
|
|
15
26
|
{ emoji: '😀', size: 28, randomOnHover: true, disabled: false },
|
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* An emoji picker in the style of Android's and Gboard's: the full Unicode set (Emoji 15.0) by category,
|
|
4
|
+
* recently used ones first, skin tones, and search by name in the app's language. The names come from Unicode's
|
|
5
|
+
* CLDR and load only when the picker is used, one language at a time.
|
|
6
|
+
*
|
|
7
|
+
* @event select An emoji was picked, with the skin tone applied
|
|
8
|
+
*/
|
|
2
9
|
/*
|
|
3
10
|
* Emoji picker. M3 has no emoji component; the reference is Google's own androidx
|
|
4
11
|
* EmojiPickerView (a category bar with Recent first, a grid with headers, skin-tone variants on
|
|
@@ -1,10 +1,19 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* A placeholder for empty views — icon, title, description, and optional action buttons.
|
|
4
|
+
*
|
|
5
|
+
* @slot actions Action buttons rendered below the description
|
|
6
|
+
*/
|
|
2
7
|
import MIcon from './MIcon.vue'
|
|
3
8
|
|
|
4
9
|
withDefaults(defineProps<{
|
|
10
|
+
/** Material Symbol icon */
|
|
5
11
|
icon?: string
|
|
12
|
+
/** Title text — required */
|
|
6
13
|
title: string
|
|
14
|
+
/** Supporting description */
|
|
7
15
|
description?: string
|
|
16
|
+
/** Smaller variant (24px icon in a 48px circle, less padding) */
|
|
8
17
|
compact?: boolean
|
|
9
18
|
}>(), { icon: 'inbox' })
|
|
10
19
|
</script>
|
|
@@ -1,13 +1,30 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* A collapsible section with a smooth height animation. Works controlled via v-model, or uncontrolled by simply
|
|
4
|
+
* omitting modelValue.
|
|
5
|
+
*
|
|
6
|
+
* @slot default Panel body content, revealed with a height animation when open
|
|
7
|
+
* @event update:modelValue Emitted when the panel is toggled — only meaningful when modelValue is passed
|
|
8
|
+
* (controlled usage); powers v-model
|
|
9
|
+
*/
|
|
2
10
|
import { computed, ref } from 'vue'
|
|
3
11
|
import MIcon from './MIcon.vue'
|
|
4
12
|
|
|
5
13
|
const props = withDefaults(defineProps<{
|
|
14
|
+
/** Panel header text */
|
|
6
15
|
title: string
|
|
16
|
+
/** Secondary text in the header, below the title */
|
|
7
17
|
subtitle?: string
|
|
18
|
+
/** Leading Material Symbol icon in the header */
|
|
8
19
|
icon?: string
|
|
20
|
+
/**
|
|
21
|
+
* Open/closed state (v-model). Omit it entirely to let the panel manage its own open state internally
|
|
22
|
+
* (uncontrolled).
|
|
23
|
+
*/
|
|
9
24
|
modelValue?: boolean
|
|
25
|
+
/** Disables toggling */
|
|
10
26
|
disabled?: boolean
|
|
27
|
+
/** Visual style of the panel container */
|
|
11
28
|
variant?: 'outlined' | 'filled' | 'elevated'
|
|
12
29
|
}>(), { modelValue: undefined, disabled: false, variant: 'outlined' })
|
|
13
30
|
|
|
@@ -1,15 +1,30 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* Serializes the data prop and triggers a real browser download — no dependencies.
|
|
4
|
+
*
|
|
5
|
+
* @slot default Replaces the label text prop
|
|
6
|
+
* @event error Emitted if serialization or the download trigger fails
|
|
7
|
+
* @event exported Emitted after a successful download is triggered
|
|
8
|
+
*/
|
|
2
9
|
import MButton from './MButton.vue'
|
|
3
10
|
|
|
4
11
|
const props = withDefaults(
|
|
5
12
|
defineProps<{
|
|
13
|
+
/** Array of objects to export */
|
|
6
14
|
data: Record<string, unknown>[]
|
|
15
|
+
/** Export format */
|
|
7
16
|
format?: 'csv' | 'json'
|
|
17
|
+
/** Filename without extension — the extension is added automatically */
|
|
8
18
|
filename?: string
|
|
19
|
+
/** Button label (overridden by the default slot) */
|
|
9
20
|
label?: string
|
|
21
|
+
/** Leading Material Symbol icon */
|
|
10
22
|
icon?: string
|
|
23
|
+
/** Visual style (same as MButton) */
|
|
11
24
|
variant?: 'filled' | 'tonal' | 'outlined' | 'text' | 'elevated'
|
|
25
|
+
/** Button size */
|
|
12
26
|
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl'
|
|
27
|
+
/** Disables the button */
|
|
13
28
|
disabled?: boolean
|
|
14
29
|
}>(),
|
|
15
30
|
{
|
package/src/components/MFab.vue
CHANGED
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* A Floating Action Button for the primary action of a screen. Supports extended (icon+label), a speed-dial of
|
|
4
|
+
* small items, or a fully custom expanding panel via the `#content` slot.
|
|
5
|
+
*
|
|
6
|
+
* @slot content A panel anchored to the FAB that opens when you press it, instead of the `items` speed dial.
|
|
7
|
+
* `close()` closes it.
|
|
8
|
+
* @event click Emitted when the FAB itself is clicked (not a speed-dial item)
|
|
9
|
+
*/
|
|
2
10
|
import { computed, onMounted, onUnmounted, ref, useSlots } from 'vue'
|
|
3
11
|
import MIcon from './MIcon.vue'
|
|
4
12
|
|
|
@@ -13,14 +21,23 @@ defineOptions({ inheritAttrs: false })
|
|
|
13
21
|
|
|
14
22
|
const props = withDefaults(
|
|
15
23
|
defineProps<{
|
|
24
|
+
/** Material Symbol icon name */
|
|
16
25
|
icon: string
|
|
26
|
+
/** Extended FAB label text */
|
|
17
27
|
label?: string
|
|
28
|
+
/** Color scheme */
|
|
18
29
|
color?: 'primary' | 'secondary' | 'tertiary' | 'surface'
|
|
30
|
+
/** FAB size */
|
|
19
31
|
size?: 'small' | 'regular' | 'medium' | 'large'
|
|
32
|
+
/** Disables interaction */
|
|
20
33
|
disabled?: boolean
|
|
34
|
+
/** Speed-dial child items (see `SpeedDialItem`) */
|
|
21
35
|
items?: SpeedDialItem[]
|
|
36
|
+
/** Speed-dial expand direction */
|
|
22
37
|
direction?: 'up' | 'down' | 'left' | 'right' | 'radial'
|
|
38
|
+
/** Vue Router destination — renders as RouterLink instead of button */
|
|
23
39
|
to?: string | Record<string, any>
|
|
40
|
+
/** Keep speed-dial open after clicking an item or clicking outside */
|
|
24
41
|
persistent?: boolean
|
|
25
42
|
/** For the `up`/`down` #content panel only: which edge it anchors to when
|
|
26
43
|
* it's wider than the FAB itself. 'start' (default) keeps its left edge
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* The M3 "FAB Menu" — a thin wrapper around `MFab`'s `#content` slot, so opening/closing, the icon's 45° morph,
|
|
4
|
+
* outside-click, and scroll-away are all inherited from `MFab` — this component only supplies the row list.
|
|
5
|
+
* Unlike the small circular buttons of a speed dial (`MFab`'s `items` prop), each row is a full icon+label
|
|
6
|
+
* pill, revealed one at a time starting from the item closest to the FAB.
|
|
7
|
+
*/
|
|
2
8
|
import { computed } from 'vue'
|
|
3
9
|
import MFab from './MFab.vue'
|
|
4
10
|
import MIcon from './MIcon.vue'
|
|
@@ -15,19 +21,33 @@ export interface FabMenuItem {
|
|
|
15
21
|
|
|
16
22
|
const props = withDefaults(
|
|
17
23
|
defineProps<{
|
|
24
|
+
/**
|
|
25
|
+
* Trigger FAB's Material Symbol icon — use a symmetric one like 'add', since MFab rotates it 45° on open
|
|
26
|
+
* (turning a + into a ×)
|
|
27
|
+
*/
|
|
18
28
|
icon: string
|
|
19
29
|
/** Shows the trigger as an extended FAB (icon + text) instead of icon-only. */
|
|
20
30
|
label?: string
|
|
31
|
+
/** The menu's items; see `FabMenuItem`. An item's own color overrides the menu's color for just that row. */
|
|
21
32
|
items: FabMenuItem[]
|
|
33
|
+
/** Color scheme applied to both the trigger FAB and every menu item row */
|
|
22
34
|
color?: 'primary' | 'secondary' | 'tertiary' | 'surface'
|
|
23
35
|
/** Trigger FAB size — independent from `itemSize` below. */
|
|
24
36
|
size?: 'small' | 'regular' | 'large'
|
|
25
37
|
/** Menu item row size — independent from the trigger FAB's own `size`. */
|
|
26
38
|
itemSize?: 'small' | 'regular' | 'large'
|
|
39
|
+
/** Which side of the FAB the menu list opens toward */
|
|
27
40
|
direction?: 'up' | 'down'
|
|
41
|
+
/**
|
|
42
|
+
* Which edge the (usually wider-than-the-FAB) menu list anchors to — 'end' keeps it from running off-screen
|
|
43
|
+
* when the FAB sits in a bottom-right corner
|
|
44
|
+
*/
|
|
28
45
|
align?: 'start' | 'end'
|
|
46
|
+
/** Dim the rest of the screen while the menu is open */
|
|
29
47
|
scrim?: boolean
|
|
48
|
+
/** Keep the menu open after clicking an item or clicking outside */
|
|
30
49
|
persistent?: boolean
|
|
50
|
+
/** Disables the trigger FAB */
|
|
31
51
|
disabled?: boolean
|
|
32
52
|
}>(),
|
|
33
53
|
{
|
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* A drag-and-drop file upload zone with image previews, per-file size formatting, and progress/status display.
|
|
4
|
+
* It only selects files: uploading them is up to you, and each entry's status and progress show how it's going.
|
|
5
|
+
*
|
|
6
|
+
* @slot dropzone Replaces the default icon + text content of the drop zone
|
|
7
|
+
* @slot actions Right-aligned row below the list, shown only while it has files. Scope: { files: UploadFile[],
|
|
8
|
+
* clear: () => void }. Put your Upload / Clear buttons here
|
|
9
|
+
* @event update:modelValue Emitted with the new list whenever files are added, removed or cleared (v-model)
|
|
10
|
+
* @event select Emitted with the newly accepted files whenever files are added (drop or picker)
|
|
11
|
+
* @event remove Emitted when a file is removed from the list with its remove button
|
|
12
|
+
*/
|
|
2
13
|
import { ref, computed, reactive, watch, onBeforeUnmount } from 'vue'
|
|
3
14
|
import MIcon from './MIcon.vue'
|
|
4
15
|
import MIconButton from './MIconButton.vue'
|
|
@@ -17,13 +28,21 @@ export interface UploadFile {
|
|
|
17
28
|
|
|
18
29
|
const props = withDefaults(
|
|
19
30
|
defineProps<{
|
|
31
|
+
/** Accepted file types (e.g. ".png,.jpg", "image/*") */
|
|
20
32
|
accept?: string
|
|
33
|
+
/** Allow multiple files */
|
|
21
34
|
multiple?: boolean
|
|
35
|
+
/** Max file size in bytes — oversized files are silently filtered out */
|
|
22
36
|
maxSize?: number
|
|
37
|
+
/** Disables the upload area */
|
|
23
38
|
disabled?: boolean
|
|
39
|
+
/** Drop zone main text (defaults to the locale string) */
|
|
24
40
|
dropText?: string
|
|
41
|
+
/** Drop zone select link text (defaults to the locale string) */
|
|
25
42
|
selectText?: string
|
|
43
|
+
/** Prefix shown before the formatted max size (defaults to the locale string) */
|
|
26
44
|
maxSizePrefix?: string
|
|
45
|
+
/** Aria label for each file row's remove button (defaults to the locale string) */
|
|
27
46
|
removeLabel?: string
|
|
28
47
|
/** Optional v-model. Bind it to own the list: clear it, or update each entry's status/progress. Unbound, the component keeps the list itself. */
|
|
29
48
|
modelValue?: UploadFile[]
|