{"version":3,"file":"InlineNotification.mjs","sources":["../../../src/components/InlineNotification/InlineNotification.tsx"],"sourcesContent":["import clsx from 'clsx';\nimport React, { type ReactNode } from 'react';\n\nimport type { Status } from '../../util/variant-types';\n\nimport { hasSlotContent, IconSlot, useSemanticIcon } from '../Icon';\nimport Text from '../Text';\n\nimport styles from './InlineNotification.module.css';\n\ntype InlineNotificationProps = {\n  // Component API\n  /**\n   * CSS class names that can be appended to the component for styling.\n   */\n  className?: string;\n  /**\n   * CSS properties defined for the HTML element. Includes the component's CSS Custom Properties:\n   *\n   * - `--inline-notification__bg`\n   * - `--inline-notification__fg`\n   */\n  style?: InlineNotificationCSSProperties;\n  // Design API\n  /**\n   * Keyword to characterize the state of the notification\n   *\n   * **Default is `\"informational\"`**.\n   */\n  status?: Status;\n  /**\n   * Secondary text used to describe the content in more detail\n   */\n  subTitle?: ReactNode;\n  /**\n   * The title/heading of the component\n   */\n  title: string;\n};\n\nexport interface InlineNotificationCSSProperties extends React.CSSProperties {\n  /**\n   * Custom property to customize the background color of this component (e.g., background color)\n   */\n  '--inline-notification__bg'?: string;\n\n  /**\n   * Custom property to customize the foreground color of this component (e.g., text, icon, etc.)\n   */\n  '--inline-notification__fg'?: string;\n}\n\n/**\n * ## Usage\n *\n * * To provide feedback to users about their actions, such as summarizing form-level errors after server-side validation.\n * * To give significant status updates about a task.\n *\n * | Type/Use | Description | Example |\n * |----------|-------------|---------|\n * | Error | Indicates an error next to a specific form field or UI element. | Invalid form input. Required field left empty. |\n * | Warning | Non-blocking alert about a potential issue. | Weak password. Deprecated selection. |\n * | Success | Confirms a successful user action related to a specific element. | Successfully saved value. |\n * | Hint | Provides guidance or clarification without requiring an action. | Input format guidance. Optional field context. |\n * | Info | Offers neutral, supportive information near the related element. | Explain why a field is disabled. |\n * | Validation feedback | Real-time response to user input as they type or select. | Password strength meters. |\n *\n * ## Interaction\n *\n * Inline notifications appear directly above the content they relate to and disappear once the\n * state that caused the alert has been resolved.\n *\n * ## Content & Accessibility\n *\n * ### Do's\n *\n * * Keep titles short and descriptive—ideally one line—and communicate the main message in sentence case.\n * * In the body, explain how to resolve the issue in 1-2 sentences (no more than 2 lines) and include links to more info when necessary.\n * * Place the notification close to the relevant screen elements so it is understood in context.\n *\n * ### Don'ts\n *\n * * Punctuate the end of the title.\n * * Repeat or summarize the title in the body.\n * * Use without an icon indicating the notification type and severity.\n */\nexport const InlineNotification = ({\n  className,\n  status = 'informational',\n  subTitle,\n  title,\n  ...other\n}: InlineNotificationProps) => {\n  const componentClassName = clsx(\n    styles['inline-notification'],\n    status && styles[`inline-notification--status-${status}`],\n    className,\n  );\n\n  // The status icon is semantic: it is the notification's whole signal of severity, so\n  // the app sets it once through `IconProvider` rather than per notification.\n  const statusIcon = useSemanticIcon(status);\n\n  return (\n    <div className={componentClassName} {...other}>\n      {hasSlotContent(statusIcon) && (\n        <IconSlot\n          className={styles['inline-notification__icon']}\n          content={statusIcon}\n          purpose=\"decorative\"\n          size=\"16px\"\n        />\n      )}\n      <div className={styles['inline-notification__body']}>\n        <Text as=\"div\" preset=\"title-sm\">\n          {title}\n        </Text>\n        {subTitle && (\n          <Text as=\"div\" preset=\"body-xs\">\n            {subTitle}\n          </Text>\n        )}\n      </div>\n    </div>\n  );\n};\n\nInlineNotification.displayName = 'InlineNotification';\n"],"names":["React"],"mappings":";;;;;;;;AAoDA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiCG;MACU,kBAAkB,GAAG,CAAC,EACjC,SAAS,EACT,MAAM,GAAG,eAAe,EACxB,QAAQ,EACR,KAAK,EACL,GAAG,KAAK,EACgB,KAAI;IAC5B,MAAM,kBAAkB,GAAG,IAAI,CAC7B,MAAM,CAAC,qBAAqB,CAAC,EAC7B,MAAM,IAAI,MAAM,CAAC,+BAA+B,MAAM,CAAA,CAAE,CAAC,EACzD,SAAS,CACV;;;AAID,IAAA,MAAM,UAAU,GAAG,eAAe,CAAC,MAAM,CAAC;AAE1C,IAAA,QACEA,cAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAE,kBAAkB,KAAM,KAAK,EAAA;QAC1C,cAAc,CAAC,UAAU,CAAC,KACzBA,cAAA,CAAA,aAAA,CAAC,QAAQ,EAAA,EACP,SAAS,EAAE,MAAM,CAAC,2BAA2B,CAAC,EAC9C,OAAO,EAAE,UAAU,EACnB,OAAO,EAAC,YAAY,EACpB,IAAI,EAAC,MAAM,EAAA,CACX,CACH;AACD,QAAAA,cAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAE,MAAM,CAAC,2BAA2B,CAAC,EAAA;YACjDA,cAAA,CAAA,aAAA,CAAC,IAAI,EAAA,EAAC,EAAE,EAAC,KAAK,EAAC,MAAM,EAAC,UAAU,EAAA,EAC7B,KAAK,CACD;AACN,YAAA,QAAQ,KACPA,cAAA,CAAA,aAAA,CAAC,IAAI,EAAA,EAAC,EAAE,EAAC,KAAK,EAAC,MAAM,EAAC,SAAS,IAC5B,QAAQ,CACJ,CACR,CACG,CACF;AAEV;AAEA,kBAAkB,CAAC,WAAW,GAAG,oBAAoB;;"}