@thebuoyant-tsdev/mui-ts-library 3.11.3 → 3.13.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/README.de.md +46 -1
- package/README.md +46 -1
- package/dist/components/color-picker/ColorPicker.d.ts +11 -0
- package/dist/components/color-picker/ColorPicker.js +527 -0
- package/dist/components/color-picker/ColorPicker.types.d.ts +65 -0
- package/dist/components/color-picker/ColorPicker.types.js +18 -0
- package/dist/components/color-picker/util/colorConversion.util.d.ts +51 -0
- package/dist/components/color-picker/util/colorConversion.util.js +166 -0
- package/dist/components/tag-selection/TagSelection.d.ts +1 -1
- package/dist/components/tag-selection/TagSelection.js +83 -70
- package/dist/components/tag-selection/TagSelection.types.d.ts +2 -0
- package/dist/components/tag-selection/TagSelectionAutocomplete.d.ts +2 -1
- package/dist/components/tag-selection/TagSelectionAutocomplete.js +88 -85
- package/dist/index.cjs +2 -2
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +3 -1
- package/package.json +2 -2
package/README.de.md
CHANGED
|
@@ -12,7 +12,7 @@ Eine typsichere React-Komponentenbibliothek auf Basis von **TypeScript** und **M
|
|
|
12
12
|
|
|
13
13
|
## Komponenten
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
12 produktionsreife Komponenten in drei Kategorien. Jede verlinkt zu einer interaktiven Live-Demo und einem vollständigen Manual mit allen Props, Typen und Mustern.
|
|
16
16
|
|
|
17
17
|
### Interaktive UI
|
|
18
18
|
|
|
@@ -21,6 +21,7 @@ Eine typsichere React-Komponentenbibliothek auf Basis von **TypeScript** und **M
|
|
|
21
21
|
| [`GanttChart`](#ganttchart) | Drag-and-Drop-Projekt-Timelines mit Meilensteinen, Abhängigkeiten und CSV-Export | [Live-Demo](https://thebuoyant.github.io/mui-ts-library/?path=/story/components-ganttchart--default) · [Docs](user-manuals/GanttChart.de.md) |
|
|
22
22
|
| [`TagSelection`](#tagselection) | Multi-Tag-Autocomplete mit freier Tag-Erstellung und Suchergebnis-Highlighting | [Live-Demo](https://thebuoyant.github.io/mui-ts-library/?path=/story/components-tagselection--default) · [Docs](user-manuals/TagSelection.de.md) |
|
|
23
23
|
| [`PasswordStrengthMeter`](#passwordstrengthmeter) | Echtzeit-Stärke-Feedback mit eingebautem sicheren Passwort-Generator | [Live-Demo](https://thebuoyant.github.io/mui-ts-library/?path=/story/components-passwordstrengthmeter--default) · [Docs](user-manuals/PasswordStrengthMeter.de.md) |
|
|
24
|
+
| [`ColorPicker`](#colorpicker) | Sättigung/Farbton/Alpha-Farbwähler-Panel mit Pipette-Werkzeug — MUI bringt keinen mit | [Live-Demo](https://thebuoyant.github.io/mui-ts-library/?path=/story/components-colorpicker--default) · [Docs](user-manuals/ColorPicker.de.md) |
|
|
24
25
|
|
|
25
26
|
### Code-Editoren
|
|
26
27
|
|
|
@@ -137,6 +138,31 @@ import { PasswordStrengthMeter } from '@thebuoyant-tsdev/mui-ts-library';
|
|
|
137
138
|
|
|
138
139
|
---
|
|
139
140
|
|
|
141
|
+
### ColorPicker
|
|
142
|
+
|
|
143
|
+
Ein Sättigung/Farbton/Alpha-Farbwähler-Panel — schließt eine echte MUI-Lücke, denn MUI bringt überhaupt keinen Farbwähler mit. Nutze es für Theme-Customizer, Markenfarben-Auswahl oder Design-System-Playgrounds. Vollständig kontrolliert; du besitzt `value` und aktualisierst es über `onChange`.
|
|
144
|
+
|
|
145
|
+
```tsx
|
|
146
|
+
import { useState } from 'react';
|
|
147
|
+
import { ColorPicker } from '@thebuoyant-tsdev/mui-ts-library';
|
|
148
|
+
|
|
149
|
+
function BrandColorPicker() {
|
|
150
|
+
const [color, setColor] = useState('#1976d2');
|
|
151
|
+
|
|
152
|
+
return (
|
|
153
|
+
<ColorPicker
|
|
154
|
+
value={color}
|
|
155
|
+
onChange={(hex) => setColor(hex)}
|
|
156
|
+
savedColors={['#f44336', '#2196f3', '#4caf50', '#ffeb3b']}
|
|
157
|
+
/>
|
|
158
|
+
);
|
|
159
|
+
}
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
→ [Vollständige Dokumentation](user-manuals/ColorPicker.de.md)
|
|
163
|
+
|
|
164
|
+
---
|
|
165
|
+
|
|
140
166
|
### RichTextEditor
|
|
141
167
|
|
|
142
168
|
Vollständiger WYSIWYG-Editor für formatierte Langtexte. Ideal für CMS-Felder, E-Mail-Templates, Kommentarbereiche und alle Eingaben, die mehr als ein einfaches `<textarea>` benötigen — mit Toolbar, Tabellen, Bild-Embed, Emoji-Picker, Vollbild und Markdown-Einfügen.
|
|
@@ -408,6 +434,25 @@ Dieses Projekt folgt [Semantic Versioning](https://semver.org/). In der Praxis b
|
|
|
408
434
|
|
|
409
435
|
## Changelog
|
|
410
436
|
|
|
437
|
+
### [3.13.0] — 2026-06-29
|
|
438
|
+
|
|
439
|
+
**Hinzugefügt**
|
|
440
|
+
- Neue Komponente: `ColorPicker` — ein Sättigung/Farbton/Alpha-Farbwähler-Panel mit Pipette-Werkzeug, schließt eine echte MUI-Lücke. Siehe [Quick Start](#colorpicker) und [Changelog](#3130--2026-06-29) für Details.
|
|
441
|
+
|
|
442
|
+
---
|
|
443
|
+
|
|
444
|
+
### [3.12.0] — 2026-06-29
|
|
445
|
+
|
|
446
|
+
**Hinzugefügt**
|
|
447
|
+
- TagSelection: `searchDebounceMs` (debounced `onSearchChange`) und `serverSideFilter` (vertraut `tags` als bereits gefiltert, für Fuzzy-/Nicht-Substring-Server-Suche) — schließt die seit längerem offene "Async Search"-Lücke.
|
|
448
|
+
|
|
449
|
+
**Behoben**
|
|
450
|
+
- TagSelection: bei der Umsetzung oben gefunden — ein verirrter zweiter `onSearchChange("")`-Aufruf feuerte direkt nach jedem echten Tastenanschlag (MUIs internes `reason="reset"`-Event). Wird jetzt herausgefiltert.
|
|
451
|
+
|
|
452
|
+
Details siehe [Changelog](#3120--2026-06-29).
|
|
453
|
+
|
|
454
|
+
---
|
|
455
|
+
|
|
411
456
|
### [3.11.3] — 2026-06-29
|
|
412
457
|
|
|
413
458
|
**Behoben**
|
package/README.md
CHANGED
|
@@ -12,7 +12,7 @@ A type-safe React component library built on **TypeScript** and **MUI (Material
|
|
|
12
12
|
|
|
13
13
|
## Components
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
12 production-ready components across three categories. Each links to a live, interactive demo and a full manual covering every prop, type, and pattern.
|
|
16
16
|
|
|
17
17
|
### Interactive UI
|
|
18
18
|
|
|
@@ -21,6 +21,7 @@ A type-safe React component library built on **TypeScript** and **MUI (Material
|
|
|
21
21
|
| [`GanttChart`](#ganttchart) | Drag-and-drop project timelines with milestones, dependencies, and CSV export | [Live demo](https://thebuoyant.github.io/mui-ts-library/?path=/story/components-ganttchart--default) · [Docs](user-manuals/GanttChart.md) |
|
|
22
22
|
| [`TagSelection`](#tagselection) | Multi-tag autocomplete with free-form tag creation and search highlighting | [Live demo](https://thebuoyant.github.io/mui-ts-library/?path=/story/components-tagselection--default) · [Docs](user-manuals/TagSelection.md) |
|
|
23
23
|
| [`PasswordStrengthMeter`](#passwordstrengthmeter) | Real-time strength feedback with a built-in secure password generator | [Live demo](https://thebuoyant.github.io/mui-ts-library/?path=/story/components-passwordstrengthmeter--default) · [Docs](user-manuals/PasswordStrengthMeter.md) |
|
|
24
|
+
| [`ColorPicker`](#colorpicker) | Saturation/hue/alpha color picker panel with an eyedropper tool — MUI ships none | [Live demo](https://thebuoyant.github.io/mui-ts-library/?path=/story/components-colorpicker--default) · [Docs](user-manuals/ColorPicker.md) |
|
|
24
25
|
|
|
25
26
|
### Code Editors
|
|
26
27
|
|
|
@@ -137,6 +138,31 @@ import { PasswordStrengthMeter } from '@thebuoyant-tsdev/mui-ts-library';
|
|
|
137
138
|
|
|
138
139
|
---
|
|
139
140
|
|
|
141
|
+
### ColorPicker
|
|
142
|
+
|
|
143
|
+
A saturation/hue/alpha color picker panel — fills a real MUI gap, since MUI ships no color picker at all. Use it for theme customizers, brand-color pickers, or design-system playgrounds. Fully controlled; you own `value` and update it from `onChange`.
|
|
144
|
+
|
|
145
|
+
```tsx
|
|
146
|
+
import { useState } from 'react';
|
|
147
|
+
import { ColorPicker } from '@thebuoyant-tsdev/mui-ts-library';
|
|
148
|
+
|
|
149
|
+
function BrandColorPicker() {
|
|
150
|
+
const [color, setColor] = useState('#1976d2');
|
|
151
|
+
|
|
152
|
+
return (
|
|
153
|
+
<ColorPicker
|
|
154
|
+
value={color}
|
|
155
|
+
onChange={(hex) => setColor(hex)}
|
|
156
|
+
savedColors={['#f44336', '#2196f3', '#4caf50', '#ffeb3b']}
|
|
157
|
+
/>
|
|
158
|
+
);
|
|
159
|
+
}
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
→ [Full documentation](user-manuals/ColorPicker.md)
|
|
163
|
+
|
|
164
|
+
---
|
|
165
|
+
|
|
140
166
|
### RichTextEditor
|
|
141
167
|
|
|
142
168
|
Full-featured WYSIWYG editor for long-form formatted content. Best for CMS fields, email templates, comment boxes, and any input that needs more than a plain `<textarea>` — with toolbar, tables, image embed, emoji picker, fullscreen, and Markdown paste support.
|
|
@@ -408,6 +434,25 @@ This project follows [Semantic Versioning](https://semver.org/). In practice:
|
|
|
408
434
|
|
|
409
435
|
## Changelog
|
|
410
436
|
|
|
437
|
+
### [3.13.0] — 2026-06-29
|
|
438
|
+
|
|
439
|
+
**Added**
|
|
440
|
+
- New component: `ColorPicker` — a saturation/hue/alpha color picker panel with an eyedropper tool, fills a real MUI gap. See [Quick Start](#colorpicker) and the [Changelog](#3130--2026-06-29) for details.
|
|
441
|
+
|
|
442
|
+
---
|
|
443
|
+
|
|
444
|
+
### [3.12.0] — 2026-06-29
|
|
445
|
+
|
|
446
|
+
**Added**
|
|
447
|
+
- TagSelection: `searchDebounceMs` (debounces `onSearchChange`) and `serverSideFilter` (trusts `tags` as already filtered, for fuzzy/non-substring server search) — closes the long-standing "Async Search" gap.
|
|
448
|
+
|
|
449
|
+
**Fixed**
|
|
450
|
+
- TagSelection: found while implementing the above — a spurious second `onSearchChange("")` call fired right after every real keystroke (MUI's internal `reason="reset"` event). Now filtered out.
|
|
451
|
+
|
|
452
|
+
See [Changelog](#3120--2026-06-29) for details.
|
|
453
|
+
|
|
454
|
+
---
|
|
455
|
+
|
|
411
456
|
### [3.11.3] — 2026-06-29
|
|
412
457
|
|
|
413
458
|
**Fixed**
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type ColorPickerProps } from "./ColorPicker.types";
|
|
2
|
+
declare global {
|
|
3
|
+
interface Window {
|
|
4
|
+
EyeDropper?: new () => {
|
|
5
|
+
open: () => Promise<{
|
|
6
|
+
sRGBHex: string;
|
|
7
|
+
}>;
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
export declare function ColorPicker({ value, onChange, onChangeCommitted, defaultFormat, onFormatChange, showAlpha, showEyeDropper, showSliderSection, showInputSection, savedColors, disabled, colorGradientSize, inputSize, width, name, translation, }: ColorPickerProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,527 @@
|
|
|
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";
|
|
7
|
+
//#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})`;
|
|
11
|
+
}
|
|
12
|
+
function y(e) {
|
|
13
|
+
let t = i(e), n = r(e), a = o(t);
|
|
14
|
+
return {
|
|
15
|
+
hex: a,
|
|
16
|
+
info: {
|
|
17
|
+
hex: a,
|
|
18
|
+
rgb: {
|
|
19
|
+
r: Math.round(t.r),
|
|
20
|
+
g: Math.round(t.g),
|
|
21
|
+
b: Math.round(t.b),
|
|
22
|
+
a: t.a
|
|
23
|
+
},
|
|
24
|
+
hsl: {
|
|
25
|
+
h: Math.round(n.h),
|
|
26
|
+
s: Math.round(n.s),
|
|
27
|
+
l: Math.round(n.l),
|
|
28
|
+
a: n.a
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
}
|
|
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, {
|
|
38
|
+
size: s,
|
|
39
|
+
value: f,
|
|
40
|
+
disabled: o,
|
|
41
|
+
onChange: (t) => {
|
|
42
|
+
let a = t.target.value;
|
|
43
|
+
p(a);
|
|
44
|
+
let o = Number(a);
|
|
45
|
+
a.trim() !== "" && !Number.isNaN(o) && n(e(o, r, i));
|
|
46
|
+
},
|
|
47
|
+
onBlur: () => {
|
|
48
|
+
p(String(Math.round(t))), c?.();
|
|
49
|
+
},
|
|
50
|
+
slotProps: { htmlInput: {
|
|
51
|
+
"aria-label": a,
|
|
52
|
+
style: { textAlign: "center" }
|
|
53
|
+
} },
|
|
54
|
+
sx: u ? {
|
|
55
|
+
flex: 1,
|
|
56
|
+
minWidth: 0
|
|
57
|
+
} : {
|
|
58
|
+
width: 64,
|
|
59
|
+
flexShrink: 0
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
}
|
|
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) : {
|
|
70
|
+
h: 0,
|
|
71
|
+
s: 0,
|
|
72
|
+
v: 0,
|
|
73
|
+
a: 1
|
|
74
|
+
};
|
|
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));
|
|
80
|
+
}
|
|
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);
|
|
92
|
+
S(t.hex, t.info);
|
|
93
|
+
}
|
|
94
|
+
}, H = () => {
|
|
95
|
+
if (!S) return;
|
|
96
|
+
let e = y(j);
|
|
97
|
+
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
|
|
105
|
+
});
|
|
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
|
|
112
|
+
});
|
|
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
|
|
119
|
+
});
|
|
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({
|
|
124
|
+
...e,
|
|
125
|
+
a: j.a
|
|
126
|
+
}));
|
|
127
|
+
} catch {}
|
|
128
|
+
}, ye = (e) => {
|
|
129
|
+
fe(e), oe?.(e);
|
|
130
|
+
}, X = i(j), Z = r(j), Q = F, $ = {
|
|
131
|
+
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
|
+
backgroundSize: "8px 8px",
|
|
133
|
+
backgroundPosition: "0 0, 0 4px, 4px -4px, -4px 0px"
|
|
134
|
+
};
|
|
135
|
+
return /* @__PURE__ */ _(f, {
|
|
136
|
+
sx: {
|
|
137
|
+
width: ue,
|
|
138
|
+
opacity: T ? .6 : 1,
|
|
139
|
+
display: "flex",
|
|
140
|
+
flexDirection: "column",
|
|
141
|
+
gap: 1
|
|
142
|
+
},
|
|
143
|
+
children: [
|
|
144
|
+
/* @__PURE__ */ g(f, {
|
|
145
|
+
ref: L,
|
|
146
|
+
role: "slider",
|
|
147
|
+
tabIndex: T ? -1 : 0,
|
|
148
|
+
"aria-label": A.gradientAreaLabel,
|
|
149
|
+
"aria-valuetext": `${Math.round(j.s)}, ${Math.round(j.v)}`,
|
|
150
|
+
onPointerDown: (e) => {
|
|
151
|
+
e.currentTarget.setPointerCapture?.(e.pointerId), K(e);
|
|
152
|
+
},
|
|
153
|
+
onPointerMove: (e) => {
|
|
154
|
+
e.buttons === 1 && K(e);
|
|
155
|
+
},
|
|
156
|
+
onPointerUp: H,
|
|
157
|
+
sx: {
|
|
158
|
+
position: "relative",
|
|
159
|
+
width: "100%",
|
|
160
|
+
height: _e,
|
|
161
|
+
borderRadius: `${k.shape.borderRadius}px`,
|
|
162
|
+
border: `1px solid ${k.palette.divider}`,
|
|
163
|
+
cursor: T ? "default" : "crosshair",
|
|
164
|
+
touchAction: "none",
|
|
165
|
+
background: `linear-gradient(to top, #000, rgba(0,0,0,0)), linear-gradient(to right, #fff, hsl(${j.h}, 100%, 50%))`
|
|
166
|
+
},
|
|
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
|
+
} })
|
|
180
|
+
}),
|
|
181
|
+
ce && /* @__PURE__ */ _(f, {
|
|
182
|
+
sx: {
|
|
183
|
+
display: "flex",
|
|
184
|
+
gap: 1,
|
|
185
|
+
alignItems: "center"
|
|
186
|
+
},
|
|
187
|
+
children: [se && Y && /* @__PURE__ */ g(te, {
|
|
188
|
+
title: A.eyeDropperLabel,
|
|
189
|
+
children: /* @__PURE__ */ g("span", { children: /* @__PURE__ */ g(p, {
|
|
190
|
+
size: "small",
|
|
191
|
+
onClick: ve,
|
|
192
|
+
disabled: T,
|
|
193
|
+
"aria-label": A.eyeDropperLabel,
|
|
194
|
+
children: /* @__PURE__ */ g(ie, { fontSize: "small" })
|
|
195
|
+
}) })
|
|
196
|
+
}), /* @__PURE__ */ _(f, {
|
|
197
|
+
sx: {
|
|
198
|
+
flex: 1,
|
|
199
|
+
display: "flex",
|
|
200
|
+
flexDirection: "column",
|
|
201
|
+
gap: .75
|
|
202
|
+
},
|
|
203
|
+
children: [/* @__PURE__ */ g(f, {
|
|
204
|
+
ref: R,
|
|
205
|
+
role: "slider",
|
|
206
|
+
tabIndex: T ? -1 : 0,
|
|
207
|
+
"aria-label": A.hueSliderLabel,
|
|
208
|
+
"aria-valuemin": 0,
|
|
209
|
+
"aria-valuemax": 360,
|
|
210
|
+
"aria-valuenow": Math.round(j.h),
|
|
211
|
+
onPointerDown: (e) => {
|
|
212
|
+
e.currentTarget.setPointerCapture?.(e.pointerId), q(e);
|
|
213
|
+
},
|
|
214
|
+
onPointerMove: (e) => {
|
|
215
|
+
e.buttons === 1 && q(e);
|
|
216
|
+
},
|
|
217
|
+
onPointerUp: H,
|
|
218
|
+
sx: {
|
|
219
|
+
position: "relative",
|
|
220
|
+
width: "100%",
|
|
221
|
+
height: W,
|
|
222
|
+
borderRadius: W,
|
|
223
|
+
cursor: T ? "default" : "pointer",
|
|
224
|
+
touchAction: "none",
|
|
225
|
+
background: "linear-gradient(to right, red, yellow, lime, cyan, blue, magenta, red)"
|
|
226
|
+
},
|
|
227
|
+
children: /* @__PURE__ */ g(f, { sx: {
|
|
228
|
+
position: "absolute",
|
|
229
|
+
left: v(j.h / 360 * 100, G),
|
|
230
|
+
top: "50%",
|
|
231
|
+
width: G,
|
|
232
|
+
height: G,
|
|
233
|
+
borderRadius: "50%",
|
|
234
|
+
border: "2px solid #fff",
|
|
235
|
+
boxShadow: "0 0 0 1px rgba(0,0,0,0.3)",
|
|
236
|
+
transform: "translate(-50%, -50%)",
|
|
237
|
+
pointerEvents: "none",
|
|
238
|
+
backgroundColor: `hsl(${j.h}, 100%, 50%)`
|
|
239
|
+
} })
|
|
240
|
+
}), C && /* @__PURE__ */ _(f, {
|
|
241
|
+
ref: z,
|
|
242
|
+
role: "slider",
|
|
243
|
+
tabIndex: T ? -1 : 0,
|
|
244
|
+
"aria-label": A.alphaFieldLabel,
|
|
245
|
+
"aria-valuemin": 0,
|
|
246
|
+
"aria-valuemax": 100,
|
|
247
|
+
"aria-valuenow": Math.round(j.a * 100),
|
|
248
|
+
onPointerDown: (e) => {
|
|
249
|
+
e.currentTarget.setPointerCapture?.(e.pointerId), J(e);
|
|
250
|
+
},
|
|
251
|
+
onPointerMove: (e) => {
|
|
252
|
+
e.buttons === 1 && J(e);
|
|
253
|
+
},
|
|
254
|
+
onPointerUp: H,
|
|
255
|
+
sx: {
|
|
256
|
+
position: "relative",
|
|
257
|
+
width: "100%",
|
|
258
|
+
height: W,
|
|
259
|
+
borderRadius: W,
|
|
260
|
+
cursor: T ? "default" : "pointer",
|
|
261
|
+
touchAction: "none",
|
|
262
|
+
...$
|
|
263
|
+
},
|
|
264
|
+
children: [/* @__PURE__ */ g(f, { sx: {
|
|
265
|
+
position: "absolute",
|
|
266
|
+
inset: 0,
|
|
267
|
+
borderRadius: W,
|
|
268
|
+
background: `linear-gradient(to right, transparent, ${Q})`
|
|
269
|
+
} }), /* @__PURE__ */ g(f, { sx: {
|
|
270
|
+
position: "absolute",
|
|
271
|
+
left: v(j.a * 100, G),
|
|
272
|
+
top: "50%",
|
|
273
|
+
width: G,
|
|
274
|
+
height: G,
|
|
275
|
+
borderRadius: "50%",
|
|
276
|
+
border: "2px solid #fff",
|
|
277
|
+
boxShadow: "0 0 0 1px rgba(0,0,0,0.3)",
|
|
278
|
+
transform: "translate(-50%, -50%)",
|
|
279
|
+
pointerEvents: "none",
|
|
280
|
+
backgroundColor: Q
|
|
281
|
+
} })]
|
|
282
|
+
})]
|
|
283
|
+
})]
|
|
284
|
+
}),
|
|
285
|
+
le && /* @__PURE__ */ _(f, {
|
|
286
|
+
sx: {
|
|
287
|
+
display: "flex",
|
|
288
|
+
flexDirection: "column",
|
|
289
|
+
gap: .75
|
|
290
|
+
},
|
|
291
|
+
children: [
|
|
292
|
+
/* @__PURE__ */ _(f, {
|
|
293
|
+
sx: {
|
|
294
|
+
display: "flex",
|
|
295
|
+
gap: .75,
|
|
296
|
+
alignItems: "center"
|
|
297
|
+
},
|
|
298
|
+
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),
|
|
305
|
+
sx: {
|
|
306
|
+
minWidth: 72,
|
|
307
|
+
fontSize: "0.75rem",
|
|
308
|
+
flexShrink: 0
|
|
309
|
+
},
|
|
310
|
+
children: [
|
|
311
|
+
/* @__PURE__ */ g(m, {
|
|
312
|
+
value: "hex",
|
|
313
|
+
children: "HEX"
|
|
314
|
+
}),
|
|
315
|
+
/* @__PURE__ */ g(m, {
|
|
316
|
+
value: "rgb",
|
|
317
|
+
children: "RGB"
|
|
318
|
+
}),
|
|
319
|
+
/* @__PURE__ */ g(m, {
|
|
320
|
+
value: "hsl",
|
|
321
|
+
children: "HSL"
|
|
322
|
+
})
|
|
323
|
+
]
|
|
324
|
+
}),
|
|
325
|
+
N === "hex" && /* @__PURE__ */ g(h, {
|
|
326
|
+
size: D,
|
|
327
|
+
value: ge,
|
|
328
|
+
disabled: T,
|
|
329
|
+
onChange: (e) => {
|
|
330
|
+
let n = e.target.value;
|
|
331
|
+
I(n);
|
|
332
|
+
let r = t(n);
|
|
333
|
+
r && B(s({
|
|
334
|
+
...r,
|
|
335
|
+
a: j.a
|
|
336
|
+
}));
|
|
337
|
+
},
|
|
338
|
+
onBlur: () => {
|
|
339
|
+
I(F), H();
|
|
340
|
+
},
|
|
341
|
+
slotProps: { htmlInput: { "aria-label": A.hexFieldLabel } },
|
|
342
|
+
sx: {
|
|
343
|
+
flex: 1,
|
|
344
|
+
minWidth: 0
|
|
345
|
+
}
|
|
346
|
+
}),
|
|
347
|
+
N !== "hex" && /* @__PURE__ */ g(f, { sx: { flex: 1 } }),
|
|
348
|
+
C && /* @__PURE__ */ g(b, {
|
|
349
|
+
label: A.alphaFieldLabel,
|
|
350
|
+
value: Math.round(j.a * 100),
|
|
351
|
+
min: 0,
|
|
352
|
+
max: 100,
|
|
353
|
+
disabled: T,
|
|
354
|
+
size: D,
|
|
355
|
+
onBlurExtra: H,
|
|
356
|
+
onCommit: (e) => B({
|
|
357
|
+
...j,
|
|
358
|
+
a: e / 100
|
|
359
|
+
})
|
|
360
|
+
})
|
|
361
|
+
]
|
|
362
|
+
}),
|
|
363
|
+
N === "rgb" && /* @__PURE__ */ _(f, {
|
|
364
|
+
sx: {
|
|
365
|
+
display: "flex",
|
|
366
|
+
gap: .75
|
|
367
|
+
},
|
|
368
|
+
children: [
|
|
369
|
+
/* @__PURE__ */ g(b, {
|
|
370
|
+
label: A.redLabel,
|
|
371
|
+
value: X.r,
|
|
372
|
+
min: 0,
|
|
373
|
+
max: 255,
|
|
374
|
+
disabled: T,
|
|
375
|
+
size: D,
|
|
376
|
+
onBlurExtra: H,
|
|
377
|
+
fullWidth: !0,
|
|
378
|
+
onCommit: (e) => B(s({
|
|
379
|
+
r: e,
|
|
380
|
+
g: X.g,
|
|
381
|
+
b: X.b,
|
|
382
|
+
a: j.a
|
|
383
|
+
}))
|
|
384
|
+
}),
|
|
385
|
+
/* @__PURE__ */ g(b, {
|
|
386
|
+
label: A.greenLabel,
|
|
387
|
+
value: X.g,
|
|
388
|
+
min: 0,
|
|
389
|
+
max: 255,
|
|
390
|
+
disabled: T,
|
|
391
|
+
size: D,
|
|
392
|
+
onBlurExtra: H,
|
|
393
|
+
fullWidth: !0,
|
|
394
|
+
onCommit: (e) => B(s({
|
|
395
|
+
r: X.r,
|
|
396
|
+
g: e,
|
|
397
|
+
b: X.b,
|
|
398
|
+
a: j.a
|
|
399
|
+
}))
|
|
400
|
+
}),
|
|
401
|
+
/* @__PURE__ */ g(b, {
|
|
402
|
+
label: A.blueLabel,
|
|
403
|
+
value: X.b,
|
|
404
|
+
min: 0,
|
|
405
|
+
max: 255,
|
|
406
|
+
disabled: T,
|
|
407
|
+
size: D,
|
|
408
|
+
onBlurExtra: H,
|
|
409
|
+
fullWidth: !0,
|
|
410
|
+
onCommit: (e) => B(s({
|
|
411
|
+
r: X.r,
|
|
412
|
+
g: X.g,
|
|
413
|
+
b: e,
|
|
414
|
+
a: j.a
|
|
415
|
+
}))
|
|
416
|
+
})
|
|
417
|
+
]
|
|
418
|
+
}),
|
|
419
|
+
N === "hsl" && /* @__PURE__ */ _(f, {
|
|
420
|
+
sx: {
|
|
421
|
+
display: "flex",
|
|
422
|
+
gap: .75
|
|
423
|
+
},
|
|
424
|
+
children: [
|
|
425
|
+
/* @__PURE__ */ g(b, {
|
|
426
|
+
label: A.hueFieldLabel,
|
|
427
|
+
value: Z.h,
|
|
428
|
+
min: 0,
|
|
429
|
+
max: 360,
|
|
430
|
+
disabled: T,
|
|
431
|
+
size: D,
|
|
432
|
+
onBlurExtra: H,
|
|
433
|
+
fullWidth: !0,
|
|
434
|
+
onCommit: (e) => B({
|
|
435
|
+
...j,
|
|
436
|
+
h: e
|
|
437
|
+
})
|
|
438
|
+
}),
|
|
439
|
+
/* @__PURE__ */ g(b, {
|
|
440
|
+
label: A.saturationFieldLabel,
|
|
441
|
+
value: Z.s,
|
|
442
|
+
min: 0,
|
|
443
|
+
max: 100,
|
|
444
|
+
disabled: T,
|
|
445
|
+
size: D,
|
|
446
|
+
onBlurExtra: H,
|
|
447
|
+
fullWidth: !0,
|
|
448
|
+
onCommit: (e) => B(n({
|
|
449
|
+
h: Z.h,
|
|
450
|
+
s: e,
|
|
451
|
+
l: Z.l,
|
|
452
|
+
a: Z.a
|
|
453
|
+
}))
|
|
454
|
+
}),
|
|
455
|
+
/* @__PURE__ */ g(b, {
|
|
456
|
+
label: A.lightnessFieldLabel,
|
|
457
|
+
value: Z.l,
|
|
458
|
+
min: 0,
|
|
459
|
+
max: 100,
|
|
460
|
+
disabled: T,
|
|
461
|
+
size: D,
|
|
462
|
+
onBlurExtra: H,
|
|
463
|
+
fullWidth: !0,
|
|
464
|
+
onCommit: (e) => B(n({
|
|
465
|
+
h: Z.h,
|
|
466
|
+
s: Z.s,
|
|
467
|
+
l: e,
|
|
468
|
+
a: Z.a
|
|
469
|
+
}))
|
|
470
|
+
})
|
|
471
|
+
]
|
|
472
|
+
})
|
|
473
|
+
]
|
|
474
|
+
}),
|
|
475
|
+
w && w.length > 0 && /* @__PURE__ */ _(f, { children: [/* @__PURE__ */ g(ne, {
|
|
476
|
+
variant: "caption",
|
|
477
|
+
sx: {
|
|
478
|
+
color: "text.secondary",
|
|
479
|
+
display: "block",
|
|
480
|
+
mb: .5
|
|
481
|
+
},
|
|
482
|
+
children: A.savedColorsLabel
|
|
483
|
+
}), /* @__PURE__ */ g(f, {
|
|
484
|
+
sx: {
|
|
485
|
+
display: "flex",
|
|
486
|
+
flexWrap: "wrap",
|
|
487
|
+
gap: .75
|
|
488
|
+
},
|
|
489
|
+
children: w.map((e, t) => /* @__PURE__ */ g(f, {
|
|
490
|
+
component: "button",
|
|
491
|
+
type: "button",
|
|
492
|
+
disabled: T,
|
|
493
|
+
"aria-label": e,
|
|
494
|
+
onClick: () => {
|
|
495
|
+
let t = a(e);
|
|
496
|
+
t && V(s(t));
|
|
497
|
+
},
|
|
498
|
+
sx: {
|
|
499
|
+
width: U,
|
|
500
|
+
height: U,
|
|
501
|
+
p: 0,
|
|
502
|
+
borderRadius: .5,
|
|
503
|
+
border: `1px solid ${k.palette.divider}`,
|
|
504
|
+
cursor: T ? "default" : "pointer",
|
|
505
|
+
flexShrink: 0,
|
|
506
|
+
...$,
|
|
507
|
+
backgroundSize: "6px 6px",
|
|
508
|
+
"&:hover": T ? void 0 : { borderColor: k.palette.primary.main }
|
|
509
|
+
},
|
|
510
|
+
children: /* @__PURE__ */ g(f, { sx: {
|
|
511
|
+
width: "100%",
|
|
512
|
+
height: "100%",
|
|
513
|
+
borderRadius: .5,
|
|
514
|
+
backgroundColor: e
|
|
515
|
+
} })
|
|
516
|
+
}, `${e}-${t}`))
|
|
517
|
+
})] }),
|
|
518
|
+
O && /* @__PURE__ */ g("input", {
|
|
519
|
+
type: "hidden",
|
|
520
|
+
name: O,
|
|
521
|
+
value: he.hex
|
|
522
|
+
})
|
|
523
|
+
]
|
|
524
|
+
});
|
|
525
|
+
}
|
|
526
|
+
//#endregion
|
|
527
|
+
export { x as ColorPicker };
|