@m3ui-vue/m3ui-vue 1.10.2 → 1.11.0
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 +19 -4
- package/dist/API.md +195 -56
- package/dist/MButton-gWoOzFWf.js +284 -0
- package/dist/MButton-gWoOzFWf.js.map +1 -0
- package/dist/MColorPickerModal-CJYMvlgK.js +466 -0
- package/dist/MColorPickerModal-CJYMvlgK.js.map +1 -0
- package/dist/MDialog-CU8EYgCC.js +226 -0
- package/dist/MDialog-CU8EYgCC.js.map +1 -0
- package/dist/{MIcon-BSsJZhK7.js → MIcon-CkUc9kuQ.js} +10 -4
- package/dist/MIcon-CkUc9kuQ.js.map +1 -0
- package/dist/MIconButton-DTFOfsTy.js +317 -0
- package/dist/MIconButton-DTFOfsTy.js.map +1 -0
- package/dist/MListItem-Cdw2FqCT.js +1306 -0
- package/dist/MListItem-Cdw2FqCT.js.map +1 -0
- package/dist/MLoadingIndicator-BxAy2x7P.js +115 -0
- package/dist/MLoadingIndicator-BxAy2x7P.js.map +1 -0
- package/dist/{MMenuItem-US0Zbglq.js → MMenuItem-CEIKYvaX.js} +216 -214
- package/dist/MMenuItem-CEIKYvaX.js.map +1 -0
- package/dist/{MPdfViewer-DL9mRsd2.js → MPdfViewer-CEfyXGq2.js} +674 -671
- package/dist/MPdfViewer-CEfyXGq2.js.map +1 -0
- package/dist/MProgressBar-BzZMxq7M.js.map +1 -1
- package/dist/MSeekBar-B3_D-PwH.js +435 -0
- package/dist/MSeekBar-B3_D-PwH.js.map +1 -0
- package/dist/{MSegmentedButton-DMou-8sG.js → MSegmentedButton-Dg07j-4r.js} +4 -4
- package/dist/{MSegmentedButton-DMou-8sG.js.map → MSegmentedButton-Dg07j-4r.js.map} +1 -1
- package/dist/{MSignaturePad-WuvE_Cyl.js → MSignaturePad-3nddtLKI.js} +2 -2
- package/dist/{MSignaturePad-WuvE_Cyl.js.map → MSignaturePad-3nddtLKI.js.map} +1 -1
- package/dist/{MSlider-7TzhFHKS.js → MSlider-BrpLbqwt.js} +4 -4
- package/dist/{MSlider-7TzhFHKS.js.map → MSlider-BrpLbqwt.js.map} +1 -1
- package/dist/{MSpinner-CkIVBuGE.js → MSpinner-CLwzDH33.js} +2 -2
- package/dist/{MSpinner-CkIVBuGE.js.map → MSpinner-CLwzDH33.js.map} +1 -1
- package/dist/{MTextField-B6_iOczK.js → MTextField-CZRizAwA.js} +136 -134
- package/dist/MTextField-CZRizAwA.js.map +1 -0
- package/dist/{_useFieldValidation-COBJ1tWr.js → _useFieldValidation-DVcqyy9g.js} +2 -2
- package/dist/{_useFieldValidation-COBJ1tWr.js.map → _useFieldValidation-DVcqyy9g.js.map} +1 -1
- package/dist/api.json +1 -1
- package/dist/chart.js +1 -1
- package/dist/code-editor.js +3 -3
- package/dist/code-editor.js.map +1 -1
- package/dist/components/MAlert.vue.d.ts +1 -1
- package/dist/components/MAudioPlayer.vue.d.ts +3 -3
- package/dist/components/MAvatar.vue.d.ts +19 -1
- package/dist/components/MButton.vue.d.ts +2 -1
- package/dist/components/MChatBubble.vue.d.ts +2 -0
- package/dist/components/MCheckbox.vue.d.ts +2 -0
- package/dist/components/MDataTable.vue.d.ts +31 -3
- package/dist/components/MFlow.vue.d.ts +1 -1
- package/dist/components/MHotkeys.vue.d.ts +1 -0
- package/dist/components/MIcon.vue.d.ts +6 -0
- package/dist/components/MIconButton.vue.d.ts +5 -0
- package/dist/components/MKanban.vue.d.ts +1 -1
- package/dist/components/MLink.vue.d.ts +59 -0
- package/dist/components/MListItem.vue.d.ts +3 -1
- package/dist/components/MMapControl.vue.d.ts +1 -1
- package/dist/components/MNotificationCenter.vue.d.ts +1 -1
- package/dist/components/MNumberField.vue.d.ts +1 -1
- package/dist/components/MPagination.vue.d.ts +14 -1
- package/dist/components/MPdfSigner.vue.d.ts +2 -2
- package/dist/components/MRadio.vue.d.ts +2 -0
- package/dist/components/MRadioGroup.vue.d.ts +2 -0
- package/dist/components/MStatCard.vue.d.ts +2 -2
- package/dist/components/MSwitch.vue.d.ts +2 -0
- package/dist/components/MText.vue.d.ts +4 -2
- package/dist/components/MTextField.vue.d.ts +2 -0
- package/dist/components/_MDrawerItemList.vue.d.ts +6 -0
- package/dist/composables/_menuGroups.d.ts +10 -1
- package/dist/composables/_splitAttrs.d.ts +6 -0
- package/dist/composables/_springAnimation.d.ts +2 -2
- package/dist/composables/_useFocusTrap.d.ts +15 -0
- package/dist/composables/_usePaneResize.d.ts +1 -1
- package/dist/composables/_useSpring.d.ts +4 -4
- package/dist/composables/dynamicColor.d.ts +9 -1
- package/dist/composables/motion.d.ts +63 -0
- package/dist/composables/useConfirm.d.ts +28 -0
- package/dist/composables/useDevice.d.ts +8 -1
- package/dist/composables/useLocale.d.ts +14 -0
- package/dist/composables/useScrollReveal.d.ts +1 -1
- package/dist/composables/useTheme.d.ts +1 -0
- package/dist/composables/useToast.d.ts +7 -0
- package/dist/draw.js +556 -556
- package/dist/draw.js.map +1 -1
- package/dist/flow.js +854 -851
- package/dist/flow.js.map +1 -1
- package/dist/gantt.js +1118 -1096
- package/dist/gantt.js.map +1 -1
- package/dist/index.d.ts +8 -5
- package/dist/locales/index.d.ts +1 -0
- package/dist/locales/index.js +833 -1
- package/dist/locales/index.js.map +1 -1
- package/dist/locales/pl.d.ts +2 -0
- package/dist/m3ui-vue.css +1 -1
- package/dist/m3ui.js +10327 -9796
- package/dist/m3ui.js.map +1 -1
- package/dist/map.js +860 -860
- package/dist/map.js.map +1 -1
- package/dist/{material-color-utilities-CEFytLsr.js → material-color-utilities-BZsBNIhi.js} +276 -217
- package/dist/material-color-utilities-BZsBNIhi.js.map +1 -0
- package/dist/media.js +7 -7
- package/dist/{motion-BcejVTeX.js → motion-BqYcqcim.js} +15 -5
- package/dist/motion-BqYcqcim.js.map +1 -0
- package/dist/pdf-sign.js +140 -137
- package/dist/pdf-sign.js.map +1 -1
- package/dist/pdf.js +1 -1
- package/dist/plugin.d.ts +11 -0
- package/dist/rich-text-editor.js +7 -7
- package/dist/styles/theme.css +40 -0
- package/dist/styles.css +1 -1
- package/dist/terminal.js +1 -1
- package/dist/{useLocale-YRaOT12S.js → useLocale-BjcYauXr.js} +60 -4
- package/dist/useLocale-BjcYauXr.js.map +1 -0
- package/dist/{useThemeTokens-DyAdPQB0.js → useThemeTokens-D5nr5KHf.js} +28 -27
- package/dist/useThemeTokens-D5nr5KHf.js.map +1 -0
- package/package.json +17 -2
- package/src/__tests__/MAvatarImage.test.ts +37 -0
- package/src/__tests__/MDataTableControlled.test.ts +68 -0
- package/src/__tests__/MHotkeysSequence.test.ts +53 -0
- package/src/__tests__/MIconAxes.test.ts +16 -0
- package/src/__tests__/MIconButtonWidth.test.ts +22 -0
- package/src/__tests__/MLink.test.ts +46 -0
- package/src/__tests__/MPaginationPages.test.ts +43 -0
- package/src/__tests__/MTextEmphasized.test.ts +14 -0
- package/src/__tests__/controlDescription.test.ts +34 -0
- package/src/__tests__/customColor.test.ts +27 -0
- package/src/__tests__/dynamicColor.test.ts +3 -2
- package/src/__tests__/focusTrap.test.ts +124 -0
- package/src/__tests__/formatMessage.test.ts +20 -0
- package/src/__tests__/inputAttrs.test.ts +103 -0
- package/src/__tests__/localePresets.test.ts +2 -0
- package/src/__tests__/menuGroupsRemount.test.ts +40 -0
- package/src/__tests__/menuHydration.test.ts +41 -0
- package/src/__tests__/motionPrefs.test.ts +28 -0
- package/src/__tests__/ssr.test.ts +11 -0
- package/src/__tests__/ssrToast.test.ts +20 -0
- package/src/__tests__/toastDetails.test.ts +39 -0
- package/src/__tests__/useConfirm.test.ts +47 -0
- package/src/__tests__/useTheme.test.ts +14 -0
- package/src/__tests__/warningRole.test.ts +22 -0
- package/src/components/MAlert.vue +2 -2
- package/src/components/MAnimatedNumber.vue +9 -3
- package/src/components/MAutocomplete.vue +16 -4
- package/src/components/MAvailabilityCalendar.vue +3 -3
- package/src/components/MAvatar.vue +32 -5
- package/src/components/MAvatarGroup.vue +7 -2
- package/src/components/MBottomSheet.vue +18 -2
- package/src/components/MButton.vue +18 -5
- package/src/components/MCarousel.vue +3 -3
- package/src/components/MChatBubble.vue +14 -1
- package/src/components/MCheckbox.vue +21 -4
- package/src/components/MChip.vue +4 -2
- package/src/components/MCollapse.vue +7 -1
- package/src/components/MCommandPalette.vue +6 -2
- package/src/components/MContextMenu.vue +4 -4
- package/src/components/MCreditCardInput.vue +5 -0
- package/src/components/MDashboardGrid.vue +2 -1
- package/src/components/MDataTable.vue +63 -16
- package/src/components/MDialog.vue +21 -3
- package/src/components/MDiffViewer.vue +3 -3
- package/src/components/MDrawLayers.vue +3 -3
- package/src/components/MFabMenu.vue +7 -0
- package/src/components/MFloorPlan.vue +3 -3
- package/src/components/MFloorPlanInspector.vue +3 -3
- package/src/components/MFlow.vue +9 -5
- package/src/components/MFlowControls.vue +6 -0
- package/src/components/MFormBuilder.vue +1 -1
- package/src/components/MGantt.vue +10 -10
- package/src/components/MHotkeys.vue +61 -16
- package/src/components/MIcon.vue +17 -1
- package/src/components/MIconButton.vue +29 -6
- package/src/components/MImageCropper.vue +1 -1
- package/src/components/MKanban.vue +2 -1
- package/src/components/MLightbox.vue +5 -4
- package/src/components/MLink.vue +136 -0
- package/src/components/MListDetail.vue +7 -0
- package/src/components/MListItem.vue +7 -4
- package/src/components/MLoadingIndicator.vue +2 -1
- package/src/components/MMap.vue +3 -0
- package/src/components/MMapCluster.vue +2 -2
- package/src/components/MMapControl.vue +2 -2
- package/src/components/MMapMeasure.vue +1 -1
- package/src/components/MMaskField.vue +16 -3
- package/src/components/MMenu.vue +4 -4
- package/src/components/MMenuItem.vue +2 -2
- package/src/components/MMeterGroup.vue +3 -2
- package/src/components/MMortgageCalculator.vue +3 -3
- package/src/components/MMultiAutocomplete.vue +19 -7
- package/src/components/MMultiSelect.vue +19 -7
- package/src/components/MNavigationDrawer.vue +10 -3
- package/src/components/MNavigationRail.vue +5 -1
- package/src/components/MNotificationCenter.vue +2 -1
- package/src/components/MNotificationHost.vue +3 -3
- package/src/components/MNumberField.vue +23 -6
- package/src/components/MOdontogram.vue +4 -4
- package/src/components/MOrderBook.vue +4 -0
- package/src/components/MPagination.vue +91 -12
- package/src/components/MPdfSigner.vue +3 -3
- package/src/components/MPdfViewer.vue +7 -7
- package/src/components/MPhoneInput.vue +17 -4
- package/src/components/MProductConfigurator.vue +4 -4
- package/src/components/MProgressBar.vue +5 -0
- package/src/components/MQuiz.vue +8 -5
- package/src/components/MRadio.vue +24 -5
- package/src/components/MRadioGroup.vue +3 -0
- package/src/components/MReactions.vue +2 -2
- package/src/components/MResourceTimeline.vue +3 -3
- package/src/components/MResult.vue +1 -1
- package/src/components/MScrollField.vue +1 -1
- package/src/components/MSearchField.vue +6 -5
- package/src/components/MSeatMap.vue +5 -0
- package/src/components/MSeekBar.vue +3 -2
- package/src/components/MSelect.vue +16 -4
- package/src/components/MSideSheet.vue +25 -3
- package/src/components/MSimpleCarousel.vue +2 -2
- package/src/components/MSnackbar.vue +16 -13
- package/src/components/MSparkline.vue +2 -1
- package/src/components/MSpinner.vue +8 -0
- package/src/components/MSplitter.vue +1 -1
- package/src/components/MSpotlightSearch.vue +6 -2
- package/src/components/MSpreadsheet.vue +1 -1
- package/src/components/MStatCard.vue +2 -1
- package/src/components/MSwitch.vue +21 -4
- package/src/components/MTabs.vue +2 -1
- package/src/components/MTagInput.vue +19 -6
- package/src/components/MText.vue +23 -4
- package/src/components/MTextField.vue +25 -6
- package/src/components/MTimeline.vue +5 -5
- package/src/components/MToolbar.vue +2 -2
- package/src/components/MTour.vue +3 -0
- package/src/components/MTrackingTimeline.vue +6 -0
- package/src/components/MTypewriter.vue +7 -1
- package/src/components/MWindow.vue +10 -1
- package/src/components/_MColorPanel.vue +4 -4
- package/src/components/_MComment.vue +3 -2
- package/src/components/_MFlowNodeShell.vue +1 -1
- package/src/components/_MPdfPage.vue +1 -1
- package/src/components/_MTransferPane.vue +10 -0
- package/src/composables/_effectCanvas.ts +2 -1
- package/src/composables/_menuGroups.ts +10 -1
- package/src/composables/_splitAttrs.ts +29 -0
- package/src/composables/_springAnimation.ts +3 -3
- package/src/composables/_themeTransition.ts +3 -2
- package/src/composables/_useFocusTrap.ts +142 -0
- package/src/composables/_useMenuNav.ts +3 -3
- package/src/composables/_usePaneResize.ts +2 -1
- package/src/composables/_useSheetMotion.ts +3 -4
- package/src/composables/_useSpring.ts +16 -10
- package/src/composables/cron.ts +7 -6
- package/src/composables/dynamicColor.ts +21 -2
- package/src/composables/motion.ts +27 -0
- package/src/composables/useConfirm.ts +116 -0
- package/src/composables/useDevice.ts +23 -3
- package/src/composables/useFieldBg.ts +4 -0
- package/src/composables/useLocale.ts +74 -0
- package/src/composables/useNotification.ts +3 -0
- package/src/composables/useScrollReveal.ts +3 -3
- package/src/composables/useTheme.ts +8 -2
- package/src/composables/useToast.ts +27 -4
- package/src/directives/vSparkle.ts +2 -1
- package/src/index.ts +8 -5
- package/src/locales/ar.ts +7 -0
- package/src/locales/de.ts +7 -0
- package/src/locales/es.ts +7 -0
- package/src/locales/fr.ts +7 -0
- package/src/locales/index.ts +1 -0
- package/src/locales/ja.ts +7 -0
- package/src/locales/ko.ts +7 -0
- package/src/locales/pl.ts +807 -0
- package/src/locales/pt.ts +7 -0
- package/src/locales/zh.ts +7 -0
- package/src/plugin.ts +16 -0
- package/src/styles/theme.css +40 -0
- package/dist/MButton-B9RCM06i.js +0 -171
- package/dist/MButton-B9RCM06i.js.map +0 -1
- package/dist/MColorPickerModal-ChRtcZOo.js +0 -577
- package/dist/MColorPickerModal-ChRtcZOo.js.map +0 -1
- package/dist/MDialog-dk07tify.js +0 -167
- package/dist/MDialog-dk07tify.js.map +0 -1
- package/dist/MIcon-BSsJZhK7.js.map +0 -1
- package/dist/MIconButton-CrBPZidd.js +0 -288
- package/dist/MIconButton-CrBPZidd.js.map +0 -1
- package/dist/MListItem-h9H223vx.js +0 -1239
- package/dist/MListItem-h9H223vx.js.map +0 -1
- package/dist/MLoadingIndicator-YTV1Ov5w.js +0 -114
- package/dist/MLoadingIndicator-YTV1Ov5w.js.map +0 -1
- package/dist/MMenuItem-US0Zbglq.js.map +0 -1
- package/dist/MPdfViewer-DL9mRsd2.js.map +0 -1
- package/dist/MSeekBar-JFZcoJ8y.js +0 -434
- package/dist/MSeekBar-JFZcoJ8y.js.map +0 -1
- package/dist/MTextField-B6_iOczK.js.map +0 -1
- package/dist/material-color-utilities-CEFytLsr.js.map +0 -1
- package/dist/motion-BcejVTeX.js.map +0 -1
- package/dist/useLocale-YRaOT12S.js.map +0 -1
- package/dist/useThemeTokens-DyAdPQB0.js.map +0 -1
|
@@ -1,23 +1,31 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
3
|
+
* Page navigation. By default previous/next buttons with an automatically computed range label; `variant="pages"`
|
|
4
|
+
* shows the page numbers instead (1 … 4 5 6 … 20), the current one highlighted. Its texts (“1–10 of 25”, “Page 1 of
|
|
5
|
+
* 3” and the buttons’ labels) come from the app’s locale.
|
|
5
6
|
*
|
|
6
|
-
* @event update:page Emitted when
|
|
7
|
-
* two-way binding
|
|
7
|
+
* @event update:page Emitted when a page button is clicked — drive page with it for v-model-style two-way binding
|
|
8
8
|
*/
|
|
9
9
|
import { computed } from 'vue'
|
|
10
10
|
import MIconButton from './MIconButton.vue'
|
|
11
|
-
import { useLocale } from '../composables/useLocale'
|
|
11
|
+
import { useLocale, formatMessage } from '../composables/useLocale'
|
|
12
12
|
|
|
13
|
-
const props = defineProps<{
|
|
13
|
+
const props = withDefaults(defineProps<{
|
|
14
14
|
/** Current page (1-based) */
|
|
15
15
|
page: number
|
|
16
16
|
/** Items per page */
|
|
17
17
|
perPage: number
|
|
18
18
|
/** Total number of items */
|
|
19
19
|
total: number
|
|
20
|
-
|
|
20
|
+
/** `simple`: range label + previous/next. `pages`: the page numbers between previous and next */
|
|
21
|
+
variant?: 'simple' | 'pages'
|
|
22
|
+
/** With `pages`: how many pages show on each side of the current one before a gap (…) */
|
|
23
|
+
siblings?: number
|
|
24
|
+
/** Adds first-page and last-page buttons at the ends */
|
|
25
|
+
showFirstLast?: boolean
|
|
26
|
+
/** With `pages`: also show the range label (“1–10 of 25”) */
|
|
27
|
+
showRange?: boolean
|
|
28
|
+
}>(), { variant: 'simple', siblings: 1, showFirstLast: false, showRange: false })
|
|
21
29
|
const emit = defineEmits<{ 'update:page': [number] }>()
|
|
22
30
|
const t = useLocale()
|
|
23
31
|
|
|
@@ -27,28 +35,99 @@ const rangeLabel = computed(() => {
|
|
|
27
35
|
if (props.total === 0) return t.noResults
|
|
28
36
|
const from = (props.page - 1) * props.perPage + 1
|
|
29
37
|
const to = Math.min(props.page * props.perPage, props.total)
|
|
30
|
-
return t.paginationRange
|
|
38
|
+
return formatMessage(t.paginationRange, { from: String(from), to: String(to), total: String(props.total) }, t.lang)
|
|
31
39
|
})
|
|
32
|
-
const pageLabel = computed(() => t.paginationPage
|
|
40
|
+
const pageLabel = computed(() => formatMessage(t.paginationPage, { page: String(props.page), pages: String(totalPages.value) }, t.lang))
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* The page numbers to show, with `'gap'` where pages are left out. Always the first and last, the current one with
|
|
44
|
+
* `siblings` on each side, and a gap only where it hides two or more pages (a gap for one page would take the same
|
|
45
|
+
* room as the number), so the bar keeps the same width while paging through the middle.
|
|
46
|
+
*/
|
|
47
|
+
const items = computed<(number | 'gap')[]>(() => {
|
|
48
|
+
const total = totalPages.value
|
|
49
|
+
const current = Math.min(Math.max(1, props.page), total)
|
|
50
|
+
const sib = Math.max(0, props.siblings)
|
|
51
|
+
// first + last + current + 2 siblings + 2 gaps
|
|
52
|
+
const slots = sib * 2 + 5
|
|
53
|
+
if (total <= slots) return Array.from({ length: total }, (_, i) => i + 1)
|
|
54
|
+
// Same shape as MUI's usePagination: the window slides between 3 and total - 2, and the slot next to each end is
|
|
55
|
+
// either a gap or the single page it would hide
|
|
56
|
+
const start = Math.max(Math.min(current - sib, total - sib * 2 - 2), 3)
|
|
57
|
+
const end = Math.min(Math.max(current + sib, sib * 2 + 3), total - 2)
|
|
58
|
+
const out: (number | 'gap')[] = [1, start > 3 ? 'gap' : 2]
|
|
59
|
+
for (let p = start; p <= end; p++) out.push(p)
|
|
60
|
+
out.push(end < total - 2 ? 'gap' : total - 1, total)
|
|
61
|
+
return out
|
|
62
|
+
})
|
|
63
|
+
|
|
64
|
+
function go(p: number) {
|
|
65
|
+
const target = Math.min(Math.max(1, p), totalPages.value)
|
|
66
|
+
if (target !== props.page) emit('update:page', target)
|
|
67
|
+
}
|
|
33
68
|
</script>
|
|
34
69
|
|
|
35
70
|
<template>
|
|
36
|
-
<div
|
|
71
|
+
<div
|
|
72
|
+
v-if="variant === 'simple'"
|
|
73
|
+
class="flex flex-wrap items-center justify-between gap-4 text-body-medium text-on-surface-variant"
|
|
74
|
+
>
|
|
37
75
|
<span>{{ rangeLabel }}</span>
|
|
38
76
|
<div class="flex items-center gap-2">
|
|
39
77
|
<span>{{ pageLabel }}</span>
|
|
78
|
+
<MIconButton v-if="showFirstLast" icon="first_page" :label="t.firstPage" :disabled="page <= 1" @click="go(1)" />
|
|
40
79
|
<MIconButton
|
|
41
80
|
icon="chevron_left"
|
|
42
81
|
:label="t.previousPage"
|
|
43
82
|
:disabled="page <= 1"
|
|
44
|
-
@click="
|
|
83
|
+
@click="go(page - 1)"
|
|
45
84
|
/>
|
|
46
85
|
<MIconButton
|
|
47
86
|
icon="chevron_right"
|
|
48
87
|
:label="t.nextPage"
|
|
49
88
|
:disabled="page >= totalPages"
|
|
50
|
-
@click="
|
|
89
|
+
@click="go(page + 1)"
|
|
51
90
|
/>
|
|
91
|
+
<MIconButton v-if="showFirstLast" icon="last_page" :label="t.lastPage" :disabled="page >= totalPages" @click="go(totalPages)" />
|
|
52
92
|
</div>
|
|
53
93
|
</div>
|
|
94
|
+
<nav
|
|
95
|
+
v-else
|
|
96
|
+
:aria-label="t.pagination"
|
|
97
|
+
class="flex flex-wrap items-center justify-between gap-4 text-body-medium text-on-surface-variant"
|
|
98
|
+
>
|
|
99
|
+
<span v-if="showRange">{{ rangeLabel }}</span>
|
|
100
|
+
<ul class="m-0 flex list-none items-center gap-1 p-0" :class="showRange ? '' : 'mx-auto'">
|
|
101
|
+
<li v-if="showFirstLast">
|
|
102
|
+
<MIconButton icon="first_page" :label="t.firstPage" :disabled="page <= 1" @click="go(1)" />
|
|
103
|
+
</li>
|
|
104
|
+
<li>
|
|
105
|
+
<MIconButton icon="chevron_left" :label="t.previousPage" :disabled="page <= 1" @click="go(page - 1)" />
|
|
106
|
+
</li>
|
|
107
|
+
<li v-for="(item, i) in items" :key="item === 'gap' ? `gap-${i}` : item">
|
|
108
|
+
<span v-if="item === 'gap'" class="flex h-10 w-6 items-center justify-center select-none" aria-hidden="true">…</span>
|
|
109
|
+
<button
|
|
110
|
+
v-else
|
|
111
|
+
type="button"
|
|
112
|
+
class="m3-pagination-page relative flex h-10 min-w-10 cursor-pointer items-center justify-center rounded-full px-2 text-label-large tabular-nums outline-none transition-colors duration-150 focus-visible:ring-2 focus-visible:ring-secondary"
|
|
113
|
+
:class="
|
|
114
|
+
item === page
|
|
115
|
+
? 'bg-secondary-container text-on-secondary-container'
|
|
116
|
+
: 'text-on-surface-variant hover:bg-on-surface/8 active:bg-on-surface/10'
|
|
117
|
+
"
|
|
118
|
+
:aria-label="formatMessage(t.goToPage, { page: String(item) }, t.lang)"
|
|
119
|
+
:aria-current="item === page ? 'page' : undefined"
|
|
120
|
+
@click="go(item)"
|
|
121
|
+
>
|
|
122
|
+
{{ item }}
|
|
123
|
+
</button>
|
|
124
|
+
</li>
|
|
125
|
+
<li>
|
|
126
|
+
<MIconButton icon="chevron_right" :label="t.nextPage" :disabled="page >= totalPages" @click="go(page + 1)" />
|
|
127
|
+
</li>
|
|
128
|
+
<li v-if="showFirstLast">
|
|
129
|
+
<MIconButton icon="last_page" :label="t.lastPage" :disabled="page >= totalPages" @click="go(totalPages)" />
|
|
130
|
+
</li>
|
|
131
|
+
</ul>
|
|
132
|
+
</nav>
|
|
54
133
|
</template>
|
|
@@ -25,7 +25,7 @@ import MSegmentedButton from './MSegmentedButton.vue'
|
|
|
25
25
|
import MTextField from './MTextField.vue'
|
|
26
26
|
import { fieldMissing, signPdf, type PdfSignField, type SignPdfOptions } from '../composables/pdfSign'
|
|
27
27
|
import type { PdfSource } from '../composables/usePdf'
|
|
28
|
-
import { useLocale, type M3Locale } from '../composables/useLocale'
|
|
28
|
+
import { useLocale, type M3Locale, formatMessage } from '../composables/useLocale'
|
|
29
29
|
|
|
30
30
|
defineOptions({ inheritAttrs: false })
|
|
31
31
|
|
|
@@ -82,7 +82,7 @@ const todo = computed(() => props.fields.filter((f) => mine(f) && (f.required ??
|
|
|
82
82
|
const done = computed(() => todo.value.filter((f) => !fieldMissing(f)).length)
|
|
83
83
|
const complete = computed(() => done.value === todo.value.length)
|
|
84
84
|
watch(complete, (c, was) => { if (c && !was && props.mode === 'sign') emit('complete') })
|
|
85
|
-
const progress = computed(() => locale.pdfSignProgress
|
|
85
|
+
const progress = computed(() => formatMessage(locale.pdfSignProgress, { done: String(done.value), total: String(todo.value.length) }, locale.lang))
|
|
86
86
|
|
|
87
87
|
function patch(id: string, change: Partial<PdfSignField>) {
|
|
88
88
|
emit('update:fields', props.fields.map((f) => (f.id === id ? { ...f, ...change } : f)))
|
|
@@ -322,7 +322,7 @@ defineExpose({
|
|
|
322
322
|
v-for="f in byPage.get(slot.page) ?? []"
|
|
323
323
|
:id="fieldId(f)"
|
|
324
324
|
:key="f.id"
|
|
325
|
-
class="m3-pdf-sign-field pointer-events-auto absolute flex items-center justify-center rounded-xs outline-none focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-
|
|
325
|
+
class="m3-pdf-sign-field pointer-events-auto absolute flex items-center justify-center rounded-xs outline-none focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-secondary"
|
|
326
326
|
:class="[
|
|
327
327
|
mode === 'prepare' ? 'cursor-move' : mine(f) ? 'cursor-pointer' : 'cursor-default opacity-40',
|
|
328
328
|
f.value ? 'm3-pdf-sign-filled' : 'm3-pdf-sign-empty',
|
|
@@ -98,7 +98,7 @@ export type PdfZoom = number | 'fit-width' | 'fit-page'
|
|
|
98
98
|
*/
|
|
99
99
|
import { computed, nextTick, onBeforeUnmount, onMounted, reactive, ref, shallowRef, watch } from 'vue'
|
|
100
100
|
import { usePdf, type PdfDocument, type PdfSource } from '../composables/usePdf'
|
|
101
|
-
import { useLocale } from '../composables/useLocale'
|
|
101
|
+
import { useLocale, formatMessage } from '../composables/useLocale'
|
|
102
102
|
import PdfPageView from './_MPdfPage.vue'
|
|
103
103
|
import MIconButton from './MIconButton.vue'
|
|
104
104
|
import MIcon from './MIcon.vue'
|
|
@@ -472,7 +472,7 @@ function closeSearch() {
|
|
|
472
472
|
matchIndex.value = -1
|
|
473
473
|
}
|
|
474
474
|
const matchText = computed(() =>
|
|
475
|
-
!query.value.trim() ? '' : searching.value ? '…' : matches.value.length ? locale.pdfMatchCount
|
|
475
|
+
!query.value.trim() ? '' : searching.value ? '…' : matches.value.length ? formatMessage(locale.pdfMatchCount, { current: String(matchIndex.value + 1), total: String(matches.value.length) }, locale.lang) : locale.pdfNoMatches,
|
|
476
476
|
)
|
|
477
477
|
|
|
478
478
|
// ── Side panel: thumbnails and outline ──────────────────────────────────────────────────────────────────
|
|
@@ -1088,7 +1088,7 @@ const TOOLS = computed(() => [
|
|
|
1088
1088
|
<button
|
|
1089
1089
|
v-if="annotate && pdf.doc.value && !editing"
|
|
1090
1090
|
type="button"
|
|
1091
|
-
class="absolute right-4 bottom-4 flex size-14 cursor-pointer items-center justify-center rounded-lg bg-primary-container text-on-primary-container shadow-elevation-3 transition-shadow outline-none hover:shadow-elevation-4 focus-visible:ring-2 focus-visible:ring-
|
|
1091
|
+
class="absolute right-4 bottom-4 flex size-14 cursor-pointer items-center justify-center rounded-lg bg-primary-container text-on-primary-container shadow-elevation-3 transition-shadow outline-none hover:shadow-elevation-4 focus-visible:ring-2 focus-visible:ring-secondary"
|
|
1092
1092
|
:aria-label="locale.pdfAnnotate"
|
|
1093
1093
|
@click="openEditing"
|
|
1094
1094
|
><MIcon name="edit" :size="24" /></button>
|
|
@@ -1110,7 +1110,7 @@ const TOOLS = computed(() => [
|
|
|
1110
1110
|
v-for="c in colors"
|
|
1111
1111
|
:key="c"
|
|
1112
1112
|
type="button"
|
|
1113
|
-
class="flex size-10 shrink-0 cursor-pointer items-center justify-center rounded-full outline-none focus-visible:ring-2 focus-visible:ring-
|
|
1113
|
+
class="flex size-10 shrink-0 cursor-pointer items-center justify-center rounded-full outline-none focus-visible:ring-2 focus-visible:ring-secondary"
|
|
1114
1114
|
:aria-label="`${locale.pdfColor} ${c}`"
|
|
1115
1115
|
:aria-pressed="color === c"
|
|
1116
1116
|
@click="color = c"
|
|
@@ -1125,9 +1125,9 @@ const TOOLS = computed(() => [
|
|
|
1125
1125
|
v-for="w in inkWidths"
|
|
1126
1126
|
:key="w"
|
|
1127
1127
|
type="button"
|
|
1128
|
-
class="flex size-10 shrink-0 cursor-pointer items-center justify-center rounded-full outline-none hover:bg-on-surface/8 focus-visible:ring-2 focus-visible:ring-
|
|
1128
|
+
class="flex size-10 shrink-0 cursor-pointer items-center justify-center rounded-full outline-none hover:bg-on-surface/8 focus-visible:ring-2 focus-visible:ring-secondary"
|
|
1129
1129
|
:class="inkWidth === w && 'bg-secondary-container'"
|
|
1130
|
-
:aria-label="locale.pdfInkWidth
|
|
1130
|
+
:aria-label="formatMessage(locale.pdfInkWidth, { n: String(w) }, locale.lang)"
|
|
1131
1131
|
:aria-pressed="inkWidth === w"
|
|
1132
1132
|
@click="inkWidth = w"
|
|
1133
1133
|
>
|
|
@@ -1171,7 +1171,7 @@ const TOOLS = computed(() => [
|
|
|
1171
1171
|
v-for="c in colors"
|
|
1172
1172
|
:key="c"
|
|
1173
1173
|
type="button"
|
|
1174
|
-
class="flex size-8 cursor-pointer items-center justify-center rounded-full outline-none focus-visible:ring-2 focus-visible:ring-
|
|
1174
|
+
class="flex size-8 cursor-pointer items-center justify-center rounded-full outline-none focus-visible:ring-2 focus-visible:ring-secondary"
|
|
1175
1175
|
:aria-label="`${locale.pdfColor} ${c}`"
|
|
1176
1176
|
:aria-pressed="selectedAnnotation.color === c"
|
|
1177
1177
|
@click="update(selectedAnnotation!.id, { color: c })"
|
|
@@ -6,6 +6,9 @@
|
|
|
6
6
|
* provider. Pasting or typing a full international number (`+34...`, `0034...`) switches the country. Without a
|
|
7
7
|
* `country`, it starts on the region of the app's locale (es-AR → Argentina). Filled or outlined, like MTextField.
|
|
8
8
|
*
|
|
9
|
+
* Your `class`, `style` and `data-*` go on the field's box; every other attribute (`id`, `inputmode`, `enterkeyhint`,
|
|
10
|
+
* `maxlength`, `readonly`, `aria-*`, native listeners like `@keydown`) goes on the `<input>`.
|
|
11
|
+
*
|
|
9
12
|
* @slot flag Replaces the flag emoji (on the button and in the list), e.g. with an image set that also shows on
|
|
10
13
|
* Windows, which has no flag emoji; receives `iso2`
|
|
11
14
|
* @event update:modelValue Emitted with the number in E.164, or null when empty — powers v-model
|
|
@@ -17,6 +20,7 @@ import { computed, inject, nextTick, onBeforeUnmount, ref, useId, watch } from '
|
|
|
17
20
|
import { FORM_KEY, useFieldValidation, useFocusLeave } from '../composables/_useFieldValidation'
|
|
18
21
|
import type { ValidateOn, ValidationRule } from '../composables/validation'
|
|
19
22
|
import MIcon from './MIcon.vue'
|
|
23
|
+
import { useSplitAttrs } from '../composables/_splitAttrs'
|
|
20
24
|
import { useFieldBg } from '../composables/useFieldBg'
|
|
21
25
|
import { useLocale } from '../composables/useLocale'
|
|
22
26
|
import { useFollowAnchor } from '../composables/_useFollowAnchor'
|
|
@@ -35,6 +39,8 @@ import {
|
|
|
35
39
|
type PhoneCountry,
|
|
36
40
|
} from '../composables/phoneNumber'
|
|
37
41
|
|
|
42
|
+
defineOptions({ inheritAttrs: false })
|
|
43
|
+
|
|
38
44
|
const props = withDefaults(
|
|
39
45
|
defineProps<{
|
|
40
46
|
/** The number in E.164 (`+541123456789`), or null (v-model) */
|
|
@@ -92,8 +98,14 @@ const emit = defineEmits<{
|
|
|
92
98
|
|
|
93
99
|
const t = useLocale()
|
|
94
100
|
const lang = computed(() => props.locale ?? t.lang)
|
|
95
|
-
const
|
|
96
|
-
const
|
|
101
|
+
const { rootAttrs, inputAttrs, attrId } = useSplitAttrs()
|
|
102
|
+
const autoId = useId()
|
|
103
|
+
const id = computed(() => attrId() ?? autoId)
|
|
104
|
+
// Ours (the message below the field) plus any the consumer passed
|
|
105
|
+
function describedBy() {
|
|
106
|
+
return [errorText.value || props.hint ? messageId : '', inputAttrs()['aria-describedby']].filter(Boolean).join(' ') || undefined
|
|
107
|
+
}
|
|
108
|
+
const listId = `${autoId}-countries`
|
|
97
109
|
|
|
98
110
|
// ── Country and number ────────────────────────────────────────────
|
|
99
111
|
function localeRegion() {
|
|
@@ -371,7 +383,7 @@ defineExpose({
|
|
|
371
383
|
</script>
|
|
372
384
|
|
|
373
385
|
<template>
|
|
374
|
-
<div ref="rootEl" class="m3-phone-input flex flex-col gap-1" @focusout="onFocusOut">
|
|
386
|
+
<div ref="rootEl" class="m3-phone-input flex flex-col gap-1" @focusout="onFocusOut" v-bind="rootAttrs()">
|
|
375
387
|
<div
|
|
376
388
|
ref="fieldEl"
|
|
377
389
|
class="group relative flex h-14 transition-[border-color,border-width] duration-150"
|
|
@@ -431,6 +443,7 @@ defineExpose({
|
|
|
431
443
|
<input
|
|
432
444
|
:id="id"
|
|
433
445
|
ref="inputEl"
|
|
446
|
+
v-bind="inputAttrs()"
|
|
434
447
|
type="tel"
|
|
435
448
|
inputmode="tel"
|
|
436
449
|
autocomplete="tel"
|
|
@@ -439,7 +452,7 @@ defineExpose({
|
|
|
439
452
|
:required="required"
|
|
440
453
|
:placeholder="placeholder ?? examplePlaceholder"
|
|
441
454
|
:aria-invalid="isError || undefined"
|
|
442
|
-
:aria-describedby="
|
|
455
|
+
:aria-describedby="describedBy()"
|
|
443
456
|
class="min-w-0 flex-1 bg-transparent pe-4 ps-1 text-body-large text-on-surface outline-none placeholder:text-on-surface-variant/60 disabled:cursor-not-allowed disabled:text-on-surface/38"
|
|
444
457
|
:class="isError ? 'caret-error' : 'caret-primary'"
|
|
445
458
|
@input="onInput"
|
|
@@ -59,7 +59,7 @@ import MRadio from './MRadio.vue'
|
|
|
59
59
|
import MCheckbox from './MCheckbox.vue'
|
|
60
60
|
import MIconButton from './MIconButton.vue'
|
|
61
61
|
import MButton from './MButton.vue'
|
|
62
|
-
import { useLocale } from '../composables/useLocale'
|
|
62
|
+
import { useLocale, formatMessage } from '../composables/useLocale'
|
|
63
63
|
import { vRipple } from '../directives/vRipple'
|
|
64
64
|
|
|
65
65
|
const locale = useLocale()
|
|
@@ -184,9 +184,9 @@ function rule(g: ProductOptionGroup): { text: string; ok: boolean; required: boo
|
|
|
184
184
|
const min = g.min ?? 0
|
|
185
185
|
const max = g.max
|
|
186
186
|
let text: string
|
|
187
|
-
if (min > 0 && max === min) text = locale.configChooseExactly
|
|
188
|
-
else if (min > 0) text = locale.configChooseAtLeast
|
|
189
|
-
else if (max !== undefined) text = locale.configChooseUpTo
|
|
187
|
+
if (min > 0 && max === min) text = formatMessage(locale.configChooseExactly, { n: String(min) }, locale.lang)
|
|
188
|
+
else if (min > 0) text = formatMessage(locale.configChooseAtLeast, { n: String(min) }, locale.lang)
|
|
189
|
+
else if (max !== undefined) text = formatMessage(locale.configChooseUpTo, { n: String(max) }, locale.lang)
|
|
190
190
|
else text = locale.configOptional
|
|
191
191
|
return { text, ok: n >= min && (max === undefined || n <= max), required: min > 0 }
|
|
192
192
|
}
|
|
@@ -468,4 +468,9 @@ watch(isIndeterminate, async (v) => {
|
|
|
468
468
|
animation: none !important;
|
|
469
469
|
}
|
|
470
470
|
}
|
|
471
|
+
/* createM3UI({ reducedMotion: 'always' }) */
|
|
472
|
+
:root[data-m3-motion='reduce'] .animate-\[m3-progress-indeterminate_1\.6s_ease-in-out_infinite\] {
|
|
473
|
+
animation: none !important;
|
|
474
|
+
}
|
|
475
|
+
|
|
471
476
|
</style>
|
package/src/components/MQuiz.vue
CHANGED
|
@@ -50,7 +50,7 @@ import { computed, onBeforeUnmount, ref, watch } from 'vue'
|
|
|
50
50
|
import MButton from './MButton.vue'
|
|
51
51
|
import MIcon from './MIcon.vue'
|
|
52
52
|
import MIconButton from './MIconButton.vue'
|
|
53
|
-
import { useLocale } from '../composables/useLocale'
|
|
53
|
+
import { useLocale, formatMessage } from '../composables/useLocale'
|
|
54
54
|
import { vRipple } from '../directives/vRipple'
|
|
55
55
|
|
|
56
56
|
const locale = useLocale()
|
|
@@ -296,7 +296,7 @@ defineExpose({ restart: setup, result })
|
|
|
296
296
|
<template v-if="!finished && current">
|
|
297
297
|
<div class="flex flex-col gap-2">
|
|
298
298
|
<div class="flex items-center gap-3 text-label-large text-on-surface-variant">
|
|
299
|
-
<span data-progress-text>{{ locale.quizQuestionOf
|
|
299
|
+
<span data-progress-text>{{ formatMessage(locale.quizQuestionOf, { n: String(index + 1), total: String(items.length) }, locale.lang) }}</span>
|
|
300
300
|
<span
|
|
301
301
|
v-if="remaining !== null"
|
|
302
302
|
class="ms-auto flex items-center gap-1 tabular-nums"
|
|
@@ -412,7 +412,7 @@ defineExpose({ restart: setup, result })
|
|
|
412
412
|
<div class="flex flex-col gap-1">
|
|
413
413
|
<p class="text-title-small">{{ currentCorrect ? locale.quizCorrect : locale.quizIncorrect }}</p>
|
|
414
414
|
<p v-if="!currentCorrect && current.type !== 'single' && current.type !== 'multiple' && current.type !== 'truefalse'" class="text-body-medium">
|
|
415
|
-
{{ locale.quizCorrectAnswer
|
|
415
|
+
{{ formatMessage(locale.quizCorrectAnswer, { answer: correctText(current) }, locale.lang) }}
|
|
416
416
|
</p>
|
|
417
417
|
<p v-if="current.q.explanation" class="text-body-medium">{{ current.q.explanation }}</p>
|
|
418
418
|
</div>
|
|
@@ -459,7 +459,7 @@ defineExpose({ restart: setup, result })
|
|
|
459
459
|
{{ result.passed ? locale.quizPassed : locale.quizFailed }}
|
|
460
460
|
</p>
|
|
461
461
|
<p class="text-body-large text-on-surface-variant" data-score>
|
|
462
|
-
{{ locale.quizScore
|
|
462
|
+
{{ formatMessage(locale.quizScore, { score: String(result.score), total: String(result.total) }, locale.lang) }}
|
|
463
463
|
</p>
|
|
464
464
|
<MButton v-if="allowRetry" variant="tonal" icon="replay" class="mt-2" data-action="retry" @click="setup">{{ locale.quizRetry }}</MButton>
|
|
465
465
|
</div>
|
|
@@ -478,7 +478,7 @@ defineExpose({ restart: setup, result })
|
|
|
478
478
|
<p class="text-body-large">{{ i + 1 }}. {{ it.q.prompt }}</p>
|
|
479
479
|
<p class="text-body-medium text-on-surface-variant">{{ locale.quizTypeAnswer }}: {{ givenText(it) }}</p>
|
|
480
480
|
<p v-if="!result.answers[key(it)]?.correct" class="text-body-medium text-on-surface-variant">
|
|
481
|
-
{{ locale.quizCorrectAnswer
|
|
481
|
+
{{ formatMessage(locale.quizCorrectAnswer, { answer: correctText(it) }, locale.lang) }}
|
|
482
482
|
</p>
|
|
483
483
|
<p v-if="it.q.explanation" class="text-body-small text-on-surface-variant">{{ it.q.explanation }}</p>
|
|
484
484
|
</div>
|
|
@@ -528,4 +528,7 @@ defineExpose({ restart: setup, result })
|
|
|
528
528
|
@media (prefers-reduced-motion: reduce) {
|
|
529
529
|
.m3-quiz__question { animation: none; }
|
|
530
530
|
}
|
|
531
|
+
/* createM3UI({ reducedMotion: 'always' }) */
|
|
532
|
+
:root[data-m3-motion='reduce'] .m3-quiz__question { animation: none; }
|
|
533
|
+
|
|
531
534
|
</style>
|
|
@@ -3,11 +3,17 @@
|
|
|
3
3
|
* A single radio button, for when you lay out the options yourself. It's selected when `modelValue` equals its
|
|
4
4
|
* `value`; for a plain list of options, MRadioGroup is simpler.
|
|
5
5
|
*
|
|
6
|
+
* Your `class`, `style` and `data-*` go on the root `<label>`; every other attribute (`id`, `name`, `aria-*`, native
|
|
7
|
+
* listeners) goes on the native `<input>`.
|
|
8
|
+
*
|
|
6
9
|
* @event update:modelValue Emitted with `value` when the radio is selected.
|
|
7
10
|
*/
|
|
8
11
|
import { computed, ref, useId } from "vue";
|
|
12
|
+
import { useSplitAttrs } from '../composables/_splitAttrs'
|
|
9
13
|
import { vRipple } from "../directives/vRipple";
|
|
10
14
|
|
|
15
|
+
defineOptions({ inheritAttrs: false })
|
|
16
|
+
|
|
11
17
|
const props = withDefaults(
|
|
12
18
|
defineProps<{
|
|
13
19
|
/** The group's current value (v-model); share one ref between the radios of a group. */
|
|
@@ -16,6 +22,8 @@ const props = withDefaults(
|
|
|
16
22
|
value: unknown;
|
|
17
23
|
/** Text next to the radio. Clicking it selects the radio too. */
|
|
18
24
|
label?: string;
|
|
25
|
+
/** Supporting text under the label (M3 list-style two-line control); screen readers read it as the description */
|
|
26
|
+
description?: string;
|
|
19
27
|
/** Grays the radio out and ignores clicks. */
|
|
20
28
|
disabled?: boolean;
|
|
21
29
|
/** Color role of the selected radio. */
|
|
@@ -26,6 +34,12 @@ const props = withDefaults(
|
|
|
26
34
|
|
|
27
35
|
const emit = defineEmits<{ "update:modelValue": [unknown] }>();
|
|
28
36
|
const id = useId();
|
|
37
|
+
const descId = `${id}-desc`;
|
|
38
|
+
function describedBy() {
|
|
39
|
+
return [props.description ? descId : '', inputAttrs()['aria-describedby']].filter(Boolean).join(' ') || undefined;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const { rootAttrs, inputAttrs, attrId } = useSplitAttrs()
|
|
29
43
|
const isChecked = computed(() => props.modelValue === props.value);
|
|
30
44
|
|
|
31
45
|
// Ring + dot color when checked, applied via currentColor on the SVG.
|
|
@@ -64,11 +78,11 @@ const iconColorClasses = computed(() => {
|
|
|
64
78
|
</script>
|
|
65
79
|
|
|
66
80
|
<template>
|
|
67
|
-
<label
|
|
81
|
+
<label v-bind="rootAttrs()"
|
|
68
82
|
v-ripple="{ disabled, layer: () => rippleEl, centered: true }"
|
|
69
83
|
:for="id"
|
|
70
|
-
class="group inline-flex
|
|
71
|
-
:class="disabled ? 'cursor-not-allowed opacity-[0.38]' : 'cursor-pointer'"
|
|
84
|
+
class="group inline-flex gap-3 select-none"
|
|
85
|
+
:class="[disabled ? 'cursor-not-allowed opacity-[0.38]' : 'cursor-pointer', description ? 'items-start' : 'items-center']"
|
|
72
86
|
>
|
|
73
87
|
<!--
|
|
74
88
|
RadioButtonTokens.StateLayerSize = 40dp (was 48px). Unlike MCheckbox/MChip,
|
|
@@ -86,7 +100,9 @@ const iconColorClasses = computed(() => {
|
|
|
86
100
|
CHANGELOG entry for the real bug this caused there).
|
|
87
101
|
-->
|
|
88
102
|
<input
|
|
89
|
-
|
|
103
|
+
v-bind="inputAttrs()"
|
|
104
|
+
:id="attrId() ?? id"
|
|
105
|
+
:aria-describedby="describedBy()"
|
|
90
106
|
type="radio"
|
|
91
107
|
class="peer sr-only"
|
|
92
108
|
:checked="isChecked"
|
|
@@ -139,7 +155,10 @@ const iconColorClasses = computed(() => {
|
|
|
139
155
|
</span>
|
|
140
156
|
</span>
|
|
141
157
|
|
|
142
|
-
<span v-if="label" class="
|
|
158
|
+
<span v-if="label || description" class="flex flex-col">
|
|
159
|
+
<span v-if="label" class="text-body-large text-on-surface">{{ label }}</span>
|
|
160
|
+
<span v-if="description" :id="descId" class="text-body-medium text-on-surface-variant">{{ description }}</span>
|
|
161
|
+
</span>
|
|
143
162
|
</label>
|
|
144
163
|
</template>
|
|
145
164
|
|
|
@@ -13,6 +13,8 @@ import type { ValidateOn, ValidationRule } from '../composables/validation'
|
|
|
13
13
|
interface Option {
|
|
14
14
|
label: string
|
|
15
15
|
value: unknown
|
|
16
|
+
/** Supporting text under the option's label */
|
|
17
|
+
description?: string
|
|
16
18
|
disabled?: boolean
|
|
17
19
|
}
|
|
18
20
|
|
|
@@ -102,6 +104,7 @@ defineExpose({
|
|
|
102
104
|
:model-value="modelValue"
|
|
103
105
|
:value="opt.value"
|
|
104
106
|
:label="opt.label"
|
|
107
|
+
:description="opt.description"
|
|
105
108
|
:color="color"
|
|
106
109
|
:disabled="isDisabled || !!opt.disabled"
|
|
107
110
|
@update:model-value="emit('update:modelValue', $event)"
|
|
@@ -12,7 +12,7 @@ import { computed, ref } from 'vue'
|
|
|
12
12
|
import MMenu from './MMenu.vue'
|
|
13
13
|
import MIcon from './MIcon.vue'
|
|
14
14
|
import MEmojiSelector from './MEmojiSelector.vue'
|
|
15
|
-
import { useLocale } from '../composables/useLocale'
|
|
15
|
+
import { useLocale, formatMessage } from '../composables/useLocale'
|
|
16
16
|
import { vRipple } from '../directives/vRipple'
|
|
17
17
|
import { vTooltip } from '../directives/vTooltip'
|
|
18
18
|
|
|
@@ -76,7 +76,7 @@ function pick(emoji: string) {
|
|
|
76
76
|
if (list.value.find((r) => r.emoji === emoji)?.reacted) return
|
|
77
77
|
toggle(emoji)
|
|
78
78
|
}
|
|
79
|
-
const chipLabel = (r: Reaction) => t.reactionCount
|
|
79
|
+
const chipLabel = (r: Reaction) => formatMessage(t.reactionCount, { emoji: r.emoji, count: String(r.count) }, t.lang)
|
|
80
80
|
</script>
|
|
81
81
|
|
|
82
82
|
<template>
|
|
@@ -35,7 +35,7 @@ import { DAY, HOUR, defaultSnap, formatDate, parseDate, snapTime } from '../comp
|
|
|
35
35
|
import { prefersReducedMotion } from '../composables/_springAnimation'
|
|
36
36
|
import { useTimeAxis } from '../composables/_useTimeAxis'
|
|
37
37
|
import { holdDragCursor, releaseDragCursor } from '../composables/_dragCursor'
|
|
38
|
-
import { useLocale } from '../composables/useLocale'
|
|
38
|
+
import { useLocale, formatMessage } from '../composables/useLocale'
|
|
39
39
|
import MTimeHeader from './_MTimeHeader.vue'
|
|
40
40
|
import MTimeBackground from './_MTimeBackground.vue'
|
|
41
41
|
import MTimeSplitter from './_MTimeSplitter.vue'
|
|
@@ -719,7 +719,7 @@ function timeRange(ev: TimelineEvent) {
|
|
|
719
719
|
return `${f(s)}–${f(e)}`
|
|
720
720
|
}
|
|
721
721
|
function announceMove(ev: TimelineEvent) {
|
|
722
|
-
announce(locale.timelineMoved
|
|
722
|
+
announce(formatMessage(locale.timelineMoved, { title: ev.title, resource: resourceById.value.get(ev.resourceId)?.name ?? '', start: formatTime(ev.start), end: formatTime(ev.end) }, locale.lang))
|
|
723
723
|
}
|
|
724
724
|
function addEvents(events: TimelineEvent | TimelineEvent[]) {
|
|
725
725
|
commit([...current.value, ...(Array.isArray(events) ? events : [events])])
|
|
@@ -735,7 +735,7 @@ async function removeEvents(ids: string[]) {
|
|
|
735
735
|
commit(current.value.filter((e) => !set.has(e.id)))
|
|
736
736
|
setSelection(selected.value.filter((id) => !set.has(id)))
|
|
737
737
|
emit('delete', { events: gone })
|
|
738
|
-
announce(locale.ganttDeleted
|
|
738
|
+
announce(formatMessage(locale.ganttDeleted, { count: String(gone.length) }, locale.lang))
|
|
739
739
|
}
|
|
740
740
|
function resourceRows() {
|
|
741
741
|
return rows.value.filter((r): r is Extract<Row, { kind: 'resource' }> => r.kind === 'resource')
|
|
@@ -28,7 +28,7 @@ const t = useLocale()
|
|
|
28
28
|
const STATUS_STYLE = {
|
|
29
29
|
success: { icon: 'check_circle', bg: 'bg-success-container', text: 'text-on-success-container' },
|
|
30
30
|
error: { icon: 'error', bg: 'bg-error-container', text: 'text-on-error-container' },
|
|
31
|
-
warning: { icon: 'warning', bg: 'bg-
|
|
31
|
+
warning: { icon: 'warning', bg: 'bg-warning-container', text: 'text-on-warning-container' },
|
|
32
32
|
info: { icon: 'info', bg: 'bg-primary-container', text: 'text-on-primary-container' },
|
|
33
33
|
'404': { icon: 'search_off', bg: 'bg-surface-container-high', text: 'text-on-surface-variant' },
|
|
34
34
|
'403': { icon: 'lock', bg: 'bg-error-container', text: 'text-on-error-container' },
|
|
@@ -287,7 +287,7 @@ const sizer = computed(() => {
|
|
|
287
287
|
:aria-valuemax="Math.max(count - 1, 0)"
|
|
288
288
|
:aria-valuetext="count > 0 ? format(selectedIndex) : undefined"
|
|
289
289
|
:aria-disabled="disabled || undefined"
|
|
290
|
-
class="relative inline-block touch-none overflow-hidden rounded-lg outline-none select-none focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-
|
|
290
|
+
class="relative inline-block touch-none overflow-hidden rounded-lg outline-none select-none focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-secondary"
|
|
291
291
|
:class="disabled ? 'cursor-default bg-surface-container-lowest/38 text-on-surface/38' : 'cursor-grab bg-surface-container-lowest'"
|
|
292
292
|
:style="{ height: `${height}px` }"
|
|
293
293
|
@pointerdown="onPointerDown"
|
|
@@ -48,11 +48,12 @@ const emit = defineEmits<{ 'update:modelValue': [string]; search: [string]; clea
|
|
|
48
48
|
|
|
49
49
|
const locale = useLocale()
|
|
50
50
|
const attrs = useAttrs()
|
|
51
|
-
|
|
52
|
-
const
|
|
51
|
+
// Functions, not computeds: $attrs isn't reactive, so a computed over it goes stale in production builds
|
|
52
|
+
const rootAttrs = () => ({ class: attrs.class, style: attrs.style })
|
|
53
|
+
const inputAttrs = () => {
|
|
53
54
|
const { class: _c, style: _s, ...rest } = attrs
|
|
54
55
|
return rest
|
|
55
|
-
}
|
|
56
|
+
}
|
|
56
57
|
|
|
57
58
|
const inputEl = ref<HTMLInputElement>()
|
|
58
59
|
const placeholderText = computed(() => props.placeholder ?? locale.search)
|
|
@@ -93,7 +94,7 @@ defineExpose({
|
|
|
93
94
|
<label
|
|
94
95
|
class="m3-search-field flex min-w-0 items-center text-on-surface focus-within:ring-2 focus-within:ring-secondary"
|
|
95
96
|
:class="[`m3-search-field-${size}`, { 'm3-search-field-slotted': $slots.leading }, disabled ? 'cursor-not-allowed opacity-38' : 'cursor-text']"
|
|
96
|
-
v-bind="rootAttrs"
|
|
97
|
+
v-bind="rootAttrs()"
|
|
97
98
|
>
|
|
98
99
|
<!-- A slotted 40px button sits 8px in and 4px from the text: its icon then lines up with the default one -->
|
|
99
100
|
<span v-if="$slots.leading" class="-me-2 flex shrink-0 items-center"><slot name="leading" /></span>
|
|
@@ -108,7 +109,7 @@ defineExpose({
|
|
|
108
109
|
enterkeyhint="search"
|
|
109
110
|
class="min-w-0 flex-1 bg-transparent text-on-surface outline-none placeholder:text-on-surface-variant disabled:cursor-not-allowed [&::-webkit-search-cancel-button]:hidden"
|
|
110
111
|
:class="size === 'sm' ? 'text-body-medium' : 'text-body-large'"
|
|
111
|
-
v-bind="inputAttrs"
|
|
112
|
+
v-bind="inputAttrs()"
|
|
112
113
|
@input="onInput"
|
|
113
114
|
@keydown="onKeydown"
|
|
114
115
|
/>
|
|
@@ -24,6 +24,7 @@ export interface SeekBarChapter {
|
|
|
24
24
|
* @event update:remaining Emitted when the end label is clicked to switch between total and remaining time
|
|
25
25
|
*/
|
|
26
26
|
import { computed, onBeforeUnmount, onMounted, ref, watch } from 'vue'
|
|
27
|
+
import { shouldReduceMotion } from '../composables/motion'
|
|
27
28
|
import { useLocale } from '../composables/useLocale'
|
|
28
29
|
|
|
29
30
|
const props = withDefaults(defineProps<{
|
|
@@ -392,7 +393,7 @@ let amp = 0
|
|
|
392
393
|
let phase = 0
|
|
393
394
|
const wavePathEl = ref<SVGPathElement>()
|
|
394
395
|
const svgH = computed(() => s.value.wave + 2 * s.value.amp + 2)
|
|
395
|
-
const reducedMotion =
|
|
396
|
+
const reducedMotion = shouldReduceMotion()
|
|
396
397
|
|
|
397
398
|
const ampTarget = () => (props.variant === 'wavy' && props.playing && scrubTime.value === null ? s.value.amp : 0)
|
|
398
399
|
amp = ampTarget()
|
|
@@ -552,7 +553,7 @@ onBeforeUnmount(() => {
|
|
|
552
553
|
/>
|
|
553
554
|
|
|
554
555
|
<div
|
|
555
|
-
class="pointer-events-none absolute top-1/2 transition-transform duration-75 group-focus-visible:ring-2 group-focus-visible:ring-
|
|
556
|
+
class="pointer-events-none absolute top-1/2 transition-transform duration-75 group-focus-visible:ring-2 group-focus-visible:ring-secondary group-focus-visible:ring-offset-2 group-focus-visible:ring-offset-surface"
|
|
556
557
|
:style="thumbStyle"
|
|
557
558
|
/>
|
|
558
559
|
|