@transferwise/components 45.21.2 → 45.22.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 (57) hide show
  1. package/build/index.esm.js +115 -130
  2. package/build/index.esm.js.map +1 -1
  3. package/build/index.js +115 -130
  4. package/build/index.js.map +1 -1
  5. package/build/main.css +1 -1
  6. package/build/styles/flowNavigation/FlowNavigation.css +1 -1
  7. package/build/styles/flowNavigation/animatedLabel/AnimatedLabel.css +1 -1
  8. package/build/styles/inputs/SelectInput.css +1 -1
  9. package/build/styles/main.css +1 -1
  10. package/build/styles/overlayHeader/OverlayHeader.css +1 -1
  11. package/build/styles/phoneNumberInput/PhoneNumberInput.css +1 -1
  12. package/build/types/common/flowHeader/FlowHeader.d.ts.map +1 -1
  13. package/build/types/flowNavigation/FlowNavigation.d.ts.map +1 -1
  14. package/build/types/flowNavigation/animatedLabel/AnimatedLabel.d.ts +1 -2
  15. package/build/types/flowNavigation/animatedLabel/AnimatedLabel.d.ts.map +1 -1
  16. package/build/types/flowNavigation/backButton/BackButton.d.ts +10 -11
  17. package/build/types/flowNavigation/backButton/BackButton.d.ts.map +1 -1
  18. package/build/types/inputs/SelectInput.d.ts +5 -1
  19. package/build/types/inputs/SelectInput.d.ts.map +1 -1
  20. package/build/types/overlayHeader/OverlayHeader.d.ts.map +1 -1
  21. package/build/types/phoneNumberInput/PhoneNumberInput.d.ts.map +1 -1
  22. package/package.json +1 -1
  23. package/src/common/flowHeader/FlowHeader.tsx +4 -22
  24. package/src/common/flowHeader/__snapshots__/FlowHeader.spec.js.snap +6 -22
  25. package/src/flowNavigation/FlowNavigation.css +1 -1
  26. package/src/flowNavigation/FlowNavigation.less +0 -9
  27. package/src/flowNavigation/FlowNavigation.spec.js +3 -3
  28. package/src/flowNavigation/FlowNavigation.story.js +22 -189
  29. package/src/flowNavigation/FlowNavigation.tsx +22 -27
  30. package/src/flowNavigation/__snapshots__/FlowNavigation.spec.js.snap +18 -26
  31. package/src/flowNavigation/animatedLabel/AnimatedLabel.css +1 -1
  32. package/src/flowNavigation/animatedLabel/AnimatedLabel.less +0 -6
  33. package/src/flowNavigation/animatedLabel/AnimatedLabel.spec.js +7 -21
  34. package/src/flowNavigation/animatedLabel/AnimatedLabel.tsx +8 -17
  35. package/src/flowNavigation/animatedLabel/__snapshots__/AnimatedLabel.spec.js.snap +4 -4
  36. package/src/flowNavigation/backButton/BackButton.js +14 -9
  37. package/src/flowNavigation/backButton/BackButton.spec.js +3 -2
  38. package/src/flowNavigation/backButton/__snapshots__/BackButton.spec.js.snap +28 -21
  39. package/src/inputs/SelectInput.css +1 -1
  40. package/src/inputs/SelectInput.less +7 -10
  41. package/src/inputs/SelectInput.spec.tsx +40 -0
  42. package/src/inputs/SelectInput.story.tsx +18 -0
  43. package/src/inputs/SelectInput.tsx +46 -12
  44. package/src/inputs/_BottomSheet.less +1 -1
  45. package/src/inputs/_Popover.less +1 -0
  46. package/src/main.css +1 -1
  47. package/src/overlayHeader/OverlayHeader.css +1 -1
  48. package/src/overlayHeader/OverlayHeader.js +6 -4
  49. package/src/overlayHeader/OverlayHeader.less +0 -8
  50. package/src/overlayHeader/OverlayHeader.spec.js +1 -1
  51. package/src/overlayHeader/__snapshots__/OverlayHeader.spec.js.snap +10 -14
  52. package/src/phoneNumberInput/PhoneNumberInput.css +1 -1
  53. package/src/phoneNumberInput/PhoneNumberInput.js +27 -28
  54. package/src/phoneNumberInput/PhoneNumberInput.less +4 -0
  55. package/src/phoneNumberInput/PhoneNumberInput.spec.js +64 -72
  56. package/src/phoneNumberInput/PhoneNumberInput.story.js +1 -3
  57. package/src/flowNavigation/animatedLabel/AnimatedLabel.story.js +0 -22
package/build/index.js CHANGED
@@ -5430,19 +5430,8 @@ const FlowHeader = /*#__PURE__*/React__namespace.forwardRef(({
5430
5430
  const isVertical = layout === exports.Layout.VERTICAL;
5431
5431
  return /*#__PURE__*/jsxRuntime.jsxs("div", {
5432
5432
  ref: reference,
5433
- className: classNames__default.default('np-flow-header', 'd-flex', 'flex-wrap', 'align-items-center', className),
5434
- children: [/*#__PURE__*/jsxRuntime.jsx("div", {
5435
- className: classNames__default.default('np-flow-header__left', {
5436
- 'flex__item--8': isVertical
5437
- }),
5438
- children: leftContent
5439
- }), /*#__PURE__*/jsxRuntime.jsx("div", {
5440
- className: classNames__default.default('align-items-center', 'd-flex', 'np-flow-header__right', 'justify-content-end', {
5441
- 'flex__item--4 ': isVertical,
5442
- 'order-2': !isVertical
5443
- }),
5444
- children: rightContent
5445
- }), /*#__PURE__*/jsxRuntime.jsx("div", {
5433
+ className: classNames__default.default('np-flow-header', 'd-flex', 'flex-wrap', 'align-items-center', 'justify-content-between', 'flex__item--12', className),
5434
+ children: [leftContent, rightContent, /*#__PURE__*/jsxRuntime.jsx("div", {
5446
5435
  className: classNames__default.default('align-items-center', 'd-flex', 'justify-content-center', {
5447
5436
  'flex__item--12': isVertical,
5448
5437
  'order-1 flex-grow-1': !isVertical
@@ -5745,19 +5734,16 @@ var messages$5 = reactIntl.defineMessages({
5745
5734
  const AnimatedLabel = ({
5746
5735
  activeLabel,
5747
5736
  className,
5748
- labels,
5749
- 'aria-label': ariaLabel
5737
+ labels
5750
5738
  }) => {
5751
- const numberLabels = labels.length - 1;
5752
- return /*#__PURE__*/jsxRuntime.jsx("div", {
5753
- "aria-label": ariaLabel,
5754
- className: classNames__default.default('np-animated-label', 'np-text-body-large-bold', className),
5739
+ return /*#__PURE__*/jsxRuntime.jsx(Body, {
5740
+ type: exports.Typography.BODY_LARGE_BOLD,
5741
+ className: classNames__default.default('np-animated-label', className),
5755
5742
  children: labels.map((label, index) => {
5756
5743
  const nextLabel = index - 1;
5757
5744
  return /*#__PURE__*/jsxRuntime.jsx("div", {
5758
- className: classNames__default.default('text-xs-left', {
5759
- 'np-animated-label--in': index === activeLabel,
5760
- 'np-animated-label--out': nextLabel === activeLabel && nextLabel !== numberLabels
5745
+ className: classNames__default.default('text-xs-center', {
5746
+ 'np-animated-label--in text-ellipsis': index === activeLabel
5761
5747
  }),
5762
5748
  children: label
5763
5749
  }, nextLabel);
@@ -5766,18 +5752,24 @@ const AnimatedLabel = ({
5766
5752
  };
5767
5753
 
5768
5754
  const BackButton = ({
5769
- label,
5770
5755
  className,
5771
- onClick
5772
- }) => /*#__PURE__*/jsxRuntime.jsxs("button", {
5773
- type: "button",
5774
- className: classNames__default.default('np-back-button', 'align-items-center', 'btn-unstyled', className),
5775
- onClick: onClick,
5776
- children: [/*#__PURE__*/jsxRuntime.jsx(icons.ArrowLeft, {
5777
- size: 24
5778
- }), label]
5756
+ onClick,
5757
+ 'aria-label': ariaLabel
5758
+ }) => /*#__PURE__*/jsxRuntime.jsx(Avatar, {
5759
+ type: exports.AvatarType.ICON,
5760
+ size: 40,
5761
+ children: /*#__PURE__*/jsxRuntime.jsx("button", {
5762
+ type: "button",
5763
+ "aria-label": ariaLabel,
5764
+ className: classNames__default.default('np-back-button', 'btn-unstyled', className),
5765
+ onClick: onClick,
5766
+ children: /*#__PURE__*/jsxRuntime.jsx(icons.ArrowLeft, {
5767
+ size: 24
5768
+ })
5769
+ })
5779
5770
  });
5780
5771
  BackButton.propTypes = {
5772
+ 'aria-label': PropTypes__default.default.string.isRequired,
5781
5773
  className: PropTypes__default.default.string,
5782
5774
  label: PropTypes__default.default.element,
5783
5775
  onClick: PropTypes__default.default.func
@@ -5807,21 +5799,9 @@ const FlowNavigation = ({
5807
5799
  onClick: onClose
5808
5800
  });
5809
5801
  const isSmall = clientWidth != null && clientWidth < exports.Breakpoint.SMALL;
5802
+ const isLarge = clientWidth != null && clientWidth >= exports.Breakpoint.LARGE;
5810
5803
  const newAvatar = done ? null : avatar;
5811
- const getLeftContentSmall = () => {
5812
- const displayGoBack = onGoBack != null && activeStep > 0;
5813
- return /*#__PURE__*/jsxRuntime.jsx(jsxRuntime.Fragment, {
5814
- children: displayGoBack ? /*#__PURE__*/jsxRuntime.jsx(BackButton$1, {
5815
- label: /*#__PURE__*/jsxRuntime.jsx(AnimatedLabel, {
5816
- className: "m-x-1",
5817
- labels: steps.map(step => step.label),
5818
- activeLabel: activeStep - 1,
5819
- "aria-label": intl.formatMessage(messages$5.back)
5820
- }),
5821
- onClick: onGoBack
5822
- }) : logo
5823
- });
5824
- };
5804
+ const displayGoBack = onGoBack != null && activeStep > 0;
5825
5805
  return /*#__PURE__*/jsxRuntime.jsx("div", {
5826
5806
  ref: reference,
5827
5807
  className: classNames__default.default('np-flow-navigation d-flex align-items-center justify-content-center p-y-3', {
@@ -5833,12 +5813,24 @@ const FlowNavigation = ({
5833
5813
  'np-flow-navigation--xs-max': isSmall,
5834
5814
  // Size switches on parent container which may or may not have the same size as the window.
5835
5815
  'np-flow-navigation--sm': clientWidth != null && clientWidth >= exports.Breakpoint.SMALL,
5836
- 'np-flow-navigation--lg': clientWidth != null && clientWidth >= exports.Breakpoint.LARGE
5816
+ 'np-flow-navigation--lg': isLarge
5837
5817
  }),
5838
- leftContent: isSmall ? getLeftContentSmall() : logo,
5839
- rightContent: /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
5818
+ leftContent: /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
5819
+ children: [isSmall && displayGoBack ? /*#__PURE__*/jsxRuntime.jsx(BackButton$1, {
5820
+ "aria-label": intl.formatMessage(messages$5.back),
5821
+ onClick: onGoBack
5822
+ }) : logo, isSmall && /*#__PURE__*/jsxRuntime.jsx(AnimatedLabel, {
5823
+ className: "m-x-1",
5824
+ labels: steps.map(step => step.label),
5825
+ activeLabel: activeStep
5826
+ })]
5827
+ }),
5828
+ rightContent: /*#__PURE__*/jsxRuntime.jsxs("div", {
5829
+ className: classNames__default.default('d-flex', 'align-items-center', {
5830
+ 'order-2': isLarge
5831
+ }),
5840
5832
  children: [newAvatar, newAvatar && closeButton && /*#__PURE__*/jsxRuntime.jsx("span", {
5841
- className: "separator"
5833
+ className: "m-x-1"
5842
5834
  }), closeButton]
5843
5835
  }),
5844
5836
  bottomContent: !done && /*#__PURE__*/jsxRuntime.jsx(Stepper, {
@@ -6783,6 +6775,7 @@ function SelectInput({
6783
6775
  value: controlledValue,
6784
6776
  compareValues,
6785
6777
  renderValue = wrapInFragment,
6778
+ renderFooter,
6786
6779
  renderTrigger = defaultRenderTrigger,
6787
6780
  filterable,
6788
6781
  filterPlaceholder,
@@ -6856,6 +6849,7 @@ function SelectInput({
6856
6849
  children: /*#__PURE__*/jsxRuntime.jsx(SelectInputOptions, {
6857
6850
  items: items,
6858
6851
  renderValue: renderValue,
6852
+ renderFooter: renderFooter,
6859
6853
  filterable: filterable,
6860
6854
  filterPlaceholder: filterPlaceholder,
6861
6855
  searchInputRef: searchInputRef,
@@ -6898,29 +6892,32 @@ const SelectInputOptionsContainer = /*#__PURE__*/React.forwardRef(function Selec
6898
6892
  React.useEffect(() => {
6899
6893
  handleAriaActiveDescendantChange(ariaActiveDescendant);
6900
6894
  }, [ariaActiveDescendant, handleAriaActiveDescendantChange]);
6901
- return (
6902
- /*#__PURE__*/
6903
- // eslint-disable-next-line jsx-a11y/no-static-element-interactions
6904
- jsxRuntime.jsx("div", {
6905
- ref: ref,
6906
- onKeyDown: event => {
6907
- // Prevent absorbing dismissal requests too early
6908
- if (event.key === 'Escape') {
6909
- return;
6910
- }
6911
- // Prevent confirmation close without an active item
6912
- if (event.key === 'Enter' && ariaActiveDescendant == null) {
6913
- return;
6914
- }
6915
- onKeyDown?.(event);
6916
- },
6917
- ...restProps
6918
- })
6919
- );
6895
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
6896
+ ref: ref,
6897
+ role: "none",
6898
+ onKeyDown: event => {
6899
+ // Prevent confirmation close without an active item
6900
+ if (event.key === 'Enter' && ariaActiveDescendant == null) {
6901
+ return;
6902
+ }
6903
+ // Prevent absorbing actions early
6904
+ if (event.key === 'Escape' || event.key === 'Tab') {
6905
+ onKeyDown?.({
6906
+ ...event,
6907
+ preventDefault: () => {},
6908
+ stopPropagation: () => {}
6909
+ });
6910
+ return;
6911
+ }
6912
+ onKeyDown?.(event);
6913
+ },
6914
+ ...restProps
6915
+ });
6920
6916
  });
6921
6917
  function SelectInputOptions({
6922
6918
  items,
6923
6919
  renderValue = wrapInFragment,
6920
+ renderFooter,
6924
6921
  filterable = false,
6925
6922
  filterPlaceholder,
6926
6923
  searchInputRef,
@@ -6935,14 +6932,14 @@ function SelectInputOptions({
6935
6932
  }
6936
6933
  return undefined;
6937
6934
  }, [filterable, query]);
6938
- const empty = needle != null && filterSelectInputItems(items, needle).length === 0;
6935
+ const resultsEmpty = needle != null && filterSelectInputItems(items, needle).length === 0;
6939
6936
  const listboxContainerRef = React.useRef(null);
6940
6937
  React.useEffect(() => {
6941
6938
  if (listboxContainerRef.current != null) {
6942
6939
  listboxContainerRef.current.style.setProperty('--initial-height', `${listboxContainerRef.current.offsetHeight}px`);
6943
6940
  }
6944
6941
  }, []);
6945
- const showStatus = empty;
6942
+ const showStatus = resultsEmpty;
6946
6943
  const statusId = reactId.useId();
6947
6944
  const listboxId = reactId.useId();
6948
6945
  return /*#__PURE__*/jsxRuntime.jsxs(react$1.Listbox.Options, {
@@ -6978,10 +6975,10 @@ function SelectInputOptions({
6978
6975
  setQuery(event.currentTarget.value);
6979
6976
  }
6980
6977
  })
6981
- }) : null, /*#__PURE__*/jsxRuntime.jsxs("div", {
6978
+ }) : null, /*#__PURE__*/jsxRuntime.jsxs("section", {
6982
6979
  ref: listboxContainerRef,
6983
6980
  className: classNames__default.default('np-select-input-listbox-container', items.some(item => item.type === 'group') && 'np-select-input-listbox-container--has-group'),
6984
- children: [empty ? /*#__PURE__*/jsxRuntime.jsxs("div", {
6981
+ children: [resultsEmpty ? /*#__PURE__*/jsxRuntime.jsxs("div", {
6985
6982
  id: statusId,
6986
6983
  className: "np-select-input-options-status",
6987
6984
  children: [/*#__PURE__*/jsxRuntime.jsx(icons.CrossCircle, {
@@ -7002,7 +6999,22 @@ function SelectInputOptions({
7002
6999
  renderValue: renderValue,
7003
7000
  needle: needle
7004
7001
  }, index))
7005
- })]
7002
+ }), renderFooter != null ? /*#__PURE__*/jsxRuntime.jsx("footer", {
7003
+ className: "np-select-input-footer",
7004
+ children: /*#__PURE__*/jsxRuntime.jsx("div", {
7005
+ role: "none",
7006
+ onKeyDown: event => {
7007
+ // Prevent interfering with Headless UI
7008
+ if (event.key !== 'Escape') {
7009
+ event.stopPropagation();
7010
+ }
7011
+ },
7012
+ children: renderFooter({
7013
+ resultsEmpty,
7014
+ normalizedQuery: needle
7015
+ })
7016
+ })
7017
+ }) : null]
7006
7018
  })]
7007
7019
  });
7008
7020
  }
@@ -7059,7 +7071,7 @@ function SelectInputGroupItemView({
7059
7071
  className: classNames__default.default(needle === null && 'np-select-input-group-item--without-needle'),
7060
7072
  children: [needle == null ? /*#__PURE__*/jsxRuntime.jsx("header", {
7061
7073
  id: headerId,
7062
- role: "presentation",
7074
+ role: "none",
7063
7075
  className: "np-select-input-group-item-header np-text-title-group",
7064
7076
  children: item.label
7065
7077
  }) : null, item.options.map((option, index) => /*#__PURE__*/jsxRuntime.jsx(SelectInputItemView
@@ -8510,7 +8522,7 @@ class MoneyInput extends React.Component {
8510
8522
  this.amountFocused = true;
8511
8523
  };
8512
8524
  getSelectOptions() {
8513
- const selectOptions = [...filterOptionsForQuery$1(this.props.currencies, this.state.searchQuery)];
8525
+ const selectOptions = [...filterOptionsForQuery(this.props.currencies, this.state.searchQuery)];
8514
8526
  if (this.props.onCustomAction) {
8515
8527
  selectOptions.push({
8516
8528
  value: CUSTOM_ACTION,
@@ -8547,7 +8559,7 @@ class MoneyInput extends React.Component {
8547
8559
  if (this.props.onSearchChange) {
8548
8560
  this.props.onSearchChange({
8549
8561
  searchQuery,
8550
- filteredOptions: filterOptionsForQuery$1(this.props.currencies, searchQuery)
8562
+ filteredOptions: filterOptionsForQuery(this.props.currencies, searchQuery)
8551
8563
  });
8552
8564
  }
8553
8565
  };
@@ -8628,7 +8640,7 @@ class MoneyInput extends React.Component {
8628
8640
  });
8629
8641
  }
8630
8642
  }
8631
- function filterOptionsForQuery$1(options, query) {
8643
+ function filterOptionsForQuery(options, query) {
8632
8644
  if (!query) {
8633
8645
  return options;
8634
8646
  }
@@ -8837,6 +8849,7 @@ const OverlayHeader = ({
8837
8849
  logo
8838
8850
  }) => {
8839
8851
  const closeButton = onClose && /*#__PURE__*/jsxRuntime.jsx(CloseButton, {
8852
+ size: exports.Size.LARGE,
8840
8853
  onClick: onClose
8841
8854
  });
8842
8855
  return /*#__PURE__*/jsxRuntime.jsx("div", {
@@ -8844,9 +8857,10 @@ const OverlayHeader = ({
8844
8857
  children: /*#__PURE__*/jsxRuntime.jsx(FlowHeader, {
8845
8858
  className: "np-overlay-header__content p-a-3",
8846
8859
  leftContent: logo,
8847
- rightContent: /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
8860
+ rightContent: /*#__PURE__*/jsxRuntime.jsxs("div", {
8861
+ className: classNames__default.default('d-flex', 'align-items-center', 'order-2'),
8848
8862
  children: [avatar, avatar && closeButton && /*#__PURE__*/jsxRuntime.jsx("span", {
8849
- className: "separator"
8863
+ className: classNames__default.default('m-x-1')
8850
8864
  }), closeButton]
8851
8865
  })
8852
8866
  })
@@ -10216,36 +10230,9 @@ const explodeNumberModel = number => {
10216
10230
  };
10217
10231
  };
10218
10232
 
10219
- /**
10220
- * Checks if query is contained into object properties.
10221
- *
10222
- * @param {object} option - the select option
10223
- * @param {string} query - the current search query
10224
- * @returns {boolean}
10225
- */
10226
- const isOptionAndFitsQuery = (option, query) => startsWith(option.iso3, query) || startsWith(option.iso2, query) || startsWith(option.name, query) || startsWith(option.phone, query);
10227
- const startsWith = (property, query) => {
10228
- if (neptuneValidation.isArray(property)) {
10229
- return property.filter(proper => normalizeValue(proper).indexOf(normalizeValue(query)) === 0).length > 0;
10230
- }
10231
- return normalizeValue(property).indexOf(normalizeValue(query)) === 0;
10232
- };
10233
- const normalizeValue = value => value.toLowerCase().replace('+', '');
10234
-
10235
- /**
10236
- * Filters a set of options based on search string
10237
- *
10238
- * @param options
10239
- * @param query
10240
- * @returns {*}
10241
- */
10242
- const filterOptionsForQuery = (options, query) => options.filter(option => isOptionAndFitsQuery(option, query));
10243
-
10244
10233
  const DIGITS_MATCH = /^$|^(\+)|([\d]+)/g;
10245
10234
  const cleanNumber = number => number.match(DIGITS_MATCH) && number.match(DIGITS_MATCH).join('') || '';
10246
10235
 
10247
- const isStringNumeric = value => /^\+?[\d-\s]+$/.test(value);
10248
-
10249
10236
  // Reference fro localeCompare : https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/localeCompare
10250
10237
  const sortArrayByProperty = (arrayToSort, property) => [...arrayToSort].sort((a, b) => a[property].localeCompare(b[property]));
10251
10238
 
@@ -10324,17 +10311,15 @@ const PhoneNumberInput = props => {
10324
10311
  };
10325
10312
  const [internalValue, setInternalValue] = React.useState(getInitialValue());
10326
10313
  const [broadcastedValue, setBroadcastedValue] = React.useState(null);
10327
- const [searchQuery, setSearchQuery] = React.useState('');
10328
- const countriesList = excludeCountries(countries$1, disabledCountries);
10329
- const listSortedByISO3 = groupCountriesByPrefix(sortArrayByProperty(countriesList, 'iso3'));
10330
- const listSortedByPhone = groupCountriesByPrefix(sortArrayByProperty(countriesList, 'phone'));
10331
10314
  const getSelectOptions = () => {
10332
- const filteredOptions = filterOptionsForQuery(isStringNumeric(searchQuery) ? listSortedByPhone : listSortedByISO3, searchQuery);
10333
- return filteredOptions.map(option => {
10315
+ const countriesList = excludeCountries(countries$1, disabledCountries);
10316
+ const listSortedByISO3 = groupCountriesByPrefix(sortArrayByProperty(countriesList, 'iso3'));
10317
+ return listSortedByISO3.map(option => {
10334
10318
  const {
10335
10319
  phone,
10336
10320
  iso3,
10337
- iso2
10321
+ iso2,
10322
+ name
10338
10323
  } = option;
10339
10324
  let note = '';
10340
10325
  if (iso3) {
@@ -10343,9 +10328,13 @@ const PhoneNumberInput = props => {
10343
10328
  note = neptuneValidation.isArray(iso2) ? iso2.join(', ') : iso2;
10344
10329
  }
10345
10330
  return {
10346
- value: phone,
10347
- label: phone,
10348
- note
10331
+ type: 'option',
10332
+ value: {
10333
+ value: phone,
10334
+ label: phone,
10335
+ note: note
10336
+ },
10337
+ filterMatchers: [phone, note, name]
10349
10338
  };
10350
10339
  });
10351
10340
  };
@@ -10353,7 +10342,6 @@ const PhoneNumberInput = props => {
10353
10342
  const onPrefixChange = ({
10354
10343
  value
10355
10344
  }) => {
10356
- setSearchQuery('');
10357
10345
  setInternalValue({
10358
10346
  prefix: value,
10359
10347
  suffix: internalValue.suffix
@@ -10381,7 +10369,7 @@ const PhoneNumberInput = props => {
10381
10369
  } = explodeNumberModel(pastedValue);
10382
10370
  const selectedPrefix = options.find(({
10383
10371
  value
10384
- }) => value === pastedPrefix);
10372
+ }) => value.value === pastedPrefix);
10385
10373
  if (selectedPrefix && ALLOWED_PHONE_CHARS.test(pastedSuffix)) {
10386
10374
  setInternalValue({
10387
10375
  prefix: pastedPrefix,
@@ -10406,22 +10394,19 @@ const PhoneNumberInput = props => {
10406
10394
  className: "tw-telephone",
10407
10395
  children: [/*#__PURE__*/jsxRuntime.jsx("div", {
10408
10396
  className: "tw-telephone__country-select",
10409
- children: /*#__PURE__*/jsxRuntime.jsx(Select, {
10410
- id: id ? `${id}-select` : undefined,
10411
- options: options,
10412
- selected: {
10413
- value: internalValue.prefix,
10414
- label: internalValue.prefix
10415
- },
10397
+ children: /*#__PURE__*/jsxRuntime.jsx(SelectInput, {
10416
10398
  placeholder: "Select an option...",
10417
- searchPlaceholder: searchPlaceholder,
10418
- dropdownWidth: exports.Size.SMALL,
10419
- searchValue: searchQuery,
10420
- required: required,
10399
+ items: options,
10400
+ value: options.find(item => item.value.value === internalValue.prefix)?.value,
10401
+ renderValue: (option, withinTrigger) => /*#__PURE__*/jsxRuntime.jsx(SelectInputOptionContent, {
10402
+ title: option.label,
10403
+ note: withinTrigger ? undefined : option.note
10404
+ }),
10405
+ filterable: true,
10406
+ filterPlaceholder: searchPlaceholder,
10421
10407
  disabled: disabled,
10422
10408
  size: size,
10423
10409
  onChange: onPrefixChange,
10424
- onSearchChange: newSearch => setSearchQuery(newSearch),
10425
10410
  ...selectProps
10426
10411
  })
10427
10412
  }), /*#__PURE__*/jsxRuntime.jsx("div", {