@transferwise/components 46.128.3 → 46.130.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (121) hide show
  1. package/build/alert/Alert.js +1 -1
  2. package/build/alert/Alert.mjs +1 -1
  3. package/build/card/Card.js.map +1 -1
  4. package/build/card/Card.mjs.map +1 -1
  5. package/build/common/{card/Card.js → baseCard/BaseCard.js} +4 -4
  6. package/build/common/baseCard/BaseCard.js.map +1 -0
  7. package/build/common/{card/Card.mjs → baseCard/BaseCard.mjs} +4 -4
  8. package/build/common/baseCard/BaseCard.mjs.map +1 -0
  9. package/build/common/liveRegion/LiveRegion.js +42 -0
  10. package/build/common/liveRegion/LiveRegion.js.map +1 -0
  11. package/build/common/liveRegion/LiveRegion.mjs +40 -0
  12. package/build/common/liveRegion/LiveRegion.mjs.map +1 -0
  13. package/build/criticalBanner/CriticalCommsBanner.js +68 -3
  14. package/build/criticalBanner/CriticalCommsBanner.js.map +1 -1
  15. package/build/criticalBanner/CriticalCommsBanner.mjs +69 -4
  16. package/build/criticalBanner/CriticalCommsBanner.mjs.map +1 -1
  17. package/build/flowNavigation/FlowNavigation.js +1 -1
  18. package/build/flowNavigation/FlowNavigation.mjs +1 -1
  19. package/build/index.js +4 -4
  20. package/build/index.mjs +1 -1
  21. package/build/inputs/SelectInput.js +1 -1
  22. package/build/inputs/SelectInput.js.map +1 -1
  23. package/build/inputs/SelectInput.mjs +1 -1
  24. package/build/inputs/SelectInput.mjs.map +1 -1
  25. package/build/inputs/_ButtonInput.js +2 -2
  26. package/build/inputs/_ButtonInput.js.map +1 -1
  27. package/build/inputs/_ButtonInput.mjs +2 -2
  28. package/build/inputs/_ButtonInput.mjs.map +1 -1
  29. package/build/main.css +191 -165
  30. package/build/overlayHeader/OverlayHeader.js +1 -1
  31. package/build/overlayHeader/OverlayHeader.mjs +1 -1
  32. package/build/promoCard/PromoCard.js +2 -2
  33. package/build/promoCard/PromoCard.js.map +1 -1
  34. package/build/promoCard/PromoCard.mjs +2 -2
  35. package/build/promoCard/PromoCard.mjs.map +1 -1
  36. package/build/prompt/InfoPrompt/InfoPrompt.js +35 -29
  37. package/build/prompt/InfoPrompt/InfoPrompt.js.map +1 -1
  38. package/build/prompt/InfoPrompt/InfoPrompt.mjs +35 -29
  39. package/build/prompt/InfoPrompt/InfoPrompt.mjs.map +1 -1
  40. package/build/sentimentSurface/SentimentSurface.js +5 -1
  41. package/build/sentimentSurface/SentimentSurface.js.map +1 -1
  42. package/build/sentimentSurface/SentimentSurface.mjs +5 -1
  43. package/build/sentimentSurface/SentimentSurface.mjs.map +1 -1
  44. package/build/styles/criticalBanner/CriticalCommsBanner.css +33 -15
  45. package/build/styles/inputs/SelectInput.css +8 -0
  46. package/build/styles/listItem/ListItem.css +1 -1
  47. package/build/styles/main.css +191 -165
  48. package/build/styles/sentimentSurface/SentimentSurface.css +100 -100
  49. package/build/types/card/Card.d.ts +1 -1
  50. package/build/types/common/{card/Card.d.ts → baseCard/BaseCard.d.ts} +8 -8
  51. package/build/types/common/baseCard/BaseCard.d.ts.map +1 -0
  52. package/build/types/common/baseCard/index.d.ts +3 -0
  53. package/build/types/common/baseCard/index.d.ts.map +1 -0
  54. package/build/types/common/index.d.ts +2 -0
  55. package/build/types/common/index.d.ts.map +1 -1
  56. package/build/types/common/liveRegion/LiveRegion.d.ts +23 -0
  57. package/build/types/common/liveRegion/LiveRegion.d.ts.map +1 -0
  58. package/build/types/common/liveRegion/index.d.ts +3 -0
  59. package/build/types/common/liveRegion/index.d.ts.map +1 -0
  60. package/build/types/criticalBanner/CriticalCommsBanner.d.ts +4 -1
  61. package/build/types/criticalBanner/CriticalCommsBanner.d.ts.map +1 -1
  62. package/build/types/criticalBanner/index.d.ts +1 -0
  63. package/build/types/criticalBanner/index.d.ts.map +1 -1
  64. package/build/types/index.d.ts +2 -1
  65. package/build/types/index.d.ts.map +1 -1
  66. package/build/types/inputs/SelectInput.d.ts.map +1 -1
  67. package/build/types/promoCard/PromoCard.d.ts +3 -3
  68. package/build/types/promoCard/PromoCard.d.ts.map +1 -1
  69. package/build/types/prompt/InfoPrompt/InfoPrompt.d.ts +11 -2
  70. package/build/types/prompt/InfoPrompt/InfoPrompt.d.ts.map +1 -1
  71. package/build/types/sentimentSurface/SentimentSurface.d.ts.map +1 -1
  72. package/package.json +2 -2
  73. package/src/card/Card.story.tsx +3 -2
  74. package/src/card/Card.tsx +1 -1
  75. package/src/common/{card/Card.less → baseCard/BaseCard.less} +1 -1
  76. package/src/common/{card/Card.story.tsx → baseCard/BaseCard.story.tsx} +5 -5
  77. package/src/common/{card/Card.test.tsx → baseCard/BaseCard.test.tsx} +11 -12
  78. package/src/common/{card/Card.tsx → baseCard/BaseCard.tsx} +9 -9
  79. package/src/common/baseCard/index.ts +2 -0
  80. package/src/common/index.ts +2 -0
  81. package/src/common/liveRegion/LiveRegion.test.tsx +56 -0
  82. package/src/common/liveRegion/LiveRegion.tsx +49 -0
  83. package/src/common/liveRegion/index.ts +2 -0
  84. package/src/criticalBanner/CriticalCommsBanner.css +33 -15
  85. package/src/criticalBanner/CriticalCommsBanner.less +46 -36
  86. package/src/criticalBanner/CriticalCommsBanner.story.tsx +9 -15
  87. package/src/criticalBanner/CriticalCommsBanner.test.story.tsx +70 -0
  88. package/src/criticalBanner/CriticalCommsBanner.test.tsx +66 -0
  89. package/src/criticalBanner/CriticalCommsBanner.tsx +54 -5
  90. package/src/criticalBanner/index.ts +1 -0
  91. package/src/index.ts +2 -1
  92. package/src/inputs/SelectInput.css +8 -0
  93. package/src/inputs/SelectInput.story.tsx +2 -2
  94. package/src/inputs/SelectInput.test.story.tsx +57 -1
  95. package/src/inputs/SelectInput.test.tsx +33 -1
  96. package/src/inputs/SelectInput.tsx +2 -1
  97. package/src/inputs/_ButtonInput.less +8 -0
  98. package/src/inputs/_ButtonInput.tsx +1 -1
  99. package/src/listItem/ListItem.css +1 -1
  100. package/src/listItem/ListItem.less +4 -2
  101. package/src/listItem/_stories/Breakpoints/ListItem.noMedia.test.story.tsx +62 -0
  102. package/src/listItem/_stories/Breakpoints/ListItem.sideMedia.test.story.tsx +62 -0
  103. package/src/listItem/_stories/Breakpoints/ListItem.stackedMedia.test.story.tsx +62 -0
  104. package/src/listItem/_stories/ListItem.story.tsx +3 -2
  105. package/src/main.css +191 -165
  106. package/src/main.less +2 -2
  107. package/src/promoCard/PromoCard.tsx +6 -5
  108. package/src/prompt/InfoPrompt/InfoPrompt.test.story.tsx +119 -0
  109. package/src/prompt/InfoPrompt/InfoPrompt.tsx +47 -34
  110. package/src/sentimentSurface/SentimentSurface.css +100 -100
  111. package/src/sentimentSurface/SentimentSurface.less +50 -50
  112. package/src/sentimentSurface/SentimentSurface.test.story.tsx +19 -0
  113. package/src/sentimentSurface/SentimentSurface.tsx +3 -0
  114. package/build/common/card/Card.js.map +0 -1
  115. package/build/common/card/Card.mjs.map +0 -1
  116. package/build/types/common/card/Card.d.ts.map +0 -1
  117. package/build/types/common/card/index.d.ts +0 -3
  118. package/build/types/common/card/index.d.ts.map +0 -1
  119. package/src/common/card/index.ts +0 -2
  120. /package/build/styles/common/{card/Card.css → baseCard/BaseCard.css} +0 -0
  121. /package/src/common/{card/Card.css → baseCard/BaseCard.css} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"PromoCard.js","sources":["../../src/promoCard/PromoCard.tsx"],"sourcesContent":["import { Check } from '@transferwise/icons';\nimport { clsx } from 'clsx';\nimport React, { forwardRef, FunctionComponent, useEffect, useId, useState } from 'react';\n\nimport Body from '../body';\nimport { Typography } from '../common';\nimport Card, { type CardProps } from '../common/card';\nimport Display from '../display';\nimport Image from '../image/Image';\nimport Title from '../title';\n\nimport { usePromoCardContext } from './PromoCardContext';\nimport PromoCardIndicator, { type PromoCardIndicatorProps } from './PromoCardIndicator';\n\nexport type ReferenceType = React.Ref<HTMLInputElement> | React.Ref<HTMLDivElement>;\nexport type RelatedTypes =\n | ''\n | 'alternate'\n | 'author'\n | 'bookmark'\n | 'external'\n | 'help'\n | 'license'\n | 'next'\n | 'nofollow'\n | 'noreferrer'\n | 'noopener'\n | 'prev'\n | 'search'\n | 'tag';\n\nexport interface PromoCardCommonProps {\n /** Optional prop to specify classNames onto the PromoCard */\n className?: string;\n\n /** Optional prop to specify the ID of the PromoCard */\n id?: string;\n\n /** Required prop to specify the descriptive text of the PromoCard */\n description: string;\n\n /**\n * Optional prop to specify the heading level of the PromoCard\n *\n * @default 'h3'\n */\n headingLevel?: 'h3' | 'h4' | 'h5' | 'h6';\n\n /** Optional prop to specify text for the indicator label of the PromoCard */\n indicatorLabel?: string;\n\n /** Optional prop to specify the icon for the indicator icon of the PromoCard */\n indicatorIcon?: PromoCardIndicatorProps['icon'];\n\n /** Optional prop to specify an image alt text */\n imageAlt?: string;\n\n /** Optional prop to specify an image class */\n imageClass?: string;\n\n /** Optional prop to specify an image source url */\n imageSource?: string;\n\n /** Specify whether the PromoCard is disabled, or not */\n isDisabled?: boolean;\n\n /** Specify an onClick event handler */\n onClick?: () => void;\n\n /** Specify an onKeyDown event handler */\n onKeyDown?: (event: React.KeyboardEvent<HTMLInputElement>) => void;\n\n /** Optional prop to specify the ID used for testing */\n testId?: string;\n\n /** Required prop to specify the title text of the PromoCard */\n title: string;\n\n /** Set to false to use body font style for the title */\n useDisplayFont?: boolean;\n\n ref?: ReferenceType;\n}\n\nexport interface PromoCardLinkProps extends PromoCardCommonProps, Omit<CardProps, 'children'> {\n /**\n * Optional prop to prompts a user to save the linked URL instead of\n * navigating to it\n */\n download?: string;\n\n /** Optionally specify an href for your PromoCard to contain an <a> element */\n href?: string;\n\n /** Optionally specify the language of the linked URL */\n hrefLang?: string;\n\n /** Optional property that can be pass a ref for the anchor. */\n anchorRef?: React.Ref<HTMLAnchorElement>;\n\n /**\n * Optional prop to specify the ID of the anchor element which can be useful when using a ref.\n */\n anchorId?: string;\n\n /**\n * Relationship between the PromoCard href URL and the current page. See\n * [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel).\n */\n rel?: RelatedTypes;\n\n /** Optional prop to to display where the linked URL will show */\n target?: React.HTMLAttributeAnchorTarget;\n\n /** Only applies to role=\"radio\" or \"checkbox\" */\n defaultChecked?: never;\n isChecked?: never;\n tabIndex?: never;\n type?: never;\n ref?: ReferenceType;\n value?: never;\n}\n\nexport interface PromoCardCheckedProps extends PromoCardCommonProps, Omit<CardProps, 'children'> {\n /** Specify the initial checked attribute of the PromoCard */\n defaultChecked?: boolean;\n\n /** Specify whether the PromoCard is checked, or not */\n isChecked?: boolean;\n\n /** Optional prop to specify the tabIndex of the PromoCard */\n tabIndex?: number;\n\n /** Optional property to provide component Ref */\n ref?: ReferenceType;\n\n /** Optional prop to specify the input type of the PromoCard */\n type?: 'checkbox' | 'radio';\n\n /** Specify the value attribute of the PromoCard if Checkbox or Radio */\n value?: string;\n\n /** Only applies to <a />s */\n download?: never;\n href?: never;\n anchorRef?: never;\n anchorId?: never;\n hrefLang?: never;\n rel?: never;\n target?: never;\n}\n\nexport type PromoCardProps = PromoCardLinkProps | PromoCardCheckedProps;\n\nexport type PolymorphicPromoCard = (\n props: PromoCardLinkProps | PromoCardCheckedProps,\n) => React.JSX.Element;\n\n/**\n * PromoCard component.\n *\n * PromoCard is a marketing style component that is used to group marketing\n * product related information (such as choosing Card types). It can be used to\n * display information in a structured way, and can be customized with various\n * props to suit different use cases.\n *\n * @component\n * @param {string} className - Additional class name for the PromoCard.\n * @param {string} description - Description text for the PromoCard.\n * @param {boolean} defaultChecked - Initial checked state for checkboxes and radios.\n * @param {string} download - Download file name for links.\n * @param {string} href - URL for links.\n * @param {string} hrefLang - Language code for linked URL.\n * @param {string} id - ID of the PromoCard.\n * @param {string} imageAlt - Alt text for the image.\n * @param {string} imageSource - Source URL of the image.\n * @param {string} indicatorLabel - Label for the indicator icon.\n * @param {boolean} isChecked - Checked state for checkboxes and radios.\n * @param {boolean} isDisabled - Whether the PromoCard is disabled.\n * @param {Function} onClick - Click event handler for the PromoCard.\n * @param {string} rel - Relationship between the URL and the current page.\n * @param {number} tabIndex - Tab index for keyboard navigation.\n * @param {string} target - Target window for links.\n * @param {string} testId - ID used for testing.\n * @param {string} title - Title text of the PromoCard.\n * @param {('checkbox'|'radio')} type - Type of the PromoCard (checkbox, radio).\n * @param {string} value - Value for checkboxes and radios.\n * @returns {React.JSX.Element} The rendered PromoCard component.\n * @example\n * <PromoCard\n * title=\"Example PromoCard\"\n * description=\"This is an example PromoCard with a link variation.\"\n * href=\"https://example.com\"\n * target=\"_blank\"\n * imageSource=\"https://example.com/image.png\"\n * imageAlt=\"Example Image\"\n * indicatorLabel=\"Learn More\"\n * />\n */\nconst PromoCard: FunctionComponent<PromoCardProps> = forwardRef(\n (\n {\n className,\n description,\n defaultChecked,\n download,\n href,\n hrefLang,\n id,\n headingLevel = 'h3',\n imageAlt,\n imageClass,\n imageSource,\n indicatorLabel,\n indicatorIcon,\n isChecked,\n isDisabled,\n onClick,\n onKeyDown,\n rel,\n tabIndex,\n target,\n testId,\n title,\n type,\n value,\n isSmall,\n useDisplayFont = true,\n anchorRef,\n anchorId,\n ...props\n },\n ref: ReferenceType,\n ) => {\n // Set the `checked` state to the value of `defaultChecked` if it is truthy,\n // or the value of `isChecked` if it is truthy, or `false` if neither\n // is truthy.\n const { state, onChange, isDisabled: contextIsDisabled } = usePromoCardContext();\n const [checked, setChecked] = useState(\n type === 'checkbox' ? (defaultChecked ?? isChecked ?? false) : false,\n );\n\n const handleClick = () => {\n if (type === 'radio') {\n onChange(value || ''); // Update the context state for radio\n } else if (type === 'checkbox') {\n setChecked(!checked); // Update local state for checkbox\n }\n };\n\n const fallbackId = useId();\n const componentId = id || fallbackId;\n\n // Set the icon to `'arrow'` if `href` is truthy and `type` is falsy, or\n // `'download'` if `download` is truthy. If neither condition is true, set\n // `icon` to `undefined`.\n\n // Create a function to get icon type\n const getIconType = () => {\n if (indicatorIcon) {\n return indicatorIcon;\n }\n\n if (download) {\n return 'download';\n }\n\n if (href && !type) {\n return 'arrow';\n }\n\n return undefined;\n };\n\n const CardTitle = useDisplayFont ? Display : Title;\n\n // Define all class names string based on the values of the `href`, `type`,\n // `checked`, and `className` props.\n const commonClasses = clsx(\n {\n 'np-Card--promoCard': true,\n 'np-Card--checked': !href && type,\n 'np-Card--link': href && !type,\n 'is-checked':\n type === 'radio' ? value === state : type === 'checkbox' ? checked : undefined,\n },\n className,\n );\n\n // Object with common props that will be passed to the `Card` components\n const commonProps = {\n className: commonClasses,\n id: componentId,\n isDisabled: isDisabled || contextIsDisabled,\n onClick,\n onKeyDown,\n ref,\n 'data-testid': testId,\n isSmall,\n };\n\n // Object with Anchor props that will be passed to the `a` element. These\n // won't be refurned if set to `isDisabled`\n const anchorProps =\n href && !isDisabled\n ? {\n download,\n href: href || undefined,\n hrefLang,\n rel,\n target,\n ref: anchorRef,\n id: anchorId,\n }\n : {};\n\n // Object of all Checked props that will be passed to the root `Card` component\n const checkedProps =\n (type === 'checkbox' || type === 'radio') && !href\n ? {\n ...commonProps,\n 'aria-checked':\n type === 'radio' ? value === state : type === 'checkbox' ? checked : undefined,\n 'aria-describedby': `${componentId}-title`,\n 'aria-disabled': isDisabled,\n 'data-value': value ?? undefined,\n role: type === 'checkbox' || type === 'radio' ? type : undefined,\n onClick: handleClick,\n onKeyDown: (event: React.KeyboardEvent<HTMLInputElement>) => {\n if (event.key === 'Enter' || event.key === ' ') {\n handleClick();\n }\n },\n ref,\n tabIndex: 0,\n }\n : {};\n\n const getTitle = () => {\n const titleContent =\n href && !type ? (\n <a className=\"np-Card-titleLink\" {...anchorProps}>\n {title}\n </a>\n ) : (\n title\n );\n\n const titleProps = {\n id: `${componentId}-title`,\n as: headingLevel,\n className: 'np-Card-title',\n };\n\n return useDisplayFont ? (\n <Display type={Typography.DISPLAY_SMALL} {...titleProps}>\n {titleContent}\n </Display>\n ) : (\n <Title type={Typography.TITLE_SUBSECTION} {...titleProps}>\n {titleContent}\n </Title>\n );\n };\n\n useEffect(() => {\n setChecked(defaultChecked ?? isChecked ?? false);\n }, [defaultChecked, isChecked]);\n\n return (\n <Card {...commonProps} {...checkedProps} {...props}>\n {(value === state || checked) && (\n <span className=\"np-Card-check\">\n <Check size={24} aria-hidden=\"true\" />\n </span>\n )}\n\n {getTitle()}\n\n <Body className=\"np-Card-description\">{description}</Body>\n\n {imageSource && (\n <div className={clsx('np-Card-image', { imageClass })}>\n <Image src={imageSource} alt={imageAlt || ''} loading=\"lazy\" />\n </div>\n )}\n\n <PromoCardIndicator label={indicatorLabel} icon={getIconType()} isSmall={isSmall} />\n </Card>\n );\n },\n) as PolymorphicPromoCard;\n\nexport default React.memo(PromoCard);\n"],"names":["PromoCard","forwardRef","className","description","defaultChecked","download","href","hrefLang","id","headingLevel","imageAlt","imageClass","imageSource","indicatorLabel","indicatorIcon","isChecked","isDisabled","onClick","onKeyDown","rel","tabIndex","target","testId","title","type","value","isSmall","useDisplayFont","anchorRef","anchorId","props","ref","state","onChange","contextIsDisabled","usePromoCardContext","checked","setChecked","useState","handleClick","fallbackId","useId","componentId","getIconType","undefined","commonClasses","clsx","commonProps","anchorProps","checkedProps","role","event","key","getTitle","titleContent","_jsx","children","titleProps","as","Display","Typography","DISPLAY_SMALL","Title","TITLE_SUBSECTION","useEffect","_jsxs","Card","Check","size","Body","Image","src","alt","loading","PromoCardIndicator","label","icon","React","memo"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuMA,MAAMA,WAAS,gBAAsCC,gBAAU,CAC7D,CACE;EACEC,SAAS;EACTC,WAAW;EACXC,cAAc;EACdC,QAAQ;EACRC,IAAI;EACJC,QAAQ;EACRC,EAAE;AACFC,EAAAA,YAAY,GAAG,IAAI;EACnBC,QAAQ;EACRC,UAAU;EACVC,WAAW;EACXC,cAAc;EACdC,aAAa;EACbC,SAAS;EACTC,UAAU;EACVC,OAAO;EACPC,SAAS;EACTC,GAAG;EACHC,QAAQ;EACRC,MAAM;EACNC,MAAM;EACNC,KAAK;EACLC,IAAI;EACJC,KA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MAAA,EAAA;AAAMrD,MAAAA,SAAS,EAAC,eAAe;MAAAsD,QAAA,eAC7BD,cAAA,CAACY,WAAK,EAAA;AAACC,QAAAA,IAAI,EAAE,EAAG;QAAC,aAAA,EAAY;OAAM;KAC/B,CACP,EAEAf,QAAQ,EAAE,eAEXE,cAAA,CAACc,YAAI,EAAA;AAACnE,MAAAA,SAAS,EAAC,qBAAqB;AAAAsD,MAAAA,QAAA,EAAErD;AAAW,KAAO,CAEzD,EAACS,WAAW,iBACV2C,cAAA,CAAA,KAAA,EAAA;AAAKrD,MAAAA,SAAS,EAAE4C,SAAI,CAAC,eAAe,EAAE;AAAEnC,QAAAA;AAAU,OAAE,CAAE;MAAA6C,QAAA,eACpDD,cAAA,CAACe,aAAK,EAAA;AAACC,QAAAA,GAAG,EAAE3D,WAAY;QAAC4D,GAAG,EAAE9D,QAAQ,IAAI,EAAG;AAAC+D,QAAAA,OAAO,EAAC;OAAM;AAC9D,KAAK,CACN,eAEDlB,cAAA,CAACmB,0BAAkB,EAAA;AAACC,MAAAA,KAAK,EAAE9D,cAAe;MAAC+D,IAAI,EAAEjC,WAAW,EAAG;AAACjB,MAAAA,OAAO,EAAEA;AAAQ,KAAA,CACnF;AAAA,GAAM,CAAC;AAEX,CAAC,CACsB;AAEzB,gBAAA,aAAemD,sBAAK,CAACC,IAAI,CAAC9E,WAAS,CAAC;;;;"}
1
+ {"version":3,"file":"PromoCard.js","sources":["../../src/promoCard/PromoCard.tsx"],"sourcesContent":["import { Check } from '@transferwise/icons';\nimport { clsx } from 'clsx';\nimport React, { forwardRef, FunctionComponent, useEffect, useId, useState } from 'react';\n\nimport Body from '../body';\nimport { Typography } from '../common';\nimport BaseCard, { type BaseCardProps } from '../common/baseCard';\nimport Display from '../display';\nimport Image from '../image/Image';\nimport Title from '../title';\n\nimport { usePromoCardContext } from './PromoCardContext';\nimport PromoCardIndicator, { type PromoCardIndicatorProps } from './PromoCardIndicator';\n\nexport type ReferenceType = React.Ref<HTMLInputElement> | React.Ref<HTMLDivElement>;\nexport type RelatedTypes =\n | ''\n | 'alternate'\n | 'author'\n | 'bookmark'\n | 'external'\n | 'help'\n | 'license'\n | 'next'\n | 'nofollow'\n | 'noreferrer'\n | 'noopener'\n | 'prev'\n | 'search'\n | 'tag';\n\nexport interface PromoCardCommonProps {\n /** Optional prop to specify classNames onto the PromoCard */\n className?: string;\n\n /** Optional prop to specify the ID of the PromoCard */\n id?: string;\n\n /** Required prop to specify the descriptive text of the PromoCard */\n description: string;\n\n /**\n * Optional prop to specify the heading level of the PromoCard\n *\n * @default 'h3'\n */\n headingLevel?: 'h3' | 'h4' | 'h5' | 'h6';\n\n /** Optional prop to specify text for the indicator label of the PromoCard */\n indicatorLabel?: string;\n\n /** Optional prop to specify the icon for the indicator icon of the PromoCard */\n indicatorIcon?: PromoCardIndicatorProps['icon'];\n\n /** Optional prop to specify an image alt text */\n imageAlt?: string;\n\n /** Optional prop to specify an image class */\n imageClass?: string;\n\n /** Optional prop to specify an image source url */\n imageSource?: string;\n\n /** Specify whether the PromoCard is disabled, or not */\n isDisabled?: boolean;\n\n /** Specify an onClick event handler */\n onClick?: () => void;\n\n /** Specify an onKeyDown event handler */\n onKeyDown?: (event: React.KeyboardEvent<HTMLInputElement>) => void;\n\n /** Optional prop to specify the ID used for testing */\n testId?: string;\n\n /** Required prop to specify the title text of the PromoCard */\n title: string;\n\n /** Set to false to use body font style for the title */\n useDisplayFont?: boolean;\n\n ref?: ReferenceType;\n}\n\nexport interface PromoCardLinkProps extends PromoCardCommonProps, Omit<BaseCardProps, 'children'> {\n /**\n * Optional prop to prompts a user to save the linked URL instead of\n * navigating to it\n */\n download?: string;\n\n /** Optionally specify an href for your PromoCard to contain an <a> element */\n href?: string;\n\n /** Optionally specify the language of the linked URL */\n hrefLang?: string;\n\n /** Optional property that can be pass a ref for the anchor. */\n anchorRef?: React.Ref<HTMLAnchorElement>;\n\n /**\n * Optional prop to specify the ID of the anchor element which can be useful when using a ref.\n */\n anchorId?: string;\n\n /**\n * Relationship between the PromoCard href URL and the current page. See\n * [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel).\n */\n rel?: RelatedTypes;\n\n /** Optional prop to to display where the linked URL will show */\n target?: React.HTMLAttributeAnchorTarget;\n\n /** Only applies to role=\"radio\" or \"checkbox\" */\n defaultChecked?: never;\n isChecked?: never;\n tabIndex?: never;\n type?: never;\n ref?: ReferenceType;\n value?: never;\n}\n\nexport interface PromoCardCheckedProps\n extends PromoCardCommonProps, Omit<BaseCardProps, 'children'> {\n /** Specify the initial checked attribute of the PromoCard */\n defaultChecked?: boolean;\n\n /** Specify whether the PromoCard is checked, or not */\n isChecked?: boolean;\n\n /** Optional prop to specify the tabIndex of the PromoCard */\n tabIndex?: number;\n\n /** Optional property to provide component Ref */\n ref?: ReferenceType;\n\n /** Optional prop to specify the input type of the PromoCard */\n type?: 'checkbox' | 'radio';\n\n /** Specify the value attribute of the PromoCard if Checkbox or Radio */\n value?: string;\n\n /** Only applies to <a />s */\n download?: never;\n href?: never;\n anchorRef?: never;\n anchorId?: never;\n hrefLang?: never;\n rel?: never;\n target?: never;\n}\n\nexport type PromoCardProps = PromoCardLinkProps | PromoCardCheckedProps;\n\nexport type PolymorphicPromoCard = (\n props: PromoCardLinkProps | PromoCardCheckedProps,\n) => React.JSX.Element;\n\n/**\n * PromoCard component.\n *\n * PromoCard is a marketing style component that is used to group marketing\n * product related information (such as choosing Card types). It can be used to\n * display information in a structured way, and can be customized with various\n * props to suit different use cases.\n *\n * @component\n * @param {string} className - Additional class name for the PromoCard.\n * @param {string} description - Description text for the PromoCard.\n * @param {boolean} defaultChecked - Initial checked state for checkboxes and radios.\n * @param {string} download - Download file name for links.\n * @param {string} href - URL for links.\n * @param {string} hrefLang - Language code for linked URL.\n * @param {string} id - ID of the PromoCard.\n * @param {string} imageAlt - Alt text for the image.\n * @param {string} imageSource - Source URL of the image.\n * @param {string} indicatorLabel - Label for the indicator icon.\n * @param {boolean} isChecked - Checked state for checkboxes and radios.\n * @param {boolean} isDisabled - Whether the PromoCard is disabled.\n * @param {Function} onClick - Click event handler for the PromoCard.\n * @param {string} rel - Relationship between the URL and the current page.\n * @param {number} tabIndex - Tab index for keyboard navigation.\n * @param {string} target - Target window for links.\n * @param {string} testId - ID used for testing.\n * @param {string} title - Title text of the PromoCard.\n * @param {('checkbox'|'radio')} type - Type of the PromoCard (checkbox, radio).\n * @param {string} value - Value for checkboxes and radios.\n * @returns {React.JSX.Element} The rendered PromoCard component.\n * @example\n * <PromoCard\n * title=\"Example PromoCard\"\n * description=\"This is an example PromoCard with a link variation.\"\n * href=\"https://example.com\"\n * target=\"_blank\"\n * imageSource=\"https://example.com/image.png\"\n * imageAlt=\"Example Image\"\n * indicatorLabel=\"Learn More\"\n * />\n */\nconst PromoCard: FunctionComponent<PromoCardProps> = forwardRef(\n (\n {\n className,\n description,\n defaultChecked,\n download,\n href,\n hrefLang,\n id,\n headingLevel = 'h3',\n imageAlt,\n imageClass,\n imageSource,\n indicatorLabel,\n indicatorIcon,\n isChecked,\n isDisabled,\n onClick,\n onKeyDown,\n rel,\n tabIndex,\n target,\n testId,\n title,\n type,\n value,\n isSmall,\n useDisplayFont = true,\n anchorRef,\n anchorId,\n ...props\n },\n ref: ReferenceType,\n ) => {\n // Set the `checked` state to the value of `defaultChecked` if it is truthy,\n // or the value of `isChecked` if it is truthy, or `false` if neither\n // is truthy.\n const { state, onChange, isDisabled: contextIsDisabled } = usePromoCardContext();\n const [checked, setChecked] = useState(\n type === 'checkbox' ? (defaultChecked ?? isChecked ?? false) : false,\n );\n\n const handleClick = () => {\n if (type === 'radio') {\n onChange(value || ''); // Update the context state for radio\n } else if (type === 'checkbox') {\n setChecked(!checked); // Update local state for checkbox\n }\n };\n\n const fallbackId = useId();\n const componentId = id || fallbackId;\n\n // Set the icon to `'arrow'` if `href` is truthy and `type` is falsy, or\n // `'download'` if `download` is truthy. If neither condition is true, set\n // `icon` to `undefined`.\n\n // Create a function to get icon type\n const getIconType = () => {\n if (indicatorIcon) {\n return indicatorIcon;\n }\n\n if (download) {\n return 'download';\n }\n\n if (href && !type) {\n return 'arrow';\n }\n\n return undefined;\n };\n\n const CardTitle = useDisplayFont ? Display : Title;\n\n // Define all class names string based on the values of the `href`, `type`,\n // `checked`, and `className` props.\n const commonClasses = clsx(\n {\n 'np-Card--promoCard': true,\n 'np-Card--checked': !href && type,\n 'np-Card--link': href && !type,\n 'is-checked':\n type === 'radio' ? value === state : type === 'checkbox' ? checked : undefined,\n },\n className,\n );\n\n // Object with common props that will be passed to the `Card` components\n const commonProps = {\n className: commonClasses,\n id: componentId,\n isDisabled: isDisabled || contextIsDisabled,\n onClick,\n onKeyDown,\n ref,\n 'data-testid': testId,\n isSmall,\n };\n\n // Object with Anchor props that will be passed to the `a` element. These\n // won't be refurned if set to `isDisabled`\n const anchorProps =\n href && !isDisabled\n ? {\n download,\n href: href || undefined,\n hrefLang,\n rel,\n target,\n ref: anchorRef,\n id: anchorId,\n }\n : {};\n\n // Object of all Checked props that will be passed to the root `Card` component\n const checkedProps =\n (type === 'checkbox' || type === 'radio') && !href\n ? {\n ...commonProps,\n 'aria-checked':\n type === 'radio' ? value === state : type === 'checkbox' ? checked : undefined,\n 'aria-describedby': `${componentId}-title`,\n 'aria-disabled': isDisabled,\n 'data-value': value ?? undefined,\n role: type === 'checkbox' || type === 'radio' ? type : undefined,\n onClick: handleClick,\n onKeyDown: (event: React.KeyboardEvent<HTMLInputElement>) => {\n if (event.key === 'Enter' || event.key === ' ') {\n handleClick();\n }\n },\n ref,\n tabIndex: 0,\n }\n : {};\n\n const getTitle = () => {\n const titleContent =\n href && !type ? (\n <a className=\"np-Card-titleLink\" {...anchorProps}>\n {title}\n </a>\n ) : (\n title\n );\n\n const titleProps = {\n id: `${componentId}-title`,\n as: headingLevel,\n className: 'np-Card-title',\n };\n\n return useDisplayFont ? (\n <Display type={Typography.DISPLAY_SMALL} {...titleProps}>\n {titleContent}\n </Display>\n ) : (\n <Title type={Typography.TITLE_SUBSECTION} {...titleProps}>\n {titleContent}\n </Title>\n );\n };\n\n useEffect(() => {\n setChecked(defaultChecked ?? isChecked ?? false);\n }, [defaultChecked, isChecked]);\n\n return (\n <BaseCard {...commonProps} {...checkedProps} {...props}>\n {(value === state || checked) && (\n <span className=\"np-Card-check\">\n <Check size={24} aria-hidden=\"true\" />\n </span>\n )}\n\n {getTitle()}\n\n <Body className=\"np-Card-description\">{description}</Body>\n\n {imageSource && (\n <div className={clsx('np-Card-image', { imageClass })}>\n <Image src={imageSource} alt={imageAlt || ''} loading=\"lazy\" />\n </div>\n )}\n\n <PromoCardIndicator label={indicatorLabel} icon={getIconType()} isSmall={isSmall} />\n </BaseCard>\n );\n },\n) as PolymorphicPromoCard;\n\nexport default React.memo(PromoCard);\n"],"names":["PromoCard","forwardRef","className","description","defaultChecked","download","href","hrefLang","id","headingLevel","imageAlt","imageClass","imageSource","indicatorLabel","indicatorIcon","isChecked","isDisabled","onClick","onKeyDown","rel","tabIndex","target","testId","title","type","value","isSmall","useDisplayFont","anchorRef","anchorId","props","ref","state","onChange","contextIsDisabled","usePromoCardContext","checked","setChecked","useState","handleClick","fallbackId","useId","componentId","getIconType","undefined","commonClasses","clsx","commonProps","anchorProps","checkedProps","role","event","key","getTitle","titleContent","_jsx","children","titleProps","as","Display","Typography","DISPLAY_SMALL","Title","TITLE_SUBSECTION","useEffect","_jsxs","BaseCard","Check","size","Body","Image","src","alt","loading","PromoCardIndicator","label","icon","React","memo"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwMA,MAAMA,WAAS,gBAAsCC,gBAAU,CAC7D,CACE;EACEC,SAAS;EACTC,WAAW;EACXC,cAAc;EACdC,QAAQ;EACRC,IAAI;EACJC,QAAQ;EACRC,EAAE;AACFC,EAAAA,YAAY,GAAG,IAAI;EACnBC,QAAQ;EACRC,UAAU;EACVC,WAAW;EACXC,cAAc;EACdC,aAAa;EACbC,SAAS;EACTC,UAAU;EACVC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AAMnB,KAAK;IAAA0B,QAAA,EAAA,CACnD,CAAC/B,KAAK,KAAKO,KAAK,IAAII,OAAO,kBAC1BmB,cAAA,CAAA,MAAA,EAAA;AAAMrD,MAAAA,SAAS,EAAC,eAAe;MAAAsD,QAAA,eAC7BD,cAAA,CAACY,WAAK,EAAA;AAACC,QAAAA,IAAI,EAAE,EAAG;QAAC,aAAA,EAAY;OAAM;KAC/B,CACP,EAEAf,QAAQ,EAAE,eAEXE,cAAA,CAACc,YAAI,EAAA;AAACnE,MAAAA,SAAS,EAAC,qBAAqB;AAAAsD,MAAAA,QAAA,EAAErD;AAAW,KAAO,CAEzD,EAACS,WAAW,iBACV2C,cAAA,CAAA,KAAA,EAAA;AAAKrD,MAAAA,SAAS,EAAE4C,SAAI,CAAC,eAAe,EAAE;AAAEnC,QAAAA;AAAU,OAAE,CAAE;MAAA6C,QAAA,eACpDD,cAAA,CAACe,aAAK,EAAA;AAACC,QAAAA,GAAG,EAAE3D,WAAY;QAAC4D,GAAG,EAAE9D,QAAQ,IAAI,EAAG;AAAC+D,QAAAA,OAAO,EAAC;OAAM;AAC9D,KAAK,CACN,eAEDlB,cAAA,CAACmB,0BAAkB,EAAA;AAACC,MAAAA,KAAK,EAAE9D,cAAe;MAAC+D,IAAI,EAAEjC,WAAW,EAAG;AAACjB,MAAAA,OAAO,EAAEA;AAAQ,KAAA,CACnF;AAAA,GAAU,CAAC;AAEf,CAAC,CACsB;AAEzB,gBAAA,aAAemD,sBAAK,CAACC,IAAI,CAAC9E,WAAS,CAAC;;;;"}
@@ -24,7 +24,7 @@ import '../common/fileType.mjs';
24
24
  import 'react-intl';
25
25
  import '../common/closeButton/CloseButton.messages.mjs';
26
26
  import { jsxs, jsx } from 'react/jsx-runtime';
27
- import Card from '../common/card/Card.mjs';
27
+ import BaseCard from '../common/baseCard/BaseCard.mjs';
28
28
  import Display from '../display/Display.mjs';
29
29
  import Image from '../image/Image.mjs';
30
30
  import Title from '../title/Title.mjs';
@@ -167,7 +167,7 @@ const PromoCard = /*#__PURE__*/forwardRef(({
167
167
  useEffect(() => {
168
168
  setChecked(defaultChecked ?? isChecked ?? false);
169
169
  }, [defaultChecked, isChecked]);
170
- return /*#__PURE__*/jsxs(Card, {
170
+ return /*#__PURE__*/jsxs(BaseCard, {
171
171
  ...commonProps,
172
172
  ...checkedProps,
173
173
  ...props,
@@ -1 +1 @@
1
- {"version":3,"file":"PromoCard.mjs","sources":["../../src/promoCard/PromoCard.tsx"],"sourcesContent":["import { Check } from '@transferwise/icons';\nimport { clsx } from 'clsx';\nimport React, { forwardRef, FunctionComponent, useEffect, useId, useState } from 'react';\n\nimport Body from '../body';\nimport { Typography } from '../common';\nimport Card, { type CardProps } from '../common/card';\nimport Display from '../display';\nimport Image from '../image/Image';\nimport Title from '../title';\n\nimport { usePromoCardContext } from './PromoCardContext';\nimport PromoCardIndicator, { type PromoCardIndicatorProps } from './PromoCardIndicator';\n\nexport type ReferenceType = React.Ref<HTMLInputElement> | React.Ref<HTMLDivElement>;\nexport type RelatedTypes =\n | ''\n | 'alternate'\n | 'author'\n | 'bookmark'\n | 'external'\n | 'help'\n | 'license'\n | 'next'\n | 'nofollow'\n | 'noreferrer'\n | 'noopener'\n | 'prev'\n | 'search'\n | 'tag';\n\nexport interface PromoCardCommonProps {\n /** Optional prop to specify classNames onto the PromoCard */\n className?: string;\n\n /** Optional prop to specify the ID of the PromoCard */\n id?: string;\n\n /** Required prop to specify the descriptive text of the PromoCard */\n description: string;\n\n /**\n * Optional prop to specify the heading level of the PromoCard\n *\n * @default 'h3'\n */\n headingLevel?: 'h3' | 'h4' | 'h5' | 'h6';\n\n /** Optional prop to specify text for the indicator label of the PromoCard */\n indicatorLabel?: string;\n\n /** Optional prop to specify the icon for the indicator icon of the PromoCard */\n indicatorIcon?: PromoCardIndicatorProps['icon'];\n\n /** Optional prop to specify an image alt text */\n imageAlt?: string;\n\n /** Optional prop to specify an image class */\n imageClass?: string;\n\n /** Optional prop to specify an image source url */\n imageSource?: string;\n\n /** Specify whether the PromoCard is disabled, or not */\n isDisabled?: boolean;\n\n /** Specify an onClick event handler */\n onClick?: () => void;\n\n /** Specify an onKeyDown event handler */\n onKeyDown?: (event: React.KeyboardEvent<HTMLInputElement>) => void;\n\n /** Optional prop to specify the ID used for testing */\n testId?: string;\n\n /** Required prop to specify the title text of the PromoCard */\n title: string;\n\n /** Set to false to use body font style for the title */\n useDisplayFont?: boolean;\n\n ref?: ReferenceType;\n}\n\nexport interface PromoCardLinkProps extends PromoCardCommonProps, Omit<CardProps, 'children'> {\n /**\n * Optional prop to prompts a user to save the linked URL instead of\n * navigating to it\n */\n download?: string;\n\n /** Optionally specify an href for your PromoCard to contain an <a> element */\n href?: string;\n\n /** Optionally specify the language of the linked URL */\n hrefLang?: string;\n\n /** Optional property that can be pass a ref for the anchor. */\n anchorRef?: React.Ref<HTMLAnchorElement>;\n\n /**\n * Optional prop to specify the ID of the anchor element which can be useful when using a ref.\n */\n anchorId?: string;\n\n /**\n * Relationship between the PromoCard href URL and the current page. See\n * [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel).\n */\n rel?: RelatedTypes;\n\n /** Optional prop to to display where the linked URL will show */\n target?: React.HTMLAttributeAnchorTarget;\n\n /** Only applies to role=\"radio\" or \"checkbox\" */\n defaultChecked?: never;\n isChecked?: never;\n tabIndex?: never;\n type?: never;\n ref?: ReferenceType;\n value?: never;\n}\n\nexport interface PromoCardCheckedProps extends PromoCardCommonProps, Omit<CardProps, 'children'> {\n /** Specify the initial checked attribute of the PromoCard */\n defaultChecked?: boolean;\n\n /** Specify whether the PromoCard is checked, or not */\n isChecked?: boolean;\n\n /** Optional prop to specify the tabIndex of the PromoCard */\n tabIndex?: number;\n\n /** Optional property to provide component Ref */\n ref?: ReferenceType;\n\n /** Optional prop to specify the input type of the PromoCard */\n type?: 'checkbox' | 'radio';\n\n /** Specify the value attribute of the PromoCard if Checkbox or Radio */\n value?: string;\n\n /** Only applies to <a />s */\n download?: never;\n href?: never;\n anchorRef?: never;\n anchorId?: never;\n hrefLang?: never;\n rel?: never;\n target?: never;\n}\n\nexport type PromoCardProps = PromoCardLinkProps | PromoCardCheckedProps;\n\nexport type PolymorphicPromoCard = (\n props: PromoCardLinkProps | PromoCardCheckedProps,\n) => React.JSX.Element;\n\n/**\n * PromoCard component.\n *\n * PromoCard is a marketing style component that is used to group marketing\n * product related information (such as choosing Card types). It can be used to\n * display information in a structured way, and can be customized with various\n * props to suit different use cases.\n *\n * @component\n * @param {string} className - Additional class name for the PromoCard.\n * @param {string} description - Description text for the PromoCard.\n * @param {boolean} defaultChecked - Initial checked state for checkboxes and radios.\n * @param {string} download - Download file name for links.\n * @param {string} href - URL for links.\n * @param {string} hrefLang - Language code for linked URL.\n * @param {string} id - ID of the PromoCard.\n * @param {string} imageAlt - Alt text for the image.\n * @param {string} imageSource - Source URL of the image.\n * @param {string} indicatorLabel - Label for the indicator icon.\n * @param {boolean} isChecked - Checked state for checkboxes and radios.\n * @param {boolean} isDisabled - Whether the PromoCard is disabled.\n * @param {Function} onClick - Click event handler for the PromoCard.\n * @param {string} rel - Relationship between the URL and the current page.\n * @param {number} tabIndex - Tab index for keyboard navigation.\n * @param {string} target - Target window for links.\n * @param {string} testId - ID used for testing.\n * @param {string} title - Title text of the PromoCard.\n * @param {('checkbox'|'radio')} type - Type of the PromoCard (checkbox, radio).\n * @param {string} value - Value for checkboxes and radios.\n * @returns {React.JSX.Element} The rendered PromoCard component.\n * @example\n * <PromoCard\n * title=\"Example PromoCard\"\n * description=\"This is an example PromoCard with a link variation.\"\n * href=\"https://example.com\"\n * target=\"_blank\"\n * imageSource=\"https://example.com/image.png\"\n * imageAlt=\"Example Image\"\n * indicatorLabel=\"Learn More\"\n * />\n */\nconst PromoCard: FunctionComponent<PromoCardProps> = forwardRef(\n (\n {\n className,\n description,\n defaultChecked,\n download,\n href,\n hrefLang,\n id,\n headingLevel = 'h3',\n imageAlt,\n imageClass,\n imageSource,\n indicatorLabel,\n indicatorIcon,\n isChecked,\n isDisabled,\n onClick,\n onKeyDown,\n rel,\n tabIndex,\n target,\n testId,\n title,\n type,\n value,\n isSmall,\n useDisplayFont = true,\n anchorRef,\n anchorId,\n ...props\n },\n ref: ReferenceType,\n ) => {\n // Set the `checked` state to the value of `defaultChecked` if it is truthy,\n // or the value of `isChecked` if it is truthy, or `false` if neither\n // is truthy.\n const { state, onChange, isDisabled: contextIsDisabled } = usePromoCardContext();\n const [checked, setChecked] = useState(\n type === 'checkbox' ? (defaultChecked ?? isChecked ?? false) : false,\n );\n\n const handleClick = () => {\n if (type === 'radio') {\n onChange(value || ''); // Update the context state for radio\n } else if (type === 'checkbox') {\n setChecked(!checked); // Update local state for checkbox\n }\n };\n\n const fallbackId = useId();\n const componentId = id || fallbackId;\n\n // Set the icon to `'arrow'` if `href` is truthy and `type` is falsy, or\n // `'download'` if `download` is truthy. If neither condition is true, set\n // `icon` to `undefined`.\n\n // Create a function to get icon type\n const getIconType = () => {\n if (indicatorIcon) {\n return indicatorIcon;\n }\n\n if (download) {\n return 'download';\n }\n\n if (href && !type) {\n return 'arrow';\n }\n\n return undefined;\n };\n\n const CardTitle = useDisplayFont ? Display : Title;\n\n // Define all class names string based on the values of the `href`, `type`,\n // `checked`, and `className` props.\n const commonClasses = clsx(\n {\n 'np-Card--promoCard': true,\n 'np-Card--checked': !href && type,\n 'np-Card--link': href && !type,\n 'is-checked':\n type === 'radio' ? value === state : type === 'checkbox' ? checked : undefined,\n },\n className,\n );\n\n // Object with common props that will be passed to the `Card` components\n const commonProps = {\n className: commonClasses,\n id: componentId,\n isDisabled: isDisabled || contextIsDisabled,\n onClick,\n onKeyDown,\n ref,\n 'data-testid': testId,\n isSmall,\n };\n\n // Object with Anchor props that will be passed to the `a` element. These\n // won't be refurned if set to `isDisabled`\n const anchorProps =\n href && !isDisabled\n ? {\n download,\n href: href || undefined,\n hrefLang,\n rel,\n target,\n ref: anchorRef,\n id: anchorId,\n }\n : {};\n\n // Object of all Checked props that will be passed to the root `Card` component\n const checkedProps =\n (type === 'checkbox' || type === 'radio') && !href\n ? {\n ...commonProps,\n 'aria-checked':\n type === 'radio' ? value === state : type === 'checkbox' ? checked : undefined,\n 'aria-describedby': `${componentId}-title`,\n 'aria-disabled': isDisabled,\n 'data-value': value ?? undefined,\n role: type === 'checkbox' || type === 'radio' ? type : undefined,\n onClick: handleClick,\n onKeyDown: (event: React.KeyboardEvent<HTMLInputElement>) => {\n if (event.key === 'Enter' || event.key === ' ') {\n handleClick();\n }\n },\n ref,\n tabIndex: 0,\n }\n : {};\n\n const getTitle = () => {\n const titleContent =\n href && !type ? (\n <a className=\"np-Card-titleLink\" {...anchorProps}>\n {title}\n </a>\n ) : (\n title\n );\n\n const titleProps = {\n id: `${componentId}-title`,\n as: headingLevel,\n className: 'np-Card-title',\n };\n\n return useDisplayFont ? (\n <Display type={Typography.DISPLAY_SMALL} {...titleProps}>\n {titleContent}\n </Display>\n ) : (\n <Title type={Typography.TITLE_SUBSECTION} {...titleProps}>\n {titleContent}\n </Title>\n );\n };\n\n useEffect(() => {\n setChecked(defaultChecked ?? isChecked ?? false);\n }, [defaultChecked, isChecked]);\n\n return (\n <Card {...commonProps} {...checkedProps} {...props}>\n {(value === state || checked) && (\n <span className=\"np-Card-check\">\n <Check size={24} aria-hidden=\"true\" />\n </span>\n )}\n\n {getTitle()}\n\n <Body className=\"np-Card-description\">{description}</Body>\n\n {imageSource && (\n <div className={clsx('np-Card-image', { imageClass })}>\n <Image src={imageSource} alt={imageAlt || ''} loading=\"lazy\" />\n </div>\n )}\n\n <PromoCardIndicator label={indicatorLabel} icon={getIconType()} isSmall={isSmall} />\n </Card>\n );\n },\n) as PolymorphicPromoCard;\n\nexport default React.memo(PromoCard);\n"],"names":["PromoCard","forwardRef","className","description","defaultChecked","download","href","hrefLang","id","headingLevel","imageAlt","imageClass","imageSource","indicatorLabel","indicatorIcon","isChecked","isDisabled","onClick","onKeyDown","rel","tabIndex","target","testId","title","type","value","isSmall","useDisplayFont","anchorRef","anchorId","props","ref","state","onChange","contextIsDisabled","usePromoCardContext","checked","setChecked","useState","handleClick","fallbackId","useId","componentId","getIconType","undefined","commonClasses","clsx","commonProps","anchorProps","checkedProps","role","event","key","getTitle","titleContent","_jsx","children","titleProps","as","Display","Typography","DISPLAY_SMALL","Title","TITLE_SUBSECTION","useEffect","_jsxs","Card","Check","size","Body","Image","src","alt","loading","PromoCardIndicator","label","icon","React","memo"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuMA,MAAMA,SAAS,gBAAsCC,UAAU,CAC7D,CACE;EACEC,SAAS;EACTC,WAAW;EACXC,cAAc;EACdC,QAAQ;EACRC,IAAI;EACJC,QAAQ;EACRC,EAAE;AACFC,EAAAA,YAAY,GAAG,IAAI;EACnBC,QAAQ;EACRC,UAAU;EACVC,WAAW;EACXC,cAAc;EACdC,aAAa;EACbC,SAAS;EACTC,UAAU;EACVC,OAAO;EACPC,SAAS;EACTC,GAAG;EACHC,QAAQ;EACRC,MAAM;EACNC,MAAM;EACNC,KAAK;EACLC,IAAI;EACJC,KAAK;EACLC,OAAO;AACPC,EAAAA,cAAc,GAAG,IAAI;EACrBC,SAAS;EACTC,QAAQ;EACR,GAAGC;AAAK,CACT,EACDC,GAAkB,KAChB;AACF;AACA;AACA;EACA,MAAM;IAAEC,KAAK;IAAEC,QAAQ;AAAEjB,IAAAA,UAAU,EAAEkB;GAAmB,GAAGC,mBAAmB,EAAE;AAChF,EAAA,MAAM,CAACC,OAAO,EAAEC,UAAU,CAAC,GAAGC,QAAQ,CACpCd,IAAI,KAAK,UAAU,GAAIpB,cAAc,IAAIW,SAAS,IAAI,KAAK,GAAI,KAAK,CACrE;EAED,MAAMwB,WAAW,GAAGA,MAAK;IACvB,IAAIf,IAAI,KAAK,OAAO,EAAE;AACpBS,MAAAA,QAAQ,CAACR,KAAK,IAAI,EAAE,CAAC,CAAC;AACxB,IAAA,CAAC,MAAM,IAAID,IAAI,KAAK,UAAU,EAAE;AA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AA,OAAO,EAAC;OAAM;AAC9D,KAAK,CACN,eAEDlB,GAAA,CAACmB,kBAAkB,EAAA;AAACC,MAAAA,KAAK,EAAE9D,cAAe;MAAC+D,IAAI,EAAEjC,WAAW,EAAG;AAACjB,MAAAA,OAAO,EAAEA;AAAQ,KAAA,CACnF;AAAA,GAAM,CAAC;AAEX,CAAC,CACsB;AAEzB,kBAAA,aAAemD,cAAK,CAACC,IAAI,CAAC9E,SAAS,CAAC;;;;"}
1
+ {"version":3,"file":"PromoCard.mjs","sources":["../../src/promoCard/PromoCard.tsx"],"sourcesContent":["import { Check } from '@transferwise/icons';\nimport { clsx } from 'clsx';\nimport React, { forwardRef, FunctionComponent, useEffect, useId, useState } from 'react';\n\nimport Body from '../body';\nimport { Typography } from '../common';\nimport BaseCard, { type BaseCardProps } from '../common/baseCard';\nimport Display from '../display';\nimport Image from '../image/Image';\nimport Title from '../title';\n\nimport { usePromoCardContext } from './PromoCardContext';\nimport PromoCardIndicator, { type PromoCardIndicatorProps } from './PromoCardIndicator';\n\nexport type ReferenceType = React.Ref<HTMLInputElement> | React.Ref<HTMLDivElement>;\nexport type RelatedTypes =\n | ''\n | 'alternate'\n | 'author'\n | 'bookmark'\n | 'external'\n | 'help'\n | 'license'\n | 'next'\n | 'nofollow'\n | 'noreferrer'\n | 'noopener'\n | 'prev'\n | 'search'\n | 'tag';\n\nexport interface PromoCardCommonProps {\n /** Optional prop to specify classNames onto the PromoCard */\n className?: string;\n\n /** Optional prop to specify the ID of the PromoCard */\n id?: string;\n\n /** Required prop to specify the descriptive text of the PromoCard */\n description: string;\n\n /**\n * Optional prop to specify the heading level of the PromoCard\n *\n * @default 'h3'\n */\n headingLevel?: 'h3' | 'h4' | 'h5' | 'h6';\n\n /** Optional prop to specify text for the indicator label of the PromoCard */\n indicatorLabel?: string;\n\n /** Optional prop to specify the icon for the indicator icon of the PromoCard */\n indicatorIcon?: PromoCardIndicatorProps['icon'];\n\n /** Optional prop to specify an image alt text */\n imageAlt?: string;\n\n /** Optional prop to specify an image class */\n imageClass?: string;\n\n /** Optional prop to specify an image source url */\n imageSource?: string;\n\n /** Specify whether the PromoCard is disabled, or not */\n isDisabled?: boolean;\n\n /** Specify an onClick event handler */\n onClick?: () => void;\n\n /** Specify an onKeyDown event handler */\n onKeyDown?: (event: React.KeyboardEvent<HTMLInputElement>) => void;\n\n /** Optional prop to specify the ID used for testing */\n testId?: string;\n\n /** Required prop to specify the title text of the PromoCard */\n title: string;\n\n /** Set to false to use body font style for the title */\n useDisplayFont?: boolean;\n\n ref?: ReferenceType;\n}\n\nexport interface PromoCardLinkProps extends PromoCardCommonProps, Omit<BaseCardProps, 'children'> {\n /**\n * Optional prop to prompts a user to save the linked URL instead of\n * navigating to it\n */\n download?: string;\n\n /** Optionally specify an href for your PromoCard to contain an <a> element */\n href?: string;\n\n /** Optionally specify the language of the linked URL */\n hrefLang?: string;\n\n /** Optional property that can be pass a ref for the anchor. */\n anchorRef?: React.Ref<HTMLAnchorElement>;\n\n /**\n * Optional prop to specify the ID of the anchor element which can be useful when using a ref.\n */\n anchorId?: string;\n\n /**\n * Relationship between the PromoCard href URL and the current page. See\n * [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel).\n */\n rel?: RelatedTypes;\n\n /** Optional prop to to display where the linked URL will show */\n target?: React.HTMLAttributeAnchorTarget;\n\n /** Only applies to role=\"radio\" or \"checkbox\" */\n defaultChecked?: never;\n isChecked?: never;\n tabIndex?: never;\n type?: never;\n ref?: ReferenceType;\n value?: never;\n}\n\nexport interface PromoCardCheckedProps\n extends PromoCardCommonProps, Omit<BaseCardProps, 'children'> {\n /** Specify the initial checked attribute of the PromoCard */\n defaultChecked?: boolean;\n\n /** Specify whether the PromoCard is checked, or not */\n isChecked?: boolean;\n\n /** Optional prop to specify the tabIndex of the PromoCard */\n tabIndex?: number;\n\n /** Optional property to provide component Ref */\n ref?: ReferenceType;\n\n /** Optional prop to specify the input type of the PromoCard */\n type?: 'checkbox' | 'radio';\n\n /** Specify the value attribute of the PromoCard if Checkbox or Radio */\n value?: string;\n\n /** Only applies to <a />s */\n download?: never;\n href?: never;\n anchorRef?: never;\n anchorId?: never;\n hrefLang?: never;\n rel?: never;\n target?: never;\n}\n\nexport type PromoCardProps = PromoCardLinkProps | PromoCardCheckedProps;\n\nexport type PolymorphicPromoCard = (\n props: PromoCardLinkProps | PromoCardCheckedProps,\n) => React.JSX.Element;\n\n/**\n * PromoCard component.\n *\n * PromoCard is a marketing style component that is used to group marketing\n * product related information (such as choosing Card types). It can be used to\n * display information in a structured way, and can be customized with various\n * props to suit different use cases.\n *\n * @component\n * @param {string} className - Additional class name for the PromoCard.\n * @param {string} description - Description text for the PromoCard.\n * @param {boolean} defaultChecked - Initial checked state for checkboxes and radios.\n * @param {string} download - Download file name for links.\n * @param {string} href - URL for links.\n * @param {string} hrefLang - Language code for linked URL.\n * @param {string} id - ID of the PromoCard.\n * @param {string} imageAlt - Alt text for the image.\n * @param {string} imageSource - Source URL of the image.\n * @param {string} indicatorLabel - Label for the indicator icon.\n * @param {boolean} isChecked - Checked state for checkboxes and radios.\n * @param {boolean} isDisabled - Whether the PromoCard is disabled.\n * @param {Function} onClick - Click event handler for the PromoCard.\n * @param {string} rel - Relationship between the URL and the current page.\n * @param {number} tabIndex - Tab index for keyboard navigation.\n * @param {string} target - Target window for links.\n * @param {string} testId - ID used for testing.\n * @param {string} title - Title text of the PromoCard.\n * @param {('checkbox'|'radio')} type - Type of the PromoCard (checkbox, radio).\n * @param {string} value - Value for checkboxes and radios.\n * @returns {React.JSX.Element} The rendered PromoCard component.\n * @example\n * <PromoCard\n * title=\"Example PromoCard\"\n * description=\"This is an example PromoCard with a link variation.\"\n * href=\"https://example.com\"\n * target=\"_blank\"\n * imageSource=\"https://example.com/image.png\"\n * imageAlt=\"Example Image\"\n * indicatorLabel=\"Learn More\"\n * />\n */\nconst PromoCard: FunctionComponent<PromoCardProps> = forwardRef(\n (\n {\n className,\n description,\n defaultChecked,\n download,\n href,\n hrefLang,\n id,\n headingLevel = 'h3',\n imageAlt,\n imageClass,\n imageSource,\n indicatorLabel,\n indicatorIcon,\n isChecked,\n isDisabled,\n onClick,\n onKeyDown,\n rel,\n tabIndex,\n target,\n testId,\n title,\n type,\n value,\n isSmall,\n useDisplayFont = true,\n anchorRef,\n anchorId,\n ...props\n },\n ref: ReferenceType,\n ) => {\n // Set the `checked` state to the value of `defaultChecked` if it is truthy,\n // or the value of `isChecked` if it is truthy, or `false` if neither\n // is truthy.\n const { state, onChange, isDisabled: contextIsDisabled } = usePromoCardContext();\n const [checked, setChecked] = useState(\n type === 'checkbox' ? (defaultChecked ?? isChecked ?? false) : false,\n );\n\n const handleClick = () => {\n if (type === 'radio') {\n onChange(value || ''); // Update the context state for radio\n } else if (type === 'checkbox') {\n setChecked(!checked); // Update local state for checkbox\n }\n };\n\n const fallbackId = useId();\n const componentId = id || fallbackId;\n\n // Set the icon to `'arrow'` if `href` is truthy and `type` is falsy, or\n // `'download'` if `download` is truthy. If neither condition is true, set\n // `icon` to `undefined`.\n\n // Create a function to get icon type\n const getIconType = () => {\n if (indicatorIcon) {\n return indicatorIcon;\n }\n\n if (download) {\n return 'download';\n }\n\n if (href && !type) {\n return 'arrow';\n }\n\n return undefined;\n };\n\n const CardTitle = useDisplayFont ? Display : Title;\n\n // Define all class names string based on the values of the `href`, `type`,\n // `checked`, and `className` props.\n const commonClasses = clsx(\n {\n 'np-Card--promoCard': true,\n 'np-Card--checked': !href && type,\n 'np-Card--link': href && !type,\n 'is-checked':\n type === 'radio' ? value === state : type === 'checkbox' ? checked : undefined,\n },\n className,\n );\n\n // Object with common props that will be passed to the `Card` components\n const commonProps = {\n className: commonClasses,\n id: componentId,\n isDisabled: isDisabled || contextIsDisabled,\n onClick,\n onKeyDown,\n ref,\n 'data-testid': testId,\n isSmall,\n };\n\n // Object with Anchor props that will be passed to the `a` element. These\n // won't be refurned if set to `isDisabled`\n const anchorProps =\n href && !isDisabled\n ? {\n download,\n href: href || undefined,\n hrefLang,\n rel,\n target,\n ref: anchorRef,\n id: anchorId,\n }\n : {};\n\n // Object of all Checked props that will be passed to the root `Card` component\n const checkedProps =\n (type === 'checkbox' || type === 'radio') && !href\n ? {\n ...commonProps,\n 'aria-checked':\n type === 'radio' ? value === state : type === 'checkbox' ? checked : undefined,\n 'aria-describedby': `${componentId}-title`,\n 'aria-disabled': isDisabled,\n 'data-value': value ?? undefined,\n role: type === 'checkbox' || type === 'radio' ? type : undefined,\n onClick: handleClick,\n onKeyDown: (event: React.KeyboardEvent<HTMLInputElement>) => {\n if (event.key === 'Enter' || event.key === ' ') {\n handleClick();\n }\n },\n ref,\n tabIndex: 0,\n }\n : {};\n\n const getTitle = () => {\n const titleContent =\n href && !type ? (\n <a className=\"np-Card-titleLink\" {...anchorProps}>\n {title}\n </a>\n ) : (\n title\n );\n\n const titleProps = {\n id: `${componentId}-title`,\n as: headingLevel,\n className: 'np-Card-title',\n };\n\n return useDisplayFont ? (\n <Display type={Typography.DISPLAY_SMALL} {...titleProps}>\n {titleContent}\n </Display>\n ) : (\n <Title type={Typography.TITLE_SUBSECTION} {...titleProps}>\n {titleContent}\n </Title>\n );\n };\n\n useEffect(() => {\n setChecked(defaultChecked ?? isChecked ?? false);\n }, [defaultChecked, isChecked]);\n\n return (\n <BaseCard {...commonProps} {...checkedProps} {...props}>\n {(value === state || checked) && (\n <span className=\"np-Card-check\">\n <Check size={24} aria-hidden=\"true\" />\n </span>\n )}\n\n {getTitle()}\n\n <Body className=\"np-Card-description\">{description}</Body>\n\n {imageSource && (\n <div className={clsx('np-Card-image', { imageClass })}>\n <Image src={imageSource} alt={imageAlt || ''} loading=\"lazy\" />\n </div>\n )}\n\n <PromoCardIndicator label={indicatorLabel} icon={getIconType()} isSmall={isSmall} />\n </BaseCard>\n );\n },\n) as PolymorphicPromoCard;\n\nexport default React.memo(PromoCard);\n"],"names":["PromoCard","forwardRef","className","description","defaultChecked","download","href","hrefLang","id","headingLevel","imageAlt","imageClass","imageSource","indicatorLabel","indicatorIcon","isChecked","isDisabled","onClick","onKeyDown","rel","tabIndex","target","testId","title","type","value","isSmall","useDisplayFont","anchorRef","anchorId","props","ref","state","onChange","contextIsDisabled","usePromoCardContext","checked","setChecked","useState","handleClick","fallbackId","useId","componentId","getIconType","undefined","commonClasses","clsx","commonProps","anchorProps","checkedProps","role","event","key","getTitle","titleContent","_jsx","children","titleProps","as","Display","Typography","DISPLAY_SMALL","Title","TITLE_SUBSECTION","useEffect","_jsxs","BaseCard","Check","size","Body","Image","src","alt","loading","PromoCardIndicator","label","icon","React","memo"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwMA,MAAMA,SAAS,gBAAsCC,UAAU,CAC7D,CACE;EACEC,SAAS;EACTC,WAAW;EACXC,cAAc;EACdC,QAAQ;EACRC,IAAI;EACJC,QAAQ;EACRC,EAAE;AACFC,EAAAA,YAAY,GAAG,IAAI;EACnBC,QAAQ;EACRC,UAAU;EACVC,WAAW;EACXC,cAAc;EACdC,aAAa;EACbC,SAAS;EACTC,UAAU;EACVC,OAAO;EACPC,SAAS;EACTC,GAAG;EACHC,QAAQ;EACRC,MAAM;EACNC,MAAM;EACNC,KAAK;EACLC,IAAI;EACJC,KAAK;EACLC,OAAO;AACPC,EAAAA,cAAc,GAAG,IAAI;EACrBC,SAAS;EACTC,QAAQ;EACR,GAAGC;AAAK,CACT,EACDC,GAAkB,KAChB;AACF;AACA;AACA;EACA,MAAM;IAAEC,KAAK;IAAEC,QAAQ;AAAEjB,IAAAA,UAAU,EAAEkB;GAAmB,GAAGC,mBAAmB,EAAE;AAChF,EAAA,MAAM,CAACC,OAAO,EAAEC,UAAU,CAAC,GAAGC,QAAQ,CACpCd,IAAI,KAAK,UAAU,GAAIpB,cAAc,IAAIW,SAAS,IAAI,KAAK,GAAI,KAAK,CACrE;EAED,MAAMwB,WAAW,GAAGA,MAAK;IACvB,IAAIf,IAAI,KAAK,OAAO,EAAE;AACpBS,MAAAA,QAAQ,CAAC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;AAACC,QAAAA,GAAG,EAAE3D,WAAY;QAAC4D,GAAG,EAAE9D,QAAQ,IAAI,EAAG;AAAC+D,QAAAA,OAAO,EAAC;OAAM;AAC9D,KAAK,CACN,eAEDlB,GAAA,CAACmB,kBAAkB,EAAA;AAACC,MAAAA,KAAK,EAAE9D,cAAe;MAAC+D,IAAI,EAAEjC,WAAW,EAAG;AAACjB,MAAAA,OAAO,EAAEA;AAAQ,KAAA,CACnF;AAAA,GAAU,CAAC;AAEf,CAAC,CACsB;AAEzB,kBAAA,aAAemD,cAAK,CAACC,IAAI,CAAC9E,SAAS,CAAC;;;;"}
@@ -25,6 +25,7 @@ var clsx = require('clsx');
25
25
  require('react-intl');
26
26
  require('../../common/closeButton/CloseButton.messages.js');
27
27
  var jsxRuntime = require('react/jsx-runtime');
28
+ var LiveRegion = require('../../common/liveRegion/LiveRegion.js');
28
29
  var StatusIcon = require('../../statusIcon/StatusIcon.js');
29
30
  var Body = require('../../body/Body.js');
30
31
  var Link = require('../../link/Link.js');
@@ -38,6 +39,7 @@ const InfoPrompt = ({
38
39
  title,
39
40
  description,
40
41
  className,
42
+ 'aria-live': ariaLive = 'polite',
41
43
  'data-testid': dataTestId,
42
44
  ...restProps
43
45
  }) => {
@@ -76,35 +78,39 @@ const InfoPrompt = ({
76
78
  sentiment: statusIconSentiment
77
79
  });
78
80
  };
79
- return /*#__PURE__*/jsxRuntime.jsx(PrimitivePrompt.PrimitivePrompt, {
80
- sentiment: sentiment$1,
81
- media: renderMedia(),
82
- "data-testid": dataTestId,
83
- className: clsx.clsx('wds-info-prompt', className),
84
- ...restProps,
85
- onTouchStart: handleTouchStart,
86
- onTouchEnd: handleTouchEnd,
87
- onTouchMove: handleTouchMove,
88
- onDismiss: onDismiss,
89
- children: /*#__PURE__*/jsxRuntime.jsxs("div", {
90
- className: "wds-info-prompt__content",
91
- children: [title && /*#__PURE__*/jsxRuntime.jsx(Body.default, {
92
- className: "wds-info-prompt__title",
93
- type: typography.Typography.BODY_LARGE_BOLD,
94
- as: "span",
95
- children: title
96
- }), /*#__PURE__*/jsxRuntime.jsx(Body.default, {
97
- as: "span",
98
- className: "wds-info-prompt__description",
99
- children: description
100
- }), action && /*#__PURE__*/jsxRuntime.jsx(Link.default, {
101
- href: action.href,
102
- target: action.target,
103
- type: typography.Typography.LINK_DEFAULT,
104
- className: "wds-info-prompt__action",
105
- onClick: action.onClick,
106
- children: action.label
107
- })]
81
+ // Render content directly in LiveRegion
82
+ return /*#__PURE__*/jsxRuntime.jsx(LiveRegion.LiveRegion, {
83
+ "aria-live": ariaLive,
84
+ children: /*#__PURE__*/jsxRuntime.jsx(PrimitivePrompt.PrimitivePrompt, {
85
+ sentiment: sentiment$1,
86
+ media: renderMedia(),
87
+ "data-testid": dataTestId,
88
+ className: clsx.clsx('wds-info-prompt', className),
89
+ ...restProps,
90
+ onTouchStart: handleTouchStart,
91
+ onTouchEnd: handleTouchEnd,
92
+ onTouchMove: handleTouchMove,
93
+ onDismiss: onDismiss,
94
+ children: /*#__PURE__*/jsxRuntime.jsxs("div", {
95
+ className: "wds-info-prompt__content",
96
+ children: [title && /*#__PURE__*/jsxRuntime.jsx(Body.default, {
97
+ className: "wds-info-prompt__title",
98
+ type: typography.Typography.BODY_LARGE_BOLD,
99
+ as: "span",
100
+ children: title
101
+ }), /*#__PURE__*/jsxRuntime.jsx(Body.default, {
102
+ as: "span",
103
+ className: "wds-info-prompt__description",
104
+ children: description
105
+ }), action && /*#__PURE__*/jsxRuntime.jsx(Link.default, {
106
+ href: action.href,
107
+ target: action.target,
108
+ type: typography.Typography.LINK_DEFAULT,
109
+ className: "wds-info-prompt__action",
110
+ onClick: action.onClick,
111
+ children: action.label
112
+ })]
113
+ })
108
114
  })
109
115
  });
110
116
  };
@@ -1 +1 @@
1
- {"version":3,"file":"InfoPrompt.js","sources":["../../../src/prompt/InfoPrompt/InfoPrompt.tsx"],"sourcesContent":["import { HTMLAttributes, ReactNode, useState } from 'react';\nimport { Sentiment, Typography } from '../../common';\nimport { GiftBox } from '@transferwise/icons';\nimport type { Sentiment as SurfaceSentiment } from '../../sentimentSurface';\nimport StatusIcon from '../../statusIcon';\nimport { clsx } from 'clsx';\nimport Body from '../../body';\nimport Link, { LinkProps } from '../../link';\nimport { PrimitivePrompt, PrimitivePromptProps } from '../PrimitivePrompt';\n\nexport type InfoPromptAction = Pick<LinkProps, 'href' | 'target' | 'onClick'> & {\n /**\n * The label text for the action link\n */\n label: string;\n};\n\nexport type InfoPromptMedia = {\n /**\n * The icon/image asset to display.\n * The asset should include its own accessibility attributes (e.g. title, aria-label) if it conveys meaning.\n */\n asset: ReactNode;\n};\n\nexport type InfoPromptProps = Omit<HTMLAttributes<HTMLDivElement>, 'title'> &\n Pick<PrimitivePromptProps, 'data-testid'> & {\n /**\n * The sentiment determines the colour scheme\n * @default 'neutral'\n */\n sentiment?: SurfaceSentiment;\n /**\n * Handler called when the close button is clicked.\n * If not provided, the close button is hidden.\n */\n onDismiss?: () => void;\n /**\n * Custom media to override the default status icon.\n * Success and proposition sentiments support 2 status variations: standard checkmark & confetti.\n */\n media?: InfoPromptMedia;\n /**\n * Action link to be displayed below the description\n */\n action?: InfoPromptAction;\n /**\n * Title content for the prompt\n */\n title?: string;\n /**\n * Description text for the prompt (required)\n */\n description: string;\n className?: string;\n };\n\n/**\n * InfoPrompt displays important contextual messages to users within a screen.\n * It provides a visually distinct way to communicate information, warnings, errors,\n * or positive feedback with optional actions and dismissal capabilities.\n *\n * Use this component to replace the deprecated Alert component.\n *\n * Guidance can be found in the [design system](https://wise.design/components/info-prompt).\n */\nexport const InfoPrompt = ({\n sentiment = 'neutral',\n onDismiss,\n media,\n action,\n title,\n description,\n className,\n 'data-testid': dataTestId,\n ...restProps\n}: InfoPromptProps) => {\n const [shouldFire, setShouldFire] = useState<boolean>();\n const statusIconSentiment =\n sentiment === 'success'\n ? Sentiment.POSITIVE\n : (sentiment as Exclude<SurfaceSentiment, 'proposition'>);\n\n const handleTouchStart = () => {\n setShouldFire(true);\n };\n\n const handleTouchEnd = () => {\n if (shouldFire && action?.href) {\n if (action.target === '_blank') {\n window.top?.open(action.href, '_blank', 'noopener, noreferrer');\n } else {\n window.top?.location.assign(action.href);\n }\n }\n setShouldFire(false);\n };\n\n const handleTouchMove = () => {\n setShouldFire(false);\n };\n\n const renderMedia = () => {\n if (media) {\n return <span className=\"wds-info-prompt__media\">{media.asset}</span>;\n }\n\n if (sentiment === 'proposition') {\n return <GiftBox size={24} />;\n }\n\n return <StatusIcon size={24} sentiment={statusIconSentiment} />;\n };\n\n return (\n <PrimitivePrompt\n sentiment={sentiment}\n media={renderMedia()}\n data-testid={dataTestId}\n className={clsx('wds-info-prompt', className)}\n {...restProps}\n onTouchStart={handleTouchStart}\n onTouchEnd={handleTouchEnd}\n onTouchMove={handleTouchMove}\n onDismiss={onDismiss}\n >\n <div className=\"wds-info-prompt__content\">\n {title && (\n <Body className=\"wds-info-prompt__title\" type={Typography.BODY_LARGE_BOLD} as=\"span\">\n {title}\n </Body>\n )}\n <Body as=\"span\" className=\"wds-info-prompt__description\">\n {description}\n </Body>\n {action && (\n <Link\n href={action.href}\n target={action.target}\n type={Typography.LINK_DEFAULT}\n className=\"wds-info-prompt__action\"\n onClick={action.onClick}\n >\n {action.label}\n </Link>\n )}\n </div>\n </PrimitivePrompt>\n );\n};\n"],"names":["InfoPrompt","sentiment","onDismiss","media","action","title","description","className","dataTestId","restProps","shouldFire","setShouldFire","useState","statusIconSentiment","Sentiment","POSITIVE","handleTouchStart","handleTouchEnd","href","target","window","top","open","location","assign","handleTouchMove","renderMedia","_jsx","children","asset","GiftBox","size","StatusIcon","PrimitivePrompt","clsx","onTouchStart","onTouchEnd","onTouchMove","_jsxs","Body","type","Typography","BODY_LARGE_BOLD","as","Link","LINK_DEFAULT","onClick","label"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkEO,MAAMA,UAAU,GAAGA,CAAC;AACzBC,aAAAA,WAAS,GAAG,SAAS;EACrBC,SAA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ACT,CACP;KACE;AACP,GAAiB,CAAC;AAEtB;;;;"}
1
+ {"version":3,"file":"InfoPrompt.js","sources":["../../../src/prompt/InfoPrompt/InfoPrompt.tsx"],"sourcesContent":["import { HTMLAttributes, ReactNode, useState } from 'react';\nimport { LiveRegion, Sentiment, Typography } from '../../common';\nimport type { AriaLive } from '../../common';\nimport { GiftBox } from '@transferwise/icons';\nimport type { Sentiment as SurfaceSentiment } from '../../sentimentSurface';\nimport StatusIcon from '../../statusIcon';\nimport { clsx } from 'clsx';\nimport Body from '../../body';\nimport Link, { LinkProps } from '../../link';\nimport { PrimitivePrompt, PrimitivePromptProps } from '../PrimitivePrompt';\n\nexport type InfoPromptAction = Pick<LinkProps, 'href' | 'target' | 'onClick'> & {\n /**\n * The label text for the action link\n */\n label: string;\n};\n\nexport type InfoPromptMedia = {\n /**\n * The icon/image asset to display.\n * The asset should include its own accessibility attributes (e.g. title, aria-label) if it conveys meaning.\n */\n asset: ReactNode;\n};\n\nexport type InfoPromptProps = Omit<HTMLAttributes<HTMLDivElement>, 'title' | 'aria-live' | 'role'> &\n Pick<PrimitivePromptProps, 'data-testid'> & {\n /**\n * The sentiment determines the colour scheme\n * @default 'neutral'\n */\n sentiment?: SurfaceSentiment;\n /**\n * Handler called when the close button is clicked.\n * If not provided, the close button is hidden.\n */\n onDismiss?: () => void;\n /**\n * Custom media to override the default status icon.\n * Success and proposition sentiments support 2 status variations: standard checkmark & confetti.\n */\n media?: InfoPromptMedia;\n /**\n * Action link to be displayed below the description\n */\n action?: InfoPromptAction;\n /**\n * Title content for the prompt\n */\n title?: string;\n /**\n * Description text for the prompt (required)\n */\n description: string;\n className?: string;\n /**\n * Sets the ARIA live region politeness level.\n * - `'polite'` — announced after the current speech (default)\n * - `'assertive'` — interrupts the current speech immediately\n * - `'off'` — disables the live region entirely\n * @default 'polite'\n */\n 'aria-live'?: AriaLive;\n };\n\n/**\n * InfoPrompt displays important contextual messages to users within a screen.\n * It provides a visually distinct way to communicate information, warnings, errors,\n * or positive feedback with optional actions and dismissal capabilities.\n *\n * Use this component to replace the deprecated Alert component.\n *\n * Guidance can be found in the [design system](https://wise.design/components/info-prompt).\n */\nexport const InfoPrompt = ({\n sentiment = 'neutral',\n onDismiss,\n media,\n action,\n title,\n description,\n className,\n 'aria-live': ariaLive = 'polite',\n 'data-testid': dataTestId,\n ...restProps\n}: InfoPromptProps) => {\n const [shouldFire, setShouldFire] = useState<boolean>();\n const statusIconSentiment =\n sentiment === 'success'\n ? Sentiment.POSITIVE\n : (sentiment as Exclude<SurfaceSentiment, 'proposition'>);\n\n const handleTouchStart = () => {\n setShouldFire(true);\n };\n\n const handleTouchEnd = () => {\n if (shouldFire && action?.href) {\n if (action.target === '_blank') {\n window.top?.open(action.href, '_blank', 'noopener, noreferrer');\n } else {\n window.top?.location.assign(action.href);\n }\n }\n setShouldFire(false);\n };\n\n const handleTouchMove = () => {\n setShouldFire(false);\n };\n\n const renderMedia = () => {\n if (media) {\n return <span className=\"wds-info-prompt__media\">{media.asset}</span>;\n }\n\n if (sentiment === 'proposition') {\n return <GiftBox size={24} />;\n }\n\n return <StatusIcon size={24} sentiment={statusIconSentiment} />;\n };\n\n // Render content directly in LiveRegion\n return (\n <LiveRegion aria-live={ariaLive}>\n <PrimitivePrompt\n sentiment={sentiment}\n media={renderMedia()}\n data-testid={dataTestId}\n className={clsx('wds-info-prompt', className)}\n {...restProps}\n onTouchStart={handleTouchStart}\n onTouchEnd={handleTouchEnd}\n onTouchMove={handleTouchMove}\n onDismiss={onDismiss}\n >\n <div className=\"wds-info-prompt__content\">\n {title && (\n <Body className=\"wds-info-prompt__title\" type={Typography.BODY_LARGE_BOLD} as=\"span\">\n {title}\n </Body>\n )}\n <Body as=\"span\" className=\"wds-info-prompt__description\">\n {description}\n </Body>\n {action && (\n <Link\n href={action.href}\n target={action.target}\n type={Typography.LINK_DEFAULT}\n className=\"wds-info-prompt__action\"\n onClick={action.onClick}\n >\n {action.label}\n </Link>\n )}\n </div>\n </PrimitivePrompt>\n </LiveRegion>\n );\n};\n"],"names":["InfoPrompt","sentiment","onDismiss","media","action","title","description","className","ariaLive","dataTestId","restProps","shouldFire","setShouldFire","useState","statusIconSentiment","Sentiment","POSITIVE","handleTouchStart","handleTouchEnd","href","target","window","top","open","location","assign","handleTouchMove","renderMedia","_jsx","children","asset","GiftBox","size","StatusIcon","LiveRegion","PrimitivePrompt","clsx","onTouchStart","onTouchEnd","onTouchMove","_jsxs","Body","type","Typography","BODY_LARGE_BOLD","as","Link","LINK_DEFAULT","onClick","label"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2EO,MAAMA,UAAU,GAAGA,CAAC;AACzBC,aAAAA,WAAS,GAAG,SAAS;EACrBC,SAAS;EACTC,KAAK;EACLC,MAAM;EACNC,KAAK;EACLC,WAAW;EACXC,SAAS;EACT,WAAW,EAAEC,QAAQ,GAAG,QAAQ;AAChC,EAAA,aAAa,EAAEC,UAAU;EACzB,GAAGC;AAAS,CACI,KAAI;EACpB,MAAM,CAACC,UAAU,EAAEC,aAAa,CAAC,GAAGC,cAAQ,EAAW;EACvD,MAAMC,mBAAmB,GACvBb,WAAS,KAAK,SAAS,GACnBc,mBAAS,CAACC,QAAQ,GACjBf,WAAsD;EAE7D,MAAMgB,gBAAgB,GAAGA,MAAK;IAC5BL,aAAa,CAAC,IAAI,CAAC;EACrB,CAAC;EAED,MAAMM,cAAc,GAAGA,MAAK;AAC1B,IAAA,IAAIP,UAAU,IAAIP,MAAM,EAAEe,IAAI,EAAE;AAC9B,MAAA,IAAIf,MAAM,CAACgB,MAAM,KAAK,QAAQ,EAAE;AAC9BC,QAAAA,MAAM,CAACC,GAAG,EAAEC,IAAI,CAACnB,MAAM,CAACe,IAAI,EAAE,QAAQ,EAAE,sBAAsB,CAAC;AACjE,MAAA,CAAC,MAAM;QACLE,MAAM,CAACC,GAAG,EAAEE,QAAQ,CAACC,MAAM,CAACrB,MAAM,CAACe,IAAI,CAAC;AAC1C,MAAA;AAC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AAClC,UAAAA,SAAS,EAAC,wBAAwB;UAACmC,IAAI,EAAEC,qBAAU,CAACC,eAAgB;AAACC,UAAAA,EAAE,EAAC,MAAM;AAAAhB,UAAAA,QAAA,EACjFxB;AAAK,SACF,CACP,eACDuB,cAAA,CAACa,YAAI,EAAA;AAACI,UAAAA,EAAE,EAAC,MAAM;AAACtC,UAAAA,SAAS,EAAC,8BAA8B;AAAAsB,UAAAA,QAAA,EACrDvB;AAAW,SACR,CACN,EAACF,MAAM,iBACLwB,cAAA,CAACkB,YAAI,EAAA;UACH3B,IAAI,EAAEf,MAAM,CAACe,IAAK;UAClBC,MAAM,EAAEhB,MAAM,CAACgB,MAAO;UACtBsB,IAAI,EAAEC,qBAAU,CAACI,YAAa;AAC9BxC,UAAAA,SAAS,EAAC,yBAAyB;UACnCyC,OAAO,EAAE5C,MAAM,CAAC4C,OAAQ;UAAAnB,QAAA,EAEvBzB,MAAM,CAAC6C;AAAK,SACT,CACP;OACE;KACU;AACnB,GAAY,CAAC;AAEjB;;;;"}
@@ -23,6 +23,7 @@ import { clsx } from 'clsx';
23
23
  import 'react-intl';
24
24
  import '../../common/closeButton/CloseButton.messages.mjs';
25
25
  import { jsx, jsxs } from 'react/jsx-runtime';
26
+ import { LiveRegion } from '../../common/liveRegion/LiveRegion.mjs';
26
27
  import StatusIcon from '../../statusIcon/StatusIcon.mjs';
27
28
  import Body from '../../body/Body.mjs';
28
29
  import Link from '../../link/Link.mjs';
@@ -36,6 +37,7 @@ const InfoPrompt = ({
36
37
  title,
37
38
  description,
38
39
  className,
40
+ 'aria-live': ariaLive = 'polite',
39
41
  'data-testid': dataTestId,
40
42
  ...restProps
41
43
  }) => {
@@ -74,35 +76,39 @@ const InfoPrompt = ({
74
76
  sentiment: statusIconSentiment
75
77
  });
76
78
  };
77
- return /*#__PURE__*/jsx(PrimitivePrompt, {
78
- sentiment: sentiment,
79
- media: renderMedia(),
80
- "data-testid": dataTestId,
81
- className: clsx('wds-info-prompt', className),
82
- ...restProps,
83
- onTouchStart: handleTouchStart,
84
- onTouchEnd: handleTouchEnd,
85
- onTouchMove: handleTouchMove,
86
- onDismiss: onDismiss,
87
- children: /*#__PURE__*/jsxs("div", {
88
- className: "wds-info-prompt__content",
89
- children: [title && /*#__PURE__*/jsx(Body, {
90
- className: "wds-info-prompt__title",
91
- type: Typography.BODY_LARGE_BOLD,
92
- as: "span",
93
- children: title
94
- }), /*#__PURE__*/jsx(Body, {
95
- as: "span",
96
- className: "wds-info-prompt__description",
97
- children: description
98
- }), action && /*#__PURE__*/jsx(Link, {
99
- href: action.href,
100
- target: action.target,
101
- type: Typography.LINK_DEFAULT,
102
- className: "wds-info-prompt__action",
103
- onClick: action.onClick,
104
- children: action.label
105
- })]
79
+ // Render content directly in LiveRegion
80
+ return /*#__PURE__*/jsx(LiveRegion, {
81
+ "aria-live": ariaLive,
82
+ children: /*#__PURE__*/jsx(PrimitivePrompt, {
83
+ sentiment: sentiment,
84
+ media: renderMedia(),
85
+ "data-testid": dataTestId,
86
+ className: clsx('wds-info-prompt', className),
87
+ ...restProps,
88
+ onTouchStart: handleTouchStart,
89
+ onTouchEnd: handleTouchEnd,
90
+ onTouchMove: handleTouchMove,
91
+ onDismiss: onDismiss,
92
+ children: /*#__PURE__*/jsxs("div", {
93
+ className: "wds-info-prompt__content",
94
+ children: [title && /*#__PURE__*/jsx(Body, {
95
+ className: "wds-info-prompt__title",
96
+ type: Typography.BODY_LARGE_BOLD,
97
+ as: "span",
98
+ children: title
99
+ }), /*#__PURE__*/jsx(Body, {
100
+ as: "span",
101
+ className: "wds-info-prompt__description",
102
+ children: description
103
+ }), action && /*#__PURE__*/jsx(Link, {
104
+ href: action.href,
105
+ target: action.target,
106
+ type: Typography.LINK_DEFAULT,
107
+ className: "wds-info-prompt__action",
108
+ onClick: action.onClick,
109
+ children: action.label
110
+ })]
111
+ })
106
112
  })
107
113
  });
108
114
  };
@@ -1 +1 @@
1
- {"version":3,"file":"InfoPrompt.mjs","sources":["../../../src/prompt/InfoPrompt/InfoPrompt.tsx"],"sourcesContent":["import { HTMLAttributes, ReactNode, useState } from 'react';\nimport { Sentiment, Typography } from '../../common';\nimport { GiftBox } from '@transferwise/icons';\nimport type { Sentiment as SurfaceSentiment } from '../../sentimentSurface';\nimport StatusIcon from '../../statusIcon';\nimport { clsx } from 'clsx';\nimport Body from '../../body';\nimport Link, { LinkProps } from '../../link';\nimport { PrimitivePrompt, PrimitivePromptProps } from '../PrimitivePrompt';\n\nexport type InfoPromptAction = Pick<LinkProps, 'href' | 'target' | 'onClick'> & {\n /**\n * The label text for the action link\n */\n label: string;\n};\n\nexport type InfoPromptMedia = {\n /**\n * The icon/image asset to display.\n * The asset should include its own accessibility attributes (e.g. title, aria-label) if it conveys meaning.\n */\n asset: ReactNode;\n};\n\nexport type InfoPromptProps = Omit<HTMLAttributes<HTMLDivElement>, 'title'> &\n Pick<PrimitivePromptProps, 'data-testid'> & {\n /**\n * The sentiment determines the colour scheme\n * @default 'neutral'\n */\n sentiment?: SurfaceSentiment;\n /**\n * Handler called when the close button is clicked.\n * If not provided, the close button is hidden.\n */\n onDismiss?: () => void;\n /**\n * Custom media to override the default status icon.\n * Success and proposition sentiments support 2 status variations: standard checkmark & confetti.\n */\n media?: InfoPromptMedia;\n /**\n * Action link to be displayed below the description\n */\n action?: InfoPromptAction;\n /**\n * Title content for the prompt\n */\n title?: string;\n /**\n * Description text for the prompt (required)\n */\n description: string;\n className?: string;\n };\n\n/**\n * InfoPrompt displays important contextual messages to users within a screen.\n * It provides a visually distinct way to communicate information, warnings, errors,\n * or positive feedback with optional actions and dismissal capabilities.\n *\n * Use this component to replace the deprecated Alert component.\n *\n * Guidance can be found in the [design system](https://wise.design/components/info-prompt).\n */\nexport const InfoPrompt = ({\n sentiment = 'neutral',\n onDismiss,\n media,\n action,\n title,\n description,\n className,\n 'data-testid': dataTestId,\n ...restProps\n}: InfoPromptProps) => {\n const [shouldFire, setShouldFire] = useState<boolean>();\n const statusIconSentiment =\n sentiment === 'success'\n ? Sentiment.POSITIVE\n : (sentiment as Exclude<SurfaceSentiment, 'proposition'>);\n\n const handleTouchStart = () => {\n setShouldFire(true);\n };\n\n const handleTouchEnd = () => {\n if (shouldFire && action?.href) {\n if (action.target === '_blank') {\n window.top?.open(action.href, '_blank', 'noopener, noreferrer');\n } else {\n window.top?.location.assign(action.href);\n }\n }\n setShouldFire(false);\n };\n\n const handleTouchMove = () => {\n setShouldFire(false);\n };\n\n const renderMedia = () => {\n if (media) {\n return <span className=\"wds-info-prompt__media\">{media.asset}</span>;\n }\n\n if (sentiment === 'proposition') {\n return <GiftBox size={24} />;\n }\n\n return <StatusIcon size={24} sentiment={statusIconSentiment} />;\n };\n\n return (\n <PrimitivePrompt\n sentiment={sentiment}\n media={renderMedia()}\n data-testid={dataTestId}\n className={clsx('wds-info-prompt', className)}\n {...restProps}\n onTouchStart={handleTouchStart}\n onTouchEnd={handleTouchEnd}\n onTouchMove={handleTouchMove}\n onDismiss={onDismiss}\n >\n <div className=\"wds-info-prompt__content\">\n {title && (\n <Body className=\"wds-info-prompt__title\" type={Typography.BODY_LARGE_BOLD} as=\"span\">\n {title}\n </Body>\n )}\n <Body as=\"span\" className=\"wds-info-prompt__description\">\n {description}\n </Body>\n {action && (\n <Link\n href={action.href}\n target={action.target}\n type={Typography.LINK_DEFAULT}\n className=\"wds-info-prompt__action\"\n onClick={action.onClick}\n >\n {action.label}\n </Link>\n )}\n </div>\n </PrimitivePrompt>\n );\n};\n"],"names":["InfoPrompt","sentiment","onDismiss","media","action","title","description","className","dataTestId","restProps","shouldFire","setShouldFire","useState","statusIconSentiment","Sentiment","POSITIVE","handleTouchStart","handleTouchEnd","href","target","window","top","open","location","assign","handleTouchMove","renderMedia","_jsx","children","asset","GiftBox","size","StatusIcon","PrimitivePrompt","clsx","onTouchStart","onTouchEnd","onTouchMove","_jsxs","Body","type","Typography","BODY_LARGE_BOLD","as","Link","LINK_DEFAULT","onClick","label"],"mappings":";;;;;;;;;;;;;;;;;;;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C,OAAO,EAAE1C,MAAM,CAAC0C,OAAQ;QAAAlB,QAAA,EAEvBxB,MAAM,CAAC2C;AAAK,OACT,CACP;KACE;AACP,GAAiB,CAAC;AAEtB;;;;"}
1
+ {"version":3,"file":"InfoPrompt.mjs","sources":["../../../src/prompt/InfoPrompt/InfoPrompt.tsx"],"sourcesContent":["import { HTMLAttributes, ReactNode, useState } from 'react';\nimport { LiveRegion, Sentiment, Typography } from '../../common';\nimport type { AriaLive } from '../../common';\nimport { GiftBox } from '@transferwise/icons';\nimport type { Sentiment as SurfaceSentiment } from '../../sentimentSurface';\nimport StatusIcon from '../../statusIcon';\nimport { clsx } from 'clsx';\nimport Body from '../../body';\nimport Link, { LinkProps } from '../../link';\nimport { PrimitivePrompt, PrimitivePromptProps } from '../PrimitivePrompt';\n\nexport type InfoPromptAction = Pick<LinkProps, 'href' | 'target' | 'onClick'> & {\n /**\n * The label text for the action link\n */\n label: string;\n};\n\nexport type InfoPromptMedia = {\n /**\n * The icon/image asset to display.\n * The asset should include its own accessibility attributes (e.g. title, aria-label) if it conveys meaning.\n */\n asset: ReactNode;\n};\n\nexport type InfoPromptProps = Omit<HTMLAttributes<HTMLDivElement>, 'title' | 'aria-live' | 'role'> &\n Pick<PrimitivePromptProps, 'data-testid'> & {\n /**\n * The sentiment determines the colour scheme\n * @default 'neutral'\n */\n sentiment?: SurfaceSentiment;\n /**\n * Handler called when the close button is clicked.\n * If not provided, the close button is hidden.\n */\n onDismiss?: () => void;\n /**\n * Custom media to override the default status icon.\n * Success and proposition sentiments support 2 status variations: standard checkmark & confetti.\n */\n media?: InfoPromptMedia;\n /**\n * Action link to be displayed below the description\n */\n action?: InfoPromptAction;\n /**\n * Title content for the prompt\n */\n title?: string;\n /**\n * Description text for the prompt (required)\n */\n description: string;\n className?: string;\n /**\n * Sets the ARIA live region politeness level.\n * - `'polite'` — announced after the current speech (default)\n * - `'assertive'` — interrupts the current speech immediately\n * - `'off'` — disables the live region entirely\n * @default 'polite'\n */\n 'aria-live'?: AriaLive;\n };\n\n/**\n * InfoPrompt displays important contextual messages to users within a screen.\n * It provides a visually distinct way to communicate information, warnings, errors,\n * or positive feedback with optional actions and dismissal capabilities.\n *\n * Use this component to replace the deprecated Alert component.\n *\n * Guidance can be found in the [design system](https://wise.design/components/info-prompt).\n */\nexport const InfoPrompt = ({\n sentiment = 'neutral',\n onDismiss,\n media,\n action,\n title,\n description,\n className,\n 'aria-live': ariaLive = 'polite',\n 'data-testid': dataTestId,\n ...restProps\n}: InfoPromptProps) => {\n const [shouldFire, setShouldFire] = useState<boolean>();\n const statusIconSentiment =\n sentiment === 'success'\n ? Sentiment.POSITIVE\n : (sentiment as Exclude<SurfaceSentiment, 'proposition'>);\n\n const handleTouchStart = () => {\n setShouldFire(true);\n };\n\n const handleTouchEnd = () => {\n if (shouldFire && action?.href) {\n if (action.target === '_blank') {\n window.top?.open(action.href, '_blank', 'noopener, noreferrer');\n } else {\n window.top?.location.assign(action.href);\n }\n }\n setShouldFire(false);\n };\n\n const handleTouchMove = () => {\n setShouldFire(false);\n };\n\n const renderMedia = () => {\n if (media) {\n return <span className=\"wds-info-prompt__media\">{media.asset}</span>;\n }\n\n if (sentiment === 'proposition') {\n return <GiftBox size={24} />;\n }\n\n return <StatusIcon size={24} sentiment={statusIconSentiment} />;\n };\n\n // Render content directly in LiveRegion\n return (\n <LiveRegion aria-live={ariaLive}>\n <PrimitivePrompt\n sentiment={sentiment}\n media={renderMedia()}\n data-testid={dataTestId}\n className={clsx('wds-info-prompt', className)}\n {...restProps}\n onTouchStart={handleTouchStart}\n onTouchEnd={handleTouchEnd}\n onTouchMove={handleTouchMove}\n onDismiss={onDismiss}\n >\n <div className=\"wds-info-prompt__content\">\n {title && (\n <Body className=\"wds-info-prompt__title\" type={Typography.BODY_LARGE_BOLD} as=\"span\">\n {title}\n </Body>\n )}\n <Body as=\"span\" className=\"wds-info-prompt__description\">\n {description}\n </Body>\n {action && (\n <Link\n href={action.href}\n target={action.target}\n type={Typography.LINK_DEFAULT}\n className=\"wds-info-prompt__action\"\n onClick={action.onClick}\n >\n {action.label}\n </Link>\n )}\n </div>\n </PrimitivePrompt>\n </LiveRegion>\n );\n};\n"],"names":["InfoPrompt","sentiment","onDismiss","media","action","title","description","className","ariaLive","dataTestId","restProps","shouldFire","setShouldFire","useState","statusIconSentiment","Sentiment","POSITIVE","handleTouchStart","handleTouchEnd","href","target","window","top","open","location","assign","handleTouchMove","renderMedia","_jsx","children","asset","GiftBox","size","StatusIcon","LiveRegion","PrimitivePrompt","clsx","onTouchStart","onTouchEnd","onTouchMove","_jsxs","Body","type","Typography","BODY_LARGE_BOLD","as","Link","LINK_DEFAULT","onClick","label"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2EO,MAAMA,UAAU,GAAGA,CAAC;AACzBC,EAAAA,SAAS,GAAG,SAAS;EACrBC,SAAS;EACTC,KAAK;EACLC,MAAM;EACNC,KAAK;EACLC,WAAW;EACXC,SAAS;EACT,WAAW,EAAEC,QAAQ,GAAG,QAAQ;AAChC,EAAA,aAAa,EAAEC,UAAU;EACzB,GAAGC;AAAS,CACI,KAAI;EACpB,MAAM,CAACC,UAAU,EAAEC,aAAa,CAAC,GAAGC,QAAQ,EAAW;EACvD,MAAMC,mBAAmB,GACvBb,SAAS,KAAK,SAAS,GACnBc,SAAS,CAACC,QAAQ,GACjBf,SAAsD;EAE7D,MAAMgB,gBAAgB,GAAGA,MAAK;IAC5BL,aAAa,CAAC,IAAI,CAAC;EACrB,CAAC;EAED,MAAMM,cAAc,GAAGA,MAAK;AAC1B,IAAA,IAAIP,UAAU,IAAIP,MAAM,EAAEe,IAAI,EAAE;AAC9B,MAAA,IAAIf,MAAM,CAACgB,MAAM,KAAK,QAAQ,EAAE;AAC9BC,QAAAA,MAAM,CAACC,GAAG,EAAEC,IAAI,CAACnB,MAAM,CAACe,IAAI,EAAE,QAAQ,EAAE,sBAAsB,CAAC;AACjE,MAAA,CAAC,MAAM;QACLE,MAAM,CA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0B;AAAAsB,QAAAA,QAAA,EAAA,CACtCxB,KAAK,iBACJuB,GAAA,CAACa,IAAI,EAAA;AAAClC,UAAAA,SAAS,EAAC,wBAAwB;UAACmC,IAAI,EAAEC,UAAU,CAACC,eAAgB;AAACC,UAAAA,EAAE,EAAC,MAAM;AAAAhB,UAAAA,QAAA,EACjFxB;AAAK,SACF,CACP,eACDuB,GAAA,CAACa,IAAI,EAAA;AAACI,UAAAA,EAAE,EAAC,MAAM;AAACtC,UAAAA,SAAS,EAAC,8BAA8B;AAAAsB,UAAAA,QAAA,EACrDvB;AAAW,SACR,CACN,EAACF,MAAM,iBACLwB,GAAA,CAACkB,IAAI,EAAA;UACH3B,IAAI,EAAEf,MAAM,CAACe,IAAK;UAClBC,MAAM,EAAEhB,MAAM,CAACgB,MAAO;UACtBsB,IAAI,EAAEC,UAAU,CAACI,YAAa;AAC9BxC,UAAAA,SAAS,EAAC,yBAAyB;UACnCyC,OAAO,EAAE5C,MAAM,CAAC4C,OAAQ;UAAAnB,QAAA,EAEvBzB,MAAM,CAAC6C;AAAK,SACT,CACP;OACE;KACU;AACnB,GAAY,CAAC;AAEjB;;;;"}
@@ -4,6 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var React = require('react');
6
6
  var clsx = require('clsx');
7
+ var componentsTheming = require('@wise/components-theming');
7
8
  var jsxRuntime = require('react/jsx-runtime');
8
9
 
9
10
  const SentimentSurface = /*#__PURE__*/React.forwardRef(function SentimentSurface({
@@ -20,7 +21,10 @@ const SentimentSurface = /*#__PURE__*/React.forwardRef(function SentimentSurface
20
21
  }, ref) {
21
22
  const Element = as ?? 'div';
22
23
  const BASE_CLASS = 'wds-sentiment-surface';
23
- const classNames = clsx.clsx(BASE_CLASS, `${BASE_CLASS}-${sentiment}-${emphasis}`, hasBaseStyles && `${BASE_CLASS}--hasBaseStyles`, className);
24
+ const {
25
+ className: closestBrandTheme
26
+ } = componentsTheming.useTheme();
27
+ const classNames = clsx.clsx(closestBrandTheme, BASE_CLASS, `${BASE_CLASS}-${sentiment}-${emphasis}`, hasBaseStyles && `${BASE_CLASS}--hasBaseStyles`, className);
24
28
  const sentimentProps = {
25
29
  ref,
26
30
  id,
@@ -1 +1 @@
1
- {"version":3,"file":"SentimentSurface.js","sources":["../../src/sentimentSurface/SentimentSurface.tsx"],"sourcesContent":["import { forwardRef, ElementType, ForwardedRef } from 'react';\nimport { clsx } from 'clsx';\n\nimport {\n SentimentSurfaceComponentProps,\n SentimentSurfaceComponent,\n} from './SentimentSurface.types';\n\n/**\n * SentimentSurface is a polymorphic container component that exposes and, optionally, applies\n * contextual colour tokens as CSS custom properties, based on sentiment types (`negative`,\n * `warning`, `neutral`, `success`, `proposition`).\n *\n * @param {ElementType} [as='div'] - Optional prop to override the HTML element rendered.\n * @param {Sentiment} sentiment - Required prop to set the sentiment type (negative, warning, neutral, success, proposition).\n * @param {Emphasis} [emphasis='base'] - Optional prop to specify the emphasis level (base or elevated).\n * @param {boolean} [hasBaseStyles=true] - If true, sets the `background-color` and `color` on the container. Otherwise, only exposes the tokens as CSS custom properties without rendering.\n * @param {ReactNode} [children] - Content to render inside the surface.\n * @param {string} [className] - Additional CSS classes to apply.\n * @param {CSSProperties} [style] - Inline styles to apply.\n * @param {string} [id] - Unique identifier for the component.\n * @param {string} [data-testid] - A unique string that appears as data attribute `data-testid` in the rendered code.\n *\n * @component\n * @example\n * ```tsx\n * // Basic usage with negative sentiment\n * <SentimentSurface sentiment=\"negative\">\n * Your payment has failed\n * </SentimentSurface>\n * ```\n *\n * @see {@link SentimentSurface} for further information.\n * @see {@link https://storybook.wise.design/?path=/docs/sentiment-surface--docs|Storybook Wise Design}\n */\n// @ts-expect-error - Generic forwardRef limitation. See: https://fettblog.eu/typescript-react-generic-forward-refs/\nconst SentimentSurface: SentimentSurfaceComponent = forwardRef(function SentimentSurface<\n T extends ElementType = 'div',\n>(\n {\n as,\n sentiment,\n emphasis = 'base',\n hasBaseStyles = true,\n style,\n className,\n children,\n id,\n 'data-testid': dataTestId,\n ...props\n }: SentimentSurfaceComponentProps<T>,\n ref: ForwardedRef<HTMLElement>,\n) {\n const Element = as ?? 'div';\n const BASE_CLASS = 'wds-sentiment-surface';\n const classNames = clsx(\n BASE_CLASS,\n `${BASE_CLASS}-${sentiment}-${emphasis}`,\n hasBaseStyles && `${BASE_CLASS}--hasBaseStyles`,\n className,\n );\n const sentimentProps = {\n ref,\n id,\n 'data-testid': dataTestId,\n className: classNames,\n style,\n ...props,\n };\n\n return (\n // @ts-expect-error - Generic forwardRef limitation. See: https://fettblog.eu/typescript-react-generic-forward-refs/\n <Element {...sentimentProps}>{children}</Element>\n );\n});\n\nSentimentSurface.displayName = 'SentimentSurface';\n\nexport default SentimentSurface;\n"],"names":["SentimentSurface","forwardRef","as","sentiment","emphasis","hasBaseStyles","style","className","children","id","dataTestId","props","ref","Element","BASE_CLASS","classNames","clsx","sentimentProps","_jsx","displayName"],"mappings":";;;;;;;;AAoCA,MAAMA,gBAAgB,gBAA8BC,gBAAU,CAAC,SAASD,gBAAgBA,CAGtF;EACEE,EAAE;EACFC,SAAS;AACTC,EAAAA,QAAQ,GAAG,MAAM;AACjBC,EAAAA,aAAa,GAAG,IAAI;EACpBC,KAAK;EACLC,SAAS;EACTC,QAAQ;EACRC,EAAE;AACF,EAAA,aAAa,EAAEC,UAAU;EACzB,GAAGC;AAAK,CAC0B,EACpCC,GAA8B,EAAA;AAE9B,EAAA,MAAMC,OAAO,GAAGX,EAAE,IAAI,KAAK;EAC3B,MAAMY,UAAU,GAAG,uBAAuB;EAC1C,MAAMC,UAAU,GAAGC,SAAI,CACrBF,UAAU,EACV,CAAA,EAAGA,UAAU,CAAA,CAAA,EAAIX,SAAS,IAAIC,QAAQ,CAAA,CAAE,EACxCC,aAAa,IAAI,GAAGS,UAAU,CAAA,eAAA,CAAiB,EAC/CP,SAAS,CACV;AACD,EAAA,MAAMU,cAAc,GAAG;IACrBL,GAAG;IACHH,EAAE;AACF,IAAA,aAAa,EAAEC,UAAU;AACzBH,IAAAA,SAAS,EAAEQ,UAAU;IACrBT,KAAK;IACL,GAAGK;GACJ;AAED,EAAA;AAAA;AACE;AACAO,IAAAA,cAAA,CAACL,OAAO,EAAA;AAAA,MAAA,GAAKI,cAAc;AAAAT,MAAAA,QAAA,EAAGA;KAAkB;AAAC;AAErD,CAAC;AAEDR,gBAAgB,CAACmB,WAAW,GAAG,kBAAkB;;;;"}
1
+ {"version":3,"file":"SentimentSurface.js","sources":["../../src/sentimentSurface/SentimentSurface.tsx"],"sourcesContent":["import { forwardRef, ElementType, ForwardedRef } from 'react';\nimport { clsx } from 'clsx';\n\nimport {\n SentimentSurfaceComponentProps,\n SentimentSurfaceComponent,\n} from './SentimentSurface.types';\nimport { useTheme } from '@wise/components-theming';\n\n/**\n * SentimentSurface is a polymorphic container component that exposes and, optionally, applies\n * contextual colour tokens as CSS custom properties, based on sentiment types (`negative`,\n * `warning`, `neutral`, `success`, `proposition`).\n *\n * @param {ElementType} [as='div'] - Optional prop to override the HTML element rendered.\n * @param {Sentiment} sentiment - Required prop to set the sentiment type (negative, warning, neutral, success, proposition).\n * @param {Emphasis} [emphasis='base'] - Optional prop to specify the emphasis level (base or elevated).\n * @param {boolean} [hasBaseStyles=true] - If true, sets the `background-color` and `color` on the container. Otherwise, only exposes the tokens as CSS custom properties without rendering.\n * @param {ReactNode} [children] - Content to render inside the surface.\n * @param {string} [className] - Additional CSS classes to apply.\n * @param {CSSProperties} [style] - Inline styles to apply.\n * @param {string} [id] - Unique identifier for the component.\n * @param {string} [data-testid] - A unique string that appears as data attribute `data-testid` in the rendered code.\n *\n * @component\n * @example\n * ```tsx\n * // Basic usage with negative sentiment\n * <SentimentSurface sentiment=\"negative\">\n * Your payment has failed\n * </SentimentSurface>\n * ```\n *\n * @see {@link SentimentSurface} for further information.\n * @see {@link https://storybook.wise.design/?path=/docs/sentiment-surface--docs|Storybook Wise Design}\n */\n// @ts-expect-error - Generic forwardRef limitation. See: https://fettblog.eu/typescript-react-generic-forward-refs/\nconst SentimentSurface: SentimentSurfaceComponent = forwardRef(function SentimentSurface<\n T extends ElementType = 'div',\n>(\n {\n as,\n sentiment,\n emphasis = 'base',\n hasBaseStyles = true,\n style,\n className,\n children,\n id,\n 'data-testid': dataTestId,\n ...props\n }: SentimentSurfaceComponentProps<T>,\n ref: ForwardedRef<HTMLElement>,\n) {\n const Element = as ?? 'div';\n const BASE_CLASS = 'wds-sentiment-surface';\n const { className: closestBrandTheme } = useTheme();\n const classNames = clsx(\n closestBrandTheme,\n BASE_CLASS,\n `${BASE_CLASS}-${sentiment}-${emphasis}`,\n hasBaseStyles && `${BASE_CLASS}--hasBaseStyles`,\n className,\n );\n const sentimentProps = {\n ref,\n id,\n 'data-testid': dataTestId,\n className: classNames,\n style,\n ...props,\n };\n\n return (\n // @ts-expect-error - Generic forwardRef limitation. See: https://fettblog.eu/typescript-react-generic-forward-refs/\n <Element {...sentimentProps}>{children}</Element>\n );\n});\n\nSentimentSurface.displayName = 'SentimentSurface';\n\nexport default SentimentSurface;\n"],"names":["SentimentSurface","forwardRef","as","sentiment","emphasis","hasBaseStyles","style","className","children","id","dataTestId","props","ref","Element","BASE_CLASS","closestBrandTheme","useTheme","classNames","clsx","sentimentProps","_jsx","displayName"],"mappings":";;;;;;;;;AAqCA,MAAMA,gBAAgB,gBAA8BC,gBAAU,CAAC,SAASD,gBAAgBA,CAGtF;EACEE,EAAE;EACFC,SAAS;AACTC,EAAAA,QAAQ,GAAG,MAAM;AACjBC,EAAAA,aAAa,GAAG,IAAI;EACpBC,KAAK;EACLC,SAAS;EACTC,QAAQ;EACRC,EAAE;AACF,EAAA,aAAa,EAAEC,UAAU;EACzB,GAAGC;AAAK,CAC0B,EACpCC,GAA8B,EAAA;AAE9B,EAAA,MAAMC,OAAO,GAAGX,EAAE,IAAI,KAAK;EAC3B,MAAMY,UAAU,GAAG,uBAAuB;EAC1C,MAAM;AAAEP,IAAAA,SAAS,EAAEQ;GAAmB,GAAGC,0BAAQ,EAAE;EACnD,MAAMC,UAAU,GAAGC,SAAI,CACrBH,iBAAiB,EACjBD,UAAU,EACV,CAAA,EAAGA,UAAU,CAAA,CAAA,EAAIX,SAAS,CAAA,CAAA,EAAIC,QAAQ,CAAA,CAAE,EACxCC,aAAa,IAAI,GAAGS,UAAU,CAAA,eAAA,CAAiB,EAC/CP,SAAS,CACV;AACD,EAAA,MAAMY,cAAc,GAAG;IACrBP,GAAG;IACHH,EAAE;AACF,IAAA,aAAa,EAAEC,UAAU;AACzBH,IAAAA,SAAS,EAAEU,UAAU;IACrBX,KAAK;IACL,GAAGK;GACJ;AAED,EAAA;AAAA;AACE;AACAS,IAAAA,cAAA,CAACP,OAAO,EAAA;AAAA,MAAA,GAAKM,cAAc;AAAAX,MAAAA,QAAA,EAAGA;KAAkB;AAAC;AAErD,CAAC;AAEDR,gBAAgB,CAACqB,WAAW,GAAG,kBAAkB;;;;"}
@@ -1,5 +1,6 @@
1
1
  import { forwardRef } from 'react';
2
2
  import { clsx } from 'clsx';
3
+ import { useTheme } from '@wise/components-theming';
3
4
  import { jsx } from 'react/jsx-runtime';
4
5
 
5
6
  const SentimentSurface = /*#__PURE__*/forwardRef(function SentimentSurface({
@@ -16,7 +17,10 @@ const SentimentSurface = /*#__PURE__*/forwardRef(function SentimentSurface({
16
17
  }, ref) {
17
18
  const Element = as ?? 'div';
18
19
  const BASE_CLASS = 'wds-sentiment-surface';
19
- const classNames = clsx(BASE_CLASS, `${BASE_CLASS}-${sentiment}-${emphasis}`, hasBaseStyles && `${BASE_CLASS}--hasBaseStyles`, className);
20
+ const {
21
+ className: closestBrandTheme
22
+ } = useTheme();
23
+ const classNames = clsx(closestBrandTheme, BASE_CLASS, `${BASE_CLASS}-${sentiment}-${emphasis}`, hasBaseStyles && `${BASE_CLASS}--hasBaseStyles`, className);
20
24
  const sentimentProps = {
21
25
  ref,
22
26
  id,
@@ -1 +1 @@
1
- {"version":3,"file":"SentimentSurface.mjs","sources":["../../src/sentimentSurface/SentimentSurface.tsx"],"sourcesContent":["import { forwardRef, ElementType, ForwardedRef } from 'react';\nimport { clsx } from 'clsx';\n\nimport {\n SentimentSurfaceComponentProps,\n SentimentSurfaceComponent,\n} from './SentimentSurface.types';\n\n/**\n * SentimentSurface is a polymorphic container component that exposes and, optionally, applies\n * contextual colour tokens as CSS custom properties, based on sentiment types (`negative`,\n * `warning`, `neutral`, `success`, `proposition`).\n *\n * @param {ElementType} [as='div'] - Optional prop to override the HTML element rendered.\n * @param {Sentiment} sentiment - Required prop to set the sentiment type (negative, warning, neutral, success, proposition).\n * @param {Emphasis} [emphasis='base'] - Optional prop to specify the emphasis level (base or elevated).\n * @param {boolean} [hasBaseStyles=true] - If true, sets the `background-color` and `color` on the container. Otherwise, only exposes the tokens as CSS custom properties without rendering.\n * @param {ReactNode} [children] - Content to render inside the surface.\n * @param {string} [className] - Additional CSS classes to apply.\n * @param {CSSProperties} [style] - Inline styles to apply.\n * @param {string} [id] - Unique identifier for the component.\n * @param {string} [data-testid] - A unique string that appears as data attribute `data-testid` in the rendered code.\n *\n * @component\n * @example\n * ```tsx\n * // Basic usage with negative sentiment\n * <SentimentSurface sentiment=\"negative\">\n * Your payment has failed\n * </SentimentSurface>\n * ```\n *\n * @see {@link SentimentSurface} for further information.\n * @see {@link https://storybook.wise.design/?path=/docs/sentiment-surface--docs|Storybook Wise Design}\n */\n// @ts-expect-error - Generic forwardRef limitation. See: https://fettblog.eu/typescript-react-generic-forward-refs/\nconst SentimentSurface: SentimentSurfaceComponent = forwardRef(function SentimentSurface<\n T extends ElementType = 'div',\n>(\n {\n as,\n sentiment,\n emphasis = 'base',\n hasBaseStyles = true,\n style,\n className,\n children,\n id,\n 'data-testid': dataTestId,\n ...props\n }: SentimentSurfaceComponentProps<T>,\n ref: ForwardedRef<HTMLElement>,\n) {\n const Element = as ?? 'div';\n const BASE_CLASS = 'wds-sentiment-surface';\n const classNames = clsx(\n BASE_CLASS,\n `${BASE_CLASS}-${sentiment}-${emphasis}`,\n hasBaseStyles && `${BASE_CLASS}--hasBaseStyles`,\n className,\n );\n const sentimentProps = {\n ref,\n id,\n 'data-testid': dataTestId,\n className: classNames,\n style,\n ...props,\n };\n\n return (\n // @ts-expect-error - Generic forwardRef limitation. See: https://fettblog.eu/typescript-react-generic-forward-refs/\n <Element {...sentimentProps}>{children}</Element>\n );\n});\n\nSentimentSurface.displayName = 'SentimentSurface';\n\nexport default SentimentSurface;\n"],"names":["SentimentSurface","forwardRef","as","sentiment","emphasis","hasBaseStyles","style","className","children","id","dataTestId","props","ref","Element","BASE_CLASS","classNames","clsx","sentimentProps","_jsx","displayName"],"mappings":";;;;AAoCA,MAAMA,gBAAgB,gBAA8BC,UAAU,CAAC,SAASD,gBAAgBA,CAGtF;EACEE,EAAE;EACFC,SAAS;AACTC,EAAAA,QAAQ,GAAG,MAAM;AACjBC,EAAAA,aAAa,GAAG,IAAI;EACpBC,KAAK;EACLC,SAAS;EACTC,QAAQ;EACRC,EAAE;AACF,EAAA,aAAa,EAAEC,UAAU;EACzB,GAAGC;AAAK,CAC0B,EACpCC,GAA8B,EAAA;AAE9B,EAAA,MAAMC,OAAO,GAAGX,EAAE,IAAI,KAAK;EAC3B,MAAMY,UAAU,GAAG,uBAAuB;EAC1C,MAAMC,UAAU,GAAGC,IAAI,CACrBF,UAAU,EACV,CAAA,EAAGA,UAAU,CAAA,CAAA,EAAIX,SAAS,IAAIC,QAAQ,CAAA,CAAE,EACxCC,aAAa,IAAI,GAAGS,UAAU,CAAA,eAAA,CAAiB,EAC/CP,SAAS,CACV;AACD,EAAA,MAAMU,cAAc,GAAG;IACrBL,GAAG;IACHH,EAAE;AACF,IAAA,aAAa,EAAEC,UAAU;AACzBH,IAAAA,SAAS,EAAEQ,UAAU;IACrBT,KAAK;IACL,GAAGK;GACJ;AAED,EAAA;AAAA;AACE;AACAO,IAAAA,GAAA,CAACL,OAAO,EAAA;AAAA,MAAA,GAAKI,cAAc;AAAAT,MAAAA,QAAA,EAAGA;KAAkB;AAAC;AAErD,CAAC;AAEDR,gBAAgB,CAACmB,WAAW,GAAG,kBAAkB;;;;"}
1
+ {"version":3,"file":"SentimentSurface.mjs","sources":["../../src/sentimentSurface/SentimentSurface.tsx"],"sourcesContent":["import { forwardRef, ElementType, ForwardedRef } from 'react';\nimport { clsx } from 'clsx';\n\nimport {\n SentimentSurfaceComponentProps,\n SentimentSurfaceComponent,\n} from './SentimentSurface.types';\nimport { useTheme } from '@wise/components-theming';\n\n/**\n * SentimentSurface is a polymorphic container component that exposes and, optionally, applies\n * contextual colour tokens as CSS custom properties, based on sentiment types (`negative`,\n * `warning`, `neutral`, `success`, `proposition`).\n *\n * @param {ElementType} [as='div'] - Optional prop to override the HTML element rendered.\n * @param {Sentiment} sentiment - Required prop to set the sentiment type (negative, warning, neutral, success, proposition).\n * @param {Emphasis} [emphasis='base'] - Optional prop to specify the emphasis level (base or elevated).\n * @param {boolean} [hasBaseStyles=true] - If true, sets the `background-color` and `color` on the container. Otherwise, only exposes the tokens as CSS custom properties without rendering.\n * @param {ReactNode} [children] - Content to render inside the surface.\n * @param {string} [className] - Additional CSS classes to apply.\n * @param {CSSProperties} [style] - Inline styles to apply.\n * @param {string} [id] - Unique identifier for the component.\n * @param {string} [data-testid] - A unique string that appears as data attribute `data-testid` in the rendered code.\n *\n * @component\n * @example\n * ```tsx\n * // Basic usage with negative sentiment\n * <SentimentSurface sentiment=\"negative\">\n * Your payment has failed\n * </SentimentSurface>\n * ```\n *\n * @see {@link SentimentSurface} for further information.\n * @see {@link https://storybook.wise.design/?path=/docs/sentiment-surface--docs|Storybook Wise Design}\n */\n// @ts-expect-error - Generic forwardRef limitation. See: https://fettblog.eu/typescript-react-generic-forward-refs/\nconst SentimentSurface: SentimentSurfaceComponent = forwardRef(function SentimentSurface<\n T extends ElementType = 'div',\n>(\n {\n as,\n sentiment,\n emphasis = 'base',\n hasBaseStyles = true,\n style,\n className,\n children,\n id,\n 'data-testid': dataTestId,\n ...props\n }: SentimentSurfaceComponentProps<T>,\n ref: ForwardedRef<HTMLElement>,\n) {\n const Element = as ?? 'div';\n const BASE_CLASS = 'wds-sentiment-surface';\n const { className: closestBrandTheme } = useTheme();\n const classNames = clsx(\n closestBrandTheme,\n BASE_CLASS,\n `${BASE_CLASS}-${sentiment}-${emphasis}`,\n hasBaseStyles && `${BASE_CLASS}--hasBaseStyles`,\n className,\n );\n const sentimentProps = {\n ref,\n id,\n 'data-testid': dataTestId,\n className: classNames,\n style,\n ...props,\n };\n\n return (\n // @ts-expect-error - Generic forwardRef limitation. See: https://fettblog.eu/typescript-react-generic-forward-refs/\n <Element {...sentimentProps}>{children}</Element>\n );\n});\n\nSentimentSurface.displayName = 'SentimentSurface';\n\nexport default SentimentSurface;\n"],"names":["SentimentSurface","forwardRef","as","sentiment","emphasis","hasBaseStyles","style","className","children","id","dataTestId","props","ref","Element","BASE_CLASS","closestBrandTheme","useTheme","classNames","clsx","sentimentProps","_jsx","displayName"],"mappings":";;;;;AAqCA,MAAMA,gBAAgB,gBAA8BC,UAAU,CAAC,SAASD,gBAAgBA,CAGtF;EACEE,EAAE;EACFC,SAAS;AACTC,EAAAA,QAAQ,GAAG,MAAM;AACjBC,EAAAA,aAAa,GAAG,IAAI;EACpBC,KAAK;EACLC,SAAS;EACTC,QAAQ;EACRC,EAAE;AACF,EAAA,aAAa,EAAEC,UAAU;EACzB,GAAGC;AAAK,CAC0B,EACpCC,GAA8B,EAAA;AAE9B,EAAA,MAAMC,OAAO,GAAGX,EAAE,IAAI,KAAK;EAC3B,MAAMY,UAAU,GAAG,uBAAuB;EAC1C,MAAM;AAAEP,IAAAA,SAAS,EAAEQ;GAAmB,GAAGC,QAAQ,EAAE;EACnD,MAAMC,UAAU,GAAGC,IAAI,CACrBH,iBAAiB,EACjBD,UAAU,EACV,CAAA,EAAGA,UAAU,CAAA,CAAA,EAAIX,SAAS,CAAA,CAAA,EAAIC,QAAQ,CAAA,CAAE,EACxCC,aAAa,IAAI,GAAGS,UAAU,CAAA,eAAA,CAAiB,EAC/CP,SAAS,CACV;AACD,EAAA,MAAMY,cAAc,GAAG;IACrBP,GAAG;IACHH,EAAE;AACF,IAAA,aAAa,EAAEC,UAAU;AACzBH,IAAAA,SAAS,EAAEU,UAAU;IACrBX,KAAK;IACL,GAAGK;GACJ;AAED,EAAA;AAAA;AACE;AACAS,IAAAA,GAAA,CAACP,OAAO,EAAA;AAAA,MAAA,GAAKM,cAAc;AAAAX,MAAAA,QAAA,EAAGA;KAAkB;AAAC;AAErD,CAAC;AAEDR,gBAAgB,CAACqB,WAAW,GAAG,kBAAkB;;;;"}