@m3ui-vue/m3ui-vue 1.10.2 → 1.11.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 +19 -4
- package/dist/API.md +204 -59
- package/dist/MButton-BHKF1Tfd.js +284 -0
- package/dist/MButton-BHKF1Tfd.js.map +1 -0
- package/dist/MColorPickerModal-CNesUJUq.js +466 -0
- package/dist/MColorPickerModal-CNesUJUq.js.map +1 -0
- package/dist/MDialog-jAYkZ4M8.js +226 -0
- package/dist/MDialog-jAYkZ4M8.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-CgdM5sco.js +1306 -0
- package/dist/MListItem-CgdM5sco.js.map +1 -0
- package/dist/MLoadingIndicator-00XbLQSf.js +115 -0
- package/dist/MLoadingIndicator-00XbLQSf.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-KjUIJOIs.js} +674 -671
- package/dist/MPdfViewer-KjUIJOIs.js.map +1 -0
- package/dist/MProgressBar-BzZMxq7M.js.map +1 -1
- package/dist/MSeekBar-B4EEWw3B.js +435 -0
- package/dist/MSeekBar-B4EEWw3B.js.map +1 -0
- package/dist/{MSegmentedButton-DMou-8sG.js → MSegmentedButton-UOAJAd2i.js} +4 -4
- package/dist/{MSegmentedButton-DMou-8sG.js.map → MSegmentedButton-UOAJAd2i.js.map} +1 -1
- package/dist/{MSignaturePad-WuvE_Cyl.js → MSignaturePad-HZavgiGB.js} +2 -2
- package/dist/{MSignaturePad-WuvE_Cyl.js.map → MSignaturePad-HZavgiGB.js.map} +1 -1
- package/dist/{MSlider-7TzhFHKS.js → MSlider-BaQeaozI.js} +4 -4
- package/dist/{MSlider-7TzhFHKS.js.map → MSlider-BaQeaozI.js.map} +1 -1
- package/dist/{MSpinner-CkIVBuGE.js → MSpinner-CbEMPY4X.js} +2 -2
- package/dist/{MSpinner-CkIVBuGE.js.map → MSpinner-CbEMPY4X.js.map} +1 -1
- package/dist/{MTextField-B6_iOczK.js → MTextField-B9PwKHlP.js} +136 -134
- package/dist/MTextField-B9PwKHlP.js.map +1 -0
- package/dist/{_useFieldValidation-COBJ1tWr.js → _useFieldValidation-B7AAfa69.js} +2 -2
- package/dist/{_useFieldValidation-COBJ1tWr.js.map → _useFieldValidation-B7AAfa69.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/MAudioRecorder.vue.d.ts +2 -2
- 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 +33 -5
- 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/MJsonViewer.vue.d.ts +2 -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 +3 -3
- 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/MTable.vue.d.ts +1 -1
- package/dist/components/MText.vue.d.ts +4 -2
- package/dist/components/MTextField.vue.d.ts +2 -0
- package/dist/components/MTicket.vue.d.ts +1 -1
- package/dist/components/_MDrawerItemList.vue.d.ts +6 -0
- package/dist/composables/_countLabel.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 +18 -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 +865 -33
- 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 +10335 -9798
- 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-BAPJ34Pq.js} +64 -8
- package/dist/useLocale-BAPJ34Pq.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__/countLabels.test.ts +66 -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 +68 -20
- 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/MJsonViewer.vue +4 -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/MTable.vue +3 -2
- 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/_countLabel.ts +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 +82 -4
- 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 +11 -4
- package/src/locales/de.ts +11 -4
- package/src/locales/es.ts +11 -4
- package/src/locales/fr.ts +11 -4
- package/src/locales/index.ts +1 -0
- package/src/locales/ja.ts +11 -4
- package/src/locales/ko.ts +11 -4
- package/src/locales/pl.ts +807 -0
- package/src/locales/pt.ts +11 -4
- package/src/locales/zh.ts +11 -4
- 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
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
import { computed, onBeforeUnmount, onMounted, ref, useSlots, watch } from 'vue'
|
|
15
15
|
import type * as Maplibre from 'maplibre-gl'
|
|
16
16
|
import { useMap } from '../composables/useMap'
|
|
17
|
-
import {
|
|
17
|
+
import { appSprings } from '../composables/motion'
|
|
18
18
|
import { playSamples, prefersReducedMotion, sampleAt, sampleSpring } from '../composables/_springAnimation'
|
|
19
19
|
import type { MapControlPosition } from './MMap.vue'
|
|
20
20
|
|
|
@@ -89,7 +89,7 @@ function onResize() {
|
|
|
89
89
|
function grow(node: HTMLElement, a: { w: number; h: number }, b: { w: number; h: number }) {
|
|
90
90
|
from = a
|
|
91
91
|
to = b
|
|
92
|
-
samples = sampleSpring(0, 1, 0,
|
|
92
|
+
samples = sampleSpring(0, 1, 0, appSprings().defaultSpatial, 0.002)
|
|
93
93
|
node.style.overflow = 'hidden'
|
|
94
94
|
const lerp = (p: number) => ({ width: `${a.w + (b.w - a.w) * p}px`, height: `${a.h + (b.h - a.h) * p}px` })
|
|
95
95
|
anim = playSamples(node, samples, lerp)
|
|
@@ -441,7 +441,7 @@ defineExpose({ start, finish, clear, remove })
|
|
|
441
441
|
<button
|
|
442
442
|
v-if="label.m !== undefined"
|
|
443
443
|
type="button"
|
|
444
|
-
class="pointer-events-auto grid size-5 cursor-pointer place-items-center rounded-full hover:bg-on-primary/
|
|
444
|
+
class="pointer-events-auto grid size-5 cursor-pointer place-items-center rounded-full hover:bg-on-primary/8 focus-visible:outline-2 focus-visible:outline-on-primary"
|
|
445
445
|
:aria-label="t.mapDeleteMeasurement"
|
|
446
446
|
v-tooltip="t.mapDeleteMeasurement"
|
|
447
447
|
@click.stop="remove(label.m)"
|
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* A text field with a formatting mask — built-in presets or a custom pattern where `#` stands for a digit.
|
|
4
4
|
*
|
|
5
|
+
* Your `class`, `style` and `data-*` go on the field's box; every other attribute (`id`, `inputmode`, `enterkeyhint`,
|
|
6
|
+
* `maxlength`, `readonly`, `aria-*`, native listeners like `@keydown`) goes on the `<input>`.
|
|
7
|
+
*
|
|
5
8
|
* @event update:modelValue Emitted on every keystroke — powers v-model
|
|
6
9
|
* @event debounced Emitted debounce ms after the user stops typing (only when debounce > 0)
|
|
7
10
|
*/
|
|
@@ -9,6 +12,7 @@ import { computed, ref, useId, watch } from 'vue'
|
|
|
9
12
|
import { useFieldValidation, useFocusLeave } from '../composables/_useFieldValidation'
|
|
10
13
|
import type { ValidateOn, ValidationRule } from '../composables/validation'
|
|
11
14
|
import MIcon from './MIcon.vue'
|
|
15
|
+
import { useSplitAttrs } from '../composables/_splitAttrs'
|
|
12
16
|
import { useFieldBg } from '../composables/useFieldBg'
|
|
13
17
|
import { useDebounce } from '../composables/useDebounce'
|
|
14
18
|
import { useLocale } from '../composables/useLocale'
|
|
@@ -27,6 +31,8 @@ const PRESETS: Record<MaskPreset, string> = {
|
|
|
27
31
|
zip: '#####-####',
|
|
28
32
|
}
|
|
29
33
|
|
|
34
|
+
defineOptions({ inheritAttrs: false })
|
|
35
|
+
|
|
30
36
|
const props = withDefaults(
|
|
31
37
|
defineProps<{
|
|
32
38
|
/** Masked value (v-model) */
|
|
@@ -101,7 +107,13 @@ const onFocusOut = useFocusLeave(() => rootEl.value, () => {
|
|
|
101
107
|
emit('blur')
|
|
102
108
|
})
|
|
103
109
|
|
|
104
|
-
const
|
|
110
|
+
const { rootAttrs, inputAttrs, attrId } = useSplitAttrs()
|
|
111
|
+
const autoId = useId()
|
|
112
|
+
const id = computed(() => attrId() ?? autoId)
|
|
113
|
+
// Ours (the message below the field) plus any the consumer passed
|
|
114
|
+
function describedBy() {
|
|
115
|
+
return [errorMessage.value || props.hint ? messageId : '', inputAttrs()['aria-describedby']].filter(Boolean).join(' ') || undefined
|
|
116
|
+
}
|
|
105
117
|
const fieldBgEl = ref<HTMLElement | null>(null)
|
|
106
118
|
const { resolvedFieldBg } = useFieldBg(fieldBgEl, () => props.fieldBg)
|
|
107
119
|
const inputEl = ref<HTMLInputElement | null>(null)
|
|
@@ -228,7 +240,7 @@ defineExpose({
|
|
|
228
240
|
</script>
|
|
229
241
|
|
|
230
242
|
<template>
|
|
231
|
-
<div ref="rootEl" class="flex flex-col gap-1" @focusout="onFocusOut">
|
|
243
|
+
<div ref="rootEl" class="flex flex-col gap-1" @focusout="onFocusOut" v-bind="rootAttrs()">
|
|
232
244
|
<div
|
|
233
245
|
ref="fieldBgEl"
|
|
234
246
|
class="relative"
|
|
@@ -249,8 +261,9 @@ defineExpose({
|
|
|
249
261
|
<input
|
|
250
262
|
:id="id"
|
|
251
263
|
ref="inputEl"
|
|
264
|
+
v-bind="inputAttrs()"
|
|
252
265
|
:aria-invalid="hasError || undefined"
|
|
253
|
-
:aria-describedby="
|
|
266
|
+
:aria-describedby="describedBy()"
|
|
254
267
|
type="text"
|
|
255
268
|
inputmode="numeric"
|
|
256
269
|
:value="modelValue"
|
package/src/components/MMenu.vue
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
import { computed, inject, nextTick, onMounted, onUnmounted, provide, ref, useSlots, watch, type VNode } from 'vue'
|
|
10
10
|
import MIcon from './MIcon.vue'
|
|
11
|
-
import { splitMenuGroups } from '../composables/_menuGroups'
|
|
11
|
+
import { splitMenuGroups, RenderNodes } from '../composables/_menuGroups'
|
|
12
12
|
import { useEscapeStack } from '../composables/_useEscapeStack'
|
|
13
13
|
import { useMenuNav } from '../composables/_useMenuNav'
|
|
14
14
|
import { POPUP_MARGIN, dropdownX } from '../composables/_popupPosition'
|
|
@@ -427,16 +427,16 @@ const origin = computed(() => `${originX.value} ${openAbove.value ? 'bottom' : '
|
|
|
427
427
|
@click="popNav"
|
|
428
428
|
>
|
|
429
429
|
<MIcon name="arrow_back" :size="20" class="shrink-0" />
|
|
430
|
-
<span class="flex-1 truncate"><
|
|
430
|
+
<span class="flex-1 truncate"><RenderNodes :nodes="() => currentNav?.header?.()" /></span>
|
|
431
431
|
</button>
|
|
432
432
|
<hr class="my-1 border-outline-variant" />
|
|
433
|
-
<
|
|
433
|
+
<RenderNodes :nodes="() => currentNav?.content?.()" />
|
|
434
434
|
</div>
|
|
435
435
|
<div v-else key="root">
|
|
436
436
|
<div v-if="isGrouped" class="flex flex-col gap-1 px-1.5">
|
|
437
437
|
<div v-for="(group, i) in groups" :key="i" class="rounded-lg shadow-elevation-2">
|
|
438
438
|
<div class="overflow-hidden rounded-lg" :class="panelBg">
|
|
439
|
-
<
|
|
439
|
+
<RenderNodes :nodes="() => group" />
|
|
440
440
|
</div>
|
|
441
441
|
</div>
|
|
442
442
|
</div>
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
*/
|
|
18
18
|
import { vRipple } from '../directives/vRipple'
|
|
19
19
|
import { computed, inject, nextTick, onMounted, onUnmounted, ref, useSlots, watch, type VNode } from 'vue'
|
|
20
|
-
import { splitMenuGroups } from '../composables/_menuGroups'
|
|
20
|
+
import { splitMenuGroups, RenderNodes } from '../composables/_menuGroups'
|
|
21
21
|
import MIcon from './MIcon.vue'
|
|
22
22
|
import { isRtl } from '../composables/_rtl'
|
|
23
23
|
import { FAST_EFFECTS, FAST_SPATIAL, useSpring } from '../composables/_useSpring'
|
|
@@ -314,7 +314,7 @@ function onSubPointerLeave(e: PointerEvent) {
|
|
|
314
314
|
<div v-if="subGrouped" class="flex flex-col gap-1 px-1.5">
|
|
315
315
|
<div v-for="(group, i) in subGroups" :key="i" class="rounded-lg shadow-elevation-2">
|
|
316
316
|
<div class="overflow-hidden rounded-lg" :class="panelBg">
|
|
317
|
-
<
|
|
317
|
+
<RenderNodes :nodes="() => group" />
|
|
318
318
|
</div>
|
|
319
319
|
</div>
|
|
320
320
|
</div>
|
|
@@ -23,6 +23,7 @@ export interface MeterItem {
|
|
|
23
23
|
* @event select Emitted with the item (and its index) when a segment or legend entry is clicked
|
|
24
24
|
*/
|
|
25
25
|
import { computed, onMounted, ref } from 'vue'
|
|
26
|
+
import { shouldReduceMotion } from '../composables/motion'
|
|
26
27
|
import MIcon from './MIcon.vue'
|
|
27
28
|
import { useLocale } from '../composables/useLocale'
|
|
28
29
|
|
|
@@ -64,7 +65,7 @@ const emit = defineEmits<{ select: [item: MeterItem, index: number] }>()
|
|
|
64
65
|
const t = useLocale()
|
|
65
66
|
const lang = computed(() => props.locale ?? t.lang)
|
|
66
67
|
|
|
67
|
-
const ROLES = new Set(['primary', 'secondary', 'tertiary', 'error', 'success', 'on-surface', 'on-surface-variant', 'outline', 'inverse-primary', 'primary-container', 'secondary-container', 'tertiary-container'])
|
|
68
|
+
const ROLES = new Set(['primary', 'secondary', 'tertiary', 'error', 'success', 'warning', 'on-surface', 'on-surface-variant', 'outline', 'inverse-primary', 'primary-container', 'secondary-container', 'tertiary-container'])
|
|
68
69
|
const CYCLE = ['primary', 'tertiary', 'secondary', 'error', 'success']
|
|
69
70
|
const colorOf = (item: MeterItem, i: number) => {
|
|
70
71
|
const c = item.color ?? CYCLE[i % CYCLE.length]!
|
|
@@ -98,7 +99,7 @@ const totalGap = computed(() => Math.max(0, segments.value.length + (hasTrack.va
|
|
|
98
99
|
const widthOf = (share: number) => `calc((100% - ${totalGap.value}px) * ${share})`
|
|
99
100
|
|
|
100
101
|
// Grows in from zero on mount: the segments render at 0 and get their width one frame later
|
|
101
|
-
const reduced =
|
|
102
|
+
const reduced = shouldReduceMotion()
|
|
102
103
|
const shown = ref(!props.animate || reduced)
|
|
103
104
|
onMounted(() => {
|
|
104
105
|
if (!shown.value) requestAnimationFrame(() => requestAnimationFrame(() => { shown.value = true }))
|
|
@@ -27,7 +27,7 @@ import MNumberField from './MNumberField.vue'
|
|
|
27
27
|
import MSlider from './MSlider.vue'
|
|
28
28
|
import MButton from './MButton.vue'
|
|
29
29
|
import { amortize } from '../composables/mortgage'
|
|
30
|
-
import { useLocale } from '../composables/useLocale'
|
|
30
|
+
import { useLocale, formatMessage } from '../composables/useLocale'
|
|
31
31
|
import { vRipple } from '../directives/vRipple'
|
|
32
32
|
|
|
33
33
|
const locale = useLocale()
|
|
@@ -174,7 +174,7 @@ defineExpose({ loan, monthly, schedule })
|
|
|
174
174
|
:data-term="t"
|
|
175
175
|
@click="update({ years: t })"
|
|
176
176
|
>
|
|
177
|
-
{{ locale.mortgageYears
|
|
177
|
+
{{ formatMessage(locale.mortgageYears, { n: String(t) }, locale.lang) }}
|
|
178
178
|
</button>
|
|
179
179
|
</div>
|
|
180
180
|
</div>
|
|
@@ -228,7 +228,7 @@ defineExpose({ loan, monthly, schedule })
|
|
|
228
228
|
</MButton>
|
|
229
229
|
<div v-if="showSchedule" class="mt-2 max-h-80 overflow-auto rounded-md border border-outline-variant">
|
|
230
230
|
<table class="w-full text-body-medium tabular-nums" data-schedule>
|
|
231
|
-
<thead class="sticky top-0 bg-surface-container-high text-label-large text-on-surface-variant">
|
|
231
|
+
<thead class="sticky top-0 z-10 bg-surface-container-high text-label-large text-on-surface-variant">
|
|
232
232
|
<tr>
|
|
233
233
|
<th class="px-3 py-2 text-start font-medium">{{ locale.mortgageYear }}</th>
|
|
234
234
|
<th class="px-3 py-2 text-end font-medium">{{ locale.mortgagePrincipal }}</th>
|
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* Multi-value autocomplete with inline search. Type to filter, Enter to toggle, Backspace to remove last chip.
|
|
4
4
|
*
|
|
5
|
+
* Your `class`, `style` and `data-*` go on the field's box; every other attribute (`id`, `aria-*`, native
|
|
6
|
+
* listeners like `@keydown`) goes on the `<input>`.
|
|
7
|
+
*
|
|
5
8
|
* @event update:modelValue Emitted on selection change — powers v-model
|
|
6
9
|
* @event debounced Emitted debounce ms after the user stops typing the search query (only when debounce > 0)
|
|
7
10
|
*/
|
|
@@ -9,6 +12,7 @@ import { computed, ref, useId, onMounted, onUnmounted, watch, nextTick } from 'v
|
|
|
9
12
|
import { useFieldValidation, useFocusLeave } from '../composables/_useFieldValidation'
|
|
10
13
|
import type { ValidateOn, ValidationRule } from '../composables/validation'
|
|
11
14
|
import MIcon from './MIcon.vue'
|
|
15
|
+
import { useSplitAttrs } from '../composables/_splitAttrs'
|
|
12
16
|
import { vTooltip } from '../directives/vTooltip'
|
|
13
17
|
import MIconButton from './MIconButton.vue'
|
|
14
18
|
import MCheckbox from './MCheckbox.vue'
|
|
@@ -113,6 +117,13 @@ const { hasError, message: errorMessage, messageId } = validation
|
|
|
113
117
|
|
|
114
118
|
const locale = useLocale()
|
|
115
119
|
const id = useId()
|
|
120
|
+
const { rootAttrs, inputAttrs, attrId } = useSplitAttrs()
|
|
121
|
+
/** The trigger's id: the consumer's `id` if given (so `<label for>` works), else the generated one */
|
|
122
|
+
const controlId = () => attrId() ?? id
|
|
123
|
+
// Ours (the message below the field) plus any the consumer passed
|
|
124
|
+
function describedBy() {
|
|
125
|
+
return [errorMessage.value || props.hint ? messageId : '', inputAttrs()['aria-describedby']].filter(Boolean).join(' ') || undefined
|
|
126
|
+
}
|
|
116
127
|
const open = ref(false)
|
|
117
128
|
const modalOpen = ref(false)
|
|
118
129
|
const modalSearch = ref('')
|
|
@@ -413,7 +424,7 @@ const onFocusOut = useFocusLeave(() => rootEl.value, () => {
|
|
|
413
424
|
</script>
|
|
414
425
|
|
|
415
426
|
<template>
|
|
416
|
-
<div ref="rootEl" class="flex flex-col gap-1" v-bind="
|
|
427
|
+
<div ref="rootEl" class="flex flex-col gap-1" v-bind="rootAttrs()" @focusout="onFocusOut">
|
|
417
428
|
<div
|
|
418
429
|
ref="fieldEl"
|
|
419
430
|
class="relative"
|
|
@@ -452,7 +463,7 @@ const onFocusOut = useFocusLeave(() => rootEl.value, () => {
|
|
|
452
463
|
:aria-label="`${locale.remove} ${chip.label}`"
|
|
453
464
|
v-if="!isDisabled"
|
|
454
465
|
type="button"
|
|
455
|
-
class="flex h-4 w-4 shrink-0 items-center justify-center rounded-full hover:bg-on-secondary-container/
|
|
466
|
+
class="flex h-4 w-4 shrink-0 items-center justify-center rounded-full hover:bg-on-secondary-container/8"
|
|
456
467
|
@click="removeChip(chip.value, $event)"
|
|
457
468
|
>
|
|
458
469
|
<MIcon name="close" :size="12" />
|
|
@@ -461,14 +472,14 @@ const onFocusOut = useFocusLeave(() => rootEl.value, () => {
|
|
|
461
472
|
<span
|
|
462
473
|
v-if="overflowCount > 0 && !chipsExpanded"
|
|
463
474
|
v-tooltip="overflowLabels"
|
|
464
|
-
class="cursor-pointer rounded-full bg-surface-container-high px-2 py-0.5 text-label-small text-on-surface-variant transition-colors hover:bg-on-surface/
|
|
475
|
+
class="cursor-pointer rounded-full bg-surface-container-high px-2 py-0.5 text-label-small text-on-surface-variant transition-colors hover:bg-on-surface/8"
|
|
465
476
|
@click.stop="chipsExpanded = true"
|
|
466
477
|
>
|
|
467
478
|
+{{ overflowCount }}
|
|
468
479
|
</span>
|
|
469
480
|
<span
|
|
470
481
|
v-if="chipsExpanded && modelValue.length > maxChips"
|
|
471
|
-
class="cursor-pointer rounded-full bg-surface-container-high px-2 py-0.5 text-label-small text-on-surface-variant transition-colors hover:bg-on-surface/
|
|
482
|
+
class="cursor-pointer rounded-full bg-surface-container-high px-2 py-0.5 text-label-small text-on-surface-variant transition-colors hover:bg-on-surface/8"
|
|
472
483
|
@click.stop="chipsExpanded = false"
|
|
473
484
|
>
|
|
474
485
|
<MIcon name="unfold_less" :size="14" />
|
|
@@ -476,10 +487,11 @@ const onFocusOut = useFocusLeave(() => rootEl.value, () => {
|
|
|
476
487
|
</template>
|
|
477
488
|
|
|
478
489
|
<input
|
|
479
|
-
|
|
490
|
+
v-bind="inputAttrs()"
|
|
491
|
+
:id="controlId()"
|
|
480
492
|
ref="inputEl"
|
|
481
493
|
:aria-invalid="hasError || undefined"
|
|
482
|
-
:aria-describedby="
|
|
494
|
+
:aria-describedby="describedBy()"
|
|
483
495
|
type="text"
|
|
484
496
|
:value="search"
|
|
485
497
|
:placeholder="!label && !hasValue ? placeholder : undefined"
|
|
@@ -503,7 +515,7 @@ const onFocusOut = useFocusLeave(() => rootEl.value, () => {
|
|
|
503
515
|
</div>
|
|
504
516
|
|
|
505
517
|
<!-- Floating label -->
|
|
506
|
-
<label :for="
|
|
518
|
+
<label :for="controlId()" :class="labelClasses">
|
|
507
519
|
{{ label }}<span v-if="required" class="text-error"> *</span>
|
|
508
520
|
</label>
|
|
509
521
|
|
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* Select multiple values with removable chips and an optional in-dropdown search.
|
|
4
4
|
*
|
|
5
|
+
* Your `class`, `style` and `data-*` go on the field's box; every other attribute (`id`, `aria-*`, native
|
|
6
|
+
* listeners like `@keydown`) goes on the trigger.
|
|
7
|
+
*
|
|
5
8
|
* @slot no-results Custom content shown in the dropdown when no options match the search query
|
|
6
9
|
* @event update:modelValue Emitted with the new array of selected values.
|
|
7
10
|
*/
|
|
@@ -9,6 +12,7 @@ import { computed, ref, useId, onMounted, onUnmounted, nextTick, watch } from 'v
|
|
|
9
12
|
import { useFieldValidation, useFocusLeave } from '../composables/_useFieldValidation'
|
|
10
13
|
import type { ValidateOn, ValidationRule } from '../composables/validation'
|
|
11
14
|
import MIcon from './MIcon.vue'
|
|
15
|
+
import { useSplitAttrs } from '../composables/_splitAttrs'
|
|
12
16
|
import { vTooltip } from '../directives/vTooltip'
|
|
13
17
|
import MIconButton from './MIconButton.vue'
|
|
14
18
|
import MCheckbox from './MCheckbox.vue'
|
|
@@ -119,6 +123,13 @@ const isDisabled = validation.disabled
|
|
|
119
123
|
const { hasError, message: errorMessage, messageId } = validation
|
|
120
124
|
|
|
121
125
|
const id = useId()
|
|
126
|
+
const { rootAttrs, inputAttrs, attrId } = useSplitAttrs()
|
|
127
|
+
/** The trigger's id: the consumer's `id` if given (so `<label for>` works), else the generated one */
|
|
128
|
+
const controlId = () => attrId() ?? id
|
|
129
|
+
// Ours (the message below the field) plus any the consumer passed
|
|
130
|
+
function describedBy() {
|
|
131
|
+
return [errorMessage.value || props.hint ? messageId : '', inputAttrs()['aria-describedby']].filter(Boolean).join(' ') || undefined
|
|
132
|
+
}
|
|
122
133
|
const open = ref(false)
|
|
123
134
|
const modalOpen = ref(false)
|
|
124
135
|
// Focused (from the keyboard too) looks like open: M3's focused field, 2dp primary indicator and primary label,
|
|
@@ -320,7 +331,7 @@ const onFocusOut = useFocusLeave(() => rootEl.value, () => {
|
|
|
320
331
|
</script>
|
|
321
332
|
|
|
322
333
|
<template>
|
|
323
|
-
<div ref="rootEl" class="flex flex-col gap-1" v-bind="
|
|
334
|
+
<div ref="rootEl" class="flex flex-col gap-1" v-bind="rootAttrs()" @focusout="onFocusOut">
|
|
324
335
|
<div
|
|
325
336
|
ref="fieldEl"
|
|
326
337
|
class="relative"
|
|
@@ -340,12 +351,13 @@ const onFocusOut = useFocusLeave(() => rootEl.value, () => {
|
|
|
340
351
|
|
|
341
352
|
<!-- Trigger field -->
|
|
342
353
|
<div
|
|
343
|
-
|
|
354
|
+
v-bind="inputAttrs()"
|
|
355
|
+
:id="controlId()"
|
|
344
356
|
:class="triggerClasses"
|
|
345
357
|
role="button"
|
|
346
358
|
:tabindex="isDisabled ? -1 : 0"
|
|
347
359
|
:aria-invalid="hasError || undefined"
|
|
348
|
-
:aria-describedby="
|
|
360
|
+
:aria-describedby="describedBy()"
|
|
349
361
|
:aria-expanded="open || modalOpen"
|
|
350
362
|
:aria-haspopup="true"
|
|
351
363
|
:aria-controls="open ? `${id}-list` : undefined"
|
|
@@ -369,7 +381,7 @@ const onFocusOut = useFocusLeave(() => rootEl.value, () => {
|
|
|
369
381
|
:aria-label="`${locale.remove} ${chip.label}`"
|
|
370
382
|
v-if="!isDisabled"
|
|
371
383
|
type="button"
|
|
372
|
-
class="flex h-4 w-4 shrink-0 items-center justify-center rounded-full hover:bg-on-secondary-container/
|
|
384
|
+
class="flex h-4 w-4 shrink-0 items-center justify-center rounded-full hover:bg-on-secondary-container/8"
|
|
373
385
|
@click="removeChip(chip.value, $event)"
|
|
374
386
|
>
|
|
375
387
|
<MIcon name="close" :size="12" />
|
|
@@ -378,14 +390,14 @@ const onFocusOut = useFocusLeave(() => rootEl.value, () => {
|
|
|
378
390
|
<span
|
|
379
391
|
v-if="overflowCount > 0 && !chipsExpanded"
|
|
380
392
|
v-tooltip="overflowLabels"
|
|
381
|
-
class="cursor-pointer rounded-full bg-surface-container-high px-2 py-0.5 text-label-small text-on-surface-variant transition-colors hover:bg-on-surface/
|
|
393
|
+
class="cursor-pointer rounded-full bg-surface-container-high px-2 py-0.5 text-label-small text-on-surface-variant transition-colors hover:bg-on-surface/8"
|
|
382
394
|
@click.stop="chipsExpanded = true"
|
|
383
395
|
>
|
|
384
396
|
+{{ overflowCount }}
|
|
385
397
|
</span>
|
|
386
398
|
<span
|
|
387
399
|
v-if="chipsExpanded && modelValue.length > maxChips"
|
|
388
|
-
class="cursor-pointer rounded-full bg-surface-container-high px-2 py-0.5 text-label-small text-on-surface-variant transition-colors hover:bg-on-surface/
|
|
400
|
+
class="cursor-pointer rounded-full bg-surface-container-high px-2 py-0.5 text-label-small text-on-surface-variant transition-colors hover:bg-on-surface/8"
|
|
389
401
|
@click.stop="chipsExpanded = false"
|
|
390
402
|
>
|
|
391
403
|
<MIcon name="unfold_less" :size="14" />
|
|
@@ -443,7 +455,7 @@ const onFocusOut = useFocusLeave(() => rootEl.value, () => {
|
|
|
443
455
|
class="fixed z-500 max-h-60 overflow-auto rounded-xs bg-surface-container shadow-elevation-2"
|
|
444
456
|
:style="dropPos"
|
|
445
457
|
>
|
|
446
|
-
<div v-if="searchable" class="sticky top-0 bg-surface-container px-3 py-2">
|
|
458
|
+
<div v-if="searchable" class="sticky top-0 z-10 bg-surface-container px-3 py-2">
|
|
447
459
|
<div class="flex items-center gap-2 rounded-full bg-surface-container-high px-3 py-1.5">
|
|
448
460
|
<MIcon name="search" :size="16" class="shrink-0 text-on-surface-variant" />
|
|
449
461
|
<input
|
|
@@ -20,9 +20,12 @@ import { vTooltip } from '../directives/vTooltip'
|
|
|
20
20
|
import type { TooltipPlacement } from '../composables/_tooltipTrigger'
|
|
21
21
|
import MBadge from "./MBadge.vue";
|
|
22
22
|
import MDrawerItemList from "./_MDrawerItemList.vue";
|
|
23
|
-
import {
|
|
23
|
+
import { type SpringSpec } from "../composables/motion";
|
|
24
|
+
// Springs of the app's motion scheme, read when each animation starts
|
|
25
|
+
import { DEFAULT_SPATIAL, FAST_EFFECTS } from "../composables/_useSpring";
|
|
24
26
|
import { sampleSpring, sampleAt, playSamples, prefersReducedMotion } from "../composables/_springAnimation";
|
|
25
27
|
import { useScrollLock } from '../composables/_useScrollLock'
|
|
28
|
+
import { useFocusTrap } from '../composables/_useFocusTrap'
|
|
26
29
|
import { useDocumentRtl } from '../composables/_rtl'
|
|
27
30
|
|
|
28
31
|
export interface DrawerItem {
|
|
@@ -217,6 +220,9 @@ function itemTag(item: DrawerItem) {
|
|
|
217
220
|
}
|
|
218
221
|
|
|
219
222
|
useScrollLock(() => props.modal && props.modelValue);
|
|
223
|
+
// Modal: focus moves into the drawer on open, Tab stays inside, and closing returns it to the opener
|
|
224
|
+
const modalEl = ref<HTMLElement>();
|
|
225
|
+
useFocusTrap(() => modalEl.value, () => props.modal && props.modelValue);
|
|
220
226
|
|
|
221
227
|
// ── Modal: slide in/out + swipe to close ────────────────────────────────────────────────────
|
|
222
228
|
// After ModalNavigationDrawer (NavigationDrawer.kt), which is left/right only; top/bottom add a bottom sheet's
|
|
@@ -227,8 +233,6 @@ useScrollLock(() => props.modal && props.modelValue);
|
|
|
227
233
|
//
|
|
228
234
|
// Each spring plays as a Web Animation (see _springAnimation.ts): a rAF loop janked the open on phones. Only the
|
|
229
235
|
// drag itself writes styles directly. Offsets are fractions of the panel's size, so opening never reads layout.
|
|
230
|
-
const DEFAULT_SPATIAL = motionSprings.standard.defaultSpatial
|
|
231
|
-
const FAST_EFFECTS = motionSprings.standard.fastEffects
|
|
232
236
|
const FLING_VELOCITY = 400
|
|
233
237
|
|
|
234
238
|
let panelEl: HTMLElement | null = null
|
|
@@ -489,6 +493,9 @@ function onPanelClickCapture(e: MouseEvent) {
|
|
|
489
493
|
<Transition :css="false" @enter="onModalEnter" @leave="onModalLeave" appear>
|
|
490
494
|
<div
|
|
491
495
|
v-if="modelValue"
|
|
496
|
+
ref="modalEl"
|
|
497
|
+
role="dialog"
|
|
498
|
+
aria-modal="true"
|
|
492
499
|
class="fixed inset-0 z-100 flex"
|
|
493
500
|
:class="[
|
|
494
501
|
(physicalSide === 'right' && !rtl) || (physicalSide === 'left' && rtl) ? 'justify-end' : '',
|
|
@@ -14,6 +14,7 @@ import MBadge from './MBadge.vue'
|
|
|
14
14
|
import { useItemLink, type ItemLink } from '../composables/_useItemLink'
|
|
15
15
|
import { sampleSpring, sampleAt, playSamples, prefersReducedMotion } from '../composables/_springAnimation'
|
|
16
16
|
import { useScrollLock } from '../composables/_useScrollLock'
|
|
17
|
+
import { useFocusTrap } from '../composables/_useFocusTrap'
|
|
17
18
|
import { useEscapeStack } from '../composables/_useEscapeStack'
|
|
18
19
|
import { isRtl } from '../composables/_rtl'
|
|
19
20
|
|
|
@@ -372,6 +373,9 @@ onUnmounted(() => {
|
|
|
372
373
|
slideScrimAnim?.cancel()
|
|
373
374
|
})
|
|
374
375
|
useScrollLock(() => props.modal && props.expanded)
|
|
376
|
+
// Modal: focus moves into the panel on open, Tab stays inside, and closing returns it to the opener
|
|
377
|
+
const modalEl = ref<HTMLElement>()
|
|
378
|
+
useFocusTrap(() => modalEl.value, () => !!(props.modal && props.expanded))
|
|
375
379
|
</script>
|
|
376
380
|
|
|
377
381
|
<template>
|
|
@@ -531,7 +535,7 @@ useScrollLock(() => props.modal && props.expanded)
|
|
|
531
535
|
-->
|
|
532
536
|
<Teleport v-if="modal" to="body">
|
|
533
537
|
<Transition :css="false" @enter="onPanelEnter" @leave="onPanelLeave">
|
|
534
|
-
<div v-if="expanded" class="fixed inset-0 z-100">
|
|
538
|
+
<div v-if="expanded" ref="modalEl" role="dialog" aria-modal="true" class="fixed inset-0 z-100">
|
|
535
539
|
<div class="wnr-scrim absolute inset-0 bg-scrim/32" @click="close" />
|
|
536
540
|
|
|
537
541
|
<nav
|
|
@@ -32,7 +32,7 @@ export interface InboxNotification {
|
|
|
32
32
|
/** An image URL instead of the icon */
|
|
33
33
|
avatar?: string
|
|
34
34
|
/** The icon's color: a theme role */
|
|
35
|
-
color?: 'primary' | 'secondary' | 'tertiary' | 'error' | 'success'
|
|
35
|
+
color?: 'primary' | 'secondary' | 'tertiary' | 'error' | 'success' | 'warning'
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
const props = withDefaults(
|
|
@@ -189,6 +189,7 @@ const ROLE_BG = {
|
|
|
189
189
|
tertiary: 'bg-tertiary-container text-on-tertiary-container',
|
|
190
190
|
error: 'bg-error-container text-on-error-container',
|
|
191
191
|
success: 'bg-success-container text-on-success-container',
|
|
192
|
+
warning: 'bg-warning-container text-on-warning-container',
|
|
192
193
|
} as const
|
|
193
194
|
</script>
|
|
194
195
|
|
|
@@ -30,17 +30,17 @@ const variantStyles: Record<string, { bg: string; icon: string; iconName: string
|
|
|
30
30
|
},
|
|
31
31
|
success: {
|
|
32
32
|
bg: 'bg-inverse-surface text-inverse-on-surface',
|
|
33
|
-
icon: 'text-
|
|
33
|
+
icon: 'text-success-container',
|
|
34
34
|
iconName: 'check_circle',
|
|
35
35
|
},
|
|
36
36
|
warning: {
|
|
37
37
|
bg: 'bg-inverse-surface text-inverse-on-surface',
|
|
38
|
-
icon: 'text-
|
|
38
|
+
icon: 'text-warning-container',
|
|
39
39
|
iconName: 'warning',
|
|
40
40
|
},
|
|
41
41
|
error: {
|
|
42
42
|
bg: 'bg-inverse-surface text-inverse-on-surface',
|
|
43
|
-
icon: 'text-
|
|
43
|
+
icon: 'text-error-container',
|
|
44
44
|
iconName: 'error',
|
|
45
45
|
},
|
|
46
46
|
}
|
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* A numeric text field with +/- stepper buttons, min/max clamping, and keyboard arrow support.
|
|
4
4
|
*
|
|
5
|
+
* Your `class`, `style` and `data-*` go on the field's box; every other attribute (`id`, `inputmode`, `enterkeyhint`,
|
|
6
|
+
* `maxlength`, `readonly`, `aria-*`, native listeners like `@keydown`) goes on the `<input>`.
|
|
7
|
+
*
|
|
5
8
|
* @event update:modelValue Emitted on every change — typing, stepper clicks, or arrow keys — powers v-model
|
|
6
9
|
* @event debounced Emitted debounce ms after the user stops typing (only when debounce > 0). Stepper
|
|
7
10
|
* clicks/arrow keys still emit instantly
|
|
@@ -10,11 +13,17 @@ import { computed, ref, useId } from 'vue'
|
|
|
10
13
|
import { useFieldValidation, useFocusLeave } from '../composables/_useFieldValidation'
|
|
11
14
|
import type { ValidateOn, ValidationRule } from '../composables/validation'
|
|
12
15
|
import MIcon from './MIcon.vue'
|
|
16
|
+
import { useSplitAttrs } from '../composables/_splitAttrs'
|
|
17
|
+
import { useLocale } from '../composables/useLocale'
|
|
13
18
|
import MIconButton from './MIconButton.vue'
|
|
14
19
|
import { useFieldBg } from '../composables/useFieldBg'
|
|
15
20
|
import { useDebounce } from '../composables/useDebounce'
|
|
16
21
|
import { FIELD_PADDING_END, fieldLabelClasses, vOverflowTitle, type FieldEndInset } from '../composables/_fieldLayout'
|
|
17
22
|
|
|
23
|
+
defineOptions({ inheritAttrs: false })
|
|
24
|
+
|
|
25
|
+
const locale = useLocale()
|
|
26
|
+
|
|
18
27
|
const props = withDefaults(
|
|
19
28
|
defineProps<{
|
|
20
29
|
/** Bound numeric value (v-model) */
|
|
@@ -42,7 +51,7 @@ const props = withDefaults(
|
|
|
42
51
|
validateOn?: ValidateOn
|
|
43
52
|
/** Wait this long (ms) after the value stops changing before re-checking (one request for an async rule, not one per key). Defaults to its `MForm`'s */
|
|
44
53
|
validateDebounce?: number
|
|
45
|
-
/**
|
|
54
|
+
/** Native `name`; also the key of this field in its `MForm`'s values, errors and schema */
|
|
46
55
|
name?: string
|
|
47
56
|
/** Hint text */
|
|
48
57
|
hint?: string
|
|
@@ -95,7 +104,13 @@ const onFocusOut = useFocusLeave(() => rootEl.value, () => {
|
|
|
95
104
|
emit('blur')
|
|
96
105
|
})
|
|
97
106
|
|
|
98
|
-
const
|
|
107
|
+
const { rootAttrs, inputAttrs, attrId } = useSplitAttrs()
|
|
108
|
+
const autoId = useId()
|
|
109
|
+
const id = computed(() => attrId() ?? autoId)
|
|
110
|
+
// Ours (the message below the field) plus any the consumer passed
|
|
111
|
+
function describedBy() {
|
|
112
|
+
return [errorMessage.value || props.hint ? messageId : '', inputAttrs()['aria-describedby']].filter(Boolean).join(' ') || undefined
|
|
113
|
+
}
|
|
99
114
|
const fieldBgEl = ref<HTMLElement | null>(null)
|
|
100
115
|
const inputEl = ref<HTMLInputElement | null>(null)
|
|
101
116
|
const { resolvedFieldBg } = useFieldBg(fieldBgEl, () => props.fieldBg)
|
|
@@ -205,7 +220,7 @@ defineExpose({
|
|
|
205
220
|
</script>
|
|
206
221
|
|
|
207
222
|
<template>
|
|
208
|
-
<div ref="rootEl" class="flex flex-col gap-1" @focusout="onFocusOut">
|
|
223
|
+
<div ref="rootEl" class="flex flex-col gap-1" @focusout="onFocusOut" v-bind="rootAttrs()">
|
|
209
224
|
<div
|
|
210
225
|
ref="fieldBgEl"
|
|
211
226
|
class="relative"
|
|
@@ -225,10 +240,12 @@ defineExpose({
|
|
|
225
240
|
|
|
226
241
|
<input
|
|
227
242
|
ref="inputEl"
|
|
243
|
+
v-bind="inputAttrs()"
|
|
228
244
|
:aria-invalid="hasError || undefined"
|
|
229
|
-
:aria-describedby="
|
|
245
|
+
:aria-describedby="describedBy()"
|
|
230
246
|
:id="id"
|
|
231
247
|
type="number"
|
|
248
|
+
:name="name"
|
|
232
249
|
:value="modelValue ?? ''"
|
|
233
250
|
:disabled="isDisabled"
|
|
234
251
|
:required="required"
|
|
@@ -247,8 +264,8 @@ defineExpose({
|
|
|
247
264
|
</label>
|
|
248
265
|
|
|
249
266
|
<div v-if="stepper" class="absolute end-1 top-1/2 -translate-y-1/2 flex items-center gap-0.5">
|
|
250
|
-
<MIconButton icon="remove" label="
|
|
251
|
-
<MIconButton icon="add" label="
|
|
267
|
+
<MIconButton icon="remove" :label="locale.decrease" :size="32" :disabled="isDisabled || (min !== undefined && (modelValue ?? 0) <= min)" @click="decrement" />
|
|
268
|
+
<MIconButton icon="add" :label="locale.increase" :size="32" :disabled="isDisabled || (max !== undefined && (modelValue ?? 0) >= max)" @click="increment" />
|
|
252
269
|
</div>
|
|
253
270
|
</div>
|
|
254
271
|
|
|
@@ -39,7 +39,7 @@ export interface OdontogramCondition {
|
|
|
39
39
|
*/
|
|
40
40
|
import { computed, nextTick, ref } from 'vue'
|
|
41
41
|
import MIcon from './MIcon.vue'
|
|
42
|
-
import { useLocale } from '../composables/useLocale'
|
|
42
|
+
import { useLocale, formatMessage } from '../composables/useLocale'
|
|
43
43
|
import { vRipple } from '../directives/vRipple'
|
|
44
44
|
|
|
45
45
|
const locale = useLocale()
|
|
@@ -280,7 +280,7 @@ async function onKeydown(e: KeyboardEvent, idx: number) {
|
|
|
280
280
|
|
|
281
281
|
function toothLabel(t: Tooth) {
|
|
282
282
|
const st = state(t)
|
|
283
|
-
const parts = [locale.odontoTooth
|
|
283
|
+
const parts = [formatMessage(locale.odontoTooth, { n: t.label }, locale.lang)]
|
|
284
284
|
for (const k of st.conditions ?? []) parts.push(condMap.value.get(k)?.label ?? k)
|
|
285
285
|
for (const [s, k] of Object.entries(st.surfaces ?? {})) parts.push(`${surfaceLabels.value[s as ToothSurface]}: ${condMap.value.get(k!)?.label ?? k}`)
|
|
286
286
|
return parts.join(', ')
|
|
@@ -380,7 +380,7 @@ const SIDES: Exclude<Side, 'center'>[] = ['top', 'bottom', 'left', 'right']
|
|
|
380
380
|
:data-surface="surfaceAt(t, s)"
|
|
381
381
|
@click="applySurface(t, surfaceAt(t, s))"
|
|
382
382
|
>
|
|
383
|
-
<title>{{ locale.odontoTooth
|
|
383
|
+
<title>{{ formatMessage(locale.odontoTooth, { n: t.label }, locale.lang) }} · {{ surfaceLabels[surfaceAt(t, s)] }}</title>
|
|
384
384
|
</polygon>
|
|
385
385
|
<rect
|
|
386
386
|
x="12"
|
|
@@ -392,7 +392,7 @@ const SIDES: Exclude<Side, 'center'>[] = ['top', 'bottom', 'left', 'right']
|
|
|
392
392
|
data-surface="occlusal"
|
|
393
393
|
@click="applySurface(t, 'occlusal')"
|
|
394
394
|
>
|
|
395
|
-
<title>{{ locale.odontoTooth
|
|
395
|
+
<title>{{ formatMessage(locale.odontoTooth, { n: t.label }, locale.lang) }} · {{ surfaceLabels.occlusal }}</title>
|
|
396
396
|
</rect>
|
|
397
397
|
|
|
398
398
|
<circle v-if="has(t, 'crown')" cx="20" cy="20" r="23" fill="none" :stroke="condMap.get('crown')?.color" stroke-width="2.5" pointer-events="none" data-mark="crown" />
|
|
@@ -284,4 +284,8 @@ function pick(r: Row, side: 'bid' | 'ask') {
|
|
|
284
284
|
.m3-ob-flash { animation: none; }
|
|
285
285
|
.m3-ob-depth { transition: none; }
|
|
286
286
|
}
|
|
287
|
+
/* createM3UI({ reducedMotion: 'always' }) */
|
|
288
|
+
:root[data-m3-motion='reduce'] .m3-ob-flash { animation: none; }
|
|
289
|
+
:root[data-m3-motion='reduce'] .m3-ob-depth { transition: none; }
|
|
290
|
+
|
|
287
291
|
</style>
|