@transferwise/components 0.0.0-experimental-db313a8 → 0.0.0-experimental-d44d661
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/dateInput/DateInput.js +8 -33
- package/build/dateInput/DateInput.js.map +1 -1
- package/build/dateInput/DateInput.mjs +10 -35
- package/build/dateInput/DateInput.mjs.map +1 -1
- package/build/dateLookup/DateLookup.js +2 -4
- package/build/dateLookup/DateLookup.js.map +1 -1
- package/build/dateLookup/DateLookup.mjs +2 -4
- package/build/dateLookup/DateLookup.mjs.map +1 -1
- package/build/dateLookup/dateTrigger/DateTrigger.js +0 -2
- package/build/dateLookup/dateTrigger/DateTrigger.js.map +1 -1
- package/build/dateLookup/dateTrigger/DateTrigger.mjs +0 -2
- package/build/dateLookup/dateTrigger/DateTrigger.mjs.map +1 -1
- package/build/field/Field.js +2 -7
- package/build/field/Field.js.map +1 -1
- package/build/field/Field.mjs +8 -13
- package/build/field/Field.mjs.map +1 -1
- package/build/inputs/InputGroup.js +1 -1
- package/build/inputs/InputGroup.js.map +1 -1
- package/build/inputs/InputGroup.mjs +2 -2
- package/build/inputs/InputGroup.mjs.map +1 -1
- package/build/inputs/SelectInput.js +3 -9
- package/build/inputs/SelectInput.js.map +1 -1
- package/build/inputs/SelectInput.mjs +3 -9
- package/build/inputs/SelectInput.mjs.map +1 -1
- package/build/inputs/_BottomSheet.js +29 -1
- package/build/inputs/_BottomSheet.js.map +1 -1
- package/build/inputs/_BottomSheet.mjs +30 -2
- package/build/inputs/_BottomSheet.mjs.map +1 -1
- package/build/inputs/contexts.js +4 -8
- package/build/inputs/contexts.js.map +1 -1
- package/build/inputs/contexts.mjs +4 -7
- package/build/inputs/contexts.mjs.map +1 -1
- package/build/label/Label.js +8 -14
- package/build/label/Label.js.map +1 -1
- package/build/label/Label.mjs +8 -14
- package/build/label/Label.mjs.map +1 -1
- package/build/main.css +1 -0
- package/build/moneyInput/MoneyInput.js +5 -6
- package/build/moneyInput/MoneyInput.js.map +1 -1
- package/build/moneyInput/MoneyInput.mjs +5 -6
- package/build/moneyInput/MoneyInput.mjs.map +1 -1
- package/build/phoneNumberInput/PhoneNumberInput.js +2 -24
- package/build/phoneNumberInput/PhoneNumberInput.js.map +1 -1
- package/build/phoneNumberInput/PhoneNumberInput.mjs +4 -26
- package/build/phoneNumberInput/PhoneNumberInput.mjs.map +1 -1
- package/build/styles/dimmer/Dimmer.css +1 -0
- package/build/styles/main.css +1 -0
- package/build/types/dateInput/DateInput.d.ts +2 -2
- package/build/types/dateInput/DateInput.d.ts.map +1 -1
- package/build/types/dateLookup/DateLookup.d.ts.map +1 -1
- package/build/types/dateLookup/dateTrigger/DateTrigger.d.ts +0 -1
- package/build/types/dateLookup/dateTrigger/DateTrigger.d.ts.map +1 -1
- package/build/types/field/Field.d.ts.map +1 -1
- package/build/types/inputs/InputGroup.d.ts.map +1 -1
- package/build/types/inputs/SelectInput.d.ts +1 -3
- package/build/types/inputs/SelectInput.d.ts.map +1 -1
- package/build/types/inputs/_BottomSheet.d.ts.map +1 -1
- package/build/types/inputs/contexts.d.ts +1 -6
- package/build/types/inputs/contexts.d.ts.map +1 -1
- package/build/types/label/Label.d.ts +15 -5
- package/build/types/label/Label.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/package.json +1 -1
- package/src/common/bottomSheet/BottomSheet.test.story.tsx +73 -0
- package/src/dateInput/DateInput.tsx +13 -43
- package/src/dateLookup/DateLookup.tsx +3 -5
- package/src/dateLookup/dateTrigger/DateTrigger.tsx +0 -3
- package/src/dimmer/Dimmer.css +1 -0
- package/src/dimmer/Dimmer.less +1 -0
- package/src/field/Field.tsx +5 -6
- package/src/inputs/InputGroup.tsx +4 -3
- package/src/inputs/SelectInput.spec.tsx +33 -0
- package/src/inputs/SelectInput.test.story.tsx +76 -0
- package/src/inputs/SelectInput.tsx +3 -13
- package/src/inputs/_BottomSheet.tsx +19 -6
- package/src/inputs/contexts.tsx +3 -12
- package/src/label/Label.tsx +20 -26
- package/src/main.css +1 -0
- package/src/moneyInput/MoneyInput.spec.tsx +1 -2
- package/src/moneyInput/MoneyInput.tsx +6 -7
- package/src/phoneNumberInput/PhoneNumberInput.tsx +10 -31
|
@@ -313,10 +313,10 @@ class MoneyInput extends Component<MoneyInputPropsWithInputAttributes, MoneyInpu
|
|
|
313
313
|
const selectedCurrencyElementId = `${inputAttributes?.id ?? amountInputId}SelectedCurrency`;
|
|
314
314
|
|
|
315
315
|
return (
|
|
316
|
-
<
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
aria-labelledby={
|
|
316
|
+
<div
|
|
317
|
+
role="group"
|
|
318
|
+
{...inputAttributes}
|
|
319
|
+
aria-labelledby={ariaLabelledBy}
|
|
320
320
|
className={clsx(
|
|
321
321
|
this.style('tw-money-input'),
|
|
322
322
|
this.style('input-group'),
|
|
@@ -324,8 +324,7 @@ class MoneyInput extends Component<MoneyInputPropsWithInputAttributes, MoneyInpu
|
|
|
324
324
|
)}
|
|
325
325
|
>
|
|
326
326
|
<Input
|
|
327
|
-
id={
|
|
328
|
-
aria-labelledby={ariaLabelledBy}
|
|
327
|
+
id={amountInputId}
|
|
329
328
|
value={this.state.formattedAmount}
|
|
330
329
|
inputMode="decimal"
|
|
331
330
|
disabled={disabled}
|
|
@@ -431,7 +430,7 @@ class MoneyInput extends Component<MoneyInputPropsWithInputAttributes, MoneyInpu
|
|
|
431
430
|
/>
|
|
432
431
|
</div>
|
|
433
432
|
)}
|
|
434
|
-
</
|
|
433
|
+
</div>
|
|
435
434
|
);
|
|
436
435
|
}
|
|
437
436
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { useState, useEffect, useMemo
|
|
1
|
+
import { useState, useEffect, useMemo } from 'react';
|
|
2
2
|
import { useIntl } from 'react-intl';
|
|
3
3
|
|
|
4
4
|
import { Size, SizeLarge, SizeMedium, SizeSmall } from '../common';
|
|
5
|
-
import {
|
|
5
|
+
import { useInputAttributes } from '../inputs/contexts';
|
|
6
6
|
import { SelectInput, SelectInputOptionContent, SelectInputProps } from '../inputs/SelectInput';
|
|
7
7
|
import messages from './PhoneNumberInput.messages';
|
|
8
8
|
import countries from './data/countries';
|
|
@@ -58,10 +58,7 @@ const PhoneNumberInput = ({
|
|
|
58
58
|
selectProps = defaultSelectProps,
|
|
59
59
|
disabledCountries = defaultDisabledCountries,
|
|
60
60
|
}: PhoneNumberInputProps) => {
|
|
61
|
-
const countryCodeSelectRef = useRef<HTMLButtonElement>(null);
|
|
62
|
-
const phoneNumberInputRef = useRef<HTMLInputElement>(null);
|
|
63
61
|
const inputAttributes = useInputAttributes({ nonLabelable: true });
|
|
64
|
-
const fieldLabelRef = useFieldLabelRef();
|
|
65
62
|
const ariaLabelledBy = ariaLabelledByProp ?? inputAttributes['aria-labelledby'];
|
|
66
63
|
|
|
67
64
|
const { locale, formatMessage } = useIntl();
|
|
@@ -74,7 +71,6 @@ const PhoneNumberInput = ({
|
|
|
74
71
|
return `${backup}-${random}`;
|
|
75
72
|
};
|
|
76
73
|
|
|
77
|
-
// Link the first non-disabled input to the the Field label, if present
|
|
78
74
|
const ids = {
|
|
79
75
|
countryCode: {
|
|
80
76
|
label: createId(id, 'country-code-label'),
|
|
@@ -166,34 +162,18 @@ const PhoneNumberInput = ({
|
|
|
166
162
|
setBroadcastedValue(internalValue);
|
|
167
163
|
}, [onChange, broadcastedValue, internalValue]);
|
|
168
164
|
|
|
169
|
-
useEffect(() => {
|
|
170
|
-
const labelRef = fieldLabelRef?.current;
|
|
171
|
-
|
|
172
|
-
if (labelRef) {
|
|
173
|
-
const handleLabelClick = () => {
|
|
174
|
-
if (!selectProps.disabled) {
|
|
175
|
-
countryCodeSelectRef.current?.click();
|
|
176
|
-
} else {
|
|
177
|
-
phoneNumberInputRef.current?.focus();
|
|
178
|
-
}
|
|
179
|
-
};
|
|
180
|
-
|
|
181
|
-
labelRef.addEventListener('click', handleLabelClick);
|
|
182
|
-
|
|
183
|
-
return () => {
|
|
184
|
-
labelRef?.removeEventListener('click', handleLabelClick);
|
|
185
|
-
};
|
|
186
|
-
}
|
|
187
|
-
}, [fieldLabelRef, selectProps.disabled]);
|
|
188
|
-
|
|
189
165
|
return (
|
|
190
|
-
<
|
|
191
|
-
|
|
166
|
+
<div
|
|
167
|
+
role="group"
|
|
168
|
+
{...inputAttributes}
|
|
169
|
+
aria-labelledby={ariaLabelledBy}
|
|
170
|
+
className="tw-telephone"
|
|
171
|
+
>
|
|
172
|
+
<label className="sr-only" id={ids.countryCode.label}>
|
|
192
173
|
{formatMessage(messages.countryCodeLabel)}
|
|
193
174
|
</label>
|
|
194
175
|
<div className="tw-telephone__country-select">
|
|
195
176
|
<SelectInput
|
|
196
|
-
triggerRef={countryCodeSelectRef}
|
|
197
177
|
placeholder={formatMessage(messages.selectInputPlaceholder)}
|
|
198
178
|
items={[...countriesByPrefix].map(([prefix, countries]) => ({
|
|
199
179
|
type: 'option',
|
|
@@ -247,7 +227,6 @@ const PhoneNumberInput = ({
|
|
|
247
227
|
<div className="tw-telephone__number-input">
|
|
248
228
|
<div className={`input-group input-group-${size}`}>
|
|
249
229
|
<Input
|
|
250
|
-
ref={phoneNumberInputRef}
|
|
251
230
|
id={ids.phoneNumber.input}
|
|
252
231
|
autoComplete="tel-national"
|
|
253
232
|
name="phoneNumber"
|
|
@@ -264,7 +243,7 @@ const PhoneNumberInput = ({
|
|
|
264
243
|
/>
|
|
265
244
|
</div>
|
|
266
245
|
</div>
|
|
267
|
-
</
|
|
246
|
+
</div>
|
|
268
247
|
);
|
|
269
248
|
};
|
|
270
249
|
|