@thebuoyant-tsdev/mui-ts-library 3.22.0 → 3.24.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.de.md +4 -0
- package/README.md +4 -0
- package/dist/components/color-picker/ColorPicker.d.ts +1 -1
- package/dist/components/color-picker/ColorPicker.js +282 -266
- package/dist/components/color-picker/ColorPicker.types.d.ts +3 -1
- package/dist/components/color-picker/colorPickerClasses.d.ts +35 -0
- package/dist/components/color-picker/colorPickerClasses.js +15 -0
- package/dist/components/password-strength-meter/PasswordStrengthBar.d.ts +2 -1
- package/dist/components/password-strength-meter/PasswordStrengthBar.js +3 -1
- package/dist/components/password-strength-meter/PasswordStrengthMeter.js +258 -237
- package/dist/components/password-strength-meter/passwordStrengthMeterClasses.d.ts +40 -0
- package/dist/components/password-strength-meter/passwordStrengthMeterClasses.js +16 -0
- package/dist/components/rich-text-editor/RichTextEditorToolbar.js +115 -111
- package/dist/components/tag-selection/TagSelection.js +82 -79
- package/dist/components/tag-selection/TagSelectionAutocomplete.js +102 -98
- package/dist/components/tag-selection/TagSelectionChip.js +24 -21
- package/dist/components/tag-selection/TagSelectionSelectedTags.js +44 -38
- package/dist/components/tag-selection/tagSelectionClasses.d.ts +34 -0
- package/dist/components/tag-selection/tagSelectionClasses.js +15 -0
- package/dist/index.cjs +2 -2
- package/dist/index.d.cts +4 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +31 -27
- package/dist/utils/muiTsClasses.d.ts +7 -0
- package/dist/utils/muiTsClasses.js +9 -0
- package/package.json +1 -1
|
@@ -1,20 +1,22 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import ie from "@mui/
|
|
1
|
+
import { muiTsStateClasses as e } from "../../utils/muiTsClasses.js";
|
|
2
|
+
import { colorPickerClasses as t } from "./colorPickerClasses.js";
|
|
3
|
+
import { clamp as n, hexToRgba as r, hslaToHsva as i, hsvaToHsla as a, hsvaToRgba as o, parseColorString as s, rgbaToHex as c, rgbaToHsva as l } from "./util/colorConversion.util.js";
|
|
4
|
+
import { DEFAULT_COLOR_PICKER_TRANSLATION as u } from "./ColorPicker.types.js";
|
|
5
|
+
import { useEffect as d, useRef as f, useState as p } from "react";
|
|
6
|
+
import { Box as m, IconButton as ee, MenuItem as h, Select as te, TextField as g, Tooltip as ne, Typography as re, useTheme as ie } from "@mui/material";
|
|
7
|
+
import { jsx as _, jsxs as v } from "react/jsx-runtime";
|
|
8
|
+
import ae from "@mui/icons-material/Colorize";
|
|
7
9
|
//#region src/components/color-picker/ColorPicker.tsx
|
|
8
|
-
function
|
|
9
|
-
let r = e
|
|
10
|
-
return `calc(${
|
|
10
|
+
function y(e, t) {
|
|
11
|
+
let r = n(e, 0, 100);
|
|
12
|
+
return `calc(${t / 2}px + (100% - ${t}px) * ${r / 100})`;
|
|
11
13
|
}
|
|
12
|
-
function
|
|
13
|
-
let t =
|
|
14
|
+
function b(e) {
|
|
15
|
+
let t = o(e), n = a(e), r = c(t);
|
|
14
16
|
return {
|
|
15
|
-
hex:
|
|
17
|
+
hex: r,
|
|
16
18
|
info: {
|
|
17
|
-
hex:
|
|
19
|
+
hex: r,
|
|
18
20
|
rgb: {
|
|
19
21
|
r: Math.round(t.r),
|
|
20
22
|
g: Math.round(t.g),
|
|
@@ -30,28 +32,28 @@ function y(e) {
|
|
|
30
32
|
}
|
|
31
33
|
};
|
|
32
34
|
}
|
|
33
|
-
function
|
|
34
|
-
let [
|
|
35
|
-
return
|
|
36
|
-
|
|
37
|
-
}, [
|
|
35
|
+
function x({ value: e, onCommit: t, min: r, max: i, label: a, disabled: o, size: s, onBlurExtra: c, fullWidth: l }) {
|
|
36
|
+
let [u, f] = p(String(Math.round(e)));
|
|
37
|
+
return d(() => {
|
|
38
|
+
f(String(Math.round(e)));
|
|
39
|
+
}, [e]), /* @__PURE__ */ _(g, {
|
|
38
40
|
size: s,
|
|
39
|
-
value:
|
|
41
|
+
value: u,
|
|
40
42
|
disabled: o,
|
|
41
|
-
onChange: (
|
|
42
|
-
let a =
|
|
43
|
-
|
|
43
|
+
onChange: (e) => {
|
|
44
|
+
let a = e.target.value;
|
|
45
|
+
f(a);
|
|
44
46
|
let o = Number(a);
|
|
45
|
-
a.trim() !== "" && !Number.isNaN(o) && n(
|
|
47
|
+
a.trim() !== "" && !Number.isNaN(o) && t(n(o, r, i));
|
|
46
48
|
},
|
|
47
49
|
onBlur: () => {
|
|
48
|
-
|
|
50
|
+
f(String(Math.round(e))), c?.();
|
|
49
51
|
},
|
|
50
52
|
slotProps: { htmlInput: {
|
|
51
53
|
"aria-label": a,
|
|
52
54
|
style: { textAlign: "center" }
|
|
53
55
|
} },
|
|
54
|
-
sx:
|
|
56
|
+
sx: l ? {
|
|
55
57
|
flex: 1,
|
|
56
58
|
minWidth: 0
|
|
57
59
|
} : {
|
|
@@ -60,218 +62,226 @@ function b({ value: t, onCommit: n, min: r, max: i, label: a, disabled: o, size:
|
|
|
60
62
|
}
|
|
61
63
|
});
|
|
62
64
|
}
|
|
63
|
-
function
|
|
64
|
-
let
|
|
65
|
-
...
|
|
66
|
-
...
|
|
67
|
-
}, [
|
|
68
|
-
let e =
|
|
69
|
-
return e ?
|
|
65
|
+
function oe({ value: c, onChange: oe, onChangeCommitted: S, defaultFormat: se = "hex", format: C, onFormatChange: ce, showAlpha: w = !0, showEyeDropper: le = !0, showSliderSection: ue = !0, showInputSection: de = !0, savedColors: T, disabled: E = !1, colorGradientSize: D = "medium", inputSize: O = "medium", width: fe = 280, name: k, translation: pe }) {
|
|
66
|
+
let A = ie(), j = {
|
|
67
|
+
...u,
|
|
68
|
+
...pe
|
|
69
|
+
}, [M, N] = p(() => {
|
|
70
|
+
let e = s(c);
|
|
71
|
+
return e ? l(e) : {
|
|
70
72
|
h: 0,
|
|
71
73
|
s: 0,
|
|
72
74
|
v: 0,
|
|
73
75
|
a: 1
|
|
74
76
|
};
|
|
75
|
-
}), [
|
|
76
|
-
if (
|
|
77
|
-
|
|
78
|
-
let e =
|
|
79
|
-
e &&
|
|
77
|
+
}), [me, he] = p(se), P = C ?? me, [ge, F] = p(c);
|
|
78
|
+
if (ge !== c) {
|
|
79
|
+
F(c);
|
|
80
|
+
let e = s(c);
|
|
81
|
+
e && N(l(e));
|
|
80
82
|
}
|
|
81
|
-
let { hex:
|
|
82
|
-
|
|
83
|
-
I
|
|
84
|
-
}, [
|
|
85
|
-
let
|
|
86
|
-
|
|
87
|
-
let t =
|
|
88
|
-
|
|
89
|
-
},
|
|
90
|
-
if (
|
|
91
|
-
let t =
|
|
83
|
+
let { hex: _e, info: ve } = b(M), I = _e.slice(0, 7), [ye, L] = p(I);
|
|
84
|
+
d(() => {
|
|
85
|
+
L(I);
|
|
86
|
+
}, [I]);
|
|
87
|
+
let R = f(null), z = f(null), B = f(null), V = (e) => {
|
|
88
|
+
N(e);
|
|
89
|
+
let t = b(e);
|
|
90
|
+
F(t.hex), oe(t.hex, t.info);
|
|
91
|
+
}, H = (e) => {
|
|
92
|
+
if (V(e), S) {
|
|
93
|
+
let t = b(e);
|
|
92
94
|
S(t.hex, t.info);
|
|
93
95
|
}
|
|
94
|
-
},
|
|
96
|
+
}, U = () => {
|
|
95
97
|
if (!S) return;
|
|
96
|
-
let e =
|
|
98
|
+
let e = b(M);
|
|
97
99
|
S(e.hex, e.info);
|
|
98
|
-
},
|
|
99
|
-
if (
|
|
100
|
-
let
|
|
101
|
-
|
|
102
|
-
...
|
|
103
|
-
s: r /
|
|
104
|
-
v: 100 - i /
|
|
100
|
+
}, be = D === "small" ? 130 : 160, W = D === "small" ? 20 : 24, G = D === "small" ? 10 : 12, K = D === "small" ? 13 : 16, q = (e) => {
|
|
101
|
+
if (E || !R.current) return;
|
|
102
|
+
let t = R.current.getBoundingClientRect(), r = n(e.clientX - t.left, 0, t.width), i = n(e.clientY - t.top, 0, t.height);
|
|
103
|
+
V({
|
|
104
|
+
...M,
|
|
105
|
+
s: r / t.width * 100,
|
|
106
|
+
v: 100 - i / t.height * 100
|
|
105
107
|
});
|
|
106
|
-
},
|
|
107
|
-
if (
|
|
108
|
-
let
|
|
109
|
-
|
|
110
|
-
...
|
|
111
|
-
h: r /
|
|
108
|
+
}, J = (e) => {
|
|
109
|
+
if (E || !z.current) return;
|
|
110
|
+
let t = z.current.getBoundingClientRect(), r = n(e.clientX - t.left, 0, t.width);
|
|
111
|
+
V({
|
|
112
|
+
...M,
|
|
113
|
+
h: r / t.width * 360
|
|
112
114
|
});
|
|
113
|
-
},
|
|
114
|
-
if (
|
|
115
|
-
let
|
|
116
|
-
|
|
117
|
-
...
|
|
118
|
-
a: r /
|
|
115
|
+
}, Y = (e) => {
|
|
116
|
+
if (E || !B.current) return;
|
|
117
|
+
let t = B.current.getBoundingClientRect(), r = n(e.clientX - t.left, 0, t.width);
|
|
118
|
+
V({
|
|
119
|
+
...M,
|
|
120
|
+
a: r / t.width
|
|
119
121
|
});
|
|
120
|
-
},
|
|
121
|
-
if (!(
|
|
122
|
-
let e =
|
|
123
|
-
e &&
|
|
122
|
+
}, xe = typeof window < "u" && !!window.EyeDropper, Se = async () => {
|
|
123
|
+
if (!(E || !window.EyeDropper)) try {
|
|
124
|
+
let e = r((await new window.EyeDropper().open()).sRGBHex);
|
|
125
|
+
e && H(l({
|
|
124
126
|
...e,
|
|
125
|
-
a:
|
|
127
|
+
a: M.a
|
|
126
128
|
}));
|
|
127
129
|
} catch {}
|
|
128
|
-
},
|
|
129
|
-
|
|
130
|
-
}, X =
|
|
130
|
+
}, Ce = (e) => {
|
|
131
|
+
C === void 0 && he(e), ce?.(e);
|
|
132
|
+
}, X = o(M), Z = a(M), Q = I, $ = {
|
|
131
133
|
backgroundImage: "linear-gradient(45deg, #ccc 25%, transparent 25%), linear-gradient(-45deg, #ccc 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #ccc 75%), linear-gradient(-45deg, transparent 75%, #ccc 75%)",
|
|
132
134
|
backgroundSize: "8px 8px",
|
|
133
135
|
backgroundPosition: "0 0, 0 4px, 4px -4px, -4px 0px"
|
|
134
136
|
};
|
|
135
|
-
return /* @__PURE__ */
|
|
137
|
+
return /* @__PURE__ */ v(m, {
|
|
136
138
|
sx: {
|
|
137
|
-
width:
|
|
138
|
-
opacity:
|
|
139
|
+
width: fe,
|
|
140
|
+
opacity: E ? .6 : 1,
|
|
139
141
|
display: "flex",
|
|
140
142
|
flexDirection: "column",
|
|
141
143
|
gap: 1
|
|
142
144
|
},
|
|
145
|
+
className: [t.root, E && e.disabled].filter(Boolean).join(" "),
|
|
143
146
|
children: [
|
|
144
|
-
/* @__PURE__ */
|
|
145
|
-
ref:
|
|
147
|
+
/* @__PURE__ */ _(m, {
|
|
148
|
+
ref: R,
|
|
146
149
|
role: "slider",
|
|
147
|
-
tabIndex:
|
|
148
|
-
"aria-label":
|
|
149
|
-
"aria-valuetext": `${Math.round(
|
|
150
|
+
tabIndex: E ? -1 : 0,
|
|
151
|
+
"aria-label": j.gradientAreaLabel,
|
|
152
|
+
"aria-valuetext": `${Math.round(M.s)}, ${Math.round(M.v)}`,
|
|
150
153
|
onPointerDown: (e) => {
|
|
151
|
-
e.currentTarget.setPointerCapture?.(e.pointerId),
|
|
154
|
+
e.currentTarget.setPointerCapture?.(e.pointerId), q(e);
|
|
152
155
|
},
|
|
153
156
|
onPointerMove: (e) => {
|
|
154
|
-
e.buttons === 1 &&
|
|
157
|
+
e.buttons === 1 && q(e);
|
|
155
158
|
},
|
|
156
|
-
onPointerUp:
|
|
159
|
+
onPointerUp: U,
|
|
160
|
+
className: t.gradientArea,
|
|
157
161
|
sx: {
|
|
158
162
|
position: "relative",
|
|
159
163
|
width: "100%",
|
|
160
|
-
height:
|
|
161
|
-
borderRadius: `${
|
|
162
|
-
border: `1px solid ${
|
|
163
|
-
cursor:
|
|
164
|
+
height: be,
|
|
165
|
+
borderRadius: `${A.shape.borderRadius}px`,
|
|
166
|
+
border: `1px solid ${A.palette.divider}`,
|
|
167
|
+
cursor: E ? "default" : "crosshair",
|
|
164
168
|
touchAction: "none",
|
|
165
|
-
background: `linear-gradient(to top, #000, rgba(0,0,0,0)), linear-gradient(to right, #fff, hsl(${
|
|
169
|
+
background: `linear-gradient(to top, #000, rgba(0,0,0,0)), linear-gradient(to right, #fff, hsl(${M.h}, 100%, 50%))`
|
|
166
170
|
},
|
|
167
|
-
children: /* @__PURE__ */
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
171
|
+
children: /* @__PURE__ */ _(m, {
|
|
172
|
+
className: t.gradientThumb,
|
|
173
|
+
sx: {
|
|
174
|
+
position: "absolute",
|
|
175
|
+
left: y(M.s, K),
|
|
176
|
+
top: y(100 - M.v, K),
|
|
177
|
+
width: K,
|
|
178
|
+
height: K,
|
|
179
|
+
borderRadius: "50%",
|
|
180
|
+
border: "2px solid #fff",
|
|
181
|
+
boxShadow: "0 0 0 1px rgba(0,0,0,0.3)",
|
|
182
|
+
transform: "translate(-50%, -50%)",
|
|
183
|
+
pointerEvents: "none",
|
|
184
|
+
backgroundColor: Q
|
|
185
|
+
}
|
|
186
|
+
})
|
|
180
187
|
}),
|
|
181
|
-
|
|
188
|
+
ue && /* @__PURE__ */ v(m, {
|
|
182
189
|
sx: {
|
|
183
190
|
display: "flex",
|
|
184
191
|
gap: 1,
|
|
185
192
|
alignItems: "center"
|
|
186
193
|
},
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
194
|
+
className: t.sliderSection,
|
|
195
|
+
children: [le && xe && /* @__PURE__ */ _(ne, {
|
|
196
|
+
title: j.eyeDropperLabel,
|
|
197
|
+
children: /* @__PURE__ */ _("span", { children: /* @__PURE__ */ _(ee, {
|
|
190
198
|
size: "small",
|
|
191
|
-
onClick:
|
|
192
|
-
disabled:
|
|
193
|
-
"aria-label":
|
|
194
|
-
children: /* @__PURE__ */
|
|
199
|
+
onClick: Se,
|
|
200
|
+
disabled: E,
|
|
201
|
+
"aria-label": j.eyeDropperLabel,
|
|
202
|
+
children: /* @__PURE__ */ _(ae, { fontSize: "small" })
|
|
195
203
|
}) })
|
|
196
|
-
}), /* @__PURE__ */
|
|
204
|
+
}), /* @__PURE__ */ v(m, {
|
|
197
205
|
sx: {
|
|
198
206
|
flex: 1,
|
|
199
207
|
display: "flex",
|
|
200
208
|
flexDirection: "column",
|
|
201
209
|
gap: .75
|
|
202
210
|
},
|
|
203
|
-
children: [/* @__PURE__ */
|
|
204
|
-
ref:
|
|
211
|
+
children: [/* @__PURE__ */ _(m, {
|
|
212
|
+
ref: z,
|
|
205
213
|
role: "slider",
|
|
206
|
-
tabIndex:
|
|
207
|
-
"aria-label":
|
|
214
|
+
tabIndex: E ? -1 : 0,
|
|
215
|
+
"aria-label": j.hueSliderLabel,
|
|
208
216
|
"aria-valuemin": 0,
|
|
209
217
|
"aria-valuemax": 360,
|
|
210
|
-
"aria-valuenow": Math.round(
|
|
218
|
+
"aria-valuenow": Math.round(M.h),
|
|
211
219
|
onPointerDown: (e) => {
|
|
212
|
-
e.currentTarget.setPointerCapture?.(e.pointerId),
|
|
220
|
+
e.currentTarget.setPointerCapture?.(e.pointerId), J(e);
|
|
213
221
|
},
|
|
214
222
|
onPointerMove: (e) => {
|
|
215
|
-
e.buttons === 1 &&
|
|
223
|
+
e.buttons === 1 && J(e);
|
|
216
224
|
},
|
|
217
|
-
onPointerUp:
|
|
225
|
+
onPointerUp: U,
|
|
226
|
+
className: t.hueSlider,
|
|
218
227
|
sx: {
|
|
219
228
|
position: "relative",
|
|
220
229
|
width: "100%",
|
|
221
|
-
height:
|
|
222
|
-
borderRadius:
|
|
223
|
-
cursor:
|
|
230
|
+
height: G,
|
|
231
|
+
borderRadius: G,
|
|
232
|
+
cursor: E ? "default" : "pointer",
|
|
224
233
|
touchAction: "none",
|
|
225
234
|
background: "linear-gradient(to right, red, yellow, lime, cyan, blue, magenta, red)"
|
|
226
235
|
},
|
|
227
|
-
children: /* @__PURE__ */
|
|
236
|
+
children: /* @__PURE__ */ _(m, { sx: {
|
|
228
237
|
position: "absolute",
|
|
229
|
-
left:
|
|
238
|
+
left: y(M.h / 360 * 100, K),
|
|
230
239
|
top: "50%",
|
|
231
|
-
width:
|
|
232
|
-
height:
|
|
240
|
+
width: K,
|
|
241
|
+
height: K,
|
|
233
242
|
borderRadius: "50%",
|
|
234
243
|
border: "2px solid #fff",
|
|
235
244
|
boxShadow: "0 0 0 1px rgba(0,0,0,0.3)",
|
|
236
245
|
transform: "translate(-50%, -50%)",
|
|
237
246
|
pointerEvents: "none",
|
|
238
|
-
backgroundColor: `hsl(${
|
|
247
|
+
backgroundColor: `hsl(${M.h}, 100%, 50%)`
|
|
239
248
|
} })
|
|
240
|
-
}),
|
|
241
|
-
ref:
|
|
249
|
+
}), w && /* @__PURE__ */ v(m, {
|
|
250
|
+
ref: B,
|
|
242
251
|
role: "slider",
|
|
243
|
-
tabIndex:
|
|
244
|
-
"aria-label":
|
|
252
|
+
tabIndex: E ? -1 : 0,
|
|
253
|
+
"aria-label": j.alphaFieldLabel,
|
|
245
254
|
"aria-valuemin": 0,
|
|
246
255
|
"aria-valuemax": 100,
|
|
247
|
-
"aria-valuenow": Math.round(
|
|
256
|
+
"aria-valuenow": Math.round(M.a * 100),
|
|
248
257
|
onPointerDown: (e) => {
|
|
249
|
-
e.currentTarget.setPointerCapture?.(e.pointerId),
|
|
258
|
+
e.currentTarget.setPointerCapture?.(e.pointerId), Y(e);
|
|
250
259
|
},
|
|
251
260
|
onPointerMove: (e) => {
|
|
252
|
-
e.buttons === 1 &&
|
|
261
|
+
e.buttons === 1 && Y(e);
|
|
253
262
|
},
|
|
254
|
-
onPointerUp:
|
|
263
|
+
onPointerUp: U,
|
|
264
|
+
className: t.alphaSlider,
|
|
255
265
|
sx: {
|
|
256
266
|
position: "relative",
|
|
257
267
|
width: "100%",
|
|
258
|
-
height:
|
|
259
|
-
borderRadius:
|
|
260
|
-
cursor:
|
|
268
|
+
height: G,
|
|
269
|
+
borderRadius: G,
|
|
270
|
+
cursor: E ? "default" : "pointer",
|
|
261
271
|
touchAction: "none",
|
|
262
272
|
...$
|
|
263
273
|
},
|
|
264
|
-
children: [/* @__PURE__ */
|
|
274
|
+
children: [/* @__PURE__ */ _(m, { sx: {
|
|
265
275
|
position: "absolute",
|
|
266
276
|
inset: 0,
|
|
267
|
-
borderRadius:
|
|
277
|
+
borderRadius: G,
|
|
268
278
|
background: `linear-gradient(to right, transparent, ${Q})`
|
|
269
|
-
} }), /* @__PURE__ */
|
|
279
|
+
} }), /* @__PURE__ */ _(m, { sx: {
|
|
270
280
|
position: "absolute",
|
|
271
|
-
left:
|
|
281
|
+
left: y(M.a * 100, K),
|
|
272
282
|
top: "50%",
|
|
273
|
-
width:
|
|
274
|
-
height:
|
|
283
|
+
width: K,
|
|
284
|
+
height: K,
|
|
275
285
|
borderRadius: "50%",
|
|
276
286
|
border: "2px solid #fff",
|
|
277
287
|
boxShadow: "0 0 0 1px rgba(0,0,0,0.3)",
|
|
@@ -282,185 +292,186 @@ function x({ value: o, onChange: x, onChangeCommitted: S, defaultFormat: ae = "h
|
|
|
282
292
|
})]
|
|
283
293
|
})]
|
|
284
294
|
}),
|
|
285
|
-
|
|
295
|
+
de && /* @__PURE__ */ v(m, {
|
|
286
296
|
sx: {
|
|
287
297
|
display: "flex",
|
|
288
298
|
flexDirection: "column",
|
|
289
299
|
gap: .75
|
|
290
300
|
},
|
|
301
|
+
className: t.inputSection,
|
|
291
302
|
children: [
|
|
292
|
-
/* @__PURE__ */
|
|
303
|
+
/* @__PURE__ */ v(m, {
|
|
293
304
|
sx: {
|
|
294
305
|
display: "flex",
|
|
295
306
|
gap: .75,
|
|
296
307
|
alignItems: "center"
|
|
297
308
|
},
|
|
298
309
|
children: [
|
|
299
|
-
/* @__PURE__ */
|
|
300
|
-
size:
|
|
301
|
-
value:
|
|
302
|
-
"aria-label":
|
|
303
|
-
disabled:
|
|
304
|
-
onChange: (e) =>
|
|
310
|
+
/* @__PURE__ */ v(te, {
|
|
311
|
+
size: O,
|
|
312
|
+
value: P,
|
|
313
|
+
"aria-label": j.formatLabel,
|
|
314
|
+
disabled: E,
|
|
315
|
+
onChange: (e) => Ce(e.target.value),
|
|
305
316
|
sx: {
|
|
306
317
|
minWidth: 80,
|
|
307
318
|
flexShrink: 0
|
|
308
319
|
},
|
|
309
320
|
children: [
|
|
310
|
-
/* @__PURE__ */
|
|
321
|
+
/* @__PURE__ */ _(h, {
|
|
311
322
|
value: "hex",
|
|
312
323
|
children: "HEX"
|
|
313
324
|
}),
|
|
314
|
-
/* @__PURE__ */
|
|
325
|
+
/* @__PURE__ */ _(h, {
|
|
315
326
|
value: "rgb",
|
|
316
327
|
children: "RGB"
|
|
317
328
|
}),
|
|
318
|
-
/* @__PURE__ */
|
|
329
|
+
/* @__PURE__ */ _(h, {
|
|
319
330
|
value: "hsl",
|
|
320
331
|
children: "HSL"
|
|
321
332
|
})
|
|
322
333
|
]
|
|
323
334
|
}),
|
|
324
|
-
|
|
325
|
-
size:
|
|
326
|
-
value:
|
|
327
|
-
disabled:
|
|
335
|
+
P === "hex" && /* @__PURE__ */ _(g, {
|
|
336
|
+
size: O,
|
|
337
|
+
value: ye,
|
|
338
|
+
disabled: E,
|
|
328
339
|
onChange: (e) => {
|
|
329
|
-
let
|
|
330
|
-
|
|
331
|
-
let
|
|
332
|
-
|
|
333
|
-
...
|
|
334
|
-
a:
|
|
340
|
+
let t = e.target.value;
|
|
341
|
+
L(t);
|
|
342
|
+
let n = r(t);
|
|
343
|
+
n && V(l({
|
|
344
|
+
...n,
|
|
345
|
+
a: M.a
|
|
335
346
|
}));
|
|
336
347
|
},
|
|
337
348
|
onBlur: () => {
|
|
338
|
-
I
|
|
349
|
+
L(I), U();
|
|
339
350
|
},
|
|
340
|
-
slotProps: { htmlInput: { "aria-label":
|
|
351
|
+
slotProps: { htmlInput: { "aria-label": j.hexFieldLabel } },
|
|
341
352
|
sx: {
|
|
342
353
|
flex: 1,
|
|
343
354
|
minWidth: 0
|
|
344
355
|
}
|
|
345
356
|
}),
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
label:
|
|
349
|
-
value: Math.round(
|
|
357
|
+
P !== "hex" && /* @__PURE__ */ _(m, { sx: { flex: 1 } }),
|
|
358
|
+
w && /* @__PURE__ */ _(x, {
|
|
359
|
+
label: j.alphaFieldLabel,
|
|
360
|
+
value: Math.round(M.a * 100),
|
|
350
361
|
min: 0,
|
|
351
362
|
max: 100,
|
|
352
|
-
disabled:
|
|
353
|
-
size:
|
|
354
|
-
onBlurExtra:
|
|
355
|
-
onCommit: (e) =>
|
|
356
|
-
...
|
|
363
|
+
disabled: E,
|
|
364
|
+
size: O,
|
|
365
|
+
onBlurExtra: U,
|
|
366
|
+
onCommit: (e) => V({
|
|
367
|
+
...M,
|
|
357
368
|
a: e / 100
|
|
358
369
|
})
|
|
359
370
|
})
|
|
360
371
|
]
|
|
361
372
|
}),
|
|
362
|
-
|
|
373
|
+
P === "rgb" && /* @__PURE__ */ v(m, {
|
|
363
374
|
sx: {
|
|
364
375
|
display: "flex",
|
|
365
376
|
gap: .75
|
|
366
377
|
},
|
|
367
378
|
children: [
|
|
368
|
-
/* @__PURE__ */
|
|
369
|
-
label:
|
|
379
|
+
/* @__PURE__ */ _(x, {
|
|
380
|
+
label: j.redLabel,
|
|
370
381
|
value: X.r,
|
|
371
382
|
min: 0,
|
|
372
383
|
max: 255,
|
|
373
|
-
disabled:
|
|
374
|
-
size:
|
|
375
|
-
onBlurExtra:
|
|
384
|
+
disabled: E,
|
|
385
|
+
size: O,
|
|
386
|
+
onBlurExtra: U,
|
|
376
387
|
fullWidth: !0,
|
|
377
|
-
onCommit: (e) =>
|
|
388
|
+
onCommit: (e) => V(l({
|
|
378
389
|
r: e,
|
|
379
390
|
g: X.g,
|
|
380
391
|
b: X.b,
|
|
381
|
-
a:
|
|
392
|
+
a: M.a
|
|
382
393
|
}))
|
|
383
394
|
}),
|
|
384
|
-
/* @__PURE__ */
|
|
385
|
-
label:
|
|
395
|
+
/* @__PURE__ */ _(x, {
|
|
396
|
+
label: j.greenLabel,
|
|
386
397
|
value: X.g,
|
|
387
398
|
min: 0,
|
|
388
399
|
max: 255,
|
|
389
|
-
disabled:
|
|
390
|
-
size:
|
|
391
|
-
onBlurExtra:
|
|
400
|
+
disabled: E,
|
|
401
|
+
size: O,
|
|
402
|
+
onBlurExtra: U,
|
|
392
403
|
fullWidth: !0,
|
|
393
|
-
onCommit: (e) =>
|
|
404
|
+
onCommit: (e) => V(l({
|
|
394
405
|
r: X.r,
|
|
395
406
|
g: e,
|
|
396
407
|
b: X.b,
|
|
397
|
-
a:
|
|
408
|
+
a: M.a
|
|
398
409
|
}))
|
|
399
410
|
}),
|
|
400
|
-
/* @__PURE__ */
|
|
401
|
-
label:
|
|
411
|
+
/* @__PURE__ */ _(x, {
|
|
412
|
+
label: j.blueLabel,
|
|
402
413
|
value: X.b,
|
|
403
414
|
min: 0,
|
|
404
415
|
max: 255,
|
|
405
|
-
disabled:
|
|
406
|
-
size:
|
|
407
|
-
onBlurExtra:
|
|
416
|
+
disabled: E,
|
|
417
|
+
size: O,
|
|
418
|
+
onBlurExtra: U,
|
|
408
419
|
fullWidth: !0,
|
|
409
|
-
onCommit: (e) =>
|
|
420
|
+
onCommit: (e) => V(l({
|
|
410
421
|
r: X.r,
|
|
411
422
|
g: X.g,
|
|
412
423
|
b: e,
|
|
413
|
-
a:
|
|
424
|
+
a: M.a
|
|
414
425
|
}))
|
|
415
426
|
})
|
|
416
427
|
]
|
|
417
428
|
}),
|
|
418
|
-
|
|
429
|
+
P === "hsl" && /* @__PURE__ */ v(m, {
|
|
419
430
|
sx: {
|
|
420
431
|
display: "flex",
|
|
421
432
|
gap: .75
|
|
422
433
|
},
|
|
423
434
|
children: [
|
|
424
|
-
/* @__PURE__ */
|
|
425
|
-
label:
|
|
435
|
+
/* @__PURE__ */ _(x, {
|
|
436
|
+
label: j.hueFieldLabel,
|
|
426
437
|
value: Z.h,
|
|
427
438
|
min: 0,
|
|
428
439
|
max: 360,
|
|
429
|
-
disabled:
|
|
430
|
-
size:
|
|
431
|
-
onBlurExtra:
|
|
440
|
+
disabled: E,
|
|
441
|
+
size: O,
|
|
442
|
+
onBlurExtra: U,
|
|
432
443
|
fullWidth: !0,
|
|
433
|
-
onCommit: (e) =>
|
|
434
|
-
...
|
|
444
|
+
onCommit: (e) => V({
|
|
445
|
+
...M,
|
|
435
446
|
h: e
|
|
436
447
|
})
|
|
437
448
|
}),
|
|
438
|
-
/* @__PURE__ */
|
|
439
|
-
label:
|
|
449
|
+
/* @__PURE__ */ _(x, {
|
|
450
|
+
label: j.saturationFieldLabel,
|
|
440
451
|
value: Z.s,
|
|
441
452
|
min: 0,
|
|
442
453
|
max: 100,
|
|
443
|
-
disabled:
|
|
444
|
-
size:
|
|
445
|
-
onBlurExtra:
|
|
454
|
+
disabled: E,
|
|
455
|
+
size: O,
|
|
456
|
+
onBlurExtra: U,
|
|
446
457
|
fullWidth: !0,
|
|
447
|
-
onCommit: (e) =>
|
|
458
|
+
onCommit: (e) => V(i({
|
|
448
459
|
h: Z.h,
|
|
449
460
|
s: e,
|
|
450
461
|
l: Z.l,
|
|
451
462
|
a: Z.a
|
|
452
463
|
}))
|
|
453
464
|
}),
|
|
454
|
-
/* @__PURE__ */
|
|
455
|
-
label:
|
|
465
|
+
/* @__PURE__ */ _(x, {
|
|
466
|
+
label: j.lightnessFieldLabel,
|
|
456
467
|
value: Z.l,
|
|
457
468
|
min: 0,
|
|
458
469
|
max: 100,
|
|
459
|
-
disabled:
|
|
460
|
-
size:
|
|
461
|
-
onBlurExtra:
|
|
470
|
+
disabled: E,
|
|
471
|
+
size: O,
|
|
472
|
+
onBlurExtra: U,
|
|
462
473
|
fullWidth: !0,
|
|
463
|
-
onCommit: (e) =>
|
|
474
|
+
onCommit: (e) => V(i({
|
|
464
475
|
h: Z.h,
|
|
465
476
|
s: Z.s,
|
|
466
477
|
l: e,
|
|
@@ -471,56 +482,61 @@ function x({ value: o, onChange: x, onChangeCommitted: S, defaultFormat: ae = "h
|
|
|
471
482
|
})
|
|
472
483
|
]
|
|
473
484
|
}),
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
}), /* @__PURE__ */ g(f, {
|
|
483
|
-
sx: {
|
|
484
|
-
display: "flex",
|
|
485
|
-
flexWrap: "wrap",
|
|
486
|
-
gap: .75
|
|
487
|
-
},
|
|
488
|
-
children: w.map((e, t) => /* @__PURE__ */ g(f, {
|
|
489
|
-
component: "button",
|
|
490
|
-
type: "button",
|
|
491
|
-
disabled: T,
|
|
492
|
-
"aria-label": e,
|
|
493
|
-
onClick: () => {
|
|
494
|
-
let t = a(e);
|
|
495
|
-
t && V(s(t));
|
|
485
|
+
T && T.length > 0 && /* @__PURE__ */ v(m, {
|
|
486
|
+
className: t.savedColors,
|
|
487
|
+
children: [/* @__PURE__ */ _(re, {
|
|
488
|
+
variant: "caption",
|
|
489
|
+
sx: {
|
|
490
|
+
color: "text.secondary",
|
|
491
|
+
display: "block",
|
|
492
|
+
mb: .5
|
|
496
493
|
},
|
|
494
|
+
children: j.savedColorsLabel
|
|
495
|
+
}), /* @__PURE__ */ _(m, {
|
|
497
496
|
sx: {
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
borderRadius: .5,
|
|
502
|
-
border: `1px solid ${k.palette.divider}`,
|
|
503
|
-
cursor: T ? "default" : "pointer",
|
|
504
|
-
flexShrink: 0,
|
|
505
|
-
...$,
|
|
506
|
-
backgroundSize: "6px 6px",
|
|
507
|
-
"&:hover": T ? void 0 : { borderColor: k.palette.primary.main }
|
|
497
|
+
display: "flex",
|
|
498
|
+
flexWrap: "wrap",
|
|
499
|
+
gap: .75
|
|
508
500
|
},
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
501
|
+
className: t.swatchList,
|
|
502
|
+
children: T.map((e, n) => /* @__PURE__ */ _(m, {
|
|
503
|
+
component: "button",
|
|
504
|
+
type: "button",
|
|
505
|
+
disabled: E,
|
|
506
|
+
"aria-label": e,
|
|
507
|
+
onClick: () => {
|
|
508
|
+
let t = s(e);
|
|
509
|
+
t && H(l(t));
|
|
510
|
+
},
|
|
511
|
+
className: t.swatch,
|
|
512
|
+
sx: {
|
|
513
|
+
width: W,
|
|
514
|
+
height: W,
|
|
515
|
+
p: 0,
|
|
516
|
+
borderRadius: .5,
|
|
517
|
+
border: `1px solid ${A.palette.divider}`,
|
|
518
|
+
cursor: E ? "default" : "pointer",
|
|
519
|
+
flexShrink: 0,
|
|
520
|
+
...$,
|
|
521
|
+
backgroundSize: "6px 6px",
|
|
522
|
+
"&:hover": E ? void 0 : { borderColor: A.palette.primary.main }
|
|
523
|
+
},
|
|
524
|
+
children: /* @__PURE__ */ _(m, { sx: {
|
|
525
|
+
width: "100%",
|
|
526
|
+
height: "100%",
|
|
527
|
+
borderRadius: .5,
|
|
528
|
+
backgroundColor: e
|
|
529
|
+
} })
|
|
530
|
+
}, `${e}-${n}`))
|
|
531
|
+
})]
|
|
532
|
+
}),
|
|
533
|
+
k && /* @__PURE__ */ _("input", {
|
|
518
534
|
type: "hidden",
|
|
519
|
-
name:
|
|
520
|
-
value:
|
|
535
|
+
name: k,
|
|
536
|
+
value: ve.hex
|
|
521
537
|
})
|
|
522
538
|
]
|
|
523
539
|
});
|
|
524
540
|
}
|
|
525
541
|
//#endregion
|
|
526
|
-
export {
|
|
542
|
+
export { oe as ColorPicker };
|