@transferwise/components 46.125.0 → 46.127.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 (197) hide show
  1. package/build/avatarView/AvatarView.js.map +1 -1
  2. package/build/avatarView/AvatarView.mjs.map +1 -1
  3. package/build/common/locale/index.js +13 -0
  4. package/build/common/locale/index.js.map +1 -1
  5. package/build/common/locale/index.mjs +13 -1
  6. package/build/common/locale/index.mjs.map +1 -1
  7. package/build/expressiveMoneyInput/currencySelector/CurrencySelector.js +31 -1
  8. package/build/expressiveMoneyInput/currencySelector/CurrencySelector.js.map +1 -1
  9. package/build/expressiveMoneyInput/currencySelector/CurrencySelector.mjs +32 -2
  10. package/build/expressiveMoneyInput/currencySelector/CurrencySelector.mjs.map +1 -1
  11. package/build/field/Field.js +1 -0
  12. package/build/field/Field.js.map +1 -1
  13. package/build/field/Field.mjs +1 -0
  14. package/build/field/Field.mjs.map +1 -1
  15. package/build/index.js +3 -0
  16. package/build/index.js.map +1 -1
  17. package/build/index.mjs +2 -1
  18. package/build/index.mjs.map +1 -1
  19. package/build/inputs/Input.js.map +1 -1
  20. package/build/inputs/Input.mjs.map +1 -1
  21. package/build/inputs/SearchInput.js.map +1 -1
  22. package/build/inputs/SearchInput.mjs.map +1 -1
  23. package/build/inputs/SelectInput.js.map +1 -1
  24. package/build/inputs/SelectInput.mjs.map +1 -1
  25. package/build/inputs/TextArea.js.map +1 -1
  26. package/build/inputs/TextArea.mjs.map +1 -1
  27. package/build/listItem/ListItem.js +2 -2
  28. package/build/listItem/ListItem.js.map +1 -1
  29. package/build/listItem/ListItem.mjs +2 -2
  30. package/build/listItem/ListItem.mjs.map +1 -1
  31. package/build/listItem/Prompt/ListItemPrompt.js +6 -4
  32. package/build/listItem/Prompt/ListItemPrompt.js.map +1 -1
  33. package/build/listItem/Prompt/ListItemPrompt.mjs +7 -2
  34. package/build/listItem/Prompt/ListItemPrompt.mjs.map +1 -1
  35. package/build/main.css +52 -21
  36. package/build/moneyInput/MoneyInput.js +6 -1
  37. package/build/moneyInput/MoneyInput.js.map +1 -1
  38. package/build/moneyInput/MoneyInput.mjs +6 -1
  39. package/build/moneyInput/MoneyInput.mjs.map +1 -1
  40. package/build/prompt/ActionPrompt/ActionPrompt.js +27 -4
  41. package/build/prompt/ActionPrompt/ActionPrompt.js.map +1 -1
  42. package/build/prompt/ActionPrompt/ActionPrompt.mjs +27 -4
  43. package/build/prompt/ActionPrompt/ActionPrompt.mjs.map +1 -1
  44. package/build/prompt/InfoPrompt/InfoPrompt.js +113 -0
  45. package/build/prompt/InfoPrompt/InfoPrompt.js.map +1 -0
  46. package/build/prompt/InfoPrompt/InfoPrompt.mjs +111 -0
  47. package/build/prompt/InfoPrompt/InfoPrompt.mjs.map +1 -0
  48. package/build/prompt/PrimitivePrompt/PrimitivePrompt.js.map +1 -1
  49. package/build/prompt/PrimitivePrompt/PrimitivePrompt.mjs.map +1 -1
  50. package/build/radioOption/RadioOption.js.map +1 -1
  51. package/build/radioOption/RadioOption.mjs.map +1 -1
  52. package/build/slidingPanel/SlidingPanel.js.map +1 -1
  53. package/build/slidingPanel/SlidingPanel.mjs.map +1 -1
  54. package/build/statusIcon/StatusIcon.js +2 -0
  55. package/build/statusIcon/StatusIcon.js.map +1 -1
  56. package/build/statusIcon/StatusIcon.mjs +2 -0
  57. package/build/statusIcon/StatusIcon.mjs.map +1 -1
  58. package/build/styles/main.css +52 -21
  59. package/build/styles/prompt/InfoPrompt/InfoPrompt.css +31 -0
  60. package/build/styles/sentimentSurface/SentimentSurface.css +21 -21
  61. package/build/table/TableCell.js.map +1 -1
  62. package/build/table/TableCell.mjs.map +1 -1
  63. package/build/typeahead/Typeahead.js +1 -0
  64. package/build/typeahead/Typeahead.js.map +1 -1
  65. package/build/typeahead/Typeahead.mjs +1 -0
  66. package/build/typeahead/Typeahead.mjs.map +1 -1
  67. package/build/types/avatarView/AvatarView.d.ts +1 -1
  68. package/build/types/avatarView/AvatarView.d.ts.map +1 -1
  69. package/build/types/common/locale/index.d.ts +8 -0
  70. package/build/types/common/locale/index.d.ts.map +1 -1
  71. package/build/types/expressiveMoneyInput/currencySelector/CurrencySelector.d.ts.map +1 -1
  72. package/build/types/index.d.ts +3 -2
  73. package/build/types/index.d.ts.map +1 -1
  74. package/build/types/inputs/Input.d.ts.map +1 -1
  75. package/build/types/inputs/SearchInput.d.ts.map +1 -1
  76. package/build/types/inputs/SelectInput.d.ts +1 -1
  77. package/build/types/inputs/SelectInput.d.ts.map +1 -1
  78. package/build/types/inputs/TextArea.d.ts.map +1 -1
  79. package/build/types/listItem/ListItem.d.ts +1 -1
  80. package/build/types/listItem/Prompt/ListItemPrompt.d.ts +2 -3
  81. package/build/types/listItem/Prompt/ListItemPrompt.d.ts.map +1 -1
  82. package/build/types/moneyInput/MoneyInput.d.ts.map +1 -1
  83. package/build/types/primitives/PrimitiveAnchor/PrimitiveAnchor.types.d.ts.map +1 -1
  84. package/build/types/primitives/PrimitiveButton/PrimitiveButton.types.d.ts.map +1 -1
  85. package/build/types/prompt/ActionPrompt/ActionPrompt.d.ts +4 -2
  86. package/build/types/prompt/ActionPrompt/ActionPrompt.d.ts.map +1 -1
  87. package/build/types/prompt/InfoPrompt/InfoPrompt.d.ts +56 -0
  88. package/build/types/prompt/InfoPrompt/InfoPrompt.d.ts.map +1 -0
  89. package/build/types/prompt/InfoPrompt/index.d.ts +3 -0
  90. package/build/types/prompt/InfoPrompt/index.d.ts.map +1 -0
  91. package/build/types/prompt/PrimitivePrompt/PrimitivePrompt.d.ts +5 -5
  92. package/build/types/prompt/PrimitivePrompt/PrimitivePrompt.d.ts.map +1 -1
  93. package/build/types/prompt/index.d.ts +2 -0
  94. package/build/types/prompt/index.d.ts.map +1 -1
  95. package/build/types/radioOption/RadioOption.d.ts.map +1 -1
  96. package/build/types/slidingPanel/SlidingPanel.d.ts.map +1 -1
  97. package/build/types/statusIcon/StatusIcon.d.ts +2 -1
  98. package/build/types/statusIcon/StatusIcon.d.ts.map +1 -1
  99. package/build/types/table/TableCell.d.ts.map +1 -1
  100. package/build/types/withDisplayFormat/WithDisplayFormat.d.ts.map +1 -1
  101. package/build/withDisplayFormat/WithDisplayFormat.js.map +1 -1
  102. package/build/withDisplayFormat/WithDisplayFormat.mjs.map +1 -1
  103. package/package.json +3 -3
  104. package/src/accordion/Accordion.test.js +0 -6
  105. package/src/accordion/AccordionItem/AccordionItem.test.js +0 -10
  106. package/src/actionButton/ActionButton.test.tsx +0 -4
  107. package/src/avatarLayout/AvatarLayout.story.tsx +3 -3
  108. package/src/avatarView/AvatarView.story.tsx +29 -24
  109. package/src/avatarView/AvatarView.tsx +1 -1
  110. package/src/avatarWrapper/AvatarWrapper.test.tsx +0 -53
  111. package/src/checkbox/Checkbox.test.tsx +0 -5
  112. package/src/chevron/Chevron.test.tsx +0 -7
  113. package/src/chips/Chips.test.tsx +0 -8
  114. package/src/common/RadioButton/RadioButton.test.tsx +0 -18
  115. package/src/common/bottomSheet/BottomSheet.test.story.tsx +98 -0
  116. package/src/common/bottomSheet/BottomSheet.test.tsx +0 -9
  117. package/src/common/card/Card.test.tsx +0 -6
  118. package/src/common/closeButton/CloseButton.test.tsx +0 -4
  119. package/src/common/locale/index.test.ts +36 -1
  120. package/src/common/locale/index.ts +13 -0
  121. package/src/common/panel/Panel.test.tsx +0 -6
  122. package/src/expressiveMoneyInput/currencySelector/CurrencySelector.tsx +5 -1
  123. package/src/flowNavigation/FlowNavigation.test.js +0 -10
  124. package/src/index.ts +3 -1
  125. package/src/inputs/Input.tsx +8 -9
  126. package/src/inputs/SearchInput.tsx +8 -9
  127. package/src/inputs/SelectInput.test.story.tsx +86 -0
  128. package/src/inputs/SelectInput.tsx +1 -1
  129. package/src/inputs/TextArea.tsx +6 -7
  130. package/src/listItem/ListItem.tsx +2 -2
  131. package/src/listItem/Prompt/ListItemPrompt.story.tsx +71 -9
  132. package/src/listItem/Prompt/ListItemPrompt.test.tsx +31 -0
  133. package/src/listItem/Prompt/ListItemPrompt.tsx +8 -2
  134. package/src/logo/Logo.story.tsx +24 -5
  135. package/src/main.css +52 -21
  136. package/src/main.less +2 -1
  137. package/src/moneyInput/MoneyInput.test.story.tsx +104 -0
  138. package/src/moneyInput/MoneyInput.tsx +20 -2
  139. package/src/overlayHeader/OverlayHeader.test.tsx +0 -3
  140. package/src/popover/Popover.test.tsx +0 -25
  141. package/src/primitives/PrimitiveAnchor/PrimitiveAnchor.types.ts +1 -3
  142. package/src/primitives/PrimitiveButton/PrimitiveButton.types.ts +1 -3
  143. package/src/promoCard/PromoCard.test.tsx +0 -6
  144. package/src/promoCard/PromoCardGroup.test.tsx +0 -5
  145. package/src/prompt/ActionPrompt/ActionPrompt.accessibility.docs.mdx +65 -0
  146. package/src/prompt/ActionPrompt/ActionPrompt.less +1 -1
  147. package/src/prompt/ActionPrompt/ActionPrompt.story.tsx +4 -1
  148. package/src/prompt/ActionPrompt/ActionPrompt.test.story.tsx +147 -0
  149. package/src/prompt/ActionPrompt/ActionPrompt.test.tsx +2 -7
  150. package/src/prompt/ActionPrompt/ActionPrompt.tsx +48 -7
  151. package/src/prompt/InfoPrompt/InfoPrompt.css +31 -0
  152. package/src/prompt/InfoPrompt/InfoPrompt.less +37 -0
  153. package/src/prompt/InfoPrompt/InfoPrompt.story.tsx +312 -0
  154. package/src/prompt/InfoPrompt/InfoPrompt.test.story.tsx +246 -0
  155. package/src/prompt/InfoPrompt/InfoPrompt.test.tsx +224 -0
  156. package/src/prompt/InfoPrompt/InfoPrompt.tsx +148 -0
  157. package/src/prompt/InfoPrompt/index.ts +2 -0
  158. package/src/prompt/InlinePrompt/InlinePrompt.story.tsx +13 -10
  159. package/src/prompt/InlinePrompt/InlinePrompt.test.tsx +13 -1
  160. package/src/prompt/PrimitivePrompt/PrimitivePrompt.less +1 -1
  161. package/src/prompt/PrimitivePrompt/PrimitivePrompt.tsx +5 -5
  162. package/src/prompt/index.ts +5 -0
  163. package/src/radioOption/RadioOption.tsx +2 -1
  164. package/src/sentimentSurface/SentimentSurface.css +21 -21
  165. package/src/sentimentSurface/SentimentSurface.less +13 -13
  166. package/src/sentimentSurface/SentimentSurface.story.tsx +1 -1
  167. package/src/sentimentSurface/SentimentSurface.test.story.tsx +48 -1
  168. package/src/slidingPanel/SlidingPanel.tsx +4 -2
  169. package/src/ssr.test.tsx +2 -0
  170. package/src/statusIcon/StatusIcon.tsx +8 -1
  171. package/src/table/TableCell.tsx +1 -3
  172. package/src/tile/Tile.test.tsx +0 -10
  173. package/src/tooltip/Tooltip.test.tsx +0 -10
  174. package/src/withDisplayFormat/WithDisplayFormat.tsx +13 -14
  175. package/src/accordion/AccordionItem/__snapshots__/AccordionItem.test.js.snap +0 -124
  176. package/src/accordion/__snapshots__/Accordion.test.js.snap +0 -3
  177. package/src/actionButton/__snapshots__/ActionButton.test.tsx.snap +0 -12
  178. package/src/avatarWrapper/__snapshots__/AvatarWrapper.test.tsx.snap +0 -156
  179. package/src/checkbox/__snapshots__/Checkbox.test.tsx.snap +0 -40
  180. package/src/chevron/__snapshots__/Chevron.test.tsx.snap +0 -24
  181. package/src/chips/__snapshots__/Chips.test.tsx.snap +0 -153
  182. package/src/common/RadioButton/__snapshots__/RadioButton.test.tsx.snap +0 -58
  183. package/src/common/bottomSheet/__snapshots__/BottomSheet.test.tsx.snap +0 -80
  184. package/src/common/card/__snapshots__/Card.test.tsx.snap +0 -10
  185. package/src/common/closeButton/__snapshots__/CloseButton.test.tsx.snap +0 -30
  186. package/src/common/flowHeader/FlowHeader.test.tsx +0 -22
  187. package/src/common/flowHeader/__snapshots__/FlowHeader.test.tsx.snap +0 -33
  188. package/src/common/panel/__snapshots__/Panel.test.tsx.snap +0 -3
  189. package/src/flowNavigation/__snapshots__/FlowNavigation.test.js.snap +0 -262
  190. package/src/logo/Logo.test.tsx +0 -55
  191. package/src/logo/__snapshots__/Logo.test.tsx.snap +0 -281
  192. package/src/overlayHeader/__snapshots__/OverlayHeader.test.tsx.snap +0 -65
  193. package/src/popover/__snapshots__/Popover.test.tsx.snap +0 -51
  194. package/src/promoCard/__snapshots__/PromoCard.test.tsx.snap +0 -40
  195. package/src/promoCard/__snapshots__/PromoCardGroup.test.tsx.snap +0 -80
  196. package/src/tile/__snapshots__/Tile.test.tsx.snap +0 -55
  197. package/src/tooltip/__snapshots__/Tooltip.test.tsx.snap +0 -32
@@ -288,7 +288,7 @@ export const EdgeInstances: Story = {
288
288
  /**
289
289
  * Like [AvatarView](?path=/docs/content-avatarview--docs#sentiment-awareness), `AvatarLayout` is sentiment-aware (note: not all features are supported) and will automatically adjust its colours if wrapped inside the
290
290
  * [SentimentSurface](?path=/docs/content-sentimentsurface--docs) component.
291
- *
291
+ *
292
292
  * Features like: `interactive` are not supported.
293
293
  * Also `AvatarLayout` isn't supported on `"elevated"` state of `SentimentSurface`.
294
294
  */
@@ -302,7 +302,7 @@ export const SentimentAwareness: Story = {
302
302
  },
303
303
  render: (args) => (
304
304
  <>
305
- {(['success', 'warning', 'negative', 'neutral', 'proposition'] as const).map((sentiment) =>
305
+ {(['success', 'warning', 'negative', 'neutral', 'proposition'] as const).map((sentiment) => (
306
306
  <SentimentSurface
307
307
  key={`${sentiment}-base`}
308
308
  sentiment={sentiment}
@@ -316,7 +316,7 @@ export const SentimentAwareness: Story = {
316
316
  avatars={[{ asset: <Freeze /> }, { asset: <Freeze /> }]}
317
317
  />
318
318
  </SentimentSurface>
319
- )}
319
+ ))}
320
320
  </>
321
321
  ),
322
322
  decorators: [
@@ -440,7 +440,7 @@ export const Profiles: Story = {
440
440
  /**
441
441
  * `AvatarView` is sentiment-aware (note: not all features are supported) and will automatically adjust its colours if wrapped inside the
442
442
  * [SentimentSurface](?path=/docs/content-sentimentsurface--docs) component.
443
- *
443
+ *
444
444
  * Features like `online`, `notification`, `selected`, and `interactive` are not supported.
445
445
  * For badge (`<AvatarView badge={}>`) only `flagCode` is supported.
446
446
  * Also `AvatarView` isn't supported on `"elevated"` state of `SentimentSurface`.
@@ -457,29 +457,34 @@ export const SentimentAwareness: Story = {
457
457
  render: () => {
458
458
  return (
459
459
  <>
460
- {(['success', 'warning', 'negative', 'neutral', 'proposition'] as const).map((sentiment) => (
461
- <SentimentSurface
462
- key={`${sentiment}-base`}
463
- sentiment={sentiment}
464
- emphasis="base"
465
- className="p-a-1 d-flex"
466
- style={{ gap: 'var(--size-16)' }}
467
- >
468
- <AvatarView size={32}>
469
- <Bank />
470
- </AvatarView>
471
- <AvatarView size={32} profileName="John Doe" />
472
- <AvatarView size={32}>
473
- <Flag code="JPY" intrinsicSize={32} />
474
- </AvatarView>
475
- <AvatarView size={32} badge={sentiment === 'proposition' ? undefined : { status: sentiment }}>
476
- <Bank />
477
- </AvatarView>
478
- <AvatarView size={32} badge={{ flagCode: 'eu' }}>
479
- <Bank />
480
- </AvatarView>
481
- </SentimentSurface>
482
- ))}
460
+ {(['success', 'warning', 'negative', 'neutral', 'proposition'] as const).map(
461
+ (sentiment) => (
462
+ <SentimentSurface
463
+ key={`${sentiment}-base`}
464
+ sentiment={sentiment}
465
+ emphasis="base"
466
+ className="p-a-1 d-flex"
467
+ style={{ gap: 'var(--size-16)' }}
468
+ >
469
+ <AvatarView size={32}>
470
+ <Bank />
471
+ </AvatarView>
472
+ <AvatarView size={32} profileName="John Doe" />
473
+ <AvatarView size={32}>
474
+ <Flag code="JPY" intrinsicSize={32} />
475
+ </AvatarView>
476
+ <AvatarView
477
+ size={32}
478
+ badge={sentiment === 'proposition' ? undefined : { status: sentiment }}
479
+ >
480
+ <Bank />
481
+ </AvatarView>
482
+ <AvatarView size={32} badge={{ flagCode: 'eu' }}>
483
+ <Bank />
484
+ </AvatarView>
485
+ </SentimentSurface>
486
+ ),
487
+ )}
483
488
  </>
484
489
  );
485
490
  },
@@ -32,7 +32,7 @@ export type Props = {
32
32
  style?: Pick<React.CSSProperties, 'border' | 'backgroundColor' | 'color'>;
33
33
  } & Pick<
34
34
  HTMLAttributes<HTMLDivElement>,
35
- 'className' | 'children' | 'role' | 'aria-label' | 'aria-labelledby' | 'aria-hidden'
35
+ 'id' | 'className' | 'children' | 'role' | 'aria-label' | 'aria-labelledby' | 'aria-hidden'
36
36
  >;
37
37
 
38
38
  function AvatarView({
@@ -36,49 +36,10 @@ describe('FlowNavigationAvatar', () => {
36
36
 
37
37
  expect(screen.getByText('M')).toBeInTheDocument();
38
38
  });
39
-
40
- describe('AND profileType', () => {
41
- it('renders as BUSINESS profile type with an icon', () => {
42
- const { container } = render(
43
- <AvatarWrapper name={name} profileType={ProfileType.BUSINESS} />,
44
- );
45
-
46
- expect(container.firstChild).toMatchSnapshot();
47
- });
48
-
49
- it('renders as PERSONAL profile type with an icon', () => {
50
- const { container } = render(
51
- <AvatarWrapper name={name} profileType={ProfileType.PERSONAL} />,
52
- );
53
-
54
- expect(container.firstChild).toMatchSnapshot();
55
- });
56
-
57
- describe('AND avatar url', () => {
58
- it('renders the image', () => {
59
- const { container } = render(
60
- <AvatarWrapper
61
- url="https://wise.com"
62
- name={name}
63
- profileType={ProfileType.BUSINESS}
64
- avatarProps={{ theme: 'dark' }}
65
- />,
66
- );
67
-
68
- expect(container.firstChild).toMatchSnapshot();
69
- });
70
- });
71
- });
72
39
  });
73
40
  });
74
41
 
75
42
  describe('with nothing passed', () => {
76
- it('renders a personal icon', () => {
77
- const { container } = render(<AvatarWrapper />);
78
-
79
- expect(container.firstChild).toMatchSnapshot();
80
- });
81
-
82
43
  it('renders aria-label', () => {
83
44
  render(<AvatarWrapper aria-label="test" />);
84
45
 
@@ -86,20 +47,6 @@ describe('FlowNavigationAvatar', () => {
86
47
  });
87
48
  });
88
49
 
89
- describe('with a badge url passed', () => {
90
- it('renders the badge', () => {
91
- const { container } = render(
92
- <AvatarWrapper
93
- badgeUrl="https://badge.com"
94
- badgeAltText="badge alt text"
95
- badgeProps={{ size: Size.LARGE } as BadgeProps}
96
- />,
97
- );
98
-
99
- expect(container.firstChild).toMatchSnapshot();
100
- });
101
- });
102
-
103
50
  describe('with a badge status icon passed', () => {
104
51
  it('renders the badge', () => {
105
52
  render(<AvatarWrapper badgeStatusIcon={Sentiment.POSITIVE} />);
@@ -19,11 +19,6 @@ describe('Checkbox', () => {
19
19
  jest.clearAllMocks();
20
20
  });
21
21
 
22
- it('renders the given label', () => {
23
- const { container } = render(<Checkbox {...props} />);
24
- expect(container).toMatchSnapshot();
25
- });
26
-
27
22
  it('is enabled by default', () => {
28
23
  const { container } = render(<Checkbox {...props} />);
29
24
  expect(getCheckboxContainer(container)).not.toHaveClass('disabled');
@@ -43,11 +43,4 @@ describe('Chevron', () => {
43
43
  expect(container.querySelector('.tw-icon-chevron-up')).not.toHaveClass('chevron-color');
44
44
  });
45
45
  });
46
-
47
- describe('custom xs icon', () => {
48
- it('renders', () => {
49
- const { container } = render(<Chevron size={Size.EXTRA_SMALL} />);
50
- expect(container).toMatchSnapshot();
51
- });
52
- });
53
46
  });
@@ -53,10 +53,6 @@ const filterProps = {
53
53
 
54
54
  describe('Chips', () => {
55
55
  describe('Choice Chips', () => {
56
- it(`renders as expected`, () => {
57
- expect(render(<Chips {...choiceProps} />).container).toMatchSnapshot();
58
- });
59
-
60
56
  it(`will pass previous state, updated state, and selected value on select`, () => {
61
57
  render(<Chips {...choiceProps} />);
62
58
  const accounting = screen.getByText('Accounting');
@@ -69,10 +65,6 @@ describe('Chips', () => {
69
65
  });
70
66
 
71
67
  describe('Filter Chips', () => {
72
- it(`renders as expected`, () => {
73
- expect(render(<Chips {...filterProps} />).container).toMatchSnapshot();
74
- });
75
-
76
68
  it(`will pass previous state, updated state, and selected value on select`, () => {
77
69
  render(<Chips {...filterProps} />);
78
70
  const accounting = screen.getByText('Accounting');
@@ -3,24 +3,6 @@ import { screen, render, userEvent } from '../../test-utils';
3
3
  import RadioButton from '.';
4
4
 
5
5
  describe('Radio button', () => {
6
- it('renders correctly', () => {
7
- const { container } = render(<RadioButton id="an-id" name="a-name" value="a-value" />);
8
-
9
- expect(container).toMatchSnapshot();
10
- });
11
-
12
- it('renders checked state correctly', () => {
13
- const { container } = render(<RadioButton name="radio-name" checked />);
14
-
15
- expect(container).toMatchSnapshot();
16
- });
17
-
18
- it('renders disabled state correctly', () => {
19
- const { container } = render(<RadioButton name="radio-name" disabled />);
20
-
21
- expect(container).toMatchSnapshot();
22
- });
23
-
24
6
  it('responds to user input', async () => {
25
7
  const onChange = jest.fn();
26
8
  render(
@@ -0,0 +1,98 @@
1
+ import { useState } from 'react';
2
+ import { Meta, StoryObj } from '@storybook/react-webpack5';
3
+ import { fireEvent, within } from 'storybook/test';
4
+ import { lorem100, lorem500 } from '../../test-utils';
5
+ import { Typography } from '../propsValues/typography';
6
+ import Alert from '../../alert';
7
+ import Body from '../../body';
8
+ import Button from '../../button';
9
+ import Title from '../../title';
10
+ import BottomSheet from './BottomSheet';
11
+
12
+ const wait = async (duration = 500) =>
13
+ new Promise<void>((resolve) => {
14
+ setTimeout(resolve, duration);
15
+ });
16
+
17
+ export default {
18
+ component: BottomSheet,
19
+ title: 'Dialogs/BottomSheet/tests',
20
+ tags: ['!autodocs'],
21
+ args: {
22
+ open: false,
23
+ },
24
+ } satisfies Meta<typeof BottomSheet>;
25
+
26
+ type Story = StoryObj<typeof BottomSheet>;
27
+
28
+ /**
29
+ * This test ensures that when the SelectInput is used within a scrollable page,
30
+ * opening the dropdown does not cause any unwanted scrolling or layout shifts.
31
+ * Expected preview should start with green bar at the top, with yellow section
32
+ * not in the viewport. The issue is particularly prominent on iOS Safari.
33
+ *
34
+ * NB: This test is disabled in Chromatic as there's no obvious way to control
35
+ * <html/> element of a snapshot. It's to be primarily used in manual testing
36
+ * on an actual device or a simulator as it cannot be reproduced with mobile
37
+ * emulation modes on desktop browsers.
38
+ */
39
+ export const SmoothScrollReset: Story = {
40
+ args: {
41
+ children: (
42
+ <>
43
+ <Title type={Typography.TITLE_SECTION}>Observe the document</Title>
44
+ <Alert className="m-t-2" type="warning">
45
+ Once the <code>BottomSheet</code> opens, the document underneath should be static and
46
+ should not scroll.
47
+ </Alert>
48
+ <Body as="p">{lorem100}</Body>
49
+ <Body as="p">{lorem100}</Body>
50
+ </>
51
+ ),
52
+ },
53
+ decorators: [
54
+ (Story) => (
55
+ <>
56
+ <style>{'html { scroll-behavior: smooth; }'}</style>
57
+ <div style={{ maxWidth: 500 }}>
58
+ <Body>
59
+ <p>{lorem100}</p>
60
+ <p>{lorem100}</p>
61
+ </Body>
62
+ <Story />
63
+ <Body as="p" className="m-t-5 disabled">
64
+ {lorem500}
65
+ </Body>
66
+ </div>
67
+ </>
68
+ ),
69
+ ],
70
+ parameters: {
71
+ chromatic: {
72
+ disableSnapshot: true,
73
+ },
74
+ },
75
+ play: async ({ canvasElement }) => {
76
+ document.documentElement.scrollTop = 400;
77
+ await wait(500);
78
+ const canvas = within(canvasElement);
79
+ // cannot use userEvent.click as it crashes on iOS Safari in the simulator
80
+ await fireEvent.click(canvas.getByRole('button'));
81
+ },
82
+ render: ({ open, ...args }) => {
83
+ const [isOpen, setIsOpen] = useState(false);
84
+
85
+ return (
86
+ <div>
87
+ <Button onClick={() => setIsOpen(true)}>Open BottomSheet</Button>
88
+ <BottomSheet
89
+ {...args}
90
+ open={isOpen}
91
+ onClose={() => {
92
+ setIsOpen(false);
93
+ }}
94
+ />
95
+ </div>
96
+ );
97
+ },
98
+ };
@@ -5,15 +5,6 @@ import BottomSheet from './BottomSheet';
5
5
  mockMatchMedia();
6
6
 
7
7
  describe('BottomSheet', () => {
8
- it('renders content when open', () => {
9
- const { baseElement } = render(
10
- <BottomSheet open onClose={jest.fn()}>
11
- <b>Test Content</b>
12
- </BottomSheet>,
13
- );
14
- expect(baseElement).toMatchSnapshot();
15
- });
16
-
17
8
  it('does not renders when closed', () => {
18
9
  const { container } = render(
19
10
  <BottomSheet open={false} onClose={jest.fn()}>
@@ -10,12 +10,6 @@ describe('Card', () => {
10
10
  testId: 'test-card',
11
11
  };
12
12
 
13
- it('matches snapshot', () => {
14
- const { container } = render(<Card {...defaultProps} />);
15
-
16
- expect(container.firstChild).toMatchSnapshot();
17
- });
18
-
19
13
  it('renders', () => {
20
14
  const props = {
21
15
  ...defaultProps,
@@ -8,10 +8,6 @@ const props = {
8
8
  };
9
9
 
10
10
  describe('CloseButton', () => {
11
- it(`renders as expected`, () => {
12
- expect(render(<CloseButton {...props} />).container).toMatchSnapshot();
13
- });
14
-
15
11
  describe('tabIndex', () => {
16
12
  it('should not have tabIndex by default', () => {
17
13
  render(<CloseButton {...props} />);
@@ -1,4 +1,11 @@
1
- import { getLangFromLocale, adjustLocale, getCountryFromLocale, getDirectionFromLocale } from '.';
1
+ import { IntlShape } from 'react-intl';
2
+ import {
3
+ getLangFromLocale,
4
+ adjustLocale,
5
+ getCountryFromLocale,
6
+ getDirectionFromLocale,
7
+ getLocaleCurrencyName,
8
+ } from '.';
2
9
 
3
10
  describe('locale utils', () => {
4
11
  beforeAll(() => {
@@ -103,4 +110,32 @@ describe('locale utils', () => {
103
110
  },
104
111
  );
105
112
  });
113
+
114
+ describe('getLocaleCurrencyName', () => {
115
+ it('should return the localized currency name if Intl.DisplayNames is supported', () => {
116
+ const intl = {
117
+ formatDisplayName: jest.fn().mockReturnValue('US Dollar'),
118
+ } as unknown as IntlShape;
119
+
120
+ const result = getLocaleCurrencyName(intl, 'USD');
121
+ expect(intl.formatDisplayName).toHaveBeenCalledWith('USD', {
122
+ type: 'currency',
123
+ fallback: 'code',
124
+ });
125
+ expect(result).toBe('US Dollar');
126
+ });
127
+
128
+ it('should return the original currency code if Intl.DisplayNames is not supported', () => {
129
+ const intl = {
130
+ formatDisplayName: jest.fn().mockReturnValue('US Dollar'),
131
+ } as unknown as IntlShape;
132
+
133
+ // Mock Intl.DisplayNames to be undefined
134
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
135
+ (Intl as any).DisplayNames = undefined;
136
+
137
+ const result = getLocaleCurrencyName(intl, 'USD');
138
+ expect(result).toBe('USD');
139
+ });
140
+ });
106
141
  });
@@ -1,3 +1,4 @@
1
+ import { IntlShape } from 'react-intl/src/types';
1
2
  import { Direction } from '../direction';
2
3
 
3
4
  export const DEFAULT_LANG = 'en';
@@ -96,3 +97,15 @@ export function getDirectionFromLocale(locale: string) {
96
97
  ? Direction.RTL
97
98
  : Direction.LTR;
98
99
  }
100
+
101
+ /**
102
+ * Provides the localized currency name for a given currency code.
103
+ * @param intl The `intl` object from `react-intl` used for localization.
104
+ * @param currencyCode The ISO 4217 currency code (e.g., `USD`, `EUR`, `JPY`).
105
+ * @returns The localized currency name if Intl.DisplayNames is supported supported, otherwise returns the original currency code.
106
+ */
107
+ export function getLocaleCurrencyName(intl: IntlShape, currencyCode: string) {
108
+ return typeof Intl.DisplayNames === 'function'
109
+ ? intl.formatDisplayName(currencyCode, { type: 'currency', fallback: 'code' })
110
+ : currencyCode;
111
+ }
@@ -20,12 +20,6 @@ describe('Panel', () => {
20
20
  onClose: jest.fn(),
21
21
  } satisfies PanelProps;
22
22
 
23
- it('renders', () => {
24
- const { container } = render(<Panel {...props} />);
25
-
26
- expect(container).toMatchSnapshot();
27
- });
28
-
29
23
  it('renders arrow', () => {
30
24
  const { rerender } = render(<Panel {...props} arrow={false} />);
31
25
 
@@ -18,6 +18,7 @@ import {
18
18
  import { useIntl } from 'react-intl';
19
19
 
20
20
  import messages from '../ExpressiveMoneyInput.messages';
21
+ import { getLocaleCurrencyName } from '../../common';
21
22
 
22
23
  export interface CurrencyOption {
23
24
  label?: string;
@@ -126,7 +127,10 @@ export const CurrencySelector = ({
126
127
  addonEnd={disabled ? undefined : { type: 'icon', value: <ChevronDown /> }}
127
128
  onClick={(event) => handleTriggerClick(event)}
128
129
  >
129
- {currency}
130
+ <>
131
+ <span aria-hidden>{currency}</span>
132
+ <span className="sr-only">{getLocaleCurrencyName(intl, currency)}</span>
133
+ </>
130
134
  </SelectInputTriggerButton>
131
135
  )}
132
136
  onChange={(newValue) => {
@@ -35,10 +35,6 @@ describe('FlowNavigation', () => {
35
35
  activeStep: 0,
36
36
  };
37
37
 
38
- it(`renders as expected`, () => {
39
- expect(render(<FlowNavigation {...props} />).container).toMatchSnapshot();
40
- });
41
-
42
38
  it(`renders full Logo`, () => {
43
39
  render(<FlowNavigation {...props} />);
44
40
  expect(logoFull()).toBeInTheDocument();
@@ -126,12 +122,6 @@ describe('FlowNavigation', () => {
126
122
  window.innerWidth = Breakpoint.SMALL - 1;
127
123
  });
128
124
 
129
- it('renders as expected', () => {
130
- expect(
131
- render(<FlowNavigation {...props} activeStep={1} onGoBack={jest.fn()} />).container,
132
- ).toMatchSnapshot();
133
- });
134
-
135
125
  it('renders Logo', () => {
136
126
  render(<FlowNavigation {...props} />);
137
127
  expect(screen.getByAltText('logo')).toBeInTheDocument();
package/src/index.ts CHANGED
@@ -36,6 +36,7 @@ export type { EmphasisProps } from './emphasis';
36
36
  export type { FieldProps } from './field/Field';
37
37
  export type { InfoProps } from './info';
38
38
  export type { InlinePromptProps, ActionPromptProps } from './prompt';
39
+ export type { InfoPromptProps, InfoPromptAction, InfoPromptMedia } from './prompt';
39
40
  export type { InputWithDisplayFormatProps } from './inputWithDisplayFormat';
40
41
  export type { InputProps } from './inputs/Input';
41
42
  export type { InputGroupProps } from './inputs/InputGroup';
@@ -171,7 +172,7 @@ export { default as Header } from './header';
171
172
  export { default as Image } from './image';
172
173
  export { default as Info } from './info';
173
174
  export { default as InlineAlert } from './inlineAlert';
174
- export { InlinePrompt, ActionPrompt } from './prompt';
175
+ export { InfoPrompt, InlinePrompt, ActionPrompt } from './prompt';
175
176
  export { default as InputWithDisplayFormat } from './inputWithDisplayFormat';
176
177
  export { Input } from './inputs/Input';
177
178
  export { InputGroup } from './inputs/InputGroup';
@@ -284,6 +285,7 @@ export {
284
285
  adjustLocale,
285
286
  getCountryFromLocale,
286
287
  getDirectionFromLocale,
288
+ getLocaleCurrencyName,
287
289
  getLangFromLocale,
288
290
  isBrowser,
289
291
  isServerSide,
@@ -7,15 +7,14 @@ import { inputClassNameBase } from './_common';
7
7
  import { useInputAttributes } from './contexts';
8
8
  import { useInputPaddings } from './InputGroup';
9
9
 
10
- export interface InputProps
11
- extends Merge<
12
- React.ComponentPropsWithRef<'input'>,
13
- {
14
- size?: 'auto' | SizeSmall | SizeMedium | SizeLarge;
15
- shape?: 'rectangle' | 'pill';
16
- 'aria-invalid'?: boolean;
17
- }
18
- > {}
10
+ export interface InputProps extends Merge<
11
+ React.ComponentPropsWithRef<'input'>,
12
+ {
13
+ size?: 'auto' | SizeSmall | SizeMedium | SizeLarge;
14
+ shape?: 'rectangle' | 'pill';
15
+ 'aria-invalid'?: boolean;
16
+ }
17
+ > {}
19
18
 
20
19
  export const Input = forwardRef(function Input(
21
20
  { size = 'auto', shape = 'rectangle', className, ...restProps }: InputProps,
@@ -7,15 +7,14 @@ import { Merge } from '../utils';
7
7
  import { Input } from './Input';
8
8
  import { InputGroup } from './InputGroup';
9
9
 
10
- export interface SearchInputProps
11
- extends Merge<
12
- React.ComponentPropsWithRef<'input'>,
13
- {
14
- size?: Size.SMALL | Size.MEDIUM;
15
- shape?: 'rectangle' | 'pill';
16
- 'aria-invalid'?: boolean;
17
- }
18
- > {}
10
+ export interface SearchInputProps extends Merge<
11
+ React.ComponentPropsWithRef<'input'>,
12
+ {
13
+ size?: Size.SMALL | Size.MEDIUM;
14
+ shape?: 'rectangle' | 'pill';
15
+ 'aria-invalid'?: boolean;
16
+ }
17
+ > {}
19
18
 
20
19
  export const SearchInput = forwardRef(function SearchInput(
21
20
  { shape = 'pill', size = Size.MEDIUM, disabled, className, ...restProps }: SearchInputProps,