@transferwise/components 0.0.0-experimental-fdbbf7b → 0.0.0-experimental-99ef65c

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 (117) hide show
  1. package/build/expressiveMoneyInput/ExpressiveMoneyInput.js +113 -0
  2. package/build/expressiveMoneyInput/ExpressiveMoneyInput.js.map +1 -0
  3. package/build/expressiveMoneyInput/ExpressiveMoneyInput.messages.js +17 -0
  4. package/build/expressiveMoneyInput/ExpressiveMoneyInput.messages.js.map +1 -0
  5. package/build/expressiveMoneyInput/ExpressiveMoneyInput.messages.mjs +13 -0
  6. package/build/expressiveMoneyInput/ExpressiveMoneyInput.messages.mjs.map +1 -0
  7. package/build/expressiveMoneyInput/ExpressiveMoneyInput.mjs +109 -0
  8. package/build/expressiveMoneyInput/ExpressiveMoneyInput.mjs.map +1 -0
  9. package/build/expressiveMoneyInput/amountInput/AmountInput.js +281 -0
  10. package/build/expressiveMoneyInput/amountInput/AmountInput.js.map +1 -0
  11. package/build/expressiveMoneyInput/amountInput/AmountInput.mjs +279 -0
  12. package/build/expressiveMoneyInput/amountInput/AmountInput.mjs.map +1 -0
  13. package/build/expressiveMoneyInput/amountInput/utils.js +87 -0
  14. package/build/expressiveMoneyInput/amountInput/utils.js.map +1 -0
  15. package/build/expressiveMoneyInput/amountInput/utils.mjs +78 -0
  16. package/build/expressiveMoneyInput/amountInput/utils.mjs.map +1 -0
  17. package/build/expressiveMoneyInput/animatedNumber/AnimatedNumber.js +50 -0
  18. package/build/expressiveMoneyInput/animatedNumber/AnimatedNumber.js.map +1 -0
  19. package/build/expressiveMoneyInput/animatedNumber/AnimatedNumber.mjs +48 -0
  20. package/build/expressiveMoneyInput/animatedNumber/AnimatedNumber.mjs.map +1 -0
  21. package/build/expressiveMoneyInput/chevron/Chevron.js +31 -0
  22. package/build/expressiveMoneyInput/chevron/Chevron.js.map +1 -0
  23. package/build/expressiveMoneyInput/chevron/Chevron.mjs +29 -0
  24. package/build/expressiveMoneyInput/chevron/Chevron.mjs.map +1 -0
  25. package/build/expressiveMoneyInput/currencySelector/CurrencySelector.js +160 -0
  26. package/build/expressiveMoneyInput/currencySelector/CurrencySelector.js.map +1 -0
  27. package/build/expressiveMoneyInput/currencySelector/CurrencySelector.mjs +157 -0
  28. package/build/expressiveMoneyInput/currencySelector/CurrencySelector.mjs.map +1 -0
  29. package/build/expressiveMoneyInput/hooks/useFocus.js +37 -0
  30. package/build/expressiveMoneyInput/hooks/useFocus.js.map +1 -0
  31. package/build/expressiveMoneyInput/hooks/useFocus.mjs +35 -0
  32. package/build/expressiveMoneyInput/hooks/useFocus.mjs.map +1 -0
  33. package/build/expressiveMoneyInput/hooks/useInputStyle.js +71 -0
  34. package/build/expressiveMoneyInput/hooks/useInputStyle.js.map +1 -0
  35. package/build/expressiveMoneyInput/hooks/useInputStyle.mjs +69 -0
  36. package/build/expressiveMoneyInput/hooks/useInputStyle.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/ExpressiveMoneyInput.css +58 -0
  52. package/build/styles/expressiveMoneyInput/amountInput/AmountInput.css +32 -0
  53. package/build/styles/expressiveMoneyInput/chevron/Chevron.css +12 -0
  54. package/build/styles/expressiveMoneyInput/currencySelector/CurrencySelector.css +6 -0
  55. package/build/styles/main.css +65 -7
  56. package/build/styles/prompt/InlinePrompt/InlinePrompt.css +7 -7
  57. package/build/types/expressiveMoneyInput/ExpressiveMoneyInput.d.ts +59 -0
  58. package/build/types/expressiveMoneyInput/ExpressiveMoneyInput.d.ts.map +1 -0
  59. package/build/types/expressiveMoneyInput/ExpressiveMoneyInput.messages.d.ts +12 -0
  60. package/build/types/expressiveMoneyInput/ExpressiveMoneyInput.messages.d.ts.map +1 -0
  61. package/build/types/expressiveMoneyInput/amountInput/AmountInput.d.ts +13 -0
  62. package/build/types/expressiveMoneyInput/amountInput/AmountInput.d.ts.map +1 -0
  63. package/build/types/expressiveMoneyInput/amountInput/utils.d.ts +22 -0
  64. package/build/types/expressiveMoneyInput/amountInput/utils.d.ts.map +1 -0
  65. package/build/types/expressiveMoneyInput/animatedNumber/AnimatedNumber.d.ts +9 -0
  66. package/build/types/expressiveMoneyInput/animatedNumber/AnimatedNumber.d.ts.map +1 -0
  67. package/build/types/expressiveMoneyInput/chevron/Chevron.d.ts +6 -0
  68. package/build/types/expressiveMoneyInput/chevron/Chevron.d.ts.map +1 -0
  69. package/build/types/expressiveMoneyInput/currencySelector/CurrencySelector.d.ts +30 -0
  70. package/build/types/expressiveMoneyInput/currencySelector/CurrencySelector.d.ts.map +1 -0
  71. package/build/types/expressiveMoneyInput/hooks/useFocus.d.ts +7 -0
  72. package/build/types/expressiveMoneyInput/hooks/useFocus.d.ts.map +1 -0
  73. package/build/types/expressiveMoneyInput/hooks/useInputStyle.d.ts +10 -0
  74. package/build/types/expressiveMoneyInput/hooks/useInputStyle.d.ts.map +1 -0
  75. package/build/types/expressiveMoneyInput/hooks/useSelectionRange.d.ts +10 -0
  76. package/build/types/expressiveMoneyInput/hooks/useSelectionRange.d.ts.map +1 -0
  77. package/build/types/expressiveMoneyInput/index.d.ts +3 -0
  78. package/build/types/expressiveMoneyInput/index.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/package.json +5 -5
  86. package/src/expressiveMoneyInput/ExpressiveMoneyInput.autofocus.docs.mdx +12 -0
  87. package/src/expressiveMoneyInput/ExpressiveMoneyInput.css +58 -0
  88. package/src/expressiveMoneyInput/ExpressiveMoneyInput.less +13 -0
  89. package/src/expressiveMoneyInput/ExpressiveMoneyInput.messages.ts +13 -0
  90. package/src/expressiveMoneyInput/ExpressiveMoneyInput.story.tsx +232 -0
  91. package/src/expressiveMoneyInput/ExpressiveMoneyInput.tsx +156 -0
  92. package/src/expressiveMoneyInput/amountInput/AmountInput.css +32 -0
  93. package/src/expressiveMoneyInput/amountInput/AmountInput.less +43 -0
  94. package/src/expressiveMoneyInput/amountInput/AmountInput.tsx +353 -0
  95. package/src/expressiveMoneyInput/amountInput/utils.spec.ts +114 -0
  96. package/src/expressiveMoneyInput/amountInput/utils.ts +116 -0
  97. package/src/expressiveMoneyInput/animatedNumber/AnimatedNumber.tsx +40 -0
  98. package/src/expressiveMoneyInput/chevron/Chevron.css +12 -0
  99. package/src/expressiveMoneyInput/chevron/Chevron.less +13 -0
  100. package/src/expressiveMoneyInput/chevron/Chevron.tsx +35 -0
  101. package/src/expressiveMoneyInput/currencySelector/CurrencySelector.css +6 -0
  102. package/src/expressiveMoneyInput/currencySelector/CurrencySelector.less +7 -0
  103. package/src/expressiveMoneyInput/currencySelector/CurrencySelector.tsx +220 -0
  104. package/src/expressiveMoneyInput/hooks/useFocus.ts +35 -0
  105. package/src/expressiveMoneyInput/hooks/useInputStyle.ts +85 -0
  106. package/src/expressiveMoneyInput/hooks/useSelectionRange.ts +23 -0
  107. package/src/expressiveMoneyInput/index.ts +2 -0
  108. package/src/i18n/en.json +2 -0
  109. package/src/index.ts +2 -0
  110. package/src/main.css +65 -7
  111. package/src/main.less +1 -0
  112. package/src/prompt/InlinePrompt/InlinePrompt.css +7 -7
  113. package/src/prompt/InlinePrompt/InlinePrompt.less +7 -7
  114. package/src/prompt/InlinePrompt/InlinePrompt.spec.tsx +6 -0
  115. package/src/prompt/InlinePrompt/InlinePrompt.story.tsx +39 -0
  116. package/src/prompt/InlinePrompt/InlinePrompt.tsx +12 -2
  117. package/src/ssr.spec.tsx +1 -0
@@ -0,0 +1,69 @@
1
+ import { useState, useLayoutEffect, useEffect } from 'react';
2
+
3
+ const useInputStyle = ({
4
+ value,
5
+ focus,
6
+ inputElement,
7
+ loading
8
+ }) => {
9
+ const initialRender = !useTimeout(300);
10
+ const inputWidth = useFirstDefinedValue(inputElement?.clientWidth, [inputElement, value]);
11
+ const getStyle = () => {
12
+ const fontSize = getFontSize(value, focus, inputWidth);
13
+ return {
14
+ fontSize,
15
+ height: fontSize,
16
+ // aligns the top of the digit with the currency button
17
+ marginTop: fontSize * -0.19,
18
+ // if the input loads with a pre-filled value, we don't want to animate the font-size immediately
19
+ transition: initialRender ? 'none' : undefined,
20
+ color: loading ? 'var(--color-interactive-secondary)' : undefined
21
+ };
22
+ };
23
+ const [style, setStyle] = useState(getStyle());
24
+ useLayoutEffect(() => {
25
+ setStyle(getStyle());
26
+ }, [value, focus, loading, inputWidth]);
27
+ return style;
28
+ };
29
+ function getFontSize(inputValue, isFocused, inputWidth) {
30
+ const defaultFontSize = 52;
31
+ const focusFontSize = 90;
32
+ const minimumFontSize = 34;
33
+ let fontSize = isFocused ? focusFontSize : defaultFontSize;
34
+ if (typeof inputWidth === 'undefined') {
35
+ return fontSize;
36
+ }
37
+ const textLength = inputValue.length;
38
+ const maxCharactersWithoutShrinking = Math.floor(inputWidth / 40);
39
+ if (textLength > maxCharactersWithoutShrinking) {
40
+ const adjustedSize = Math.round(inputWidth / textLength * 1.9);
41
+ fontSize = Math.min(fontSize, adjustedSize);
42
+ }
43
+ return Math.max(fontSize, minimumFontSize);
44
+ }
45
+ const useFirstDefinedValue = (newValue, dependencies) => {
46
+ const [value, setValue] = useState(newValue);
47
+ useLayoutEffect(() => {
48
+ if (typeof newValue !== 'undefined' && typeof value === 'undefined') {
49
+ setValue(newValue);
50
+ }
51
+ // eslint-disable-next-line react-hooks/exhaustive-deps
52
+ }, [...dependencies, value]);
53
+ return value;
54
+ };
55
+ const useTimeout = delay => {
56
+ const [ready, setReady] = useState(false);
57
+ useEffect(() => {
58
+ const timeout = setTimeout(() => {
59
+ setReady(true);
60
+ }, delay);
61
+ return () => {
62
+ clearTimeout(timeout);
63
+ };
64
+ }, [delay]);
65
+ return ready;
66
+ };
67
+
68
+ export { useInputStyle };
69
+ //# sourceMappingURL=useInputStyle.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useInputStyle.mjs","sources":["../../../src/expressiveMoneyInput/hooks/useInputStyle.ts"],"sourcesContent":["import { type CSSProperties, useEffect, useLayoutEffect, useState } from 'react';\nimport { Props as ExpressiveMoneyInputProps } from '../ExpressiveMoneyInput';\n\ntype InputStyleObject = {\n value: string;\n focus: boolean;\n inputElement: HTMLInputElement | null;\n} & Pick<ExpressiveMoneyInputProps, 'loading'>;\n\nexport const useInputStyle = ({ value, focus, inputElement, loading }: InputStyleObject) => {\n const initialRender = !useTimeout(300);\n const inputWidth = useFirstDefinedValue(inputElement?.clientWidth, [inputElement, value]);\n\n const getStyle = (): CSSProperties => {\n const fontSize = getFontSize(value, focus, inputWidth);\n\n return {\n fontSize,\n height: fontSize,\n // aligns the top of the digit with the currency button\n marginTop: fontSize * -0.19,\n // if the input loads with a pre-filled value, we don't want to animate the font-size immediately\n transition: initialRender ? 'none' : undefined,\n color: loading ? 'var(--color-interactive-secondary)' : undefined,\n };\n };\n\n const [style, setStyle] = useState(getStyle());\n\n useLayoutEffect(() => {\n setStyle(getStyle());\n }, [value, focus, loading, inputWidth]);\n\n return style;\n};\n\nfunction getFontSize(inputValue: string, isFocused: boolean, inputWidth: number | undefined) {\n const defaultFontSize = 52;\n const focusFontSize = 90;\n const minimumFontSize = 34;\n\n let fontSize = isFocused ? focusFontSize : defaultFontSize;\n\n if (typeof inputWidth === 'undefined') {\n return fontSize;\n }\n const textLength = inputValue.length;\n const maxCharactersWithoutShrinking = Math.floor(inputWidth / 40);\n\n if (textLength > maxCharactersWithoutShrinking) {\n const adjustedSize = Math.round((inputWidth / textLength) * 1.9);\n fontSize = Math.min(fontSize, adjustedSize);\n }\n\n return Math.max(fontSize, minimumFontSize);\n}\n\nconst useFirstDefinedValue = (newValue: number | undefined, dependencies: unknown[]) => {\n const [value, setValue] = useState<number | undefined>(newValue);\n\n useLayoutEffect(() => {\n if (typeof newValue !== 'undefined' && typeof value === 'undefined') {\n setValue(newValue);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [...dependencies, value]);\n\n return value;\n};\n\nconst useTimeout = (delay: number) => {\n const [ready, setReady] = useState(false);\n\n useEffect(() => {\n const timeout = setTimeout(() => {\n setReady(true);\n }, delay);\n\n return () => {\n clearTimeout(timeout);\n };\n }, [delay]);\n\n return ready;\n};\n"],"names":["useInputStyle","value","focus","inputElement","loading","initialRender","useTimeout","inputWidth","useFirstDefinedValue","clientWidth","getStyle","fontSize","getFontSize","height","marginTop","transition","undefined","color","style","setStyle","useState","useLayoutEffect","inputValue","isFocused","defaultFontSize","focusFontSize","minimumFontSize","textLength","length","maxCharactersWithoutShrinking","Math","floor","adjustedSize","round","min","max","newValue","dependencies","setValue","delay","ready","setReady","useEffect","timeout","setTimeout","clearTimeout"],"mappings":"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"}
@@ -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);
@@ -4455,6 +4455,64 @@ button.np-link {
4455
4455
  box-shadow: inset 0 0 0 1px #c9cbce !important;
4456
4456
  box-shadow: inset 0 0 0 1px var(--color-interactive-secondary) !important;
4457
4457
  }
4458
+ .wds-amount-input-container {
4459
+ width: 100%;
4460
+ }
4461
+ .wds-amount-input-input-container {
4462
+ display: flex;
4463
+ justify-content: right;
4464
+ width: 100%;
4465
+ 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;
4466
+ color: var(--color-interactive-primary);
4467
+ overflow: hidden;
4468
+ margin-bottom: 0 !important;
4469
+ }
4470
+ @media (prefers-reduced-motion: reduce) {
4471
+ .wds-amount-input-input-container {
4472
+ transition: none;
4473
+ }
4474
+ }
4475
+ .wds-amount-input-input {
4476
+ border: none;
4477
+ outline: none;
4478
+ flex-grow: 1;
4479
+ text-align: right;
4480
+ background-color: transparent;
4481
+ }
4482
+ .wds-amount-input-input:focus-visible {
4483
+ outline: none;
4484
+ }
4485
+ .wds-amount-input-placeholder {
4486
+ flex-grow: 0;
4487
+ display: flex;
4488
+ align-items: center;
4489
+ }
4490
+ .wds-currency-selector:disabled {
4491
+ opacity: 1 !important;
4492
+ cursor: auto !important;
4493
+ cursor: initial !important;
4494
+ mix-blend-mode: initial !important;
4495
+ }
4496
+ .wds-chevron-container {
4497
+ width: 32px;
4498
+ width: var(--size-32);
4499
+ overflow: hidden;
4500
+ color: var(--color-interactive-primary);
4501
+ margin-left: 8px;
4502
+ margin-left: var(--size-8);
4503
+ transition: width 0.3s ease;
4504
+ }
4505
+ .wds-chevron-hidden {
4506
+ width: 0;
4507
+ }
4508
+ .wds-expressive-money-input-currency-selector {
4509
+ flex-shrink: 0;
4510
+ margin-right: 24px;
4511
+ margin-right: var(--size-24);
4512
+ }
4513
+ .wds-expressive-money-input-chevron {
4514
+ transform: translateY(-5%);
4515
+ }
4458
4516
  .np-navigation-option {
4459
4517
  -webkit-text-decoration: none;
4460
4518
  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,GAAGC;AAAI,CACW,KAAI;EACtB,MAAMC,WAAW,GAAGA,MAAK;AACvB,IAAA,IAAIF,KAAK,IAAI,CAAC,aAAa,EAAE,UAAU,CAAC,CAACG,QAAQ,CAACV,SAAS,CAAC,EAAE;AAC5D,MAAA,OAAOO,KAAK;AACd,IAAA;IACA,IAAIP,SAAS,KAAK,aAAa,EAAE;AAC/B,MAAA,oBAAOW,GAAA,CAACC,OAAO,EAAA,GAAG;AACpB,IAAA;AACA,IAAA,IAAIT,KAAK,EAAE;MACT,oBAAOQ,GAAA,CAACE,eAAe,EAAA;AAACC,QAAAA,IAAI,EAAE,EAAG;QAAC,aAAA,EAAY;AAAoB,QAAG;AACvE,IAAA;AACA,IAAA,IAAIV,OAAO,EAAE;MACX,oBAAOO,GAAA,CAACI,gBAAgB,EAAA;AAAC,QAAA,aAAA,EAAY,+BAA+B;AAACD,QAAAA,IAAI,EAAC;AAAK,OAAA,CAAG;AACpF,IAAA;IACA,oBAAOH,GAAA,CAACK,UAAU,EAAA;AAACF,MAAAA,IAAI,EAAE,EAAG;AAACd,MAAAA,SAAS,EAAEA;AAAU,MAAG;EACvD,CAAC;AAED,EAAA,oBACEiB,IAAA,CAAA,KAAA,EAAA;IACEZ,SAAS,EAAEa,IAAI,CACb,mBAAmB,EACnB,CAAA,mBAAA,EAAsBlB,SAAS,EAAE,EACjC;AACE,MAAA,0BAA0B,EAAEG,KAAK;AACjC,MAAA,4BAA4B,EAAEC;KAC/B,EACDC,SAAS,CACT;AAAA,IAAA,GACEG,IAAI;AAAAF,IAAAA,QAAA,gBAERK,GAAA,CAAA,KAAA,EAAA;AAAKN,MAAAA,SAAS,EAAC,kCAAkC;MAAAC,QAAA,EAAEG,WAAW;AAAE,KAAM,CACtE,eAAAE,GAAA,CAACQ,IAAI,EAAA;AAAAb,MAAAA,QAAA,EAAEA;AAAQ,KAAO,CACxB;AAAA,GAAK,CAAC;AAEV;;;;"}
@@ -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
+ }
@@ -0,0 +1,32 @@
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
+ }
@@ -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
+ }
@@ -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);
@@ -4455,6 +4455,64 @@ button.np-link {
4455
4455
  box-shadow: inset 0 0 0 1px #c9cbce !important;
4456
4456
  box-shadow: inset 0 0 0 1px var(--color-interactive-secondary) !important;
4457
4457
  }
4458
+ .wds-amount-input-container {
4459
+ width: 100%;
4460
+ }
4461
+ .wds-amount-input-input-container {
4462
+ display: flex;
4463
+ justify-content: right;
4464
+ width: 100%;
4465
+ 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;
4466
+ color: var(--color-interactive-primary);
4467
+ overflow: hidden;
4468
+ margin-bottom: 0 !important;
4469
+ }
4470
+ @media (prefers-reduced-motion: reduce) {
4471
+ .wds-amount-input-input-container {
4472
+ transition: none;
4473
+ }
4474
+ }
4475
+ .wds-amount-input-input {
4476
+ border: none;
4477
+ outline: none;
4478
+ flex-grow: 1;
4479
+ text-align: right;
4480
+ background-color: transparent;
4481
+ }
4482
+ .wds-amount-input-input:focus-visible {
4483
+ outline: none;
4484
+ }
4485
+ .wds-amount-input-placeholder {
4486
+ flex-grow: 0;
4487
+ display: flex;
4488
+ align-items: center;
4489
+ }
4490
+ .wds-currency-selector:disabled {
4491
+ opacity: 1 !important;
4492
+ cursor: auto !important;
4493
+ cursor: initial !important;
4494
+ mix-blend-mode: initial !important;
4495
+ }
4496
+ .wds-chevron-container {
4497
+ width: 32px;
4498
+ width: var(--size-32);
4499
+ overflow: hidden;
4500
+ color: var(--color-interactive-primary);
4501
+ margin-left: 8px;
4502
+ margin-left: var(--size-8);
4503
+ transition: width 0.3s ease;
4504
+ }
4505
+ .wds-chevron-hidden {
4506
+ width: 0;
4507
+ }
4508
+ .wds-expressive-money-input-currency-selector {
4509
+ flex-shrink: 0;
4510
+ margin-right: 24px;
4511
+ margin-right: var(--size-24);
4512
+ }
4513
+ .wds-expressive-money-input-chevron {
4514
+ transform: translateY(-5%);
4515
+ }
4458
4516
  .np-navigation-option {
4459
4517
  -webkit-text-decoration: none;
4460
4518
  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,59 @@
1
+ import { type ReactNode } from 'react';
2
+ import { type Props as CurrencySelectorProps } from './currencySelector/CurrencySelector';
3
+ import { CommonProps } from '../common';
4
+ import { type InlinePromptProps } from '../prompt/InlinePrompt';
5
+ type AmountType = number | null;
6
+ export type CurrencyType = string;
7
+ type DefaultCurrencySelectorInstanceType = Pick<CurrencySelectorProps, 'addons' | 'options' | 'onChange' | 'onOpen' | 'onSearchChange'>;
8
+ type CustomCurrencySelectorInstanceType = {
9
+ customRender?: (props: {
10
+ id: string;
11
+ labelId: string;
12
+ }) => ReactNode;
13
+ };
14
+ type CurrencySelectorType = DefaultCurrencySelectorInstanceType & CustomCurrencySelectorInstanceType;
15
+ export type Props = {
16
+ label?: ReactNode;
17
+ currencySelector?: CurrencySelectorType;
18
+ amount?: AmountType;
19
+ /**
20
+ * The currency code, e.g. `USD`, `EUR`, `GBP`, etc. Governs the flag rendered in the currency selector.
21
+ */
22
+ currency: CurrencyType;
23
+ inlinePrompt?: {
24
+ sentiment?: InlinePromptProps['sentiment'];
25
+ message: InlinePromptProps['children'];
26
+ media?: InlinePromptProps['media'];
27
+ };
28
+ showChevron?: boolean;
29
+ /**
30
+ * If set, it auto-focuses the amount input upon component mount.<br />
31
+ * ⚠️ **Use with caution**, as it may impact user experience and
32
+ * fail [WCAG 2.4.3 requirements](https://www.w3.org/WAI/WCAG21/Understanding/focus-order.html)
33
+ */
34
+ autoFocus?: boolean;
35
+ /**
36
+ * Dims the input to indicate a loading state. Does not disable it.
37
+ */
38
+ loading?: boolean;
39
+ onAmountChange: (amount: AmountType) => void;
40
+ onFocusChange?: (focused: boolean) => void;
41
+ } & CommonProps;
42
+ /**
43
+ * This component has been kindly contributed by our friends at the `Send` team 🎉.
44
+ *
45
+ * Some patterns and implementation details used in this component may differ
46
+ * from what's commonly used in the Design System. The overall build and QA was managed
47
+ * by the contributing team directly, and such did not follow a typical DS lifecycle.
48
+ *
49
+ * While we house this component and will help facilitate its future iterations,
50
+ * direct contributions by consuming product teams are highly encouraged.
51
+ *
52
+ * > ⚠️ **Prerequisite:** <br />The component depends on the
53
+ * [framer-motion](https://www.npmjs.com/package/framer-motion) package, which has been
54
+ * deliberately excluded from the Design System bundle and kept as an opt-in only.
55
+ * **Make sure to add it to your project dependencies.**
56
+ */
57
+ export default function ExpressiveMoneyInput({ label, currency, currencySelector, amount, onAmountChange, className, inlinePrompt, showChevron, autoFocus, loading, onFocusChange, }: Props): import("react").JSX.Element;
58
+ export {};
59
+ //# sourceMappingURL=ExpressiveMoneyInput.d.ts.map