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AAG,CAAA,GAAA,qBAAa,EAAE,MAAM;QACxB,GAAG,UAAU;QACd,KAAK;QACL,UAAU,YAAY,KAAK;QAC3B,WAAW;QACX,WAAW,CAAA,GAAA,yCAAS,EAClB,CAAA,GAAA,wDAAK,GACL,wBACA,CAAC,sBAAsB,EAAE,SAAS,EAClC,WAAW,SAAS;QAEtB,MAAK;qBACL,gCAAC,CAAA,GAAA,yCAAG;QAAE,kBAAkB,CAAA,GAAA,wDAAK,CAAC,CAAC,4BAA4B;qBACzD,gCAAC,CAAA,GAAA,yCAAW;QAAE,OAAO;OAClB,sBACC,gCAAC;QAAK,kBAAkB,CAAA,GAAA,wDAAK,CAAC,CAAC,4BAA4B;QAAE,cAAY;QAE1E;AAMb","sources":["packages/@adobe/react-spectrum/src/inlinealert/InlineAlert.tsx"],"sourcesContent":["/*\n * Copyright 2023 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 {DOMProps, DOMRef, StyleProps} from '@react-types/shared';\nimport {filterDOMProps} from 'react-aria/filterDOMProps';\nimport {FocusRing} from 'react-aria/FocusRing';\nimport {Grid} from '../layout/Grid';\nimport InfoMedium from '@spectrum-icons/ui/InfoMedium';\nimport intlMessages from '../../intl/inlinealert/*.json';\nimport React, {ReactNode, useEffect, useRef} from 'react';\nimport {SlotProvider} from '../utils/Slots';\n// @ts-ignore\nimport styles from '@adobe/spectrum-css-temp/components/inlinealert/vars.css';\nimport SuccessMedium from '@spectrum-icons/ui/SuccessMedium';\nimport {useDOMRef} from '../utils/useDOMRef';\nimport {useLocalizedStringFormatter} from 'react-aria/useLocalizedStringFormatter';\nimport {useProviderProps} from '../provider/Provider';\nimport {useStyleProps} from '../utils/styleProps';\n\nexport interface SpectrumInlineAlertProps extends DOMProps, StyleProps {\n  /**\n   * The [visual style](https://spectrum.adobe.com/page/in-line-alert/#Options) of the Inline Alert.\n   *\n   * @default 'neutral'\n   */\n  variant?: 'neutral' | 'info' | 'positive' | 'notice' | 'negative';\n  /**\n   * The contents of the Inline Alert.\n   */\n  children: ReactNode;\n  /**\n   * Whether to automatically focus the Inline Alert when it first renders.\n   */\n  autoFocus?: boolean;\n}\n\nlet ICONS = {\n  info: InfoMedium,\n  positive: SuccessMedium,\n  notice: AlertMedium,\n  negative: AlertMedium\n};\n\n/**\n * Inline alerts display a non-modal message associated with objects in a view. These are often used\n * in form validation, providing a place to aggregate feedback related to multiple fields.\n */\nexport const InlineAlert = React.forwardRef(function InlineAlert(\n  props: SpectrumInlineAlertProps,\n  ref: DOMRef<HTMLDivElement>\n) {\n  props = useProviderProps(props);\n  let {children, variant = 'neutral', autoFocus, ...otherProps} = props;\n\n  let {styleProps} = useStyleProps(otherProps);\n  let domRef = useDOMRef(ref);\n\n  let slots = {\n    heading: {UNSAFE_className: styles['spectrum-InLineAlert-heading']},\n    content: {UNSAFE_className: styles['spectrum-InLineAlert-content']}\n  };\n\n  let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-spectrum/inlinealert');\n  let Icon: typeof React.Component | null = null;\n  let iconAlt: string = '';\n  if (variant in ICONS) {\n    Icon = ICONS[variant];\n    iconAlt = stringFormatter.format(variant);\n  }\n\n  let autoFocusRef = useRef(props.autoFocus);\n  useEffect(() => {\n    if (autoFocusRef.current && domRef.current) {\n      domRef.current.focus();\n    }\n    autoFocusRef.current = false;\n  }, [domRef]);\n\n  return (\n    <FocusRing focusRingClass={styles['focus-ring']}>\n      <div\n        {...filterDOMProps(props)}\n        {...styleProps}\n        ref={domRef}\n        tabIndex={autoFocus ? -1 : undefined}\n        autoFocus={autoFocus}\n        className={classNames(\n          styles,\n          'spectrum-InLineAlert',\n          `spectrum-InLineAlert--${variant}`,\n          styleProps.className\n        )}\n        role=\"alert\">\n        <Grid UNSAFE_className={styles['spectrum-InLineAlert-grid']}>\n          <SlotProvider slots={slots}>\n            {Icon && (\n              <Icon UNSAFE_className={styles['spectrum-InLineAlert-icon']} aria-label={iconAlt} />\n            )}\n            {children}\n          </SlotProvider>\n        </Grid>\n      </div>\n    </FocusRing>\n  );\n});\n"],"names":[],"version":3,"file":"InlineAlert.mjs.map"}