@transferwise/components 0.0.0-experimental-3759445 → 0.0.0-experimental-b545514

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 (48) hide show
  1. package/build/index.js +19 -15
  2. package/build/index.js.map +1 -1
  3. package/build/index.mjs +19 -15
  4. package/build/index.mjs.map +1 -1
  5. package/build/types/alert/Alert.d.ts.map +1 -1
  6. package/build/types/dimmer/Dimmer.d.ts.map +1 -1
  7. package/build/types/loader/Loader.d.ts.map +1 -1
  8. package/build/types/phoneNumberInput/PhoneNumberInput.d.ts.map +1 -1
  9. package/build/types/popover/Popover.d.ts.map +1 -1
  10. package/build/types/select/Select.d.ts.map +1 -1
  11. package/build/types/stepper/deviceDetection.d.ts.map +1 -1
  12. package/build/types/uploadInput/uploadButton/UploadButton.d.ts.map +1 -1
  13. package/package.json +3 -3
  14. package/src/accordion/Accordion.story.tsx +1 -1
  15. package/src/alert/Alert.tsx +2 -1
  16. package/src/avatar/colors/colors.ts +1 -1
  17. package/src/body/Body.spec.tsx +1 -1
  18. package/src/body/Body.story.tsx +8 -8
  19. package/src/checkbox/Checkbox.js +1 -1
  20. package/src/checkboxButton/CheckboxButton.spec.tsx +0 -1
  21. package/src/common/Option/Option.tsx +1 -1
  22. package/src/common/deviceDetection/deviceDetection.js +1 -1
  23. package/src/common/deviceDetection/deviceDetection.spec.js +4 -2
  24. package/src/common/responsivePanel/ResponsivePanel.spec.js +11 -15
  25. package/src/decision/Decision.spec.js +0 -1
  26. package/src/dimmer/Dimmer.tsx +6 -2
  27. package/src/inlineAlert/InlineAlert.story.tsx +8 -7
  28. package/src/link/Link.story.tsx +16 -16
  29. package/src/loader/Loader.tsx +0 -1
  30. package/src/logo/Logo.js +2 -2
  31. package/src/moneyInput/MoneyInput.story.tsx +3 -3
  32. package/src/nudge/Nudge.spec.tsx +5 -5
  33. package/src/phoneNumberInput/PhoneNumberInput.tsx +2 -1
  34. package/src/phoneNumberInput/utils/cleanNumber/cleanNumber.ts +1 -1
  35. package/src/popover/Popover.tsx +2 -1
  36. package/src/promoCard/PromoCard.tsx +1 -1
  37. package/src/radioGroup/RadioGroup.spec.js +1 -1
  38. package/src/section/Section.story.tsx +2 -1
  39. package/src/segmentedControl/SegmentedControl.spec.tsx +2 -2
  40. package/src/select/Select.js +2 -3
  41. package/src/stepper/deviceDetection.js +1 -2
  42. package/src/stepper/deviceDetection.spec.js +8 -3
  43. package/src/test-utils/index.js +1 -1
  44. package/src/test-utils/story-config.ts +1 -1
  45. package/src/title/Title.spec.tsx +1 -1
  46. package/src/typeahead/Typeahead.spec.js +4 -2
  47. package/src/upload/Upload.spec.js +8 -4
  48. package/src/uploadInput/uploadButton/UploadButton.tsx +1 -0
package/build/index.js CHANGED
@@ -93,7 +93,7 @@ var HistoryNavigator$1 = HistoryNavigator;
93
93
  function isIosDevice() {
94
94
  const sampleTouchDevices = ['iphone', 'ipad', 'ipod'];
95
95
  const matchString = sampleTouchDevices.map(device => `(${device})`).join('|');
96
- const regex = new RegExp(matchString, 'ig');
96
+ const regex = new RegExp(matchString, 'gi');
97
97
  return typeof navigator !== 'undefined' && !!navigator.userAgent.match(regex);
98
98
  }
99
99
 
@@ -939,8 +939,9 @@ function resolveType(type) {
939
939
  return 'neutral';
940
940
  case 'error':
941
941
  return 'negative';
942
+ default:
943
+ return type;
942
944
  }
943
- return type;
944
945
  }
945
946
  function Alert({
946
947
  arrow,
@@ -1086,7 +1087,7 @@ const hashSeed = seed => {
1086
1087
  const modulo = avatarColors.length;
1087
1088
  let hashValue = 0;
1088
1089
  let basePow = 1;
1089
- for (let i = 0; i < seed.length; i++) {
1090
+ for (let i = 0; i < seed.length; i += 1) {
1090
1091
  hashValue = (hashValue + seed.charCodeAt(i) * basePow) % modulo;
1091
1092
  basePow = basePow * base % modulo;
1092
1093
  }
@@ -1378,11 +1379,15 @@ const Dimmer = ({
1378
1379
  }, [onClose]);
1379
1380
  const onEnter = () => {
1380
1381
  setHasNotExited(true);
1381
- dimmerReference.current && dimmerManager.add(dimmerReference.current);
1382
+ if (dimmerReference.current) {
1383
+ dimmerManager.add(dimmerReference.current);
1384
+ }
1382
1385
  };
1383
1386
  const onExited = () => {
1384
1387
  setHasNotExited(false);
1385
- dimmerReference.current && dimmerManager.remove(dimmerReference.current);
1388
+ if (dimmerReference.current) {
1389
+ dimmerManager.remove(dimmerReference.current);
1390
+ }
1386
1391
  };
1387
1392
  React.useEffect(() => {
1388
1393
  const localReferenceCopy = dimmerReference.current;
@@ -4697,7 +4702,6 @@ const Tooltip = ({
4697
4702
 
4698
4703
  function supportsTouchEvents() {
4699
4704
  const onTouchStartIsDefined = typeof window !== 'undefined' && window.ontouchstart !== undefined;
4700
- // eslint-disable-next-line compat/compat
4701
4705
  const maxTouchPointsIsDefined = typeof navigator !== 'undefined' && navigator.maxTouchPoints;
4702
4706
  const documentTouchIsDefined = typeof window !== 'undefined' && window.DocumentTouch && document instanceof window.DocumentTouch;
4703
4707
  return !!(onTouchStartIsDefined || maxTouchPointsIsDefined || documentTouchIsDefined);
@@ -4705,7 +4709,7 @@ function supportsTouchEvents() {
4705
4709
  function userAgentSuggestsTouchDevice() {
4706
4710
  const sampleTouchDevices = ['android', 'iemobile', 'iphone', 'ipad', 'ipod', 'blackberry', 'bada'];
4707
4711
  const matchString = sampleTouchDevices.map(device => `(${device})`).join('|');
4708
- const regex = new RegExp(matchString, 'ig');
4712
+ const regex = new RegExp(matchString, 'gi');
4709
4713
  return typeof navigator !== 'undefined' && !!navigator.userAgent.match(regex);
4710
4714
  }
4711
4715
  // Important: this is not fool-proof! It gives false positives and negatives, and will be outdated.
@@ -5111,8 +5115,9 @@ function resolvePlacement(preferredPlacement) {
5111
5115
  case 'bottom-left':
5112
5116
  case 'bottom-right':
5113
5117
  return 'bottom';
5118
+ default:
5119
+ return preferredPlacement;
5114
5120
  }
5115
- return preferredPlacement;
5116
5121
  }
5117
5122
  function Popover$1({
5118
5123
  children,
@@ -6675,7 +6680,6 @@ const Loader = ({
6675
6680
  }, 1000);
6676
6681
  }
6677
6682
  return () => {
6678
- // eslint-disable-next-line fp/no-mutation
6679
6683
  cancelled = true;
6680
6684
  clearTimeout(timeout);
6681
6685
  };
@@ -8612,7 +8616,7 @@ const explodeNumberModel = number => {
8612
8616
  };
8613
8617
  };
8614
8618
 
8615
- const DIGITS_MATCH = /^$|^(\+)|([\d]+)/g;
8619
+ const DIGITS_MATCH = /^$|^(\+)|(\d+)/g;
8616
8620
  const cleanNumber = number => number.match(DIGITS_MATCH)?.join('') ?? '';
8617
8621
 
8618
8622
  function sortArrayByProperty(arrayToSort, property) {
@@ -8698,7 +8702,8 @@ const PhoneNumberInput = ({
8698
8702
  };
8699
8703
  React.useEffect(() => {
8700
8704
  if (broadcastedValue === null) {
8701
- return setBroadcastedValue(internalValue);
8705
+ setBroadcastedValue(internalValue);
8706
+ return;
8702
8707
  }
8703
8708
  const internalPhoneNumber = `${internalValue.prefix ?? ''}${internalValue.suffix}`;
8704
8709
  const broadcastedPhoneNumber = `${broadcastedValue.prefix ?? ''}${broadcastedValue.suffix}`;
@@ -8971,7 +8976,7 @@ const PromoCard = /*#__PURE__*/React.forwardRef(({
8971
8976
  const checkedProps = (type === 'checkbox' || type === 'radio') && !href ? {
8972
8977
  ...commonProps,
8973
8978
  'aria-checked': type === 'radio' ? value === state : type === 'checkbox' ? checked : undefined,
8974
- 'aria-describedby': `${componentId}-title` || undefined,
8979
+ 'aria-describedby': `${componentId}-title`,
8975
8980
  'aria-disabled': isDisabled,
8976
8981
  'data-value': value ?? undefined,
8977
8982
  role: type === 'checkbox' || type === 'radio' ? type : undefined,
@@ -9624,8 +9629,8 @@ function Select({
9624
9629
  }
9625
9630
  };
9626
9631
  function selectKeyboardFocusedOption() {
9627
- if (keyboardFocusedOptionIndex != null) {
9628
- selectableOptions.length > 0 && selectOption(selectableOptions[keyboardFocusedOptionIndex]);
9632
+ if (keyboardFocusedOptionIndex != null && selectableOptions.length > 0) {
9633
+ selectOption(selectableOptions[keyboardFocusedOptionIndex]);
9629
9634
  }
9630
9635
  }
9631
9636
  function moveFocusWithDifference(difference) {
@@ -9852,7 +9857,6 @@ function Select({
9852
9857
  disabled: disabled,
9853
9858
  "aria-controls": listboxId,
9854
9859
  "aria-expanded": open,
9855
- "aria-autocomplete": "none",
9856
9860
  onClick: handleOnClick,
9857
9861
  ...buttonProps,
9858
9862
  children: [selected ? /*#__PURE__*/jsxRuntime.jsx(Option$1, {