@frontify/fondue-components 3.0.3 → 3.2.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 +38 -24
- package/dist/fondue-components.js.map +1 -1
- package/dist/fondue-components10.js +18 -38
- package/dist/fondue-components10.js.map +1 -1
- package/dist/fondue-components11.js +64 -40
- package/dist/fondue-components11.js.map +1 -1
- package/dist/fondue-components12.js +19 -77
- package/dist/fondue-components12.js.map +1 -1
- package/dist/fondue-components13.js +22 -64
- package/dist/fondue-components13.js.map +1 -1
- package/dist/fondue-components14.js +39 -46
- package/dist/fondue-components14.js.map +1 -1
- package/dist/fondue-components15.js +6 -12
- package/dist/fondue-components15.js.map +1 -1
- package/dist/fondue-components16.js +46 -154
- package/dist/fondue-components16.js.map +1 -1
- package/dist/fondue-components17.js +54 -117
- package/dist/fondue-components17.js.map +1 -1
- package/dist/fondue-components18.js +28 -117
- package/dist/fondue-components18.js.map +1 -1
- package/dist/fondue-components19.js +111 -20
- package/dist/fondue-components19.js.map +1 -1
- package/dist/fondue-components20.js +65 -14
- package/dist/fondue-components20.js.map +1 -1
- package/dist/fondue-components21.js +42 -59
- package/dist/fondue-components21.js.map +1 -1
- package/dist/fondue-components22.js +32 -17
- package/dist/fondue-components22.js.map +1 -1
- package/dist/fondue-components23.js +5 -17
- package/dist/fondue-components23.js.map +1 -1
- package/dist/fondue-components24.js +10 -33
- package/dist/fondue-components24.js.map +1 -1
- package/dist/fondue-components25.js +154 -24
- package/dist/fondue-components25.js.map +1 -1
- package/dist/fondue-components26.js +118 -9
- package/dist/fondue-components26.js.map +1 -1
- package/dist/fondue-components27.js +118 -110
- package/dist/fondue-components27.js.map +1 -1
- package/dist/fondue-components28.js +21 -12
- package/dist/fondue-components28.js.map +1 -1
- package/dist/fondue-components29.js +28 -39
- package/dist/fondue-components29.js.map +1 -1
- package/dist/fondue-components3.js +11 -40
- package/dist/fondue-components3.js.map +1 -1
- package/dist/fondue-components30.js +28 -8
- package/dist/fondue-components30.js.map +1 -1
- package/dist/fondue-components31.js +129 -20
- package/dist/fondue-components31.js.map +1 -1
- package/dist/fondue-components32.js +20 -55
- package/dist/fondue-components32.js.map +1 -1
- package/dist/fondue-components33.js +45 -18
- package/dist/fondue-components33.js.map +1 -1
- package/dist/fondue-components34.js +15 -15
- package/dist/fondue-components34.js.map +1 -1
- package/dist/fondue-components35.js +60 -2
- package/dist/fondue-components35.js.map +1 -1
- package/dist/fondue-components36.js +14 -38
- package/dist/fondue-components36.js.map +1 -1
- package/dist/fondue-components37.js +22 -0
- package/dist/fondue-components37.js.map +1 -0
- package/dist/fondue-components38.js +20 -0
- package/dist/fondue-components38.js.map +1 -0
- package/dist/fondue-components39.js +8 -0
- package/dist/fondue-components39.js.map +1 -0
- package/dist/fondue-components4.js +39 -45
- package/dist/fondue-components4.js.map +1 -1
- package/dist/fondue-components40.js +16 -0
- package/dist/fondue-components40.js.map +1 -0
- package/dist/fondue-components41.js +8 -0
- package/dist/fondue-components41.js.map +1 -0
- package/dist/fondue-components42.js +38 -0
- package/dist/fondue-components42.js.map +1 -0
- package/dist/fondue-components43.js +8 -0
- package/dist/fondue-components43.js.map +1 -0
- package/dist/fondue-components44.js +28 -0
- package/dist/fondue-components44.js.map +1 -0
- package/dist/fondue-components45.js +20 -0
- package/dist/fondue-components45.js.map +1 -0
- package/dist/fondue-components46.js +14 -0
- package/dist/fondue-components46.js.map +1 -0
- package/dist/fondue-components47.js +16 -0
- package/dist/fondue-components47.js.map +1 -0
- package/dist/fondue-components48.js +133 -0
- package/dist/fondue-components48.js.map +1 -0
- package/dist/fondue-components49.js +15 -0
- package/dist/fondue-components49.js.map +1 -0
- package/dist/fondue-components5.js +46 -82
- package/dist/fondue-components5.js.map +1 -1
- package/dist/fondue-components50.js +46 -0
- package/dist/fondue-components50.js.map +1 -0
- package/dist/fondue-components51.js +11 -0
- package/dist/fondue-components51.js.map +1 -0
- package/dist/fondue-components52.js +30 -0
- package/dist/fondue-components52.js.map +1 -0
- package/dist/fondue-components53.js +52 -0
- package/dist/fondue-components53.js.map +1 -0
- package/dist/fondue-components54.js +21 -0
- package/dist/fondue-components54.js.map +1 -0
- package/dist/fondue-components55.js +10 -0
- package/dist/fondue-components55.js.map +1 -0
- package/dist/fondue-components56.js +5 -0
- package/dist/fondue-components56.js.map +1 -0
- package/dist/fondue-components57.js +14 -0
- package/dist/fondue-components57.js.map +1 -0
- package/dist/fondue-components58.js +42 -0
- package/dist/fondue-components58.js.map +1 -0
- package/dist/fondue-components6.js +48 -30
- package/dist/fondue-components6.js.map +1 -1
- package/dist/fondue-components7.js +80 -83
- package/dist/fondue-components7.js.map +1 -1
- package/dist/fondue-components8.js +28 -56
- package/dist/fondue-components8.js.map +1 -1
- package/dist/fondue-components9.js +101 -22
- package/dist/fondue-components9.js.map +1 -1
- package/dist/index.d.ts +490 -5
- package/dist/style.css +1 -1
- package/package.json +5 -3
|
@@ -1,24 +1,133 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
import { jsxs as o, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as b, useState as g, useEffect as R } from "react";
|
|
3
|
+
import { Select as c } from "./fondue-components19.js";
|
|
4
|
+
import { TextInput as r } from "./fondue-components20.js";
|
|
5
|
+
import a from "./fondue-components32.js";
|
|
6
|
+
import { rgbColorToHex as d, isValidHexColor as m, hexColorToRgba as I, getLimitedColorChannelValue as n, DEFAULT_COLOR as x, DEFAULT_FORMAT as S } from "./fondue-components33.js";
|
|
7
|
+
const h = ({
|
|
8
|
+
currentColor: t = x,
|
|
9
|
+
onColorChange: i = () => {
|
|
10
|
+
},
|
|
11
|
+
currentFormat: s = S,
|
|
12
|
+
setCurrentFormat: v = () => {
|
|
13
|
+
},
|
|
14
|
+
"data-test-id": f = "color-picker-value-input"
|
|
15
|
+
}, N) => {
|
|
16
|
+
const [u, p] = g(d(t));
|
|
17
|
+
return R(() => {
|
|
18
|
+
p(d(t));
|
|
19
|
+
}, [t]), /* @__PURE__ */ o("div", { className: a.inputs, "data-test-id": f, ref: N, children: [
|
|
20
|
+
/* @__PURE__ */ e("div", { className: a.colorFormatInput, children: /* @__PURE__ */ o(
|
|
21
|
+
c,
|
|
22
|
+
{
|
|
23
|
+
"data-test-id": "color-picker-select-format",
|
|
24
|
+
"aria-label": "Select a color format",
|
|
25
|
+
onSelect: (l) => {
|
|
26
|
+
v(l);
|
|
27
|
+
},
|
|
28
|
+
value: s,
|
|
29
|
+
children: [
|
|
30
|
+
/* @__PURE__ */ e(c.Item, { value: "HEX", children: "HEX" }),
|
|
31
|
+
/* @__PURE__ */ e(c.Item, { value: "RGBA", children: "RGBA" })
|
|
32
|
+
]
|
|
33
|
+
}
|
|
34
|
+
) }),
|
|
35
|
+
s === "HEX" ? /* @__PURE__ */ e(
|
|
36
|
+
r.Root,
|
|
37
|
+
{
|
|
38
|
+
"data-test-id": "color-picker-value-input-hex",
|
|
39
|
+
className: a.valueInput,
|
|
40
|
+
type: "text",
|
|
41
|
+
value: u,
|
|
42
|
+
status: m(u) ? "neutral" : "error",
|
|
43
|
+
onBlur: (l) => {
|
|
44
|
+
m(l.target.value) && i(I(l.target.value));
|
|
45
|
+
},
|
|
46
|
+
onChange: (l) => {
|
|
47
|
+
p(l.target.value);
|
|
48
|
+
},
|
|
49
|
+
"aria-label": "Hex color value",
|
|
50
|
+
children: /* @__PURE__ */ e(r.Slot, { name: "left", children: /* @__PURE__ */ e("span", { className: a.inputDecorator, children: "#" }) })
|
|
51
|
+
}
|
|
52
|
+
) : /* @__PURE__ */ o("div", { className: a.colorChannelInputGroup, children: [
|
|
53
|
+
/* @__PURE__ */ e(
|
|
54
|
+
r.Root,
|
|
55
|
+
{
|
|
56
|
+
"data-test-id": "color-picker-value-input-red",
|
|
57
|
+
className: a.valueInput,
|
|
58
|
+
value: t.red,
|
|
59
|
+
type: "number",
|
|
60
|
+
onChange: (l) => {
|
|
61
|
+
i({
|
|
62
|
+
...t,
|
|
63
|
+
red: n(l.target.value)
|
|
64
|
+
});
|
|
65
|
+
},
|
|
66
|
+
"aria-label": "Red Color Channel",
|
|
67
|
+
children: /* @__PURE__ */ e(r.Slot, { name: "left", children: /* @__PURE__ */ e("span", { className: a.inputDecorator, children: "R" }) })
|
|
68
|
+
}
|
|
69
|
+
),
|
|
70
|
+
/* @__PURE__ */ e(
|
|
71
|
+
r.Root,
|
|
72
|
+
{
|
|
73
|
+
"data-test-id": "color-picker-value-input-green",
|
|
74
|
+
className: a.valueInput,
|
|
75
|
+
value: t.green,
|
|
76
|
+
type: "number",
|
|
77
|
+
onChange: (l) => {
|
|
78
|
+
i({
|
|
79
|
+
...t,
|
|
80
|
+
green: n(l.target.value)
|
|
81
|
+
});
|
|
82
|
+
},
|
|
83
|
+
"aria-label": "Green Color Channel",
|
|
84
|
+
children: /* @__PURE__ */ e(r.Slot, { name: "left", children: /* @__PURE__ */ e("span", { className: a.inputDecorator, children: "G" }) })
|
|
85
|
+
}
|
|
86
|
+
),
|
|
87
|
+
/* @__PURE__ */ e(
|
|
88
|
+
r.Root,
|
|
89
|
+
{
|
|
90
|
+
"data-test-id": "color-picker-value-input-blue",
|
|
91
|
+
className: a.valueInput,
|
|
92
|
+
value: t.blue,
|
|
93
|
+
type: "number",
|
|
94
|
+
onChange: (l) => {
|
|
95
|
+
i({
|
|
96
|
+
...t,
|
|
97
|
+
blue: n(l.target.value)
|
|
98
|
+
});
|
|
99
|
+
},
|
|
100
|
+
"aria-label": "Blue Color Channel",
|
|
101
|
+
children: /* @__PURE__ */ e(r.Slot, { name: "left", children: /* @__PURE__ */ e("span", { className: a.inputDecorator, children: "B" }) })
|
|
102
|
+
}
|
|
103
|
+
)
|
|
104
|
+
] }),
|
|
105
|
+
/* @__PURE__ */ e("div", { className: a.colorAlphaInput, children: /* @__PURE__ */ o(
|
|
106
|
+
r.Root,
|
|
107
|
+
{
|
|
108
|
+
"data-test-id": "color-picker-value-input-alpha",
|
|
109
|
+
className: a.valueInput,
|
|
110
|
+
value: t.alpha === void 0 ? 100 : Math.trunc(t.alpha * 100),
|
|
111
|
+
type: "number",
|
|
112
|
+
onChange: (l) => {
|
|
113
|
+
i({
|
|
114
|
+
...t,
|
|
115
|
+
alpha: n(l.target.value, 0, 100) / 100
|
|
116
|
+
});
|
|
117
|
+
},
|
|
118
|
+
"aria-label": "Color Opacity",
|
|
119
|
+
children: [
|
|
120
|
+
/* @__PURE__ */ e(r.Slot, { name: "left", children: /* @__PURE__ */ e("span", { className: a.inputDecorator, children: "A" }) }),
|
|
121
|
+
/* @__PURE__ */ e(r.Slot, { name: "right", children: /* @__PURE__ */ e("span", { className: a.inputDecorator, children: "%" }) })
|
|
122
|
+
]
|
|
123
|
+
}
|
|
124
|
+
) })
|
|
125
|
+
] });
|
|
11
126
|
};
|
|
127
|
+
h.displayName = "ColorPicker.Values";
|
|
128
|
+
const E = b(h);
|
|
12
129
|
export {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
e as default,
|
|
16
|
-
s as group,
|
|
17
|
-
_ as input,
|
|
18
|
-
r as item,
|
|
19
|
-
u as menu,
|
|
20
|
-
n as portal,
|
|
21
|
-
t as root,
|
|
22
|
-
o as slot
|
|
130
|
+
h as ColorValueInput,
|
|
131
|
+
E as ForwardedRefColorValueInput
|
|
23
132
|
};
|
|
24
133
|
//# sourceMappingURL=fondue-components31.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fondue-components31.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"fondue-components31.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 { 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\nexport const ColorValueInput = (\n {\n currentColor = DEFAULT_COLOR,\n onColorChange = () => {},\n currentFormat = DEFAULT_FORMAT,\n setCurrentFormat = () => {},\n 'data-test-id': dataTestId = 'color-picker-value-input',\n }: ColorValueInputProps,\n forwardedRef: ForwardedRef<HTMLDivElement>,\n) => {\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=\"Select a color format\"\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));\n }\n }}\n onChange={(event) => {\n setHexColorValue(event.target.value);\n }}\n aria-label=\"Hex color value\"\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=\"Red Color Channel\"\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=\"Green Color Channel\"\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=\"Blue Color Channel\"\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 value={currentColor.alpha === undefined ? 100 : Math.trunc(currentColor.alpha * 100)}\n type=\"number\"\n onChange={(event) => {\n onColorChange({\n ...currentColor,\n alpha: getLimitedColorChannelValue(event.target.value, 0, 100) / 100,\n });\n }}\n aria-label=\"Color 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":["ColorValueInput","currentColor","DEFAULT_COLOR","onColorChange","currentFormat","DEFAULT_FORMAT","setCurrentFormat","dataTestId","forwardedRef","hexColorValue","setHexColorValue","useState","rgbColorToHex","useEffect","jsxs","styles","jsx","Select","selectedValue","TextInput","isValidHexColor","event","hexColorToRgba","getLimitedColorChannelValue","ForwardedRefColorValueInput","forwardRef"],"mappings":";;;;;;AA+CO,MAAMA,IAAkB,CAC3B;AAAA,EACI,cAAAC,IAAeC;AAAA,EACf,eAAAC,IAAgB,MAAM;AAAA,EAAC;AAAA,EACvB,eAAAC,IAAgBC;AAAA,EAChB,kBAAAC,IAAmB,MAAM;AAAA,EAAC;AAAA,EAC1B,gBAAgBC,IAAa;AACjC,GACAC,MACC;AACD,QAAM,CAACC,GAAeC,CAAgB,IAAIC,EAAiBC,EAAcX,CAAY,CAAC;AAEtF,SAAAY,EAAU,MAAM;AACK,IAAAH,EAAAE,EAAcX,CAAY,CAAC;AAAA,EAAA,GAC7C,CAACA,CAAY,CAAC,GAGb,gBAAAa,EAAC,SAAI,WAAWC,EAAO,QAAQ,gBAAcR,GAAY,KAAKC,GAC1D,UAAA;AAAA,IAAC,gBAAAQ,EAAA,OAAA,EAAI,WAAWD,EAAO,kBACnB,UAAA,gBAAAD;AAAA,MAACG;AAAA,MAAA;AAAA,QACG,gBAAa;AAAA,QACb,cAAW;AAAA,QACX,UAAU,CAACC,MAAkB;AACzB,UAAAZ,EAAiBY,CAA4B;AAAA,QACjD;AAAA,QACA,OAAOd;AAAA,QAEP,UAAA;AAAA,UAAA,gBA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;AACH,UAAAlB,EAAA;AAAA,YACV,GAAGF;AAAA,YACH,OAAOsB,EAA4BF,EAAM,OAAO,OAAO,GAAG,GAAG,IAAI;AAAA,UAAA,CACpE;AAAA,QACL;AAAA,QACA,cAAW;AAAA,QAEX,UAAA;AAAA,UAAC,gBAAAL,EAAAG,EAAU,MAAV,EAAe,MAAK,QACjB,UAAC,gBAAAH,EAAA,QAAA,EAAK,WAAWD,EAAO,gBAAgB,UAAA,IAAC,CAAA,GAC7C;AAAA,UACC,gBAAAC,EAAAG,EAAU,MAAV,EAAe,MAAK,SACjB,UAAC,gBAAAH,EAAA,QAAA,EAAK,WAAWD,EAAO,gBAAgB,UAAA,IAAC,CAAA,GAC7C;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA,GAER;AAAA,EACJ,EAAA,CAAA;AAER;AACAf,EAAgB,cAAc;AAEjB,MAAAwB,IAA8BC,EAAiDzB,CAAe;"}
|
|
@@ -1,59 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
t.push(v(o.props));
|
|
12
|
-
else if (u(o) && o.props.children) {
|
|
13
|
-
const l = i(o.props.children);
|
|
14
|
-
for (const a of l)
|
|
15
|
-
t.push(a);
|
|
16
|
-
}
|
|
17
|
-
}), t;
|
|
18
|
-
}, k = (s) => {
|
|
19
|
-
const [t, o] = x(""), { inputSlots: l, menuSlots: a, itemValues: p, clearButton: V } = S(() => {
|
|
20
|
-
const r = [], n = [];
|
|
21
|
-
let m;
|
|
22
|
-
return f.toArray(s).some(
|
|
23
|
-
(e) => u(e) && e.type === c
|
|
24
|
-
) ? (f.forEach(s, (e) => {
|
|
25
|
-
u(e) && e.type === c && (e.props.name === "menu" ? n.push(e.props.children) : e.props.name === "left" || e.props.name === "right" ? r.push(e) : e.props.name === "clear" && (e.props.children ? m = e : m = B(e, { children: /* @__PURE__ */ g(w, { size: 16 }) })));
|
|
26
|
-
}), {
|
|
27
|
-
inputSlots: r,
|
|
28
|
-
menuSlots: n,
|
|
29
|
-
clearButton: m,
|
|
30
|
-
itemValues: i(n)
|
|
31
|
-
}) : {
|
|
32
|
-
menuSlots: s,
|
|
33
|
-
inputSlots: [],
|
|
34
|
-
itemValues: i(s)
|
|
35
|
-
};
|
|
36
|
-
}, [s]), y = S(
|
|
37
|
-
() => p.filter(
|
|
38
|
-
(r) => t === "" || r.label.toLowerCase().includes(t.toLowerCase())
|
|
39
|
-
),
|
|
40
|
-
[p, t]
|
|
41
|
-
), C = E(
|
|
42
|
-
(r) => r ? p.find((n) => n.value === r) : void 0,
|
|
43
|
-
[p]
|
|
44
|
-
);
|
|
45
|
-
return {
|
|
46
|
-
inputSlots: l,
|
|
47
|
-
menuSlots: a,
|
|
48
|
-
clearButton: V,
|
|
49
|
-
setFilterText: o,
|
|
50
|
-
filterText: t,
|
|
51
|
-
items: y,
|
|
52
|
-
getItemByValue: C
|
|
53
|
-
};
|
|
1
|
+
const o = "_root_v784d_5", t = "_inputs_v784d_12", n = "_colorFormatInput_v784d_23", r = "_colorAlphaInput_v784d_24", u = "_colorChannelInputGroup_v784d_28", p = "_inputDecorator_v784d_39", _ = "_gradientInput_v784d_43", l = "_reactColorful_v784d_46", c = "_valueInput_v784d_50", a = {
|
|
2
|
+
root: o,
|
|
3
|
+
inputs: t,
|
|
4
|
+
colorFormatInput: n,
|
|
5
|
+
colorAlphaInput: r,
|
|
6
|
+
colorChannelInputGroup: u,
|
|
7
|
+
inputDecorator: p,
|
|
8
|
+
gradientInput: _,
|
|
9
|
+
reactColorful: l,
|
|
10
|
+
valueInput: c
|
|
54
11
|
};
|
|
55
12
|
export {
|
|
56
|
-
|
|
57
|
-
|
|
13
|
+
r as colorAlphaInput,
|
|
14
|
+
u as colorChannelInputGroup,
|
|
15
|
+
n as colorFormatInput,
|
|
16
|
+
a as default,
|
|
17
|
+
_ as gradientInput,
|
|
18
|
+
p as inputDecorator,
|
|
19
|
+
t as inputs,
|
|
20
|
+
l as reactColorful,
|
|
21
|
+
o as root,
|
|
22
|
+
c as valueInput
|
|
58
23
|
};
|
|
59
24
|
//# sourceMappingURL=fondue-components32.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fondue-components32.js","sources":[
|
|
1
|
+
{"version":3,"file":"fondue-components32.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;"}
|
|
@@ -1,21 +1,48 @@
|
|
|
1
|
-
const
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
const s = { red: 255, green: 255, blue: 255, alpha: 1, name: "" }, g = "HEX", $ = (e) => {
|
|
2
|
+
if (e)
|
|
3
|
+
return `rgba(${e.red}, ${e.green}, ${e.blue}, ${e.alpha || 1})`;
|
|
4
|
+
}, p = (e) => {
|
|
5
|
+
const r = /^([\dA-Fa-f]{3}){1,2}$/;
|
|
6
|
+
return e.length > 2 && r.test(e);
|
|
7
|
+
}, h = (e) => {
|
|
8
|
+
const r = /^([\dA-Fa-f]{3}){1,2}$/, n = e.match(r);
|
|
9
|
+
if (!n)
|
|
10
|
+
return {
|
|
11
|
+
red: 0,
|
|
12
|
+
green: 0,
|
|
13
|
+
blue: 0,
|
|
14
|
+
alpha: 0
|
|
15
|
+
};
|
|
16
|
+
const t = n[0];
|
|
17
|
+
return t.length === 3 ? {
|
|
18
|
+
red: parseInt(`${t[0]}${t[0]}`, 16),
|
|
19
|
+
green: parseInt(`${t[1]}${t[1]}`, 16),
|
|
20
|
+
blue: parseInt(`${t[2]}${t[2]}`, 16),
|
|
21
|
+
alpha: 1
|
|
22
|
+
} : {
|
|
23
|
+
red: parseInt(t.slice(0, 2), 16),
|
|
24
|
+
green: parseInt(t.slice(2, 4), 16),
|
|
25
|
+
blue: parseInt(t.slice(4, 6), 16),
|
|
26
|
+
alpha: 1
|
|
27
|
+
};
|
|
28
|
+
}, a = (e) => {
|
|
29
|
+
const { red: r, green: n, blue: t } = e;
|
|
30
|
+
return `${r.toString(16).padStart(2, "0")}${n.toString(16).padStart(2, "0")}${t.toString(16).padStart(2, "0")}`;
|
|
31
|
+
}, i = (e, r) => r === "HEX" ? {
|
|
32
|
+
...e,
|
|
33
|
+
name: `#${a(e)}`
|
|
34
|
+
} : {
|
|
35
|
+
...e,
|
|
36
|
+
name: `rgba(${e.red}, ${e.green}, ${e.blue}, ${e.alpha || 1})`
|
|
37
|
+
}, u = (e, r = 0, n = 255) => e.length === 0 || parseInt(e) < r ? r : parseInt(e) > n ? n : parseInt(e);
|
|
11
38
|
export {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
39
|
+
s as DEFAULT_COLOR,
|
|
40
|
+
g as DEFAULT_FORMAT,
|
|
41
|
+
$ as colorToCss,
|
|
42
|
+
i as getColorWithName,
|
|
43
|
+
u as getLimitedColorChannelValue,
|
|
44
|
+
h as hexColorToRgba,
|
|
45
|
+
p as isValidHexColor,
|
|
46
|
+
a as rgbColorToHex
|
|
20
47
|
};
|
|
21
48
|
//# sourceMappingURL=fondue-components33.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fondue-components33.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"fondue-components33.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 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: 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: `#${rgbColorToHex(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","getColorWithName","currentFormat","getLimitedColorChannelValue","value","min","max"],"mappings":"AAIa,MAAAA,IAAgB,EAAE,KAAK,KAAK,OAAO,KAAK,MAAM,KAAK,OAAO,GAAG,MAAM,GAAG,GACtEC,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;AACM,WAAA;AAAA,MACH,KAAK;AAAA,MACL,OAAO;AAAA,MACP,MAAM;AAAA,MACN,OAAO;AAAA,IAAA;AAGT,QAAAC,IAAWD,EAAQ,CAAC;AACtB,SAAAC,EAAS,WAAW,IACb;AAAA,IACH,KAAK,SAAS,GAAGA,EAAS,CAAC,CAAC,GAAGA,EAAS,CAAC,CAAC,IAAI,EAA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
|
9
|
-
},
|
|
10
|
-
defaultVariants: {
|
|
11
|
-
padding: "spacious"
|
|
12
|
-
}
|
|
13
|
-
}), e = "tw-w-2 tw-h-2 tw-bg-box-neutral-mighty tw-border-r tw-border-b tw-border-r-line-mighty tw-border-b-line-mighty tw-rotate-45 -tw-translate-y-1 tw-rounded-br-small";
|
|
1
|
+
const e = "_content_789em_6", t = "_header_789em_49", o = "_footer_789em_50", n = "_body_789em_53", _ = "_underlay_789em_64", d = "_sideContent_789em_75", s = {
|
|
2
|
+
content: e,
|
|
3
|
+
header: t,
|
|
4
|
+
footer: o,
|
|
5
|
+
body: n,
|
|
6
|
+
underlay: _,
|
|
7
|
+
sideContent: d
|
|
8
|
+
};
|
|
14
9
|
export {
|
|
15
|
-
|
|
16
|
-
|
|
10
|
+
n as body,
|
|
11
|
+
e as content,
|
|
12
|
+
s as default,
|
|
13
|
+
o as footer,
|
|
14
|
+
t as header,
|
|
15
|
+
d as sideContent,
|
|
16
|
+
_ as underlay
|
|
17
17
|
};
|
|
18
18
|
//# sourceMappingURL=fondue-components34.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fondue-components34.js","sources":[
|
|
1
|
+
{"version":3,"file":"fondue-components34.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;"}
|
|
@@ -1,5 +1,63 @@
|
|
|
1
|
-
|
|
1
|
+
import { sv as t } from "./fondue-components24.js";
|
|
2
|
+
const i = t({
|
|
3
|
+
base: "tw-flex tw-self-stretch tw-justify-center ",
|
|
4
|
+
variants: {
|
|
5
|
+
direction: {
|
|
6
|
+
horizontal: "tw-flex-col tw-h-0 tw-border-t tw-w-full",
|
|
7
|
+
vertical: "tw-flex-row tw-w-0 tw-border-r tw-h-full "
|
|
8
|
+
},
|
|
9
|
+
color: {
|
|
10
|
+
weak: "tw-border-line-weak",
|
|
11
|
+
default: "tw-border-line",
|
|
12
|
+
strong: "tw-border-line-strong",
|
|
13
|
+
"x-strong": "tw-border-x-line-strong"
|
|
14
|
+
},
|
|
15
|
+
variant: {
|
|
16
|
+
solid: "tw-border-solid",
|
|
17
|
+
dashed: "tw-border-dashed",
|
|
18
|
+
noline: "tw-border-none"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
compoundVariants: [
|
|
22
|
+
{
|
|
23
|
+
direction: "horizontal",
|
|
24
|
+
padding: "small",
|
|
25
|
+
class: "tw-my-4"
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
direction: "horizontal",
|
|
29
|
+
padding: "medium",
|
|
30
|
+
class: "tw-my-7"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
direction: "horizontal",
|
|
34
|
+
padding: "large",
|
|
35
|
+
class: "tw-my-12"
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
direction: "vertical",
|
|
39
|
+
padding: "small",
|
|
40
|
+
class: "tw-mx-4"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
direction: "vertical",
|
|
44
|
+
padding: "medium",
|
|
45
|
+
class: "tw-mx-7"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
direction: "vertical",
|
|
49
|
+
padding: "large",
|
|
50
|
+
class: "tw-mx-12"
|
|
51
|
+
}
|
|
52
|
+
],
|
|
53
|
+
defaultVariants: {
|
|
54
|
+
padding: "medium",
|
|
55
|
+
direction: "horizontal",
|
|
56
|
+
color: "default",
|
|
57
|
+
variant: "solid"
|
|
58
|
+
}
|
|
59
|
+
});
|
|
2
60
|
export {
|
|
3
|
-
|
|
61
|
+
i as dividerStyles
|
|
4
62
|
};
|
|
5
63
|
//# sourceMappingURL=fondue-components35.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fondue-components35.js","sources":["../src/
|
|
1
|
+
{"version":3,"file":"fondue-components35.js","sources":["../src/components/Divider/styles/dividerStyles.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { sv } from '#/utilities/styleUtilities';\n\nexport const dividerStyles = sv({\n base: 'tw-flex tw-self-stretch tw-justify-center ',\n variants: {\n direction: {\n horizontal: 'tw-flex-col tw-h-0 tw-border-t tw-w-full',\n vertical: 'tw-flex-row tw-w-0 tw-border-r tw-h-full ',\n },\n color: {\n weak: 'tw-border-line-weak',\n default: 'tw-border-line',\n strong: 'tw-border-line-strong',\n 'x-strong': 'tw-border-x-line-strong',\n },\n variant: {\n solid: 'tw-border-solid',\n dashed: 'tw-border-dashed',\n noline: 'tw-border-none',\n },\n },\n compoundVariants: [\n {\n direction: 'horizontal',\n padding: 'small',\n class: 'tw-my-4',\n },\n {\n direction: 'horizontal',\n padding: 'medium',\n class: 'tw-my-7',\n },\n {\n direction: 'horizontal',\n padding: 'large',\n class: 'tw-my-12',\n },\n {\n direction: 'vertical',\n padding: 'small',\n class: 'tw-mx-4',\n },\n {\n direction: 'vertical',\n padding: 'medium',\n class: 'tw-mx-7',\n },\n {\n direction: 'vertical',\n padding: 'large',\n class: 'tw-mx-12',\n },\n ],\n defaultVariants: {\n padding: 'medium',\n direction: 'horizontal',\n color: 'default',\n variant: 'solid',\n },\n});\n"],"names":["dividerStyles","sv"],"mappings":";AAIO,MAAMA,IAAgBC,EAAG;AAAA,EAC5B,MAAM;AAAA,EACN,UAAU;AAAA,IACN,WAAW;AAAA,MACP,YAAY;AAAA,MACZ,UAAU;AAAA,IACd;AAAA,IACA,OAAO;AAAA,MACH,MAAM;AAAA,MACN,SAAS;AAAA,MACT,QAAQ;AAAA,MACR,YAAY;AAAA,IAChB;AAAA,IACA,SAAS;AAAA,MACL,OAAO;AAAA,MACP,QAAQ;AAAA,MACR,QAAQ;AAAA,IACZ;AAAA,EACJ;AAAA,EACA,kBAAkB;AAAA,IACd;AAAA,MACI,WAAW;AAAA,MACX,SAAS;AAAA,MACT,OAAO;AAAA,IACX;AAAA,IACA;AAAA,MACI,WAAW;AAAA,MACX,SAAS;AAAA,MACT,OAAO;AAAA,IACX;AAAA,IACA;AAAA,MACI,WAAW;AAAA,MACX,SAAS;AAAA,MACT,OAAO;AAAA,IACX;AAAA,IACA;AAAA,MACI,WAAW;AAAA,MACX,SAAS;AAAA,MACT,OAAO;AAAA,IACX;AAAA,IACA;AAAA,MACI,WAAW;AAAA,MACX,SAAS;AAAA,MACT,OAAO;AAAA,IACX;AAAA,IACA;AAAA,MACI,WAAW;AAAA,MACX,SAAS;AAAA,MACT,OAAO;AAAA,IACX;AAAA,EACJ;AAAA,EACA,iBAAiB;AAAA,IACb,SAAS;AAAA,IACT,WAAW;AAAA,IACX,OAAO;AAAA,IACP,SAAS;AAAA,EACb;AACJ,CAAC;"}
|
|
@@ -1,42 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
})
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}, w = (r, o) => u(r) && r.type === o, y = (r, o, s, p = 0) => {
|
|
14
|
-
const n = [];
|
|
15
|
-
let t = 0;
|
|
16
|
-
return a.forEach(r, (e) => {
|
|
17
|
-
if (w(e, E) && u(e))
|
|
18
|
-
g(e.props).label.toLowerCase().includes((s == null ? void 0 : s.toLowerCase()) || "") && (n.push(o(e, p + t)), t++);
|
|
19
|
-
else if (u(e) && (e != null && e.props.children)) {
|
|
20
|
-
const { parsedChildren: m, subElementCount: C } = y(
|
|
21
|
-
e.props.children,
|
|
22
|
-
o,
|
|
23
|
-
"",
|
|
24
|
-
p + t
|
|
25
|
-
);
|
|
26
|
-
e = f(e, {
|
|
27
|
-
children: m,
|
|
28
|
-
key: `group-${p + t}`
|
|
29
|
-
}), n.push(e), t += C;
|
|
30
|
-
} else
|
|
31
|
-
n.push(e);
|
|
32
|
-
}), {
|
|
33
|
-
parsedChildren: n,
|
|
34
|
-
subElementCount: t
|
|
1
|
+
import { useCallback as r, useLayoutEffect as n } from "react";
|
|
2
|
+
import { isElementVisible as i, setMaxHeightToAvailableSpace as o } from "./fondue-components37.js";
|
|
3
|
+
function u(t) {
|
|
4
|
+
const e = r(() => {
|
|
5
|
+
requestAnimationFrame(() => {
|
|
6
|
+
t.current && i(t.current) && o(t.current);
|
|
7
|
+
});
|
|
8
|
+
}, [t]);
|
|
9
|
+
return n(() => (e(), window.addEventListener("resize", e), () => {
|
|
10
|
+
window.removeEventListener("resize", e);
|
|
11
|
+
}), [e]), {
|
|
12
|
+
setMaxHeight: e
|
|
35
13
|
};
|
|
36
|
-
}
|
|
14
|
+
}
|
|
37
15
|
export {
|
|
38
|
-
|
|
39
|
-
w as isReactLeaf,
|
|
40
|
-
y as recursiveMap
|
|
16
|
+
u as usePreventDropdownOverflow
|
|
41
17
|
};
|
|
42
18
|
//# sourceMappingURL=fondue-components36.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fondue-components36.js","sources":["../src/
|
|
1
|
+
{"version":3,"file":"fondue-components36.js","sources":["../src/hooks/usePreventDropdownOverflow.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type RefObject, useCallback, useLayoutEffect } from 'react';\n\nimport { isElementVisible, setMaxHeightToAvailableSpace } from '#/utilities/domUtilities';\n\n/**\n * Custom hook to dynamically adjust the maximum height of an HTMLElement\n * based on the window's resize events. This function provides an object\n * containing the `setMaxHeight` method to manually trigger\n * the maximum height adjustment if needed.\n *\n * ! Note: Components utilizing this hook should have tests in place to verify\n * ! that in each scenario, the height is correctly adjusted accodrding to the\n * ! requirements of the component and the viewport.\n *\n * @param {RefObject<HTMLElement | null>} ref - A reference to the HTMLElement.\n * @returns {Object} An object containing `setMaxHeight` method.\n */\nexport function usePreventDropdownOverflow(ref: RefObject<HTMLElement | null>) {\n const setMaxHeight = useCallback(() => {\n requestAnimationFrame(() => {\n if (ref.current && isElementVisible(ref.current)) {\n setMaxHeightToAvailableSpace(ref.current);\n }\n });\n }, [ref]);\n\n useLayoutEffect(() => {\n setMaxHeight();\n window.addEventListener('resize', setMaxHeight);\n return () => {\n window.removeEventListener('resize', setMaxHeight);\n };\n }, [setMaxHeight]);\n\n return {\n setMaxHeight,\n };\n}\n"],"names":["usePreventDropdownOverflow","ref","setMaxHeight","useCallback","isElementVisible","setMaxHeightToAvailableSpace","useLayoutEffect"],"mappings":";;AAmBO,SAASA,EAA2BC,GAAoC;AACrE,QAAAC,IAAeC,EAAY,MAAM;AACnC,0BAAsB,MAAM;AACxB,MAAIF,EAAI,WAAWG,EAAiBH,EAAI,OAAO,KAC3CI,EAA6BJ,EAAI,OAAO;AAAA,IAC5C,CACH;AAAA,EAAA,GACF,CAACA,CAAG,CAAC;AAER,SAAAK,EAAgB,OACCJ,KACN,OAAA,iBAAiB,UAAUA,CAAY,GACvC,MAAM;AACF,WAAA,oBAAoB,UAAUA,CAAY;AAAA,EAAA,IAEtD,CAACA,CAAY,CAAC,GAEV;AAAA,IACH,cAAAA;AAAA,EAAA;AAER;"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
const c = 8;
|
|
2
|
+
function h(n) {
|
|
3
|
+
if (!window)
|
|
4
|
+
throw new Error("Window object not found, this method should be used in a browser environment");
|
|
5
|
+
n.style.maxHeight = "";
|
|
6
|
+
const { top: t, bottom: i } = n.getBoundingClientRect();
|
|
7
|
+
t - 8 < 0 ? n.style.maxHeight = `${i - 8}px` : i + 8 > window.innerHeight && (n.style.maxHeight = `${window.innerHeight - t - 8}px`);
|
|
8
|
+
}
|
|
9
|
+
function r(n) {
|
|
10
|
+
const t = n.getBoundingClientRect(), i = t.width > 0 && t.height > 0, e = window.getComputedStyle(n), o = e.display !== "none" && e.visibility !== "hidden" && parseFloat(e.opacity) !== 0, s = t.top < window.innerHeight && t.left < window.innerWidth && t.bottom > 0 && t.right > 0;
|
|
11
|
+
return i && o && s;
|
|
12
|
+
}
|
|
13
|
+
function H(n, t) {
|
|
14
|
+
t && (typeof t == "function" ? t(n.current) : t && "current" in t && (t.current = n.current));
|
|
15
|
+
}
|
|
16
|
+
export {
|
|
17
|
+
c as MAX_HEIGHT_MARGIN,
|
|
18
|
+
r as isElementVisible,
|
|
19
|
+
h as setMaxHeightToAvailableSpace,
|
|
20
|
+
H as syncRefs
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=fondue-components37.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fondue-components37.js","sources":["../src/utilities/domUtilities.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type ForwardedRef, type RefObject } from 'react';\n\nexport const MAX_HEIGHT_MARGIN = 8;\n\n/**\n * Sets the maximum height for a dialog element based on its position on the viewport.\n * The function calculates the space below the dialog up to the bottom of the viewport window,\n * subtracting a default margin, and sets this value as the max-height style of the dialog.\n *\n * @param {HTMLElement} dialog - The dialog element whose maximum height is to be set.\n *\n * @example\n * // Suppose you have a dialog element with id 'my-dialog'.\n * const dialogElement = myDialogRef.current || document.getElementById('my-dialog');\n * // Setting its max height relative to its current position and the viewport's dimensions.\n * setMaxHeightToAvailableSpace(dialogElement);\n */\nexport function setMaxHeightToAvailableSpace(dialog: HTMLElement) {\n if (!window) {\n throw new Error('Window object not found, this method should be used in a browser environment');\n }\n\n dialog.style.maxHeight = '';\n\n const { top, bottom } = dialog.getBoundingClientRect();\n if (top - MAX_HEIGHT_MARGIN < 0) {\n // if the dialog is overflowing to the top\n dialog.style.maxHeight = `${bottom - MAX_HEIGHT_MARGIN}px`;\n } else if (bottom + MAX_HEIGHT_MARGIN > window.innerHeight) {\n // if the dialog is overflowing to the bottom\n dialog.style.maxHeight = `${window.innerHeight - top - MAX_HEIGHT_MARGIN}px`;\n }\n}\n\n/**\n * Checks if a specified HTML element is visible within the viewport.\n * Visibility is determined by several factors:\n * - The element must have non-zero dimensions.\n * - The element's computed style must not be `display: none`, `visibility: hidden`, or `opacity: 0`.\n * - The element must be within the bounds of the current viewport.\n *\n * @param {HTMLElement} element - The HTML element to check for visibility.\n * @returns {boolean} Returns true if the element is visible according to the criteria specified, otherwise returns false.\n */\nexport function isElementVisible(element: HTMLElement) {\n const rect = element.getBoundingClientRect();\n const hasSize = rect.width > 0 && rect.height > 0;\n\n const style = window.getComputedStyle(element);\n const isVisibleStyle = style.display !== 'none' && style.visibility !== 'hidden' && parseFloat(style.opacity) !== 0;\n\n // Check if the element is within the viewport\n const isInViewport =\n rect.top < window.innerHeight && rect.left < window.innerWidth && rect.bottom > 0 && rect.right > 0;\n\n return hasSize && isVisibleStyle && isInViewport;\n}\n\n/**\n * Assigns a local DOM ref to a forwarded ref.\n *\n * @param {RefObject<HTMLDivElement>} localRef - The local React reference to an HTMLDivElement.\n * @param {ForwardedRef<HTMLDivElement>} forwardedRef - The ref forwarded from a parent component.\n */\nexport function syncRefs(localRef: RefObject<HTMLDivElement>, forwardedRef: ForwardedRef<HTMLDivElement>) {\n if (!forwardedRef) {\n return;\n }\n\n if (typeof forwardedRef === 'function') {\n forwardedRef(localRef.current);\n } else if (forwardedRef && 'current' in forwardedRef) {\n forwardedRef.current = localRef.current;\n }\n}\n"],"names":["MAX_HEIGHT_MARGIN","setMaxHeightToAvailableSpace","dialog","top","bottom","isElementVisible","element","rect","hasSize","style","isVisibleStyle","isInViewport","syncRefs","localRef","forwardedRef"],"mappings":"AAIO,MAAMA,IAAoB;AAe1B,SAASC,EAA6BC,GAAqB;AAC9D,MAAI,CAAC;AACK,UAAA,IAAI,MAAM,8EAA8E;AAGlG,EAAAA,EAAO,MAAM,YAAY;AAEzB,QAAM,EAAE,KAAAC,GAAK,QAAAC,EAAO,IAAIF,EAAO,sBAAsB;AACjD,EAAAC,IAAM,IAAoB,IAE1BD,EAAO,MAAM,YAAY,GAAGE,IAAS,CAAiB,OAC/CA,IAAS,IAAoB,OAAO,gBAE3CF,EAAO,MAAM,YAAY,GAAG,OAAO,cAAcC,IAAM,CAAiB;AAEhF;AAYO,SAASE,EAAiBC,GAAsB;AAC7C,QAAAC,IAAOD,EAAQ,yBACfE,IAAUD,EAAK,QAAQ,KAAKA,EAAK,SAAS,GAE1CE,IAAQ,OAAO,iBAAiBH,CAAO,GACvCI,IAAiBD,EAAM,YAAY,UAAUA,EAAM,eAAe,YAAY,WAAWA,EAAM,OAAO,MAAM,GAG5GE,IACFJ,EAAK,MAAM,OAAO,eAAeA,EAAK,OAAO,OAAO,cAAcA,EAAK,SAAS,KAAKA,EAAK,QAAQ;AAEtG,SAAOC,KAAWE,KAAkBC;AACxC;AAQgB,SAAAC,EAASC,GAAqCC,GAA4C;AACtG,EAAKA,MAID,OAAOA,KAAiB,aACxBA,EAAaD,EAAS,OAAO,IACtBC,KAAgB,aAAaA,MACpCA,EAAa,UAAUD,EAAS;AAExC;"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
const t = "_content_5bz3o_4", o = "_subContent_5bz3o_5", n = "_item_5bz3o_15", s = "_subTrigger_5bz3o_16", _ = "_subMenuIndicator_5bz3o_52", e = "_group_5bz3o_58", b = "_slot_5bz3o_65", u = {
|
|
2
|
+
content: t,
|
|
3
|
+
subContent: o,
|
|
4
|
+
item: n,
|
|
5
|
+
subTrigger: s,
|
|
6
|
+
subMenuIndicator: _,
|
|
7
|
+
group: e,
|
|
8
|
+
slot: b
|
|
9
|
+
};
|
|
10
|
+
export {
|
|
11
|
+
t as content,
|
|
12
|
+
u as default,
|
|
13
|
+
e as group,
|
|
14
|
+
n as item,
|
|
15
|
+
b as slot,
|
|
16
|
+
o as subContent,
|
|
17
|
+
_ as subMenuIndicator,
|
|
18
|
+
s as subTrigger
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=fondue-components38.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fondue-components38.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;"}
|