{"version":3,"file":"Callout.cjs","names":["_styled","_interopRequireDefault","require","_react","_i18n","_Link","_OdysseyDesignTokensContext","_Typography","_jsxRuntime","e","__esModule","default","calloutRoleValues","exports","calloutSeverityValues","ContentContainer","styled","shouldForwardProp","prop","odysseyDesignTokens","marginBlockStart","Spacing4","Callout","children","linkRel","linkTarget","linkText","linkUrl","onLinkClick","role","severity","testId","text","title","translate","t","useTranslation","useOdysseyDesignTokens","jsxs","_Alert2","variant","jsx","_AlertTitle2","_Box2","component","Paragraph","Link","href","onClick","rel","target","MemoizedCallout","memo","displayName"],"sources":["../../src/Callout.tsx"],"sourcesContent":["/*!\n * Copyright (c) 2022-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport styled from \"@emotion/styled\";\nimport { Alert, AlertTitle, Box } from \"@mui/material\";\nimport { memo, ReactNode } from \"react\";\n\nimport type { HtmlProps } from \"./HtmlProps.js\";\n\nimport { useTranslation } from \"./i18n.generated/i18n.js\";\nimport { Link, LinkProps } from \"./Link.js\";\nimport {\n  DesignTokens,\n  useOdysseyDesignTokens,\n} from \"./OdysseyDesignTokensContext.js\";\nimport { Paragraph } from \"./Typography.js\";\n\nexport const calloutRoleValues = [\"status\", \"alert\"] as const;\nexport const calloutSeverityValues = [\n  \"success\",\n  \"info\",\n  \"warning\",\n  \"error\",\n] as const;\n\nexport type CalloutProps = {\n  /**\n   * Supplementary content rendered inside the callout body, typically a list or structured markup.\n   */\n  children?: ReactNode;\n  /**\n   * Sets the ARIA live-region role.\n   * - If `'status'`, announces updates politely; use for non-critical dynamic messages.\n   * - If `'alert'`, announces updates assertively; use for errors or urgent information.\n   */\n  role?: (typeof calloutRoleValues)[number];\n  /**\n   * Visual severity level that controls the callout's color and icon.\n   */\n  severity: (typeof calloutSeverityValues)[number];\n  /**\n   * Primary message text displayed inside the callout body.\n   */\n  text?: string;\n  /**\n   * Heading text displayed at the top of the callout, above the body content.\n   */\n  title?: string;\n} & (\n  | {\n      children?: never;\n      text: string;\n    }\n  | {\n      children: ReactNode;\n      text?: never;\n    }\n) &\n  // if linkText is provided, either linkUrl or onLinkClick must be provided\n  (\n    | {\n        /** The `rel` attribute forwarded to the action link. */\n        linkRel?: LinkProps[\"rel\"];\n        /** The `target` attribute forwarded to the action link. */\n        linkTarget?: LinkProps[\"target\"];\n        /** Visible label for the action link rendered below the Callout content. */\n        linkText: string;\n        /** URL the action link navigates to. Required when `onLinkClick` is not provided. */\n        linkUrl: LinkProps[\"href\"];\n        onLinkClick?: never;\n      }\n    | {\n        linkRel?: never;\n        linkTarget?: never;\n        /** Visible label for the action link rendered below the Callout content. */\n        linkText: string;\n        linkUrl?: never;\n        /** Click handler for the action link. Required when `linkUrl` is not provided. */\n        onLinkClick: LinkProps[\"onClick\"];\n      }\n    | {\n        linkRel?: never;\n        linkTarget?: never;\n        linkText?: never;\n        linkUrl?: never;\n        onLinkClick?: never;\n      }\n  ) &\n  Pick<HtmlProps, \"testId\" | \"translate\">;\n\nconst ContentContainer = styled(\"div\", {\n  shouldForwardProp: (prop) => prop !== \"odysseyDesignTokens\",\n})<{ odysseyDesignTokens: DesignTokens }>(({ odysseyDesignTokens }) => ({\n  \"& > * + *\": {\n    marginBlockStart: odysseyDesignTokens.Spacing4,\n  },\n}));\n\n/**\n * A non-dismissible inline message that draws attention to important contextual information. Use Callout to surface status, warnings, errors, or supplementary guidance within a page or form.\n */\nconst Callout = ({\n  children,\n  linkRel,\n  linkTarget,\n  linkText,\n  linkUrl,\n  onLinkClick,\n  role,\n  severity,\n  testId,\n  text,\n  title,\n  translate,\n}: CalloutProps) => {\n  const { t } = useTranslation();\n  const odysseyDesignTokens = useOdysseyDesignTokens();\n\n  return (\n    <Alert\n      aria-label={t(`severity.${severity}`)}\n      data-se={testId}\n      role={role}\n      severity={severity}\n      variant=\"callout\"\n    >\n      {title && <AlertTitle translate={translate}>{title}</AlertTitle>}\n\n      <ContentContainer odysseyDesignTokens={odysseyDesignTokens}>\n        {children && <Box component=\"div\">{children}</Box>}\n        {text && <Paragraph>{text}</Paragraph>}\n        {linkText && (\n          <Box>\n            <Link\n              href={linkUrl ?? \"#\"}\n              onClick={onLinkClick}\n              rel={linkRel}\n              target={linkTarget}\n              variant=\"monochrome\"\n            >\n              {linkText}\n            </Link>\n          </Box>\n        )}\n      </ContentContainer>\n    </Alert>\n  );\n};\n\nconst MemoizedCallout = memo(Callout);\nMemoizedCallout.displayName = \"Callout\";\n\nexport { MemoizedCallout as Callout };\n"],"mappings":";;;;;;;;;AAYA,IAAAA,OAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,MAAA,GAAAD,OAAA;AAIA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,2BAAA,GAAAJ,OAAA;AAIA,IAAAK,WAAA,GAAAL,OAAA;AAA4C,IAAAM,WAAA,GAAAN,OAAA;AAAA,SAAAD,uBAAAQ,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAxB5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAgBO,MAAMG,iBAAiB,GAAAC,OAAA,CAAAD,iBAAA,GAAG,CAAC,QAAQ,EAAE,OAAO,CAAU;AACtD,MAAME,qBAAqB,GAAAD,OAAA,CAAAC,qBAAA,GAAG,CACnC,SAAS,EACT,MAAM,EACN,SAAS,EACT,OAAO,CACC;AAmEV,MAAMC,gBAAgB,GAAG,IAAAC,eAAM,EAAC,KAAK,EAAE;EACrCC,iBAAiB,EAAGC,I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