@frontify/fondue 12.0.0-beta.424 → 12.0.0-beta.426

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,12 +1,12 @@
1
- import { jsxs as S, jsx as e } from "react/jsx-runtime";
1
+ import { jsxs as T, jsx as e } from "react/jsx-runtime";
2
2
  import { useFocusRing as f } from "@react-aria/focus";
3
3
  import { forwardRef as z, useRef as et, useImperativeHandle as rt, useState as ot, useEffect as O } from "react";
4
4
  import st from "../../foundation/Icon/Generated/IconCheckMark.es.js";
5
5
  import it from "../../foundation/Icon/Generated/IconClipboard.es.js";
6
6
  import nt from "../../foundation/Icon/Generated/IconCross.es.js";
7
7
  import ct from "../../foundation/Icon/Generated/IconCrossCircle.es.js";
8
- import lt from "../../foundation/Icon/Generated/IconExclamationMarkTriangle.es.js";
9
- import at from "../../foundation/Icon/Generated/IconEye.es.js";
8
+ import at from "../../foundation/Icon/Generated/IconExclamationMarkTriangle.es.js";
9
+ import lt from "../../foundation/Icon/Generated/IconEye.es.js";
10
10
  import wt from "../../foundation/Icon/Generated/IconEyeOff.es.js";
11
11
  import { useCopy as ut } from "../../hooks/useCopy.es.js";
12
12
  import { useMemoizedId as dt } from "../../hooks/useMemoizedId.es.js";
@@ -15,12 +15,12 @@ import { merge as i } from "../../utilities/merge.es.js";
15
15
  import { validationClassMap as pt, Validation as u } from "../../utilities/validation.es.js";
16
16
  import { LegacyTooltip as ft } from "../LegacyTooltip/LegacyTooltip.es.js";
17
17
  import { LoadingCircle as mt, LoadingCircleSize as bt } from "../LoadingCircle/LoadingCircle.es.js";
18
- var xt = /* @__PURE__ */ ((r) => (r.Text = "text", r.Password = "password", r.Number = "number", r))(xt || {});
19
- const kt = ({ extraAction: r, disabled: l }, b) => {
18
+ var xt = /* @__PURE__ */ ((r) => (r.Text = "text", r.Password = "password", r.Number = "number", r.Search = "search", r))(xt || {});
19
+ const kt = ({ extraAction: r, disabled: a }, b) => {
20
20
  const { isFocusVisible: n, focusProps: k } = f();
21
21
  if (!r)
22
22
  return null;
23
- const d = l || r.disabled;
23
+ const d = a || r.disabled;
24
24
  return /* @__PURE__ */ e(
25
25
  "button",
26
26
  {
@@ -43,7 +43,7 @@ const kt = ({ extraAction: r, disabled: l }, b) => {
43
43
  }, R = z(kt), ht = z(
44
44
  ({
45
45
  id: r,
46
- type: l = "text",
46
+ type: a = "text",
47
47
  decorator: b,
48
48
  validation: n = u.Default,
49
49
  clearable: k = !1,
@@ -55,7 +55,7 @@ const kt = ({ extraAction: r, disabled: l }, b) => {
55
55
  dotted: W = !1,
56
56
  value: h = "",
57
57
  copyable: $ = !1,
58
- onChange: a,
58
+ onChange: l,
59
59
  onEnterPressed: N,
60
60
  onBlur: g,
61
61
  onClear: y,
@@ -73,8 +73,8 @@ const kt = ({ extraAction: r, disabled: l }, b) => {
73
73
  rt(_, () => w.current, []);
74
74
  const { isFocusVisible: q, focusProps: c } = f({
75
75
  isTextInput: !0
76
- }), { isFocusVisible: j, focusProps: G } = f(), { isFocusVisible: B, focusProps: J } = f(), { isFocusVisible: P, focusProps: Q } = f(), { copy: X, status: F } = ut(), [x, T] = ot(
77
- typeof p == "boolean" ? p : l === "password"
76
+ }), { isFocusVisible: j, focusProps: G } = f(), { isFocusVisible: B, focusProps: J } = f(), { isFocusVisible: P, focusProps: Q } = f(), { copy: X, status: F } = ut(), [x, L] = ot(
77
+ typeof p == "boolean" ? p : a === "password"
78
78
  /* Password */
79
79
  );
80
80
  O(() => {
@@ -83,12 +83,12 @@ const kt = ({ extraAction: r, disabled: l }, b) => {
83
83
  C && ((t = w.current) == null || t.focus());
84
84
  }, 0);
85
85
  }, [C]), O(() => {
86
- typeof p == "boolean" && T(p);
86
+ typeof p == "boolean" && L(p);
87
87
  }, [p]);
88
88
  const Z = (t) => {
89
89
  t.key === "Enter" && N && N(t);
90
- }, A = () => l === "password" ? x ? "password" : "text" : l, tt = typeof V == "boolean" ? { spellCheck: V } : null;
91
- return /* @__PURE__ */ S(
90
+ }, A = () => a === "password" ? x ? "password" : "text" : a, tt = typeof V == "boolean" ? { spellCheck: V } : null;
91
+ return /* @__PURE__ */ T(
92
92
  "div",
93
93
  {
94
94
  ...Y,
@@ -128,7 +128,7 @@ const kt = ({ extraAction: r, disabled: l }, b) => {
128
128
  var t;
129
129
  return (t = w.current) == null ? void 0 : t.focus();
130
130
  },
131
- onChange: (t) => a == null ? void 0 : a(t.currentTarget.value),
131
+ onChange: (t) => l == null ? void 0 : l(t.currentTarget.value),
132
132
  onBlur: (t) => {
133
133
  var s;
134
134
  (s = c.onBlur) == null || s.call(c, t), g == null || g(t);
@@ -152,15 +152,15 @@ const kt = ({ extraAction: r, disabled: l }, b) => {
152
152
  }
153
153
  ),
154
154
  I && I.length > 0 && I.map((t, s) => {
155
- const L = `text-input-extra-action-${s}`;
155
+ const S = `text-input-extra-action-${s}`;
156
156
  return t.tooltip ? /* @__PURE__ */ e(
157
157
  ft,
158
158
  {
159
159
  ...t.tooltip,
160
160
  triggerElement: /* @__PURE__ */ e(R, { extraAction: t, disabled: o })
161
161
  },
162
- L
163
- ) : /* @__PURE__ */ e(R, { extraAction: t, disabled: o }, L);
162
+ S
163
+ ) : /* @__PURE__ */ e(R, { extraAction: t, disabled: o }, S);
164
164
  }),
165
165
  `${h}`.length > 0 && k && /* @__PURE__ */ e(
166
166
  "button",
@@ -172,7 +172,7 @@ const kt = ({ extraAction: r, disabled: l }, b) => {
172
172
  ]),
173
173
  onClick: () => {
174
174
  var t, s;
175
- (t = w.current) == null || t.focus(), (s = w.current) == null || s.setAttribute("value", ""), a == null || a(""), y == null || y();
175
+ (t = w.current) == null || t.focus(), (s = w.current) == null || s.setAttribute("value", ""), l == null || l(""), y == null || y();
176
176
  },
177
177
  "data-test-id": "clear-icon",
178
178
  title: "Clear text input",
@@ -183,7 +183,7 @@ const kt = ({ extraAction: r, disabled: l }, b) => {
183
183
  children: /* @__PURE__ */ e(nt, {})
184
184
  }
185
185
  ),
186
- l === "password" && /* @__PURE__ */ e(
186
+ a === "password" && /* @__PURE__ */ e(
187
187
  "button",
188
188
  {
189
189
  className: i([
@@ -191,14 +191,14 @@ const kt = ({ extraAction: r, disabled: l }, b) => {
191
191
  o ? "tw-cursor-default tw-text-black-40" : "tw-text-black-60 hover:tw-text-black-100",
192
192
  B && m
193
193
  ]),
194
- onClick: () => T(!x),
194
+ onClick: () => L(!x),
195
195
  "data-test-id": "visibility-icon",
196
196
  title: "Toggle text visibility",
197
197
  type: "button",
198
198
  "aria-label": `${x ? "unveil" : "obfuscate"} text input`,
199
199
  disabled: o,
200
200
  ...J,
201
- children: x ? /* @__PURE__ */ e(at, {}) : /* @__PURE__ */ e(wt, {})
201
+ children: x ? /* @__PURE__ */ e(lt, {}) : /* @__PURE__ */ e(wt, {})
202
202
  }
203
203
  ),
204
204
  n === u.Loading && /* @__PURE__ */ e("span", { className: "tw-absolute tw-top-[-0.55rem] tw-right-[-0.55rem] tw-bg-white tw-rounded-full tw-p-[2px] tw-border tw-border-black-10", children: /* @__PURE__ */ e(mt, { size: bt.ExtraSmall }) }),
@@ -211,10 +211,10 @@ const kt = ({ extraAction: r, disabled: l }, b) => {
211
211
  n === u.Warning && "tw-text-text-warning"
212
212
  ]),
213
213
  "data-test-id": "error-state-exclamation-mark-icon",
214
- children: /* @__PURE__ */ e(lt, {})
214
+ children: /* @__PURE__ */ e(at, {})
215
215
  }
216
216
  ),
217
- $ && /* @__PURE__ */ S(
217
+ $ && /* @__PURE__ */ T(
218
218
  "button",
219
219
  {
220
220
  className: i([
@@ -1 +1 @@
1
- {"version":3,"file":"TextInput.es.js","sources":["../../../src/components/TextInput/TextInput.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { useFocusRing } from '@react-aria/focus';\nimport {\n type AriaAttributes,\n type FocusEvent,\n type ForwardRefRenderFunction,\n type KeyboardEvent,\n type ReactElement,\n type ReactNode,\n forwardRef,\n useEffect,\n useImperativeHandle,\n useRef,\n useState,\n} from 'react';\n\nimport { LoadingCircle, LoadingCircleSize } from '@components/LoadingCircle';\nimport IconCheckMark from '@foundation/Icon/Generated/IconCheckMark';\nimport IconClipboard from '@foundation/Icon/Generated/IconClipboard';\nimport IconCross from '@foundation/Icon/Generated/IconCross';\nimport IconCrossCircle from '@foundation/Icon/Generated/IconCrossCircle';\nimport IconExclamationMarkTriangle from '@foundation/Icon/Generated/IconExclamationMarkTriangle';\nimport IconEye from '@foundation/Icon/Generated/IconEye';\nimport IconEyeOff from '@foundation/Icon/Generated/IconEyeOff';\nimport { useCopy } from '@hooks/useCopy';\nimport { useMemoizedId } from '@hooks/useMemoizedId';\nimport { FOCUS_STYLE } from '@utilities/focusStyle';\nimport { merge } from '@utilities/merge';\nimport { Validation, validationClassMap } from '@utilities/validation';\n\nimport { LegacyTooltip, type LegacyTooltipProps } from '../LegacyTooltip';\n\nexport enum TextInputType {\n Text = 'text',\n Password = 'password',\n Number = 'number',\n}\n\nexport type TextInputExtraAction = {\n onClick: () => void;\n icon: ReactElement;\n title: string;\n tooltip?: Omit<LegacyTooltipProps, 'triggerElement'>;\n disabled?: boolean;\n};\n\nexport type TextInputBaseProps = {\n id?: string;\n type?: TextInputType;\n decorator?: ReactNode;\n dotted?: boolean;\n clearable?: boolean;\n placeholder?: string;\n required?: boolean;\n disabled?: boolean;\n autocomplete?: boolean;\n readonly?: boolean;\n validation?: Validation;\n copyable?: boolean;\n value?: string;\n onChange?: (value: string) => void;\n onEnterPressed?: (event: KeyboardEvent<HTMLInputElement>) => void;\n onBlur?: (event: FocusEvent<HTMLInputElement>) => void;\n onFocus?: (event: FocusEvent<HTMLInputElement>) => void;\n onClear?: () => void;\n maxLength?: number;\n size?: number;\n spellcheck?: boolean;\n /** @deprecated a `ref` can be forwarded to expose the underlying `<input />` DOM node.\n @example\n ```tsx\n import { TextInput } from '@frontify/fondue';\n\n const Component = () => {\n const inputRef = useRef();\n\n useEffect(() => {\n if (inputRef.current) {\n inputRef.current.focus();\n }\n }, [)\n return <TextInput ref={inputRef} />\n }\n ```\n */\n focusOnMount?: boolean;\n selectable?: boolean;\n extraActions?: TextInputExtraAction[];\n ariaLabel?: string;\n} & AriaAttributes;\n\nexport type TextInputProps =\n | ({\n type?: TextInputType.Text;\n obfuscated?: false;\n } & TextInputBaseProps)\n | ({\n type?: TextInputType.Number;\n obfuscated?: false;\n min?: number;\n max?: number;\n } & TextInputBaseProps)\n | ({\n type: TextInputType.Password;\n obfuscated?: boolean;\n } & TextInputBaseProps);\n\ntype ExtraActionButtonProps = {\n extraAction: TextInputExtraAction;\n disabled: boolean;\n};\n\nconst ExtraActionButton: ForwardRefRenderFunction<HTMLButtonElement | null, ExtraActionButtonProps> = (\n { extraAction, disabled },\n ref,\n): ReactElement | null => {\n const { isFocusVisible: extraActionButtonIsFocusVisible, focusProps: extraActionButtonFocusProps } = useFocusRing();\n\n if (!extraAction) {\n return null;\n }\n\n const isDisabled = disabled || extraAction.disabled;\n return (\n <button\n className={merge([\n 'tw-flex tw-items-center tw-justify-center tw-transition-colors tw-rounded tw-p-1',\n isDisabled\n ? 'tw-cursor-default tw-text-text-disabled'\n : 'tw-text-text-weak hover:tw-bg-box-neutral-hover hover:tw-text-box-neutral-inverse-hover',\n extraActionButtonIsFocusVisible && FOCUS_STYLE,\n ])}\n onClick={extraAction.onClick}\n data-test-id=\"fondue-extra-action-icon\"\n aria-label={extraAction.title.toLowerCase()}\n disabled={isDisabled}\n aria-disabled={isDisabled}\n type=\"button\"\n ref={ref}\n {...extraActionButtonFocusProps}\n >\n {extraAction.icon}\n </button>\n );\n};\nconst ExtraActionButtonWithRef = forwardRef(ExtraActionButton);\n\nexport const TextInput = forwardRef<HTMLInputElement, TextInputProps>(\n (\n {\n id: propId,\n type = TextInputType.Text,\n decorator,\n validation = Validation.Default,\n clearable = false,\n placeholder,\n required,\n obfuscated,\n disabled = false,\n autocomplete = false,\n dotted = false,\n value = '',\n copyable = false,\n onChange,\n onEnterPressed,\n onBlur,\n onClear,\n onFocus,\n size,\n spellcheck,\n readonly,\n focusOnMount,\n selectable = false,\n extraActions,\n maxLength,\n ...props\n },\n ref,\n ): ReactElement => {\n const inputElement = useRef<HTMLInputElement | null>(null);\n useImperativeHandle(ref, () => inputElement.current!, []);\n\n const { isFocusVisible: inputIsFocusVisible, focusProps: inputFocusProps } = useFocusRing({\n isTextInput: true,\n });\n const { isFocusVisible: clearButtonIsFocusVisible, focusProps: clearButtonFocusProps } = useFocusRing();\n const { isFocusVisible: passwordButtonIsFocusVisible, focusProps: passwordButtonFocusProps } = useFocusRing();\n const { isFocusVisible: copyButtonIsFocusVisible, focusProps: copyButtonFocusProps } = useFocusRing();\n\n const { copy, status } = useCopy();\n\n const [isObfuscated, setIsObfuscated] = useState(\n typeof obfuscated === 'boolean' ? obfuscated : type === TextInputType.Password,\n );\n\n useEffect(() => {\n setTimeout(() => {\n focusOnMount && inputElement.current?.focus();\n }, 0);\n }, [focusOnMount]);\n\n useEffect(() => {\n if (typeof obfuscated === 'boolean') {\n setIsObfuscated(obfuscated);\n }\n }, [obfuscated]);\n\n const onKeyDown = (event: KeyboardEvent<HTMLInputElement>) => {\n if (event.key === 'Enter' && onEnterPressed) {\n onEnterPressed(event);\n }\n };\n\n const getInputType = () => {\n if (type === TextInputType.Password) {\n return isObfuscated ? TextInputType.Password : TextInputType.Text;\n }\n return type;\n };\n\n const spellcheckProp = typeof spellcheck === 'boolean' ? { spellCheck: spellcheck } : null;\n\n return (\n <div\n {...props}\n className={merge([\n 'tw-flex tw-items-center tw-h-9 tw-gap-2 tw-px-3 tw-border tw-transition tw-rounded tw-text-body-small tw-font-sans tw-relative tw-bg-base dark:tw-bg-transparent',\n dotted ? 'tw-border-dashed' : 'tw-border-solid',\n disabled || readonly\n ? 'tw-bg-box-disabled dark:tw-bg-box-disabled hover:tw-cursor-not-allowed tw-border-line-weak dark:tw-border-line-weak'\n : merge([\n 'focus-within:tw-border-line-xx-strong focus-within:hover:tw-border-line-xx-strong hover:tw-border-line-x-strong',\n validationClassMap[validation],\n inputIsFocusVisible &&\n !clearButtonIsFocusVisible &&\n !passwordButtonIsFocusVisible &&\n !copyButtonIsFocusVisible &&\n FOCUS_STYLE,\n ]),\n ])}\n data-test-id=\"fondue-text-input-component\"\n >\n {decorator && (\n <div\n className={merge([\n 'tw-flex tw-items-center tw-justify-center tw-pl-1',\n disabled ? 'tw-text-black-60' : 'tw-text-black-80',\n ])}\n data-test-id=\"decorator\"\n >\n {decorator}\n </div>\n )}\n <input\n {...inputFocusProps}\n id={useMemoizedId(propId)}\n ref={inputElement}\n className={merge([\n 'tw-w-full tw-grow tw-border-none tw-outline-none tw-bg-transparent tw-hide-input-arrows',\n disabled || readonly\n ? 'tw-text-text-disabled tw-placeholder-text-disabled dark:tw-text-black-30 dark:tw-placeholder-black-40 hover:tw-cursor-not-allowed'\n : 'tw-text-black tw-placeholder-black-60 dark:tw-text-white',\n ])}\n onClick={() => inputElement.current?.focus()}\n onChange={(event) => onChange?.(event.currentTarget.value)}\n onBlur={(e) => {\n inputFocusProps.onBlur?.(e);\n onBlur?.(e);\n }}\n onKeyDown={onKeyDown}\n placeholder={placeholder}\n value={value}\n type={getInputType()}\n required={required}\n readOnly={readonly}\n disabled={disabled}\n onFocus={(e) => {\n inputFocusProps.onFocus?.(e);\n if (selectable) {\n e.target.select();\n }\n if (onFocus) {\n onFocus(e);\n }\n }}\n autoComplete={autocomplete ? 'on' : 'off'}\n maxLength={maxLength}\n size={size}\n data-test-id=\"text-input\"\n {...spellcheckProp}\n />\n {extraActions &&\n extraActions.length > 0 &&\n extraActions.map((extraAction: TextInputExtraAction, index: number) => {\n const key = `text-input-extra-action-${index}`;\n if (extraAction.tooltip) {\n return (\n <LegacyTooltip\n key={key}\n {...extraAction.tooltip}\n triggerElement={\n <ExtraActionButtonWithRef extraAction={extraAction} disabled={disabled} />\n }\n />\n );\n }\n return <ExtraActionButtonWithRef key={key} extraAction={extraAction} disabled={disabled} />;\n })}\n {`${value}`.length > 0 && clearable && (\n <button\n className={merge([\n 'tw-flex tw-items-center tw-justify-center tw-transition-colors tw-rounded',\n disabled\n ? 'tw-cursor-default tw-text-black-40'\n : 'tw-text-black-60 hover:tw-text-black-100',\n clearButtonIsFocusVisible && FOCUS_STYLE,\n ])}\n onClick={() => {\n inputElement.current?.focus();\n inputElement.current?.setAttribute('value', '');\n\n onChange?.('');\n onClear?.();\n }}\n data-test-id=\"clear-icon\"\n title=\"Clear text input\"\n aria-label=\"clear text input\"\n disabled={disabled}\n type=\"button\"\n {...clearButtonFocusProps}\n >\n <IconCross />\n </button>\n )}\n {type === TextInputType.Password && (\n <button\n className={merge([\n 'tw-flex tw-items-center tw-justify-center tw-transition-colors tw-rounded',\n disabled\n ? 'tw-cursor-default tw-text-black-40'\n : 'tw-text-black-60 hover:tw-text-black-100',\n passwordButtonIsFocusVisible && FOCUS_STYLE,\n ])}\n onClick={() => setIsObfuscated(!isObfuscated)}\n data-test-id=\"visibility-icon\"\n title=\"Toggle text visibility\"\n type=\"button\"\n aria-label={`${isObfuscated ? 'unveil' : 'obfuscate'} text input`}\n disabled={disabled}\n {...passwordButtonFocusProps}\n >\n {isObfuscated ? <IconEye /> : <IconEyeOff />}\n </button>\n )}\n {validation === Validation.Loading && (\n <span className=\"tw-absolute tw-top-[-0.55rem] tw-right-[-0.55rem] tw-bg-white tw-rounded-full tw-p-[2px] tw-border tw-border-black-10\">\n <LoadingCircle size={LoadingCircleSize.ExtraSmall} />\n </span>\n )}\n {(validation === Validation.Error || validation === Validation.Warning) && (\n <span\n className={merge([\n 'tw-flex tw-items-center tw-justify-center',\n validation === Validation.Error && 'tw-text-text-negative',\n validation === Validation.Warning && 'tw-text-text-warning',\n ])}\n data-test-id=\"error-state-exclamation-mark-icon\"\n >\n <IconExclamationMarkTriangle />\n </span>\n )}\n {copyable && (\n <button\n className={merge([\n 'tw-flex tw-items-center tw-justify-center tw-transition-colors tw-rounded',\n disabled\n ? 'tw-cursor-default tw-text-black-40'\n : 'tw-text-black-60 hover:tw-text-black-100',\n copyButtonIsFocusVisible && FOCUS_STYLE,\n ])}\n onClick={() => copy(value)}\n data-test-id=\"copy-icon\"\n title=\"Copy input text\"\n disabled={disabled}\n type=\"button\"\n {...copyButtonFocusProps}\n >\n {status === 'error' && (\n <span className=\"tw-text-box-negative-strong\">\n <IconCrossCircle />\n </span>\n )}\n {status === 'idle' && <IconClipboard />}\n {status === 'success' && (\n <span className=\"tw-text-box-positive-strong\">\n <IconCheckMark />\n </span>\n )}\n </button>\n )}\n </div>\n );\n },\n);\nTextInput.displayName = 'FondueTextInput';\n"],"names":["TextInputType","ExtraActionButton","extraAction","disabled","ref","extraActionButtonIsFocusVisible","extraActionButtonFocusProps","useFocusRing","isDisabled","jsx","merge","FOCUS_STYLE","ExtraActionButtonWithRef","forwardRef","TextInput","propId","type","decorator","validation","Validation","clearable","placeholder","required","obfuscated","autocomplete","dotted","value","copyable","onChange","onEnterPressed","onBlur","onClear","onFocus","size","spellcheck","readonly","focusOnMount","selectable","extraActions","maxLength","props","inputElement","useRef","useImperativeHandle","inputIsFocusVisible","inputFocusProps","clearButtonIsFocusVisible","clearButtonFocusProps","passwordButtonIsFocusVisible","passwordButtonFocusProps","copyButtonIsFocusVisible","copyButtonFocusProps","copy","status","useCopy","isObfuscated","setIsObfuscated","useState","useEffect","_a","onKeyDown","event","getInputType","spellcheckProp","jsxs","validationClassMap","useMemoizedId","e","index","key","LegacyTooltip","_b","IconCross","IconEye","IconEyeOff","LoadingCircle","LoadingCircleSize","IconExclamationMarkTriangle","IconCrossCircle","IconClipboard","IconCheckMark"],"mappings":";;;;;;;;;;;;;;;;;AAiCY,IAAAA,uBAAAA,OACRA,EAAA,OAAO,QACPA,EAAA,WAAW,YACXA,EAAA,SAAS,UAHDA,IAAAA,MAAA,CAAA,CAAA;AAgFZ,MAAMC,KAAgG,CAClG,EAAE,aAAAC,GAAa,UAAAC,EAAA,GACfC,MACsB;AACtB,QAAM,EAAE,gBAAgBC,GAAiC,YAAYC,EAAA,IAAg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xD,MAAeC,EAAW,WACvB,gBAAAV,EAAC,QAAK,EAAA,WAAU,yHACZ,UAAA,gBAAAA,EAACkE,IAAc,EAAA,MAAMC,GAAkB,WAAY,CAAA,GACvD;AAAA,WAEF1D,MAAeC,EAAW,SAASD,MAAeC,EAAW,YAC3D,gBAAAV;AAAA,YAAC;AAAA,YAAA;AAAA,cACG,WAAWC,EAAM;AAAA,gBACb;AAAA,gBACAQ,MAAeC,EAAW,SAAS;AAAA,gBACnCD,MAAeC,EAAW,WAAW;AAAA,cAAA,CACxC;AAAA,cACD,gBAAa;AAAA,cAEb,4BAAC0D,IAA4B,EAAA;AAAA,YAAA;AAAA,UACjC;AAAA,UAEHlD,KACG,gBAAAqC;AAAA,YAAC;AAAA,YAAA;AAAA,cACG,WAAWtD,EAAM;AAAA,gBACb;AAAA,gBACAP,IACM,uCACA;AAAA,gBACN+C,KAA4BvC;AAAA,cAAA,CAC/B;AAAA,cACD,SAAS,MAAMyC,EAAK1B,CAAK;AAAA,cACzB,gBAAa;AAAA,cACb,OAAM;AAAA,cACN,UAAAvB;AAAA,cACA,MAAK;AAAA,cACJ,GAAGgD;AAAA,cAEH,UAAA;AAAA,gBAAAE,MAAW,WACP,gBAAA5C,EAAA,QAAA,EAAK,WAAU,+BACZ,UAAA,gBAAAA,EAACqE,MAAgB,EACrB,CAAA;AAAA,gBAEHzB,MAAW,UAAU,gBAAA5C,EAACsE,IAAc,CAAA,CAAA;AAAA,gBACpC1B,MAAW,aACP,gBAAA5C,EAAA,QAAA,EAAK,WAAU,+BACZ,UAAA,gBAAAA,EAACuE,MAAc,EACnB,CAAA;AAAA,cAAA;AAAA,YAAA;AAAA,UAER;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAIhB;AACJ;AACAlE,GAAU,cAAc;"}
1
+ {"version":3,"file":"TextInput.es.js","sources":["../../../src/components/TextInput/TextInput.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { useFocusRing } from '@react-aria/focus';\nimport {\n type AriaAttributes,\n type FocusEvent,\n type ForwardRefRenderFunction,\n type KeyboardEvent,\n type ReactElement,\n type ReactNode,\n forwardRef,\n useEffect,\n useImperativeHandle,\n useRef,\n useState,\n} from 'react';\n\nimport { LoadingCircle, LoadingCircleSize } from '@components/LoadingCircle';\nimport IconCheckMark from '@foundation/Icon/Generated/IconCheckMark';\nimport IconClipboard from '@foundation/Icon/Generated/IconClipboard';\nimport IconCross from '@foundation/Icon/Generated/IconCross';\nimport IconCrossCircle from '@foundation/Icon/Generated/IconCrossCircle';\nimport IconExclamationMarkTriangle from '@foundation/Icon/Generated/IconExclamationMarkTriangle';\nimport IconEye from '@foundation/Icon/Generated/IconEye';\nimport IconEyeOff from '@foundation/Icon/Generated/IconEyeOff';\nimport { useCopy } from '@hooks/useCopy';\nimport { useMemoizedId } from '@hooks/useMemoizedId';\nimport { FOCUS_STYLE } from '@utilities/focusStyle';\nimport { merge } from '@utilities/merge';\nimport { Validation, validationClassMap } from '@utilities/validation';\n\nimport { LegacyTooltip, type LegacyTooltipProps } from '../LegacyTooltip';\n\nexport enum TextInputType {\n Text = 'text',\n Password = 'password',\n Number = 'number',\n Search = 'search',\n}\n\nexport type TextInputExtraAction = {\n onClick: () => void;\n icon: ReactElement;\n title: string;\n tooltip?: Omit<LegacyTooltipProps, 'triggerElement'>;\n disabled?: boolean;\n};\n\nexport type TextInputBaseProps = {\n id?: string;\n type?: TextInputType;\n decorator?: ReactNode;\n dotted?: boolean;\n clearable?: boolean;\n placeholder?: string;\n required?: boolean;\n disabled?: boolean;\n autocomplete?: boolean;\n readonly?: boolean;\n validation?: Validation;\n copyable?: boolean;\n value?: string;\n onChange?: (value: string) => void;\n onEnterPressed?: (event: KeyboardEvent<HTMLInputElement>) => void;\n onBlur?: (event: FocusEvent<HTMLInputElement>) => void;\n onFocus?: (event: FocusEvent<HTMLInputElement>) => void;\n onClear?: () => void;\n maxLength?: number;\n size?: number;\n spellcheck?: boolean;\n /** @deprecated a `ref` can be forwarded to expose the underlying `<input />` DOM node.\n @example\n ```tsx\n import { TextInput } from '@frontify/fondue';\n\n const Component = () => {\n const inputRef = useRef();\n\n useEffect(() => {\n if (inputRef.current) {\n inputRef.current.focus();\n }\n }, [)\n return <TextInput ref={inputRef} />\n }\n ```\n */\n focusOnMount?: boolean;\n selectable?: boolean;\n extraActions?: TextInputExtraAction[];\n ariaLabel?: string;\n} & AriaAttributes;\n\ntype TextInputTextProps = TextInputBaseProps & {\n type?: TextInputType.Text;\n obfuscated?: false;\n};\ntype TextInputSearchProps = TextInputBaseProps & {\n type: TextInputType.Search;\n obfuscated?: false;\n};\ntype TextInputNumberProps = TextInputBaseProps & {\n type: TextInputType.Number;\n min?: number;\n max?: number;\n obfuscated?: false;\n};\ntype TextInputPasswordProps = TextInputBaseProps & {\n type: TextInputType.Password;\n obfuscated?: boolean;\n};\nexport type TextInputProps = TextInputTextProps | TextInputNumberProps | TextInputPasswordProps | TextInputSearchProps;\n\ntype ExtraActionButtonProps = {\n extraAction: TextInputExtraAction;\n disabled: boolean;\n};\n\nconst ExtraActionButton: ForwardRefRenderFunction<HTMLButtonElement | null, ExtraActionButtonProps> = (\n { extraAction, disabled },\n ref,\n): ReactElement | null => {\n const { isFocusVisible: extraActionButtonIsFocusVisible, focusProps: extraActionButtonFocusProps } = useFocusRing();\n\n if (!extraAction) {\n return null;\n }\n\n const isDisabled = disabled || extraAction.disabled;\n return (\n <button\n className={merge([\n 'tw-flex tw-items-center tw-justify-center tw-transition-colors tw-rounded tw-p-1',\n isDisabled\n ? 'tw-cursor-default tw-text-text-disabled'\n : 'tw-text-text-weak hover:tw-bg-box-neutral-hover hover:tw-text-box-neutral-inverse-hover',\n extraActionButtonIsFocusVisible && FOCUS_STYLE,\n ])}\n onClick={extraAction.onClick}\n data-test-id=\"fondue-extra-action-icon\"\n aria-label={extraAction.title.toLowerCase()}\n disabled={isDisabled}\n aria-disabled={isDisabled}\n type=\"button\"\n ref={ref}\n {...extraActionButtonFocusProps}\n >\n {extraAction.icon}\n </button>\n );\n};\nconst ExtraActionButtonWithRef = forwardRef(ExtraActionButton);\n\nexport const TextInput = forwardRef<HTMLInputElement, TextInputProps>(\n (\n {\n id: propId,\n type = TextInputType.Text,\n decorator,\n validation = Validation.Default,\n clearable = false,\n placeholder,\n required,\n obfuscated,\n disabled = false,\n autocomplete = false,\n dotted = false,\n value = '',\n copyable = false,\n onChange,\n onEnterPressed,\n onBlur,\n onClear,\n onFocus,\n size,\n spellcheck,\n readonly,\n focusOnMount,\n selectable = false,\n extraActions,\n maxLength,\n ...props\n },\n ref,\n ): ReactElement => {\n const inputElement = useRef<HTMLInputElement | null>(null);\n useImperativeHandle(ref, () => inputElement.current!, []);\n\n const { isFocusVisible: inputIsFocusVisible, focusProps: inputFocusProps } = useFocusRing({\n isTextInput: true,\n });\n const { isFocusVisible: clearButtonIsFocusVisible, focusProps: clearButtonFocusProps } = useFocusRing();\n const { isFocusVisible: passwordButtonIsFocusVisible, focusProps: passwordButtonFocusProps } = useFocusRing();\n const { isFocusVisible: copyButtonIsFocusVisible, focusProps: copyButtonFocusProps } = useFocusRing();\n\n const { copy, status } = useCopy();\n\n const [isObfuscated, setIsObfuscated] = useState(\n typeof obfuscated === 'boolean' ? obfuscated : type === TextInputType.Password,\n );\n\n useEffect(() => {\n setTimeout(() => {\n focusOnMount && inputElement.current?.focus();\n }, 0);\n }, [focusOnMount]);\n\n useEffect(() => {\n if (typeof obfuscated === 'boolean') {\n setIsObfuscated(obfuscated);\n }\n }, [obfuscated]);\n\n const onKeyDown = (event: KeyboardEvent<HTMLInputElement>) => {\n if (event.key === 'Enter' && onEnterPressed) {\n onEnterPressed(event);\n }\n };\n\n const getInputType = () => {\n if (type === TextInputType.Password) {\n return isObfuscated ? TextInputType.Password : TextInputType.Text;\n }\n return type;\n };\n\n const spellcheckProp = typeof spellcheck === 'boolean' ? { spellCheck: spellcheck } : null;\n\n return (\n <div\n {...props}\n className={merge([\n 'tw-flex tw-items-center tw-h-9 tw-gap-2 tw-px-3 tw-border tw-transition tw-rounded tw-text-body-small tw-font-sans tw-relative tw-bg-base dark:tw-bg-transparent',\n dotted ? 'tw-border-dashed' : 'tw-border-solid',\n disabled || readonly\n ? 'tw-bg-box-disabled dark:tw-bg-box-disabled hover:tw-cursor-not-allowed tw-border-line-weak dark:tw-border-line-weak'\n : merge([\n 'focus-within:tw-border-line-xx-strong focus-within:hover:tw-border-line-xx-strong hover:tw-border-line-x-strong',\n validationClassMap[validation],\n inputIsFocusVisible &&\n !clearButtonIsFocusVisible &&\n !passwordButtonIsFocusVisible &&\n !copyButtonIsFocusVisible &&\n FOCUS_STYLE,\n ]),\n ])}\n data-test-id=\"fondue-text-input-component\"\n >\n {decorator && (\n <div\n className={merge([\n 'tw-flex tw-items-center tw-justify-center tw-pl-1',\n disabled ? 'tw-text-black-60' : 'tw-text-black-80',\n ])}\n data-test-id=\"decorator\"\n >\n {decorator}\n </div>\n )}\n <input\n {...inputFocusProps}\n id={useMemoizedId(propId)}\n ref={inputElement}\n className={merge([\n 'tw-w-full tw-grow tw-border-none tw-outline-none tw-bg-transparent tw-hide-input-arrows',\n disabled || readonly\n ? 'tw-text-text-disabled tw-placeholder-text-disabled dark:tw-text-black-30 dark:tw-placeholder-black-40 hover:tw-cursor-not-allowed'\n : 'tw-text-black tw-placeholder-black-60 dark:tw-text-white',\n ])}\n onClick={() => inputElement.current?.focus()}\n onChange={(event) => onChange?.(event.currentTarget.value)}\n onBlur={(e) => {\n inputFocusProps.onBlur?.(e);\n onBlur?.(e);\n }}\n onKeyDown={onKeyDown}\n placeholder={placeholder}\n value={value}\n type={getInputType()}\n required={required}\n readOnly={readonly}\n disabled={disabled}\n onFocus={(e) => {\n inputFocusProps.onFocus?.(e);\n if (selectable) {\n e.target.select();\n }\n if (onFocus) {\n onFocus(e);\n }\n }}\n autoComplete={autocomplete ? 'on' : 'off'}\n maxLength={maxLength}\n size={size}\n data-test-id=\"text-input\"\n {...spellcheckProp}\n />\n {extraActions &&\n extraActions.length > 0 &&\n extraActions.map((extraAction: TextInputExtraAction, index: number) => {\n const key = `text-input-extra-action-${index}`;\n if (extraAction.tooltip) {\n return (\n <LegacyTooltip\n key={key}\n {...extraAction.tooltip}\n triggerElement={\n <ExtraActionButtonWithRef extraAction={extraAction} disabled={disabled} />\n }\n />\n );\n }\n return <ExtraActionButtonWithRef key={key} extraAction={extraAction} disabled={disabled} />;\n })}\n {`${value}`.length > 0 && clearable && (\n <button\n className={merge([\n 'tw-flex tw-items-center tw-justify-center tw-transition-colors tw-rounded',\n disabled\n ? 'tw-cursor-default tw-text-black-40'\n : 'tw-text-black-60 hover:tw-text-black-100',\n clearButtonIsFocusVisible && FOCUS_STYLE,\n ])}\n onClick={() => {\n inputElement.current?.focus();\n inputElement.current?.setAttribute('value', '');\n\n onChange?.('');\n onClear?.();\n }}\n data-test-id=\"clear-icon\"\n title=\"Clear text input\"\n aria-label=\"clear text input\"\n disabled={disabled}\n type=\"button\"\n {...clearButtonFocusProps}\n >\n <IconCross />\n </button>\n )}\n {type === TextInputType.Password && (\n <button\n className={merge([\n 'tw-flex tw-items-center tw-justify-center tw-transition-colors tw-rounded',\n disabled\n ? 'tw-cursor-default tw-text-black-40'\n : 'tw-text-black-60 hover:tw-text-black-100',\n passwordButtonIsFocusVisible && FOCUS_STYLE,\n ])}\n onClick={() => setIsObfuscated(!isObfuscated)}\n data-test-id=\"visibility-icon\"\n title=\"Toggle text visibility\"\n type=\"button\"\n aria-label={`${isObfuscated ? 'unveil' : 'obfuscate'} text input`}\n disabled={disabled}\n {...passwordButtonFocusProps}\n >\n {isObfuscated ? <IconEye /> : <IconEyeOff />}\n </button>\n )}\n {validation === Validation.Loading && (\n <span className=\"tw-absolute tw-top-[-0.55rem] tw-right-[-0.55rem] tw-bg-white tw-rounded-full tw-p-[2px] tw-border tw-border-black-10\">\n <LoadingCircle size={LoadingCircleSize.ExtraSmall} />\n </span>\n )}\n {(validation === Validation.Error || validation === Validation.Warning) && (\n <span\n className={merge([\n 'tw-flex tw-items-center tw-justify-center',\n validation === Validation.Error && 'tw-text-text-negative',\n validation === Validation.Warning && 'tw-text-text-warning',\n ])}\n data-test-id=\"error-state-exclamation-mark-icon\"\n >\n <IconExclamationMarkTriangle />\n </span>\n )}\n {copyable && (\n <button\n className={merge([\n 'tw-flex tw-items-center tw-justify-center tw-transition-colors tw-rounded',\n disabled\n ? 'tw-cursor-default tw-text-black-40'\n : 'tw-text-black-60 hover:tw-text-black-100',\n copyButtonIsFocusVisible && FOCUS_STYLE,\n ])}\n onClick={() => copy(value)}\n data-test-id=\"copy-icon\"\n title=\"Copy input text\"\n disabled={disabled}\n type=\"button\"\n {...copyButtonFocusProps}\n >\n {status === 'error' && (\n <span className=\"tw-text-box-negative-strong\">\n <IconCrossCircle />\n </span>\n )}\n {status === 'idle' && <IconClipboard />}\n {status === 'success' && (\n <span className=\"tw-text-box-positive-strong\">\n <IconCheckMark />\n </span>\n )}\n </button>\n )}\n </div>\n );\n },\n);\nTextInput.displayName = 'FondueTextInput';\n"],"names":["TextInputType","ExtraActionButton","extraAction","disabled","ref","extraActionButtonIsFocusVisible","extraActionButtonFocusProps","useFocusRing","isDisabled","jsx","merge","FOCUS_STYLE","ExtraActionButtonWithRef","forwardRef","TextInput","propId","type","decorator","validation","Validation","clearable","placeholder","required","obfuscated","autocomplete","dotted","value","copyable","onChange","onEnterPressed","onBlur","onClear","onFocus","size","spellcheck","readonly","focusOnMount","selectable","extraActions","maxLength","props","inputElement","useRef","useImperativeHandle","inputIsFocusVisible","inputFocusProps","clearButtonIsFocusVisible","clearButtonFocusProps","passwordButtonIsFocusVisible","passwordButtonFocusProps","copyButtonIsFocusVisible","copyButtonFocusProps","copy","status","useCopy","isObfuscated","setIsObfuscated","useState","useEffect","_a","onKeyDown","event","getInputType","spellcheckProp","jsxs","validationClassMap","useMemoizedId","e","index","key","LegacyTooltip","_b","IconCross","IconEye","IconEyeOff","LoadingCircle","LoadingCircleSize","IconExclamationMarkTriangle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