@m3ui-vue/m3ui-vue 1.6.1 → 1.7.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 +649 -28
- package/dist/{MButton-OQ4wIERQ.js → MButton-CN3wYwIG.js} +2 -2
- package/dist/{MButton-OQ4wIERQ.js.map → MButton-CN3wYwIG.js.map} +1 -1
- package/dist/MColorPickerModal-BKM1CHxr.js +577 -0
- package/dist/MColorPickerModal-BKM1CHxr.js.map +1 -0
- package/dist/{MDialog-DYMnaBlt.js → MDialog-1LAk9WAO.js} +2 -2
- package/dist/{MDialog-DYMnaBlt.js.map → MDialog-1LAk9WAO.js.map} +1 -1
- package/dist/{MListItem-D2cNUyzP.js → MListItem-BU5KDRCB.js} +376 -270
- package/dist/MListItem-BU5KDRCB.js.map +1 -0
- package/dist/{MLoadingIndicator-DWUj0BAB.js → MLoadingIndicator-RykOo5tf.js} +2 -2
- package/dist/{MLoadingIndicator-DWUj0BAB.js.map → MLoadingIndicator-RykOo5tf.js.map} +1 -1
- package/dist/{MSeekBar-C4cn9RIF.js → MSeekBar-B_Y3MpVz.js} +2 -2
- package/dist/{MSeekBar-C4cn9RIF.js.map → MSeekBar-B_Y3MpVz.js.map} +1 -1
- package/dist/MSegmentedButton-CiOOY1-N.js +105 -0
- package/dist/MSegmentedButton-CiOOY1-N.js.map +1 -0
- package/dist/MSlider-BCeVIxcq.js +739 -0
- package/dist/MSlider-BCeVIxcq.js.map +1 -0
- package/dist/{MSpinner-DZkXZJpc.js → MSpinner-Cs03qoqE.js} +2 -2
- package/dist/{MSpinner-DZkXZJpc.js.map → MSpinner-Cs03qoqE.js.map} +1 -1
- package/dist/{MTextField-CNH-byir.js → MTextField-NaFbMkjv.js} +162 -115
- package/dist/MTextField-NaFbMkjv.js.map +1 -0
- package/dist/MTooltip-CK39Zon4.js +183 -0
- package/dist/MTooltip-CK39Zon4.js.map +1 -0
- package/dist/_useFieldValidation-Bz34IAQY.js +191 -0
- package/dist/_useFieldValidation-Bz34IAQY.js.map +1 -0
- package/dist/api.json +1 -1
- package/dist/code-editor.js +184 -103
- package/dist/code-editor.js.map +1 -1
- package/dist/components/MAddressField.vue.d.ts +18 -3
- package/dist/components/MAppBarWithSearch.vue.d.ts +1 -1
- package/dist/components/MAudioRecorder.vue.d.ts +2 -2
- package/dist/components/MAutocomplete.vue.d.ts +22 -3
- package/dist/components/MCheckbox.vue.d.ts +23 -1
- package/dist/components/MCodeEditor.vue.d.ts +23 -1
- package/dist/components/MColorPicker.vue.d.ts +24 -3
- package/dist/components/MConfirmDialog.vue.d.ts +2 -2
- package/dist/components/MCountrySelect.vue.d.ts +13 -2
- package/dist/components/MCreditCardInput.vue.d.ts +33 -0
- package/dist/components/MCronField.vue.d.ts +23 -1
- package/dist/components/MDataTable.vue.d.ts +1 -1
- package/dist/components/MDatePicker.vue.d.ts +24 -3
- package/dist/components/MDateRangePicker.vue.d.ts +24 -3
- package/dist/components/MFileUpload.vue.d.ts +23 -2
- package/dist/components/MForm.vue.d.ts +61 -0
- package/dist/components/MJsonEditor.vue.d.ts +23 -1
- package/dist/components/MMapRoute.vue.d.ts +168 -0
- package/dist/components/MMaskField.vue.d.ts +20 -2
- package/dist/components/MMentionField.vue.d.ts +13 -2
- package/dist/components/MMultiAutocomplete.vue.d.ts +22 -3
- package/dist/components/MMultiSelect.vue.d.ts +22 -3
- package/dist/components/MNavigationRail.vue.d.ts +1 -1
- package/dist/components/MNotificationCenter.vue.d.ts +2 -2
- package/dist/components/MNumberField.vue.d.ts +20 -2
- package/dist/components/MPhoneInput.vue.d.ts +19 -4
- package/dist/components/MPinInput.vue.d.ts +24 -3
- package/dist/components/MPosKeypad.vue.d.ts +2 -2
- package/dist/components/MRadioGroup.vue.d.ts +23 -1
- package/dist/components/MRating.vue.d.ts +23 -1
- package/dist/components/MRichTextEditor.vue.d.ts +23 -1
- package/dist/components/MSearchBar.vue.d.ts +1 -1
- package/dist/components/MSegmentedButton.vue.d.ts +23 -2
- package/dist/components/MSelect.vue.d.ts +22 -3
- package/dist/components/MSignaturePad.vue.d.ts +19 -0
- package/dist/components/MSlider.vue.d.ts +23 -1
- package/dist/components/MSwitch.vue.d.ts +23 -1
- package/dist/components/MTable.vue.d.ts +1 -1
- package/dist/components/MTagInput.vue.d.ts +20 -2
- package/dist/components/MText.vue.d.ts +1 -1
- package/dist/components/MTextField.vue.d.ts +26 -3
- package/dist/components/MTimePicker.vue.d.ts +24 -3
- package/dist/components/MTimezoneSelect.vue.d.ts +13 -2
- package/dist/components/MTour.vue.d.ts +2 -2
- package/dist/components/MTrackingTimeline.vue.d.ts +75 -0
- package/dist/components/MWindow.vue.d.ts +2 -2
- package/dist/composables/_routeGeometry.d.ts +26 -0
- package/dist/composables/_useFieldValidation.d.ts +91 -0
- package/dist/composables/mapRouting.d.ts +35 -0
- package/dist/composables/useLocale.d.ts +23 -0
- package/dist/composables/validation.d.ts +82 -0
- package/dist/draw.js +27 -26
- package/dist/draw.js.map +1 -1
- package/dist/flow.js +1 -1
- package/dist/gantt.js +2 -2
- package/dist/index.d.ts +5 -0
- package/dist/locales/index.js +154 -7
- package/dist/locales/index.js.map +1 -1
- package/dist/m3ui-vue.css +1 -1
- package/dist/m3ui.js +7350 -6183
- package/dist/m3ui.js.map +1 -1
- package/dist/map.d.ts +4 -0
- package/dist/map.js +1319 -867
- package/dist/map.js.map +1 -1
- package/dist/media.js +4 -4
- package/dist/pdf.js +4 -4
- package/dist/rich-text-editor.js +189 -146
- package/dist/rich-text-editor.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/{useLocale-DaVSTdm0.js → useLocale-Dh1xZZ8i.js} +22 -1
- package/dist/useLocale-Dh1xZZ8i.js.map +1 -0
- package/package.json +1 -1
- package/src/__tests__/MForm.test.ts +325 -0
- package/src/__tests__/MMapRoute.test.ts +384 -0
- package/src/__tests__/MPhoneInput.test.ts +5 -2
- package/src/__tests__/MRichTextEditor.test.ts +2 -1
- package/src/__tests__/MTrackingTimeline.test.ts +66 -0
- package/src/__tests__/_fakeMaplibre.ts +4 -1
- package/src/__tests__/_osrmRoutes.ts +10 -0
- package/src/__tests__/attrsFallthrough.test.ts +11 -0
- package/src/__tests__/fieldsValidation.test.ts +229 -0
- package/src/__tests__/ssr.test.ts +1 -0
- package/src/__tests__/validation.test.ts +77 -0
- package/src/components/MAddressField.vue +45 -8
- package/src/components/MAudioRecorder.vue +9 -9
- package/src/components/MAutocomplete.vue +69 -23
- package/src/components/MCheckbox.vue +80 -17
- package/src/components/MCodeEditor.vue +59 -2
- package/src/components/MColorPicker.vue +65 -16
- package/src/components/MCountrySelect.vue +17 -3
- package/src/components/MCreditCardInput.vue +76 -7
- package/src/components/MCronField.vue +60 -10
- package/src/components/MDatePicker.vue +65 -16
- package/src/components/MDateRangePicker.vue +66 -16
- package/src/components/MFileUpload.vue +71 -8
- package/src/components/MForm.vue +208 -0
- package/src/components/MJsonEditor.vue +57 -3
- package/src/components/MMapBaseLayers.vue +29 -28
- package/src/components/MMapMeasure.vue +1 -1
- package/src/components/MMapRoute.vue +470 -0
- package/src/components/MMaskField.vue +55 -13
- package/src/components/MMentionField.vue +17 -2
- package/src/components/MMultiAutocomplete.vue +70 -23
- package/src/components/MMultiSelect.vue +70 -23
- package/src/components/MNumberField.vue +58 -16
- package/src/components/MPhoneInput.vue +60 -18
- package/src/components/MPinInput.vue +58 -10
- package/src/components/MRadioGroup.vue +65 -4
- package/src/components/MRating.vue +62 -6
- package/src/components/MRichTextEditor.vue +64 -4
- package/src/components/MSegmentedButton.vue +59 -2
- package/src/components/MSelect.vue +72 -26
- package/src/components/MSignaturePad.vue +71 -6
- package/src/components/MSlider.vue +61 -10
- package/src/components/MSwitch.vue +63 -8
- package/src/components/MTagInput.vue +67 -25
- package/src/components/MTextField.vue +68 -14
- package/src/components/MTimePicker.vue +65 -16
- package/src/components/MTimezoneSelect.vue +17 -3
- package/src/components/MTrackingTimeline.vue +257 -0
- package/src/composables/_routeGeometry.ts +140 -0
- package/src/composables/_useFieldValidation.ts +287 -0
- package/src/composables/mapRouting.ts +55 -0
- package/src/composables/useLocale.ts +46 -0
- package/src/composables/validation.ts +178 -0
- package/src/index.ts +5 -0
- package/src/locales/de.ts +21 -0
- package/src/locales/es.ts +28 -7
- package/src/locales/fr.ts +21 -0
- package/src/locales/ja.ts +21 -0
- package/src/locales/ko.ts +21 -0
- package/src/locales/pt.ts +21 -0
- package/src/locales/zh.ts +21 -0
- package/src/map.ts +4 -0
- package/dist/MListItem-D2cNUyzP.js.map +0 -1
- package/dist/MSegmentedButton-BEB4gXLA.js +0 -64
- package/dist/MSegmentedButton-BEB4gXLA.js.map +0 -1
- package/dist/MSlider-BIkA6DiE.js +0 -690
- package/dist/MSlider-BIkA6DiE.js.map +0 -1
- package/dist/MTextField-CNH-byir.js.map +0 -1
- package/dist/MTooltip-Dd5g2zhh.js +0 -754
- package/dist/MTooltip-Dd5g2zhh.js.map +0 -1
- package/dist/useLocale-DaVSTdm0.js.map +0 -1
|
@@ -1,754 +0,0 @@
|
|
|
1
|
-
import { i as e, o as t } from "./_storageKeys-C4W_4xK4.js";
|
|
2
|
-
import { i as n } from "./useLocale-DaVSTdm0.js";
|
|
3
|
-
import { t as r } from "./MIconButton-BBggVwBV.js";
|
|
4
|
-
import { t as i } from "./MIcon-DpajuUTJ.js";
|
|
5
|
-
import { t as a } from "./_plugin-vue_export-helper-Djzt4Yr7.js";
|
|
6
|
-
import { t as o } from "./MDialog-DYMnaBlt.js";
|
|
7
|
-
import { t as s } from "./MButton-OQ4wIERQ.js";
|
|
8
|
-
import { Fragment as c, Teleport as l, Transition as u, computed as d, createBlock as f, createCommentVNode as p, createElementBlock as m, createElementVNode as h, createTextVNode as g, createVNode as _, defineComponent as v, mergeProps as y, nextTick as b, normalizeClass as x, normalizeStyle as S, onMounted as C, onUnmounted as w, openBlock as T, ref as E, renderList as ee, renderSlot as D, toDisplayString as O, unref as k, watch as te, withCtx as A, withKeys as ne } from "vue";
|
|
9
|
-
// src/composables/_tooltipTrigger.ts
|
|
10
|
-
var j = 500, M = 1500, N = 120, P = 4, F = 6;
|
|
11
|
-
function I(e, t, n) {
|
|
12
|
-
let r = e.getBoundingClientRect(), i = t.getBoundingClientRect(), a = 0, o = 0;
|
|
13
|
-
switch (n) {
|
|
14
|
-
case "top":
|
|
15
|
-
a = r.top - i.height - P, o = r.left + (r.width - i.width) / 2;
|
|
16
|
-
break;
|
|
17
|
-
case "bottom":
|
|
18
|
-
a = r.bottom + P, o = r.left + (r.width - i.width) / 2;
|
|
19
|
-
break;
|
|
20
|
-
case "left":
|
|
21
|
-
a = r.top + (r.height - i.height) / 2, o = r.left - i.width - P;
|
|
22
|
-
break;
|
|
23
|
-
case "right": a = r.top + (r.height - i.height) / 2, o = r.right + P;
|
|
24
|
-
}
|
|
25
|
-
return a = Math.max(F, Math.min(a, window.innerHeight - i.height - F)), o = Math.max(F, Math.min(o, window.innerWidth - i.width - F)), {
|
|
26
|
-
top: a,
|
|
27
|
-
left: o
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
function L(e, t) {
|
|
31
|
-
let n, r, i = null, a = !1, o = () => t.rich?.() ?? !1;
|
|
32
|
-
function s() {
|
|
33
|
-
clearTimeout(n), clearTimeout(r);
|
|
34
|
-
}
|
|
35
|
-
function c() {
|
|
36
|
-
s(), n = setTimeout(t.open, t.delay());
|
|
37
|
-
}
|
|
38
|
-
function l() {
|
|
39
|
-
s(), o() ? r = setTimeout(t.close, N) : t.close();
|
|
40
|
-
}
|
|
41
|
-
function u() {
|
|
42
|
-
s(), t.close();
|
|
43
|
-
}
|
|
44
|
-
function d(e) {
|
|
45
|
-
e.pointerType === "mouse" && c();
|
|
46
|
-
}
|
|
47
|
-
function f(e) {
|
|
48
|
-
e.pointerType === "mouse" && l();
|
|
49
|
-
}
|
|
50
|
-
function p() {
|
|
51
|
-
i && clearTimeout(i.timer), i = null, window.removeEventListener("pointermove", h), window.removeEventListener("pointerup", g), window.removeEventListener("pointercancel", v);
|
|
52
|
-
}
|
|
53
|
-
function m(e) {
|
|
54
|
-
e.pointerType !== "mouse" && (p(), a = !1, i = {
|
|
55
|
-
id: e.pointerId,
|
|
56
|
-
x: e.clientX,
|
|
57
|
-
y: e.clientY,
|
|
58
|
-
timer: setTimeout(() => {
|
|
59
|
-
a = !0, s(), t.open();
|
|
60
|
-
}, j)
|
|
61
|
-
}, window.addEventListener("pointermove", h), window.addEventListener("pointerup", g), window.addEventListener("pointercancel", v));
|
|
62
|
-
}
|
|
63
|
-
function h(e) {
|
|
64
|
-
i && e.pointerId === i.id && Math.hypot(e.clientX - i.x, e.clientY - i.y) > 10 && p();
|
|
65
|
-
}
|
|
66
|
-
function g(e) {
|
|
67
|
-
i && e.pointerId === i.id && (p(), a && (s(), o() ? document.addEventListener("pointerdown", _, !0) : r = setTimeout(t.close, M)));
|
|
68
|
-
}
|
|
69
|
-
function _(n) {
|
|
70
|
-
let r = n.target;
|
|
71
|
-
t.tip()?.contains(r) || e.contains(r) || (document.removeEventListener("pointerdown", _, !0), t.close());
|
|
72
|
-
}
|
|
73
|
-
function v(e) {
|
|
74
|
-
i && e.pointerId === i.id && (p(), a && l());
|
|
75
|
-
}
|
|
76
|
-
function y(e) {
|
|
77
|
-
a && (a = !1, e.preventDefault(), e.stopPropagation());
|
|
78
|
-
}
|
|
79
|
-
function b(e) {
|
|
80
|
-
(i || a) && e.preventDefault();
|
|
81
|
-
}
|
|
82
|
-
function x(e) {
|
|
83
|
-
let t = !0;
|
|
84
|
-
try {
|
|
85
|
-
t = e.target.matches(":focus-visible");
|
|
86
|
-
} catch {}
|
|
87
|
-
t && c();
|
|
88
|
-
}
|
|
89
|
-
function S(e) {
|
|
90
|
-
e.key === "Escape" && t.visible() && (e.stopPropagation(), u());
|
|
91
|
-
}
|
|
92
|
-
function C() {
|
|
93
|
-
t.visible() && u();
|
|
94
|
-
}
|
|
95
|
-
return e.addEventListener("pointerenter", d), e.addEventListener("pointerleave", f), e.addEventListener("pointerdown", m), e.addEventListener("click", y, !0), e.addEventListener("contextmenu", b), e.addEventListener("focusin", x), e.addEventListener("focusout", l), e.addEventListener("keydown", S), window.addEventListener("scroll", C, !0), {
|
|
96
|
-
cancel: s,
|
|
97
|
-
closeNow: u,
|
|
98
|
-
destroy() {
|
|
99
|
-
s(), p(), document.removeEventListener("pointerdown", _, !0), e.removeEventListener("pointerenter", d), e.removeEventListener("pointerleave", f), e.removeEventListener("pointerdown", m), e.removeEventListener("click", y, !0), e.removeEventListener("contextmenu", b), e.removeEventListener("focusin", x), e.removeEventListener("focusout", l), e.removeEventListener("keydown", S), window.removeEventListener("scroll", C, !0);
|
|
100
|
-
}
|
|
101
|
-
};
|
|
102
|
-
}
|
|
103
|
-
// src/composables/_colorUtils.ts
|
|
104
|
-
function R(e) {
|
|
105
|
-
let t = e.trim().replace(/^#/, "");
|
|
106
|
-
if (!/^([0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(t)) return null;
|
|
107
|
-
t.length <= 4 && (t = [...t].map((e) => e + e).join(""));
|
|
108
|
-
let n = (e) => parseInt(t.substring(e, e + 2), 16);
|
|
109
|
-
return {
|
|
110
|
-
r: n(0),
|
|
111
|
-
g: n(2),
|
|
112
|
-
b: n(4),
|
|
113
|
-
a: t.length === 8 ? n(6) / 255 : 1
|
|
114
|
-
};
|
|
115
|
-
}
|
|
116
|
-
function re({ r: e, g: t, b: n, a: r }) {
|
|
117
|
-
let i = (e) => Math.round(Math.max(0, Math.min(255, e))).toString(16).padStart(2, "0");
|
|
118
|
-
return `#${i(e)}${i(t)}${i(n)}${r < 1 ? i(r * 255) : ""}`;
|
|
119
|
-
}
|
|
120
|
-
function z(e) {
|
|
121
|
-
let t = R(e);
|
|
122
|
-
return t ? re(t) : "";
|
|
123
|
-
}
|
|
124
|
-
function ie({ r: e, g: t, b: n }) {
|
|
125
|
-
e /= 255, t /= 255, n /= 255;
|
|
126
|
-
let r = Math.max(e, t, n), i = r - Math.min(e, t, n), a = 0;
|
|
127
|
-
return i !== 0 && (a = r === e ? ((t - n) / i + 6) % 6 : r === t ? (n - e) / i + 2 : (e - t) / i + 4, a *= 60), {
|
|
128
|
-
h: a,
|
|
129
|
-
s: r === 0 ? 0 : i / r * 100,
|
|
130
|
-
v: r * 100
|
|
131
|
-
};
|
|
132
|
-
}
|
|
133
|
-
function B({ h: e, s: t, v: n }, r = 1) {
|
|
134
|
-
t /= 100, n /= 100;
|
|
135
|
-
let i = (r) => {
|
|
136
|
-
let i = (r + e / 60) % 6;
|
|
137
|
-
return (n - n * t * Math.max(0, Math.min(i, 4 - i, 1))) * 255;
|
|
138
|
-
};
|
|
139
|
-
return {
|
|
140
|
-
r: i(5),
|
|
141
|
-
g: i(3),
|
|
142
|
-
b: i(1),
|
|
143
|
-
a: r
|
|
144
|
-
};
|
|
145
|
-
}
|
|
146
|
-
function ae({ h: e, s: t, v: n }) {
|
|
147
|
-
t /= 100, n /= 100;
|
|
148
|
-
let r = n * (1 - t / 2);
|
|
149
|
-
return {
|
|
150
|
-
h: e,
|
|
151
|
-
s: (r === 0 || r === 1 ? 0 : (n - r) / Math.min(r, 1 - r)) * 100,
|
|
152
|
-
l: r * 100
|
|
153
|
-
};
|
|
154
|
-
}
|
|
155
|
-
function oe({ h: e, s: t, l: n }) {
|
|
156
|
-
t /= 100, n /= 100;
|
|
157
|
-
let r = n + t * Math.min(n, 1 - n);
|
|
158
|
-
return {
|
|
159
|
-
h: e,
|
|
160
|
-
s: r === 0 ? 0 : 2 * (1 - n / r) * 100,
|
|
161
|
-
v: r * 100
|
|
162
|
-
};
|
|
163
|
-
}
|
|
164
|
-
function V(e) {
|
|
165
|
-
let t = R(e);
|
|
166
|
-
if (!t) return "#000000";
|
|
167
|
-
let n = (e) => (e /= 255, e <= .03928 ? e / 12.92 : ((e + .055) / 1.055) ** 2.4);
|
|
168
|
-
return .2126 * n(t.r) + .7152 * n(t.g) + .0722 * n(t.b) > .179 ? "#000000" : "#ffffff";
|
|
169
|
-
}
|
|
170
|
-
var H = "m3-color-recent";
|
|
171
|
-
function U() {
|
|
172
|
-
try {
|
|
173
|
-
let e = JSON.parse(localStorage.getItem(t(H)) ?? "[]");
|
|
174
|
-
return Array.isArray(e) ? e.filter((e) => typeof e == "string" && !!R(e)) : [];
|
|
175
|
-
} catch {
|
|
176
|
-
return [];
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
var W = E(U());
|
|
180
|
-
e(() => {
|
|
181
|
-
W.value = U();
|
|
182
|
-
});
|
|
183
|
-
function G(e, n) {
|
|
184
|
-
let r = z(e);
|
|
185
|
-
if (r) {
|
|
186
|
-
W.value = [r, ...W.value.filter((e) => e !== r)].slice(0, Math.max(n, 0));
|
|
187
|
-
try {
|
|
188
|
-
localStorage.setItem(t(H), JSON.stringify(W.value));
|
|
189
|
-
} catch {}
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
var K = [
|
|
193
|
-
"#f44336",
|
|
194
|
-
"#e91e63",
|
|
195
|
-
"#9c27b0",
|
|
196
|
-
"#673ab7",
|
|
197
|
-
"#3f51b5",
|
|
198
|
-
"#2196f3",
|
|
199
|
-
"#03a9f4",
|
|
200
|
-
"#00bcd4",
|
|
201
|
-
"#009688",
|
|
202
|
-
"#4caf50",
|
|
203
|
-
"#8bc34a",
|
|
204
|
-
"#cddc39",
|
|
205
|
-
"#ffeb3b",
|
|
206
|
-
"#ffc107",
|
|
207
|
-
"#ff9800",
|
|
208
|
-
"#ff5722",
|
|
209
|
-
"#795548",
|
|
210
|
-
"#607d8b",
|
|
211
|
-
"#9e9e9e",
|
|
212
|
-
"#000000",
|
|
213
|
-
"#ffffff"
|
|
214
|
-
], se = { class: "flex flex-col gap-4" }, ce = [
|
|
215
|
-
"aria-label",
|
|
216
|
-
"aria-valuenow",
|
|
217
|
-
"aria-valuetext"
|
|
218
|
-
], le = { class: "flex flex-col gap-1" }, ue = ["aria-label", "aria-valuenow"], de = [
|
|
219
|
-
"aria-label",
|
|
220
|
-
"aria-valuenow",
|
|
221
|
-
"aria-valuetext"
|
|
222
|
-
], fe = { class: "flex items-center gap-2" }, pe = { class: "flex h-10 min-w-0 flex-1" }, me = ["aria-label", "title"], he = { class: "flex items-start gap-2" }, ge = ["aria-label"], _e = ["maxlength", "value"], ve = [
|
|
223
|
-
"aria-label",
|
|
224
|
-
"value",
|
|
225
|
-
"onInput",
|
|
226
|
-
"onKeydown"
|
|
227
|
-
], ye = { class: "text-label-small text-on-surface-variant" }, be = ["aria-label"], xe = {
|
|
228
|
-
key: 0,
|
|
229
|
-
class: "text-label-medium text-on-surface-variant"
|
|
230
|
-
}, Se = { class: "grid grid-cols-7 gap-2" }, Ce = [
|
|
231
|
-
"aria-label",
|
|
232
|
-
"aria-pressed",
|
|
233
|
-
"onClick"
|
|
234
|
-
], q = 12, we = "repeating-conic-gradient(#d4d4d4 0 25%, #fff 0 50%) 0 0 / 8px 8px", J = /*#__PURE__*/ a(/* @__PURE__ */ v({
|
|
235
|
-
__name: "_MColorPanel",
|
|
236
|
-
props: {
|
|
237
|
-
modelValue: {},
|
|
238
|
-
presets: {},
|
|
239
|
-
alpha: { type: Boolean },
|
|
240
|
-
recent: { type: Boolean },
|
|
241
|
-
eyedropper: { type: Boolean },
|
|
242
|
-
original: {}
|
|
243
|
-
},
|
|
244
|
-
emits: ["update:modelValue"],
|
|
245
|
-
setup(e, { expose: t, emit: a }) {
|
|
246
|
-
let o = e, s = a, l = n(), u = E(0), v = E(100), y = E(100), b = E(1), w = d(() => re(B({
|
|
247
|
-
h: u.value,
|
|
248
|
-
s: v.value,
|
|
249
|
-
v: y.value
|
|
250
|
-
}, o.alpha ? b.value : 1))), D = d(() => re(B({
|
|
251
|
-
h: u.value,
|
|
252
|
-
s: v.value,
|
|
253
|
-
v: y.value
|
|
254
|
-
}))), A = d(() => `hsl(${u.value}, 100%, 50%)`);
|
|
255
|
-
function j(e) {
|
|
256
|
-
let t = ie(e);
|
|
257
|
-
t.v > 0 && t.s > 0 && (u.value = t.h), t.v > 0 && (v.value = t.s), y.value = t.v, b.value = o.alpha ? e.a : 1;
|
|
258
|
-
}
|
|
259
|
-
let M = "";
|
|
260
|
-
function N() {
|
|
261
|
-
M = w.value, w.value !== z(o.modelValue) && s("update:modelValue", w.value);
|
|
262
|
-
}
|
|
263
|
-
te(() => o.modelValue, (e) => {
|
|
264
|
-
let t = z(e);
|
|
265
|
-
t && t !== M && (j(R(t)), M = t);
|
|
266
|
-
}, { immediate: !0 });
|
|
267
|
-
function P(e) {
|
|
268
|
-
let t = R(e);
|
|
269
|
-
t && (j(t), N());
|
|
270
|
-
}
|
|
271
|
-
let F = E(), I = E(), L = E(), H = E(null), U = (e, t, n) => Math.min(n, Math.max(t, e));
|
|
272
|
-
function G(e, t) {
|
|
273
|
-
let n = e === "area" ? F.value : e === "hue" ? I.value : L.value;
|
|
274
|
-
if (!n) return;
|
|
275
|
-
let r = n.getBoundingClientRect();
|
|
276
|
-
if (e === "area") v.value = U((t.clientX - r.left) / r.width * 100, 0, 100), y.value = U((1 - (t.clientY - r.top) / r.height) * 100, 0, 100);
|
|
277
|
-
else {
|
|
278
|
-
let n = U((t.clientX - r.left - q) / (r.width - 24), 0, 1);
|
|
279
|
-
e === "hue" ? u.value = n * 360 : b.value = Math.round(n * 100) / 100;
|
|
280
|
-
}
|
|
281
|
-
N();
|
|
282
|
-
}
|
|
283
|
-
function K(e, t) {
|
|
284
|
-
t.button === 0 && (t.preventDefault(), t.currentTarget.focus({ preventScroll: !0 }), t.currentTarget.setPointerCapture?.(t.pointerId), H.value = e, G(e, t));
|
|
285
|
-
}
|
|
286
|
-
function J(e, t) {
|
|
287
|
-
H.value === e && G(e, t);
|
|
288
|
-
}
|
|
289
|
-
function Y() {
|
|
290
|
-
H.value = null;
|
|
291
|
-
}
|
|
292
|
-
function X(e, t) {
|
|
293
|
-
let n = t.shiftKey ? 10 : 1, r = t.key === "ArrowRight" ? n : t.key === "ArrowLeft" ? -n : 0, i = t.key === "ArrowUp" ? n : t.key === "ArrowDown" ? -n : 0;
|
|
294
|
-
if (e === "area") {
|
|
295
|
-
if (!r && !i) return;
|
|
296
|
-
v.value = U(v.value + r, 0, 100), y.value = U(y.value + i, 0, 100);
|
|
297
|
-
} else {
|
|
298
|
-
let n = e === "hue" ? 360 : 100, a = e === "hue" ? u.value : b.value * 100, o;
|
|
299
|
-
if (t.key === "Home") o = 0;
|
|
300
|
-
else if (t.key === "End") o = n;
|
|
301
|
-
else if (r || i) o = U(a + (r || i), 0, n);
|
|
302
|
-
else return;
|
|
303
|
-
e === "hue" ? u.value = o : b.value = Math.round(o) / 100;
|
|
304
|
-
}
|
|
305
|
-
t.preventDefault(), N();
|
|
306
|
-
}
|
|
307
|
-
let Te = E(!1);
|
|
308
|
-
C(() => {
|
|
309
|
-
Te.value = "EyeDropper" in window;
|
|
310
|
-
});
|
|
311
|
-
async function Ee() {
|
|
312
|
-
try {
|
|
313
|
-
let e = window.EyeDropper, { sRGBHex: t } = await new e().open(), n = R(t);
|
|
314
|
-
n && (j({
|
|
315
|
-
...n,
|
|
316
|
-
a: b.value
|
|
317
|
-
}), N());
|
|
318
|
-
} catch {}
|
|
319
|
-
}
|
|
320
|
-
let Z = [
|
|
321
|
-
{
|
|
322
|
-
id: "hex",
|
|
323
|
-
label: "HEX"
|
|
324
|
-
},
|
|
325
|
-
{
|
|
326
|
-
id: "rgb",
|
|
327
|
-
label: "RGB"
|
|
328
|
-
},
|
|
329
|
-
{
|
|
330
|
-
id: "hsl",
|
|
331
|
-
label: "HSL"
|
|
332
|
-
}
|
|
333
|
-
], Q = E("hex"), De = d(() => Z.find((e) => e.id === Q.value).label);
|
|
334
|
-
function Oe() {
|
|
335
|
-
Q.value = Z[(Z.findIndex((e) => e.id === Q.value) + 1) % Z.length].id, $.value = null;
|
|
336
|
-
}
|
|
337
|
-
function ke(e) {
|
|
338
|
-
u.value = e.h, v.value = e.s, y.value = e.v;
|
|
339
|
-
}
|
|
340
|
-
let Ae = d(() => ({
|
|
341
|
-
key: "a",
|
|
342
|
-
label: "A",
|
|
343
|
-
display: String(Math.round(b.value * 100)),
|
|
344
|
-
max: 100,
|
|
345
|
-
apply: (e) => {
|
|
346
|
-
b.value = e / 100;
|
|
347
|
-
}
|
|
348
|
-
})), je = d(() => {
|
|
349
|
-
let e = [];
|
|
350
|
-
if (Q.value === "rgb") {
|
|
351
|
-
let t = B({
|
|
352
|
-
h: u.value,
|
|
353
|
-
s: v.value,
|
|
354
|
-
v: y.value
|
|
355
|
-
}), n = {
|
|
356
|
-
r: Math.round(t.r),
|
|
357
|
-
g: Math.round(t.g),
|
|
358
|
-
b: Math.round(t.b),
|
|
359
|
-
a: b.value
|
|
360
|
-
};
|
|
361
|
-
for (let t of [
|
|
362
|
-
"r",
|
|
363
|
-
"g",
|
|
364
|
-
"b"
|
|
365
|
-
]) e.push({
|
|
366
|
-
key: t,
|
|
367
|
-
label: t.toUpperCase(),
|
|
368
|
-
display: String(n[t]),
|
|
369
|
-
max: 255,
|
|
370
|
-
apply: (e) => j({
|
|
371
|
-
...n,
|
|
372
|
-
[t]: e
|
|
373
|
-
})
|
|
374
|
-
});
|
|
375
|
-
} else if (Q.value === "hsl") {
|
|
376
|
-
let t = ae({
|
|
377
|
-
h: u.value,
|
|
378
|
-
s: v.value,
|
|
379
|
-
v: y.value
|
|
380
|
-
}), n = {
|
|
381
|
-
h: Math.round(t.h),
|
|
382
|
-
s: Math.round(t.s),
|
|
383
|
-
l: Math.round(t.l)
|
|
384
|
-
};
|
|
385
|
-
for (let t of [
|
|
386
|
-
"h",
|
|
387
|
-
"s",
|
|
388
|
-
"l"
|
|
389
|
-
]) e.push({
|
|
390
|
-
key: t,
|
|
391
|
-
label: t.toUpperCase(),
|
|
392
|
-
display: String(n[t]),
|
|
393
|
-
max: t === "h" ? 360 : 100,
|
|
394
|
-
apply: (e) => ke(oe({
|
|
395
|
-
...n,
|
|
396
|
-
[t]: e
|
|
397
|
-
}))
|
|
398
|
-
});
|
|
399
|
-
}
|
|
400
|
-
return o.alpha && Q.value !== "hex" && e.push(Ae.value), e;
|
|
401
|
-
}), $ = E(null), Me = (e, t) => $.value?.key === e ? $.value.text : t;
|
|
402
|
-
function Ne(e) {
|
|
403
|
-
let t = e.target.value;
|
|
404
|
-
$.value = {
|
|
405
|
-
key: "hex",
|
|
406
|
-
text: t
|
|
407
|
-
};
|
|
408
|
-
let n = R(t);
|
|
409
|
-
n && (j(n), N());
|
|
410
|
-
}
|
|
411
|
-
function Pe(e, t) {
|
|
412
|
-
let n = t.target.value;
|
|
413
|
-
if ($.value = {
|
|
414
|
-
key: e.key,
|
|
415
|
-
text: n
|
|
416
|
-
}, !/^\d+$/.test(n.trim())) return;
|
|
417
|
-
let r = Number(n);
|
|
418
|
-
r > e.max || (e.apply(r), N());
|
|
419
|
-
}
|
|
420
|
-
function Fe(e, t) {
|
|
421
|
-
if (t.key === "Enter") {
|
|
422
|
-
$.value = null;
|
|
423
|
-
return;
|
|
424
|
-
}
|
|
425
|
-
if (t.key !== "ArrowUp" && t.key !== "ArrowDown") return;
|
|
426
|
-
t.preventDefault();
|
|
427
|
-
let n = (t.shiftKey ? 10 : 1) * (t.key === "ArrowUp" ? 1 : -1);
|
|
428
|
-
e.apply(U(Number(e.display) + n, 0, e.max)), $.value = null, N();
|
|
429
|
-
}
|
|
430
|
-
let Ie = d(() => o.recent ? W.value : []), Le = (e) => z(e) === w.value, Re = (e) => `linear-gradient(${e}, ${e}), ${we}`, ze = d(() => b.value < .5 ? "#000000" : V(D.value)), Be = d(() => !!o.original && !!z(o.original) && z(o.original) !== w.value);
|
|
431
|
-
return t({ focus: () => F.value?.focus({ preventScroll: !0 }) }), (t, n) => (T(), m("div", se, [
|
|
432
|
-
h("div", {
|
|
433
|
-
ref_key: "areaEl",
|
|
434
|
-
ref: F,
|
|
435
|
-
role: "slider",
|
|
436
|
-
tabindex: "0",
|
|
437
|
-
"aria-label": `${k(l).colorSaturation}, ${k(l).colorBrightness}`,
|
|
438
|
-
"aria-valuenow": Math.round(v.value),
|
|
439
|
-
"aria-valuemin": "0",
|
|
440
|
-
"aria-valuemax": "100",
|
|
441
|
-
"aria-valuetext": `${k(l).colorSaturation} ${Math.round(v.value)}%, ${k(l).colorBrightness} ${Math.round(y.value)}%`,
|
|
442
|
-
class: "relative h-40 w-full shrink-0 cursor-crosshair touch-none rounded-md outline-none focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary",
|
|
443
|
-
style: S({ background: `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, ${A.value})` }),
|
|
444
|
-
onPointerdown: n[0] ||= (e) => K("area", e),
|
|
445
|
-
onPointermove: n[1] ||= (e) => J("area", e),
|
|
446
|
-
onPointerup: Y,
|
|
447
|
-
onPointercancel: Y,
|
|
448
|
-
onKeydown: n[2] ||= (e) => X("area", e)
|
|
449
|
-
}, [h("span", {
|
|
450
|
-
class: x(["m3-cp-area-thumb pointer-events-none absolute size-5 -translate-x-1/2 -translate-y-1/2 rounded-full border-2 border-white transition-[scale] duration-150", H.value === "area" ? "scale-125" : ""]),
|
|
451
|
-
style: S({
|
|
452
|
-
left: `${v.value}%`,
|
|
453
|
-
top: `${100 - y.value}%`,
|
|
454
|
-
backgroundColor: D.value
|
|
455
|
-
})
|
|
456
|
-
}, null, 6)], 44, ce),
|
|
457
|
-
h("div", le, [h("div", {
|
|
458
|
-
ref_key: "hueEl",
|
|
459
|
-
ref: I,
|
|
460
|
-
role: "slider",
|
|
461
|
-
tabindex: "0",
|
|
462
|
-
"aria-label": k(l).colorHue,
|
|
463
|
-
"aria-valuenow": Math.round(u.value),
|
|
464
|
-
"aria-valuemin": "0",
|
|
465
|
-
"aria-valuemax": "360",
|
|
466
|
-
class: "m3-cp-slider group",
|
|
467
|
-
onPointerdown: n[3] ||= (e) => K("hue", e),
|
|
468
|
-
onPointermove: n[4] ||= (e) => J("hue", e),
|
|
469
|
-
onPointerup: Y,
|
|
470
|
-
onPointercancel: Y,
|
|
471
|
-
onKeydown: n[5] ||= (e) => X("hue", e)
|
|
472
|
-
}, [n[13] ||= h("span", { class: "m3-cp-track m3-cp-hue" }, null, -1), h("span", {
|
|
473
|
-
class: x(["m3-cp-handle", { "m3-cp-handle-pressed": H.value === "hue" }]),
|
|
474
|
-
style: S({ left: `calc(${q}px + ${u.value / 360} * (100% - 24px))` })
|
|
475
|
-
}, null, 6)], 40, ue), e.alpha ? (T(), m("div", {
|
|
476
|
-
key: 0,
|
|
477
|
-
ref_key: "alphaEl",
|
|
478
|
-
ref: L,
|
|
479
|
-
role: "slider",
|
|
480
|
-
tabindex: "0",
|
|
481
|
-
"aria-label": k(l).colorAlpha,
|
|
482
|
-
"aria-valuenow": Math.round(b.value * 100),
|
|
483
|
-
"aria-valuemin": "0",
|
|
484
|
-
"aria-valuemax": "100",
|
|
485
|
-
"aria-valuetext": `${Math.round(b.value * 100)}%`,
|
|
486
|
-
class: "m3-cp-slider group",
|
|
487
|
-
onPointerdown: n[6] ||= (e) => K("alpha", e),
|
|
488
|
-
onPointermove: n[7] ||= (e) => J("alpha", e),
|
|
489
|
-
onPointerup: Y,
|
|
490
|
-
onPointercancel: Y,
|
|
491
|
-
onKeydown: n[8] ||= (e) => X("alpha", e)
|
|
492
|
-
}, [h("span", {
|
|
493
|
-
class: "m3-cp-track",
|
|
494
|
-
style: S({ background: `linear-gradient(to right, transparent, ${D.value}), ${we}` })
|
|
495
|
-
}, null, 4), h("span", {
|
|
496
|
-
class: x(["m3-cp-handle", { "m3-cp-handle-pressed": H.value === "alpha" }]),
|
|
497
|
-
style: S({ left: `calc(${q}px + ${b.value} * (100% - 24px))` })
|
|
498
|
-
}, null, 6)], 40, de)) : p("", !0)]),
|
|
499
|
-
h("div", fe, [h("div", pe, [Be.value ? (T(), m("button", {
|
|
500
|
-
key: 0,
|
|
501
|
-
type: "button",
|
|
502
|
-
class: "m3-cp-swatch flex w-12 shrink-0 cursor-pointer items-center justify-center rounded-l-full outline-none focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary",
|
|
503
|
-
style: S({ background: Re(e.original) }),
|
|
504
|
-
"aria-label": k(l).colorOriginal,
|
|
505
|
-
title: k(l).colorOriginal,
|
|
506
|
-
onClick: n[9] ||= (t) => P(e.original)
|
|
507
|
-
}, [_(i, {
|
|
508
|
-
name: "undo",
|
|
509
|
-
size: 18,
|
|
510
|
-
style: S({ color: k(V)(e.original) })
|
|
511
|
-
}, null, 8, ["style"])], 12, me)) : p("", !0), h("span", {
|
|
512
|
-
class: x(["m3-cp-swatch flex min-w-0 flex-1 items-center px-4 font-mono text-label-large transition-[border-radius] duration-200", Be.value ? "rounded-r-full" : "rounded-full"]),
|
|
513
|
-
style: S({
|
|
514
|
-
background: Re(w.value),
|
|
515
|
-
color: ze.value
|
|
516
|
-
})
|
|
517
|
-
}, O(w.value), 7)]), e.eyedropper && Te.value ? (T(), f(r, {
|
|
518
|
-
key: 0,
|
|
519
|
-
icon: "colorize",
|
|
520
|
-
variant: "tonal",
|
|
521
|
-
label: k(l).colorEyedropper,
|
|
522
|
-
onClick: Ee
|
|
523
|
-
}, null, 8, ["label"])) : p("", !0)]),
|
|
524
|
-
h("div", he, [
|
|
525
|
-
h("button", {
|
|
526
|
-
type: "button",
|
|
527
|
-
class: "flex h-10 shrink-0 cursor-pointer items-center gap-0.5 rounded-full bg-secondary-container pr-2 pl-3 text-label-large text-on-secondary-container outline-none transition-[background-color] duration-150 hover:bg-[color-mix(in_srgb,var(--color-secondary-container),var(--color-on-secondary-container)_8%)] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary",
|
|
528
|
-
"aria-label": `${k(l).colorFormat}: ${De.value}`,
|
|
529
|
-
onClick: Oe
|
|
530
|
-
}, [g(O(De.value) + " ", 1), _(i, {
|
|
531
|
-
name: "unfold_more",
|
|
532
|
-
size: 18
|
|
533
|
-
})], 8, ge),
|
|
534
|
-
Q.value === "hex" ? (T(), m("input", {
|
|
535
|
-
key: 0,
|
|
536
|
-
type: "text",
|
|
537
|
-
spellcheck: "false",
|
|
538
|
-
autocomplete: "off",
|
|
539
|
-
maxlength: e.alpha ? 9 : 7,
|
|
540
|
-
"aria-label": "HEX",
|
|
541
|
-
value: Me("hex", w.value),
|
|
542
|
-
class: "m3-cp-field min-w-0 flex-1 font-mono text-body-medium",
|
|
543
|
-
onInput: Ne,
|
|
544
|
-
onBlur: n[10] ||= (e) => $.value = null,
|
|
545
|
-
onKeydown: n[11] ||= ne((e) => $.value = null, ["enter"])
|
|
546
|
-
}, null, 40, _e)) : p("", !0),
|
|
547
|
-
(T(!0), m(c, null, ee(je.value, (e) => (T(), m("label", {
|
|
548
|
-
key: e.key,
|
|
549
|
-
class: "flex min-w-0 flex-1 flex-col items-center gap-1"
|
|
550
|
-
}, [h("input", {
|
|
551
|
-
type: "text",
|
|
552
|
-
inputmode: "numeric",
|
|
553
|
-
autocomplete: "off",
|
|
554
|
-
maxlength: 3,
|
|
555
|
-
"aria-label": e.label,
|
|
556
|
-
value: Me(e.key, e.display),
|
|
557
|
-
class: "m3-cp-field w-full font-mono text-body-medium",
|
|
558
|
-
onInput: (t) => Pe(e, t),
|
|
559
|
-
onKeydown: (t) => Fe(e, t),
|
|
560
|
-
onBlur: n[12] ||= (e) => $.value = null
|
|
561
|
-
}, null, 40, ve), h("span", ye, O(e.label), 1)]))), 128))
|
|
562
|
-
]),
|
|
563
|
-
(T(!0), m(c, null, ee([{
|
|
564
|
-
id: "recent",
|
|
565
|
-
label: k(l).colorRecent,
|
|
566
|
-
colors: Ie.value
|
|
567
|
-
}, {
|
|
568
|
-
id: "presets",
|
|
569
|
-
label: k(l).colorPresets,
|
|
570
|
-
colors: e.presets
|
|
571
|
-
}], (e) => (T(), m(c, { key: e.id }, [e.colors.length ? (T(), m("div", {
|
|
572
|
-
key: 0,
|
|
573
|
-
role: "group",
|
|
574
|
-
"aria-label": e.label,
|
|
575
|
-
class: "flex flex-col gap-2"
|
|
576
|
-
}, [Ie.value.length ? (T(), m("span", xe, O(e.label), 1)) : p("", !0), h("div", Se, [(T(!0), m(c, null, ee(e.colors, (e) => (T(), m("button", {
|
|
577
|
-
key: e,
|
|
578
|
-
type: "button",
|
|
579
|
-
class: x(["m3-cp-swatch m3-cp-morph flex aspect-square cursor-pointer items-center justify-center outline-none focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary", { "m3-cp-morph-selected": Le(e) }]),
|
|
580
|
-
style: S({ background: Re(e) }),
|
|
581
|
-
"aria-label": e,
|
|
582
|
-
"aria-pressed": Le(e),
|
|
583
|
-
onClick: (t) => P(e)
|
|
584
|
-
}, [Le(e) ? (T(), f(i, {
|
|
585
|
-
key: 0,
|
|
586
|
-
name: "check",
|
|
587
|
-
size: 18,
|
|
588
|
-
style: S({ color: k(V)(e) })
|
|
589
|
-
}, null, 8, ["style"])) : p("", !0)], 14, Ce))), 128))])], 8, be)) : p("", !0)], 64))), 128))
|
|
590
|
-
]));
|
|
591
|
-
}
|
|
592
|
-
}), [["__scopeId", "data-v-87647feb"]]), Y = /* @__PURE__ */ v({
|
|
593
|
-
__name: "MColorPickerModal",
|
|
594
|
-
props: {
|
|
595
|
-
modelValue: {},
|
|
596
|
-
show: {
|
|
597
|
-
type: Boolean,
|
|
598
|
-
default: !1
|
|
599
|
-
},
|
|
600
|
-
presets: { default: () => K },
|
|
601
|
-
title: {},
|
|
602
|
-
alpha: {
|
|
603
|
-
type: Boolean,
|
|
604
|
-
default: !1
|
|
605
|
-
},
|
|
606
|
-
recent: {
|
|
607
|
-
type: Boolean,
|
|
608
|
-
default: !0
|
|
609
|
-
},
|
|
610
|
-
recentLimit: { default: 7 },
|
|
611
|
-
eyedropper: {
|
|
612
|
-
type: Boolean,
|
|
613
|
-
default: !0
|
|
614
|
-
}
|
|
615
|
-
},
|
|
616
|
-
emits: ["update:modelValue", "update:show"],
|
|
617
|
-
setup(e, { emit: t }) {
|
|
618
|
-
let r = e, i = n(), a = t, c = E(r.modelValue);
|
|
619
|
-
te(() => r.show, (e) => {
|
|
620
|
-
e && (c.value = r.modelValue);
|
|
621
|
-
}, { immediate: !0 });
|
|
622
|
-
function l() {
|
|
623
|
-
a("update:show", !1);
|
|
624
|
-
}
|
|
625
|
-
function u() {
|
|
626
|
-
let e = z(c.value) || c.value;
|
|
627
|
-
r.recent && G(e, r.recentLimit), a("update:modelValue", e), a("update:show", !1);
|
|
628
|
-
}
|
|
629
|
-
return (t, n) => (T(), f(o, {
|
|
630
|
-
"model-value": e.show,
|
|
631
|
-
title: e.title || k(i).selectColor,
|
|
632
|
-
"max-width": "328px",
|
|
633
|
-
closable: !1,
|
|
634
|
-
"onUpdate:modelValue": n[1] ||= (e) => !e && l()
|
|
635
|
-
}, {
|
|
636
|
-
actions: A(() => [_(s, {
|
|
637
|
-
variant: "text",
|
|
638
|
-
onClick: l
|
|
639
|
-
}, {
|
|
640
|
-
default: A(() => [g(O(k(i).cancel), 1)]),
|
|
641
|
-
_: 1
|
|
642
|
-
}), _(s, {
|
|
643
|
-
variant: "text",
|
|
644
|
-
onClick: u
|
|
645
|
-
}, {
|
|
646
|
-
default: A(() => [g(O(k(i).confirm), 1)]),
|
|
647
|
-
_: 1
|
|
648
|
-
})]),
|
|
649
|
-
default: A(() => [_(J, {
|
|
650
|
-
modelValue: c.value,
|
|
651
|
-
"onUpdate:modelValue": n[0] ||= (e) => c.value = e,
|
|
652
|
-
presets: e.presets,
|
|
653
|
-
alpha: e.alpha,
|
|
654
|
-
recent: e.recent,
|
|
655
|
-
eyedropper: e.eyedropper,
|
|
656
|
-
original: e.modelValue
|
|
657
|
-
}, null, 8, [
|
|
658
|
-
"modelValue",
|
|
659
|
-
"presets",
|
|
660
|
-
"alpha",
|
|
661
|
-
"recent",
|
|
662
|
-
"eyedropper",
|
|
663
|
-
"original"
|
|
664
|
-
])]),
|
|
665
|
-
_: 1
|
|
666
|
-
}, 8, ["model-value", "title"]));
|
|
667
|
-
}
|
|
668
|
-
}), X = {
|
|
669
|
-
key: 0,
|
|
670
|
-
class: "px-4 pt-3 pb-1 text-title-small font-medium text-on-surface-variant"
|
|
671
|
-
}, Te = { class: "px-4 py-2 text-body-medium text-on-surface-variant" }, Ee = {
|
|
672
|
-
key: 1,
|
|
673
|
-
class: "flex justify-end gap-2 px-4 pb-3"
|
|
674
|
-
}, Z = /* @__PURE__ */ v({
|
|
675
|
-
inheritAttrs: !1,
|
|
676
|
-
__name: "MTooltip",
|
|
677
|
-
props: {
|
|
678
|
-
text: {},
|
|
679
|
-
placement: { default: "top" },
|
|
680
|
-
delay: { default: 600 },
|
|
681
|
-
rich: {
|
|
682
|
-
type: Boolean,
|
|
683
|
-
default: !1
|
|
684
|
-
}
|
|
685
|
-
},
|
|
686
|
-
setup(e) {
|
|
687
|
-
let t = e, n = E(!1), r = E(), i = E(), a = E({}), o;
|
|
688
|
-
async function s() {
|
|
689
|
-
n.value = !0, await b(), v();
|
|
690
|
-
}
|
|
691
|
-
function d() {
|
|
692
|
-
t.rich && o?.cancel();
|
|
693
|
-
}
|
|
694
|
-
function g() {
|
|
695
|
-
t.rich && o?.closeNow();
|
|
696
|
-
}
|
|
697
|
-
function v() {
|
|
698
|
-
if (!i.value || !r.value) return;
|
|
699
|
-
let { top: e, left: n } = I(i.value, r.value, t.placement);
|
|
700
|
-
a.value = {
|
|
701
|
-
top: `${e}px`,
|
|
702
|
-
left: `${n}px`
|
|
703
|
-
};
|
|
704
|
-
}
|
|
705
|
-
return C(() => {
|
|
706
|
-
o = L(i.value, {
|
|
707
|
-
delay: () => t.delay,
|
|
708
|
-
rich: () => t.rich,
|
|
709
|
-
visible: () => n.value,
|
|
710
|
-
open: s,
|
|
711
|
-
close: () => {
|
|
712
|
-
n.value = !1;
|
|
713
|
-
},
|
|
714
|
-
tip: () => r.value
|
|
715
|
-
});
|
|
716
|
-
}), w(() => o?.destroy()), (t, o) => (T(), m(c, null, [h("span", y({
|
|
717
|
-
ref_key: "triggerEl",
|
|
718
|
-
ref: i
|
|
719
|
-
}, t.$attrs, { class: "inline-flex" }), [D(t.$slots, "default")], 16), (T(), f(l, { to: "body" }, [_(u, {
|
|
720
|
-
"enter-active-class": "transition-opacity duration-150",
|
|
721
|
-
"enter-from-class": "opacity-0",
|
|
722
|
-
"enter-to-class": "opacity-100",
|
|
723
|
-
"leave-active-class": "transition-opacity duration-100",
|
|
724
|
-
"leave-from-class": "opacity-100",
|
|
725
|
-
"leave-to-class": "opacity-0"
|
|
726
|
-
}, {
|
|
727
|
-
default: A(() => [n.value && !e.rich && e.text ? (T(), m("div", {
|
|
728
|
-
key: 0,
|
|
729
|
-
ref_key: "tipEl",
|
|
730
|
-
ref: r,
|
|
731
|
-
class: "pointer-events-none fixed z-400 min-h-6 min-w-10 max-w-[200px] rounded bg-inverse-surface px-2 py-1 text-body-small text-inverse-on-surface",
|
|
732
|
-
style: S(a.value),
|
|
733
|
-
role: "tooltip"
|
|
734
|
-
}, O(e.text), 5)) : n.value && e.rich ? (T(), m("div", {
|
|
735
|
-
key: 1,
|
|
736
|
-
ref_key: "tipEl",
|
|
737
|
-
ref: r,
|
|
738
|
-
class: "fixed z-400 max-w-[320px] rounded-xl bg-surface-container shadow-elevation-2",
|
|
739
|
-
style: S(a.value),
|
|
740
|
-
role: "tooltip",
|
|
741
|
-
onMouseenter: d,
|
|
742
|
-
onMouseleave: g
|
|
743
|
-
}, [
|
|
744
|
-
e.text ? (T(), m("div", X, O(e.text), 1)) : p("", !0),
|
|
745
|
-
h("div", Te, [D(t.$slots, "content")]),
|
|
746
|
-
t.$slots.actions ? (T(), m("div", Ee, [D(t.$slots, "actions")])) : p("", !0)
|
|
747
|
-
], 36)) : p("", !0)]),
|
|
748
|
-
_: 3
|
|
749
|
-
})]))], 64));
|
|
750
|
-
}
|
|
751
|
-
});
|
|
752
|
-
export { z as a, I as c, K as i, Y as n, G as o, J as r, L as s, Z as t };
|
|
753
|
-
|
|
754
|
-
//# sourceMappingURL=MTooltip-Dd5g2zhh.js.map
|