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

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 (50) hide show
  1. package/build/index.js +20 -15
  2. package/build/index.js.map +1 -1
  3. package/build/index.mjs +20 -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/inputs/SelectInput.d.ts.map +1 -1
  8. package/build/types/loader/Loader.d.ts.map +1 -1
  9. package/build/types/phoneNumberInput/PhoneNumberInput.d.ts.map +1 -1
  10. package/build/types/popover/Popover.d.ts.map +1 -1
  11. package/build/types/select/Select.d.ts.map +1 -1
  12. package/build/types/stepper/deviceDetection.d.ts.map +1 -1
  13. package/build/types/uploadInput/uploadButton/UploadButton.d.ts.map +1 -1
  14. package/package.json +3 -3
  15. package/src/accordion/Accordion.story.tsx +1 -1
  16. package/src/alert/Alert.tsx +2 -1
  17. package/src/avatar/colors/colors.ts +1 -1
  18. package/src/body/Body.spec.tsx +1 -1
  19. package/src/body/Body.story.tsx +8 -8
  20. package/src/checkbox/Checkbox.js +1 -1
  21. package/src/checkboxButton/CheckboxButton.spec.tsx +0 -1
  22. package/src/common/Option/Option.tsx +1 -1
  23. package/src/common/deviceDetection/deviceDetection.js +1 -1
  24. package/src/common/deviceDetection/deviceDetection.spec.js +4 -2
  25. package/src/common/responsivePanel/ResponsivePanel.spec.js +11 -15
  26. package/src/decision/Decision.spec.js +0 -1
  27. package/src/dimmer/Dimmer.tsx +6 -2
  28. package/src/inlineAlert/InlineAlert.story.tsx +8 -7
  29. package/src/inputs/SelectInput.tsx +1 -0
  30. package/src/link/Link.story.tsx +16 -16
  31. package/src/loader/Loader.tsx +0 -1
  32. package/src/logo/Logo.js +2 -2
  33. package/src/moneyInput/MoneyInput.story.tsx +3 -3
  34. package/src/nudge/Nudge.spec.tsx +5 -5
  35. package/src/phoneNumberInput/PhoneNumberInput.tsx +2 -1
  36. package/src/phoneNumberInput/utils/cleanNumber/cleanNumber.ts +1 -1
  37. package/src/popover/Popover.tsx +2 -1
  38. package/src/promoCard/PromoCard.tsx +1 -1
  39. package/src/radioGroup/RadioGroup.spec.js +1 -1
  40. package/src/section/Section.story.tsx +2 -1
  41. package/src/segmentedControl/SegmentedControl.spec.tsx +2 -2
  42. package/src/select/Select.js +2 -3
  43. package/src/stepper/deviceDetection.js +1 -2
  44. package/src/stepper/deviceDetection.spec.js +8 -3
  45. package/src/test-utils/index.js +1 -1
  46. package/src/test-utils/story-config.ts +1 -1
  47. package/src/title/Title.spec.tsx +1 -1
  48. package/src/typeahead/Typeahead.spec.js +4 -2
  49. package/src/upload/Upload.spec.js +8 -4
  50. package/src/uploadInput/uploadButton/UploadButton.tsx +1 -0
package/build/index.mjs CHANGED
@@ -62,7 +62,7 @@ var HistoryNavigator$1 = HistoryNavigator;
62
62
  function isIosDevice() {
63
63
  const sampleTouchDevices = ['iphone', 'ipad', 'ipod'];
64
64
  const matchString = sampleTouchDevices.map(device => `(${device})`).join('|');
65
- const regex = new RegExp(matchString, 'ig');
65
+ const regex = new RegExp(matchString, 'gi');
66
66
  return typeof navigator !== 'undefined' && !!navigator.userAgent.match(regex);
67
67
  }
68
68
 
@@ -908,8 +908,9 @@ function resolveType(type) {
908
908
  return 'neutral';
909
909
  case 'error':
910
910
  return 'negative';
911
+ default:
912
+ return type;
911
913
  }
912
- return type;
913
914
  }
914
915
  function Alert({
915
916
  arrow,
@@ -1055,7 +1056,7 @@ const hashSeed = seed => {
1055
1056
  const modulo = avatarColors.length;
1056
1057
  let hashValue = 0;
1057
1058
  let basePow = 1;
1058
- for (let i = 0; i < seed.length; i++) {
1059
+ for (let i = 0; i < seed.length; i += 1) {
1059
1060
  hashValue = (hashValue + seed.charCodeAt(i) * basePow) % modulo;
1060
1061
  basePow = basePow * base % modulo;
1061
1062
  }
@@ -1347,11 +1348,15 @@ const Dimmer = ({
1347
1348
  }, [onClose]);
1348
1349
  const onEnter = () => {
1349
1350
  setHasNotExited(true);
1350
- dimmerReference.current && dimmerManager.add(dimmerReference.current);
1351
+ if (dimmerReference.current) {
1352
+ dimmerManager.add(dimmerReference.current);
1353
+ }
1351
1354
  };
1352
1355
  const onExited = () => {
1353
1356
  setHasNotExited(false);
1354
- dimmerReference.current && dimmerManager.remove(dimmerReference.current);
1357
+ if (dimmerReference.current) {
1358
+ dimmerManager.remove(dimmerReference.current);
1359
+ }
1355
1360
  };
1356
1361
  useEffect(() => {
1357
1362
  const localReferenceCopy = dimmerReference.current;
@@ -4666,7 +4671,6 @@ const Tooltip = ({
4666
4671
 
4667
4672
  function supportsTouchEvents() {
4668
4673
  const onTouchStartIsDefined = typeof window !== 'undefined' && window.ontouchstart !== undefined;
4669
- // eslint-disable-next-line compat/compat
4670
4674
  const maxTouchPointsIsDefined = typeof navigator !== 'undefined' && navigator.maxTouchPoints;
4671
4675
  const documentTouchIsDefined = typeof window !== 'undefined' && window.DocumentTouch && document instanceof window.DocumentTouch;
4672
4676
  return !!(onTouchStartIsDefined || maxTouchPointsIsDefined || documentTouchIsDefined);
@@ -4674,7 +4678,7 @@ function supportsTouchEvents() {
4674
4678
  function userAgentSuggestsTouchDevice() {
4675
4679
  const sampleTouchDevices = ['android', 'iemobile', 'iphone', 'ipad', 'ipod', 'blackberry', 'bada'];
4676
4680
  const matchString = sampleTouchDevices.map(device => `(${device})`).join('|');
4677
- const regex = new RegExp(matchString, 'ig');
4681
+ const regex = new RegExp(matchString, 'gi');
4678
4682
  return typeof navigator !== 'undefined' && !!navigator.userAgent.match(regex);
4679
4683
  }
4680
4684
  // Important: this is not fool-proof! It gives false positives and negatives, and will be outdated.
@@ -5080,8 +5084,9 @@ function resolvePlacement(preferredPlacement) {
5080
5084
  case 'bottom-left':
5081
5085
  case 'bottom-right':
5082
5086
  return 'bottom';
5087
+ default:
5088
+ return preferredPlacement;
5083
5089
  }
5084
- return preferredPlacement;
5085
5090
  }
5086
5091
  function Popover$1({
5087
5092
  children,
@@ -5735,6 +5740,7 @@ const defaultRenderTrigger = ({
5735
5740
  })
5736
5741
  })]
5737
5742
  }),
5743
+ initialContentWidth: 24 + 4,
5738
5744
  padding: 'sm'
5739
5745
  },
5740
5746
  disabled: disabled,
@@ -6644,7 +6650,6 @@ const Loader = ({
6644
6650
  }, 1000);
6645
6651
  }
6646
6652
  return () => {
6647
- // eslint-disable-next-line fp/no-mutation
6648
6653
  cancelled = true;
6649
6654
  clearTimeout(timeout);
6650
6655
  };
@@ -8581,7 +8586,7 @@ const explodeNumberModel = number => {
8581
8586
  };
8582
8587
  };
8583
8588
 
8584
- const DIGITS_MATCH = /^$|^(\+)|([\d]+)/g;
8589
+ const DIGITS_MATCH = /^$|^(\+)|(\d+)/g;
8585
8590
  const cleanNumber = number => number.match(DIGITS_MATCH)?.join('') ?? '';
8586
8591
 
8587
8592
  function sortArrayByProperty(arrayToSort, property) {
@@ -8667,7 +8672,8 @@ const PhoneNumberInput = ({
8667
8672
  };
8668
8673
  useEffect(() => {
8669
8674
  if (broadcastedValue === null) {
8670
- return setBroadcastedValue(internalValue);
8675
+ setBroadcastedValue(internalValue);
8676
+ return;
8671
8677
  }
8672
8678
  const internalPhoneNumber = `${internalValue.prefix ?? ''}${internalValue.suffix}`;
8673
8679
  const broadcastedPhoneNumber = `${broadcastedValue.prefix ?? ''}${broadcastedValue.suffix}`;
@@ -8940,7 +8946,7 @@ const PromoCard = /*#__PURE__*/forwardRef(({
8940
8946
  const checkedProps = (type === 'checkbox' || type === 'radio') && !href ? {
8941
8947
  ...commonProps,
8942
8948
  'aria-checked': type === 'radio' ? value === state : type === 'checkbox' ? checked : undefined,
8943
- 'aria-describedby': `${componentId}-title` || undefined,
8949
+ 'aria-describedby': `${componentId}-title`,
8944
8950
  'aria-disabled': isDisabled,
8945
8951
  'data-value': value ?? undefined,
8946
8952
  role: type === 'checkbox' || type === 'radio' ? type : undefined,
@@ -9593,8 +9599,8 @@ function Select({
9593
9599
  }
9594
9600
  };
9595
9601
  function selectKeyboardFocusedOption() {
9596
- if (keyboardFocusedOptionIndex != null) {
9597
- selectableOptions.length > 0 && selectOption(selectableOptions[keyboardFocusedOptionIndex]);
9602
+ if (keyboardFocusedOptionIndex != null && selectableOptions.length > 0) {
9603
+ selectOption(selectableOptions[keyboardFocusedOptionIndex]);
9598
9604
  }
9599
9605
  }
9600
9606
  function moveFocusWithDifference(difference) {
@@ -9821,7 +9827,6 @@ function Select({
9821
9827
  disabled: disabled,
9822
9828
  "aria-controls": listboxId,
9823
9829
  "aria-expanded": open,
9824
- "aria-autocomplete": "none",
9825
9830
  onClick: handleOnClick,
9826
9831
  ...buttonProps,
9827
9832
  children: [selected ? /*#__PURE__*/jsx(Option$1, {