@transferwise/components 45.19.1 → 45.19.3

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.
package/build/index.js CHANGED
@@ -823,7 +823,7 @@ const ActionOption = ({
823
823
  });
824
824
  };
825
825
 
826
- var messages$a = reactIntl.defineMessages({
826
+ var messages$b = reactIntl.defineMessages({
827
827
  ariaLabel: {
828
828
  id: "neptune.CloseButton.ariaLabel"
829
829
  }
@@ -839,7 +839,7 @@ const CloseButton = /*#__PURE__*/React.forwardRef(function CloseButton({
839
839
  testId
840
840
  }, reference) {
841
841
  const intl = reactIntl.useIntl();
842
- ariaLabel ??= intl.formatMessage(messages$a.ariaLabel);
842
+ ariaLabel ??= intl.formatMessage(messages$b.ariaLabel);
843
843
  const Icon = filled ? icons.CrossCircleFill : icons.Cross;
844
844
  return /*#__PURE__*/jsxRuntime.jsx("button", {
845
845
  ref: reference,
@@ -859,7 +859,7 @@ const CloseButton = /*#__PURE__*/React.forwardRef(function CloseButton({
859
859
  });
860
860
  });
861
861
 
862
- var messages$9 = reactIntl.defineMessages({
862
+ var messages$a = reactIntl.defineMessages({
863
863
  opensInNewTab: {
864
864
  id: "neptune.Link.opensInNewTab"
865
865
  }
@@ -888,7 +888,7 @@ const Link = ({
888
888
  onClick: onClick,
889
889
  ...props,
890
890
  children: [children, " ", isBlank && /*#__PURE__*/jsxRuntime.jsx(icons.NavigateAway, {
891
- title: formatMessage(messages$9.opensInNewTab)
891
+ title: formatMessage(messages$a.opensInNewTab)
892
892
  })]
893
893
  });
894
894
  };
@@ -2250,7 +2250,7 @@ ProcessIndicator.defaultProps = {
2250
2250
  };
2251
2251
  var ProcessIndicator$1 = ProcessIndicator;
2252
2252
 
2253
- var messages$8 = reactIntl.defineMessages({
2253
+ var messages$9 = reactIntl.defineMessages({
2254
2254
  loadingAriaLabel: {
2255
2255
  id: "neptune.Button.loadingAriaLabel"
2256
2256
  }
@@ -2369,7 +2369,7 @@ const Button = /*#__PURE__*/React.forwardRef(({
2369
2369
  className: classes,
2370
2370
  ...props,
2371
2371
  "aria-live": loading ? 'polite' : 'off',
2372
- "aria-label": loading ? intl.formatMessage(messages$8.loadingAriaLabel) : undefined,
2372
+ "aria-label": loading ? intl.formatMessage(messages$9.loadingAriaLabel) : rest['aria-label'],
2373
2373
  children: [children, loading && /*#__PURE__*/jsxRuntime.jsx(ProcessIndicator$1, {
2374
2374
  size: processIndicatorSize(),
2375
2375
  className: "btn-loader"
@@ -2662,7 +2662,7 @@ const Chip = ({
2662
2662
  }, value);
2663
2663
  };
2664
2664
 
2665
- var messages$7 = reactIntl.defineMessages({
2665
+ var messages$8 = reactIntl.defineMessages({
2666
2666
  ariaLabel: {
2667
2667
  id: "neptune.Chips.ariaLabel"
2668
2668
  }
@@ -2694,7 +2694,7 @@ const Chips = ({
2694
2694
  value: chip.value,
2695
2695
  label: chip.label,
2696
2696
  closeButton: {
2697
- 'aria-label': intl.formatMessage(messages$7.ariaLabel, {
2697
+ 'aria-label': intl.formatMessage(messages$8.ariaLabel, {
2698
2698
  choice: chip.label
2699
2699
  })
2700
2700
  },
@@ -2802,7 +2802,7 @@ const validDateObject = dateObject => dateObject instanceof Date && !isNaN(dateO
2802
2802
 
2803
2803
  const isMonthAndYearFormat = dateString => validDateString(dateString) && dateString.split('-').length < 3;
2804
2804
 
2805
- var messages$6 = reactIntl.defineMessages({
2805
+ var messages$7 = reactIntl.defineMessages({
2806
2806
  monthLabel: {
2807
2807
  id: "neptune.DateInput.month.label"
2808
2808
  },
@@ -2880,12 +2880,12 @@ const DateInput = ({
2880
2880
  const [month, setMonth] = React.useState(() => getExplodedDate('month'));
2881
2881
  const [year, setYear] = React.useState(() => getExplodedDate('year'));
2882
2882
  const [lastBroadcastedValue, setLastBroadcastedValue] = React.useState(getDateObject);
2883
- dayLabel = dayLabel || formatMessage(messages$6.dayLabel);
2884
- monthLabel = monthLabel || formatMessage(messages$6.monthLabel);
2885
- yearLabel = yearLabel || formatMessage(messages$6.yearLabel);
2883
+ dayLabel = dayLabel || formatMessage(messages$7.dayLabel);
2884
+ monthLabel = monthLabel || formatMessage(messages$7.monthLabel);
2885
+ yearLabel = yearLabel || formatMessage(messages$7.yearLabel);
2886
2886
  placeholders = {
2887
2887
  day: placeholders?.day || 'DD',
2888
- month: placeholders?.month || formatMessage(messages$6.monthLabel),
2888
+ month: placeholders?.month || formatMessage(messages$7.monthLabel),
2889
2889
  year: placeholders?.year || 'YYYY'
2890
2890
  };
2891
2891
  const getDateAsString = date => {
@@ -3316,7 +3316,7 @@ const ResponsivePanel = /*#__PURE__*/React.forwardRef(({
3316
3316
  });
3317
3317
  var ResponsivePanel$1 = ResponsivePanel;
3318
3318
 
3319
- var messages$5 = reactIntl.defineMessages({
3319
+ var messages$6 = reactIntl.defineMessages({
3320
3320
  ariaLabel: {
3321
3321
  id: "neptune.ClearButton.ariaLabel"
3322
3322
  }
@@ -3379,7 +3379,7 @@ const DateTrigger = ({
3379
3379
  className: "input-group-addon",
3380
3380
  children: /*#__PURE__*/jsxRuntime.jsx(CloseButton, {
3381
3381
  className: `clear-btn clear-btn--${size}`,
3382
- "aria-label": formatMessage(messages$5.ariaLabel),
3382
+ "aria-label": formatMessage(messages$6.ariaLabel),
3383
3383
  size: exports.Size.SMALL,
3384
3384
  onClick: event => {
3385
3385
  event.stopPropagation();
@@ -3409,7 +3409,7 @@ DateTrigger.defaultProps = {
3409
3409
  };
3410
3410
  var DateTrigger$1 = DateTrigger;
3411
3411
 
3412
- var messages$4 = reactIntl.defineMessages({
3412
+ var messages$5 = reactIntl.defineMessages({
3413
3413
  next: {
3414
3414
  id: "neptune.DateLookup.next"
3415
3415
  },
@@ -3452,7 +3452,7 @@ const DateHeader = ({
3452
3452
  children: /*#__PURE__*/jsxRuntime.jsx("button", {
3453
3453
  type: "button",
3454
3454
  className: `d-inline-flex ${buttonClasses}`,
3455
- "aria-label": `${intl.formatMessage(messages$4.previous)} ${dateMode}`,
3455
+ "aria-label": `${intl.formatMessage(messages$5.previous)} ${dateMode}`,
3456
3456
  onClick: onPreviousClick,
3457
3457
  children: /*#__PURE__*/jsxRuntime.jsx(Chevron$1, {
3458
3458
  orientation: exports.Position.LEFT,
@@ -3463,7 +3463,7 @@ const DateHeader = ({
3463
3463
  }), label && /*#__PURE__*/jsxRuntime.jsx("button", {
3464
3464
  type: "button",
3465
3465
  className: `tw-date-lookup-header-current ${buttonClasses}`,
3466
- "aria-label": intl.formatMessage(messages$4.goTo20YearView),
3466
+ "aria-label": intl.formatMessage(messages$5.goTo20YearView),
3467
3467
  onClick: onLabelClick,
3468
3468
  children: label
3469
3469
  }), /*#__PURE__*/jsxRuntime.jsx("div", {
@@ -3471,7 +3471,7 @@ const DateHeader = ({
3471
3471
  children: /*#__PURE__*/jsxRuntime.jsx("button", {
3472
3472
  type: "button",
3473
3473
  className: `d-inline-flex ${buttonClasses}`,
3474
- "aria-label": `${reactIntl.useIntl().formatMessage(messages$4.next)} ${dateMode}`,
3474
+ "aria-label": `${reactIntl.useIntl().formatMessage(messages$5.next)} ${dateMode}`,
3475
3475
  onClick: onNextClick,
3476
3476
  children: /*#__PURE__*/jsxRuntime.jsx(Chevron$1, {
3477
3477
  orientation: exports.Position.RIGHT,
@@ -3515,7 +3515,7 @@ class TableLink extends React.PureComponent {
3515
3515
  };
3516
3516
  calculateAriaLabel = (longTitle, title, active, type, formatMessage) => {
3517
3517
  if (active) {
3518
- return `${longTitle || title}, ${formatMessage(messages$4.selected)} ${formatMessage(messages$4[type])}`;
3518
+ return `${longTitle || title}, ${formatMessage(messages$5.selected)} ${formatMessage(messages$5[type])}`;
3519
3519
  }
3520
3520
  return longTitle || title;
3521
3521
  };
@@ -3738,7 +3738,7 @@ class DayCalendar extends React.PureComponent {
3738
3738
  month: monthFormat,
3739
3739
  year: 'numeric'
3740
3740
  }),
3741
- dateMode: formatMessage(messages$4.month),
3741
+ dateMode: formatMessage(messages$5.month),
3742
3742
  onLabelClick: onLabelClick,
3743
3743
  onPreviousClick: this.selectPreviousMonth,
3744
3744
  onNextClick: this.selectNextMonth
@@ -3866,7 +3866,7 @@ class MonthCalendar extends React.PureComponent {
3866
3866
  } = this.props;
3867
3867
  return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
3868
3868
  children: [/*#__PURE__*/jsxRuntime.jsx(DateHeader$1, {
3869
- dateMode: formatMessage(messages$4.year),
3869
+ dateMode: formatMessage(messages$5.year),
3870
3870
  label: formatting.formatDate(new Date(viewYear, 0), locale, {
3871
3871
  year: 'numeric'
3872
3872
  }),
@@ -3991,7 +3991,7 @@ class YearCalendar extends React.PureComponent {
3991
3991
  } = this.props;
3992
3992
  return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
3993
3993
  children: [/*#__PURE__*/jsxRuntime.jsx(DateHeader$1, {
3994
- dateMode: formatMessage(messages$4.twentyYears),
3994
+ dateMode: formatMessage(messages$5.twentyYears),
3995
3995
  onPreviousClick: this.selectPreviousYears,
3996
3996
  onNextClick: this.selectNextYears
3997
3997
  }), /*#__PURE__*/jsxRuntime.jsx(YearCalendarTable$1, {
@@ -5689,13 +5689,21 @@ const Stepper = ({
5689
5689
  });
5690
5690
  };
5691
5691
 
5692
+ var messages$4 = reactIntl.defineMessages({
5693
+ back: {
5694
+ id: "neptune.FlowNavigation.back"
5695
+ }
5696
+ });
5697
+
5692
5698
  const AnimatedLabel = ({
5693
5699
  activeLabel,
5694
5700
  className,
5695
- labels
5701
+ labels,
5702
+ 'aria-label': ariaLabel
5696
5703
  }) => {
5697
5704
  const numberLabels = labels.length - 1;
5698
5705
  return /*#__PURE__*/jsxRuntime.jsx("div", {
5706
+ "aria-label": ariaLabel,
5699
5707
  className: classNames__default.default('np-animated-label', 'np-text-body-large-bold', className),
5700
5708
  children: labels.map((label, index) => {
5701
5709
  const nextLabel = index - 1;
@@ -5709,15 +5717,6 @@ const AnimatedLabel = ({
5709
5717
  })
5710
5718
  });
5711
5719
  };
5712
- AnimatedLabel.propTypes = {
5713
- activeLabel: PropTypes__default.default.number.isRequired,
5714
- className: PropTypes__default.default.string,
5715
- labels: PropTypes__default.default.arrayOf(PropTypes__default.default.node).isRequired
5716
- };
5717
- AnimatedLabel.defaultProps = {
5718
- className: undefined
5719
- };
5720
- var AnimatedLabel$1 = AnimatedLabel;
5721
5720
 
5722
5721
  const BackButton = ({
5723
5722
  label,
@@ -5752,6 +5751,7 @@ const FlowNavigation = ({
5752
5751
  steps
5753
5752
  }) => {
5754
5753
  const reference = React.useRef(null);
5754
+ const intl = reactIntl.useIntl();
5755
5755
  const [clientWidth] = useClientWidth({
5756
5756
  ref: reference
5757
5757
  });
@@ -5765,10 +5765,11 @@ const FlowNavigation = ({
5765
5765
  const displayGoBack = onGoBack != null && activeStep > 0;
5766
5766
  return /*#__PURE__*/jsxRuntime.jsx(jsxRuntime.Fragment, {
5767
5767
  children: displayGoBack ? /*#__PURE__*/jsxRuntime.jsx(BackButton$1, {
5768
- label: /*#__PURE__*/jsxRuntime.jsx(AnimatedLabel$1, {
5768
+ label: /*#__PURE__*/jsxRuntime.jsx(AnimatedLabel, {
5769
5769
  className: "m-x-1",
5770
5770
  labels: steps.map(step => step.label),
5771
- activeLabel: activeStep - 1
5771
+ activeLabel: activeStep - 1,
5772
+ "aria-label": intl.formatMessage(messages$4.back)
5772
5773
  }),
5773
5774
  onClick: onGoBack
5774
5775
  }) : logo
@@ -6709,7 +6710,7 @@ function SelectInputClearButton({
6709
6710
  const intl = reactIntl.useIntl();
6710
6711
  return /*#__PURE__*/jsxRuntime.jsx("button", {
6711
6712
  type: "button",
6712
- "aria-label": intl.formatMessage(messages$5.ariaLabel),
6713
+ "aria-label": intl.formatMessage(messages$6.ariaLabel),
6713
6714
  className: classNames__default.default(className, 'np-select-input-addon np-select-input-addon--interactive'),
6714
6715
  onClick: onClick,
6715
6716
  children: /*#__PURE__*/jsxRuntime.jsx(icons.Cross, {
@@ -6866,7 +6867,12 @@ function SelectInputOptions({
6866
6867
  listboxRef
6867
6868
  }) {
6868
6869
  const [query, setQuery] = React.useState('');
6869
- const needle = React.useMemo(() => query ? searchableString(query) : null, [query]);
6870
+ const needle = React.useMemo(() => {
6871
+ if (filterable) {
6872
+ return query ? searchableString(query) : null;
6873
+ }
6874
+ return undefined;
6875
+ }, [filterable, query]);
6870
6876
  const listboxContainerRef = React.useRef(null);
6871
6877
  React.useEffect(() => {
6872
6878
  if (listboxContainerRef.current != null) {
@@ -6978,7 +6984,7 @@ function SelectInputGroupItemView({
6978
6984
  jsxRuntime.jsxs("section", {
6979
6985
  role: "group",
6980
6986
  "aria-labelledby": headerId,
6981
- className: classNames__default.default(needle == null && 'np-select-input-group-item--without-needle'),
6987
+ className: classNames__default.default(needle === null && 'np-select-input-group-item--without-needle'),
6982
6988
  children: [needle == null ? /*#__PURE__*/jsxRuntime.jsx("header", {
6983
6989
  id: headerId,
6984
6990
  role: "presentation",
@@ -10709,6 +10715,7 @@ var en = {
10709
10715
  "neptune.DateLookup.selected": "selected",
10710
10716
  "neptune.DateLookup.twentyYears": "20 years",
10711
10717
  "neptune.DateLookup.year": "year",
10718
+ "neptune.FlowNavigation.back": "back to previous step",
10712
10719
  "neptune.Link.opensInNewTab": "(opens in new tab)",
10713
10720
  "neptune.MoneyInput.Select.placeholder": "Select an option...",
10714
10721
  "neptune.Select.searchPlaceholder": "Search...",