@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
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
import { i as e, o as t } from "./_storageKeys-C4W_4xK4.js";
|
|
2
|
+
import { t as n } from "./MSpinner-CbEMPY4X.js";
|
|
3
|
+
import { t as r } from "./MIcon-CkUc9kuQ.js";
|
|
4
|
+
import { p as i } from "./MIconButton-DTFOfsTy.js";
|
|
5
|
+
import { Fragment as a, computed as o, createBlock as s, createCommentVNode as c, createElementBlock as l, defineComponent as u, normalizeClass as d, normalizeStyle as f, openBlock as p, ref as m, renderSlot as h, resolveDynamicComponent as g, unref as _, withCtx as v, withDirectives as y } from "vue";
|
|
6
|
+
// src/composables/_colorUtils.ts
|
|
7
|
+
function b(e) {
|
|
8
|
+
let t = e.trim().replace(/^#/, "");
|
|
9
|
+
if (!/^([0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(t)) return null;
|
|
10
|
+
t.length <= 4 && (t = [...t].map((e) => e + e).join(""));
|
|
11
|
+
let n = (e) => parseInt(t.substring(e, e + 2), 16);
|
|
12
|
+
return {
|
|
13
|
+
r: n(0),
|
|
14
|
+
g: n(2),
|
|
15
|
+
b: n(4),
|
|
16
|
+
a: t.length === 8 ? n(6) / 255 : 1
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
function x({ r: e, g: t, b: n, a: r }) {
|
|
20
|
+
let i = (e) => Math.round(Math.max(0, Math.min(255, e))).toString(16).padStart(2, "0");
|
|
21
|
+
return `#${i(e)}${i(t)}${i(n)}${r < 1 ? i(r * 255) : ""}`;
|
|
22
|
+
}
|
|
23
|
+
function S(e) {
|
|
24
|
+
let t = b(e);
|
|
25
|
+
return t ? x(t) : "";
|
|
26
|
+
}
|
|
27
|
+
function C({ r: e, g: t, b: n }) {
|
|
28
|
+
e /= 255, t /= 255, n /= 255;
|
|
29
|
+
let r = Math.max(e, t, n), i = r - Math.min(e, t, n), a = 0;
|
|
30
|
+
return i !== 0 && (a = r === e ? ((t - n) / i + 6) % 6 : r === t ? (n - e) / i + 2 : (e - t) / i + 4, a *= 60), {
|
|
31
|
+
h: a,
|
|
32
|
+
s: r === 0 ? 0 : i / r * 100,
|
|
33
|
+
v: r * 100
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
function w({ h: e, s: t, v: n }, r = 1) {
|
|
37
|
+
t /= 100, n /= 100;
|
|
38
|
+
let i = (r) => {
|
|
39
|
+
let i = (r + e / 60) % 6;
|
|
40
|
+
return (n - n * t * Math.max(0, Math.min(i, 4 - i, 1))) * 255;
|
|
41
|
+
};
|
|
42
|
+
return {
|
|
43
|
+
r: i(5),
|
|
44
|
+
g: i(3),
|
|
45
|
+
b: i(1),
|
|
46
|
+
a: r
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
function T({ h: e, s: t, v: n }) {
|
|
50
|
+
t /= 100, n /= 100;
|
|
51
|
+
let r = n * (1 - t / 2);
|
|
52
|
+
return {
|
|
53
|
+
h: e,
|
|
54
|
+
s: (r === 0 || r === 1 ? 0 : (n - r) / Math.min(r, 1 - r)) * 100,
|
|
55
|
+
l: r * 100
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
function E({ h: e, s: t, l: n }) {
|
|
59
|
+
t /= 100, n /= 100;
|
|
60
|
+
let r = n + t * Math.min(n, 1 - n);
|
|
61
|
+
return {
|
|
62
|
+
h: e,
|
|
63
|
+
s: r === 0 ? 0 : 2 * (1 - n / r) * 100,
|
|
64
|
+
v: r * 100
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
function D(e) {
|
|
68
|
+
let t = b(e);
|
|
69
|
+
if (!t) return "#000000";
|
|
70
|
+
let n = (e) => (e /= 255, e <= .03928 ? e / 12.92 : ((e + .055) / 1.055) ** 2.4);
|
|
71
|
+
return .2126 * n(t.r) + .7152 * n(t.g) + .0722 * n(t.b) > .179 ? "#000000" : "#ffffff";
|
|
72
|
+
}
|
|
73
|
+
var O = "m3-color-recent";
|
|
74
|
+
function k() {
|
|
75
|
+
try {
|
|
76
|
+
let e = JSON.parse(localStorage.getItem(t(O)) ?? "[]");
|
|
77
|
+
return Array.isArray(e) ? e.filter((e) => typeof e == "string" && !!b(e)) : [];
|
|
78
|
+
} catch {
|
|
79
|
+
return [];
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
var A = m(k());
|
|
83
|
+
e(() => {
|
|
84
|
+
A.value = k();
|
|
85
|
+
});
|
|
86
|
+
function j(e, n) {
|
|
87
|
+
let r = S(e);
|
|
88
|
+
if (r) {
|
|
89
|
+
A.value = [r, ...A.value.filter((e) => e !== r)].slice(0, Math.max(n, 0));
|
|
90
|
+
try {
|
|
91
|
+
localStorage.setItem(t(O), JSON.stringify(A.value));
|
|
92
|
+
} catch {}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
var M = [
|
|
96
|
+
"#f44336",
|
|
97
|
+
"#e91e63",
|
|
98
|
+
"#9c27b0",
|
|
99
|
+
"#673ab7",
|
|
100
|
+
"#3f51b5",
|
|
101
|
+
"#2196f3",
|
|
102
|
+
"#03a9f4",
|
|
103
|
+
"#00bcd4",
|
|
104
|
+
"#009688",
|
|
105
|
+
"#4caf50",
|
|
106
|
+
"#8bc34a",
|
|
107
|
+
"#cddc39",
|
|
108
|
+
"#ffeb3b",
|
|
109
|
+
"#ffc107",
|
|
110
|
+
"#ff9800",
|
|
111
|
+
"#ff5722",
|
|
112
|
+
"#795548",
|
|
113
|
+
"#607d8b",
|
|
114
|
+
"#9e9e9e",
|
|
115
|
+
"#000000",
|
|
116
|
+
"#ffffff"
|
|
117
|
+
], N = "relative inline-flex items-center justify-center font-medium whitespace-nowrap transition-[box-shadow,background-color,color] duration-150 select-none cursor-pointer pointer-coarse:after:content-[''] pointer-coarse:after:absolute pointer-coarse:after:left-1/2 pointer-coarse:after:top-1/2 pointer-coarse:after:-translate-x-1/2 pointer-coarse:after:-translate-y-1/2 pointer-coarse:after:size-full pointer-coarse:after:min-h-12 pointer-coarse:after:min-w-12 disabled:cursor-not-allowed disabled:shadow-none disabled:text-on-surface/38 before:content-[''] before:pointer-events-none before:absolute before:inset-0 before:rounded-[inherit] before:bg-current before:opacity-0 before:transition-opacity before:duration-150 enabled:hover:before:opacity-[0.08] enabled:focus-visible:before:opacity-[0.1] enabled:active:before:opacity-[0.1]", P = /* @__PURE__ */ u({
|
|
118
|
+
__name: "MButton",
|
|
119
|
+
props: {
|
|
120
|
+
variant: { default: "filled" },
|
|
121
|
+
color: { default: "primary" },
|
|
122
|
+
type: { default: "button" },
|
|
123
|
+
disabled: {
|
|
124
|
+
type: Boolean,
|
|
125
|
+
default: !1
|
|
126
|
+
},
|
|
127
|
+
loading: {
|
|
128
|
+
type: Boolean,
|
|
129
|
+
default: !1
|
|
130
|
+
},
|
|
131
|
+
icon: {},
|
|
132
|
+
iconFilled: { type: Boolean },
|
|
133
|
+
iconPos: { default: "leading" },
|
|
134
|
+
size: { default: "sm" },
|
|
135
|
+
shape: { default: "rounded" },
|
|
136
|
+
to: {},
|
|
137
|
+
rippleColor: {},
|
|
138
|
+
contentColor: {}
|
|
139
|
+
},
|
|
140
|
+
setup(e) {
|
|
141
|
+
let t = ["primary", "error"], u = e, m = o(() => u.to ? "RouterLink" : "button"), x = o(() => !!u.color && !t.includes(u.color)), S = o(() => {
|
|
142
|
+
if (x.value) return {
|
|
143
|
+
"--color-primary": u.color,
|
|
144
|
+
"--color-on-primary": b(u.color) ? D(u.color) : "#ffffff",
|
|
145
|
+
"--color-primary-container": `color-mix(in srgb, ${u.color} 20%, transparent)`,
|
|
146
|
+
"--color-on-primary-container": u.color,
|
|
147
|
+
"--color-secondary-container": `color-mix(in srgb, ${u.color} 20%, transparent)`,
|
|
148
|
+
"--color-on-secondary-container": u.color
|
|
149
|
+
};
|
|
150
|
+
}), C = o(() => u.color === "error"), w = /^(on-)?(primary|secondary|tertiary|error|surface|surface-variant|inverse-surface|inverse-primary)(-container|-variant)?$/, T = o(() => {
|
|
151
|
+
let e = u.contentColor;
|
|
152
|
+
return !e || u.disabled || u.loading ? S.value : {
|
|
153
|
+
...S.value,
|
|
154
|
+
color: w.test(e) ? `var(--color-${e})` : e
|
|
155
|
+
};
|
|
156
|
+
}), E = o(() => {
|
|
157
|
+
switch (u.variant) {
|
|
158
|
+
case "filled":
|
|
159
|
+
case "tonal":
|
|
160
|
+
case "elevated": return "disabled:bg-on-surface/10";
|
|
161
|
+
case "outlined": return C.value ? "disabled:border-error/10" : "disabled:border-outline-variant/10";
|
|
162
|
+
default: return "";
|
|
163
|
+
}
|
|
164
|
+
}), O = {
|
|
165
|
+
xs: {
|
|
166
|
+
h: "h-8",
|
|
167
|
+
text: "text-label-large",
|
|
168
|
+
icon: 20,
|
|
169
|
+
spinner: 16,
|
|
170
|
+
gap: "gap-1",
|
|
171
|
+
px: "px-3",
|
|
172
|
+
pxText: "px-2",
|
|
173
|
+
squareRadius: "rounded-md"
|
|
174
|
+
},
|
|
175
|
+
sm: {
|
|
176
|
+
h: "h-10",
|
|
177
|
+
text: "text-label-large",
|
|
178
|
+
icon: 20,
|
|
179
|
+
spinner: 16,
|
|
180
|
+
gap: "gap-2",
|
|
181
|
+
px: "px-4",
|
|
182
|
+
pxText: "px-3",
|
|
183
|
+
squareRadius: "rounded-md"
|
|
184
|
+
},
|
|
185
|
+
md: {
|
|
186
|
+
h: "h-14",
|
|
187
|
+
text: "text-title-medium",
|
|
188
|
+
icon: 24,
|
|
189
|
+
spinner: 18,
|
|
190
|
+
gap: "gap-2",
|
|
191
|
+
px: "px-6",
|
|
192
|
+
pxText: "px-3",
|
|
193
|
+
squareRadius: "rounded-lg"
|
|
194
|
+
},
|
|
195
|
+
lg: {
|
|
196
|
+
h: "h-24",
|
|
197
|
+
text: "text-headline-small",
|
|
198
|
+
icon: 32,
|
|
199
|
+
spinner: 26,
|
|
200
|
+
gap: "gap-3",
|
|
201
|
+
px: "px-12",
|
|
202
|
+
pxText: "px-4",
|
|
203
|
+
squareRadius: "rounded-xl"
|
|
204
|
+
},
|
|
205
|
+
xl: {
|
|
206
|
+
h: "h-[136px]",
|
|
207
|
+
text: "text-headline-large",
|
|
208
|
+
icon: 40,
|
|
209
|
+
spinner: 34,
|
|
210
|
+
gap: "gap-4",
|
|
211
|
+
px: "px-16",
|
|
212
|
+
pxText: "px-4",
|
|
213
|
+
squareRadius: "rounded-xl"
|
|
214
|
+
}
|
|
215
|
+
}, k = o(() => O[u.size] ?? O.sm), A = o(() => `${k.value.h} ${k.value.text} ${k.value.gap}`), j = o(() => k.value.icon), M = o(() => k.value.spinner), P = o(() => u.variant === "text" ? k.value.pxText : k.value.px), F = o(() => u.shape === "squared" ? k.value.squareRadius : "rounded-full"), I = o(() => {
|
|
216
|
+
let e = C.value;
|
|
217
|
+
switch (u.variant) {
|
|
218
|
+
case "filled": return e ? "bg-error text-on-error enabled:hover:shadow-elevation-1 enabled:active:shadow-none" : "bg-primary text-on-primary enabled:hover:shadow-elevation-1 enabled:active:shadow-none";
|
|
219
|
+
case "tonal": return e ? "bg-error-container text-on-error-container enabled:hover:shadow-elevation-1 enabled:active:shadow-none" : "bg-secondary-container text-on-secondary-container enabled:hover:shadow-elevation-1 enabled:active:shadow-none";
|
|
220
|
+
case "elevated": return e ? "bg-surface-container-low text-error shadow-elevation-1 enabled:hover:shadow-elevation-2" : "bg-surface-container-low text-primary shadow-elevation-1 enabled:hover:shadow-elevation-2";
|
|
221
|
+
case "outlined": return e ? "border border-error text-error" : "border border-outline-variant text-primary";
|
|
222
|
+
case "text": return e ? "text-error" : "text-primary";
|
|
223
|
+
default: return "";
|
|
224
|
+
}
|
|
225
|
+
});
|
|
226
|
+
return (t, o) => y((p(), s(g(m.value), {
|
|
227
|
+
to: e.to || void 0,
|
|
228
|
+
type: e.to ? void 0 : e.type,
|
|
229
|
+
disabled: e.disabled || e.loading,
|
|
230
|
+
class: d([
|
|
231
|
+
N,
|
|
232
|
+
F.value,
|
|
233
|
+
A.value,
|
|
234
|
+
P.value,
|
|
235
|
+
I.value,
|
|
236
|
+
E.value
|
|
237
|
+
]),
|
|
238
|
+
style: f(T.value)
|
|
239
|
+
}, {
|
|
240
|
+
default: v(() => [
|
|
241
|
+
e.iconPos === "leading" ? (p(), l(a, { key: 0 }, [e.loading ? (p(), s(n, {
|
|
242
|
+
key: 0,
|
|
243
|
+
size: M.value
|
|
244
|
+
}, null, 8, ["size"])) : e.icon ? (p(), s(r, {
|
|
245
|
+
key: 1,
|
|
246
|
+
name: e.icon,
|
|
247
|
+
size: j.value,
|
|
248
|
+
filled: e.iconFilled
|
|
249
|
+
}, null, 8, [
|
|
250
|
+
"name",
|
|
251
|
+
"size",
|
|
252
|
+
"filled"
|
|
253
|
+
])) : c("", !0)], 64)) : c("", !0),
|
|
254
|
+
h(t.$slots, "default"),
|
|
255
|
+
e.iconPos === "trailing" ? (p(), l(a, { key: 1 }, [e.loading ? (p(), s(n, {
|
|
256
|
+
key: 0,
|
|
257
|
+
size: M.value
|
|
258
|
+
}, null, 8, ["size"])) : e.icon ? (p(), s(r, {
|
|
259
|
+
key: 1,
|
|
260
|
+
name: e.icon,
|
|
261
|
+
size: j.value,
|
|
262
|
+
filled: e.iconFilled
|
|
263
|
+
}, null, 8, [
|
|
264
|
+
"name",
|
|
265
|
+
"size",
|
|
266
|
+
"filled"
|
|
267
|
+
])) : c("", !0)], 64)) : c("", !0)
|
|
268
|
+
]),
|
|
269
|
+
_: 3
|
|
270
|
+
}, 8, [
|
|
271
|
+
"to",
|
|
272
|
+
"type",
|
|
273
|
+
"disabled",
|
|
274
|
+
"class",
|
|
275
|
+
"style"
|
|
276
|
+
])), [[_(i), {
|
|
277
|
+
disabled: e.disabled || e.loading,
|
|
278
|
+
color: e.rippleColor
|
|
279
|
+
}]]);
|
|
280
|
+
}
|
|
281
|
+
});
|
|
282
|
+
export { w as a, b as c, C as d, x as f, T as i, j as l, M as n, D as o, E as r, S as s, P as t, A as u };
|
|
283
|
+
|
|
284
|
+
//# sourceMappingURL=MButton-BHKF1Tfd.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MButton-BHKF1Tfd.js","names":["_withDirectives","_openBlock","_createBlock","_resolveDynamicComponent","_normalizeClass","_normalizeStyle","_withCtx","_createElementBlock","_Fragment","MSpinner","MIcon","_renderSlot","_unref","onStoragePrefix","storageKey","MSpinner_default","MIcon_default","vRipple","parseHex","c","input","ch","i","toHex","h","n","r","g","b","a","normalizeHex","rgbToHsv","max","d","hsvToRgb","f","k","v","s","hsvToHsl","l","hslToHsv","inkFor","hex","lin","RECENT_KEY","readRecents","x","recentColors","ref","pushRecentColor","limit","defaultColorPresets","base","MButton_default","defineComponent","NAMED_COLORS","props","__props","tag","computed","isCustomColor","customStyle","isError","ROLE","style","disabledContainerClasses","sizeMap","sizeClasses","iconSize","spinnerSize","px","shapeClass","variantClasses","err","withDirectives","openBlock","createBlock","resolveDynamicComponent","normalizeClass","normalizeStyle","withCtx","createElementBlock","Fragment","createCommentVNode","renderSlot","_ctx","unref"],"sources":["../src/composables/_colorUtils.ts","../src/components/MButton.vue"],"sourcesContent":["// Internal color math shared by MColorPicker and MColorPickerModal (through _MColorPanel).\n// Not exported from index.ts.\nimport { ref } from 'vue'\nimport { onStoragePrefix, storageKey } from './_storageKeys'\n\nexport interface Rgba { r: number; g: number; b: number; a: number }\n/** h 0–360, s/v 0–100 */\nexport interface Hsv { h: number; s: number; v: number }\n/** h 0–360, s/l 0–100 */\nexport interface Hsl { h: number; s: number; l: number }\n\n/** Parses `#rgb`, `#rgba`, `#rrggbb` or `#rrggbbaa` (the `#` is optional). r/g/b 0–255, a 0–1. */\nexport function parseHex(input: string): Rgba | null {\n let c = input.trim().replace(/^#/, '')\n if (!/^([0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(c)) return null\n if (c.length <= 4) c = [...c].map((ch) => ch + ch).join('')\n const n = (i: number) => parseInt(c.substring(i, i + 2), 16)\n return { r: n(0), g: n(2), b: n(4), a: c.length === 8 ? n(6) / 255 : 1 }\n}\n\n/** `#rrggbb`, or `#rrggbbaa` when a < 1. Lowercase. */\nexport function toHex({ r, g, b, a }: Rgba): string {\n const h = (n: number) => Math.round(Math.max(0, Math.min(255, n))).toString(16).padStart(2, '0')\n return `#${h(r)}${h(g)}${h(b)}${a < 1 ? h(a * 255) : ''}`\n}\n\n/** Lowercase canonical form of a hex string, or '' when it isn't one. */\nexport function normalizeHex(input: string): string {\n const c = parseHex(input)\n return c ? toHex(c) : ''\n}\n\nexport function rgbToHsv({ r, g, b }: Rgba): Hsv {\n r /= 255; g /= 255; b /= 255\n const max = Math.max(r, g, b), d = max - Math.min(r, g, b)\n let h = 0\n if (d !== 0) {\n if (max === r) h = ((g - b) / d + 6) % 6\n else if (max === g) h = (b - r) / d + 2\n else h = (r - g) / d + 4\n h *= 60\n }\n return { h, s: max === 0 ? 0 : (d / max) * 100, v: max * 100 }\n}\n\nexport function hsvToRgb({ h, s, v }: Hsv, a = 1): Rgba {\n s /= 100; v /= 100\n const f = (n: number) => {\n const k = (n + h / 60) % 6\n return (v - v * s * Math.max(0, Math.min(k, 4 - k, 1))) * 255\n }\n return { r: f(5), g: f(3), b: f(1), a }\n}\n\nexport function hsvToHsl({ h, s, v }: Hsv): Hsl {\n s /= 100; v /= 100\n const l = v * (1 - s / 2)\n const sl = l === 0 || l === 1 ? 0 : (v - l) / Math.min(l, 1 - l)\n return { h, s: sl * 100, l: l * 100 }\n}\n\nexport function hslToHsv({ h, s, l }: Hsl): Hsv {\n s /= 100; l /= 100\n const v = l + s * Math.min(l, 1 - l)\n return { h, s: v === 0 ? 0 : 2 * (1 - l / v) * 100, v: v * 100 }\n}\n\n/** Black or white, whichever reads better on the color (WCAG relative luminance). */\nexport function inkFor(hex: string): '#000000' | '#ffffff' {\n const c = parseHex(hex)\n if (!c) return '#000000'\n const lin = (n: number) => {\n n /= 255\n return n <= 0.03928 ? n / 12.92 : ((n + 0.055) / 1.055) ** 2.4\n }\n const lum = 0.2126 * lin(c.r) + 0.7152 * lin(c.g) + 0.0722 * lin(c.b)\n // Contrast against black beats contrast against white above ~0.179\n return lum > 0.179 ? '#000000' : '#ffffff'\n}\n\n// ── Recent colors (per viewer, localStorage, shared by every picker on the page) ──────────────\n\nconst RECENT_KEY = 'm3-color-recent'\n\nfunction readRecents(): string[] {\n try {\n const v = JSON.parse(localStorage.getItem(storageKey(RECENT_KEY)) ?? '[]')\n return Array.isArray(v) ? v.filter((x): x is string => typeof x === 'string' && !!parseHex(x)) : []\n } catch {\n return []\n }\n}\n\nexport const recentColors = ref<string[]>(readRecents())\nonStoragePrefix(() => { recentColors.value = readRecents() })\n\nexport function pushRecentColor(hex: string, limit: number) {\n const c = normalizeHex(hex)\n if (!c) return\n recentColors.value = [c, ...recentColors.value.filter((x) => x !== c)].slice(0, Math.max(limit, 0))\n try { localStorage.setItem(storageKey(RECENT_KEY), JSON.stringify(recentColors.value)) } catch { /* storage blocked */ }\n}\n\n/** Default swatches for both pickers: the Material 2014 palette's 500 tones plus grey, black and white (3 rows of 7) */\nexport const defaultColorPresets = [\n '#f44336', '#e91e63', '#9c27b0', '#673ab7', '#3f51b5', '#2196f3', '#03a9f4',\n '#00bcd4', '#009688', '#4caf50', '#8bc34a', '#cddc39', '#ffeb3b', '#ffc107',\n '#ff9800', '#ff5722', '#795548', '#607d8b', '#9e9e9e', '#000000', '#ffffff',\n]\n","<script setup lang=\"ts\">\n/**\n * The standard M3 button — five variants, five expressive size tiers, and either color.\n *\n * @slot default The button's label.\n */\nimport { inkFor, parseHex } from '../composables/_colorUtils'\nimport { computed } from 'vue'\nimport MSpinner from './MSpinner.vue'\nimport MIcon from './MIcon.vue'\nimport { vRipple } from '../directives/vRipple'\n\nconst NAMED_COLORS = ['primary', 'error'] as const\ntype NamedColor = (typeof NAMED_COLORS)[number]\n\nconst props = withDefaults(\n defineProps<{\n /** Visual style of the button */\n variant?: 'filled' | 'tonal' | 'outlined' | 'text' | 'elevated'\n /**\n * Named semantic color ('primary' | 'error') OR any CSS color string\n * ('red', '#e91e63', 'oklch(0.6 0.2 0)', …).\n * When a CSS color is passed, --color-primary is overridden for this button; its text is black or white by\n * contrast for a hex color, white for any other form (set `contentColor` to choose).\n */\n color?: string\n /** HTML button type */\n type?: 'button' | 'submit' | 'reset'\n /** Disables interaction */\n disabled?: boolean\n /** Shows a spinner and disables the button */\n loading?: boolean\n /** Material Symbol icon name shown next to the label */\n icon?: string\n /** Draw the icon filled (Material Symbols' FILL axis), e.g. a starred star or a play icon */\n iconFilled?: boolean\n /** Which side of the label the icon renders on */\n // Which side of the label `icon` renders on. Real M3 buttons support both via\n // `ButtonDefaults.contentPaddingFor(hasStartIcon/hasEndIcon)` — padding ends up identical\n // either way at every tier, so this only changes render order, not spacing.\n iconPos?: 'leading' | 'trailing'\n /**\n * M3's 5-tier expressive button sizing (xs: 32px, sm: 40px, md: 56px, lg: 96px, xl: 136px) — lg/xl are\n * meant for hero-style prominent buttons, not everyday UI\n */\n size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl'\n /**\n * Button shape — rounded (pill, always) or squared (corner radius scales with size: 12px xs/sm, 16px md,\n * 28px lg/xl)\n */\n shape?: 'rounded' | 'squared'\n /** Vue Router destination — renders as RouterLink instead of button */\n to?: string | Record<string, any>\n /** Any CSS color for the press ripple; defaults to the button's content color */\n rippleColor?: string\n /**\n * Label and icon color, over what the variant and `color` give: an M3 role (`on-surface` for a neutral text\n * button, `on-primary-container`…) or any CSS color (`#000` on a white filled button). Disabled buttons keep\n * their own\n */\n contentColor?: string\n }>(),\n {\n variant: 'filled',\n color: 'primary',\n type: 'button',\n disabled: false,\n loading: false,\n iconPos: 'leading',\n size: 'sm',\n shape: 'rounded',\n },\n)\n\nconst tag = computed(() => props.to ? 'RouterLink' : 'button')\n\nconst isCustomColor = computed(\n () => !!props.color && !(NAMED_COLORS as readonly string[]).includes(props.color),\n)\n\nconst customStyle = computed(() => {\n if (!isCustomColor.value) return undefined\n return {\n '--color-primary': props.color,\n // Black or white by contrast when the color is a hex literal; white otherwise (set contentColor to override)\n '--color-on-primary': parseHex(props.color!) ? inkFor(props.color!) : '#ffffff',\n // color-mix, not a hex alpha suffix: works with any CSS color (rgb(), a name, var(--x)…)\n '--color-primary-container': `color-mix(in srgb, ${props.color} 20%, transparent)`,\n '--color-on-primary-container': props.color,\n // The tonal variant draws with the secondary container: point it at the same tint, or a custom color never\n // reached tonal buttons at all\n '--color-secondary-container': `color-mix(in srgb, ${props.color} 20%, transparent)`,\n '--color-on-secondary-container': props.color,\n }\n})\n\nconst isError = computed(() => props.color === 'error')\n\n// Color-role names (`on-surface`, `secondary-container`…) read the theme's token; anything else is a CSS color\nconst ROLE = /^(on-)?(primary|secondary|tertiary|error|surface|surface-variant|inverse-surface|inverse-primary)(-container|-variant)?$/\nconst style = computed(() => {\n const c = props.contentColor\n if (!c || props.disabled || props.loading) return customStyle.value\n return { ...customStyle.value, color: ROLE.test(c) ? `var(--color-${c})` : c }\n})\n\n// M3's minimum touch target (minimumInteractiveComponentSize, 48dp): on a touch screen (pointer: coarse) an invisible\n// box centered on the button, so the 32px and 40px sizes still take a 48px tap. Not with a mouse: there it would only\n// widen the hover and overlap neighbors in dense toolbars. Needs the button not to clip (no overflow-hidden): the state layer\n// rounds itself instead, and the ripple clips in its own layer.\nconst base =\n 'relative inline-flex items-center justify-center font-medium ' +\n 'whitespace-nowrap transition-[box-shadow,background-color,color] duration-150 select-none cursor-pointer ' +\n \"pointer-coarse:after:content-[''] pointer-coarse:after:absolute pointer-coarse:after:left-1/2 pointer-coarse:after:top-1/2 pointer-coarse:after:-translate-x-1/2 pointer-coarse:after:-translate-y-1/2 pointer-coarse:after:size-full pointer-coarse:after:min-h-12 pointer-coarse:after:min-w-12 \" +\n 'disabled:cursor-not-allowed disabled:shadow-none disabled:text-on-surface/38 ' +\n \"before:content-[''] before:pointer-events-none before:absolute before:inset-0 before:rounded-[inherit] \" +\n 'before:bg-current before:opacity-0 before:transition-opacity before:duration-150 ' +\n 'enabled:hover:before:opacity-[0.08] enabled:focus-visible:before:opacity-[0.1] enabled:active:before:opacity-[0.1]'\n\n// M3 disabled tokens: container at 10% on-surface opacity (DisabledContainerOpacity, same\n// across Filled/Tonal/Elevated), content/label always at 38% on-surface (handled in `base`\n// above, applies to every variant including text/elevated which have no container). The\n// outlined border uses the SAME color role as its enabled border (OutlineVariant, not\n// on-surface) just dimmed to that 10% too — see `variantClasses`' outlined case below for\n// why the enabled color is also outline-variant, not outline.\nconst disabledContainerClasses = computed(() => {\n switch (props.variant) {\n case 'filled':\n case 'tonal':\n case 'elevated':\n return 'disabled:bg-on-surface/10'\n case 'outlined':\n return isError.value ? 'disabled:border-error/10' : 'disabled:border-outline-variant/10'\n default:\n return ''\n }\n})\n\n/*\n * M3's newer 5-tier \"expressive\" button sizing (Button{XSmall,Small,Medium,Large,\n * XLarge}Tokens.kt + Button.kt's size-variant overloads — @ExperimentalMaterial3ExpressiveApi\n * in Compose, but this `size` prop is deliberately implementing exactly that system, same\n * as MFabMenu/MLoadingIndicator already do for other Expressive-only components). Content\n * padding is IDENTICAL whether or not an icon is present at every tier in the default\n * (non \"precision pointer\") mode — e.g. `IconMediumLeadingPadding = MediumLeadingPadding`\n * verbatim in the real source — so there's deliberately no separate icon-vs-no-icon padding\n * split here, unlike the old version of this file which had one (and got the values wrong\n * in both directions). `gap` between icon and label also varies by tier (IconLabelSpace),\n * not a flat value for every size.\n */\nconst sizeMap = {\n xs: { h: 'h-8', text: 'text-label-large', icon: 20, spinner: 16, gap: 'gap-1', px: 'px-3', pxText: 'px-2', squareRadius: 'rounded-md' },\n sm: { h: 'h-10', text: 'text-label-large', icon: 20, spinner: 16, gap: 'gap-2', px: 'px-4', pxText: 'px-3', squareRadius: 'rounded-md' },\n md: { h: 'h-14', text: 'text-title-medium', icon: 24, spinner: 18, gap: 'gap-2', px: 'px-6', pxText: 'px-3', squareRadius: 'rounded-lg' },\n lg: { h: 'h-24', text: 'text-headline-small', icon: 32, spinner: 26, gap: 'gap-3', px: 'px-12', pxText: 'px-4', squareRadius: 'rounded-xl' },\n xl: { h: 'h-[136px]', text: 'text-headline-large', icon: 40, spinner: 34, gap: 'gap-4', px: 'px-16', pxText: 'px-4', squareRadius: 'rounded-xl' },\n}\n\nconst s = computed(() => sizeMap[props.size] ?? sizeMap.sm)\nconst sizeClasses = computed(() => `${s.value.h} ${s.value.text} ${s.value.gap}`)\nconst iconSize = computed(() => s.value.icon)\nconst spinnerSize = computed(() => s.value.spinner)\n\nconst px = computed(() => props.variant === 'text' ? s.value.pxText : s.value.px)\n\n// Squared shape radius scales with size, matching each tier's own ContainerShapeSquare\n// token (ButtonXSmallTokens/ButtonSmallTokens use CornerMedium=12px, ButtonMediumTokens\n// CornerLarge=16px, ButtonLargeTokens/ButtonXLargeTokens CornerExtraLarge=28px) — the\n// pill (ContainerShapeRound) is CornerFull at every tier, so that half doesn't vary.\nconst shapeClass = computed(() => props.shape === 'squared' ? s.value.squareRadius : 'rounded-full')\n\nconst variantClasses = computed(() => {\n const err = isError.value\n switch (props.variant) {\n case 'filled':\n return err\n ? 'bg-error text-on-error enabled:hover:shadow-elevation-1 enabled:active:shadow-none'\n : 'bg-primary text-on-primary enabled:hover:shadow-elevation-1 enabled:active:shadow-none'\n case 'tonal':\n return err\n ? 'bg-error-container text-on-error-container enabled:hover:shadow-elevation-1 enabled:active:shadow-none'\n : 'bg-secondary-container text-on-secondary-container enabled:hover:shadow-elevation-1 enabled:active:shadow-none'\n case 'elevated':\n return err\n ? 'bg-surface-container-low text-error shadow-elevation-1 enabled:hover:shadow-elevation-2'\n : 'bg-surface-container-low text-primary shadow-elevation-1 enabled:hover:shadow-elevation-2'\n case 'outlined':\n // OutlinedButtonTokens.OutlineColor = ColorSchemeKeyTokens.OutlineVariant, not Outline\n return err\n ? 'border border-error text-error'\n : 'border border-outline-variant text-primary'\n case 'text':\n return err\n ? 'text-error'\n : 'text-primary'\n default:\n return ''\n }\n})\n</script>\n\n<template>\n <component\n :is=\"tag\"\n :to=\"to || undefined\"\n :type=\"to ? undefined : type\"\n :disabled=\"disabled || loading\"\n :class=\"[base, shapeClass, sizeClasses, px, variantClasses, disabledContainerClasses]\"\n :style=\"style\"\n v-ripple=\"{ disabled: disabled || loading, color: rippleColor }\"\n >\n <template v-if=\"iconPos === 'leading'\">\n <MSpinner v-if=\"loading\" :size=\"spinnerSize\" />\n <MIcon v-else-if=\"icon\" :name=\"icon\" :size=\"iconSize\" :filled=\"iconFilled\" />\n </template>\n <slot />\n <template v-if=\"iconPos === 'trailing'\">\n <MSpinner v-if=\"loading\" :size=\"spinnerSize\" />\n <MIcon v-else-if=\"icon\" :name=\"icon\" :size=\"iconSize\" :filled=\"iconFilled\" />\n </template>\n </component>\n</template>\n"],"mappings":";;;;;;AAYA,SAAgBkB,EAAS,GAA4B;CACnD,IAAIC,IAAIC,EAAM,KAAK,CAAC,CAAC,QAAQ,MAAM,EAAE;CACrC,IAAI,CAAC,6CAA6C,KAAKD,CAAC,GAAG,OAAO;CAClE,AAAIA,EAAE,UAAU,MAAG,IAAI,CAAC,GAAGA,C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