@transferwise/components 0.0.0-experimental-b3df26d → 0.0.0-experimental-050f154

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 (121) hide show
  1. package/build/expressiveMoneyInput/AmountInput.js +281 -0
  2. package/build/expressiveMoneyInput/AmountInput.js.map +1 -0
  3. package/build/expressiveMoneyInput/AmountInput.mjs +279 -0
  4. package/build/expressiveMoneyInput/AmountInput.mjs.map +1 -0
  5. package/build/expressiveMoneyInput/AnimatedNumber.js +50 -0
  6. package/build/expressiveMoneyInput/AnimatedNumber.js.map +1 -0
  7. package/build/expressiveMoneyInput/AnimatedNumber.mjs +48 -0
  8. package/build/expressiveMoneyInput/AnimatedNumber.mjs.map +1 -0
  9. package/build/expressiveMoneyInput/Chevron.js +33 -0
  10. package/build/expressiveMoneyInput/Chevron.js.map +1 -0
  11. package/build/expressiveMoneyInput/Chevron.mjs +31 -0
  12. package/build/expressiveMoneyInput/Chevron.mjs.map +1 -0
  13. package/build/expressiveMoneyInput/CurrencySelector.js +160 -0
  14. package/build/expressiveMoneyInput/CurrencySelector.js.map +1 -0
  15. package/build/expressiveMoneyInput/CurrencySelector.mjs +157 -0
  16. package/build/expressiveMoneyInput/CurrencySelector.mjs.map +1 -0
  17. package/build/expressiveMoneyInput/ExpressiveMoneyInput.js +114 -0
  18. package/build/expressiveMoneyInput/ExpressiveMoneyInput.js.map +1 -0
  19. package/build/expressiveMoneyInput/ExpressiveMoneyInput.messages.js +17 -0
  20. package/build/expressiveMoneyInput/ExpressiveMoneyInput.messages.js.map +1 -0
  21. package/build/expressiveMoneyInput/ExpressiveMoneyInput.messages.mjs +13 -0
  22. package/build/expressiveMoneyInput/ExpressiveMoneyInput.messages.mjs.map +1 -0
  23. package/build/expressiveMoneyInput/ExpressiveMoneyInput.mjs +110 -0
  24. package/build/expressiveMoneyInput/ExpressiveMoneyInput.mjs.map +1 -0
  25. package/build/expressiveMoneyInput/useFocus.js +37 -0
  26. package/build/expressiveMoneyInput/useFocus.js.map +1 -0
  27. package/build/expressiveMoneyInput/useFocus.mjs +35 -0
  28. package/build/expressiveMoneyInput/useFocus.mjs.map +1 -0
  29. package/build/expressiveMoneyInput/useInputStyle.js +71 -0
  30. package/build/expressiveMoneyInput/useInputStyle.js.map +1 -0
  31. package/build/expressiveMoneyInput/useInputStyle.mjs +69 -0
  32. package/build/expressiveMoneyInput/useInputStyle.mjs.map +1 -0
  33. package/build/expressiveMoneyInput/utils.js +87 -0
  34. package/build/expressiveMoneyInput/utils.js.map +1 -0
  35. package/build/expressiveMoneyInput/utils.mjs +78 -0
  36. package/build/expressiveMoneyInput/utils.mjs.map +1 -0
  37. package/build/i18n/en.json +2 -0
  38. package/build/i18n/en.json.js +2 -0
  39. package/build/i18n/en.json.js.map +1 -1
  40. package/build/i18n/en.json.mjs +2 -0
  41. package/build/i18n/en.json.mjs.map +1 -1
  42. package/build/index.js +2 -0
  43. package/build/index.js.map +1 -1
  44. package/build/index.mjs +1 -0
  45. package/build/index.mjs.map +1 -1
  46. package/build/main.css +65 -7
  47. package/build/prompt/InlinePrompt/InlinePrompt.js +7 -0
  48. package/build/prompt/InlinePrompt/InlinePrompt.js.map +1 -1
  49. package/build/prompt/InlinePrompt/InlinePrompt.mjs +8 -1
  50. package/build/prompt/InlinePrompt/InlinePrompt.mjs.map +1 -1
  51. package/build/styles/expressiveMoneyInput/AmountInput.css +32 -0
  52. package/build/styles/expressiveMoneyInput/Chevron.css +12 -0
  53. package/build/styles/expressiveMoneyInput/CurrencySelector.css +6 -0
  54. package/build/styles/expressiveMoneyInput/ExpressiveMoneyInput.css +58 -0
  55. package/build/styles/main.css +65 -7
  56. package/build/styles/prompt/InlinePrompt/InlinePrompt.css +7 -7
  57. package/build/types/expressiveMoneyInput/AmountInput.d.ts +13 -0
  58. package/build/types/expressiveMoneyInput/AmountInput.d.ts.map +1 -0
  59. package/build/types/expressiveMoneyInput/AnimatedNumber.d.ts +9 -0
  60. package/build/types/expressiveMoneyInput/AnimatedNumber.d.ts.map +1 -0
  61. package/build/types/expressiveMoneyInput/Chevron.d.ts +6 -0
  62. package/build/types/expressiveMoneyInput/Chevron.d.ts.map +1 -0
  63. package/build/types/expressiveMoneyInput/CurrencySelector.d.ts +30 -0
  64. package/build/types/expressiveMoneyInput/CurrencySelector.d.ts.map +1 -0
  65. package/build/types/expressiveMoneyInput/ExpressiveMoneyInput.d.ts +33 -0
  66. package/build/types/expressiveMoneyInput/ExpressiveMoneyInput.d.ts.map +1 -0
  67. package/build/types/expressiveMoneyInput/ExpressiveMoneyInput.messages.d.ts +12 -0
  68. package/build/types/expressiveMoneyInput/ExpressiveMoneyInput.messages.d.ts.map +1 -0
  69. package/build/types/expressiveMoneyInput/index.d.ts +3 -0
  70. package/build/types/expressiveMoneyInput/index.d.ts.map +1 -0
  71. package/build/types/expressiveMoneyInput/useFocus.d.ts +7 -0
  72. package/build/types/expressiveMoneyInput/useFocus.d.ts.map +1 -0
  73. package/build/types/expressiveMoneyInput/useInputStyle.d.ts +10 -0
  74. package/build/types/expressiveMoneyInput/useInputStyle.d.ts.map +1 -0
  75. package/build/types/expressiveMoneyInput/useSelectionRange.d.ts +10 -0
  76. package/build/types/expressiveMoneyInput/useSelectionRange.d.ts.map +1 -0
  77. package/build/types/expressiveMoneyInput/utils.d.ts +22 -0
  78. package/build/types/expressiveMoneyInput/utils.d.ts.map +1 -0
  79. package/build/types/index.d.ts +2 -0
  80. package/build/types/index.d.ts.map +1 -1
  81. package/build/types/prompt/InlinePrompt/InlinePrompt.d.ts +3 -2
  82. package/build/types/prompt/InlinePrompt/InlinePrompt.d.ts.map +1 -1
  83. package/build/types/test-utils/index.d.ts +4 -0
  84. package/build/types/test-utils/index.d.ts.map +1 -1
  85. package/build/types/withDisplayFormat/WithDisplayFormat.d.ts.map +1 -1
  86. package/build/withDisplayFormat/WithDisplayFormat.js +1 -0
  87. package/build/withDisplayFormat/WithDisplayFormat.js.map +1 -1
  88. package/build/withDisplayFormat/WithDisplayFormat.mjs +1 -0
  89. package/build/withDisplayFormat/WithDisplayFormat.mjs.map +1 -1
  90. package/package.json +1 -1
  91. package/src/expressiveMoneyInput/AmountInput.css +32 -0
  92. package/src/expressiveMoneyInput/AmountInput.less +43 -0
  93. package/src/expressiveMoneyInput/AmountInput.tsx +353 -0
  94. package/src/expressiveMoneyInput/AnimatedNumber.tsx +40 -0
  95. package/src/expressiveMoneyInput/Chevron.css +12 -0
  96. package/src/expressiveMoneyInput/Chevron.less +13 -0
  97. package/src/expressiveMoneyInput/Chevron.tsx +35 -0
  98. package/src/expressiveMoneyInput/CurrencySelector.css +6 -0
  99. package/src/expressiveMoneyInput/CurrencySelector.less +7 -0
  100. package/src/expressiveMoneyInput/CurrencySelector.tsx +218 -0
  101. package/src/expressiveMoneyInput/ExpressiveMoneyInput.css +58 -0
  102. package/src/expressiveMoneyInput/ExpressiveMoneyInput.less +13 -0
  103. package/src/expressiveMoneyInput/ExpressiveMoneyInput.messages.ts +13 -0
  104. package/src/expressiveMoneyInput/ExpressiveMoneyInput.story.tsx +290 -0
  105. package/src/expressiveMoneyInput/ExpressiveMoneyInput.tsx +118 -0
  106. package/src/expressiveMoneyInput/index.ts +2 -0
  107. package/src/expressiveMoneyInput/useFocus.ts +35 -0
  108. package/src/expressiveMoneyInput/useInputStyle.ts +85 -0
  109. package/src/expressiveMoneyInput/useSelectionRange.ts +23 -0
  110. package/src/expressiveMoneyInput/utils.spec.ts +114 -0
  111. package/src/expressiveMoneyInput/utils.ts +116 -0
  112. package/src/i18n/en.json +2 -0
  113. package/src/index.ts +2 -0
  114. package/src/main.css +65 -7
  115. package/src/main.less +1 -0
  116. package/src/prompt/InlinePrompt/InlinePrompt.css +7 -7
  117. package/src/prompt/InlinePrompt/InlinePrompt.less +7 -7
  118. package/src/prompt/InlinePrompt/InlinePrompt.story.tsx +49 -0
  119. package/src/prompt/InlinePrompt/InlinePrompt.tsx +12 -2
  120. package/src/ssr.spec.tsx +1 -0
  121. package/src/withDisplayFormat/WithDisplayFormat.tsx +1 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sources":["../../src/expressiveMoneyInput/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"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AAW,CAAA,CAAA,EAAIG,oBAAoB,CAAA,CAAE,CAAC;AAE7F,EAAA,OAAO5B,uBAAY,CAAC8B,yBAAyB,EAAEhC,QAAQ,EAAEC,MAAM,EAAE;AAC/DsB,IAAAA;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;;;;;;;;;;;"}
@@ -0,0 +1,78 @@
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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.mjs","sources":["../../src/expressiveMoneyInput/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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AIC,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;;;;"}
@@ -16,6 +16,8 @@
16
16
  "neptune.DateLookup.selected": "selected",
17
17
  "neptune.DateLookup.twentyYears": "20 years",
18
18
  "neptune.DateLookup.year": "year",
19
+ "neptune.ExpressiveMoneyInput.currency.search.placeholder": "Type a currency / country",
20
+ "neptune.ExpressiveMoneyInput.currency.select.currency": "Select currency",
19
21
  "neptune.FlowNavigation.back": "back to previous step",
20
22
  "neptune.Info.ariaLabel": "More information",
21
23
  "neptune.Label.optional": "(Optional)",
@@ -20,6 +20,8 @@ var en = {
20
20
  "neptune.DateLookup.selected": "selected",
21
21
  "neptune.DateLookup.twentyYears": "20 years",
22
22
  "neptune.DateLookup.year": "year",
23
+ "neptune.ExpressiveMoneyInput.currency.search.placeholder": "Type a currency / country",
24
+ "neptune.ExpressiveMoneyInput.currency.select.currency": "Select currency",
23
25
  "neptune.FlowNavigation.back": "back to previous step",
24
26
  "neptune.Info.ariaLabel": "More information",
25
27
  "neptune.Label.optional": "(Optional)",
@@ -1 +1 @@
1
- {"version":3,"file":"en.json.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"en.json.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -16,6 +16,8 @@ var en = {
16
16
  "neptune.DateLookup.selected": "selected",
17
17
  "neptune.DateLookup.twentyYears": "20 years",
18
18
  "neptune.DateLookup.year": "year",
19
+ "neptune.ExpressiveMoneyInput.currency.search.placeholder": "Type a currency / country",
20
+ "neptune.ExpressiveMoneyInput.currency.select.currency": "Select currency",
19
21
  "neptune.FlowNavigation.back": "back to previous step",
20
22
  "neptune.Info.ariaLabel": "More information",
21
23
  "neptune.Label.optional": "(Optional)",
@@ -1 +1 @@
1
- {"version":3,"file":"en.json.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"en.json.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
package/build/index.js CHANGED
@@ -67,6 +67,7 @@ var Markdown = require('./markdown/Markdown.js');
67
67
  var Modal = require('./modal/Modal.js');
68
68
  var Money = require('./money/Money.js');
69
69
  var MoneyInput = require('./moneyInput/MoneyInput.js');
70
+ var ExpressiveMoneyInput = require('./expressiveMoneyInput/ExpressiveMoneyInput.js');
70
71
  var NavigationOption = require('./navigationOption/NavigationOption.js');
71
72
  var NavigationOptionsList = require('./navigationOptionsList/NavigationOptionsList.js');
72
73
  var Nudge = require('./nudge/Nudge.js');
@@ -229,6 +230,7 @@ exports.Markdown = Markdown.default;
229
230
  exports.Modal = Modal.default;
230
231
  exports.Money = Money.default;
231
232
  exports.MoneyInput = MoneyInput.default;
233
+ exports.ExpressiveMoneyInput = ExpressiveMoneyInput.default;
232
234
  exports.NavigationOption = NavigationOption.default;
233
235
  exports.NavigationOptionsList = NavigationOptionsList.default;
234
236
  exports.Nudge = Nudge.default;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
package/build/index.mjs CHANGED
@@ -65,6 +65,7 @@ export { default as Markdown } from './markdown/Markdown.mjs';
65
65
  export { default as Modal } from './modal/Modal.mjs';
66
66
  export { default as Money } from './money/Money.mjs';
67
67
  export { default as MoneyInput } from './moneyInput/MoneyInput.mjs';
68
+ export { default as ExpressiveMoneyInput } from './expressiveMoneyInput/ExpressiveMoneyInput.mjs';
68
69
  export { default as NavigationOption } from './navigationOption/NavigationOption.mjs';
69
70
  export { default as NavigationOptionsList } from './navigationOptionsList/NavigationOptionsList.mjs';
70
71
  export { default as Nudge } from './nudge/Nudge.mjs';
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
package/build/main.css CHANGED
@@ -526,26 +526,26 @@
526
526
  background-color: var(--color-sentiment-positive-secondary-active);
527
527
  }
528
528
  .wds-inline-prompt--proposition {
529
- background-color: var(--color-sentiment-positive-secondary);
530
- color: var(--color-sentiment-positive-primary);
529
+ background-color: #D2F9F7;
530
+ color: var(--color-interactive-primary);
531
531
  }
532
532
  .wds-inline-prompt--proposition a,
533
533
  .wds-inline-prompt--proposition button {
534
- color: var(--color-sentiment-positive-primary);
534
+ color: var(--color-interactive-primary);
535
535
  }
536
536
  .wds-inline-prompt--proposition a:hover,
537
537
  .wds-inline-prompt--proposition button:hover {
538
- color: var(--color-sentiment-positive-primary-hover);
538
+ color: var(--color-interactive-primary-hover);
539
539
  }
540
540
  .wds-inline-prompt--proposition a:active,
541
541
  .wds-inline-prompt--proposition button:active {
542
- color: var(--color-sentiment-positive-primary-active);
542
+ color: var(--color-interactive-primary-active);
543
543
  }
544
544
  .wds-inline-prompt.wds-inline-prompt--proposition:has(a, button):hover {
545
- background-color: var(--color-sentiment-positive-secondary-hover);
545
+ background-color: #B2F4F3;
546
546
  }
547
547
  .wds-inline-prompt.wds-inline-prompt--proposition:has(a, button):active {
548
- background-color: var(--color-sentiment-positive-secondary-active);
548
+ background-color: #91F0EE;
549
549
  }
550
550
  .wds-inline-prompt--neutral {
551
551
  background-color: rgba(134,167,189,0.10196);
@@ -4447,6 +4447,64 @@ button.np-link {
4447
4447
  box-shadow: inset 0 0 0 1px #c9cbce !important;
4448
4448
  box-shadow: inset 0 0 0 1px var(--color-interactive-secondary) !important;
4449
4449
  }
4450
+ .wds-amount-input-container {
4451
+ width: 100%;
4452
+ }
4453
+ .wds-amount-input-input-container {
4454
+ display: flex;
4455
+ justify-content: right;
4456
+ width: 100%;
4457
+ transition: font-size 0.4s cubic-bezier(0.3, 0, 0.1, 1), height 0.4s cubic-bezier(0.3, 0, 0.1, 1), margin-top 0.4s cubic-bezier(0.3, 0, 0.1, 1), color 0.4s ease;
4458
+ color: var(--color-interactive-primary);
4459
+ overflow: hidden;
4460
+ margin-bottom: 0 !important;
4461
+ }
4462
+ @media (prefers-reduced-motion: reduce) {
4463
+ .wds-amount-input-input-container {
4464
+ transition: none;
4465
+ }
4466
+ }
4467
+ .wds-amount-input-input {
4468
+ border: none;
4469
+ outline: none;
4470
+ flex-grow: 1;
4471
+ text-align: right;
4472
+ background-color: transparent;
4473
+ }
4474
+ .wds-amount-input-input:focus-visible {
4475
+ outline: none;
4476
+ }
4477
+ .wds-amount-input-placeholder {
4478
+ flex-grow: 0;
4479
+ display: flex;
4480
+ align-items: center;
4481
+ }
4482
+ .wds-currency-selector:disabled {
4483
+ opacity: 1 !important;
4484
+ cursor: auto !important;
4485
+ cursor: initial !important;
4486
+ mix-blend-mode: initial !important;
4487
+ }
4488
+ .wds-chevron-container {
4489
+ width: 32px;
4490
+ width: var(--size-32);
4491
+ overflow: hidden;
4492
+ color: var(--color-interactive-primary);
4493
+ margin-left: 8px;
4494
+ margin-left: var(--size-8);
4495
+ transition: width 0.3s ease;
4496
+ }
4497
+ .wds-chevron-hidden {
4498
+ width: 0;
4499
+ }
4500
+ .wds-expressive-money-input-currency-selector {
4501
+ flex-shrink: 0;
4502
+ margin-right: 24px;
4503
+ margin-right: var(--size-24);
4504
+ }
4505
+ .wds-expressive-money-input-chevron {
4506
+ transform: translateY(-5%);
4507
+ }
4450
4508
  .np-navigation-option {
4451
4509
  -webkit-text-decoration: none;
4452
4510
  text-decoration: none;
@@ -35,9 +35,16 @@ const InlinePrompt = ({
35
35
  loading = false,
36
36
  className,
37
37
  children,
38
+ media = null,
38
39
  ...rest
39
40
  }) => {
40
41
  const renderMedia = () => {
42
+ if (media && ['proposition', 'positive'].includes(sentiment$1)) {
43
+ return media;
44
+ }
45
+ if (sentiment$1 === 'proposition') {
46
+ return /*#__PURE__*/jsxRuntime.jsx(icons.GiftBox, {});
47
+ }
41
48
  if (muted) {
42
49
  return /*#__PURE__*/jsxRuntime.jsx(icons.BackslashCircle, {
43
50
  size: 16,
@@ -1 +1 @@
1
- {"version":3,"file":"InlinePrompt.js","sources":["../../../src/prompt/InlinePrompt/InlinePrompt.tsx"],"sourcesContent":["import { Sentiment } from '../../common';\nimport { BackslashCircle } from '@transferwise/icons';\nimport ProcessIndicator from '../../processIndicator';\nimport StatusIcon from '../../statusIcon';\nimport { clsx } from 'clsx';\nimport Body from '../../body';\n\nexport type InlinePromptProps = {\n sentiment?: `${Sentiment.POSITIVE | Sentiment.NEGATIVE | Sentiment.NEUTRAL | Sentiment.WARNING}`;\n loading?: boolean;\n /**\n * Use for short-lived inline prompts to avoid swap of the icon (which is bad UX for short-lived prompts, e.g. when submit form)\n */\n muted?: boolean;\n id?: string;\n className?: string;\n 'data-testid'?: string;\n children: React.ReactNode;\n};\n\nexport const InlinePrompt = ({\n sentiment = Sentiment.POSITIVE,\n muted = false,\n loading = false,\n className,\n children,\n ...rest\n}: InlinePromptProps) => {\n const renderMedia = () => {\n if (muted) {\n return <BackslashCircle size={16} data-testid=\"InlinePrompt_Muted\" />;\n }\n if (loading) {\n return <ProcessIndicator data-testid=\"InlinePrompt_ProcessIndicator\" size=\"xxs\" />;\n }\n return <StatusIcon size={16} sentiment={sentiment} />;\n };\n\n return (\n <div\n className={clsx(\n 'wds-inline-prompt',\n `wds-inline-prompt--${sentiment}`,\n {\n 'wds-inline-prompt--muted': muted,\n 'wds-inline-prompt--loading': loading,\n },\n className,\n )}\n {...rest}\n >\n <div className=\"wds-inline-prompt__media-wrapper\">{renderMedia()}</div>\n <Body>{children}</Body>\n </div>\n );\n};\n"],"names":["InlinePrompt","sentiment","Sentiment","POSITIVE","muted","loading","className","children","rest","renderMedia","_jsx","BackslashCircle","size","ProcessIndicator","StatusIcon","_jsxs","clsx","Body"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoBO,MAAMA,YAAY,GAAGA,CAAC;aAC3BC,WAAS,GAAGC,mBAAS,CAACC,QAAQ;AAC9BC,EAAAA,KAAK,GAAG,KAAK;AACbC,EAAAA,OAAO,GAAG,KAAK;EACfC,SAAS;EACTC,QAAQ;EACR,GAAGC;AAAI,CACW,KAAI;EACtB,MAAMC,WAAW,GAAGA,MAAK;AACvB,IAAA,IAAIL,KAAK,EAAE;MACT,oBAAOM,cAAA,CAACC,qBAAe,EAAA;AAACC,QAAAA,IAAI,EAAE,EAAG;QAAC,aAAA,EAAY;AAAoB,QAAG;AACvE,IAAA;AACA,IAAA,IAAIP,OAAO,EAAE;MACX,oBAAOK,cAAA,CAACG,wBAAgB,EAAA;AAAC,QAAA,aAAA,EAAY,+BAA+B;AAACD,QAAAA,IAAI,EAAC;AAAK,OAAA,CAAG;AACpF,IAAA;IACA,oBAAOF,cAAA,CAACI,kBAAU,EAAA;AAACF,MAAAA,IAAI,EAAE,EAAG;AAACX,MAAAA,SAAS,EAAEA;AAAU,MAAG;EACvD,CAAC;AAED,EAAA,oBACEc,eAAA,CAAA,KAAA,EAAA;IACET,SAAS,EAAEU,SAAI,CACb,mBAAmB,EACnB,CAAA,mBAAA,EAAsBf,WAAS,EAAE,EACjC;AACE,MAAA,0BAA0B,EAAEG,KAAK;AACjC,MAAA,4BAA4B,EAAEC;KAC/B,EACDC,SAAS,CACT;AAAA,IAAA,GACEE,IAAI;AAAAD,IAAAA,QAAA,gBAERG,cAAA,CAAA,KAAA,EAAA;AAAKJ,MAAAA,SAAS,EAAC,kCAAkC;MAAAC,QAAA,EAAEE,WAAW;AAAE,KAAM,CACtE,eAAAC,cAAA,CAACO,YAAI,EAAA;AAAAV,MAAAA,QAAA,EAAEA;AAAQ,KAAO,CACxB;AAAA,GAAK,CAAC;AAEV;;;;"}
1
+ {"version":3,"file":"InlinePrompt.js","sources":["../../../src/prompt/InlinePrompt/InlinePrompt.tsx"],"sourcesContent":["import { Sentiment } from '../../common';\nimport { BackslashCircle, GiftBox } from '@transferwise/icons';\nimport ProcessIndicator from '../../processIndicator';\nimport StatusIcon from '../../statusIcon';\nimport { clsx } from 'clsx';\nimport Body from '../../body';\n\nexport type InlinePromptProps = {\n sentiment?:\n | `${Sentiment.POSITIVE | Sentiment.NEGATIVE | Sentiment.NEUTRAL | Sentiment.WARNING}`\n | 'proposition';\n loading?: boolean;\n /**\n * Use for short-lived inline prompts to avoid swap of the icon (which is bad UX for short-lived prompts, e.g. when submit form)\n */\n muted?: boolean;\n id?: string;\n className?: string;\n 'data-testid'?: string;\n children: React.ReactNode;\n media?: React.ReactNode;\n};\n\nexport const InlinePrompt = ({\n sentiment = Sentiment.POSITIVE,\n muted = false,\n loading = false,\n className,\n children,\n media = null,\n ...rest\n}: InlinePromptProps) => {\n const renderMedia = () => {\n if (media && ['proposition', 'positive'].includes(sentiment)) {\n return media;\n }\n if (sentiment === 'proposition') {\n return <GiftBox />;\n }\n if (muted) {\n return <BackslashCircle size={16} data-testid=\"InlinePrompt_Muted\" />;\n }\n if (loading) {\n return <ProcessIndicator data-testid=\"InlinePrompt_ProcessIndicator\" size=\"xxs\" />;\n }\n return <StatusIcon size={16} sentiment={sentiment} />;\n };\n\n return (\n <div\n className={clsx(\n 'wds-inline-prompt',\n `wds-inline-prompt--${sentiment}`,\n {\n 'wds-inline-prompt--muted': muted,\n 'wds-inline-prompt--loading': loading,\n },\n className,\n )}\n {...rest}\n >\n <div className=\"wds-inline-prompt__media-wrapper\">{renderMedia()}</div>\n <Body>{children}</Body>\n </div>\n );\n};\n"],"names":["InlinePrompt","sentiment","Sentiment","POSITIVE","muted","loading","className","children","media","rest","renderMedia","includes","_jsx","GiftBox","BackslashCircle","size","ProcessIndicator","StatusIcon","_jsxs","clsx","Body"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuBO,MAAMA,YAAY,GAAGA,CAAC;aAC3BC,WAAS,GAAGC,mBAAS,CAACC,QAAQ;AAC9BC,EAAAA,KAAK,GAAG,KAAK;AACbC,EAAAA,OAAO,GAAG,KAAK;EACfC,SAAS;EACTC,QAAQ;AACRC,EAAAA,KAAK,GAAG,IAAI;EACZ,GAAGC;AAAI,CACW,KAAI;EACtB,MAAMC,WAAW,GAAGA,MAAK;AACvB,IAAA,IAAIF,KAAK,IAAI,CAAC,aAAa,EAAE,UAAU,CAAC,CAACG,QAAQ,CAACV,WAAS,CAAC,EAAE;AAC5D,MAAA,OAAOO,KAAK;AACd,IAAA;IACA,IAAIP,WAAS,KAAK,aAAa,EAAE;AAC/B,MAAA,oBAAOW,cAAA,CAACC,aAAO,EAAA,GAAG;AACpB,IAAA;AACA,IAAA,IAAIT,KAAK,EAAE;MACT,oBAAOQ,cAAA,CAACE,qBAAe,EAAA;AAACC,QAAAA,IAAI,EAAE,EAAG;QAAC,aAAA,EAAY;AAAoB,QAAG;AACvE,IAAA;AACA,IAAA,IAAIV,OAAO,EAAE;MACX,oBAAOO,cAAA,CAACI,wBAAgB,EAAA;AAAC,QAAA,aAAA,EAAY,+BAA+B;AAACD,QAAAA,IAAI,EAAC;AAAK,OAAA,CAAG;AACpF,IAAA;IACA,oBAAOH,cAAA,CAACK,kBAAU,EAAA;AAACF,MAAAA,IAAI,EAAE,EAAG;AAACd,MAAAA,SAAS,EAAEA;AAAU,MAAG;EACvD,CAAC;AAED,EAAA,oBACEiB,eAAA,CAAA,KAAA,EAAA;IACEZ,SAAS,EAAEa,SAAI,CACb,mBAAmB,EACnB,CAAA,mBAAA,EAAsBlB,WAAS,EAAE,EACjC;AACE,MAAA,0BAA0B,EAAEG,KAAK;AACjC,MAAA,4BAA4B,EAAEC;KAC/B,EACDC,SAAS,CACT;AAAA,IAAA,GACEG,IAAI;AAAAF,IAAAA,QAAA,gBAERK,cAAA,CAAA,KAAA,EAAA;AAAKN,MAAAA,SAAS,EAAC,kCAAkC;MAAAC,QAAA,EAAEG,WAAW;AAAE,KAAM,CACtE,eAAAE,cAAA,CAACQ,YAAI,EAAA;AAAAb,MAAAA,QAAA,EAAEA;AAAQ,KAAO,CACxB;AAAA,GAAK,CAAC;AAEV;;;;"}
@@ -17,7 +17,7 @@ import '../../common/propsValues/variant.mjs';
17
17
  import '../../common/propsValues/scroll.mjs';
18
18
  import '../../common/propsValues/markdownNodeType.mjs';
19
19
  import '../../common/fileType.mjs';
20
- import { BackslashCircle } from '@transferwise/icons';
20
+ import { GiftBox, BackslashCircle } from '@transferwise/icons';
21
21
  import { clsx } from 'clsx';
22
22
  import 'react';
23
23
  import 'react-intl';
@@ -33,9 +33,16 @@ const InlinePrompt = ({
33
33
  loading = false,
34
34
  className,
35
35
  children,
36
+ media = null,
36
37
  ...rest
37
38
  }) => {
38
39
  const renderMedia = () => {
40
+ if (media && ['proposition', 'positive'].includes(sentiment)) {
41
+ return media;
42
+ }
43
+ if (sentiment === 'proposition') {
44
+ return /*#__PURE__*/jsx(GiftBox, {});
45
+ }
39
46
  if (muted) {
40
47
  return /*#__PURE__*/jsx(BackslashCircle, {
41
48
  size: 16,
@@ -1 +1 @@
1
- {"version":3,"file":"InlinePrompt.mjs","sources":["../../../src/prompt/InlinePrompt/InlinePrompt.tsx"],"sourcesContent":["import { Sentiment } from '../../common';\nimport { BackslashCircle } from '@transferwise/icons';\nimport ProcessIndicator from '../../processIndicator';\nimport StatusIcon from '../../statusIcon';\nimport { clsx } from 'clsx';\nimport Body from '../../body';\n\nexport type InlinePromptProps = {\n sentiment?: `${Sentiment.POSITIVE | Sentiment.NEGATIVE | Sentiment.NEUTRAL | Sentiment.WARNING}`;\n loading?: boolean;\n /**\n * Use for short-lived inline prompts to avoid swap of the icon (which is bad UX for short-lived prompts, e.g. when submit form)\n */\n muted?: boolean;\n id?: string;\n className?: string;\n 'data-testid'?: string;\n children: React.ReactNode;\n};\n\nexport const InlinePrompt = ({\n sentiment = Sentiment.POSITIVE,\n muted = false,\n loading = false,\n className,\n children,\n ...rest\n}: InlinePromptProps) => {\n const renderMedia = () => {\n if (muted) {\n return <BackslashCircle size={16} data-testid=\"InlinePrompt_Muted\" />;\n }\n if (loading) {\n return <ProcessIndicator data-testid=\"InlinePrompt_ProcessIndicator\" size=\"xxs\" />;\n }\n return <StatusIcon size={16} sentiment={sentiment} />;\n };\n\n return (\n <div\n className={clsx(\n 'wds-inline-prompt',\n `wds-inline-prompt--${sentiment}`,\n {\n 'wds-inline-prompt--muted': muted,\n 'wds-inline-prompt--loading': loading,\n },\n className,\n )}\n {...rest}\n >\n <div className=\"wds-inline-prompt__media-wrapper\">{renderMedia()}</div>\n <Body>{children}</Body>\n </div>\n );\n};\n"],"names":["InlinePrompt","sentiment","Sentiment","POSITIVE","muted","loading","className","children","rest","renderMedia","_jsx","BackslashCircle","size","ProcessIndicator","StatusIcon","_jsxs","clsx","Body"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoBO,MAAMA,YAAY,GAAGA,CAAC;EAC3BC,SAAS,GAAGC,SAAS,CAACC,QAAQ;AAC9BC,EAAAA,KAAK,GAAG,KAAK;AACbC,EAAAA,OAAO,GAAG,KAAK;EACfC,SAAS;EACTC,QAAQ;EACR,GAAGC;AAAI,CACW,KAAI;EACtB,MAAMC,WAAW,GAAGA,MAAK;AACvB,IAAA,IAAIL,KAAK,EAAE;MACT,oBAAOM,GAAA,CAACC,eAAe,EAAA;AAACC,QAAAA,IAAI,EAAE,EAAG;QAAC,aAAA,EAAY;AAAoB,QAAG;AACvE,IAAA;AACA,IAAA,IAAIP,OAAO,EAAE;MACX,oBAAOK,GAAA,CAACG,gBAAgB,EAAA;AAAC,QAAA,aAAA,EAAY,+BAA+B;AAACD,QAAAA,IAAI,EAAC;AAAK,OAAA,CAAG;AACpF,IAAA;IACA,oBAAOF,GAAA,CAACI,UAAU,EAAA;AAACF,MAAAA,IAAI,EAAE,EAAG;AAACX,MAAAA,SAAS,EAAEA;AAAU,MAAG;EACvD,CAAC;AAED,EAAA,oBACEc,IAAA,CAAA,KAAA,EAAA;IACET,SAAS,EAAEU,IAAI,CACb,mBAAmB,EACnB,CAAA,mBAAA,EAAsBf,SAAS,EAAE,EACjC;AACE,MAAA,0BAA0B,EAAEG,KAAK;AACjC,MAAA,4BAA4B,EAAEC;KAC/B,EACDC,SAAS,CACT;AAAA,IAAA,GACEE,IAAI;AAAAD,IAAAA,QAAA,gBAERG,GAAA,CAAA,KAAA,EAAA;AAAKJ,MAAAA,SAAS,EAAC,kCAAkC;MAAAC,QAAA,EAAEE,WAAW;AAAE,KAAM,CACtE,eAAAC,GAAA,CAACO,IAAI,EAAA;AAAAV,MAAAA,QAAA,EAAEA;AAAQ,KAAO,CACxB;AAAA,GAAK,CAAC;AAEV;;;;"}
1
+ {"version":3,"file":"InlinePrompt.mjs","sources":["../../../src/prompt/InlinePrompt/InlinePrompt.tsx"],"sourcesContent":["import { Sentiment } from '../../common';\nimport { BackslashCircle, GiftBox } from '@transferwise/icons';\nimport ProcessIndicator from '../../processIndicator';\nimport StatusIcon from '../../statusIcon';\nimport { clsx } from 'clsx';\nimport Body from '../../body';\n\nexport type InlinePromptProps = {\n sentiment?:\n | `${Sentiment.POSITIVE | Sentiment.NEGATIVE | Sentiment.NEUTRAL | Sentiment.WARNING}`\n | 'proposition';\n loading?: boolean;\n /**\n * Use for short-lived inline prompts to avoid swap of the icon (which is bad UX for short-lived prompts, e.g. when submit form)\n */\n muted?: boolean;\n id?: string;\n className?: string;\n 'data-testid'?: string;\n children: React.ReactNode;\n media?: React.ReactNode;\n};\n\nexport const InlinePrompt = ({\n sentiment = Sentiment.POSITIVE,\n muted = false,\n loading = false,\n className,\n children,\n media = null,\n ...rest\n}: InlinePromptProps) => {\n const renderMedia = () => {\n if (media && ['proposition', 'positive'].includes(sentiment)) {\n return media;\n }\n if (sentiment === 'proposition') {\n return <GiftBox />;\n }\n if (muted) {\n return <BackslashCircle size={16} data-testid=\"InlinePrompt_Muted\" />;\n }\n if (loading) {\n return <ProcessIndicator data-testid=\"InlinePrompt_ProcessIndicator\" size=\"xxs\" />;\n }\n return <StatusIcon size={16} sentiment={sentiment} />;\n };\n\n return (\n <div\n className={clsx(\n 'wds-inline-prompt',\n `wds-inline-prompt--${sentiment}`,\n {\n 'wds-inline-prompt--muted': muted,\n 'wds-inline-prompt--loading': loading,\n },\n className,\n )}\n {...rest}\n >\n <div className=\"wds-inline-prompt__media-wrapper\">{renderMedia()}</div>\n <Body>{children}</Body>\n </div>\n );\n};\n"],"names":["InlinePrompt","sentiment","Sentiment","POSITIVE","muted","loading","className","children","media","rest","renderMedia","includes","_jsx","GiftBox","BackslashCircle","size","ProcessIndicator","StatusIcon","_jsxs","clsx","Body"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuBO,MAAMA,YAAY,GAAGA,CAAC;EAC3BC,SAAS,GAAGC,SAAS,CAACC,QAAQ;AAC9BC,EAAAA,KAAK,GAAG,KAAK;AACbC,EAAAA,OAAO,GAAG,KAAK;EACfC,SAAS;EACTC,QAAQ;AACRC,EAAAA,KAAK,GAAG,IAAI;EACZ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2
+ width: 100%;
3
+ }
4
+ .wds-amount-input-input-container {
5
+ display: flex;
6
+ justify-content: right;
7
+ width: 100%;
8
+ transition: font-size 0.4s cubic-bezier(0.3, 0, 0.1, 1), height 0.4s cubic-bezier(0.3, 0, 0.1, 1), margin-top 0.4s cubic-bezier(0.3, 0, 0.1, 1), color 0.4s ease;
9
+ color: var(--color-interactive-primary);
10
+ overflow: hidden;
11
+ margin-bottom: 0 !important;
12
+ }
13
+ @media (prefers-reduced-motion: reduce) {
14
+ .wds-amount-input-input-container {
15
+ transition: none;
16
+ }
17
+ }
18
+ .wds-amount-input-input {
19
+ border: none;
20
+ outline: none;
21
+ flex-grow: 1;
22
+ text-align: right;
23
+ background-color: transparent;
24
+ }
25
+ .wds-amount-input-input:focus-visible {
26
+ outline: none;
27
+ }
28
+ .wds-amount-input-placeholder {
29
+ flex-grow: 0;
30
+ display: flex;
31
+ align-items: center;
32
+ }
@@ -0,0 +1,12 @@
1
+ .wds-chevron-container {
2
+ width: 32px;
3
+ width: var(--size-32);
4
+ overflow: hidden;
5
+ color: var(--color-interactive-primary);
6
+ margin-left: 8px;
7
+ margin-left: var(--size-8);
8
+ transition: width 0.3s ease;
9
+ }
10
+ .wds-chevron-hidden {
11
+ width: 0;
12
+ }
@@ -0,0 +1,6 @@
1
+ .wds-currency-selector:disabled {
2
+ opacity: 1 !important;
3
+ cursor: auto !important;
4
+ cursor: initial !important;
5
+ mix-blend-mode: initial !important;
6
+ }
@@ -0,0 +1,58 @@
1
+ .wds-amount-input-container {
2
+ width: 100%;
3
+ }
4
+ .wds-amount-input-input-container {
5
+ display: flex;
6
+ justify-content: right;
7
+ width: 100%;
8
+ transition: font-size 0.4s cubic-bezier(0.3, 0, 0.1, 1), height 0.4s cubic-bezier(0.3, 0, 0.1, 1), margin-top 0.4s cubic-bezier(0.3, 0, 0.1, 1), color 0.4s ease;
9
+ color: var(--color-interactive-primary);
10
+ overflow: hidden;
11
+ margin-bottom: 0 !important;
12
+ }
13
+ @media (prefers-reduced-motion: reduce) {
14
+ .wds-amount-input-input-container {
15
+ transition: none;
16
+ }
17
+ }
18
+ .wds-amount-input-input {
19
+ border: none;
20
+ outline: none;
21
+ flex-grow: 1;
22
+ text-align: right;
23
+ background-color: transparent;
24
+ }
25
+ .wds-amount-input-input:focus-visible {
26
+ outline: none;
27
+ }
28
+ .wds-amount-input-placeholder {
29
+ flex-grow: 0;
30
+ display: flex;
31
+ align-items: center;
32
+ }
33
+ .wds-currency-selector:disabled {
34
+ opacity: 1 !important;
35
+ cursor: auto !important;
36
+ cursor: initial !important;
37
+ mix-blend-mode: initial !important;
38
+ }
39
+ .wds-chevron-container {
40
+ width: 32px;
41
+ width: var(--size-32);
42
+ overflow: hidden;
43
+ color: var(--color-interactive-primary);
44
+ margin-left: 8px;
45
+ margin-left: var(--size-8);
46
+ transition: width 0.3s ease;
47
+ }
48
+ .wds-chevron-hidden {
49
+ width: 0;
50
+ }
51
+ .wds-expressive-money-input-currency-selector {
52
+ flex-shrink: 0;
53
+ margin-right: 24px;
54
+ margin-right: var(--size-24);
55
+ }
56
+ .wds-expressive-money-input-chevron {
57
+ transform: translateY(-5%);
58
+ }
@@ -526,26 +526,26 @@
526
526
  background-color: var(--color-sentiment-positive-secondary-active);
527
527
  }
528
528
  .wds-inline-prompt--proposition {
529
- background-color: var(--color-sentiment-positive-secondary);
530
- color: var(--color-sentiment-positive-primary);
529
+ background-color: #D2F9F7;
530
+ color: var(--color-interactive-primary);
531
531
  }
532
532
  .wds-inline-prompt--proposition a,
533
533
  .wds-inline-prompt--proposition button {
534
- color: var(--color-sentiment-positive-primary);
534
+ color: var(--color-interactive-primary);
535
535
  }
536
536
  .wds-inline-prompt--proposition a:hover,
537
537
  .wds-inline-prompt--proposition button:hover {
538
- color: var(--color-sentiment-positive-primary-hover);
538
+ color: var(--color-interactive-primary-hover);
539
539
  }
540
540
  .wds-inline-prompt--proposition a:active,
541
541
  .wds-inline-prompt--proposition button:active {
542
- color: var(--color-sentiment-positive-primary-active);
542
+ color: var(--color-interactive-primary-active);
543
543
  }
544
544
  .wds-inline-prompt.wds-inline-prompt--proposition:has(a, button):hover {
545
- background-color: var(--color-sentiment-positive-secondary-hover);
545
+ background-color: #B2F4F3;
546
546
  }
547
547
  .wds-inline-prompt.wds-inline-prompt--proposition:has(a, button):active {
548
- background-color: var(--color-sentiment-positive-secondary-active);
548
+ background-color: #91F0EE;
549
549
  }
550
550
  .wds-inline-prompt--neutral {
551
551
  background-color: rgba(134,167,189,0.10196);
@@ -4447,6 +4447,64 @@ button.np-link {
4447
4447
  box-shadow: inset 0 0 0 1px #c9cbce !important;
4448
4448
  box-shadow: inset 0 0 0 1px var(--color-interactive-secondary) !important;
4449
4449
  }
4450
+ .wds-amount-input-container {
4451
+ width: 100%;
4452
+ }
4453
+ .wds-amount-input-input-container {
4454
+ display: flex;
4455
+ justify-content: right;
4456
+ width: 100%;
4457
+ transition: font-size 0.4s cubic-bezier(0.3, 0, 0.1, 1), height 0.4s cubic-bezier(0.3, 0, 0.1, 1), margin-top 0.4s cubic-bezier(0.3, 0, 0.1, 1), color 0.4s ease;
4458
+ color: var(--color-interactive-primary);
4459
+ overflow: hidden;
4460
+ margin-bottom: 0 !important;
4461
+ }
4462
+ @media (prefers-reduced-motion: reduce) {
4463
+ .wds-amount-input-input-container {
4464
+ transition: none;
4465
+ }
4466
+ }
4467
+ .wds-amount-input-input {
4468
+ border: none;
4469
+ outline: none;
4470
+ flex-grow: 1;
4471
+ text-align: right;
4472
+ background-color: transparent;
4473
+ }
4474
+ .wds-amount-input-input:focus-visible {
4475
+ outline: none;
4476
+ }
4477
+ .wds-amount-input-placeholder {
4478
+ flex-grow: 0;
4479
+ display: flex;
4480
+ align-items: center;
4481
+ }
4482
+ .wds-currency-selector:disabled {
4483
+ opacity: 1 !important;
4484
+ cursor: auto !important;
4485
+ cursor: initial !important;
4486
+ mix-blend-mode: initial !important;
4487
+ }
4488
+ .wds-chevron-container {
4489
+ width: 32px;
4490
+ width: var(--size-32);
4491
+ overflow: hidden;
4492
+ color: var(--color-interactive-primary);
4493
+ margin-left: 8px;
4494
+ margin-left: var(--size-8);
4495
+ transition: width 0.3s ease;
4496
+ }
4497
+ .wds-chevron-hidden {
4498
+ width: 0;
4499
+ }
4500
+ .wds-expressive-money-input-currency-selector {
4501
+ flex-shrink: 0;
4502
+ margin-right: 24px;
4503
+ margin-right: var(--size-24);
4504
+ }
4505
+ .wds-expressive-money-input-chevron {
4506
+ transform: translateY(-5%);
4507
+ }
4450
4508
  .np-navigation-option {
4451
4509
  -webkit-text-decoration: none;
4452
4510
  text-decoration: none;
@@ -91,26 +91,26 @@
91
91
  background-color: var(--color-sentiment-positive-secondary-active);
92
92
  }
93
93
  .wds-inline-prompt--proposition {
94
- background-color: var(--color-sentiment-positive-secondary);
95
- color: var(--color-sentiment-positive-primary);
94
+ background-color: #D2F9F7;
95
+ color: var(--color-interactive-primary);
96
96
  }
97
97
  .wds-inline-prompt--proposition a,
98
98
  .wds-inline-prompt--proposition button {
99
- color: var(--color-sentiment-positive-primary);
99
+ color: var(--color-interactive-primary);
100
100
  }
101
101
  .wds-inline-prompt--proposition a:hover,
102
102
  .wds-inline-prompt--proposition button:hover {
103
- color: var(--color-sentiment-positive-primary-hover);
103
+ color: var(--color-interactive-primary-hover);
104
104
  }
105
105
  .wds-inline-prompt--proposition a:active,
106
106
  .wds-inline-prompt--proposition button:active {
107
- color: var(--color-sentiment-positive-primary-active);
107
+ color: var(--color-interactive-primary-active);
108
108
  }
109
109
  .wds-inline-prompt.wds-inline-prompt--proposition:has(a, button):hover {
110
- background-color: var(--color-sentiment-positive-secondary-hover);
110
+ background-color: #B2F4F3;
111
111
  }
112
112
  .wds-inline-prompt.wds-inline-prompt--proposition:has(a, button):active {
113
- background-color: var(--color-sentiment-positive-secondary-active);
113
+ background-color: #91F0EE;
114
114
  }
115
115
  .wds-inline-prompt--neutral {
116
116
  background-color: rgba(134,167,189,0.10196);
@@ -0,0 +1,13 @@
1
+ import { Props as ExpressiveMoneyInputProps } from './ExpressiveMoneyInput';
2
+ type Props = {
3
+ id: string;
4
+ describedById?: string;
5
+ amount?: number | null;
6
+ currency: string;
7
+ autoFocus?: boolean;
8
+ onChange: (amount: number | null) => void;
9
+ onFocusChange?: (focused: boolean) => void;
10
+ } & Pick<ExpressiveMoneyInputProps, 'loading'>;
11
+ export declare const AmountInput: ({ id, describedById, amount, currency, autoFocus, onChange, onFocusChange, loading, }: Props) => import("react").JSX.Element;
12
+ export {};
13
+ //# sourceMappingURL=AmountInput.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AmountInput.d.ts","sourceRoot":"","sources":["../../../src/expressiveMoneyInput/AmountInput.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,IAAI,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AAe5E,KAAK,KAAK,GAAG;IACX,EAAE,EAAE,MAAM,CAAC;IACX,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IAC1C,aAAa,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;CAC5C,GAAG,IAAI,CAAC,yBAAyB,EAAE,SAAS,CAAC,CAAC;AAE/C,eAAO,MAAM,WAAW,GAAI,uFASzB,KAAK,gCA2SP,CAAC"}