@transferwise/components 45.15.0 → 45.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (111) hide show
  1. package/build/i18n/en.json +8 -0
  2. package/build/index.esm.js +550 -488
  3. package/build/index.esm.js.map +1 -1
  4. package/build/index.js +549 -487
  5. package/build/index.js.map +1 -1
  6. package/build/main.css +1 -1
  7. package/build/styles/dateLookup/DateLookup.css +1 -1
  8. package/build/styles/main.css +1 -1
  9. package/build/styles/popover/Popover.css +1 -1
  10. package/build/styles/promoCard/PromoCard.css +1 -1
  11. package/build/types/alert/Alert.d.ts.map +1 -1
  12. package/build/types/avatarWrapper/AvatarWrapper.d.ts +14 -5
  13. package/build/types/avatarWrapper/AvatarWrapper.d.ts.map +1 -1
  14. package/build/types/common/Option/Option.d.ts.map +1 -1
  15. package/build/types/common/card/Card.d.ts.map +1 -1
  16. package/build/types/common/card/index.d.ts +1 -0
  17. package/build/types/common/card/index.d.ts.map +1 -1
  18. package/build/types/common/focusBoundary/FocusBoundary.d.ts +2 -2
  19. package/build/types/common/focusBoundary/FocusBoundary.d.ts.map +1 -1
  20. package/build/types/dateInput/DateInput.d.ts +2 -0
  21. package/build/types/dateInput/DateInput.d.ts.map +1 -1
  22. package/build/types/dateLookup/DateLookup.messages.d.ts +65 -0
  23. package/build/types/dateLookup/DateLookup.messages.d.ts.map +1 -0
  24. package/build/types/dateLookup/dateHeader/DateHeader.d.ts +3 -1
  25. package/build/types/dateLookup/dateHeader/DateHeader.d.ts.map +1 -1
  26. package/build/types/dateLookup/tableLink/TableLink.d.ts +4 -26
  27. package/build/types/dateLookup/tableLink/TableLink.d.ts.map +1 -1
  28. package/build/types/dateLookup/yearCalendar/YearCalendar.d.ts +4 -29
  29. package/build/types/dateLookup/yearCalendar/YearCalendar.d.ts.map +1 -1
  30. package/build/types/inputs/_BottomSheet.d.ts.map +1 -1
  31. package/build/types/inputs/_Popover.d.ts.map +1 -1
  32. package/build/types/phoneNumberInput/PhoneNumberInput.d.ts.map +1 -1
  33. package/build/types/promoCard/PromoCard.d.ts +9 -3
  34. package/build/types/promoCard/PromoCard.d.ts.map +1 -1
  35. package/build/types/promoCard/PromoCardIndicator.d.ts +5 -3
  36. package/build/types/promoCard/PromoCardIndicator.d.ts.map +1 -1
  37. package/build/types/snackbar/Snackbar.d.ts.map +1 -1
  38. package/build/types/tabs/Tabs.d.ts.map +1 -1
  39. package/build/types/upload/steps/completeStep/completeStep.d.ts.map +1 -1
  40. package/build/types/upload/steps/processingStep/processingStep.d.ts.map +1 -1
  41. package/package.json +4 -3
  42. package/src/accordion/AccordionItem/__snapshots__/AccordionItem.spec.js.snap +6 -6
  43. package/src/alert/Alert.js +11 -9
  44. package/src/alert/Alert.spec.js +22 -13
  45. package/src/alert/withArrow/withArrow.spec.js +4 -4
  46. package/src/avatarWrapper/AvatarWrapper.tsx +20 -8
  47. package/src/avatarWrapper/__snapshots__/AvatarWrapper.spec.tsx.snap +1 -1
  48. package/src/card/Card.spec.js +2 -2
  49. package/src/common/Option/Option.tsx +1 -7
  50. package/src/common/bottomSheet/__snapshots__/BottomSheet.spec.tsx.snap +8 -1
  51. package/src/common/card/Card.tsx +6 -2
  52. package/src/common/card/index.ts +1 -0
  53. package/src/common/focusBoundary/FocusBoundary.tsx +9 -32
  54. package/src/dateInput/DateInput.js +6 -0
  55. package/src/dateInput/DateInput.story.tsx +2 -0
  56. package/src/dateLookup/DateLookup.css +1 -1
  57. package/src/dateLookup/DateLookup.keyboardEvents.spec.js +3 -3
  58. package/src/dateLookup/DateLookup.less +4 -0
  59. package/src/dateLookup/DateLookup.messages.js +44 -0
  60. package/src/dateLookup/DateLookup.testingLibrary.spec.js +39 -0
  61. package/src/dateLookup/dateHeader/DateHeader.js +48 -26
  62. package/src/dateLookup/dateHeader/DateHeader.spec.js +37 -0
  63. package/src/dateLookup/dayCalendar/DayCalendar.js +3 -1
  64. package/src/dateLookup/dayCalendar/DayCalendar.spec.js +7 -1
  65. package/src/dateLookup/dayCalendar/table/DayCalendarTable.js +7 -3
  66. package/src/dateLookup/dayCalendar/table/DayCalendarTable.spec.js +1 -0
  67. package/src/dateLookup/monthCalendar/MonthCalendar.js +3 -1
  68. package/src/dateLookup/monthCalendar/MonthCalendar.spec.js +7 -1
  69. package/src/dateLookup/monthCalendar/table/MonthCalendarTable.spec.js +4 -5
  70. package/src/dateLookup/tableLink/TableLink.js +25 -3
  71. package/src/dateLookup/tableLink/TableLink.spec.js +66 -4
  72. package/src/dateLookup/yearCalendar/YearCalendar.js +16 -3
  73. package/src/dateLookup/yearCalendar/YearCalendar.spec.js +14 -1
  74. package/src/dateLookup/yearCalendar/table/YearCalendarTable.spec.js +4 -5
  75. package/src/i18n/en.json +8 -0
  76. package/src/inputs/SelectInput.story.tsx +36 -9
  77. package/src/inputs/_BottomSheet.less +1 -1
  78. package/src/inputs/_BottomSheet.tsx +57 -52
  79. package/src/inputs/_Popover.less +1 -1
  80. package/src/inputs/_Popover.tsx +31 -24
  81. package/src/listItem/ListItem.story.tsx +1 -1
  82. package/src/main.css +1 -1
  83. package/src/phoneNumberInput/PhoneNumberInput.js +1 -0
  84. package/src/popover/Popover.css +1 -1
  85. package/src/promoCard/PromoCard.css +1 -1
  86. package/src/promoCard/PromoCard.less +9 -9
  87. package/src/promoCard/PromoCard.spec.tsx +1 -0
  88. package/src/promoCard/PromoCard.story.tsx +90 -30
  89. package/src/promoCard/PromoCard.tsx +69 -22
  90. package/src/promoCard/PromoCardIndicator.tsx +20 -8
  91. package/src/snackbar/Snackbar.js +6 -1
  92. package/src/snackbar/Snackbar.spec.js +1 -3
  93. package/src/tabs/Tabs.js +2 -1
  94. package/src/upload/Upload.js +1 -1
  95. package/src/upload/steps/completeStep/completeStep.js +4 -1
  96. package/src/upload/steps/processingStep/processingStep.js +1 -0
  97. package/src/uploadInput/uploadItem/UploadItem.tsx +1 -1
  98. package/build/types/common/focusBoundary/utils/getFocusableElements.d.ts +0 -2
  99. package/build/types/common/focusBoundary/utils/getFocusableElements.d.ts.map +0 -1
  100. package/build/types/common/focusBoundary/utils/index.d.ts +0 -3
  101. package/build/types/common/focusBoundary/utils/index.d.ts.map +0 -1
  102. package/build/types/common/focusBoundary/utils/resetFocus.d.ts +0 -2
  103. package/build/types/common/focusBoundary/utils/resetFocus.d.ts.map +0 -1
  104. package/src/common/focusBoundary/FocusBoundary.spec.tsx +0 -66
  105. package/src/common/focusBoundary/__snapshots__/FocusBoundary.spec.tsx.snap +0 -16
  106. package/src/common/focusBoundary/utils/getFocusableElements.js +0 -25
  107. package/src/common/focusBoundary/utils/getFocusableElements.spec.js +0 -51
  108. package/src/common/focusBoundary/utils/index.js +0 -2
  109. package/src/common/focusBoundary/utils/resetFocus.js +0 -23
  110. package/src/common/focusBoundary/utils/resetFocus.spec.js +0 -103
  111. package/src/snackbar/__snapshots__/Snackbar.spec.js.snap +0 -5
@@ -4,6 +4,8 @@ import { Flag } from '@wise/art';
4
4
  import { useState } from 'react';
5
5
 
6
6
  import { getMonthNames } from '../common/dateUtils';
7
+ import Drawer from '../drawer';
8
+ import Modal from '../modal';
7
9
 
8
10
  import { SelectInput, type SelectInputItem, SelectInputOptionContent } from './SelectInput';
9
11
 
@@ -141,7 +143,10 @@ export const Months: StoryObj<{
141
143
  <div className="d-flex flex-column">
142
144
  <SelectInput
143
145
  placeholder="Month"
144
- items={months.map((month) => ({ type: 'option', value: month }))}
146
+ items={months.map((month) => ({
147
+ type: 'option',
148
+ value: month,
149
+ }))}
145
150
  value={selectedMonth}
146
151
  renderValue={(month) => <SelectInputOptionContent title={month.name} />}
147
152
  onChange={(month) => {
@@ -206,6 +211,14 @@ const allCurrencies: Currency[] = [...popularCurrencies, ...otherCurrencies].sor
206
211
  a.code.localeCompare(b.code),
207
212
  );
208
213
 
214
+ function currencyOption(currency: Currency) {
215
+ return {
216
+ type: 'option',
217
+ value: currency,
218
+ filterMatchers: [currency.code, currency.name, ...(currency.countries ?? [])],
219
+ } satisfies SelectInputItem<Currency>;
220
+ }
221
+
209
222
  export const Currencies: StoryObj<{
210
223
  onChange: (value: Currency) => void;
211
224
  }> = {
@@ -219,18 +232,12 @@ export const Currencies: StoryObj<{
219
232
  {
220
233
  type: 'group',
221
234
  label: 'Popular currencies',
222
- options: popularCurrencies.map((currency) => ({
223
- type: 'option',
224
- value: currency,
225
- })),
235
+ options: popularCurrencies.map((currency) => currencyOption(currency)),
226
236
  },
227
237
  {
228
238
  type: 'group',
229
239
  label: 'All currencies',
230
- options: allCurrencies.map((currency) => ({
231
- type: 'option',
232
- value: currency,
233
- })),
240
+ options: allCurrencies.map((currency) => currencyOption(currency)),
234
241
  },
235
242
  ]}
236
243
  value={selectedCurrency}
@@ -257,3 +264,23 @@ export const Currencies: StoryObj<{
257
264
  },
258
265
  },
259
266
  };
267
+
268
+ export const WithinDrawer: StoryObj<{
269
+ onChange: (value: Currency) => void;
270
+ }> = {
271
+ ...Currencies,
272
+ decorators: [
273
+ (Story) => (
274
+ <Drawer open headerTitle="This is the title of the drawer">
275
+ <Story />
276
+ </Drawer>
277
+ ),
278
+ ],
279
+ };
280
+
281
+ export const WithinModal: StoryObj<{
282
+ onChange: (value: Currency) => void;
283
+ }> = {
284
+ ...Currencies,
285
+ decorators: [(Story) => <Modal open body={<Story />} onClose={() => {}} />],
286
+ };
@@ -1,6 +1,6 @@
1
1
  .np-bottom-sheet-v2-container {
2
2
  position: relative;
3
- z-index: 50;
3
+ z-index: 1060;
4
4
  }
5
5
 
6
6
  .np-bottom-sheet-v2-backdrop-container {
@@ -7,6 +7,7 @@ import {
7
7
  useRole,
8
8
  } from '@floating-ui/react';
9
9
  import { Transition } from '@headlessui/react';
10
+ import { ThemeProvider, useTheme } from '@wise/components-theming';
10
11
  import classNames from 'classnames';
11
12
  import { useState } from 'react';
12
13
 
@@ -55,6 +56,8 @@ export function BottomSheet({
55
56
 
56
57
  const [floatingKey, setFloatingKey] = useState(0);
57
58
 
59
+ const { theme, screenMode } = useTheme();
60
+
58
61
  return (
59
62
  <>
60
63
  {open ? <PreventScroll /> : null}
@@ -64,64 +67,66 @@ export function BottomSheet({
64
67
  })}
65
68
 
66
69
  <FloatingPortal>
67
- <Transition
68
- show={open}
69
- className="np-bottom-sheet-v2-container"
70
- beforeEnter={() => {
71
- setFloatingKey((prev) => prev + 1);
72
- }}
73
- >
74
- <Transition.Child
75
- enter="np-bottom-sheet-v2-backdrop-container--enter"
76
- enterFrom="np-bottom-sheet-v2-backdrop-container--enter-from"
77
- leave="np-bottom-sheet-v2-backdrop-container--leave"
78
- leaveTo="np-bottom-sheet-v2-backdrop-container--leave-to"
70
+ <ThemeProvider theme={theme} screenMode={screenMode} isNotRootProvider>
71
+ <Transition
72
+ show={open}
73
+ className="np-bottom-sheet-v2-container"
74
+ beforeEnter={() => {
75
+ setFloatingKey((prev) => prev + 1);
76
+ }}
79
77
  >
80
- <div className="np-bottom-sheet-v2-backdrop" />
81
- </Transition.Child>
78
+ <Transition.Child
79
+ enter="np-bottom-sheet-v2-backdrop-container--enter"
80
+ enterFrom="np-bottom-sheet-v2-backdrop-container--enter-from"
81
+ leave="np-bottom-sheet-v2-backdrop-container--leave"
82
+ leaveTo="np-bottom-sheet-v2-backdrop-container--leave-to"
83
+ >
84
+ <div className="np-bottom-sheet-v2-backdrop" />
85
+ </Transition.Child>
82
86
 
83
- <FloatingFocusManager context={context} initialFocus={initialFocusRef}>
84
- <div className="np-bottom-sheet-v2">
85
- <Transition.Child
86
- className="np-bottom-sheet-v2-content"
87
- enter="np-bottom-sheet-v2-content--enter"
88
- enterFrom="np-bottom-sheet-v2-content--enter-from"
89
- leave="np-bottom-sheet-v2-content--leave"
90
- leaveTo="np-bottom-sheet-v2-content--leave-to"
91
- >
92
- <div
93
- key={floatingKey} // Force inner state invalidation on open
94
- ref={refs.setFloating}
95
- className="np-bottom-sheet-v2-content-inner-container"
96
- {...getFloatingProps()}
87
+ <FloatingFocusManager context={context} initialFocus={initialFocusRef}>
88
+ <div className="np-bottom-sheet-v2">
89
+ <Transition.Child
90
+ className="np-bottom-sheet-v2-content"
91
+ enter="np-bottom-sheet-v2-content--enter"
92
+ enterFrom="np-bottom-sheet-v2-content--enter-from"
93
+ leave="np-bottom-sheet-v2-content--leave"
94
+ leaveTo="np-bottom-sheet-v2-content--leave-to"
97
95
  >
98
- <div className="np-bottom-sheet-v2-header">
99
- <CloseButton
100
- size={Size.SMALL}
101
- onClick={() => {
102
- onClose?.();
103
- }}
104
- />
105
- </div>
106
96
  <div
107
- className={classNames(
108
- 'np-bottom-sheet-v2-content-inner',
109
- title && 'np-bottom-sheet-v2-content-inner--has-title',
110
- {
111
- 'np-bottom-sheet-v2-content-inner--padding-md': padding === 'md',
112
- },
113
- )}
97
+ key={floatingKey} // Force inner state invalidation on open
98
+ ref={refs.setFloating}
99
+ className="np-bottom-sheet-v2-content-inner-container"
100
+ {...getFloatingProps()}
114
101
  >
115
- {title ? (
116
- <h2 className="np-bottom-sheet-v2-title np-text-title-body">{title}</h2>
117
- ) : null}
118
- <div className="np-bottom-sheet-v2-body np-text-body-default">{children}</div>
102
+ <div className="np-bottom-sheet-v2-header">
103
+ <CloseButton
104
+ size={Size.SMALL}
105
+ onClick={() => {
106
+ onClose?.();
107
+ }}
108
+ />
109
+ </div>
110
+ <div
111
+ className={classNames(
112
+ 'np-bottom-sheet-v2-content-inner',
113
+ title && 'np-bottom-sheet-v2-content-inner--has-title',
114
+ {
115
+ 'np-bottom-sheet-v2-content-inner--padding-md': padding === 'md',
116
+ },
117
+ )}
118
+ >
119
+ {title ? (
120
+ <h2 className="np-bottom-sheet-v2-title np-text-title-body">{title}</h2>
121
+ ) : null}
122
+ <div className="np-bottom-sheet-v2-body np-text-body-default">{children}</div>
123
+ </div>
119
124
  </div>
120
- </div>
121
- </Transition.Child>
122
- </div>
123
- </FloatingFocusManager>
124
- </Transition>
125
+ </Transition.Child>
126
+ </div>
127
+ </FloatingFocusManager>
128
+ </Transition>
129
+ </ThemeProvider>
125
130
  </FloatingPortal>
126
131
  </>
127
132
  );
@@ -1,5 +1,5 @@
1
1
  .np-popover-v2-container {
2
- z-index: 10;
2
+ z-index: 1060;
3
3
  display: flex;
4
4
  max-height: var(--max-height);
5
5
  width: var(--width);
@@ -13,6 +13,7 @@ import {
13
13
  useRole,
14
14
  } from '@floating-ui/react';
15
15
  import { Transition } from '@headlessui/react';
16
+ import { ThemeProvider, useTheme } from '@wise/components-theming';
16
17
  import classNames from 'classnames';
17
18
  import { useState } from 'react';
18
19
 
@@ -75,6 +76,8 @@ export function Popover({
75
76
 
76
77
  const [floatingKey, setFloatingKey] = useState(0);
77
78
 
79
+ const { theme, screenMode } = useTheme();
80
+
78
81
  return (
79
82
  <>
80
83
  {open ? <PreventScroll /> : null}
@@ -84,34 +87,38 @@ export function Popover({
84
87
  })}
85
88
 
86
89
  <FloatingPortal>
87
- <FloatingFocusManager context={context}>
88
- <Transition
89
- show={open}
90
- leave="transition-opacity"
91
- leaveTo="opacity-0"
92
- beforeEnter={() => {
93
- setFloatingKey((prev) => prev + 1);
94
- }}
95
- >
96
- <div
97
- key={floatingKey} // Force inner state invalidation on open
98
- ref={refs.setFloating}
99
- className="np-popover-v2-container"
100
- // eslint-disable-next-line react/forbid-dom-props
101
- style={floatingStyles}
102
- {...getFloatingProps()}
90
+ <ThemeProvider theme={theme} screenMode={screenMode} isNotRootProvider>
91
+ <FloatingFocusManager context={context}>
92
+ <Transition
93
+ show={open}
94
+ leave="transition-opacity"
95
+ leaveTo="opacity-0"
96
+ beforeEnter={() => {
97
+ setFloatingKey((prev) => prev + 1);
98
+ }}
103
99
  >
104
100
  <div
105
- className={classNames('np-popover-v2', title && 'np-popover-v2--has-title', {
106
- 'np-popover-v2--padding-md': padding === 'md',
107
- })}
101
+ key={floatingKey} // Force inner state invalidation on open
102
+ ref={refs.setFloating}
103
+ className="np-popover-v2-container"
104
+ // eslint-disable-next-line react/forbid-dom-props
105
+ style={floatingStyles}
106
+ {...getFloatingProps()}
108
107
  >
109
- {title ? <h2 className="np-popover-v2-title np-text-title-body">{title}</h2> : null}
110
- <div className="np-popover-v2-content np-text-body-default">{children}</div>
108
+ <div
109
+ className={classNames('np-popover-v2', title && 'np-popover-v2--has-title', {
110
+ 'np-popover-v2--padding-md': padding === 'md',
111
+ })}
112
+ >
113
+ {title ? (
114
+ <h2 className="np-popover-v2-title np-text-title-body">{title}</h2>
115
+ ) : null}
116
+ <div className="np-popover-v2-content np-text-body-default">{children}</div>
117
+ </div>
111
118
  </div>
112
- </div>
113
- </Transition>
114
- </FloatingFocusManager>
119
+ </Transition>
120
+ </FloatingFocusManager>
121
+ </ThemeProvider>
115
122
  </FloatingPortal>
116
123
  </>
117
124
  );
@@ -100,7 +100,7 @@ export const Variants = () => {
100
100
  </div>
101
101
  <div className="m-t-4 m-b-2">
102
102
  <Title type="title-body">Text Only List</Title>
103
- <ul style={{ paddingLeft: 0 }}>
103
+ <ul className="list-unstyled">
104
104
  <Template title="Sort code" value="23-14-71" />
105
105
  <Template title="Account number" value="12345678" />
106
106
  </ul>