@transferwise/components 0.0.0-experimental-77845f6 → 0.0.0-experimental-e556371
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/i18n/en.json +0 -2
- package/build/i18n/en.json.js +0 -2
- package/build/i18n/en.json.js.map +1 -1
- package/build/i18n/en.json.mjs +0 -2
- package/build/i18n/en.json.mjs.map +1 -1
- package/build/index.js +0 -2
- package/build/index.js.map +1 -1
- package/build/index.mjs +0 -1
- package/build/index.mjs.map +1 -1
- package/build/main.css +15 -65
- package/build/prompt/InlinePrompt/InlinePrompt.js +0 -7
- package/build/prompt/InlinePrompt/InlinePrompt.js.map +1 -1
- package/build/prompt/InlinePrompt/InlinePrompt.mjs +1 -8
- package/build/prompt/InlinePrompt/InlinePrompt.mjs.map +1 -1
- package/build/styles/main.css +15 -65
- package/build/styles/moneyInput/MoneyInput.css +8 -0
- package/build/styles/prompt/InlinePrompt/InlinePrompt.css +7 -7
- package/build/types/index.d.ts +0 -2
- package/build/types/index.d.ts.map +1 -1
- package/build/types/prompt/InlinePrompt/InlinePrompt.d.ts +2 -3
- package/build/types/prompt/InlinePrompt/InlinePrompt.d.ts.map +1 -1
- package/build/types/test-utils/index.d.ts +0 -4
- package/build/types/test-utils/index.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/i18n/en.json +0 -2
- package/src/index.ts +0 -2
- package/src/main.css +15 -65
- package/src/main.less +0 -1
- package/src/moneyInput/MoneyInput.css +8 -0
- package/src/moneyInput/MoneyInput.less +5 -0
- package/src/prompt/InlinePrompt/InlinePrompt.css +7 -7
- package/src/prompt/InlinePrompt/InlinePrompt.less +7 -7
- package/src/prompt/InlinePrompt/InlinePrompt.spec.tsx +0 -6
- package/src/prompt/InlinePrompt/InlinePrompt.tsx +2 -12
- package/src/ssr.spec.tsx +0 -1
- package/build/expressiveMoneyInput/ExpressiveMoneyInput.js +0 -114
- package/build/expressiveMoneyInput/ExpressiveMoneyInput.js.map +0 -1
- package/build/expressiveMoneyInput/ExpressiveMoneyInput.messages.js +0 -17
- package/build/expressiveMoneyInput/ExpressiveMoneyInput.messages.js.map +0 -1
- package/build/expressiveMoneyInput/ExpressiveMoneyInput.messages.mjs +0 -13
- package/build/expressiveMoneyInput/ExpressiveMoneyInput.messages.mjs.map +0 -1
- package/build/expressiveMoneyInput/ExpressiveMoneyInput.mjs +0 -110
- package/build/expressiveMoneyInput/ExpressiveMoneyInput.mjs.map +0 -1
- package/build/expressiveMoneyInput/amountInput/AmountInput.js +0 -281
- package/build/expressiveMoneyInput/amountInput/AmountInput.js.map +0 -1
- package/build/expressiveMoneyInput/amountInput/AmountInput.mjs +0 -279
- package/build/expressiveMoneyInput/amountInput/AmountInput.mjs.map +0 -1
- package/build/expressiveMoneyInput/amountInput/utils.js +0 -87
- package/build/expressiveMoneyInput/amountInput/utils.js.map +0 -1
- package/build/expressiveMoneyInput/amountInput/utils.mjs +0 -78
- package/build/expressiveMoneyInput/amountInput/utils.mjs.map +0 -1
- package/build/expressiveMoneyInput/animatedNumber/AnimatedNumber.js +0 -50
- package/build/expressiveMoneyInput/animatedNumber/AnimatedNumber.js.map +0 -1
- package/build/expressiveMoneyInput/animatedNumber/AnimatedNumber.mjs +0 -48
- package/build/expressiveMoneyInput/animatedNumber/AnimatedNumber.mjs.map +0 -1
- package/build/expressiveMoneyInput/chevron/Chevron.js +0 -31
- package/build/expressiveMoneyInput/chevron/Chevron.js.map +0 -1
- package/build/expressiveMoneyInput/chevron/Chevron.mjs +0 -29
- package/build/expressiveMoneyInput/chevron/Chevron.mjs.map +0 -1
- package/build/expressiveMoneyInput/currencySelector/CurrencySelector.js +0 -160
- package/build/expressiveMoneyInput/currencySelector/CurrencySelector.js.map +0 -1
- package/build/expressiveMoneyInput/currencySelector/CurrencySelector.mjs +0 -157
- package/build/expressiveMoneyInput/currencySelector/CurrencySelector.mjs.map +0 -1
- package/build/expressiveMoneyInput/hooks/useFocus.js +0 -37
- package/build/expressiveMoneyInput/hooks/useFocus.js.map +0 -1
- package/build/expressiveMoneyInput/hooks/useFocus.mjs +0 -35
- package/build/expressiveMoneyInput/hooks/useFocus.mjs.map +0 -1
- package/build/expressiveMoneyInput/hooks/useInputStyle.js +0 -71
- package/build/expressiveMoneyInput/hooks/useInputStyle.js.map +0 -1
- package/build/expressiveMoneyInput/hooks/useInputStyle.mjs +0 -69
- package/build/expressiveMoneyInput/hooks/useInputStyle.mjs.map +0 -1
- package/build/styles/expressiveMoneyInput/ExpressiveMoneyInput.css +0 -58
- package/build/styles/expressiveMoneyInput/amountInput/AmountInput.css +0 -32
- package/build/styles/expressiveMoneyInput/chevron/Chevron.css +0 -12
- package/build/styles/expressiveMoneyInput/currencySelector/CurrencySelector.css +0 -6
- package/build/types/expressiveMoneyInput/ExpressiveMoneyInput.d.ts +0 -33
- package/build/types/expressiveMoneyInput/ExpressiveMoneyInput.d.ts.map +0 -1
- package/build/types/expressiveMoneyInput/ExpressiveMoneyInput.messages.d.ts +0 -12
- package/build/types/expressiveMoneyInput/ExpressiveMoneyInput.messages.d.ts.map +0 -1
- package/build/types/expressiveMoneyInput/amountInput/AmountInput.d.ts +0 -13
- package/build/types/expressiveMoneyInput/amountInput/AmountInput.d.ts.map +0 -1
- package/build/types/expressiveMoneyInput/amountInput/utils.d.ts +0 -22
- package/build/types/expressiveMoneyInput/amountInput/utils.d.ts.map +0 -1
- package/build/types/expressiveMoneyInput/animatedNumber/AnimatedNumber.d.ts +0 -9
- package/build/types/expressiveMoneyInput/animatedNumber/AnimatedNumber.d.ts.map +0 -1
- package/build/types/expressiveMoneyInput/chevron/Chevron.d.ts +0 -6
- package/build/types/expressiveMoneyInput/chevron/Chevron.d.ts.map +0 -1
- package/build/types/expressiveMoneyInput/currencySelector/CurrencySelector.d.ts +0 -30
- package/build/types/expressiveMoneyInput/currencySelector/CurrencySelector.d.ts.map +0 -1
- package/build/types/expressiveMoneyInput/hooks/useFocus.d.ts +0 -7
- package/build/types/expressiveMoneyInput/hooks/useFocus.d.ts.map +0 -1
- package/build/types/expressiveMoneyInput/hooks/useInputStyle.d.ts +0 -10
- package/build/types/expressiveMoneyInput/hooks/useInputStyle.d.ts.map +0 -1
- package/build/types/expressiveMoneyInput/hooks/useSelectionRange.d.ts +0 -10
- package/build/types/expressiveMoneyInput/hooks/useSelectionRange.d.ts.map +0 -1
- package/build/types/expressiveMoneyInput/index.d.ts +0 -3
- package/build/types/expressiveMoneyInput/index.d.ts.map +0 -1
- package/src/expressiveMoneyInput/ExpressiveMoneyInput.css +0 -58
- package/src/expressiveMoneyInput/ExpressiveMoneyInput.less +0 -13
- package/src/expressiveMoneyInput/ExpressiveMoneyInput.messages.ts +0 -13
- package/src/expressiveMoneyInput/ExpressiveMoneyInput.story.tsx +0 -290
- package/src/expressiveMoneyInput/ExpressiveMoneyInput.tsx +0 -125
- package/src/expressiveMoneyInput/amountInput/AmountInput.css +0 -32
- package/src/expressiveMoneyInput/amountInput/AmountInput.less +0 -43
- package/src/expressiveMoneyInput/amountInput/AmountInput.tsx +0 -353
- package/src/expressiveMoneyInput/amountInput/utils.spec.ts +0 -114
- package/src/expressiveMoneyInput/amountInput/utils.ts +0 -116
- package/src/expressiveMoneyInput/animatedNumber/AnimatedNumber.tsx +0 -40
- package/src/expressiveMoneyInput/chevron/Chevron.css +0 -12
- package/src/expressiveMoneyInput/chevron/Chevron.less +0 -13
- package/src/expressiveMoneyInput/chevron/Chevron.tsx +0 -35
- package/src/expressiveMoneyInput/currencySelector/CurrencySelector.css +0 -6
- package/src/expressiveMoneyInput/currencySelector/CurrencySelector.less +0 -7
- package/src/expressiveMoneyInput/currencySelector/CurrencySelector.tsx +0 -218
- package/src/expressiveMoneyInput/hooks/useFocus.ts +0 -35
- package/src/expressiveMoneyInput/hooks/useInputStyle.ts +0 -85
- package/src/expressiveMoneyInput/hooks/useSelectionRange.ts +0 -23
- package/src/expressiveMoneyInput/index.ts +0 -2
- package/src/prompt/InlinePrompt/InlinePrompt.story.tsx +0 -57
package/src/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:
|
|
530
|
-
color: var(--color-
|
|
529
|
+
background-color: var(--color-sentiment-positive-secondary);
|
|
530
|
+
color: var(--color-sentiment-positive-primary);
|
|
531
531
|
}
|
|
532
532
|
.wds-inline-prompt--proposition a,
|
|
533
533
|
.wds-inline-prompt--proposition button {
|
|
534
|
-
color: var(--color-
|
|
534
|
+
color: var(--color-sentiment-positive-primary);
|
|
535
535
|
}
|
|
536
536
|
.wds-inline-prompt--proposition a:hover,
|
|
537
537
|
.wds-inline-prompt--proposition button:hover {
|
|
538
|
-
color: var(--color-
|
|
538
|
+
color: var(--color-sentiment-positive-primary-hover);
|
|
539
539
|
}
|
|
540
540
|
.wds-inline-prompt--proposition a:active,
|
|
541
541
|
.wds-inline-prompt--proposition button:active {
|
|
542
|
-
color: var(--color-
|
|
542
|
+
color: var(--color-sentiment-positive-primary-active);
|
|
543
543
|
}
|
|
544
544
|
.wds-inline-prompt.wds-inline-prompt--proposition:has(a, button):hover {
|
|
545
|
-
background-color:
|
|
545
|
+
background-color: var(--color-sentiment-positive-secondary-hover);
|
|
546
546
|
}
|
|
547
547
|
.wds-inline-prompt.wds-inline-prompt--proposition:has(a, button):active {
|
|
548
|
-
background-color:
|
|
548
|
+
background-color: var(--color-sentiment-positive-secondary-active);
|
|
549
549
|
}
|
|
550
550
|
.wds-inline-prompt--neutral {
|
|
551
551
|
background-color: rgba(134,167,189,0.10196);
|
|
@@ -4421,6 +4421,14 @@ button.np-link {
|
|
|
4421
4421
|
flex-shrink: 0;
|
|
4422
4422
|
width: auto;
|
|
4423
4423
|
}
|
|
4424
|
+
.tw-money-input .input-group-addon:not(.amount-currency-select-btn):not(.tw-money-input__fixed-currency):not(:has(~ .tw-money-input__fixed-currency)) {
|
|
4425
|
+
padding-right: 0 !important;
|
|
4426
|
+
}
|
|
4427
|
+
[dir="rtl"] .tw-money-input .input-group-addon:not(.amount-currency-select-btn):not(.tw-money-input__fixed-currency):not(:has(~ .tw-money-input__fixed-currency)) {
|
|
4428
|
+
padding-left: 0 !important;
|
|
4429
|
+
padding-right: 0 !important;
|
|
4430
|
+
padding-right: initial !important;
|
|
4431
|
+
}
|
|
4424
4432
|
.tw-money-input .amount-currency-select-btn {
|
|
4425
4433
|
flex-shrink: 0;
|
|
4426
4434
|
width: auto;
|
|
@@ -4447,64 +4455,6 @@ button.np-link {
|
|
|
4447
4455
|
box-shadow: inset 0 0 0 1px #c9cbce !important;
|
|
4448
4456
|
box-shadow: inset 0 0 0 1px var(--color-interactive-secondary) !important;
|
|
4449
4457
|
}
|
|
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
|
-
}
|
|
4508
4458
|
.np-navigation-option {
|
|
4509
4459
|
-webkit-text-decoration: none;
|
|
4510
4460
|
text-decoration: none;
|
package/src/main.less
CHANGED
|
@@ -51,7 +51,6 @@
|
|
|
51
51
|
@import "./logo/Logo.less";
|
|
52
52
|
@import "./modal/Modal.less";
|
|
53
53
|
@import "./moneyInput/MoneyInput.less";
|
|
54
|
-
@import "./expressiveMoneyInput/ExpressiveMoneyInput.less";
|
|
55
54
|
@import "./navigationOption/NavigationOption.less";
|
|
56
55
|
@import "./navigationOptionsList/NavigationOptionsList.less";
|
|
57
56
|
@import "./nudge/Nudge.less";
|
|
@@ -38,6 +38,14 @@
|
|
|
38
38
|
flex-shrink: 0;
|
|
39
39
|
width: auto;
|
|
40
40
|
}
|
|
41
|
+
.tw-money-input .input-group-addon:not(.amount-currency-select-btn):not(.tw-money-input__fixed-currency):not(:has(~ .tw-money-input__fixed-currency)) {
|
|
42
|
+
padding-right: 0 !important;
|
|
43
|
+
}
|
|
44
|
+
[dir="rtl"] .tw-money-input .input-group-addon:not(.amount-currency-select-btn):not(.tw-money-input__fixed-currency):not(:has(~ .tw-money-input__fixed-currency)) {
|
|
45
|
+
padding-left: 0 !important;
|
|
46
|
+
padding-right: 0 !important;
|
|
47
|
+
padding-right: initial !important;
|
|
48
|
+
}
|
|
41
49
|
.tw-money-input .amount-currency-select-btn {
|
|
42
50
|
flex-shrink: 0;
|
|
43
51
|
width: auto;
|
|
@@ -32,11 +32,16 @@
|
|
|
32
32
|
|
|
33
33
|
.input-group-addon {
|
|
34
34
|
flex-shrink: 0;
|
|
35
|
+
|
|
35
36
|
&:not(.amount-currency-select-btn) {
|
|
36
37
|
display: flex;
|
|
37
38
|
align-items: center;
|
|
38
39
|
flex-shrink: 0;
|
|
39
40
|
width: auto;
|
|
41
|
+
|
|
42
|
+
&:not(.tw-money-input__fixed-currency):not(:has(~ .tw-money-input__fixed-currency)) {
|
|
43
|
+
.padding(right, 0) !important;
|
|
44
|
+
}
|
|
40
45
|
}
|
|
41
46
|
}
|
|
42
47
|
|
|
@@ -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:
|
|
95
|
-
color: var(--color-
|
|
94
|
+
background-color: var(--color-sentiment-positive-secondary);
|
|
95
|
+
color: var(--color-sentiment-positive-primary);
|
|
96
96
|
}
|
|
97
97
|
.wds-inline-prompt--proposition a,
|
|
98
98
|
.wds-inline-prompt--proposition button {
|
|
99
|
-
color: var(--color-
|
|
99
|
+
color: var(--color-sentiment-positive-primary);
|
|
100
100
|
}
|
|
101
101
|
.wds-inline-prompt--proposition a:hover,
|
|
102
102
|
.wds-inline-prompt--proposition button:hover {
|
|
103
|
-
color: var(--color-
|
|
103
|
+
color: var(--color-sentiment-positive-primary-hover);
|
|
104
104
|
}
|
|
105
105
|
.wds-inline-prompt--proposition a:active,
|
|
106
106
|
.wds-inline-prompt--proposition button:active {
|
|
107
|
-
color: var(--color-
|
|
107
|
+
color: var(--color-sentiment-positive-primary-active);
|
|
108
108
|
}
|
|
109
109
|
.wds-inline-prompt.wds-inline-prompt--proposition:has(a, button):hover {
|
|
110
|
-
background-color:
|
|
110
|
+
background-color: var(--color-sentiment-positive-secondary-hover);
|
|
111
111
|
}
|
|
112
112
|
.wds-inline-prompt.wds-inline-prompt--proposition:has(a, button):active {
|
|
113
|
-
background-color:
|
|
113
|
+
background-color: var(--color-sentiment-positive-secondary-active);
|
|
114
114
|
}
|
|
115
115
|
.wds-inline-prompt--neutral {
|
|
116
116
|
background-color: rgba(134,167,189,0.10196);
|
|
@@ -94,26 +94,26 @@
|
|
|
94
94
|
}
|
|
95
95
|
|
|
96
96
|
&--proposition {
|
|
97
|
-
background-color:
|
|
97
|
+
background-color: var(--color-sentiment-positive-secondary);
|
|
98
98
|
|
|
99
|
-
color: var(--color-
|
|
99
|
+
color: var(--color-sentiment-positive-primary);
|
|
100
100
|
|
|
101
101
|
a, button {
|
|
102
|
-
color: var(--color-
|
|
102
|
+
color: var(--color-sentiment-positive-primary);
|
|
103
103
|
&:hover {
|
|
104
|
-
color: var(--color-
|
|
104
|
+
color: var(--color-sentiment-positive-primary-hover);
|
|
105
105
|
}
|
|
106
106
|
&:active {
|
|
107
|
-
color: var(--color-
|
|
107
|
+
color: var(--color-sentiment-positive-primary-active);
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
110
|
|
|
111
111
|
.wds-inline-prompt&:has(a, button) {
|
|
112
112
|
&:hover {
|
|
113
|
-
background-color:
|
|
113
|
+
background-color: var(--color-sentiment-positive-secondary-hover);
|
|
114
114
|
}
|
|
115
115
|
&:active {
|
|
116
|
-
background-color:
|
|
116
|
+
background-color: var(--color-sentiment-positive-secondary-active);
|
|
117
117
|
}
|
|
118
118
|
}
|
|
119
119
|
}
|
|
@@ -15,12 +15,6 @@ describe('InlinePrompt', () => {
|
|
|
15
15
|
expect(screen.getByText('Hello world')).toBeInTheDocument();
|
|
16
16
|
});
|
|
17
17
|
|
|
18
|
-
it('renders with GiftBox icon as default for `proposition` sentiment', () => {
|
|
19
|
-
render(<InlinePrompt {...defaultProps} sentiment="proposition" />);
|
|
20
|
-
expect(screen.getByText('Prompt message')).toBeInTheDocument();
|
|
21
|
-
expect(screen.getByTestId('gift-box-icon')).toBeInTheDocument();
|
|
22
|
-
});
|
|
23
|
-
|
|
24
18
|
describe('renders with each sentiment', () => {
|
|
25
19
|
it.each([Sentiment.POSITIVE, Sentiment.NEUTRAL, Sentiment.NEGATIVE, Sentiment.WARNING])(
|
|
26
20
|
'renders with sentiment %s',
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import { Sentiment } from '../../common';
|
|
2
|
-
import { BackslashCircle
|
|
2
|
+
import { BackslashCircle } from '@transferwise/icons';
|
|
3
3
|
import ProcessIndicator from '../../processIndicator';
|
|
4
4
|
import StatusIcon from '../../statusIcon';
|
|
5
5
|
import { clsx } from 'clsx';
|
|
6
6
|
import Body from '../../body';
|
|
7
7
|
|
|
8
8
|
export type InlinePromptProps = {
|
|
9
|
-
sentiment?:
|
|
10
|
-
| `${Sentiment.POSITIVE | Sentiment.NEGATIVE | Sentiment.NEUTRAL | Sentiment.WARNING}`
|
|
11
|
-
| 'proposition';
|
|
9
|
+
sentiment?: `${Sentiment.POSITIVE | Sentiment.NEGATIVE | Sentiment.NEUTRAL | Sentiment.WARNING}`;
|
|
12
10
|
loading?: boolean;
|
|
13
11
|
/**
|
|
14
12
|
* 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)
|
|
@@ -18,7 +16,6 @@ export type InlinePromptProps = {
|
|
|
18
16
|
className?: string;
|
|
19
17
|
'data-testid'?: string;
|
|
20
18
|
children: React.ReactNode;
|
|
21
|
-
media?: React.ReactNode;
|
|
22
19
|
};
|
|
23
20
|
|
|
24
21
|
export const InlinePrompt = ({
|
|
@@ -27,16 +24,9 @@ export const InlinePrompt = ({
|
|
|
27
24
|
loading = false,
|
|
28
25
|
className,
|
|
29
26
|
children,
|
|
30
|
-
media = null,
|
|
31
27
|
...rest
|
|
32
28
|
}: InlinePromptProps) => {
|
|
33
29
|
const renderMedia = () => {
|
|
34
|
-
if (media && ['proposition', 'positive'].includes(sentiment)) {
|
|
35
|
-
return media;
|
|
36
|
-
}
|
|
37
|
-
if (sentiment === 'proposition') {
|
|
38
|
-
return <GiftBox />;
|
|
39
|
-
}
|
|
40
30
|
if (muted) {
|
|
41
31
|
return <BackslashCircle size={16} data-testid="InlinePrompt_Muted" />;
|
|
42
32
|
}
|
package/src/ssr.spec.tsx
CHANGED
|
@@ -92,7 +92,6 @@ describe('Server side rendering', () => {
|
|
|
92
92
|
// stick all possible properties we might need to render all components in here
|
|
93
93
|
const allProps: Record<string, unknown> = {
|
|
94
94
|
currencies: [],
|
|
95
|
-
currencySelector: { options: [] },
|
|
96
95
|
steps: [],
|
|
97
96
|
stepper: {
|
|
98
97
|
steps: [],
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var Body = require('../body/Body.js');
|
|
6
|
-
var Label = require('../label/Label.js');
|
|
7
|
-
var clsx = require('clsx');
|
|
8
|
-
var framerMotion = require('framer-motion');
|
|
9
|
-
var React = require('react');
|
|
10
|
-
var CurrencySelector = require('./currencySelector/CurrencySelector.js');
|
|
11
|
-
var AmountInput = require('./amountInput/AmountInput.js');
|
|
12
|
-
var Chevron = require('./chevron/Chevron.js');
|
|
13
|
-
var InlinePrompt = require('../prompt/InlinePrompt/InlinePrompt.js');
|
|
14
|
-
var jsxRuntime = require('react/jsx-runtime');
|
|
15
|
-
|
|
16
|
-
function ExpressiveMoneyInput({
|
|
17
|
-
label,
|
|
18
|
-
currency,
|
|
19
|
-
currencySelector = {
|
|
20
|
-
options: []
|
|
21
|
-
},
|
|
22
|
-
amount,
|
|
23
|
-
onAmountChange,
|
|
24
|
-
className,
|
|
25
|
-
inlinePrompt,
|
|
26
|
-
showChevron,
|
|
27
|
-
autoFocus,
|
|
28
|
-
loading,
|
|
29
|
-
onFocusChange
|
|
30
|
-
}) {
|
|
31
|
-
const inputId = React.useId();
|
|
32
|
-
const labelId = React.useId();
|
|
33
|
-
const customAlertId = React.useId();
|
|
34
|
-
const currencyId = React.useId();
|
|
35
|
-
const selector = currencySelector.customRender?.({
|
|
36
|
-
id: currencyId,
|
|
37
|
-
labelId
|
|
38
|
-
}) ?? /*#__PURE__*/jsxRuntime.jsx(CurrencySelector.CurrencySelector, {
|
|
39
|
-
id: currencyId,
|
|
40
|
-
labelId: labelId,
|
|
41
|
-
currency: currency,
|
|
42
|
-
...currencySelector
|
|
43
|
-
});
|
|
44
|
-
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
45
|
-
className: clsx.clsx('wds-expressive-money-input', className),
|
|
46
|
-
children: [/*#__PURE__*/jsxRuntime.jsx(Label.Label, {
|
|
47
|
-
id: labelId,
|
|
48
|
-
htmlFor: inputId,
|
|
49
|
-
className: clsx.clsx('m-b-1', 'font-weight-normal'),
|
|
50
|
-
children: label
|
|
51
|
-
}), /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
52
|
-
className: clsx.clsx('d-flex'),
|
|
53
|
-
role: "group",
|
|
54
|
-
"aria-labelledby": labelId,
|
|
55
|
-
...(inlinePrompt ? {
|
|
56
|
-
'aria-describedby': customAlertId
|
|
57
|
-
} : {}),
|
|
58
|
-
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
59
|
-
className: "wds-expressive-money-input-currency-selector",
|
|
60
|
-
children: selector
|
|
61
|
-
}), /*#__PURE__*/jsxRuntime.jsx(AmountInput.AmountInput, {
|
|
62
|
-
id: inputId,
|
|
63
|
-
describedById: currencyId,
|
|
64
|
-
amount: amount,
|
|
65
|
-
currency: currency
|
|
66
|
-
// eslint-disable-next-line jsx-a11y/no-autofocus
|
|
67
|
-
,
|
|
68
|
-
autoFocus: autoFocus,
|
|
69
|
-
loading: loading,
|
|
70
|
-
onChange: onAmountChange,
|
|
71
|
-
onFocusChange: onFocusChange
|
|
72
|
-
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
73
|
-
className: clsx.clsx('d-flex align-items-center', 'wds-expressive-money-input-chevron'),
|
|
74
|
-
children: /*#__PURE__*/jsxRuntime.jsx(Chevron.Chevron, {
|
|
75
|
-
shouldShow: Boolean(showChevron)
|
|
76
|
-
})
|
|
77
|
-
})]
|
|
78
|
-
}), /*#__PURE__*/jsxRuntime.jsx(framerMotion.AnimatePresence, {
|
|
79
|
-
initial: false,
|
|
80
|
-
children: inlinePrompt && /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
81
|
-
className: clsx.clsx('d-flex justify-content-end', inlinePrompt && 'm-t-1'),
|
|
82
|
-
children: /*#__PURE__*/jsxRuntime.jsx(framerMotion.motion.div, {
|
|
83
|
-
initial: {
|
|
84
|
-
opacity: 0,
|
|
85
|
-
height: 0
|
|
86
|
-
},
|
|
87
|
-
animate: {
|
|
88
|
-
opacity: 1,
|
|
89
|
-
height: 'auto',
|
|
90
|
-
transition: {
|
|
91
|
-
delay: 0.75,
|
|
92
|
-
duration: 0.3
|
|
93
|
-
}
|
|
94
|
-
},
|
|
95
|
-
exit: {
|
|
96
|
-
opacity: 0,
|
|
97
|
-
height: 0
|
|
98
|
-
},
|
|
99
|
-
children: inlinePrompt.sentiment ? /*#__PURE__*/jsxRuntime.jsx(InlinePrompt.InlinePrompt, {
|
|
100
|
-
id: customAlertId,
|
|
101
|
-
media: inlinePrompt.media,
|
|
102
|
-
sentiment: inlinePrompt.sentiment,
|
|
103
|
-
children: inlinePrompt.message
|
|
104
|
-
}) : /*#__PURE__*/jsxRuntime.jsx(Body.default, {
|
|
105
|
-
children: inlinePrompt.message
|
|
106
|
-
})
|
|
107
|
-
}, customAlertId)
|
|
108
|
-
})
|
|
109
|
-
})]
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
exports.default = ExpressiveMoneyInput;
|
|
114
|
-
//# sourceMappingURL=ExpressiveMoneyInput.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ExpressiveMoneyInput.js","sources":["../../src/expressiveMoneyInput/ExpressiveMoneyInput.tsx"],"sourcesContent":["import Body from '../body';\nimport { Label } from '../label/Label';\nimport { clsx } from 'clsx';\nimport { AnimatePresence, motion } from 'framer-motion';\nimport { useId, type ReactNode } from 'react';\n\nimport {\n type Props as CurrencySelectorProps,\n CurrencySelector,\n} from './currencySelector/CurrencySelector';\nimport { CommonProps } from '../common';\nimport { AmountInput } from './amountInput/AmountInput';\nimport { Chevron } from './chevron/Chevron';\nimport { InlinePrompt, type InlinePromptProps } from '../prompt/InlinePrompt';\n\ntype AmountType = number | null;\nexport type CurrencyType = string;\n\ntype DefaultCurrencySelectorInstanceType = Pick<\n CurrencySelectorProps,\n 'addons' | 'options' | 'onChange' | 'onOpen' | 'onSearchChange'\n>;\ntype CustomCurrencySelectorInstanceType = {\n customRender?: (props: { id: string; labelId: string }) => ReactNode;\n};\ntype CurrencySelectorType = DefaultCurrencySelectorInstanceType &\n CustomCurrencySelectorInstanceType;\n\nexport type Props = {\n label?: ReactNode;\n currencySelector?: CurrencySelectorType;\n amount?: AmountType;\n currency: CurrencyType;\n inlinePrompt?: {\n sentiment?: InlinePromptProps['sentiment'];\n message: InlinePromptProps['children'];\n media?: InlinePromptProps['media'];\n };\n showChevron?: boolean;\n autoFocus?: boolean;\n loading?: boolean;\n onAmountChange: (amount: AmountType) => void;\n onFocusChange?: (focused: boolean) => void;\n} & CommonProps;\n\nexport default function ExpressiveMoneyInput({\n label,\n currency,\n currencySelector = { options: [] } as DefaultCurrencySelectorInstanceType,\n amount,\n onAmountChange,\n className,\n inlinePrompt,\n showChevron,\n autoFocus,\n loading,\n onFocusChange,\n}: Props) {\n const inputId = useId();\n const labelId = useId();\n const customAlertId = useId();\n const currencyId = useId();\n\n const selector = currencySelector.customRender?.({ id: currencyId, labelId }) ?? (\n <CurrencySelector id={currencyId} labelId={labelId} currency={currency} {...currencySelector} />\n );\n\n return (\n <div className={clsx('wds-expressive-money-input', className)}>\n <Label id={labelId} htmlFor={inputId} className={clsx('m-b-1', 'font-weight-normal')}>\n {label}\n </Label>\n <div\n className={clsx('d-flex')}\n role=\"group\"\n aria-labelledby={labelId}\n {...(inlinePrompt ? { 'aria-describedby': customAlertId } : {})}\n >\n <div className=\"wds-expressive-money-input-currency-selector\">{selector}</div>\n <AmountInput\n id={inputId}\n describedById={currencyId}\n amount={amount}\n currency={currency}\n // eslint-disable-next-line jsx-a11y/no-autofocus\n autoFocus={autoFocus}\n loading={loading}\n onChange={onAmountChange}\n onFocusChange={onFocusChange}\n />\n <div className={clsx('d-flex align-items-center', 'wds-expressive-money-input-chevron')}>\n <Chevron shouldShow={Boolean(showChevron)} />\n </div>\n </div>\n <AnimatePresence initial={false}>\n {inlinePrompt && (\n <div className={clsx('d-flex justify-content-end', inlinePrompt && 'm-t-1')}>\n <motion.div\n key={customAlertId}\n initial={{ opacity: 0, height: 0 }}\n animate={{\n opacity: 1,\n height: 'auto',\n transition: { delay: 0.75, duration: 0.3 },\n }}\n exit={{ opacity: 0, height: 0 }}\n >\n {inlinePrompt.sentiment ? (\n <InlinePrompt\n id={customAlertId}\n media={inlinePrompt.media}\n sentiment={inlinePrompt.sentiment}\n >\n {inlinePrompt.message}\n </InlinePrompt>\n ) : (\n <Body>{inlinePrompt.message}</Body>\n )}\n </motion.div>\n </div>\n )}\n </AnimatePresence>\n </div>\n );\n}\n"],"names":["ExpressiveMoneyInput","label","currency","currencySelector","options","amount","onAmountChange","className","inlinePrompt","showChevron","autoFocus","loading","onFocusChange","inputId","useId","labelId","customAlertId","currencyId","selector","customRender","id","_jsx","CurrencySelector","_jsxs","clsx","children","Label","htmlFor","role","AmountInput","describedById","onChange","Chevron","shouldShow","Boolean","AnimatePresence","initial","motion","div","opacity","height","animate","transition","delay","duration","exit","sentiment","InlinePrompt","media","message","Body"],"mappings":";;;;;;;;;;;;;;;AA6Cc,SAAUA,oBAAoBA,CAAC;EAC3CC,KAAK;EACLC,QAAQ;AACRC,EAAAA,gBAAgB,GAAG;AAAEC,IAAAA,OAAO,EAAE;GAA2C;EACzEC,MAAM;EACNC,cAAc;EACdC,SAAS;EACTC,YAAY;EACZC,WAAW;EACXC,SAAS;EACTC,OAAO;AACPC,EAAAA;AAAa,CACP,EAAA;AACN,EAAA,MAAMC,OAAO,GAAGC,WAAK,EAAE;AACvB,EAAA,MAAMC,OAAO,GAAGD,WAAK,EAAE;AACvB,EAAA,MAAME,aAAa,GAAGF,WAAK,EAAE;AAC7B,EAAA,MAAMG,UAAU,GAAGH,WAAK,EAAE;AAE1B,EAAA,MAAMI,QAAQ,GAAGf,gBAAgB,CAACgB,YAAY,GAAG;AAAEC,IAAAA,EAAE,EAAEH,UAAU;AAAEF,IAAAA;AAAO,GAAE,CAAC,iBAC3EM,cAAA,CAACC,iCAAgB,EAAA;AAACF,IAAAA,EAAE,EAAEH,UAAW;AAACF,IAAAA,OAAO,EAAEA,OAAQ;AAACb,IAAAA,QAAQ,EAAEA,QAAS;IAAA,GAAKC;AAAgB,GAAC,CAC9F;AAED,EAAA,oBACEoB,eAAA,CAAA,KAAA,EAAA;AAAKhB,IAAAA,SAAS,EAAEiB,SAAI,CAAC,4BAA4B,EAAEjB,SAAS,CAAE;IAAAkB,QAAA,EAAA,cAC5DJ,cAAA,CAACK,WAAK,EAAA;AAACN,MAAAA,EAAE,EAAEL,OAAQ;AAACY,MAAAA,OAAO,EAAEd,OAAQ;AAACN,MAAAA,SAAS,EAAEiB,SAAI,CAAC,OAAO,EAAE,oBAAoB,CAAE;AAAAC,MAAAA,QAAA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O,EAAE;AAAEG,YAAAA,OAAO,EAAE,CAAC;AAAEC,YAAAA,MAAM,EAAE;WAAI;AACnCC,UAAAA,OAAO,EAAE;AACPF,YAAAA,OAAO,EAAE,CAAC;AACVC,YAAAA,MAAM,EAAE,MAAM;AACdE,YAAAA,UAAU,EAAE;AAAEC,cAAAA,KAAK,EAAE,IAAI;AAAEC,cAAAA,QAAQ,EAAE;AAAG;WACxC;AACFC,UAAAA,IAAI,EAAE;AAAEN,YAAAA,OAAO,EAAE,CAAC;AAAEC,YAAAA,MAAM,EAAE;WAAI;AAAAf,UAAAA,QAAA,EAE/BjB,YAAY,CAACsC,SAAS,gBACrBzB,cAAA,CAAC0B,yBAAY,EAAA;AACX3B,YAAAA,EAAE,EAAEJ,aAAc;YAClBgC,KAAK,EAAExC,YAAY,CAACwC,KAAM;YAC1BF,SAAS,EAAEtC,YAAY,CAACsC,SAAU;YAAArB,QAAA,EAEjCjB,YAAY,CAACyC;AAAO,WACT,CAAC,gBAEf5B,cAAA,CAAC6B,YAAI,EAAA;YAAAzB,QAAA,EAAEjB,YAAY,CAACyC;WAAc;AACnC,SAAA,EAnBIjC,aAoBK;OACT;AACN,KACc,CACnB;AAAA,GAAK,CAAC;AAEV;;;;"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var reactIntl = require('react-intl');
|
|
6
|
-
|
|
7
|
-
var messages = reactIntl.defineMessages({
|
|
8
|
-
currencySelectorSearchPlaceholder: {
|
|
9
|
-
id: "neptune.ExpressiveMoneyInput.currency.search.placeholder"
|
|
10
|
-
},
|
|
11
|
-
currencySelectorSelectCurrency: {
|
|
12
|
-
id: "neptune.ExpressiveMoneyInput.currency.select.currency"
|
|
13
|
-
}
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
exports.default = messages;
|
|
17
|
-
//# sourceMappingURL=ExpressiveMoneyInput.messages.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ExpressiveMoneyInput.messages.js","sources":["../../src/expressiveMoneyInput/ExpressiveMoneyInput.messages.ts"],"sourcesContent":["import { defineMessages } from 'react-intl';\n\nexport default defineMessages({\n currencySelectorSearchPlaceholder: {\n id: 'neptune.ExpressiveMoneyInput.currency.search.placeholder',\n defaultMessage: 'Type a currency / country',\n },\n\n currencySelectorSelectCurrency: {\n id: 'neptune.ExpressiveMoneyInput.currency.select.currency',\n defaultMessage: 'Select currency',\n },\n});\n"],"names":["defineMessages","currencySelectorSearchPlaceholder","id","currencySelectorSelectCurrency"],"mappings":";;;;;;AAEA,eAAeA,wBAAc,CAAC;AAC5BC,EAAAA,iCAAiC,EAAE;IACjCC,EAAE,EAAA;GAEH;AAEDC,EAAAA,8BAA8B,EAAE;IAC9BD,EAAE,EAAA;AAEH;AACF,CAAA,CAAC;;;;"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { defineMessages } from 'react-intl';
|
|
2
|
-
|
|
3
|
-
var messages = defineMessages({
|
|
4
|
-
currencySelectorSearchPlaceholder: {
|
|
5
|
-
id: "neptune.ExpressiveMoneyInput.currency.search.placeholder"
|
|
6
|
-
},
|
|
7
|
-
currencySelectorSelectCurrency: {
|
|
8
|
-
id: "neptune.ExpressiveMoneyInput.currency.select.currency"
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
export { messages as default };
|
|
13
|
-
//# sourceMappingURL=ExpressiveMoneyInput.messages.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ExpressiveMoneyInput.messages.mjs","sources":["../../src/expressiveMoneyInput/ExpressiveMoneyInput.messages.ts"],"sourcesContent":["import { defineMessages } from 'react-intl';\n\nexport default defineMessages({\n currencySelectorSearchPlaceholder: {\n id: 'neptune.ExpressiveMoneyInput.currency.search.placeholder',\n defaultMessage: 'Type a currency / country',\n },\n\n currencySelectorSelectCurrency: {\n id: 'neptune.ExpressiveMoneyInput.currency.select.currency',\n defaultMessage: 'Select currency',\n },\n});\n"],"names":["defineMessages","currencySelectorSearchPlaceholder","id","currencySelectorSelectCurrency"],"mappings":";;AAEA,eAAeA,cAAc,CAAC;AAC5BC,EAAAA,iCAAiC,EAAE;IACjCC,EAAE,EAAA;GAEH;AAEDC,EAAAA,8BAA8B,EAAE;IAC9BD,EAAE,EAAA;AAEH;AACF,CAAA,CAAC;;;;"}
|
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
import Body from '../body/Body.mjs';
|
|
2
|
-
import { Label as LabelNamespace } from '../label/Label.mjs';
|
|
3
|
-
import { clsx } from 'clsx';
|
|
4
|
-
import { AnimatePresence, motion } from 'framer-motion';
|
|
5
|
-
import { useId } from 'react';
|
|
6
|
-
import { CurrencySelector } from './currencySelector/CurrencySelector.mjs';
|
|
7
|
-
import { AmountInput } from './amountInput/AmountInput.mjs';
|
|
8
|
-
import { Chevron } from './chevron/Chevron.mjs';
|
|
9
|
-
import { InlinePrompt } from '../prompt/InlinePrompt/InlinePrompt.mjs';
|
|
10
|
-
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
11
|
-
|
|
12
|
-
function ExpressiveMoneyInput({
|
|
13
|
-
label,
|
|
14
|
-
currency,
|
|
15
|
-
currencySelector = {
|
|
16
|
-
options: []
|
|
17
|
-
},
|
|
18
|
-
amount,
|
|
19
|
-
onAmountChange,
|
|
20
|
-
className,
|
|
21
|
-
inlinePrompt,
|
|
22
|
-
showChevron,
|
|
23
|
-
autoFocus,
|
|
24
|
-
loading,
|
|
25
|
-
onFocusChange
|
|
26
|
-
}) {
|
|
27
|
-
const inputId = useId();
|
|
28
|
-
const labelId = useId();
|
|
29
|
-
const customAlertId = useId();
|
|
30
|
-
const currencyId = useId();
|
|
31
|
-
const selector = currencySelector.customRender?.({
|
|
32
|
-
id: currencyId,
|
|
33
|
-
labelId
|
|
34
|
-
}) ?? /*#__PURE__*/jsx(CurrencySelector, {
|
|
35
|
-
id: currencyId,
|
|
36
|
-
labelId: labelId,
|
|
37
|
-
currency: currency,
|
|
38
|
-
...currencySelector
|
|
39
|
-
});
|
|
40
|
-
return /*#__PURE__*/jsxs("div", {
|
|
41
|
-
className: clsx('wds-expressive-money-input', className),
|
|
42
|
-
children: [/*#__PURE__*/jsx(LabelNamespace, {
|
|
43
|
-
id: labelId,
|
|
44
|
-
htmlFor: inputId,
|
|
45
|
-
className: clsx('m-b-1', 'font-weight-normal'),
|
|
46
|
-
children: label
|
|
47
|
-
}), /*#__PURE__*/jsxs("div", {
|
|
48
|
-
className: clsx('d-flex'),
|
|
49
|
-
role: "group",
|
|
50
|
-
"aria-labelledby": labelId,
|
|
51
|
-
...(inlinePrompt ? {
|
|
52
|
-
'aria-describedby': customAlertId
|
|
53
|
-
} : {}),
|
|
54
|
-
children: [/*#__PURE__*/jsx("div", {
|
|
55
|
-
className: "wds-expressive-money-input-currency-selector",
|
|
56
|
-
children: selector
|
|
57
|
-
}), /*#__PURE__*/jsx(AmountInput, {
|
|
58
|
-
id: inputId,
|
|
59
|
-
describedById: currencyId,
|
|
60
|
-
amount: amount,
|
|
61
|
-
currency: currency
|
|
62
|
-
// eslint-disable-next-line jsx-a11y/no-autofocus
|
|
63
|
-
,
|
|
64
|
-
autoFocus: autoFocus,
|
|
65
|
-
loading: loading,
|
|
66
|
-
onChange: onAmountChange,
|
|
67
|
-
onFocusChange: onFocusChange
|
|
68
|
-
}), /*#__PURE__*/jsx("div", {
|
|
69
|
-
className: clsx('d-flex align-items-center', 'wds-expressive-money-input-chevron'),
|
|
70
|
-
children: /*#__PURE__*/jsx(Chevron, {
|
|
71
|
-
shouldShow: Boolean(showChevron)
|
|
72
|
-
})
|
|
73
|
-
})]
|
|
74
|
-
}), /*#__PURE__*/jsx(AnimatePresence, {
|
|
75
|
-
initial: false,
|
|
76
|
-
children: inlinePrompt && /*#__PURE__*/jsx("div", {
|
|
77
|
-
className: clsx('d-flex justify-content-end', inlinePrompt && 'm-t-1'),
|
|
78
|
-
children: /*#__PURE__*/jsx(motion.div, {
|
|
79
|
-
initial: {
|
|
80
|
-
opacity: 0,
|
|
81
|
-
height: 0
|
|
82
|
-
},
|
|
83
|
-
animate: {
|
|
84
|
-
opacity: 1,
|
|
85
|
-
height: 'auto',
|
|
86
|
-
transition: {
|
|
87
|
-
delay: 0.75,
|
|
88
|
-
duration: 0.3
|
|
89
|
-
}
|
|
90
|
-
},
|
|
91
|
-
exit: {
|
|
92
|
-
opacity: 0,
|
|
93
|
-
height: 0
|
|
94
|
-
},
|
|
95
|
-
children: inlinePrompt.sentiment ? /*#__PURE__*/jsx(InlinePrompt, {
|
|
96
|
-
id: customAlertId,
|
|
97
|
-
media: inlinePrompt.media,
|
|
98
|
-
sentiment: inlinePrompt.sentiment,
|
|
99
|
-
children: inlinePrompt.message
|
|
100
|
-
}) : /*#__PURE__*/jsx(Body, {
|
|
101
|
-
children: inlinePrompt.message
|
|
102
|
-
})
|
|
103
|
-
}, customAlertId)
|
|
104
|
-
})
|
|
105
|
-
})]
|
|
106
|
-
});
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
export { ExpressiveMoneyInput as default };
|
|
110
|
-
//# sourceMappingURL=ExpressiveMoneyInput.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ExpressiveMoneyInput.mjs","sources":["../../src/expressiveMoneyInput/ExpressiveMoneyInput.tsx"],"sourcesContent":["import Body from '../body';\nimport { Label } from '../label/Label';\nimport { clsx } from 'clsx';\nimport { AnimatePresence, motion } from 'framer-motion';\nimport { useId, type ReactNode } from 'react';\n\nimport {\n type Props as CurrencySelectorProps,\n CurrencySelector,\n} from './currencySelector/CurrencySelector';\nimport { CommonProps } from '../common';\nimport { AmountInput } from './amountInput/AmountInput';\nimport { Chevron } from './chevron/Chevron';\nimport { InlinePrompt, type InlinePromptProps } from '../prompt/InlinePrompt';\n\ntype AmountType = number | null;\nexport type CurrencyType = string;\n\ntype DefaultCurrencySelectorInstanceType = Pick<\n CurrencySelectorProps,\n 'addons' | 'options' | 'onChange' | 'onOpen' | 'onSearchChange'\n>;\ntype CustomCurrencySelectorInstanceType = {\n customRender?: (props: { id: string; labelId: string }) => ReactNode;\n};\ntype CurrencySelectorType = DefaultCurrencySelectorInstanceType &\n CustomCurrencySelectorInstanceType;\n\nexport type Props = {\n label?: ReactNode;\n currencySelector?: CurrencySelectorType;\n amount?: AmountType;\n currency: CurrencyType;\n inlinePrompt?: {\n sentiment?: InlinePromptProps['sentiment'];\n message: InlinePromptProps['children'];\n media?: InlinePromptProps['media'];\n };\n showChevron?: boolean;\n autoFocus?: boolean;\n loading?: boolean;\n onAmountChange: (amount: AmountType) => void;\n onFocusChange?: (focused: boolean) => void;\n} & CommonProps;\n\nexport default function ExpressiveMoneyInput({\n label,\n currency,\n currencySelector = { options: [] } as DefaultCurrencySelectorInstanceType,\n amount,\n onAmountChange,\n className,\n inlinePrompt,\n showChevron,\n autoFocus,\n loading,\n onFocusChange,\n}: Props) {\n const inputId = useId();\n const labelId = useId();\n const customAlertId = useId();\n const currencyId = useId();\n\n const selector = currencySelector.customRender?.({ id: currencyId, labelId }) ?? (\n <CurrencySelector id={currencyId} labelId={labelId} currency={currency} {...currencySelector} />\n );\n\n return (\n <div className={clsx('wds-expressive-money-input', className)}>\n <Label id={labelId} htmlFor={inputId} className={clsx('m-b-1', 'font-weight-normal')}>\n {label}\n </Label>\n <div\n className={clsx('d-flex')}\n role=\"group\"\n aria-labelledby={labelId}\n {...(inlinePrompt ? { 'aria-describedby': customAlertId } : {})}\n >\n <div className=\"wds-expressive-money-input-currency-selector\">{selector}</div>\n <AmountInput\n id={inputId}\n describedById={currencyId}\n amount={amount}\n currency={currency}\n // eslint-disable-next-line jsx-a11y/no-autofocus\n autoFocus={autoFocus}\n loading={loading}\n onChange={onAmountChange}\n onFocusChange={onFocusChange}\n />\n <div className={clsx('d-flex align-items-center', 'wds-expressive-money-input-chevron')}>\n <Chevron shouldShow={Boolean(showChevron)} />\n </div>\n </div>\n <AnimatePresence initial={false}>\n {inlinePrompt && (\n <div className={clsx('d-flex justify-content-end', inlinePrompt && 'm-t-1')}>\n <motion.div\n key={customAlertId}\n initial={{ opacity: 0, height: 0 }}\n animate={{\n opacity: 1,\n height: 'auto',\n transition: { delay: 0.75, duration: 0.3 },\n }}\n exit={{ opacity: 0, height: 0 }}\n >\n {inlinePrompt.sentiment ? (\n <InlinePrompt\n id={customAlertId}\n media={inlinePrompt.media}\n sentiment={inlinePrompt.sentiment}\n >\n {inlinePrompt.message}\n </InlinePrompt>\n ) : (\n <Body>{inlinePrompt.message}</Body>\n )}\n </motion.div>\n </div>\n )}\n </AnimatePresence>\n </div>\n );\n}\n"],"names":["ExpressiveMoneyInput","label","currency","currencySelector","options","amount","onAmountChange","className","inlinePrompt","showChevron","autoFocus","loading","onFocusChange","inputId","useId","labelId","customAlertId","currencyId","selector","customRender","id","_jsx","CurrencySelector","_jsxs","clsx","children","Label","htmlFor","role","AmountInput","describedById","onChange","Chevron","shouldShow","Boolean","AnimatePresence","initial","motion","div","opacity","height","animate","transition","delay","duration","exit","sentiment","InlinePrompt","media","message","Body"],"mappings":";;;;;;;;;;;AA6Cc,SAAUA,oBAAoBA,CAAC;EAC3CC,KAAK;EACLC,QAAQ;AACRC,EAAAA,gBAAgB,GAAG;AAAEC,IAAAA,OAAO,EAAE;GAA2C;EACzEC,MAAM;EACNC,cAAc;EACdC,SAAS;EACTC,YAAY;EACZC,WAAW;EACXC,SAAS;EACTC,OAAO;AACPC,EAAAA;AAAa,CACP,EAAA;AACN,EAAA,MAAMC,OAAO,GAAGC,KAAK,EAAE;AACvB,EAAA,MAAMC,OAAO,GAAGD,KAAK,EAAE;AACvB,EAAA,MAAME,aAAa,GAAGF,KAAK,EAAE;AAC7B,EAAA,MAAMG,UAAU,GAAGH,KAAK,EAAE;AAE1B,EAAA,MAAMI,QAAQ,GAAGf,gBAAgB,CAACgB,YAAY,GAAG;AAAEC,IAAA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