@traefik-labs/faency 13.1.1 → 13.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.
Files changed (99) hide show
  1. package/dist/components/Checkbox/Checkbox.cjs +15 -2
  2. package/dist/components/Checkbox/Checkbox.cjs.map +1 -1
  3. package/dist/components/Checkbox/Checkbox.js +15 -2
  4. package/dist/components/Checkbox/Checkbox.js.map +1 -1
  5. package/dist/components/Checkbox/Checkbox.themes.cjs +4 -2
  6. package/dist/components/Checkbox/Checkbox.themes.cjs.map +1 -1
  7. package/dist/components/Checkbox/Checkbox.themes.js +4 -2
  8. package/dist/components/Checkbox/Checkbox.themes.js.map +1 -1
  9. package/dist/components/DateTimePickerInput/DateTimePickerInput.cjs +1 -1
  10. package/dist/components/DateTimePickerInput/DateTimePickerInput.cjs.map +1 -1
  11. package/dist/components/DateTimePickerInput/DateTimePickerInput.js +1 -1
  12. package/dist/components/DateTimePickerInput/DateTimePickerInput.js.map +1 -1
  13. package/dist/components/Field/Field.cjs +91 -0
  14. package/dist/components/Field/Field.cjs.map +1 -0
  15. package/dist/components/Field/Field.js +89 -0
  16. package/dist/components/Field/Field.js.map +1 -0
  17. package/dist/components/Field/Field.vanilla.cjs +95 -0
  18. package/dist/components/Field/Field.vanilla.cjs.map +1 -0
  19. package/dist/components/Field/Field.vanilla.css.cjs +6 -0
  20. package/dist/components/Field/Field.vanilla.css.cjs.map +1 -0
  21. package/dist/components/Field/Field.vanilla.css.js +6 -0
  22. package/dist/components/Field/Field.vanilla.css.js.map +1 -0
  23. package/dist/components/Field/Field.vanilla.js +93 -0
  24. package/dist/components/Field/Field.vanilla.js.map +1 -0
  25. package/dist/components/Field/FieldContext.cjs +136 -0
  26. package/dist/components/Field/FieldContext.cjs.map +1 -0
  27. package/dist/components/Field/FieldContext.js +130 -0
  28. package/dist/components/Field/FieldContext.js.map +1 -0
  29. package/dist/components/Input/Input.cjs +31 -6
  30. package/dist/components/Input/Input.cjs.map +1 -1
  31. package/dist/components/Input/Input.js +31 -6
  32. package/dist/components/Input/Input.js.map +1 -1
  33. package/dist/components/Input/Input.vanilla.cjs +17 -4
  34. package/dist/components/Input/Input.vanilla.cjs.map +1 -1
  35. package/dist/components/Input/Input.vanilla.css.cjs.map +1 -1
  36. package/dist/components/Input/Input.vanilla.css.js.map +1 -1
  37. package/dist/components/Input/Input.vanilla.js +17 -4
  38. package/dist/components/Input/Input.vanilla.js.map +1 -1
  39. package/dist/components/Radio/Radio.cjs +21 -1
  40. package/dist/components/Radio/Radio.cjs.map +1 -1
  41. package/dist/components/Radio/Radio.js +21 -1
  42. package/dist/components/Radio/Radio.js.map +1 -1
  43. package/dist/components/Radio/Radio.themes.cjs +4 -2
  44. package/dist/components/Radio/Radio.themes.cjs.map +1 -1
  45. package/dist/components/Radio/Radio.themes.js +4 -2
  46. package/dist/components/Radio/Radio.themes.js.map +1 -1
  47. package/dist/components/Select/Select.cjs +33 -4
  48. package/dist/components/Select/Select.cjs.map +1 -1
  49. package/dist/components/Select/Select.js +33 -4
  50. package/dist/components/Select/Select.js.map +1 -1
  51. package/dist/components/Switch/Switch.cjs +19 -5
  52. package/dist/components/Switch/Switch.cjs.map +1 -1
  53. package/dist/components/Switch/Switch.js +19 -5
  54. package/dist/components/Switch/Switch.js.map +1 -1
  55. package/dist/components/Switch/Switch.themes.cjs +4 -2
  56. package/dist/components/Switch/Switch.themes.cjs.map +1 -1
  57. package/dist/components/Switch/Switch.themes.js +4 -2
  58. package/dist/components/Switch/Switch.themes.js.map +1 -1
  59. package/dist/components/Text/Text.themes.cjs +2 -2
  60. package/dist/components/Text/Text.themes.cjs.map +1 -1
  61. package/dist/components/Text/Text.themes.js +2 -2
  62. package/dist/components/Text/Text.themes.js.map +1 -1
  63. package/dist/components/Text/Text.vanilla.cjs +36 -0
  64. package/dist/components/Text/Text.vanilla.cjs.map +1 -0
  65. package/dist/components/Text/Text.vanilla.css.cjs +55 -0
  66. package/dist/components/Text/Text.vanilla.css.cjs.map +1 -0
  67. package/dist/components/Text/Text.vanilla.css.js +56 -0
  68. package/dist/components/Text/Text.vanilla.css.js.map +1 -0
  69. package/dist/components/Text/Text.vanilla.js +36 -0
  70. package/dist/components/Text/Text.vanilla.js.map +1 -0
  71. package/dist/components/TextField/TextField.cjs +73 -77
  72. package/dist/components/TextField/TextField.cjs.map +1 -1
  73. package/dist/components/TextField/TextField.js +73 -77
  74. package/dist/components/TextField/TextField.js.map +1 -1
  75. package/dist/components/TextField/TextField.vanilla.cjs +70 -86
  76. package/dist/components/TextField/TextField.vanilla.cjs.map +1 -1
  77. package/dist/components/TextField/TextField.vanilla.css.cjs +10 -0
  78. package/dist/components/TextField/TextField.vanilla.css.cjs.map +1 -0
  79. package/dist/components/TextField/TextField.vanilla.css.js +8 -0
  80. package/dist/components/TextField/TextField.vanilla.css.js.map +1 -0
  81. package/dist/components/TextField/TextField.vanilla.js +71 -87
  82. package/dist/components/TextField/TextField.vanilla.js.map +1 -1
  83. package/dist/components/Textarea/Textarea.cjs +51 -41
  84. package/dist/components/Textarea/Textarea.cjs.map +1 -1
  85. package/dist/components/Textarea/Textarea.js +51 -41
  86. package/dist/components/Textarea/Textarea.js.map +1 -1
  87. package/dist/components/Textarea/Textarea.vanilla.cjs +49 -49
  88. package/dist/components/Textarea/Textarea.vanilla.cjs.map +1 -1
  89. package/dist/components/Textarea/Textarea.vanilla.css.cjs.map +1 -1
  90. package/dist/components/Textarea/Textarea.vanilla.css.js.map +1 -1
  91. package/dist/components/Textarea/Textarea.vanilla.js +49 -49
  92. package/dist/components/Textarea/Textarea.vanilla.js.map +1 -1
  93. package/dist/faency.css +170 -14
  94. package/dist/index.cjs +7 -1
  95. package/dist/index.d.ts +375 -0
  96. package/dist/index.js +5 -2
  97. package/dist/styles/themes.css.cjs.map +1 -1
  98. package/dist/styles/themes.css.js.map +1 -1
  99. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"TextField.js","names":[],"sources":["../../../components/TextField/TextField.tsx"],"sourcesContent":["import {\n CrossCircledIcon,\n ExclamationTriangleIcon,\n EyeClosedIcon,\n EyeOpenIcon,\n} from '@radix-ui/react-icons';\nimport React from 'react';\n\nimport { styled } from '../../stitches.config';\nimport { Box } from '../Box';\nimport { Input, InputHandle, InputProps, InputVariants } from '../Input';\nimport { Label } from '../Label';\nimport { Tooltip } from '../Tooltip';\n\n// TYPES\nexport interface TextFieldLabelProps {\n variant: 'invalid' | 'subtle' | 'contrast' | 'default';\n htmlFor?: string;\n}\nexport type TextFieldProps = InputProps & {\n type?: string;\n clearable?: boolean;\n label?: string | ((props: TextFieldLabelProps) => JSX.Element);\n};\n\nexport type TextFieldVariants = InputVariants;\n\n// COMPONENTS\nconst AdornmentGroup = styled('div', {\n display: 'flex',\n flexDirection: 'row',\n alignItems: 'center',\n});\n\nconst StyledExclamationTriangleIcon = styled(ExclamationTriangleIcon, {\n '& + *': {\n marginLeft: '$1',\n },\n});\n\nconst StyledEyeOpenIcon = styled(EyeOpenIcon, {\n '@hover': {\n '&:hover': {\n cursor: 'pointer',\n },\n },\n});\n\nconst StyledEyeClosedIcon = styled(EyeClosedIcon, {\n '@hover': {\n '&:hover': {\n cursor: 'pointer',\n },\n },\n});\n\nconst StyledCrossCircledIcon = styled(CrossCircledIcon, {\n '@hover': {\n '&:hover': {\n cursor: 'pointer',\n },\n },\n});\n\nexport const TextField = React.forwardRef<React.ElementRef<typeof Input>, TextFieldProps>(\n (\n {\n state,\n clearable,\n label: LabelOrComponent,\n id,\n type,\n disabled,\n readOnly,\n onBlur,\n onFocus,\n css,\n ...props\n },\n forwardedRef,\n ) => {\n const inputRef = React.useRef<InputHandle | null>(null);\n React.useImperativeHandle(forwardedRef, () => inputRef.current as InputHandle);\n\n const [inputHasFocus, setInputHasFocus] = React.useState(false);\n const [innerType, setInnerType] = React.useState(type);\n const isPasswordVisible = React.useMemo(() => innerType !== 'password', [innerType]);\n\n const invalid = React.useMemo(() => state === 'invalid', [state]);\n\n const labelVariant = React.useMemo(() => {\n if (disabled) {\n return 'subtle';\n }\n if (invalid) {\n return 'invalid';\n }\n if (inputHasFocus) {\n return 'contrast';\n }\n return 'default';\n }, [invalid, disabled, inputHasFocus]);\n\n const LabelNode = React.useMemo(() => {\n if (LabelOrComponent === undefined || LabelOrComponent === null) {\n return null;\n }\n if (typeof LabelOrComponent === 'string') {\n return (\n <Label variant={labelVariant} htmlFor={id}>\n {LabelOrComponent}\n </Label>\n );\n }\n return <LabelOrComponent variant={labelVariant} htmlFor={id} />;\n }, [LabelOrComponent, labelVariant, id]);\n\n const isPasswordType = React.useMemo(() => type === 'password', [type]);\n\n const typeOrInnerType = React.useMemo(\n () => (isPasswordType ? innerType : type),\n [isPasswordType, type, innerType],\n );\n\n const hasInnerAdornment = React.useMemo(\n () => clearable || isPasswordType || invalid,\n [clearable, isPasswordType, invalid],\n );\n\n const hasAdornmentGroup = React.useMemo(\n () => (clearable && invalid) || (clearable && isPasswordType) || (invalid && isPasswordType),\n [clearable, invalid, isPasswordType],\n );\n\n const clearDisabled = React.useMemo(() => readOnly || disabled, [readOnly, disabled]);\n\n const handleClear = React.useCallback(() => {\n const { current } = inputRef;\n if (current) {\n current.clear();\n }\n }, [inputRef]);\n\n const handleFocus = React.useCallback(\n (e: React.FocusEvent<HTMLInputElement>) => {\n if (onFocus) {\n onFocus(e);\n }\n setInputHasFocus(true);\n },\n [onFocus, setInputHasFocus],\n );\n\n const handleBlur = React.useCallback(\n (e: React.FocusEvent<HTMLInputElement>) => {\n if (onBlur) {\n onBlur(e);\n }\n setInputHasFocus(false);\n },\n [onBlur, setInputHasFocus],\n );\n\n const togglePasswordVisibility = React.useCallback(() => {\n setInnerType((prevInnerType) => (prevInnerType === 'password' ? undefined : 'password'));\n }, [setInnerType]);\n\n const EndAdornmentWrapper = hasAdornmentGroup ? AdornmentGroup : React.Fragment;\n\n const PasswordVisibilityToggleIcon = isPasswordVisible\n ? StyledEyeClosedIcon\n : StyledEyeOpenIcon;\n\n const passwordAction = React.useMemo(\n () => (isPasswordVisible ? 'Hide password' : 'Show password'),\n [isPasswordVisible],\n );\n\n return (\n <Box css={css}>\n {LabelNode}\n <Input\n id={id}\n ref={inputRef}\n endAdornment={\n hasInnerAdornment && (\n <EndAdornmentWrapper>\n {invalid && <StyledExclamationTriangleIcon role=\"alert\" aria-label=\"Invalid\" />}\n {isPasswordType && (\n <Tooltip content={passwordAction}>\n <PasswordVisibilityToggleIcon\n aria-label={passwordAction}\n onClick={togglePasswordVisibility}\n />\n </Tooltip>\n )}\n {clearable && !clearDisabled && (\n <Tooltip content=\"Clear\">\n <StyledCrossCircledIcon aria-label=\"Clear\" onClick={handleClear} />\n </Tooltip>\n )}\n </EndAdornmentWrapper>\n )\n }\n state={state}\n type={typeOrInnerType}\n disabled={disabled}\n readOnly={readOnly}\n onFocus={handleFocus}\n onBlur={handleBlur}\n {...props}\n />\n </Box>\n );\n },\n);\n"],"mappings":";;;;;;;;;AA4BA,IAAM,iBAAiB,OAAO,OAAO;CACnC,SAAS;CACT,eAAe;CACf,YAAY;AACd,CAAC;AAED,IAAM,gCAAgC,OAAO,yBAAyB,EACpE,SAAS,EACP,YAAY,KACd,EACF,CAAC;AAED,IAAM,oBAAoB,OAAO,aAAa,EAC5C,UAAU,EACR,WAAW,EACT,QAAQ,UACV,EACF,EACF,CAAC;AAED,IAAM,sBAAsB,OAAO,eAAe,EAChD,UAAU,EACR,WAAW,EACT,QAAQ,UACV,EACF,EACF,CAAC;AAED,IAAM,yBAAyB,OAAO,kBAAkB,EACtD,UAAU,EACR,WAAW,EACT,QAAQ,UACV,EACF,EACF,CAAC;AAED,IAAa,YAAY,MAAM,YAE3B,EACE,OACA,WACA,OAAO,kBACP,IACA,MACA,UACA,UACA,QACA,SACA,KACA,GAAG,SAEL,iBACG;CACH,MAAM,WAAW,MAAM,OAA2B,IAAI;CACtD,MAAM,oBAAoB,oBAAoB,SAAS,OAAsB;CAE7E,MAAM,CAAC,eAAe,oBAAoB,MAAM,SAAS,KAA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vB,GACA,CAAC,SAAS,gBAAgB,CAC5B;CAEA,MAAM,aAAa,MAAM,aACtB,MAA0C;EACzC,IAAI,QACF,OAAO,CAAC;EAEV,iBAAiB,KAAK;CACxB,GACA,CAAC,QAAQ,gBAAgB,CAC3B;CAEA,MAAM,2BAA2B,MAAM,kBAAkB;EACvD,cAAc,kBAAmB,kBAAkB,aAAa,KAAA,IAAY,UAAW;CACzF,GAAG,CAAC,YAAY,CAAC;CAEjB,MAAM,sBAAsB,oBAAoB,iBAAiB,MAAM;CAEvE,MAAM,+BAA+B,oBACjC,sBACA;CAEJ,MAAM,iBAAiB,MAAM,cACpB,oBAAoB,kBAAkB,iBAC7C,CAAC,iBAAiB,CACpB;CAEA,OACE,qBAAC,KAAD;EAAU;EAAV,UAAA,CACG,WACD,oBAAC,OAAD;GACM;GACJ,KAAK;GACL,cACE,qBACE,qBAAC,qBAAD,EAAA,UAAA;IACG,WAAW,oBAAC,+BAAD;KAA+B,MAAK;KAAQ,cAAW;IAAW,CAAA;IAC7E,kBACC,oBAAC,SAAD;KAAS,SAAS;KAChB,UAAA,oBAAC,8BAAD;MACE,cAAY;MACZ,SAAS;KACV,CAAA;IACM,CAAA;IAEV,aAAa,CAAC,iBACb,oBAAC,SAAD;KAAS,SAAQ;KACf,UAAA,oBAAC,wBAAD;MAAwB,cAAW;MAAQ,SAAS;KAAc,CAAA;IAC3D,CAAA;GAEQ,EAAA,CAAA;GAGlB;GACP,MAAM;GACI;GACA;GACV,SAAS;GACT,QAAQ;GACR,GAAI;EACL,CAAA,CACE;;AAET,CACF"}
1
+ {"version":3,"file":"TextField.js","names":[],"sources":["../../../components/TextField/TextField.tsx"],"sourcesContent":["import {\n CrossCircledIcon,\n ExclamationTriangleIcon,\n EyeClosedIcon,\n EyeOpenIcon,\n} from '@radix-ui/react-icons';\nimport React from 'react';\n\nimport { styled } from '../../stitches.config';\nimport { Field } from '../Field/Field';\nimport { FieldLabelProps, useFieldContext } from '../Field/FieldContext';\nimport { Input, InputHandle, InputProps, InputVariants } from '../Input';\nimport { Tooltip } from '../Tooltip';\n\n// TYPES\nexport interface TextFieldLabelProps {\n variant: 'invalid' | 'subtle' | 'contrast' | 'default';\n htmlFor?: string;\n id?: string;\n}\nexport type TextFieldProps = InputProps & {\n type?: string;\n clearable?: boolean;\n label?: string | ((props: TextFieldLabelProps) => JSX.Element);\n description?: React.ReactNode;\n error?: React.ReactNode;\n announceError?: boolean;\n};\n\nexport type TextFieldVariants = InputVariants;\n\n// COMPONENTS\nconst AdornmentGroup = styled('div', {\n display: 'flex',\n flexDirection: 'row',\n alignItems: 'center',\n});\n\nconst StyledExclamationTriangleIcon = styled(ExclamationTriangleIcon, {\n '& + *': {\n marginLeft: '$1',\n },\n});\n\nconst AdornmentButton = styled('button', {\n appearance: 'none',\n background: 'none',\n border: 'none',\n padding: 0,\n font: 'inherit',\n display: 'inline-flex',\n alignItems: 'center',\n justifyContent: 'center',\n borderRadius: '$1',\n color: 'inherit',\n '@hover': {\n '&:hover': {\n cursor: 'pointer',\n },\n },\n '&:focus-visible': {\n outline: '2px solid $inputFocusBorder',\n outlineOffset: '1px',\n },\n});\n\nexport const TextField = React.forwardRef<React.ElementRef<typeof Input>, TextFieldProps>(\n (\n {\n state,\n clearable,\n label: LabelOrComponent,\n description,\n error,\n announceError,\n id,\n type,\n disabled,\n readOnly,\n css,\n ...props\n },\n forwardedRef,\n ) => {\n const inputRef = React.useRef<InputHandle | null>(null);\n React.useImperativeHandle(forwardedRef, () => inputRef.current as InputHandle);\n\n const outerField = useFieldContext();\n const [innerType, setInnerType] = React.useState(type);\n const isPasswordVisible = React.useMemo(() => innerType !== 'password', [innerType]);\n\n const invalid = state === 'invalid' || Boolean(error) || Boolean(outerField?.invalid);\n\n const renderLabel = React.useMemo(() => {\n if (LabelOrComponent === undefined || LabelOrComponent === null) {\n return undefined;\n }\n if (typeof LabelOrComponent === 'string') {\n return LabelOrComponent;\n }\n return (labelProps: FieldLabelProps) => <LabelOrComponent {...labelProps} />;\n }, [LabelOrComponent]);\n\n const isPasswordType = React.useMemo(() => type === 'password', [type]);\n\n const typeOrInnerType = React.useMemo(\n () => (isPasswordType ? innerType : type),\n [isPasswordType, type, innerType],\n );\n\n const hasInnerAdornment = React.useMemo(\n () => clearable || isPasswordType || invalid,\n [clearable, isPasswordType, invalid],\n );\n\n const hasAdornmentGroup = React.useMemo(\n () => (clearable && invalid) || (clearable && isPasswordType) || (invalid && isPasswordType),\n [clearable, invalid, isPasswordType],\n );\n\n const clearDisabled = readOnly || disabled || Boolean(outerField?.disabled);\n\n const handleClear = React.useCallback(() => {\n const { current } = inputRef;\n if (current) {\n const setValue = Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, 'value')?.set;\n setValue?.call(current, '');\n current.dispatchEvent(new Event('input', { bubbles: true }));\n current.focus();\n }\n }, [inputRef]);\n\n const togglePasswordVisibility = React.useCallback(() => {\n setInnerType((prevInnerType) => (prevInnerType === 'password' ? undefined : 'password'));\n }, [setInnerType]);\n\n const EndAdornmentWrapper = hasAdornmentGroup ? AdornmentGroup : React.Fragment;\n\n const PasswordVisibilityToggleIcon = isPasswordVisible ? EyeClosedIcon : EyeOpenIcon;\n\n const passwordAction = React.useMemo(\n () => (isPasswordVisible ? 'Hide password' : 'Show password'),\n [isPasswordVisible],\n );\n\n const input = (\n <Input\n id={id}\n ref={inputRef}\n endAdornment={\n hasInnerAdornment && (\n <EndAdornmentWrapper>\n {invalid && <StyledExclamationTriangleIcon aria-hidden />}\n {isPasswordType && (\n <Tooltip content={passwordAction}>\n <AdornmentButton\n type=\"button\"\n aria-label={passwordAction}\n onClick={togglePasswordVisibility}\n >\n <PasswordVisibilityToggleIcon aria-hidden />\n </AdornmentButton>\n </Tooltip>\n )}\n {clearable && !clearDisabled && (\n <Tooltip content=\"Clear\">\n <AdornmentButton type=\"button\" aria-label=\"Clear\" onClick={handleClear}>\n <CrossCircledIcon aria-hidden />\n </AdornmentButton>\n </Tooltip>\n )}\n </EndAdornmentWrapper>\n )\n }\n state={state}\n type={typeOrInnerType}\n disabled={disabled}\n readOnly={readOnly}\n {...props}\n />\n );\n\n return (\n <Field\n id={id}\n label={renderLabel}\n description={description}\n error={error}\n announceError={announceError}\n invalid={state === 'invalid'}\n disabled={disabled}\n css={css}\n >\n {input}\n </Field>\n );\n },\n);\n"],"mappings":";;;;;;;;;AAgCA,IAAM,iBAAiB,OAAO,OAAO;CACnC,SAAS;CACT,eAAe;CACf,YAAY;AACd,CAAC;AAED,IAAM,gCAAgC,OAAO,yBAAyB,EACpE,SAAS,EACP,YAAY,KACd,EACF,CAAC;AAED,IAAM,kBAAkB,OAAO,UAAU;CACvC,YAAY;CACZ,YAAY;CACZ,QAAQ;CACR,SAAS;CACT,MAAM;CACN,SAAS;CACT,YAAY;CACZ,gBAAgB;CAChB,cAAc;CACd,OAAO;CACP,UAAU,EACR,WAAW,EACT,QAAQ,UACV,EACF;CACA,mBAAmB;EACjB,SAAS;EACT,eAAe;CACjB;AACF,CAAC;AAED,IAAa,YAAY,MAAM,YAE3B,EACE,OACA,WACA,OAAO,kBACP,aACA,OACA,eACA,IACA,MACA,UACA,UACA,KACA,GAAG,SAEL,iBACG;CACH,MAAM,WAAW,MAAM,OAA2B,IAAI;CACtD,MAAM,oBAAoB,oBAAoB,SAAS,OAAsB;CAE7E,MAAM,aAAa,gBAAgB;CACnC,MAAM,CAAC,WAAW,gBAAgB,MAAM,SAAS,IAAI;CACrD,MAAM,oBAAoB,MAAM,cAAc,cAAc,YAAY,CAAC,SAAS,CAAC;CAEnF,MAAM,UAAU,UAAU,aAAa,QAAQ,KAAK,KAAK,QAAQ,YAAY,OAAO;CAEpF,MAAM,cAAc,MAAM,cAAc;EACtC,IAAI,qBAAqB,KAAA,KAAa,qBAAqB,MACzD;EAEF,IAAI,OAAO,qBAAqB,UAC9B,OAAO;EAET,QAAQ,eAAgC,oBAAC,kBAAD,EAAkB,GAAI,WAAa,CAAA;CAC7E,GAAG,CAAC,gBAAgB,CAAC;CAErB,MAA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a,CAAA;IAC5B,CAAA;GACV,CAAA;GAEV,aAAa,CAAC,iBACb,oBAAC,SAAD;IAAS,SAAQ;IACf,UAAA,oBAAC,iBAAD;KAAiB,MAAK;KAAS,cAAW;KAAQ,SAAS;KACzD,UAAA,oBAAC,kBAAD,EAAkB,eAAA,KAAa,CAAA;IAChB,CAAA;GACV,CAAA;EAEQ,EAAA,CAAA;EAGlB;EACP,MAAM;EACI;EACA;EACV,GAAI;CACL,CAAA;CAGH,OACE,oBAAC,OAAD;EACM;EACJ,OAAO;EACM;EACN;EACQ;EACf,SAAS,UAAU;EACT;EACL;EAEJ,UAAA;CACI,CAAA;AAEX,CACF"}
@@ -1,56 +1,26 @@
1
1
  const require_runtime = require("../../_virtual/_rolldown/runtime.cjs");
2
- const require_stitches_config = require("../../stitches.config.cjs");
3
- const require_Box_vanilla = require("../Box/Box.vanilla.cjs");
4
- const require_Label_vanilla = require("../Label/Label.vanilla.cjs");
2
+ const require_FieldContext = require("../Field/FieldContext.cjs");
5
3
  const require_Input_vanilla = require("../Input/Input.vanilla.cjs");
4
+ const require_Field_vanilla = require("../Field/Field.vanilla.cjs");
6
5
  const require_Tooltip = require("../Tooltip/Tooltip.cjs");
6
+ require("./TextField.vanilla.css.cjs");
7
7
  let _radix_ui_react_icons = require("@radix-ui/react-icons");
8
8
  let react = require("react");
9
9
  react = require_runtime.__toESM(react, 1);
10
10
  let react_jsx_runtime = require("react/jsx-runtime");
11
11
  // components/TextField/TextField.vanilla.tsx
12
- var AdornmentGroup = require_stitches_config.styled("div", {
13
- display: "flex",
14
- flexDirection: "row",
15
- alignItems: "center"
16
- });
17
- var StyledExclamationTriangleIcon = require_stitches_config.styled(_radix_ui_react_icons.ExclamationTriangleIcon, { "& + *": { marginLeft: "$1" } });
18
- var StyledEyeOpenIcon = require_stitches_config.styled(_radix_ui_react_icons.EyeOpenIcon, { "@hover": { "&:hover": { cursor: "pointer" } } });
19
- var StyledEyeClosedIcon = require_stitches_config.styled(_radix_ui_react_icons.EyeClosedIcon, { "@hover": { "&:hover": { cursor: "pointer" } } });
20
- var StyledCrossCircledIcon = require_stitches_config.styled(_radix_ui_react_icons.CrossCircledIcon, { "@hover": { "&:hover": { cursor: "pointer" } } });
21
- var TextFieldVanilla = react.default.forwardRef(({ state, clearable, label: LabelOrComponent, id, type, disabled, readOnly, onBlur, onFocus, css, ...props }, forwardedRef) => {
12
+ var TextFieldVanilla = react.default.forwardRef(({ state, clearable, label: LabelOrComponent, description, error, announceError, id, type, disabled, readOnly, css, ...props }, forwardedRef) => {
22
13
  const inputRef = react.default.useRef(null);
23
14
  react.default.useImperativeHandle(forwardedRef, () => inputRef.current);
24
- const [inputHasFocus, setInputHasFocus] = react.default.useState(false);
15
+ const outerField = require_FieldContext.useFieldContext();
25
16
  const [innerType, setInnerType] = react.default.useState(type);
26
17
  const isPasswordVisible = react.default.useMemo(() => innerType !== "password", [innerType]);
27
- const invalid = react.default.useMemo(() => state === "invalid", [state]);
28
- const labelVariant = react.default.useMemo(() => {
29
- if (disabled) return "subtle";
30
- if (invalid) return "invalid";
31
- if (inputHasFocus) return "contrast";
32
- return "default";
33
- }, [
34
- invalid,
35
- disabled,
36
- inputHasFocus
37
- ]);
38
- const LabelNode = react.default.useMemo(() => {
39
- if (LabelOrComponent === void 0 || LabelOrComponent === null) return null;
40
- if (typeof LabelOrComponent === "string") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Label_vanilla.LabelVanilla, {
41
- variant: labelVariant,
42
- htmlFor: id,
43
- children: LabelOrComponent
44
- });
45
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(LabelOrComponent, {
46
- variant: labelVariant,
47
- htmlFor: id
48
- });
49
- }, [
50
- LabelOrComponent,
51
- labelVariant,
52
- id
53
- ]);
18
+ const invalid = state === "invalid" || Boolean(error) || Boolean(outerField?.invalid);
19
+ const renderLabel = react.default.useMemo(() => {
20
+ if (LabelOrComponent === void 0 || LabelOrComponent === null) return;
21
+ if (typeof LabelOrComponent === "string") return LabelOrComponent;
22
+ return (labelProps) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(LabelOrComponent, { ...labelProps });
23
+ }, [LabelOrComponent]);
54
24
  const isPasswordType = react.default.useMemo(() => type === "password", [type]);
55
25
  const typeOrInnerType = react.default.useMemo(() => isPasswordType ? innerType : type, [
56
26
  isPasswordType,
@@ -67,58 +37,72 @@ var TextFieldVanilla = react.default.forwardRef(({ state, clearable, label: Labe
67
37
  invalid,
68
38
  isPasswordType
69
39
  ]);
70
- const clearDisabled = react.default.useMemo(() => readOnly || disabled, [readOnly, disabled]);
40
+ const clearDisabled = readOnly || disabled || Boolean(outerField?.disabled);
71
41
  const handleClear = react.default.useCallback(() => {
72
42
  const { current } = inputRef;
73
- if (current) current.clear();
43
+ if (current) {
44
+ (Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, "value")?.set)?.call(current, "");
45
+ current.dispatchEvent(new Event("input", { bubbles: true }));
46
+ current.focus();
47
+ }
74
48
  }, [inputRef]);
75
- const handleFocus = react.default.useCallback((e) => {
76
- if (onFocus) onFocus(e);
77
- setInputHasFocus(true);
78
- }, [onFocus, setInputHasFocus]);
79
- const handleBlur = react.default.useCallback((e) => {
80
- if (onBlur) onBlur(e);
81
- setInputHasFocus(false);
82
- }, [onBlur, setInputHasFocus]);
83
49
  const togglePasswordVisibility = react.default.useCallback(() => {
84
50
  setInnerType((prevInnerType) => prevInnerType === "password" ? void 0 : "password");
85
51
  }, [setInnerType]);
86
- const EndAdornmentWrapper = hasAdornmentGroup ? AdornmentGroup : react.default.Fragment;
87
- const PasswordVisibilityToggleIcon = isPasswordVisible ? StyledEyeClosedIcon : StyledEyeOpenIcon;
52
+ const PasswordVisibilityToggleIcon = isPasswordVisible ? _radix_ui_react_icons.EyeClosedIcon : _radix_ui_react_icons.EyeOpenIcon;
88
53
  const passwordAction = react.default.useMemo(() => isPasswordVisible ? "Hide password" : "Show password", [isPasswordVisible]);
89
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_Box_vanilla.BoxVanilla, {
90
- css,
91
- children: [LabelNode, /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Input_vanilla.InputVanilla, {
92
- id,
93
- ref: inputRef,
94
- endAdornment: hasInnerAdornment && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(EndAdornmentWrapper, { children: [
95
- invalid && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StyledExclamationTriangleIcon, {
96
- role: "alert",
97
- "aria-label": "Invalid"
98
- }),
99
- isPasswordType && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Tooltip.Tooltip, {
100
- content: passwordAction,
101
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PasswordVisibilityToggleIcon, {
102
- "aria-label": passwordAction,
103
- onClick: togglePasswordVisibility
104
- })
105
- }),
106
- clearable && !clearDisabled && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Tooltip.Tooltip, {
107
- content: "Clear",
108
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StyledCrossCircledIcon, {
109
- "aria-label": "Clear",
110
- onClick: handleClear
111
- })
112
- })
113
- ] }),
114
- state,
115
- type: typeOrInnerType,
116
- disabled,
117
- readOnly,
118
- onFocus: handleFocus,
119
- onBlur: handleBlur,
120
- ...props
121
- })]
54
+ const adornments = /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
55
+ invalid && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_icons.ExclamationTriangleIcon, {
56
+ className: "_1q0c5701",
57
+ "aria-hidden": true
58
+ }),
59
+ isPasswordType && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Tooltip.Tooltip, {
60
+ content: passwordAction,
61
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
62
+ type: "button",
63
+ className: "_1q0c5702",
64
+ "aria-label": passwordAction,
65
+ onClick: togglePasswordVisibility,
66
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PasswordVisibilityToggleIcon, { "aria-hidden": true })
67
+ })
68
+ }),
69
+ clearable && !clearDisabled && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Tooltip.Tooltip, {
70
+ content: "Clear",
71
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
72
+ type: "button",
73
+ className: "_1q0c5702",
74
+ "aria-label": "Clear",
75
+ onClick: handleClear,
76
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_icons.CrossCircledIcon, { "aria-hidden": true })
77
+ })
78
+ })
79
+ ] });
80
+ const input = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Input_vanilla.InputVanilla, {
81
+ id,
82
+ ref: inputRef,
83
+ endAdornment: hasInnerAdornment && (hasAdornmentGroup ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
84
+ className: "_1q0c5700",
85
+ children: adornments
86
+ }) : adornments),
87
+ state,
88
+ type: typeOrInnerType,
89
+ disabled,
90
+ readOnly,
91
+ ...props
92
+ });
93
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Field_vanilla.FieldVanilla, {
94
+ id,
95
+ label: renderLabel,
96
+ description,
97
+ error,
98
+ announceError,
99
+ invalid: state === "invalid",
100
+ disabled,
101
+ css: {
102
+ boxSizing: "border-box",
103
+ ...css
104
+ },
105
+ children: input
122
106
  });
123
107
  });
124
108
  TextFieldVanilla.displayName = "TextFieldVanilla";
@@ -1 +1 @@
1
- {"version":3,"file":"TextField.vanilla.cjs","names":["styled","ExclamationTriangleIcon","EyeOpenIcon","EyeClosedIcon","CrossCircledIcon","React","LabelVanilla","BoxVanilla","InputVanilla","Tooltip"],"sources":["../../../components/TextField/TextField.vanilla.tsx"],"sourcesContent":["import {\n CrossCircledIcon,\n ExclamationTriangleIcon,\n EyeClosedIcon,\n EyeOpenIcon,\n} from '@radix-ui/react-icons';\nimport React from 'react';\n\nimport { styled } from '../../stitches.config';\nimport { BoxVanilla } from '../Box';\nimport { InputVanilla, InputVanillaHandle, InputVanillaProps } from '../Input';\nimport { LabelVanilla } from '../Label';\nimport { Tooltip } from '../Tooltip';\n\n// TYPES\nexport interface TextFieldLabelProps {\n variant: 'invalid' | 'subtle' | 'contrast' | 'default';\n htmlFor?: string;\n}\n\nexport type TextFieldVanillaProps = InputVanillaProps & {\n type?: string;\n clearable?: boolean;\n label?: string | ((props: TextFieldLabelProps) => JSX.Element);\n};\n\n// COMPONENTS\nconst AdornmentGroup = styled('div', {\n display: 'flex',\n flexDirection: 'row',\n alignItems: 'center',\n});\n\nconst StyledExclamationTriangleIcon = styled(ExclamationTriangleIcon, {\n '& + *': {\n marginLeft: '$1',\n },\n});\n\nconst StyledEyeOpenIcon = styled(EyeOpenIcon, {\n '@hover': {\n '&:hover': {\n cursor: 'pointer',\n },\n },\n});\n\nconst StyledEyeClosedIcon = styled(EyeClosedIcon, {\n '@hover': {\n '&:hover': {\n cursor: 'pointer',\n },\n },\n});\n\nconst StyledCrossCircledIcon = styled(CrossCircledIcon, {\n '@hover': {\n '&:hover': {\n cursor: 'pointer',\n },\n },\n});\n\nexport const TextFieldVanilla = React.forwardRef<\n React.ElementRef<typeof InputVanilla>,\n TextFieldVanillaProps\n>(\n (\n {\n state,\n clearable,\n label: LabelOrComponent,\n id,\n type,\n disabled,\n readOnly,\n onBlur,\n onFocus,\n css,\n ...props\n },\n forwardedRef,\n ) => {\n const inputRef = React.useRef<InputVanillaHandle | null>(null);\n React.useImperativeHandle(forwardedRef, () => inputRef.current as InputVanillaHandle);\n\n const [inputHasFocus, setInputHasFocus] = React.useState(false);\n const [innerType, setInnerType] = React.useState(type);\n const isPasswordVisible = React.useMemo(() => innerType !== 'password', [innerType]);\n\n const invalid = React.useMemo(() => state === 'invalid', [state]);\n\n const labelVariant = React.useMemo(() => {\n if (disabled) {\n return 'subtle';\n }\n if (invalid) {\n return 'invalid';\n }\n if (inputHasFocus) {\n return 'contrast';\n }\n return 'default';\n }, [invalid, disabled, inputHasFocus]);\n\n const LabelNode = React.useMemo(() => {\n if (LabelOrComponent === undefined || LabelOrComponent === null) {\n return null;\n }\n if (typeof LabelOrComponent === 'string') {\n return (\n <LabelVanilla variant={labelVariant} htmlFor={id}>\n {LabelOrComponent}\n </LabelVanilla>\n );\n }\n return <LabelOrComponent variant={labelVariant} htmlFor={id} />;\n }, [LabelOrComponent, labelVariant, id]);\n\n const isPasswordType = React.useMemo(() => type === 'password', [type]);\n\n const typeOrInnerType = React.useMemo(\n () => (isPasswordType ? innerType : type),\n [isPasswordType, type, innerType],\n );\n\n const hasInnerAdornment = React.useMemo(\n () => clearable || isPasswordType || invalid,\n [clearable, isPasswordType, invalid],\n );\n\n const hasAdornmentGroup = React.useMemo(\n () => (clearable && invalid) || (clearable && isPasswordType) || (invalid && isPasswordType),\n [clearable, invalid, isPasswordType],\n );\n\n const clearDisabled = React.useMemo(() => readOnly || disabled, [readOnly, disabled]);\n\n const handleClear = React.useCallback(() => {\n const { current } = inputRef;\n if (current) {\n current.clear();\n }\n }, [inputRef]);\n\n const handleFocus = React.useCallback(\n (e: React.FocusEvent<HTMLInputElement>) => {\n if (onFocus) {\n onFocus(e);\n }\n setInputHasFocus(true);\n },\n [onFocus, setInputHasFocus],\n );\n\n const handleBlur = React.useCallback(\n (e: React.FocusEvent<HTMLInputElement>) => {\n if (onBlur) {\n onBlur(e);\n }\n setInputHasFocus(false);\n },\n [onBlur, setInputHasFocus],\n );\n\n const togglePasswordVisibility = React.useCallback(() => {\n setInnerType((prevInnerType) => (prevInnerType === 'password' ? undefined : 'password'));\n }, [setInnerType]);\n\n const EndAdornmentWrapper = hasAdornmentGroup ? AdornmentGroup : React.Fragment;\n\n const PasswordVisibilityToggleIcon = isPasswordVisible\n ? StyledEyeClosedIcon\n : StyledEyeOpenIcon;\n\n const passwordAction = React.useMemo(\n () => (isPasswordVisible ? 'Hide password' : 'Show password'),\n [isPasswordVisible],\n );\n\n return (\n <BoxVanilla css={css}>\n {LabelNode}\n <InputVanilla\n id={id}\n ref={inputRef}\n endAdornment={\n hasInnerAdornment && (\n <EndAdornmentWrapper>\n {invalid && <StyledExclamationTriangleIcon role=\"alert\" aria-label=\"Invalid\" />}\n {isPasswordType && (\n <Tooltip content={passwordAction}>\n <PasswordVisibilityToggleIcon\n aria-label={passwordAction}\n onClick={togglePasswordVisibility}\n />\n </Tooltip>\n )}\n {clearable && !clearDisabled && (\n <Tooltip content=\"Clear\">\n <StyledCrossCircledIcon aria-label=\"Clear\" onClick={handleClear} />\n </Tooltip>\n )}\n </EndAdornmentWrapper>\n )\n }\n state={state}\n type={typeOrInnerType}\n disabled={disabled}\n readOnly={readOnly}\n onFocus={handleFocus}\n onBlur={handleBlur}\n {...props}\n />\n </BoxVanilla>\n );\n },\n);\n\nTextFieldVanilla.displayName = 'TextFieldVanilla';\n"],"mappings":";;;;;;;;;;;AA2BA,IAAM,iBAAiBA,wBAAAA,OAAO,OAAO;CACnC,SAAS;CACT,eAAe;CACf,YAAY;AACd,CAAC;AAED,IAAM,gCAAgCA,wBAAAA,OAAOC,sBAAAA,yBAAyB,EACpE,SAAS,EACP,YAAY,KACd,EACF,CAAC;AAED,IAAM,oBAAoBD,wBAAAA,OAAOE,sBAAAA,aAAa,EAC5C,UAAU,EACR,WAAW,EACT,QAAQ,UACV,EACF,EACF,CAAC;AAED,IAAM,sBAAsBF,wBAAAA,OAAOG,sBAAAA,eAAe,EAChD,UAAU,EACR,WAAW,EACT,QAAQ,UACV,EACF,EACF,CAAC;AAED,IAAM,yBAAyBH,wBAAAA,OAAOI,sBAAAA,kBAAkB,EACtD,UAAU,EACR,WAAW,EACT,QAAQ,UACV,EACF,EACF,CAAC;AAED,IAAa,mBAAmBC,MAAAA,QAAM,YAKlC,EACE,OACA,WACA,OAAO,kBACP,IACA,MACA,UACA,UACA,QACA,SACA,KACA,GAAG,SAEL,iBACG;CACH,MAAM,WAAWA,MAAAA,QAAM,OAAkC,IAAI;CAC7D,MAAA,QAAM,oBAAoB,oBA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IAAA,CAACA,gBAAAA,SAAD;KAAS,SAAQ;KACf,UAAA,iBAAA,GAAA,kBAAA,IAAA,CAAC,wBAAD;MAAwB,cAAW;MAAQ,SAAS;KAAc,CAAA;IAC3D,CAAA;GAEQ,EAAA,CAAA;GAGlB;GACP,MAAM;GACI;GACA;GACV,SAAS;GACT,QAAQ;GACR,GAAI;EACL,CAAA,CACS;;AAEhB,CACF;AAEA,iBAAiB,cAAc"}
1
+ {"version":3,"file":"TextField.vanilla.cjs","names":["React","useFieldContext","EyeClosedIcon","EyeOpenIcon","_Fragment","ExclamationTriangleIcon","Tooltip","CrossCircledIcon","InputVanilla","FieldVanilla"],"sources":["../../../components/TextField/TextField.vanilla.tsx"],"sourcesContent":["import {\n CrossCircledIcon,\n ExclamationTriangleIcon,\n EyeClosedIcon,\n EyeOpenIcon,\n} from '@radix-ui/react-icons';\nimport React from 'react';\n\nimport { FieldVanilla } from '../Field/Field.vanilla';\nimport { FieldLabelProps, useFieldContext } from '../Field/FieldContext';\nimport { InputVanilla, InputVanillaHandle, InputVanillaProps } from '../Input';\nimport { Tooltip } from '../Tooltip';\nimport { adornmentButton, adornmentGroup, invalidIcon } from './TextField.vanilla.css';\n\n// TYPES\nexport interface TextFieldLabelProps {\n variant: 'invalid' | 'subtle' | 'contrast' | 'default';\n htmlFor?: string;\n id?: string;\n}\n\nexport type TextFieldVanillaProps = InputVanillaProps & {\n type?: string;\n clearable?: boolean;\n label?: string | ((props: TextFieldLabelProps) => JSX.Element);\n description?: React.ReactNode;\n error?: React.ReactNode;\n announceError?: boolean;\n};\n\nexport const TextFieldVanilla = React.forwardRef<\n React.ElementRef<typeof InputVanilla>,\n TextFieldVanillaProps\n>(\n (\n {\n state,\n clearable,\n label: LabelOrComponent,\n description,\n error,\n announceError,\n id,\n type,\n disabled,\n readOnly,\n css,\n ...props\n },\n forwardedRef,\n ) => {\n const inputRef = React.useRef<InputVanillaHandle | null>(null);\n React.useImperativeHandle(forwardedRef, () => inputRef.current as InputVanillaHandle);\n\n const outerField = useFieldContext();\n const [innerType, setInnerType] = React.useState(type);\n const isPasswordVisible = React.useMemo(() => innerType !== 'password', [innerType]);\n\n const invalid = state === 'invalid' || Boolean(error) || Boolean(outerField?.invalid);\n\n const renderLabel = React.useMemo(() => {\n if (LabelOrComponent === undefined || LabelOrComponent === null) {\n return undefined;\n }\n if (typeof LabelOrComponent === 'string') {\n return LabelOrComponent;\n }\n return (labelProps: FieldLabelProps) => <LabelOrComponent {...labelProps} />;\n }, [LabelOrComponent]);\n\n const isPasswordType = React.useMemo(() => type === 'password', [type]);\n\n const typeOrInnerType = React.useMemo(\n () => (isPasswordType ? innerType : type),\n [isPasswordType, type, innerType],\n );\n\n const hasInnerAdornment = React.useMemo(\n () => clearable || isPasswordType || invalid,\n [clearable, isPasswordType, invalid],\n );\n\n const hasAdornmentGroup = React.useMemo(\n () => (clearable && invalid) || (clearable && isPasswordType) || (invalid && isPasswordType),\n [clearable, invalid, isPasswordType],\n );\n\n const clearDisabled = readOnly || disabled || Boolean(outerField?.disabled);\n\n const handleClear = React.useCallback(() => {\n const { current } = inputRef;\n if (current) {\n const setValue = Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, 'value')?.set;\n setValue?.call(current, '');\n current.dispatchEvent(new Event('input', { bubbles: true }));\n current.focus();\n }\n }, [inputRef]);\n\n const togglePasswordVisibility = React.useCallback(() => {\n setInnerType((prevInnerType) => (prevInnerType === 'password' ? undefined : 'password'));\n }, [setInnerType]);\n\n const PasswordVisibilityToggleIcon = isPasswordVisible ? EyeClosedIcon : EyeOpenIcon;\n\n const passwordAction = React.useMemo(\n () => (isPasswordVisible ? 'Hide password' : 'Show password'),\n [isPasswordVisible],\n );\n\n const adornments = (\n <>\n {invalid && <ExclamationTriangleIcon className={invalidIcon} aria-hidden />}\n {isPasswordType && (\n <Tooltip content={passwordAction}>\n <button\n type=\"button\"\n className={adornmentButton}\n aria-label={passwordAction}\n onClick={togglePasswordVisibility}\n >\n <PasswordVisibilityToggleIcon aria-hidden />\n </button>\n </Tooltip>\n )}\n {clearable && !clearDisabled && (\n <Tooltip content=\"Clear\">\n <button\n type=\"button\"\n className={adornmentButton}\n aria-label=\"Clear\"\n onClick={handleClear}\n >\n <CrossCircledIcon aria-hidden />\n </button>\n </Tooltip>\n )}\n </>\n );\n\n const input = (\n <InputVanilla\n id={id}\n ref={inputRef}\n endAdornment={\n hasInnerAdornment &&\n (hasAdornmentGroup ? <div className={adornmentGroup}>{adornments}</div> : adornments)\n }\n state={state}\n type={typeOrInnerType}\n disabled={disabled}\n readOnly={readOnly}\n {...props}\n />\n );\n\n return (\n <FieldVanilla\n id={id}\n label={renderLabel}\n description={description}\n error={error}\n announceError={announceError}\n invalid={state === 'invalid'}\n disabled={disabled}\n css={{ boxSizing: 'border-box', ...css }}\n >\n {input}\n </FieldVanilla>\n );\n },\n);\n\nTextFieldVanilla.displayName = 'TextFieldVanilla';\n"],"mappings":";;;;;;;;;;;AA8BA,IAAa,mBAAmBA,MAAAA,QAAM,YAKlC,EACE,OACA,WACA,OAAO,kBACP,aACA,OACA,eACA,IACA,MACA,UACA,UACA,KACA,GAAG,SAEL,iBACG;CACH,MAAM,WAAWA,MAAAA,QAAM,OAAkC,IAAI;CAC7D,MAAA,QAAM,oBAAoB,oBAAoB,SAAS,OAA6B;CAEpF,MAAM,aAAaC,qBAAAA,gBAAgB;CACnC,MAAM,CAAC,WAAW,gBAAgBD,MAAAA,QAAM,SAAS,IAAI;CACrD,MAAM,oBAAoBA,MAAAA,QAAM,cAAc,cAAc,YAAY,CAAC,SAAS,CAAC;CAEnF,MAAM,UAAU,UAAU,aAAa,QAAQ,KAAK,KAAK,QAAQ,YAAY,OAAO;CAEpF,MAAM,cAAcA,MAAAA,QAAM,cAAc;EACtC,IAAI,qBAAqB,KAAA,KAAa,qBAAqB,MACzD;EAEF,IAAI,OAAO,qBAAqB,UAC9B,OAAO;EAET,QAAQ,eAAgC,iBAAA,GAAA,kBAAA,IAAA,CAAC,kBAAD,E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E,kBACC,iBAAA,GAAA,kBAAA,IAAA,CAACC,gBAAAA,SAAD;GAAS,SAAS;GAChB,UAAA,iBAAA,GAAA,kBAAA,IAAA,CAAC,UAAD;IACE,MAAK;IACL,WAAA;IACA,cAAY;IACZ,SAAS;IAET,UAAA,iBAAA,GAAA,kBAAA,IAAA,CAAC,8BAAD,EAA8B,eAAA,KAAa,CAAA;GACrC,CAAA;EACD,CAAA;EAEV,aAAa,CAAC,iBACb,iBAAA,GAAA,kBAAA,IAAA,CAACA,gBAAAA,SAAD;GAAS,SAAQ;GACf,UAAA,iBAAA,GAAA,kBAAA,IAAA,CAAC,UAAD;IACE,MAAK;IACL,WAAA;IACA,cAAW;IACX,SAAS;IAET,UAAA,iBAAA,GAAA,kBAAA,IAAA,CAACC,sBAAAA,kBAAD,EAAkB,eAAA,KAAa,CAAA;GACzB,CAAA;EACD,CAAA;CAEX,EAAA,CAAA;CAGJ,MAAM,QACJ,iBAAA,GAAA,kBAAA,IAAA,CAACC,sBAAAA,cAAD;EACM;EACJ,KAAK;EACL,cACE,sBACC,oBAAoB,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;GAAK,WAAA;GAA4B,UAAA;EAAgB,CAAA,IAAI;EAErE;EACP,MAAM;EACI;EACA;EACV,GAAI;CACL,CAAA;CAGH,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACC,sBAAAA,cAAD;EACM;EACJ,OAAO;EACM;EACN;EACQ;EACf,SAAS,UAAU;EACT;EACV,KAAK;GAAE,WAAW;GAAc,GAAG;EAAI;EAEtC,UAAA;CACW,CAAA;AAElB,CACF;AAEA,iBAAiB,cAAc"}
@@ -0,0 +1,10 @@
1
+ ;/* empty css */
2
+ // components/TextField/TextField.vanilla.css.ts
3
+ var adornmentGroup = "_1q0c5700";
4
+ var invalidIcon = "_1q0c5701";
5
+ var adornmentButton = "_1q0c5702";
6
+ exports.adornmentButton = adornmentButton;
7
+ exports.adornmentGroup = adornmentGroup;
8
+ exports.invalidIcon = invalidIcon;
9
+
10
+ //# sourceMappingURL=TextField.vanilla.css.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TextField.vanilla.css.cjs","names":[],"sources":["../../../components/TextField/TextField.vanilla.css.ts"],"sourcesContent":["import { globalStyle, style } from '@vanilla-extract/css';\n\nimport { tokens } from '../../styles/tokens.css';\n\nexport const adornmentGroup = style({\n display: 'flex',\n flexDirection: 'row',\n alignItems: 'center',\n});\n\nexport const invalidIcon = style({});\n\nglobalStyle(`${invalidIcon} + *`, {\n marginLeft: tokens.space['1'],\n});\n\nexport const adornmentButton = style({\n appearance: 'none',\n background: 'none',\n border: 'none',\n padding: 0,\n font: 'inherit',\n display: 'inline-flex',\n alignItems: 'center',\n justifyContent: 'center',\n borderRadius: tokens.radii['1'],\n color: 'inherit',\n cursor: 'pointer',\n selectors: {\n '&:focus-visible': {\n outline: `2px solid ${tokens.colors.inputFocusBorder}`,\n outlineOffset: '1px',\n },\n },\n});\n"],"mappings":""}
@@ -0,0 +1,8 @@
1
+ /* empty css */
2
+ // components/TextField/TextField.vanilla.css.ts
3
+ var adornmentGroup = "_1q0c5700";
4
+ var invalidIcon = "_1q0c5701";
5
+ var adornmentButton = "_1q0c5702";
6
+ export { adornmentButton, adornmentGroup, invalidIcon };
7
+
8
+ //# sourceMappingURL=TextField.vanilla.css.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TextField.vanilla.css.js","names":[],"sources":["../../../components/TextField/TextField.vanilla.css.ts"],"sourcesContent":["import { globalStyle, style } from '@vanilla-extract/css';\n\nimport { tokens } from '../../styles/tokens.css';\n\nexport const adornmentGroup = style({\n display: 'flex',\n flexDirection: 'row',\n alignItems: 'center',\n});\n\nexport const invalidIcon = style({});\n\nglobalStyle(`${invalidIcon} + *`, {\n marginLeft: tokens.space['1'],\n});\n\nexport const adornmentButton = style({\n appearance: 'none',\n background: 'none',\n border: 'none',\n padding: 0,\n font: 'inherit',\n display: 'inline-flex',\n alignItems: 'center',\n justifyContent: 'center',\n borderRadius: tokens.radii['1'],\n color: 'inherit',\n cursor: 'pointer',\n selectors: {\n '&:focus-visible': {\n outline: `2px solid ${tokens.colors.inputFocusBorder}`,\n outlineOffset: '1px',\n },\n },\n});\n"],"mappings":""}
@@ -1,54 +1,24 @@
1
- import { styled } from "../../stitches.config.js";
2
- import { BoxVanilla } from "../Box/Box.vanilla.js";
3
- import { LabelVanilla } from "../Label/Label.vanilla.js";
1
+ import { useFieldContext } from "../Field/FieldContext.js";
4
2
  import { InputVanilla } from "../Input/Input.vanilla.js";
3
+ import { FieldVanilla } from "../Field/Field.vanilla.js";
5
4
  import { Tooltip } from "../Tooltip/Tooltip.js";
5
+ import "./TextField.vanilla.css.js";
6
6
  import { CrossCircledIcon, ExclamationTriangleIcon, EyeClosedIcon, EyeOpenIcon } from "@radix-ui/react-icons";
7
7
  import React from "react";
8
- import { jsx, jsxs } from "react/jsx-runtime";
8
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
9
9
  // components/TextField/TextField.vanilla.tsx
10
- var AdornmentGroup = styled("div", {
11
- display: "flex",
12
- flexDirection: "row",
13
- alignItems: "center"
14
- });
15
- var StyledExclamationTriangleIcon = styled(ExclamationTriangleIcon, { "& + *": { marginLeft: "$1" } });
16
- var StyledEyeOpenIcon = styled(EyeOpenIcon, { "@hover": { "&:hover": { cursor: "pointer" } } });
17
- var StyledEyeClosedIcon = styled(EyeClosedIcon, { "@hover": { "&:hover": { cursor: "pointer" } } });
18
- var StyledCrossCircledIcon = styled(CrossCircledIcon, { "@hover": { "&:hover": { cursor: "pointer" } } });
19
- var TextFieldVanilla = React.forwardRef(({ state, clearable, label: LabelOrComponent, id, type, disabled, readOnly, onBlur, onFocus, css, ...props }, forwardedRef) => {
10
+ var TextFieldVanilla = React.forwardRef(({ state, clearable, label: LabelOrComponent, description, error, announceError, id, type, disabled, readOnly, css, ...props }, forwardedRef) => {
20
11
  const inputRef = React.useRef(null);
21
12
  React.useImperativeHandle(forwardedRef, () => inputRef.current);
22
- const [inputHasFocus, setInputHasFocus] = React.useState(false);
13
+ const outerField = useFieldContext();
23
14
  const [innerType, setInnerType] = React.useState(type);
24
15
  const isPasswordVisible = React.useMemo(() => innerType !== "password", [innerType]);
25
- const invalid = React.useMemo(() => state === "invalid", [state]);
26
- const labelVariant = React.useMemo(() => {
27
- if (disabled) return "subtle";
28
- if (invalid) return "invalid";
29
- if (inputHasFocus) return "contrast";
30
- return "default";
31
- }, [
32
- invalid,
33
- disabled,
34
- inputHasFocus
35
- ]);
36
- const LabelNode = React.useMemo(() => {
37
- if (LabelOrComponent === void 0 || LabelOrComponent === null) return null;
38
- if (typeof LabelOrComponent === "string") return /* @__PURE__ */ jsx(LabelVanilla, {
39
- variant: labelVariant,
40
- htmlFor: id,
41
- children: LabelOrComponent
42
- });
43
- return /* @__PURE__ */ jsx(LabelOrComponent, {
44
- variant: labelVariant,
45
- htmlFor: id
46
- });
47
- }, [
48
- LabelOrComponent,
49
- labelVariant,
50
- id
51
- ]);
16
+ const invalid = state === "invalid" || Boolean(error) || Boolean(outerField?.invalid);
17
+ const renderLabel = React.useMemo(() => {
18
+ if (LabelOrComponent === void 0 || LabelOrComponent === null) return;
19
+ if (typeof LabelOrComponent === "string") return LabelOrComponent;
20
+ return (labelProps) => /* @__PURE__ */ jsx(LabelOrComponent, { ...labelProps });
21
+ }, [LabelOrComponent]);
52
22
  const isPasswordType = React.useMemo(() => type === "password", [type]);
53
23
  const typeOrInnerType = React.useMemo(() => isPasswordType ? innerType : type, [
54
24
  isPasswordType,
@@ -65,58 +35,72 @@ var TextFieldVanilla = React.forwardRef(({ state, clearable, label: LabelOrCompo
65
35
  invalid,
66
36
  isPasswordType
67
37
  ]);
68
- const clearDisabled = React.useMemo(() => readOnly || disabled, [readOnly, disabled]);
38
+ const clearDisabled = readOnly || disabled || Boolean(outerField?.disabled);
69
39
  const handleClear = React.useCallback(() => {
70
40
  const { current } = inputRef;
71
- if (current) current.clear();
41
+ if (current) {
42
+ (Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, "value")?.set)?.call(current, "");
43
+ current.dispatchEvent(new Event("input", { bubbles: true }));
44
+ current.focus();
45
+ }
72
46
  }, [inputRef]);
73
- const handleFocus = React.useCallback((e) => {
74
- if (onFocus) onFocus(e);
75
- setInputHasFocus(true);
76
- }, [onFocus, setInputHasFocus]);
77
- const handleBlur = React.useCallback((e) => {
78
- if (onBlur) onBlur(e);
79
- setInputHasFocus(false);
80
- }, [onBlur, setInputHasFocus]);
81
47
  const togglePasswordVisibility = React.useCallback(() => {
82
48
  setInnerType((prevInnerType) => prevInnerType === "password" ? void 0 : "password");
83
49
  }, [setInnerType]);
84
- const EndAdornmentWrapper = hasAdornmentGroup ? AdornmentGroup : React.Fragment;
85
- const PasswordVisibilityToggleIcon = isPasswordVisible ? StyledEyeClosedIcon : StyledEyeOpenIcon;
50
+ const PasswordVisibilityToggleIcon = isPasswordVisible ? EyeClosedIcon : EyeOpenIcon;
86
51
  const passwordAction = React.useMemo(() => isPasswordVisible ? "Hide password" : "Show password", [isPasswordVisible]);
87
- return /* @__PURE__ */ jsxs(BoxVanilla, {
88
- css,
89
- children: [LabelNode, /* @__PURE__ */ jsx(InputVanilla, {
90
- id,
91
- ref: inputRef,
92
- endAdornment: hasInnerAdornment && /* @__PURE__ */ jsxs(EndAdornmentWrapper, { children: [
93
- invalid && /* @__PURE__ */ jsx(StyledExclamationTriangleIcon, {
94
- role: "alert",
95
- "aria-label": "Invalid"
96
- }),
97
- isPasswordType && /* @__PURE__ */ jsx(Tooltip, {
98
- content: passwordAction,
99
- children: /* @__PURE__ */ jsx(PasswordVisibilityToggleIcon, {
100
- "aria-label": passwordAction,
101
- onClick: togglePasswordVisibility
102
- })
103
- }),
104
- clearable && !clearDisabled && /* @__PURE__ */ jsx(Tooltip, {
105
- content: "Clear",
106
- children: /* @__PURE__ */ jsx(StyledCrossCircledIcon, {
107
- "aria-label": "Clear",
108
- onClick: handleClear
109
- })
110
- })
111
- ] }),
112
- state,
113
- type: typeOrInnerType,
114
- disabled,
115
- readOnly,
116
- onFocus: handleFocus,
117
- onBlur: handleBlur,
118
- ...props
119
- })]
52
+ const adornments = /* @__PURE__ */ jsxs(Fragment, { children: [
53
+ invalid && /* @__PURE__ */ jsx(ExclamationTriangleIcon, {
54
+ className: "_1q0c5701",
55
+ "aria-hidden": true
56
+ }),
57
+ isPasswordType && /* @__PURE__ */ jsx(Tooltip, {
58
+ content: passwordAction,
59
+ children: /* @__PURE__ */ jsx("button", {
60
+ type: "button",
61
+ className: "_1q0c5702",
62
+ "aria-label": passwordAction,
63
+ onClick: togglePasswordVisibility,
64
+ children: /* @__PURE__ */ jsx(PasswordVisibilityToggleIcon, { "aria-hidden": true })
65
+ })
66
+ }),
67
+ clearable && !clearDisabled && /* @__PURE__ */ jsx(Tooltip, {
68
+ content: "Clear",
69
+ children: /* @__PURE__ */ jsx("button", {
70
+ type: "button",
71
+ className: "_1q0c5702",
72
+ "aria-label": "Clear",
73
+ onClick: handleClear,
74
+ children: /* @__PURE__ */ jsx(CrossCircledIcon, { "aria-hidden": true })
75
+ })
76
+ })
77
+ ] });
78
+ const input = /* @__PURE__ */ jsx(InputVanilla, {
79
+ id,
80
+ ref: inputRef,
81
+ endAdornment: hasInnerAdornment && (hasAdornmentGroup ? /* @__PURE__ */ jsx("div", {
82
+ className: "_1q0c5700",
83
+ children: adornments
84
+ }) : adornments),
85
+ state,
86
+ type: typeOrInnerType,
87
+ disabled,
88
+ readOnly,
89
+ ...props
90
+ });
91
+ return /* @__PURE__ */ jsx(FieldVanilla, {
92
+ id,
93
+ label: renderLabel,
94
+ description,
95
+ error,
96
+ announceError,
97
+ invalid: state === "invalid",
98
+ disabled,
99
+ css: {
100
+ boxSizing: "border-box",
101
+ ...css
102
+ },
103
+ children: input
120
104
  });
121
105
  });
122
106
  TextFieldVanilla.displayName = "TextFieldVanilla";
@@ -1 +1 @@
1
- {"version":3,"file":"TextField.vanilla.js","names":[],"sources":["../../../components/TextField/TextField.vanilla.tsx"],"sourcesContent":["import {\n CrossCircledIcon,\n ExclamationTriangleIcon,\n EyeClosedIcon,\n EyeOpenIcon,\n} from '@radix-ui/react-icons';\nimport React from 'react';\n\nimport { styled } from '../../stitches.config';\nimport { BoxVanilla } from '../Box';\nimport { InputVanilla, InputVanillaHandle, InputVanillaProps } from '../Input';\nimport { LabelVanilla } from '../Label';\nimport { Tooltip } from '../Tooltip';\n\n// TYPES\nexport interface TextFieldLabelProps {\n variant: 'invalid' | 'subtle' | 'contrast' | 'default';\n htmlFor?: string;\n}\n\nexport type TextFieldVanillaProps = InputVanillaProps & {\n type?: string;\n clearable?: boolean;\n label?: string | ((props: TextFieldLabelProps) => JSX.Element);\n};\n\n// COMPONENTS\nconst AdornmentGroup = styled('div', {\n display: 'flex',\n flexDirection: 'row',\n alignItems: 'center',\n});\n\nconst StyledExclamationTriangleIcon = styled(ExclamationTriangleIcon, {\n '& + *': {\n marginLeft: '$1',\n },\n});\n\nconst StyledEyeOpenIcon = styled(EyeOpenIcon, {\n '@hover': {\n '&:hover': {\n cursor: 'pointer',\n },\n },\n});\n\nconst StyledEyeClosedIcon = styled(EyeClosedIcon, {\n '@hover': {\n '&:hover': {\n cursor: 'pointer',\n },\n },\n});\n\nconst StyledCrossCircledIcon = styled(CrossCircledIcon, {\n '@hover': {\n '&:hover': {\n cursor: 'pointer',\n },\n },\n});\n\nexport const TextFieldVanilla = React.forwardRef<\n React.ElementRef<typeof InputVanilla>,\n TextFieldVanillaProps\n>(\n (\n {\n state,\n clearable,\n label: LabelOrComponent,\n id,\n type,\n disabled,\n readOnly,\n onBlur,\n onFocus,\n css,\n ...props\n },\n forwardedRef,\n ) => {\n const inputRef = React.useRef<InputVanillaHandle | null>(null);\n React.useImperativeHandle(forwardedRef, () => inputRef.current as InputVanillaHandle);\n\n const [inputHasFocus, setInputHasFocus] = React.useState(false);\n const [innerType, setInnerType] = React.useState(type);\n const isPasswordVisible = React.useMemo(() => innerType !== 'password', [innerType]);\n\n const invalid = React.useMemo(() => state === 'invalid', [state]);\n\n const labelVariant = React.useMemo(() => {\n if (disabled) {\n return 'subtle';\n }\n if (invalid) {\n return 'invalid';\n }\n if (inputHasFocus) {\n return 'contrast';\n }\n return 'default';\n }, [invalid, disabled, inputHasFocus]);\n\n const LabelNode = React.useMemo(() => {\n if (LabelOrComponent === undefined || LabelOrComponent === null) {\n return null;\n }\n if (typeof LabelOrComponent === 'string') {\n return (\n <LabelVanilla variant={labelVariant} htmlFor={id}>\n {LabelOrComponent}\n </LabelVanilla>\n );\n }\n return <LabelOrComponent variant={labelVariant} htmlFor={id} />;\n }, [LabelOrComponent, labelVariant, id]);\n\n const isPasswordType = React.useMemo(() => type === 'password', [type]);\n\n const typeOrInnerType = React.useMemo(\n () => (isPasswordType ? innerType : type),\n [isPasswordType, type, innerType],\n );\n\n const hasInnerAdornment = React.useMemo(\n () => clearable || isPasswordType || invalid,\n [clearable, isPasswordType, invalid],\n );\n\n const hasAdornmentGroup = React.useMemo(\n () => (clearable && invalid) || (clearable && isPasswordType) || (invalid && isPasswordType),\n [clearable, invalid, isPasswordType],\n );\n\n const clearDisabled = React.useMemo(() => readOnly || disabled, [readOnly, disabled]);\n\n const handleClear = React.useCallback(() => {\n const { current } = inputRef;\n if (current) {\n current.clear();\n }\n }, [inputRef]);\n\n const handleFocus = React.useCallback(\n (e: React.FocusEvent<HTMLInputElement>) => {\n if (onFocus) {\n onFocus(e);\n }\n setInputHasFocus(true);\n },\n [onFocus, setInputHasFocus],\n );\n\n const handleBlur = React.useCallback(\n (e: React.FocusEvent<HTMLInputElement>) => {\n if (onBlur) {\n onBlur(e);\n }\n setInputHasFocus(false);\n },\n [onBlur, setInputHasFocus],\n );\n\n const togglePasswordVisibility = React.useCallback(() => {\n setInnerType((prevInnerType) => (prevInnerType === 'password' ? undefined : 'password'));\n }, [setInnerType]);\n\n const EndAdornmentWrapper = hasAdornmentGroup ? AdornmentGroup : React.Fragment;\n\n const PasswordVisibilityToggleIcon = isPasswordVisible\n ? StyledEyeClosedIcon\n : StyledEyeOpenIcon;\n\n const passwordAction = React.useMemo(\n () => (isPasswordVisible ? 'Hide password' : 'Show password'),\n [isPasswordVisible],\n );\n\n return (\n <BoxVanilla css={css}>\n {LabelNode}\n <InputVanilla\n id={id}\n ref={inputRef}\n endAdornment={\n hasInnerAdornment && (\n <EndAdornmentWrapper>\n {invalid && <StyledExclamationTriangleIcon role=\"alert\" aria-label=\"Invalid\" />}\n {isPasswordType && (\n <Tooltip content={passwordAction}>\n <PasswordVisibilityToggleIcon\n aria-label={passwordAction}\n onClick={togglePasswordVisibility}\n />\n </Tooltip>\n )}\n {clearable && !clearDisabled && (\n <Tooltip content=\"Clear\">\n <StyledCrossCircledIcon aria-label=\"Clear\" onClick={handleClear} />\n </Tooltip>\n )}\n </EndAdornmentWrapper>\n )\n }\n state={state}\n type={typeOrInnerType}\n disabled={disabled}\n readOnly={readOnly}\n onFocus={handleFocus}\n onBlur={handleBlur}\n {...props}\n />\n </BoxVanilla>\n );\n },\n);\n\nTextFieldVanilla.displayName = 'TextFieldVanilla';\n"],"mappings":";;;;;;;;;AA2BA,IAAM,iBAAiB,OAAO,OAAO;CACnC,SAAS;CACT,eAAe;CACf,YAAY;AACd,CAAC;AAED,IAAM,gCAAgC,OAAO,yBAAyB,EACpE,SAAS,EACP,YAAY,KACd,EACF,CAAC;AAED,IAAM,oBAAoB,OAAO,aAAa,EAC5C,UAAU,EACR,WAAW,EACT,QAAQ,UACV,EACF,EACF,CAAC;AAED,IAAM,sBAAsB,OAAO,eAAe,EAChD,UAAU,EACR,WAAW,EACT,QAAQ,UACV,EACF,EACF,CAAC;AAED,IAAM,yBAAyB,OAAO,kBAAkB,EACtD,UAAU,EACR,WAAW,EACT,QAAQ,UACV,EACF,EACF,CAAC;AAED,IAAa,mBAAmB,MAAM,YAKlC,EACE,OACA,WACA,OAAO,kBACP,IACA,MACA,UACA,UACA,QACA,SACA,KACA,GAAG,SAEL,iBACG;CACH,MAAM,WAAW,MAAM,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AAC,QAAQ,CAAC;CAEb,MAAM,cAAc,MAAM,aACvB,MAA0C;EACzC,IAAI,SACF,QAAQ,CAAC;EAEX,iBAAiB,IAAI;CACvB,GACA,CAAC,SAAS,gBAAgB,CAC5B;CAEA,MAAM,aAAa,MAAM,aACtB,MAA0C;EACzC,IAAI,QACF,OAAO,CAAC;EAEV,iBAAiB,KAAK;CACxB,GACA,CAAC,QAAQ,gBAAgB,CAC3B;CAEA,MAAM,2BAA2B,MAAM,kBAAkB;EACvD,cAAc,kBAAmB,kBAAkB,aAAa,KAAA,IAAY,UAAW;CACzF,GAAG,CAAC,YAAY,CAAC;CAEjB,MAAM,sBAAsB,oBAAoB,iBAAiB,MAAM;CAEvE,MAAM,+BAA+B,oBACjC,sBACA;CAEJ,MAAM,iBAAiB,MAAM,cACpB,oBAAoB,kBAAkB,iBAC7C,CAAC,iBAAiB,CACpB;CAEA,OACE,qBAAC,YAAD;EAAiB;EAAjB,UAAA,CACG,WACD,oBAAC,cAAD;GACM;GACJ,KAAK;GACL,cACE,qBACE,qBAAC,qBAAD,EAAA,UAAA;IACG,WAAW,oBAAC,+BAAD;KAA+B,MAAK;KAAQ,cAAW;IAAW,CAAA;IAC7E,kBACC,oBAAC,SAAD;KAAS,SAAS;KAChB,UAAA,oBAAC,8BAAD;MACE,cAAY;MACZ,SAAS;KACV,CAAA;IACM,CAAA;IAEV,aAAa,CAAC,iBACb,oBAAC,SAAD;KAAS,SAAQ;KACf,UAAA,oBAAC,wBAAD;MAAwB,cAAW;MAAQ,SAAS;KAAc,CAAA;IAC3D,CAAA;GAEQ,EAAA,CAAA;GAGlB;GACP,MAAM;GACI;GACA;GACV,SAAS;GACT,QAAQ;GACR,GAAI;EACL,CAAA,CACS;;AAEhB,CACF;AAEA,iBAAiB,cAAc"}
1
+ {"version":3,"file":"TextField.vanilla.js","names":["_Fragment"],"sources":["../../../components/TextField/TextField.vanilla.tsx"],"sourcesContent":["import {\n CrossCircledIcon,\n ExclamationTriangleIcon,\n EyeClosedIcon,\n EyeOpenIcon,\n} from '@radix-ui/react-icons';\nimport React from 'react';\n\nimport { FieldVanilla } from '../Field/Field.vanilla';\nimport { FieldLabelProps, useFieldContext } from '../Field/FieldContext';\nimport { InputVanilla, InputVanillaHandle, InputVanillaProps } from '../Input';\nimport { Tooltip } from '../Tooltip';\nimport { adornmentButton, adornmentGroup, invalidIcon } from './TextField.vanilla.css';\n\n// TYPES\nexport interface TextFieldLabelProps {\n variant: 'invalid' | 'subtle' | 'contrast' | 'default';\n htmlFor?: string;\n id?: string;\n}\n\nexport type TextFieldVanillaProps = InputVanillaProps & {\n type?: string;\n clearable?: boolean;\n label?: string | ((props: TextFieldLabelProps) => JSX.Element);\n description?: React.ReactNode;\n error?: React.ReactNode;\n announceError?: boolean;\n};\n\nexport const TextFieldVanilla = React.forwardRef<\n React.ElementRef<typeof InputVanilla>,\n TextFieldVanillaProps\n>(\n (\n {\n state,\n clearable,\n label: LabelOrComponent,\n description,\n error,\n announceError,\n id,\n type,\n disabled,\n readOnly,\n css,\n ...props\n },\n forwardedRef,\n ) => {\n const inputRef = React.useRef<InputVanillaHandle | null>(null);\n React.useImperativeHandle(forwardedRef, () => inputRef.current as InputVanillaHandle);\n\n const outerField = useFieldContext();\n const [innerType, setInnerType] = React.useState(type);\n const isPasswordVisible = React.useMemo(() => innerType !== 'password', [innerType]);\n\n const invalid = state === 'invalid' || Boolean(error) || Boolean(outerField?.invalid);\n\n const renderLabel = React.useMemo(() => {\n if (LabelOrComponent === undefined || LabelOrComponent === null) {\n return undefined;\n }\n if (typeof LabelOrComponent === 'string') {\n return LabelOrComponent;\n }\n return (labelProps: FieldLabelProps) => <LabelOrComponent {...labelProps} />;\n }, [LabelOrComponent]);\n\n const isPasswordType = React.useMemo(() => type === 'password', [type]);\n\n const typeOrInnerType = React.useMemo(\n () => (isPasswordType ? innerType : type),\n [isPasswordType, type, innerType],\n );\n\n const hasInnerAdornment = React.useMemo(\n () => clearable || isPasswordType || invalid,\n [clearable, isPasswordType, invalid],\n );\n\n const hasAdornmentGroup = React.useMemo(\n () => (clearable && invalid) || (clearable && isPasswordType) || (invalid && isPasswordType),\n [clearable, invalid, isPasswordType],\n );\n\n const clearDisabled = readOnly || disabled || Boolean(outerField?.disabled);\n\n const handleClear = React.useCallback(() => {\n const { current } = inputRef;\n if (current) {\n const setValue = Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, 'value')?.set;\n setValue?.call(current, '');\n current.dispatchEvent(new Event('input', { bubbles: true }));\n current.focus();\n }\n }, [inputRef]);\n\n const togglePasswordVisibility = React.useCallback(() => {\n setInnerType((prevInnerType) => (prevInnerType === 'password' ? undefined : 'password'));\n }, [setInnerType]);\n\n const PasswordVisibilityToggleIcon = isPasswordVisible ? EyeClosedIcon : EyeOpenIcon;\n\n const passwordAction = React.useMemo(\n () => (isPasswordVisible ? 'Hide password' : 'Show password'),\n [isPasswordVisible],\n );\n\n const adornments = (\n <>\n {invalid && <ExclamationTriangleIcon className={invalidIcon} aria-hidden />}\n {isPasswordType && (\n <Tooltip content={passwordAction}>\n <button\n type=\"button\"\n className={adornmentButton}\n aria-label={passwordAction}\n onClick={togglePasswordVisibility}\n >\n <PasswordVisibilityToggleIcon aria-hidden />\n </button>\n </Tooltip>\n )}\n {clearable && !clearDisabled && (\n <Tooltip content=\"Clear\">\n <button\n type=\"button\"\n className={adornmentButton}\n aria-label=\"Clear\"\n onClick={handleClear}\n >\n <CrossCircledIcon aria-hidden />\n </button>\n </Tooltip>\n )}\n </>\n );\n\n const input = (\n <InputVanilla\n id={id}\n ref={inputRef}\n endAdornment={\n hasInnerAdornment &&\n (hasAdornmentGroup ? <div className={adornmentGroup}>{adornments}</div> : adornments)\n }\n state={state}\n type={typeOrInnerType}\n disabled={disabled}\n readOnly={readOnly}\n {...props}\n />\n );\n\n return (\n <FieldVanilla\n id={id}\n label={renderLabel}\n description={description}\n error={error}\n announceError={announceError}\n invalid={state === 'invalid'}\n disabled={disabled}\n css={{ boxSizing: 'border-box', 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