@frontify/fondue-components 24.0.0 → 24.1.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-components31.js +88 -79
- package/dist/fondue-components31.js.map +1 -1
- package/dist/fondue-components36.js +2 -2
- package/dist/fondue-components41.js +1 -1
- package/dist/fondue-components44.js +1 -1
- package/dist/fondue-components46.js +1 -1
- package/dist/fondue-components70.js +1 -1
- package/dist/fondue-components73.js +2 -2
- package/dist/fondue-components85.js +18 -16
- package/dist/fondue-components85.js.map +1 -1
- package/dist/fondue-components89.js +3 -15
- package/dist/fondue-components89.js.map +1 -1
- package/dist/fondue-components90.js +5 -2
- package/dist/fondue-components90.js.map +1 -1
- package/dist/fondue-components91.js +2 -5
- package/dist/fondue-components91.js.map +1 -1
- package/dist/fondue-components92.js +39 -4
- package/dist/fondue-components92.js.map +1 -1
- package/dist/fondue-components93.js +20 -39
- package/dist/fondue-components93.js.map +1 -1
- package/dist/fondue-components94.js +16 -20
- package/dist/fondue-components94.js.map +1 -1
- package/dist/index.d.ts +27 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
|
@@ -1,110 +1,119 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { IconCheckMark as
|
|
3
|
-
import { forwardRef as
|
|
4
|
-
import { useSyncRefs as
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
import { jsxs as F, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { IconCheckMark as J, IconExclamationMarkTriangle as L, IconCross as Q } from "@frontify/fondue-icons";
|
|
3
|
+
import { forwardRef as B, useRef as y, useState as U, useEffect as z } from "react";
|
|
4
|
+
import { useSyncRefs as X } from "./fondue-components50.js";
|
|
5
|
+
import { cn as Y } from "./fondue-components40.js";
|
|
6
|
+
import o from "./fondue-components85.js";
|
|
7
|
+
const D = ({
|
|
8
|
+
"data-test-id": c = "fondue-textarea",
|
|
9
|
+
autocomplete: i,
|
|
10
|
+
autosize: u,
|
|
11
|
+
children: m,
|
|
12
|
+
clearable: f,
|
|
13
|
+
decorator: h,
|
|
14
|
+
defaultValue: g,
|
|
15
|
+
disabled: n,
|
|
14
16
|
extraActions: l,
|
|
15
|
-
focusOnMount:
|
|
16
|
-
minRows:
|
|
17
|
-
maxRows:
|
|
18
|
-
onEnterPressed:
|
|
19
|
-
readOnly:
|
|
20
|
-
resizable:
|
|
21
|
-
selectable:
|
|
17
|
+
focusOnMount: v,
|
|
18
|
+
minRows: M = 1,
|
|
19
|
+
maxRows: k,
|
|
20
|
+
onEnterPressed: w,
|
|
21
|
+
readOnly: d,
|
|
22
|
+
resizable: $,
|
|
23
|
+
selectable: b = !0,
|
|
22
24
|
status: s = "default",
|
|
23
|
-
value:
|
|
24
|
-
...
|
|
25
|
-
},
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
const [
|
|
29
|
-
|
|
30
|
-
},
|
|
31
|
-
var
|
|
32
|
-
a.key === "Enter" && (
|
|
25
|
+
value: N,
|
|
26
|
+
...r
|
|
27
|
+
}, W) => {
|
|
28
|
+
const R = y(null), T = y(!1);
|
|
29
|
+
X(R, W);
|
|
30
|
+
const [x, S] = U(N ?? g ?? ""), C = (l == null ? void 0 : l.length) !== void 0 || f || ["success", "error"].includes(s), q = () => {
|
|
31
|
+
S("");
|
|
32
|
+
}, G = (a) => {
|
|
33
|
+
var t;
|
|
34
|
+
a.key === "Enter" && (w == null || w(a)), (t = r.onKeyDown) == null || t.call(r, a);
|
|
33
35
|
};
|
|
34
36
|
return z(() => {
|
|
35
|
-
|
|
36
|
-
}, [
|
|
37
|
+
S(N ?? g ?? "");
|
|
38
|
+
}, [g, N]), z(() => {
|
|
37
39
|
var a;
|
|
38
|
-
|
|
39
|
-
}, [
|
|
40
|
+
v && ((a = R.current) == null || a.focus());
|
|
41
|
+
}, [v]), /* @__PURE__ */ F(
|
|
40
42
|
"div",
|
|
41
43
|
{
|
|
42
|
-
className:
|
|
43
|
-
"data-autosize":
|
|
44
|
-
"data-clearable":
|
|
45
|
-
"data-disabled":
|
|
46
|
-
"data-has-decorator": !!
|
|
47
|
-
"data-has-tools":
|
|
48
|
-
"data-
|
|
49
|
-
"data-resizable": D,
|
|
44
|
+
className: o.root,
|
|
45
|
+
"data-autosize": u,
|
|
46
|
+
"data-clearable": f,
|
|
47
|
+
"data-disabled": n || d,
|
|
48
|
+
"data-has-decorator": !!h,
|
|
49
|
+
"data-has-tools": C,
|
|
50
|
+
"data-resizable": $,
|
|
50
51
|
"data-status": s,
|
|
51
|
-
"data-max-rows": !!
|
|
52
|
-
"data-test-id":
|
|
53
|
-
style: { "--max-rows": `${
|
|
52
|
+
"data-max-rows": !!k,
|
|
53
|
+
"data-test-id": c,
|
|
54
|
+
style: { "--max-rows": `${k}` },
|
|
54
55
|
children: [
|
|
55
|
-
|
|
56
|
-
/* @__PURE__ */ o(
|
|
56
|
+
h ? /* @__PURE__ */ e("div", { className: o.decorator, children: h }) : null,
|
|
57
|
+
/* @__PURE__ */ e("div", { className: o.textareaWrapper, "data-replicated-value": x, children: /* @__PURE__ */ e(
|
|
57
58
|
"textarea",
|
|
58
59
|
{
|
|
59
|
-
...
|
|
60
|
+
...r,
|
|
60
61
|
onMouseDown: (a) => {
|
|
61
|
-
|
|
62
|
+
T.current = !0, a.currentTarget.dataset.showFocusRing = "false";
|
|
62
63
|
},
|
|
63
64
|
onFocus: (a) => {
|
|
64
|
-
var
|
|
65
|
-
|
|
65
|
+
var t;
|
|
66
|
+
T.current || (a.target.dataset.showFocusRing = "true"), (t = r.onFocus) == null || t.call(r, a);
|
|
66
67
|
},
|
|
67
68
|
onBlur: (a) => {
|
|
68
|
-
var
|
|
69
|
-
a.target.dataset.showFocusRing = "false",
|
|
69
|
+
var t;
|
|
70
|
+
a.target.dataset.showFocusRing = "false", T.current = !1, (t = r.onBlur) == null || t.call(r, a);
|
|
70
71
|
},
|
|
71
|
-
autoComplete:
|
|
72
|
-
className:
|
|
73
|
-
disabled:
|
|
74
|
-
onKeyDown:
|
|
75
|
-
onInput: (a) =>
|
|
72
|
+
autoComplete: i ? "on" : "off",
|
|
73
|
+
className: o.textarea,
|
|
74
|
+
disabled: n,
|
|
75
|
+
onKeyDown: G,
|
|
76
|
+
onInput: (a) => S(a.currentTarget.value),
|
|
76
77
|
onSelect: (a) => {
|
|
77
|
-
|
|
78
|
+
b || (a.currentTarget.selectionStart = a.currentTarget.selectionEnd);
|
|
78
79
|
},
|
|
79
|
-
readOnly:
|
|
80
|
-
ref:
|
|
81
|
-
rows:
|
|
82
|
-
value:
|
|
80
|
+
readOnly: d,
|
|
81
|
+
ref: R,
|
|
82
|
+
rows: M,
|
|
83
|
+
value: x
|
|
83
84
|
}
|
|
84
|
-
),
|
|
85
|
-
s === "loading" && /* @__PURE__ */
|
|
86
|
-
|
|
87
|
-
s === "success" && /* @__PURE__ */
|
|
88
|
-
s === "error" && /* @__PURE__ */
|
|
89
|
-
l == null ? void 0 : l.map(({ icon: a, title:
|
|
85
|
+
) }),
|
|
86
|
+
s === "loading" && /* @__PURE__ */ e("div", { className: o.loadingStatus, "data-test-id": `${c}-loader` }),
|
|
87
|
+
C && /* @__PURE__ */ F("div", { className: o.tools, children: [
|
|
88
|
+
s === "success" && /* @__PURE__ */ e("div", { className: o.success, children: /* @__PURE__ */ e(J, { size: 20 }) }),
|
|
89
|
+
s === "error" && /* @__PURE__ */ e("div", { className: o[s], children: /* @__PURE__ */ e(L, { size: 20 }) }),
|
|
90
|
+
l == null ? void 0 : l.map(({ icon: a, title: t, callback: H }) => /* @__PURE__ */ e(
|
|
90
91
|
"button",
|
|
91
92
|
{
|
|
92
|
-
className:
|
|
93
|
-
disabled:
|
|
94
|
-
onClick:
|
|
95
|
-
title:
|
|
93
|
+
className: o.toolsButton,
|
|
94
|
+
disabled: n || d,
|
|
95
|
+
onClick: H,
|
|
96
|
+
title: t,
|
|
96
97
|
children: a
|
|
97
98
|
},
|
|
98
|
-
|
|
99
|
+
t
|
|
99
100
|
)),
|
|
100
|
-
|
|
101
|
-
] })
|
|
101
|
+
f && /* @__PURE__ */ e("button", { className: o.toolsButton, onClick: q, disabled: n || d, children: /* @__PURE__ */ e(Q, { size: 20, fill: "currentColor" }) })
|
|
102
|
+
] }),
|
|
103
|
+
m
|
|
102
104
|
]
|
|
103
105
|
}
|
|
104
106
|
);
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
+
};
|
|
108
|
+
D.displayName = "Textarea.Root";
|
|
109
|
+
const I = ({ name: c, className: i, ...u }, m) => /* @__PURE__ */ e("div", { "data-slot": !0, "data-name": c, ...u, ref: m, className: Y(o.slot, i) });
|
|
110
|
+
I.displayName = "Textarea.Slot";
|
|
111
|
+
const K = B(D), Z = B(I), j = K;
|
|
112
|
+
j.Root = K;
|
|
113
|
+
j.Slot = Z;
|
|
107
114
|
export {
|
|
108
|
-
|
|
115
|
+
j as Textarea,
|
|
116
|
+
D as TextareaRoot,
|
|
117
|
+
I as TextareaSlot
|
|
109
118
|
};
|
|
110
119
|
//# sourceMappingURL=fondue-components31.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fondue-components31.js","sources":["../src/components/Textarea/Textarea.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { IconCheckMark, IconCross, IconExclamationMarkTriangle } from '@frontify/fondue-icons';\nimport {\n forwardRef,\n useEffect,\n useRef,\n useState,\n type ChangeEventHandler,\n type CSSProperties,\n type FocusEventHandler,\n type ForwardedRef,\n type KeyboardEventHandler,\n type ReactElement,\n type SyntheticEvent,\n} from 'react';\n\nimport { useSyncRefs } from '#/hooks/useSyncRefs';\n\nimport styles from './styles/textarea.module.scss';\n\nexport type ExtraAction = {\n icon: ReactElement;\n title: string;\n callback: () => void;\n};\n\ntype Status = 'default' | 'loading' | 'success' | 'error';\n\ntype TextareaProps = {\n /**\n * The id of the textarea\n */\n id?: string;\n /**\n * If `true`, Textarea will have `autoComplete` functionality\n */\n autocomplete?: boolean;\n /**\n * If `true`, component rendered is a auto sizing Textarea\n */\n autosize?: boolean;\n /**\n * Render `clear` button to clear input on click\n */\n clearable?: boolean;\n /**\n * A `ReactElement` that will be rendered at the start of the `Textarea`\n */\n decorator?: ReactElement;\n /**\n * Initial value\n */\n defaultValue?: string;\n disabled?: boolean;\n /**\n * Collection of extra actions the input can preform\n */\n extraActions?: ExtraAction[];\n /**\n * If `true`, Textarea will be focused on mount\n */\n focusOnMount?: boolean;\n /**\n * If autosize is false, this is used as rows property for default textarea\n * @default 1\n */\n minRows?: number;\n /**\n * If `autosize` is `false`, this property is ignored\n */\n maxRows?: number;\n /**\n * Event handler called when the textarea value changes\n */\n onChange?: ChangeEventHandler<HTMLTextAreaElement>;\n /**\n * Event handler called when the text input is blurred\n */\n onBlur?: FocusEventHandler<HTMLTextAreaElement>;\n /**\n * Event handler called when the text input is focused\n */\n onFocus?: FocusEventHandler<HTMLTextAreaElement>;\n /**\n * Event handler called when a key is pressed\n */\n onKeyDown?: KeyboardEventHandler<HTMLTextAreaElement>;\n /**\n * Event handler called when Enter is pressed\n */\n onEnterPressed?: KeyboardEventHandler<HTMLTextAreaElement>;\n /**\n * Event handler called when a key is released\n */\n onKeyUp?: KeyboardEventHandler<HTMLTextAreaElement>;\n /**\n * Event handler called when the text inside of text input is selected\n */\n onSelect?: (event: SyntheticEvent<HTMLTextAreaElement>) => void;\n /**\n * If `true`, Textarea will be required\n */\n required?: boolean;\n /**\n * The test id of the textarea\n */\n 'data-test-id'?: string;\n placeholder?: string;\n readOnly?: boolean;\n resizable?: boolean;\n selectable?: boolean;\n /**\n * The current status of the input. It will trigger the corresponding icon to be appended to the Textarea.\n * @default 'default'\n */\n status?: Status;\n value?: string;\n};\n\nconst TextareaComponent = (\n {\n 'data-test-id': dataTestId = 'fondue-textarea',\n autocomplete,\n autosize,\n clearable,\n decorator,\n defaultValue,\n disabled,\n extraActions,\n focusOnMount,\n minRows: rows = 1,\n maxRows,\n onEnterPressed,\n readOnly,\n resizable,\n selectable = true,\n status = 'default',\n value: inputValue,\n ...props\n }: TextareaProps,\n forwardedRef: ForwardedRef<HTMLTextAreaElement>,\n) => {\n const ref = useRef<HTMLTextAreaElement>(null);\n const wasClicked = useRef(false);\n\n useSyncRefs<HTMLTextAreaElement>(ref, forwardedRef);\n\n const [value, setValue] = useState(inputValue ?? defaultValue ?? '');\n\n const hasTools = extraActions?.length !== undefined || clearable || ['success', 'error'].includes(status);\n\n const clear = () => {\n setValue('');\n };\n\n const handleKeyDown: KeyboardEventHandler<HTMLTextAreaElement> = (event) => {\n if (event.key === 'Enter') {\n onEnterPressed?.(event);\n }\n props.onKeyDown?.(event);\n };\n\n useEffect(() => {\n setValue(inputValue ?? defaultValue ?? '');\n }, [defaultValue, inputValue]);\n\n useEffect(() => {\n if (focusOnMount) {\n ref.current?.focus();\n }\n }, [focusOnMount]);\n\n return (\n <div\n className={styles.root}\n data-autosize={autosize}\n data-clearable={clearable}\n data-disabled={disabled || readOnly}\n data-has-decorator={decorator ? true : false}\n data-has-tools={hasTools}\n data-replicated-value={value}\n data-resizable={resizable}\n data-status={status}\n data-max-rows={!!maxRows}\n data-test-id={dataTestId}\n style={{ '--max-rows': `${maxRows}` } as CSSProperties}\n >\n {decorator ? <div className={styles.decorator}>{decorator}</div> : null}\n <textarea\n {...props}\n onMouseDown={(mouseEvent) => {\n wasClicked.current = true;\n mouseEvent.currentTarget.dataset.showFocusRing = 'false';\n }}\n onFocus={(focusEvent) => {\n if (!wasClicked.current) {\n focusEvent.target.dataset.showFocusRing = 'true';\n }\n props.onFocus?.(focusEvent);\n }}\n onBlur={(blurEvent) => {\n blurEvent.target.dataset.showFocusRing = 'false';\n wasClicked.current = false;\n props.onBlur?.(blurEvent);\n }}\n autoComplete={autocomplete ? 'on' : 'off'}\n className={styles.textarea}\n disabled={disabled}\n onKeyDown={handleKeyDown}\n onInput={(event) => setValue(event.currentTarget.value)}\n onSelect={(event) => {\n if (!selectable) {\n event.currentTarget.selectionStart = event.currentTarget.selectionEnd;\n }\n }}\n readOnly={readOnly}\n ref={ref}\n rows={rows}\n value={value}\n ></textarea>\n {status === 'loading' && <div className={styles.loadingStatus} data-test-id={`${dataTestId}-loader`} />}\n {hasTools && (\n <div className={styles.tools}>\n {status === 'success' && (\n <div className={styles.success}>\n <IconCheckMark size={20} />\n </div>\n )}\n {status === 'error' && (\n <div className={styles[status]}>\n <IconExclamationMarkTriangle size={20} />\n </div>\n )}\n {extraActions?.map(({ icon, title, callback }) => (\n <button\n className={styles.toolsButton}\n disabled={disabled || readOnly}\n key={title}\n onClick={callback}\n title={title}\n >\n {icon}\n </button>\n ))}\n {clearable && (\n <button className={styles.toolsButton} onClick={clear} disabled={disabled || readOnly}>\n <IconCross size={20} fill=\"currentColor\" />\n </button>\n )}\n </div>\n )}\n </div>\n );\n};\n\nexport const Textarea = forwardRef<HTMLTextAreaElement, TextareaProps>(TextareaComponent);\nTextarea.displayName = 'Textarea';\n"],"names":["TextareaComponent","dataTestId","autocomplete","autosize","clearable","decorator","defaultValue","disabled","extraActions","focusOnMount","rows","maxRows","onEnterPressed","readOnly","resizable","selectable","status","inputValue","props","forwardedRef","ref","useRef","wasClicked","useSyncRefs","value","setValue","useState","hasTools","clear","handleKeyDown","event","_a","useEffect","jsxs","styles","jsx","mouseEvent","focusEvent","blurEvent","IconCheckMark","IconExclamationMarkTriangle","icon","title","callback","IconCross","Textarea","forwardRef"],"mappings":";;;;;AAwHA,MAAMA,IAAoB,CACtB;AAAA,EACI,gBAAgBC,IAAa;AAAA,EAC7B,cAAAC;AAAA,EACA,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,WAAAC;AAAA,EACA,cAAAC;AAAA,EACA,UAAAC;AAAA,EACA,cAAAC;AAAA,EACA,cAAAC;AAAA,EACA,SAASC,IAAO;AAAA,EAChB,SAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,UA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,gBAAAmB,EAACK,GAAA,EAA4B,MAAM,GAAA,CAAI,GAC3C;AAAA,UAEHhC,KAAA,gBAAAA,EAAc,IAAI,CAAC,EAAE,MAAAiC,GAAM,OAAAC,GAAO,UAAAC,QAC/B,gBAAAR;AAAA,YAAC;AAAA,YAAA;AAAA,cACG,WAAWD,EAAO;AAAA,cAClB,UAAU3B,KAAYM;AAAA,cAEtB,SAAS8B;AAAA,cACT,OAAAD;AAAA,cAEC,UAAAD;AAAA,YAAA;AAAA,YAJIC;AAAA,UAAA;AAAA,UAOZtC,KACG,gBAAA+B,EAAC,UAAA,EAAO,WAAWD,EAAO,aAAa,SAASN,GAAO,UAAUrB,KAAYM,GACzE,UAAA,gBAAAsB,EAACS,GAAA,EAAU,MAAM,IAAI,MAAK,gBAAe,EAAA,CAC7C;AAAA,QAAA,EAAA,CAER;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAIhB,GAEaC,IAAWC,EAA+C9C,CAAiB;AACxF6C,EAAS,cAAc;"}
|
|
1
|
+
{"version":3,"file":"fondue-components31.js","sources":["../src/components/Textarea/Textarea.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { IconCheckMark, IconCross, IconExclamationMarkTriangle } from '@frontify/fondue-icons';\nimport {\n forwardRef,\n useEffect,\n useRef,\n useState,\n type ChangeEventHandler,\n type CSSProperties,\n type FocusEventHandler,\n type ForwardedRef,\n type KeyboardEventHandler,\n type ReactElement,\n type ReactNode,\n type SyntheticEvent,\n} from 'react';\n\nimport { useSyncRefs } from '#/hooks/useSyncRefs';\nimport { cn } from '#/utilities/styleUtilities';\n\nimport styles from './styles/textarea.module.scss';\n\n/**\n * @deprecated Use Textarea.Slot instead for custom actions\n */\nexport type ExtraAction = {\n icon: ReactElement;\n title: string;\n callback: () => void;\n};\n\ntype Status = 'default' | 'loading' | 'success' | 'error';\n\ntype TextareaProps = {\n /**\n * The id of the textarea\n */\n id?: string;\n /**\n * The place where the textarea slots are placed\n */\n children?: ReactNode;\n /**\n * If `true`, Textarea will have `autoComplete` functionality\n */\n autocomplete?: boolean;\n /**\n * If `true`, component rendered is a auto sizing Textarea\n */\n autosize?: boolean;\n /**\n * Render `clear` button to clear input on click\n */\n clearable?: boolean;\n /**\n * A `ReactElement` that will be rendered at the start of the `Textarea`\n */\n decorator?: ReactElement;\n /**\n * Initial value\n */\n defaultValue?: string;\n disabled?: boolean;\n /**\n * Collection of extra actions the input can preform\n * @deprecated Use Textarea.Slot instead for custom actions\n */\n extraActions?: ExtraAction[];\n /**\n * If `true`, Textarea will be focused on mount\n */\n focusOnMount?: boolean;\n /**\n * If autosize is false, this is used as rows property for default textarea\n * @default 1\n */\n minRows?: number;\n /**\n * If `autosize` is `false`, this property is ignored\n */\n maxRows?: number;\n /**\n * Event handler called when the textarea value changes\n */\n onChange?: ChangeEventHandler<HTMLTextAreaElement>;\n /**\n * Event handler called when the text input is blurred\n */\n onBlur?: FocusEventHandler<HTMLTextAreaElement>;\n /**\n * Event handler called when the text input is focused\n */\n onFocus?: FocusEventHandler<HTMLTextAreaElement>;\n /**\n * Event handler called when a key is pressed\n */\n onKeyDown?: KeyboardEventHandler<HTMLTextAreaElement>;\n /**\n * Event handler called when Enter is pressed\n */\n onEnterPressed?: KeyboardEventHandler<HTMLTextAreaElement>;\n /**\n * Event handler called when a key is released\n */\n onKeyUp?: KeyboardEventHandler<HTMLTextAreaElement>;\n /**\n * Event handler called when the text inside of text input is selected\n */\n onSelect?: (event: SyntheticEvent<HTMLTextAreaElement>) => void;\n /**\n * If `true`, Textarea will be required\n */\n required?: boolean;\n /**\n * The test id of the textarea\n */\n 'data-test-id'?: string;\n placeholder?: string;\n readOnly?: boolean;\n resizable?: boolean;\n selectable?: boolean;\n /**\n * The current status of the input. It will trigger the corresponding icon to be appended to the Textarea.\n * @default 'default'\n */\n status?: Status;\n value?: string;\n};\n\nexport const TextareaRoot = (\n {\n 'data-test-id': dataTestId = 'fondue-textarea',\n autocomplete,\n autosize,\n children,\n clearable,\n decorator,\n defaultValue,\n disabled,\n extraActions,\n focusOnMount,\n minRows: rows = 1,\n maxRows,\n onEnterPressed,\n readOnly,\n resizable,\n selectable = true,\n status = 'default',\n value: inputValue,\n ...props\n }: TextareaProps,\n forwardedRef: ForwardedRef<HTMLTextAreaElement>,\n) => {\n const ref = useRef<HTMLTextAreaElement>(null);\n const wasClicked = useRef(false);\n\n useSyncRefs<HTMLTextAreaElement>(ref, forwardedRef);\n\n const [value, setValue] = useState(inputValue ?? defaultValue ?? '');\n\n const hasTools = extraActions?.length !== undefined || clearable || ['success', 'error'].includes(status);\n\n const clear = () => {\n setValue('');\n };\n\n const handleKeyDown: KeyboardEventHandler<HTMLTextAreaElement> = (event) => {\n if (event.key === 'Enter') {\n onEnterPressed?.(event);\n }\n props.onKeyDown?.(event);\n };\n\n useEffect(() => {\n setValue(inputValue ?? defaultValue ?? '');\n }, [defaultValue, inputValue]);\n\n useEffect(() => {\n if (focusOnMount) {\n ref.current?.focus();\n }\n }, [focusOnMount]);\n\n return (\n <div\n className={styles.root}\n data-autosize={autosize}\n data-clearable={clearable}\n data-disabled={disabled || readOnly}\n data-has-decorator={decorator ? true : false}\n data-has-tools={hasTools}\n data-resizable={resizable}\n data-status={status}\n data-max-rows={!!maxRows}\n data-test-id={dataTestId}\n style={{ '--max-rows': `${maxRows}` } as CSSProperties}\n >\n {decorator ? <div className={styles.decorator}>{decorator}</div> : null}\n <div className={styles.textareaWrapper} data-replicated-value={value}>\n <textarea\n {...props}\n onMouseDown={(mouseEvent) => {\n wasClicked.current = true;\n mouseEvent.currentTarget.dataset.showFocusRing = 'false';\n }}\n onFocus={(focusEvent) => {\n if (!wasClicked.current) {\n focusEvent.target.dataset.showFocusRing = 'true';\n }\n props.onFocus?.(focusEvent);\n }}\n onBlur={(blurEvent) => {\n blurEvent.target.dataset.showFocusRing = 'false';\n wasClicked.current = false;\n props.onBlur?.(blurEvent);\n }}\n autoComplete={autocomplete ? 'on' : 'off'}\n className={styles.textarea}\n disabled={disabled}\n onKeyDown={handleKeyDown}\n onInput={(event) => setValue(event.currentTarget.value)}\n onSelect={(event) => {\n if (!selectable) {\n event.currentTarget.selectionStart = event.currentTarget.selectionEnd;\n }\n }}\n readOnly={readOnly}\n ref={ref}\n rows={rows}\n value={value}\n ></textarea>\n </div>\n {status === 'loading' && <div className={styles.loadingStatus} data-test-id={`${dataTestId}-loader`} />}\n {hasTools && (\n <div className={styles.tools}>\n {status === 'success' && (\n <div className={styles.success}>\n <IconCheckMark size={20} />\n </div>\n )}\n {status === 'error' && (\n <div className={styles[status]}>\n <IconExclamationMarkTriangle size={20} />\n </div>\n )}\n {extraActions?.map(({ icon, title, callback }) => (\n <button\n className={styles.toolsButton}\n disabled={disabled || readOnly}\n key={title}\n onClick={callback}\n title={title}\n >\n {icon}\n </button>\n ))}\n {clearable && (\n <button className={styles.toolsButton} onClick={clear} disabled={disabled || readOnly}>\n <IconCross size={20} fill=\"currentColor\" />\n </button>\n )}\n </div>\n )}\n {children}\n </div>\n );\n};\nTextareaRoot.displayName = 'Textarea.Root';\n\nexport type TextareaSlotProps = {\n children: ReactNode;\n name?: 'left' | 'right';\n className?: string;\n};\n\nexport const TextareaSlot = (\n { name, className, ...slotProps }: TextareaSlotProps,\n forwardedRef: ForwardedRef<HTMLDivElement>,\n) => {\n return <div data-slot data-name={name} {...slotProps} ref={forwardedRef} className={cn(styles.slot, className)} />;\n};\n\nTextareaSlot.displayName = 'Textarea.Slot';\n\nconst ForwardedRefTextareaRoot = forwardRef<HTMLTextAreaElement, TextareaProps>(TextareaRoot);\nconst ForwardedRefTextareaSlot = forwardRef<HTMLDivElement, TextareaSlotProps>(TextareaSlot);\n\n// @ts-expect-error We support both single component (without slots) and compound components (with slots)\nexport const Textarea: typeof TextareaRoot & {\n Root: typeof ForwardedRefTextareaRoot;\n Slot: typeof ForwardedRefTextareaSlot;\n} = ForwardedRefTextareaRoot;\nTextarea.Root = ForwardedRefTextareaRoot;\nTextarea.Slot = ForwardedRefTextareaSlot;\n"],"names":["TextareaRoot","dataTestId","autocomplete","autosize","children","clearable","decorator","defaultValue","disabled","extraActions","focusOnMount","rows","maxRows","onEnterPressed","readOnly","resizable","selectable","status","inputValue","props","forwardedRef","ref","useRef","wasClicked","useSyncRefs","value","setValue","useState","hasTools","clear","handleKeyDown","event","_a","useEffect","jsxs","styles","jsx","mouseEvent","focusEvent","blurEvent","IconCheckMark","IconExclamationMarkTriangle","icon","title","callback","IconCross","TextareaSlot","name","className","slotProps","cn","ForwardedRefTextareaRoot","forwardRef","ForwardedRefTextareaSlot","Textarea"],"mappings":";;;;;;AAkIO,MAAMA,IAAe,CACxB;AAAA,EACI,gBAAgBC,IAAa;AAAA,EAC7B,cAAAC;AAAA,EACA,UAAAC;AAAA,EACA,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,WAAAC;AAAA,EACA,cAAAC;AAAA,EACA,UAAAC;AAAA,EACA,cAAAC;AAAA,EACA,cAAAC;AAAA,EACA,SAASC,IAAO;AAAA,EAChB,SAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,YAAAC,IAAa;AAAA,EACb,QAAAC,IAAS;AAAA,EACT,OAAOC;AAAA,EACP,GAAGC;AACP,GACAC,MACC;AACD,QAAMC,IAAMC,EAA4B,IAAI,GACtCC,IAAaD,EAAO,EAAK;AAE/B,EAAAE,EAAiCH,GAAKD,CAAY;AAElD,QAAM,CAACK,GAAOC,CAAQ,IAAIC,EAAST,KAAcX,KAAgB,EAAE,GAE7DqB,KAAWnB,KAAA,gBAAAA,EAAc,YAAW,UAAaJ,KAAa,CAAC,WAAW,OAAO,EAAE,SAASY,CAAM,GAElGY,IAAQ,MAAM;AAChB,IAAAH,EAAS,EAAE;AAAA,EACf,GAEMI,IAA2D,CAACC,MAAU;;AACxE,IAAIA,EAAM,QAAQ,YACdlB,KAAA,QAAAA,EAAiBkB,MAErBC,IAAAb,EAAM,cAAN,QAAAa,EAAA,K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AA,QAEHzC;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGb;AACAJ,EAAa,cAAc;AAQpB,MAAM8C,IAAe,CACxB,EAAE,MAAAC,GAAM,WAAAC,GAAW,GAAGC,EAAA,GACtB7B,MAEO,gBAAAgB,EAAC,OAAA,EAAI,aAAS,IAAC,aAAWW,GAAO,GAAGE,GAAW,KAAK7B,GAAc,WAAW8B,EAAGf,EAAO,MAAMa,CAAS,GAAG;AAGpHF,EAAa,cAAc;AAE3B,MAAMK,IAA2BC,EAA+CpD,CAAY,GACtFqD,IAA2BD,EAA8CN,CAAY,GAG9EQ,IAGTH;AACJG,EAAS,OAAOH;AAChBG,EAAS,OAAOD;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
-
import s from "./fondue-
|
|
3
|
-
import { colorToCss as e } from "./fondue-
|
|
2
|
+
import s from "./fondue-components89.js";
|
|
3
|
+
import { colorToCss as e } from "./fondue-components90.js";
|
|
4
4
|
const a = ["default", "positive", "highlight", "warning", "negative"], i = (t) => typeof t == "string" && a.includes(t), p = ({ status: t }) => {
|
|
5
5
|
const o = i(t) ? { "data-status": t } : { style: { backgroundColor: typeof t == "string" ? t : e(t) || "transparent" } };
|
|
6
6
|
return /* @__PURE__ */ r("div", { "data-test-id": "badge-status", className: s.root, ...o });
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FOCUS_OUTLINE as t } from "./fondue-
|
|
1
|
+
import { FOCUS_OUTLINE as t } from "./fondue-components91.js";
|
|
2
2
|
import { sv as e } from "./fondue-components40.js";
|
|
3
3
|
const o = e({
|
|
4
4
|
base: `tw-group tw-relative tw-flex tw-flex-row tw-gap-2 tw-items-center tw-justify-center tw-cursor-pointer tw-font-body tw-font-medium tw-box-border tw-whitespace-nowrap tw-transition-colors ${t}`,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FOCUS_OUTLINE as t } from "./fondue-
|
|
1
|
+
import { FOCUS_OUTLINE as t } from "./fondue-components91.js";
|
|
2
2
|
import { sv as e } from "./fondue-components40.js";
|
|
3
3
|
const s = e({
|
|
4
4
|
base: `tw-peer tw-relative tw-inline-flex tw-bg-base tw-text-white tw-shrink-0 tw-rounded tw-border tw-border-line-x-strong group-hover:tw-border-line-xx-strong hover:tw-border-line-xx-strong tw-transition-colors data-[state="checked"]:tw-border-transparent data-[state="indeterminate"]:tw-border-transparent disabled:tw-border-line-strong disabled:tw-bg-base disabled:tw-cursor-not-allowed data-[state="checked"]:disabled:tw-bg-box-disabled-strong data-[readonly="true"]:tw-pointer-events-none ${t}`,
|
|
@@ -3,7 +3,7 @@ import { IconDroplet as I, IconCross as k, IconCaretDown as v } from "@frontify/
|
|
|
3
3
|
import { forwardRef as P } from "react";
|
|
4
4
|
import { useTranslation as w } from "./fondue-components35.js";
|
|
5
5
|
import { Button as y } from "./fondue-components6.js";
|
|
6
|
-
import a from "./fondue-
|
|
6
|
+
import a from "./fondue-components94.js";
|
|
7
7
|
import { getColorWithName as z, colorToCss as x } from "./fondue-components49.js";
|
|
8
8
|
const c = ({
|
|
9
9
|
id: m,
|
|
@@ -4,7 +4,7 @@ import { Slot as V } from "@radix-ui/react-slot";
|
|
|
4
4
|
import { isValidElement as D } from "react";
|
|
5
5
|
import { useFondueTheme as M, ThemeProvider as T } from "./fondue-components32.js";
|
|
6
6
|
import i from "./fondue-components72.js";
|
|
7
|
-
import { recursiveMap as E, getSelectOptionValue as F } from "./fondue-
|
|
7
|
+
import { recursiveMap as E, getSelectOptionValue as F } from "./fondue-components92.js";
|
|
8
8
|
const R = ({
|
|
9
9
|
highlightedIndex: p,
|
|
10
10
|
getMenuProps: c,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as E } from "react/jsx-runtime";
|
|
2
2
|
import { useState as S, useMemo as b, Children as v, isValidElement as C, cloneElement as w, useCallback as B, useEffect as x } from "react";
|
|
3
|
-
import { SelectClear as F } from "./fondue-
|
|
3
|
+
import { SelectClear as F } from "./fondue-components93.js";
|
|
4
4
|
import { ForwardedRefSelectItem as L } from "./fondue-components69.js";
|
|
5
5
|
import { ForwardedRefSelectSlot as y } from "./fondue-components71.js";
|
|
6
|
-
import { getSelectOptionValue as I } from "./fondue-
|
|
6
|
+
import { getSelectOptionValue as I } from "./fondue-components92.js";
|
|
7
7
|
const O = (n, s) => {
|
|
8
8
|
const [e, r] = S(!1), [m, i] = S(null), [l, f] = S({
|
|
9
9
|
menuComponents: [],
|
|
@@ -1,26 +1,28 @@
|
|
|
1
|
-
const
|
|
2
|
-
root:
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
const t = "_root_14jmh_5", o = "_textareaWrapper_14jmh_62", s = "_textarea_14jmh_62", _ = "_slot_14jmh_120", r = "_decorator_14jmh_145", e = "_tools_14jmh_158", a = "_toolsButton_14jmh_190", c = "_success_14jmh_222", n = "_error_14jmh_226", l = "_loadingStatus_14jmh_230", h = "_spin_14jmh_1", j = {
|
|
2
|
+
root: t,
|
|
3
|
+
textareaWrapper: o,
|
|
4
|
+
textarea: s,
|
|
5
|
+
slot: _,
|
|
5
6
|
decorator: r,
|
|
6
|
-
tools:
|
|
7
|
-
toolsButton:
|
|
7
|
+
tools: e,
|
|
8
|
+
toolsButton: a,
|
|
8
9
|
success: c,
|
|
9
10
|
error: n,
|
|
10
|
-
loadingStatus:
|
|
11
|
-
spin:
|
|
11
|
+
loadingStatus: l,
|
|
12
|
+
spin: h
|
|
12
13
|
};
|
|
13
14
|
export {
|
|
14
15
|
r as decorator,
|
|
15
|
-
|
|
16
|
+
j as default,
|
|
16
17
|
n as error,
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
l as loadingStatus,
|
|
19
|
+
t as root,
|
|
20
|
+
_ as slot,
|
|
21
|
+
h as spin,
|
|
21
22
|
c as success,
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
s as textarea,
|
|
24
|
+
o as textareaWrapper,
|
|
25
|
+
e as tools,
|
|
26
|
+
a as toolsButton
|
|
25
27
|
};
|
|
26
28
|
//# sourceMappingURL=fondue-components85.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fondue-components85.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"fondue-components85.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;"}
|
|
@@ -1,20 +1,8 @@
|
|
|
1
|
-
const o = "
|
|
2
|
-
root: o
|
|
3
|
-
clearIcon: c,
|
|
4
|
-
caret: t,
|
|
5
|
-
colorName: _,
|
|
6
|
-
button: n,
|
|
7
|
-
colorIndicator: e,
|
|
8
|
-
actions: r
|
|
1
|
+
const o = "_root_b0bc4_2", t = {
|
|
2
|
+
root: o
|
|
9
3
|
};
|
|
10
4
|
export {
|
|
11
|
-
|
|
12
|
-
n as button,
|
|
13
|
-
t as caret,
|
|
14
|
-
c as clearIcon,
|
|
15
|
-
e as colorIndicator,
|
|
16
|
-
_ as colorName,
|
|
17
|
-
a as default,
|
|
5
|
+
t as default,
|
|
18
6
|
o as root
|
|
19
7
|
};
|
|
20
8
|
//# sourceMappingURL=fondue-components89.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fondue-components89.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"fondue-components89.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;"}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
const
|
|
1
|
+
const r = (e) => {
|
|
2
|
+
if (e)
|
|
3
|
+
return `rgba(${e.red}, ${e.green}, ${e.blue}, ${e.alpha ?? 1})`;
|
|
4
|
+
};
|
|
2
5
|
export {
|
|
3
|
-
|
|
6
|
+
r as colorToCss
|
|
4
7
|
};
|
|
5
8
|
//# sourceMappingURL=fondue-components90.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fondue-components90.js","sources":["../src/
|
|
1
|
+
{"version":3,"file":"fondue-components90.js","sources":["../src/components/Badge/utils.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type RgbaColor } from './types';\n\nexport const DEFAULT_COLOR = { red: 255, green: 255, blue: 255, alpha: 1, name: '' };\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"],"names":["colorToCss","color"],"mappings":"AAiBO,MAAMA,IAAa,CAACC,MAAsB;AAC7C,MAAKA;AAGL,WAAO,QAAQA,EAAM,GAAG,KAAKA,EAAM,KAAK,KAAKA,EAAM,IAAI,KAAKA,EAAM,SAAS,CAAC;AAChF;"}
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
const
|
|
2
|
-
root: o
|
|
3
|
-
};
|
|
1
|
+
const t = "focus-visible:tw-outline has-[[data-show-focus-ring=true]]:tw-outline tw-outline-4 tw-outline-offset-2 tw-outline-blue focus-visible:tw-outline-blue";
|
|
4
2
|
export {
|
|
5
|
-
t as
|
|
6
|
-
o as root
|
|
3
|
+
t as FOCUS_OUTLINE
|
|
7
4
|
};
|
|
8
5
|
//# sourceMappingURL=fondue-components91.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fondue-components91.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"fondue-components91.js","sources":["../src/utilities/focusStyle.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nexport const FOCUS_OUTLINE =\n 'focus-visible:tw-outline has-[[data-show-focus-ring=true]]:tw-outline tw-outline-4 tw-outline-offset-2 tw-outline-blue focus-visible:tw-outline-blue'; // second declaration of tw-outline-blue is to assure that in firefox the outline isn't overriden by a global definition of :-moz-focusring which is coming from tailwinds normalization styling\n"],"names":["FOCUS_OUTLINE"],"mappings":"AAEO,MAAMA,IACT;"}
|
|
@@ -1,8 +1,43 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { Children as a, isValidElement as u, cloneElement as f } from "react";
|
|
2
|
+
import { ForwardedRefSelectItem as E } from "./fondue-components69.js";
|
|
3
|
+
const g = ({
|
|
4
|
+
children: o,
|
|
5
|
+
value: r,
|
|
6
|
+
label: s
|
|
7
|
+
}) => o && typeof o == "string" ? {
|
|
8
|
+
value: r || o,
|
|
9
|
+
label: s || o
|
|
10
|
+
} : {
|
|
11
|
+
value: r || "",
|
|
12
|
+
label: s || r || "",
|
|
13
|
+
...o ? { children: o } : null
|
|
14
|
+
}, w = (o, r) => u(o) && o.type === r, y = (o, r, s, p = 0) => {
|
|
15
|
+
const n = [];
|
|
16
|
+
let t = 0;
|
|
17
|
+
return a.forEach(o, (e) => {
|
|
18
|
+
if (w(e, E) && u(e))
|
|
19
|
+
g(e.props).label.toLowerCase().includes((s == null ? void 0 : s.toLowerCase()) || "") && (n.push(r(e, p + t)), t++);
|
|
20
|
+
else if (u(e) && (e != null && e.props.children)) {
|
|
21
|
+
const { parsedChildren: m, subElementCount: C } = y(
|
|
22
|
+
e.props.children,
|
|
23
|
+
r,
|
|
24
|
+
"",
|
|
25
|
+
p + t
|
|
26
|
+
);
|
|
27
|
+
e = f(e, {
|
|
28
|
+
children: m,
|
|
29
|
+
key: `group-${p + t}`
|
|
30
|
+
}), n.push(e), t += C;
|
|
31
|
+
} else
|
|
32
|
+
n.push(e);
|
|
33
|
+
}), {
|
|
34
|
+
parsedChildren: n,
|
|
35
|
+
subElementCount: t
|
|
36
|
+
};
|
|
4
37
|
};
|
|
5
38
|
export {
|
|
6
|
-
|
|
39
|
+
g as getSelectOptionValue,
|
|
40
|
+
w as isReactLeaf,
|
|
41
|
+
y as recursiveMap
|
|
7
42
|
};
|
|
8
43
|
//# sourceMappingURL=fondue-components92.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fondue-components92.js","sources":["../src/components/
|
|
1
|
+
{"version":3,"file":"fondue-components92.js","sources":["../src/components/Select/utils.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport {\n Children,\n cloneElement,\n isValidElement,\n type JSXElementConstructor,\n type ReactElement,\n type ReactNode,\n} from 'react';\n\nimport { ForwardedRefSelectItem, type SelectItemProps } from './SelectItem';\n\n/**\n * Extracts and returns an object containing `value` and `label` from a given SelectItemProps object.\n * It prioritizes explicit `value` and `label` properties but will fall back to using `children` as the value or label if necessary.\n *\n * @param {SelectItemProps} props - The properties of a select item, which include potential children, value, and label.\n * @returns {{ value: string; label: string, children?: ReactNode }} An object containing `value` and `label` as strings.\n *\n * @example\n * // Returns { value: 'option1', label: 'Option 1' }\n * getSelectOptionValue({ value: 'option1', label: 'Option 1' });\n *\n * @example\n * // Uses children as the value and label when they are not explicitly provided\n * // Returns { value: 'Default', label: 'Default' }\n * getSelectOptionValue({ children: 'Default' });\n */\nexport const getSelectOptionValue = ({\n children,\n value,\n label,\n}: SelectItemProps): {\n value: string;\n label: string;\n children?: ReactNode;\n} => {\n if (children && typeof children === 'string') {\n return {\n value: value ? value : children,\n label: label ? label : children,\n };\n }\n\n return {\n value: value || '',\n label: label ? label : value || '',\n ...(children ? { children } : null),\n };\n};\n/**\n * Determines if the child is a leaf node of React, meaning it has one final child of a native type;\n *\n * @param {ReactNode} child - The React child node to check.\n * @param {JSXElementConstructor<never>} Component - The React component constructor used for comparison.\n * @returns {boolean} Returns true if the `child` is a valid React element of the specified `Component` type.\n *\n * @example\n * // Assuming ForwardedRefSelectItem is a component that renders an <input> element\n * // Returns true\n * isReactLeaf(<ForwardedRefSelectItem />, ForwardedRefSelectItem);\n *\n * @example\n * // Returns false for non-matching types or non-leaf components\n * isReactLeaf(<div><ForwardedRefSelectItem /></div>, ForwardedRefSelectItem);\n */\nexport const isReactLeaf = (child: ReactNode, Component: JSXElementConstructor<never>): child is ReactElement =>\n isValidElement(child) && child.type === Component;\n\n/**\n * Recursively maps through React children, applying a callback to each child that meets the specified conditions.\n * This function is useful for deeply nested structures where modifications or checks are needed at multiple levels.\n *\n * @param {ReactNode} children - The children to be recursively processed.\n * @param {function(ReactNode, number): ReactNode} callback - A function that is called for each child that meets the condition. It receives the child and its index, and returns a React node.\n * @param {string} [filterText=''] - Optional text used to filter children based on their properties.\n * @param {number} [nextIndex=0] - The starting index for numbering children, defaults to 0.\n * @returns {{ parsedChildren: ReactNode[], subElementCount: number }} An object containing the transformed children array and the count of all processed sub-elements.\n *\n * @example\n * // Example usage in a select component where only items containing a certain text are modified\n * recursiveMap(children, (child, index) => React.cloneElement(child, { extraProp: 'value' }), 'specific text');\n *\n * @example\n * // Nested structure transformation, adding class names based on index\n * recursiveMap(children, (child, index) => React.cloneElement(child, { className: `item-${index}` }));\n */\nexport const recursiveMap = (\n children: ReactNode,\n callback: (child: ReactNode, nextIndex: number) => ReactNode,\n filterText?: string,\n nextIndex: number = 0,\n): {\n parsedChildren: ReactNode[];\n subElementCount: number;\n} => {\n const resultingChildren: ReactNode[] = [];\n let itemCounter = 0;\n Children.forEach(children, (child) => {\n if (isReactLeaf(child, ForwardedRefSelectItem) && isValidElement<SelectItemProps>(child)) {\n if (\n getSelectOptionValue(child.props)\n .label.toLowerCase()\n .includes(filterText?.toLowerCase() || '')\n ) {\n resultingChildren.push(callback(child, nextIndex + itemCounter));\n itemCounter++;\n }\n } else if (isValidElement<{ children: ReactNode }>(child) && child?.props.children) {\n const { parsedChildren, subElementCount } = recursiveMap(\n child.props.children,\n callback,\n '',\n nextIndex + itemCounter,\n );\n child = cloneElement(child, {\n children: parsedChildren,\n key: `group-${nextIndex + itemCounter}`,\n });\n resultingChildren.push(child);\n itemCounter += subElementCount;\n } else {\n resultingChildren.push(child);\n }\n });\n return {\n parsedChildren: resultingChildren,\n subElementCount: itemCounter,\n };\n};\n"],"names":["getSelectOptionValue","children","value","label","isReactLeaf","child","Component","isValidElement","recursiveMap","callback","filterText","nextIndex","resultingChildren","itemCounter","Children","ForwardedRefSelectItem","parsedChildren","subElementCount","cloneElement"],"mappings":";;AA6BO,MAAMA,IAAuB,CAAC;AAAA,EACjC,UAAAC;AAAA,EACA,OAAAC;AAAA,EACA,OAAAC;AACJ,MAKQF,KAAY,OAAOA,KAAa,WACzB;AAAA,EACH,OAAOC,KAAgBD;AAAA,EACvB,OAAOE,KAAgBF;AAAA,IAIxB;AAAA,EACH,OAAOC,KAAS;AAAA,EAChB,OAAOC,KAAgBD,KAAS;AAAA,EAChC,GAAID,IAAW,EAAE,UAAAA,MAAa;AAAA,GAmBzBG,IAAc,CAACC,GAAkBC,MAC1CC,EAAeF,CAAK,KAAKA,EAAM,SAASC,GAoB/BE,IAAe,CACxBP,GACAQ,GACAC,GACAC,IAAoB,MAInB;AACD,QAAMC,IAAiC,CAAA;AACvC,MAAIC,IAAc;AAClB,SAAAC,EAAS,QAAQb,GAAU,CAACI,MAAU;AAClC,QAAID,EAAYC,GAAOU,CAAsB,KAAKR,EAAgCF,CAAK;AACnF,MACIL,EAAqBK,EAAM,KAAK,EAC3B,MAAM,cACN,UAASK,KAAA,gBAAAA,EAAY,kBAAiB,EAAE,MAE7CE,EAAkB,KAAKH,EAASJ,GAAOM,IAAYE,CAAW,CAAC,GAC/DA;AAAA,aAEGN,EAAwCF,CAAK,MAAKA,KAAA,QAAAA,EAAO,MAAM,WAAU;AAChF,YAAM,EAAE,gBAAAW,GAAgB,iBAAAC,EAAA,IAAoBT;AAAA,QACxCH,EAAM,MAAM;AAAA,QACZI;AAAA,QACA;AAAA,QACAE,IAAYE;AAAA,MAAA;AAEhB,MAAAR,IAAQa,EAAab,GAAO;AAAA,QACxB,UAAUW;AAAA,QACV,KAAK,SAASL,IAAYE,CAAW;AAAA,MAAA,CACxC,GACDD,EAAkB,KAAKP,CAAK,GAC5BQ,KAAeI;AAAA,IACnB;AACI,MAAAL,EAAkB,KAAKP,CAAK;AAAA,EAEpC,CAAC,GACM;AAAA,IACH,gBAAgBO;AAAA,IAChB,iBAAiBC;AAAA,EAAA;AAEzB;"}
|
|
@@ -1,43 +1,24 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
else if (u(e) && (e != null && e.props.children)) {
|
|
21
|
-
const { parsedChildren: m, subElementCount: C } = y(
|
|
22
|
-
e.props.children,
|
|
23
|
-
r,
|
|
24
|
-
"",
|
|
25
|
-
p + t
|
|
26
|
-
);
|
|
27
|
-
e = f(e, {
|
|
28
|
-
children: m,
|
|
29
|
-
key: `group-${p + t}`
|
|
30
|
-
}), n.push(e), t += C;
|
|
31
|
-
} else
|
|
32
|
-
n.push(e);
|
|
33
|
-
}), {
|
|
34
|
-
parsedChildren: n,
|
|
35
|
-
subElementCount: t
|
|
36
|
-
};
|
|
1
|
+
import { jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { IconCross as s } from "@frontify/fondue-icons";
|
|
3
|
+
import { useTranslation as t } from "./fondue-components35.js";
|
|
4
|
+
import { Button as a } from "./fondue-components6.js";
|
|
5
|
+
import l from "./fondue-components72.js";
|
|
6
|
+
const f = ({ onClear: r }) => {
|
|
7
|
+
const { t: o } = t();
|
|
8
|
+
return /* @__PURE__ */ e(
|
|
9
|
+
a,
|
|
10
|
+
{
|
|
11
|
+
"aria-label": o("Select_clear"),
|
|
12
|
+
type: "button",
|
|
13
|
+
size: "small",
|
|
14
|
+
emphasis: "weak",
|
|
15
|
+
aspect: "square",
|
|
16
|
+
onPress: r,
|
|
17
|
+
children: /* @__PURE__ */ e(s, { className: l.clearIcon, size: 16 })
|
|
18
|
+
}
|
|
19
|
+
);
|
|
37
20
|
};
|
|
38
21
|
export {
|
|
39
|
-
|
|
40
|
-
w as isReactLeaf,
|
|
41
|
-
y as recursiveMap
|
|
22
|
+
f as SelectClear
|
|
42
23
|
};
|
|
43
24
|
//# sourceMappingURL=fondue-components93.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fondue-components93.js","sources":["../src/components/Select/
|
|
1
|
+
{"version":3,"file":"fondue-components93.js","sources":["../src/components/Select/SelectClear.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { IconCross } from '@frontify/fondue-icons';\n\nimport { useTranslation } from '#/hooks/useTranslation';\n\nimport { Button } from '../Button/Button';\n\nimport styles from './styles/select.module.scss';\n\nexport const SelectClear = ({ onClear }: { onClear?: () => void }) => {\n const { t } = useTranslation();\n\n return (\n <Button\n aria-label={t('Select_clear')}\n type=\"button\"\n size=\"small\"\n emphasis=\"weak\"\n aspect=\"square\"\n onPress={onClear}\n >\n <IconCross className={styles.clearIcon} size={16} />\n </Button>\n );\n};\n"],"names":["SelectClear","onClear","t","useTranslation","jsx","Button","IconCross","styles"],"mappings":";;;;;AAUO,MAAMA,IAAc,CAAC,EAAE,SAAAC,QAAwC;AAClE,QAAM,EAAE,GAAAC,EAAA,IAAMC,EAAA;AAEd,SACI,gBAAAC;AAAA,IAACC;AAAA,IAAA;AAAA,MACG,cAAYH,EAAE,cAAc;AAAA,MAC5B,MAAK;AAAA,MACL,MAAK;AAAA,MACL,UAAS;AAAA,MACT,QAAO;AAAA,MACP,SAASD;AAAA,MAET,4BAACK,GAAA,EAAU,WAAWC,EAAO,WAAW,MAAM,GAAA,CAAI;AAAA,IAAA;AAAA,EAAA;AAG9D;"}
|