{"version":3,"sources":["../src/alert.tsx"],"sourcesContent":["import { cx } from \"@chakra-ui/shared-utils\"\nimport {\n  chakra,\n  forwardRef,\n  HTMLChakraProps,\n  omitThemingProps,\n  SystemStyleObject,\n  ThemingProps,\n  useMultiStyleConfig,\n} from \"@chakra-ui/system\"\nimport {\n  AlertProvider,\n  AlertStatus,\n  AlertStylesProvider,\n  getStatusColorScheme,\n} from \"./alert-context\"\n\ninterface AlertOptions {\n  /**\n   * The status of the alert\n   * @default \"info\"\n   */\n  status?: AlertStatus\n}\n\nexport interface AlertProps\n  extends HTMLChakraProps<\"div\">,\n    AlertOptions,\n    ThemingProps<\"Alert\"> {\n  /**\n   * @default false\n   */\n  addRole?: boolean\n}\n\n/**\n * Alert is used to communicate the state or status of a\n * page, feature or action\n *\n * @see Docs https://chakra-ui.com/docs/components/alert\n * @see WAI-ARIA https://www.w3.org/WAI/ARIA/apg/patterns/alert/\n */\nexport const Alert = forwardRef<AlertProps, \"div\">(function Alert(props, ref) {\n  const { status = \"info\", addRole = true, ...rest } = omitThemingProps(props)\n  const colorScheme = props.colorScheme ?? getStatusColorScheme(status)\n\n  const styles = useMultiStyleConfig(\"Alert\", { ...props, colorScheme })\n\n  const alertStyles: SystemStyleObject = {\n    width: \"100%\",\n    display: \"flex\",\n    alignItems: \"center\",\n    position: \"relative\",\n    overflow: \"hidden\",\n    ...styles.container,\n  }\n\n  return (\n    <AlertProvider value={{ status }}>\n      <AlertStylesProvider value={styles}>\n        <chakra.div\n          data-status={status}\n          role={addRole ? \"alert\" : undefined}\n          ref={ref}\n          {...rest}\n          className={cx(\"chakra-alert\", props.className)}\n          __css={alertStyles}\n        />\n      </AlertStylesProvider>\n    </AlertProvider>\n  )\n})\n\nAlert.displayName = \"Alert\"\n"],"mappings":";;;;;;;;AAAA,SAAS,UAAU;AACnB;AAAA,EACE;AAAA,EACA;AAAA,EAEA;AAAA,EAGA;AAAA,OACK;AAmDC;AAlBD,IAAM,QAAQ,WAA8B,SAASA,OAAM,OAAO,KAAK;AA1C9E;AA2CE,QAAM,EAAE,SAAS,QAAQ,UAAU,MAAM,GAAG,KAAK,IAAI,iBAAiB,KAAK;AAC3E,QAAM,eAAc,WAAM,gBAAN,YAAqB,qBAAqB,MAAM;AAEpE,QAAM,SAAS,oBAAoB,SAAS,EAAE,GAAG,OAAO,YAAY,CAAC;AAErE,QAAM,cAAiC;AAAA,IACrC,OAAO;AAAA,IACP,SAAS;AAAA,IACT,YAAY;AAAA,IACZ,UAAU;AAAA,IACV,UAAU;AAAA,IACV,GAAG,OAAO;AAAA,EACZ;AAEA,SACE,oBAAC,iBAAc,OAAO,EAAE,OAAO,GAC7B,8BAAC,uBAAoB,OAAO,QAC1B;AAAA,IAAC,OAAO;AAAA,IAAP;AAAA,MACC,eAAa;AAAA,MACb,MAAM,UAAU,UAAU;AAAA,MAC1B;AAAA,MACC,GAAG;AAAA,MACJ,WAAW,GAAG,gBAAgB,MAAM,SAAS;AAAA,MAC7C,OAAO;AAAA;AAAA,EACT,GACF,GACF;AAEJ,CAAC;AAED,MAAM,cAAc;","names":["Alert"]}