@transferwise/components 46.0.4 → 46.0.6

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 (43) hide show
  1. package/build/i18n/cs.json +2 -0
  2. package/build/i18n/de.json +2 -0
  3. package/build/i18n/es.json +2 -0
  4. package/build/i18n/fr.json +2 -0
  5. package/build/i18n/hu.json +2 -0
  6. package/build/i18n/id.json +2 -0
  7. package/build/i18n/it.json +2 -0
  8. package/build/i18n/ja.json +2 -0
  9. package/build/i18n/pl.json +2 -0
  10. package/build/i18n/pt.json +2 -0
  11. package/build/i18n/ro.json +2 -0
  12. package/build/i18n/ru.json +2 -0
  13. package/build/i18n/th.json +2 -0
  14. package/build/i18n/tr.json +2 -0
  15. package/build/i18n/uk.json +2 -0
  16. package/build/i18n/zh-CN.json +2 -0
  17. package/build/i18n/zh-HK.json +2 -0
  18. package/build/index.esm.js +35 -5
  19. package/build/index.esm.js.map +1 -1
  20. package/build/index.js +35 -5
  21. package/build/index.js.map +1 -1
  22. package/build/types/moneyInput/MoneyInput.d.ts.map +1 -1
  23. package/package.json +2 -2
  24. package/src/i18n/cs.json +2 -0
  25. package/src/i18n/de.json +2 -0
  26. package/src/i18n/es.json +2 -0
  27. package/src/i18n/fr.json +2 -0
  28. package/src/i18n/hu.json +2 -0
  29. package/src/i18n/id.json +2 -0
  30. package/src/i18n/it.json +2 -0
  31. package/src/i18n/ja.json +2 -0
  32. package/src/i18n/pl.json +2 -0
  33. package/src/i18n/pt.json +2 -0
  34. package/src/i18n/ro.json +2 -0
  35. package/src/i18n/ru.json +2 -0
  36. package/src/i18n/th.json +2 -0
  37. package/src/i18n/tr.json +2 -0
  38. package/src/i18n/uk.json +2 -0
  39. package/src/i18n/zh-CN.json +2 -0
  40. package/src/i18n/zh-HK.json +2 -0
  41. package/src/moneyInput/MoneyInput.js +1 -3
  42. package/src/moneyInput/MoneyInput.story.tsx +23 -7
  43. package/src/tooltip/__snapshots__/Tooltip.spec.tsx.snap +1 -0
@@ -1 +1 @@
1
- {"version":3,"file":"MoneyInput.d.ts","sourceRoot":"","sources":["../../../src/moneyInput/MoneyInput.js"],"names":[],"mappings":";;;;AA+DA;IACE,wBAeC;IAZC,mBAAkD;IAClD;;;;;MAUC;IAGH,uDAaC;IAED,+CAWE;IAEF,oCAIE;IAEF,kCAyBE;IAEF,qCAgBE;IAEF,yBAGE;IAFA,mCAA0B;IAI5B,0BAEE;IAEF;;;;MAME;IAEF,0BAuBC;IAED,kBAsBC;IAED,yCAIE;IAEF,+BAKE;IAEF,+CAQE;IAEF,+BAAqE;IAErE,sCA6IC;CACF"}
1
+ {"version":3,"file":"MoneyInput.d.ts","sourceRoot":"","sources":["../../../src/moneyInput/MoneyInput.js"],"names":[],"mappings":";;;;AA+DA;IACE,wBAcC;IAXC,mBAAkD;IAClD;;;;MASC;IAGH,uDAaC;IAED,+CAWE;IAEF,oCAIE;IAEF,kCAyBE;IAEF,qCAgBE;IAEF,yBAGE;IAFA,mCAA0B;IAI5B,0BAEE;IAEF;;;;MAME;IAEF,0BAuBC;IAED,kBAsBC;IAED,yCAGE;IAEF,+BAKE;IAEF,+CAQE;IAEF,+BAAqE;IAErE,sCA6IC;CACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@transferwise/components",
3
- "version": "46.0.4",
3
+ "version": "46.0.6",
4
4
  "description": "Neptune React components",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -120,7 +120,7 @@
120
120
  "merge-props": "^6.0.0",
121
121
  "prop-types": "^15.7.2",
122
122
  "react-merge-refs": "^1.1.0",
123
- "react-popper": "^2.2.4",
123
+ "react-popper": "^2.3.0",
124
124
  "react-required-if": "^1.0.3",
125
125
  "react-transition-group": "^4.4.2",
126
126
  "use-sync-external-store": "^1.2.0"
package/src/i18n/cs.json CHANGED
@@ -4,8 +4,10 @@
4
4
  "neptune.ClearButton.ariaLabel": "Vyčistit",
5
5
  "neptune.CloseButton.ariaLabel": "Zavřít",
6
6
  "neptune.DateInput.day.label": "Den",
7
+ "neptune.DateInput.day.placeholder": "DD",
7
8
  "neptune.DateInput.month.label": "Měsíc",
8
9
  "neptune.DateInput.year.label": "Rok",
10
+ "neptune.DateInput.year.placeholder": "RRRR",
9
11
  "neptune.DateLookup.day": "den",
10
12
  "neptune.DateLookup.goTo20YearView": "Go to 20 year view",
11
13
  "neptune.DateLookup.month": "měsíc",
package/src/i18n/de.json CHANGED
@@ -4,8 +4,10 @@
4
4
  "neptune.ClearButton.ariaLabel": "Zurücksetzen",
5
5
  "neptune.CloseButton.ariaLabel": "Schließen",
6
6
  "neptune.DateInput.day.label": "Tag",
7
+ "neptune.DateInput.day.placeholder": "DD",
7
8
  "neptune.DateInput.month.label": "Monat",
8
9
  "neptune.DateInput.year.label": "Jahr",
10
+ "neptune.DateInput.year.placeholder": "YYYY",
9
11
  "neptune.DateLookup.day": "Tag",
10
12
  "neptune.DateLookup.goTo20YearView": "Zur 20-Jahres-Ansicht",
11
13
  "neptune.DateLookup.month": "Monat",
package/src/i18n/es.json CHANGED
@@ -4,8 +4,10 @@
4
4
  "neptune.ClearButton.ariaLabel": "Borrar",
5
5
  "neptune.CloseButton.ariaLabel": "Cerrar",
6
6
  "neptune.DateInput.day.label": "Día",
7
+ "neptune.DateInput.day.placeholder": "DD",
7
8
  "neptune.DateInput.month.label": "Mes",
8
9
  "neptune.DateInput.year.label": "Año",
10
+ "neptune.DateInput.year.placeholder": "AAAA",
9
11
  "neptune.DateLookup.day": "día",
10
12
  "neptune.DateLookup.goTo20YearView": "Ir a vista de 20 años",
11
13
  "neptune.DateLookup.month": "mes",
package/src/i18n/fr.json CHANGED
@@ -4,8 +4,10 @@
4
4
  "neptune.ClearButton.ariaLabel": "Effacer",
5
5
  "neptune.CloseButton.ariaLabel": "Fermer",
6
6
  "neptune.DateInput.day.label": "Jour",
7
+ "neptune.DateInput.day.placeholder": "JJ",
7
8
  "neptune.DateInput.month.label": "Mois",
8
9
  "neptune.DateInput.year.label": "Année",
10
+ "neptune.DateInput.year.placeholder": "AAAA",
9
11
  "neptune.DateLookup.day": "jour",
10
12
  "neptune.DateLookup.goTo20YearView": "Accéder à la vue sur 20 ans",
11
13
  "neptune.DateLookup.month": "mois",
package/src/i18n/hu.json CHANGED
@@ -4,8 +4,10 @@
4
4
  "neptune.ClearButton.ariaLabel": "Törlés",
5
5
  "neptune.CloseButton.ariaLabel": "Bezárás",
6
6
  "neptune.DateInput.day.label": "Nap",
7
+ "neptune.DateInput.day.placeholder": "Nap",
7
8
  "neptune.DateInput.month.label": "Hónap",
8
9
  "neptune.DateInput.year.label": "Év",
10
+ "neptune.DateInput.year.placeholder": "Év",
9
11
  "neptune.DateLookup.day": "nap",
10
12
  "neptune.DateLookup.goTo20YearView": "Ugrás a 20 éves nézetre",
11
13
  "neptune.DateLookup.month": "hónap",
package/src/i18n/id.json CHANGED
@@ -4,8 +4,10 @@
4
4
  "neptune.ClearButton.ariaLabel": "Hapus",
5
5
  "neptune.CloseButton.ariaLabel": "Tutup",
6
6
  "neptune.DateInput.day.label": "Hari",
7
+ "neptune.DateInput.day.placeholder": "HH",
7
8
  "neptune.DateInput.month.label": "Bulan",
8
9
  "neptune.DateInput.year.label": "Tahun",
10
+ "neptune.DateInput.year.placeholder": "TTTT",
9
11
  "neptune.DateLookup.day": "hari",
10
12
  "neptune.DateLookup.goTo20YearView": "Lihat tampilan 20 tahun",
11
13
  "neptune.DateLookup.month": "bulan",
package/src/i18n/it.json CHANGED
@@ -4,8 +4,10 @@
4
4
  "neptune.ClearButton.ariaLabel": "Elimina",
5
5
  "neptune.CloseButton.ariaLabel": "Chiudi",
6
6
  "neptune.DateInput.day.label": "Giorno",
7
+ "neptune.DateInput.day.placeholder": "GG",
7
8
  "neptune.DateInput.month.label": "Mese",
8
9
  "neptune.DateInput.year.label": "Anno",
10
+ "neptune.DateInput.year.placeholder": "AAAA",
9
11
  "neptune.DateLookup.day": "giorno",
10
12
  "neptune.DateLookup.goTo20YearView": "Vai alla vista su 20 anni",
11
13
  "neptune.DateLookup.month": "mese",
package/src/i18n/ja.json CHANGED
@@ -4,8 +4,10 @@
4
4
  "neptune.ClearButton.ariaLabel": "消去",
5
5
  "neptune.CloseButton.ariaLabel": "閉じる",
6
6
  "neptune.DateInput.day.label": "日",
7
+ "neptune.DateInput.day.placeholder": "日",
7
8
  "neptune.DateInput.month.label": "月",
8
9
  "neptune.DateInput.year.label": "年",
10
+ "neptune.DateInput.year.placeholder": "年(西暦)",
9
11
  "neptune.DateLookup.day": "日",
10
12
  "neptune.DateLookup.goTo20YearView": "20年表示に移動する",
11
13
  "neptune.DateLookup.month": "月",
package/src/i18n/pl.json CHANGED
@@ -4,8 +4,10 @@
4
4
  "neptune.ClearButton.ariaLabel": "Wyczyść",
5
5
  "neptune.CloseButton.ariaLabel": "Zamknij",
6
6
  "neptune.DateInput.day.label": "Dzień",
7
+ "neptune.DateInput.day.placeholder": "DD",
7
8
  "neptune.DateInput.month.label": "Miesiąc",
8
9
  "neptune.DateInput.year.label": "Rok",
10
+ "neptune.DateInput.year.placeholder": "RRRR",
9
11
  "neptune.DateLookup.day": "dzień",
10
12
  "neptune.DateLookup.goTo20YearView": "Przejdź do widoku 20-letniego",
11
13
  "neptune.DateLookup.month": "miesiąc",
package/src/i18n/pt.json CHANGED
@@ -4,8 +4,10 @@
4
4
  "neptune.ClearButton.ariaLabel": "Remover",
5
5
  "neptune.CloseButton.ariaLabel": "Fechar",
6
6
  "neptune.DateInput.day.label": "Dia",
7
+ "neptune.DateInput.day.placeholder": "DD",
7
8
  "neptune.DateInput.month.label": "Mês",
8
9
  "neptune.DateInput.year.label": "Ano",
10
+ "neptune.DateInput.year.placeholder": "AAAA",
9
11
  "neptune.DateLookup.day": "dia",
10
12
  "neptune.DateLookup.goTo20YearView": "Acessar a visualização de 20 anos",
11
13
  "neptune.DateLookup.month": "mês",
package/src/i18n/ro.json CHANGED
@@ -4,8 +4,10 @@
4
4
  "neptune.ClearButton.ariaLabel": "Elimină",
5
5
  "neptune.CloseButton.ariaLabel": "Închide",
6
6
  "neptune.DateInput.day.label": "Zi",
7
+ "neptune.DateInput.day.placeholder": "ZZ",
7
8
  "neptune.DateInput.month.label": "Lună",
8
9
  "neptune.DateInput.year.label": "An",
10
+ "neptune.DateInput.year.placeholder": "AAAA",
9
11
  "neptune.DateLookup.day": "zi",
10
12
  "neptune.DateLookup.goTo20YearView": "Accesează vizualizarea pe 20 de ani",
11
13
  "neptune.DateLookup.month": "lună",
package/src/i18n/ru.json CHANGED
@@ -4,8 +4,10 @@
4
4
  "neptune.ClearButton.ariaLabel": "Очистить",
5
5
  "neptune.CloseButton.ariaLabel": "Закрыть",
6
6
  "neptune.DateInput.day.label": "День",
7
+ "neptune.DateInput.day.placeholder": "ДД",
7
8
  "neptune.DateInput.month.label": "Месяц",
8
9
  "neptune.DateInput.year.label": "Год",
10
+ "neptune.DateInput.year.placeholder": "ГГГГ",
9
11
  "neptune.DateLookup.day": "день",
10
12
  "neptune.DateLookup.goTo20YearView": "Перейти к обзору 20 лет",
11
13
  "neptune.DateLookup.month": "месяц",
package/src/i18n/th.json CHANGED
@@ -4,8 +4,10 @@
4
4
  "neptune.ClearButton.ariaLabel": "ชัดเจน",
5
5
  "neptune.CloseButton.ariaLabel": "ปิด",
6
6
  "neptune.DateInput.day.label": "วัน",
7
+ "neptune.DateInput.day.placeholder": "DD",
7
8
  "neptune.DateInput.month.label": "เดือน",
8
9
  "neptune.DateInput.year.label": "ปี",
10
+ "neptune.DateInput.year.placeholder": "YYYY",
9
11
  "neptune.DateLookup.day": "วัน",
10
12
  "neptune.DateLookup.goTo20YearView": "Go to 20 year view",
11
13
  "neptune.DateLookup.month": "เดือน",
package/src/i18n/tr.json CHANGED
@@ -4,8 +4,10 @@
4
4
  "neptune.ClearButton.ariaLabel": "Sil",
5
5
  "neptune.CloseButton.ariaLabel": "Kapat",
6
6
  "neptune.DateInput.day.label": "Gün",
7
+ "neptune.DateInput.day.placeholder": "GG",
7
8
  "neptune.DateInput.month.label": "Ay",
8
9
  "neptune.DateInput.year.label": "Yıl",
10
+ "neptune.DateInput.year.placeholder": "YYYY",
9
11
  "neptune.DateLookup.day": "gün",
10
12
  "neptune.DateLookup.goTo20YearView": "20 yıl görünümüne git",
11
13
  "neptune.DateLookup.month": "ay",
package/src/i18n/uk.json CHANGED
@@ -4,8 +4,10 @@
4
4
  "neptune.ClearButton.ariaLabel": "Очистити",
5
5
  "neptune.CloseButton.ariaLabel": "Закрити",
6
6
  "neptune.DateInput.day.label": "День",
7
+ "neptune.DateInput.day.placeholder": "ДД",
7
8
  "neptune.DateInput.month.label": "Місяць",
8
9
  "neptune.DateInput.year.label": "Рік",
10
+ "neptune.DateInput.year.placeholder": "РРРР",
9
11
  "neptune.DateLookup.day": "дня",
10
12
  "neptune.DateLookup.goTo20YearView": "Go to 20 year view",
11
13
  "neptune.DateLookup.month": "місяць",
@@ -4,8 +4,10 @@
4
4
  "neptune.ClearButton.ariaLabel": "清除",
5
5
  "neptune.CloseButton.ariaLabel": "关闭",
6
6
  "neptune.DateInput.day.label": "日",
7
+ "neptune.DateInput.day.placeholder": "DD",
7
8
  "neptune.DateInput.month.label": "月",
8
9
  "neptune.DateInput.year.label": "年",
10
+ "neptune.DateInput.year.placeholder": "YYYY",
9
11
  "neptune.DateLookup.day": "日",
10
12
  "neptune.DateLookup.goTo20YearView": "转到 20 年视图",
11
13
  "neptune.DateLookup.month": "月",
@@ -4,8 +4,10 @@
4
4
  "neptune.ClearButton.ariaLabel": "清除",
5
5
  "neptune.CloseButton.ariaLabel": "關閉",
6
6
  "neptune.DateInput.day.label": "日",
7
+ "neptune.DateInput.day.placeholder": "日",
7
8
  "neptune.DateInput.month.label": "月",
8
9
  "neptune.DateInput.year.label": "年",
10
+ "neptune.DateInput.year.placeholder": "年",
9
11
  "neptune.DateLookup.day": "日",
10
12
  "neptune.DateLookup.goTo20YearView": "切換至20年視圖",
11
13
  "neptune.DateLookup.month": "月",
@@ -68,7 +68,6 @@ class MoneyInput extends Component {
68
68
  this.formatMessage = this.props.intl.formatMessage;
69
69
  this.state = {
70
70
  searchQuery: '',
71
- selectedOption: this.props.selectedCurrency,
72
71
  formattedAmount: formatAmountIfSet(
73
72
  props.amount,
74
73
  props.selectedCurrency.currency,
@@ -226,7 +225,6 @@ class MoneyInput extends Component {
226
225
 
227
226
  handleSelectChange = (value) => {
228
227
  this.handleSearchChange('');
229
- this.setState({ selectedOption: value });
230
228
  this.props.onCurrencyChange(value);
231
229
  };
232
230
 
@@ -356,7 +354,7 @@ class MoneyInput extends Component {
356
354
  >
357
355
  <SelectInput
358
356
  items={selectOptions}
359
- value={this.state.selectedOption}
357
+ value={selectedCurrency}
360
358
  compareValues="currency"
361
359
  renderValue={(currency, withinTrigger) => {
362
360
  return (
@@ -1,19 +1,33 @@
1
1
  import { Meta, StoryObj } from '@storybook/react';
2
2
  import { within, userEvent } from '@storybook/testing-library';
3
3
  import { Lock } from '@transferwise/icons';
4
- import React from 'react';
4
+ import React, { useState } from 'react';
5
5
 
6
6
  import MoneyInput from '.';
7
7
 
8
8
  export default {
9
9
  component: MoneyInput,
10
10
  title: 'Forms/MoneyInput',
11
- render: (args) => (
12
- <>
13
- <label htmlFor={args.id as string}>Editable money input label</label>
14
- <MoneyInput {...args} />
15
- </>
16
- ),
11
+ render: (args) => {
12
+ // eslint-disable-next-line react-hooks/rules-of-hooks
13
+ const [selectedCurrency, setSelectedCurrency] = useState(
14
+ args.selectedCurrency as SelectedOption,
15
+ );
16
+ const currencies = args.currencies as SelectedOption[];
17
+
18
+ const handleOnCurrencyChange = (value: SelectedOption) => setSelectedCurrency(value);
19
+
20
+ return (
21
+ <>
22
+ <label htmlFor={args.id as string}>Editable money input label</label>
23
+ <MoneyInput
24
+ {...args}
25
+ selectedCurrency={selectedCurrency}
26
+ onCurrencyChange={currencies.length > 1 ? handleOnCurrencyChange : undefined}
27
+ />
28
+ </>
29
+ );
30
+ },
17
31
  args: {
18
32
  id: 'money-input',
19
33
  amount: 1000,
@@ -28,6 +42,8 @@ export default {
28
42
 
29
43
  type Story = StoryObj<typeof MoneyInput>;
30
44
 
45
+ type SelectedOption = (typeof exampleCurrency)[keyof typeof exampleCurrency];
46
+
31
47
  const exampleCurrency = {
32
48
  eur: {
33
49
  value: 'EUR',
@@ -23,6 +23,7 @@ exports[`Tooltip Component renders an empty list when no items are passed 1`] =
23
23
  Test Tooltip
24
24
  <div
25
25
  class="np-panel__arrow"
26
+ style="position: absolute;"
26
27
  />
27
28
  </div>
28
29
  </div>