@m3ui-vue/m3ui-vue 1.8.1 → 1.9.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/dist/API.md +26 -11
- package/dist/{MButton-B6eZTfFV.js → MButton-LiZRRP4h.js} +4 -4
- package/dist/{MButton-B6eZTfFV.js.map → MButton-LiZRRP4h.js.map} +1 -1
- package/dist/{MColorPickerModal-Dajjf6tH.js → MColorPickerModal-IjciC8zh.js} +185 -185
- package/dist/MColorPickerModal-IjciC8zh.js.map +1 -0
- package/dist/{MDialog-DQvE_JBv.js → MDialog-BLpfgIA3.js} +7 -7
- package/dist/{MDialog-DQvE_JBv.js.map → MDialog-BLpfgIA3.js.map} +1 -1
- package/dist/MIcon-BSsJZhK7.js +116 -0
- package/dist/MIcon-BSsJZhK7.js.map +1 -0
- package/dist/{MIconButton-BBggVwBV.js → MIconButton-CNjN0xwW.js} +18 -18
- package/dist/{MIconButton-BBggVwBV.js.map → MIconButton-CNjN0xwW.js.map} +1 -1
- package/dist/{MListItem-DiOAxaN7.js → MListItem-BBQ-6i3v.js} +139 -139
- package/dist/MListItem-BBQ-6i3v.js.map +1 -0
- package/dist/{MLoadingIndicator-CuTZYFFj.js → MLoadingIndicator-dejdXpu8.js} +2 -2
- package/dist/{MLoadingIndicator-CuTZYFFj.js.map → MLoadingIndicator-dejdXpu8.js.map} +1 -1
- package/dist/MMenuItem-E31tMzOt.js +577 -0
- package/dist/MMenuItem-E31tMzOt.js.map +1 -0
- package/dist/{MPdfViewer-C5ngKPRM.js → MPdfViewer-B5Q9Xs9d.js} +9 -9
- package/dist/{MPdfViewer-C5ngKPRM.js.map → MPdfViewer-B5Q9Xs9d.js.map} +1 -1
- package/dist/{MProgressBar-BWly1UKN.js → MProgressBar-CPrZhQbA.js} +3 -3
- package/dist/{MProgressBar-BWly1UKN.js.map → MProgressBar-CPrZhQbA.js.map} +1 -1
- package/dist/{MSeekBar-BCDQTx2t.js → MSeekBar-NwkuAzx-.js} +2 -2
- package/dist/{MSeekBar-BCDQTx2t.js.map → MSeekBar-NwkuAzx-.js.map} +1 -1
- package/dist/{MSegmentedButton-BXzRsg1S.js → MSegmentedButton-DZuZLBML.js} +4 -4
- package/dist/{MSegmentedButton-BXzRsg1S.js.map → MSegmentedButton-DZuZLBML.js.map} +1 -1
- package/dist/{MSignaturePad-CxOtelzE.js → MSignaturePad-Bqr-1R9f.js} +2 -2
- package/dist/{MSignaturePad-CxOtelzE.js.map → MSignaturePad-Bqr-1R9f.js.map} +1 -1
- package/dist/MSlider-B7dIcHVn.js +745 -0
- package/dist/MSlider-B7dIcHVn.js.map +1 -0
- package/dist/{MSpinner-UCdtSOHP.js → MSpinner-CXLY7lWw.js} +2 -2
- package/dist/{MSpinner-UCdtSOHP.js.map → MSpinner-CXLY7lWw.js.map} +1 -1
- package/dist/{MTextField-CYk9yFvi.js → MTextField-CryHMs8-.js} +18 -18
- package/dist/MTextField-CryHMs8-.js.map +1 -0
- package/dist/MTooltip-Cn_DYm9M.js +90 -0
- package/dist/MTooltip-Cn_DYm9M.js.map +1 -0
- package/dist/{_popupPosition-nL8SVKPK.js → _popupPosition-C_lxj9qU.js} +7 -7
- package/dist/_popupPosition-C_lxj9qU.js.map +1 -0
- package/dist/{_useFieldValidation-B0B44M_t.js → _useFieldValidation-CvZnZfl-.js} +2 -2
- package/dist/{_useFieldValidation-B0B44M_t.js.map → _useFieldValidation-CvZnZfl-.js.map} +1 -1
- package/dist/api.json +1 -1
- package/dist/code-editor.js +129 -128
- package/dist/code-editor.js.map +1 -1
- package/dist/components/MAddressField.vue.d.ts +1 -1
- package/dist/components/MAudioPlayer.vue.d.ts +1 -1
- package/dist/components/MAutocomplete.vue.d.ts +1 -1
- package/dist/components/MAvailabilityCalendar.vue.d.ts +3 -3
- package/dist/components/MBadge.vue.d.ts +2 -2
- package/dist/components/MBar.vue.d.ts +1 -1
- package/dist/components/MBeforeAfter.vue.d.ts +3 -3
- package/dist/components/MButton.vue.d.ts +1 -1
- package/dist/components/MCalendarHeatmap.vue.d.ts +1 -1
- package/dist/components/MChatBubble.vue.d.ts +1 -1
- package/dist/components/MCodeEditor.vue.d.ts +1 -1
- package/dist/components/MContainerTransform.vue.d.ts +1 -1
- package/dist/components/MCopyButton.vue.d.ts +2 -2
- package/dist/components/MCountrySelect.vue.d.ts +1 -1
- package/dist/components/MCreditCardInput.vue.d.ts +2 -2
- package/dist/components/MDiffViewer.vue.d.ts +1 -1
- package/dist/components/MDrawCanvas.vue.d.ts +2 -2
- package/dist/components/MExpansionPanel.vue.d.ts +1 -1
- package/dist/components/MExportButton.vue.d.ts +1 -1
- package/dist/components/MFab.vue.d.ts +1 -1
- package/dist/components/MFilterBuilder.vue.d.ts +1 -1
- package/dist/components/MFlex.vue.d.ts +2 -2
- package/dist/components/MFloorPlan.vue.d.ts +2 -2
- package/dist/components/MFlow.vue.d.ts +2 -2
- package/dist/components/MFormRenderer.vue.d.ts +2 -2
- package/dist/components/MGantt.vue.d.ts +2 -2
- package/dist/components/MGanttControls.vue.d.ts +1 -1
- package/dist/components/MGrid.vue.d.ts +1 -1
- package/dist/components/MIcon.vue.d.ts +3 -5
- package/dist/components/MIconButton.vue.d.ts +1 -1
- package/dist/components/MLightbox.vue.d.ts +2 -2
- package/dist/components/MMapMeasure.vue.d.ts +2 -2
- package/dist/components/MMenu.vue.d.ts +6 -3
- package/dist/components/MMortgageCalculator.vue.d.ts +2 -2
- package/dist/components/MMultiAutocomplete.vue.d.ts +1 -1
- package/dist/components/MMultiSelect.vue.d.ts +1 -1
- package/dist/components/MNavigationDrawer.vue.d.ts +5 -4
- package/dist/components/MNavigationRail.vue.d.ts +1 -1
- package/dist/components/MNumberField.vue.d.ts +1 -1
- package/dist/components/MOdontogram.vue.d.ts +2 -2
- package/dist/components/MPhoneInput.vue.d.ts +2 -2
- package/dist/components/MPinInput.vue.d.ts +3 -3
- package/dist/components/MPosKeypad.vue.d.ts +1 -1
- package/dist/components/MProductConfigurator.vue.d.ts +1 -1
- package/dist/components/MResourceTimeline.vue.d.ts +2 -2
- package/dist/components/MRichTextEditor.vue.d.ts +1 -1
- package/dist/components/MScheme.vue.d.ts +1 -1
- package/dist/components/MSearchBar.vue.d.ts +2 -2
- package/dist/components/MSearchField.vue.d.ts +1 -1
- package/dist/components/MSeatMap.vue.d.ts +1 -1
- package/dist/components/MSeekBar.vue.d.ts +2 -2
- package/dist/components/MSelect.vue.d.ts +1 -1
- package/dist/components/MShortNavigationBar.vue.d.ts +1 -1
- package/dist/components/MSkeleton.vue.d.ts +1 -1
- package/dist/components/MSpreadsheet.vue.d.ts +2 -2
- package/dist/components/MStack.vue.d.ts +2 -2
- package/dist/components/MSubtitle.vue.d.ts +1 -1
- package/dist/components/MSwipeToDismiss.vue.d.ts +1 -1
- package/dist/components/MSwitch.vue.d.ts +1 -1
- package/dist/components/MTagInput.vue.d.ts +1 -1
- package/dist/components/MText.vue.d.ts +1 -1
- package/dist/components/MTextField.vue.d.ts +3 -3
- package/dist/components/MTimeScroll.vue.d.ts +1 -1
- package/dist/components/MTimezoneSelect.vue.d.ts +1 -1
- package/dist/components/MTitle.vue.d.ts +1 -1
- package/dist/components/MToolbar.vue.d.ts +1 -1
- package/dist/components/MTooltip.vue.d.ts +1 -1
- package/dist/components/MTopAppBar.vue.d.ts +2 -2
- package/dist/components/MVitalsChart.vue.d.ts +1 -1
- package/dist/components/MWindow.vue.d.ts +3 -3
- package/dist/components/_MDrawerItemList.vue.d.ts +8 -1
- package/dist/composables/_fieldLayout.d.ts +8 -8
- package/dist/composables/_popupPosition.d.ts +3 -2
- package/dist/composables/_rtl.d.ts +26 -0
- package/dist/composables/useColorPalette.d.ts +1 -1
- package/dist/composables/useLocale.d.ts +4 -0
- package/dist/draw.js +5 -5
- package/dist/flow.js +2 -2
- package/dist/gantt.js +3 -3
- package/dist/locales/ar.d.ts +6 -0
- package/dist/locales/index.d.ts +1 -0
- package/dist/locales/index.js +768 -1
- package/dist/locales/index.js.map +1 -1
- package/dist/m3ui-vue.css +1 -1
- package/dist/m3ui.js +11961 -12040
- package/dist/m3ui.js.map +1 -1
- package/dist/map.js +1127 -1149
- package/dist/map.js.map +1 -1
- package/dist/markdown.js +1 -1
- package/dist/markdown.js.map +1 -1
- package/dist/media.js +7 -7
- package/dist/pdf-sign.js +9 -9
- package/dist/pdf.js +1 -1
- package/dist/plugin.d.ts +8 -0
- package/dist/rich-text-editor.js +79 -78
- package/dist/rich-text-editor.js.map +1 -1
- package/dist/styles/theme.css +13 -0
- package/dist/styles.css +1 -1
- package/dist/terminal.js +5 -2
- package/dist/terminal.js.map +1 -1
- package/dist/{useLocale-DL96OFgr.js → useLocale-ybIju59R.js} +3 -1
- package/dist/useLocale-ybIju59R.js.map +1 -0
- package/dist/vTooltip-xESB2YOb.js +154 -0
- package/dist/vTooltip-xESB2YOb.js.map +1 -0
- package/package.json +1 -1
- package/src/__tests__/MAddressField.test.ts +1 -1
- package/src/__tests__/MChip.test.ts +3 -3
- package/src/__tests__/MFab.test.ts +6 -6
- package/src/__tests__/MListItemNestedControl.test.ts +2 -2
- package/src/__tests__/MScheduler.test.ts +1 -1
- package/src/__tests__/MTrackingTimeline.test.ts +1 -1
- package/src/__tests__/MWindow.test.ts +16 -0
- package/src/__tests__/fieldOverflow.test.ts +9 -9
- package/src/__tests__/hydration.test.ts +39 -0
- package/src/__tests__/localePresets.test.ts +2 -0
- package/src/__tests__/rtl.test.ts +167 -0
- package/src/__tests__/ssr.test.ts +6 -0
- package/src/components/MAlert.vue +1 -1
- package/src/components/MAutocomplete.vue +7 -7
- package/src/components/MAvailabilityCalendar.vue +5 -3
- package/src/components/MBadge.vue +12 -3
- package/src/components/MBar.vue +1 -1
- package/src/components/MBottomAppBar.vue +1 -1
- package/src/components/MCalendar.vue +3 -3
- package/src/components/MCalendarHeatmap.vue +3 -3
- package/src/components/MChatBubble.vue +3 -3
- package/src/components/MChip.vue +6 -6
- package/src/components/MCodeEditor.vue +7 -3
- package/src/components/MColorPicker.vue +1 -1
- package/src/components/MCommandPalette.vue +1 -1
- package/src/components/MContainerTransform.vue +1 -1
- package/src/components/MContextMenu.vue +1 -1
- package/src/components/MDataTable.vue +5 -5
- package/src/components/MDatePicker.vue +3 -2
- package/src/components/MDateRangePicker.vue +3 -2
- package/src/components/MDialog.vue +5 -5
- package/src/components/MDiffViewer.vue +1 -1
- package/src/components/MDivider.vue +1 -1
- package/src/components/MDragDropList.vue +1 -1
- package/src/components/MEmojiSelector.vue +11 -7
- package/src/components/MExpansionPanel.vue +1 -1
- package/src/components/MFab.vue +5 -5
- package/src/components/MFormBuilder.vue +3 -3
- package/src/components/MIcon.vue +14 -2
- package/src/components/MJsonEditor.vue +1 -3
- package/src/components/MJsonViewer.vue +1 -1
- package/src/components/MKanban.vue +2 -1
- package/src/components/MListDetail.vue +2 -2
- package/src/components/MListGroup.vue +1 -1
- package/src/components/MListItem.vue +5 -5
- package/src/components/MListSubheader.vue +1 -1
- package/src/components/MMapDraw.vue +3 -2
- package/src/components/MMapHover.vue +2 -1
- package/src/components/MMapMeasure.vue +2 -1
- package/src/components/MMapRoute.vue +2 -1
- package/src/components/MMarkdown.vue +9 -6
- package/src/components/MMaskField.vue +6 -6
- package/src/components/MMenu.vue +13 -6
- package/src/components/MMenuItem.vue +8 -6
- package/src/components/MMultiAutocomplete.vue +9 -8
- package/src/components/MMultiSelect.vue +9 -8
- package/src/components/MNavigationDrawer.vue +39 -27
- package/src/components/MNavigationRail.vue +28 -19
- package/src/components/MNavigationSuite.vue +1 -1
- package/src/components/MNotificationCenter.vue +1 -1
- package/src/components/MNotificationHost.vue +1 -1
- package/src/components/MNumberField.vue +6 -6
- package/src/components/MOrderTicket.vue +1 -1
- package/src/components/MPageProgress.vue +1 -1
- package/src/components/MPhoneInput.vue +5 -4
- package/src/components/MPinInput.vue +3 -2
- package/src/components/MPosKeypad.vue +2 -1
- package/src/components/MProductConfigurator.vue +2 -1
- package/src/components/MProgressBar.vue +2 -2
- package/src/components/MRichTextEditor.vue +8 -4
- package/src/components/MScheduler.vue +14 -14
- package/src/components/MSearchField.vue +1 -1
- package/src/components/MSeatMap.vue +2 -1
- package/src/components/MSegmentedButton.vue +1 -1
- package/src/components/MSelect.vue +7 -7
- package/src/components/MSideSheet.vue +3 -2
- package/src/components/MSimpleCarousel.vue +20 -11
- package/src/components/MSlider.vue +15 -5
- package/src/components/MSnackbar.vue +2 -2
- package/src/components/MSplitButton.vue +3 -2
- package/src/components/MSplitter.vue +6 -3
- package/src/components/MSpotlightSearch.vue +1 -1
- package/src/components/MSwitch.vue +5 -5
- package/src/components/MTable.vue +3 -3
- package/src/components/MTabs.vue +4 -1
- package/src/components/MTagInput.vue +6 -6
- package/src/components/MTerminal.vue +1 -1
- package/src/components/MText.vue +1 -1
- package/src/components/MTextField.vue +7 -7
- package/src/components/MTimePicker.vue +3 -2
- package/src/components/MTimePickerModal.vue +2 -2
- package/src/components/MTimeScroll.vue +1 -1
- package/src/components/MTimeline.vue +12 -12
- package/src/components/MToolbar.vue +3 -3
- package/src/components/MTrackingTimeline.vue +3 -2
- package/src/components/MTransition.vue +8 -3
- package/src/components/MTreeTable.vue +1 -1
- package/src/components/MTypewriter.vue +1 -1
- package/src/components/MVirtualTable.vue +2 -2
- package/src/components/MWindow.vue +4 -3
- package/src/components/_MColorPanel.vue +5 -4
- package/src/components/_MDrawerItemList.vue +9 -5
- package/src/components/_MMapAttribution.vue +2 -1
- package/src/components/_MMonthYearButton.vue +1 -1
- package/src/components/_MTransferPane.vue +8 -1
- package/src/components/_MTreeNode.vue +3 -3
- package/src/components/_MYearGrid.vue +4 -2
- package/src/composables/_fieldLayout.ts +19 -19
- package/src/composables/_popupPosition.ts +5 -3
- package/src/composables/_rtl.ts +76 -0
- package/src/composables/_useMenuNav.ts +24 -17
- package/src/composables/_useSheetMotion.ts +10 -3
- package/src/composables/useLocale.ts +6 -0
- package/src/locales/ar.ts +798 -0
- package/src/locales/de.ts +2 -0
- package/src/locales/es.ts +2 -0
- package/src/locales/fr.ts +2 -0
- package/src/locales/index.ts +1 -0
- package/src/locales/ja.ts +2 -0
- package/src/locales/ko.ts +2 -0
- package/src/locales/pt.ts +2 -0
- package/src/locales/zh.ts +2 -0
- package/src/plugin.ts +10 -0
- package/src/styles/theme.css +13 -0
- package/dist/MColorPickerModal-Dajjf6tH.js.map +0 -1
- package/dist/MIcon-DpajuUTJ.js +0 -33
- package/dist/MIcon-DpajuUTJ.js.map +0 -1
- package/dist/MListItem-DiOAxaN7.js.map +0 -1
- package/dist/MMenuItem-BuxYoASE.js +0 -574
- package/dist/MMenuItem-BuxYoASE.js.map +0 -1
- package/dist/MSlider-D_O8J9YH.js +0 -739
- package/dist/MSlider-D_O8J9YH.js.map +0 -1
- package/dist/MTextField-CYk9yFvi.js.map +0 -1
- package/dist/MTooltip-CK39Zon4.js +0 -183
- package/dist/MTooltip-CK39Zon4.js.map +0 -1
- package/dist/_popupPosition-nL8SVKPK.js.map +0 -1
- package/dist/useLocale-DL96OFgr.js.map +0 -1
|
@@ -16,11 +16,14 @@
|
|
|
16
16
|
*/
|
|
17
17
|
import { ref, reactive, watch, provide, computed, nextTick, onBeforeUnmount } from "vue";
|
|
18
18
|
import MIcon from "./MIcon.vue";
|
|
19
|
+
import { vTooltip } from '../directives/vTooltip'
|
|
20
|
+
import type { TooltipPlacement } from '../composables/_tooltipTrigger'
|
|
19
21
|
import MBadge from "./MBadge.vue";
|
|
20
22
|
import MDrawerItemList from "./_MDrawerItemList.vue";
|
|
21
23
|
import { motionSprings, type SpringSpec } from "../composables/motion";
|
|
22
24
|
import { sampleSpring, sampleAt, playSamples, prefersReducedMotion } from "../composables/_springAnimation";
|
|
23
25
|
import { useScrollLock } from '../composables/_useScrollLock'
|
|
26
|
+
import { useDocumentRtl } from '../composables/_rtl'
|
|
24
27
|
|
|
25
28
|
export interface DrawerItem {
|
|
26
29
|
value: string | number;
|
|
@@ -67,10 +70,11 @@ const props = withDefaults(
|
|
|
67
70
|
/** Custom drawer width (e.g. "320px", "25rem"). Defaults to 22.5rem (360px) */
|
|
68
71
|
width?: string;
|
|
69
72
|
/**
|
|
70
|
-
* Which side the drawer opens from.
|
|
71
|
-
* variant
|
|
73
|
+
* Which side the drawer opens from. `start` is the left edge, or the right one in a right-to-left page, and
|
|
74
|
+
* `end` the other one. Top/bottom are only available for the modal variant — the inline variant always
|
|
75
|
+
* renders on one side.
|
|
72
76
|
*/
|
|
73
|
-
side?: 'left' | 'right' | 'top' | 'bottom';
|
|
77
|
+
side?: 'start' | 'end' | 'left' | 'right' | 'top' | 'bottom';
|
|
74
78
|
/** Lets the modal drawer be swiped closed toward its edge; with false it only closes through v-model or the scrim */
|
|
75
79
|
swipeEnabled?: boolean;
|
|
76
80
|
/** Opens the groups that hold the selected item (and the selected item, if it's a group) whenever `selected` changes */
|
|
@@ -78,7 +82,7 @@ const props = withDefaults(
|
|
|
78
82
|
/** Keeps one group open per level: opening a group, by hand or through `expandSelected`, closes its siblings */
|
|
79
83
|
accordion?: boolean;
|
|
80
84
|
}>(),
|
|
81
|
-
{ modal: true, side: '
|
|
85
|
+
{ modal: true, side: 'start', swipeEnabled: true, expandSelected: true, accordion: false },
|
|
82
86
|
);
|
|
83
87
|
|
|
84
88
|
const emit = defineEmits<{
|
|
@@ -181,7 +185,12 @@ function subLeave(el: Element, done: () => void) {
|
|
|
181
185
|
).onfinish = done
|
|
182
186
|
}
|
|
183
187
|
|
|
184
|
-
|
|
188
|
+
// start/end resolved to the physical edge the drawer sits on, slides from and is swiped toward
|
|
189
|
+
const rtl = useDocumentRtl()
|
|
190
|
+
const physicalSide = computed(() =>
|
|
191
|
+
props.side === 'start' ? (rtl.value ? 'right' : 'left') : props.side === 'end' ? (rtl.value ? 'left' : 'right') : props.side,
|
|
192
|
+
)
|
|
193
|
+
const inlineSide = computed(() => physicalSide.value === 'left' || physicalSide.value === 'right' ? physicalSide.value : 'left')
|
|
185
194
|
const collapsedRef = computed(() => props.collapsed ?? false)
|
|
186
195
|
provide("nd-open-items", openItems);
|
|
187
196
|
provide("nd-toggle-item", onChildToggle);
|
|
@@ -191,6 +200,9 @@ provide("nd-collapsed", collapsedRef);
|
|
|
191
200
|
const rail = computed(() => !props.modal && collapsedRef.value && !!props.collapsedLabels)
|
|
192
201
|
provide("nd-rail", rail);
|
|
193
202
|
provide("nd-collapsed-labels", computed(() => !props.modal && !!props.collapsedLabels));
|
|
203
|
+
// A collapsed item's tooltip opens beside it, toward the content
|
|
204
|
+
const tooltipPlacement = computed<TooltipPlacement>(() => (inlineSide.value === 'right' ? 'left' : 'right'))
|
|
205
|
+
provide("nd-tooltip-placement", tooltipPlacement);
|
|
194
206
|
|
|
195
207
|
// A collapsed item's badge sits on its icon: a number as a count, anything else ("New") as a dot
|
|
196
208
|
function badgeProps(badge: string | number) {
|
|
@@ -230,14 +242,14 @@ let scrimAnim: Animation | null = null
|
|
|
230
242
|
let samples: number[] = []
|
|
231
243
|
let settled: (() => void) | null = null
|
|
232
244
|
|
|
233
|
-
const horizontal = () =>
|
|
245
|
+
const horizontal = () => physicalSide.value === "left" || physicalSide.value === "right";
|
|
234
246
|
const transformAt = (p: number) => (horizontal() ? `translateX(${p * 100}%)` : `translateY(${p * 100}%)`);
|
|
235
247
|
const opacityAt = (p: number) => String(Math.min(1, Math.max(0, 1 - p / closedDir)));
|
|
236
248
|
|
|
237
249
|
function bindModal(root: Element) {
|
|
238
250
|
panelEl = root.querySelector<HTMLElement>(".nd-panel");
|
|
239
251
|
scrimEl = root.querySelector<HTMLElement>(".nd-scrim");
|
|
240
|
-
closedDir =
|
|
252
|
+
closedDir = physicalSide.value === "left" || physicalSide.value === "top" ? -1 : 1;
|
|
241
253
|
}
|
|
242
254
|
|
|
243
255
|
function writeModal() {
|
|
@@ -298,11 +310,11 @@ let listEl: HTMLElement | null = null;
|
|
|
298
310
|
function updateListTouchAction() {
|
|
299
311
|
const list = listEl;
|
|
300
312
|
if (!list || horizontal() || !props.swipeEnabled) return;
|
|
301
|
-
const atEdge =
|
|
313
|
+
const atEdge = physicalSide.value === "bottom"
|
|
302
314
|
? list.scrollTop <= 0
|
|
303
315
|
: list.scrollTop + list.clientHeight >= list.scrollHeight - 1;
|
|
304
316
|
const directional = typeof CSS !== "undefined" && !!CSS.supports?.("touch-action", "pan-down");
|
|
305
|
-
list.style.touchAction = atEdge && directional ? (
|
|
317
|
+
list.style.touchAction = atEdge && directional ? (physicalSide.value === "bottom" ? "pan-down" : "pan-up") : "pan-y";
|
|
306
318
|
}
|
|
307
319
|
|
|
308
320
|
// Expanding a section or item changes how far the list scrolls without a scroll event: re-check once it settles
|
|
@@ -479,9 +491,9 @@ function onPanelClickCapture(e: MouseEvent) {
|
|
|
479
491
|
v-if="modelValue"
|
|
480
492
|
class="fixed inset-0 z-100 flex"
|
|
481
493
|
:class="[
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
494
|
+
(physicalSide === 'right' && !rtl) || (physicalSide === 'left' && rtl) ? 'justify-end' : '',
|
|
495
|
+
physicalSide === 'bottom' ? 'flex-col justify-end' : '',
|
|
496
|
+
physicalSide === 'top' ? 'flex-col' : '',
|
|
485
497
|
]"
|
|
486
498
|
>
|
|
487
499
|
<!-- will-change: a drag writes their transform/opacity directly, without the layer an animation gets -->
|
|
@@ -491,14 +503,14 @@ function onPanelClickCapture(e: MouseEvent) {
|
|
|
491
503
|
v-bind="$attrs"
|
|
492
504
|
:class="[
|
|
493
505
|
'nd-panel relative flex flex-col bg-surface-container-low shadow-elevation-1 will-change-transform',
|
|
494
|
-
|
|
506
|
+
physicalSide === 'top' || physicalSide === 'bottom'
|
|
495
507
|
? 'w-full max-h-[85vh]'
|
|
496
508
|
: 'h-full max-w-[85vw]',
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
swipeEnabled ? (
|
|
509
|
+
physicalSide === 'top' || physicalSide === 'bottom' || width ? '' : 'w-[22.5rem]',
|
|
510
|
+
physicalSide === 'right' ? 'rounded-l-lg' : physicalSide === 'left' ? 'rounded-r-lg' : physicalSide === 'bottom' ? 'rounded-t-lg' : '',
|
|
511
|
+
swipeEnabled ? (physicalSide === 'left' || physicalSide === 'right' ? 'touch-pan-y' : 'touch-none') : '',
|
|
500
512
|
]"
|
|
501
|
-
:style="
|
|
513
|
+
:style="physicalSide !== 'top' && physicalSide !== 'bottom' && width ? { width } : undefined"
|
|
502
514
|
@pointerdown="onPanelPointerDown"
|
|
503
515
|
@pointermove="onPanelPointerMove"
|
|
504
516
|
@pointerup="onPanelPointerUp"
|
|
@@ -541,7 +553,7 @@ function onPanelClickCapture(e: MouseEvent) {
|
|
|
541
553
|
:size="24"
|
|
542
554
|
class="shrink-0"
|
|
543
555
|
/>
|
|
544
|
-
<span class="flex-1 text-
|
|
556
|
+
<span class="flex-1 text-start text-title-small font-medium">{{
|
|
545
557
|
section.title
|
|
546
558
|
}}</span>
|
|
547
559
|
<MIcon
|
|
@@ -570,9 +582,9 @@ function onPanelClickCapture(e: MouseEvent) {
|
|
|
570
582
|
:is="itemTag(item)"
|
|
571
583
|
:to="item.to && !item.disabled ? item.to : undefined"
|
|
572
584
|
:type="item.to ? undefined : 'button'"
|
|
573
|
-
class="flex w-full items-center gap-3 rounded-full py-4 text-
|
|
585
|
+
class="flex w-full items-center gap-3 rounded-full py-4 text-start transition-colors focus-visible:outline-none"
|
|
574
586
|
:class="[
|
|
575
|
-
section.collapsible ? '
|
|
587
|
+
section.collapsible ? 'ps-8 pe-3' : 'px-4',
|
|
576
588
|
item.disabled
|
|
577
589
|
? 'cursor-not-allowed opacity-[0.38]'
|
|
578
590
|
: item.value === selected
|
|
@@ -675,7 +687,7 @@ function onPanelClickCapture(e: MouseEvent) {
|
|
|
675
687
|
type="button"
|
|
676
688
|
class="mt-1 flex w-full shrink-0 cursor-pointer items-center gap-3 overflow-hidden whitespace-nowrap rounded-xl py-2.5 text-on-surface-variant hover:bg-on-surface/8"
|
|
677
689
|
:class="rail ? 'px-4' : 'px-3'"
|
|
678
|
-
|
|
690
|
+
v-tooltip="{ text: section.title, disabled: !collapsed || rail, placement: tooltipPlacement }"
|
|
679
691
|
@click="toggleSection(section, si)"
|
|
680
692
|
>
|
|
681
693
|
<MIcon
|
|
@@ -685,7 +697,7 @@ function onPanelClickCapture(e: MouseEvent) {
|
|
|
685
697
|
class="shrink-0"
|
|
686
698
|
/>
|
|
687
699
|
<span
|
|
688
|
-
class="nd-label min-w-0 flex-1 text-
|
|
700
|
+
class="nd-label min-w-0 flex-1 text-start text-title-small font-medium"
|
|
689
701
|
>{{ section.title }}</span
|
|
690
702
|
>
|
|
691
703
|
<MIcon
|
|
@@ -715,12 +727,12 @@ function onPanelClickCapture(e: MouseEvent) {
|
|
|
715
727
|
:is="itemTag(item)"
|
|
716
728
|
:to="item.to && !item.disabled ? item.to : undefined"
|
|
717
729
|
:type="item.to ? undefined : 'button'"
|
|
718
|
-
|
|
719
|
-
class="relative flex w-full shrink-0 items-center gap-3 overflow-hidden whitespace-nowrap text-
|
|
730
|
+
v-tooltip="{ text: item.label, disabled: !collapsed || rail, placement: tooltipPlacement }"
|
|
731
|
+
class="relative flex w-full shrink-0 items-center gap-3 overflow-hidden whitespace-nowrap text-start focus-visible:outline-none"
|
|
720
732
|
:class="[
|
|
721
733
|
// Rail look: 56px tall, the icon in a 56×32 pill at the top and the label under it, the
|
|
722
734
|
// icon at the same x as expanded (8 + 16 = 12 + 12) so collapsing never moves it sideways
|
|
723
|
-
rail ? 'px-4 pt-2 pb-6' : ['rounded-full py-4', section.collapsible && !collapsed ? '
|
|
735
|
+
rail ? 'px-4 pt-2 pb-6' : ['rounded-full py-4', section.collapsible && !collapsed ? 'ps-8 pe-3' : 'px-3'],
|
|
724
736
|
item.disabled
|
|
725
737
|
? 'cursor-not-allowed opacity-[0.38]'
|
|
726
738
|
: item.value === selected
|
|
@@ -733,7 +745,7 @@ function onPanelClickCapture(e: MouseEvent) {
|
|
|
733
745
|
<span
|
|
734
746
|
v-if="rail"
|
|
735
747
|
aria-hidden="true"
|
|
736
|
-
class="pointer-events-none absolute
|
|
748
|
+
class="pointer-events-none absolute start-0 top-1 h-8 w-14 rounded-full transition-colors"
|
|
737
749
|
:class="item.value === selected && !item.disabled ? 'bg-secondary-container' : 'group-hover:bg-on-surface/8'"
|
|
738
750
|
/>
|
|
739
751
|
<MBadge
|
|
@@ -768,7 +780,7 @@ function onPanelClickCapture(e: MouseEvent) {
|
|
|
768
780
|
</span>
|
|
769
781
|
<span
|
|
770
782
|
v-if="collapsedLabels"
|
|
771
|
-
class="nd-rail-label pointer-events-none absolute
|
|
783
|
+
class="nd-rail-label pointer-events-none absolute start-0 top-10 w-14 truncate text-center text-label-medium font-medium"
|
|
772
784
|
:class="item.value === selected ? 'text-secondary' : 'text-on-surface-variant'"
|
|
773
785
|
>{{ item.label }}</span>
|
|
774
786
|
</component>
|
|
@@ -15,6 +15,7 @@ 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
17
|
import { useEscapeStack } from '../composables/_useEscapeStack'
|
|
18
|
+
import { isRtl } from '../composables/_rtl'
|
|
18
19
|
|
|
19
20
|
export interface NavRailItem {
|
|
20
21
|
value: string | number
|
|
@@ -195,9 +196,12 @@ let slidePanel: HTMLElement | null = null
|
|
|
195
196
|
let slideScrim: HTMLElement | null = null
|
|
196
197
|
let slideDone: (() => void) | null = null
|
|
197
198
|
|
|
199
|
+
// 1, or -1 when the rail sits at the right edge of a right-to-left page (x stays negative = hidden toward its edge)
|
|
200
|
+
let railDir = 1
|
|
201
|
+
|
|
198
202
|
function setSlide(panel: HTMLElement, scrim: HTMLElement | null, x: number) {
|
|
199
203
|
panelX = x
|
|
200
|
-
panel.style.transform = `translateX(${x * 100}%)`
|
|
204
|
+
panel.style.transform = `translateX(${x * railDir * 100}%)`
|
|
201
205
|
if (scrim) scrim.style.opacity = String(Math.min(1, Math.max(0, 1 + x)))
|
|
202
206
|
}
|
|
203
207
|
|
|
@@ -227,6 +231,7 @@ function slide(el: Element, to: number, done?: () => void) {
|
|
|
227
231
|
if (!panel) return finishSlide()
|
|
228
232
|
if (scrim) scrim.style.transition = 'none'
|
|
229
233
|
stopSlide()
|
|
234
|
+
railDir = isRtl(panel) ? -1 : 1
|
|
230
235
|
const from = panelX
|
|
231
236
|
const v = releaseVelocity
|
|
232
237
|
releaseVelocity = 0
|
|
@@ -234,7 +239,8 @@ function slide(el: Element, to: number, done?: () => void) {
|
|
|
234
239
|
setSlide(panel, scrim, to)
|
|
235
240
|
if (prefersReducedMotion() || from === to) return finishSlide()
|
|
236
241
|
slideSamples = sampleSpring(from, to, v, { dampingRatio: SLIDE_DAMPING, stiffness: SLIDE_STIFFNESS }, 0.001)
|
|
237
|
-
const
|
|
242
|
+
const dir = railDir
|
|
243
|
+
const a = playSamples(panel, slideSamples, (x) => ({ transform: `translateX(${x * dir * 100}%)` }))
|
|
238
244
|
if (!a) return finishSlide()
|
|
239
245
|
slideScrimAnim = playSamples(scrim, slideSamples, (x) => ({ opacity: String(Math.min(1, Math.max(0, 1 + x))) }))
|
|
240
246
|
slideAnim = a
|
|
@@ -250,17 +256,20 @@ function slide(el: Element, to: number, done?: () => void) {
|
|
|
250
256
|
// AnchoredDraggableDefaults: settles at the nearer anchor (positionalThreshold 50%) unless released faster
|
|
251
257
|
// than 125dp/s, which goes the way of the fling
|
|
252
258
|
const FLING_VELOCITY = 125
|
|
259
|
+
// x positions are along the reading direction (clientX times railDir)
|
|
253
260
|
let drag: { id: number; x: number; y: number; startX: number; width: number; active: boolean; samples: { t: number; x: number }[] } | null = null
|
|
254
261
|
let suppressClick = false
|
|
255
262
|
|
|
256
263
|
function onPanelPointerDown(e: PointerEvent) {
|
|
257
264
|
if (!props.hideOnCollapse || e.button !== 0) return
|
|
258
|
-
|
|
265
|
+
railDir = isRtl(e.currentTarget as Element) ? -1 : 1
|
|
266
|
+
const x = e.clientX * railDir
|
|
267
|
+
drag = { id: e.pointerId, x, y: e.clientY, startX: 0, width: 1, active: false, samples: [{ t: e.timeStamp, x }] }
|
|
259
268
|
}
|
|
260
269
|
|
|
261
270
|
function onPanelPointerMove(e: PointerEvent) {
|
|
262
271
|
if (!drag || e.pointerId !== drag.id) return
|
|
263
|
-
const dx = e.clientX - drag.x
|
|
272
|
+
const dx = e.clientX * railDir - drag.x
|
|
264
273
|
const dy = e.clientY - drag.y
|
|
265
274
|
if (!drag.active) {
|
|
266
275
|
if (Math.abs(dy) > 8 && Math.abs(dy) > Math.abs(dx)) { drag = null; return }
|
|
@@ -276,7 +285,7 @@ function onPanelPointerMove(e: PointerEvent) {
|
|
|
276
285
|
const scrim = panel.parentElement?.querySelector<HTMLElement>('.wnr-scrim') ?? null
|
|
277
286
|
if (scrim) scrim.style.transition = 'none'
|
|
278
287
|
setSlide(panel, scrim, Math.min(0, Math.max(-1, drag.startX + dx / drag.width)))
|
|
279
|
-
drag.samples.push({ t: e.timeStamp, x: e.clientX })
|
|
288
|
+
drag.samples.push({ t: e.timeStamp, x: e.clientX * railDir })
|
|
280
289
|
drag.samples = drag.samples.filter((p) => e.timeStamp - p.t < 100)
|
|
281
290
|
}
|
|
282
291
|
|
|
@@ -377,7 +386,7 @@ useScrollLock(() => props.modal && props.expanded)
|
|
|
377
386
|
v-if="!(modal && hideOnCollapse)"
|
|
378
387
|
ref="railEl"
|
|
379
388
|
v-bind="$attrs"
|
|
380
|
-
class="flex h-full flex-col border-
|
|
389
|
+
class="flex h-full flex-col border-e border-outline-variant bg-surface transition-[width] duration-200"
|
|
381
390
|
:class="railExpanded ? '' : 'w-20'"
|
|
382
391
|
:style="railExpanded ? { width: `${expandedWidth}px` } : undefined"
|
|
383
392
|
>
|
|
@@ -435,10 +444,10 @@ useScrollLock(() => props.modal && props.expanded)
|
|
|
435
444
|
hugging automatic: as the label's own overflow-hidden box animates its width from 0,
|
|
436
445
|
the pill (inline-flex, no explicit width) resizes right along with it via ordinary
|
|
437
446
|
flex layout — no separate width bookkeeping needed. The pill is always left-anchored
|
|
438
|
-
with a constant `
|
|
447
|
+
with a constant `ps-4`, so the icon's horizontal position never moves at all.
|
|
439
448
|
|
|
440
449
|
The pill NEVER gets an explicit width, collapsed included: collapsed it's
|
|
441
|
-
|
|
450
|
+
ps-4 + 24px icon + pe-4 + a 0-wide label = exactly 56dp, the same as the old `w-14`.
|
|
442
451
|
Switching `auto` <-> `w-14` can't be transitioned (auto isn't interpolable), so on
|
|
443
452
|
collapse the pill snapped to 56px on the first frame and flex-shrink squeezed the
|
|
444
453
|
still-visible label to 0, which then regrew a few px before clipping away — the
|
|
@@ -446,7 +455,7 @@ useScrollLock(() => props.modal && props.expanded)
|
|
|
446
455
|
states means it only ever follows the label's own animated width.
|
|
447
456
|
-->
|
|
448
457
|
<span
|
|
449
|
-
class="absolute
|
|
458
|
+
class="absolute start-0 inline-flex items-center ps-4 pe-4 rounded-full transition-all duration-200"
|
|
450
459
|
:class="[
|
|
451
460
|
railExpanded ? 'top-1 h-14' : 'top-1.5 h-8',
|
|
452
461
|
item.value === modelValue
|
|
@@ -481,11 +490,11 @@ useScrollLock(() => props.modal && props.expanded)
|
|
|
481
490
|
-->
|
|
482
491
|
<span
|
|
483
492
|
class="grid transition-[grid-template-columns,opacity,margin-left] duration-200"
|
|
484
|
-
:class="railExpanded ? '
|
|
493
|
+
:class="railExpanded ? 'ms-2 grid-cols-[1fr] opacity-100' : 'ms-0 grid-cols-[0fr] opacity-0'"
|
|
485
494
|
>
|
|
486
495
|
<span
|
|
487
496
|
data-rail-label
|
|
488
|
-
class="min-w-0 overflow-hidden text-ellipsis whitespace-nowrap text-
|
|
497
|
+
class="min-w-0 overflow-hidden text-ellipsis whitespace-nowrap text-start text-label-large font-medium"
|
|
489
498
|
:style="{ maxWidth: `${LABEL_MAX}px` }"
|
|
490
499
|
:class="item.value === modelValue ? 'text-secondary' : 'text-on-surface-variant'"
|
|
491
500
|
>
|
|
@@ -496,7 +505,7 @@ useScrollLock(() => props.modal && props.expanded)
|
|
|
496
505
|
|
|
497
506
|
<!-- Label, collapsed: stays put below the icon, just fades out when expanding -->
|
|
498
507
|
<span
|
|
499
|
-
class="pointer-events-none absolute
|
|
508
|
+
class="pointer-events-none absolute start-0 top-[42px] w-14 truncate text-center text-label-medium font-medium transition-opacity duration-150"
|
|
500
509
|
:class="[
|
|
501
510
|
railExpanded ? 'opacity-0' : 'opacity-100',
|
|
502
511
|
item.value === modelValue ? 'text-secondary' : 'text-on-surface-variant',
|
|
@@ -512,10 +521,10 @@ useScrollLock(() => props.modal && props.expanded)
|
|
|
512
521
|
Modal panel: ModalWideNavigationRail's expanded state (default hideOnCollapse=false
|
|
513
522
|
variant). Floats above the app with its own scrim — `NavigationRailExpandedTokens`:
|
|
514
523
|
ModalContainerColor = surface-container, ModalContainerElevation = Level2. Flush against
|
|
515
|
-
the screen edge (`inset-y-0
|
|
524
|
+
the screen edge (`inset-y-0 start-0`), same as the collapsed rail and MNavigationDrawer —
|
|
516
525
|
confirmed against the real M3 demo app/reference video, not floating with a margin as an
|
|
517
526
|
earlier version of this comment assumed from the token name alone. Only the far (right)
|
|
518
|
-
corners are rounded (`rounded-
|
|
527
|
+
corners are rounded (`rounded-e-lg`): rounding the near/screen-edge corners too would be
|
|
519
528
|
invisible anyway since they're flush against the viewport edge. Item markup below is
|
|
520
529
|
intentionally a near-duplicate of the inline rail's (see the top-of-file "not DRY" note
|
|
521
530
|
in CLAUDE.md for pickers/modals) — check here too if fixing a pill/label bug above.
|
|
@@ -526,7 +535,7 @@ useScrollLock(() => props.modal && props.expanded)
|
|
|
526
535
|
<div class="wnr-scrim absolute inset-0 bg-scrim/32" @click="close" />
|
|
527
536
|
|
|
528
537
|
<nav
|
|
529
|
-
class="wnr-panel fixed inset-y-0
|
|
538
|
+
class="wnr-panel fixed inset-y-0 start-0 z-10 flex flex-col overflow-hidden rounded-e-lg bg-surface-container shadow-elevation-2"
|
|
530
539
|
:class="hideOnCollapse ? 'touch-pan-y' : ''"
|
|
531
540
|
:style="hideOnCollapse ? { width: `${expandedWidth}px` } : undefined"
|
|
532
541
|
@pointerdown="onPanelPointerDown"
|
|
@@ -570,7 +579,7 @@ useScrollLock(() => props.modal && props.expanded)
|
|
|
570
579
|
@click="selectModal(item)"
|
|
571
580
|
>
|
|
572
581
|
<span
|
|
573
|
-
class="absolute
|
|
582
|
+
class="absolute start-0 inline-flex items-center ps-4 pe-4 rounded-full transition-all duration-200"
|
|
574
583
|
:class="[
|
|
575
584
|
panelExpanded ? 'top-1 h-14' : 'top-1.5 h-8',
|
|
576
585
|
item.value === modelValue
|
|
@@ -588,11 +597,11 @@ useScrollLock(() => props.modal && props.expanded)
|
|
|
588
597
|
|
|
589
598
|
<span
|
|
590
599
|
class="grid transition-[grid-template-columns,opacity,margin-left] duration-200"
|
|
591
|
-
:class="panelExpanded ? '
|
|
600
|
+
:class="panelExpanded ? 'ms-2 grid-cols-[1fr] opacity-100' : 'ms-0 grid-cols-[0fr] opacity-0'"
|
|
592
601
|
>
|
|
593
602
|
<span
|
|
594
603
|
data-rail-label
|
|
595
|
-
class="min-w-0 overflow-hidden text-ellipsis whitespace-nowrap text-
|
|
604
|
+
class="min-w-0 overflow-hidden text-ellipsis whitespace-nowrap text-start text-label-large font-medium"
|
|
596
605
|
:style="{ maxWidth: `${LABEL_MAX}px` }"
|
|
597
606
|
:class="item.value === modelValue ? 'text-secondary' : 'text-on-surface-variant'"
|
|
598
607
|
>
|
|
@@ -603,7 +612,7 @@ useScrollLock(() => props.modal && props.expanded)
|
|
|
603
612
|
|
|
604
613
|
<!-- Label, collapsed: stays put below the icon, just fades out when expanding -->
|
|
605
614
|
<span
|
|
606
|
-
class="pointer-events-none absolute
|
|
615
|
+
class="pointer-events-none absolute start-0 top-[42px] w-14 truncate text-center text-label-medium font-medium transition-opacity duration-150"
|
|
607
616
|
:class="[
|
|
608
617
|
panelExpanded ? 'opacity-0' : 'opacity-100',
|
|
609
618
|
item.value === modelValue ? 'text-secondary' : 'text-on-surface-variant',
|
|
@@ -88,7 +88,7 @@ const isBar = computed(() => resolved.value === 'bar' || resolved.value === 'bar
|
|
|
88
88
|
<div class="min-h-0 flex-1 overflow-auto">
|
|
89
89
|
<slot :layout="resolved" />
|
|
90
90
|
</div>
|
|
91
|
-
<div v-if="!isRail && $slots.fab" class="absolute
|
|
91
|
+
<div v-if="!isRail && $slots.fab" class="absolute end-4 bottom-4">
|
|
92
92
|
<slot name="fab" />
|
|
93
93
|
</div>
|
|
94
94
|
</div>
|
|
@@ -240,7 +240,7 @@ const ROLE_BG = {
|
|
|
240
240
|
</slot>
|
|
241
241
|
<span v-if="!n.read" class="mt-2 size-2 shrink-0 rounded-full bg-primary" aria-hidden="true" />
|
|
242
242
|
<!-- Floating over the row on hover / focus, so they take no room from the text -->
|
|
243
|
-
<span class="absolute
|
|
243
|
+
<span class="absolute end-2 top-1/2 flex -translate-y-1/2 rounded-full bg-surface-container-high opacity-0 shadow-elevation-1 transition-opacity focus-within:opacity-100 group-hover:opacity-100 max-md:hidden">
|
|
244
244
|
<MIconButton :icon="n.read ? 'mark_email_unread' : 'mark_email_read'" :label="n.read ? t.notifMarkUnread : t.notifMarkRead" size="sm" @click.stop="update(n.id, { read: !n.read })" />
|
|
245
245
|
<MIconButton v-if="dismissible" icon="close" :label="t.notifDismiss" size="sm" @click.stop="dismiss(n)" />
|
|
246
246
|
</span>
|
|
@@ -55,7 +55,7 @@ const getStyle = (variant: string) => variantStyles[variant] ?? variantStyles.in
|
|
|
55
55
|
<Transition name="m3-badge">
|
|
56
56
|
<span
|
|
57
57
|
v-if="n.count >= 2"
|
|
58
|
-
class="notif-count-badge absolute -top-1.5 -
|
|
58
|
+
class="notif-count-badge absolute -top-1.5 -end-1.5 z-10 flex h-5 min-w-5 items-center justify-center rounded-full bg-primary px-1 text-[10px] font-semibold leading-none text-on-primary shadow-elevation-1"
|
|
59
59
|
>
|
|
60
60
|
<Transition name="m3-count" mode="out-in">
|
|
61
61
|
<span :key="n.count">{{ n.count }}</span>
|
|
@@ -13,7 +13,7 @@ import MIcon from './MIcon.vue'
|
|
|
13
13
|
import MIconButton from './MIconButton.vue'
|
|
14
14
|
import { useFieldBg } from '../composables/useFieldBg'
|
|
15
15
|
import { useDebounce } from '../composables/useDebounce'
|
|
16
|
-
import {
|
|
16
|
+
import { FIELD_PADDING_END, fieldLabelClasses, vOverflowTitle, type FieldEndInset } from '../composables/_fieldLayout'
|
|
17
17
|
|
|
18
18
|
const props = withDefaults(
|
|
19
19
|
defineProps<{
|
|
@@ -145,11 +145,11 @@ function onKeydown(e: KeyboardEvent) {
|
|
|
145
145
|
}
|
|
146
146
|
|
|
147
147
|
// The label and the text both stop before the trailing controls
|
|
148
|
-
const rightInset = computed<
|
|
148
|
+
const rightInset = computed<FieldEndInset>(() => (props.stepper ? 'end-24' : 'end-4'))
|
|
149
149
|
|
|
150
150
|
const inputClasses = computed(() => {
|
|
151
|
-
const pl = props.leadingIcon ? '
|
|
152
|
-
const pr =
|
|
151
|
+
const pl = props.leadingIcon ? 'ps-12' : 'ps-4'
|
|
152
|
+
const pr = FIELD_PADDING_END[rightInset.value]
|
|
153
153
|
const base = [
|
|
154
154
|
'peer block w-full text-body-large text-on-surface outline-none placeholder:text-transparent',
|
|
155
155
|
'transition-[border-color,border-width] duration-150',
|
|
@@ -214,7 +214,7 @@ defineExpose({
|
|
|
214
214
|
>
|
|
215
215
|
<div
|
|
216
216
|
v-if="leadingIcon"
|
|
217
|
-
class="pointer-events-none absolute
|
|
217
|
+
class="pointer-events-none absolute start-3.5"
|
|
218
218
|
:class="[
|
|
219
219
|
variant === 'filled' ? 'top-4.5' : 'top-4',
|
|
220
220
|
isDisabled ? 'text-on-surface/38' : 'text-on-surface-variant',
|
|
@@ -246,7 +246,7 @@ defineExpose({
|
|
|
246
246
|
{{ label }}<span v-if="required" class="text-error"> *</span>
|
|
247
247
|
</label>
|
|
248
248
|
|
|
249
|
-
<div v-if="stepper" class="absolute
|
|
249
|
+
<div v-if="stepper" class="absolute end-1 top-1/2 -translate-y-1/2 flex items-center gap-0.5">
|
|
250
250
|
<MIconButton icon="remove" label="Decrease" :size="32" :disabled="isDisabled || (min !== undefined && (modelValue ?? 0) <= min)" @click="decrement" />
|
|
251
251
|
<MIconButton icon="add" label="Increase" :size="32" :disabled="isDisabled || (max !== undefined && (modelValue ?? 0) >= max)" @click="increment" />
|
|
252
252
|
</div>
|
|
@@ -162,7 +162,7 @@ function mod(m: OrderModifier) {
|
|
|
162
162
|
<li v-for="item in items" :key="item.id">
|
|
163
163
|
<button
|
|
164
164
|
type="button"
|
|
165
|
-
class="m3-order-line flex w-full items-start gap-3 px-4 py-2 text-
|
|
165
|
+
class="m3-order-line flex w-full items-start gap-3 px-4 py-2 text-start transition-opacity duration-150"
|
|
166
166
|
:class="[doneSet.has(item.id) ? 'is-done opacity-50' : '', readonly ? 'cursor-default' : 'cursor-pointer']"
|
|
167
167
|
:aria-pressed="doneSet.has(item.id)"
|
|
168
168
|
:disabled="readonly"
|
|
@@ -61,7 +61,7 @@ onUnmounted(() => {
|
|
|
61
61
|
aria-valuemax="100"
|
|
62
62
|
>
|
|
63
63
|
<div
|
|
64
|
-
class="h-full rounded-
|
|
64
|
+
class="h-full rounded-e-full transition-[width] duration-200 ease-out"
|
|
65
65
|
:class="colorMap[color]"
|
|
66
66
|
:style="{ width: `${progress}%` }"
|
|
67
67
|
/>
|
|
@@ -21,6 +21,7 @@ import { useFieldBg } from '../composables/useFieldBg'
|
|
|
21
21
|
import { useLocale } from '../composables/useLocale'
|
|
22
22
|
import { useFollowAnchor } from '../composables/_useFollowAnchor'
|
|
23
23
|
import { POPUP_MARGIN, dropdownX, fitPopup } from '../composables/_popupPosition'
|
|
24
|
+
import { isRtl } from '../composables/_rtl'
|
|
24
25
|
import { useEscapeStack } from '../composables/_useEscapeStack'
|
|
25
26
|
import {
|
|
26
27
|
flagEmoji,
|
|
@@ -284,7 +285,7 @@ function place() {
|
|
|
284
285
|
const width = Math.max(anchor.width, 280)
|
|
285
286
|
panel.style.width = `${width}px`
|
|
286
287
|
const h = panel.offsetHeight
|
|
287
|
-
const left = dropdownX(anchor, width, window.innerWidth, 'start')
|
|
288
|
+
const left = dropdownX(anchor, width, window.innerWidth, 'start', undefined, isRtl())
|
|
288
289
|
const top = fitPopup([anchor.bottom + 4, anchor.top - 4 - h], h, window.innerHeight, POPUP_MARGIN)
|
|
289
290
|
panelPos.value = { left: `${left}px`, top: `${top}px`, width: `${width}px` }
|
|
290
291
|
}
|
|
@@ -400,7 +401,7 @@ defineExpose({
|
|
|
400
401
|
:for="id"
|
|
401
402
|
class="pointer-events-none absolute truncate text-label-small"
|
|
402
403
|
:class="[
|
|
403
|
-
variant === 'outlined' ? '
|
|
404
|
+
variant === 'outlined' ? 'start-3 -top-2.5 max-w-[calc(100%-1.5rem)] bg-[var(--field-bg)] px-1' : 'start-4 top-2 end-4',
|
|
404
405
|
isDisabled ? 'text-on-surface/38' : isError ? 'text-error' : 'text-on-surface-variant group-focus-within:text-primary',
|
|
405
406
|
]"
|
|
406
407
|
>
|
|
@@ -411,7 +412,7 @@ defineExpose({
|
|
|
411
412
|
<button
|
|
412
413
|
ref="buttonEl"
|
|
413
414
|
type="button"
|
|
414
|
-
class="m3-phone-country
|
|
415
|
+
class="m3-phone-country ms-1 flex h-8 shrink-0 cursor-pointer items-center gap-1 rounded-full pe-1 ps-3 text-body-large text-on-surface outline-none transition-colors hover:bg-on-surface/8 focus-visible:ring-2 focus-visible:ring-secondary disabled:cursor-not-allowed disabled:text-on-surface/38"
|
|
415
416
|
:class="variant === 'filled' && '-mb-1'"
|
|
416
417
|
:disabled="isDisabled"
|
|
417
418
|
:aria-label="`${t.phoneCountry}: ${nameOf(country.iso2)} +${country.dial}`"
|
|
@@ -439,7 +440,7 @@ defineExpose({
|
|
|
439
440
|
:placeholder="placeholder ?? examplePlaceholder"
|
|
440
441
|
:aria-invalid="isError || undefined"
|
|
441
442
|
:aria-describedby="errorText || hint ? messageId : undefined"
|
|
442
|
-
class="min-w-0 flex-1 bg-transparent
|
|
443
|
+
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"
|
|
443
444
|
:class="isError ? 'caret-error' : 'caret-primary'"
|
|
444
445
|
@input="onInput"
|
|
445
446
|
@keydown="onKeydown"
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
/**
|
|
3
3
|
* One box per character for OTP/PIN/verification codes. Typing advances to the next box, backspace on an empty
|
|
4
|
-
* box goes back, and pasting a full code fills every box at once.
|
|
4
|
+
* box goes back, and pasting a full code fills every box at once. The boxes read left to right in a right-to-left
|
|
5
|
+
* page too, as codes do.
|
|
5
6
|
*
|
|
6
7
|
* @event update:modelValue Emitted on every box change — powers v-model
|
|
7
8
|
* @event complete Fires once with the full code as soon as every box is filled — the natural place to trigger
|
|
@@ -240,7 +241,7 @@ defineExpose({
|
|
|
240
241
|
|
|
241
242
|
<template>
|
|
242
243
|
<div ref="rootEl" class="flex flex-col gap-1" @focusout="onFocusOut">
|
|
243
|
-
<div role="group" :aria-label="label" class="flex min-w-0 items-center gap-2">
|
|
244
|
+
<div role="group" :aria-label="label" dir="ltr" class="flex min-w-0 items-center gap-2">
|
|
244
245
|
<template v-for="(digit, i) in digits" :key="i">
|
|
245
246
|
<input
|
|
246
247
|
:ref="(el) => setInputEl(el, i)"
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
*/
|
|
19
19
|
import { computed, onBeforeUnmount, onMounted, ref, watch } from 'vue'
|
|
20
20
|
import MIcon from './MIcon.vue'
|
|
21
|
+
import { vTooltip } from '../directives/vTooltip'
|
|
21
22
|
import MButton from './MButton.vue'
|
|
22
23
|
import { vRipple } from '../directives/vRipple'
|
|
23
24
|
import { useLocale } from '../composables/useLocale'
|
|
@@ -355,7 +356,7 @@ function keyLabel(key: Key) {
|
|
|
355
356
|
tabindex="-1"
|
|
356
357
|
:disabled="disabled"
|
|
357
358
|
:aria-label="key === 'backspace' ? locale.keypadDelete : key === 'clear' ? locale.keypadClear : undefined"
|
|
358
|
-
|
|
359
|
+
v-tooltip="key === 'backspace' ? locale.keypadDelete : undefined"
|
|
359
360
|
:data-key="key"
|
|
360
361
|
class="m3-pos-key relative flex h-16 cursor-pointer items-center justify-center overflow-hidden text-headline-small tabular-nums transition-[border-radius,background-color] duration-150 disabled:cursor-not-allowed disabled:opacity-38"
|
|
361
362
|
:class="key === 'backspace' || key === 'clear'
|
|
@@ -54,6 +54,7 @@ export type ProductSelection = Record<string, string | string[] | Record<string,
|
|
|
54
54
|
*/
|
|
55
55
|
import { computed } from 'vue'
|
|
56
56
|
import MIcon from './MIcon.vue'
|
|
57
|
+
import { vTooltip } from '../directives/vTooltip'
|
|
57
58
|
import MRadio from './MRadio.vue'
|
|
58
59
|
import MCheckbox from './MCheckbox.vue'
|
|
59
60
|
import MIconButton from './MIconButton.vue'
|
|
@@ -269,7 +270,7 @@ defineExpose({ valid, unitPrice, total })
|
|
|
269
270
|
:aria-label="o.price ? `${o.label} ${money(o.price, true)}` : o.label"
|
|
270
271
|
:aria-pressed="isSelected(g, o)"
|
|
271
272
|
:disabled="disabled || !available(g, o)"
|
|
272
|
-
|
|
273
|
+
v-tooltip="o.label"
|
|
273
274
|
:data-option="o.value"
|
|
274
275
|
@click="pick(g, o)"
|
|
275
276
|
/>
|
|
@@ -210,7 +210,7 @@ watch(isIndeterminate, async (v) => {
|
|
|
210
210
|
<!-- ── Linear variant ────────────────────────────────────────────────── -->
|
|
211
211
|
<div
|
|
212
212
|
v-if="variant === 'linear'"
|
|
213
|
-
class="relative w-full overflow-hidden rounded-full"
|
|
213
|
+
class="relative w-full overflow-hidden rounded-full m3-rtl:-scale-x-100"
|
|
214
214
|
:class="isIndeterminate ? 'bg-(--m3-progress-track)' : ''"
|
|
215
215
|
:style="{ height: `${effectiveThickness}px` }"
|
|
216
216
|
role="progressbar"
|
|
@@ -239,7 +239,7 @@ watch(isIndeterminate, async (v) => {
|
|
|
239
239
|
<!-- ── Wavy variant ───────────────────────────────────────────────────── -->
|
|
240
240
|
<div
|
|
241
241
|
v-else
|
|
242
|
-
class="relative w-full overflow-visible"
|
|
242
|
+
class="relative w-full overflow-visible m3-rtl:-scale-x-100"
|
|
243
243
|
:style="{ height: `${waveViewH}px` }"
|
|
244
244
|
role="progressbar"
|
|
245
245
|
:aria-valuenow="isIndeterminate ? undefined : clampedValue"
|