@transferwise/components 0.0.0-experimental-b6b6dc1 → 0.0.0-experimental-a308934

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 (104) hide show
  1. package/build/expressiveMoneyInput/currencySelector/CurrencySelector.js +2 -3
  2. package/build/expressiveMoneyInput/currencySelector/CurrencySelector.js.map +1 -1
  3. package/build/expressiveMoneyInput/currencySelector/CurrencySelector.mjs +2 -3
  4. package/build/expressiveMoneyInput/currencySelector/CurrencySelector.mjs.map +1 -1
  5. package/build/field/Field.js +5 -4
  6. package/build/field/Field.js.map +1 -1
  7. package/build/field/Field.mjs +5 -4
  8. package/build/field/Field.mjs.map +1 -1
  9. package/build/i18n/en.json +2 -0
  10. package/build/i18n/en.json.js +2 -0
  11. package/build/i18n/en.json.js.map +1 -1
  12. package/build/i18n/en.json.mjs +2 -0
  13. package/build/i18n/en.json.mjs.map +1 -1
  14. package/build/index.js +2 -0
  15. package/build/index.js.map +1 -1
  16. package/build/index.mjs +1 -0
  17. package/build/index.mjs.map +1 -1
  18. package/build/listItem/Prompt/ListItemPrompt.js +5 -4
  19. package/build/listItem/Prompt/ListItemPrompt.js.map +1 -1
  20. package/build/listItem/Prompt/ListItemPrompt.mjs +5 -4
  21. package/build/listItem/Prompt/ListItemPrompt.mjs.map +1 -1
  22. package/build/main.css +85 -29
  23. package/build/prompt/ActionPrompt/ActionPrompt.js +8 -40
  24. package/build/prompt/ActionPrompt/ActionPrompt.js.map +1 -1
  25. package/build/prompt/ActionPrompt/ActionPrompt.mjs +8 -40
  26. package/build/prompt/ActionPrompt/ActionPrompt.mjs.map +1 -1
  27. package/build/prompt/CriticalBanner/CriticalBanner.js +145 -0
  28. package/build/prompt/CriticalBanner/CriticalBanner.js.map +1 -0
  29. package/build/prompt/CriticalBanner/CriticalBanner.mjs +143 -0
  30. package/build/prompt/CriticalBanner/CriticalBanner.mjs.map +1 -0
  31. package/build/prompt/CriticalBanner/helpers.js +29 -0
  32. package/build/prompt/CriticalBanner/helpers.js.map +1 -0
  33. package/build/prompt/CriticalBanner/helpers.mjs +26 -0
  34. package/build/prompt/CriticalBanner/helpers.mjs.map +1 -0
  35. package/build/prompt/PrimitivePrompt/PrimitivePrompt.js +2 -0
  36. package/build/prompt/PrimitivePrompt/PrimitivePrompt.js.map +1 -1
  37. package/build/prompt/PrimitivePrompt/PrimitivePrompt.mjs +2 -0
  38. package/build/prompt/PrimitivePrompt/PrimitivePrompt.mjs.map +1 -1
  39. package/build/prompt/common/Expander/Expander.js +47 -0
  40. package/build/prompt/common/Expander/Expander.js.map +1 -0
  41. package/build/prompt/common/Expander/Expander.messages.js +17 -0
  42. package/build/prompt/common/Expander/Expander.messages.js.map +1 -0
  43. package/build/prompt/common/Expander/Expander.messages.mjs +13 -0
  44. package/build/prompt/common/Expander/Expander.messages.mjs.map +1 -0
  45. package/build/prompt/common/Expander/Expander.mjs +44 -0
  46. package/build/prompt/common/Expander/Expander.mjs.map +1 -0
  47. package/build/prompt/helpers/promptMedia.js +52 -0
  48. package/build/prompt/helpers/promptMedia.js.map +1 -0
  49. package/build/prompt/helpers/promptMedia.mjs +50 -0
  50. package/build/prompt/helpers/promptMedia.mjs.map +1 -0
  51. package/build/styles/main.css +85 -29
  52. package/build/styles/prompt/CriticalBanner/CriticalBanner.css +39 -0
  53. package/build/styles/prompt/common/Expander/Expander.css +8 -0
  54. package/build/typeahead/Typeahead.js +5 -4
  55. package/build/typeahead/Typeahead.js.map +1 -1
  56. package/build/typeahead/Typeahead.mjs +5 -4
  57. package/build/typeahead/Typeahead.mjs.map +1 -1
  58. package/build/types/expressiveMoneyInput/currencySelector/CurrencySelector.d.ts.map +1 -1
  59. package/build/types/index.d.ts +2 -2
  60. package/build/types/index.d.ts.map +1 -1
  61. package/build/types/prompt/ActionPrompt/ActionPrompt.d.ts +2 -11
  62. package/build/types/prompt/ActionPrompt/ActionPrompt.d.ts.map +1 -1
  63. package/build/types/prompt/CriticalBanner/CriticalBanner.d.ts +43 -0
  64. package/build/types/prompt/CriticalBanner/CriticalBanner.d.ts.map +1 -0
  65. package/build/types/prompt/CriticalBanner/helpers.d.ts +18 -0
  66. package/build/types/prompt/CriticalBanner/helpers.d.ts.map +1 -0
  67. package/build/types/prompt/CriticalBanner/index.d.ts +3 -0
  68. package/build/types/prompt/CriticalBanner/index.d.ts.map +1 -0
  69. package/build/types/prompt/PrimitivePrompt/PrimitivePrompt.d.ts +8 -3
  70. package/build/types/prompt/PrimitivePrompt/PrimitivePrompt.d.ts.map +1 -1
  71. package/build/types/prompt/common/Expander/Expander.d.ts +20 -0
  72. package/build/types/prompt/common/Expander/Expander.d.ts.map +1 -0
  73. package/build/types/prompt/common/Expander/Expander.messages.d.ts +14 -0
  74. package/build/types/prompt/common/Expander/Expander.messages.d.ts.map +1 -0
  75. package/build/types/prompt/helpers/promptMedia.d.ts +22 -0
  76. package/build/types/prompt/helpers/promptMedia.d.ts.map +1 -0
  77. package/build/types/prompt/index.d.ts +2 -0
  78. package/build/types/prompt/index.d.ts.map +1 -1
  79. package/build/types/test-utils/index.d.ts +4 -0
  80. package/build/types/test-utils/index.d.ts.map +1 -1
  81. package/package.json +4 -4
  82. package/src/expressiveMoneyInput/currencySelector/CurrencySelector.tsx +2 -3
  83. package/src/i18n/en.json +2 -0
  84. package/src/index.ts +2 -2
  85. package/src/main.css +85 -29
  86. package/src/main.less +3 -1
  87. package/src/prompt/ActionPrompt/ActionPrompt.tsx +9 -62
  88. package/src/prompt/CriticalBanner/CriticalBanner.accessibility.docs.mdx +131 -0
  89. package/src/prompt/CriticalBanner/CriticalBanner.css +39 -0
  90. package/src/prompt/CriticalBanner/CriticalBanner.less +45 -0
  91. package/src/prompt/CriticalBanner/CriticalBanner.story.tsx +476 -0
  92. package/src/prompt/CriticalBanner/CriticalBanner.test.story.tsx +67 -0
  93. package/src/prompt/CriticalBanner/CriticalBanner.tsx +188 -0
  94. package/src/prompt/CriticalBanner/helpers.ts +39 -0
  95. package/src/prompt/CriticalBanner/index.ts +2 -0
  96. package/src/prompt/PrimitivePrompt/PrimitivePrompt.tsx +9 -2
  97. package/src/prompt/common/Expander/Expander.css +8 -0
  98. package/src/prompt/common/Expander/Expander.less +9 -0
  99. package/src/prompt/common/Expander/Expander.messages.ts +14 -0
  100. package/src/prompt/common/Expander/Expander.test.tsx +167 -0
  101. package/src/prompt/common/Expander/Expander.tsx +83 -0
  102. package/src/prompt/helpers/promptMedia.tsx +79 -0
  103. package/src/prompt/index.ts +4 -0
  104. package/src/sentimentSurface/SentimentSurface.story.tsx +43 -17
@@ -0,0 +1,20 @@
1
+ export type ExpanderState = {
2
+ expanded: boolean;
3
+ toggle: () => void;
4
+ setExpanded: (expanded: boolean) => void;
5
+ };
6
+ export declare function useExpanderState(initialExpanded?: boolean): ExpanderState;
7
+ export declare function shouldShowWhenExpanded({ expanded, hasContent, alwaysShow, }: {
8
+ expanded: boolean;
9
+ hasContent: boolean;
10
+ alwaysShow?: boolean;
11
+ }): boolean;
12
+ export type ExpanderToggleProps = {
13
+ expanded: boolean;
14
+ onToggle: () => void;
15
+ size?: 16 | 24 | 32 | 40 | 48 | 56 | 72;
16
+ className?: string;
17
+ 'data-testid'?: string;
18
+ };
19
+ export declare const ExpanderToggle: ({ expanded, onToggle, size, className, "data-testid": testId, }: ExpanderToggleProps) => import("react").JSX.Element;
20
+ //# sourceMappingURL=Expander.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Expander.d.ts","sourceRoot":"","sources":["../../../../../src/prompt/common/Expander/Expander.tsx"],"names":[],"mappings":"AAOA,MAAM,MAAM,aAAa,GAAG;IAC1B,QAAQ,EAAE,OAAO,CAAC;IAClB,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,WAAW,EAAE,CAAC,QAAQ,EAAE,OAAO,KAAK,IAAI,CAAC;CAC1C,CAAC;AAGF,wBAAgB,gBAAgB,CAAC,eAAe,UAAO,GAAG,aAAa,CAYtE;AAGD,wBAAgB,sBAAsB,CAAC,EACrC,QAAQ,EACR,UAAU,EACV,UAAkB,GACnB,EAAE;IACD,QAAQ,EAAE,OAAO,CAAC;IAClB,UAAU,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,GAAG,OAAO,CAMV;AAED,MAAM,MAAM,mBAAmB,GAAG;IAChC,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,IAAI,CAAC,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC;IACxC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC;AAGF,eAAO,MAAM,cAAc,GAAI,iEAM5B,mBAAmB,gCAsBrB,CAAC"}
@@ -0,0 +1,14 @@
1
+ declare const _default: {
2
+ expandAriaLabel: {
3
+ id: string;
4
+ defaultMessage: string;
5
+ description: string;
6
+ };
7
+ collapseAriaLabel: {
8
+ id: string;
9
+ defaultMessage: string;
10
+ description: string;
11
+ };
12
+ };
13
+ export default _default;
14
+ //# sourceMappingURL=Expander.messages.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Expander.messages.d.ts","sourceRoot":"","sources":["../../../../../src/prompt/common/Expander/Expander.messages.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,wBAWG"}
@@ -0,0 +1,22 @@
1
+ import { ReactNode } from 'react';
2
+ import { AvatarViewProps } from '../../avatarView';
3
+ import { BadgeAssetsProps } from '../../badge';
4
+ import { PrimitivePromptProps } from '../PrimitivePrompt';
5
+ export type PromptMedia = {
6
+ imgSrc?: string;
7
+ avatar?: Pick<AvatarViewProps, 'imgSrc' | 'profileName' | 'profileType'> & {
8
+ asset?: AvatarViewProps['children'];
9
+ badge?: Pick<BadgeAssetsProps, 'flagCode'>;
10
+ };
11
+ 'aria-label'?: string;
12
+ 'aria-hidden'?: boolean;
13
+ };
14
+ type RenderPromptMediaOptions = {
15
+ media: PromptMedia;
16
+ sentiment: PrimitivePromptProps['sentiment'];
17
+ mediaId: string;
18
+ imgClassName: string;
19
+ };
20
+ export declare function renderPromptMedia({ media, sentiment, mediaId, imgClassName, }: RenderPromptMediaOptions): ReactNode;
21
+ export {};
22
+ //# sourceMappingURL=promptMedia.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"promptMedia.d.ts","sourceRoot":"","sources":["../../../../src/prompt/helpers/promptMedia.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGlC,OAAmB,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAG/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAE1D,MAAM,MAAM,WAAW,GAAG;IACxB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,IAAI,CAAC,eAAe,EAAE,QAAQ,GAAG,aAAa,GAAG,aAAa,CAAC,GAAG;QACzE,KAAK,CAAC,EAAE,eAAe,CAAC,UAAU,CAAC,CAAC;QACpC,KAAK,CAAC,EAAE,IAAI,CAAC,gBAAgB,EAAE,UAAU,CAAC,CAAC;KAC5C,CAAC;IACF,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB,CAAC;AAEF,KAAK,wBAAwB,GAAG;IAC9B,KAAK,EAAE,WAAW,CAAC;IACnB,SAAS,EAAE,oBAAoB,CAAC,WAAW,CAAC,CAAC;IAC7C,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,wBAAgB,iBAAiB,CAAC,EAChC,KAAK,EACL,SAAS,EACT,OAAO,EACP,YAAY,GACb,EAAE,wBAAwB,GAAG,SAAS,CA+CtC"}
@@ -4,4 +4,6 @@ export type { ActionPromptProps } from './ActionPrompt';
4
4
  export { ActionPrompt } from './ActionPrompt';
5
5
  export type { InfoPromptProps, InfoPromptAction, InfoPromptMedia } from './InfoPrompt';
6
6
  export { InfoPrompt } from './InfoPrompt';
7
+ export type { CriticalBannerProps } from './CriticalBanner';
8
+ export { CriticalBanner } from './CriticalBanner';
7
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/prompt/index.ts"],"names":[],"mappings":"AAIA,YAAY,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAG9C,YAAY,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAG9C,YAAY,EAAE,eAAe,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACvF,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/prompt/index.ts"],"names":[],"mappings":"AAIA,YAAY,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAG9C,YAAY,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAG9C,YAAY,EAAE,eAAe,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACvF,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG1C,YAAY,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC"}
@@ -26,6 +26,8 @@ declare function customRender(ui: ReactElement, { locale, messages, ...renderOpt
26
26
  "neptune.DateLookup.selected": string;
27
27
  "neptune.DateLookup.twentyYears": string;
28
28
  "neptune.DateLookup.year": string;
29
+ "neptune.Expander.collapseAriaLabel": string;
30
+ "neptune.Expander.expandAriaLabel": string;
29
31
  "neptune.ExpressiveMoneyInput.currency.search.placeholder": string;
30
32
  "neptune.ExpressiveMoneyInput.currency.select.currency": string;
31
33
  "neptune.FlowNavigation.back": string;
@@ -111,6 +113,8 @@ declare function customRenderHook(callback: () => unknown, { locale, messages }?
111
113
  "neptune.DateLookup.selected": string;
112
114
  "neptune.DateLookup.twentyYears": string;
113
115
  "neptune.DateLookup.year": string;
116
+ "neptune.Expander.collapseAriaLabel": string;
117
+ "neptune.Expander.expandAriaLabel": string;
114
118
  "neptune.ExpressiveMoneyInput.currency.search.placeholder": string;
115
119
  "neptune.ExpressiveMoneyInput.currency.select.currency": string;
116
120
  "neptune.FlowNavigation.back": string;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/test-utils/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAM,MAAM,OAAO,CAAC;AACzC,OAAO,EAAE,MAAM,EAAc,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAMxD;;;;GAIG;AACH,iBAAS,YAAY,CACnB,EAAE,EAAE,YAAY,EAChB,EAAE,MAAuB,EAAE,QAAa,EAAE,GAAG,aAAa,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAAK,GAChE,UAAU,CAAC,OAAO,MAAM,CAAC,CAK3B;AAED;;;GAGG;AACH,iBAAS,gBAAgB,CACvB,QAAQ,EAAE,MAAM,OAAO,EACvB,EAAE,MAAuB,EAAE,QAAa,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAAK,uEAKhD;AAED,cAAc,wBAAwB,CAAC;AACvC,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,YAAY,IAAI,MAAM,EAAE,gBAAgB,IAAI,UAAU,EAAE,SAAS,EAAE,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/test-utils/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAM,MAAM,OAAO,CAAC;AACzC,OAAO,EAAE,MAAM,EAAc,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAMxD;;;;GAIG;AACH,iBAAS,YAAY,CACnB,EAAE,EAAE,YAAY,EAChB,EAAE,MAAuB,EAAE,QAAa,EAAE,GAAG,aAAa,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAAK,GAChE,UAAU,CAAC,OAAO,MAAM,CAAC,CAK3B;AAED;;;GAGG;AACH,iBAAS,gBAAgB,CACvB,QAAQ,EAAE,MAAM,OAAO,EACvB,EAAE,MAAuB,EAAE,QAAa,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAAK,uEAKhD;AAED,cAAc,wBAAwB,CAAC;AACvC,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,YAAY,IAAI,MAAM,EAAE,gBAAgB,IAAI,UAAU,EAAE,SAAS,EAAE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@transferwise/components",
3
- "version": "0.0.0-experimental-b6b6dc1",
3
+ "version": "0.0.0-experimental-a308934",
4
4
  "description": "Neptune React components",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -88,8 +88,8 @@
88
88
  "storybook-addon-test-codegen": "^3.0.1",
89
89
  "@transferwise/less-config": "3.1.2",
90
90
  "@transferwise/neptune-css": "14.27.1",
91
- "@wise/components-theming": "1.10.1",
92
- "@wise/wds-configs": "0.0.0"
91
+ "@wise/wds-configs": "0.0.0",
92
+ "@wise/components-theming": "1.10.1"
93
93
  },
94
94
  "peerDependencies": {
95
95
  "@transferwise/icons": "^3 || ^4",
@@ -107,7 +107,7 @@
107
107
  "@popperjs/core": "^2.11.8",
108
108
  "@react-aria/focus": "^3.21.5",
109
109
  "@react-aria/overlays": "^3.31.2",
110
- "@transferwise/formatting": "^2.14.0",
110
+ "@transferwise/formatting": "^2.13.7",
111
111
  "@transferwise/neptune-validation": "^3.3.3",
112
112
  "clsx": "^2.1.1",
113
113
  "commonmark": "^0.31.2",
@@ -19,7 +19,6 @@ import { useIntl } from 'react-intl';
19
19
 
20
20
  import messages from '../ExpressiveMoneyInput.messages';
21
21
  import { getLocaleCurrencyName } from '../../common';
22
- import { formatCurrencyCode } from '@transferwise/formatting';
23
22
 
24
23
  export interface CurrencyOption {
25
24
  label?: string;
@@ -100,7 +99,7 @@ export const CurrencySelector = ({
100
99
  renderValue={({ code, label }) => {
101
100
  return (
102
101
  <SelectInputOptionContent
103
- title={formatCurrencyCode(code)}
102
+ title={code}
104
103
  note={label}
105
104
  icon={<Flag code={code} intrinsicSize={24} />}
106
105
  />
@@ -129,7 +128,7 @@ export const CurrencySelector = ({
129
128
  onClick={(event) => handleTriggerClick(event)}
130
129
  >
131
130
  <>
132
- <span aria-hidden>{formatCurrencyCode(currency)}</span>
131
+ <span aria-hidden>{currency}</span>
133
132
  <span className="sr-only">{getLocaleCurrencyName(intl, currency)}</span>
134
133
  </>
135
134
  </SelectInputTriggerButton>
package/src/i18n/en.json CHANGED
@@ -16,6 +16,8 @@
16
16
  "neptune.DateLookup.selected": "selected",
17
17
  "neptune.DateLookup.twentyYears": "20 years",
18
18
  "neptune.DateLookup.year": "year",
19
+ "neptune.Expander.collapseAriaLabel": "Collapse",
20
+ "neptune.Expander.expandAriaLabel": "Expand",
19
21
  "neptune.ExpressiveMoneyInput.currency.search.placeholder": "Type a currency / country",
20
22
  "neptune.ExpressiveMoneyInput.currency.select.currency": "Select currency",
21
23
  "neptune.FlowNavigation.back": "back to previous step",
package/src/index.ts CHANGED
@@ -35,7 +35,7 @@ export type { HeaderProps } from './header';
35
35
  export type { EmphasisProps } from './emphasis';
36
36
  export type { FieldProps } from './field/Field';
37
37
  export type { InfoProps } from './info';
38
- export type { InlinePromptProps, ActionPromptProps } from './prompt';
38
+ export type { InlinePromptProps, ActionPromptProps, CriticalBannerProps } from './prompt';
39
39
  export type { InfoPromptProps, InfoPromptAction, InfoPromptMedia } from './prompt';
40
40
  export type { InputWithDisplayFormatProps } from './inputWithDisplayFormat';
41
41
  export type { InputProps } from './inputs/Input';
@@ -173,7 +173,7 @@ export { default as Header } from './header';
173
173
  export { default as Image } from './image';
174
174
  export { default as Info } from './info';
175
175
  export { default as InlineAlert } from './inlineAlert';
176
- export { InfoPrompt, InlinePrompt, ActionPrompt } from './prompt';
176
+ export { InfoPrompt, InlinePrompt, ActionPrompt, CriticalBanner } from './prompt';
177
177
  export { default as InputWithDisplayFormat } from './inputWithDisplayFormat';
178
178
  export { Input } from './inputs/Input';
179
179
  export { InputGroup } from './inputs/InputGroup';
package/src/main.css CHANGED
@@ -32176,6 +32176,91 @@ html:not([dir="rtl"]) .np-navigation-option {
32176
32176
  padding: 0;
32177
32177
  }
32178
32178
 
32179
+ .wds-action-prompt {
32180
+ --Prompt-padding: var(--size-16);
32181
+ --Prompt-actions-gap: var(--size-8);
32182
+ --Prompt-gap: var(--size-10) var(--size-16);
32183
+ --Prompt-border-radius: var(--radius-large);
32184
+ }
32185
+
32186
+ .wds-action-prompt--media-image {
32187
+ width: 48px;
32188
+ width: var(--size-48);
32189
+ height: 48px;
32190
+ height: var(--size-48);
32191
+ -o-object-fit: contain;
32192
+ object-fit: contain;
32193
+ }
32194
+
32195
+ @media (max-width: 767px) {
32196
+ .wds-action-prompt--with-two-actions .wds-prompt__actions-wrapper .wds-Button {
32197
+ flex: 1 1 calc(50% - (var(--Prompt-actions-gap) / 2));
32198
+ min-width: -moz-fit-content;
32199
+ min-width: fit-content;
32200
+ }
32201
+ }
32202
+
32203
+ .wds-action-prompt__content {
32204
+ max-width: calc(48px * 10);
32205
+ max-width: calc(var(--size-48) * 10);
32206
+ }
32207
+
32208
+ .wds-critical-banner {
32209
+ --Prompt-padding: var(--size-16);
32210
+ --Prompt-actions-gap: var(--size-8);
32211
+ --Prompt-gap: var(--size-10) var(--size-16);
32212
+ --Prompt-border-radius: 0;
32213
+ }
32214
+
32215
+ .wds-critical-banner--media-image {
32216
+ width: 48px;
32217
+ width: var(--size-48);
32218
+ height: 48px;
32219
+ height: var(--size-48);
32220
+ -o-object-fit: contain;
32221
+ object-fit: contain;
32222
+ }
32223
+
32224
+ @media (max-width: 767px) {
32225
+ .wds-critical-banner--with-two-actions .wds-prompt__actions-wrapper .wds-Button {
32226
+ flex: 1 1 calc(50% - (var(--Prompt-actions-gap) / 2));
32227
+ min-width: -moz-fit-content;
32228
+ min-width: fit-content;
32229
+ }
32230
+ }
32231
+
32232
+ .wds-critical-banner__description--collapsed {
32233
+ display: -webkit-box;
32234
+ -webkit-line-clamp: 2;
32235
+ -webkit-box-orient: vertical;
32236
+ overflow: hidden;
32237
+ }
32238
+
32239
+ .wds-critical-banner .wds-prompt__content-wrapper {
32240
+ grid-template-columns: auto 1fr auto;
32241
+ align-items: flex-start;
32242
+ }
32243
+
32244
+ .wds-critical-banner__text-wrapper {
32245
+ min-width: 0;
32246
+ }
32247
+
32248
+ @media (max-width: 767px) {
32249
+ .wds-critical-banner .wds-prompt__actions-wrapper {
32250
+ grid-column: span 3;
32251
+ }
32252
+ }
32253
+
32254
+ .wds-expander-toggle {
32255
+ align-self: flex-start;
32256
+ flex-shrink: 0;
32257
+ transition: transform 0.2s ease-in-out;
32258
+ }
32259
+
32260
+ .wds-expander-toggle--collapsed {
32261
+ transform: rotate(180deg);
32262
+ }
32263
+
32179
32264
  .wds-radio-group .np-radio:last-child label {
32180
32265
  margin-bottom: 0;
32181
32266
  }
@@ -34600,32 +34685,3 @@ html:not([dir="rtl"]) .np-navigation-option {
34600
34685
  .np-list-item__action {
34601
34686
  flex-shrink: 0;
34602
34687
  }
34603
-
34604
- .wds-action-prompt {
34605
- --Prompt-padding: var(--size-16);
34606
- --Prompt-actions-gap: var(--size-8);
34607
- --Prompt-gap: var(--size-10) var(--size-16);
34608
- --Prompt-border-radius: var(--radius-large);
34609
- }
34610
-
34611
- .wds-action-prompt--media-image {
34612
- width: 48px;
34613
- width: var(--size-48);
34614
- height: 48px;
34615
- height: var(--size-48);
34616
- -o-object-fit: contain;
34617
- object-fit: contain;
34618
- }
34619
-
34620
- @media (max-width: 767px) {
34621
- .wds-action-prompt--with-two-actions .wds-prompt__actions-wrapper .wds-Button {
34622
- flex: 1 1 calc(50% - (var(--Prompt-actions-gap) / 2));
34623
- min-width: -moz-fit-content;
34624
- min-width: fit-content;
34625
- }
34626
- }
34627
-
34628
- .wds-action-prompt__content {
34629
- max-width: calc(48px * 10);
34630
- max-width: calc(var(--size-48) * 10);
34631
- }
package/src/main.less CHANGED
@@ -66,6 +66,9 @@
66
66
  @import "./prompt/PrimitivePrompt/PrimitivePrompt.less";
67
67
  @import "./prompt/InlinePrompt/InlinePrompt.less";
68
68
  @import "./prompt/InfoPrompt/InfoPrompt.less";
69
+ @import "./prompt/ActionPrompt/ActionPrompt.less";
70
+ @import "./prompt/CriticalBanner/CriticalBanner.less";
71
+ @import "./prompt/common/Expander/Expander.less";
69
72
  @import "./radioGroup/RadioGroup.less";
70
73
  @import "./section/Section.less";
71
74
  @import "./slidingPanel/SlidingPanel.less";
@@ -90,7 +93,6 @@
90
93
  @import "./progress/Progress.less";
91
94
  @import "./progressBar/ProgressBar.less";
92
95
  @import "./legacylistItem/LegacyListItem.less";
93
- @import "./prompt/ActionPrompt/ActionPrompt.less";
94
96
 
95
97
  // List all less files in src in alphabetical order: find -s src -type f -name '*.less' ! -name 'main.less'
96
98
  // Make sure you are not referencing main.less itself in this file!
@@ -1,31 +1,19 @@
1
1
  import { AriaAttributes, ReactNode, useId } from 'react';
2
2
  import { clsx } from 'clsx';
3
3
 
4
- import StatusIcon from '../../statusIcon';
5
4
  import Body from '../../body';
6
5
  import Button from '../../button';
7
6
  import { Breakpoint, Typography } from '../../common';
8
- import AvatarView, { AvatarViewProps } from '../../avatarView';
9
- import Image from '../../image';
10
7
  import { ButtonProps } from '../../button/Button.types';
11
8
  import { PrimitivePrompt, PrimitivePromptProps } from '../PrimitivePrompt';
12
- import { BadgeAssetsProps } from '../../badge';
13
- import { GiftBox } from '@transferwise/icons';
14
9
  import { useScreenSize } from '../../common/hooks/useScreenSize';
10
+ import { renderPromptMedia, PromptMedia } from '../helpers/promptMedia';
15
11
 
16
12
  export type ActionPromptProps = {
17
13
  title: ReactNode;
18
14
  description?: ReactNode;
19
15
  /** @default {} */
20
- media?: {
21
- imgSrc?: string;
22
- avatar?: Pick<AvatarViewProps, 'imgSrc' | 'profileName' | 'profileType'> & {
23
- asset?: AvatarViewProps['children'];
24
- badge?: Pick<BadgeAssetsProps, 'flagCode'>;
25
- };
26
- 'aria-label'?: string;
27
- 'aria-hidden'?: boolean;
28
- };
16
+ media?: PromptMedia;
29
17
  action: Pick<ButtonProps, 'onClick' | 'href' | 'target'> & {
30
18
  label: ButtonProps['children'];
31
19
  };
@@ -74,54 +62,13 @@ export const ActionPrompt = ({
74
62
  .filter(Boolean)
75
63
  .join(' ');
76
64
 
77
- const renderMedia = () => {
78
- if (media?.imgSrc) {
79
- return (
80
- <Image
81
- id={mediaId}
82
- src={media.imgSrc}
83
- className="wds-action-prompt--media-image"
84
- alt={media['aria-label'] ?? ''}
85
- />
86
- );
87
- }
88
- if (media?.avatar) {
89
- const badge = media.avatar.badge
90
- ? media.avatar.badge
91
- : sentiment === 'proposition'
92
- ? {}
93
- : { status: sentiment };
94
- return (
95
- <AvatarView
96
- {...media.avatar}
97
- badge={badge}
98
- aria-label={media['aria-label']}
99
- aria-hidden={media['aria-hidden']}
100
- id={mediaId}
101
- size={48}
102
- >
103
- {media.avatar.asset}
104
- </AvatarView>
105
- );
106
- }
107
- return sentiment === 'proposition' ? (
108
- <AvatarView
109
- id={mediaId}
110
- size={48}
111
- aria-label={media['aria-label']}
112
- aria-hidden={media['aria-hidden']}
113
- >
114
- <GiftBox />
115
- </AvatarView>
116
- ) : (
117
- <StatusIcon
118
- id={mediaId}
119
- size={48}
120
- sentiment={sentiment}
121
- iconLabel={media['aria-hidden'] ? null : media['aria-label']}
122
- />
123
- );
124
- };
65
+ const renderMedia = () =>
66
+ renderPromptMedia({
67
+ media,
68
+ sentiment,
69
+ mediaId,
70
+ imgClassName: 'wds-action-prompt--media-image',
71
+ });
125
72
 
126
73
  return (
127
74
  <PrimitivePrompt
@@ -0,0 +1,131 @@
1
+ import { Meta, Source, Canvas } from '@storybook/addon-docs/blocks';
2
+ import * as CriticalBannerStories from './CriticalBanner.story';
3
+
4
+ <Meta title="Prompts/CriticalBanner/Accessibility" tags={['new']} />
5
+
6
+ # Accessibility
7
+
8
+ Under the hood, `CriticalBanner` is marked as `role="region"` for a section of content that users might want to navigate to directly.
9
+
10
+ By default, it's labelled by the `title` and described by the `description`.
11
+
12
+ ## Announcement Behavior
13
+
14
+ `CriticalBanner` is designed for critical messages that require immediate attention. It always uses **`aria-live="assertive"`** to immediately interrupt and announce changes to screen readers.
15
+
16
+ Unlike `InfoPrompt` which offers configurable politeness levels, `CriticalBanner` is always assertive because it communicates critical, time-sensitive information that users must be aware of immediately.
17
+
18
+ ### What Gets Announced
19
+
20
+ The component intelligently announces only **visible content**, respecting the collapsed/expanded state:
21
+
22
+ - **Collapsed with title**: Announces title only (description is hidden)
23
+ - **Collapsed without title**: Announces description only (visible up to 2 lines)
24
+ - **Expanded**: Announces title, description, and action button labels (all visible)
25
+
26
+ <Source
27
+ dark
28
+ code={`
29
+ // Collapsed with title - announces: "Your account requires verification"
30
+ <CriticalBanner
31
+ title="Your account requires verification"
32
+ description="Please verify your identity to continue"
33
+ action={{ label: "Verify now", onClick: handleVerify }}
34
+ expanded={false}
35
+ onToggle={handleToggle}
36
+ />
37
+
38
+ // Expanded - announces: "Your account requires verification | Please verify your identity to continue | Verify now | Learn more"
39
+
40
+ <CriticalBanner
41
+ title="Your account requires verification"
42
+ description="Please verify your identity to continue"
43
+ action={{ label: 'Verify now', onClick: handleVerify }}
44
+ actionSecondary={{ label: 'Learn more', onClick: handleLearnMore }}
45
+ expanded={true}
46
+ onToggle={handleToggle}
47
+ />
48
+
49
+ // Collapsed without title - announces: "Your verification is pending..."
50
+
51
+ <CriticalBanner
52
+ description="Your verification is pending. We'll notify you once complete."
53
+ expanded={false}
54
+ onToggle={handleToggle}
55
+ />
56
+ `}
57
+ />
58
+
59
+ ### When Announcements Trigger
60
+
61
+ Screen readers announce the banner content whenever:
62
+
63
+ - The banner first appears in the DOM
64
+ - The user toggles between collapsed and expanded states
65
+ - The content (title, description, or action labels) changes
66
+
67
+ ## Custom Labels
68
+
69
+ If you want to provide a custom label for screen readers, you can use the `aria-label` prop. Make sure to include all necessary information in it, because when provided, the default labelling will be removed.
70
+
71
+ <Source
72
+ dark
73
+ code={`
74
+ <CriticalBanner
75
+ title="Account suspended"
76
+ description="Unusual activity detected"
77
+ action={{ label: "Verify identity", onClick: handleVerify }}
78
+ aria-label="Critical: Your account has been suspended due to unusual activity. Please verify your identity immediately to restore access."
79
+ expanded={false}
80
+ onToggle={handleToggle}
81
+ />
82
+ `}
83
+ />
84
+
85
+ ## Media
86
+
87
+ Custom media icons should include their own accessibility attributes. Use the `title` prop on icons to provide accessible names for screen readers:
88
+
89
+ <Source
90
+ dark
91
+ code={`
92
+ import { Bank, AlertCircle } from '@transferwise/icons';
93
+
94
+ <CriticalBanner
95
+ title="Bank connection required"
96
+ description="Connect your bank account to continue"
97
+ media={{ avatar: { asset: <Bank title="Bank account" /> } }}
98
+ action={{ label: 'Connect now', onClick: handleConnect }}
99
+ expanded={false}
100
+ onToggle={handleToggle}
101
+ />
102
+
103
+ <CriticalBanner
104
+ title="Verification required"
105
+ description="We need to verify your identity"
106
+ media={{ avatar: { asset: <AlertCircle title="Alert" /> } }}
107
+ action={{ label: "Start verification", onClick: handleVerify }}
108
+ expanded={false}
109
+ onToggle={handleToggle}
110
+ />
111
+ `}
112
+ />
113
+
114
+ Alternatively, you can use `media['aria-label']` to provide a label for custom images:
115
+
116
+ <Source
117
+ dark
118
+ code={`
119
+ <CriticalBanner
120
+ title="Card blocked"
121
+ description="Your card has been blocked for security reasons"
122
+ media={{
123
+ imgSrc: '/wise-card.svg',
124
+ 'aria-label': 'Wise debit card'
125
+ }}
126
+ action={{ label: "Unblock card", onClick: handleUnblock }}
127
+ expanded={false}
128
+ onToggle={handleToggle}
129
+ />
130
+ `}
131
+ />
@@ -0,0 +1,39 @@
1
+ .wds-critical-banner {
2
+ --Prompt-padding: var(--size-16);
3
+ --Prompt-actions-gap: var(--size-8);
4
+ --Prompt-gap: var(--size-10) var(--size-16);
5
+ --Prompt-border-radius: 0;
6
+ }
7
+ .wds-critical-banner--media-image {
8
+ width: 48px;
9
+ width: var(--size-48);
10
+ height: 48px;
11
+ height: var(--size-48);
12
+ -o-object-fit: contain;
13
+ object-fit: contain;
14
+ }
15
+ @media (max-width: 767px) {
16
+ .wds-critical-banner--with-two-actions .wds-prompt__actions-wrapper .wds-Button {
17
+ flex: 1 1 calc(50% - (var(--Prompt-actions-gap) / 2));
18
+ min-width: -moz-fit-content;
19
+ min-width: fit-content;
20
+ }
21
+ }
22
+ .wds-critical-banner__description--collapsed {
23
+ display: -webkit-box;
24
+ -webkit-line-clamp: 2;
25
+ -webkit-box-orient: vertical;
26
+ overflow: hidden;
27
+ }
28
+ .wds-critical-banner .wds-prompt__content-wrapper {
29
+ grid-template-columns: auto 1fr auto;
30
+ align-items: flex-start;
31
+ }
32
+ .wds-critical-banner__text-wrapper {
33
+ min-width: 0;
34
+ }
35
+ @media (max-width: 767px) {
36
+ .wds-critical-banner .wds-prompt__actions-wrapper {
37
+ grid-column: span 3;
38
+ }
39
+ }
@@ -0,0 +1,45 @@
1
+ .wds-critical-banner {
2
+ --Prompt-padding: var(--size-16);
3
+ --Prompt-actions-gap: var(--size-8);
4
+ --Prompt-gap: var(--size-10) var(--size-16);
5
+ --Prompt-border-radius: 0;
6
+
7
+ &--media-image {
8
+ width: var(--size-48);
9
+ height: var(--size-48);
10
+ object-fit: contain;
11
+ }
12
+
13
+ &--with-two-actions {
14
+ @media (--screen-sm-max) {
15
+ .wds-prompt__actions-wrapper {
16
+ .wds-Button {
17
+ flex: 1 1 calc(50% - (var(--Prompt-actions-gap) / 2));
18
+ min-width: fit-content;
19
+ }
20
+ }
21
+ }
22
+ }
23
+
24
+ &__description--collapsed {
25
+ display: -webkit-box;
26
+ -webkit-line-clamp: 2;
27
+ -webkit-box-orient: vertical;
28
+ overflow: hidden;
29
+ }
30
+
31
+ .wds-prompt__content-wrapper {
32
+ grid-template-columns: auto 1fr auto;
33
+ align-items: flex-start;
34
+ }
35
+
36
+ &__text-wrapper {
37
+ min-width: 0;
38
+ }
39
+
40
+ .wds-prompt__actions-wrapper {
41
+ @media (--screen-sm-max) {
42
+ grid-column: span 3;
43
+ }
44
+ }
45
+ }