@transferwise/components 46.147.0 → 46.148.1

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 (124) hide show
  1. package/build/container/Container.js.map +1 -1
  2. package/build/container/Container.mjs.map +1 -1
  3. package/build/main.css +63 -6
  4. package/build/prompt/CriticalBanner/CriticalBanner.js +81 -68
  5. package/build/prompt/CriticalBanner/CriticalBanner.js.map +1 -1
  6. package/build/prompt/CriticalBanner/CriticalBanner.mjs +82 -69
  7. package/build/prompt/CriticalBanner/CriticalBanner.mjs.map +1 -1
  8. package/build/prompt/PrimitivePrompt/PrimitivePrompt.js.map +1 -1
  9. package/build/prompt/PrimitivePrompt/PrimitivePrompt.mjs.map +1 -1
  10. package/build/styles/main.css +63 -6
  11. package/build/styles/prompt/ActionPrompt/ActionPrompt.css +2 -1
  12. package/build/styles/prompt/CriticalBanner/CriticalBanner.css +50 -1
  13. package/build/styles/prompt/InfoPrompt/InfoPrompt.css +2 -1
  14. package/build/styles/prompt/InlinePrompt/InlinePrompt.css +2 -1
  15. package/build/styles/prompt/PrimitivePrompt/PrimitivePrompt.css +2 -2
  16. package/build/types/container/Container.d.ts +2 -2
  17. package/build/types/container/Container.d.ts.map +1 -1
  18. package/build/types/iconButton/IconButton.d.ts +1 -1
  19. package/build/types/prompt/CriticalBanner/CriticalBanner.d.ts.map +1 -1
  20. package/build/types/prompt/PrimitivePrompt/PrimitivePrompt.d.ts +1 -1
  21. package/build/types/prompt/PrimitivePrompt/PrimitivePrompt.d.ts.map +1 -1
  22. package/package.json +1 -1
  23. package/src/accordion/Accordion.story.tsx +25 -0
  24. package/src/avatarLayout/AvatarLayout.story.tsx +10 -0
  25. package/src/avatarView/AvatarView.story.tsx +8 -0
  26. package/src/body/Body.story.tsx +12 -0
  27. package/src/button/_stories/Button.story.tsx +7 -1
  28. package/src/calendar/Calendar.story.tsx +19 -7
  29. package/src/carousel/Carousel.story.tsx +35 -0
  30. package/src/checkbox/Checkbox.story.tsx +20 -0
  31. package/src/checkboxButton/CheckboxButton.story.tsx +16 -0
  32. package/src/chevron/Chevron.story.tsx +6 -0
  33. package/src/chips/Chips.story.tsx +23 -0
  34. package/src/circularButton/CircularButton.story.tsx +13 -0
  35. package/src/common/baseCard/BaseCard.story.tsx +12 -0
  36. package/src/common/bottomSheet/BottomSheet.story.tsx +21 -0
  37. package/src/common/circle/Circle.story.tsx +11 -0
  38. package/src/container/Container.story.tsx +12 -0
  39. package/src/container/Container.tsx +2 -2
  40. package/src/dateInput/DateInput.story.tsx +20 -0
  41. package/src/dateLookup/DateLookup.story.tsx +23 -0
  42. package/src/decision/Decision.story.tsx +36 -0
  43. package/src/definitionList/DefinitionList.story.tsx +16 -0
  44. package/src/dimmer/Dimmer.story.tsx +24 -0
  45. package/src/display/Display.story.tsx +11 -0
  46. package/src/divider/Divider.story.tsx +6 -0
  47. package/src/drawer/Drawer.story.tsx +25 -0
  48. package/src/dropFade/DropFade.story.tsx +27 -0
  49. package/src/emphasis/Emphasis.story.tsx +10 -0
  50. package/src/expressiveMoneyInput/ExpressiveMoneyInput.story.tsx +37 -0
  51. package/src/field/Field.story.tsx +16 -0
  52. package/src/flowNavigation/FlowNavigation.story.tsx +25 -0
  53. package/src/header/Header.story.tsx +17 -0
  54. package/src/iconButton/IconButton.story.tsx +14 -0
  55. package/src/image/Image.story.tsx +11 -0
  56. package/src/info/Info.story.tsx +10 -0
  57. package/src/inputWithDisplayFormat/InputWithDisplayFormat.story.tsx +23 -0
  58. package/src/inputs/InputGroup.story.tsx +37 -0
  59. package/src/inputs/SearchInput.story.tsx +22 -0
  60. package/src/inputs/SelectInput/_stories/SelectInput.story.tsx +42 -0
  61. package/src/inputs/TextArea.story.tsx +22 -0
  62. package/src/instructionsList/InstructionsList.story.tsx +19 -0
  63. package/src/label/Label.story.tsx +17 -0
  64. package/src/link/Link.story.tsx +11 -0
  65. package/src/list/List.story.tsx +19 -0
  66. package/src/listItem/_stories/ListItem.story.tsx +20 -0
  67. package/src/loader/Loader.story.tsx +6 -0
  68. package/src/logo/Logo.story.tsx +6 -0
  69. package/src/main.css +63 -6
  70. package/src/markdown/Markdown.story.tsx +17 -0
  71. package/src/modal/Modal.story.tsx +23 -0
  72. package/src/money/Money.story.tsx +7 -0
  73. package/src/moneyInput/MoneyInput.story.tsx +34 -0
  74. package/src/nudge/Nudge.story.tsx +17 -0
  75. package/src/overlayHeader/OverlayHeader.story.tsx +10 -0
  76. package/src/phoneNumberInput/PhoneNumberInput.story.tsx +23 -0
  77. package/src/popover/Popover.story.tsx +12 -0
  78. package/src/primitives/PrimitiveAnchor/stories/PrimitiveAnchor.story.tsx +11 -0
  79. package/src/primitives/PrimitiveButton/stories/PrimitiveButton.story.tsx +11 -0
  80. package/src/processIndicator/ProcessIndicator.story.tsx +10 -0
  81. package/src/progress/Progress.story.tsx +6 -0
  82. package/src/progressBar/ProgressBar.story.tsx +12 -0
  83. package/src/promoCard/PromoCard.story.tsx +15 -0
  84. package/src/promoCard/PromoCardGroup.story.tsx +28 -0
  85. package/src/prompt/ActionPrompt/ActionPrompt.css +2 -1
  86. package/src/prompt/ActionPrompt/ActionPrompt.less +2 -1
  87. package/src/prompt/ActionPrompt/ActionPrompt.story.tsx +31 -0
  88. package/src/prompt/CriticalBanner/CriticalBanner.accessibility.docs.mdx +9 -0
  89. package/src/prompt/CriticalBanner/CriticalBanner.css +50 -1
  90. package/src/prompt/CriticalBanner/CriticalBanner.less +74 -1
  91. package/src/prompt/CriticalBanner/CriticalBanner.story.tsx +181 -170
  92. package/src/prompt/CriticalBanner/CriticalBanner.test.story.tsx +25 -6
  93. package/src/prompt/CriticalBanner/CriticalBanner.test.tsx +37 -0
  94. package/src/prompt/CriticalBanner/CriticalBanner.tsx +96 -84
  95. package/src/prompt/CriticalBanner/CriticalBanner.vars.less +1 -0
  96. package/src/prompt/InfoPrompt/InfoPrompt.css +2 -1
  97. package/src/prompt/InfoPrompt/InfoPrompt.less +2 -1
  98. package/src/prompt/InfoPrompt/InfoPrompt.story.tsx +30 -0
  99. package/src/prompt/InlinePrompt/InlinePrompt.css +2 -1
  100. package/src/prompt/InlinePrompt/InlinePrompt.less +2 -1
  101. package/src/prompt/InlinePrompt/InlinePrompt.story.tsx +14 -0
  102. package/src/prompt/PrimitivePrompt/PrimitivePrompt.css +2 -2
  103. package/src/prompt/PrimitivePrompt/PrimitivePrompt.less +1 -1
  104. package/src/prompt/PrimitivePrompt/PrimitivePrompt.tsx +1 -1
  105. package/src/radio/Radio.story.tsx +34 -0
  106. package/src/radioGroup/RadioGroup.story.tsx +26 -0
  107. package/src/section/Section.story.tsx +15 -0
  108. package/src/segmentedControl/SegmentedControl.story.tsx +27 -0
  109. package/src/sentimentSurface/SentimentSurface.story.tsx +11 -0
  110. package/src/slidingPanel/SlidingPanel.story.tsx +19 -0
  111. package/src/snackbar/Snackbar.story.tsx +24 -0
  112. package/src/statusIcon/StatusIcon.story.tsx +6 -0
  113. package/src/stepper/Stepper.story.tsx +30 -0
  114. package/src/sticky/Sticky.story.tsx +22 -1
  115. package/src/switch/Switch.story.tsx +17 -0
  116. package/src/table/Table.story.tsx +32 -0
  117. package/src/tabs/Tabs.story.tsx +31 -0
  118. package/src/textareaWithDisplayFormat/TextareaWithDisplayFormat.story.tsx +23 -0
  119. package/src/tile/Tile.story.tsx +13 -0
  120. package/src/title/Title.story.tsx +12 -0
  121. package/src/tooltip/Tooltip.story.tsx +8 -0
  122. package/src/typeahead/Typeahead.story.tsx +33 -0
  123. package/src/upload/Upload.story.tsx +24 -0
  124. package/src/uploadInput/UploadInput.story.tsx +31 -0
@@ -1 +1 @@
1
- {"version":3,"file":"Container.js","sources":["../../src/container/Container.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport type { ComponentPropsWithoutRef, ElementType, PropsWithChildren } from 'react';\n\nimport { CommonProps } from '../common';\n\ntype ContainerOwnProps<T extends ElementType> = CommonProps & {\n /** Controls the maximum width: `fluid` (100%), `standard` (1160px), `narrow` (840px), `compact` (600px). @default 'standard' */\n size?: 'fluid' | 'standard' | 'narrow' | 'compact';\n as?: T;\n};\n\nexport type ContainerProps<T extends ElementType = 'div'> = PropsWithChildren<\n ContainerOwnProps<T>\n> &\n Omit<ComponentPropsWithoutRef<T>, keyof ContainerOwnProps<T> | 'children'>;\n\n/**\n * Centers page content within a responsive max-width boundary, with automatic horizontal padding that adapts to the viewport size.\n *\n * **Design guidance**: <a href=\"https://docs.wise.design/foundations/grid\" target=\"_blank\">wise.design/foundations/grid</a>\n */\nconst Container = <T extends ElementType = 'div'>({\n size = 'standard',\n as,\n className,\n children,\n ...otherProps\n}: ContainerProps<T>) => {\n const Element = as ?? 'div';\n return (\n <Element {...otherProps} className={clsx('wds-container', `wds-container--${size}`, className)}>\n {children}\n </Element>\n );\n};\n\nexport default Container;\n"],"names":["Container","size","as","className","children","otherProps","Element","_jsx","clsx"],"mappings":";;;;;;;AAqBA,MAAMA,SAAS,GAAGA,CAAgC;AAChDC,EAAAA,IAAI,GAAG,UAAU;EACjBC,EAAE;EACFC,SAAS;EACTC,QAAQ;EACR,GAAGC;AAAU,CACK,KAAI;AACtB,EAAA,MAAMC,OAAO,GAAGJ,EAAE,IAAI,KAAK;EAC3B,oBACEK,cAAA,CAACD,OAAO,EAAA;AAAA,IAAA,GAAKD,UAAU;IAAEF,SAAS,EAAEK,SAAI,CAAC,eAAe,EAAE,kBAAkBP,IAAI,CAAA,CAAE,EAAEE,SAAS,CAAE;AAAAC,IAAAA,QAAA,EAC5FA;AAAQ,GACF,CAAC;AAEd;;;;"}
1
+ {"version":3,"file":"Container.js","sources":["../../src/container/Container.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport type { ComponentPropsWithRef, ElementType, PropsWithChildren } from 'react';\n\nimport { CommonProps } from '../common';\n\ntype ContainerOwnProps<T extends ElementType> = CommonProps & {\n /** Controls the maximum width: `fluid` (100%), `standard` (1160px), `narrow` (840px), `compact` (600px). @default 'standard' */\n size?: 'fluid' | 'standard' | 'narrow' | 'compact';\n as?: T;\n};\n\nexport type ContainerProps<T extends ElementType = 'div'> = PropsWithChildren<\n ContainerOwnProps<T>\n> &\n Omit<ComponentPropsWithRef<T>, keyof ContainerOwnProps<T> | 'children'>;\n\n/**\n * Centers page content within a responsive max-width boundary, with automatic horizontal padding that adapts to the viewport size.\n *\n * **Design guidance**: <a href=\"https://docs.wise.design/foundations/grid\" target=\"_blank\">wise.design/foundations/grid</a>\n */\nconst Container = <T extends ElementType = 'div'>({\n size = 'standard',\n as,\n className,\n children,\n ...otherProps\n}: ContainerProps<T>) => {\n const Element = as ?? 'div';\n return (\n <Element {...otherProps} className={clsx('wds-container', `wds-container--${size}`, className)}>\n {children}\n </Element>\n );\n};\n\nexport default Container;\n"],"names":["Container","size","as","className","children","otherProps","Element","_jsx","clsx"],"mappings":";;;;;;;AAqBA,MAAMA,SAAS,GAAGA,CAAgC;AAChDC,EAAAA,IAAI,GAAG,UAAU;EACjBC,EAAE;EACFC,SAAS;EACTC,QAAQ;EACR,GAAGC;AAAU,CACK,KAAI;AACtB,EAAA,MAAMC,OAAO,GAAGJ,EAAE,IAAI,KAAK;EAC3B,oBACEK,cAAA,CAACD,OAAO,EAAA;AAAA,IAAA,GAAKD,UAAU;IAAEF,SAAS,EAAEK,SAAI,CAAC,eAAe,EAAE,kBAAkBP,IAAI,CAAA,CAAE,EAAEE,SAAS,CAAE;AAAAC,IAAAA,QAAA,EAC5FA;AAAQ,GACF,CAAC;AAEd;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"Container.mjs","sources":["../../src/container/Container.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport type { ComponentPropsWithoutRef, ElementType, PropsWithChildren } from 'react';\n\nimport { CommonProps } from '../common';\n\ntype ContainerOwnProps<T extends ElementType> = CommonProps & {\n /** Controls the maximum width: `fluid` (100%), `standard` (1160px), `narrow` (840px), `compact` (600px). @default 'standard' */\n size?: 'fluid' | 'standard' | 'narrow' | 'compact';\n as?: T;\n};\n\nexport type ContainerProps<T extends ElementType = 'div'> = PropsWithChildren<\n ContainerOwnProps<T>\n> &\n Omit<ComponentPropsWithoutRef<T>, keyof ContainerOwnProps<T> | 'children'>;\n\n/**\n * Centers page content within a responsive max-width boundary, with automatic horizontal padding that adapts to the viewport size.\n *\n * **Design guidance**: <a href=\"https://docs.wise.design/foundations/grid\" target=\"_blank\">wise.design/foundations/grid</a>\n */\nconst Container = <T extends ElementType = 'div'>({\n size = 'standard',\n as,\n className,\n children,\n ...otherProps\n}: ContainerProps<T>) => {\n const Element = as ?? 'div';\n return (\n <Element {...otherProps} className={clsx('wds-container', `wds-container--${size}`, className)}>\n {children}\n </Element>\n );\n};\n\nexport default Container;\n"],"names":["Container","size","as","className","children","otherProps","Element","_jsx","clsx"],"mappings":";;;AAqBA,MAAMA,SAAS,GAAGA,CAAgC;AAChDC,EAAAA,IAAI,GAAG,UAAU;EACjBC,EAAE;EACFC,SAAS;EACTC,QAAQ;EACR,GAAGC;AAAU,CACK,KAAI;AACtB,EAAA,MAAMC,OAAO,GAAGJ,EAAE,IAAI,KAAK;EAC3B,oBACEK,GAAA,CAACD,OAAO,EAAA;AAAA,IAAA,GAAKD,UAAU;IAAEF,SAAS,EAAEK,IAAI,CAAC,eAAe,EAAE,kBAAkBP,IAAI,CAAA,CAAE,EAAEE,SAAS,CAAE;AAAAC,IAAAA,QAAA,EAC5FA;AAAQ,GACF,CAAC;AAEd;;;;"}
1
+ {"version":3,"file":"Container.mjs","sources":["../../src/container/Container.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport type { ComponentPropsWithRef, ElementType, PropsWithChildren } from 'react';\n\nimport { CommonProps } from '../common';\n\ntype ContainerOwnProps<T extends ElementType> = CommonProps & {\n /** Controls the maximum width: `fluid` (100%), `standard` (1160px), `narrow` (840px), `compact` (600px). @default 'standard' */\n size?: 'fluid' | 'standard' | 'narrow' | 'compact';\n as?: T;\n};\n\nexport type ContainerProps<T extends ElementType = 'div'> = PropsWithChildren<\n ContainerOwnProps<T>\n> &\n Omit<ComponentPropsWithRef<T>, keyof ContainerOwnProps<T> | 'children'>;\n\n/**\n * Centers page content within a responsive max-width boundary, with automatic horizontal padding that adapts to the viewport size.\n *\n * **Design guidance**: <a href=\"https://docs.wise.design/foundations/grid\" target=\"_blank\">wise.design/foundations/grid</a>\n */\nconst Container = <T extends ElementType = 'div'>({\n size = 'standard',\n as,\n className,\n children,\n ...otherProps\n}: ContainerProps<T>) => {\n const Element = as ?? 'div';\n return (\n <Element {...otherProps} className={clsx('wds-container', `wds-container--${size}`, className)}>\n {children}\n </Element>\n );\n};\n\nexport default Container;\n"],"names":["Container","size","as","className","children","otherProps","Element","_jsx","clsx"],"mappings":";;;AAqBA,MAAMA,SAAS,GAAGA,CAAgC;AAChDC,EAAAA,IAAI,GAAG,UAAU;EACjBC,EAAE;EACFC,SAAS;EACTC,QAAQ;EACR,GAAGC;AAAU,CACK,KAAI;AACtB,EAAA,MAAMC,OAAO,GAAGJ,EAAE,IAAI,KAAK;EAC3B,oBACEK,GAAA,CAACD,OAAO,EAAA;AAAA,IAAA,GAAKD,UAAU;IAAEF,SAAS,EAAEK,IAAI,CAAC,eAAe,EAAE,kBAAkBP,IAAI,CAAA,CAAE,EAAEE,SAAS,CAAE;AAAAC,IAAAA,QAAA,EAC5FA;AAAQ,GACF,CAAC;AAEd;;;;"}
package/build/main.css CHANGED
@@ -31706,8 +31706,8 @@ html:not([dir="rtl"]) .np-navigation-option {
31706
31706
  gap: 16px;
31707
31707
  gap: var(--Prompt-gap, var(--size-16));
31708
31708
  word-wrap: break-word;
31709
- padding: 8px;
31710
- padding: var(--Prompt-padding, var(--padding-x-small));
31709
+ padding: 8px 8px;
31710
+ padding: var(--Prompt-padding-y, var(--padding-x-small)) var(--Prompt-padding-x, var(--padding-x-small));
31711
31711
  text-align: left;
31712
31712
  word-break: break-word;
31713
31713
  width: 100%;
@@ -31759,7 +31759,8 @@ html:not([dir="rtl"]) .np-navigation-option {
31759
31759
 
31760
31760
  .wds-inline-prompt {
31761
31761
  --Prompt-gap: calc(var(--size-12) / 2);
31762
- --Prompt-padding: calc(var(--padding-x-small) / 2) var(--padding-x-small);
31762
+ --Prompt-padding-x: var(--padding-x-small);
31763
+ --Prompt-padding-y: calc(var(--padding-x-small) / 2);
31763
31764
  display: inline-flex;
31764
31765
  border-radius: 10px;
31765
31766
  border-radius: var(--radius-small);
@@ -31829,7 +31830,8 @@ html:not([dir="rtl"]) .np-navigation-option {
31829
31830
  .wds-info-prompt {
31830
31831
  --Prompt-border-radius: var(--radius-medium);
31831
31832
  --Prompt-gap: var(--size-8);
31832
- --Prompt-padding: var(--size-12);
31833
+ --Prompt-padding-x: var(--size-12);
31834
+ --Prompt-padding-y: var(--size-12);
31833
31835
  }
31834
31836
 
31835
31837
  .wds-info-prompt__content {
@@ -31895,7 +31897,8 @@ html:not([dir="rtl"]) .np-navigation-option {
31895
31897
  }
31896
31898
 
31897
31899
  .wds-action-prompt {
31898
- --Prompt-padding: var(--size-16);
31900
+ --Prompt-padding-x: var(--size-16);
31901
+ --Prompt-padding-y: var(--size-16);
31899
31902
  --Prompt-actions-gap: var(--size-8);
31900
31903
  --Prompt-gap: var(--size-10) var(--size-16);
31901
31904
  --Prompt-border-radius: var(--radius-large);
@@ -31930,11 +31933,13 @@ html:not([dir="rtl"]) .np-navigation-option {
31930
31933
  }
31931
31934
 
31932
31935
  .wds-critical-banner {
31933
- --Prompt-padding: var(--size-16);
31936
+ --Prompt-padding-x: var(--wds-container-padding-inline);
31937
+ --Prompt-padding-y: var(--size-16);
31934
31938
  --Prompt-actions-gap: var(--size-8);
31935
31939
  --Prompt-gap: var(--size-10) var(--size-16);
31936
31940
  --Prompt-border-radius: 0;
31937
31941
  container-type: inline-size;
31942
+ position: relative;
31938
31943
  --critical-banner-easing: cubic-bezier(0.9, 0, 0.7, 1);
31939
31944
  --critical-banner-duration: 150ms;
31940
31945
  /* Override PrimitivePrompt's --screen-sm-max actions behaviour:
@@ -32075,6 +32080,53 @@ html:not([dir="rtl"]) .np-navigation-option {
32075
32080
  }
32076
32081
  }
32077
32082
 
32083
+ .wds-critical-banner-overhang-query {
32084
+ container-name: critical-banner-overhang;
32085
+ container-type: inline-size;
32086
+ inline-size: 100%;
32087
+ }
32088
+
32089
+ .wds-critical-banner__entry-mask {
32090
+ display: grid;
32091
+ grid-template-rows: 0fr;
32092
+ overflow: hidden;
32093
+ animation: wds-critical-banner-reveal-height 400ms cubic-bezier(0.3, 0, 0.1, 1) 500ms both;
32094
+ }
32095
+
32096
+ @container critical-banner-overhang (max-width: 600px) {
32097
+ .wds-critical-banner__entry-mask {
32098
+ --critical-banner-mobile-overhang-size: 32px;
32099
+ }
32100
+ .wds-critical-banner__entry-mask .wds-critical-banner-overhang {
32101
+ margin-bottom: var(--critical-banner-mobile-overhang-size);
32102
+ }
32103
+ .wds-critical-banner__entry-mask .wds-critical-banner-overhang::after {
32104
+ content: "";
32105
+ position: absolute;
32106
+ right: 0;
32107
+ bottom: calc(-1 * var(--critical-banner-mobile-overhang-size));
32108
+ left: 0;
32109
+ height: var(--critical-banner-mobile-overhang-size);
32110
+ pointer-events: none;
32111
+ background: radial-gradient(circle at 100% 100%, transparent var(--critical-banner-mobile-overhang-size), var(--color-sentiment-background-surface) var(--critical-banner-mobile-overhang-size)) 0 0 / var(--critical-banner-mobile-overhang-size) var(--critical-banner-mobile-overhang-size) no-repeat, radial-gradient(circle at 0% 100%, transparent var(--critical-banner-mobile-overhang-size), var(--color-sentiment-background-surface) var(--critical-banner-mobile-overhang-size)) 100% 0 / var(--critical-banner-mobile-overhang-size) var(--critical-banner-mobile-overhang-size) no-repeat;
32112
+ }
32113
+ }
32114
+
32115
+ .wds-critical-banner__entry-track {
32116
+ min-height: 0;
32117
+ }
32118
+
32119
+ @keyframes wds-critical-banner-reveal-height {
32120
+ from {
32121
+ grid-template-rows: 0fr;
32122
+ overflow: hidden;
32123
+ }
32124
+ to {
32125
+ grid-template-rows: 1fr;
32126
+ overflow: visible;
32127
+ }
32128
+ }
32129
+
32078
32130
  @media (prefers-reduced-motion: reduce) {
32079
32131
  .wds-critical-banner__description,
32080
32132
  .wds-critical-banner__title,
@@ -32082,6 +32134,11 @@ html:not([dir="rtl"]) .np-navigation-option {
32082
32134
  .wds-critical-banner__toggle {
32083
32135
  transition: none !important;
32084
32136
  }
32137
+ .wds-critical-banner__entry-mask {
32138
+ animation: none;
32139
+ grid-template-rows: 1fr;
32140
+ overflow: visible;
32141
+ }
32085
32142
  }
32086
32143
 
32087
32144
  .wds-expander-toggle {
@@ -4,6 +4,7 @@ var React = require('react');
4
4
  var clsx = require('clsx');
5
5
  var Body = require('../../body/Body.js');
6
6
  var Button_resolver = require('../../button/Button.resolver.js');
7
+ var Container = require('../../container/Container.js');
7
8
  require('../../common/theme.js');
8
9
  require('../../common/direction.js');
9
10
  var neptuneTokens = require('@transferwise/neptune-tokens');
@@ -58,6 +59,77 @@ const CriticalBanner = ({
58
59
  const titleId = React.useId();
59
60
  const descId = React.useId();
60
61
  const ariaLabelledByIds = [media['aria-hidden'] ? undefined : mediaId, !title ? undefined : titleId].filter(Boolean).join(' ');
62
+ const bannerSurface = /*#__PURE__*/jsxRuntime.jsxs(Container.default, {
63
+ size: "fluid",
64
+ as: PrimitivePrompt.PrimitivePrompt,
65
+ ref: containerRef,
66
+ id: id,
67
+ sentiment: sentiment,
68
+ emphasis: sentiment === 'neutral' ? 'base' : 'elevated',
69
+ "data-testid": testId,
70
+ className: clsx.clsx('wds-critical-banner', 'wds-critical-banner-overhang', {
71
+ 'wds-critical-banner--collapsed': !resolvedExpanded,
72
+ 'wds-critical-banner--with-two-actions': !!actionSecondary
73
+ }, className),
74
+ media: promptMedia.renderPromptMedia({
75
+ media,
76
+ sentiment,
77
+ mediaId,
78
+ imgClassName: 'wds-critical-banner--media-image'
79
+ }),
80
+ actions: hasActions ? /*#__PURE__*/jsxRuntime.jsxs("div", {
81
+ "aria-hidden": !resolvedExpanded ? true : undefined,
82
+ style: {
83
+ display: 'contents'
84
+ },
85
+ children: [actionSecondary &&
86
+ /*#__PURE__*/
87
+ // @ts-expect-error onClick type mismatch
88
+ jsxRuntime.jsx(Button_resolver.default, {
89
+ v2: true,
90
+ size: "md",
91
+ priority: "secondary",
92
+ href: actionSecondary.href,
93
+ tabIndex: resolvedExpanded ? undefined : -1,
94
+ onClick: actionSecondary?.onClick,
95
+ children: actionSecondary.label
96
+ }), action &&
97
+ /*#__PURE__*/
98
+ // @ts-expect-error onClick type mismatch
99
+ jsxRuntime.jsx(Button_resolver.default, {
100
+ v2: true,
101
+ size: "md",
102
+ priority: "primary",
103
+ href: action.href,
104
+ tabIndex: resolvedExpanded ? undefined : -1,
105
+ onClick: action.onClick,
106
+ children: action.label
107
+ })]
108
+ }) : undefined,
109
+ role: "region",
110
+ "aria-labelledby": ariaLabelledByIds || undefined,
111
+ "aria-describedby": description ? descId : undefined,
112
+ children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
113
+ className: "wds-critical-banner__text-wrapper",
114
+ children: [title && /*#__PURE__*/jsxRuntime.jsx(Body.default, {
115
+ id: titleId,
116
+ type: typography.Typography.BODY_LARGE_BOLD,
117
+ className: "wds-critical-banner__content wds-critical-banner__title",
118
+ children: title
119
+ }), description && /*#__PURE__*/jsxRuntime.jsx(Body.default, {
120
+ id: descId,
121
+ className: clsx.clsx('wds-critical-banner__content', 'wds-critical-banner__description', {
122
+ 'wds-critical-banner__description--with-title': !!title
123
+ }),
124
+ children: description
125
+ })]
126
+ }), /*#__PURE__*/jsxRuntime.jsx(Expander.ExpanderToggle, {
127
+ expanded: resolvedExpanded,
128
+ size: 24,
129
+ className: "wds-critical-banner__toggle",
130
+ onToggle: handleToggle
131
+ })]
132
+ });
61
133
  return /*#__PURE__*/jsxRuntime.jsx(LiveRegion.LiveRegion, {
62
134
  "aria-live": "assertive",
63
135
  announceOnChange: helpers.buildAnnouncementString({
@@ -67,74 +139,15 @@ const CriticalBanner = ({
67
139
  actionLabel: action?.label,
68
140
  actionSecondaryLabel: actionSecondary?.label
69
141
  }),
70
- children: /*#__PURE__*/jsxRuntime.jsxs(PrimitivePrompt.PrimitivePrompt, {
71
- ref: containerRef,
72
- id: id,
73
- sentiment: sentiment,
74
- emphasis: sentiment === 'neutral' ? 'base' : 'elevated',
75
- "data-testid": testId,
76
- className: clsx.clsx('wds-critical-banner', {
77
- 'wds-critical-banner--collapsed': !resolvedExpanded,
78
- 'wds-critical-banner--with-two-actions': !!actionSecondary
79
- }, className),
80
- media: promptMedia.renderPromptMedia({
81
- media,
82
- sentiment,
83
- mediaId,
84
- imgClassName: 'wds-critical-banner--media-image'
85
- }),
86
- actions: hasActions ? /*#__PURE__*/jsxRuntime.jsxs("div", {
87
- "aria-hidden": !resolvedExpanded ? true : undefined,
88
- style: {
89
- display: 'contents'
90
- },
91
- children: [actionSecondary &&
92
- /*#__PURE__*/
93
- // @ts-expect-error onClick type mismatch
94
- jsxRuntime.jsx(Button_resolver.default, {
95
- v2: true,
96
- size: "md",
97
- priority: "secondary",
98
- href: actionSecondary.href,
99
- tabIndex: resolvedExpanded ? undefined : -1,
100
- onClick: actionSecondary?.onClick,
101
- children: actionSecondary.label
102
- }), action &&
103
- /*#__PURE__*/
104
- // @ts-expect-error onClick type mismatch
105
- jsxRuntime.jsx(Button_resolver.default, {
106
- v2: true,
107
- size: "md",
108
- priority: "primary",
109
- href: action.href,
110
- tabIndex: resolvedExpanded ? undefined : -1,
111
- onClick: action.onClick,
112
- children: action.label
113
- })]
114
- }) : undefined,
115
- role: "region",
116
- "aria-labelledby": ariaLabelledByIds || undefined,
117
- "aria-describedby": description ? descId : undefined,
118
- children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
119
- className: "wds-critical-banner__text-wrapper",
120
- children: [title && /*#__PURE__*/jsxRuntime.jsx(Body.default, {
121
- id: titleId,
122
- type: typography.Typography.BODY_LARGE_BOLD,
123
- className: "wds-critical-banner__content wds-critical-banner__title",
124
- children: title
125
- }), description && /*#__PURE__*/jsxRuntime.jsx(Body.default, {
126
- id: descId,
127
- className: clsx.clsx('wds-critical-banner__content', 'wds-critical-banner__description', {
128
- 'wds-critical-banner__description--with-title': !!title
129
- }),
130
- children: description
131
- })]
132
- }), /*#__PURE__*/jsxRuntime.jsx(Expander.ExpanderToggle, {
133
- expanded: resolvedExpanded,
134
- size: 24,
135
- className: "wds-critical-banner__toggle",
136
- onToggle: handleToggle
137
- })]
142
+ children: /*#__PURE__*/jsxRuntime.jsx("div", {
143
+ className: "wds-critical-banner-overhang-query",
144
+ children: /*#__PURE__*/jsxRuntime.jsx("div", {
145
+ className: "wds-critical-banner__entry-mask",
146
+ children: /*#__PURE__*/jsxRuntime.jsx("div", {
147
+ className: "wds-critical-banner__entry-track",
148
+ children: bannerSurface
149
+ })
150
+ })
138
151
  })
139
152
  });
140
153
  };
@@ -1 +1 @@
1
- {"version":3,"file":"CriticalBanner.js","sources":["../../../src/prompt/CriticalBanner/CriticalBanner.tsx"],"sourcesContent":["import { ReactNode, useId, useState } from 'react';\nimport { clsx } from 'clsx';\n\nimport Body from '../../body';\nimport Button from '../../button';\nimport { Breakpoint, LiveRegion, Typography } from '../../common';\nimport { ButtonProps } from '../../button/Button.types';\nimport { PrimitivePrompt, PrimitivePromptProps } from '../PrimitivePrompt';\n\nimport { renderPromptMedia, PromptMedia } from '../helpers/promptMedia';\nimport { ExpanderToggle } from '../common/Expander/Expander';\nimport { buildAnnouncementString } from './helpers';\nimport { useContainerSize } from '../../common/hooks/useContainerSize';\n\nexport type CriticalBannerProps = {\n title?: ReactNode;\n description: ReactNode;\n media?: PromptMedia;\n action?: Pick<ButtonProps, 'onClick' | 'href' | 'target'> & {\n label: ButtonProps['children'];\n };\n actionSecondary?: Pick<ButtonProps, 'onClick' | 'href' | 'target'> & {\n label: ButtonProps['children'];\n };\n sentiment?: Exclude<PrimitivePromptProps['sentiment'], 'proposition'>;\n /**\n * Controls whether the description and actions are visible, as a controlled component.\n * When collapsed with a title, only the title is shown.\n * When collapsed without a title, the description is trimmed to 2 lines.\n *\n * Note: On desktop (container width >= 768px), the banner is always expanded\n * regardless of this prop value.\n */\n expanded?: boolean;\n /**\n * Called when the user clicks the chevron toggle.\n * If not provided, the component will manage expanded state internally.\n */\n onToggle?: () => void;\n} & Pick<PrimitivePromptProps, 'id' | 'className' | 'data-testid'>;\n\n/**\n * A full-width, non-dismissible banner for critical messages such as account blocks or\n * time-sensitive actions that require immediate user attention.\n\n * @see {@link https://docs.wise.design/components/critical-banner Design Spec}\n */\nexport const CriticalBanner = ({\n sentiment = 'negative',\n title,\n description,\n media = {},\n action,\n actionSecondary,\n expanded: expandedProp,\n onToggle,\n id,\n className,\n 'data-testid': testId,\n}: CriticalBannerProps) => {\n const [containerRef, isDesktop] = useContainerSize(Breakpoint.MEDIUM);\n const isControlled = expandedProp !== undefined && onToggle !== undefined;\n const [internalExpanded, setInternalExpanded] = useState(true);\n const resolvedExpanded = isDesktop ? true : isControlled ? expandedProp : internalExpanded;\n const handleToggle = isControlled\n ? onToggle\n : () => setInternalExpanded((previousExpanded) => !previousExpanded);\n const hasActions = action ?? actionSecondary;\n const mediaId = useId();\n const titleId = useId();\n const descId = useId();\n\n const ariaLabelledByIds = [\n media['aria-hidden'] ? undefined : mediaId,\n !title ? undefined : titleId,\n ]\n .filter(Boolean)\n .join(' ');\n\n return (\n <LiveRegion\n aria-live=\"assertive\"\n announceOnChange={buildAnnouncementString({\n title,\n description,\n expanded: resolvedExpanded,\n actionLabel: action?.label,\n actionSecondaryLabel: actionSecondary?.label,\n })}\n >\n <PrimitivePrompt\n ref={containerRef}\n id={id}\n sentiment={sentiment}\n emphasis={sentiment === 'neutral' ? 'base' : 'elevated'}\n data-testid={testId}\n className={clsx(\n 'wds-critical-banner',\n {\n 'wds-critical-banner--collapsed': !resolvedExpanded,\n 'wds-critical-banner--with-two-actions': !!actionSecondary,\n },\n className,\n )}\n media={renderPromptMedia({\n media,\n sentiment,\n mediaId,\n imgClassName: 'wds-critical-banner--media-image',\n })}\n actions={\n hasActions ? (\n <div aria-hidden={!resolvedExpanded ? true : undefined} style={{ display: 'contents' }}>\n {actionSecondary && (\n // @ts-expect-error onClick type mismatch\n <Button\n v2\n size=\"md\"\n priority=\"secondary\"\n href={actionSecondary.href}\n tabIndex={resolvedExpanded ? undefined : -1}\n onClick={actionSecondary?.onClick}\n >\n {actionSecondary.label}\n </Button>\n )}\n {action && (\n // @ts-expect-error onClick type mismatch\n <Button\n v2\n size=\"md\"\n priority=\"primary\"\n href={action.href}\n tabIndex={resolvedExpanded ? undefined : -1}\n onClick={action.onClick}\n >\n {action.label}\n </Button>\n )}\n </div>\n ) : undefined\n }\n role=\"region\"\n aria-labelledby={ariaLabelledByIds || undefined}\n aria-describedby={description ? descId : undefined}\n >\n <div className=\"wds-critical-banner__text-wrapper\">\n {title && (\n <Body\n id={titleId}\n type={Typography.BODY_LARGE_BOLD}\n className=\"wds-critical-banner__content wds-critical-banner__title\"\n >\n {title}\n </Body>\n )}\n {description && (\n <Body\n id={descId}\n className={clsx('wds-critical-banner__content', 'wds-critical-banner__description', {\n 'wds-critical-banner__description--with-title': !!title,\n })}\n >\n {description}\n </Body>\n )}\n </div>\n <ExpanderToggle\n expanded={resolvedExpanded}\n size={24}\n className=\"wds-critical-banner__toggle\"\n onToggle={handleToggle}\n />\n </PrimitivePrompt>\n </LiveRegion>\n );\n};\n\nexport default CriticalBanner;\n"],"names":["CriticalBanner","sentiment","title","description","media","action","actionSecondary","expanded","expandedProp","onToggle","id","className","testId","containerRef","isDesktop","useContainerSize","Breakpoint","MEDIUM","isControlled","undefined","internalExpanded","setInternalExpanded","useState","resolvedExpanded","handleToggle","previousExpanded","hasActions","mediaId","useId","titleId","descId","ariaLabelledByIds","filter","Boolean","join","_jsx","LiveRegion","announceOnChange","buildAnnouncementString","actionLabel","label","actionSecondaryLabel","children","_jsxs","PrimitivePrompt","ref","emphasis","clsx","renderPromptMedia","imgClassName","actions","style","display","Button","v2","size","priority","href","tabIndex","onClick","role","Body","type","Typography","BODY_LARGE_BOLD","Expander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gC,QAAAA,IAAI,EAAE,EAAG;AACT5C,QAAAA,SAAS,EAAC,6BAA6B;AACvCF,QAAAA,QAAQ,EAAEe;AAAa,OAAA,CAE3B;KAAiB;AACnB,GAAY,CAAC;AAEjB;;;;"}
1
+ {"version":3,"file":"CriticalBanner.js","sources":["../../../src/prompt/CriticalBanner/CriticalBanner.tsx"],"sourcesContent":["import { ElementType, ReactNode, useId, useState } from 'react';\nimport { clsx } from 'clsx';\n\nimport Body from '../../body';\nimport Button from '../../button';\nimport Container from '../../container';\nimport { Breakpoint, LiveRegion, Typography } from '../../common';\nimport { ButtonProps } from '../../button/Button.types';\nimport { PrimitivePrompt, PrimitivePromptProps } from '../PrimitivePrompt';\n\nimport { renderPromptMedia, PromptMedia } from '../helpers/promptMedia';\nimport { ExpanderToggle } from '../common/Expander/Expander';\nimport { buildAnnouncementString } from './helpers';\nimport { useContainerSize } from '../../common/hooks/useContainerSize';\n\nexport type CriticalBannerProps = {\n title?: ReactNode;\n description: ReactNode;\n media?: PromptMedia;\n action?: Pick<ButtonProps, 'onClick' | 'href' | 'target'> & {\n label: ButtonProps['children'];\n };\n actionSecondary?: Pick<ButtonProps, 'onClick' | 'href' | 'target'> & {\n label: ButtonProps['children'];\n };\n sentiment?: Exclude<PrimitivePromptProps['sentiment'], 'proposition'>;\n /**\n * Controls whether the description and actions are visible, as a controlled component.\n * When collapsed with a title, only the title is shown.\n * When collapsed without a title, the description is trimmed to 2 lines.\n *\n * Note: On desktop (container width >= 768px), the banner is always expanded\n * regardless of this prop value.\n */\n expanded?: boolean;\n /**\n * Called when the user clicks the chevron toggle.\n * If not provided, the component will manage expanded state internally.\n */\n onToggle?: () => void;\n} & Pick<PrimitivePromptProps, 'id' | 'className' | 'data-testid'>;\n\n/**\n * A full-width, non-dismissible banner for critical messages such as account blocks or\n * time-sensitive actions that require immediate user attention.\n\n * @see {@link https://docs.wise.design/components/critical-banner Design Spec}\n */\nexport const CriticalBanner = ({\n sentiment = 'negative',\n title,\n description,\n media = {},\n action,\n actionSecondary,\n expanded: expandedProp,\n onToggle,\n id,\n className,\n 'data-testid': testId,\n}: CriticalBannerProps) => {\n const [containerRef, isDesktop] = useContainerSize(Breakpoint.MEDIUM);\n const isControlled = expandedProp !== undefined && onToggle !== undefined;\n const [internalExpanded, setInternalExpanded] = useState(true);\n const resolvedExpanded = isDesktop ? true : isControlled ? expandedProp : internalExpanded;\n const handleToggle = isControlled\n ? onToggle\n : () => setInternalExpanded((previousExpanded) => !previousExpanded);\n const hasActions = action ?? actionSecondary;\n const mediaId = useId();\n const titleId = useId();\n const descId = useId();\n\n const ariaLabelledByIds = [\n media['aria-hidden'] ? undefined : mediaId,\n !title ? undefined : titleId,\n ]\n .filter(Boolean)\n .join(' ');\n\n const bannerSurface = (\n <Container\n size=\"fluid\"\n as={PrimitivePrompt as ElementType}\n ref={containerRef}\n id={id}\n sentiment={sentiment}\n emphasis={sentiment === 'neutral' ? 'base' : 'elevated'}\n data-testid={testId}\n className={clsx(\n 'wds-critical-banner',\n 'wds-critical-banner-overhang',\n {\n 'wds-critical-banner--collapsed': !resolvedExpanded,\n 'wds-critical-banner--with-two-actions': !!actionSecondary,\n },\n className,\n )}\n media={renderPromptMedia({\n media,\n sentiment,\n mediaId,\n imgClassName: 'wds-critical-banner--media-image',\n })}\n actions={\n hasActions ? (\n <div aria-hidden={!resolvedExpanded ? true : undefined} style={{ display: 'contents' }}>\n {actionSecondary && (\n // @ts-expect-error onClick type mismatch\n <Button\n v2\n size=\"md\"\n priority=\"secondary\"\n href={actionSecondary.href}\n tabIndex={resolvedExpanded ? undefined : -1}\n onClick={actionSecondary?.onClick}\n >\n {actionSecondary.label}\n </Button>\n )}\n {action && (\n // @ts-expect-error onClick type mismatch\n <Button\n v2\n size=\"md\"\n priority=\"primary\"\n href={action.href}\n tabIndex={resolvedExpanded ? undefined : -1}\n onClick={action.onClick}\n >\n {action.label}\n </Button>\n )}\n </div>\n ) : undefined\n }\n role=\"region\"\n aria-labelledby={ariaLabelledByIds || undefined}\n aria-describedby={description ? descId : undefined}\n >\n <div className=\"wds-critical-banner__text-wrapper\">\n {title && (\n <Body\n id={titleId}\n type={Typography.BODY_LARGE_BOLD}\n className=\"wds-critical-banner__content wds-critical-banner__title\"\n >\n {title}\n </Body>\n )}\n {description && (\n <Body\n id={descId}\n className={clsx('wds-critical-banner__content', 'wds-critical-banner__description', {\n 'wds-critical-banner__description--with-title': !!title,\n })}\n >\n {description}\n </Body>\n )}\n </div>\n <ExpanderToggle\n expanded={resolvedExpanded}\n size={24}\n className=\"wds-critical-banner__toggle\"\n onToggle={handleToggle}\n />\n </Container>\n );\n\n return (\n <LiveRegion\n aria-live=\"assertive\"\n announceOnChange={buildAnnouncementString({\n title,\n description,\n expanded: resolvedExpanded,\n actionLabel: action?.label,\n actionSecondaryLabel: actionSecondary?.label,\n })}\n >\n <div className=\"wds-critical-banner-overhang-query\">\n <div className=\"wds-critical-banner__entry-mask\">\n <div className=\"wds-critical-banner__entry-track\">{bannerSurface}</div>\n </div>\n </div>\n </LiveRegion>\n );\n};\n\nexport default CriticalBanner;\n"],"names":["CriticalBanner","sentiment","title","description","media","action","actionSecondary","expanded","expandedProp","onToggle","id","className","testId","containerRef","isDesktop","useContainerSize","Breakpoint","MEDIUM","isControlled","undefined","internalExpanded","setInternalExpanded","useState","resolvedExpanded","handleToggle","previousExpanded","hasActions","mediaId","useId","titleId","descId","ariaLabelledByIds","filter","Boolean","join","bannerSurface","_jsxs","Container","size","as","PrimitivePrompt","ref","emphasis","clsx","renderPromptMedia","imgClassName","actions","style","display","children","_jsx","Button","v2","priority","href","tabIndex","onClick","label","role","Body","type","Typography","BODY_LARGE_BOLD","ExpanderToggle","LiveRegion","announceOnChange","buildAnnouncementString","actionLabel","actionSecondaryLabel"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgDO,MAAMA,cAAc,GAAGA,CAAC;AAC7BC,EAAAA,SAAS,GAAG,UAAU;EACtBC,KAAK;EACLC,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oD,KAAK;MAC1BW,oBAAoB,EAAE9D,eAAe,EAAEmD;AACxC,KAAA,CAAE;AAAAR,IAAAA,QAAA,eAEHC,cAAA,CAAA,KAAA,EAAA;AAAKvC,MAAAA,SAAS,EAAC,oCAAoC;AAAAsC,MAAAA,QAAA,eACjDC,cAAA,CAAA,KAAA,EAAA;AAAKvC,QAAAA,SAAS,EAAC,iCAAiC;AAAAsC,QAAAA,QAAA,eAC9CC,cAAA,CAAA,KAAA,EAAA;AAAKvC,UAAAA,SAAS,EAAC,kCAAkC;AAAAsC,UAAAA,QAAA,EAAEd;SAAmB;OACnE;KACF;AACP,GAAY,CAAC;AAEjB;;;;"}
@@ -2,6 +2,7 @@ import { useState, useId } from 'react';
2
2
  import { clsx } from 'clsx';
3
3
  import Body from '../../body/Body.mjs';
4
4
  import Button from '../../button/Button.resolver.mjs';
5
+ import Container from '../../container/Container.mjs';
5
6
  import '../../common/theme.mjs';
6
7
  import '../../common/direction.mjs';
7
8
  import { Breakpoint } from '@transferwise/neptune-tokens';
@@ -25,7 +26,7 @@ import '@transferwise/formatting';
25
26
  import '@transferwise/icons';
26
27
  import 'react-intl';
27
28
  import '../../common/closeButton/CloseButton.messages.mjs';
28
- import { jsx, jsxs } from 'react/jsx-runtime';
29
+ import { jsxs, jsx } from 'react/jsx-runtime';
29
30
  import { LiveRegion } from '../../common/liveRegion/LiveRegion.mjs';
30
31
  import { PrimitivePrompt } from '../PrimitivePrompt/PrimitivePrompt.mjs';
31
32
  import { renderPromptMedia } from '../helpers/promptMedia.mjs';
@@ -56,6 +57,77 @@ const CriticalBanner = ({
56
57
  const titleId = useId();
57
58
  const descId = useId();
58
59
  const ariaLabelledByIds = [media['aria-hidden'] ? undefined : mediaId, !title ? undefined : titleId].filter(Boolean).join(' ');
60
+ const bannerSurface = /*#__PURE__*/jsxs(Container, {
61
+ size: "fluid",
62
+ as: PrimitivePrompt,
63
+ ref: containerRef,
64
+ id: id,
65
+ sentiment: sentiment,
66
+ emphasis: sentiment === 'neutral' ? 'base' : 'elevated',
67
+ "data-testid": testId,
68
+ className: clsx('wds-critical-banner', 'wds-critical-banner-overhang', {
69
+ 'wds-critical-banner--collapsed': !resolvedExpanded,
70
+ 'wds-critical-banner--with-two-actions': !!actionSecondary
71
+ }, className),
72
+ media: renderPromptMedia({
73
+ media,
74
+ sentiment,
75
+ mediaId,
76
+ imgClassName: 'wds-critical-banner--media-image'
77
+ }),
78
+ actions: hasActions ? /*#__PURE__*/jsxs("div", {
79
+ "aria-hidden": !resolvedExpanded ? true : undefined,
80
+ style: {
81
+ display: 'contents'
82
+ },
83
+ children: [actionSecondary &&
84
+ /*#__PURE__*/
85
+ // @ts-expect-error onClick type mismatch
86
+ jsx(Button, {
87
+ v2: true,
88
+ size: "md",
89
+ priority: "secondary",
90
+ href: actionSecondary.href,
91
+ tabIndex: resolvedExpanded ? undefined : -1,
92
+ onClick: actionSecondary?.onClick,
93
+ children: actionSecondary.label
94
+ }), action &&
95
+ /*#__PURE__*/
96
+ // @ts-expect-error onClick type mismatch
97
+ jsx(Button, {
98
+ v2: true,
99
+ size: "md",
100
+ priority: "primary",
101
+ href: action.href,
102
+ tabIndex: resolvedExpanded ? undefined : -1,
103
+ onClick: action.onClick,
104
+ children: action.label
105
+ })]
106
+ }) : undefined,
107
+ role: "region",
108
+ "aria-labelledby": ariaLabelledByIds || undefined,
109
+ "aria-describedby": description ? descId : undefined,
110
+ children: [/*#__PURE__*/jsxs("div", {
111
+ className: "wds-critical-banner__text-wrapper",
112
+ children: [title && /*#__PURE__*/jsx(Body, {
113
+ id: titleId,
114
+ type: Typography.BODY_LARGE_BOLD,
115
+ className: "wds-critical-banner__content wds-critical-banner__title",
116
+ children: title
117
+ }), description && /*#__PURE__*/jsx(Body, {
118
+ id: descId,
119
+ className: clsx('wds-critical-banner__content', 'wds-critical-banner__description', {
120
+ 'wds-critical-banner__description--with-title': !!title
121
+ }),
122
+ children: description
123
+ })]
124
+ }), /*#__PURE__*/jsx(ExpanderToggle, {
125
+ expanded: resolvedExpanded,
126
+ size: 24,
127
+ className: "wds-critical-banner__toggle",
128
+ onToggle: handleToggle
129
+ })]
130
+ });
59
131
  return /*#__PURE__*/jsx(LiveRegion, {
60
132
  "aria-live": "assertive",
61
133
  announceOnChange: buildAnnouncementString({
@@ -65,74 +137,15 @@ const CriticalBanner = ({
65
137
  actionLabel: action?.label,
66
138
  actionSecondaryLabel: actionSecondary?.label
67
139
  }),
68
- children: /*#__PURE__*/jsxs(PrimitivePrompt, {
69
- ref: containerRef,
70
- id: id,
71
- sentiment: sentiment,
72
- emphasis: sentiment === 'neutral' ? 'base' : 'elevated',
73
- "data-testid": testId,
74
- className: clsx('wds-critical-banner', {
75
- 'wds-critical-banner--collapsed': !resolvedExpanded,
76
- 'wds-critical-banner--with-two-actions': !!actionSecondary
77
- }, className),
78
- media: renderPromptMedia({
79
- media,
80
- sentiment,
81
- mediaId,
82
- imgClassName: 'wds-critical-banner--media-image'
83
- }),
84
- actions: hasActions ? /*#__PURE__*/jsxs("div", {
85
- "aria-hidden": !resolvedExpanded ? true : undefined,
86
- style: {
87
- display: 'contents'
88
- },
89
- children: [actionSecondary &&
90
- /*#__PURE__*/
91
- // @ts-expect-error onClick type mismatch
92
- jsx(Button, {
93
- v2: true,
94
- size: "md",
95
- priority: "secondary",
96
- href: actionSecondary.href,
97
- tabIndex: resolvedExpanded ? undefined : -1,
98
- onClick: actionSecondary?.onClick,
99
- children: actionSecondary.label
100
- }), action &&
101
- /*#__PURE__*/
102
- // @ts-expect-error onClick type mismatch
103
- jsx(Button, {
104
- v2: true,
105
- size: "md",
106
- priority: "primary",
107
- href: action.href,
108
- tabIndex: resolvedExpanded ? undefined : -1,
109
- onClick: action.onClick,
110
- children: action.label
111
- })]
112
- }) : undefined,
113
- role: "region",
114
- "aria-labelledby": ariaLabelledByIds || undefined,
115
- "aria-describedby": description ? descId : undefined,
116
- children: [/*#__PURE__*/jsxs("div", {
117
- className: "wds-critical-banner__text-wrapper",
118
- children: [title && /*#__PURE__*/jsx(Body, {
119
- id: titleId,
120
- type: Typography.BODY_LARGE_BOLD,
121
- className: "wds-critical-banner__content wds-critical-banner__title",
122
- children: title
123
- }), description && /*#__PURE__*/jsx(Body, {
124
- id: descId,
125
- className: clsx('wds-critical-banner__content', 'wds-critical-banner__description', {
126
- 'wds-critical-banner__description--with-title': !!title
127
- }),
128
- children: description
129
- })]
130
- }), /*#__PURE__*/jsx(ExpanderToggle, {
131
- expanded: resolvedExpanded,
132
- size: 24,
133
- className: "wds-critical-banner__toggle",
134
- onToggle: handleToggle
135
- })]
140
+ children: /*#__PURE__*/jsx("div", {
141
+ className: "wds-critical-banner-overhang-query",
142
+ children: /*#__PURE__*/jsx("div", {
143
+ className: "wds-critical-banner__entry-mask",
144
+ children: /*#__PURE__*/jsx("div", {
145
+ className: "wds-critical-banner__entry-track",
146
+ children: bannerSurface
147
+ })
148
+ })
136
149
  })
137
150
  });
138
151
  };
@@ -1 +1 @@
1
- {"version":3,"file":"CriticalBanner.mjs","sources":["../../../src/prompt/CriticalBanner/CriticalBanner.tsx"],"sourcesContent":["import { ReactNode, useId, useState } from 'react';\nimport { clsx } from 'clsx';\n\nimport Body from '../../body';\nimport Button from '../../button';\nimport { Breakpoint, LiveRegion, Typography } from '../../common';\nimport { ButtonProps } from '../../button/Button.types';\nimport { PrimitivePrompt, PrimitivePromptProps } from '../PrimitivePrompt';\n\nimport { renderPromptMedia, PromptMedia } from '../helpers/promptMedia';\nimport { ExpanderToggle } from '../common/Expander/Expander';\nimport { buildAnnouncementString } from './helpers';\nimport { useContainerSize } from '../../common/hooks/useContainerSize';\n\nexport type CriticalBannerProps = {\n title?: ReactNode;\n description: ReactNode;\n media?: PromptMedia;\n action?: Pick<ButtonProps, 'onClick' | 'href' | 'target'> & {\n label: ButtonProps['children'];\n };\n actionSecondary?: Pick<ButtonProps, 'onClick' | 'href' | 'target'> & {\n label: ButtonProps['children'];\n };\n sentiment?: Exclude<PrimitivePromptProps['sentiment'], 'proposition'>;\n /**\n * Controls whether the description and actions are visible, as a controlled component.\n * When collapsed with a title, only the title is shown.\n * When collapsed without a title, the description is trimmed to 2 lines.\n *\n * Note: On desktop (container width >= 768px), the banner is always expanded\n * regardless of this prop value.\n */\n expanded?: boolean;\n /**\n * Called when the user clicks the chevron toggle.\n * If not provided, the component will manage expanded state internally.\n */\n onToggle?: () => void;\n} & Pick<PrimitivePromptProps, 'id' | 'className' | 'data-testid'>;\n\n/**\n * A full-width, non-dismissible banner for critical messages such as account blocks or\n * time-sensitive actions that require immediate user attention.\n\n * @see {@link https://docs.wise.design/components/critical-banner Design Spec}\n */\nexport const CriticalBanner = ({\n sentiment = 'negative',\n title,\n description,\n media = {},\n action,\n actionSecondary,\n expanded: expandedProp,\n onToggle,\n id,\n className,\n 'data-testid': testId,\n}: CriticalBannerProps) => {\n const [containerRef, isDesktop] = useContainerSize(Breakpoint.MEDIUM);\n const isControlled = expandedProp !== undefined && onToggle !== undefined;\n const [internalExpanded, setInternalExpanded] = useState(true);\n const resolvedExpanded = isDesktop ? true : isControlled ? expandedProp : internalExpanded;\n const handleToggle = isControlled\n ? onToggle\n : () => setInternalExpanded((previousExpanded) => !previousExpanded);\n const hasActions = action ?? actionSecondary;\n const mediaId = useId();\n const titleId = useId();\n const descId = useId();\n\n const ariaLabelledByIds = [\n media['aria-hidden'] ? undefined : mediaId,\n !title ? undefined : titleId,\n ]\n .filter(Boolean)\n .join(' ');\n\n return (\n <LiveRegion\n aria-live=\"assertive\"\n announceOnChange={buildAnnouncementString({\n title,\n description,\n expanded: resolvedExpanded,\n actionLabel: action?.label,\n actionSecondaryLabel: actionSecondary?.label,\n })}\n >\n <PrimitivePrompt\n ref={containerRef}\n id={id}\n sentiment={sentiment}\n emphasis={sentiment === 'neutral' ? 'base' : 'elevated'}\n data-testid={testId}\n className={clsx(\n 'wds-critical-banner',\n {\n 'wds-critical-banner--collapsed': !resolvedExpanded,\n 'wds-critical-banner--with-two-actions': !!actionSecondary,\n },\n className,\n )}\n media={renderPromptMedia({\n media,\n sentiment,\n mediaId,\n imgClassName: 'wds-critical-banner--media-image',\n })}\n actions={\n hasActions ? (\n <div aria-hidden={!resolvedExpanded ? true : undefined} style={{ display: 'contents' }}>\n {actionSecondary && (\n // @ts-expect-error onClick type mismatch\n <Button\n v2\n size=\"md\"\n priority=\"secondary\"\n href={actionSecondary.href}\n tabIndex={resolvedExpanded ? undefined : -1}\n onClick={actionSecondary?.onClick}\n >\n {actionSecondary.label}\n </Button>\n )}\n {action && (\n // @ts-expect-error onClick type mismatch\n <Button\n v2\n size=\"md\"\n priority=\"primary\"\n href={action.href}\n tabIndex={resolvedExpanded ? undefined : -1}\n onClick={action.onClick}\n >\n {action.label}\n </Button>\n )}\n </div>\n ) : undefined\n }\n role=\"region\"\n aria-labelledby={ariaLabelledByIds || undefined}\n aria-describedby={description ? descId : undefined}\n >\n <div className=\"wds-critical-banner__text-wrapper\">\n {title && (\n <Body\n id={titleId}\n type={Typography.BODY_LARGE_BOLD}\n className=\"wds-critical-banner__content wds-critical-banner__title\"\n >\n {title}\n </Body>\n )}\n {description && (\n <Body\n id={descId}\n className={clsx('wds-critical-banner__content', 'wds-critical-banner__description', {\n 'wds-critical-banner__description--with-title': !!title,\n })}\n >\n {description}\n </Body>\n )}\n </div>\n <ExpanderToggle\n expanded={resolvedExpanded}\n size={24}\n className=\"wds-critical-banner__toggle\"\n onToggle={handleToggle}\n />\n </PrimitivePrompt>\n </LiveRegion>\n );\n};\n\nexport default CriticalBanner;\n"],"names":["CriticalBanner","sentiment","title","description","media","action","actionSecondary","expanded","expandedProp","onToggle","id","className","testId","containerRef","isDesktop","useContainerSize","Breakpoint","MEDIUM","isControlled","undefined","internalExpanded","setInternalExpanded","useState","resolvedExpanded","handleToggle","previousExpanded","hasActions","mediaId","useId","titleId","descId","ariaLabelledByIds","filter","Boolean","join","_jsx","LiveRegion","announceOnChange","buildAnnouncementString","actionLabel","label","actionSecondaryLabel","children","_jsxs","PrimitivePrompt","ref","emphasis","clsx","renderPromptMedia","imgClassName","actions","style","display","Button","v2","size","priority","href","tabIndex","onClick","role","Body","type","Typography","BODY_LARGE_BOLD","ExpanderToggle"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+CO,MAAMA,cAAc,GAAGA,CAAC;AAC7BC,EAAAA,SAAS,GAAG,UAAU;EACtBC,KAAK;EACLC,WAAW;EACXC,KAAK,GAAG,EAAE;EACVC,MAAM;EACNC,eAAe;AACfC,EAAAA,QAAQ,EAAEC,YAAY;EACtBC,QAAQ;EACRC,EAAE;EACFC,SAAS;AACT,EAAA,aAAa,EAAEC;AAAM,CACD,KAAI;EACxB,MAAM,CAACC,YAAY,EAAEC,SAAS,CAAC,GAAGC,gBAAgB,CAACC,UAAU,CAACC,MAAM,CAAC;EACrE,MAAMC,YAAY,GAAGV,YAAY,KAAKW,SAAS,IAAIV,QAAQ,KAAKU,SAAS;EACzE,MAAM,CAACC,gBAAgB,EAAEC,mBAAmB,CAAC,GAAGC,QAAQ,CAAC,IAAI,CAAC;EAC9D,MAAMC,gBAAgB,GAAGT,SAAS,GAAG,IAAI,GAAGI,YAAY,GAAGV,YAAY,GAAGY,gBAAgB;AAC1F,EAAA,MAAMI,YAAY,GAAGN,YAAY,GAC7BT,QAAQ,GACR,MAAMY,mBAAmB,CAAEI,gBAAgB,IAAK,CAACA,gBAAgB,CAAC;AACtE,EAAA,MAAMC,UAAU,GAAGrB,MAAM,IAAIC,eAAe;AAC5C,EAAA,MAAMqB,OAAO,GAAGC,KAAK,EAAE;AACvB,EAAA,MAAMC,OAAO,GAAGD,KAAK,EAAE;AACvB,EAAA,MAAME,MAAM,GAAGF,KAAK,EAAE;AAEtB,EAAA,MAAMG,iBAAiB,GAAG,CACxB3B,KAAK,CAAC,aAAa,CAAC,GAAGe,SAAS,GAAGQ,OAAO,EAC1C,CAACzB,KAAK,GAAGiB,SAAS,GAAGU,OAAO,CAC7B,CACEG,MAAM,CAACC,OAAO,CAAC,CACfC,IA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,CACL,eAAAgC,GAAA,CAAC8B,cAAc,EAAA;AACb1D,QAAAA,QAAQ,EAAEgB,gBAAiB;AAC3BgC,QAAAA,IAAI,EAAE,EAAG;AACT5C,QAAAA,SAAS,EAAC,6BAA6B;AACvCF,QAAAA,QAAQ,EAAEe;AAAa,OAAA,CAE3B;KAAiB;AACnB,GAAY,CAAC;AAEjB;;;;"}
1
+ {"version":3,"file":"CriticalBanner.mjs","sources":["../../../src/prompt/CriticalBanner/CriticalBanner.tsx"],"sourcesContent":["import { ElementType, ReactNode, useId, useState } from 'react';\nimport { clsx } from 'clsx';\n\nimport Body from '../../body';\nimport Button from '../../button';\nimport Container from '../../container';\nimport { Breakpoint, LiveRegion, Typography } from '../../common';\nimport { ButtonProps } from '../../button/Button.types';\nimport { PrimitivePrompt, PrimitivePromptProps } from '../PrimitivePrompt';\n\nimport { renderPromptMedia, PromptMedia } from '../helpers/promptMedia';\nimport { ExpanderToggle } from '../common/Expander/Expander';\nimport { buildAnnouncementString } from './helpers';\nimport { useContainerSize } from '../../common/hooks/useContainerSize';\n\nexport type CriticalBannerProps = {\n title?: ReactNode;\n description: ReactNode;\n media?: PromptMedia;\n action?: Pick<ButtonProps, 'onClick' | 'href' | 'target'> & {\n label: ButtonProps['children'];\n };\n actionSecondary?: Pick<ButtonProps, 'onClick' | 'href' | 'target'> & {\n label: ButtonProps['children'];\n };\n sentiment?: Exclude<PrimitivePromptProps['sentiment'], 'proposition'>;\n /**\n * Controls whether the description and actions are visible, as a controlled component.\n * When collapsed with a title, only the title is shown.\n * When collapsed without a title, the description is trimmed to 2 lines.\n *\n * Note: On desktop (container width >= 768px), the banner is always expanded\n * regardless of this prop value.\n */\n expanded?: boolean;\n /**\n * Called when the user clicks the chevron toggle.\n * If not provided, the component will manage expanded state internally.\n */\n onToggle?: () => void;\n} & Pick<PrimitivePromptProps, 'id' | 'className' | 'data-testid'>;\n\n/**\n * A full-width, non-dismissible banner for critical messages such as account blocks or\n * time-sensitive actions that require immediate user attention.\n\n * @see {@link https://docs.wise.design/components/critical-banner Design Spec}\n */\nexport const CriticalBanner = ({\n sentiment = 'negative',\n title,\n description,\n media = {},\n action,\n actionSecondary,\n expanded: expandedProp,\n onToggle,\n id,\n className,\n 'data-testid': testId,\n}: CriticalBannerProps) => {\n const [containerRef, isDesktop] = useContainerSize(Breakpoint.MEDIUM);\n const isControlled = expandedProp !== undefined && onToggle !== undefined;\n const [internalExpanded, setInternalExpanded] = useState(true);\n const resolvedExpanded = isDesktop ? true : isControlled ? expandedProp : internalExpanded;\n const handleToggle = isControlled\n ? onToggle\n : () => setInternalExpanded((previousExpanded) => !previousExpanded);\n const hasActions = action ?? actionSecondary;\n const mediaId = useId();\n const titleId = useId();\n const descId = useId();\n\n const ariaLabelledByIds = [\n media['aria-hidden'] ? undefined : mediaId,\n !title ? undefined : titleId,\n ]\n .filter(Boolean)\n .join(' ');\n\n const bannerSurface = (\n <Container\n size=\"fluid\"\n as={PrimitivePrompt as ElementType}\n ref={containerRef}\n id={id}\n sentiment={sentiment}\n emphasis={sentiment === 'neutral' ? 'base' : 'elevated'}\n data-testid={testId}\n className={clsx(\n 'wds-critical-banner',\n 'wds-critical-banner-overhang',\n {\n 'wds-critical-banner--collapsed': !resolvedExpanded,\n 'wds-critical-banner--with-two-actions': !!actionSecondary,\n },\n className,\n )}\n media={renderPromptMedia({\n media,\n sentiment,\n mediaId,\n imgClassName: 'wds-critical-banner--media-image',\n })}\n actions={\n hasActions ? (\n <div aria-hidden={!resolvedExpanded ? true : undefined} style={{ display: 'contents' }}>\n {actionSecondary && (\n // @ts-expect-error onClick type mismatch\n <Button\n v2\n size=\"md\"\n priority=\"secondary\"\n href={actionSecondary.href}\n tabIndex={resolvedExpanded ? undefined : -1}\n onClick={actionSecondary?.onClick}\n >\n {actionSecondary.label}\n </Button>\n )}\n {action && (\n // @ts-expect-error onClick type mismatch\n <Button\n v2\n size=\"md\"\n priority=\"primary\"\n href={action.href}\n tabIndex={resolvedExpanded ? undefined : -1}\n onClick={action.onClick}\n >\n {action.label}\n </Button>\n )}\n </div>\n ) : undefined\n }\n role=\"region\"\n aria-labelledby={ariaLabelledByIds || undefined}\n aria-describedby={description ? descId : undefined}\n >\n <div className=\"wds-critical-banner__text-wrapper\">\n {title && (\n <Body\n id={titleId}\n type={Typography.BODY_LARGE_BOLD}\n className=\"wds-critical-banner__content wds-critical-banner__title\"\n >\n {title}\n </Body>\n )}\n {description && (\n <Body\n id={descId}\n className={clsx('wds-critical-banner__content', 'wds-critical-banner__description', {\n 'wds-critical-banner__description--with-title': !!title,\n })}\n >\n {description}\n </Body>\n )}\n </div>\n <ExpanderToggle\n expanded={resolvedExpanded}\n size={24}\n className=\"wds-critical-banner__toggle\"\n onToggle={handleToggle}\n />\n </Container>\n );\n\n return (\n <LiveRegion\n aria-live=\"assertive\"\n announceOnChange={buildAnnouncementString({\n title,\n description,\n expanded: resolvedExpanded,\n actionLabel: action?.label,\n actionSecondaryLabel: actionSecondary?.label,\n })}\n >\n <div className=\"wds-critical-banner-overhang-query\">\n <div className=\"wds-critical-banner__entry-mask\">\n <div className=\"wds-critical-banner__entry-track\">{bannerSurface}</div>\n </div>\n </div>\n </LiveRegion>\n );\n};\n\nexport default CriticalBanner;\n"],"names":["CriticalBanner","sentiment","title","description","media","action","actionSecondary","expanded","expandedProp","onToggle","id","className","testId","containerRef","isDesktop","useContainerSize","Breakpoint","MEDIUM","isControlled","undefined","internalExpanded","setInternalExpanded","useState","resolvedExpanded","handleToggle","previousExpanded","hasActions","mediaId","useId","titleId","descId","ariaLabelledByIds","filter","Boolean","join","bannerSurface","_jsxs","Container","size","as","PrimitivePrompt","ref","emphasis","clsx","renderPromptMedia","imgClassName","actions","style","display","children","_jsx","Button","v2","priority","href","tabIndex","onClick","label","role","Body","type","Typography","BODY_LARGE_BOLD","ExpanderToggle","LiveRegion","announceOnChange","buildAnnouncementString","actionLabel","actionSecondaryLabel"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;A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AW;AACXI,MAAAA,QAAQ,EAAEgB,gBAAgB;MAC1B4C,WAAW,EAAE9D,MAAM,EAAEoD,KAAK;MAC1BW,oBAAoB,EAAE9D,eAAe,EAAEmD;AACxC,KAAA,CAAE;AAAAR,IAAAA,QAAA,eAEHC,GAAA,CAAA,KAAA,EAAA;AAAKvC,MAAAA,SAAS,EAAC,oCAAoC;AAAAsC,MAAAA,QAAA,eACjDC,GAAA,CAAA,KAAA,EAAA;AAAKvC,QAAAA,SAAS,EAAC,iCAAiC;AAAAsC,QAAAA,QAAA,eAC9CC,GAAA,CAAA,KAAA,EAAA;AAAKvC,UAAAA,SAAS,EAAC,kCAAkC;AAAAsC,UAAAA,QAAA,EAAEd;SAAmB;OACnE;KACF;AACP,GAAY,CAAC;AAEjB;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"PrimitivePrompt.js","sources":["../../../src/prompt/PrimitivePrompt/PrimitivePrompt.tsx"],"sourcesContent":["import { Cross } from '@transferwise/icons';\nimport { clsx } from 'clsx';\nimport SentimentSurface, { Emphasis, Sentiment } from '../../sentimentSurface';\nimport IconButton from '../../iconButton';\nimport { useIntl } from 'react-intl';\nimport closeBtnMessages from '../../common/closeButton/CloseButton.messages';\nimport { forwardRef, HTMLAttributes, ReactNode } from 'react';\n\nexport type PrimitivePromptProps = HTMLAttributes<HTMLDivElement> & {\n /**\n * The sentiment determines the colour scheme.\n * @default success\n */\n sentiment?: Sentiment;\n /**\n * The emphasis level affecting background and text contrast.\n * @default 'base'\n */\n emphasis?: Emphasis;\n /**\n * Media to be displayed on the prompt (icon/image/etc).\n */\n media: ReactNode;\n /**\n * Any actions to be displayed on the prompt.\n */\n actions?: ReactNode;\n /**\n * Handler called when the close button is clicked. If not provided, then the close button is hidden.\n */\n onDismiss?: () => void;\n /**\n * Test ID for testing tools\n */\n 'data-testid'?: string;\n};\n\n/**\n * PrimitivePrompt is a low-level component that provides the structure, sentiment support and styling for various prompts.\n * Uses several css variables to handle styling from within the consuming component, e.g. --Prompt-padding. */\nexport const PrimitivePrompt = forwardRef<HTMLDivElement, PrimitivePromptProps>(\n (\n {\n sentiment = 'success',\n emphasis = 'base',\n media,\n actions,\n onDismiss,\n className,\n children,\n ...restProps\n },\n ref,\n ) => {\n const intl = useIntl();\n\n return (\n <SentimentSurface\n // @ts-expect-error - SentimentSurface forwardRef types don't expose ref in props\n ref={ref}\n sentiment={sentiment}\n emphasis={emphasis}\n className={clsx('wds-prompt', `wds-prompt--${sentiment}`, className)}\n {...restProps}\n >\n <div\n className={clsx('wds-prompt__content-wrapper', {\n 'wds-prompt__content-wrapper--with-dismiss': !!onDismiss,\n })}\n >\n <div className={clsx('wds-prompt__media-wrapper')}>{media}</div>\n {children}\n {onDismiss && (\n <IconButton\n size={24}\n priority=\"secondary\"\n aria-label={intl.formatMessage(closeBtnMessages.ariaLabel)}\n onClick={onDismiss}\n >\n <Cross />\n </IconButton>\n )}\n {actions && <div className=\"wds-prompt__actions-wrapper\">{actions}</div>}\n </div>\n </SentimentSurface>\n );\n },\n);\n\nPrimitivePrompt.displayName = 'PrimitivePrompt';\n"],"names":["PrimitivePrompt","forwardRef","sentiment","emphasis","media","actions","onDismiss","className","children","restProps","ref","intl","useIntl","_jsx","SentimentSurface","clsx","_jsxs","IconButton","size","priority","formatMessage","closeBtnMessages","ariaLabel","onClick","Cross","displayName"],"mappings":";;;;;;;;;;;AAwCO,MAAMA,eAAe,gBAAGC,gBAAU,CACvC,CACE;AACEC,EAAAA,SAAS,GAAG,SAAS;AACrBC,EAAAA,QAAQ,GAAG,MAAM;EACjBC,KAAK;EACLC,OAAO;EACPC,SAAS;EACTC,SAAS;EACTC,QAAQ;EACR,GAAGC;AAAS,CACb,EACDC,GAAG,KACD;AACF,EAAA,MAAMC,IAAI,GAAGC,iBAAO,EAAE;AAEtB,EAAA,oBACEC,cAAA,CAACC;AACC;AAAA,IAAA;AACAJ,IAAAA,GAAG,EAAEA,GAAI;AACTR,IAAAA,SAAS,EAAEA,SAAU;AACrBC,IAAAA,QAAQ,EAAEA,QAAS;IACnBI,SAAS,EAAEQ,SAAI,CAAC,YAAY,EAAE,eAAeb,SAAS,CAAA,CAAE,EAAEK,SAAS,CAAE;AAAA,IAAA,GACjEE,SAAS;AAAAD,IAAAA,QAAA,eAEbQ,eAAA,CAAA,KAAA,EAAA;AACET,MAAAA,SAAS,EAAEQ,SAAI,CAAC,6BAA6B,EAAE;QAC7C,2CAA2C,EAAE,CAAC,CAACT;AAChD,OAAA,CAAE;AAAAE,MAAAA,QAAA,gBAEHK,cAAA,CAAA,KAAA,EAAA;AAAKN,QAAAA,SAAS,EAAEQ,SAAI,CAAC,2BAA2B,CAAE;AAAAP,QAAAA,QAAA,EAAEJ;OAAW,CAC/D,EAACI,QAAQ,EACRF,SAAS,iBACRO,cAAA,CAACI,kBAAU,EAAA;AACTC,QAAAA,IAAI,EAAE,EAAG;AACTC,QAAAA,QAAQ,EAAC,WAAW;AACpB,QAAA,YAAA,EAAYR,IAAI,CAACS,aAAa,CAACC,4BAAgB,CAACC,SAAS,CAAE;AAC3DC,QAAAA,OAAO,EAAEjB,SAAU;AAAAE,QAAAA,QAAA,eAEnBK,cAAA,CAACW,WAAK,EAAA,EAAA;AACR,OAAY,CACb,EACAnB,OAAO,iBAAIQ,cAAA,CAAA,KAAA,EAAA;AAAKN,QAAAA,SAAS,EAAC,6BAA6B;AAAAC,QAAAA,QAAA,EAAEH;AAAO,OAAM,CAAC;KACrE;AACP,GAAkB,CAAC;AAEvB,CAAC;AAGHL,eAAe,CAACyB,WAAW,GAAG,iBAAiB;;;;"}
1
+ {"version":3,"file":"PrimitivePrompt.js","sources":["../../../src/prompt/PrimitivePrompt/PrimitivePrompt.tsx"],"sourcesContent":["import { Cross } from '@transferwise/icons';\nimport { clsx } from 'clsx';\nimport SentimentSurface, { Emphasis, Sentiment } from '../../sentimentSurface';\nimport IconButton from '../../iconButton';\nimport { useIntl } from 'react-intl';\nimport closeBtnMessages from '../../common/closeButton/CloseButton.messages';\nimport { forwardRef, HTMLAttributes, ReactNode } from 'react';\n\nexport type PrimitivePromptProps = HTMLAttributes<HTMLDivElement> & {\n /**\n * The sentiment determines the colour scheme.\n * @default success\n */\n sentiment?: Sentiment;\n /**\n * The emphasis level affecting background and text contrast.\n * @default 'base'\n */\n emphasis?: Emphasis;\n /**\n * Media to be displayed on the prompt (icon/image/etc).\n */\n media: ReactNode;\n /**\n * Any actions to be displayed on the prompt.\n */\n actions?: ReactNode;\n /**\n * Handler called when the close button is clicked. If not provided, then the close button is hidden.\n */\n onDismiss?: () => void;\n /**\n * Test ID for testing tools\n */\n 'data-testid'?: string;\n};\n\n/**\n * PrimitivePrompt is a low-level component that provides the structure, sentiment support and styling for various prompts.\n * Uses several css variables to handle styling from within the consuming component, e.g. --Prompt-padding-x. */\nexport const PrimitivePrompt = forwardRef<HTMLDivElement, PrimitivePromptProps>(\n (\n {\n sentiment = 'success',\n emphasis = 'base',\n media,\n actions,\n onDismiss,\n className,\n children,\n ...restProps\n },\n ref,\n ) => {\n const intl = useIntl();\n\n return (\n <SentimentSurface\n // @ts-expect-error - SentimentSurface forwardRef types don't expose ref in props\n ref={ref}\n sentiment={sentiment}\n emphasis={emphasis}\n className={clsx('wds-prompt', `wds-prompt--${sentiment}`, className)}\n {...restProps}\n >\n <div\n className={clsx('wds-prompt__content-wrapper', {\n 'wds-prompt__content-wrapper--with-dismiss': !!onDismiss,\n })}\n >\n <div className={clsx('wds-prompt__media-wrapper')}>{media}</div>\n {children}\n {onDismiss && (\n <IconButton\n size={24}\n priority=\"secondary\"\n aria-label={intl.formatMessage(closeBtnMessages.ariaLabel)}\n onClick={onDismiss}\n >\n <Cross />\n </IconButton>\n )}\n {actions && <div className=\"wds-prompt__actions-wrapper\">{actions}</div>}\n </div>\n </SentimentSurface>\n );\n },\n);\n\nPrimitivePrompt.displayName = 'PrimitivePrompt';\n"],"names":["PrimitivePrompt","forwardRef","sentiment","emphasis","media","actions","onDismiss","className","children","restProps","ref","intl","useIntl","_jsx","SentimentSurface","clsx","_jsxs","IconButton","size","priority","formatMessage","closeBtnMessages","ariaLabel","onClick","Cross","displayName"],"mappings":";;;;;;;;;;;AAwCO,MAAMA,eAAe,gBAAGC,gBAAU,CACvC,CACE;AACEC,EAAAA,SAAS,GAAG,SAAS;AACrBC,EAAAA,QAAQ,GAAG,MAAM;EACjBC,KAAK;EACLC,OAAO;EACPC,SAAS;EACTC,SAAS;EACTC,QAAQ;EACR,GAAGC;AAAS,CACb,EACDC,GAAG,KACD;AACF,EAAA,MAAMC,IAAI,GAAGC,iBAAO,EAAE;AAEtB,EAAA,oBACEC,cAAA,CAACC;AACC;AAAA,IAAA;AACAJ,IAAAA,GAAG,EAAEA,GAAI;AACTR,IAAAA,SAAS,EAAEA,SAAU;AACrBC,IAAAA,QAAQ,EAAEA,QAAS;IACnBI,SAAS,EAAEQ,SAAI,CAAC,YAAY,EAAE,eAAeb,SAAS,CAAA,CAAE,EAAEK,SAAS,CAAE;AAAA,IAAA,GACjEE,SAAS;AAAAD,IAAAA,QAAA,eAEbQ,eAAA,CAAA,KAAA,EAAA;AACET,MAAAA,SAAS,EAAEQ,SAAI,CAAC,6BAA6B,EAAE;QAC7C,2CAA2C,EAAE,CAAC,CAACT;AAChD,OAAA,CAAE;AAAAE,MAAAA,QAAA,gBAEHK,cAAA,CAAA,KAAA,EAAA;AAAKN,QAAAA,SAAS,EAAEQ,SAAI,CAAC,2BAA2B,CAAE;AAAAP,QAAAA,QAAA,EAAEJ;OAAW,CAC/D,EAACI,QAAQ,EACRF,SAAS,iBACRO,cAAA,CAACI,kBAAU,EAAA;AACTC,QAAAA,IAAI,EAAE,EAAG;AACTC,QAAAA,QAAQ,EAAC,WAAW;AACpB,QAAA,YAAA,EAAYR,IAAI,CAACS,aAAa,CAACC,4BAAgB,CAACC,SAAS,CAAE;AAC3DC,QAAAA,OAAO,EAAEjB,SAAU;AAAAE,QAAAA,QAAA,eAEnBK,cAAA,CAACW,WAAK,EAAA,EAAA;AACR,OAAY,CAC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