@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.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,
@@ -5766,6 +5771,7 @@ const defaultRenderTrigger = ({
5766
5771
  })
5767
5772
  })]
5768
5773
  }),
5774
+ initialContentWidth: 24 + 4,
5769
5775
  padding: 'sm'
5770
5776
  },
5771
5777
  disabled: disabled,
@@ -6675,7 +6681,6 @@ const Loader = ({
6675
6681
  }, 1000);
6676
6682
  }
6677
6683
  return () => {
6678
- // eslint-disable-next-line fp/no-mutation
6679
6684
  cancelled = true;
6680
6685
  clearTimeout(timeout);
6681
6686
  };
@@ -8612,7 +8617,7 @@ const explodeNumberModel = number => {
8612
8617
  };
8613
8618
  };
8614
8619
 
8615
- const DIGITS_MATCH = /^$|^(\+)|([\d]+)/g;
8620
+ const DIGITS_MATCH = /^$|^(\+)|(\d+)/g;
8616
8621
  const cleanNumber = number => number.match(DIGITS_MATCH)?.join('') ?? '';
8617
8622
 
8618
8623
  function sortArrayByProperty(arrayToSort, property) {
@@ -8698,7 +8703,8 @@ const PhoneNumberInput = ({
8698
8703
  };
8699
8704
  React.useEffect(() => {
8700
8705
  if (broadcastedValue === null) {
8701
- return setBroadcastedValue(internalValue);
8706
+ setBroadcastedValue(internalValue);
8707
+ return;
8702
8708
  }
8703
8709
  const internalPhoneNumber = `${internalValue.prefix ?? ''}${internalValue.suffix}`;
8704
8710
  const broadcastedPhoneNumber = `${broadcastedValue.prefix ?? ''}${broadcastedValue.suffix}`;
@@ -8971,7 +8977,7 @@ const PromoCard = /*#__PURE__*/React.forwardRef(({
8971
8977
  const checkedProps = (type === 'checkbox' || type === 'radio') && !href ? {
8972
8978
  ...commonProps,
8973
8979
  'aria-checked': type === 'radio' ? value === state : type === 'checkbox' ? checked : undefined,
8974
- 'aria-describedby': `${componentId}-title` || undefined,
8980
+ 'aria-describedby': `${componentId}-title`,
8975
8981
  'aria-disabled': isDisabled,
8976
8982
  'data-value': value ?? undefined,
8977
8983
  role: type === 'checkbox' || type === 'radio' ? type : undefined,
@@ -9624,8 +9630,8 @@ function Select({
9624
9630
  }
9625
9631
  };
9626
9632
  function selectKeyboardFocusedOption() {
9627
- if (keyboardFocusedOptionIndex != null) {
9628
- selectableOptions.length > 0 && selectOption(selectableOptions[keyboardFocusedOptionIndex]);
9633
+ if (keyboardFocusedOptionIndex != null && selectableOptions.length > 0) {
9634
+ selectOption(selectableOptions[keyboardFocusedOptionIndex]);
9629
9635
  }
9630
9636
  }
9631
9637
  function moveFocusWithDifference(difference) {
@@ -9852,7 +9858,6 @@ function Select({
9852
9858
  disabled: disabled,
9853
9859
  "aria-controls": listboxId,
9854
9860
  "aria-expanded": open,
9855
- "aria-autocomplete": "none",
9856
9861
  onClick: handleOnClick,
9857
9862
  ...buttonProps,
9858
9863
  children: [selected ? /*#__PURE__*/jsxRuntime.jsx(Option$1, {