@transferwise/components 0.0.0-experimental-6348893 → 0.0.0-experimental-e556371

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 (116) hide show
  1. package/build/i18n/en.json +0 -2
  2. package/build/i18n/en.json.js +0 -2
  3. package/build/i18n/en.json.js.map +1 -1
  4. package/build/i18n/en.json.mjs +0 -2
  5. package/build/i18n/en.json.mjs.map +1 -1
  6. package/build/index.js +0 -2
  7. package/build/index.js.map +1 -1
  8. package/build/index.mjs +0 -1
  9. package/build/index.mjs.map +1 -1
  10. package/build/main.css +7 -65
  11. package/build/prompt/InlinePrompt/InlinePrompt.js +0 -7
  12. package/build/prompt/InlinePrompt/InlinePrompt.js.map +1 -1
  13. package/build/prompt/InlinePrompt/InlinePrompt.mjs +1 -8
  14. package/build/prompt/InlinePrompt/InlinePrompt.mjs.map +1 -1
  15. package/build/styles/main.css +7 -65
  16. package/build/styles/prompt/InlinePrompt/InlinePrompt.css +7 -7
  17. package/build/types/index.d.ts +0 -2
  18. package/build/types/index.d.ts.map +1 -1
  19. package/build/types/prompt/InlinePrompt/InlinePrompt.d.ts +2 -3
  20. package/build/types/prompt/InlinePrompt/InlinePrompt.d.ts.map +1 -1
  21. package/build/types/test-utils/index.d.ts +0 -4
  22. package/build/types/test-utils/index.d.ts.map +1 -1
  23. package/package.json +1 -1
  24. package/src/i18n/en.json +0 -2
  25. package/src/index.ts +0 -2
  26. package/src/main.css +7 -65
  27. package/src/main.less +0 -1
  28. package/src/prompt/InlinePrompt/InlinePrompt.css +7 -7
  29. package/src/prompt/InlinePrompt/InlinePrompt.less +7 -7
  30. package/src/prompt/InlinePrompt/InlinePrompt.spec.tsx +0 -6
  31. package/src/prompt/InlinePrompt/InlinePrompt.tsx +2 -12
  32. package/src/ssr.spec.tsx +0 -1
  33. package/build/expressiveMoneyInput/ExpressiveMoneyInput.js +0 -114
  34. package/build/expressiveMoneyInput/ExpressiveMoneyInput.js.map +0 -1
  35. package/build/expressiveMoneyInput/ExpressiveMoneyInput.messages.js +0 -17
  36. package/build/expressiveMoneyInput/ExpressiveMoneyInput.messages.js.map +0 -1
  37. package/build/expressiveMoneyInput/ExpressiveMoneyInput.messages.mjs +0 -13
  38. package/build/expressiveMoneyInput/ExpressiveMoneyInput.messages.mjs.map +0 -1
  39. package/build/expressiveMoneyInput/ExpressiveMoneyInput.mjs +0 -110
  40. package/build/expressiveMoneyInput/ExpressiveMoneyInput.mjs.map +0 -1
  41. package/build/expressiveMoneyInput/amountInput/AmountInput.js +0 -281
  42. package/build/expressiveMoneyInput/amountInput/AmountInput.js.map +0 -1
  43. package/build/expressiveMoneyInput/amountInput/AmountInput.mjs +0 -279
  44. package/build/expressiveMoneyInput/amountInput/AmountInput.mjs.map +0 -1
  45. package/build/expressiveMoneyInput/amountInput/utils.js +0 -87
  46. package/build/expressiveMoneyInput/amountInput/utils.js.map +0 -1
  47. package/build/expressiveMoneyInput/amountInput/utils.mjs +0 -78
  48. package/build/expressiveMoneyInput/amountInput/utils.mjs.map +0 -1
  49. package/build/expressiveMoneyInput/animatedNumber/AnimatedNumber.js +0 -50
  50. package/build/expressiveMoneyInput/animatedNumber/AnimatedNumber.js.map +0 -1
  51. package/build/expressiveMoneyInput/animatedNumber/AnimatedNumber.mjs +0 -48
  52. package/build/expressiveMoneyInput/animatedNumber/AnimatedNumber.mjs.map +0 -1
  53. package/build/expressiveMoneyInput/chevron/Chevron.js +0 -31
  54. package/build/expressiveMoneyInput/chevron/Chevron.js.map +0 -1
  55. package/build/expressiveMoneyInput/chevron/Chevron.mjs +0 -29
  56. package/build/expressiveMoneyInput/chevron/Chevron.mjs.map +0 -1
  57. package/build/expressiveMoneyInput/currencySelector/CurrencySelector.js +0 -160
  58. package/build/expressiveMoneyInput/currencySelector/CurrencySelector.js.map +0 -1
  59. package/build/expressiveMoneyInput/currencySelector/CurrencySelector.mjs +0 -157
  60. package/build/expressiveMoneyInput/currencySelector/CurrencySelector.mjs.map +0 -1
  61. package/build/expressiveMoneyInput/hooks/useFocus.js +0 -37
  62. package/build/expressiveMoneyInput/hooks/useFocus.js.map +0 -1
  63. package/build/expressiveMoneyInput/hooks/useFocus.mjs +0 -35
  64. package/build/expressiveMoneyInput/hooks/useFocus.mjs.map +0 -1
  65. package/build/expressiveMoneyInput/hooks/useInputStyle.js +0 -71
  66. package/build/expressiveMoneyInput/hooks/useInputStyle.js.map +0 -1
  67. package/build/expressiveMoneyInput/hooks/useInputStyle.mjs +0 -69
  68. package/build/expressiveMoneyInput/hooks/useInputStyle.mjs.map +0 -1
  69. package/build/styles/expressiveMoneyInput/ExpressiveMoneyInput.css +0 -58
  70. package/build/styles/expressiveMoneyInput/amountInput/AmountInput.css +0 -32
  71. package/build/styles/expressiveMoneyInput/chevron/Chevron.css +0 -12
  72. package/build/styles/expressiveMoneyInput/currencySelector/CurrencySelector.css +0 -6
  73. package/build/types/expressiveMoneyInput/ExpressiveMoneyInput.d.ts +0 -33
  74. package/build/types/expressiveMoneyInput/ExpressiveMoneyInput.d.ts.map +0 -1
  75. package/build/types/expressiveMoneyInput/ExpressiveMoneyInput.messages.d.ts +0 -12
  76. package/build/types/expressiveMoneyInput/ExpressiveMoneyInput.messages.d.ts.map +0 -1
  77. package/build/types/expressiveMoneyInput/amountInput/AmountInput.d.ts +0 -13
  78. package/build/types/expressiveMoneyInput/amountInput/AmountInput.d.ts.map +0 -1
  79. package/build/types/expressiveMoneyInput/amountInput/utils.d.ts +0 -22
  80. package/build/types/expressiveMoneyInput/amountInput/utils.d.ts.map +0 -1
  81. package/build/types/expressiveMoneyInput/animatedNumber/AnimatedNumber.d.ts +0 -9
  82. package/build/types/expressiveMoneyInput/animatedNumber/AnimatedNumber.d.ts.map +0 -1
  83. package/build/types/expressiveMoneyInput/chevron/Chevron.d.ts +0 -6
  84. package/build/types/expressiveMoneyInput/chevron/Chevron.d.ts.map +0 -1
  85. package/build/types/expressiveMoneyInput/currencySelector/CurrencySelector.d.ts +0 -30
  86. package/build/types/expressiveMoneyInput/currencySelector/CurrencySelector.d.ts.map +0 -1
  87. package/build/types/expressiveMoneyInput/hooks/useFocus.d.ts +0 -7
  88. package/build/types/expressiveMoneyInput/hooks/useFocus.d.ts.map +0 -1
  89. package/build/types/expressiveMoneyInput/hooks/useInputStyle.d.ts +0 -10
  90. package/build/types/expressiveMoneyInput/hooks/useInputStyle.d.ts.map +0 -1
  91. package/build/types/expressiveMoneyInput/hooks/useSelectionRange.d.ts +0 -10
  92. package/build/types/expressiveMoneyInput/hooks/useSelectionRange.d.ts.map +0 -1
  93. package/build/types/expressiveMoneyInput/index.d.ts +0 -3
  94. package/build/types/expressiveMoneyInput/index.d.ts.map +0 -1
  95. package/src/expressiveMoneyInput/ExpressiveMoneyInput.css +0 -58
  96. package/src/expressiveMoneyInput/ExpressiveMoneyInput.less +0 -13
  97. package/src/expressiveMoneyInput/ExpressiveMoneyInput.messages.ts +0 -13
  98. package/src/expressiveMoneyInput/ExpressiveMoneyInput.story.tsx +0 -290
  99. package/src/expressiveMoneyInput/ExpressiveMoneyInput.tsx +0 -125
  100. package/src/expressiveMoneyInput/amountInput/AmountInput.css +0 -32
  101. package/src/expressiveMoneyInput/amountInput/AmountInput.less +0 -43
  102. package/src/expressiveMoneyInput/amountInput/AmountInput.tsx +0 -353
  103. package/src/expressiveMoneyInput/amountInput/utils.spec.ts +0 -114
  104. package/src/expressiveMoneyInput/amountInput/utils.ts +0 -116
  105. package/src/expressiveMoneyInput/animatedNumber/AnimatedNumber.tsx +0 -40
  106. package/src/expressiveMoneyInput/chevron/Chevron.css +0 -12
  107. package/src/expressiveMoneyInput/chevron/Chevron.less +0 -13
  108. package/src/expressiveMoneyInput/chevron/Chevron.tsx +0 -35
  109. package/src/expressiveMoneyInput/currencySelector/CurrencySelector.css +0 -6
  110. package/src/expressiveMoneyInput/currencySelector/CurrencySelector.less +0 -7
  111. package/src/expressiveMoneyInput/currencySelector/CurrencySelector.tsx +0 -218
  112. package/src/expressiveMoneyInput/hooks/useFocus.ts +0 -35
  113. package/src/expressiveMoneyInput/hooks/useInputStyle.ts +0 -85
  114. package/src/expressiveMoneyInput/hooks/useSelectionRange.ts +0 -23
  115. package/src/expressiveMoneyInput/index.ts +0 -2
  116. package/src/prompt/InlinePrompt/InlinePrompt.story.tsx +0 -57
@@ -1,87 +0,0 @@
1
- 'use strict';
2
-
3
- var formatting = require('@transferwise/formatting');
4
-
5
- const getDecimalSeparator = (currency, locale) => {
6
- return formatting.formatAmount(1.1, currency, locale).replace(/\p{Number}/gu, '');
7
- };
8
- const getGroupSeparator = (currency, locale) => {
9
- return formatting.formatAmount(10000000, currency, locale).replace(/\p{Number}/gu, '')[0];
10
- };
11
- const getDecimalCount = (currency, locale) => {
12
- const decimalSeparator = getDecimalSeparator(currency, locale);
13
- if (!decimalSeparator) {
14
- return 0;
15
- }
16
- const parts = formatting.formatAmount(1.1, currency, locale).split(decimalSeparator);
17
- return parts.length === 2 ? parts[1].length : 0;
18
- };
19
- const getEnteredDecimalsCount = (value, decimalSeparator) => {
20
- return value.split(decimalSeparator)[1]?.length ?? 0;
21
- };
22
- const getUnformattedNumber = ({
23
- value: formattedValue,
24
- currency,
25
- locale
26
- }) => {
27
- const groupSeparator = getGroupSeparator(currency, locale);
28
- const decimalSeparator = getDecimalSeparator(currency, locale);
29
- if (!formattedValue) {
30
- return null;
31
- }
32
- // parseFloat can't handle thousands separators
33
- const withoutGroupSeparator = groupSeparator ? formattedValue.replace(/ /gu, '').replace(new RegExp(`\\${groupSeparator}`, 'g'), '') : formattedValue;
34
- // parseFloat can only handle . as decimal separator
35
- const withNormalisedDecimalSeparator = decimalSeparator ? withoutGroupSeparator.replace(decimalSeparator, '.') : withoutGroupSeparator;
36
- const parsedValue = Number.parseFloat(withNormalisedDecimalSeparator);
37
- return parsedValue;
38
- };
39
- const getFormattedString = ({
40
- value: unformattedValue,
41
- currency,
42
- locale,
43
- alwaysShowDecimals = false
44
- }) => {
45
- const decimalSeparator = getDecimalSeparator(currency, locale);
46
- // formatAmount rounds extra decimals, so 1.999 will become 2. Instead we will manually strip extra decimals so that it becomes 1.99 after formatting
47
- const decimalCount = getDecimalCount(currency, locale);
48
- const unformattedString = unformattedValue.toString();
49
- const [integerPart, decimalPart] = decimalSeparator ? unformattedString.split(decimalSeparator) : [unformattedString, undefined];
50
- const formattedDecimalPart = decimalPart ? decimalPart.slice(0, decimalCount) : '';
51
- const sanitisedUnformattedValue = Number.parseFloat(`${integerPart}.${formattedDecimalPart}`);
52
- return formatting.formatAmount(sanitisedUnformattedValue, currency, locale, {
53
- alwaysShowDecimals
54
- });
55
- };
56
- const isInputPossiblyOverflowing = ({
57
- ref,
58
- value
59
- }) => {
60
- const textLength = value.length;
61
- const inputWidth = ref.current?.clientWidth;
62
- if (!inputWidth || !textLength) {
63
- return;
64
- }
65
- const maxCharactersWithoutOverflow = Math.floor(inputWidth / 19);
66
- return textLength > maxCharactersWithoutOverflow;
67
- };
68
- const allowedInputKeys = new Set(['Backspace', 'Delete', ',', '.', 'ArrowLeft', 'ArrowRight', 'Enter', 'Tab']);
69
- const isAllowedInputKey = e => {
70
- const {
71
- metaKey,
72
- key,
73
- ctrlKey
74
- } = e;
75
- const isNumberKey = !Number.isNaN(Number.parseInt(key, 10));
76
- return isNumberKey || metaKey || ctrlKey || allowedInputKeys.has(key);
77
- };
78
-
79
- exports.getDecimalCount = getDecimalCount;
80
- exports.getDecimalSeparator = getDecimalSeparator;
81
- exports.getEnteredDecimalsCount = getEnteredDecimalsCount;
82
- exports.getFormattedString = getFormattedString;
83
- exports.getGroupSeparator = getGroupSeparator;
84
- exports.getUnformattedNumber = getUnformattedNumber;
85
- exports.isAllowedInputKey = isAllowedInputKey;
86
- exports.isInputPossiblyOverflowing = isInputPossiblyOverflowing;
87
- //# sourceMappingURL=utils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.js","sources":["../../../src/expressiveMoneyInput/amountInput/utils.ts"],"sourcesContent":["import { formatAmount } from '@transferwise/formatting';\nimport type { KeyboardEvent } from 'react';\n\nexport const getDecimalSeparator = (currency: string, locale: string): string | null => {\n return formatAmount(1.1, currency, locale).replace(/\\p{Number}/gu, '');\n};\n\nexport const getGroupSeparator = (currency: string, locale: string): string | null => {\n return formatAmount(10000000, currency, locale).replace(/\\p{Number}/gu, '')[0];\n};\n\nexport const getDecimalCount = (currency: string, locale: string): number => {\n const decimalSeparator = getDecimalSeparator(currency, locale);\n if (!decimalSeparator) {\n return 0;\n }\n const parts = formatAmount(1.1, currency, locale).split(decimalSeparator);\n return parts.length === 2 ? parts[1].length : 0;\n};\n\nexport const getEnteredDecimalsCount = (value: string, decimalSeparator: string) => {\n return value.split(decimalSeparator)[1]?.length ?? 0;\n};\n\nexport const getUnformattedNumber = ({\n value: formattedValue,\n currency,\n locale,\n}: {\n value: string;\n currency: string;\n locale: string;\n}): number | null => {\n const groupSeparator = getGroupSeparator(currency, locale);\n const decimalSeparator = getDecimalSeparator(currency, locale);\n if (!formattedValue) {\n return null;\n }\n\n // parseFloat can't handle thousands separators\n const withoutGroupSeparator = groupSeparator\n ? formattedValue.replace(/ /gu, '').replace(new RegExp(`\\\\${groupSeparator}`, 'g'), '')\n : formattedValue;\n\n // parseFloat can only handle . as decimal separator\n const withNormalisedDecimalSeparator = decimalSeparator\n ? withoutGroupSeparator.replace(decimalSeparator, '.')\n : withoutGroupSeparator;\n\n const parsedValue = Number.parseFloat(withNormalisedDecimalSeparator);\n return parsedValue;\n};\n\nexport const getFormattedString = ({\n value: unformattedValue,\n currency,\n locale,\n alwaysShowDecimals = false,\n}: {\n value: number;\n currency: string;\n locale: string;\n alwaysShowDecimals?: boolean;\n}): string => {\n const decimalSeparator = getDecimalSeparator(currency, locale);\n // formatAmount rounds extra decimals, so 1.999 will become 2. Instead we will manually strip extra decimals so that it becomes 1.99 after formatting\n const decimalCount = getDecimalCount(currency, locale);\n const unformattedString = unformattedValue.toString();\n\n const [integerPart, decimalPart] = decimalSeparator\n ? unformattedString.split(decimalSeparator)\n : [unformattedString, undefined];\n\n const formattedDecimalPart = decimalPart ? decimalPart.slice(0, decimalCount) : '';\n\n const sanitisedUnformattedValue = Number.parseFloat(`${integerPart}.${formattedDecimalPart}`);\n\n return formatAmount(sanitisedUnformattedValue, currency, locale, {\n alwaysShowDecimals,\n });\n};\n\nexport const isInputPossiblyOverflowing = ({\n ref,\n value,\n}: {\n ref: React.RefObject<HTMLInputElement>;\n value: string;\n}) => {\n const textLength = value.length;\n const inputWidth = ref.current?.clientWidth;\n if (!inputWidth || !textLength) {\n return;\n }\n\n const maxCharactersWithoutOverflow = Math.floor(inputWidth / 19);\n return textLength > maxCharactersWithoutOverflow;\n};\n\nconst allowedInputKeys = new Set([\n 'Backspace',\n 'Delete',\n ',',\n '.',\n 'ArrowLeft',\n 'ArrowRight',\n 'Enter',\n 'Tab',\n]);\n\nexport const isAllowedInputKey = (e: KeyboardEvent<HTMLInputElement>) => {\n const { metaKey, key, ctrlKey } = e;\n const isNumberKey = !Number.isNaN(Number.parseInt(key, 10));\n\n return isNumberKey || metaKey || ctrlKey || allowedInputKeys.has(key);\n};\n"],"names":["getDecimalSeparator","currency","locale","formatAmount","replace","getGroupSeparator","getDecimalCount","decimalSeparator","parts","split","length","getEnteredDecimalsCount","value","getUnformattedNumber","formattedValue","groupSeparator","withoutGroupSeparator","RegExp","withNormalisedDecimalSeparator","parsedValue","Number","parseFloat","getFormattedString","unformattedValue","alwaysShowDecimals","decimalCount","unformattedString","toString","integerPart","decimalPart","undefined","formattedDecimalPart","slice","sanitisedUnformattedValue","isInputPossiblyOverflowing","ref","textLength","inputWidth","current","clientWidth","maxCharactersWithoutOverflow","Math","floor","allowedInputKeys","Set","isAllowedInputKey","e","metaKey","key","ctrlKey","isNumberKey","isNaN","parseInt","has"],"mappings":";;;;MAGaA,mBAAmB,GAAGA,CAACC,QAAgB,EAAEC,MAAc,KAAmB;AACrF,EAAA,OAAOC,uBAAY,CAAC,GAAG,EAAEF,QAAQ,EAAEC,MAAM,CAAC,CA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AAA;AACD,GAAA,CAAC;AACJ;AAEO,MAAMU,0BAA0B,GAAGA,CAAC;EACzCC,GAAG;AACHvB,EAAAA;AAAK,CAIN,KAAI;AACH,EAAA,MAAMwB,UAAU,GAAGxB,KAAK,CAACF,MAAM;AAC/B,EAAA,MAAM2B,UAAU,GAAGF,GAAG,CAACG,OAAO,EAAEC,WAAW;AAC3C,EAAA,IAAI,CAACF,UAAU,IAAI,CAACD,UAAU,EAAE;AAC9B,IAAA;AACF,EAAA;EAEA,MAAMI,4BAA4B,GAAGC,IAAI,CAACC,KAAK,CAACL,UAAU,GAAG,EAAE,CAAC;EAChE,OAAOD,UAAU,GAAGI,4BAA4B;AAClD;AAEA,MAAMG,gBAAgB,GAAG,IAAIC,GAAG,CAAC,CAC/B,WAAW,EACX,QAAQ,EACR,GAAG,EACH,GAAG,EACH,WAAW,EACX,YAAY,EACZ,OAAO,EACP,KAAK,CACN,CAAC;AAEK,MAAMC,iBAAiB,GAAIC,CAAkC,IAAI;EACtE,MAAM;IAAEC,OAAO;IAAEC,GAAG;AAAEC,IAAAA;AAAO,GAAE,GAAGH,CAAC;AACnC,EAAA,MAAMI,WAAW,GAAG,CAAC9B,MAAM,CAAC+B,KAAK,CAAC/B,MAAM,CAACgC,QAAQ,CAACJ,GAAG,EAAE,EAAE,CAAC,CAAC;EAE3D,OAAOE,WAAW,IAAIH,OAAO,IAAIE,OAAO,IAAIN,gBAAgB,CAACU,GAAG,CAACL,GAAG,CAAC;AACvE;;;;;;;;;;;"}
@@ -1,78 +0,0 @@
1
- import { formatAmount } from '@transferwise/formatting';
2
-
3
- const getDecimalSeparator = (currency, locale) => {
4
- return formatAmount(1.1, currency, locale).replace(/\p{Number}/gu, '');
5
- };
6
- const getGroupSeparator = (currency, locale) => {
7
- return formatAmount(10000000, currency, locale).replace(/\p{Number}/gu, '')[0];
8
- };
9
- const getDecimalCount = (currency, locale) => {
10
- const decimalSeparator = getDecimalSeparator(currency, locale);
11
- if (!decimalSeparator) {
12
- return 0;
13
- }
14
- const parts = formatAmount(1.1, currency, locale).split(decimalSeparator);
15
- return parts.length === 2 ? parts[1].length : 0;
16
- };
17
- const getEnteredDecimalsCount = (value, decimalSeparator) => {
18
- return value.split(decimalSeparator)[1]?.length ?? 0;
19
- };
20
- const getUnformattedNumber = ({
21
- value: formattedValue,
22
- currency,
23
- locale
24
- }) => {
25
- const groupSeparator = getGroupSeparator(currency, locale);
26
- const decimalSeparator = getDecimalSeparator(currency, locale);
27
- if (!formattedValue) {
28
- return null;
29
- }
30
- // parseFloat can't handle thousands separators
31
- const withoutGroupSeparator = groupSeparator ? formattedValue.replace(/ /gu, '').replace(new RegExp(`\\${groupSeparator}`, 'g'), '') : formattedValue;
32
- // parseFloat can only handle . as decimal separator
33
- const withNormalisedDecimalSeparator = decimalSeparator ? withoutGroupSeparator.replace(decimalSeparator, '.') : withoutGroupSeparator;
34
- const parsedValue = Number.parseFloat(withNormalisedDecimalSeparator);
35
- return parsedValue;
36
- };
37
- const getFormattedString = ({
38
- value: unformattedValue,
39
- currency,
40
- locale,
41
- alwaysShowDecimals = false
42
- }) => {
43
- const decimalSeparator = getDecimalSeparator(currency, locale);
44
- // formatAmount rounds extra decimals, so 1.999 will become 2. Instead we will manually strip extra decimals so that it becomes 1.99 after formatting
45
- const decimalCount = getDecimalCount(currency, locale);
46
- const unformattedString = unformattedValue.toString();
47
- const [integerPart, decimalPart] = decimalSeparator ? unformattedString.split(decimalSeparator) : [unformattedString, undefined];
48
- const formattedDecimalPart = decimalPart ? decimalPart.slice(0, decimalCount) : '';
49
- const sanitisedUnformattedValue = Number.parseFloat(`${integerPart}.${formattedDecimalPart}`);
50
- return formatAmount(sanitisedUnformattedValue, currency, locale, {
51
- alwaysShowDecimals
52
- });
53
- };
54
- const isInputPossiblyOverflowing = ({
55
- ref,
56
- value
57
- }) => {
58
- const textLength = value.length;
59
- const inputWidth = ref.current?.clientWidth;
60
- if (!inputWidth || !textLength) {
61
- return;
62
- }
63
- const maxCharactersWithoutOverflow = Math.floor(inputWidth / 19);
64
- return textLength > maxCharactersWithoutOverflow;
65
- };
66
- const allowedInputKeys = new Set(['Backspace', 'Delete', ',', '.', 'ArrowLeft', 'ArrowRight', 'Enter', 'Tab']);
67
- const isAllowedInputKey = e => {
68
- const {
69
- metaKey,
70
- key,
71
- ctrlKey
72
- } = e;
73
- const isNumberKey = !Number.isNaN(Number.parseInt(key, 10));
74
- return isNumberKey || metaKey || ctrlKey || allowedInputKeys.has(key);
75
- };
76
-
77
- export { getDecimalCount, getDecimalSeparator, getEnteredDecimalsCount, getFormattedString, getGroupSeparator, getUnformattedNumber, isAllowedInputKey, isInputPossiblyOverflowing };
78
- //# sourceMappingURL=utils.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.mjs","sources":["../../../src/expressiveMoneyInput/amountInput/utils.ts"],"sourcesContent":["import { formatAmount } from '@transferwise/formatting';\nimport type { KeyboardEvent } from 'react';\n\nexport const getDecimalSeparator = (currency: string, locale: string): string | null => {\n return formatAmount(1.1, currency, locale).replace(/\\p{Number}/gu, '');\n};\n\nexport const getGroupSeparator = (currency: string, locale: string): string | null => {\n return formatAmount(10000000, currency, locale).replace(/\\p{Number}/gu, '')[0];\n};\n\nexport const getDecimalCount = (currency: string, locale: string): number => {\n const decimalSeparator = getDecimalSeparator(currency, locale);\n if (!decimalSeparator) {\n return 0;\n }\n const parts = formatAmount(1.1, currency, locale).split(decimalSeparator);\n return parts.length === 2 ? parts[1].length : 0;\n};\n\nexport const getEnteredDecimalsCount = (value: string, decimalSeparator: string) => {\n return value.split(decimalSeparator)[1]?.length ?? 0;\n};\n\nexport const getUnformattedNumber = ({\n value: formattedValue,\n currency,\n locale,\n}: {\n value: string;\n currency: string;\n locale: string;\n}): number | null => {\n const groupSeparator = getGroupSeparator(currency, locale);\n const decimalSeparator = getDecimalSeparator(currency, locale);\n if (!formattedValue) {\n return null;\n }\n\n // parseFloat can't handle thousands separators\n const withoutGroupSeparator = groupSeparator\n ? formattedValue.replace(/ /gu, '').replace(new RegExp(`\\\\${groupSeparator}`, 'g'), '')\n : formattedValue;\n\n // parseFloat can only handle . as decimal separator\n const withNormalisedDecimalSeparator = decimalSeparator\n ? withoutGroupSeparator.replace(decimalSeparator, '.')\n : withoutGroupSeparator;\n\n const parsedValue = Number.parseFloat(withNormalisedDecimalSeparator);\n return parsedValue;\n};\n\nexport const getFormattedString = ({\n value: unformattedValue,\n currency,\n locale,\n alwaysShowDecimals = false,\n}: {\n value: number;\n currency: string;\n locale: string;\n alwaysShowDecimals?: boolean;\n}): string => {\n const decimalSeparator = getDecimalSeparator(currency, locale);\n // formatAmount rounds extra decimals, so 1.999 will become 2. Instead we will manually strip extra decimals so that it becomes 1.99 after formatting\n const decimalCount = getDecimalCount(currency, locale);\n const unformattedString = unformattedValue.toString();\n\n const [integerPart, decimalPart] = decimalSeparator\n ? unformattedString.split(decimalSeparator)\n : [unformattedString, undefined];\n\n const formattedDecimalPart = decimalPart ? decimalPart.slice(0, decimalCount) : '';\n\n const sanitisedUnformattedValue = Number.parseFloat(`${integerPart}.${formattedDecimalPart}`);\n\n return formatAmount(sanitisedUnformattedValue, currency, locale, {\n alwaysShowDecimals,\n });\n};\n\nexport const isInputPossiblyOverflowing = ({\n ref,\n value,\n}: {\n ref: React.RefObject<HTMLInputElement>;\n value: string;\n}) => {\n const textLength = value.length;\n const inputWidth = ref.current?.clientWidth;\n if (!inputWidth || !textLength) {\n return;\n }\n\n const maxCharactersWithoutOverflow = Math.floor(inputWidth / 19);\n return textLength > maxCharactersWithoutOverflow;\n};\n\nconst allowedInputKeys = new Set([\n 'Backspace',\n 'Delete',\n ',',\n '.',\n 'ArrowLeft',\n 'ArrowRight',\n 'Enter',\n 'Tab',\n]);\n\nexport const isAllowedInputKey = (e: KeyboardEvent<HTMLInputElement>) => {\n const { metaKey, key, ctrlKey } = e;\n const isNumberKey = !Number.isNaN(Number.parseInt(key, 10));\n\n return isNumberKey || metaKey || ctrlKey || allowedInputKeys.has(key);\n};\n"],"names":["getDecimalSeparator","currency","locale","formatAmount","replace","getGroupSeparator","getDecimalCount","decimalSeparator","parts","split","length","getEnteredDecimalsCount","value","getUnformattedNumber","formattedValue","groupSeparator","withoutGroupSeparator","RegExp","withNormalisedDecimalSeparator","parsedValue","Number","parseFloat","getFormattedString","unformattedValue","alwaysShowDecimals","decimalCount","unformattedString","toString","integerPart","decimalPart","undefined","formattedDecimalPart","slice","sanitisedUnformattedValue","isInputPossiblyOverflowing","ref","textLength","inputWidth","current","clientWidth","maxCharactersWithoutOverflow","Math","floor","allowedInputKeys","Set","isAllowedInputKey","e","metaKey","key","ctrlKey","isNumberKey","isNaN","parseInt","has"],"mappings":";;MAGaA,mBAAmB,GAAGA,CAACC,QAAgB,EAAEC,MAAc,KAAmB;AACrF,EAAA,OAAOC,YAAY,CAAC,GAAG,EAAEF,QAAQ,EAAEC,MAAM,CAAC,CAACE,OAAO,CAAC,cAAc,EAAE,EAAE,CAAC;AACxE;MAEaC,iBAAiB,GAAGA,CAACJ,QAAgB,EAAEC,MAAc,KAAmB;AACnF,EAAA,OAAOC,YAAY,CAAC,QAAQ,EAAEF,QAAQ,EAAEC,MAAM,CAAC,CAACE,OAAO,CAAC,cAAc,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC;AAChF;MAEaE,eAAe,GAAGA,CAACL,QAAgB,EAAEC,MAAc,KAAY;AAC1E,EAAA,MAAMK,gBAAgB,GAAGP,mBAAmB,CAACC,QAAQ,EAAEC,MAAM,CAAC;EAC9D,IAAI,CAACK,gBAAgB,EAAE;AACrB,IAAA,OAAO,CAAC;AACV,EAAA;AACA,EAAA,MAAMC,KAAK,GAAGL,YAAY,CAAC,GAAG,EAAEF,QAAQ,EAAEC,MAAM,CAAC,CAACO,KAAK,CAACF,gBAAgB,CAAC;AACzE,EAAA,OAAOC,KAAK,CAACE,MAAM,KAAK,CAAC,GAAGF,KAAK,CAAC,CAAC,CAAC,CAACE,MAAM,GAAG,CAAC;AACjD;MAEaC,uBAA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AGH,CAAC;AACnC,EAAA,MAAMI,WAAW,GAAG,CAAC9B,MAAM,CAAC+B,KAAK,CAAC/B,MAAM,CAACgC,QAAQ,CAACJ,GAAG,EAAE,EAAE,CAAC,CAAC;EAE3D,OAAOE,WAAW,IAAIH,OAAO,IAAIE,OAAO,IAAIN,gBAAgB,CAACU,GAAG,CAACL,GAAG,CAAC;AACvE;;;;"}
@@ -1,50 +0,0 @@
1
- 'use strict';
2
-
3
- var framerMotion = require('framer-motion');
4
- var jsxRuntime = require('react/jsx-runtime');
5
-
6
- const AnimatedNumber = ({
7
- children,
8
- onClick,
9
- className
10
- }) => {
11
- const reducedMotion = framerMotion.useReducedMotion();
12
- return /*#__PURE__*/jsxRuntime.jsx(framerMotion.motion.span, {
13
- className: className,
14
- "aria-hidden": true,
15
- initial: {
16
- zoom: 0.01
17
- },
18
- animate: {
19
- zoom: 1
20
- },
21
- exit: {
22
- zoom: 0.01
23
- },
24
- transition: {
25
- duration: reducedMotion ? 0 : 0.3,
26
- type: 'tween',
27
- ease: [0.3, 0, 0.1, 1]
28
- },
29
- onClick: () => onClick?.(),
30
- children: /*#__PURE__*/jsxRuntime.jsx(framerMotion.motion.span, {
31
- initial: {
32
- opacity: 0
33
- },
34
- animate: {
35
- opacity: [0, 0, 1]
36
- },
37
- exit: {
38
- opacity: [1, 0, 0]
39
- },
40
- transition: {
41
- duration: reducedMotion ? 0 : 0.3,
42
- times: [0, 0.5, 1]
43
- },
44
- children: children
45
- })
46
- });
47
- };
48
-
49
- exports.AnimatedNumber = AnimatedNumber;
50
- //# sourceMappingURL=AnimatedNumber.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AnimatedNumber.js","sources":["../../../src/expressiveMoneyInput/animatedNumber/AnimatedNumber.tsx"],"sourcesContent":["import { motion, useReducedMotion } from 'framer-motion';\nimport type { ReactNode } from 'react';\n\ninterface Props {\n children: ReactNode;\n onClick?: () => void;\n className?: string;\n}\n\nexport const AnimatedNumber = ({ children, onClick, className }: Props) => {\n const reducedMotion = useReducedMotion();\n\n return (\n <motion.span\n className={className}\n aria-hidden\n initial={{ zoom: 0.01 }}\n animate={{ zoom: 1 }}\n exit={{ zoom: 0.01 }}\n transition={{\n duration: reducedMotion ? 0 : 0.3,\n type: 'tween',\n ease: [0.3, 0, 0.1, 1],\n }}\n onClick={() => onClick?.()}\n >\n <motion.span\n initial={{ opacity: 0 }}\n animate={{ opacity: [0, 0, 1] }}\n exit={{ opacity: [1, 0, 0] }}\n transition={{\n duration: reducedMotion ? 0 : 0.3,\n times: [0, 0.5, 1],\n }}\n >\n {children}\n </motion.span>\n </motion.span>\n );\n};\n"],"names":["AnimatedNumber","children","onClick","className","reducedMotion","useReducedMotion","_jsx","motion","span","initial","zoom","animate","exit","transition","duration","type","ease","opacity","times"],"mappings":";;;;;AASO,MAAMA,cAAc,GAAGA,CAAC;EAAEC,QAAQ;EAAEC,OAAO;AAAEC,EAAAA;AAAS,CAAS,KAAI;AACxE,EAAA,MAAMC,aAAa,GAAGC,6BAAgB,EAAE;AAExC,EAAA,oBACEC,cAAA,CAACC,mBAAM,CAACC,IAAI,EAAA;AACVL,IAAAA,SAAS,EAAEA,SAAU;IACrB,aAAA,EAAA,IAAW;AACXM,IAAAA,OAAO,EAAE;AAAEC,MAAAA,IAAI,EAAE;KAAO;AACxBC,IAAAA,OAAO,EAAE;AAAED,MAAAA,IAAI,EAAE;KAAI;AACrBE,IAAAA,IAAI,EAAE;AAAEF,MAAAA,IAAI,EAAE;KAAO;AACrBG,IAAAA,UAAU,EAAE;AACVC,MAAAA,QAAQ,EAAEV,aAAa,GAAG,CAAC,GAAG,GAAG;AACjCW,MAAAA,IAAI,EAAE,OAAO;MACbC,IAAI,EAAE,CAAC,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC;KACrB;AACFd,IAAAA,OAAO,EAAEA,MAAMA,OAAO,IAAK;AAAAD,IAAAA,QAAA,eAE3BK,cAAA,CAACC,mBAAM,CAACC,IAAI,EAAA;AACVC,MAAAA,OAAO,EAAE;AAAEQ,QAAAA,OAAO,EAAE;OAAI;AACxBN,MAAAA,OAAO,EAAE;AAAEM,QAAAA,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC;OAAI;AAChCL,MAAAA,IAAI,EAAE;AAAEK,QAAAA,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC;OAAI;AAC7BJ,MAAAA,UAAU,EAAE;AACVC,QAAAA,QAAQ,EAAEV,aAAa,GAAG,CAAC,GAAG,GAAG;AACjCc,QAAAA,KAAK,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC;OACjB;AAAAjB,MAAAA,QAAA,EAEDA;KACU;AACf,GAAa,CAAC;AAElB;;;;"}
@@ -1,48 +0,0 @@
1
- import { useReducedMotion, motion } from 'framer-motion';
2
- import { jsx } from 'react/jsx-runtime';
3
-
4
- const AnimatedNumber = ({
5
- children,
6
- onClick,
7
- className
8
- }) => {
9
- const reducedMotion = useReducedMotion();
10
- return /*#__PURE__*/jsx(motion.span, {
11
- className: className,
12
- "aria-hidden": true,
13
- initial: {
14
- zoom: 0.01
15
- },
16
- animate: {
17
- zoom: 1
18
- },
19
- exit: {
20
- zoom: 0.01
21
- },
22
- transition: {
23
- duration: reducedMotion ? 0 : 0.3,
24
- type: 'tween',
25
- ease: [0.3, 0, 0.1, 1]
26
- },
27
- onClick: () => onClick?.(),
28
- children: /*#__PURE__*/jsx(motion.span, {
29
- initial: {
30
- opacity: 0
31
- },
32
- animate: {
33
- opacity: [0, 0, 1]
34
- },
35
- exit: {
36
- opacity: [1, 0, 0]
37
- },
38
- transition: {
39
- duration: reducedMotion ? 0 : 0.3,
40
- times: [0, 0.5, 1]
41
- },
42
- children: children
43
- })
44
- });
45
- };
46
-
47
- export { AnimatedNumber };
48
- //# sourceMappingURL=AnimatedNumber.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AnimatedNumber.mjs","sources":["../../../src/expressiveMoneyInput/animatedNumber/AnimatedNumber.tsx"],"sourcesContent":["import { motion, useReducedMotion } from 'framer-motion';\nimport type { ReactNode } from 'react';\n\ninterface Props {\n children: ReactNode;\n onClick?: () => void;\n className?: string;\n}\n\nexport const AnimatedNumber = ({ children, onClick, className }: Props) => {\n const reducedMotion = useReducedMotion();\n\n return (\n <motion.span\n className={className}\n aria-hidden\n initial={{ zoom: 0.01 }}\n animate={{ zoom: 1 }}\n exit={{ zoom: 0.01 }}\n transition={{\n duration: reducedMotion ? 0 : 0.3,\n type: 'tween',\n ease: [0.3, 0, 0.1, 1],\n }}\n onClick={() => onClick?.()}\n >\n <motion.span\n initial={{ opacity: 0 }}\n animate={{ opacity: [0, 0, 1] }}\n exit={{ opacity: [1, 0, 0] }}\n transition={{\n duration: reducedMotion ? 0 : 0.3,\n times: [0, 0.5, 1],\n }}\n >\n {children}\n </motion.span>\n </motion.span>\n );\n};\n"],"names":["AnimatedNumber","children","onClick","className","reducedMotion","useReducedMotion","_jsx","motion","span","initial","zoom","animate","exit","transition","duration","type","ease","opacity","times"],"mappings":";;;AASO,MAAMA,cAAc,GAAGA,CAAC;EAAEC,QAAQ;EAAEC,OAAO;AAAEC,EAAAA;AAAS,CAAS,KAAI;AACxE,EAAA,MAAMC,aAAa,GAAGC,gBAAgB,EAAE;AAExC,EAAA,oBACEC,GAAA,CAACC,MAAM,CAACC,IAAI,EAAA;AACVL,IAAAA,SAAS,EAAEA,SAAU;IACrB,aAAA,EAAA,IAAW;AACXM,IAAAA,OAAO,EAAE;AAAEC,MAAAA,IAAI,EAAE;KAAO;AACxBC,IAAAA,OAAO,EAAE;AAAED,MAAAA,IAAI,EAAE;KAAI;AACrBE,IAAAA,IAAI,EAAE;AAAEF,MAAAA,IAAI,EAAE;KAAO;AACrBG,IAAAA,UAAU,EAAE;AACVC,MAAAA,QAAQ,EAAEV,aAAa,GAAG,CAAC,GAAG,GAAG;AACjCW,MAAAA,IAAI,EAAE,OAAO;MACbC,IAAI,EAAE,CAAC,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC;KACrB;AACFd,IAAAA,OAAO,EAAEA,MAAMA,OAAO,IAAK;AAAAD,IAAAA,QAAA,eAE3BK,GAAA,CAACC,MAAM,CAACC,IAAI,EAAA;AACVC,MAAAA,OAAO,EAAE;AAAEQ,QAAAA,OAAO,EAAE;OAAI;AACxBN,MAAAA,OAAO,EAAE;AAAEM,QAAAA,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC;OAAI;AAChCL,MAAAA,IAAI,EAAE;AAAEK,QAAAA,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC;OAAI;AAC7BJ,MAAAA,UAAU,EAAE;AACVC,QAAAA,QAAQ,EAAEV,aAAa,GAAG,CAAC,GAAG,GAAG;AACjCc,QAAAA,KAAK,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC;OACjB;AAAAjB,MAAAA,QAAA,EAEDA;KACU;AACf,GAAa,CAAC;AAElB;;;;"}
@@ -1,31 +0,0 @@
1
- 'use strict';
2
-
3
- var icons = require('@transferwise/icons');
4
- var clsx = require('clsx');
5
- var framerMotion = require('framer-motion');
6
- var jsxRuntime = require('react/jsx-runtime');
7
-
8
- const Chevron = ({
9
- shouldShow = true
10
- }) => {
11
- return /*#__PURE__*/jsxRuntime.jsx("div", {
12
- className: clsx.clsx('d-flex align-items-center', 'wds-chevron-container', !shouldShow && 'wds-chevron-hidden'),
13
- children: /*#__PURE__*/jsxRuntime.jsx(framerMotion.motion.div, {
14
- animate: {
15
- x: [12, 0, 0, -12],
16
- opacity: [0, 1, 1, 0]
17
- },
18
- transition: {
19
- duration: 3,
20
- ease: [[0.3, 0, 0.1, 1], 'linear', [0.3, 0, 0.1, 1]],
21
- times: [0, 0.1, 0.9, 1],
22
- repeat: Infinity,
23
- repeatType: 'loop'
24
- },
25
- children: /*#__PURE__*/jsxRuntime.jsx(icons.ChevronLeft, {})
26
- })
27
- });
28
- };
29
-
30
- exports.Chevron = Chevron;
31
- //# sourceMappingURL=Chevron.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Chevron.js","sources":["../../../src/expressiveMoneyInput/chevron/Chevron.tsx"],"sourcesContent":["import { ChevronLeft } from '@transferwise/icons';\nimport { clsx } from 'clsx';\nimport { motion } from 'framer-motion';\n\ninterface Props {\n shouldShow: boolean;\n}\n\nexport const Chevron = ({ shouldShow = true }: Props) => {\n return (\n <div\n className={clsx(\n 'd-flex align-items-center',\n 'wds-chevron-container',\n !shouldShow && 'wds-chevron-hidden',\n )}\n >\n <motion.div\n animate={{\n x: [12, 0, 0, -12],\n opacity: [0, 1, 1, 0],\n }}\n transition={{\n duration: 3,\n ease: [[0.3, 0, 0.1, 1], 'linear', [0.3, 0, 0.1, 1]],\n times: [0, 0.1, 0.9, 1],\n repeat: Infinity,\n repeatType: 'loop',\n }}\n >\n <ChevronLeft />\n </motion.div>\n </div>\n );\n};\n"],"names":["Chevron","shouldShow","_jsx","className","clsx","children","motion","div","animate","x","opacity","transition","duration","ease","times","repeat","Infinity","repeatType","ChevronLeft"],"mappings":";;;;;;;AAQO,MAAMA,OAAO,GAAGA,CAAC;AAAEC,EAAAA,UAAU,GAAG;AAAI,CAAS,KAAI;AACtD,EAAA,oBACEC,cAAA,CAAA,KAAA,EAAA;IACEC,SAAS,EAAEC,SAAI,CACb,2BAA2B,EAC3B,uBAAuB,EACvB,CAACH,UAAU,IAAI,oBAAoB,CACnC;AAAAI,IAAAA,QAAA,eAEFH,cAAA,CAACI,mBAAM,CAACC,GAAG,EAAA;AACTC,MAAAA,OAAO,EAAE;QACPC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC;QAClBC,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;OACpB;AACFC,MAAAA,UAAU,EAAE;AACVC,QAAAA,QAAQ,EAAE,CAAC;QACXC,IAAI,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC;QACpDC,KAAK,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC;AACvBC,QAAAA,MAAM,EAAEC,QAAQ;AAChBC,QAAAA,UAAU,EAAE;OACZ;AAAAZ,MAAAA,QAAA,eAEFH,cAAA,CAACgB,iBAAW,EAAA,EAAA;KACF;AACd,GAAK,CAAC;AAEV;;;;"}
@@ -1,29 +0,0 @@
1
- import { ChevronLeft } from '@transferwise/icons';
2
- import { clsx } from 'clsx';
3
- import { motion } from 'framer-motion';
4
- import { jsx } from 'react/jsx-runtime';
5
-
6
- const Chevron = ({
7
- shouldShow = true
8
- }) => {
9
- return /*#__PURE__*/jsx("div", {
10
- className: clsx('d-flex align-items-center', 'wds-chevron-container', !shouldShow && 'wds-chevron-hidden'),
11
- children: /*#__PURE__*/jsx(motion.div, {
12
- animate: {
13
- x: [12, 0, 0, -12],
14
- opacity: [0, 1, 1, 0]
15
- },
16
- transition: {
17
- duration: 3,
18
- ease: [[0.3, 0, 0.1, 1], 'linear', [0.3, 0, 0.1, 1]],
19
- times: [0, 0.1, 0.9, 1],
20
- repeat: Infinity,
21
- repeatType: 'loop'
22
- },
23
- children: /*#__PURE__*/jsx(ChevronLeft, {})
24
- })
25
- });
26
- };
27
-
28
- export { Chevron };
29
- //# sourceMappingURL=Chevron.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Chevron.mjs","sources":["../../../src/expressiveMoneyInput/chevron/Chevron.tsx"],"sourcesContent":["import { ChevronLeft } from '@transferwise/icons';\nimport { clsx } from 'clsx';\nimport { motion } from 'framer-motion';\n\ninterface Props {\n shouldShow: boolean;\n}\n\nexport const Chevron = ({ shouldShow = true }: Props) => {\n return (\n <div\n className={clsx(\n 'd-flex align-items-center',\n 'wds-chevron-container',\n !shouldShow && 'wds-chevron-hidden',\n )}\n >\n <motion.div\n animate={{\n x: [12, 0, 0, -12],\n opacity: [0, 1, 1, 0],\n }}\n transition={{\n duration: 3,\n ease: [[0.3, 0, 0.1, 1], 'linear', [0.3, 0, 0.1, 1]],\n times: [0, 0.1, 0.9, 1],\n repeat: Infinity,\n repeatType: 'loop',\n }}\n >\n <ChevronLeft />\n </motion.div>\n </div>\n );\n};\n"],"names":["Chevron","shouldShow","_jsx","className","clsx","children","motion","div","animate","x","opacity","transition","duration","ease","times","repeat","Infinity","repeatType","ChevronLeft"],"mappings":";;;;;AAQO,MAAMA,OAAO,GAAGA,CAAC;AAAEC,EAAAA,UAAU,GAAG;AAAI,CAAS,KAAI;AACtD,EAAA,oBACEC,GAAA,CAAA,KAAA,EAAA;IACEC,SAAS,EAAEC,IAAI,CACb,2BAA2B,EAC3B,uBAAuB,EACvB,CAACH,UAAU,IAAI,oBAAoB,CACnC;AAAAI,IAAAA,QAAA,eAEFH,GAAA,CAACI,MAAM,CAACC,GAAG,EAAA;AACTC,MAAAA,OAAO,EAAE;QACPC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC;QAClBC,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;OACpB;AACFC,MAAAA,UAAU,EAAE;AACVC,QAAAA,QAAQ,EAAE,CAAC;QACXC,IAAI,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC;QACpDC,KAAK,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC;AACvBC,QAAAA,MAAM,EAAEC,QAAQ;AAChBC,QAAAA,UAAU,EAAE;OACZ;AAAAZ,MAAAA,QAAA,eAEFH,GAAA,CAACgB,WAAW,EAAA,EAAA;KACF;AACd,GAAK,CAAC;AAEV;;;;"}
@@ -1,160 +0,0 @@
1
- 'use strict';
2
-
3
- var Button_resolver = require('../../button/Button.resolver.js');
4
- var SelectInput = require('../../inputs/SelectInput.js');
5
- var icons = require('@transferwise/icons');
6
- var art = require('@wise/art');
7
- var React = require('react');
8
- var reactIntl = require('react-intl');
9
- var ExpressiveMoneyInput_messages = require('../ExpressiveMoneyInput.messages.js');
10
- var jsxRuntime = require('react/jsx-runtime');
11
-
12
- const CurrencySelector = ({
13
- id,
14
- currency,
15
- options = [],
16
- labelId,
17
- onChange,
18
- addons,
19
- onOpen,
20
- onSearchChange
21
- }) => {
22
- const intl = reactIntl.useIntl();
23
- const allCurrencyOptions = React.useMemo(() => getUniqueCurrencies(options), [options]);
24
- const activeCurrencyOption = React.useMemo(() => {
25
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
26
- return allCurrencyOptions.find(option => option.code === currency);
27
- }, [currency, allCurrencyOptions]);
28
- const disabled = !onChange || options.length === 0 || options.length === 1 && options[0].currencies.length <= 1;
29
- const [searchQuery, setSearchQuery] = React.useState('');
30
- const handleTriggerClick = event => {
31
- const triggerEl = event.currentTarget;
32
- if (triggerEl?.getAttribute('aria-expanded') === 'false') {
33
- onOpen?.();
34
- }
35
- };
36
- const items = searchQuery ? filterAndSortCurrenciesForQuery(allCurrencyOptions, searchQuery).map(getCurrencySelectOption) : options.map(getCurrencyGroup);
37
- return /*#__PURE__*/jsxRuntime.jsx(SelectInput.SelectInput, {
38
- compareValues: "code",
39
- disabled: disabled,
40
- id: id,
41
- value: activeCurrencyOption,
42
- filterable: true,
43
- filterPlaceholder: intl.formatMessage(ExpressiveMoneyInput_messages.default.currencySelectorSearchPlaceholder),
44
- UNSAFE_triggerButtonProps: {
45
- id: undefined,
46
- 'aria-labelledby': undefined,
47
- 'aria-describedby': labelId,
48
- 'aria-invalid': undefined,
49
- 'aria-label': intl.formatMessage(ExpressiveMoneyInput_messages.default.currencySelectorSelectCurrency)
50
- },
51
- items: items,
52
- renderValue: ({
53
- code,
54
- label
55
- }) => {
56
- return /*#__PURE__*/jsxRuntime.jsx(SelectInput.SelectInputOptionContent, {
57
- title: code,
58
- note: label,
59
- icon: /*#__PURE__*/jsxRuntime.jsx(art.Flag, {
60
- code: code,
61
- intrinsicSize: 24
62
- })
63
- });
64
- },
65
- renderTrigger: () => /*#__PURE__*/jsxRuntime.jsx(SelectInput.SelectInputTriggerButton, {
66
- as: ButtonInput
67
- // @ts-expect-error new (v2) ButtonProps
68
- ,
69
- addonStart: {
70
- type: 'avatar',
71
- value: [addons ? addons[0] : null, {
72
- ...(addons && addons.length > 1 ? {
73
- ...addons[1]
74
- } : {
75
- asset: /*#__PURE__*/jsxRuntime.jsx(art.Flag, {
76
- code: currency
77
- })
78
- })
79
- }].filter(avatar => Boolean(avatar))
80
- },
81
- addonEnd: disabled ? undefined : {
82
- type: 'icon',
83
- value: /*#__PURE__*/jsxRuntime.jsx(icons.ChevronDown, {})
84
- },
85
- onClick: event => handleTriggerClick(event),
86
- children: currency
87
- }),
88
- onChange: newValue => {
89
- onChange?.(newValue.code);
90
- },
91
- onFilterChange: ({
92
- queryNormalized
93
- }) => {
94
- setSearchQuery(queryNormalized ?? '');
95
- if (queryNormalized) {
96
- onSearchChange?.({
97
- query: queryNormalized,
98
- resultCount: filterAndSortCurrenciesForQuery(allCurrencyOptions, queryNormalized).length
99
- });
100
- }
101
- }
102
- });
103
- };
104
- const ButtonInput = /*#__PURE__*/React.forwardRef(function ButtonInput({
105
- children,
106
- ...rest
107
- }, ref) {
108
- return /*#__PURE__*/jsxRuntime.jsx(Button_resolver.default, {
109
- ref: ref,
110
- size: "md",
111
- v2: true,
112
- className: "wds-currency-selector",
113
- priority: "secondary-neutral",
114
- ...rest,
115
- children: children
116
- });
117
- });
118
- const getCurrencySelectOption = currency => {
119
- return {
120
- type: 'option',
121
- value: currency,
122
- filterMatchers: currency.keywords
123
- };
124
- };
125
- const getCurrencyGroup = section => {
126
- return {
127
- type: 'group',
128
- label: section.title,
129
- options: section.currencies.map(getCurrencySelectOption)
130
- };
131
- };
132
- const getUniqueCurrencies = options => {
133
- const allCurrencyOptions = options.flatMap(section => section.currencies);
134
- const uniqueCurrencies = new Map();
135
- allCurrencyOptions.forEach(currencyObj => {
136
- uniqueCurrencies.set(currencyObj.code, currencyObj);
137
- });
138
- return Array.from(uniqueCurrencies.values());
139
- };
140
- const filterAndSortCurrenciesForQuery = (currencies, query) => {
141
- return currencies.filter(currency => {
142
- return currency.code.toLowerCase().includes(query) || (currency.label ?? '').toLowerCase().includes(query) || currency.keywords?.some(keyword => keyword.toLowerCase().includes(query));
143
- })
144
- // prefer exact matches, then sort alphabetically by code
145
- .sort((a, b) => {
146
- const aCode = a.code.toLowerCase();
147
- const bCode = b.code.toLowerCase();
148
- if (aCode === query) {
149
- return -1;
150
- }
151
- if (bCode === query) {
152
- return 1;
153
- }
154
- return aCode.localeCompare(bCode);
155
- });
156
- };
157
-
158
- exports.ButtonInput = ButtonInput;
159
- exports.CurrencySelector = CurrencySelector;
160
- //# sourceMappingURL=CurrencySelector.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"CurrencySelector.js","sources":["../../../src/expressiveMoneyInput/currencySelector/CurrencySelector.tsx"],"sourcesContent":["import type { AvatarLayoutProps } from '../../avatarLayout';\nimport Button from '../../button';\nimport {\n SelectInput,\n SelectInputOptionContent,\n SelectInputTriggerButton,\n} from '../../inputs/SelectInput';\nimport { CurrencyType, Props as ExpressiveMoneyInputProps } from '../ExpressiveMoneyInput';\nimport { ChevronDown } from '@transferwise/icons';\nimport { Flag } from '@wise/art';\nimport {\n type ButtonHTMLAttributes,\n forwardRef,\n type MouseEventHandler,\n useMemo,\n useState,\n} from 'react';\nimport { useIntl } from 'react-intl';\n\nimport messages from '../ExpressiveMoneyInput.messages';\n\nexport interface CurrencyOption {\n label?: string;\n code: string;\n keywords: string[] | undefined;\n}\n\nexport interface CurrencySection {\n title: string;\n currencies: CurrencyOption[];\n}\n\nexport type CurrencyOptions = CurrencySection[];\n\nexport type Props = {\n id: string;\n labelId: string;\n options?: CurrencyOptions;\n onChange?: (currency: CurrencyType) => void;\n onOpen?: () => void;\n addons?: AvatarLayoutProps['avatars'];\n onSearchChange?: (payload: { query: string; resultCount: number }) => void;\n} & Pick<ExpressiveMoneyInputProps, 'currency'>;\n\nexport const CurrencySelector = ({\n id,\n currency,\n options = [],\n labelId,\n onChange,\n addons,\n onOpen,\n onSearchChange,\n}: Props) => {\n const intl = useIntl();\n\n const allCurrencyOptions = useMemo(() => getUniqueCurrencies(options), [options]);\n\n const activeCurrencyOption = useMemo(() => {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n return allCurrencyOptions.find((option) => option.code === currency)!;\n }, [currency, allCurrencyOptions]);\n\n const disabled =\n !onChange ||\n options.length === 0 ||\n (options.length === 1 && options[0].currencies.length <= 1);\n\n const [searchQuery, setSearchQuery] = useState<string>('');\n\n const handleTriggerClick: MouseEventHandler = (event) => {\n const triggerEl = event.currentTarget;\n if (triggerEl?.getAttribute('aria-expanded') === 'false') {\n onOpen?.();\n }\n };\n\n const items = searchQuery\n ? filterAndSortCurrenciesForQuery(allCurrencyOptions, searchQuery).map(getCurrencySelectOption)\n : options.map(getCurrencyGroup);\n\n return (\n <SelectInput\n compareValues=\"code\"\n disabled={disabled}\n id={id}\n value={activeCurrencyOption}\n filterable\n filterPlaceholder={intl.formatMessage(messages.currencySelectorSearchPlaceholder)}\n UNSAFE_triggerButtonProps={{\n id: undefined,\n 'aria-labelledby': undefined,\n 'aria-describedby': labelId,\n 'aria-invalid': undefined,\n 'aria-label': intl.formatMessage(messages.currencySelectorSelectCurrency),\n }}\n items={items}\n renderValue={({ code, label }) => {\n return (\n <SelectInputOptionContent\n title={code}\n note={label}\n icon={<Flag code={code} intrinsicSize={24} />}\n />\n );\n }}\n renderTrigger={() => (\n <SelectInputTriggerButton\n as={ButtonInput}\n // @ts-expect-error new (v2) ButtonProps\n addonStart={{\n type: 'avatar',\n value: [\n addons ? addons[0] : null,\n {\n ...(addons && addons.length > 1\n ? { ...addons[1] }\n : {\n asset: <Flag code={currency} />,\n }),\n },\n ].filter((avatar) => Boolean(avatar)),\n }}\n addonEnd={disabled ? undefined : { type: 'icon', value: <ChevronDown /> }}\n onClick={(event) => handleTriggerClick(event)}\n >\n {currency}\n </SelectInputTriggerButton>\n )}\n onChange={(newValue) => {\n onChange?.(newValue.code);\n }}\n onFilterChange={({ queryNormalized }) => {\n setSearchQuery(queryNormalized ?? '');\n if (queryNormalized) {\n onSearchChange?.({\n query: queryNormalized,\n resultCount: filterAndSortCurrenciesForQuery(allCurrencyOptions, queryNormalized)\n .length,\n });\n }\n }}\n />\n );\n};\n\nexport const ButtonInput = forwardRef(function ButtonInput(\n { children, ...rest }: React.PropsWithChildren<ButtonHTMLAttributes<HTMLButtonElement>>,\n ref: React.ForwardedRef<HTMLButtonElement | null>,\n) {\n return (\n <Button\n ref={ref}\n size=\"md\"\n v2\n className=\"wds-currency-selector\"\n priority=\"secondary-neutral\"\n {...rest}\n >\n {children}\n </Button>\n );\n});\n\nconst getCurrencySelectOption = (currency: CurrencyOption) => {\n return {\n type: 'option' as const,\n value: currency,\n filterMatchers: currency.keywords,\n };\n};\n\nconst getCurrencyGroup = (section: CurrencySection) => {\n return {\n type: 'group' as const,\n label: section.title,\n options: section.currencies.map(getCurrencySelectOption),\n };\n};\n\nconst getUniqueCurrencies = (options: CurrencyOptions) => {\n const allCurrencyOptions = options.flatMap((section) => section.currencies);\n const uniqueCurrencies = new Map<string, CurrencyOption>();\n\n allCurrencyOptions.forEach((currencyObj) => {\n uniqueCurrencies.set(currencyObj.code, currencyObj);\n });\n\n return Array.from(uniqueCurrencies.values());\n};\n\nconst filterAndSortCurrenciesForQuery = (\n currencies: CurrencyOption[],\n query: string,\n): CurrencyOption[] => {\n return (\n currencies\n .filter((currency) => {\n return (\n currency.code.toLowerCase().includes(query) ||\n (currency.label ?? '').toLowerCase().includes(query) ||\n currency.keywords?.some((keyword) => keyword.toLowerCase().includes(query))\n );\n })\n // prefer exact matches, then sort alphabetically by code\n .sort((a, b) => {\n const aCode = a.code.toLowerCase();\n const bCode = b.code.toLowerCase();\n if (aCode === query) {\n return -1;\n }\n if (bCode === query) {\n return 1;\n }\n return aCode.localeCompare(bCode);\n })\n );\n};\n"],"names":["CurrencySelector","id","currency","options","labelId","onChange","addons","onOpen","onSearchChange","intl","useIntl","allCurrencyOptions","useMemo","getUniqueCurrencies","activeCurrencyOption","find","option","code","disabled","length","currencies","searchQuery","setSearchQuery","useState","handleTriggerClick","event","triggerEl","currentTarget","getAttribute","items","filterAndSortCurrenciesForQuery","map","getCurrencySelectOption","getCurrencyGroup","_jsx","SelectInput","compareValues","value","filterable","filterPlaceholder","formatMessage","messages","currencySelectorSearchPlaceholder","UNSAFE_triggerButtonProps","undefined","currencySelectorSelectCurrency","renderValue","label","SelectInputOptionContent","title","note","icon","Flag","intrinsicSize","renderTrigger","SelectInputTriggerButton","as","ButtonInput","addonStart","type","asset","filter","avatar","Boolean","addonEnd","ChevronDown","onClick","children","newValue","onFilterChange","queryNormalized","query","resultCount","forwardRef","rest","ref","Button","size","v2","className","priority","filterMatchers","keywords","section","flatMap","uniqueCurrencies","Map","forEach","currencyObj","set","Array","from","values","toLowerCase","includes","some","keyword","sort","a","b","aCode","bCode","localeCompare"],"mappings":";;;;;;;;;;;AA4CO,MAAMA,gBAAgB,GAAGA,CAAC;EAC/BC,EAAE;EACFC,QAAQ;AACRC,EAAAA,OAAO,GAAG,EAAE;EACZC,OAAO;EACPC,QAAQ;EACRC,MAAM;EACNC,MAAM;AACNC,EAAAA;AAAc,CACR,KAAI;AACV,EAAA,MAAMC,IAAI,GAAGC,iBAAO,EAAE;AAEtB,EAAA,MAAMC,kBAAkB,GAAGC,aAAO,CAAC,MAAMC,mBAAmB,CAACV,OAAO,CAAC,EAAE,CAACA,OAAO,CAAC,CAAC;AAEjF,EAAA,MAAMW,oBAAoB,GAAGF,aAAO,CAAC,MAAK;AACxC;I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