@transferwise/components 0.0.0-experimental-7a83d86 → 0.0.0-experimental-b2a535a
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/index.js +17 -22
- package/build/index.js.map +1 -1
- package/build/index.mjs +17 -22
- package/build/index.mjs.map +1 -1
- package/build/types/alert/Alert.d.ts.map +1 -1
- package/build/types/dimmer/Dimmer.d.ts.map +1 -1
- package/build/types/loader/Loader.d.ts.map +1 -1
- package/build/types/phoneNumberInput/PhoneNumberInput.d.ts.map +1 -1
- package/build/types/popover/Popover.d.ts.map +1 -1
- package/build/types/segmentedControl/SegmentedControl.d.ts +2 -2
- package/build/types/segmentedControl/SegmentedControl.d.ts.map +1 -1
- package/build/types/select/Select.d.ts.map +1 -1
- package/build/types/stepper/deviceDetection.d.ts.map +1 -1
- package/build/types/uploadInput/uploadButton/UploadButton.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/accordion/Accordion.story.tsx +1 -1
- package/src/alert/Alert.tsx +1 -2
- package/src/avatar/colors/colors.ts +1 -1
- package/src/body/Body.spec.tsx +1 -1
- package/src/body/Body.story.tsx +8 -8
- package/src/checkbox/Checkbox.js +1 -1
- package/src/checkboxButton/CheckboxButton.spec.tsx +1 -0
- package/src/common/Option/Option.tsx +1 -1
- package/src/common/deviceDetection/deviceDetection.js +1 -1
- package/src/common/deviceDetection/deviceDetection.spec.js +2 -4
- package/src/common/responsivePanel/ResponsivePanel.spec.js +15 -11
- package/src/decision/Decision.spec.js +1 -0
- package/src/dimmer/Dimmer.tsx +2 -6
- package/src/inlineAlert/InlineAlert.story.tsx +7 -8
- package/src/link/Link.story.tsx +16 -16
- package/src/loader/Loader.tsx +1 -0
- package/src/logo/Logo.js +2 -2
- package/src/moneyInput/MoneyInput.story.tsx +3 -3
- package/src/nudge/Nudge.spec.tsx +5 -5
- package/src/phoneNumberInput/PhoneNumberInput.tsx +1 -2
- package/src/phoneNumberInput/utils/cleanNumber/cleanNumber.ts +1 -1
- package/src/popover/Popover.tsx +1 -2
- package/src/promoCard/PromoCard.tsx +1 -1
- package/src/radioGroup/RadioGroup.spec.js +1 -1
- package/src/section/Section.story.tsx +1 -2
- package/src/segmentedControl/SegmentedControl.spec.tsx +41 -3
- package/src/segmentedControl/SegmentedControl.story.tsx +51 -13
- package/src/segmentedControl/SegmentedControl.tsx +3 -4
- package/src/select/Select.js +3 -2
- package/src/stepper/deviceDetection.js +2 -1
- package/src/stepper/deviceDetection.spec.js +3 -8
- package/src/test-utils/index.js +1 -1
- package/src/test-utils/story-config.ts +1 -1
- package/src/title/Title.spec.tsx +1 -1
- package/src/typeahead/Typeahead.spec.js +2 -4
- package/src/upload/Upload.spec.js +4 -8
- package/src/uploadInput/uploadButton/UploadButton.tsx +0 -1
package/build/index.mjs
CHANGED
|
@@ -63,7 +63,7 @@ var HistoryNavigator$1 = HistoryNavigator;
|
|
|
63
63
|
function isIosDevice() {
|
|
64
64
|
const sampleTouchDevices = ['iphone', 'ipad', 'ipod'];
|
|
65
65
|
const matchString = sampleTouchDevices.map(device => `(${device})`).join('|');
|
|
66
|
-
const regex = new RegExp(matchString, '
|
|
66
|
+
const regex = new RegExp(matchString, 'ig');
|
|
67
67
|
return typeof navigator !== 'undefined' && !!navigator.userAgent.match(regex);
|
|
68
68
|
}
|
|
69
69
|
|
|
@@ -909,9 +909,8 @@ function resolveType(type) {
|
|
|
909
909
|
return 'neutral';
|
|
910
910
|
case 'error':
|
|
911
911
|
return 'negative';
|
|
912
|
-
default:
|
|
913
|
-
return type;
|
|
914
912
|
}
|
|
913
|
+
return type;
|
|
915
914
|
}
|
|
916
915
|
function Alert({
|
|
917
916
|
arrow,
|
|
@@ -1057,7 +1056,7 @@ const hashSeed = seed => {
|
|
|
1057
1056
|
const modulo = avatarColors.length;
|
|
1058
1057
|
let hashValue = 0;
|
|
1059
1058
|
let basePow = 1;
|
|
1060
|
-
for (let i = 0; i < seed.length; i
|
|
1059
|
+
for (let i = 0; i < seed.length; i++) {
|
|
1061
1060
|
hashValue = (hashValue + seed.charCodeAt(i) * basePow) % modulo;
|
|
1062
1061
|
basePow = basePow * base % modulo;
|
|
1063
1062
|
}
|
|
@@ -1349,15 +1348,11 @@ const Dimmer = ({
|
|
|
1349
1348
|
}, [onClose]);
|
|
1350
1349
|
const onEnter = () => {
|
|
1351
1350
|
setHasNotExited(true);
|
|
1352
|
-
|
|
1353
|
-
dimmerManager.add(dimmerReference.current);
|
|
1354
|
-
}
|
|
1351
|
+
dimmerReference.current && dimmerManager.add(dimmerReference.current);
|
|
1355
1352
|
};
|
|
1356
1353
|
const onExited = () => {
|
|
1357
1354
|
setHasNotExited(false);
|
|
1358
|
-
|
|
1359
|
-
dimmerManager.remove(dimmerReference.current);
|
|
1360
|
-
}
|
|
1355
|
+
dimmerReference.current && dimmerManager.remove(dimmerReference.current);
|
|
1361
1356
|
};
|
|
1362
1357
|
useEffect(() => {
|
|
1363
1358
|
const localReferenceCopy = dimmerReference.current;
|
|
@@ -5174,6 +5169,7 @@ const Tooltip = ({
|
|
|
5174
5169
|
|
|
5175
5170
|
function supportsTouchEvents() {
|
|
5176
5171
|
const onTouchStartIsDefined = typeof window !== 'undefined' && window.ontouchstart !== undefined;
|
|
5172
|
+
// eslint-disable-next-line compat/compat
|
|
5177
5173
|
const maxTouchPointsIsDefined = typeof navigator !== 'undefined' && navigator.maxTouchPoints;
|
|
5178
5174
|
const documentTouchIsDefined = typeof window !== 'undefined' && window.DocumentTouch && document instanceof window.DocumentTouch;
|
|
5179
5175
|
return !!(onTouchStartIsDefined || maxTouchPointsIsDefined || documentTouchIsDefined);
|
|
@@ -5181,7 +5177,7 @@ function supportsTouchEvents() {
|
|
|
5181
5177
|
function userAgentSuggestsTouchDevice() {
|
|
5182
5178
|
const sampleTouchDevices = ['android', 'iemobile', 'iphone', 'ipad', 'ipod', 'blackberry', 'bada'];
|
|
5183
5179
|
const matchString = sampleTouchDevices.map(device => `(${device})`).join('|');
|
|
5184
|
-
const regex = new RegExp(matchString, '
|
|
5180
|
+
const regex = new RegExp(matchString, 'ig');
|
|
5185
5181
|
return typeof navigator !== 'undefined' && !!navigator.userAgent.match(regex);
|
|
5186
5182
|
}
|
|
5187
5183
|
// Important: this is not fool-proof! It gives false positives and negatives, and will be outdated.
|
|
@@ -5587,9 +5583,8 @@ function resolvePlacement(preferredPlacement) {
|
|
|
5587
5583
|
case 'bottom-left':
|
|
5588
5584
|
case 'bottom-right':
|
|
5589
5585
|
return 'bottom';
|
|
5590
|
-
default:
|
|
5591
|
-
return preferredPlacement;
|
|
5592
5586
|
}
|
|
5587
|
+
return preferredPlacement;
|
|
5593
5588
|
}
|
|
5594
5589
|
function Popover$1({
|
|
5595
5590
|
children,
|
|
@@ -7152,6 +7147,7 @@ const Loader = ({
|
|
|
7152
7147
|
}, 1000);
|
|
7153
7148
|
}
|
|
7154
7149
|
return () => {
|
|
7150
|
+
// eslint-disable-next-line fp/no-mutation
|
|
7155
7151
|
cancelled = true;
|
|
7156
7152
|
clearTimeout(timeout);
|
|
7157
7153
|
};
|
|
@@ -9088,7 +9084,7 @@ const explodeNumberModel = number => {
|
|
|
9088
9084
|
};
|
|
9089
9085
|
};
|
|
9090
9086
|
|
|
9091
|
-
const DIGITS_MATCH = /^$|^(\+)|(\d+)/g;
|
|
9087
|
+
const DIGITS_MATCH = /^$|^(\+)|([\d]+)/g;
|
|
9092
9088
|
const cleanNumber = number => number.match(DIGITS_MATCH)?.join('') ?? '';
|
|
9093
9089
|
|
|
9094
9090
|
function sortArrayByProperty(arrayToSort, property) {
|
|
@@ -9174,8 +9170,7 @@ const PhoneNumberInput = ({
|
|
|
9174
9170
|
};
|
|
9175
9171
|
useEffect(() => {
|
|
9176
9172
|
if (broadcastedValue === null) {
|
|
9177
|
-
setBroadcastedValue(internalValue);
|
|
9178
|
-
return;
|
|
9173
|
+
return setBroadcastedValue(internalValue);
|
|
9179
9174
|
}
|
|
9180
9175
|
const internalPhoneNumber = `${internalValue.prefix ?? ''}${internalValue.suffix}`;
|
|
9181
9176
|
const broadcastedPhoneNumber = `${broadcastedValue.prefix ?? ''}${broadcastedValue.suffix}`;
|
|
@@ -9448,7 +9443,7 @@ const PromoCard = /*#__PURE__*/forwardRef(({
|
|
|
9448
9443
|
const checkedProps = (type === 'checkbox' || type === 'radio') && !href ? {
|
|
9449
9444
|
...commonProps,
|
|
9450
9445
|
'aria-checked': type === 'radio' ? value === state : type === 'checkbox' ? checked : undefined,
|
|
9451
|
-
'aria-describedby': `${componentId}-title
|
|
9446
|
+
'aria-describedby': `${componentId}-title` || undefined,
|
|
9452
9447
|
'aria-disabled': isDisabled,
|
|
9453
9448
|
'data-value': value ?? undefined,
|
|
9454
9449
|
role: type === 'checkbox' || type === 'radio' ? type : undefined,
|
|
@@ -10101,8 +10096,8 @@ function Select({
|
|
|
10101
10096
|
}
|
|
10102
10097
|
};
|
|
10103
10098
|
function selectKeyboardFocusedOption() {
|
|
10104
|
-
if (keyboardFocusedOptionIndex != null
|
|
10105
|
-
selectOption(selectableOptions[keyboardFocusedOptionIndex]);
|
|
10099
|
+
if (keyboardFocusedOptionIndex != null) {
|
|
10100
|
+
selectableOptions.length > 0 && selectOption(selectableOptions[keyboardFocusedOptionIndex]);
|
|
10106
10101
|
}
|
|
10107
10102
|
}
|
|
10108
10103
|
function moveFocusWithDifference(difference) {
|
|
@@ -10329,6 +10324,7 @@ function Select({
|
|
|
10329
10324
|
disabled: disabled,
|
|
10330
10325
|
"aria-controls": listboxId,
|
|
10331
10326
|
"aria-expanded": open,
|
|
10327
|
+
"aria-autocomplete": "none",
|
|
10332
10328
|
onClick: handleOnClick,
|
|
10333
10329
|
...buttonProps,
|
|
10334
10330
|
children: [selected ? /*#__PURE__*/jsx(Option$1, {
|
|
@@ -10444,12 +10440,11 @@ Select.defaultProps = {
|
|
|
10444
10440
|
|
|
10445
10441
|
const SegmentedControl = ({
|
|
10446
10442
|
name,
|
|
10447
|
-
|
|
10443
|
+
selectedValue,
|
|
10448
10444
|
mode = 'input',
|
|
10449
10445
|
segments,
|
|
10450
10446
|
onChange
|
|
10451
10447
|
}) => {
|
|
10452
|
-
const [selectedValue, setSelectedValue] = useState(defaultValue || segments[0].value);
|
|
10453
10448
|
const [animate, setAnimate] = useState(false);
|
|
10454
10449
|
const segmentsRef = useRef(null);
|
|
10455
10450
|
if (segments.length > 3) {
|
|
@@ -10473,6 +10468,7 @@ const SegmentedControl = ({
|
|
|
10473
10468
|
}
|
|
10474
10469
|
};
|
|
10475
10470
|
useEffect(() => {
|
|
10471
|
+
setAnimate(true);
|
|
10476
10472
|
updateSegmentPosition();
|
|
10477
10473
|
const handleWindowSizeChange = () => {
|
|
10478
10474
|
setAnimate(false);
|
|
@@ -10498,7 +10494,6 @@ const SegmentedControl = ({
|
|
|
10498
10494
|
children: segmentsWithRefs.map(segment => {
|
|
10499
10495
|
const onSelect = () => {
|
|
10500
10496
|
setAnimate(true);
|
|
10501
|
-
setSelectedValue(segment.value);
|
|
10502
10497
|
onChange(segment.value);
|
|
10503
10498
|
};
|
|
10504
10499
|
return mode === 'input' ? /*#__PURE__*/jsxs("label", {
|