morya-ui 0.4.5 → 0.5.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/CHANGELOG.md +41 -2
- package/dist/{Input-D2bee2LU.js → Input-BErawS7K.js} +1 -5
- package/dist/InputNumber-DjbXtTzR.js +245 -0
- package/dist/{Pagination-DpNOb0CS.js → Pagination-B8WYoL2a.js} +1 -1
- package/dist/{Popover-Bnz7KNZq.js → Popover-zQChu00_.js} +6 -1
- package/dist/{Select-q4X2ff_M.js → Select-BaFKBeIh.js} +2 -2
- package/dist/{Textarea-DsFOAtPd.js → Textarea-WCEgpzbq.js} +1 -5
- package/dist/accordion/style.css +6 -15
- package/dist/affix/style.css +6 -15
- package/dist/alert/style.css +6 -15
- package/dist/anchor/style.css +6 -15
- package/dist/auto-complete/style.css +6 -15
- package/dist/avatar/style.css +6 -15
- package/dist/badge/style.css +6 -15
- package/dist/block-ui/style.css +6 -15
- package/dist/breadcrumb/style.css +6 -15
- package/dist/button/style.css +6 -15
- package/dist/calendar/index.js +1 -1
- package/dist/calendar/style.css +6 -15
- package/dist/card/style.css +6 -15
- package/dist/carousel/style.css +6 -15
- package/dist/cascade-select/style.css +6 -15
- package/dist/checkbox/style.css +6 -15
- package/dist/chip/style.css +6 -15
- package/dist/color-picker/index.js +676 -0
- package/dist/{input-color → color-picker}/style.css +1406 -83
- package/dist/color-picker/style.js +8 -0
- package/dist/command-menu/index.js +73 -66
- package/dist/command-menu/style.css +6 -15
- package/dist/components/ColorPicker/ColorPicker.vue.d.ts +41 -0
- package/dist/components/ColorPicker/ColorPicker.vue.d.ts.map +1 -0
- package/dist/components/ColorPicker/colorUtils.d.ts +23 -0
- package/dist/components/ColorPicker/colorUtils.d.ts.map +1 -0
- package/dist/components/ColorPicker/gradientUtils.d.ts +9 -0
- package/dist/components/ColorPicker/gradientUtils.d.ts.map +1 -0
- package/dist/components/ColorPicker/index.d.ts +3 -0
- package/dist/components/ColorPicker/index.d.ts.map +1 -0
- package/dist/components/ColorPicker/styles.css +405 -0
- package/dist/components/ColorPicker/types.d.ts +60 -0
- package/dist/components/ColorPicker/types.d.ts.map +1 -0
- package/dist/components/CommandMenu/CommandMenu.vue.d.ts.map +1 -1
- package/dist/components/ContextMenu/ContextMenuNodes.vue.d.ts.map +1 -1
- package/dist/components/ContextMenu/styles.css +1 -1
- package/dist/components/Dock/Dock.vue.d.ts.map +1 -1
- package/dist/components/Dropdown/DropdownNodes.vue.d.ts.map +1 -1
- package/dist/components/Dropdown/styles.css +1 -1
- package/dist/components/Input/Input.vue.d.ts +0 -1
- package/dist/components/Input/Input.vue.d.ts.map +1 -1
- package/dist/components/Input/types.d.ts +0 -2
- package/dist/components/Input/types.d.ts.map +1 -1
- package/dist/components/InputNumber/styles.css +28 -10
- package/dist/components/InputPassword/InputPassword.vue.d.ts +0 -1
- package/dist/components/InputPassword/InputPassword.vue.d.ts.map +1 -1
- package/dist/components/InputPassword/types.d.ts +0 -2
- package/dist/components/InputPassword/types.d.ts.map +1 -1
- package/dist/components/MegaMenu/MegaMenu.vue.d.ts.map +1 -1
- package/dist/components/Mentions/Mentions.vue.d.ts +0 -1
- package/dist/components/Mentions/Mentions.vue.d.ts.map +1 -1
- package/dist/components/Mentions/types.d.ts +0 -2
- package/dist/components/Mentions/types.d.ts.map +1 -1
- package/dist/components/Menu/Menu.vue.d.ts.map +1 -1
- package/dist/components/Menu/MenuNodes.vue.d.ts.map +1 -1
- package/dist/components/Menu/styles.css +45 -3
- package/dist/components/Menu/types.d.ts +3 -1
- package/dist/components/Menu/types.d.ts.map +1 -1
- package/dist/components/Menubar/Menubar.vue.d.ts +2 -2
- package/dist/components/Menubar/Menubar.vue.d.ts.map +1 -1
- package/dist/components/Menubar/styles.css +1 -1
- package/dist/components/Popover/Popover.vue.d.ts.map +1 -1
- package/dist/components/Rating/Rating.vue.d.ts +1 -1
- package/dist/components/Rating/types.d.ts +2 -2
- package/dist/components/Rating/types.d.ts.map +1 -1
- package/dist/components/Select/Select.vue.d.ts +1 -1
- package/dist/components/Select/types.d.ts +1 -1
- package/dist/components/Select/types.d.ts.map +1 -1
- package/dist/components/Sidebar/Sidebar.vue.d.ts.map +1 -1
- package/dist/components/SpeedDial/SpeedDial.vue.d.ts +3 -3
- package/dist/components/SpeedDial/SpeedDial.vue.d.ts.map +1 -1
- package/dist/components/SplitButton/SplitButton.vue.d.ts.map +1 -1
- package/dist/components/Textarea/Textarea.vue.d.ts +0 -1
- package/dist/components/Textarea/Textarea.vue.d.ts.map +1 -1
- package/dist/components/Textarea/types.d.ts +0 -2
- package/dist/components/Textarea/types.d.ts.map +1 -1
- package/dist/components/TieredMenu/styles.css +2 -2
- package/dist/components/Tooltip/styles.css +15 -2
- package/dist/config-provider/style.css +6 -15
- package/dist/confirm-dialog/style.css +6 -15
- package/dist/confirm-popup/style.css +6 -15
- package/dist/context-menu/index.js +92 -84
- package/dist/context-menu/style.css +7 -16
- package/dist/data-view/index.js +1 -1
- package/dist/data-view/style.css +6 -15
- package/dist/date-picker/style.css +6 -15
- package/dist/descriptions/style.css +6 -15
- package/dist/dialog/style.css +6 -15
- package/dist/divider/style.css +6 -15
- package/dist/dock/index.js +21 -18
- package/dist/dock/style.css +6 -15
- package/dist/drawer/style.css +6 -15
- package/dist/dropdown/index.js +103 -95
- package/dist/dropdown/style.css +7 -16
- package/dist/empty/style.css +6 -15
- package/dist/fieldset/style.css +6 -15
- package/dist/file-upload/style.css +6 -15
- package/dist/flex/style.css +6 -15
- package/dist/float-label/style.css +6 -15
- package/dist/fluid/style.css +6 -15
- package/dist/form/style.css +6 -15
- package/dist/gallery/style.css +6 -15
- package/dist/grid/style.css +6 -15
- package/dist/icon/style.css +6 -15
- package/dist/{icon-H8prbteT.js → icon-CUrSaD8r.js} +4 -1
- package/dist/icon-field/style.css +6 -15
- package/dist/image/style.css +6 -15
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4047 -3420
- package/dist/inplace/style.css +6 -15
- package/dist/input/index.js +1 -1
- package/dist/input/style.css +6 -15
- package/dist/input-group/style.css +6 -15
- package/dist/input-number/index.js +2 -245
- package/dist/input-number/style.css +34 -25
- package/dist/input-otp/style.css +6 -15
- package/dist/input-password/index.js +1 -5
- package/dist/input-password/style.css +6 -15
- package/dist/input-tags/style.css +6 -15
- package/dist/knob/style.css +6 -15
- package/dist/label/style.css +6 -15
- package/dist/layout/style.css +6 -15
- package/dist/list/index.js +1 -1
- package/dist/list/style.css +6 -15
- package/dist/listbox/style.css +6 -15
- package/dist/loading/style.css +6 -15
- package/dist/mega-menu/index.js +94 -87
- package/dist/mega-menu/style.css +6 -15
- package/dist/mentions/index.js +35 -39
- package/dist/mentions/style.css +6 -15
- package/dist/menu/index.js +235 -213
- package/dist/menu/style.css +66 -20
- package/dist/menubar/index.js +107 -99
- package/dist/menubar/style.css +7 -16
- package/dist/message/style.css +6 -15
- package/dist/meter-group/style.css +6 -15
- package/dist/order-list/style.css +6 -15
- package/dist/page/style.css +6 -15
- package/dist/pagination/index.js +1 -1
- package/dist/pagination/style.css +6 -15
- package/dist/panel/style.css +6 -15
- package/dist/pick-list/style.css +6 -15
- package/dist/popover/index.js +1 -1
- package/dist/popover/style.css +6 -15
- package/dist/progress-bar/style.css +6 -15
- package/dist/progress-spinner/style.css +6 -15
- package/dist/qr-code/style.css +6 -15
- package/dist/radio/style.css +6 -15
- package/dist/rating/index.js +2 -2
- package/dist/rating/style.css +6 -15
- package/dist/resolver.js +1 -1
- package/dist/result/style.css +6 -15
- package/dist/scroll-top/style.css +6 -15
- package/dist/scrollbar/style.css +6 -15
- package/dist/segmented/style.css +6 -15
- package/dist/select/index.js +1 -1
- package/dist/select/style.css +6 -15
- package/dist/select-button/style.css +6 -15
- package/dist/shared/menu/icon.d.ts +3 -0
- package/dist/shared/menu/icon.d.ts.map +1 -1
- package/dist/shared/menu/index.d.ts +2 -2
- package/dist/shared/menu/index.d.ts.map +1 -1
- package/dist/shared/menu/types.d.ts +3 -1
- package/dist/shared/menu/types.d.ts.map +1 -1
- package/dist/sidebar/index.js +37 -29
- package/dist/sidebar/style.css +6 -15
- package/dist/skeleton/style.css +6 -15
- package/dist/slider/style.css +6 -15
- package/dist/space/style.css +6 -15
- package/dist/speed-dial/index.js +101 -94
- package/dist/speed-dial/style.css +6 -15
- package/dist/split-button/index.js +3 -3
- package/dist/split-button/style.css +6 -15
- package/dist/splitter/style.css +6 -15
- package/dist/statistic/style.css +6 -15
- package/dist/status/style.css +6 -15
- package/dist/stepper/style.css +6 -15
- package/dist/styles/base.css +6 -15
- package/dist/styles.css +1 -1
- package/dist/switch/style.css +6 -15
- package/dist/table/index.js +3 -3
- package/dist/table/style.css +6 -15
- package/dist/tabs/style.css +6 -15
- package/dist/tag/style.css +6 -15
- package/dist/terminal/style.css +6 -15
- package/dist/textarea/index.js +1 -1
- package/dist/textarea/style.css +6 -15
- package/dist/tiered-menu/style.css +8 -17
- package/dist/time-picker/style.css +6 -15
- package/dist/timeline/style.css +6 -15
- package/dist/toast/style.css +6 -15
- package/dist/toggle-button/index.js +1 -1
- package/dist/toggle-button/style.css +6 -15
- package/dist/toolbar/style.css +6 -15
- package/dist/tooltip/style.css +21 -17
- package/dist/tour/style.css +6 -15
- package/dist/tree/style.css +6 -15
- package/dist/tree-select/style.css +6 -15
- package/dist/typography/index.js +1 -1
- package/dist/typography/style.css +6 -15
- package/dist/virtual-scroller/style.css +6 -15
- package/dist/watermark/style.css +6 -15
- package/package.json +8 -8
- package/dist/components/InputColor/InputColor.vue.d.ts +0 -24
- package/dist/components/InputColor/InputColor.vue.d.ts.map +0 -1
- package/dist/components/InputColor/index.d.ts +0 -3
- package/dist/components/InputColor/index.d.ts.map +0 -1
- package/dist/components/InputColor/styles.css +0 -139
- package/dist/components/InputColor/types.d.ts +0 -19
- package/dist/components/InputColor/types.d.ts.map +0 -1
- package/dist/input-color/index.js +0 -118
- package/dist/input-color/style.js +0 -3
|
@@ -0,0 +1,676 @@
|
|
|
1
|
+
import { i as e } from "../useComponentAttrs-e-5QAjdw.js";
|
|
2
|
+
import { n as t } from "../overlay-oR-5MDuE.js";
|
|
3
|
+
import { t as n } from "../overlayPlacement-qwEJPVS4.js";
|
|
4
|
+
import { t as r } from "../useMId-BXFYayPP.js";
|
|
5
|
+
import { t as i } from "../useMotionTransition-DohkfWRB.js";
|
|
6
|
+
import { t as a } from "../Icon-CmHjx7W8.js";
|
|
7
|
+
import { t as o } from "../Segmented-CMP3nBAP.js";
|
|
8
|
+
import { t as s } from "../Select-BaFKBeIh.js";
|
|
9
|
+
import { t as c } from "../Input-BErawS7K.js";
|
|
10
|
+
import { t as l } from "../InputNumber-DjbXtTzR.js";
|
|
11
|
+
import { l as u, o as ee } from "../config-Cd20zAyW.js";
|
|
12
|
+
import { n as te } from "../locale-BcxMPufl.js";
|
|
13
|
+
import "./style.js";
|
|
14
|
+
import { Fragment as d, Teleport as ne, Transition as re, computed as f, createBlock as p, createCommentVNode as m, createElementBlock as h, createElementVNode as g, createVNode as _, defineComponent as v, mergeProps as ie, nextTick as ae, normalizeClass as oe, normalizeStyle as y, onBeforeUnmount as se, openBlock as b, ref as x, renderList as S, toDisplayString as C, unref as w, useAttrs as ce, watch as le, withCtx as ue, withModifiers as T } from "vue";
|
|
15
|
+
//#region src/components/ColorPicker/colorUtils.ts
|
|
16
|
+
function E(e, t, n) {
|
|
17
|
+
return Math.min(n, Math.max(t, e));
|
|
18
|
+
}
|
|
19
|
+
function D(e, t = 0) {
|
|
20
|
+
let n = 10 ** t;
|
|
21
|
+
return Math.round(e * n) / n;
|
|
22
|
+
}
|
|
23
|
+
function O(e) {
|
|
24
|
+
let t = e.replace("#", "").trim();
|
|
25
|
+
return /^[0-9a-f]{6}$/i.test(t) ? {
|
|
26
|
+
r: parseInt(t.slice(0, 2), 16),
|
|
27
|
+
g: parseInt(t.slice(2, 4), 16),
|
|
28
|
+
b: parseInt(t.slice(4, 6), 16)
|
|
29
|
+
} : null;
|
|
30
|
+
}
|
|
31
|
+
function k(e) {
|
|
32
|
+
let t = (e) => E(Math.round(e), 0, 255).toString(16).padStart(2, "0");
|
|
33
|
+
return `#${t(e.r)}${t(e.g)}${t(e.b)}`;
|
|
34
|
+
}
|
|
35
|
+
function A(e) {
|
|
36
|
+
let t = e.r / 255, n = e.g / 255, r = e.b / 255, i = Math.max(t, n, r), a = i - Math.min(t, n, r), o = 0;
|
|
37
|
+
a !== 0 && (o = i === t ? ((n - r) / a + (n < r ? 6 : 0)) * 60 : i === n ? ((r - t) / a + 2) * 60 : ((t - n) / a + 4) * 60);
|
|
38
|
+
let s = i === 0 ? 0 : a / i;
|
|
39
|
+
return {
|
|
40
|
+
h: D(o),
|
|
41
|
+
s: D(s, 4),
|
|
42
|
+
b: D(i, 4)
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
function j(e) {
|
|
46
|
+
let t = (e.h % 360 + 360) % 360, n = E(e.s, 0, 1), r = E(e.b, 0, 1), i = r * n, a = i * (1 - Math.abs(t / 60 % 2 - 1)), o = r - i, s = 0, c = 0, l = 0;
|
|
47
|
+
return t < 60 ? (s = i, c = a, l = 0) : t < 120 ? (s = a, c = i, l = 0) : t < 180 ? (s = 0, c = i, l = a) : t < 240 ? (s = 0, c = a, l = i) : t < 300 ? (s = a, c = 0, l = i) : (s = i, c = 0, l = a), {
|
|
48
|
+
r: D((s + o) * 255),
|
|
49
|
+
g: D((c + o) * 255),
|
|
50
|
+
b: D((l + o) * 255)
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
function de(e) {
|
|
54
|
+
return /^#[0-9a-f]{6}$/i.test(e.trim());
|
|
55
|
+
}
|
|
56
|
+
function M(e) {
|
|
57
|
+
let t = e.trim();
|
|
58
|
+
if (de(t)) return t.toLowerCase();
|
|
59
|
+
let n = O(t);
|
|
60
|
+
return n ? k(n) : "#000000";
|
|
61
|
+
}
|
|
62
|
+
//#endregion
|
|
63
|
+
//#region src/components/ColorPicker/gradientUtils.ts
|
|
64
|
+
var fe = 0;
|
|
65
|
+
function N() {
|
|
66
|
+
return `stop-${++fe}-${Date.now()}`;
|
|
67
|
+
}
|
|
68
|
+
function pe(e) {
|
|
69
|
+
return /^(linear|radial|conic)-gradient\(/.test(e.trim());
|
|
70
|
+
}
|
|
71
|
+
function me(e) {
|
|
72
|
+
let t = e.trim();
|
|
73
|
+
if (!pe(t)) return null;
|
|
74
|
+
let n = t.match(/^(linear|radial)-gradient\((.+)\)$/i);
|
|
75
|
+
if (!n) return null;
|
|
76
|
+
let r = n[1].toLowerCase(), i = n[2], a = [], o = 0, s = "";
|
|
77
|
+
for (let e of i) e === "(" && o++, e === ")" && o--, e === "," && o === 0 ? (a.push(s.trim()), s = "") : s += e;
|
|
78
|
+
s && a.push(s.trim());
|
|
79
|
+
let c = 90, l = 0;
|
|
80
|
+
if (r === "linear" && a.length > 0) {
|
|
81
|
+
let e = a[0], t = e.match(/^(\d+(?:\.\d+)?)(deg|turn|grad|rad)$/i);
|
|
82
|
+
if (t) {
|
|
83
|
+
c = parseFloat(t[1]);
|
|
84
|
+
let e = t[2].toLowerCase();
|
|
85
|
+
e === "turn" ? c *= 360 : e === "grad" ? c *= .9 : e === "rad" && (c *= 180 / Math.PI), l = 1;
|
|
86
|
+
} else e === "to right" ? (c = 90, l = 1) : e === "to left" ? (c = 270, l = 1) : e === "to bottom" ? (c = 180, l = 1) : e === "to top" ? (c = 0, l = 1) : e === "to bottom right" ? (c = 135, l = 1) : e === "to bottom left" ? (c = 225, l = 1) : e === "to top right" ? (c = 45, l = 1) : e === "to top left" && (c = 315, l = 1);
|
|
87
|
+
}
|
|
88
|
+
let u = [];
|
|
89
|
+
for (let e = l; e < a.length; e++) {
|
|
90
|
+
let t = a[e].match(/^(#[0-9a-f]{3,8}|rgba?\([^)]+\)|[a-z]+)\s*(\d+(?:\.\d+)?%?)?$/i);
|
|
91
|
+
if (t) {
|
|
92
|
+
let e = t[1], n = t[2], r = 0;
|
|
93
|
+
n ? (r = parseFloat(n), n.endsWith("%") || (r = u.length > 0 ? u[u.length - 1].position + 100 / (a.length - l - 1) : 0)) : r = u.length > 0 ? u[u.length - 1].position + 100 / (a.length - l - 1) : 0, u.push({
|
|
94
|
+
id: N(),
|
|
95
|
+
color: P(e),
|
|
96
|
+
position: Math.min(100, Math.max(0, r))
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
for (; u.length < 2;) u.push({
|
|
101
|
+
id: N(),
|
|
102
|
+
color: u.length === 0 ? "#000000" : "#ffffff",
|
|
103
|
+
position: u.length * 100
|
|
104
|
+
});
|
|
105
|
+
return u.sort((e, t) => e.position - t.position), {
|
|
106
|
+
type: r,
|
|
107
|
+
angle: c,
|
|
108
|
+
stops: u
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
function he(e) {
|
|
112
|
+
let t = e.stops.map((e) => `${e.color} ${Math.round(e.position * 100) / 100}%`).join(", ");
|
|
113
|
+
return e.type === "linear" ? `linear-gradient(${Math.round(e.angle)}deg, ${t})` : `radial-gradient(${t})`;
|
|
114
|
+
}
|
|
115
|
+
function P(e) {
|
|
116
|
+
let t = {
|
|
117
|
+
red: "#ff0000",
|
|
118
|
+
green: "#008000",
|
|
119
|
+
blue: "#0000ff",
|
|
120
|
+
white: "#ffffff",
|
|
121
|
+
black: "#000000",
|
|
122
|
+
yellow: "#ffff00",
|
|
123
|
+
cyan: "#00ffff",
|
|
124
|
+
magenta: "#ff00ff"
|
|
125
|
+
}, n = e.toLowerCase();
|
|
126
|
+
return t[n] ? t[n] : /^#[0-9a-f]{3}$/i.test(e) ? `#${e[1]}${e[1]}${e[2]}${e[2]}${e[3]}${e[3]}` : /^#[0-9a-f]{6}$/i.test(e) ? e : /^#[0-9a-f]{8}$/i.test(e) ? e.slice(0, 7) : "#000000";
|
|
127
|
+
}
|
|
128
|
+
function ge() {
|
|
129
|
+
return {
|
|
130
|
+
type: "linear",
|
|
131
|
+
angle: 90,
|
|
132
|
+
stops: [{
|
|
133
|
+
id: N(),
|
|
134
|
+
color: "#1677ff",
|
|
135
|
+
position: 0
|
|
136
|
+
}, {
|
|
137
|
+
id: N(),
|
|
138
|
+
color: "#ff4d4f",
|
|
139
|
+
position: 100
|
|
140
|
+
}]
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
function _e(e) {
|
|
144
|
+
return `linear-gradient(to right, ${[...e].sort((e, t) => e.position - t.position).map((e) => `${e.color} ${Math.round(e.position * 100) / 100}%`).join(", ")})`;
|
|
145
|
+
}
|
|
146
|
+
//#endregion
|
|
147
|
+
//#region src/components/ColorPicker/ColorPicker.vue?vue&type=script&setup=true&lang.ts
|
|
148
|
+
var ve = [
|
|
149
|
+
"disabled",
|
|
150
|
+
"aria-expanded",
|
|
151
|
+
"aria-label"
|
|
152
|
+
], ye = {
|
|
153
|
+
key: 0,
|
|
154
|
+
class: "m-colorpicker__trigger-text"
|
|
155
|
+
}, be = ["aria-label"], xe = { class: "m-colorpicker__panel-inner" }, Se = {
|
|
156
|
+
key: 0,
|
|
157
|
+
class: "m-colorpicker__mode-switch"
|
|
158
|
+
}, Ce = { class: "m-colorpicker__gradient-section" }, we = ["onClick", "onPointerdown"], Te = { class: "m-colorpicker__gradient-stops-list" }, Ee = ["onClick"], De = { class: "m-colorpicker__gradient-stop-pos" }, Oe = ["disabled", "onClick"], ke = { class: "m-colorpicker__gradient-options" }, Ae = {
|
|
159
|
+
key: 1,
|
|
160
|
+
class: "m-colorpicker__gradient-angle-unit"
|
|
161
|
+
}, je = { class: "m-colorpicker__sliders" }, Me = { class: "m-colorpicker__input-row" }, Ne = {
|
|
162
|
+
key: 2,
|
|
163
|
+
class: "m-colorpicker__presets"
|
|
164
|
+
}, Pe = {
|
|
165
|
+
key: 0,
|
|
166
|
+
class: "m-colorpicker__preset-label"
|
|
167
|
+
}, Fe = { class: "m-colorpicker__preset-colors" }, Ie = [
|
|
168
|
+
"disabled",
|
|
169
|
+
"aria-label",
|
|
170
|
+
"onClick"
|
|
171
|
+
], F = /* @__PURE__ */ v({
|
|
172
|
+
inheritAttrs: !1,
|
|
173
|
+
__name: "ColorPicker",
|
|
174
|
+
props: {
|
|
175
|
+
modelValue: { default: "#1677ff" },
|
|
176
|
+
disabled: {
|
|
177
|
+
type: Boolean,
|
|
178
|
+
default: !1
|
|
179
|
+
},
|
|
180
|
+
disabledAlpha: {
|
|
181
|
+
type: Boolean,
|
|
182
|
+
default: !1
|
|
183
|
+
},
|
|
184
|
+
clearable: {
|
|
185
|
+
type: Boolean,
|
|
186
|
+
default: !1
|
|
187
|
+
},
|
|
188
|
+
format: { default: "hex" },
|
|
189
|
+
presets: { default: void 0 },
|
|
190
|
+
showText: {
|
|
191
|
+
type: Boolean,
|
|
192
|
+
default: !1
|
|
193
|
+
},
|
|
194
|
+
size: { default: void 0 },
|
|
195
|
+
placement: { default: "bottom-start" },
|
|
196
|
+
teleport: {
|
|
197
|
+
type: Boolean,
|
|
198
|
+
default: !0
|
|
199
|
+
},
|
|
200
|
+
appendTo: {},
|
|
201
|
+
transition: {
|
|
202
|
+
type: [String, Boolean],
|
|
203
|
+
default: void 0
|
|
204
|
+
},
|
|
205
|
+
pt: { default: void 0 },
|
|
206
|
+
gradient: {
|
|
207
|
+
type: Boolean,
|
|
208
|
+
default: !1
|
|
209
|
+
}
|
|
210
|
+
},
|
|
211
|
+
emits: [
|
|
212
|
+
"update:modelValue",
|
|
213
|
+
"change",
|
|
214
|
+
"clear",
|
|
215
|
+
"show",
|
|
216
|
+
"hide"
|
|
217
|
+
],
|
|
218
|
+
setup(v, { expose: D, emit: fe }) {
|
|
219
|
+
let P = v, F = fe, Le = ce(), { rootAttrs: Re } = e(Le, () => P.pt), ze = te(), Be = u(), Ve = ee("ColorPicker", () => P.size), He = r("m-colorpicker"), Ue = f(() => He), { transitionName: We, transitionCss: Ge } = i({
|
|
220
|
+
role: "popup",
|
|
221
|
+
local: () => P.transition,
|
|
222
|
+
componentName: "ColorPicker",
|
|
223
|
+
fallback: "scale-fade"
|
|
224
|
+
}), I = x(!1), L = x(null), R = x(null), Ke = x({}), z = x(null), B = x(null), qe = x(null), Je = x(null), V = x("single"), H = x({
|
|
225
|
+
h: 0,
|
|
226
|
+
s: 0,
|
|
227
|
+
b: 0
|
|
228
|
+
}), Ye = x(1), U = x(""), W = x(ge()), G = x(""), Xe = f(() => t(P, Be.value.appendTo)), K;
|
|
229
|
+
le(() => P.modelValue, (e) => {
|
|
230
|
+
let t = e ?? "#000000";
|
|
231
|
+
if (t !== K) {
|
|
232
|
+
if (K = void 0, P.gradient && pe(t)) {
|
|
233
|
+
V.value = "gradient";
|
|
234
|
+
let e = me(t);
|
|
235
|
+
if (e) {
|
|
236
|
+
let t = G.value, n = t ? W.value.stops.find((e) => e.id === t) : void 0;
|
|
237
|
+
if (W.value = e, e.stops.length > 0) {
|
|
238
|
+
let t = !1;
|
|
239
|
+
if (n) {
|
|
240
|
+
let r = e.stops.find((e) => Math.abs(e.position - n.position) < .5 && e.color.toLowerCase() === n.color.toLowerCase());
|
|
241
|
+
r && (G.value = r.id, t = !0);
|
|
242
|
+
}
|
|
243
|
+
if (!t) {
|
|
244
|
+
G.value = e.stops[0].id;
|
|
245
|
+
let t = O(M(e.stops[0].color));
|
|
246
|
+
t && (H.value = A(t));
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
} else {
|
|
251
|
+
V.value = "single";
|
|
252
|
+
let e = O(M(t));
|
|
253
|
+
e && (H.value = A(e));
|
|
254
|
+
}
|
|
255
|
+
U.value = Y(t);
|
|
256
|
+
}
|
|
257
|
+
}, { immediate: !0 });
|
|
258
|
+
let q = f(() => P.gradient && V.value === "gradient"), J = f(() => k(j(H.value))), Ze = f(() => j(H.value)), Qe = f(() => W.value.stops.find((e) => e.id === G.value)), $e = f(() => _e(W.value.stops)), et = f(() => q.value ? he(W.value) : Y(J.value)), tt = f(() => q.value ? $e.value : J.value), nt = f(() => {
|
|
259
|
+
let e = j({
|
|
260
|
+
h: H.value.h,
|
|
261
|
+
s: 1,
|
|
262
|
+
b: 1
|
|
263
|
+
});
|
|
264
|
+
return `rgb(${e.r}, ${e.g}, ${e.b})`;
|
|
265
|
+
}), rt = f(() => ({
|
|
266
|
+
left: `${H.value.h / 360 * 100}%`,
|
|
267
|
+
background: `hsl(${H.value.h}, 100%, 50%)`
|
|
268
|
+
})), it = f(() => ({
|
|
269
|
+
left: `${H.value.s * 100}%`,
|
|
270
|
+
top: `${(1 - H.value.b) * 100}%`,
|
|
271
|
+
background: J.value
|
|
272
|
+
})), at = f(() => ({
|
|
273
|
+
left: `${Ye.value * 100}%`,
|
|
274
|
+
background: J.value
|
|
275
|
+
})), ot = f(() => {
|
|
276
|
+
let e = Ze.value;
|
|
277
|
+
return `linear-gradient(to right, rgba(${e.r}, ${e.g}, ${e.b}, 0) 0%, rgba(${e.r}, ${e.g}, ${e.b}, 1) 100%)`;
|
|
278
|
+
}), st = f(() => [
|
|
279
|
+
"m-colorpicker",
|
|
280
|
+
`m-colorpicker--${Ve.value}`,
|
|
281
|
+
{
|
|
282
|
+
"m-colorpicker--disabled": P.disabled,
|
|
283
|
+
"m-colorpicker--open": I.value,
|
|
284
|
+
"m-colorpicker--gradient": q.value
|
|
285
|
+
}
|
|
286
|
+
]);
|
|
287
|
+
function Y(e) {
|
|
288
|
+
let t = O(e) ?? {
|
|
289
|
+
r: 0,
|
|
290
|
+
g: 0,
|
|
291
|
+
b: 0
|
|
292
|
+
}, n = A(t);
|
|
293
|
+
switch (P.format) {
|
|
294
|
+
case "rgb": return `rgb(${t.r}, ${t.g}, ${t.b})`;
|
|
295
|
+
case "hsb": return `hsb(${Math.round(n.h)}, ${Math.round(n.s * 100)}%, ${Math.round(n.b * 100)}%)`;
|
|
296
|
+
default: return e;
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
function X(e, t) {
|
|
300
|
+
H.value = { ...e }, t !== void 0 && (Ye.value = E(t, 0, 1));
|
|
301
|
+
let n = k(j(H.value));
|
|
302
|
+
q.value && Qe.value ? (Qe.value.color = n, Z()) : (U.value = Y(n), K = n, F("update:modelValue", n), F("change", n));
|
|
303
|
+
}
|
|
304
|
+
function Z() {
|
|
305
|
+
let e = he(W.value);
|
|
306
|
+
K = e, U.value = e, F("update:modelValue", e), F("change", e);
|
|
307
|
+
}
|
|
308
|
+
function ct(e) {
|
|
309
|
+
if (P.disabled || e == null) return;
|
|
310
|
+
let t = e;
|
|
311
|
+
if (V.value = t, t === "gradient" && !pe(P.modelValue ?? "")) {
|
|
312
|
+
W.value = ge();
|
|
313
|
+
let e = W.value.stops[0];
|
|
314
|
+
e && (e.color = J.value, G.value = e.id), Z();
|
|
315
|
+
} else if (t === "single") {
|
|
316
|
+
let e = W.value.stops[0];
|
|
317
|
+
if (e) {
|
|
318
|
+
let t = O(M(e.color));
|
|
319
|
+
if (t) {
|
|
320
|
+
H.value = A(t);
|
|
321
|
+
let e = k(t);
|
|
322
|
+
U.value = Y(e), F("update:modelValue", e), F("change", e);
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
function lt(e) {
|
|
328
|
+
if (P.disabled) return;
|
|
329
|
+
let t = Je.value;
|
|
330
|
+
if (!t) return;
|
|
331
|
+
let n = t.getBoundingClientRect(), r = E((e.clientX - n.left) / n.width, 0, 1) * 100, i = null, a = Infinity;
|
|
332
|
+
for (let e of W.value.stops) {
|
|
333
|
+
let t = Math.abs(e.position - r);
|
|
334
|
+
t < a && (a = t, i = e);
|
|
335
|
+
}
|
|
336
|
+
if (i && a < 5) {
|
|
337
|
+
G.value = i.id;
|
|
338
|
+
let e = O(M(i.color));
|
|
339
|
+
e && (H.value = A(e));
|
|
340
|
+
return;
|
|
341
|
+
}
|
|
342
|
+
let o = {
|
|
343
|
+
id: N(),
|
|
344
|
+
color: J.value,
|
|
345
|
+
position: Math.round(r)
|
|
346
|
+
};
|
|
347
|
+
W.value.stops.push(o), W.value.stops.sort((e, t) => e.position - t.position), G.value = o.id, Z(), dt(t, t, e.pointerId, o);
|
|
348
|
+
}
|
|
349
|
+
function ut(e, t) {
|
|
350
|
+
if (P.disabled) return;
|
|
351
|
+
e.stopPropagation(), G.value = t.id;
|
|
352
|
+
let n = O(M(t.color));
|
|
353
|
+
n && (H.value = A(n));
|
|
354
|
+
let r = e.currentTarget, i = Je.value;
|
|
355
|
+
!r || !i || dt(r, i, e.pointerId, t);
|
|
356
|
+
}
|
|
357
|
+
function dt(e, t, n, r) {
|
|
358
|
+
e.setPointerCapture(n);
|
|
359
|
+
let i = r.id, a = (e) => {
|
|
360
|
+
let n = t.getBoundingClientRect(), r = E((e.clientX - n.left) / n.width, 0, 1) * 100, a = W.value.stops.find((e) => e.id === i);
|
|
361
|
+
a && (a.position = r, W.value.stops.sort((e, t) => e.position - t.position), Z());
|
|
362
|
+
}, o = () => {
|
|
363
|
+
let t = W.value.stops.find((e) => e.id === i);
|
|
364
|
+
t && (t.position = Math.round(t.position), W.value.stops.sort((e, t) => e.position - t.position), Z()), e.removeEventListener("pointermove", a), e.removeEventListener("pointerup", o);
|
|
365
|
+
};
|
|
366
|
+
e.addEventListener("pointermove", a), e.addEventListener("pointerup", o);
|
|
367
|
+
}
|
|
368
|
+
function ft(e) {
|
|
369
|
+
e != null && (W.value.angle = e, Z());
|
|
370
|
+
}
|
|
371
|
+
function pt(e) {
|
|
372
|
+
e != null && typeof e != "object" && (W.value.type = e, Z());
|
|
373
|
+
}
|
|
374
|
+
function mt(e) {
|
|
375
|
+
if (W.value.stops.length <= 2) return;
|
|
376
|
+
let t = W.value.stops.findIndex((t) => t.id === e);
|
|
377
|
+
t > -1 && (W.value.stops.splice(t, 1), G.value === e && (G.value = W.value.stops[0]?.id ?? ""), Z());
|
|
378
|
+
}
|
|
379
|
+
function ht(e) {
|
|
380
|
+
G.value = e.id;
|
|
381
|
+
let t = O(M(e.color));
|
|
382
|
+
t && (H.value = A(t));
|
|
383
|
+
}
|
|
384
|
+
function gt(e) {
|
|
385
|
+
if (P.disabled) return;
|
|
386
|
+
let t = z.value;
|
|
387
|
+
if (!t) return;
|
|
388
|
+
t.setPointerCapture(e.pointerId), _t(e);
|
|
389
|
+
let n = (e) => _t(e), r = () => {
|
|
390
|
+
t.removeEventListener("pointermove", n), t.removeEventListener("pointerup", r);
|
|
391
|
+
};
|
|
392
|
+
t.addEventListener("pointermove", n), t.addEventListener("pointerup", r);
|
|
393
|
+
}
|
|
394
|
+
function _t(e) {
|
|
395
|
+
let t = z.value;
|
|
396
|
+
if (!t) return;
|
|
397
|
+
let n = t.getBoundingClientRect(), r = E((e.clientX - n.left) / n.width, 0, 1), i = E((e.clientY - n.top) / n.height, 0, 1);
|
|
398
|
+
X({
|
|
399
|
+
...H.value,
|
|
400
|
+
s: r,
|
|
401
|
+
b: 1 - i
|
|
402
|
+
});
|
|
403
|
+
}
|
|
404
|
+
function vt(e) {
|
|
405
|
+
if (P.disabled) return;
|
|
406
|
+
let t = B.value;
|
|
407
|
+
if (!t) return;
|
|
408
|
+
t.setPointerCapture(e.pointerId), yt(e);
|
|
409
|
+
let n = (e) => yt(e), r = () => {
|
|
410
|
+
t.removeEventListener("pointermove", n), t.removeEventListener("pointerup", r);
|
|
411
|
+
};
|
|
412
|
+
t.addEventListener("pointermove", n), t.addEventListener("pointerup", r);
|
|
413
|
+
}
|
|
414
|
+
function yt(e) {
|
|
415
|
+
let t = B.value;
|
|
416
|
+
if (!t) return;
|
|
417
|
+
let n = t.getBoundingClientRect(), r = E((e.clientX - n.left) / n.width, 0, 1);
|
|
418
|
+
X({
|
|
419
|
+
...H.value,
|
|
420
|
+
h: r * 360
|
|
421
|
+
});
|
|
422
|
+
}
|
|
423
|
+
function bt(e) {
|
|
424
|
+
if (P.disabled || P.disabledAlpha) return;
|
|
425
|
+
let t = qe.value;
|
|
426
|
+
if (!t) return;
|
|
427
|
+
t.setPointerCapture(e.pointerId), xt(e);
|
|
428
|
+
let n = (e) => xt(e), r = () => {
|
|
429
|
+
t.removeEventListener("pointermove", n), t.removeEventListener("pointerup", r);
|
|
430
|
+
};
|
|
431
|
+
t.addEventListener("pointermove", n), t.addEventListener("pointerup", r);
|
|
432
|
+
}
|
|
433
|
+
function xt(e) {
|
|
434
|
+
let t = qe.value;
|
|
435
|
+
if (!t) return;
|
|
436
|
+
let n = t.getBoundingClientRect(), r = E((e.clientX - n.left) / n.width, 0, 1);
|
|
437
|
+
X(H.value, r);
|
|
438
|
+
}
|
|
439
|
+
function St(e) {
|
|
440
|
+
let t = e.trim();
|
|
441
|
+
if (q.value) {
|
|
442
|
+
let e = me(t);
|
|
443
|
+
if (e) {
|
|
444
|
+
if (W.value = e, e.stops.length > 0) {
|
|
445
|
+
G.value = e.stops[0].id;
|
|
446
|
+
let t = O(M(e.stops[0].color));
|
|
447
|
+
t && (H.value = A(t));
|
|
448
|
+
}
|
|
449
|
+
Z();
|
|
450
|
+
}
|
|
451
|
+
} else if (de(t)) {
|
|
452
|
+
let e = O(t);
|
|
453
|
+
e && X(A(e));
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
function Ct() {
|
|
457
|
+
U.value = et.value;
|
|
458
|
+
}
|
|
459
|
+
function wt() {
|
|
460
|
+
K = "", F("update:modelValue", ""), F("clear"), $();
|
|
461
|
+
}
|
|
462
|
+
function Tt(e) {
|
|
463
|
+
if (P.disabled) return;
|
|
464
|
+
let t = O(M(e));
|
|
465
|
+
t && X(A(t));
|
|
466
|
+
}
|
|
467
|
+
async function Q() {
|
|
468
|
+
if (!I.value || !L.value || (await ae(), !R.value || !L.value)) return;
|
|
469
|
+
let e = n(L.value.getBoundingClientRect(), P.placement, { gap: 4 });
|
|
470
|
+
Ke.value = e;
|
|
471
|
+
}
|
|
472
|
+
function Et() {
|
|
473
|
+
P.disabled || I.value || (I.value = !0, F("show"), Q(), document.addEventListener("click", Ot, !0), window.addEventListener("resize", Q), window.addEventListener("scroll", Q, !0));
|
|
474
|
+
}
|
|
475
|
+
function $() {
|
|
476
|
+
I.value && (I.value = !1, F("hide"), document.removeEventListener("click", Ot, !0), window.removeEventListener("resize", Q), window.removeEventListener("scroll", Q, !0));
|
|
477
|
+
}
|
|
478
|
+
function Dt() {
|
|
479
|
+
I.value ? $() : Et();
|
|
480
|
+
}
|
|
481
|
+
function Ot(e) {
|
|
482
|
+
let t = e.target;
|
|
483
|
+
L.value?.contains(t) || R.value?.contains(t) || $();
|
|
484
|
+
}
|
|
485
|
+
return se(() => {
|
|
486
|
+
$();
|
|
487
|
+
}), D({
|
|
488
|
+
open: Et,
|
|
489
|
+
close: $,
|
|
490
|
+
toggle: Dt
|
|
491
|
+
}), (e, t) => (b(), h("div", ie(w(Re), { class: st.value }), [g("button", {
|
|
492
|
+
ref_key: "triggerRef",
|
|
493
|
+
ref: L,
|
|
494
|
+
type: "button",
|
|
495
|
+
class: "m-colorpicker__trigger",
|
|
496
|
+
disabled: v.disabled,
|
|
497
|
+
"aria-expanded": I.value,
|
|
498
|
+
"aria-haspopup": !0,
|
|
499
|
+
"aria-label": w(ze).selectColor,
|
|
500
|
+
onClick: Dt
|
|
501
|
+
}, [
|
|
502
|
+
g("span", {
|
|
503
|
+
class: "m-colorpicker__trigger-swatch",
|
|
504
|
+
style: y({ background: tt.value })
|
|
505
|
+
}, null, 4),
|
|
506
|
+
v.showText ? (b(), h("span", ye, C(et.value), 1)) : m("", !0),
|
|
507
|
+
v.clearable && v.modelValue ? (b(), p(a, {
|
|
508
|
+
key: 1,
|
|
509
|
+
name: "close",
|
|
510
|
+
size: "sm",
|
|
511
|
+
class: "m-colorpicker__clear",
|
|
512
|
+
onClick: T(wt, ["stop"])
|
|
513
|
+
})) : (b(), p(a, {
|
|
514
|
+
key: 2,
|
|
515
|
+
name: "chevron-down",
|
|
516
|
+
size: "sm",
|
|
517
|
+
class: "m-colorpicker__arrow"
|
|
518
|
+
}))
|
|
519
|
+
], 8, ve), (b(), p(ne, {
|
|
520
|
+
to: Xe.value.to,
|
|
521
|
+
disabled: Xe.value.disabled
|
|
522
|
+
}, [_(re, {
|
|
523
|
+
name: w(We),
|
|
524
|
+
css: w(Ge)
|
|
525
|
+
}, {
|
|
526
|
+
default: ue(() => [I.value ? (b(), h("div", {
|
|
527
|
+
key: 0,
|
|
528
|
+
ref_key: "panelRef",
|
|
529
|
+
ref: R,
|
|
530
|
+
class: "m-colorpicker__panel",
|
|
531
|
+
style: y(Ke.value),
|
|
532
|
+
role: "dialog",
|
|
533
|
+
"aria-label": w(ze).selectColor
|
|
534
|
+
}, [g("div", xe, [
|
|
535
|
+
v.gradient ? (b(), h("div", Se, [_(o, {
|
|
536
|
+
"model-value": V.value,
|
|
537
|
+
block: "",
|
|
538
|
+
options: [{
|
|
539
|
+
label: "Single",
|
|
540
|
+
value: "single"
|
|
541
|
+
}, {
|
|
542
|
+
label: "Gradient",
|
|
543
|
+
value: "gradient"
|
|
544
|
+
}],
|
|
545
|
+
size: "small",
|
|
546
|
+
disabled: v.disabled,
|
|
547
|
+
"onUpdate:modelValue": ct
|
|
548
|
+
}, null, 8, ["model-value", "disabled"])])) : m("", !0),
|
|
549
|
+
q.value ? (b(), h(d, { key: 1 }, [g("div", Ce, [g("div", {
|
|
550
|
+
ref_key: "gradientBarRef",
|
|
551
|
+
ref: Je,
|
|
552
|
+
class: "m-colorpicker__gradient-bar",
|
|
553
|
+
style: y({ background: $e.value }),
|
|
554
|
+
onPointerdown: lt
|
|
555
|
+
}, [(b(!0), h(d, null, S(W.value.stops, (e) => (b(), h("div", {
|
|
556
|
+
key: e.id,
|
|
557
|
+
class: oe(["m-colorpicker__gradient-stop", { "m-colorpicker__gradient-stop--active": e.id === G.value }]),
|
|
558
|
+
style: y({
|
|
559
|
+
left: `${e.position}%`,
|
|
560
|
+
background: e.color
|
|
561
|
+
}),
|
|
562
|
+
onClick: T((t) => ht(e), ["stop"]),
|
|
563
|
+
onPointerdown: T((t) => ut(t, e), ["stop"])
|
|
564
|
+
}, null, 46, we))), 128))], 36), g("div", Te, [(b(!0), h(d, null, S(W.value.stops, (e) => (b(), h("div", {
|
|
565
|
+
key: e.id,
|
|
566
|
+
class: oe(["m-colorpicker__gradient-stop-item", { "m-colorpicker__gradient-stop-item--active": e.id === G.value }]),
|
|
567
|
+
onClick: (t) => ht(e)
|
|
568
|
+
}, [
|
|
569
|
+
g("span", {
|
|
570
|
+
class: "m-colorpicker__gradient-stop-color",
|
|
571
|
+
style: y({ background: e.color })
|
|
572
|
+
}, null, 4),
|
|
573
|
+
g("span", De, C(Math.round(e.position)) + "%", 1),
|
|
574
|
+
W.value.stops.length > 2 ? (b(), h("button", {
|
|
575
|
+
key: 0,
|
|
576
|
+
type: "button",
|
|
577
|
+
class: "m-colorpicker__gradient-stop-delete",
|
|
578
|
+
disabled: v.disabled,
|
|
579
|
+
onClick: T((t) => mt(e.id), ["stop"])
|
|
580
|
+
}, [_(a, {
|
|
581
|
+
name: "close",
|
|
582
|
+
size: "sm"
|
|
583
|
+
})], 8, Oe)) : m("", !0)
|
|
584
|
+
], 10, Ee))), 128))])]), g("div", ke, [
|
|
585
|
+
_(s, {
|
|
586
|
+
"model-value": W.value.type,
|
|
587
|
+
options: [{
|
|
588
|
+
label: "Linear",
|
|
589
|
+
value: "linear"
|
|
590
|
+
}, {
|
|
591
|
+
label: "Radial",
|
|
592
|
+
value: "radial"
|
|
593
|
+
}],
|
|
594
|
+
size: "small",
|
|
595
|
+
disabled: v.disabled,
|
|
596
|
+
"onUpdate:modelValue": pt
|
|
597
|
+
}, null, 8, ["model-value", "disabled"]),
|
|
598
|
+
W.value.type === "linear" ? (b(), p(l, {
|
|
599
|
+
key: 0,
|
|
600
|
+
"model-value": Math.round(W.value.angle),
|
|
601
|
+
size: "small",
|
|
602
|
+
min: 0,
|
|
603
|
+
max: 360,
|
|
604
|
+
disabled: v.disabled,
|
|
605
|
+
"onUpdate:modelValue": ft
|
|
606
|
+
}, null, 8, ["model-value", "disabled"])) : m("", !0),
|
|
607
|
+
W.value.type === "linear" ? (b(), h("span", Ae, "deg")) : m("", !0)
|
|
608
|
+
])], 64)) : m("", !0),
|
|
609
|
+
g("div", {
|
|
610
|
+
ref_key: "saturationRef",
|
|
611
|
+
ref: z,
|
|
612
|
+
class: "m-colorpicker__saturation",
|
|
613
|
+
style: y({ background: nt.value }),
|
|
614
|
+
onPointerdown: gt
|
|
615
|
+
}, [
|
|
616
|
+
t[1] ||= g("div", { class: "m-colorpicker__saturation-white" }, null, -1),
|
|
617
|
+
t[2] ||= g("div", { class: "m-colorpicker__saturation-black" }, null, -1),
|
|
618
|
+
g("div", {
|
|
619
|
+
class: "m-colorpicker__saturation-handle",
|
|
620
|
+
style: y(it.value)
|
|
621
|
+
}, null, 4)
|
|
622
|
+
], 36),
|
|
623
|
+
g("div", je, [g("div", {
|
|
624
|
+
ref_key: "hueRef",
|
|
625
|
+
ref: B,
|
|
626
|
+
class: "m-colorpicker__hue",
|
|
627
|
+
onPointerdown: vt
|
|
628
|
+
}, [t[3] ||= g("div", { class: "m-colorpicker__hue-track" }, null, -1), g("div", {
|
|
629
|
+
class: "m-colorpicker__hue-handle",
|
|
630
|
+
style: y(rt.value)
|
|
631
|
+
}, null, 4)], 544), v.disabledAlpha ? m("", !0) : (b(), h("div", {
|
|
632
|
+
key: 0,
|
|
633
|
+
ref_key: "alphaRef",
|
|
634
|
+
ref: qe,
|
|
635
|
+
class: "m-colorpicker__alpha",
|
|
636
|
+
onPointerdown: bt
|
|
637
|
+
}, [g("div", {
|
|
638
|
+
class: "m-colorpicker__alpha-track",
|
|
639
|
+
style: y({ background: ot.value })
|
|
640
|
+
}, null, 4), g("div", {
|
|
641
|
+
class: "m-colorpicker__alpha-handle",
|
|
642
|
+
style: y(at.value)
|
|
643
|
+
}, null, 4)], 544))]),
|
|
644
|
+
g("div", Me, [_(c, {
|
|
645
|
+
id: Ue.value,
|
|
646
|
+
modelValue: U.value,
|
|
647
|
+
"onUpdate:modelValue": t[0] ||= (e) => U.value = e,
|
|
648
|
+
size: "small",
|
|
649
|
+
disabled: v.disabled,
|
|
650
|
+
spellcheck: "false",
|
|
651
|
+
onChange: St,
|
|
652
|
+
onBlur: Ct
|
|
653
|
+
}, null, 8, [
|
|
654
|
+
"id",
|
|
655
|
+
"modelValue",
|
|
656
|
+
"disabled"
|
|
657
|
+
])]),
|
|
658
|
+
v.presets?.length ? (b(), h("div", Ne, [(b(!0), h(d, null, S(v.presets, (e, t) => (b(), h("div", {
|
|
659
|
+
key: t,
|
|
660
|
+
class: "m-colorpicker__preset-group"
|
|
661
|
+
}, [e.label ? (b(), h("div", Pe, C(e.label), 1)) : m("", !0), g("div", Fe, [(b(!0), h(d, null, S(e.colors, (e) => (b(), h("button", {
|
|
662
|
+
key: e,
|
|
663
|
+
type: "button",
|
|
664
|
+
class: oe(["m-colorpicker__preset-swatch", { "m-colorpicker__preset-swatch--active": w(M)(e) === J.value }]),
|
|
665
|
+
style: y({ background: e }),
|
|
666
|
+
disabled: v.disabled,
|
|
667
|
+
"aria-label": e,
|
|
668
|
+
onClick: (t) => Tt(e)
|
|
669
|
+
}, null, 14, Ie))), 128))])]))), 128))])) : m("", !0)
|
|
670
|
+
])], 12, be)) : m("", !0)]),
|
|
671
|
+
_: 1
|
|
672
|
+
}, 8, ["name", "css"])], 8, ["to", "disabled"]))], 16));
|
|
673
|
+
}
|
|
674
|
+
});
|
|
675
|
+
//#endregion
|
|
676
|
+
export { F as MColorPicker };
|