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,MAAM,MAAM;KAAC;IAEpC,CAAA,GAAA,2DAAc,EAAE;QACd,IAAI,SAAS,OAAO,EAClB;IAEJ,GAAG;QAAC;QAAgB;QAAY;KAAS;IAEzC,IAAI,YAAY,CAAA,GAAA,mBAAK,EAAE;IACvB,CAAA,GAAA,sBAAQ,EAAE;QACR,IAAI,MAAM,WAAW,IAAI,CAAC,UAAU,OAAO,IAAI,QAAQ,GAAG,CAAC,QAAQ,KAAK,cAAc;YACpF,QAAQ,IAAI,CAAC;YACb,UAAU,OAAO,GAAG;QACtB;IACF,GAAG;QAAC,MAAM,WAAW;KAAC;IAEtB,IAAI,SAAS,CAAA,GAAA,yCAAW,EAAE;QACxB,GAAG,KAAK;QACR,UAAU,CAAA,GAAA,2BAAI,EAAE,UAAU;QAC1B,kBAAkB;IACpB,GAAG;IAEH,qBACE,0DAAC,CAAA,GAAA,uCAAY;QACV,GAAG,UAAU;QACd,KAAK;QACL,UAAU;QACT,GAAG,MAAM;QACV,WAAA;QACA,YAAY;QACZ,SAAS;QACT,YAAY;QACZ,YAAY;;AAElB","sources":["packages/@adobe/react-spectrum/src/textfield/TextArea.tsx"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaTextFieldProps, useTextField} from 'react-aria/useTextField';\n\nimport {chain} from 'react-aria/chain';\nimport React, {ReactElement, Ref, useCallback, useEffect, useRef} from 'react';\nimport {SpectrumFieldValidation, SpectrumLabelableProps, SpectrumTextInputBase, StyleProps} from '@react-types/shared';\nimport {TextFieldBase} from './TextFieldBase';\nimport {TextFieldRef} from './TextField';\nimport {useControlledState} from 'react-stately/useControlledState';\nimport {useFormProps} from '../form/Form';\nimport {useLayoutEffect} from 'react-aria/private/utils/useLayoutEffect';\nimport {useProviderProps} from '../provider/Provider';\n\nexport interface SpectrumTextAreaProps extends SpectrumTextInputBase, Omit<AriaTextFieldProps<HTMLTextAreaElement>, 'isInvalid' | 'validationState' | 'type' | 'pattern'>, SpectrumFieldValidation<string>, SpectrumLabelableProps, StyleProps {\n  /** An icon to display at the start of the input. */\n  icon?: ReactElement | null,\n  /** Whether the input should be displayed with a quiet style. */\n  isQuiet?: boolean\n}\n\n/**\n * TextAreas are multiline text inputs, useful for cases where users have\n * a sizable amount of text to enter. They allow for all customizations that\n * are available to text fields.\n */\nexport const TextArea = React.forwardRef(function TextArea(props: SpectrumTextAreaProps, ref: Ref<TextFieldRef<HTMLTextAreaElement>>) {\n  props = useProviderProps(props);\n  props = useFormProps(props);\n  let {\n    isDisabled = false,\n    isQuiet = false,\n    isReadOnly = false,\n    isRequired = false,\n    onChange,\n    ...otherProps\n  } = props;\n\n  // not in stately because this is so we know when to re-measure, which is a spectrum design\n  let [inputValue, setInputValue] = useControlledState(props.value, props.defaultValue ?? '', () => {});\n  let inputRef = useRef<HTMLTextAreaElement>(null);\n\n  let onHeightChange = useCallback(() => {\n    // Quiet textareas always grow based on their text content.\n    // Standard textareas also grow by default, unless an explicit height is set.\n    if ((isQuiet || !props.height) && inputRef.current) {\n      let input = inputRef.current;\n      let prevAlignment = input.style.alignSelf;\n      let prevOverflow = input.style.overflow;\n      // Firefox scroll position is lost when overflow: 'hidden' is applied so we skip applying it.\n      // The measure/applied height is also incorrect/reset if we turn on and off\n      // overflow: hidden in Firefox https://bugzilla.mozilla.org/show_bug.cgi?id=1787062\n      let isFirefox = 'MozAppearance' in input.style;\n      if (!isFirefox) {\n        input.style.overflow = 'hidden';\n      }\n      input.style.alignSelf = 'start';\n      input.style.height = 'auto';\n      // offsetHeight - clientHeight accounts for the border/padding.\n      input.style.height = `${input.scrollHeight + (input.offsetHeight - input.clientHeight)}px`;\n      input.style.overflow = prevOverflow;\n      input.style.alignSelf = prevAlignment;\n    }\n  }, [isQuiet, inputRef, props.height]);\n\n  useLayoutEffect(() => {\n    if (inputRef.current) {\n      onHeightChange();\n    }\n  }, [onHeightChange, inputValue, inputRef]);\n\n  let hasWarned = useRef(false);\n  useEffect(() => {\n    if (props.placeholder && !hasWarned.current && process.env.NODE_ENV !== 'production') {\n      console.warn('Placeholders are deprecated due to accessibility issues. Please use help text instead. See the docs for details: https://react-spectrum.adobe.com/react-spectrum/TextArea.html#help-text');\n      hasWarned.current = true;\n    }\n  }, [props.placeholder]);\n\n  let result = useTextField({\n    ...props,\n    onChange: chain(onChange, setInputValue),\n    inputElementType: 'textarea'\n  }, inputRef);\n\n  return (\n    <TextFieldBase\n      {...otherProps as any}\n      ref={ref}\n      inputRef={inputRef}\n      {...result}\n      multiLine\n      isDisabled={isDisabled}\n      isQuiet={isQuiet}\n      isReadOnly={isReadOnly}\n      isRequired={isRequired} />\n  );\n});\n"],"names":[],"version":3,"file":"TextArea.cjs.map"}