@transferwise/components 46.9.0 → 46.10.1

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 (97) hide show
  1. package/build/i18n/de.json +1 -0
  2. package/build/i18n/en.json +1 -0
  3. package/build/i18n/es.json +1 -0
  4. package/build/i18n/fr.json +1 -0
  5. package/build/i18n/hu.json +1 -0
  6. package/build/i18n/id.json +1 -0
  7. package/build/i18n/it.json +1 -0
  8. package/build/i18n/ja.json +1 -0
  9. package/build/i18n/pl.json +1 -0
  10. package/build/i18n/pt.json +1 -0
  11. package/build/i18n/ro.json +1 -0
  12. package/build/i18n/ru.json +1 -0
  13. package/build/i18n/th.json +1 -0
  14. package/build/i18n/tr.json +1 -0
  15. package/build/i18n/zh-CN.json +1 -0
  16. package/build/i18n/zh-HK.json +1 -0
  17. package/build/index.esm.js +82 -88
  18. package/build/index.esm.js.map +1 -1
  19. package/build/index.js +82 -88
  20. package/build/index.js.map +1 -1
  21. package/build/main.css +6 -0
  22. package/build/styles/drawer/Drawer.css +3 -0
  23. package/build/styles/main.css +6 -0
  24. package/build/styles/modal/Modal.css +3 -0
  25. package/build/types/common/index.d.ts +0 -1
  26. package/build/types/dateLookup/DateLookup.d.ts.map +1 -1
  27. package/build/types/inputs/SelectInput.d.ts +2 -1
  28. package/build/types/inputs/SelectInput.d.ts.map +1 -1
  29. package/build/types/moneyInput/MoneyInput.d.ts.map +1 -1
  30. package/build/types/phoneNumberInput/PhoneNumberInput.d.ts.map +1 -1
  31. package/build/types/phoneNumberInput/PhoneNumberInput.messages.d.ts +8 -0
  32. package/build/types/phoneNumberInput/PhoneNumberInput.messages.d.ts.map +1 -0
  33. package/build/types/select/Select.d.ts.map +1 -1
  34. package/build/types/switch/Switch.d.ts.map +1 -1
  35. package/build/types/tabs/Tabs.d.ts.map +1 -1
  36. package/build/types/typeahead/Typeahead.d.ts.map +1 -1
  37. package/package.json +14 -17
  38. package/src/button/Button.story.tsx +3 -3
  39. package/src/common/fakeEvents.js +2 -2
  40. package/src/common/index.js +0 -1
  41. package/src/dateInput/DateInput.story.tsx +4 -3
  42. package/src/dateLookup/DateLookup.js +6 -7
  43. package/src/dateLookup/DateLookup.keyboardEvents.spec.js +24 -25
  44. package/src/dateLookup/DateLookup.story.js +4 -3
  45. package/src/dateLookup/dateTrigger/DateTrigger.spec.js +3 -3
  46. package/src/drawer/Drawer.css +3 -0
  47. package/src/drawer/Drawer.less +4 -0
  48. package/src/i18n/de.json +1 -0
  49. package/src/i18n/en.json +1 -0
  50. package/src/i18n/es.json +1 -0
  51. package/src/i18n/fr.json +1 -0
  52. package/src/i18n/hu.json +1 -0
  53. package/src/i18n/id.json +1 -0
  54. package/src/i18n/it.json +1 -0
  55. package/src/i18n/ja.json +1 -0
  56. package/src/i18n/pl.json +1 -0
  57. package/src/i18n/pt.json +1 -0
  58. package/src/i18n/ro.json +1 -0
  59. package/src/i18n/ru.json +1 -0
  60. package/src/i18n/th.json +1 -0
  61. package/src/i18n/tr.json +1 -0
  62. package/src/i18n/zh-CN.json +1 -0
  63. package/src/i18n/zh-HK.json +1 -0
  64. package/src/info/Info.story.tsx +3 -3
  65. package/src/inputWithDisplayFormat/InputWithDisplayFormat.story.js +2 -7
  66. package/src/inputs/SelectInput.spec.tsx +7 -0
  67. package/src/inputs/SelectInput.story.tsx +223 -317
  68. package/src/inputs/SelectInput.tsx +4 -0
  69. package/src/logo/Logo.js +4 -4
  70. package/src/main.css +6 -0
  71. package/src/modal/Modal.css +3 -0
  72. package/src/modal/Modal.less +4 -0
  73. package/src/modal/Modal.story.tsx +55 -21
  74. package/src/moneyInput/MoneyInput.story.tsx +3 -3
  75. package/src/moneyInput/MoneyInput.tsx +14 -24
  76. package/src/phoneNumberInput/PhoneNumberInput.messages.ts +8 -0
  77. package/src/phoneNumberInput/PhoneNumberInput.spec.js +12 -7
  78. package/src/phoneNumberInput/PhoneNumberInput.tsx +3 -2
  79. package/src/select/Select.js +8 -9
  80. package/src/snackbar/Snackbar.story.tsx +3 -3
  81. package/src/switch/Switch.spec.js +2 -3
  82. package/src/switch/Switch.tsx +1 -2
  83. package/src/switchOption/SwitchOption.spec.js +1 -4
  84. package/src/tabs/Tabs.js +1 -2
  85. package/src/textareaWithDisplayFormat/TextareaWithDisplayFormat.story.tsx +5 -4
  86. package/src/tile/Tile.js +2 -2
  87. package/src/tile/Tile.spec.js +5 -5
  88. package/src/tooltip/Tooltip.story.tsx +3 -3
  89. package/src/typeahead/Typeahead.js +5 -6
  90. package/src/typeahead/Typeahead.spec.js +3 -8
  91. package/src/typeahead/Typeahead.story.js +3 -4
  92. package/build/types/common/key.d.ts +0 -9
  93. package/build/types/common/key.d.ts.map +0 -1
  94. package/build/types/common/keyCodes.d.ts +0 -16
  95. package/build/types/common/keyCodes.d.ts.map +0 -1
  96. package/src/common/key.js +0 -8
  97. package/src/common/keyCodes.js +0 -19
package/build/index.js CHANGED
@@ -367,15 +367,6 @@ exports.FileType = void 0;
367
367
  FileType["CSV"] = ".csv,text/csv";
368
368
  })(exports.FileType || (exports.FileType = {}));
369
369
 
370
- const Key = {
371
- ENTER: 'Enter',
372
- ESCAPE: 'Escape',
373
- SPACE: [' ', 'Spacebar'],
374
- TAB: 'Tab',
375
- PERIOD: '.',
376
- COMMA: ','
377
- };
378
-
379
370
  const DEFAULT_LANG = 'en';
380
371
  const DEFAULT_LOCALE = 'en-GB';
381
372
  /**
@@ -765,7 +756,7 @@ const ActionOption = ({
765
756
  });
766
757
  };
767
758
 
768
- var messages$c = reactIntl.defineMessages({
759
+ var messages$d = reactIntl.defineMessages({
769
760
  ariaLabel: {
770
761
  id: "neptune.CloseButton.ariaLabel"
771
762
  }
@@ -781,7 +772,7 @@ const CloseButton = /*#__PURE__*/React.forwardRef(function CloseButton({
781
772
  testId
782
773
  }, reference) {
783
774
  const intl = reactIntl.useIntl();
784
- ariaLabel ??= intl.formatMessage(messages$c.ariaLabel);
775
+ ariaLabel ??= intl.formatMessage(messages$d.ariaLabel);
785
776
  const Icon = filled ? icons.CrossCircleFill : icons.Cross;
786
777
  return /*#__PURE__*/jsxRuntime.jsx("button", {
787
778
  ref: reference,
@@ -801,7 +792,7 @@ const CloseButton = /*#__PURE__*/React.forwardRef(function CloseButton({
801
792
  });
802
793
  });
803
794
 
804
- var messages$b = reactIntl.defineMessages({
795
+ var messages$c = reactIntl.defineMessages({
805
796
  opensInNewTab: {
806
797
  id: "neptune.Link.opensInNewTab"
807
798
  }
@@ -830,7 +821,7 @@ const Link = ({
830
821
  onClick: onClick,
831
822
  ...props,
832
823
  children: [children, " ", isBlank && /*#__PURE__*/jsxRuntime.jsx(icons.NavigateAway, {
833
- title: formatMessage(messages$b.opensInNewTab)
824
+ title: formatMessage(messages$c.opensInNewTab)
834
825
  })]
835
826
  });
836
827
  };
@@ -2260,7 +2251,7 @@ ProcessIndicator.defaultProps = {
2260
2251
  };
2261
2252
  var ProcessIndicator$1 = ProcessIndicator;
2262
2253
 
2263
- var messages$a = reactIntl.defineMessages({
2254
+ var messages$b = reactIntl.defineMessages({
2264
2255
  loadingAriaLabel: {
2265
2256
  id: "neptune.Button.loadingAriaLabel"
2266
2257
  }
@@ -2379,7 +2370,7 @@ const Button = /*#__PURE__*/React.forwardRef(({
2379
2370
  className: classes,
2380
2371
  ...props,
2381
2372
  "aria-live": loading ? 'polite' : 'off',
2382
- "aria-label": loading ? intl.formatMessage(messages$a.loadingAriaLabel) : rest['aria-label'],
2373
+ "aria-label": loading ? intl.formatMessage(messages$b.loadingAriaLabel) : rest['aria-label'],
2383
2374
  children: [children, loading && /*#__PURE__*/jsxRuntime.jsx(ProcessIndicator$1, {
2384
2375
  size: processIndicatorSize(),
2385
2376
  className: "btn-loader"
@@ -2672,7 +2663,7 @@ const Chip = ({
2672
2663
  }, value);
2673
2664
  };
2674
2665
 
2675
- var messages$9 = reactIntl.defineMessages({
2666
+ var messages$a = reactIntl.defineMessages({
2676
2667
  ariaLabel: {
2677
2668
  id: "neptune.Chips.ariaLabel"
2678
2669
  }
@@ -2704,7 +2695,7 @@ const Chips = ({
2704
2695
  value: chip.value,
2705
2696
  label: chip.label,
2706
2697
  closeButton: {
2707
- 'aria-label': intl.formatMessage(messages$9.ariaLabel, {
2698
+ 'aria-label': intl.formatMessage(messages$a.ariaLabel, {
2708
2699
  choice: chip.label
2709
2700
  })
2710
2701
  },
@@ -2812,7 +2803,7 @@ const validDateObject = dateObject => dateObject instanceof Date && !isNaN(dateO
2812
2803
 
2813
2804
  const isMonthAndYearFormat = dateString => validDateString(dateString) && dateString.split('-').length < 3;
2814
2805
 
2815
- var messages$8 = reactIntl.defineMessages({
2806
+ var messages$9 = reactIntl.defineMessages({
2816
2807
  monthLabel: {
2817
2808
  id: "neptune.DateInput.month.label"
2818
2809
  },
@@ -2898,13 +2889,13 @@ const DateInput = ({
2898
2889
  const [month, setMonth] = React.useState(() => getExplodedDate('month'));
2899
2890
  const [year, setYear] = React.useState(() => getExplodedDate('year'));
2900
2891
  const [lastBroadcastedValue, setLastBroadcastedValue] = React.useState(getDateObject);
2901
- dayLabel = dayLabel || formatMessage(messages$8.dayLabel);
2902
- monthLabel = monthLabel || formatMessage(messages$8.monthLabel);
2903
- yearLabel = yearLabel || formatMessage(messages$8.yearLabel);
2892
+ dayLabel = dayLabel || formatMessage(messages$9.dayLabel);
2893
+ monthLabel = monthLabel || formatMessage(messages$9.monthLabel);
2894
+ yearLabel = yearLabel || formatMessage(messages$9.yearLabel);
2904
2895
  placeholders = {
2905
- day: placeholders?.day || formatMessage(messages$8.dayPlaceholder),
2906
- month: placeholders?.month || formatMessage(messages$8.monthLabel),
2907
- year: placeholders?.year || formatMessage(messages$8.yearPlaceholder)
2896
+ day: placeholders?.day || formatMessage(messages$9.dayPlaceholder),
2897
+ month: placeholders?.month || formatMessage(messages$9.monthLabel),
2898
+ year: placeholders?.year || formatMessage(messages$9.yearPlaceholder)
2908
2899
  };
2909
2900
  const getDateAsString = date => {
2910
2901
  if (!isDateValid(date)) {
@@ -3168,26 +3159,6 @@ DateInput.defaultProps = {
3168
3159
  };
3169
3160
  var DateInput$1 = DateInput;
3170
3161
 
3171
- /**
3172
- * TODO: mention what to use instead or consider to delete this object
3173
- *
3174
- * @deprecated
3175
- */
3176
- var KeyCodes = {
3177
- DOWN: 40,
3178
- UP: 38,
3179
- LEFT: 37,
3180
- RIGHT: 39,
3181
- ENTER: 13,
3182
- ESCAPE: 27,
3183
- TAB: 9,
3184
- SPACE: 32,
3185
- BACKSPACE: 8,
3186
- DELETE: 46,
3187
- COMMA: 188,
3188
- PERIOD: 190
3189
- };
3190
-
3191
3162
  const POPOVER_OFFSET = [0, 16];
3192
3163
  // By default the flip positioning explores only the opposite alternative. So if left is passed and there's no enough space
3193
3164
  // the right one gets chosen. If there's no space on both sides popover goes back to the initially chosen one left.
@@ -3433,7 +3404,7 @@ DateTrigger.defaultProps = {
3433
3404
  };
3434
3405
  var DateTrigger$1 = DateTrigger;
3435
3406
 
3436
- var messages$7 = reactIntl.defineMessages({
3407
+ var messages$8 = reactIntl.defineMessages({
3437
3408
  next: {
3438
3409
  id: "neptune.DateLookup.next"
3439
3410
  },
@@ -3479,7 +3450,7 @@ const DateHeader = ({
3479
3450
  children: /*#__PURE__*/jsxRuntime.jsx("button", {
3480
3451
  type: "button",
3481
3452
  className: `d-inline-flex ${buttonClasses}`,
3482
- "aria-label": `${intl.formatMessage(messages$7.previous)} ${dateMode}`,
3453
+ "aria-label": `${intl.formatMessage(messages$8.previous)} ${dateMode}`,
3483
3454
  onClick: onPreviousClick,
3484
3455
  children: /*#__PURE__*/jsxRuntime.jsx(Chevron, {
3485
3456
  orientation: exports.Position.LEFT,
@@ -3493,7 +3464,7 @@ const DateHeader = ({
3493
3464
  children: /*#__PURE__*/jsxRuntime.jsx("button", {
3494
3465
  type: "button",
3495
3466
  className: `tw-date-lookup-header-current ${buttonClasses}`,
3496
- "aria-label": intl.formatMessage(messages$7.goTo20YearView),
3467
+ "aria-label": intl.formatMessage(messages$8.goTo20YearView),
3497
3468
  onClick: onLabelClick,
3498
3469
  children: label
3499
3470
  })
@@ -3502,7 +3473,7 @@ const DateHeader = ({
3502
3473
  children: /*#__PURE__*/jsxRuntime.jsx("button", {
3503
3474
  type: "button",
3504
3475
  className: `d-inline-flex ${buttonClasses}`,
3505
- "aria-label": `${reactIntl.useIntl().formatMessage(messages$7.next)} ${dateMode}`,
3476
+ "aria-label": `${reactIntl.useIntl().formatMessage(messages$8.next)} ${dateMode}`,
3506
3477
  onClick: onNextClick,
3507
3478
  children: /*#__PURE__*/jsxRuntime.jsx(Chevron, {
3508
3479
  orientation: exports.Position.RIGHT,
@@ -3569,7 +3540,7 @@ const TableLink = ({
3569
3540
  };
3570
3541
  const calculateAriaLabel = () => {
3571
3542
  if (active) {
3572
- return `${longTitle || title || ''}, ${intl.formatMessage(messages$7.selected)} ${intl.formatMessage(messages$7[type])}`;
3543
+ return `${longTitle || title || ''}, ${intl.formatMessage(messages$8.selected)} ${intl.formatMessage(messages$8[type])}`;
3573
3544
  }
3574
3545
  return longTitle || title;
3575
3546
  };
@@ -3786,7 +3757,7 @@ class DayCalendar extends React.PureComponent {
3786
3757
  month: monthFormat,
3787
3758
  year: 'numeric'
3788
3759
  }),
3789
- dateMode: formatMessage(messages$7.month),
3760
+ dateMode: formatMessage(messages$8.month),
3790
3761
  onLabelClick: onLabelClick,
3791
3762
  onPreviousClick: this.selectPreviousMonth,
3792
3763
  onNextClick: this.selectNextMonth
@@ -3932,7 +3903,7 @@ class MonthCalendar extends React.PureComponent {
3932
3903
  } = this.props;
3933
3904
  return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
3934
3905
  children: [/*#__PURE__*/jsxRuntime.jsx(DateHeader$1, {
3935
- dateMode: formatMessage(messages$7.year),
3906
+ dateMode: formatMessage(messages$8.year),
3936
3907
  label: formatting.formatDate(new Date(viewYear, 0), locale, {
3937
3908
  year: 'numeric'
3938
3909
  }),
@@ -4078,7 +4049,7 @@ class YearCalendar extends React.PureComponent {
4078
4049
  } = this.props;
4079
4050
  return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
4080
4051
  children: [/*#__PURE__*/jsxRuntime.jsx(DateHeader$1, {
4081
- dateMode: formatMessage(messages$7.twentyYears),
4052
+ dateMode: formatMessage(messages$8.twentyYears),
4082
4053
  onPreviousClick: this.selectPreviousYears,
4083
4054
  onNextClick: this.selectNextYears
4084
4055
  }), /*#__PURE__*/jsxRuntime.jsx(YearCalendarTable$1, {
@@ -4209,8 +4180,8 @@ class DateLookup extends React.PureComponent {
4209
4180
  open,
4210
4181
  originalDate
4211
4182
  } = this.state;
4212
- switch (event.keyCode) {
4213
- case KeyCodes.LEFT:
4183
+ switch (event.key) {
4184
+ case 'ArrowLeft':
4214
4185
  if (open) {
4215
4186
  this.adjustDate(-1, -1, -1);
4216
4187
  } else {
@@ -4218,7 +4189,7 @@ class DateLookup extends React.PureComponent {
4218
4189
  }
4219
4190
  event.preventDefault();
4220
4191
  break;
4221
- case KeyCodes.UP:
4192
+ case 'ArrowUp':
4222
4193
  if (open) {
4223
4194
  this.adjustDate(-7, -4, -4);
4224
4195
  } else {
@@ -4226,7 +4197,7 @@ class DateLookup extends React.PureComponent {
4226
4197
  }
4227
4198
  event.preventDefault();
4228
4199
  break;
4229
- case KeyCodes.RIGHT:
4200
+ case 'ArrowRight':
4230
4201
  if (open) {
4231
4202
  this.adjustDate(1, 1, 1);
4232
4203
  } else {
@@ -4234,7 +4205,7 @@ class DateLookup extends React.PureComponent {
4234
4205
  }
4235
4206
  event.preventDefault();
4236
4207
  break;
4237
- case KeyCodes.DOWN:
4208
+ case 'ArrowDown':
4238
4209
  if (open) {
4239
4210
  this.adjustDate(7, 4, 4);
4240
4211
  } else {
@@ -4242,7 +4213,7 @@ class DateLookup extends React.PureComponent {
4242
4213
  }
4243
4214
  event.preventDefault();
4244
4215
  break;
4245
- case KeyCodes.ESCAPE:
4216
+ case 'Escape':
4246
4217
  if (originalDate !== null) {
4247
4218
  this.props.onChange(originalDate);
4248
4219
  }
@@ -4565,7 +4536,7 @@ const Tile = ({
4565
4536
  onKeyDown: disabled ? null : ({
4566
4537
  key
4567
4538
  }) => {
4568
- if (key === Key.ENTER || Key.SPACE.includes(key)) {
4539
+ if (key === 'Enter' || key === ' ') {
4569
4540
  onClick();
4570
4541
  }
4571
4542
  },
@@ -5729,7 +5700,7 @@ const Stepper = ({
5729
5700
  });
5730
5701
  };
5731
5702
 
5732
- var messages$6 = reactIntl.defineMessages({
5703
+ var messages$7 = reactIntl.defineMessages({
5733
5704
  back: {
5734
5705
  id: "neptune.FlowNavigation.back"
5735
5706
  }
@@ -5821,7 +5792,7 @@ const FlowNavigation = ({
5821
5792
  }),
5822
5793
  leftContent: /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
5823
5794
  children: [isSmall && displayGoBack ? /*#__PURE__*/jsxRuntime.jsx(BackButton$1, {
5824
- "aria-label": intl.formatMessage(messages$6.back),
5795
+ "aria-label": intl.formatMessage(messages$7.back),
5825
5796
  onClick: onGoBack
5826
5797
  }) : /*#__PURE__*/jsxRuntime.jsx("div", {
5827
5798
  className: "np-flow-header__left",
@@ -6129,7 +6100,7 @@ const deprecatedPlacements = {
6129
6100
  };
6130
6101
  var Popover$2 = Popover$1;
6131
6102
 
6132
- var messages$5 = reactIntl.defineMessages({
6103
+ var messages$6 = reactIntl.defineMessages({
6133
6104
  ariaLabel: {
6134
6105
  id: "neptune.Info.ariaLabel"
6135
6106
  }
@@ -6147,7 +6118,7 @@ const Info = ({
6147
6118
  }) => {
6148
6119
  const intl = reactIntl.useIntl();
6149
6120
  const [open, setOpen] = React.useState(false);
6150
- ariaLabel ??= intl.formatMessage(messages$5.ariaLabel);
6121
+ ariaLabel ??= intl.formatMessage(messages$6.ariaLabel);
6151
6122
  const isModal = presentation === exports.InfoPresentation.MODAL;
6152
6123
  const isSmall = size === exports.Size.SMALL;
6153
6124
  const buttonProps = {
@@ -6433,7 +6404,7 @@ const PolymorphicWithOverrides = /*#__PURE__*/React.forwardRef(function Polymorp
6433
6404
  });
6434
6405
  });
6435
6406
 
6436
- var messages$4 = reactIntl.defineMessages({
6407
+ var messages$5 = reactIntl.defineMessages({
6437
6408
  noResultsFound: {
6438
6409
  id: "neptune.SelectInput.noResultsFound"
6439
6410
  }
@@ -6796,6 +6767,7 @@ function SelectInputClearButton({
6796
6767
  }
6797
6768
  const noop = () => {};
6798
6769
  function SelectInput({
6770
+ id,
6799
6771
  name,
6800
6772
  multiple,
6801
6773
  placeholder,
@@ -6861,6 +6833,7 @@ function SelectInput({
6861
6833
  // eslint-disable-next-line react/jsx-no-constructed-context-values
6862
6834
  value: {
6863
6835
  ref: mergeRefs__default.default([ref, triggerRef]),
6836
+ id,
6864
6837
  ...mergeProps__default.default({
6865
6838
  onClick: () => {
6866
6839
  setOpen(prev => !prev);
@@ -7051,7 +7024,7 @@ function SelectInputOptions({
7051
7024
  children: [/*#__PURE__*/jsxRuntime.jsx(icons.CrossCircle, {
7052
7025
  size: 16,
7053
7026
  className: "np-select-input-options-status-icon"
7054
- }), intl.formatMessage(messages$4.noResultsFound)]
7027
+ }), intl.formatMessage(messages$5.noResultsFound)]
7055
7028
  }) : null, /*#__PURE__*/jsxRuntime.jsx("div", {
7056
7029
  ref: listboxRef,
7057
7030
  id: listboxId,
@@ -7717,7 +7690,7 @@ Money.propTypes = {
7717
7690
  };
7718
7691
  var Money$1 = Money;
7719
7692
 
7720
- var messages$3 = reactIntl.defineMessages({
7693
+ var messages$4 = reactIntl.defineMessages({
7721
7694
  selectPlaceholder: {
7722
7695
  id: "neptune.MoneyInput.Select.placeholder"
7723
7696
  }
@@ -7809,8 +7782,7 @@ const parseNumber = ({
7809
7782
  }
7810
7783
  return Number(amount);
7811
7784
  };
7812
- const inputKeyCodeAllowlist = new Set([KeyCodes.BACKSPACE, KeyCodes.DELETE, KeyCodes.COMMA, KeyCodes.PERIOD, KeyCodes.DOWN, KeyCodes.UP, KeyCodes.LEFT, KeyCodes.RIGHT, KeyCodes.ENTER, KeyCodes.ESCAPE, KeyCodes.TAB]);
7813
- const inputKeyAllowlist = new Set([Key.PERIOD, Key.COMMA]);
7785
+ const allowedInputKeys = new Set(['Backspace', 'Delete', ',', '.', 'ArrowDown', 'ArrowUp', 'ArrowLeft', 'ArrowRight', 'Enter', 'Escape', 'Tab']);
7814
7786
  class MoneyInput extends React.Component {
7815
7787
  static defaultProps = {
7816
7788
  size: exports.Size.LARGE,
@@ -7848,13 +7820,12 @@ class MoneyInput extends React.Component {
7848
7820
  }
7849
7821
  isInputAllowedForKeyEvent = event => {
7850
7822
  const {
7851
- keyCode,
7852
7823
  metaKey,
7853
7824
  key,
7854
7825
  ctrlKey
7855
7826
  } = event;
7856
7827
  const isNumberKey = neptuneValidation.isNumber(parseInt(key, 10));
7857
- return isNumberKey || metaKey || ctrlKey || inputKeyCodeAllowlist.has(keyCode) || inputKeyAllowlist.has(key);
7828
+ return isNumberKey || metaKey || ctrlKey || allowedInputKeys.has(key);
7858
7829
  };
7859
7830
  handleKeyDown = event => {
7860
7831
  if (!this.isInputAllowedForKeyEvent(event)) {
@@ -8063,7 +8034,7 @@ class MoneyInput extends React.Component {
8063
8034
  onClick: this.handleCustomAction,
8064
8035
  children: this.props.customActionLabel
8065
8036
  }) : undefined,
8066
- placeholder: this.props.intl.formatMessage(messages$3.selectPlaceholder),
8037
+ placeholder: this.props.intl.formatMessage(messages$4.selectPlaceholder),
8067
8038
  filterable: true,
8068
8039
  filterPlaceholder: this.props.searchPlaceholder,
8069
8040
  disabled: disabled,
@@ -8274,6 +8245,12 @@ OverlayHeader.propTypes = {
8274
8245
  };
8275
8246
  var OverlayHeader$1 = OverlayHeader;
8276
8247
 
8248
+ var messages$3 = reactIntl.defineMessages({
8249
+ selectInputPlaceholder: {
8250
+ id: "neptune.PhoneNumberInput.SelectInput.placeholder"
8251
+ }
8252
+ });
8253
+
8277
8254
  const countries = [{
8278
8255
  name: 'Afghanistan',
8279
8256
  iso2: 'AF',
@@ -9656,7 +9633,8 @@ const PhoneNumberInput = ({
9656
9633
  disabledCountries = defaultDisabledCountries
9657
9634
  }) => {
9658
9635
  const {
9659
- locale
9636
+ locale,
9637
+ formatMessage
9660
9638
  } = reactIntl.useIntl();
9661
9639
  const [internalValue, setInternalValue] = React.useState(() => {
9662
9640
  const cleanValue = initialValue ? cleanNumber(initialValue) : null;
@@ -9707,7 +9685,7 @@ const PhoneNumberInput = ({
9707
9685
  children: [/*#__PURE__*/jsxRuntime.jsx("div", {
9708
9686
  className: "tw-telephone__country-select",
9709
9687
  children: /*#__PURE__*/jsxRuntime.jsx(SelectInput, {
9710
- placeholder: "Select an option\u2026",
9688
+ placeholder: formatMessage(messages$3.selectInputPlaceholder),
9711
9689
  items: [...countriesByPrefix].map(([prefix, countries]) => ({
9712
9690
  type: 'option',
9713
9691
  value: prefix,
@@ -10063,6 +10041,7 @@ var en = {
10063
10041
  "neptune.Info.ariaLabel": "More information",
10064
10042
  "neptune.Link.opensInNewTab": "(opens in new tab)",
10065
10043
  "neptune.MoneyInput.Select.placeholder": "Select an option...",
10044
+ "neptune.PhoneNumberInput.SelectInput.placeholder": "Select an option...",
10066
10045
  "neptune.Select.searchPlaceholder": "Search...",
10067
10046
  "neptune.SelectInput.noResultsFound": "No results found",
10068
10047
  "neptune.Summary.statusDone": "Item done",
@@ -10694,17 +10673,17 @@ function Select({
10694
10673
  }
10695
10674
  };
10696
10675
  const handleKeyDown = event => {
10697
- switch (event.keyCode) {
10698
- case KeyCodes.UP:
10699
- case KeyCodes.DOWN:
10676
+ switch (event.key) {
10677
+ case 'ArrowUp':
10678
+ case 'ArrowDown':
10700
10679
  if (open) {
10701
- moveFocusWithDifference(event.keyCode === KeyCodes.UP ? -1 : 1);
10680
+ moveFocusWithDifference(event.key === 'ArrowUp' ? -1 : 1);
10702
10681
  } else {
10703
10682
  setOpen(true);
10704
10683
  }
10705
10684
  stopPropagation$1(event);
10706
10685
  break;
10707
- case KeyCodes.SPACE:
10686
+ case ' ':
10708
10687
  if (event.target !== searchBoxReference.current) {
10709
10688
  if (open) {
10710
10689
  selectKeyboardFocusedOption();
@@ -10714,7 +10693,7 @@ function Select({
10714
10693
  stopPropagation$1(event);
10715
10694
  }
10716
10695
  break;
10717
- case KeyCodes.ENTER:
10696
+ case 'Enter':
10718
10697
  if (open) {
10719
10698
  selectKeyboardFocusedOption();
10720
10699
  } else {
@@ -10722,11 +10701,11 @@ function Select({
10722
10701
  }
10723
10702
  stopPropagation$1(event);
10724
10703
  break;
10725
- case KeyCodes.ESCAPE:
10704
+ case 'Escape':
10726
10705
  handleCloseOptions();
10727
10706
  stopPropagation$1(event);
10728
10707
  break;
10729
- case KeyCodes.TAB:
10708
+ case 'Tab':
10730
10709
  if (open) {
10731
10710
  selectKeyboardFocusedOption();
10732
10711
  }
@@ -11485,7 +11464,7 @@ const Switch = props => {
11485
11464
  disabled
11486
11465
  } = props;
11487
11466
  const handleKeyDown = event => {
11488
- if (event.code === '32' || event.keyCode === KeyCodes.SPACE) {
11467
+ if (event.key === ' ') {
11489
11468
  event.preventDefault();
11490
11469
  onClick();
11491
11470
  }
@@ -11982,7 +11961,7 @@ class Tabs extends React.Component {
11982
11961
  this.switchTab(index);
11983
11962
  };
11984
11963
  onKeyDown = index => event => {
11985
- if (event && event.keyCode === KeyCodes.ENTER) {
11964
+ if (event && event.key === 'Enter') {
11986
11965
  this.switchTab(index);
11987
11966
  }
11988
11967
  };
@@ -12584,16 +12563,16 @@ class Typeahead extends React.Component {
12584
12563
  label: query
12585
12564
  });
12586
12565
  } else {
12587
- switch (event.keyCode) {
12588
- case KeyCodes.DOWN:
12566
+ switch (event.key) {
12567
+ case 'ArrowDown':
12589
12568
  event.preventDefault();
12590
12569
  this.moveFocusedOption(1);
12591
12570
  break;
12592
- case KeyCodes.UP:
12571
+ case 'ArrowUp':
12593
12572
  event.preventDefault();
12594
12573
  this.moveFocusedOption(-1);
12595
12574
  break;
12596
- case KeyCodes.ENTER:
12575
+ case 'Enter':
12597
12576
  event.preventDefault();
12598
12577
  if (options[keyboardFocusedOptionIndex]) {
12599
12578
  this.selectItem(options[keyboardFocusedOptionIndex]);
@@ -12603,7 +12582,7 @@ class Typeahead extends React.Component {
12603
12582
  });
12604
12583
  }
12605
12584
  break;
12606
- case KeyCodes.BACKSPACE:
12585
+ case 'Backspace':
12607
12586
  if (multiple && !query && selected.length > 0) {
12608
12587
  this.updateSelectedValue(selected.slice(0, -1));
12609
12588
  }
@@ -14642,6 +14621,7 @@ var de = {
14642
14621
  "neptune.Info.ariaLabel": "Weitere Informationen",
14643
14622
  "neptune.Link.opensInNewTab": "(wird in einem neuen Tab geöffnet)",
14644
14623
  "neptune.MoneyInput.Select.placeholder": "Wähle eine der Möglichkeiten aus...",
14624
+ "neptune.PhoneNumberInput.SelectInput.placeholder": "Wähle eine der Möglichkeiten aus...",
14645
14625
  "neptune.Select.searchPlaceholder": "Wird gesucht...",
14646
14626
  "neptune.SelectInput.noResultsFound": "Keine Ergebnisse gefunden",
14647
14627
  "neptune.Summary.statusDone": "Schritt erledigt",
@@ -14699,6 +14679,7 @@ var es = {
14699
14679
  "neptune.Info.ariaLabel": "Más información",
14700
14680
  "neptune.Link.opensInNewTab": "(se abre en una pestaña nueva)",
14701
14681
  "neptune.MoneyInput.Select.placeholder": "Selecciona una opción...",
14682
+ "neptune.PhoneNumberInput.SelectInput.placeholder": "Selecciona una opción...",
14702
14683
  "neptune.Select.searchPlaceholder": "Buscar...",
14703
14684
  "neptune.SelectInput.noResultsFound": "No se han encontrado resultados",
14704
14685
  "neptune.Summary.statusDone": "Apartado listo",
@@ -14756,6 +14737,7 @@ var fr = {
14756
14737
  "neptune.Info.ariaLabel": "Plus d'informations",
14757
14738
  "neptune.Link.opensInNewTab": "(ouvre dans un nouvel onglet)",
14758
14739
  "neptune.MoneyInput.Select.placeholder": "Sélectionner une option...",
14740
+ "neptune.PhoneNumberInput.SelectInput.placeholder": "Sélectionnez une option…",
14759
14741
  "neptune.Select.searchPlaceholder": "Recherche...",
14760
14742
  "neptune.SelectInput.noResultsFound": "Aucun résultat trouvé",
14761
14743
  "neptune.Summary.statusDone": "Validé",
@@ -14813,6 +14795,7 @@ var hu = {
14813
14795
  "neptune.Info.ariaLabel": "További információ",
14814
14796
  "neptune.Link.opensInNewTab": "(új lapon nyílik meg)",
14815
14797
  "neptune.MoneyInput.Select.placeholder": "Válassz ki egy lehetőséget...",
14798
+ "neptune.PhoneNumberInput.SelectInput.placeholder": "Válassz ki egy lehetőséget...",
14816
14799
  "neptune.Select.searchPlaceholder": "Keresés...",
14817
14800
  "neptune.SelectInput.noResultsFound": "Nincs találat",
14818
14801
  "neptune.Summary.statusDone": "Kész",
@@ -14870,6 +14853,7 @@ var id = {
14870
14853
  "neptune.Info.ariaLabel": "Informasi lebih lanjut",
14871
14854
  "neptune.Link.opensInNewTab": "(terbuka di tab baru)",
14872
14855
  "neptune.MoneyInput.Select.placeholder": "Pilih opsi...",
14856
+ "neptune.PhoneNumberInput.SelectInput.placeholder": "Pilih opsi...",
14873
14857
  "neptune.Select.searchPlaceholder": "Cari...",
14874
14858
  "neptune.SelectInput.noResultsFound": "Hasil tidak ditemukan",
14875
14859
  "neptune.Summary.statusDone": "Item selesai",
@@ -14927,6 +14911,7 @@ var it = {
14927
14911
  "neptune.Info.ariaLabel": "Maggiori informazioni",
14928
14912
  "neptune.Link.opensInNewTab": "(si apre in una nuova scheda)",
14929
14913
  "neptune.MoneyInput.Select.placeholder": "Seleziona un'opzione...",
14914
+ "neptune.PhoneNumberInput.SelectInput.placeholder": "Seleziona un'opzione...",
14930
14915
  "neptune.Select.searchPlaceholder": "Cerca...",
14931
14916
  "neptune.SelectInput.noResultsFound": "Nessun risultato trovato",
14932
14917
  "neptune.Summary.statusDone": "Completato",
@@ -14984,6 +14969,7 @@ var ja = {
14984
14969
  "neptune.Info.ariaLabel": "詳細",
14985
14970
  "neptune.Link.opensInNewTab": "(新しいタブで開きます)",
14986
14971
  "neptune.MoneyInput.Select.placeholder": "選択してください...",
14972
+ "neptune.PhoneNumberInput.SelectInput.placeholder": "選択してください…",
14987
14973
  "neptune.Select.searchPlaceholder": "検索... ",
14988
14974
  "neptune.SelectInput.noResultsFound": "結果が見つかりませんでした",
14989
14975
  "neptune.Summary.statusDone": "完了",
@@ -15041,6 +15027,7 @@ var pl = {
15041
15027
  "neptune.Info.ariaLabel": "Więcej informacji",
15042
15028
  "neptune.Link.opensInNewTab": "(otworzy się w nowej zakładce)",
15043
15029
  "neptune.MoneyInput.Select.placeholder": "Wybierz opcję...",
15030
+ "neptune.PhoneNumberInput.SelectInput.placeholder": "Wybierz opcję...",
15044
15031
  "neptune.Select.searchPlaceholder": "Wyszukaj...",
15045
15032
  "neptune.SelectInput.noResultsFound": "Nie znaleziono wyników",
15046
15033
  "neptune.Summary.statusDone": "Czynność wykonana",
@@ -15098,6 +15085,7 @@ var pt = {
15098
15085
  "neptune.Info.ariaLabel": "Mais informações",
15099
15086
  "neptune.Link.opensInNewTab": "(abre em uma nova aba)",
15100
15087
  "neptune.MoneyInput.Select.placeholder": "Escolha uma opção...",
15088
+ "neptune.PhoneNumberInput.SelectInput.placeholder": "Escolha uma opção...",
15101
15089
  "neptune.Select.searchPlaceholder": "Buscar...",
15102
15090
  "neptune.SelectInput.noResultsFound": "Nenhum resultado encontrado",
15103
15091
  "neptune.Summary.statusDone": "Pronto",
@@ -15155,6 +15143,7 @@ var ro = {
15155
15143
  "neptune.Info.ariaLabel": "Mai multe informații",
15156
15144
  "neptune.Link.opensInNewTab": "(se deschide într-o filă nouă)",
15157
15145
  "neptune.MoneyInput.Select.placeholder": "Selectează o opţiune...",
15146
+ "neptune.PhoneNumberInput.SelectInput.placeholder": "Selectează o opțiune...",
15158
15147
  "neptune.Select.searchPlaceholder": "Caută...",
15159
15148
  "neptune.SelectInput.noResultsFound": "Nu s-a găsit niciun rezultat",
15160
15149
  "neptune.Summary.statusDone": "Finalizat",
@@ -15212,6 +15201,7 @@ var ru = {
15212
15201
  "neptune.Info.ariaLabel": "Подробнее",
15213
15202
  "neptune.Link.opensInNewTab": "(откроется в новой вкладке)",
15214
15203
  "neptune.MoneyInput.Select.placeholder": "Выберите вариант...",
15204
+ "neptune.PhoneNumberInput.SelectInput.placeholder": "Выберите вариант...",
15215
15205
  "neptune.Select.searchPlaceholder": "Поиск...",
15216
15206
  "neptune.SelectInput.noResultsFound": "Ничего не найдено",
15217
15207
  "neptune.Summary.statusDone": "Этап завершен",
@@ -15269,6 +15259,7 @@ var th = {
15269
15259
  "neptune.Info.ariaLabel": "ข้อมูลเพิ่มเติม",
15270
15260
  "neptune.Link.opensInNewTab": "(เปิดในแท็บใหม่)",
15271
15261
  "neptune.MoneyInput.Select.placeholder": "เลือกตัวเลือก...",
15262
+ "neptune.PhoneNumberInput.SelectInput.placeholder": "เลือกตัวเลือก...",
15272
15263
  "neptune.Select.searchPlaceholder": "ค้นหา...",
15273
15264
  "neptune.SelectInput.noResultsFound": "ไม่พบผลลัพธ์",
15274
15265
  "neptune.Summary.statusDone": "รายการที่ทำแล้ว",
@@ -15326,6 +15317,7 @@ var tr = {
15326
15317
  "neptune.Info.ariaLabel": "Daha fazla bilgi",
15327
15318
  "neptune.Link.opensInNewTab": "(yeni sekmede açılır)",
15328
15319
  "neptune.MoneyInput.Select.placeholder": "Bir seçenek seçin...",
15320
+ "neptune.PhoneNumberInput.SelectInput.placeholder": "Bir seçenek seçin...",
15329
15321
  "neptune.Select.searchPlaceholder": "Ara...",
15330
15322
  "neptune.SelectInput.noResultsFound": "Sonuç bulunamadı",
15331
15323
  "neptune.Summary.statusDone": "Tamamlanan aşama",
@@ -15440,6 +15432,7 @@ var zhCN = {
15440
15432
  "neptune.Info.ariaLabel": "更多信息",
15441
15433
  "neptune.Link.opensInNewTab": "(在新标签页中打开)",
15442
15434
  "neptune.MoneyInput.Select.placeholder": "请选择...",
15435
+ "neptune.PhoneNumberInput.SelectInput.placeholder": "选择一个选项...",
15443
15436
  "neptune.Select.searchPlaceholder": "搜索",
15444
15437
  "neptune.SelectInput.noResultsFound": "找不到结果",
15445
15438
  "neptune.Summary.statusDone": "已完成",
@@ -15497,6 +15490,7 @@ var zhHK = {
15497
15490
  "neptune.Info.ariaLabel": "更多資訊",
15498
15491
  "neptune.Link.opensInNewTab": "(在新分頁中開啟)",
15499
15492
  "neptune.MoneyInput.Select.placeholder": "選擇一個選項…",
15493
+ "neptune.PhoneNumberInput.SelectInput.placeholder": "選擇其中一項…",
15500
15494
  "neptune.Select.searchPlaceholder": "搜尋…",
15501
15495
  "neptune.SelectInput.noResultsFound": "找不到任何結果",
15502
15496
  "neptune.Summary.statusDone": "已完成事項",