@frontify/fondue-components 24.0.0 → 24.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.
@@ -1,110 +1,119 @@
1
- import { jsxs as R, jsx as o } from "react/jsx-runtime";
2
- import { IconCheckMark as $, IconExclamationMarkTriangle as b, IconCross as q } from "@frontify/fondue-icons";
3
- import { forwardRef as G, useRef as y, useState as H, useEffect as z } from "react";
4
- import { useSyncRefs as J } from "./fondue-components50.js";
5
- import c from "./fondue-components85.js";
6
- const L = ({
7
- "data-test-id": N = "fondue-textarea",
8
- autocomplete: F,
9
- autosize: S,
10
- clearable: i,
11
- decorator: d,
12
- defaultValue: u,
13
- disabled: r,
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: C,
16
- minRows: B = 1,
17
- maxRows: T,
18
- onEnterPressed: m,
19
- readOnly: n,
20
- resizable: D,
21
- selectable: I = !0,
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: f,
24
- ...t
25
- }, K) => {
26
- const h = y(null), g = y(!1);
27
- J(h, K);
28
- const [k, w] = H(f ?? u ?? ""), v = (l == null ? void 0 : l.length) !== void 0 || i || ["success", "error"].includes(s), j = () => {
29
- w("");
30
- }, x = (a) => {
31
- var e;
32
- a.key === "Enter" && (m == null || m(a)), (e = t.onKeyDown) == null || e.call(t, a);
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
- w(f ?? u ?? "");
36
- }, [u, f]), z(() => {
37
+ S(N ?? g ?? "");
38
+ }, [g, N]), z(() => {
37
39
  var a;
38
- C && ((a = h.current) == null || a.focus());
39
- }, [C]), /* @__PURE__ */ R(
40
+ v && ((a = R.current) == null || a.focus());
41
+ }, [v]), /* @__PURE__ */ F(
40
42
  "div",
41
43
  {
42
- className: c.root,
43
- "data-autosize": S,
44
- "data-clearable": i,
45
- "data-disabled": r || n,
46
- "data-has-decorator": !!d,
47
- "data-has-tools": v,
48
- "data-replicated-value": k,
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": !!T,
52
- "data-test-id": N,
53
- style: { "--max-rows": `${T}` },
52
+ "data-max-rows": !!k,
53
+ "data-test-id": c,
54
+ style: { "--max-rows": `${k}` },
54
55
  children: [
55
- d ? /* @__PURE__ */ o("div", { className: c.decorator, children: d }) : null,
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
- ...t,
60
+ ...r,
60
61
  onMouseDown: (a) => {
61
- g.current = !0, a.currentTarget.dataset.showFocusRing = "false";
62
+ T.current = !0, a.currentTarget.dataset.showFocusRing = "false";
62
63
  },
63
64
  onFocus: (a) => {
64
- var e;
65
- g.current || (a.target.dataset.showFocusRing = "true"), (e = t.onFocus) == null || e.call(t, a);
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 e;
69
- a.target.dataset.showFocusRing = "false", g.current = !1, (e = t.onBlur) == null || e.call(t, a);
69
+ var t;
70
+ a.target.dataset.showFocusRing = "false", T.current = !1, (t = r.onBlur) == null || t.call(r, a);
70
71
  },
71
- autoComplete: F ? "on" : "off",
72
- className: c.textarea,
73
- disabled: r,
74
- onKeyDown: x,
75
- onInput: (a) => w(a.currentTarget.value),
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
- I || (a.currentTarget.selectionStart = a.currentTarget.selectionEnd);
78
+ b || (a.currentTarget.selectionStart = a.currentTarget.selectionEnd);
78
79
  },
79
- readOnly: n,
80
- ref: h,
81
- rows: B,
82
- value: k
80
+ readOnly: d,
81
+ ref: R,
82
+ rows: M,
83
+ value: x
83
84
  }
84
- ),
85
- s === "loading" && /* @__PURE__ */ o("div", { className: c.loadingStatus, "data-test-id": `${N}-loader` }),
86
- v && /* @__PURE__ */ R("div", { className: c.tools, children: [
87
- s === "success" && /* @__PURE__ */ o("div", { className: c.success, children: /* @__PURE__ */ o($, { size: 20 }) }),
88
- s === "error" && /* @__PURE__ */ o("div", { className: c[s], children: /* @__PURE__ */ o(b, { size: 20 }) }),
89
- l == null ? void 0 : l.map(({ icon: a, title: e, callback: M }) => /* @__PURE__ */ o(
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: c.toolsButton,
93
- disabled: r || n,
94
- onClick: M,
95
- title: e,
93
+ className: o.toolsButton,
94
+ disabled: n || d,
95
+ onClick: H,
96
+ title: t,
96
97
  children: a
97
98
  },
98
- e
99
+ t
99
100
  )),
100
- i && /* @__PURE__ */ o("button", { className: c.toolsButton, onClick: j, disabled: r || n, children: /* @__PURE__ */ o(q, { size: 20, fill: "currentColor" }) })
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
- }, Q = G(L);
106
- Q.displayName = "Textarea";
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
- Q as Textarea
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,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,EAAI,WAAWC,EAAO,OAClB,UAAA;AAAA,UAAAlB,MAAW,aACR,gBAAAmB,EAAC,OAAA,EAAI,WAAWD,EAAO,SACnB,UAAA,gBAAAC,EAACI,GAAA,EAAc,MAAM,GAAA,CAAI,EAAA,CAC7B;AAAA,UAEHvB,MAAW,WACR,gBAAAmB,EAAC,OAAA,EAAI,WAAWD,EAAOlB,CAAM,GACzB,UAAA,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,gBAAA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AAA,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,GAER;AAAA,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-components91.js";
3
- import { colorToCss as e } from "./fondue-components92.js";
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
- const s = "_root_i684q_3", o = "_dismiss_i684q_156", t = {
1
+ const s = "_root_1swzw_3", o = "_dismiss_1swzw_156", t = {
2
2
  root: s,
3
3
  dismiss: o
4
4
  };
@@ -1,4 +1,4 @@
1
- import { FOCUS_OUTLINE as t } from "./fondue-components90.js";
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-components90.js";
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-components89.js";
6
+ import a from "./fondue-components92.js";
7
7
  import { getColorWithName as z, colorToCss as x } from "./fondue-components49.js";
8
8
  const c = ({
9
9
  id: m,
@@ -1,26 +1,28 @@
1
- const o = "_root_18lbr_5", t = "_textarea_18lbr_73", s = "_slot_18lbr_123", r = "_decorator_18lbr_137", _ = "_tools_18lbr_150", l = "_toolsButton_18lbr_162", c = "_success_18lbr_194", n = "_error_18lbr_198", e = "_loadingStatus_18lbr_202", a = "_spin_18lbr_1", b = {
2
- root: o,
3
- textarea: t,
4
- slot: s,
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: l,
7
+ tools: e,
8
+ toolsButton: a,
8
9
  success: c,
9
10
  error: n,
10
- loadingStatus: e,
11
- spin: a
11
+ loadingStatus: l,
12
+ spin: h
12
13
  };
13
14
  export {
14
15
  r as decorator,
15
- b as default,
16
+ j as default,
16
17
  n as error,
17
- e as loadingStatus,
18
- o as root,
19
- s as slot,
20
- a as spin,
18
+ l as loadingStatus,
19
+ t as root,
20
+ _ as slot,
21
+ h as spin,
21
22
  c as success,
22
- t as textarea,
23
- _ as tools,
24
- l as toolsButton
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 = "_root_3jye8_5", c = "_clearIcon_3jye8_35", t = "_caret_3jye8_52", _ = "_colorName_3jye8_72", n = "_button_3jye8_93", e = "_colorIndicator_3jye8_105", r = "_actions_3jye8_124", a = {
2
- root: o,
3
- clearIcon: c,
4
- caret: t,
5
- colorName: _,
6
- button: n,
7
- colorIndicator: e,
8
- actions: r
1
+ const o = "_root_18sn3_2", t = {
2
+ root: o
9
3
  };
10
4
  export {
11
- r as actions,
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 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";
1
+ const r = (e) => {
2
+ if (e)
3
+ return `rgba(${e.red}, ${e.green}, ${e.blue}, ${e.alpha ?? 1})`;
4
+ };
2
5
  export {
3
- t as FOCUS_OUTLINE
6
+ r as colorToCss
4
7
  };
5
8
  //# sourceMappingURL=fondue-components90.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"fondue-components90.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
+ {"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 o = "_root_b0bc4_2", t = {
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 default,
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,20 @@
1
- const r = (e) => {
2
- if (e)
3
- return `rgba(${e.red}, ${e.green}, ${e.blue}, ${e.alpha ?? 1})`;
1
+ const o = "_root_3jye8_5", c = "_clearIcon_3jye8_35", t = "_caret_3jye8_52", _ = "_colorName_3jye8_72", n = "_button_3jye8_93", e = "_colorIndicator_3jye8_105", r = "_actions_3jye8_124", a = {
2
+ root: o,
3
+ clearIcon: c,
4
+ caret: t,
5
+ colorName: _,
6
+ button: n,
7
+ colorIndicator: e,
8
+ actions: r
4
9
  };
5
10
  export {
6
- r as colorToCss
11
+ r as actions,
12
+ n as button,
13
+ t as caret,
14
+ c as clearIcon,
15
+ e as colorIndicator,
16
+ _ as colorName,
17
+ a as default,
18
+ o as root
7
19
  };
8
20
  //# sourceMappingURL=fondue-components92.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"fondue-components92.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
+ {"version":3,"file":"fondue-components92.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;"}
package/dist/index.d.ts CHANGED
@@ -804,6 +804,9 @@ declare const enUS: {
804
804
  Badge_dismiss: string;
805
805
  };
806
806
 
807
+ /**
808
+ * @deprecated Use Textarea.Slot instead for custom actions
809
+ */
807
810
  declare type ExtraAction = {
808
811
  icon: ReactElement;
809
812
  title: string;
@@ -1042,6 +1045,10 @@ declare const ForwardedRefSelectItemGroup: ForwardRefExoticComponent<SelectItemG
1042
1045
 
1043
1046
  declare const ForwardedRefSelectSlot: ForwardRefExoticComponent<SelectSlotProps & RefAttributes<HTMLDivElement>>;
1044
1047
 
1048
+ declare const ForwardedRefTextareaRoot: ForwardRefExoticComponent<TextareaProps & RefAttributes<HTMLTextAreaElement>>;
1049
+
1050
+ declare const ForwardedRefTextareaSlot: ForwardRefExoticComponent<TextareaSlotProps & RefAttributes<HTMLDivElement>>;
1051
+
1045
1052
  declare const ForwardedRefTextFieldRoot: ForwardRefExoticComponent<TextInputProps & RefAttributes<HTMLInputElement>>;
1046
1053
 
1047
1054
  declare const ForwardedRefTextFieldSlot: ForwardRefExoticComponent<TextFieldSlotProps & RefAttributes<HTMLDivElement>>;
@@ -2134,13 +2141,20 @@ declare const Text_2: (<TTag extends TagType_2 = "span">(props: TextProps<TTag>
2134
2141
  };
2135
2142
  export { Text_2 as Text }
2136
2143
 
2137
- export declare const Textarea: ForwardRefExoticComponent<TextareaProps & RefAttributes<HTMLTextAreaElement>>;
2144
+ export declare const Textarea: typeof TextareaRoot & {
2145
+ Root: typeof ForwardedRefTextareaRoot;
2146
+ Slot: typeof ForwardedRefTextareaSlot;
2147
+ };
2138
2148
 
2139
2149
  declare type TextareaProps = {
2140
2150
  /**
2141
2151
  * The id of the textarea
2142
2152
  */
2143
2153
  id?: string;
2154
+ /**
2155
+ * The place where the textarea slots are placed
2156
+ */
2157
+ children?: ReactNode;
2144
2158
  /**
2145
2159
  * If `true`, Textarea will have `autoComplete` functionality
2146
2160
  */
@@ -2164,6 +2178,7 @@ declare type TextareaProps = {
2164
2178
  disabled?: boolean;
2165
2179
  /**
2166
2180
  * Collection of extra actions the input can preform
2181
+ * @deprecated Use Textarea.Slot instead for custom actions
2167
2182
  */
2168
2183
  extraActions?: ExtraAction[];
2169
2184
  /**
@@ -2227,6 +2242,17 @@ declare type TextareaProps = {
2227
2242
  value?: string;
2228
2243
  };
2229
2244
 
2245
+ declare const TextareaRoot: {
2246
+ ({ "data-test-id": dataTestId, autocomplete, autosize, children, clearable, decorator, defaultValue, disabled, extraActions, focusOnMount, minRows: rows, maxRows, onEnterPressed, readOnly, resizable, selectable, status, value: inputValue, ...props }: TextareaProps, forwardedRef: ForwardedRef<HTMLTextAreaElement>): JSX_2.Element;
2247
+ displayName: string;
2248
+ };
2249
+
2250
+ declare type TextareaSlotProps = {
2251
+ children: ReactNode;
2252
+ name?: 'left' | 'right';
2253
+ className?: string;
2254
+ };
2255
+
2230
2256
  declare type TextColor = 'default' | 'weak' | 'x-weak' | 'disabled' | 'negative' | 'positive' | 'warning' | 'interactive';
2231
2257
 
2232
2258
  declare type TextElementMap = {