{"mappings":";;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;AAsBM,MAAM,0DAAW,CAAA,GAAA,sCAAI,EAAE,UAAU,CAAC,SAAS,SAAS,KAAoB,EAAE,GAA2B;IAC1G,IAAI,eACF,WAAW,gBACX,YAAY,mBACZ,eAAe,aACf,SAAS,cACT,UAAU,iBACV,aAAa,oBACb,gBAAgB,qBAChB,iBAAiB,EAClB,GAAG;IACJ,IAAI,SAAS,CAAA,GAAA,mCAAQ,EAAE;IACvB,IAAI,iBAAiB,gBAAiB,CAAA,aAAa,oBAAoB,SAAQ;IAC/E,IAAI,cAAC,UAAU,EAAC,GAAG,CAAA,GAAA,uCAAY,EAAE;IAEjC,qBACE,0DAAC;QACE,GAAG,UAAU;QACd,WAAW,CAAA,GAAA,oCAAS,EAClB,CAAA,GAAA,mDAAK,GACL,qBACA,CAAC,mBAAmB,EAAE,iBAAiB,aAAa,WAAW,EAC/D;YAAC,eAAe;QAAU,GAC1B,WAAW,SAAS;QAEtB,KAAK;OACJ,+BACC,sHACG,+BAAiB,0DAAC,CAAA,GAAA,2DAAU;QAAE,kBAAkB,CAAA,GAAA,oCAAS,EAAE,CAAA,GAAA,mDAAK,GAAG;sBACpE,0DAAC;QAAK,GAAG,iBAAiB;QAAE,WAAW,CAAA,GAAA,oCAAS,EAAE,CAAA,GAAA,mDAAK,GAAG;OACvD,+BAIL,0DAAC;QAAK,GAAG,gBAAgB;QAAE,WAAW,CAAA,GAAA,oCAAS,EAAE,CAAA,GAAA,mDAAK,GAAG;OACtD;AAKX","sources":["packages/@adobe/react-spectrum/src/label/HelpText.tsx"],"sourcesContent":["/*\n * Copyright 2021 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 AlertMedium from '@spectrum-icons/ui/AlertMedium';\nimport {classNames} from '../utils/classNames';\nimport {DOMRef, SpectrumFieldValidation, SpectrumHelpTextProps, StyleProps, Validation} from '@react-types/shared';\nimport React, {HTMLAttributes, ReactNode} from 'react';\nimport styles from '@adobe/spectrum-css-temp/components/helptext/vars.css';\nimport {useDOMRef} from '../utils/useDOMRef';\nimport {useStyleProps} from '../utils/styleProps';\n\ninterface HelpTextProps extends Omit<SpectrumHelpTextProps, 'errorMessage'>, Omit<Validation<any>, 'validationState'>, SpectrumFieldValidation<any>, StyleProps {\n  /** Props for the help text description element. */\n  descriptionProps?: HTMLAttributes<HTMLElement>,\n  /** Props for the help text error message element. */\n  errorMessageProps?: HTMLAttributes<HTMLElement>,\n  /** An error message for the field. */\n  errorMessage?: ReactNode\n}\n\n/**\n * Help text provides either an informative description or an error message that gives more context about what a user needs to input. It's commonly used in forms.\n */\nexport const HelpText = React.forwardRef(function HelpText(props: HelpTextProps, ref: DOMRef<HTMLDivElement>) {\n  let {\n    description,\n    errorMessage,\n    validationState,\n    isInvalid,\n    isDisabled,\n    showErrorIcon,\n    descriptionProps,\n    errorMessageProps\n  } = props;\n  let domRef = useDOMRef(ref);\n  let isErrorMessage = errorMessage && (isInvalid || validationState === 'invalid');\n  let {styleProps} = useStyleProps(props);\n\n  return (\n    <div\n      {...styleProps}\n      className={classNames(\n        styles,\n        'spectrum-HelpText',\n        `spectrum-HelpText--${isErrorMessage ? 'negative' : 'neutral'}`,\n        {'is-disabled': isDisabled},\n        styleProps.className\n      )}\n      ref={domRef}>\n      {isErrorMessage ? (\n        <>\n          {showErrorIcon && <AlertMedium UNSAFE_className={classNames(styles, 'spectrum-HelpText-validationIcon')} />}\n          <div {...errorMessageProps} className={classNames(styles, 'spectrum-HelpText-text')}>\n            {errorMessage}\n          </div>\n        </>\n      ) : (\n        <div {...descriptionProps} className={classNames(styles, 'spectrum-HelpText-text')}>\n          {description}\n        </div>\n      )}\n    </div>\n  );\n});\n"],"names":[],"version":3,"file":"HelpText.cjs.map"}