@thebuoyant-tsdev/mui-ts-library 3.22.0 → 3.25.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.
Files changed (33) hide show
  1. package/README.de.md +30 -0
  2. package/README.md +30 -0
  3. package/dist/components/color-picker/ColorPicker.d.ts +1 -1
  4. package/dist/components/color-picker/ColorPicker.js +282 -266
  5. package/dist/components/color-picker/ColorPicker.types.d.ts +3 -1
  6. package/dist/components/color-picker/colorPickerClasses.d.ts +35 -0
  7. package/dist/components/color-picker/colorPickerClasses.js +15 -0
  8. package/dist/components/gantt-chart/GanttTaskPanel.js +187 -160
  9. package/dist/components/json-editor/JsonEditor.d.ts +1 -1
  10. package/dist/components/json-editor/JsonEditor.js +32 -31
  11. package/dist/components/json-editor/JsonEditor.types.d.ts +5 -0
  12. package/dist/components/json-editor/JsonEditor.types.js +3 -0
  13. package/dist/components/json-editor/JsonEditorToolbar.d.ts +2 -1
  14. package/dist/components/json-editor/JsonEditorToolbar.js +78 -61
  15. package/dist/components/password-strength-meter/PasswordStrengthBar.d.ts +2 -1
  16. package/dist/components/password-strength-meter/PasswordStrengthBar.js +3 -1
  17. package/dist/components/password-strength-meter/PasswordStrengthMeter.js +258 -237
  18. package/dist/components/password-strength-meter/passwordStrengthMeterClasses.d.ts +40 -0
  19. package/dist/components/password-strength-meter/passwordStrengthMeterClasses.js +16 -0
  20. package/dist/components/rich-text-editor/RichTextEditorToolbar.js +115 -111
  21. package/dist/components/tag-selection/TagSelection.js +82 -79
  22. package/dist/components/tag-selection/TagSelectionAutocomplete.js +102 -98
  23. package/dist/components/tag-selection/TagSelectionChip.js +24 -21
  24. package/dist/components/tag-selection/TagSelectionSelectedTags.js +44 -38
  25. package/dist/components/tag-selection/tagSelectionClasses.d.ts +34 -0
  26. package/dist/components/tag-selection/tagSelectionClasses.js +15 -0
  27. package/dist/index.cjs +2 -2
  28. package/dist/index.d.cts +4 -0
  29. package/dist/index.d.ts +4 -0
  30. package/dist/index.js +31 -27
  31. package/dist/utils/muiTsClasses.d.ts +7 -0
  32. package/dist/utils/muiTsClasses.js +9 -0
  33. package/package.json +2 -1
@@ -1,20 +1,22 @@
1
- import { clamp as e, hexToRgba as t, hslaToHsva as n, hsvaToHsla as r, hsvaToRgba as i, parseColorString as a, rgbaToHex as o, rgbaToHsva as s } from "./util/colorConversion.util.js";
2
- import { DEFAULT_COLOR_PICKER_TRANSLATION as c } from "./ColorPicker.types.js";
3
- import { useEffect as l, useRef as u, useState as d } from "react";
4
- import { Box as f, IconButton as p, MenuItem as m, Select as ee, TextField as h, Tooltip as te, Typography as ne, useTheme as re } from "@mui/material";
5
- import { jsx as g, jsxs as _ } from "react/jsx-runtime";
6
- import ie from "@mui/icons-material/Colorize";
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 v(t, n) {
9
- let r = e(t, 0, 100);
10
- return `calc(${n / 2}px + (100% - ${n}px) * ${r / 100})`;
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 y(e) {
13
- let t = i(e), n = r(e), a = o(t);
14
+ function b(e) {
15
+ let t = o(e), n = a(e), r = c(t);
14
16
  return {
15
- hex: a,
17
+ hex: r,
16
18
  info: {
17
- hex: a,
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 b({ value: t, onCommit: n, min: r, max: i, label: a, disabled: o, size: s, onBlurExtra: c, fullWidth: u }) {
34
- let [f, p] = d(String(Math.round(t)));
35
- return l(() => {
36
- p(String(Math.round(t)));
37
- }, [t]), /* @__PURE__ */ g(h, {
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: f,
41
+ value: u,
40
42
  disabled: o,
41
- onChange: (t) => {
42
- let a = t.target.value;
43
- p(a);
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(e(o, r, i));
47
+ a.trim() !== "" && !Number.isNaN(o) && t(n(o, r, i));
46
48
  },
47
49
  onBlur: () => {
48
- p(String(Math.round(t))), c?.();
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: u ? {
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 x({ value: o, onChange: x, onChangeCommitted: S, defaultFormat: ae = "hex", onFormatChange: oe, showAlpha: C = !0, showEyeDropper: se = !0, showSliderSection: ce = !0, showInputSection: le = !0, savedColors: w, disabled: T = !1, colorGradientSize: E = "medium", inputSize: D = "medium", width: ue = 280, name: O, translation: de }) {
64
- let k = re(), A = {
65
- ...c,
66
- ...de
67
- }, [j, M] = d(() => {
68
- let e = a(o);
69
- return e ? s(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
- }), [N, fe] = d(ae), [pe, P] = d(o);
76
- if (pe !== o) {
77
- P(o);
78
- let e = a(o);
79
- e && M(s(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: me, info: he } = y(j), F = me.slice(0, 7), [ge, I] = d(F);
82
- l(() => {
83
- I(F);
84
- }, [F]);
85
- let L = u(null), R = u(null), z = u(null), B = (e) => {
86
- M(e);
87
- let t = y(e);
88
- P(t.hex), x(t.hex, t.info);
89
- }, V = (e) => {
90
- if (B(e), S) {
91
- let t = y(e);
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
- }, H = () => {
96
+ }, U = () => {
95
97
  if (!S) return;
96
- let e = y(j);
98
+ let e = b(M);
97
99
  S(e.hex, e.info);
98
- }, _e = E === "small" ? 130 : 160, U = E === "small" ? 20 : 24, W = E === "small" ? 10 : 12, G = E === "small" ? 13 : 16, K = (t) => {
99
- if (T || !L.current) return;
100
- let n = L.current.getBoundingClientRect(), r = e(t.clientX - n.left, 0, n.width), i = e(t.clientY - n.top, 0, n.height);
101
- B({
102
- ...j,
103
- s: r / n.width * 100,
104
- v: 100 - i / n.height * 100
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
- }, q = (t) => {
107
- if (T || !R.current) return;
108
- let n = R.current.getBoundingClientRect(), r = e(t.clientX - n.left, 0, n.width);
109
- B({
110
- ...j,
111
- h: r / n.width * 360
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
- }, J = (t) => {
114
- if (T || !z.current) return;
115
- let n = z.current.getBoundingClientRect(), r = e(t.clientX - n.left, 0, n.width);
116
- B({
117
- ...j,
118
- a: r / n.width
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
- }, Y = typeof window < "u" && !!window.EyeDropper, ve = async () => {
121
- if (!(T || !window.EyeDropper)) try {
122
- let e = t((await new window.EyeDropper().open()).sRGBHex);
123
- e && V(s({
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: j.a
127
+ a: M.a
126
128
  }));
127
129
  } catch {}
128
- }, ye = (e) => {
129
- fe(e), oe?.(e);
130
- }, X = i(j), Z = r(j), Q = F, $ = {
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__ */ _(f, {
137
+ return /* @__PURE__ */ v(m, {
136
138
  sx: {
137
- width: ue,
138
- opacity: T ? .6 : 1,
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__ */ g(f, {
145
- ref: L,
147
+ /* @__PURE__ */ _(m, {
148
+ ref: R,
146
149
  role: "slider",
147
- tabIndex: T ? -1 : 0,
148
- "aria-label": A.gradientAreaLabel,
149
- "aria-valuetext": `${Math.round(j.s)}, ${Math.round(j.v)}`,
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), K(e);
154
+ e.currentTarget.setPointerCapture?.(e.pointerId), q(e);
152
155
  },
153
156
  onPointerMove: (e) => {
154
- e.buttons === 1 && K(e);
157
+ e.buttons === 1 && q(e);
155
158
  },
156
- onPointerUp: H,
159
+ onPointerUp: U,
160
+ className: t.gradientArea,
157
161
  sx: {
158
162
  position: "relative",
159
163
  width: "100%",
160
- height: _e,
161
- borderRadius: `${k.shape.borderRadius}px`,
162
- border: `1px solid ${k.palette.divider}`,
163
- cursor: T ? "default" : "crosshair",
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(${j.h}, 100%, 50%))`
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__ */ g(f, { sx: {
168
- position: "absolute",
169
- left: v(j.s, G),
170
- top: v(100 - j.v, G),
171
- width: G,
172
- height: G,
173
- borderRadius: "50%",
174
- border: "2px solid #fff",
175
- boxShadow: "0 0 0 1px rgba(0,0,0,0.3)",
176
- transform: "translate(-50%, -50%)",
177
- pointerEvents: "none",
178
- backgroundColor: Q
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
- ce && /* @__PURE__ */ _(f, {
188
+ ue && /* @__PURE__ */ v(m, {
182
189
  sx: {
183
190
  display: "flex",
184
191
  gap: 1,
185
192
  alignItems: "center"
186
193
  },
187
- children: [se && Y && /* @__PURE__ */ g(te, {
188
- title: A.eyeDropperLabel,
189
- children: /* @__PURE__ */ g("span", { children: /* @__PURE__ */ g(p, {
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: ve,
192
- disabled: T,
193
- "aria-label": A.eyeDropperLabel,
194
- children: /* @__PURE__ */ g(ie, { fontSize: "small" })
199
+ onClick: Se,
200
+ disabled: E,
201
+ "aria-label": j.eyeDropperLabel,
202
+ children: /* @__PURE__ */ _(ae, { fontSize: "small" })
195
203
  }) })
196
- }), /* @__PURE__ */ _(f, {
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__ */ g(f, {
204
- ref: R,
211
+ children: [/* @__PURE__ */ _(m, {
212
+ ref: z,
205
213
  role: "slider",
206
- tabIndex: T ? -1 : 0,
207
- "aria-label": A.hueSliderLabel,
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(j.h),
218
+ "aria-valuenow": Math.round(M.h),
211
219
  onPointerDown: (e) => {
212
- e.currentTarget.setPointerCapture?.(e.pointerId), q(e);
220
+ e.currentTarget.setPointerCapture?.(e.pointerId), J(e);
213
221
  },
214
222
  onPointerMove: (e) => {
215
- e.buttons === 1 && q(e);
223
+ e.buttons === 1 && J(e);
216
224
  },
217
- onPointerUp: H,
225
+ onPointerUp: U,
226
+ className: t.hueSlider,
218
227
  sx: {
219
228
  position: "relative",
220
229
  width: "100%",
221
- height: W,
222
- borderRadius: W,
223
- cursor: T ? "default" : "pointer",
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__ */ g(f, { sx: {
236
+ children: /* @__PURE__ */ _(m, { sx: {
228
237
  position: "absolute",
229
- left: v(j.h / 360 * 100, G),
238
+ left: y(M.h / 360 * 100, K),
230
239
  top: "50%",
231
- width: G,
232
- height: G,
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(${j.h}, 100%, 50%)`
247
+ backgroundColor: `hsl(${M.h}, 100%, 50%)`
239
248
  } })
240
- }), C && /* @__PURE__ */ _(f, {
241
- ref: z,
249
+ }), w && /* @__PURE__ */ v(m, {
250
+ ref: B,
242
251
  role: "slider",
243
- tabIndex: T ? -1 : 0,
244
- "aria-label": A.alphaFieldLabel,
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(j.a * 100),
256
+ "aria-valuenow": Math.round(M.a * 100),
248
257
  onPointerDown: (e) => {
249
- e.currentTarget.setPointerCapture?.(e.pointerId), J(e);
258
+ e.currentTarget.setPointerCapture?.(e.pointerId), Y(e);
250
259
  },
251
260
  onPointerMove: (e) => {
252
- e.buttons === 1 && J(e);
261
+ e.buttons === 1 && Y(e);
253
262
  },
254
- onPointerUp: H,
263
+ onPointerUp: U,
264
+ className: t.alphaSlider,
255
265
  sx: {
256
266
  position: "relative",
257
267
  width: "100%",
258
- height: W,
259
- borderRadius: W,
260
- cursor: T ? "default" : "pointer",
268
+ height: G,
269
+ borderRadius: G,
270
+ cursor: E ? "default" : "pointer",
261
271
  touchAction: "none",
262
272
  ...$
263
273
  },
264
- children: [/* @__PURE__ */ g(f, { sx: {
274
+ children: [/* @__PURE__ */ _(m, { sx: {
265
275
  position: "absolute",
266
276
  inset: 0,
267
- borderRadius: W,
277
+ borderRadius: G,
268
278
  background: `linear-gradient(to right, transparent, ${Q})`
269
- } }), /* @__PURE__ */ g(f, { sx: {
279
+ } }), /* @__PURE__ */ _(m, { sx: {
270
280
  position: "absolute",
271
- left: v(j.a * 100, G),
281
+ left: y(M.a * 100, K),
272
282
  top: "50%",
273
- width: G,
274
- height: G,
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
- le && /* @__PURE__ */ _(f, {
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__ */ _(f, {
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__ */ _(ee, {
300
- size: D,
301
- value: N,
302
- "aria-label": A.formatLabel,
303
- disabled: T,
304
- onChange: (e) => ye(e.target.value),
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__ */ g(m, {
321
+ /* @__PURE__ */ _(h, {
311
322
  value: "hex",
312
323
  children: "HEX"
313
324
  }),
314
- /* @__PURE__ */ g(m, {
325
+ /* @__PURE__ */ _(h, {
315
326
  value: "rgb",
316
327
  children: "RGB"
317
328
  }),
318
- /* @__PURE__ */ g(m, {
329
+ /* @__PURE__ */ _(h, {
319
330
  value: "hsl",
320
331
  children: "HSL"
321
332
  })
322
333
  ]
323
334
  }),
324
- N === "hex" && /* @__PURE__ */ g(h, {
325
- size: D,
326
- value: ge,
327
- disabled: T,
335
+ P === "hex" && /* @__PURE__ */ _(g, {
336
+ size: O,
337
+ value: ye,
338
+ disabled: E,
328
339
  onChange: (e) => {
329
- let n = e.target.value;
330
- I(n);
331
- let r = t(n);
332
- r && B(s({
333
- ...r,
334
- a: j.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(F), H();
349
+ L(I), U();
339
350
  },
340
- slotProps: { htmlInput: { "aria-label": A.hexFieldLabel } },
351
+ slotProps: { htmlInput: { "aria-label": j.hexFieldLabel } },
341
352
  sx: {
342
353
  flex: 1,
343
354
  minWidth: 0
344
355
  }
345
356
  }),
346
- N !== "hex" && /* @__PURE__ */ g(f, { sx: { flex: 1 } }),
347
- C && /* @__PURE__ */ g(b, {
348
- label: A.alphaFieldLabel,
349
- value: Math.round(j.a * 100),
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: T,
353
- size: D,
354
- onBlurExtra: H,
355
- onCommit: (e) => B({
356
- ...j,
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
- N === "rgb" && /* @__PURE__ */ _(f, {
373
+ P === "rgb" && /* @__PURE__ */ v(m, {
363
374
  sx: {
364
375
  display: "flex",
365
376
  gap: .75
366
377
  },
367
378
  children: [
368
- /* @__PURE__ */ g(b, {
369
- label: A.redLabel,
379
+ /* @__PURE__ */ _(x, {
380
+ label: j.redLabel,
370
381
  value: X.r,
371
382
  min: 0,
372
383
  max: 255,
373
- disabled: T,
374
- size: D,
375
- onBlurExtra: H,
384
+ disabled: E,
385
+ size: O,
386
+ onBlurExtra: U,
376
387
  fullWidth: !0,
377
- onCommit: (e) => B(s({
388
+ onCommit: (e) => V(l({
378
389
  r: e,
379
390
  g: X.g,
380
391
  b: X.b,
381
- a: j.a
392
+ a: M.a
382
393
  }))
383
394
  }),
384
- /* @__PURE__ */ g(b, {
385
- label: A.greenLabel,
395
+ /* @__PURE__ */ _(x, {
396
+ label: j.greenLabel,
386
397
  value: X.g,
387
398
  min: 0,
388
399
  max: 255,
389
- disabled: T,
390
- size: D,
391
- onBlurExtra: H,
400
+ disabled: E,
401
+ size: O,
402
+ onBlurExtra: U,
392
403
  fullWidth: !0,
393
- onCommit: (e) => B(s({
404
+ onCommit: (e) => V(l({
394
405
  r: X.r,
395
406
  g: e,
396
407
  b: X.b,
397
- a: j.a
408
+ a: M.a
398
409
  }))
399
410
  }),
400
- /* @__PURE__ */ g(b, {
401
- label: A.blueLabel,
411
+ /* @__PURE__ */ _(x, {
412
+ label: j.blueLabel,
402
413
  value: X.b,
403
414
  min: 0,
404
415
  max: 255,
405
- disabled: T,
406
- size: D,
407
- onBlurExtra: H,
416
+ disabled: E,
417
+ size: O,
418
+ onBlurExtra: U,
408
419
  fullWidth: !0,
409
- onCommit: (e) => B(s({
420
+ onCommit: (e) => V(l({
410
421
  r: X.r,
411
422
  g: X.g,
412
423
  b: e,
413
- a: j.a
424
+ a: M.a
414
425
  }))
415
426
  })
416
427
  ]
417
428
  }),
418
- N === "hsl" && /* @__PURE__ */ _(f, {
429
+ P === "hsl" && /* @__PURE__ */ v(m, {
419
430
  sx: {
420
431
  display: "flex",
421
432
  gap: .75
422
433
  },
423
434
  children: [
424
- /* @__PURE__ */ g(b, {
425
- label: A.hueFieldLabel,
435
+ /* @__PURE__ */ _(x, {
436
+ label: j.hueFieldLabel,
426
437
  value: Z.h,
427
438
  min: 0,
428
439
  max: 360,
429
- disabled: T,
430
- size: D,
431
- onBlurExtra: H,
440
+ disabled: E,
441
+ size: O,
442
+ onBlurExtra: U,
432
443
  fullWidth: !0,
433
- onCommit: (e) => B({
434
- ...j,
444
+ onCommit: (e) => V({
445
+ ...M,
435
446
  h: e
436
447
  })
437
448
  }),
438
- /* @__PURE__ */ g(b, {
439
- label: A.saturationFieldLabel,
449
+ /* @__PURE__ */ _(x, {
450
+ label: j.saturationFieldLabel,
440
451
  value: Z.s,
441
452
  min: 0,
442
453
  max: 100,
443
- disabled: T,
444
- size: D,
445
- onBlurExtra: H,
454
+ disabled: E,
455
+ size: O,
456
+ onBlurExtra: U,
446
457
  fullWidth: !0,
447
- onCommit: (e) => B(n({
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__ */ g(b, {
455
- label: A.lightnessFieldLabel,
465
+ /* @__PURE__ */ _(x, {
466
+ label: j.lightnessFieldLabel,
456
467
  value: Z.l,
457
468
  min: 0,
458
469
  max: 100,
459
- disabled: T,
460
- size: D,
461
- onBlurExtra: H,
470
+ disabled: E,
471
+ size: O,
472
+ onBlurExtra: U,
462
473
  fullWidth: !0,
463
- onCommit: (e) => B(n({
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
- w && w.length > 0 && /* @__PURE__ */ _(f, { children: [/* @__PURE__ */ g(ne, {
475
- variant: "caption",
476
- sx: {
477
- color: "text.secondary",
478
- display: "block",
479
- mb: .5
480
- },
481
- children: A.savedColorsLabel
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
- width: U,
499
- height: U,
500
- p: 0,
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
- children: /* @__PURE__ */ g(f, { sx: {
510
- width: "100%",
511
- height: "100%",
512
- borderRadius: .5,
513
- backgroundColor: e
514
- } })
515
- }, `${e}-${t}`))
516
- })] }),
517
- O && /* @__PURE__ */ g("input", {
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: O,
520
- value: he.hex
535
+ name: k,
536
+ value: ve.hex
521
537
  })
522
538
  ]
523
539
  });
524
540
  }
525
541
  //#endregion
526
- export { x as ColorPicker };
542
+ export { oe as ColorPicker };