@frontify/fondue-components 15.0.1 → 16.0.3
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-components10.js +92 -85
- package/dist/fondue-components10.js.map +1 -1
- package/dist/fondue-components12.js +39 -35
- package/dist/fondue-components12.js.map +1 -1
- package/dist/fondue-components21.js +47 -45
- package/dist/fondue-components21.js.map +1 -1
- package/dist/fondue-components24.js +51 -51
- package/dist/fondue-components25.js +4 -4
- package/dist/fondue-components25.js.map +1 -1
- package/dist/fondue-components29.js +19 -19
- package/dist/fondue-components3.js +49 -51
- package/dist/fondue-components3.js.map +1 -1
- package/dist/fondue-components30.js +4 -8
- package/dist/fondue-components30.js.map +1 -1
- package/dist/fondue-components31.js +5 -5
- package/dist/fondue-components38.js +15 -15
- package/dist/fondue-components39.js +31 -28
- package/dist/fondue-components39.js.map +1 -1
- package/dist/fondue-components40.js +13 -13
- package/dist/fondue-components42.js +15 -15
- package/dist/fondue-components42.js.map +1 -1
- package/dist/fondue-components54.js +4 -6
- package/dist/fondue-components54.js.map +1 -1
- package/dist/fondue-components57.js +3 -3
- package/dist/fondue-components59.js +43 -41
- package/dist/fondue-components59.js.map +1 -1
- package/dist/fondue-components6.js +3 -3
- package/dist/fondue-components61.js +42 -38
- package/dist/fondue-components61.js.map +1 -1
- package/dist/fondue-components64.js +13 -13
- package/dist/fondue-components66.js +9 -9
- package/dist/fondue-components7.js +37 -34
- package/dist/fondue-components7.js.map +1 -1
- package/dist/fondue-components73.js +6 -9
- package/dist/fondue-components73.js.map +1 -1
- package/dist/fondue-components77.js +6 -6
- package/dist/fondue-components8.js +3 -3
- package/dist/index.d.ts +42 -8
- package/dist/style.css +1 -1
- package/package.json +54 -54
|
@@ -1,94 +1,92 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as a, jsxs as p } from "react/jsx-runtime";
|
|
2
2
|
import { IconCaretDown as A } from "@frontify/fondue-icons";
|
|
3
|
-
import * as
|
|
4
|
-
import
|
|
5
|
-
const
|
|
3
|
+
import * as n from "@radix-ui/react-accordion";
|
|
4
|
+
import d from "./fondue-components30.js";
|
|
5
|
+
const c = ({
|
|
6
6
|
"data-test-id": t = "fondue-accordion",
|
|
7
7
|
border: o = !0,
|
|
8
8
|
children: e,
|
|
9
|
-
defaultValue:
|
|
10
|
-
disabled:
|
|
11
|
-
value:
|
|
12
|
-
}) => /* @__PURE__ */
|
|
13
|
-
|
|
9
|
+
defaultValue: i,
|
|
10
|
+
disabled: r,
|
|
11
|
+
value: u
|
|
12
|
+
}) => /* @__PURE__ */ a(
|
|
13
|
+
n.Root,
|
|
14
14
|
{
|
|
15
|
-
className:
|
|
15
|
+
className: d.root,
|
|
16
16
|
"data-test-id": t,
|
|
17
|
-
defaultValue:
|
|
18
|
-
disabled:
|
|
17
|
+
defaultValue: i,
|
|
18
|
+
disabled: r,
|
|
19
19
|
type: "multiple",
|
|
20
|
-
value:
|
|
20
|
+
value: u,
|
|
21
21
|
"data-border": o,
|
|
22
22
|
children: e
|
|
23
23
|
}
|
|
24
24
|
);
|
|
25
|
-
|
|
26
|
-
const
|
|
25
|
+
c.displayName = "Accordion.Root";
|
|
26
|
+
const s = ({
|
|
27
27
|
"data-test-id": t = "fondue-accordion-item",
|
|
28
28
|
children: o,
|
|
29
29
|
disabled: e,
|
|
30
|
-
onClick: d,
|
|
31
30
|
value: i
|
|
32
|
-
}) => /* @__PURE__ */
|
|
33
|
-
|
|
31
|
+
}) => /* @__PURE__ */ a(
|
|
32
|
+
n.Item,
|
|
34
33
|
{
|
|
35
|
-
className:
|
|
34
|
+
className: d.accordionItem,
|
|
36
35
|
value: i,
|
|
37
|
-
onPointerDown: (
|
|
38
|
-
|
|
36
|
+
onPointerDown: (r) => {
|
|
37
|
+
r.currentTarget.dataset.showFocusRing = "false";
|
|
39
38
|
},
|
|
40
|
-
onBlur: (
|
|
41
|
-
|
|
39
|
+
onBlur: (r) => {
|
|
40
|
+
r.currentTarget.dataset.showFocusRing = "true";
|
|
42
41
|
},
|
|
43
|
-
onClick: d,
|
|
44
42
|
disabled: e,
|
|
45
43
|
"data-test-id": t,
|
|
46
44
|
children: o
|
|
47
45
|
}
|
|
48
46
|
);
|
|
49
|
-
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
const
|
|
47
|
+
s.displayName = "Accordion.Item";
|
|
48
|
+
const m = ({ onClick: t, children: o }) => /* @__PURE__ */ a(n.Header, { onClick: t, children: o });
|
|
49
|
+
m.displayName = "Accordion.Header";
|
|
50
|
+
const l = ({
|
|
53
51
|
"data-test-id": t = "fondue-accordion-trigger",
|
|
54
52
|
asChild: o,
|
|
55
53
|
children: e
|
|
56
|
-
}) => /* @__PURE__ */ p(
|
|
54
|
+
}) => /* @__PURE__ */ p(n.Trigger, { asChild: o, className: d.accordionTrigger, "data-test-id": t, children: [
|
|
57
55
|
e,
|
|
58
|
-
/* @__PURE__ */
|
|
56
|
+
/* @__PURE__ */ a(A, { className: d.accordionCaret, size: "16" })
|
|
59
57
|
] });
|
|
60
|
-
|
|
61
|
-
const
|
|
58
|
+
l.displayName = "Accordion.Trigger";
|
|
59
|
+
const g = ({
|
|
62
60
|
"data-test-id": t = "collapsible-wrap",
|
|
63
61
|
children: o,
|
|
64
62
|
divider: e = !1,
|
|
65
|
-
onClick:
|
|
66
|
-
padding:
|
|
67
|
-
}) => /* @__PURE__ */
|
|
68
|
-
|
|
63
|
+
onClick: i,
|
|
64
|
+
padding: r = "large"
|
|
65
|
+
}) => /* @__PURE__ */ a(
|
|
66
|
+
n.Content,
|
|
69
67
|
{
|
|
70
|
-
className:
|
|
71
|
-
onClick:
|
|
68
|
+
className: d.accordionContent,
|
|
69
|
+
onClick: i,
|
|
72
70
|
"data-test-id": t,
|
|
73
|
-
"data-item-padding":
|
|
71
|
+
"data-item-padding": r,
|
|
74
72
|
"data-item-divider": e,
|
|
75
|
-
children: /* @__PURE__ */
|
|
73
|
+
children: /* @__PURE__ */ a("div", { className: d.accordionContentText, "data-test-id": `inner-${t}`, children: o })
|
|
76
74
|
}
|
|
77
75
|
);
|
|
78
|
-
|
|
76
|
+
g.displayName = "Accordion.Content";
|
|
79
77
|
const y = {
|
|
80
|
-
Root:
|
|
81
|
-
Item:
|
|
82
|
-
Header:
|
|
83
|
-
Trigger:
|
|
84
|
-
Content:
|
|
78
|
+
Root: c,
|
|
79
|
+
Item: s,
|
|
80
|
+
Header: m,
|
|
81
|
+
Trigger: l,
|
|
82
|
+
Content: g
|
|
85
83
|
};
|
|
86
84
|
export {
|
|
87
85
|
y as Accordion,
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
86
|
+
g as AccordionContent,
|
|
87
|
+
m as AccordionHeader,
|
|
88
|
+
s as AccordionItem,
|
|
89
|
+
c as AccordionRoot,
|
|
90
|
+
l as AccordionTrigger
|
|
93
91
|
};
|
|
94
92
|
//# sourceMappingURL=fondue-components3.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fondue-components3.js","sources":["../src/components/Accordion/Accordion.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { IconCaretDown } from '@frontify/fondue-icons';\nimport * as RadixAccordion from '@radix-ui/react-accordion';\nimport { type MouseEventHandler, type ReactNode } from 'react';\n\nimport styles from './styles/accordion.module.scss';\n\ntype AccordionPadding = 'none' | 'small' | 'medium' | 'large';\n\nexport type AccordionRootProps = {\n 'data-test-id'?: string;\n /**\n * Show or hide the top and bottom border\n * @default true\n */\n border?: boolean;\n /**\n * Children of the Accordion component. This should contain the `Accordion.Item` components\n */\n children?: ReactNode;\n /**\n * The value of the items whose contents are expanded when the accordion is initially rendered.\n * Use `defaultValue` if you do not need to control the state of an accordion.\n */\n defaultValue?: string[];\n /**\n * Whether or not an accordion is disabled from user interaction.\n */\n disabled?: boolean;\n /**\n * The controlled stateful value of the accordion items whose contents are expanded.\n */\n value?: string[];\n};\n\nexport const AccordionRoot = ({\n 'data-test-id': dataTestId = 'fondue-accordion',\n border = true,\n children,\n defaultValue,\n disabled,\n value,\n}: AccordionRootProps) => {\n return (\n <RadixAccordion.Root\n className={styles.root}\n data-test-id={dataTestId}\n defaultValue={defaultValue}\n disabled={disabled}\n type=\"multiple\"\n value={value}\n data-border={border}\n >\n {children}\n </RadixAccordion.Root>\n );\n};\nAccordionRoot.displayName = 'Accordion.Root';\n\nexport type AccordionItemProps = {\n 'data-test-id'?: string;\n /**\n * Children of the Accordion item. This should contain the `Accordion.Header` and `Accordion.Content` components\n */\n children?: ReactNode;\n /**\n * Whether or not an accordion item is disabled from user interaction.\n *\n * @default false\n */\n disabled?: boolean;\n /**\n *
|
|
1
|
+
{"version":3,"file":"fondue-components3.js","sources":["../src/components/Accordion/Accordion.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { IconCaretDown } from '@frontify/fondue-icons';\nimport * as RadixAccordion from '@radix-ui/react-accordion';\nimport { type MouseEventHandler, type ReactNode } from 'react';\n\nimport styles from './styles/accordion.module.scss';\n\ntype AccordionPadding = 'none' | 'small' | 'medium' | 'large';\n\nexport type AccordionRootProps = {\n 'data-test-id'?: string;\n /**\n * Show or hide the top and bottom border\n * @default true\n */\n border?: boolean;\n /**\n * Children of the Accordion component. This should contain the `Accordion.Item` components\n */\n children?: ReactNode;\n /**\n * The value of the items whose contents are expanded when the accordion is initially rendered.\n * Use `defaultValue` if you do not need to control the state of an accordion.\n */\n defaultValue?: string[];\n /**\n * Whether or not an accordion is disabled from user interaction.\n */\n disabled?: boolean;\n /**\n * The controlled stateful value of the accordion items whose contents are expanded.\n */\n value?: string[];\n};\n\nexport const AccordionRoot = ({\n 'data-test-id': dataTestId = 'fondue-accordion',\n border = true,\n children,\n defaultValue,\n disabled,\n value,\n}: AccordionRootProps) => {\n return (\n <RadixAccordion.Root\n className={styles.root}\n data-test-id={dataTestId}\n defaultValue={defaultValue}\n disabled={disabled}\n type=\"multiple\"\n value={value}\n data-border={border}\n >\n {children}\n </RadixAccordion.Root>\n );\n};\nAccordionRoot.displayName = 'Accordion.Root';\n\nexport type AccordionItemProps = {\n 'data-test-id'?: string;\n /**\n * Children of the Accordion item. This should contain the `Accordion.Header` and `Accordion.Content` components\n */\n children?: ReactNode;\n /**\n * Whether or not an accordion item is disabled from user interaction.\n *\n * @default false\n */\n disabled?: boolean;\n /**\n * A string value for the accordion item. All items within an accordion should use a unique value.\n */\n value: string;\n};\n\nexport const AccordionItem = ({\n 'data-test-id': dataTestId = 'fondue-accordion-item',\n children,\n disabled,\n value,\n}: AccordionItemProps) => {\n return (\n <RadixAccordion.Item\n className={styles.accordionItem}\n value={value}\n onPointerDown={(event) => {\n event.currentTarget.dataset.showFocusRing = 'false';\n }}\n onBlur={(event) => {\n event.currentTarget.dataset.showFocusRing = 'true';\n }}\n disabled={disabled}\n data-test-id={dataTestId}\n >\n {children}\n </RadixAccordion.Item>\n );\n};\nAccordionItem.displayName = 'Accordion.Item';\n\nexport type AccordionHeaderProps = {\n /**\n * Click callback for this item.\n */\n onClick?: MouseEventHandler<HTMLDivElement>;\n /**\n * Children of the Accordion header. This should contain `Accordion.Trigger`\n */\n children?: ReactNode;\n};\n\nexport const AccordionHeader = ({ onClick, children }: AccordionHeaderProps) => {\n return <RadixAccordion.Header onClick={onClick}>{children}</RadixAccordion.Header>;\n};\nAccordionHeader.displayName = 'Accordion.Header';\n\nexport type AccordionTriggerProps = {\n 'data-test-id'?: string;\n /**\n * Change the default rendered element for the one passed as a child, merging their props and behavior.\n * @default false\n */\n asChild?: boolean;\n /**\n * Children of the Accordion trigger. This contains the actually clickable and visible header content\n */\n children?: ReactNode;\n};\n\nexport const AccordionTrigger = ({\n 'data-test-id': dataTestId = 'fondue-accordion-trigger',\n asChild,\n children,\n}: AccordionTriggerProps) => {\n return (\n <RadixAccordion.Trigger asChild={asChild} className={styles.accordionTrigger} data-test-id={dataTestId}>\n {children}\n <IconCaretDown className={styles.accordionCaret} size=\"16\" />\n </RadixAccordion.Trigger>\n );\n};\nAccordionTrigger.displayName = 'Accordion.Trigger';\n\ntype AccordionContentProps = {\n 'data-test-id'?: string;\n /**\n * Children of the Accordion content. This contains the main content.\n */\n children?: ReactNode;\n /**\n * Adds a divider line between the header and the content.\n */\n divider?: boolean;\n /**\n * Click callback for the content.\n */\n onClick?: MouseEventHandler<HTMLDivElement>;\n /**\n * Controls if we show paddings around the content.\n * @default 'large'\n */\n padding?: AccordionPadding;\n};\n\nexport const AccordionContent = ({\n 'data-test-id': dataTestId = 'collapsible-wrap',\n children,\n divider = false,\n onClick,\n padding = 'large',\n}: AccordionContentProps) => {\n return (\n <RadixAccordion.Content\n className={styles.accordionContent}\n onClick={onClick}\n data-test-id={dataTestId}\n data-item-padding={padding}\n data-item-divider={divider}\n >\n <div className={styles.accordionContentText} data-test-id={`inner-${dataTestId}`}>\n {children}\n </div>\n </RadixAccordion.Content>\n );\n};\nAccordionContent.displayName = 'Accordion.Content';\n\nexport const Accordion = {\n Root: AccordionRoot,\n Item: AccordionItem,\n Header: AccordionHeader,\n Trigger: AccordionTrigger,\n Content: AccordionContent,\n};\n"],"names":["AccordionRoot","dataTestId","border","children","defaultValue","disabled","value","jsx","RadixAccordion","styles","AccordionItem","event","AccordionHeader","onClick","AccordionTrigger","asChild","jsxs","IconCaretDown","AccordionContent","divider","padding","Accordion"],"mappings":";;;;AAoCO,MAAMA,IAAgB,CAAC;AAAA,EAC1B,gBAAgBC,IAAa;AAAA,EAC7B,QAAAC,IAAS;AAAA,EACT,UAAAC;AAAA,EACA,cAAAC;AAAA,EACA,UAAAC;AAAA,EACA,OAAAC;AACJ,MAEQ,gBAAAC;AAAA,EAACC,EAAe;AAAA,EAAf;AAAA,IACG,WAAWC,EAAO;AAAA,IAClB,gBAAcR;AAAA,IACd,cAAAG;AAAA,IACA,UAAAC;AAAA,IACA,MAAK;AAAA,IACL,OAAAC;AAAA,IACA,eAAaJ;AAAA,IAEZ,UAAAC;AAAA,EAAA;AACL;AAGRH,EAAc,cAAc;AAoBrB,MAAMU,IAAgB,CAAC;AAAA,EAC1B,gBAAgBT,IAAa;AAAA,EAC7B,UAAAE;AAAA,EACA,UAAAE;AAAA,EACA,OAAAC;AACJ,MAEQ,gBAAAC;AAAA,EAACC,EAAe;AAAA,EAAf;AAAA,IACG,WAAWC,EAAO;AAAA,IAClB,OAAAH;AAAA,IACA,eAAe,CAACK,MAAU;AAChB,MAAAA,EAAA,cAAc,QAAQ,gBAAgB;AAAA,IAChD;AAAA,IACA,QAAQ,CAACA,MAAU;AACT,MAAAA,EAAA,cAAc,QAAQ,gBAAgB;AAAA,IAChD;AAAA,IACA,UAAAN;AAAA,IACA,gBAAcJ;AAAA,IAEb,UAAAE;AAAA,EAAA;AACL;AAGRO,EAAc,cAAc;AAarB,MAAME,IAAkB,CAAC,EAAE,SAAAC,GAAS,UAAAV,QAC/B,gBAAAI,EAAAC,EAAe,QAAf,EAAsB,SAAAK,GAAmB,UAAAV,EAAS,CAAA;AAE9DS,EAAgB,cAAc;AAevB,MAAME,IAAmB,CAAC;AAAA,EAC7B,gBAAgBb,IAAa;AAAA,EAC7B,SAAAc;AAAA,EACA,UAAAZ;AACJ,MAEQ,gBAAAa,EAACR,EAAe,SAAf,EAAuB,SAAAO,GAAkB,WAAWN,EAAO,kBAAkB,gBAAcR,GACvF,UAAA;AAAA,EAAAE;AAAA,oBACAc,GAAc,EAAA,WAAWR,EAAO,gBAAgB,MAAK,KAAK,CAAA;AAAA,GAC/D;AAGRK,EAAiB,cAAc;AAuBxB,MAAMI,IAAmB,CAAC;AAAA,EAC7B,gBAAgBjB,IAAa;AAAA,EAC7B,UAAAE;AAAA,EACA,SAAAgB,IAAU;AAAA,EACV,SAAAN;AAAA,EACA,SAAAO,IAAU;AACd,MAEQ,gBAAAb;AAAA,EAACC,EAAe;AAAA,EAAf;AAAA,IACG,WAAWC,EAAO;AAAA,IAClB,SAAAI;AAAA,IACA,gBAAcZ;AAAA,IACd,qBAAmBmB;AAAA,IACnB,qBAAmBD;AAAA,IAEnB,UAAA,gBAAAZ,EAAC,SAAI,WAAWE,EAAO,sBAAsB,gBAAc,SAASR,CAAU,IACzE,UAAAE,EACL,CAAA;AAAA,EAAA;AACJ;AAGRe,EAAiB,cAAc;AAExB,MAAMG,IAAY;AAAA,EACrB,MAAMrB;AAAA,EACN,MAAMU;AAAA,EACN,QAAQE;AAAA,EACR,SAASE;AAAA,EACT,SAASI;AACb;"}
|
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
const o = "_root_1f8r4_2", c = "_accordionItem_1f8r4_7", n = "_accordionTrigger_1f8r4_13", r = "_accordionCaret_1f8r4_31", t = "_accordionContent_1f8r4_35", e = "_accordionContentText_1f8r4_62",
|
|
1
|
+
const o = "_root_1f8r4_2", c = "_accordionItem_1f8r4_7", n = "_accordionTrigger_1f8r4_13", r = "_accordionCaret_1f8r4_31", t = "_accordionContent_1f8r4_35", e = "_accordionContentText_1f8r4_62", a = {
|
|
2
2
|
root: o,
|
|
3
3
|
accordionItem: c,
|
|
4
4
|
accordionTrigger: n,
|
|
5
5
|
accordionCaret: r,
|
|
6
6
|
accordionContent: t,
|
|
7
|
-
accordionContentText: e
|
|
8
|
-
slideDown: i,
|
|
9
|
-
slideUp: _
|
|
7
|
+
accordionContentText: e
|
|
10
8
|
};
|
|
11
9
|
export {
|
|
12
10
|
r as accordionCaret,
|
|
@@ -14,9 +12,7 @@ export {
|
|
|
14
12
|
e as accordionContentText,
|
|
15
13
|
c as accordionItem,
|
|
16
14
|
n as accordionTrigger,
|
|
17
|
-
|
|
18
|
-
o as root
|
|
19
|
-
i as slideDown,
|
|
20
|
-
_ as slideUp
|
|
15
|
+
a as default,
|
|
16
|
+
o as root
|
|
21
17
|
};
|
|
22
18
|
//# sourceMappingURL=fondue-components30.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fondue-components30.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"fondue-components30.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;"}
|
|
@@ -18,15 +18,15 @@ const g = (n) => n.startsWith("aria-") || n === "role", s = {
|
|
|
18
18
|
wrap: "flex-wrap",
|
|
19
19
|
columns: "grid-template-columns",
|
|
20
20
|
rows: "grid-template-rows"
|
|
21
|
-
}, m = (n, r) => n === "columns" || n === "rows" ? typeof r == "number" ? `repeat(${r}, 1fr)` : r : typeof r == "number" ? `${r * 0.25}rem` : r, f = (n, r = {}) => Object.entries(n).reduce((i, [t,
|
|
21
|
+
}, m = (n, r) => n === "columns" || n === "rows" ? typeof r == "number" ? `repeat(${r}, 1fr)` : r : typeof r == "number" ? `${r * 0.25}rem` : r, f = (n, r = {}) => Object.entries(n).reduce((i, [t, o]) => {
|
|
22
22
|
if (g(t))
|
|
23
23
|
return i;
|
|
24
|
-
const
|
|
25
|
-
if (typeof
|
|
26
|
-
for (const [d, a] of Object.entries(
|
|
24
|
+
const e = t in r ? r[t] : t in s ? s[t] : t, p = e == null ? void 0 : e.replaceAll(/([\da-z]|(?=[A-Z]))([A-Z])/g, "$1-$2").toLowerCase();
|
|
25
|
+
if (typeof o == "object")
|
|
26
|
+
for (const [d, a] of Object.entries(o))
|
|
27
27
|
a !== void 0 && (i[`--${d}-${p}`] = m(t, a));
|
|
28
28
|
else
|
|
29
|
-
i[`--${p}`] = m(t,
|
|
29
|
+
i[`--${p}`] = m(t, o);
|
|
30
30
|
return i;
|
|
31
31
|
}, {});
|
|
32
32
|
export {
|
|
@@ -1,35 +1,35 @@
|
|
|
1
1
|
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import { RgbaColorPicker as
|
|
2
|
+
import { forwardRef as m } from "react";
|
|
3
|
+
import { RgbaColorPicker as n } from "react-colorful";
|
|
4
4
|
import t from "./fondue-components41.js";
|
|
5
5
|
import { DEFAULT_COLOR as s } from "./fondue-components42.js";
|
|
6
6
|
const i = ({
|
|
7
|
-
currentColor:
|
|
7
|
+
currentColor: a = s,
|
|
8
8
|
onColorChange: d = () => {
|
|
9
9
|
},
|
|
10
10
|
"data-test-id": o = "color-picker-input"
|
|
11
11
|
}, p) => /* @__PURE__ */ r("div", { className: t.gradientInput, "data-test-id": o, ref: p, children: /* @__PURE__ */ r(
|
|
12
|
-
|
|
12
|
+
n,
|
|
13
13
|
{
|
|
14
14
|
className: t.reactColorful,
|
|
15
15
|
color: {
|
|
16
|
-
r:
|
|
17
|
-
g:
|
|
18
|
-
b:
|
|
19
|
-
a:
|
|
16
|
+
r: a.red,
|
|
17
|
+
g: a.green,
|
|
18
|
+
b: a.blue,
|
|
19
|
+
a: a.alpha === void 0 ? 1 : a.alpha
|
|
20
20
|
},
|
|
21
|
-
onChange: (
|
|
22
|
-
red:
|
|
23
|
-
green:
|
|
24
|
-
blue:
|
|
25
|
-
alpha:
|
|
21
|
+
onChange: (e) => d({
|
|
22
|
+
red: e.r,
|
|
23
|
+
green: e.g,
|
|
24
|
+
blue: e.b,
|
|
25
|
+
alpha: e.a
|
|
26
26
|
})
|
|
27
27
|
}
|
|
28
28
|
) });
|
|
29
29
|
i.displayName = "ColorPicker.Gradient";
|
|
30
|
-
const
|
|
30
|
+
const c = m(i);
|
|
31
31
|
export {
|
|
32
32
|
i as ColorGradientInput,
|
|
33
|
-
|
|
33
|
+
c as ForwardedRefColorGradientInput
|
|
34
34
|
};
|
|
35
35
|
//# sourceMappingURL=fondue-components38.js.map
|
|
@@ -1,40 +1,43 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { IconDroplet as
|
|
1
|
+
import { jsxs as s, jsx as e, Fragment as N } from "react/jsx-runtime";
|
|
2
|
+
import { IconDroplet as h, IconCross as f, IconCaretDown as I } from "@frontify/fondue-icons";
|
|
3
3
|
import { forwardRef as b } from "react";
|
|
4
|
-
import
|
|
5
|
-
import { colorToCss as
|
|
4
|
+
import t from "./fondue-components77.js";
|
|
5
|
+
import { getColorWithName as v, colorToCss as k } from "./fondue-components42.js";
|
|
6
6
|
const o = ({
|
|
7
7
|
id: c,
|
|
8
|
-
currentColor:
|
|
8
|
+
currentColor: a,
|
|
9
9
|
isOpen: d,
|
|
10
10
|
onClear: i,
|
|
11
11
|
onClick: l,
|
|
12
|
-
"data-test-id":
|
|
13
|
-
...
|
|
14
|
-
},
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
"
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
/* @__PURE__ */
|
|
12
|
+
"data-test-id": m = "color-picker-input",
|
|
13
|
+
...n
|
|
14
|
+
}, r) => {
|
|
15
|
+
const p = (a == null ? void 0 : a.name) ?? (a ? v(a, "RGBA").name : "");
|
|
16
|
+
return /* @__PURE__ */ s("div", { id: c, className: t.root, ref: r, "data-test-id": m, children: [
|
|
17
|
+
/* @__PURE__ */ s("button", { className: t.button, ...n, onClick: l, type: "button", "data-color-input-select": !0, children: [
|
|
18
|
+
(a == null ? void 0 : a.red) !== void 0 ? /* @__PURE__ */ e(
|
|
19
|
+
"div",
|
|
20
|
+
{
|
|
21
|
+
"aria-hidden": !0,
|
|
22
|
+
className: t.colorIndicator,
|
|
23
|
+
style: { "--active-color": k(a) }
|
|
24
|
+
}
|
|
25
|
+
) : /* @__PURE__ */ s(N, { children: [
|
|
26
|
+
/* @__PURE__ */ e(h, { size: 16 }),
|
|
27
|
+
/* @__PURE__ */ e("span", { children: "Select Color" })
|
|
28
|
+
] }),
|
|
29
|
+
/* @__PURE__ */ e("span", { className: t.colorName, children: p })
|
|
26
30
|
] }),
|
|
27
|
-
/* @__PURE__ */
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
] });
|
|
31
|
+
/* @__PURE__ */ s("div", { className: t.actions, children: [
|
|
32
|
+
i && /* @__PURE__ */ e("button", { type: "button", "aria-label": "Clear color", onClick: i, className: t.clear, children: /* @__PURE__ */ e(f, { size: 16 }) }),
|
|
33
|
+
/* @__PURE__ */ e("div", { className: t.caret, "data-state": d ? "open" : "closed", children: /* @__PURE__ */ e(I, { size: 16, className: t.caret }) })
|
|
34
|
+
] })
|
|
35
|
+
] });
|
|
36
|
+
};
|
|
34
37
|
o.displayName = "ColorPicker.Input";
|
|
35
|
-
const
|
|
38
|
+
const R = b(o);
|
|
36
39
|
export {
|
|
37
40
|
o as ColorPickerInput,
|
|
38
|
-
|
|
41
|
+
R as ForwardedRefColorPickerInput
|
|
39
42
|
};
|
|
40
43
|
//# sourceMappingURL=fondue-components39.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fondue-components39.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 ForwardedRef, forwardRef } from 'react';\n\nimport { type CommonAriaAttrs } from '#/utilities/types';\n\nimport styles from './styles/colorInput.module.scss';\nimport { type RgbaColor } from './types';\nimport { colorToCss } 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 dermine arrow state\n */\n isOpen?: 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 onClear,\n onClick,\n 'data-test-id': dataTestId = 'color-picker-input',\n ...props\n }: ColorPickerInputProps,\n forwardedRef: ForwardedRef<HTMLDivElement>,\n) => {\n return (\n <div id={id} className={styles.root}
|
|
1
|
+
{"version":3,"file":"fondue-components39.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 { type CommonAriaAttrs } from '#/utilities/types';\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 dermine arrow state\n */\n isOpen?: 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 onClear,\n onClick,\n 'data-test-id': dataTestId = 'color-picker-input',\n ...props\n }: ColorPickerInputProps,\n forwardedRef: ForwardedRef<HTMLDivElement>,\n) => {\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 className={styles.button} {...props} onClick={onClick} type=\"button\" data-color-input-select>\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>Select Color</span>\n </>\n )}\n\n <span className={styles.colorName}>{colorName}</span>\n </button>\n <div className={styles.actions}>\n {onClear && (\n <button type=\"button\" aria-label=\"Clear color\" onClick={onClear} className={styles.clear}>\n <IconCross 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","onClear","onClick","dataTestId","props","forwardedRef","colorName","getColorWithName","jsxs","styles","jsx","colorToCss","Fragment","IconDroplet","IconCross","IconCaretDown","ForwardedRefColorPickerInput","forwardRef"],"mappings":";;;;;AAmCO,MAAMA,IAAmB,CAC5B;AAAA,EACI,IAAAC;AAAA,EACA,cAAAC;AAAA,EACA,QAAAC;AAAA,EACA,SAAAC;AAAA,EACA,SAAAC;AAAA,EACA,gBAAgBC,IAAa;AAAA,EAC7B,GAAGC;AACP,GACAC,MACC;AACK,QAAAC,KAAYP,KAAA,gBAAAA,EAAc,UAASA,IAAeQ,EAAiBR,GAAc,MAAM,EAAE,OAAO;AAElG,SAAA,gBAAAS,EAAC,SAAI,IAAAV,GAAQ,WAAWW,EAAO,MAAM,KAAKJ,GAAc,gBAAcF,GAClE,UAAA;AAAA,IAAC,gBAAAK,EAAA,UAAA,EAAO,WAAWC,EAAO,QAAS,GAAGL,GAAO,SAAAF,GAAkB,MAAK,UAAS,2BAAuB,IAC/F,UAAA;AAAA,OAAAH,KAAA,gBAAAA,EAAc,SAAQ,SACnB,gBAAAW;AAAA,QAAC;AAAA,QAAA;AAAA,UACG,eAAW;AAAA,UACX,WAAWD,EAAO;AAAA,UAClB,OAAO,EAAE,kBAAkBE,EAAWZ,CAAY,EAAE;AAAA,QAAA;AAAA,MAAA,IAIpD,gBAAAS,EAAAI,GAAA,EAAA,UAAA;AAAA,QAAC,gBAAAF,EAAAG,GAAA,EAAY,MAAM,GAAI,CAAA;AAAA,QACvB,gBAAAH,EAAC,UAAK,UAAY,eAAA,CAAA;AAAA,MAAA,GACtB;AAAA,MAGH,gBAAAA,EAAA,QAAA,EAAK,WAAWD,EAAO,WAAY,UAAUH,EAAA,CAAA;AAAA,IAAA,GAClD;AAAA,IACC,gBAAAE,EAAA,OAAA,EAAI,WAAWC,EAAO,SAClB,UAAA;AAAA,MAAAR,KACI,gBAAAS,EAAA,UAAA,EAAO,MAAK,UAAS,cAAW,eAAc,SAAST,GAAS,WAAWQ,EAAO,OAC/E,UAAA,gBAAAC,EAACI,GAAU,EAAA,MAAM,GAAI,CAAA,GACzB;AAAA,wBAEH,OAAI,EAAA,WAAWL,EAAO,OAAO,cAAYT,IAAS,SAAS,UACxD,UAAA,gBAAAU,EAACK,KAAc,MAAM,IAAI,WAAWN,EAAO,OAAO,EACtD,CAAA;AAAA,IAAA,EACJ,CAAA;AAAA,EAAA,GACJ;AAER;AACAZ,EAAiB,cAAc;AAElB,MAAAmB,IAA+BC,EAAkDpB,CAAgB;"}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as o, jsx as e } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef as N, useState as b, useEffect as R } from "react";
|
|
3
3
|
import { Select as c } from "./fondue-components21.js";
|
|
4
4
|
import { TextInput as r } from "./fondue-components27.js";
|
|
5
5
|
import a from "./fondue-components41.js";
|
|
6
|
-
import { rgbColorToHex as d,
|
|
6
|
+
import { rgbColorToHex as d, DEFAULT_COLOR as I, DEFAULT_FORMAT as x, isValidHexColor as m, hexColorToRgba as S, getLimitedColorChannelValue as n } from "./fondue-components42.js";
|
|
7
7
|
const h = ({
|
|
8
|
-
currentColor: t =
|
|
8
|
+
currentColor: t = I,
|
|
9
9
|
onColorChange: i = () => {
|
|
10
10
|
},
|
|
11
|
-
currentFormat: s =
|
|
11
|
+
currentFormat: s = x,
|
|
12
12
|
setCurrentFormat: v = () => {
|
|
13
13
|
},
|
|
14
14
|
"data-test-id": f = "color-picker-value-input"
|
|
@@ -16,8 +16,8 @@ const h = ({
|
|
|
16
16
|
const [u, p] = b(d(t));
|
|
17
17
|
return R(() => {
|
|
18
18
|
p(d(t));
|
|
19
|
-
}, [t]), /* @__PURE__ */
|
|
20
|
-
/* @__PURE__ */ e("div", { className: a.colorFormatInput, children: /* @__PURE__ */
|
|
19
|
+
}, [t]), /* @__PURE__ */ o("div", { className: a.inputs, "data-test-id": f, ref: g, children: [
|
|
20
|
+
/* @__PURE__ */ e("div", { className: a.colorFormatInput, children: /* @__PURE__ */ o(
|
|
21
21
|
c,
|
|
22
22
|
{
|
|
23
23
|
"data-test-id": "color-picker-select-format",
|
|
@@ -41,7 +41,7 @@ const h = ({
|
|
|
41
41
|
value: u,
|
|
42
42
|
status: m(u) ? "neutral" : "error",
|
|
43
43
|
onBlur: (l) => {
|
|
44
|
-
m(l.target.value) && i(
|
|
44
|
+
m(l.target.value) && i(S(l.target.value));
|
|
45
45
|
},
|
|
46
46
|
onChange: (l) => {
|
|
47
47
|
p(l.target.value);
|
|
@@ -49,7 +49,7 @@ const h = ({
|
|
|
49
49
|
"aria-label": "Hex color value",
|
|
50
50
|
children: /* @__PURE__ */ e(r.Slot, { name: "left", children: /* @__PURE__ */ e("span", { className: a.inputDecorator, children: "#" }) })
|
|
51
51
|
}
|
|
52
|
-
) : /* @__PURE__ */
|
|
52
|
+
) : /* @__PURE__ */ o("div", { className: a.colorChannelInputGroup, children: [
|
|
53
53
|
/* @__PURE__ */ e(
|
|
54
54
|
r.Root,
|
|
55
55
|
{
|
|
@@ -60,7 +60,7 @@ const h = ({
|
|
|
60
60
|
onChange: (l) => {
|
|
61
61
|
i({
|
|
62
62
|
...t,
|
|
63
|
-
red:
|
|
63
|
+
red: n(l.target.value)
|
|
64
64
|
});
|
|
65
65
|
},
|
|
66
66
|
"aria-label": "Red Color Channel",
|
|
@@ -77,7 +77,7 @@ const h = ({
|
|
|
77
77
|
onChange: (l) => {
|
|
78
78
|
i({
|
|
79
79
|
...t,
|
|
80
|
-
green:
|
|
80
|
+
green: n(l.target.value)
|
|
81
81
|
});
|
|
82
82
|
},
|
|
83
83
|
"aria-label": "Green Color Channel",
|
|
@@ -94,7 +94,7 @@ const h = ({
|
|
|
94
94
|
onChange: (l) => {
|
|
95
95
|
i({
|
|
96
96
|
...t,
|
|
97
|
-
blue:
|
|
97
|
+
blue: n(l.target.value)
|
|
98
98
|
});
|
|
99
99
|
},
|
|
100
100
|
"aria-label": "Blue Color Channel",
|
|
@@ -102,7 +102,7 @@ const h = ({
|
|
|
102
102
|
}
|
|
103
103
|
)
|
|
104
104
|
] }),
|
|
105
|
-
/* @__PURE__ */ e("div", { className: a.colorAlphaInput, children: /* @__PURE__ */
|
|
105
|
+
/* @__PURE__ */ e("div", { className: a.colorAlphaInput, children: /* @__PURE__ */ o(
|
|
106
106
|
r.Root,
|
|
107
107
|
{
|
|
108
108
|
"data-test-id": "color-picker-value-input-alpha",
|
|
@@ -112,7 +112,7 @@ const h = ({
|
|
|
112
112
|
onChange: (l) => {
|
|
113
113
|
i({
|
|
114
114
|
...t,
|
|
115
|
-
alpha:
|
|
115
|
+
alpha: n(l.target.value, 0, 100) / 100
|
|
116
116
|
});
|
|
117
117
|
},
|
|
118
118
|
"aria-label": "Color Opacity",
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
const s = { red: 255, green: 255, blue: 255, alpha: 1, name: "" }, g = "HEX", $ = (e) => {
|
|
2
2
|
if (e)
|
|
3
|
-
return `rgba(${e.red}, ${e.green}, ${e.blue}, ${e.alpha
|
|
3
|
+
return `rgba(${e.red}, ${e.green}, ${e.blue}, ${e.alpha ?? 1})`;
|
|
4
4
|
}, p = (e) => {
|
|
5
|
-
const
|
|
6
|
-
return e.length > 2 &&
|
|
7
|
-
},
|
|
8
|
-
const
|
|
9
|
-
if (!
|
|
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
10
|
return {
|
|
11
11
|
red: 0,
|
|
12
12
|
green: 0,
|
|
13
13
|
blue: 0,
|
|
14
14
|
alpha: 0
|
|
15
15
|
};
|
|
16
|
-
const t =
|
|
16
|
+
const t = n[0];
|
|
17
17
|
return t.length === 3 ? {
|
|
18
18
|
red: parseInt(`${t[0]}${t[0]}`, 16),
|
|
19
19
|
green: parseInt(`${t[1]}${t[1]}`, 16),
|
|
@@ -26,22 +26,22 @@ const s = { red: 255, green: 255, blue: 255, alpha: 1, name: "" }, g = "HEX", $
|
|
|
26
26
|
alpha: 1
|
|
27
27
|
};
|
|
28
28
|
}, a = (e) => {
|
|
29
|
-
const { red:
|
|
30
|
-
return `${
|
|
31
|
-
},
|
|
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
32
|
...e,
|
|
33
33
|
name: `#${a(e)}`
|
|
34
34
|
} : {
|
|
35
35
|
...e,
|
|
36
|
-
name: `rgba(${e.red}, ${e.green}, ${e.blue}, ${e.alpha
|
|
37
|
-
},
|
|
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);
|
|
38
38
|
export {
|
|
39
39
|
s as DEFAULT_COLOR,
|
|
40
40
|
g as DEFAULT_FORMAT,
|
|
41
41
|
$ as colorToCss,
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
42
|
+
i as getColorWithName,
|
|
43
|
+
u as getLimitedColorChannelValue,
|
|
44
|
+
h as hexColorToRgba,
|
|
45
45
|
p as isValidHexColor,
|
|
46
46
|
a as rgbColorToHex
|
|
47
47
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fondue-components42.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
|
+
{"version":3,"file":"fondue-components42.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,IACX;AAEE,QAAAC,IAAWD,EAAQ,CAAC;AACtB,SAAAC,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,EACX,IAEG;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,EACX;AACJ,GAcaC,IAAgB,CAACC,MAA0C;AACpE,QAAM,EAAE,KAAAC,GAAK,OAAAC,GAAO,MAAAC,EAAS,IAAAH;AACtB,SAAA,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,GAcaC,IAAmB,CAACZ,GAAkBa,MAC3CA,MAAkB,QACX;AAAA,EACH,GAAGb;AAAA,EACH,MAAM,IAAIO,EAAcP,CAAK,CAAC;AAClC,IAEG;AAAA,EACH,GAAGA;AAAA,EACH,MAAM,QAAQA,EAAM,GAAG,KAAKA,EAAM,KAAK,KAAKA,EAAM,IAAI,KAAKA,EAAM,SAAS,CAAC;AAC/E,GAoBSc,IAA8B,CAACC,GAAeC,IAAc,GAAGC,IAAc,QAClFF,EAAM,WAAW,KAAK,SAASA,CAAK,IAAIC,IACjCA,IACA,SAASD,CAAK,IAAIE,IAClBA,IAEJ,SAASF,CAAK;"}
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
const t = "_root_t4a4t_8", o =
|
|
2
|
-
root: t
|
|
3
|
-
spin: o
|
|
1
|
+
const t = "_root_t4a4t_8", o = {
|
|
2
|
+
root: t
|
|
4
3
|
};
|
|
5
4
|
export {
|
|
6
|
-
|
|
7
|
-
t as root
|
|
8
|
-
o as spin
|
|
5
|
+
o as default,
|
|
6
|
+
t as root
|
|
9
7
|
};
|
|
10
8
|
//# sourceMappingURL=fondue-components54.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fondue-components54.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"fondue-components54.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { useMemo as f, useCallback as
|
|
1
|
+
import { useMemo as f, useCallback as d, useState as v, useRef as S, useEffect as m } from "react";
|
|
2
2
|
const U = ({
|
|
3
3
|
prop: e,
|
|
4
4
|
defaultProp: n,
|
|
5
5
|
onChange: s = () => {
|
|
6
6
|
}
|
|
7
7
|
}) => {
|
|
8
|
-
const [o, c] = b({ defaultProp: n, onChange: s }), t = e !== void 0,
|
|
8
|
+
const [o, c] = b({ defaultProp: n, onChange: s }), t = e !== void 0, i = t ? e : o, r = f(() => s, [s]), a = d(
|
|
9
9
|
(l) => {
|
|
10
10
|
if (t) {
|
|
11
11
|
const u = typeof l == "function" ? l(e) : l;
|
|
@@ -15,7 +15,7 @@ const U = ({
|
|
|
15
15
|
},
|
|
16
16
|
[t, e, c, r]
|
|
17
17
|
);
|
|
18
|
-
return [
|
|
18
|
+
return [i, a];
|
|
19
19
|
}, b = ({ defaultProp: e, onChange: n }) => {
|
|
20
20
|
const s = v(e), [o] = s, c = S(o), t = f(() => n, [n]);
|
|
21
21
|
return m(() => {
|