@transferwise/components 46.160.4 → 46.160.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/ExpressiveMoneyInput/AmountInput/AmountInput.js +2 -0
- package/build/ExpressiveMoneyInput/AmountInput/AmountInput.js.map +1 -1
- package/build/ExpressiveMoneyInput/AmountInput/AmountInput.mjs +2 -0
- package/build/ExpressiveMoneyInput/AmountInput/AmountInput.mjs.map +1 -1
- package/build/ExpressiveMoneyInput/hooks/useInputStyle.js +1 -1
- package/build/ExpressiveMoneyInput/hooks/useInputStyle.js.map +1 -1
- package/build/ExpressiveMoneyInput/hooks/useInputStyle.mjs +1 -1
- package/build/ExpressiveMoneyInput/hooks/useInputStyle.mjs.map +1 -1
- package/build/Inputs/Input/Input.js +1 -0
- package/build/Inputs/Input/Input.js.map +1 -1
- package/build/Inputs/Input/Input.mjs +1 -0
- package/build/Inputs/Input/Input.mjs.map +1 -1
- package/build/Inputs/TextArea/TextArea.js +1 -0
- package/build/Inputs/TextArea/TextArea.js.map +1 -1
- package/build/Inputs/TextArea/TextArea.mjs +1 -0
- package/build/Inputs/TextArea/TextArea.mjs.map +1 -1
- package/build/MoneyInput/MoneyInput.js +1 -0
- package/build/MoneyInput/MoneyInput.js.map +1 -1
- package/build/MoneyInput/MoneyInput.mjs +1 -0
- package/build/MoneyInput/MoneyInput.mjs.map +1 -1
- package/build/PhoneNumberInput/PhoneNumberInput.js +3 -2
- package/build/PhoneNumberInput/PhoneNumberInput.js.map +1 -1
- package/build/PhoneNumberInput/PhoneNumberInput.messages.js +3 -0
- package/build/PhoneNumberInput/PhoneNumberInput.messages.js.map +1 -1
- package/build/PhoneNumberInput/PhoneNumberInput.messages.mjs +3 -0
- package/build/PhoneNumberInput/PhoneNumberInput.messages.mjs.map +1 -1
- package/build/PhoneNumberInput/PhoneNumberInput.mjs +3 -2
- package/build/PhoneNumberInput/PhoneNumberInput.mjs.map +1 -1
- package/build/Typeahead/TypeaheadInput/TypeaheadInput.js +50 -20
- package/build/Typeahead/TypeaheadInput/TypeaheadInput.js.map +1 -1
- package/build/Typeahead/TypeaheadInput/TypeaheadInput.mjs +50 -20
- package/build/Typeahead/TypeaheadInput/TypeaheadInput.mjs.map +1 -1
- package/build/i18n/en.json +1 -0
- package/build/i18n/en.json.js +1 -0
- package/build/i18n/en.json.js.map +1 -1
- package/build/i18n/en.json.mjs +1 -0
- package/build/i18n/en.json.mjs.map +1 -1
- package/build/main.css +69 -1
- package/build/styles/ExpressiveMoneyInput/AmountInput/AmountInput.css +6 -0
- package/build/styles/ExpressiveMoneyInput/ExpressiveMoneyInput.css +6 -0
- package/build/styles/Inputs/Input/Input.css +19 -0
- package/build/styles/Inputs/TextArea/TextArea.css +16 -1
- package/build/styles/MoneyInput/MoneyInput.css +3 -0
- package/build/styles/PhoneNumberInput/PhoneNumberInput.css +7 -0
- package/build/styles/PocketSurface/PocketSurface.css +1 -0
- package/build/styles/SentimentSurface/SentimentSurface.css +5 -0
- package/build/styles/css/neptune.css +11 -0
- package/build/styles/main.css +69 -1
- package/build/styles/styles/less/neptune.css +11 -0
- package/build/types/ExpressiveMoneyInput/AmountInput/AmountInput.d.ts.map +1 -1
- package/build/types/ExpressiveMoneyInput/hooks/useInputStyle.d.ts.map +1 -1
- package/build/types/Inputs/Input/Input.d.ts.map +1 -1
- package/build/types/Inputs/TextArea/TextArea.d.ts.map +1 -1
- package/build/types/MoneyInput/MoneyInput.d.ts.map +1 -1
- package/build/types/PhoneNumberInput/PhoneNumberInput.d.ts.map +1 -1
- package/build/types/PhoneNumberInput/PhoneNumberInput.messages.d.ts +5 -0
- package/build/types/PhoneNumberInput/PhoneNumberInput.messages.d.ts.map +1 -1
- package/build/types/Typeahead/TypeaheadInput/TypeaheadInput.d.ts +1 -1
- package/build/types/Typeahead/TypeaheadInput/TypeaheadInput.d.ts.map +1 -1
- package/build/types/test-utils/index.d.ts +2 -0
- package/build/types/test-utils/index.d.ts.map +1 -1
- package/package.json +14 -14
- package/src/ExpressiveMoneyInput/AmountInput/AmountInput.css +6 -0
- package/src/ExpressiveMoneyInput/AmountInput/AmountInput.less +7 -0
- package/src/ExpressiveMoneyInput/AmountInput/AmountInput.tsx +2 -1
- package/src/ExpressiveMoneyInput/ExpressiveMoneyInput.css +6 -0
- package/src/ExpressiveMoneyInput/hooks/useInputStyle.ts +1 -2
- package/src/Field/_stories/Field.test.story.tsx +27 -0
- package/src/Inputs/Input/Input.css +19 -0
- package/src/Inputs/Input/Input.less +16 -0
- package/src/Inputs/Input/Input.tsx +1 -0
- package/src/Inputs/{_stories → InputGroup/_stories}/InputGroup.story.tsx +9 -9
- package/src/Inputs/InputGroup/_stories/InputGroup.test.story.tsx +80 -0
- package/src/Inputs/{_stories → SearchInput/_stories}/SearchInput.story.tsx +4 -4
- package/src/Inputs/SearchInput/_stories/SearchInput.test.story.tsx +38 -0
- package/src/Inputs/SelectInput/_stories/SelectInput.rtl.test.story.tsx +31 -19
- package/src/Inputs/TextArea/TextArea.css +16 -1
- package/src/Inputs/TextArea/TextArea.less +6 -1
- package/src/Inputs/TextArea/TextArea.tsx +1 -0
- package/src/Inputs/{_stories → TextArea/_stories}/TextArea.story.tsx +4 -4
- package/src/Inputs/{_stories → TextArea/_stories}/TextArea.test.story.tsx +50 -26
- package/src/MoneyInput/MoneyInput.css +3 -0
- package/src/MoneyInput/MoneyInput.less +6 -0
- package/src/MoneyInput/MoneyInput.tsx +1 -0
- package/src/MoneyInput/_stories/MoneyInput.rtl.test.story.tsx +14 -10
- package/src/PhoneNumberInput/PhoneNumberInput.css +7 -0
- package/src/PhoneNumberInput/PhoneNumberInput.less +13 -0
- package/src/PhoneNumberInput/PhoneNumberInput.messages.ts +5 -0
- package/src/PhoneNumberInput/PhoneNumberInput.tsx +3 -2
- package/src/PhoneNumberInput/_stories/PhoneNumberInput.rtl.test.story.tsx +15 -7
- package/src/PocketSurface/PocketSurface.css +1 -0
- package/src/Prompt/ActionPrompt/_stories/ActionPrompt.story.tsx +5 -1
- package/src/Prompt/InfoPrompt/_stories/InfoPrompt.story.tsx +12 -9
- package/src/Prompt/InlinePrompt/_stories/InlinePrompt.story.tsx +5 -5
- package/src/Prompt/PrimitivePrompt/PrimitivePrompt.less +2 -1
- package/src/SentimentSurface/SentimentSurface.css +5 -0
- package/src/SentimentSurface/SentimentSurface.less +5 -0
- package/src/SentimentSurface/_stories/SentimentSurface.story.tsx +6 -2
- package/src/TextareaWithDisplayFormat/_stories/TextareaWithDisplayFormat.test.story.tsx +49 -34
- package/src/Typeahead/TypeaheadInput/TypeaheadInput.tsx +31 -20
- package/src/Typeahead/_stories/Typeahead.rtl.test.story.tsx +90 -57
- package/src/_deprecated/Select/_stories/Select.rtl.test.story.tsx +8 -1
- package/src/main.css +69 -1
- package/src/styles/less/neptune.css +11 -0
- package/src/Inputs/_stories/InputGroup.test.story.tsx +0 -69
- package/src/Inputs/_stories/SearchInput.test.story.tsx +0 -32
|
@@ -2,7 +2,7 @@ import type { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
|
2
2
|
import { userEvent, within } from 'storybook/test';
|
|
3
3
|
import { Flag } from '@wise/art';
|
|
4
4
|
|
|
5
|
-
import { withRTLDiff } from '../../../../.storybook/decorators/RtlDiffDecorator';
|
|
5
|
+
import { useRtlDiffI18n, withRTLDiff } from '../../../../.storybook/decorators/RtlDiffDecorator';
|
|
6
6
|
import { SelectInput, SelectInputOptionContent } from '..';
|
|
7
7
|
|
|
8
8
|
export default {
|
|
@@ -108,28 +108,40 @@ const groupedItems = [
|
|
|
108
108
|
];
|
|
109
109
|
|
|
110
110
|
export const OpenDropdown: Story = {
|
|
111
|
-
render: () =>
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
111
|
+
render: () => {
|
|
112
|
+
const i18n = useRtlDiffI18n();
|
|
113
|
+
return (
|
|
114
|
+
<SelectInput
|
|
115
|
+
size="lg"
|
|
116
|
+
filterable
|
|
117
|
+
filterPlaceholder={i18n.filterPlaceholder}
|
|
118
|
+
placeholder="Select currency"
|
|
119
|
+
defaultValue={rtlCurrencies[0]}
|
|
120
|
+
items={groupedItems}
|
|
121
|
+
renderValue={(currency, withinTrigger) => (
|
|
122
|
+
<SelectInputOptionContent
|
|
123
|
+
title={currency.code}
|
|
124
|
+
note={withinTrigger ? undefined : currency.name}
|
|
125
|
+
icon={<Flag code={currency.code} intrinsicSize={24} />}
|
|
126
|
+
/>
|
|
127
|
+
)}
|
|
128
|
+
/>
|
|
129
|
+
);
|
|
130
|
+
},
|
|
128
131
|
play: async ({ canvasElement }) => {
|
|
129
132
|
const canvas = within(canvasElement);
|
|
130
133
|
const trigger = canvas.queryByRole('combobox');
|
|
131
134
|
if (!trigger) return;
|
|
132
135
|
await userEvent.click(trigger);
|
|
133
136
|
},
|
|
134
|
-
...withRTLDiff({
|
|
137
|
+
...withRTLDiff({
|
|
138
|
+
renderAs: 'iframe',
|
|
139
|
+
width: '80%',
|
|
140
|
+
i18n: {
|
|
141
|
+
filterPlaceholder: {
|
|
142
|
+
ltr: 'Type a currency / country',
|
|
143
|
+
rtl: 'اكتب عملة / دولة',
|
|
144
|
+
},
|
|
145
|
+
},
|
|
146
|
+
}),
|
|
135
147
|
};
|
|
@@ -154,7 +154,22 @@
|
|
|
154
154
|
color: #768e9c;
|
|
155
155
|
color: var(--color-content-tertiary);
|
|
156
156
|
}
|
|
157
|
-
.np-text-area
|
|
157
|
+
.np-text-area:-moz-placeholder {
|
|
158
158
|
color: #768e9c;
|
|
159
159
|
color: var(--color-content-tertiary);
|
|
160
160
|
}
|
|
161
|
+
.np-text-area::placeholder,
|
|
162
|
+
.np-text-area:placeholder-shown {
|
|
163
|
+
color: #768e9c;
|
|
164
|
+
color: var(--color-content-tertiary);
|
|
165
|
+
}
|
|
166
|
+
[dir="rtl"] .np-text-area::-moz-placeholder {
|
|
167
|
+
direction: rtl !important;
|
|
168
|
+
}
|
|
169
|
+
[dir="rtl"] .np-text-area:-moz-placeholder {
|
|
170
|
+
direction: rtl !important;
|
|
171
|
+
}
|
|
172
|
+
[dir="rtl"] .np-text-area::placeholder,
|
|
173
|
+
[dir="rtl"] .np-text-area:placeholder-shown {
|
|
174
|
+
direction: rtl !important;
|
|
175
|
+
}
|
|
@@ -4,10 +4,10 @@ import { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
|
4
4
|
import {
|
|
5
5
|
createSandboxStory,
|
|
6
6
|
globalScope,
|
|
7
|
-
} from '
|
|
8
|
-
import Field from '
|
|
9
|
-
import { Sentiment } from '
|
|
10
|
-
import { TextArea } from '../TextArea
|
|
7
|
+
} from '../../../../.storybook/components/sandbox/SandboxEditor';
|
|
8
|
+
import Field from '../../../Field';
|
|
9
|
+
import { Sentiment } from '../../../common';
|
|
10
|
+
import { TextArea } from '../TextArea';
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* TextArea must be the only input with `maxLength` inside a given Field.
|
|
@@ -2,10 +2,10 @@ import { useState } from 'react';
|
|
|
2
2
|
import { userEvent, within } from 'storybook/test';
|
|
3
3
|
import { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
4
4
|
|
|
5
|
-
import { withRTLDiff } from '
|
|
6
|
-
import Field from '
|
|
7
|
-
import { Sentiment } from '
|
|
8
|
-
import { TextArea } from '../TextArea
|
|
5
|
+
import { useRtlDiffI18n, withRTLDiff } from '../../../../.storybook/decorators/RtlDiffDecorator';
|
|
6
|
+
import Field from '../../../Field';
|
|
7
|
+
import { Sentiment } from '../../../common';
|
|
8
|
+
import { TextArea } from '../TextArea';
|
|
9
9
|
|
|
10
10
|
const meta: Meta<typeof TextArea> = {
|
|
11
11
|
title: 'Forms/TextArea/Tests',
|
|
@@ -144,26 +144,50 @@ export const CJKTypingBlocked: Story = {
|
|
|
144
144
|
};
|
|
145
145
|
|
|
146
146
|
export const RTLDiff: Story = {
|
|
147
|
-
render: () =>
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
<
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
<
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
147
|
+
render: () => {
|
|
148
|
+
const i18n = useRtlDiffI18n();
|
|
149
|
+
|
|
150
|
+
return (
|
|
151
|
+
<>
|
|
152
|
+
<Field label="Localised placeholder">
|
|
153
|
+
<TextArea placeholder={i18n.placeholder} />
|
|
154
|
+
</Field>
|
|
155
|
+
<Field label="Localised value">
|
|
156
|
+
<TextArea value={i18n.value_ar} readOnly />
|
|
157
|
+
</Field>
|
|
158
|
+
<Field label="LTR value">
|
|
159
|
+
<TextArea value={i18n.value_en} readOnly />
|
|
160
|
+
</Field>
|
|
161
|
+
<Field label="Message" sentiment={Sentiment.NEGATIVE} message={i18n.errorMessage}>
|
|
162
|
+
<TextArea value={i18n.invalidInputText} readOnly />
|
|
163
|
+
</Field>
|
|
164
|
+
<Field label="Message with character count">
|
|
165
|
+
<TextArea maxLength={200} value={i18n.characterCounter} readOnly />
|
|
166
|
+
</Field>
|
|
167
|
+
</>
|
|
168
|
+
);
|
|
169
|
+
},
|
|
170
|
+
...withRTLDiff({
|
|
171
|
+
width: 'stretch',
|
|
172
|
+
i18n: {
|
|
173
|
+
placeholder: { ltr: 'Translated placeholder...', rtl: 'نص بديل مترجم...' },
|
|
174
|
+
value_en: {
|
|
175
|
+
ltr: 'This is LTR text content in the RTL textarea field, showing the input adapting to the content rather than page setting.',
|
|
176
|
+
rtl: 'This is LTR text content in the RTL textarea field, showing the input adapting to the content rather than page setting.',
|
|
177
|
+
},
|
|
178
|
+
value_ar: {
|
|
179
|
+
ltr: 'This is some entered text content in the textarea field.',
|
|
180
|
+
rtl: 'هذا هو بعض المحتوى النصي المدخل في حقل منطقة النص.',
|
|
181
|
+
},
|
|
182
|
+
errorMessage: {
|
|
183
|
+
ltr: 'This field has an error message',
|
|
184
|
+
rtl: 'هذا الحقل يحتوي على رسالة خطأ',
|
|
185
|
+
},
|
|
186
|
+
invalidInputText: { ltr: 'Invalid input text', rtl: 'نص الإدخال غير صالح' },
|
|
187
|
+
characterCounter: {
|
|
188
|
+
ltr: 'Text with a character counter displayed below.',
|
|
189
|
+
rtl: 'نص مع عداد أحرف معروض أدناه.',
|
|
190
|
+
},
|
|
191
|
+
},
|
|
192
|
+
}),
|
|
169
193
|
};
|
|
@@ -367,6 +367,7 @@ class MoneyInput extends Component<MoneyInputPropsWithInputAttributes, MoneyInpu
|
|
|
367
367
|
locale: this.state.locale,
|
|
368
368
|
decimals: this.props.decimals,
|
|
369
369
|
})}
|
|
370
|
+
className="money-input__number-input"
|
|
370
371
|
autoComplete="off"
|
|
371
372
|
aria-describedby={selectedCurrencyElementId}
|
|
372
373
|
onKeyDown={this.handleKeyDown}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
2
2
|
import { userEvent, within } from 'storybook/test';
|
|
3
3
|
|
|
4
|
-
import { withRTLDiff } from '../../../.storybook/decorators/RtlDiffDecorator';
|
|
4
|
+
import { useRtlDiffI18n, withRTLDiff } from '../../../.storybook/decorators/RtlDiffDecorator';
|
|
5
5
|
import Field from '../../Field/Field';
|
|
6
6
|
import MoneyInput from '..';
|
|
7
7
|
|
|
@@ -70,19 +70,23 @@ export const TriggerVariants: Story = {
|
|
|
70
70
|
};
|
|
71
71
|
|
|
72
72
|
export const OpenDropdown: Story = {
|
|
73
|
-
render: () =>
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
73
|
+
render: () => {
|
|
74
|
+
const i18n = useRtlDiffI18n();
|
|
75
|
+
return (
|
|
76
|
+
<MoneyInput
|
|
77
|
+
{...sharedProps}
|
|
78
|
+
size="lg"
|
|
79
|
+
currencies={multipleCurrencies}
|
|
80
|
+
selectedCurrency={eurCurrency}
|
|
81
|
+
searchPlaceholder={i18n.searchPlaceholder}
|
|
82
|
+
/>
|
|
83
|
+
);
|
|
84
|
+
},
|
|
81
85
|
play: async ({ canvasElement }) => {
|
|
82
86
|
const canvas = within(canvasElement);
|
|
83
87
|
const trigger = canvas.queryByRole('combobox');
|
|
84
88
|
if (!trigger) return;
|
|
85
89
|
await userEvent.click(trigger);
|
|
86
90
|
},
|
|
87
|
-
...withRTLDiff({ renderAs: 'iframe', width: '40%' }),
|
|
91
|
+
...withRTLDiff({ renderAs: 'iframe', width: '40%', i18n: { searchPlaceholder: { ltr: 'Search currencies or countries', rtl: 'ابحث عن العملات أو الدول' } } }),
|
|
88
92
|
};
|
|
@@ -5,6 +5,9 @@
|
|
|
5
5
|
margin-inline-start: 12px;
|
|
6
6
|
margin-inline-start: var(--size-12);
|
|
7
7
|
}
|
|
8
|
+
[dir="rtl"] .tw-telephone__number-input-field {
|
|
9
|
+
text-align: end;
|
|
10
|
+
}
|
|
8
11
|
.tw-telephone__country-select {
|
|
9
12
|
flex-basis: 120px;
|
|
10
13
|
flex-shrink: 0;
|
|
@@ -12,6 +15,10 @@
|
|
|
12
15
|
.tw-telephone__country-select .np-input-group {
|
|
13
16
|
inline-size: 100%;
|
|
14
17
|
}
|
|
18
|
+
[dir="rtl"] .tw-telephone__country-select .np-select-input-content {
|
|
19
|
+
text-align: end;
|
|
20
|
+
direction: ltr;
|
|
21
|
+
}
|
|
15
22
|
.tw-telephone__country-select--with-input-group-addon-start .np-button-input {
|
|
16
23
|
padding-inline-start: 48px;
|
|
17
24
|
padding-inline-start: var(--size-48);
|
|
@@ -6,6 +6,12 @@
|
|
|
6
6
|
.tw-telephone__number-input {
|
|
7
7
|
margin-left: var(--size-12);
|
|
8
8
|
}
|
|
9
|
+
|
|
10
|
+
&__number-input-field{
|
|
11
|
+
[dir="rtl"] & {
|
|
12
|
+
text-align: end;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
9
15
|
}
|
|
10
16
|
|
|
11
17
|
.tw-telephone__country-select {
|
|
@@ -15,6 +21,13 @@
|
|
|
15
21
|
.np-input-group {
|
|
16
22
|
width: 100%;
|
|
17
23
|
}
|
|
24
|
+
|
|
25
|
+
.np-select-input-content{
|
|
26
|
+
[dir="rtl"] & {
|
|
27
|
+
text-align: end;
|
|
28
|
+
direction: ltr;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
18
31
|
}
|
|
19
32
|
|
|
20
33
|
.tw-telephone__country-select--with-input-group-addon-start {
|
|
@@ -13,4 +13,9 @@ export default defineMessages({
|
|
|
13
13
|
id: 'neptune.PhoneNumberInput.phoneNumberLabel',
|
|
14
14
|
defaultMessage: 'Phone number',
|
|
15
15
|
},
|
|
16
|
+
phoneNumberPrefix: {
|
|
17
|
+
id: 'neptune.PhoneNumberInput.phoneNumberPrefix',
|
|
18
|
+
defaultMessage: 'Prefix',
|
|
19
|
+
description: 'phone number prefix / country code',
|
|
20
|
+
},
|
|
16
21
|
});
|
|
@@ -59,7 +59,7 @@ const PhoneNumberInput = ({
|
|
|
59
59
|
onFocus,
|
|
60
60
|
onBlur,
|
|
61
61
|
countryCode,
|
|
62
|
-
searchPlaceholder
|
|
62
|
+
searchPlaceholder,
|
|
63
63
|
size = Size.MEDIUM,
|
|
64
64
|
placeholder,
|
|
65
65
|
selectProps = defaultSelectProps,
|
|
@@ -232,7 +232,7 @@ const PhoneNumberInput = ({
|
|
|
232
232
|
/>
|
|
233
233
|
)}
|
|
234
234
|
filterable
|
|
235
|
-
filterPlaceholder={searchPlaceholder}
|
|
235
|
+
filterPlaceholder={searchPlaceholder ?? formatMessage(messages.phoneNumberPrefix)}
|
|
236
236
|
disabled={disabled}
|
|
237
237
|
size={size}
|
|
238
238
|
id={ids.countryCode.select}
|
|
@@ -261,6 +261,7 @@ const PhoneNumberInput = ({
|
|
|
261
261
|
<div className={`input-group input-group-${size} ${disabled ? 'disabled' : ''}`}>
|
|
262
262
|
<Input
|
|
263
263
|
ref={phoneNumberInputRef}
|
|
264
|
+
className="tw-telephone__number-input-field"
|
|
264
265
|
id={ids.phoneNumber.input}
|
|
265
266
|
autoComplete="tel-national"
|
|
266
267
|
name="phoneNumber"
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
2
2
|
import { userEvent, within } from 'storybook/test';
|
|
3
3
|
|
|
4
|
-
import { withRTLDiff } from '../../../.storybook/decorators/RtlDiffDecorator';
|
|
4
|
+
import { useRtlDiffI18n, withRTLDiff } from '../../../.storybook/decorators/RtlDiffDecorator';
|
|
5
5
|
import Field from '../../Field/Field';
|
|
6
6
|
import PhoneNumberInput from '..';
|
|
7
7
|
|
|
@@ -37,16 +37,24 @@ export const Sizes: Story = {
|
|
|
37
37
|
};
|
|
38
38
|
|
|
39
39
|
export const DropdownOpen: Story = {
|
|
40
|
-
render: () =>
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
40
|
+
render: () => {
|
|
41
|
+
const i18n = useRtlDiffI18n();
|
|
42
|
+
|
|
43
|
+
return (
|
|
44
|
+
<Field label="Phone number">
|
|
45
|
+
<PhoneNumberInput searchPlaceholder={i18n.searchPlaceholder} onChange={() => {}} />
|
|
46
|
+
</Field>
|
|
47
|
+
);
|
|
48
|
+
},
|
|
45
49
|
play: async ({ canvasElement }) => {
|
|
46
50
|
const canvas = within(canvasElement);
|
|
47
51
|
const trigger = canvas.queryByRole('combobox');
|
|
48
52
|
if (!trigger) return;
|
|
49
53
|
await userEvent.click(trigger);
|
|
50
54
|
},
|
|
51
|
-
...withRTLDiff({
|
|
55
|
+
...withRTLDiff({
|
|
56
|
+
renderAs: 'iframe',
|
|
57
|
+
hAlign: 'center',
|
|
58
|
+
i18n: { searchPlaceholder: { ltr: 'Country code', rtl: 'رمز الدولة' } },
|
|
59
|
+
}),
|
|
52
60
|
};
|
|
@@ -233,7 +233,11 @@ export const Sentiments: Story = {
|
|
|
233
233
|
key={sentiment}
|
|
234
234
|
sentiment={sentiment}
|
|
235
235
|
title={`${sentiment.charAt(0).toUpperCase() + sentiment.slice(1)} Action`}
|
|
236
|
-
description={
|
|
236
|
+
description={
|
|
237
|
+
<>
|
|
238
|
+
This is a <strong>{sentiment}</strong> prompt.
|
|
239
|
+
</>
|
|
240
|
+
}
|
|
237
241
|
action={{ label: 'Primary', onClick: fn() }}
|
|
238
242
|
actionSecondary={{ label: 'Secondary', onClick: fn() }}
|
|
239
243
|
/>
|
|
@@ -73,6 +73,8 @@ export default {
|
|
|
73
73
|
},
|
|
74
74
|
} satisfies Meta<InfoPromptProps>;
|
|
75
75
|
|
|
76
|
+
type Story = StoryObj<InfoPromptProps>;
|
|
77
|
+
|
|
76
78
|
/**
|
|
77
79
|
* Convenience controls for previewing rich markup,
|
|
78
80
|
* not otherwise possible via Storybook
|
|
@@ -192,7 +194,7 @@ export const Sandbox = createSandboxStory({
|
|
|
192
194
|
* - `warning`: Warning messages
|
|
193
195
|
* - `proposition`: Promotional content (uses GiftBox icon by default)
|
|
194
196
|
*/
|
|
195
|
-
export const Sentiments:
|
|
197
|
+
export const Sentiments: Story = {
|
|
196
198
|
render: (args: InfoPromptProps) => (
|
|
197
199
|
<>
|
|
198
200
|
<InfoPrompt {...args} sentiment="neutral" description="This is a neutral message." />
|
|
@@ -207,7 +209,7 @@ export const Sentiments: StoryObj<InfoPromptProps> = {
|
|
|
207
209
|
/**
|
|
208
210
|
* InfoPrompt can include both a title and description for more detailed messaging.
|
|
209
211
|
*/
|
|
210
|
-
export const WithTitle:
|
|
212
|
+
export const WithTitle: Story = {
|
|
211
213
|
render: (args: InfoPromptProps) => (
|
|
212
214
|
<>
|
|
213
215
|
<InfoPrompt
|
|
@@ -236,7 +238,7 @@ export const WithTitle: StoryObj<InfoPromptProps> = {
|
|
|
236
238
|
* Use the `action` prop to add a clickable link below the message.
|
|
237
239
|
* Actions can have an `href` for navigation or an `onClick` for custom behavior.
|
|
238
240
|
*/
|
|
239
|
-
export const WithAction:
|
|
241
|
+
export const WithAction: Story = {
|
|
240
242
|
render: (args: InfoPromptProps) => (
|
|
241
243
|
<>
|
|
242
244
|
<InfoPrompt
|
|
@@ -270,7 +272,7 @@ export const WithAction: StoryObj<InfoPromptProps> = {
|
|
|
270
272
|
* **Important**: If the description contains an interactive element, do not use the `action` prop
|
|
271
273
|
* simultaneously — InfoPrompt should have at most one interaction.
|
|
272
274
|
*/
|
|
273
|
-
export const WithRichDescription:
|
|
275
|
+
export const WithRichDescription: Story = {
|
|
274
276
|
render: (args: InfoPromptProps) => (
|
|
275
277
|
<>
|
|
276
278
|
<InfoPrompt
|
|
@@ -282,7 +284,7 @@ export const WithRichDescription: StoryObj<InfoPromptProps> = {
|
|
|
282
284
|
<Link href="/fees" target="_blank" type="link-default">
|
|
283
285
|
fee schedule
|
|
284
286
|
</Link>
|
|
285
|
-
.
|
|
287
|
+
. This has <strong>bold text</strong> that matches the sentiment color.
|
|
286
288
|
</>
|
|
287
289
|
}
|
|
288
290
|
/>
|
|
@@ -296,7 +298,8 @@ export const WithRichDescription: StoryObj<InfoPromptProps> = {
|
|
|
296
298
|
<Link href="/verify" type="link-default">
|
|
297
299
|
verify your identity
|
|
298
300
|
</Link>{' '}
|
|
299
|
-
to continue sending money.
|
|
301
|
+
to continue sending money. This has <strong>bold text</strong> that matches the
|
|
302
|
+
sentiment color.
|
|
300
303
|
</>
|
|
301
304
|
}
|
|
302
305
|
/>
|
|
@@ -308,7 +311,7 @@ export const WithRichDescription: StoryObj<InfoPromptProps> = {
|
|
|
308
311
|
* When `onDismiss` is provided, a close button appears allowing users to dismiss the prompt.
|
|
309
312
|
* Note: The component itself is not automatically removed - you must handle state management.
|
|
310
313
|
*/
|
|
311
|
-
export const Dismissible:
|
|
314
|
+
export const Dismissible: Story = {
|
|
312
315
|
render: function Render() {
|
|
313
316
|
const [showPrompt, setShowPrompt] = useState(true);
|
|
314
317
|
|
|
@@ -339,7 +342,7 @@ export const Dismissible: StoryObj<InfoPromptProps> = {
|
|
|
339
342
|
* **Icon Overrides**: Replace default icons with custom icons to match the prompt's visual language to its content.
|
|
340
343
|
* Success and proposition sentiments support both standard checkmark and confetti variations.
|
|
341
344
|
*/
|
|
342
|
-
export const MediaTypes:
|
|
345
|
+
export const MediaTypes: Story = {
|
|
343
346
|
render: (args) => (
|
|
344
347
|
<>
|
|
345
348
|
<Title type="title-body">Default</Title>
|
|
@@ -392,7 +395,7 @@ export const MediaTypes: StoryObj<InfoPromptProps> = {
|
|
|
392
395
|
*
|
|
393
396
|
* [Visit wise.design](https://docs.wise.design/components/info-prompt#writing-an-info-prompt) for guidance on writing effective prompt messages that are concise and easy to understand.
|
|
394
397
|
*/
|
|
395
|
-
export const ParagraphWidth:
|
|
398
|
+
export const ParagraphWidth: Story = {
|
|
396
399
|
parameters: {
|
|
397
400
|
docs: {
|
|
398
401
|
canvas: {
|
|
@@ -135,19 +135,19 @@ export const Sentiments: StoryObj<PreviewStoryArgs> = {
|
|
|
135
135
|
return (
|
|
136
136
|
<>
|
|
137
137
|
<InlinePrompt {...props} {...previewProps} sentiment="neutral">
|
|
138
|
-
This is a neutral prompt.
|
|
138
|
+
This is a <strong>neutral</strong> prompt.
|
|
139
139
|
</InlinePrompt>
|
|
140
140
|
<InlinePrompt {...props} {...previewProps} sentiment="negative">
|
|
141
|
-
This is a negative prompt.
|
|
141
|
+
This is a <strong>negative</strong> prompt.
|
|
142
142
|
</InlinePrompt>
|
|
143
143
|
<InlinePrompt {...props} {...previewProps} sentiment="warning">
|
|
144
|
-
This is a warning prompt.
|
|
144
|
+
This is a <strong>warning</strong> prompt.
|
|
145
145
|
</InlinePrompt>
|
|
146
146
|
<InlinePrompt {...props} {...previewProps} sentiment="positive">
|
|
147
|
-
This is a positive prompt.
|
|
147
|
+
This is a <strong>positive</strong> prompt.
|
|
148
148
|
</InlinePrompt>
|
|
149
149
|
<InlinePrompt {...props} {...previewProps} sentiment="proposition">
|
|
150
|
-
This is a proposition prompt.
|
|
150
|
+
This is a <strong>proposition</strong> prompt.
|
|
151
151
|
</InlinePrompt>
|
|
152
152
|
</>
|
|
153
153
|
);
|
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
display: flex;
|
|
4
4
|
gap: var(--Prompt-gap, var(--size-16));
|
|
5
5
|
overflow-wrap: break-word;
|
|
6
|
-
padding: var(--Prompt-padding-y, var(--padding-x-small))
|
|
6
|
+
padding: var(--Prompt-padding-y, var(--padding-x-small))
|
|
7
|
+
var(--Prompt-padding-x, var(--padding-x-small));
|
|
7
8
|
text-align: left;
|
|
8
9
|
word-break: break-word;
|
|
9
10
|
width: 100%;
|
|
@@ -442,6 +442,7 @@
|
|
|
442
442
|
--color-sentiment-background-surface-active: #F8CD20;
|
|
443
443
|
--color-sentiment-border-overlay: rgba(58,53,35,0.30196);
|
|
444
444
|
}
|
|
445
|
+
|
|
445
446
|
.wds-sentiment-surface {
|
|
446
447
|
--ring-outline-color: var(--color-sentiment-content-primary, var(--color-content-primary));
|
|
447
448
|
}
|
|
@@ -449,3 +450,7 @@
|
|
|
449
450
|
background-color: var(--color-sentiment-background-surface);
|
|
450
451
|
color: var(--color-sentiment-content-primary);
|
|
451
452
|
}
|
|
453
|
+
.wds-sentiment-surface strong,
|
|
454
|
+
.wds-sentiment-surface b {
|
|
455
|
+
color: var(--color-sentiment-content-primary);
|
|
456
|
+
}
|
|
@@ -228,7 +228,9 @@ export const EmphasisLevels: Story = {
|
|
|
228
228
|
sentiment={sentiment}
|
|
229
229
|
emphasis="base"
|
|
230
230
|
>
|
|
231
|
-
<div className="p-a-2 text-capitalize">
|
|
231
|
+
<div className="p-a-2 text-capitalize">
|
|
232
|
+
<strong>{sentiment}</strong> - Base emphasis
|
|
233
|
+
</div>
|
|
232
234
|
</SentimentSurface>
|
|
233
235
|
<SentimentSurface
|
|
234
236
|
key={`${sentiment}-elevated`}
|
|
@@ -236,7 +238,9 @@ export const EmphasisLevels: Story = {
|
|
|
236
238
|
sentiment={sentiment}
|
|
237
239
|
emphasis="elevated"
|
|
238
240
|
>
|
|
239
|
-
<div className="p-a-2 text-capitalize">
|
|
241
|
+
<div className="p-a-2 text-capitalize">
|
|
242
|
+
<strong>{sentiment}</strong> - Elevated emphasis
|
|
243
|
+
</div>
|
|
240
244
|
</SentimentSurface>
|
|
241
245
|
</div>
|
|
242
246
|
))}
|