@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
@@ -2656,16 +2656,16 @@ const CircularButton = ({
2656
2656
  children,
2657
2657
  disabled,
2658
2658
  icon,
2659
- priority,
2660
- type,
2659
+ priority = Priority.PRIMARY,
2660
+ type = ControlType.ACCENT,
2661
2661
  ...rest
2662
2662
  }) => {
2663
2663
  const classes = classNames('btn np-btn', typeClassMap$1[type], priorityClassMap[priority]);
2664
- const iconElement = icon.props.size !== 24 ? /*#__PURE__*/cloneElement(icon, {
2664
+ const iconElement = Number(icon.props.size) !== 24 ? /*#__PURE__*/cloneElement(icon, {
2665
2665
  size: 24
2666
2666
  }) : icon;
2667
2667
  return /*#__PURE__*/jsxs("label", {
2668
- className: classNames('np-circular-btn', priority, type, disabled ? 'disabled' : '', className),
2668
+ className: classNames('np-circular-btn', priority, type, disabled && 'disabled', className),
2669
2669
  children: [/*#__PURE__*/jsx("input", {
2670
2670
  type: "button",
2671
2671
  "aria-label": children,
@@ -2680,22 +2680,6 @@ const CircularButton = ({
2680
2680
  })]
2681
2681
  });
2682
2682
  };
2683
- CircularButton.propTypes = {
2684
- className: PropTypes.string,
2685
- children: PropTypes.string.isRequired,
2686
- disabled: PropTypes.bool,
2687
- icon: PropTypes.element.isRequired,
2688
- onClick: PropTypes.func,
2689
- priority: PropTypes.oneOf(['primary', 'secondary']),
2690
- type: PropTypes.oneOf(['accent', 'positive', 'negative'])
2691
- };
2692
- CircularButton.defaultProps = {
2693
- className: undefined,
2694
- disabled: false,
2695
- priority: Priority.PRIMARY,
2696
- type: ControlType.ACCENT
2697
- };
2698
- var CircularButton$1 = CircularButton;
2699
2683
 
2700
2684
  function getDayNames(locale, format = 'short') {
2701
2685
  const days = [];
@@ -4239,6 +4223,7 @@ class DateLookup extends PureComponent {
4239
4223
  return /*#__PURE__*/jsxs("div", {
4240
4224
  // eslint-disable-line jsx-a11y/no-static-element-interactions
4241
4225
  ref: this.element,
4226
+ id: this.props.id,
4242
4227
  "aria-labelledby": ariaLabelledBy,
4243
4228
  className: "input-group",
4244
4229
  onKeyDown: this.handleKeyDown,
@@ -4263,6 +4248,7 @@ class DateLookup extends PureComponent {
4263
4248
  }
4264
4249
  }
4265
4250
  DateLookup.propTypes = {
4251
+ id: PropTypes.string,
4266
4252
  value: PropTypes.instanceOf(Date),
4267
4253
  min: PropTypes.instanceOf(Date),
4268
4254
  max: PropTypes.instanceOf(Date),
@@ -7369,7 +7355,7 @@ const InstructionsList = ({
7369
7355
  }) : /*#__PURE__*/jsxs(Fragment, {
7370
7356
  children: [dontsInstructions, dosInstructions]
7371
7357
  });
7372
- return /*#__PURE__*/jsx("div", {
7358
+ return /*#__PURE__*/jsx("ul", {
7373
7359
  className: "tw-instructions",
7374
7360
  children: orderedInstructions
7375
7361
  });
@@ -7379,7 +7365,7 @@ function Instruction({
7379
7365
  type
7380
7366
  }) {
7381
7367
  const isInstructionNode = typeof item === 'object' && item !== null && 'content' in item && 'aria-label' in item;
7382
- return /*#__PURE__*/jsxs("div", {
7368
+ return /*#__PURE__*/jsxs("li", {
7383
7369
  className: "instruction",
7384
7370
  "aria-label": isInstructionNode ? item['aria-label'] : undefined,
7385
7371
  children: [type === 'do' ? /*#__PURE__*/jsx(CheckCircleFill, {
@@ -9400,6 +9386,7 @@ const defaultSelectProps = {};
9400
9386
  const defaultDisabledCountries = [];
9401
9387
  const PhoneNumberInput = ({
9402
9388
  id,
9389
+ 'aria-labelledby': ariaLabelledBy,
9403
9390
  required,
9404
9391
  disabled,
9405
9392
  initialValue,
@@ -9462,6 +9449,7 @@ const PhoneNumberInput = ({
9462
9449
  setBroadcastedValue(internalValue);
9463
9450
  }, [onChange, broadcastedValue, internalValue]);
9464
9451
  return /*#__PURE__*/jsxs("div", {
9452
+ "aria-labelledby": ariaLabelledBy,
9465
9453
  className: "tw-telephone",
9466
9454
  children: [/*#__PURE__*/jsx("div", {
9467
9455
  className: "tw-telephone__country-select",
@@ -11088,6 +11076,8 @@ const Summary = ({
11088
11076
  className: "np-summary__title d-flex",
11089
11077
  children: [/*#__PURE__*/jsx(Body, {
11090
11078
  as: "span",
11079
+ role: "heading",
11080
+ "aria-level": 4,
11091
11081
  type: Typography.BODY_LARGE_BOLD,
11092
11082
  className: "text-primary m-b-1",
11093
11083
  children: title
@@ -11951,7 +11941,7 @@ class TypeaheadInput extends Component {
11951
11941
  autoFocus,
11952
11942
  multiple,
11953
11943
  name,
11954
- optionsShown,
11944
+ dropdownOpen,
11955
11945
  placeholder,
11956
11946
  selected,
11957
11947
  value,
@@ -11973,7 +11963,7 @@ class TypeaheadInput extends Component {
11973
11963
  autoFocus: autoFocus,
11974
11964
  placeholder: hasPlaceholder ? placeholder : '',
11975
11965
  "aria-autocomplete": "list",
11976
- "aria-expanded": optionsShown,
11966
+ "aria-expanded": dropdownOpen,
11977
11967
  "aria-haspopup": "listbox",
11978
11968
  "aria-controls": `menu-${typeaheadId}`,
11979
11969
  autoComplete: autoComplete,
@@ -12266,7 +12256,12 @@ class Typeahead extends Component {
12266
12256
  query = item.label;
12267
12257
  }
12268
12258
  this.updateSelectedValue(selected);
12269
- this.hideMenu();
12259
+ if (!item.keepFocusOnSelect) {
12260
+ this.hideMenu();
12261
+ }
12262
+ if (item.clearQueryOnSelect) {
12263
+ query = '';
12264
+ }
12270
12265
  this.setState({
12271
12266
  query
12272
12267
  });
@@ -12470,7 +12465,7 @@ class Typeahead extends Component {
12470
12465
  }), /*#__PURE__*/jsx(TypeaheadInput, {
12471
12466
  autoFocus,
12472
12467
  multiple,
12473
- optionsShown,
12468
+ dropdownOpen,
12474
12469
  placeholder,
12475
12470
  selected,
12476
12471
  maxHeight,
@@ -12493,10 +12488,10 @@ class Typeahead extends Component {
12493
12488
  children: /*#__PURE__*/jsx(Cross, {})
12494
12489
  })
12495
12490
  })]
12496
- }), displayAlert && /*#__PURE__*/jsx(InlineAlert, {
12491
+ }), displayAlert ? /*#__PURE__*/jsx(InlineAlert, {
12497
12492
  type: alert.type,
12498
12493
  children: alert.message
12499
- }), menu]
12494
+ }) : menu]
12500
12495
  })
12501
12496
  });
12502
12497
  }
@@ -15122,5 +15117,5 @@ const translations = {
15122
15117
  'zh-HK': zhHK
15123
15118
  };
15124
15119
 
15125
- export { Accordion, ActionButton, ActionOption, Alert$1 as Alert, ArrowPosition as AlertArrowPosition, Avatar, AvatarType, AvatarWrapper, Badge, Card as BaseCard, Body, BottomSheet$2 as BottomSheet, Breakpoint, Button, Card$2 as Card, Checkbox$1 as Checkbox, CheckboxButton$1 as CheckboxButton, CheckboxOption, Chevron, Chip, Chips, CircularButton$1 as CircularButton, ControlType, CriticalCommsBanner, DEFAULT_LANG, DEFAULT_LOCALE, DateInput, DateLookup$1 as DateLookup, DateMode, Decision, DecisionPresentation, DecisionType, DefinitionList$1 as DefinitionList, Dimmer$1 as Dimmer, Direction, DirectionProvider, Display, Drawer$1 as Drawer, DropFade, DynamicFieldDefinitionList$1 as DynamicFieldDefinitionList, Emphasis, FileType, FlowNavigation, Header, Image, Info, InfoPresentation, InlineAlert, Input, InputGroup, InputWithDisplayFormat, InstructionsList, LanguageProvider, Layout, Link, ListItem$1 as ListItem, Loader$1 as Loader, Logo$1 as Logo, LogoType, Markdown, MarkdownNodeType, Modal, Money$1 as Money, MoneyInput$1 as MoneyInput, MonthFormat, NavigationOption, NavigationOptionList$1 as NavigationOptionsList, Nudge, Option$2 as Option, OverlayHeader$1 as OverlayHeader, PhoneNumberInput, Popover$2 as Popover, Position, Priority, ProcessIndicator$1 as ProcessIndicator, ProfileType, Progress, ProgressBar, PromoCard$1 as PromoCard, PromoCard$1 as PromoCardGroup, Provider$1 as Provider, RTL_LANGUAGES, Radio, RadioGroup, RadioOption, SUPPORTED_LANGUAGES, Scroll, SearchInput, Section, SegmentedControl, Select, SelectInput, SelectInputOptionContent, SelectInputTriggerButton, Sentiment, Size, SlidingPanel$1 as SlidingPanel, SnackbarConsumer, SnackbarContext, SnackbarPortal, SnackbarProvider, Status, StatusIcon, Stepper, Sticky$1 as Sticky, Summary, Switch, SwitchOption, Tabs$1 as Tabs, TextArea, TextareaWithDisplayFormat, Theme, Title, Tooltip$1 as Tooltip, Type, Typeahead, Typography, Upload$1 as Upload, UploadInput, UploadStep, Variant, Width, adjustLocale, getCountryFromLocale, getDirectionFromLocale, getLangFromLocale, isBrowser, isServerSide, translations, useDirection, useLayout, useScreenSize, useSnackbar };
15120
+ export { Accordion, ActionButton, ActionOption, Alert$1 as Alert, ArrowPosition as AlertArrowPosition, Avatar, AvatarType, AvatarWrapper, Badge, Card as BaseCard, Body, BottomSheet$2 as BottomSheet, Breakpoint, Button, Card$2 as Card, Checkbox$1 as Checkbox, CheckboxButton$1 as CheckboxButton, CheckboxOption, Chevron, Chip, Chips, CircularButton, ControlType, CriticalCommsBanner, DEFAULT_LANG, DEFAULT_LOCALE, DateInput, DateLookup$1 as DateLookup, DateMode, Decision, DecisionPresentation, DecisionType, DefinitionList$1 as DefinitionList, Dimmer$1 as Dimmer, Direction, DirectionProvider, Display, Drawer$1 as Drawer, DropFade, DynamicFieldDefinitionList$1 as DynamicFieldDefinitionList, Emphasis, FileType, FlowNavigation, Header, Image, Info, InfoPresentation, InlineAlert, Input, InputGroup, InputWithDisplayFormat, InstructionsList, LanguageProvider, Layout, Link, ListItem$1 as ListItem, Loader$1 as Loader, Logo$1 as Logo, LogoType, Markdown, MarkdownNodeType, Modal, Money$1 as Money, MoneyInput$1 as MoneyInput, MonthFormat, NavigationOption, NavigationOptionList$1 as NavigationOptionsList, Nudge, Option$2 as Option, OverlayHeader$1 as OverlayHeader, PhoneNumberInput, Popover$2 as Popover, Position, Priority, ProcessIndicator$1 as ProcessIndicator, ProfileType, Progress, ProgressBar, PromoCard$1 as PromoCard, PromoCard$1 as PromoCardGroup, Provider$1 as Provider, RTL_LANGUAGES, Radio, RadioGroup, RadioOption, SUPPORTED_LANGUAGES, Scroll, SearchInput, Section, SegmentedControl, Select, SelectInput, SelectInputOptionContent, SelectInputTriggerButton, Sentiment, Size, SlidingPanel$1 as SlidingPanel, SnackbarConsumer, SnackbarContext, SnackbarPortal, SnackbarProvider, Status, StatusIcon, Stepper, Sticky$1 as Sticky, Summary, Switch, SwitchOption, Tabs$1 as Tabs, TextArea, TextareaWithDisplayFormat, Theme, Title, Tooltip$1 as Tooltip, Type, Typeahead, Typography, Upload$1 as Upload, UploadInput, UploadStep, Variant, Width, adjustLocale, getCountryFromLocale, getDirectionFromLocale, getLangFromLocale, isBrowser, isServerSide, translations, useDirection, useLayout, useScreenSize, useSnackbar };
15126
15121
  //# sourceMappingURL=index.esm.js.map