@transferwise/components 46.17.3 → 46.19.0

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 (58) hide show
  1. package/build/index.esm.js +24 -29
  2. package/build/index.esm.js.map +1 -1
  3. package/build/index.js +24 -29
  4. package/build/index.js.map +1 -1
  5. package/build/main.css +4 -0
  6. package/build/styles/instructionsList/InstructionsList.css +4 -0
  7. package/build/styles/main.css +4 -0
  8. package/build/types/accordion/Accordion.d.ts +3 -7
  9. package/build/types/accordion/Accordion.d.ts.map +1 -1
  10. package/build/types/accordion/index.d.ts +1 -0
  11. package/build/types/accordion/index.d.ts.map +1 -1
  12. package/build/types/actionButton/ActionButton.d.ts +1 -1
  13. package/build/types/body/Body.d.ts +1 -1
  14. package/build/types/circularButton/CircularButton.d.ts +16 -20
  15. package/build/types/circularButton/CircularButton.d.ts.map +1 -1
  16. package/build/types/circularButton/index.d.ts +2 -1
  17. package/build/types/circularButton/index.d.ts.map +1 -1
  18. package/build/types/dateLookup/DateLookup.d.ts +1 -0
  19. package/build/types/dateLookup/DateLookup.d.ts.map +1 -1
  20. package/build/types/index.d.ts +3 -1
  21. package/build/types/index.d.ts.map +1 -1
  22. package/build/types/phoneNumberInput/PhoneNumberInput.d.ts +2 -1
  23. package/build/types/phoneNumberInput/PhoneNumberInput.d.ts.map +1 -1
  24. package/build/types/radioGroup/RadioGroup.d.ts +2 -1
  25. package/build/types/radioGroup/RadioGroup.d.ts.map +1 -1
  26. package/build/types/radioGroup/index.d.ts +1 -1
  27. package/build/types/radioGroup/index.d.ts.map +1 -1
  28. package/build/types/summary/Summary.d.ts.map +1 -1
  29. package/build/types/typeahead/Typeahead.d.ts +3 -1
  30. package/build/types/typeahead/Typeahead.d.ts.map +1 -1
  31. package/build/types/typeahead/typeaheadInput/TypeaheadInput.d.ts +1 -1
  32. package/package.json +1 -1
  33. package/src/accordion/Accordion.tsx +6 -7
  34. package/src/accordion/index.ts +1 -0
  35. package/src/circularButton/{CircularButton.story.js → CircularButton.story.tsx} +2 -2
  36. package/src/circularButton/CircularButton.tsx +51 -0
  37. package/src/circularButton/index.ts +2 -0
  38. package/src/dateLookup/DateLookup.js +2 -0
  39. package/src/dateLookup/DateLookup.story.js +3 -0
  40. package/src/dateLookup/DateLookup.view.spec.js +5 -0
  41. package/src/index.ts +3 -1
  42. package/src/instructionsList/InstructionsList.css +4 -0
  43. package/src/instructionsList/InstructionsList.less +5 -0
  44. package/src/instructionsList/InstructionsList.tsx +3 -3
  45. package/src/main.css +4 -0
  46. package/src/phoneNumberInput/PhoneNumberInput.rtl.spec.tsx +22 -0
  47. package/src/phoneNumberInput/PhoneNumberInput.tsx +3 -1
  48. package/src/radioGroup/RadioGroup.tsx +6 -1
  49. package/src/radioGroup/index.ts +1 -1
  50. package/src/summary/Summary.tsx +7 -1
  51. package/src/typeahead/Typeahead.spec.js +9 -0
  52. package/src/typeahead/Typeahead.story.tsx +109 -0
  53. package/src/typeahead/Typeahead.tsx +13 -4
  54. package/src/typeahead/typeaheadInput/TypeaheadInput.tsx +3 -3
  55. package/src/circularButton/CircularButton.js +0 -57
  56. package/src/circularButton/index.js +0 -1
  57. /package/src/circularButton/{CircularButton.spec.js → CircularButton.spec.tsx} +0 -0
  58. /package/src/circularButton/__snapshots__/{CircularButton.spec.js.snap → CircularButton.spec.tsx.snap} +0 -0
package/build/index.js CHANGED
@@ -2689,16 +2689,16 @@ const CircularButton = ({
2689
2689
  children,
2690
2690
  disabled,
2691
2691
  icon,
2692
- priority,
2693
- type,
2692
+ priority = exports.Priority.PRIMARY,
2693
+ type = exports.ControlType.ACCENT,
2694
2694
  ...rest
2695
2695
  }) => {
2696
2696
  const classes = classNames__default.default('btn np-btn', typeClassMap$1[type], priorityClassMap[priority]);
2697
- const iconElement = icon.props.size !== 24 ? /*#__PURE__*/React.cloneElement(icon, {
2697
+ const iconElement = Number(icon.props.size) !== 24 ? /*#__PURE__*/React.cloneElement(icon, {
2698
2698
  size: 24
2699
2699
  }) : icon;
2700
2700
  return /*#__PURE__*/jsxRuntime.jsxs("label", {
2701
- className: classNames__default.default('np-circular-btn', priority, type, disabled ? 'disabled' : '', className),
2701
+ className: classNames__default.default('np-circular-btn', priority, type, disabled && 'disabled', className),
2702
2702
  children: [/*#__PURE__*/jsxRuntime.jsx("input", {
2703
2703
  type: "button",
2704
2704
  "aria-label": children,
@@ -2713,22 +2713,6 @@ const CircularButton = ({
2713
2713
  })]
2714
2714
  });
2715
2715
  };
2716
- CircularButton.propTypes = {
2717
- className: PropTypes__default.default.string,
2718
- children: PropTypes__default.default.string.isRequired,
2719
- disabled: PropTypes__default.default.bool,
2720
- icon: PropTypes__default.default.element.isRequired,
2721
- onClick: PropTypes__default.default.func,
2722
- priority: PropTypes__default.default.oneOf(['primary', 'secondary']),
2723
- type: PropTypes__default.default.oneOf(['accent', 'positive', 'negative'])
2724
- };
2725
- CircularButton.defaultProps = {
2726
- className: undefined,
2727
- disabled: false,
2728
- priority: exports.Priority.PRIMARY,
2729
- type: exports.ControlType.ACCENT
2730
- };
2731
- var CircularButton$1 = CircularButton;
2732
2716
 
2733
2717
  function getDayNames(locale, format = 'short') {
2734
2718
  const days = [];
@@ -4272,6 +4256,7 @@ class DateLookup extends React.PureComponent {
4272
4256
  return /*#__PURE__*/jsxRuntime.jsxs("div", {
4273
4257
  // eslint-disable-line jsx-a11y/no-static-element-interactions
4274
4258
  ref: this.element,
4259
+ id: this.props.id,
4275
4260
  "aria-labelledby": ariaLabelledBy,
4276
4261
  className: "input-group",
4277
4262
  onKeyDown: this.handleKeyDown,
@@ -4296,6 +4281,7 @@ class DateLookup extends React.PureComponent {
4296
4281
  }
4297
4282
  }
4298
4283
  DateLookup.propTypes = {
4284
+ id: PropTypes__default.default.string,
4299
4285
  value: PropTypes__default.default.instanceOf(Date),
4300
4286
  min: PropTypes__default.default.instanceOf(Date),
4301
4287
  max: PropTypes__default.default.instanceOf(Date),
@@ -7402,7 +7388,7 @@ const InstructionsList = ({
7402
7388
  }) : /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
7403
7389
  children: [dontsInstructions, dosInstructions]
7404
7390
  });
7405
- return /*#__PURE__*/jsxRuntime.jsx("div", {
7391
+ return /*#__PURE__*/jsxRuntime.jsx("ul", {
7406
7392
  className: "tw-instructions",
7407
7393
  children: orderedInstructions
7408
7394
  });
@@ -7412,7 +7398,7 @@ function Instruction({
7412
7398
  type
7413
7399
  }) {
7414
7400
  const isInstructionNode = typeof item === 'object' && item !== null && 'content' in item && 'aria-label' in item;
7415
- return /*#__PURE__*/jsxRuntime.jsxs("div", {
7401
+ return /*#__PURE__*/jsxRuntime.jsxs("li", {
7416
7402
  className: "instruction",
7417
7403
  "aria-label": isInstructionNode ? item['aria-label'] : undefined,
7418
7404
  children: [type === 'do' ? /*#__PURE__*/jsxRuntime.jsx(icons.CheckCircleFill, {
@@ -9433,6 +9419,7 @@ const defaultSelectProps = {};
9433
9419
  const defaultDisabledCountries = [];
9434
9420
  const PhoneNumberInput = ({
9435
9421
  id,
9422
+ 'aria-labelledby': ariaLabelledBy,
9436
9423
  required,
9437
9424
  disabled,
9438
9425
  initialValue,
@@ -9495,6 +9482,7 @@ const PhoneNumberInput = ({
9495
9482
  setBroadcastedValue(internalValue);
9496
9483
  }, [onChange, broadcastedValue, internalValue]);
9497
9484
  return /*#__PURE__*/jsxRuntime.jsxs("div", {
9485
+ "aria-labelledby": ariaLabelledBy,
9498
9486
  className: "tw-telephone",
9499
9487
  children: [/*#__PURE__*/jsxRuntime.jsx("div", {
9500
9488
  className: "tw-telephone__country-select",
@@ -11121,6 +11109,8 @@ const Summary = ({
11121
11109
  className: "np-summary__title d-flex",
11122
11110
  children: [/*#__PURE__*/jsxRuntime.jsx(Body, {
11123
11111
  as: "span",
11112
+ role: "heading",
11113
+ "aria-level": 4,
11124
11114
  type: exports.Typography.BODY_LARGE_BOLD,
11125
11115
  className: "text-primary m-b-1",
11126
11116
  children: title
@@ -11984,7 +11974,7 @@ class TypeaheadInput extends React.Component {
11984
11974
  autoFocus,
11985
11975
  multiple,
11986
11976
  name,
11987
- optionsShown,
11977
+ dropdownOpen,
11988
11978
  placeholder,
11989
11979
  selected,
11990
11980
  value,
@@ -12006,7 +11996,7 @@ class TypeaheadInput extends React.Component {
12006
11996
  autoFocus: autoFocus,
12007
11997
  placeholder: hasPlaceholder ? placeholder : '',
12008
11998
  "aria-autocomplete": "list",
12009
- "aria-expanded": optionsShown,
11999
+ "aria-expanded": dropdownOpen,
12010
12000
  "aria-haspopup": "listbox",
12011
12001
  "aria-controls": `menu-${typeaheadId}`,
12012
12002
  autoComplete: autoComplete,
@@ -12299,7 +12289,12 @@ class Typeahead extends React.Component {
12299
12289
  query = item.label;
12300
12290
  }
12301
12291
  this.updateSelectedValue(selected);
12302
- this.hideMenu();
12292
+ if (!item.keepFocusOnSelect) {
12293
+ this.hideMenu();
12294
+ }
12295
+ if (item.clearQueryOnSelect) {
12296
+ query = '';
12297
+ }
12303
12298
  this.setState({
12304
12299
  query
12305
12300
  });
@@ -12503,7 +12498,7 @@ class Typeahead extends React.Component {
12503
12498
  }), /*#__PURE__*/jsxRuntime.jsx(TypeaheadInput, {
12504
12499
  autoFocus,
12505
12500
  multiple,
12506
- optionsShown,
12501
+ dropdownOpen,
12507
12502
  placeholder,
12508
12503
  selected,
12509
12504
  maxHeight,
@@ -12526,10 +12521,10 @@ class Typeahead extends React.Component {
12526
12521
  children: /*#__PURE__*/jsxRuntime.jsx(icons.Cross, {})
12527
12522
  })
12528
12523
  })]
12529
- }), displayAlert && /*#__PURE__*/jsxRuntime.jsx(InlineAlert, {
12524
+ }), displayAlert ? /*#__PURE__*/jsxRuntime.jsx(InlineAlert, {
12530
12525
  type: alert.type,
12531
12526
  children: alert.message
12532
- }), menu]
12527
+ }) : menu]
12533
12528
  })
12534
12529
  });
12535
12530
  }
@@ -15173,7 +15168,7 @@ exports.CheckboxOption = CheckboxOption;
15173
15168
  exports.Chevron = Chevron;
15174
15169
  exports.Chip = Chip;
15175
15170
  exports.Chips = Chips;
15176
- exports.CircularButton = CircularButton$1;
15171
+ exports.CircularButton = CircularButton;
15177
15172
  exports.CriticalCommsBanner = CriticalCommsBanner;
15178
15173
  exports.DEFAULT_LANG = DEFAULT_LANG;
15179
15174
  exports.DEFAULT_LOCALE = DEFAULT_LOCALE;