@frontify/fondue-components 24.1.0 → 25.0.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/fondue-components.js +52 -48
- package/dist/fondue-components.js.map +1 -1
- package/dist/fondue-components10.js +3 -3
- package/dist/fondue-components10.js.map +1 -1
- package/dist/fondue-components11.js +104 -86
- package/dist/fondue-components11.js.map +1 -1
- package/dist/fondue-components12.js +2 -2
- package/dist/fondue-components13.js +58 -57
- package/dist/fondue-components13.js.map +1 -1
- package/dist/fondue-components14.js +2 -2
- package/dist/fondue-components15.js +2 -2
- package/dist/fondue-components16.js +2 -2
- package/dist/fondue-components17.js +56 -36
- package/dist/fondue-components17.js.map +1 -1
- package/dist/fondue-components18.js +34 -16
- package/dist/fondue-components18.js.map +1 -1
- package/dist/fondue-components19.js +18 -73
- package/dist/fondue-components19.js.map +1 -1
- package/dist/fondue-components20.js +18 -36
- package/dist/fondue-components20.js.map +1 -1
- package/dist/fondue-components21.js +71 -50
- package/dist/fondue-components21.js.map +1 -1
- package/dist/fondue-components22.js +36 -138
- package/dist/fondue-components22.js.map +1 -1
- package/dist/fondue-components23.js +50 -50
- package/dist/fondue-components23.js.map +1 -1
- package/dist/fondue-components24.js +137 -99
- package/dist/fondue-components24.js.map +1 -1
- package/dist/fondue-components25.js +48 -26
- package/dist/fondue-components25.js.map +1 -1
- package/dist/fondue-components26.js +92 -188
- package/dist/fondue-components26.js.map +1 -1
- package/dist/fondue-components27.js +30 -134
- package/dist/fondue-components27.js.map +1 -1
- package/dist/fondue-components28.js +191 -126
- package/dist/fondue-components28.js.map +1 -1
- package/dist/fondue-components29.js +134 -30
- package/dist/fondue-components29.js.map +1 -1
- package/dist/fondue-components3.js +1 -1
- package/dist/fondue-components30.js +130 -63
- package/dist/fondue-components30.js.map +1 -1
- package/dist/fondue-components31.js +31 -114
- package/dist/fondue-components31.js.map +1 -1
- package/dist/fondue-components32.js +64 -36
- package/dist/fondue-components32.js.map +1 -1
- package/dist/fondue-components33.js +111 -53
- package/dist/fondue-components33.js.map +1 -1
- package/dist/fondue-components34.js +36 -20
- package/dist/fondue-components34.js.map +1 -1
- package/dist/fondue-components35.js +57 -23
- package/dist/fondue-components35.js.map +1 -1
- package/dist/fondue-components36.js +20 -7
- package/dist/fondue-components36.js.map +1 -1
- package/dist/fondue-components37.js +23 -6
- package/dist/fondue-components37.js.map +1 -1
- package/dist/fondue-components38.js +8 -32
- package/dist/fondue-components38.js.map +1 -1
- package/dist/fondue-components39.js +5 -3
- package/dist/fondue-components39.js.map +1 -1
- package/dist/fondue-components4.js +3 -3
- package/dist/fondue-components40.js +32 -12
- package/dist/fondue-components40.js.map +1 -1
- package/dist/fondue-components41.js +5 -155
- package/dist/fondue-components41.js.map +1 -1
- package/dist/fondue-components42.js +18 -116
- package/dist/fondue-components42.js.map +1 -1
- package/dist/fondue-components43.js +59 -22
- package/dist/fondue-components43.js.map +1 -1
- package/dist/fondue-components44.js +111 -14
- package/dist/fondue-components44.js.map +1 -1
- package/dist/fondue-components45.js +116 -30
- package/dist/fondue-components45.js.map +1 -1
- package/dist/fondue-components46.js +21 -54
- package/dist/fondue-components46.js.map +1 -1
- package/dist/fondue-components47.js +32 -131
- package/dist/fondue-components47.js.map +1 -1
- package/dist/fondue-components48.js +53 -20
- package/dist/fondue-components48.js.map +1 -1
- package/dist/fondue-components49.js +131 -53
- package/dist/fondue-components49.js.map +1 -1
- package/dist/fondue-components5.js +2 -2
- package/dist/fondue-components50.js +20 -7
- package/dist/fondue-components50.js.map +1 -1
- package/dist/fondue-components51.js +53 -13
- package/dist/fondue-components51.js.map +1 -1
- package/dist/fondue-components52.js +7 -14
- package/dist/fondue-components52.js.map +1 -1
- package/dist/fondue-components53.js +13 -5
- package/dist/fondue-components53.js.map +1 -1
- package/dist/fondue-components54.js +15 -60
- package/dist/fondue-components54.js.map +1 -1
- package/dist/fondue-components55.js +5 -18
- package/dist/fondue-components55.js.map +1 -1
- package/dist/fondue-components56.js +60 -19
- package/dist/fondue-components56.js.map +1 -1
- package/dist/fondue-components57.js +18 -5
- package/dist/fondue-components57.js.map +1 -1
- package/dist/fondue-components58.js +18 -14
- package/dist/fondue-components58.js.map +1 -1
- package/dist/fondue-components59.js +1 -1
- package/dist/fondue-components6.js +4 -4
- package/dist/fondue-components60.js +10 -16
- package/dist/fondue-components60.js.map +1 -1
- package/dist/fondue-components61.js +4 -10
- package/dist/fondue-components61.js.map +1 -1
- package/dist/fondue-components62.js +18 -35
- package/dist/fondue-components62.js.map +1 -1
- package/dist/fondue-components63.js +10 -4
- package/dist/fondue-components63.js.map +1 -1
- package/dist/fondue-components64.js +34 -10
- package/dist/fondue-components64.js.map +1 -1
- package/dist/fondue-components65.js +35 -5
- package/dist/fondue-components65.js.map +1 -1
- package/dist/fondue-components66.js +4 -24
- package/dist/fondue-components66.js.map +1 -1
- package/dist/fondue-components67.js +12 -16
- package/dist/fondue-components67.js.map +1 -1
- package/dist/fondue-components68.js +4 -151
- package/dist/fondue-components68.js.map +1 -1
- package/dist/fondue-components69.js +25 -19
- package/dist/fondue-components69.js.map +1 -1
- package/dist/fondue-components7.js +2 -2
- package/dist/fondue-components70.js +16 -78
- package/dist/fondue-components70.js.map +1 -1
- package/dist/fondue-components71.js +152 -8
- package/dist/fondue-components71.js.map +1 -1
- package/dist/fondue-components72.js +19 -37
- package/dist/fondue-components72.js.map +1 -1
- package/dist/fondue-components73.js +77 -69
- package/dist/fondue-components73.js.map +1 -1
- package/dist/fondue-components74.js +8 -11
- package/dist/fondue-components74.js.map +1 -1
- package/dist/fondue-components75.js +36 -10
- package/dist/fondue-components75.js.map +1 -1
- package/dist/fondue-components76.js +70 -12
- package/dist/fondue-components76.js.map +1 -1
- package/dist/fondue-components77.js +10 -12
- package/dist/fondue-components77.js.map +1 -1
- package/dist/fondue-components78.js +10 -22
- package/dist/fondue-components78.js.map +1 -1
- package/dist/fondue-components79.js +13 -34
- package/dist/fondue-components79.js.map +1 -1
- package/dist/fondue-components8.js +5 -5
- package/dist/fondue-components80.js +12 -10
- package/dist/fondue-components80.js.map +1 -1
- package/dist/fondue-components81.js +22 -67
- package/dist/fondue-components81.js.map +1 -1
- package/dist/fondue-components82.js +34 -15
- package/dist/fondue-components82.js.map +1 -1
- package/dist/fondue-components83.js +9 -24
- package/dist/fondue-components83.js.map +1 -1
- package/dist/fondue-components84.js +67 -18
- package/dist/fondue-components84.js.map +1 -1
- package/dist/fondue-components85.js +12 -22
- package/dist/fondue-components85.js.map +1 -1
- package/dist/fondue-components86.js +24 -6
- package/dist/fondue-components86.js.map +1 -1
- package/dist/fondue-components87.js +18 -19
- package/dist/fondue-components87.js.map +1 -1
- package/dist/fondue-components88.js +24 -6
- package/dist/fondue-components88.js.map +1 -1
- package/dist/fondue-components89.js +8 -4
- package/dist/fondue-components89.js.map +1 -1
- package/dist/fondue-components9.js +5 -5
- package/dist/fondue-components90.js +19 -4
- package/dist/fondue-components90.js.map +1 -1
- package/dist/fondue-components91.js +7 -2
- package/dist/fondue-components91.js.map +1 -1
- package/dist/fondue-components92.js +4 -39
- package/dist/fondue-components92.js.map +1 -1
- package/dist/fondue-components93.js +4 -20
- package/dist/fondue-components93.js.map +1 -1
- package/dist/fondue-components94.js +2 -17
- package/dist/fondue-components94.js.map +1 -1
- package/dist/fondue-components95.js +43 -0
- package/dist/fondue-components95.js.map +1 -0
- package/dist/fondue-components96.js +24 -0
- package/dist/fondue-components96.js.map +1 -0
- package/dist/fondue-components97.js +20 -0
- package/dist/fondue-components97.js.map +1 -0
- package/dist/index.d.ts +116 -3
- package/dist/style.css +1 -1
- package/package.json +6 -6
|
@@ -1,134 +1,35 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
},
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
/* @__PURE__ */ e(c.Item, { value: "RGBA", children: "RGBA" })
|
|
32
|
-
]
|
|
33
|
-
}
|
|
34
|
-
) }),
|
|
35
|
-
u === "HEX" ? /* @__PURE__ */ e(
|
|
36
|
-
r.Root,
|
|
37
|
-
{
|
|
38
|
-
"data-test-id": "color-picker-value-input-hex",
|
|
39
|
-
className: l.valueInput,
|
|
40
|
-
type: "text",
|
|
41
|
-
value: p,
|
|
42
|
-
status: h(p) ? "neutral" : "error",
|
|
43
|
-
onBlur: (a) => {
|
|
44
|
-
h(a.target.value) && o({ ...D(a.target.value), alpha: t.alpha });
|
|
45
|
-
},
|
|
46
|
-
onChange: (a) => {
|
|
47
|
-
const k = a.target.value.startsWith("#") ? a.target.value.slice(1) : a.target.value;
|
|
48
|
-
d(k);
|
|
49
|
-
},
|
|
50
|
-
"aria-label": i("ColorPicker_hexValue"),
|
|
51
|
-
children: /* @__PURE__ */ e(r.Slot, { name: "left", children: /* @__PURE__ */ e("span", { className: l.inputDecorator, children: "#" }) })
|
|
52
|
-
}
|
|
53
|
-
) : /* @__PURE__ */ n("div", { className: l.colorChannelInputGroup, children: [
|
|
54
|
-
/* @__PURE__ */ e(
|
|
55
|
-
r.Root,
|
|
56
|
-
{
|
|
57
|
-
"data-test-id": "color-picker-value-input-red",
|
|
58
|
-
className: l.valueInput,
|
|
59
|
-
value: t.red,
|
|
60
|
-
type: "number",
|
|
61
|
-
onChange: (a) => {
|
|
62
|
-
o({
|
|
63
|
-
...t,
|
|
64
|
-
red: s(a.target.value)
|
|
65
|
-
});
|
|
66
|
-
},
|
|
67
|
-
"aria-label": i("ColorPicker_redChannel"),
|
|
68
|
-
children: /* @__PURE__ */ e(r.Slot, { name: "left", children: /* @__PURE__ */ e("span", { className: l.inputDecorator, children: "R" }) })
|
|
69
|
-
}
|
|
70
|
-
),
|
|
71
|
-
/* @__PURE__ */ e(
|
|
72
|
-
r.Root,
|
|
73
|
-
{
|
|
74
|
-
"data-test-id": "color-picker-value-input-green",
|
|
75
|
-
className: l.valueInput,
|
|
76
|
-
value: t.green,
|
|
77
|
-
type: "number",
|
|
78
|
-
onChange: (a) => {
|
|
79
|
-
o({
|
|
80
|
-
...t,
|
|
81
|
-
green: s(a.target.value)
|
|
82
|
-
});
|
|
83
|
-
},
|
|
84
|
-
"aria-label": i("ColorPicker_greenChannel"),
|
|
85
|
-
children: /* @__PURE__ */ e(r.Slot, { name: "left", children: /* @__PURE__ */ e("span", { className: l.inputDecorator, children: "G" }) })
|
|
86
|
-
}
|
|
87
|
-
),
|
|
88
|
-
/* @__PURE__ */ e(
|
|
89
|
-
r.Root,
|
|
90
|
-
{
|
|
91
|
-
"data-test-id": "color-picker-value-input-blue",
|
|
92
|
-
className: l.valueInput,
|
|
93
|
-
value: t.blue,
|
|
94
|
-
type: "number",
|
|
95
|
-
onChange: (a) => {
|
|
96
|
-
o({
|
|
97
|
-
...t,
|
|
98
|
-
blue: s(a.target.value)
|
|
99
|
-
});
|
|
100
|
-
},
|
|
101
|
-
"aria-label": i("ColorPicker_blueChannel"),
|
|
102
|
-
children: /* @__PURE__ */ e(r.Slot, { name: "left", children: /* @__PURE__ */ e("span", { className: l.inputDecorator, children: "B" }) })
|
|
103
|
-
}
|
|
104
|
-
)
|
|
105
|
-
] }),
|
|
106
|
-
/* @__PURE__ */ e("div", { className: l.colorAlphaInput, children: /* @__PURE__ */ n(
|
|
107
|
-
r.Root,
|
|
108
|
-
{
|
|
109
|
-
"data-test-id": "color-picker-value-input-alpha",
|
|
110
|
-
className: l.valueInput,
|
|
111
|
-
value: t.alpha === void 0 ? 100 : Math.trunc(t.alpha * 100).toString(),
|
|
112
|
-
type: "number",
|
|
113
|
-
onChange: (a) => {
|
|
114
|
-
o({
|
|
115
|
-
...t,
|
|
116
|
-
alpha: s(a.target.value, 0, 100) / 100
|
|
117
|
-
});
|
|
118
|
-
},
|
|
119
|
-
"aria-label": i("ColorPicker_opacity"),
|
|
120
|
-
children: [
|
|
121
|
-
/* @__PURE__ */ e(r.Slot, { name: "left", children: /* @__PURE__ */ e("span", { className: l.inputDecorator, children: "A" }) }),
|
|
122
|
-
/* @__PURE__ */ e(r.Slot, { name: "right", children: /* @__PURE__ */ e("span", { className: l.inputDecorator, children: "%" }) })
|
|
123
|
-
]
|
|
124
|
-
}
|
|
125
|
-
) })
|
|
126
|
-
] });
|
|
127
|
-
};
|
|
128
|
-
f.displayName = "ColorPicker.Values";
|
|
129
|
-
const F = I(f);
|
|
1
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as m } from "react";
|
|
3
|
+
import { RgbaColorPicker as n } from "react-colorful";
|
|
4
|
+
import t from "./fondue-components50.js";
|
|
5
|
+
import { DEFAULT_COLOR as s } from "./fondue-components51.js";
|
|
6
|
+
const i = ({
|
|
7
|
+
currentColor: a = s,
|
|
8
|
+
onColorChange: d = () => {
|
|
9
|
+
},
|
|
10
|
+
"data-test-id": o = "color-picker-input"
|
|
11
|
+
}, p) => /* @__PURE__ */ r("div", { className: t.gradientInput, "data-test-id": o, ref: p, children: /* @__PURE__ */ r(
|
|
12
|
+
n,
|
|
13
|
+
{
|
|
14
|
+
className: t.reactColorful,
|
|
15
|
+
color: {
|
|
16
|
+
r: a.red,
|
|
17
|
+
g: a.green,
|
|
18
|
+
b: a.blue,
|
|
19
|
+
a: a.alpha === void 0 ? 1 : a.alpha
|
|
20
|
+
},
|
|
21
|
+
onChange: (e) => d({
|
|
22
|
+
red: e.r,
|
|
23
|
+
green: e.g,
|
|
24
|
+
blue: e.b,
|
|
25
|
+
alpha: e.a
|
|
26
|
+
})
|
|
27
|
+
}
|
|
28
|
+
) });
|
|
29
|
+
i.displayName = "ColorPicker.Gradient";
|
|
30
|
+
const c = m(i);
|
|
130
31
|
export {
|
|
131
|
-
|
|
132
|
-
|
|
32
|
+
i as ColorGradientInput,
|
|
33
|
+
c as ForwardedRefColorGradientInput
|
|
133
34
|
};
|
|
134
35
|
//# sourceMappingURL=fondue-components47.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fondue-components47.js","sources":["../src/components/ColorPicker/ColorValueInput.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type ForwardedRef, forwardRef, useEffect, useState } from 'react';\n\nimport { useTranslation } from '#/hooks/useTranslation';\n\nimport { Select } from '../Select/Select';\nimport { TextInput } from '../TextInput/TextInput';\n\nimport styles from './styles/customColorPicker.module.scss';\nimport { type RgbaColor } from './types';\nimport {\n DEFAULT_COLOR,\n DEFAULT_FORMAT,\n getLimitedColorChannelValue,\n hexColorToRgba,\n isValidHexColor,\n rgbColorToHex,\n} from './utils';\n\ntype ColorFormat = 'HEX' | 'RGBA';\n\ntype ColorValueInputProps = {\n /**\n * @ignore\n * The active color in the color picker, passed down from the root component\n */\n currentColor?: RgbaColor;\n /**\n * @ignore\n * Event handler called when the color changes, passed down from the root component\n */\n onColorChange?: (color: RgbaColor) => void;\n /**\n * @ignore\n * The format to use for the color input, passed down from the root component\n */\n currentFormat?: ColorFormat;\n /**\n * @ignore\n * The format to use for the color input, passed down from the root component\n */\n setCurrentFormat?: (format: ColorFormat) => void;\n /**\n * The test id of the color picker value input\n */\n 'data-test-id'?: string;\n};\n\nconst nooperation = () => {};\n\nexport const ColorValueInput = (\n {\n currentColor = DEFAULT_COLOR,\n onColorChange = nooperation,\n currentFormat = DEFAULT_FORMAT,\n setCurrentFormat = nooperation,\n 'data-test-id': dataTestId = 'color-picker-value-input',\n }: ColorValueInputProps,\n forwardedRef: ForwardedRef<HTMLDivElement>,\n) => {\n const { t } = useTranslation();\n const [hexColorValue, setHexColorValue] = useState<string>(() => rgbColorToHex(currentColor));\n\n useEffect(() => {\n setHexColorValue(rgbColorToHex(currentColor));\n }, [currentColor]);\n\n return (\n <div className={styles.inputs} data-test-id={dataTestId} ref={forwardedRef}>\n <div className={styles.colorFormatInput}>\n <Select\n data-test-id=\"color-picker-select-format\"\n aria-label={t('ColorPicker_selectFormat')}\n onSelect={(selectedValue) => {\n setCurrentFormat(selectedValue as ColorFormat);\n }}\n value={currentFormat}\n >\n <Select.Item value=\"HEX\">HEX</Select.Item>\n <Select.Item value=\"RGBA\">RGBA</Select.Item>\n </Select>\n </div>\n {currentFormat === 'HEX' ? (\n <TextInput.Root\n data-test-id=\"color-picker-value-input-hex\"\n className={styles.valueInput}\n type=\"text\"\n value={hexColorValue}\n status={isValidHexColor(hexColorValue) ? 'neutral' : 'error'}\n onBlur={(event) => {\n if (isValidHexColor(event.target.value)) {\n onColorChange({ ...hexColorToRgba(event.target.value), alpha: currentColor.alpha });\n }\n }}\n onChange={(event) => {\n const inputValue = event.target.value.startsWith('#')\n ? event.target.value.slice(1)\n : event.target.value;\n\n setHexColorValue(inputValue);\n }}\n aria-label={t('ColorPicker_hexValue')}\n >\n <TextInput.Slot name=\"left\">\n <span className={styles.inputDecorator}>#</span>\n </TextInput.Slot>\n </TextInput.Root>\n ) : (\n <div className={styles.colorChannelInputGroup}>\n <TextInput.Root\n data-test-id=\"color-picker-value-input-red\"\n className={styles.valueInput}\n value={currentColor.red}\n type=\"number\"\n onChange={(event) => {\n onColorChange({\n ...currentColor,\n red: getLimitedColorChannelValue(event.target.value),\n });\n }}\n aria-label={t('ColorPicker_redChannel')}\n >\n <TextInput.Slot name=\"left\">\n <span className={styles.inputDecorator}>R</span>\n </TextInput.Slot>\n </TextInput.Root>\n <TextInput.Root\n data-test-id=\"color-picker-value-input-green\"\n className={styles.valueInput}\n value={currentColor.green}\n type=\"number\"\n onChange={(event) => {\n onColorChange({\n ...currentColor,\n green: getLimitedColorChannelValue(event.target.value),\n });\n }}\n aria-label={t('ColorPicker_greenChannel')}\n >\n <TextInput.Slot name=\"left\">\n <span className={styles.inputDecorator}>G</span>\n </TextInput.Slot>\n </TextInput.Root>\n <TextInput.Root\n data-test-id=\"color-picker-value-input-blue\"\n className={styles.valueInput}\n value={currentColor.blue}\n type=\"number\"\n onChange={(event) => {\n onColorChange({\n ...currentColor,\n blue: getLimitedColorChannelValue(event.target.value),\n });\n }}\n aria-label={t('ColorPicker_blueChannel')}\n >\n <TextInput.Slot name=\"left\">\n <span className={styles.inputDecorator}>B</span>\n </TextInput.Slot>\n </TextInput.Root>\n </div>\n )}\n <div className={styles.colorAlphaInput}>\n <TextInput.Root\n data-test-id=\"color-picker-value-input-alpha\"\n className={styles.valueInput}\n /* .toString() is a workaround for https://github.com/facebook/react/issues/9402 */\n value={currentColor.alpha === undefined ? 100 : Math.trunc(currentColor.alpha * 100).toString()}\n type=\"number\"\n onChange={(event) => {\n onColorChange({\n ...currentColor,\n alpha: getLimitedColorChannelValue(event.target.value, 0, 100) / 100,\n });\n }}\n aria-label={t('ColorPicker_opacity')}\n >\n <TextInput.Slot name=\"left\">\n <span className={styles.inputDecorator}>A</span>\n </TextInput.Slot>\n <TextInput.Slot name=\"right\">\n <span className={styles.inputDecorator}>%</span>\n </TextInput.Slot>\n </TextInput.Root>\n </div>\n </div>\n );\n};\nColorValueInput.displayName = 'ColorPicker.Values';\n\nexport const ForwardedRefColorValueInput = forwardRef<HTMLDivElement, ColorValueInputProps>(ColorValueInput);\n"],"names":["nooperation","ColorValueInput","currentColor","DEFAULT_COLOR","onColorChange","currentFormat","DEFAULT_FORMAT","setCurrentFormat","dataTestId","forwardedRef","t","useTranslation","hexColorValue","setHexColorValue","useState","rgbColorToHex","useEffect","jsxs","styles","jsx","Select","selectedValue","TextInput","isValidHexColor","event","hexColorToRgba","inputValue","getLimitedColorChannelValue","ForwardedRefColorValueInput","forwardRef"],"mappings":";;;;;;;AAiDA,MAAMA,IAAc,MAAM;AAAC,GAEdC,IAAkB,CAC3B;AAAA,EACI,cAAAC,IAAeC;A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AO,gBAAgB,UAAA,IAAA,CAAC,GAC7C;AAAA,UACA,gBAAAC,EAACG,EAAU,MAAV,EAAe,MAAK,SACjB,UAAA,gBAAAH,EAAC,QAAA,EAAK,WAAWD,EAAO,gBAAgB,UAAA,IAAA,CAAC,EAAA,CAC7C;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA,EACJ,CACJ;AAAA,EAAA,GACJ;AAER;AACAjB,EAAgB,cAAc;AAEvB,MAAM2B,IAA8BC,EAAiD5B,CAAe;"}
|
|
1
|
+
{"version":3,"file":"fondue-components47.js","sources":["../src/components/ColorPicker/ColorGradientInput.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type ForwardedRef, forwardRef } from 'react';\nimport { RgbaColorPicker } from 'react-colorful';\n\nimport styles from './styles/customColorPicker.module.scss';\nimport { type RgbaColor } from './types';\nimport { DEFAULT_COLOR } from './utils';\n\ntype ColorGradientInputProps = {\n /**\n * @ignore\n * The active color in the color picker, passed down from the root component\n */\n currentColor?: RgbaColor;\n /**\n * @ignore\n * Event handler called when the color changes, passed down from the root component\n */\n onColorChange?: (color: RgbaColor) => void;\n /**\n * The test id of the color picker gradient input\n */\n 'data-test-id'?: string;\n};\n\nexport const ColorGradientInput = (\n {\n currentColor = DEFAULT_COLOR,\n onColorChange = () => {},\n 'data-test-id': dataTestId = 'color-picker-input',\n }: ColorGradientInputProps,\n forwardedRef: ForwardedRef<HTMLDivElement>,\n) => {\n return (\n <div className={styles.gradientInput} data-test-id={dataTestId} ref={forwardedRef}>\n <RgbaColorPicker\n className={styles.reactColorful}\n color={{\n r: currentColor.red,\n g: currentColor.green,\n b: currentColor.blue,\n a: currentColor.alpha === undefined ? 1 : currentColor.alpha,\n }}\n onChange={(color) =>\n onColorChange({\n red: color.r,\n green: color.g,\n blue: color.b,\n alpha: color.a,\n })\n }\n />\n </div>\n );\n};\nColorGradientInput.displayName = 'ColorPicker.Gradient';\n\nexport const ForwardedRefColorGradientInput = forwardRef<HTMLDivElement, ColorGradientInputProps>(ColorGradientInput);\n"],"names":["ColorGradientInput","currentColor","DEFAULT_COLOR","onColorChange","dataTestId","forwardedRef","jsx","styles","RgbaColorPicker","color","ForwardedRefColorGradientInput","forwardRef"],"mappings":";;;;;AA0BO,MAAMA,IAAqB,CAC9B;AAAA,EACI,cAAAC,IAAeC;AAAA,EACf,eAAAC,IAAgB,MAAM;AAAA,EAAC;AAAA,EACvB,gBAAgBC,IAAa;AACjC,GACAC,MAGI,gBAAAC,EAAC,SAAI,WAAWC,EAAO,eAAe,gBAAcH,GAAY,KAAKC,GACjE,UAAA,gBAAAC;AAAA,EAACE;AAAA,EAAA;AAAA,IACG,WAAWD,EAAO;AAAA,IAClB,OAAO;AAAA,MACH,GAAGN,EAAa;AAAA,MAChB,GAAGA,EAAa;AAAA,MAChB,GAAGA,EAAa;AAAA,MAChB,GAAGA,EAAa,UAAU,SAAY,IAAIA,EAAa;AAAA,IAAA;AAAA,IAE3D,UAAU,CAACQ,MACPN,EAAc;AAAA,MACV,KAAKM,EAAM;AAAA,MACX,OAAOA,EAAM;AAAA,MACb,MAAMA,EAAM;AAAA,MACZ,OAAOA,EAAM;AAAA,IAAA,CAChB;AAAA,EAAA;AAAA,GAGb;AAGRT,EAAmB,cAAc;AAE1B,MAAMU,IAAiCC,EAAoDX,CAAkB;"}
|
|
@@ -1,24 +1,57 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
import { jsxs as t, jsx as s, Fragment as h } from "react/jsx-runtime";
|
|
2
|
+
import { IconDroplet as I, IconCross as k, IconCaretDown as v } from "@frontify/fondue-icons";
|
|
3
|
+
import { forwardRef as P } from "react";
|
|
4
|
+
import { useTranslation as w } from "./fondue-components37.js";
|
|
5
|
+
import { Button as y } from "./fondue-components6.js";
|
|
6
|
+
import a from "./fondue-components97.js";
|
|
7
|
+
import { getColorWithName as z, colorToCss as x } from "./fondue-components51.js";
|
|
8
|
+
const c = ({
|
|
9
|
+
id: m,
|
|
10
|
+
currentColor: e,
|
|
11
|
+
isOpen: l,
|
|
12
|
+
disabled: o = !1,
|
|
13
|
+
onClear: i,
|
|
14
|
+
onClick: r,
|
|
15
|
+
"data-test-id": d = "color-picker-input",
|
|
16
|
+
...n
|
|
17
|
+
}, p) => {
|
|
18
|
+
const { t: f } = w(), N = (e == null ? void 0 : e.name) ?? (e ? z(e, "RGBA").name : "");
|
|
19
|
+
return /* @__PURE__ */ t("div", { id: m, className: a.root, ref: p, "data-test-id": d, children: [
|
|
20
|
+
/* @__PURE__ */ t(
|
|
21
|
+
"button",
|
|
22
|
+
{
|
|
23
|
+
className: a.button,
|
|
24
|
+
...n,
|
|
25
|
+
disabled: o,
|
|
26
|
+
onClick: r,
|
|
27
|
+
type: "button",
|
|
28
|
+
"data-color-input-select": !0,
|
|
29
|
+
children: [
|
|
30
|
+
(e == null ? void 0 : e.red) !== void 0 ? /* @__PURE__ */ s(
|
|
31
|
+
"div",
|
|
32
|
+
{
|
|
33
|
+
"aria-hidden": !0,
|
|
34
|
+
className: a.colorIndicator,
|
|
35
|
+
style: { "--active-color": x(e) }
|
|
36
|
+
}
|
|
37
|
+
) : /* @__PURE__ */ t(h, { children: [
|
|
38
|
+
/* @__PURE__ */ s(I, { size: 16 }),
|
|
39
|
+
/* @__PURE__ */ s("span", { children: f("ColorPicker_selectColor") })
|
|
40
|
+
] }),
|
|
41
|
+
/* @__PURE__ */ s("span", { className: a.colorName, children: N })
|
|
42
|
+
]
|
|
43
|
+
}
|
|
44
|
+
),
|
|
45
|
+
/* @__PURE__ */ t("div", { className: a.actions, children: [
|
|
46
|
+
i && /* @__PURE__ */ s(y, { onPress: i, disabled: o, size: "small", emphasis: "weak", aspect: "square", children: /* @__PURE__ */ s(k, { className: a.clearIcon, size: 16 }) }),
|
|
47
|
+
/* @__PURE__ */ s("div", { className: a.caret, "data-state": l ? "open" : "closed", children: /* @__PURE__ */ s(v, { size: 16, className: a.caret }) })
|
|
48
|
+
] })
|
|
49
|
+
] });
|
|
11
50
|
};
|
|
51
|
+
c.displayName = "ColorPicker.Input";
|
|
52
|
+
const F = P(c);
|
|
12
53
|
export {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
t as colorFormatInput,
|
|
16
|
-
a as default,
|
|
17
|
-
_ as gradientInput,
|
|
18
|
-
p as inputDecorator,
|
|
19
|
-
n as inputs,
|
|
20
|
-
l as reactColorful,
|
|
21
|
-
o as root,
|
|
22
|
-
c as valueInput
|
|
54
|
+
c as ColorPickerInput,
|
|
55
|
+
F as ForwardedRefColorPickerInput
|
|
23
56
|
};
|
|
24
57
|
//# sourceMappingURL=fondue-components48.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fondue-components48.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"fondue-components48.js","sources":["../src/components/ColorPicker/ColorPickerInput.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { IconCaretDown, IconCross, IconDroplet } from '@frontify/fondue-icons';\nimport { type CSSProperties, type ForwardedRef, forwardRef } from 'react';\n\nimport { useTranslation } from '#/hooks/useTranslation';\nimport { type CommonAriaAttrs } from '#/utilities/types';\n\nimport { Button } from '../Button/Button';\n\nimport styles from './styles/colorInput.module.scss';\nimport { type RgbaColor } from './types';\nimport { colorToCss, getColorWithName } from './utils';\n\ntype ColorPickerInputProps = {\n id?: string;\n /**\n * The active color in the color picker\n */\n currentColor?: RgbaColor;\n /**\n * The open state of the color picker used to determine arrow state\n */\n isOpen?: boolean;\n /**\n * Whether the color picker input is disabled\n */\n disabled?: boolean;\n /**\n * callback for clearing the color\n */\n onClear?: () => void;\n /**\n * Event handler called when the color picker input is clicked\n */\n onClick?: () => void;\n /**\n * The test id of the color picker input\n */\n 'data-test-id'?: string;\n} & CommonAriaAttrs;\n\nexport const ColorPickerInput = (\n {\n id,\n currentColor,\n isOpen,\n disabled = false,\n onClear,\n onClick,\n 'data-test-id': dataTestId = 'color-picker-input',\n ...props\n }: ColorPickerInputProps,\n forwardedRef: ForwardedRef<HTMLDivElement>,\n) => {\n const { t } = useTranslation();\n const colorName = currentColor?.name ?? (currentColor ? getColorWithName(currentColor, 'RGBA').name : '');\n return (\n <div id={id} className={styles.root} ref={forwardedRef} data-test-id={dataTestId}>\n <button\n className={styles.button}\n {...props}\n disabled={disabled}\n onClick={onClick}\n type=\"button\"\n data-color-input-select\n >\n {currentColor?.red !== undefined ? (\n <div\n aria-hidden\n className={styles.colorIndicator}\n style={{ '--active-color': colorToCss(currentColor) } as CSSProperties}\n />\n ) : (\n <>\n <IconDroplet size={16} />\n <span>{t('ColorPicker_selectColor')}</span>\n </>\n )}\n\n <span className={styles.colorName}>{colorName}</span>\n </button>\n <div className={styles.actions}>\n {onClear && (\n <Button onPress={onClear} disabled={disabled} size=\"small\" emphasis=\"weak\" aspect=\"square\">\n <IconCross className={styles.clearIcon} size={16} />\n </Button>\n )}\n <div className={styles.caret} data-state={isOpen ? 'open' : 'closed'}>\n <IconCaretDown size={16} className={styles.caret} />\n </div>\n </div>\n </div>\n );\n};\nColorPickerInput.displayName = 'ColorPicker.Input';\n\nexport const ForwardedRefColorPickerInput = forwardRef<HTMLDivElement, ColorPickerInputProps>(ColorPickerInput);\n"],"names":["ColorPickerInput","id","currentColor","isOpen","disabled","onClear","onClick","dataTestId","props","forwardedRef","t","useTranslation","colorName","getColorWithName","jsxs","styles","jsx","colorToCss","Fragment","IconDroplet","Button","IconCross","IconCaretDown","ForwardedRefColorPickerInput","forwardRef"],"mappings":";;;;;;;AA0CO,MAAMA,IAAmB,CAC5B;AAAA,EACI,IAAAC;AAAA,EACA,cAAAC;AAAA,EACA,QAAAC;AAAA,EACA,UAAAC,IAAW;AAAA,EACX,SAAAC;AAAA,EACA,SAAAC;AAAA,EACA,gBAAgBC,IAAa;AAA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BAAAa,EAACM,KAAc,MAAM,IAAI,WAAWP,EAAO,OAAO,EAAA,CACtD;AAAA,IAAA,EAAA,CACJ;AAAA,EAAA,GACJ;AAER;AACAf,EAAiB,cAAc;AAExB,MAAMuB,IAA+BC,EAAkDxB,CAAgB;"}
|
|
@@ -1,56 +1,134 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const t =
|
|
17
|
-
return
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
1
|
+
import { jsxs as n, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as I, useState as R, useEffect as x } from "react";
|
|
3
|
+
import { useTranslation as S } from "./fondue-components37.js";
|
|
4
|
+
import { Select as c } from "./fondue-components24.js";
|
|
5
|
+
import { TextInput as r } from "./fondue-components32.js";
|
|
6
|
+
import l from "./fondue-components50.js";
|
|
7
|
+
import { rgbColorToHex as m, DEFAULT_COLOR as V, DEFAULT_FORMAT as y, isValidHexColor as h, hexColorToRgba as D, getLimitedColorChannelValue as s } from "./fondue-components51.js";
|
|
8
|
+
const v = () => {
|
|
9
|
+
}, f = ({
|
|
10
|
+
currentColor: t = V,
|
|
11
|
+
onColorChange: o = v,
|
|
12
|
+
currentFormat: u = y,
|
|
13
|
+
setCurrentFormat: g = v,
|
|
14
|
+
"data-test-id": b = "color-picker-value-input"
|
|
15
|
+
}, N) => {
|
|
16
|
+
const { t: i } = S(), [p, d] = R(() => m(t));
|
|
17
|
+
return x(() => {
|
|
18
|
+
d(m(t));
|
|
19
|
+
}, [t]), /* @__PURE__ */ n("div", { className: l.inputs, "data-test-id": b, ref: N, children: [
|
|
20
|
+
/* @__PURE__ */ e("div", { className: l.colorFormatInput, children: /* @__PURE__ */ n(
|
|
21
|
+
c,
|
|
22
|
+
{
|
|
23
|
+
"data-test-id": "color-picker-select-format",
|
|
24
|
+
"aria-label": i("ColorPicker_selectFormat"),
|
|
25
|
+
onSelect: (a) => {
|
|
26
|
+
g(a);
|
|
27
|
+
},
|
|
28
|
+
value: u,
|
|
29
|
+
children: [
|
|
30
|
+
/* @__PURE__ */ e(c.Item, { value: "HEX", children: "HEX" }),
|
|
31
|
+
/* @__PURE__ */ e(c.Item, { value: "RGBA", children: "RGBA" })
|
|
32
|
+
]
|
|
33
|
+
}
|
|
34
|
+
) }),
|
|
35
|
+
u === "HEX" ? /* @__PURE__ */ e(
|
|
36
|
+
r.Root,
|
|
37
|
+
{
|
|
38
|
+
"data-test-id": "color-picker-value-input-hex",
|
|
39
|
+
className: l.valueInput,
|
|
40
|
+
type: "text",
|
|
41
|
+
value: p,
|
|
42
|
+
status: h(p) ? "neutral" : "error",
|
|
43
|
+
onBlur: (a) => {
|
|
44
|
+
h(a.target.value) && o({ ...D(a.target.value), alpha: t.alpha });
|
|
45
|
+
},
|
|
46
|
+
onChange: (a) => {
|
|
47
|
+
const k = a.target.value.startsWith("#") ? a.target.value.slice(1) : a.target.value;
|
|
48
|
+
d(k);
|
|
49
|
+
},
|
|
50
|
+
"aria-label": i("ColorPicker_hexValue"),
|
|
51
|
+
children: /* @__PURE__ */ e(r.Slot, { name: "left", children: /* @__PURE__ */ e("span", { className: l.inputDecorator, children: "#" }) })
|
|
52
|
+
}
|
|
53
|
+
) : /* @__PURE__ */ n("div", { className: l.colorChannelInputGroup, children: [
|
|
54
|
+
/* @__PURE__ */ e(
|
|
55
|
+
r.Root,
|
|
56
|
+
{
|
|
57
|
+
"data-test-id": "color-picker-value-input-red",
|
|
58
|
+
className: l.valueInput,
|
|
59
|
+
value: t.red,
|
|
60
|
+
type: "number",
|
|
61
|
+
onChange: (a) => {
|
|
62
|
+
o({
|
|
63
|
+
...t,
|
|
64
|
+
red: s(a.target.value)
|
|
65
|
+
});
|
|
66
|
+
},
|
|
67
|
+
"aria-label": i("ColorPicker_redChannel"),
|
|
68
|
+
children: /* @__PURE__ */ e(r.Slot, { name: "left", children: /* @__PURE__ */ e("span", { className: l.inputDecorator, children: "R" }) })
|
|
69
|
+
}
|
|
70
|
+
),
|
|
71
|
+
/* @__PURE__ */ e(
|
|
72
|
+
r.Root,
|
|
73
|
+
{
|
|
74
|
+
"data-test-id": "color-picker-value-input-green",
|
|
75
|
+
className: l.valueInput,
|
|
76
|
+
value: t.green,
|
|
77
|
+
type: "number",
|
|
78
|
+
onChange: (a) => {
|
|
79
|
+
o({
|
|
80
|
+
...t,
|
|
81
|
+
green: s(a.target.value)
|
|
82
|
+
});
|
|
83
|
+
},
|
|
84
|
+
"aria-label": i("ColorPicker_greenChannel"),
|
|
85
|
+
children: /* @__PURE__ */ e(r.Slot, { name: "left", children: /* @__PURE__ */ e("span", { className: l.inputDecorator, children: "G" }) })
|
|
86
|
+
}
|
|
87
|
+
),
|
|
88
|
+
/* @__PURE__ */ e(
|
|
89
|
+
r.Root,
|
|
90
|
+
{
|
|
91
|
+
"data-test-id": "color-picker-value-input-blue",
|
|
92
|
+
className: l.valueInput,
|
|
93
|
+
value: t.blue,
|
|
94
|
+
type: "number",
|
|
95
|
+
onChange: (a) => {
|
|
96
|
+
o({
|
|
97
|
+
...t,
|
|
98
|
+
blue: s(a.target.value)
|
|
99
|
+
});
|
|
100
|
+
},
|
|
101
|
+
"aria-label": i("ColorPicker_blueChannel"),
|
|
102
|
+
children: /* @__PURE__ */ e(r.Slot, { name: "left", children: /* @__PURE__ */ e("span", { className: l.inputDecorator, children: "B" }) })
|
|
103
|
+
}
|
|
104
|
+
)
|
|
105
|
+
] }),
|
|
106
|
+
/* @__PURE__ */ e("div", { className: l.colorAlphaInput, children: /* @__PURE__ */ n(
|
|
107
|
+
r.Root,
|
|
108
|
+
{
|
|
109
|
+
"data-test-id": "color-picker-value-input-alpha",
|
|
110
|
+
className: l.valueInput,
|
|
111
|
+
value: t.alpha === void 0 ? 100 : Math.trunc(t.alpha * 100).toString(),
|
|
112
|
+
type: "number",
|
|
113
|
+
onChange: (a) => {
|
|
114
|
+
o({
|
|
115
|
+
...t,
|
|
116
|
+
alpha: s(a.target.value, 0, 100) / 100
|
|
117
|
+
});
|
|
118
|
+
},
|
|
119
|
+
"aria-label": i("ColorPicker_opacity"),
|
|
120
|
+
children: [
|
|
121
|
+
/* @__PURE__ */ e(r.Slot, { name: "left", children: /* @__PURE__ */ e("span", { className: l.inputDecorator, children: "A" }) }),
|
|
122
|
+
/* @__PURE__ */ e(r.Slot, { name: "right", children: /* @__PURE__ */ e("span", { className: l.inputDecorator, children: "%" }) })
|
|
123
|
+
]
|
|
124
|
+
}
|
|
125
|
+
) })
|
|
126
|
+
] });
|
|
127
|
+
};
|
|
128
|
+
f.displayName = "ColorPicker.Values";
|
|
129
|
+
const F = I(f);
|
|
45
130
|
export {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
h as colorToCss,
|
|
49
|
-
l as getColorWithName,
|
|
50
|
-
s as getHexDisplayName,
|
|
51
|
-
i as getLimitedColorChannelValue,
|
|
52
|
-
u as hexColorToRgba,
|
|
53
|
-
$ as isValidHexColor,
|
|
54
|
-
a as rgbColorToHex
|
|
131
|
+
f as ColorValueInput,
|
|
132
|
+
F as ForwardedRefColorValueInput
|
|
55
133
|
};
|
|
56
134
|
//# sourceMappingURL=fondue-components49.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fondue-components49.js","sources":["../src/components/ColorPicker/utils.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type ColorFormat, type RgbaColor } from './types';\n\nexport const DEFAULT_COLOR = { red: 255, green: 255, blue: 255, alpha: 1, name: '' };\nexport const DEFAULT_FORMAT = 'HEX';\n\n/**\n * Converts a color object to a CSS color string.\n * @param {RgbaColor} color - The color object to be converted.\n * @returns {string}\n * @example\n * colorToCss({ red: 255, green: 255, blue: 255, alpha: 1 }); // 'rgba(255, 255, 255, 1)'\n * @example\n * colorToCss({ red: 255, green: 87, blue: 51, alpha: 1 }); // 'rgba(255, 87, 51, 1)'\n * @example\n * colorToCss({ red: 0, green: 0, blue: 0, alpha: 0 }); // 'rgba(0, 0, 0, 0)'\n */\nexport const colorToCss = (color?: RgbaColor) => {\n if (!color) {\n return undefined;\n }\n return `rgba(${color.red}, ${color.green}, ${color.blue}, ${color.alpha ?? 1})`;\n};\n\n/**\n * Checks if a string is a valid hexadecimal color code. This function accepts\n * both three-digit and six-digit hex codes without the '#' symbol.\n * @param {string} color - The color code to be checked.\n * @returns {boolean}\n * @example\n * isValidHexColor('FFF'); // true\n * @example\n * isValidHexColor('FF5733'); // true\n * @example\n * isValidHexColor('XYZ'); // false\n */\nexport const isValidHexColor = (color: string): boolean => {\n const hexRegex = /^([\\dA-Fa-f]{3}){1,2}$/;\n return color.length > 2 && hexRegex.test(color);\n};\n\n/**\n * Converts a hexadecimal color code to an RGBA color object. This function accepts\n * both three-digit and six-digit hex codes without the '#' symbol.\n * @param {string} hex - The hex code, either 3 or 6 characters long. Characters should be from the set [0-9A-Fa-f].\n * @returns {RgbaColor}\n * @example\n * hexColorToRgba('FFF'); // { red: 255, green: 255, blue: 255, alpha: 1 }\n * @example\n * hexColorToRgba('FF5733'); // { red: 255, green: 87, blue: 51, alpha: 1 }\n * @example\n * hexColorToRgba('XYZ'); // { red: 0, green: 0, blue: 0, alpha: 0 }\n */\nexport const hexColorToRgba = (hex: string): RgbaColor => {\n const hexRegex = /^([\\dA-Fa-f]{3}){1,2}$/;\n const matches = hex.match(hexRegex);\n if (!matches) {\n return {\n red: 0,\n green: 0,\n blue: 0,\n alpha: 0,\n };\n }\n const hexColor = matches[0];\n if (hexColor.length === 3) {\n return {\n red: parseInt(`${hexColor[0]}${hexColor[0]}`, 16),\n green: parseInt(`${hexColor[1]}${hexColor[1]}`, 16),\n blue: parseInt(`${hexColor[2]}${hexColor[2]}`, 16),\n alpha: 1,\n };\n }\n return {\n red: parseInt(hexColor.slice(0, 2), 16),\n green: parseInt(hexColor.slice(2, 4), 16),\n blue: parseInt(hexColor.slice(4, 6), 16),\n alpha: 1,\n };\n};\n\n/**\n * Converts an RGBA color object to a hexadecimal color code. This function returns a\n * six-digit hex code without the '#' symbol.\n * @param {RgbaColor} rgb - The RGBA color object.\n * @returns {string}\n * @example\n * rgbColorToHex({ red: 255, green: 255, blue: 255, alpha: 1 }); // '#FFFFFF'\n * @example\n * rgbColorToHex({ red: 255, green: 87, blue: 51, alpha: 1 }); // '#FF5733'\n * @example\n * rgbColorToHex({ red: 0, green: 0, blue: 0, alpha: 0 }); // '#000000'\n */\nexport const rgbColorToHex = (rgb: Omit<RgbaColor, 'alpha'>): string => {\n const { red, green, blue } = rgb;\n return `${red.toString(16).padStart(2, '0')}${green.toString(16).padStart(2, '0')}${blue.toString(16).padStart(2, '0')}`;\n};\n\n/**\n * Returns a hex color display name with alpha percentage if alpha < 100%.\n * @param {RgbaColor} color - The RGBA color object.\n * @returns {string}\n * @example\n * getHexDisplayName({ red: 255, green: 255, blue: 255, alpha: 1 }); // '#FFFFFF'\n * @example\n * getHexDisplayName({ red: 255, green: 255, blue: 255, alpha: 0.9 }); // '#FFFFFF 90%'\n * @example\n * getHexDisplayName({ red: 255, green: 87, blue: 51, alpha: 0.84 }); // '#FF5733 84%'\n */\nexport const getHexDisplayName = (color: RgbaColor): string => {\n const hexValue = rgbColorToHex(color);\n const alpha = color.alpha ?? 1;\n\n if (alpha < 1) {\n const alphaPercentage = Math.round(alpha * 100);\n return `#${hexValue} ${alphaPercentage}%`;\n }\n\n return `#${hexValue}`;\n};\n\n/**\n * Returns a color object with a name property based on the provided color and format.\n * @param {RgbaColor} color - The RGBA color object.\n * @param {ColorFormat} currentFormat - The current format of the color.\n * @returns {RgbaColor}\n * @example\n * getColorWithName({ red: 255, green: 255, blue: 255, alpha: 1 }, 'HEX'); // { red: 255, green: 255, blue: 255, alpha: 1, name: '#FFFFFF' }\n * @example\n * getColorWithName({ red: 255, green: 255, blue: 255, alpha: 0.9 }, 'HEX'); // { red: 255, green: 255, blue: 255, alpha: 0.9, name: '#FFFFFF 90%' }\n * @example\n * getColorWithName({ red: 255, green: 255, blue: 255, alpha: 1 }, 'RGBA'); // { red: 255, green: 255, blue: 255, alpha: 1, name: 'rgba(255, 255, 255, 1)' }\n * @example\n * getColorWithName({ red: 255, green: 87, blue: 51, alpha: 1 }, 'RGBA'); // { red: 255, green: 87, blue: 51, alpha: 1, name: 'rgba(255, 87, 51, 1)' }\n */\nexport const getColorWithName = (color: RgbaColor, currentFormat: ColorFormat) => {\n if (currentFormat === 'HEX') {\n return {\n ...color,\n name: getHexDisplayName(color),\n };\n }\n return {\n ...color,\n name: `rgba(${color.red}, ${color.green}, ${color.blue}, ${color.alpha ?? 1})`,\n };\n};\n\n/**\n * Returns a number between a minimum and maximum value, inclusive.\n * @param {string} value - The value to be limited.\n * @param {number} [min=0] - The minimum value (inclusive).\n * @param {number} [max=255] - The maximum value (inclusive).\n * @returns {number}\n * @example\n * getLimitedColorChannelValue('255'); // 255\n * @example\n * getLimitedColorChannelValue('100'); // 100\n * @example\n * getLimitedColorChannelValue('0'); // 0\n * @example\n * getLimitedColorChannelValue('500'); // 255\n * @example\n * getLimitedColorChannelValue('500', 0, 100); // 100\n */\nexport const getLimitedColorChannelValue = (value: string, min: number = 0, max: number = 255): number => {\n if (value.length === 0 || parseInt(value) < min) {\n return min;\n } else if (parseInt(value) > max) {\n return max;\n }\n return parseInt(value);\n};\n"],"names":["DEFAULT_COLOR","DEFAULT_FORMAT","colorToCss","color","isValidHexColor","hexRegex","hexColorToRgba","hex","matches","hexColor","rgbColorToHex","rgb","red","green","blue","getHexDisplayName","hexValue","alpha","alphaPercentage","getColorWithName","currentFormat","getLimitedColorChannelValue","value","min","max"],"mappings":"AAIO,MAAMA,IAAgB,EAAE,KAAK,KAAK,OAAO,KAAK,MAAM,KAAK,OAAO,GAAG,MAAM,GAAA,GACnEC,IAAiB,OAajBC,IAAa,CAACC,MAAsB;AAC7C,MAAKA;AAGL,WAAO,QAAQA,EAAM,GAAG,KAAKA,EAAM,KAAK,KAAKA,EAAM,IAAI,KAAKA,EAAM,SAAS,CAAC;AAChF,GAcaC,IAAkB,CAACD,MAA2B;AACvD,QAAME,IAAW;AACjB,SAAOF,EAAM,SAAS,KAAKE,EAAS,KAAKF,CAAK;AAClD,GAcaG,IAAiB,CAACC,MAA2B;AACtD,QAAMF,IAAW,0BACXG,IAAUD,EAAI,MAAMF,CAAQ;AAClC,MAAI,CAACG;AACD,WAAO;AAAA,MACH,KAAK;AAAA,MACL,OAAO;AAAA,MACP,MAAM;AAAA,MACN,OAAO;AAAA,IAAA;AAGf,QAAMC,IAAWD,EAAQ,CAAC;AAC1B,SAAIC,EAAS,WAAW,IACb;AAAA,IACH,KAAK,SAAS,GAAGA,EAAS,CAAC,CAAC,GAAGA,EAAS,CAAC,CAAC,IAAI,EAAE;AAAA,IAChD,OAAO,SAAS,GAAGA,EAAS,CAAC,CAAC,GAAGA,EAAS,CAAC,CAAC,IAAI,EAAE;AAAA,IAClD,MAAM,SAAS,GAAGA,EAAS,CAAC,CAAC,GAAGA,EAAS,CAAC,CAAC,IAAI,EAAE;AAAA,IACjD,OAAO;AAAA,EAAA,IAGR;AAAA,IACH,KAAK,SAASA,EAAS,MAAM,GAAG,CAAC,GAAG,EAAE;AAAA,IACtC,OAAO,SAASA,EAAS,MAAM,GAAG,CAAC,GAAG,EAAE;AAAA,IACxC,MAAM,SAASA,EAAS,MAAM,GAAG,CAAC,GAAG,EAAE;AAAA,IACvC,OAAO;AAAA,EAAA;AAEf,GAcaC,IAAgB,CAACC,MAA0C;AACpE,QAAM,EAAE,KAAAC,GAAK,OAAAC,GAAO,MAAAC,EAAA,IAASH;AAC7B,SAAO,GAAGC,EAAI,SAAS,EAAE,EAAE,SAAS,GAAG,GAAG,CAAC,GAAGC,EAAM,SAAS,EAAE,EAAE,SAAS,GAAG,GAAG,CAAC,GAAGC,EAAK,SAAS,EAAE,EAAE,SAAS,GAAG,GAAG,CAAC;AAC1H,GAaaC,IAAoB,CAACZ,MAA6B;AAC3D,QAAMa,IAAWN,EAAcP,CAAK,GAC9Bc,IAAQd,EAAM,SAAS;AAE7B,MAAIc,IAAQ,GAAG;AACX,UAAMC,IAAkB,KAAK,MAAMD,IAAQ,GAAG;AAC9C,WAAO,IAAID,CAAQ,IAAIE,CAAe;AAAA,EAC1C;AAEA,SAAO,IAAIF,CAAQ;AACvB,GAgBaG,IAAmB,CAAChB,GAAkBiB,MAC3CA,MAAkB,QACX;AAAA,EACH,GAAGjB;AAAA,EACH,MAAMY,EAAkBZ,CAAK;AAAA,IAG9B;AAAA,EACH,GAAGA;AAAA,EACH,MAAM,QAAQA,EAAM,GAAG,KAAKA,EAAM,KAAK,KAAKA,EAAM,IAAI,KAAKA,EAAM,SAAS,CAAC;AAAA,GAqBtEkB,IAA8B,CAACC,GAAeC,IAAc,GAAGC,IAAc,QAClFF,EAAM,WAAW,KAAK,SAASA,CAAK,IAAIC,IACjCA,IACA,SAASD,CAAK,IAAIE,IAClBA,IAEJ,SAASF,CAAK;"}
|
|
1
|
+
{"version":3,"file":"fondue-components49.js","sources":["../src/components/ColorPicker/ColorValueInput.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type ForwardedRef, forwardRef, useEffect, useState } from 'react';\n\nimport { useTranslation } from '#/hooks/useTranslation';\n\nimport { Select } from '../Select/Select';\nimport { TextInput } from '../TextInput/TextInput';\n\nimport styles from './styles/customColorPicker.module.scss';\nimport { type RgbaColor } from './types';\nimport {\n DEFAULT_COLOR,\n DEFAULT_FORMAT,\n getLimitedColorChannelValue,\n hexColorToRgba,\n isValidHexColor,\n rgbColorToHex,\n} from './utils';\n\ntype ColorFormat = 'HEX' | 'RGBA';\n\ntype ColorValueInputProps = {\n /**\n * @ignore\n * The active color in the color picker, passed down from the root component\n */\n currentColor?: RgbaColor;\n /**\n * @ignore\n * Event handler called when the color changes, passed down from the root component\n */\n onColorChange?: (color: RgbaColor) => void;\n /**\n * @ignore\n * The format to use for the color input, passed down from the root component\n */\n currentFormat?: ColorFormat;\n /**\n * @ignore\n * The format to use for the color input, passed down from the root component\n */\n setCurrentFormat?: (format: ColorFormat) => void;\n /**\n * The test id of the color picker value input\n */\n 'data-test-id'?: string;\n};\n\nconst nooperation = () => {};\n\nexport const ColorValueInput = (\n {\n currentColor = DEFAULT_COLOR,\n onColorChange = nooperation,\n currentFormat = DEFAULT_FORMAT,\n setCurrentFormat = nooperation,\n 'data-test-id': dataTestId = 'color-picker-value-input',\n }: ColorValueInputProps,\n forwardedRef: ForwardedRef<HTMLDivElement>,\n) => {\n const { t } = useTranslation();\n const [hexColorValue, setHexColorValue] = useState<string>(() => rgbColorToHex(currentColor));\n\n useEffect(() => {\n setHexColorValue(rgbColorToHex(currentColor));\n }, [currentColor]);\n\n return (\n <div className={styles.inputs} data-test-id={dataTestId} ref={forwardedRef}>\n <div className={styles.colorFormatInput}>\n <Select\n data-test-id=\"color-picker-select-format\"\n aria-label={t('ColorPicker_selectFormat')}\n onSelect={(selectedValue) => {\n setCurrentFormat(selectedValue as ColorFormat);\n }}\n value={currentFormat}\n >\n <Select.Item value=\"HEX\">HEX</Select.Item>\n <Select.Item value=\"RGBA\">RGBA</Select.Item>\n </Select>\n </div>\n {currentFormat === 'HEX' ? (\n <TextInput.Root\n data-test-id=\"color-picker-value-input-hex\"\n className={styles.valueInput}\n type=\"text\"\n value={hexColorValue}\n status={isValidHexColor(hexColorValue) ? 'neutral' : 'error'}\n onBlur={(event) => {\n if (isValidHexColor(event.target.value)) {\n onColorChange({ ...hexColorToRgba(event.target.value), alpha: currentColor.alpha });\n }\n }}\n onChange={(event) => {\n const inputValue = event.target.value.startsWith('#')\n ? event.target.value.slice(1)\n : event.target.value;\n\n setHexColorValue(inputValue);\n }}\n aria-label={t('ColorPicker_hexValue')}\n >\n <TextInput.Slot name=\"left\">\n <span className={styles.inputDecorator}>#</span>\n </TextInput.Slot>\n </TextInput.Root>\n ) : (\n <div className={styles.colorChannelInputGroup}>\n <TextInput.Root\n data-test-id=\"color-picker-value-input-red\"\n className={styles.valueInput}\n value={currentColor.red}\n type=\"number\"\n onChange={(event) => {\n onColorChange({\n ...currentColor,\n red: getLimitedColorChannelValue(event.target.value),\n });\n }}\n aria-label={t('ColorPicker_redChannel')}\n >\n <TextInput.Slot name=\"left\">\n <span className={styles.inputDecorator}>R</span>\n </TextInput.Slot>\n </TextInput.Root>\n <TextInput.Root\n data-test-id=\"color-picker-value-input-green\"\n className={styles.valueInput}\n value={currentColor.green}\n type=\"number\"\n onChange={(event) => {\n onColorChange({\n ...currentColor,\n green: getLimitedColorChannelValue(event.target.value),\n });\n }}\n aria-label={t('ColorPicker_greenChannel')}\n >\n <TextInput.Slot name=\"left\">\n <span className={styles.inputDecorator}>G</span>\n </TextInput.Slot>\n </TextInput.Root>\n <TextInput.Root\n data-test-id=\"color-picker-value-input-blue\"\n className={styles.valueInput}\n value={currentColor.blue}\n type=\"number\"\n onChange={(event) => {\n onColorChange({\n ...currentColor,\n blue: getLimitedColorChannelValue(event.target.value),\n });\n }}\n aria-label={t('ColorPicker_blueChannel')}\n >\n <TextInput.Slot name=\"left\">\n <span className={styles.inputDecorator}>B</span>\n </TextInput.Slot>\n </TextInput.Root>\n </div>\n )}\n <div className={styles.colorAlphaInput}>\n <TextInput.Root\n data-test-id=\"color-picker-value-input-alpha\"\n className={styles.valueInput}\n /* .toString() is a workaround for https://github.com/facebook/react/issues/9402 */\n value={currentColor.alpha === undefined ? 100 : Math.trunc(currentColor.alpha * 100).toString()}\n type=\"number\"\n onChange={(event) => {\n onColorChange({\n ...currentColor,\n alpha: getLimitedColorChannelValue(event.target.value, 0, 100) / 100,\n });\n }}\n aria-label={t('ColorPicker_opacity')}\n >\n <TextInput.Slot name=\"left\">\n <span className={styles.inputDecorator}>A</span>\n </TextInput.Slot>\n <TextInput.Slot name=\"right\">\n <span className={styles.inputDecorator}>%</span>\n </TextInput.Slot>\n </TextInput.Root>\n </div>\n </div>\n );\n};\nColorValueInput.displayName = 'ColorPicker.Values';\n\nexport const ForwardedRefColorValueInput = forwardRef<HTMLDivElement, ColorValueInputProps>(ColorValueInput);\n"],"names":["nooperation","ColorValueInput","currentColor","DEFAULT_COLOR","onColorChange","currentFormat","DEFAULT_FORMAT","setCurrentFormat","dataTestId","forwardedRef","t","useTranslation","hexColorValue","setHexColorValue","useState","rgbColorToHex","useEffect","jsxs","styles","jsx","Select","selectedValue","TextInput","isValidHexColor","event","hexColorToRgba","inputValue","getLimitedColorChannelValue","ForwardedRefColorValueInput","forwardRef"],"mappings":";;;;;;;AAiDA,MAAMA,IAAc,MAAM;AAAC,GAEdC,IAAkB,CAC3B;AAAA,EACI,cAAAC,IAAeC;AAAA,EACf,eAAAC,IAAgBJ;AAAA,EAChB,eAAAK,IAAgBC;AAAA,EAChB,kBAAAC,IAAmBP;AAAA,EACnB,gBAAgBQ,IAAa;AACjC,GACAC,MACC;AACD,QAAM,EAAE,GAAAC,EAAA,IAAMC,EAAA,GACR,CAACC,GAAeC,CAAgB,IAAIC,EAAiB,MAAMC,EAAcb,CAAY,CAAC;AAE5F,SAAAc,EAAU,MAAM;AACZ,IAAAH,EAAiBE,EAAcb,CAAY,CAAC;AAAA,EAChD,GAAG,CAACA,CAAY,CAAC,GAGb,gBAAAe,EAAC,SAAI,WAAWC,EAAO,QAAQ,gBAAcV,GAAY,KAAKC,GAC1D,UAAA;AAAA,IAAA,gBAAAU,EAAC,OAAA,EA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d,EAAE,yBAAyB;AAAA,UAEvC,UAAA,gBAAAS,EAACG,EAAU,MAAV,EAAe,MAAK,QACjB,UAAA,gBAAAH,EAAC,QAAA,EAAK,WAAWD,EAAO,gBAAgB,UAAA,IAAA,CAAC,EAAA,CAC7C;AAAA,QAAA;AAAA,MAAA;AAAA,IACJ,GACJ;AAAA,IAEJ,gBAAAC,EAAC,OAAA,EAAI,WAAWD,EAAO,iBACnB,UAAA,gBAAAD;AAAA,MAACK,EAAU;AAAA,MAAV;AAAA,QACG,gBAAa;AAAA,QACb,WAAWJ,EAAO;AAAA,QAElB,OAAOhB,EAAa,UAAU,SAAY,MAAM,KAAK,MAAMA,EAAa,QAAQ,GAAG,EAAE,SAAA;AAAA,QACrF,MAAK;AAAA,QACL,UAAU,CAACsB,MAAU;AACjB,UAAApB,EAAc;AAAA,YACV,GAAGF;AAAA,YACH,OAAOyB,EAA4BH,EAAM,OAAO,OAAO,GAAG,GAAG,IAAI;AAAA,UAAA,CACpE;AAAA,QACL;AAAA,QACA,cAAYd,EAAE,qBAAqB;AAAA,QAEnC,UAAA;AAAA,UAAA,gBAAAS,EAACG,EAAU,MAAV,EAAe,MAAK,QACjB,UAAA,gBAAAH,EAAC,QAAA,EAAK,WAAWD,EAAO,gBAAgB,UAAA,IAAA,CAAC,GAC7C;AAAA,UACA,gBAAAC,EAACG,EAAU,MAAV,EAAe,MAAK,SACjB,UAAA,gBAAAH,EAAC,QAAA,EAAK,WAAWD,EAAO,gBAAgB,UAAA,IAAA,CAAC,EAAA,CAC7C;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA,EACJ,CACJ;AAAA,EAAA,GACJ;AAER;AACAjB,EAAgB,cAAc;AAEvB,MAAM2B,IAA8BC,EAAiD5B,CAAe;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as f } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef as n } from "react";
|
|
3
|
-
import { propsToCssVariables as x } from "./fondue-
|
|
4
|
-
import y from "./fondue-
|
|
3
|
+
import { propsToCssVariables as x } from "./fondue-components40.js";
|
|
4
|
+
import y from "./fondue-components41.js";
|
|
5
5
|
const c = n(
|
|
6
6
|
({
|
|
7
7
|
as: a = "div",
|
|
@@ -1,11 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
const o = "_root_6n5w5_4", n = "_inputs_6n5w5_12", t = "_colorFormatInput_6n5w5_23", r = "_colorAlphaInput_6n5w5_24", u = "_colorChannelInputGroup_6n5w5_28", p = "_inputDecorator_6n5w5_39", _ = "_gradientInput_6n5w5_43", l = "_reactColorful_6n5w5_46", c = "_valueInput_6n5w5_50", a = {
|
|
2
|
+
root: o,
|
|
3
|
+
inputs: n,
|
|
4
|
+
colorFormatInput: t,
|
|
5
|
+
colorAlphaInput: r,
|
|
6
|
+
colorChannelInputGroup: u,
|
|
7
|
+
inputDecorator: p,
|
|
8
|
+
gradientInput: _,
|
|
9
|
+
reactColorful: l,
|
|
10
|
+
valueInput: c
|
|
7
11
|
};
|
|
8
12
|
export {
|
|
9
|
-
|
|
13
|
+
r as colorAlphaInput,
|
|
14
|
+
u as colorChannelInputGroup,
|
|
15
|
+
t as colorFormatInput,
|
|
16
|
+
a as default,
|
|
17
|
+
_ as gradientInput,
|
|
18
|
+
p as inputDecorator,
|
|
19
|
+
n as inputs,
|
|
20
|
+
l as reactColorful,
|
|
21
|
+
o as root,
|
|
22
|
+
c as valueInput
|
|
10
23
|
};
|
|
11
24
|
//# sourceMappingURL=fondue-components50.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fondue-components50.js","sources":[
|
|
1
|
+
{"version":3,"file":"fondue-components50.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;"}
|