@transferwise/components 45.27.0 → 45.28.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 (54) hide show
  1. package/build/i18n/cs.json +2 -0
  2. package/build/i18n/de.json +2 -0
  3. package/build/i18n/es.json +2 -0
  4. package/build/i18n/fr.json +2 -0
  5. package/build/i18n/hu.json +2 -0
  6. package/build/i18n/id.json +2 -0
  7. package/build/i18n/it.json +2 -0
  8. package/build/i18n/ja.json +2 -0
  9. package/build/i18n/pl.json +2 -0
  10. package/build/i18n/pt.json +5 -3
  11. package/build/i18n/ro.json +5 -3
  12. package/build/i18n/ru.json +3 -1
  13. package/build/i18n/th.json +2 -0
  14. package/build/i18n/tr.json +2 -0
  15. package/build/i18n/uk.json +2 -0
  16. package/build/i18n/zh-CN.json +8 -6
  17. package/build/i18n/zh-HK.json +2 -0
  18. package/build/index.esm.js +1344 -1253
  19. package/build/index.esm.js.map +1 -1
  20. package/build/index.js +1343 -1252
  21. package/build/index.js.map +1 -1
  22. package/build/main.css +1 -1
  23. package/build/styles/main.css +1 -1
  24. package/build/styles/moneyInput/MoneyInput.css +1 -1
  25. package/build/types/inputs/SelectInput.d.ts +2 -1
  26. package/build/types/inputs/SelectInput.d.ts.map +1 -1
  27. package/build/types/moneyInput/MoneyInput.d.ts.map +1 -1
  28. package/package.json +1 -1
  29. package/src/i18n/cs.json +2 -0
  30. package/src/i18n/de.json +2 -0
  31. package/src/i18n/es.json +2 -0
  32. package/src/i18n/fr.json +2 -0
  33. package/src/i18n/hu.json +2 -0
  34. package/src/i18n/id.json +2 -0
  35. package/src/i18n/it.json +2 -0
  36. package/src/i18n/ja.json +2 -0
  37. package/src/i18n/pl.json +2 -0
  38. package/src/i18n/pt.json +5 -3
  39. package/src/i18n/ro.json +5 -3
  40. package/src/i18n/ru.json +3 -1
  41. package/src/i18n/th.json +2 -0
  42. package/src/i18n/tr.json +2 -0
  43. package/src/i18n/uk.json +2 -0
  44. package/src/i18n/zh-CN.json +8 -6
  45. package/src/i18n/zh-HK.json +2 -0
  46. package/src/inputs/SelectInput.spec.tsx +5 -5
  47. package/src/inputs/SelectInput.tsx +24 -3
  48. package/src/main.css +1 -1
  49. package/src/moneyInput/MoneyInput.css +1 -1
  50. package/src/moneyInput/MoneyInput.js +85 -42
  51. package/src/moneyInput/MoneyInput.less +40 -159
  52. package/src/moneyInput/MoneyInput.rtl.spec.js +71 -0
  53. package/src/moneyInput/MoneyInput.spec.js +247 -116
  54. package/src/moneyInput/MoneyInput.story.tsx +54 -1
@@ -20,7 +20,7 @@ import { usePopper } from 'react-popper';
20
20
  import throttle from 'lodash.throttle';
21
21
  import { createPortal } from 'react-dom';
22
22
  import { isUndefined, isKey, isNumber, isEmpty, isNull, isArray } from '@transferwise/neptune-validation';
23
- import { Illustration } from '@wise/art';
23
+ import { Flag, Illustration } from '@wise/art';
24
24
  import clamp$2 from 'lodash.clamp';
25
25
  import debounce from 'lodash.debounce';
26
26
  import requiredIf from 'react-required-if';
@@ -6860,6 +6860,7 @@ function SelectInput({
6860
6860
  size = 'md',
6861
6861
  className,
6862
6862
  onChange,
6863
+ onSearchChange,
6863
6864
  onClear
6864
6865
  }) {
6865
6866
  const [open, setOpen] = useState(false);
@@ -6898,6 +6899,11 @@ function SelectInput({
6898
6899
  ...mergeProps({
6899
6900
  onClick: () => {
6900
6901
  setOpen(prev => !prev);
6902
+ },
6903
+ onKeyDown: event => {
6904
+ if (event.key === ' ' || event.key === 'Enter' || event.key === 'ArrowDown' || event.key === 'ArrowUp') {
6905
+ setOpen(prev => !prev);
6906
+ }
6901
6907
  }
6902
6908
  }, getInteractionProps())
6903
6909
  },
@@ -6930,7 +6936,8 @@ function SelectInput({
6930
6936
  filterable: filterable,
6931
6937
  filterPlaceholder: filterPlaceholder,
6932
6938
  searchInputRef: searchInputRef,
6933
- listboxRef: listboxRef
6939
+ listboxRef: listboxRef,
6940
+ onSearchChange: onSearchChange
6934
6941
  })
6935
6942
  })
6936
6943
  });
@@ -6942,6 +6949,7 @@ function SelectInputTriggerButton({
6942
6949
  const {
6943
6950
  ref,
6944
6951
  onClick,
6952
+ onKeyDown,
6945
6953
  ...interactionProps
6946
6954
  } = useContext(SelectInputTriggerButtonPropsContext);
6947
6955
  return /*#__PURE__*/jsx(Listbox.Button, {
@@ -6952,7 +6960,8 @@ function SelectInputTriggerButton({
6952
6960
  ...interactionProps
6953
6961
  },
6954
6962
  ...mergeProps({
6955
- onClick
6963
+ onClick,
6964
+ onKeyDown
6956
6965
  }, restProps)
6957
6966
  });
6958
6967
  }
@@ -6998,7 +7007,8 @@ function SelectInputOptions({
6998
7007
  filterable = false,
6999
7008
  filterPlaceholder,
7000
7009
  searchInputRef,
7001
- listboxRef
7010
+ listboxRef,
7011
+ onSearchChange
7002
7012
  }) {
7003
7013
  const intl = useIntl();
7004
7014
  const controllerRef = filterable ? searchInputRef : listboxRef;
@@ -7050,6 +7060,9 @@ function SelectInputOptions({
7050
7060
  },
7051
7061
  onChange: event => {
7052
7062
  setQuery(event.currentTarget.value);
7063
+ if (onSearchChange) {
7064
+ onSearchChange(event.currentTarget.value);
7065
+ }
7053
7066
  }
7054
7067
  })
7055
7068
  }) : null, /*#__PURE__*/jsxs("section", {
@@ -7779,1139 +7792,526 @@ Money.propTypes = {
7779
7792
  var Money$1 = Money;
7780
7793
 
7781
7794
  var messages$3 = defineMessages({
7782
- searchPlaceholder: {
7783
- id: "neptune.Select.searchPlaceholder"
7795
+ selectPlaceholder: {
7796
+ id: "neptune.MoneyInput.Select.placeholder"
7784
7797
  }
7785
7798
  });
7786
7799
 
7787
- // Option.tsx NEW
7788
- function Option$1({
7789
- label,
7790
- currency = '',
7791
- note = '',
7792
- secondary = '',
7793
- icon,
7794
- classNames = {},
7795
- selected = false
7796
- }) {
7797
- const {
7798
- isModern
7799
- } = useTheme();
7800
- const style = classes => classes.map(className => classNames[className] || className).join(' ');
7801
- const currencyClassNames = currency ? style(['currency-flag', `currency-flag-${currency.toLowerCase()}`]) : undefined;
7802
- const iconElement = icon ? /*#__PURE__*/cloneElement(icon, {
7803
- size: 24,
7804
- className: 'tw-icon'
7805
- }) : currency && /*#__PURE__*/jsx("i", {
7806
- className: currencyClassNames
7807
- });
7808
- const titleAndNoteElement = /*#__PURE__*/jsxs(Body, {
7809
- as: "span",
7810
- type: Typography.BODY_LARGE,
7811
- className: selected ? 'text-ellipsis' : undefined,
7812
- children: [label, note && /*#__PURE__*/jsx(Body, {
7813
- as: "span",
7814
- className: isModern ? 'm-l-1' : 'm-l-1 body-2',
7815
- children: note
7816
- })]
7817
- });
7818
- const secondaryElementClassNames = () => {
7819
- let classes = undefined;
7820
- if (selected) {
7821
- classes = 'text-ellipsis';
7822
- }
7823
- if (isModern) {
7824
- return classes;
7825
- }
7826
- return `${classes ? classes + ' ' : ''}body-2`;
7827
- };
7828
- const secondaryElement = secondary && /*#__PURE__*/jsx(Body, {
7829
- className: secondaryElementClassNames(),
7830
- children: secondary
7831
- });
7832
- return iconElement ? /*#__PURE__*/jsxs("div", {
7833
- className: "d-flex np-option-content",
7834
- children: [/*#__PURE__*/jsx("div", {
7835
- className: `d-flex flex-column${selected ? ' justify-content-center' : ''}`,
7836
- children: iconElement
7837
- }), /*#__PURE__*/jsxs("div", {
7838
- className: "d-flex flex-column justify-content-center",
7839
- children: [titleAndNoteElement, secondaryElement]
7840
- })]
7841
- }) : /*#__PURE__*/jsxs(Fragment, {
7842
- children: [iconElement, titleAndNoteElement, secondaryElement]
7843
- });
7800
+ // TODO: do not duplicate this between formatting and components
7801
+ const currencyDecimals = {
7802
+ BIF: 0,
7803
+ BYR: 0,
7804
+ CLP: 0,
7805
+ DJF: 0,
7806
+ GNF: 0,
7807
+ JPY: 0,
7808
+ KMF: 0,
7809
+ KRW: 0,
7810
+ MGA: 0,
7811
+ PYG: 0,
7812
+ RWF: 0,
7813
+ VND: 0,
7814
+ VUV: 0,
7815
+ XAF: 0,
7816
+ XOF: 0,
7817
+ XPF: 0,
7818
+ // technically HUF does have decimals, but due to the exchange rate banks
7819
+ // do not accept decimal amounts
7820
+ HUF: 0,
7821
+ BHD: 3,
7822
+ JOD: 3,
7823
+ KWD: 3,
7824
+ OMR: 3,
7825
+ TND: 3
7826
+ };
7827
+ const DEFAULT_CURRENCY_DECIMALS = 2;
7828
+ function isNumberLocaleSupported() {
7829
+ const number = 1234;
7830
+ const numberString = number.toLocaleString && number.toLocaleString(DEFAULT_LOCALE);
7831
+ return numberString === '1,234';
7844
7832
  }
7845
-
7846
- const SearchBox = /*#__PURE__*/forwardRef(({
7847
- id,
7848
- classNames: classNames$1 = {},
7849
- focusedOptionId,
7850
- onChange,
7851
- onClick,
7852
- placeholder = undefined,
7853
- value = ''
7854
- }, reference) => {
7855
- const style = className => classNames$1[className] || className;
7856
- return /*#__PURE__*/jsx("li", {
7857
- className: style('border-bottom'),
7858
- children: /*#__PURE__*/jsx("a", {
7859
- className: `${style('np-select-filter-link')} ${style('p-a-0')}`,
7860
- children: /*#__PURE__*/jsxs("div", {
7861
- className: style('input-group'),
7862
- children: [/*#__PURE__*/jsx("span", {
7863
- className: classNames('input-group-addon', 'input-group-addon--search'),
7864
- children: /*#__PURE__*/jsx(Search, {
7865
- className: classNames(style('tw-icon'), style('tw-icon-search')),
7866
- size: 24
7867
- })
7868
- }), /*#__PURE__*/jsx(Input, {
7869
- ref: reference,
7870
- id: id,
7871
- role: "searchbox",
7872
- inputMode: "search",
7873
- className: classNames(style('np-select-filter')),
7874
- placeholder: placeholder,
7875
- value: value,
7876
- spellCheck: "false",
7877
- "aria-activedescendant": focusedOptionId,
7878
- onChange: onChange,
7879
- onClick: onClick
7880
- })]
7881
- })
7882
- })
7883
- });
7884
- });
7885
- var SearchBox$1 = SearchBox;
7886
-
7887
- const DEFAULT_SEARCH_VALUE = '';
7888
- const DEFAULT_OPTIONS_PAGE_SIZE = 1000;
7889
- const includesString = (string1, string2) => string1.toLowerCase().includes(string2.toLowerCase());
7890
- function defaultFilterFunction(option, searchValue) {
7891
- if (isPlaceholderOption(option)) {
7892
- return true;
7833
+ function getValidLocale(locale) {
7834
+ try {
7835
+ const noUnderscoreLocale = locale.replace(/_/, '-');
7836
+ Intl.NumberFormat(noUnderscoreLocale);
7837
+ return noUnderscoreLocale;
7838
+ } catch {
7839
+ return 'en-GB';
7893
7840
  }
7894
- const {
7895
- label,
7896
- note,
7897
- secondary,
7898
- currency,
7899
- searchStrings
7900
- } = option;
7901
- return !!label && includesString(label, searchValue) || !!note && includesString(note, searchValue) || !!secondary && includesString(secondary, searchValue) || !!currency && includesString(currency, searchValue) || !!searchStrings && searchStrings.some(string => includesString(string, searchValue));
7902
- }
7903
- function isActionableOption(option) {
7904
- return !option.header && !option.separator && !option.disabled;
7905
7841
  }
7906
- function isHeaderOption(option) {
7907
- return option != null && 'header' in option;
7842
+ function getCurrencyDecimals(currency = '') {
7843
+ const upperCaseCurrency = currency.toUpperCase();
7844
+ if (Object.prototype.hasOwnProperty.call(currencyDecimals, upperCaseCurrency)) {
7845
+ return currencyDecimals[upperCaseCurrency];
7846
+ }
7847
+ return DEFAULT_CURRENCY_DECIMALS;
7908
7848
  }
7909
- function isSeparatorOption(option) {
7910
- return option != null && 'separator' in option;
7849
+ function getDecimalSeparator(locale) {
7850
+ return isNumberLocaleSupported() ? 1.1.toLocaleString(locale)[1] : '.';
7911
7851
  }
7912
- function clamp(from, to, value) {
7913
- return Math.max(Math.min(to, value), from);
7852
+ function parseAmount(number, currency, locale) {
7853
+ const validLocale = getValidLocale(locale);
7854
+ const precision = getCurrencyDecimals(currency);
7855
+ const groupSeparator = isNumberLocaleSupported() ? 10000 .toLocaleString(validLocale)[2] : ',';
7856
+ const decimalSeparator = getDecimalSeparator(validLocale);
7857
+ const numberWithStandardDecimalSeparator = (number ? `${number}` : '').replace(new RegExp(`\\${groupSeparator}`, 'g'), '').replace(new RegExp(`\\${decimalSeparator}`, 'g'), '.').replace(/[^0-9.]/g, '');
7858
+ const parsedAmount = parseFloat(parseFloat(numberWithStandardDecimalSeparator).toFixed(precision));
7859
+ return Math.abs(parsedAmount);
7914
7860
  }
7915
7861
 
7916
- /**
7917
- * No option or placeholder option is selected
7918
- */
7919
- const DEFAULT_SELECTED_OPTION = null;
7920
- function isPlaceholderOption(option) {
7921
- return option === DEFAULT_SELECTED_OPTION || 'placeholder' in option;
7922
- }
7923
- function isSearchableOption(option) {
7924
- return !isHeaderOption(option) && !isSeparatorOption(option) && !isPlaceholderOption(option);
7925
- }
7926
- const getUniqueIdForOption = (parentId = '', option) => {
7927
- if (option == null) {
7928
- return undefined;
7862
+ const Currency = PropTypes.shape({
7863
+ header: PropTypes.string,
7864
+ value: PropTypes.string,
7865
+ label: PropTypes.string,
7866
+ currency: PropTypes.string,
7867
+ note: PropTypes.string,
7868
+ searchable: PropTypes.string
7869
+ });
7870
+ const isNumberOrNull = v => isNumber(v) || isNull(v);
7871
+ const formatAmountIfSet = (amount, currency, locale, maxLengthOverride) => {
7872
+ if (maxLengthOverride) {
7873
+ return amount || '';
7874
+ } else {
7875
+ return typeof amount === 'number' ? formatAmount(amount, currency, locale) : '';
7929
7876
  }
7930
- const uniqueOptionId = option.value || (option.label?.replace(/\s/g, '') ?? '');
7931
- return `option-${parentId}-${uniqueOptionId}`;
7932
7877
  };
7933
-
7934
- /**
7935
- * @deprecated Use `SelectInput` instead (https://neptune.wise.design/blog/2023-11-28-adopting-our-new-selectinput)
7936
- */
7937
- function Select({
7938
- placeholder,
7939
- id,
7940
- required,
7941
- disabled,
7942
- inverse,
7943
- dropdownWidth,
7944
- size,
7945
- block,
7946
- selected,
7947
- search,
7948
- onChange,
7949
- onFocus,
7950
- onBlur,
7951
- options: defaultOptions,
7952
- onSearchChange,
7953
- searchValue: initSearchValue,
7954
- searchPlaceholder,
7955
- // eslint-disable-next-line unicorn/prevent-abbreviations
7956
- classNames: classNamesProp,
7957
- dropdownUp,
7958
- dropdownProps,
7959
- buttonProps
7960
- }) {
7961
- const {
7962
- formatMessage
7963
- } = useIntl();
7964
- const {
7965
- isModern
7966
- } = useTheme();
7967
- const s = className => classNamesProp[className] || className;
7968
- const [open, setOpen] = useState(false);
7969
- const [searchValue, setSearchValue] = useState(DEFAULT_SEARCH_VALUE);
7970
- const [keyboardFocusedOptionIndex, setKeyboardFocusedOptionIndex] = useState(null);
7971
- const keyboardFocusedReference = useRef();
7972
- const previousKeyboardFocusedOptionIndex = useRef();
7973
- const [numberOfOptionsShown, setNumberOfOptionsShown] = useState(DEFAULT_OPTIONS_PAGE_SIZE);
7974
- const searchBoxReference = useRef(null);
7975
- const selectReference = useRef(null);
7976
- const dropdownButtonReference = useRef(null);
7977
- const optionsListReference = useRef(null);
7978
- const isSearchEnabled = !!onSearchChange || !!search;
7979
- const isDropdownAutoWidth = dropdownWidth == null;
7980
- const fallbackButtonId = useMemo(() => getSimpleRandomId('np-select-'), []);
7981
- const options = useMemo(() => {
7982
- if (!search || !searchValue) {
7983
- return defaultOptions;
7984
- }
7985
- return defaultOptions.filter(isSearchableOption).filter(option => {
7986
- if (typeof search === 'function') {
7987
- return search(option, searchValue);
7988
- } else {
7989
- return defaultFilterFunction(option, searchValue);
7990
- }
7878
+ const parseNumber = (amount, currency, locale, maxLengthOverride) => {
7879
+ if (!maxLengthOverride) {
7880
+ return parseAmount(amount, currency, locale);
7881
+ }
7882
+ if (maxLengthOverride && amount.length > maxLengthOverride) {
7883
+ return 0;
7884
+ }
7885
+ return +amount;
7886
+ };
7887
+ 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]);
7888
+ const inputKeyAllowlist = new Set([Key.PERIOD, Key.COMMA]);
7889
+ class MoneyInput extends Component {
7890
+ constructor(props) {
7891
+ super(props);
7892
+ const {
7893
+ locale
7894
+ } = this.props.intl;
7895
+ this.formatMessage = this.props.intl.formatMessage;
7896
+ this.state = {
7897
+ searchQuery: '',
7898
+ selectedOption: this.props.selectedCurrency,
7899
+ formattedAmount: formatAmountIfSet(props.amount, props.selectedCurrency.currency, locale, props.maxLengthOverride),
7900
+ locale
7901
+ };
7902
+ }
7903
+ UNSAFE_componentWillReceiveProps(nextProps) {
7904
+ this.setState({
7905
+ locale: nextProps?.intl?.locale
7991
7906
  });
7992
- }, [defaultOptions, search, searchValue]);
7993
- const selectableOptions = useMemo(() => options.filter(isActionableOption), [options]);
7994
- const focusedOption = selectableOptions[keyboardFocusedOptionIndex];
7995
- const computedId = id || fallbackButtonId;
7996
- const listboxId = `${computedId}-listbox`;
7997
- const searchBoxId = `${computedId}-searchbox`;
7998
- const {
7999
- isMobile
8000
- } = useLayout();
8001
- useEffect(() => {
8002
- let cancelled;
8003
- if (keyboardFocusedOptionIndex >= 0) {
8004
- requestAnimationFrame(() => {
8005
- if (!cancelled) {
8006
- if (isSearchEnabled) {
8007
- keyboardFocusedReference.current?.scrollIntoView?.({
8008
- block: 'center'
8009
- });
8010
- } else {
8011
- keyboardFocusedReference.current?.focus();
8012
- }
8013
- }
7907
+ if (!this.amountFocused) {
7908
+ this.setState({
7909
+ formattedAmount: formatAmountIfSet(nextProps.amount, nextProps.selectedCurrency.currency, nextProps?.intl?.locale, nextProps.maxLengthOverride)
8014
7910
  });
8015
- return () => {
8016
- cancelled = true;
8017
- };
8018
7911
  }
8019
- }, [keyboardFocusedOptionIndex, isSearchEnabled]);
8020
- const handleOnClick = () => {
8021
- setOpen(true);
7912
+ }
7913
+ isInputAllowedForKeyEvent = event => {
7914
+ const {
7915
+ keyCode,
7916
+ metaKey,
7917
+ key,
7918
+ ctrlKey
7919
+ } = event;
7920
+ const isNumberKey = isNumber(parseInt(key, 10));
7921
+ return isNumberKey || metaKey || ctrlKey || inputKeyCodeAllowlist.has(keyCode) || inputKeyAllowlist.has(key);
8022
7922
  };
8023
- const handleTouchStart = event => {
8024
- if (event.currentTarget === event.target && open) {
8025
- handleCloseOptions();
7923
+ handleKeyDown = event => {
7924
+ if (!this.isInputAllowedForKeyEvent(event)) {
7925
+ event.preventDefault();
8026
7926
  }
8027
7927
  };
8028
- const handleOnFocus = event => {
8029
- if (onFocus) {
8030
- onFocus(event);
7928
+ handlePaste = event => {
7929
+ const paste = (event.clipboardData || window.clipboardData).getData('text');
7930
+ const {
7931
+ locale
7932
+ } = this.state;
7933
+ const parsed = isEmpty(paste) ? null : parseNumber(paste, this.props.selectedCurrency.currency, locale, this.props.maxLengthOverride);
7934
+ if (isNumberOrNull(parsed)) {
7935
+ this.setState({
7936
+ formattedAmount: formatAmountIfSet(parsed, this.props.selectedCurrency.currency, locale, this.props.maxLengthOverride)
7937
+ });
7938
+ this.props.onAmountChange(parsed);
8031
7939
  }
7940
+ event.preventDefault();
8032
7941
  };
8033
- const handleOnBlur = event => {
7942
+ onAmountChange = event => {
8034
7943
  const {
8035
- nativeEvent
8036
- } = event;
8037
- if (nativeEvent) {
8038
- const elementReceivingFocus = nativeEvent.relatedTarget;
8039
- const select = event.currentTarget;
8040
- if (select && elementReceivingFocus && select.contains(elementReceivingFocus)) {
8041
- return;
8042
- }
8043
- }
8044
- if (onBlur) {
8045
- onBlur(event);
7944
+ value
7945
+ } = event.target;
7946
+ this.setState({
7947
+ formattedAmount: value
7948
+ });
7949
+ const parsed = isEmpty(value) ? null : parseNumber(value, this.props.selectedCurrency.currency, this.state.locale, this.props.maxLengthOverride);
7950
+ if (isNumberOrNull(parsed)) {
7951
+ this.props.onAmountChange(parsed);
8046
7952
  }
8047
7953
  };
8048
- const handleSearchChange = event => {
8049
- setNumberOfOptionsShown(DEFAULT_OPTIONS_PAGE_SIZE);
8050
- setSearchValue(event.target.value);
8051
- if (onSearchChange) {
8052
- onSearchChange(event.target.value);
8053
- }
7954
+ onAmountBlur = () => {
7955
+ this.amountFocused = false;
7956
+ this.setAmount();
8054
7957
  };
8055
- const handleKeyDown = event => {
8056
- switch (event.keyCode) {
8057
- case KeyCodes.UP:
8058
- case KeyCodes.DOWN:
8059
- if (open) {
8060
- moveFocusWithDifference(event.keyCode === KeyCodes.UP ? -1 : 1);
8061
- } else {
8062
- setOpen(true);
8063
- }
8064
- stopPropagation$1(event);
8065
- break;
8066
- case KeyCodes.SPACE:
8067
- if (event.target !== searchBoxReference.current) {
8068
- if (open) {
8069
- selectKeyboardFocusedOption();
8070
- } else {
8071
- setOpen(true);
8072
- }
8073
- stopPropagation$1(event);
8074
- }
8075
- break;
8076
- case KeyCodes.ENTER:
8077
- if (open) {
8078
- selectKeyboardFocusedOption();
8079
- } else {
8080
- setOpen(true);
8081
- }
8082
- stopPropagation$1(event);
8083
- break;
8084
- case KeyCodes.ESCAPE:
8085
- handleCloseOptions();
8086
- stopPropagation$1(event);
8087
- break;
8088
- case KeyCodes.TAB:
8089
- if (open) {
8090
- selectKeyboardFocusedOption();
8091
- }
8092
- break;
8093
- }
7958
+ onAmountFocus = () => {
7959
+ this.amountFocused = true;
8094
7960
  };
8095
- function selectKeyboardFocusedOption() {
8096
- if (keyboardFocusedOptionIndex != null) {
8097
- selectableOptions.length > 0 && selectOption(selectableOptions[keyboardFocusedOptionIndex]);
8098
- }
8099
- }
8100
- function moveFocusWithDifference(difference) {
8101
- const selectedOptionIndex = selectableOptions.reduce((optionIndex, current, index) => {
8102
- if (optionIndex != null) {
8103
- return optionIndex;
8104
- }
8105
- if (isOptionSelected(selected, current)) {
8106
- return index;
8107
- }
8108
- return null;
8109
- }, null);
8110
- const previousFocusedIndex = previousKeyboardFocusedOptionIndex.current ?? -1;
8111
- let indexToStartMovingFrom = previousFocusedIndex;
8112
- if (previousFocusedIndex === -1) {
8113
- if (selectedOptionIndex == null) {
8114
- setKeyboardFocusedOptionIndex(0);
7961
+ mapOption = item => {
7962
+ return {
7963
+ type: 'option',
7964
+ value: item,
7965
+ filterMatchers: [item.value, item.label, item.note, item.searchable]
7966
+ };
7967
+ };
7968
+ getSelectOptions() {
7969
+ const selectOptions = [...filterOptionsForQuery(this.props.currencies, this.state.searchQuery)];
7970
+ let formattedOptions = [];
7971
+ let groupIndex = null;
7972
+ selectOptions.forEach(item => {
7973
+ if (item.header) {
7974
+ formattedOptions.push({
7975
+ type: 'group',
7976
+ label: item.header,
7977
+ options: []
7978
+ });
7979
+ groupIndex = formattedOptions.length - 1;
8115
7980
  } else {
8116
- indexToStartMovingFrom = selectedOptionIndex;
7981
+ if (groupIndex === null) {
7982
+ formattedOptions.push(this.mapOption(item));
7983
+ } else {
7984
+ formattedOptions[groupIndex]?.options.push(this.mapOption(item));
7985
+ }
8117
7986
  }
8118
- }
8119
- const unClampedNewIndex = indexToStartMovingFrom + difference;
8120
- const newIndex = clamp(0, selectableOptions.length - 1, unClampedNewIndex);
8121
- setKeyboardFocusedOptionIndex(newIndex);
7987
+ });
7988
+ return formattedOptions;
8122
7989
  }
8123
- useEffect(() => {
8124
- if (open) {
8125
- if (!isMobile || searchValue) {
8126
- if (isSearchEnabled && !!searchBoxReference.current) {
8127
- searchBoxReference.current.focus();
8128
- }
8129
- if (!isSearchEnabled && optionsListReference.current && (previousKeyboardFocusedOptionIndex.current == null || Number.isNaN(previousKeyboardFocusedOptionIndex.current))) {
8130
- optionsListReference.current.focus();
8131
- }
7990
+ setAmount() {
7991
+ this.setState(previousState => {
7992
+ const parsed = parseNumber(previousState.formattedAmount, this.props.selectedCurrency.currency, previousState.locale, this.props.maxLengthOverride);
7993
+ if (!isNumberOrNull(parsed)) {
7994
+ return {
7995
+ formattedAmount: previousState.formattedAmount
7996
+ };
8132
7997
  }
8133
- previousKeyboardFocusedOptionIndex.current = keyboardFocusedOptionIndex;
8134
- } else {
8135
- previousKeyboardFocusedOptionIndex.current = null;
8136
- }
8137
- }, [open, searchValue, isSearchEnabled, isMobile, keyboardFocusedOptionIndex]);
8138
- const handleCloseOptions = () => {
8139
- setOpen(false);
8140
- setKeyboardFocusedOptionIndex(null);
8141
- if (dropdownButtonReference.current) {
8142
- dropdownButtonReference.current.focus();
7998
+ return {
7999
+ formattedAmount: formatAmountIfSet(parsed, this.props.selectedCurrency.currency, previousState.locale, this.props.maxLengthOverride)
8000
+ };
8001
+ });
8002
+ }
8003
+ handleSelectChange = value => {
8004
+ this.handleSearchChange('');
8005
+ this.setState({
8006
+ selectedOption: value
8007
+ });
8008
+ this.props.onCurrencyChange(value);
8009
+ };
8010
+ handleCustomAction = () => {
8011
+ this.handleSearchChange('');
8012
+ if (this.props.onCustomAction) {
8013
+ this.props.onCustomAction();
8143
8014
  }
8144
8015
  };
8145
- function createSelectHandlerForOption(option) {
8146
- return event => {
8147
- stopPropagation$1(event);
8148
- selectOption(option);
8149
- };
8150
- }
8151
- function selectOption(option) {
8152
- onChange(isPlaceholderOption(option) ? DEFAULT_SELECTED_OPTION : option);
8153
- handleCloseOptions();
8154
- }
8155
- function renderOptionsList({
8156
- className
8157
- } = {}) {
8158
- const dropdownClass = classNames(s('np-dropdown-menu'), {
8159
- [s('np-dropdown-menu-desktop')]: !isMobile,
8160
- [s(`np-dropdown-menu-${dropdownWidth}`)]: !isMobile && !isDropdownAutoWidth
8161
- }, s(className));
8162
- const showPlaceholder = !required && !isSearchEnabled && Boolean(placeholder);
8163
- return /*#__PURE__*/jsxs("ul", {
8164
- ref: optionsListReference,
8165
- id: listboxId,
8166
- role: "listbox",
8167
- "aria-orientation": "vertical",
8168
- "aria-activedescendant": getUniqueIdForOption(id, selected),
8169
- tabIndex: "-1",
8170
- className: dropdownClass,
8171
- ...dropdownProps,
8172
- children: [showPlaceholder && /*#__PURE__*/jsx(PlaceHolderOption, {}), isSearchEnabled && /*#__PURE__*/jsx(SearchBox$1, {
8173
- ref: searchBoxReference,
8174
- id: searchBoxId,
8175
- classNames: classNamesProp,
8176
- value: initSearchValue || searchValue,
8177
- placeholder: searchPlaceholder || formatMessage(messages$3.searchPlaceholder),
8178
- focusedOptionId: getUniqueIdForOption(id, focusedOption),
8179
- onChange: handleSearchChange,
8180
- onClick: stopPropagation$1
8181
- }), options.slice(0, numberOfOptionsShown).map(renderOption), numberOfOptionsShown < options.length && /*#__PURE__*/jsx(ShowMoreOption, {})]
8016
+ handleSearchChange = searchQuery => {
8017
+ this.setState({
8018
+ searchQuery
8182
8019
  });
8183
- }
8184
- function ShowMoreOption() {
8185
- function handleOnClick(event) {
8186
- stopPropagation$1(event);
8187
- setNumberOfOptionsShown(numberOfOptionsShown + DEFAULT_OPTIONS_PAGE_SIZE);
8020
+ if (this.props.onSearchChange) {
8021
+ this.props.onSearchChange({
8022
+ searchQuery,
8023
+ filteredOptions: filterOptionsForQuery(this.props.currencies, searchQuery)
8024
+ });
8188
8025
  }
8189
- return (
8190
- /*#__PURE__*/
8191
- /* eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions */
8192
- jsx("li", {
8193
- className: classNames(s('clickable'), s('border-bottom'), s('show-more')),
8194
- onClick: handleOnClick,
8195
- onKeyPress: handleOnClick,
8196
- children: /*#__PURE__*/jsx("a", {
8197
- children: "..."
8198
- })
8199
- })
8200
- );
8201
- }
8202
- function PlaceHolderOption() {
8203
- const placeholderOption = {
8204
- placeholder
8026
+ };
8027
+ style = className => this.props.classNames[className] || className;
8028
+ render() {
8029
+ const {
8030
+ selectedCurrency,
8031
+ onCurrencyChange,
8032
+ size,
8033
+ addon,
8034
+ id,
8035
+ selectProps,
8036
+ maxLengthOverride
8037
+ } = this.props;
8038
+ const selectOptions = this.getSelectOptions();
8039
+ const getFirstOption = () => {
8040
+ if (selectOptions.length !== 0) {
8041
+ const firstOption = selectOptions[0];
8042
+ if (firstOption.type === 'option') {
8043
+ return firstOption.value;
8044
+ }
8045
+ if (firstOption.type === 'group' && firstOption.options.length !== 0) {
8046
+ return firstOption.options[0].value;
8047
+ }
8048
+ }
8049
+ return null;
8205
8050
  };
8206
- return (
8207
- /*#__PURE__*/
8208
- /* eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions */
8209
- jsx("li", {
8210
- className: classNames(s('clickable'), s('border-bottom')),
8211
- onClick: createSelectHandlerForOption(placeholderOption),
8212
- onKeyPress: createSelectHandlerForOption(placeholderOption),
8213
- children: /*#__PURE__*/jsx("a", {
8214
- children: placeholder
8051
+ const firstOption = getFirstOption();
8052
+ const isFixedCurrency = !this.state.searchQuery && (selectOptions.length === 1 && firstOption.currency === selectedCurrency.currency || !onCurrencyChange);
8053
+ const disabled = !this.props.onAmountChange;
8054
+ return /*#__PURE__*/jsxs("div", {
8055
+ className: classNames(this.style('tw-money-input'), this.style('input-group'), this.style(`input-group-${size}`)),
8056
+ children: [/*#__PURE__*/jsx(Input, {
8057
+ id: id,
8058
+ value: this.state.formattedAmount,
8059
+ inputMode: "decimal",
8060
+ disabled: disabled,
8061
+ maxLength: maxLengthOverride,
8062
+ placeholder: formatAmountIfSet(this.props.placeholder, this.props.selectedCurrency.currency, this.state.locale, this.props.maxLengthOverride),
8063
+ autoComplete: "off",
8064
+ onKeyDown: this.handleKeyDown,
8065
+ onChange: this.onAmountChange,
8066
+ onFocus: this.onAmountFocus,
8067
+ onBlur: this.onAmountBlur,
8068
+ onPaste: this.handlePaste
8069
+ }), addon && /*#__PURE__*/jsx("span", {
8070
+ className: classNames(this.style('input-group-addon'), this.style(`input-${size}`), disabled ? this.style('disabled') : ''),
8071
+ children: addon
8072
+ }), isFixedCurrency ? /*#__PURE__*/jsxs("div", {
8073
+ className: classNames(this.style('input-group-addon'), this.style(`input-${size}`), this.style('tw-money-input__fixed-currency'), disabled ? this.style('disabled') : ''),
8074
+ children: [(size === 'lg' || size === 'md') && /*#__PURE__*/jsx("span", {
8075
+ className: classNames(this.style('money-input-currency-flag'), this.style('m-r-2')),
8076
+ children: /*#__PURE__*/jsx(Flag, {
8077
+ code: selectedCurrency.currency.toLowerCase(),
8078
+ intrinsicSize: 24
8079
+ })
8080
+ }), /*#__PURE__*/jsx(Title, {
8081
+ as: "span",
8082
+ type: Typography.TITLE_SUBSECTION,
8083
+ className: size === 'lg' ? this.style('m-r-1') : '',
8084
+ children: selectedCurrency.currency.toUpperCase()
8085
+ })]
8086
+ }) : /*#__PURE__*/jsx("div", {
8087
+ className: classNames(this.style('input-group-btn'), this.style('amount-currency-select-btn')),
8088
+ children: /*#__PURE__*/jsx(SelectInput, {
8089
+ items: selectOptions,
8090
+ value: this.state.selectedOption,
8091
+ compareValues: "currency",
8092
+ renderValue: (currency, withinTrigger) => {
8093
+ return /*#__PURE__*/jsx(SelectInputOptionContent, {
8094
+ title: currency.label,
8095
+ note: withinTrigger ? undefined : currency.note,
8096
+ icon: /*#__PURE__*/jsx(Flag, {
8097
+ code: currency.currency,
8098
+ intrinsicSize: 24
8099
+ })
8100
+ });
8101
+ },
8102
+ renderFooter: this.props.onCustomAction ? () =>
8103
+ /*#__PURE__*/
8104
+ // eslint-disable-next-line jsx-a11y/click-events-have-key-events
8105
+ jsx("div", {
8106
+ role: "button",
8107
+ tabIndex: "0",
8108
+ onClick: this.handleCustomAction,
8109
+ children: this.props.customActionLabel
8110
+ }) : null,
8111
+ placeholder: this.formatMessage(messages$3.selectPlaceholder),
8112
+ filterable: true,
8113
+ filterPlaceholder: this.props.searchPlaceholder,
8114
+ disabled: disabled,
8115
+ size: size,
8116
+ onChange: this.handleSelectChange,
8117
+ onSearchChange: this.handleSearchChange,
8118
+ ...selectProps
8215
8119
  })
8216
- })
8217
- );
8218
- }
8219
-
8220
- // eslint-disable-next-line react/prop-types
8221
- function SeparatorOption() {
8222
- return /*#__PURE__*/jsx("li", {
8223
- className: s('np-separator'),
8224
- "aria-hidden": true
8225
- });
8226
- }
8227
-
8228
- // eslint-disable-next-line react/prop-types
8229
- function HeaderOption({
8230
- children
8231
- }) {
8232
- return /*#__PURE__*/jsx("li", {
8233
- // eslint-disable-line jsx-a11y/no-noninteractive-element-interactions
8234
- className: classNames(s('np-dropdown-header'), s('np-text-title-group')),
8235
- onClick: stopPropagation$1,
8236
- onKeyPress: stopPropagation$1,
8237
- children: children
8120
+ })]
8238
8121
  });
8239
8122
  }
8240
- function isOptionSelected(selected, option) {
8241
- return selected?.value === option?.value;
8123
+ }
8124
+ function filterOptionsForQuery(options, query) {
8125
+ if (!query) {
8126
+ return options;
8242
8127
  }
8243
- const renderOption = (option, index) => {
8244
- const separatorOption = option;
8245
- if (isSeparatorOption(separatorOption) && separatorOption?.separator) {
8246
- return /*#__PURE__*/jsx(SeparatorOption, {}, index);
8247
- }
8248
- const headerOption = option;
8249
- if (isHeaderOption(headerOption) && headerOption.header) {
8250
- return /*#__PURE__*/jsx(HeaderOption, {
8251
- children: headerOption.header
8252
- }, index);
8128
+ const filteredOptions = removeDuplicateValueOptions(options).filter(option => isCurrencyOptionAndFitsQuery(option, query));
8129
+ return sortOptionsLabelsToFirst(filteredOptions, query);
8130
+ }
8131
+ function removeDuplicateValueOptions(options) {
8132
+ const result = [];
8133
+ const resultValues = [];
8134
+ options.forEach(option => {
8135
+ if (option.value && !resultValues.includes(option.value)) {
8136
+ result.push(option);
8137
+ resultValues.push(option.value);
8253
8138
  }
8254
- const isActive = isOptionSelected(selected, option);
8255
- const selectOption = option;
8256
- const isFocusedWithKeyboard = !selectOption.disabled && keyboardFocusedOptionIndex === getIndexWithoutHeadersForIndexWithHeaders(index);
8257
- const className = classNames(s('np-dropdown-item'), selectOption.disabled ? [s('disabled')] : s('clickable'), {
8258
- [s('active')]: isActive,
8259
- [s('np-dropdown-item--focused')]: isFocusedWithKeyboard
8260
- });
8261
- const handleOnClick = selectOption.disabled ? stopPropagation$1 : createSelectHandlerForOption(selectOption);
8262
- return (
8263
- /*#__PURE__*/
8264
- /* eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions */
8265
- jsx("li", {
8266
- ref: isFocusedWithKeyboard ? keyboardFocusedReference : undefined,
8267
- id: getUniqueIdForOption(id, option),
8268
- "aria-selected": isActive,
8269
- "aria-disabled": option.disabled,
8270
- role: "option",
8271
- tabIndex: "-1",
8272
- className: className,
8273
- onClick: handleOnClick,
8274
- onKeyPress: handleOnClick,
8275
- children: /*#__PURE__*/jsx("a", {
8276
- disabled: selectOption.disabled,
8277
- children: /*#__PURE__*/jsx(Option$1, {
8278
- ...selectOption,
8279
- classNames: classNamesProp
8280
- })
8281
- })
8282
- }, index)
8283
- );
8284
- };
8285
- function getIndexWithoutHeadersForIndexWithHeaders(index) {
8286
- return options.reduce((sum, option, currentIndex) => {
8287
- if (currentIndex < index && isActionableOption(option)) {
8288
- return sum + 1;
8289
- }
8290
- return sum;
8291
- }, 0);
8139
+ });
8140
+ return result;
8141
+ }
8142
+ function isCurrencyOptionAndFitsQuery(option, query) {
8143
+ if (!option.value) {
8144
+ return false;
8292
8145
  }
8293
- const hasActiveOptions = !!defaultOptions.length;
8294
- if (open && (initSearchValue || searchValue)) {
8295
- if (hasActiveOptions && keyboardFocusedOptionIndex == null) {
8296
- setKeyboardFocusedOptionIndex(0);
8146
+ return contains(option.label, query) || contains(option.searchable, query) || contains(option.note, query);
8147
+ }
8148
+ function contains(property, query) {
8149
+ return property && property.toLowerCase().includes(query.toLowerCase());
8150
+ }
8151
+ function sortOptionsLabelsToFirst(options, query) {
8152
+ return options.sort((first, second) => {
8153
+ const firstContains = contains(first.label, query);
8154
+ const secondContains = contains(second.label, query);
8155
+ if (firstContains && secondContains) {
8156
+ return 0;
8297
8157
  }
8298
- if (!hasActiveOptions && keyboardFocusedOptionIndex != null) {
8299
- setKeyboardFocusedOptionIndex(null);
8158
+ if (firstContains) {
8159
+ return -1;
8300
8160
  }
8301
- }
8302
- return /*#__PURE__*/jsxs("div", {
8303
- // eslint-disable-line jsx-a11y/no-static-element-interactions
8304
- ref: selectReference,
8305
- className: classNames(s('np-select'), block ? s('btn-block') : null, s('btn-group')),
8306
- onKeyDown: handleKeyDown,
8307
- onTouchMove: handleTouchStart,
8308
- onFocus: handleOnFocus,
8309
- onBlur: handleOnBlur,
8310
- children: [/*#__PURE__*/jsxs(Button, {
8311
- ref: dropdownButtonReference,
8312
- id: computedId,
8313
- block: block,
8314
- size: size,
8315
- htmlType: "button",
8316
- className: classNames(s('np-dropdown-toggle'), s('np-text-body-large'), inverse ? s('np-dropdown-toggle-navy') : null)
8317
- // reset Button's styles
8318
- ,
8319
- type: null,
8320
- priority: null,
8321
- disabled: disabled,
8322
- "aria-controls": listboxId,
8323
- "aria-expanded": open,
8324
- "aria-autocomplete": "none",
8325
- onClick: handleOnClick,
8326
- ...buttonProps,
8327
- children: [selected ? /*#__PURE__*/jsx(Option$1, {
8328
- ...selected,
8329
- classNames: classNamesProp,
8330
- selected: true
8331
- }) : /*#__PURE__*/jsx("span", {
8332
- className: s('form-control-placeholder'),
8333
- children: placeholder
8334
- }), /*#__PURE__*/jsx(Chevron$1
8335
- // disabled={disabled}
8336
- , {
8337
- className: classNames(s('tw-icon'), s('tw-chevron-up-icon'), s('tw-chevron'), s('bottom'), s('np-select-chevron'))
8338
- })]
8339
- }), isMobile ? isSearchEnabled ? /*#__PURE__*/jsx(Drawer$1, {
8340
- open: open,
8341
- headerTitle: searchPlaceholder || formatMessage(messages$3.searchPlaceholder),
8342
- onClose: handleCloseOptions,
8343
- children: renderOptionsList()
8344
- }) : /*#__PURE__*/jsx(BottomSheet$2, {
8345
- open: open,
8346
- onClose: handleCloseOptions,
8347
- children: renderOptionsList({
8348
- className: isModern ? '' : 'p-a-1'
8349
- })
8350
- }) : /*#__PURE__*/jsx(Panel$1, {
8351
- open: open,
8352
- flip: false,
8353
- altAxis: true,
8354
- anchorRef: selectReference,
8355
- anchorWidth: isDropdownAutoWidth,
8356
- position: dropdownUp ? Position.TOP : Position.BOTTOM,
8357
- onClose: handleCloseOptions,
8358
- children: renderOptionsList({
8359
- className: 'p-a-1'
8360
- })
8361
- })]
8161
+ if (secondContains) {
8162
+ return 1;
8163
+ }
8164
+ return 0;
8362
8165
  });
8363
8166
  }
8364
- Select.propTypes = {
8365
- placeholder: PropTypes.string,
8167
+ MoneyInput.propTypes = {
8366
8168
  id: PropTypes.string,
8367
- required: PropTypes.bool,
8368
- disabled: PropTypes.bool,
8369
- inverse: PropTypes.bool,
8370
- dropdownRight: PropTypes.oneOf(['xs', 'sm', 'md', 'lg', 'xl']),
8371
- dropdownWidth: PropTypes.oneOf(['sm', 'md', 'lg']),
8169
+ currencies: PropTypes.arrayOf(Currency).isRequired,
8170
+ selectedCurrency: Currency.isRequired,
8171
+ onCurrencyChange: PropTypes.func,
8172
+ placeholder: PropTypes.number,
8173
+ amount: PropTypes.number,
8372
8174
  size: PropTypes.oneOf(['sm', 'md', 'lg']),
8373
- block: PropTypes.bool,
8374
- selected: PropTypes.shape({
8375
- value: PropTypes.any.isRequired,
8376
- label: PropTypes.node,
8377
- icon: PropTypes.node,
8378
- currency: PropTypes.string,
8379
- note: PropTypes.node,
8380
- secondary: PropTypes.node
8381
- }),
8382
- /**
8383
- * Search toggle
8384
- * if `true` default search functionality being enabled (not case sensitive search in option labels & currency props)
8385
- * if `function` you can define your own search function to implement custom search experience. This search function used while filtering the options array. The custom search function takes two parameters. First is the option the second is the keyword.
8386
- */
8387
- search: PropTypes.oneOfType([PropTypes.bool, PropTypes.func]),
8388
- onChange: PropTypes.func.isRequired,
8389
- onFocus: PropTypes.func,
8390
- onBlur: PropTypes.func,
8391
- options: PropTypes.arrayOf(PropTypes.shape({
8392
- value: PropTypes.any,
8393
- label: PropTypes.node,
8394
- header: PropTypes.node,
8395
- icon: PropTypes.node,
8396
- currency: PropTypes.string,
8397
- note: PropTypes.node,
8398
- secondary: PropTypes.node,
8399
- separator: PropTypes.bool,
8400
- disabled: PropTypes.bool,
8401
- searchStrings: PropTypes.arrayOf(PropTypes.string)
8402
- })).isRequired,
8175
+ onAmountChange: PropTypes.func,
8176
+ addon: PropTypes.node,
8177
+ searchPlaceholder: PropTypes.string,
8403
8178
  /**
8404
- * To have full control of your search value and response use `onSearchChange` function combined with `searchValue` and custom filtering on the options array.
8405
- * DO NOT USE TOGETHER WITH `search` PROPERTY
8179
+ * Allows the consumer to react to searching, while the search itself is handled internally. Called with `{ searchQuery: string, filteredOptions: Currency[] }`
8406
8180
  */
8407
8181
  onSearchChange: PropTypes.func,
8408
- searchValue: PropTypes.string,
8409
- searchPlaceholder: PropTypes.string,
8182
+ customActionLabel: PropTypes.node,
8183
+ onCustomAction: PropTypes.func,
8410
8184
  classNames: PropTypes.objectOf(PropTypes.string),
8411
- dropdownUp: PropTypes.bool,
8412
- buttonProps: PropTypes.object,
8413
- dropdownProps: PropTypes.object
8185
+ selectProps: PropTypes.object,
8186
+ maxLengthOverride: PropTypes.number
8414
8187
  };
8415
- Select.defaultProps = {
8416
- id: undefined,
8417
- placeholder: undefined,
8418
- size: 'md',
8419
- dropdownRight: null,
8420
- dropdownWidth: null,
8421
- inverse: false,
8422
- required: false,
8423
- disabled: false,
8424
- block: true,
8425
- selected: null,
8426
- onFocus: null,
8427
- onBlur: null,
8188
+ MoneyInput.defaultProps = {
8189
+ id: null,
8190
+ size: Size.LARGE,
8191
+ addon: null,
8192
+ searchPlaceholder: '',
8428
8193
  onSearchChange: undefined,
8429
- search: false,
8430
- searchValue: '',
8431
- searchPlaceholder: undefined,
8194
+ onCurrencyChange: null,
8195
+ placeholder: null,
8196
+ amount: null,
8197
+ onAmountChange: null,
8198
+ customActionLabel: '',
8199
+ onCustomAction: null,
8432
8200
  classNames: {},
8433
- dropdownUp: false,
8434
- buttonProps: {},
8435
- dropdownProps: {}
8201
+ selectProps: {},
8202
+ maxLengthOverride: null
8436
8203
  };
8204
+ var MoneyInput$1 = injectIntl(MoneyInput);
8437
8205
 
8438
- var messages$2 = defineMessages({
8439
- selectPlaceholder: {
8440
- id: "neptune.MoneyInput.Select.placeholder"
8441
- }
8442
- });
8443
-
8444
- // TODO: do not duplicate this between formatting and components
8445
- const currencyDecimals = {
8446
- BIF: 0,
8447
- BYR: 0,
8448
- CLP: 0,
8449
- DJF: 0,
8450
- GNF: 0,
8451
- JPY: 0,
8452
- KMF: 0,
8453
- KRW: 0,
8454
- MGA: 0,
8455
- PYG: 0,
8456
- RWF: 0,
8457
- VND: 0,
8458
- VUV: 0,
8459
- XAF: 0,
8460
- XOF: 0,
8461
- XPF: 0,
8462
- // technically HUF does have decimals, but due to the exchange rate banks
8463
- // do not accept decimal amounts
8464
- HUF: 0,
8465
- BHD: 3,
8466
- JOD: 3,
8467
- KWD: 3,
8468
- OMR: 3,
8469
- TND: 3
8206
+ const NavigationOptionList = ({
8207
+ children
8208
+ }) => {
8209
+ return /*#__PURE__*/jsx("ul", {
8210
+ className: "np-navigation-options-list",
8211
+ children: Children.map(children, child => /*#__PURE__*/jsx("li", {
8212
+ className: "np-navigation-options-list__item",
8213
+ children: child
8214
+ }, child.key))
8215
+ });
8470
8216
  };
8471
- const DEFAULT_CURRENCY_DECIMALS = 2;
8472
- function isNumberLocaleSupported() {
8473
- const number = 1234;
8474
- const numberString = number.toLocaleString && number.toLocaleString(DEFAULT_LOCALE);
8475
- return numberString === '1,234';
8476
- }
8477
- function getValidLocale(locale) {
8478
- try {
8479
- const noUnderscoreLocale = locale.replace(/_/, '-');
8480
- Intl.NumberFormat(noUnderscoreLocale);
8481
- return noUnderscoreLocale;
8482
- } catch {
8483
- return 'en-GB';
8484
- }
8485
- }
8486
- function getCurrencyDecimals(currency = '') {
8487
- const upperCaseCurrency = currency.toUpperCase();
8488
- if (Object.prototype.hasOwnProperty.call(currencyDecimals, upperCaseCurrency)) {
8489
- return currencyDecimals[upperCaseCurrency];
8490
- }
8491
- return DEFAULT_CURRENCY_DECIMALS;
8492
- }
8493
- function getDecimalSeparator(locale) {
8494
- return isNumberLocaleSupported() ? 1.1.toLocaleString(locale)[1] : '.';
8495
- }
8496
- function parseAmount(number, currency, locale) {
8497
- const validLocale = getValidLocale(locale);
8498
- const precision = getCurrencyDecimals(currency);
8499
- const groupSeparator = isNumberLocaleSupported() ? 10000 .toLocaleString(validLocale)[2] : ',';
8500
- const decimalSeparator = getDecimalSeparator(validLocale);
8501
- const numberWithStandardDecimalSeparator = (number ? `${number}` : '').replace(new RegExp(`\\${groupSeparator}`, 'g'), '').replace(new RegExp(`\\${decimalSeparator}`, 'g'), '.').replace(/[^0-9.]/g, '');
8502
- const parsedAmount = parseFloat(parseFloat(numberWithStandardDecimalSeparator).toFixed(precision));
8503
- return Math.abs(parsedAmount);
8504
- }
8505
-
8506
- const Currency = PropTypes.shape({
8507
- header: PropTypes.string,
8508
- value: PropTypes.string,
8509
- label: PropTypes.string,
8510
- currency: PropTypes.string,
8511
- note: PropTypes.string,
8512
- searchable: PropTypes.string
8513
- });
8514
- const CUSTOM_ACTION = 'CUSTOM_ACTION';
8515
- const isNumberOrNull = v => isNumber(v) || isNull(v);
8516
- const formatAmountIfSet = (amount, currency, locale, maxLengthOverride) => {
8517
- if (maxLengthOverride) {
8518
- return amount || '';
8519
- } else {
8520
- return typeof amount === 'number' ? formatAmount(amount, currency, locale) : '';
8521
- }
8217
+ NavigationOptionList.propTypes = {
8218
+ children: PropTypes.node.isRequired
8522
8219
  };
8523
- const parseNumber = (amount, currency, locale, maxLengthOverride) => {
8524
- if (!maxLengthOverride) {
8525
- return parseAmount(amount, currency, locale);
8526
- }
8527
- if (maxLengthOverride && amount.length > maxLengthOverride) {
8528
- return 0;
8529
- }
8530
- return +amount;
8220
+ var NavigationOptionList$1 = NavigationOptionList;
8221
+
8222
+ const STORAGE_NAME = 'dismissedNudges';
8223
+ const getLocalStorage = () => {
8224
+ try {
8225
+ const storageItem = localStorage.getItem(STORAGE_NAME);
8226
+ if (storageItem) {
8227
+ const storage = JSON.parse(storageItem);
8228
+ if (Array.isArray(storage)) {
8229
+ return storage;
8230
+ }
8231
+ }
8232
+ // eslint-disable-next-line unicorn/prefer-optional-catch-binding, no-empty
8233
+ } catch (error) {}
8234
+ return [];
8531
8235
  };
8532
- 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]);
8533
- const inputKeyAllowlist = new Set([Key.PERIOD, Key.COMMA]);
8534
- class MoneyInput extends Component {
8535
- constructor(props) {
8536
- super(props);
8537
- const {
8538
- locale
8539
- } = this.props.intl;
8540
- this.formatMessage = this.props.intl.formatMessage;
8541
- this.state = {
8542
- searchQuery: '',
8543
- formattedAmount: formatAmountIfSet(props.amount, props.selectedCurrency.currency, locale, props.maxLengthOverride),
8544
- locale
8545
- };
8546
- }
8547
- UNSAFE_componentWillReceiveProps(nextProps) {
8548
- this.setState({
8549
- locale: nextProps?.intl?.locale
8550
- });
8551
- if (!this.amountFocused) {
8552
- this.setState({
8553
- formattedAmount: formatAmountIfSet(nextProps.amount, nextProps.selectedCurrency.currency, nextProps?.intl?.locale, nextProps.maxLengthOverride)
8554
- });
8555
- }
8556
- }
8557
- isInputAllowedForKeyEvent = event => {
8558
- const {
8559
- keyCode,
8560
- metaKey,
8561
- key,
8562
- ctrlKey
8563
- } = event;
8564
- const isNumberKey = isNumber(parseInt(key, 10));
8565
- return isNumberKey || metaKey || ctrlKey || inputKeyCodeAllowlist.has(keyCode) || inputKeyAllowlist.has(key);
8566
- };
8567
- handleKeyDown = event => {
8568
- if (!this.isInputAllowedForKeyEvent(event)) {
8569
- event.preventDefault();
8570
- }
8571
- };
8572
- handlePaste = event => {
8573
- const paste = (event.clipboardData || window.clipboardData).getData('text');
8574
- const {
8575
- locale
8576
- } = this.state;
8577
- const parsed = isEmpty(paste) ? null : parseNumber(paste, this.props.selectedCurrency.currency, locale, this.props.maxLengthOverride);
8578
- if (isNumberOrNull(parsed)) {
8579
- this.setState({
8580
- formattedAmount: formatAmountIfSet(parsed, this.props.selectedCurrency.currency, locale, this.props.maxLengthOverride)
8581
- });
8582
- this.props.onAmountChange(parsed);
8236
+ const Nudge = ({
8237
+ media,
8238
+ mediaName,
8239
+ title,
8240
+ link,
8241
+ href,
8242
+ onClick,
8243
+ onDismiss,
8244
+ persistDismissal,
8245
+ isPreviouslyDismissed,
8246
+ id,
8247
+ className
8248
+ }) => {
8249
+ const [isDismissed, setIsDismissed] = useState(false);
8250
+ const [isMounted, setIsMounted] = useState(false);
8251
+ const handleOnDismiss = () => {
8252
+ const dismissedNudgesStorage = getLocalStorage();
8253
+ if (persistDismissal && id) {
8254
+ try {
8255
+ localStorage.setItem(STORAGE_NAME, JSON.stringify([...(dismissedNudgesStorage ? dismissedNudgesStorage : []), id]));
8256
+ // eslint-disable-next-line unicorn/prefer-optional-catch-binding, no-empty
8257
+ } catch (error) {}
8258
+ setIsDismissed(true);
8583
8259
  }
8584
- event.preventDefault();
8585
- };
8586
- onAmountChange = event => {
8587
- const {
8588
- value
8589
- } = event.target;
8590
- this.setState({
8591
- formattedAmount: value
8592
- });
8593
- const parsed = isEmpty(value) ? null : parseNumber(value, this.props.selectedCurrency.currency, this.state.locale, this.props.maxLengthOverride);
8594
- if (isNumberOrNull(parsed)) {
8595
- this.props.onAmountChange(parsed);
8260
+ if (onDismiss) {
8261
+ onDismiss();
8596
8262
  }
8597
8263
  };
8598
- onAmountBlur = () => {
8599
- this.amountFocused = false;
8600
- this.setAmount();
8601
- };
8602
- onAmountFocus = () => {
8603
- this.amountFocused = true;
8604
- };
8605
- getSelectOptions() {
8606
- const selectOptions = [...filterOptionsForQuery(this.props.currencies, this.state.searchQuery)];
8607
- if (this.props.onCustomAction) {
8608
- selectOptions.push({
8609
- value: CUSTOM_ACTION,
8610
- label: this.props.customActionLabel
8611
- });
8612
- }
8613
- return selectOptions;
8614
- }
8615
- setAmount() {
8616
- this.setState(previousState => {
8617
- const parsed = parseNumber(previousState.formattedAmount, this.props.selectedCurrency.currency, previousState.locale, this.props.maxLengthOverride);
8618
- if (!isNumberOrNull(parsed)) {
8619
- return {
8620
- formattedAmount: previousState.formattedAmount
8621
- };
8264
+ useEffect(() => {
8265
+ if (persistDismissal && id) {
8266
+ const dismissedNudgesStorage = getLocalStorage();
8267
+ let isDismissed = false;
8268
+ if (dismissedNudgesStorage && dismissedNudgesStorage.find(item => item === id)) {
8269
+ setIsDismissed(true);
8270
+ isDismissed = true;
8271
+ }
8272
+ if (isPreviouslyDismissed) {
8273
+ isPreviouslyDismissed(isDismissed);
8622
8274
  }
8623
- return {
8624
- formattedAmount: formatAmountIfSet(parsed, this.props.selectedCurrency.currency, previousState.locale, this.props.maxLengthOverride)
8625
- };
8626
- });
8627
- }
8628
- handleSelectChange = value => {
8629
- this.handleSearchChange('');
8630
- if (this.props.onCustomAction && value.value === CUSTOM_ACTION) {
8631
- this.props.onCustomAction();
8632
- } else {
8633
- this.props.onCurrencyChange(value);
8634
- }
8635
- };
8636
- handleSearchChange = searchQuery => {
8637
- this.setState({
8638
- searchQuery
8639
- });
8640
- if (this.props.onSearchChange) {
8641
- this.props.onSearchChange({
8642
- searchQuery,
8643
- filteredOptions: filterOptionsForQuery(this.props.currencies, searchQuery)
8644
- });
8645
8275
  }
8646
- };
8647
- style = className => this.props.classNames[className] || className;
8648
- render() {
8649
- const {
8650
- selectedCurrency,
8651
- onCurrencyChange,
8652
- size,
8653
- addon,
8654
- id,
8655
- selectProps,
8656
- maxLengthOverride
8657
- } = this.props;
8658
- const selectOptions = this.getSelectOptions();
8659
- const isFixedCurrency = !this.state.searchQuery && (selectOptions.length === 1 && selectOptions[0].currency === selectedCurrency.currency || !onCurrencyChange);
8660
- const disabled = !this.props.onAmountChange;
8661
- return /*#__PURE__*/jsxs("div", {
8662
- className: classNames(this.style('tw-money-input'), this.style('input-group'), this.style(`input-group-${size}`)),
8663
- children: [/*#__PURE__*/jsx(Input, {
8664
- id: id,
8665
- value: this.state.formattedAmount,
8666
- inputMode: "decimal",
8667
- disabled: disabled,
8668
- maxLength: maxLengthOverride,
8669
- placeholder: formatAmountIfSet(this.props.placeholder, this.props.selectedCurrency.currency, this.state.locale, this.props.maxLengthOverride),
8670
- autoComplete: "off",
8671
- onKeyDown: this.handleKeyDown,
8672
- onChange: this.onAmountChange,
8673
- onFocus: this.onAmountFocus,
8674
- onBlur: this.onAmountBlur,
8675
- onPaste: this.handlePaste
8676
- }), addon && /*#__PURE__*/jsx("span", {
8677
- className: classNames(this.style('input-group-addon'), this.style(`input-${size}`), disabled ? this.style('disabled') : ''),
8678
- children: addon
8679
- }), isFixedCurrency ? /*#__PURE__*/jsxs("div", {
8680
- className: classNames(this.style('input-group-addon'), this.style(`input-${size}`), this.style('tw-money-input__fixed-currency'), disabled ? this.style('disabled') : ''),
8681
- children: [(size === 'lg' || size === 'md') && /*#__PURE__*/jsxs(Fragment, {
8682
- children: [/*#__PURE__*/jsx("i", {
8683
- className: classNames(this.style('tw-money-input__keyline'))
8684
- }), /*#__PURE__*/jsx("i", {
8685
- className: classNames(this.style('currency-flag'), this.style(`currency-flag-${selectedCurrency.currency.toLowerCase()}`), this.style('m-r-2'))
8686
- })]
8687
- }), /*#__PURE__*/jsx(Title, {
8688
- as: "span",
8689
- type: Typography.TITLE_SUBSECTION,
8690
- className: size === 'lg' ? this.style('m-r-1') : '',
8691
- children: selectedCurrency.currency.toUpperCase()
8692
- })]
8693
- }) : /*#__PURE__*/jsx("div", {
8694
- className: classNames(this.style('input-group-btn'), this.style('amount-currency-select-btn')),
8695
- children: /*#__PURE__*/jsx(Select, {
8696
- id: id ? `${id}-select` : undefined,
8697
- classNames: this.props.classNames,
8698
- options: selectOptions,
8699
- selected: {
8700
- ...selectedCurrency,
8701
- label: /*#__PURE__*/jsx(Title, {
8702
- as: "span",
8703
- type: Typography.TITLE_SUBSECTION,
8704
- className: "tw-money-input__text",
8705
- children: selectedCurrency.label
8706
- }),
8707
- note: null
8708
- },
8709
- placeholder: this.formatMessage(messages$2.selectPlaceholder),
8710
- searchPlaceholder: this.props.searchPlaceholder,
8711
- searchValue: this.state.searchQuery,
8712
- size: size,
8713
- required: true,
8714
- dropdownWidth: Size.LARGE,
8715
- inverse: true,
8716
- onChange: this.handleSelectChange,
8717
- onSearchChange: this.handleSearchChange,
8718
- ...selectProps
8719
- })
8720
- })]
8721
- });
8722
- }
8723
- }
8724
- function filterOptionsForQuery(options, query) {
8725
- if (!query) {
8726
- return options;
8276
+ setIsMounted(true);
8277
+ // eslint-disable-next-line react-hooks/exhaustive-deps
8278
+ }, [id, persistDismissal]);
8279
+ if (persistDismissal && (isDismissed || !isMounted)) {
8280
+ return null;
8727
8281
  }
8728
- const filteredOptions = removeDuplicateValueOptions(options).filter(option => isCurrencyOptionAndFitsQuery(option, query));
8729
- return sortOptionsLabelsToFirst(filteredOptions, query);
8730
- }
8731
- function removeDuplicateValueOptions(options) {
8732
- const result = [];
8733
- const resultValues = [];
8734
- options.forEach(option => {
8735
- if (option.value && !resultValues.includes(option.value)) {
8736
- result.push(option);
8737
- resultValues.push(option.value);
8738
- }
8739
- });
8740
- return result;
8741
- }
8742
- function isCurrencyOptionAndFitsQuery(option, query) {
8743
- if (!option.value) {
8744
- return false;
8745
- }
8746
- return contains(option.label, query) || contains(option.searchable, query) || contains(option.note, query);
8747
- }
8748
- function contains(property, query) {
8749
- return property && property.toLowerCase().includes(query.toLowerCase());
8750
- }
8751
- function sortOptionsLabelsToFirst(options, query) {
8752
- return options.sort((first, second) => {
8753
- const firstContains = contains(first.label, query);
8754
- const secondContains = contains(second.label, query);
8755
- if (firstContains && secondContains) {
8756
- return 0;
8757
- }
8758
- if (firstContains) {
8759
- return -1;
8760
- }
8761
- if (secondContains) {
8762
- return 1;
8763
- }
8764
- return 0;
8765
- });
8766
- }
8767
- MoneyInput.propTypes = {
8768
- id: PropTypes.string,
8769
- currencies: PropTypes.arrayOf(Currency).isRequired,
8770
- selectedCurrency: Currency.isRequired,
8771
- onCurrencyChange: PropTypes.func,
8772
- placeholder: PropTypes.number,
8773
- amount: PropTypes.number,
8774
- size: PropTypes.oneOf(['sm', 'md', 'lg']),
8775
- onAmountChange: PropTypes.func,
8776
- addon: PropTypes.node,
8777
- searchPlaceholder: PropTypes.string,
8778
- /**
8779
- * Allows the consumer to react to searching, while the search itself is handled internally. Called with `{ searchQuery: string, filteredOptions: Currency[] }`
8780
- */
8781
- onSearchChange: PropTypes.func,
8782
- customActionLabel: PropTypes.node,
8783
- onCustomAction: PropTypes.func,
8784
- classNames: PropTypes.objectOf(PropTypes.string),
8785
- selectProps: PropTypes.object,
8786
- maxLengthOverride: PropTypes.number
8787
- };
8788
- MoneyInput.defaultProps = {
8789
- id: null,
8790
- size: Size.LARGE,
8791
- addon: null,
8792
- searchPlaceholder: '',
8793
- onSearchChange: undefined,
8794
- onCurrencyChange: null,
8795
- placeholder: null,
8796
- amount: null,
8797
- onAmountChange: null,
8798
- customActionLabel: '',
8799
- onCustomAction: null,
8800
- classNames: {},
8801
- selectProps: {},
8802
- maxLengthOverride: null
8803
- };
8804
- var MoneyInput$1 = injectIntl(MoneyInput);
8805
-
8806
- const NavigationOptionList = ({
8807
- children
8808
- }) => {
8809
- return /*#__PURE__*/jsx("ul", {
8810
- className: "np-navigation-options-list",
8811
- children: Children.map(children, child => /*#__PURE__*/jsx("li", {
8812
- className: "np-navigation-options-list__item",
8813
- children: child
8814
- }, child.key))
8815
- });
8816
- };
8817
- NavigationOptionList.propTypes = {
8818
- children: PropTypes.node.isRequired
8819
- };
8820
- var NavigationOptionList$1 = NavigationOptionList;
8821
-
8822
- const STORAGE_NAME = 'dismissedNudges';
8823
- const getLocalStorage = () => {
8824
- try {
8825
- const storageItem = localStorage.getItem(STORAGE_NAME);
8826
- if (storageItem) {
8827
- const storage = JSON.parse(storageItem);
8828
- if (Array.isArray(storage)) {
8829
- return storage;
8830
- }
8831
- }
8832
- // eslint-disable-next-line unicorn/prefer-optional-catch-binding, no-empty
8833
- } catch (error) {}
8834
- return [];
8835
- };
8836
- const Nudge = ({
8837
- media,
8838
- mediaName,
8839
- title,
8840
- link,
8841
- href,
8842
- onClick,
8843
- onDismiss,
8844
- persistDismissal,
8845
- isPreviouslyDismissed,
8846
- id,
8847
- className
8848
- }) => {
8849
- const [isDismissed, setIsDismissed] = useState(false);
8850
- const [isMounted, setIsMounted] = useState(false);
8851
- const handleOnDismiss = () => {
8852
- const dismissedNudgesStorage = getLocalStorage();
8853
- if (persistDismissal && id) {
8854
- try {
8855
- localStorage.setItem(STORAGE_NAME, JSON.stringify([...(dismissedNudgesStorage ? dismissedNudgesStorage : []), id]));
8856
- // eslint-disable-next-line unicorn/prefer-optional-catch-binding, no-empty
8857
- } catch (error) {}
8858
- setIsDismissed(true);
8859
- }
8860
- if (onDismiss) {
8861
- onDismiss();
8862
- }
8863
- };
8864
- useEffect(() => {
8865
- if (persistDismissal && id) {
8866
- const dismissedNudgesStorage = getLocalStorage();
8867
- let isDismissed = false;
8868
- if (dismissedNudgesStorage && dismissedNudgesStorage.find(item => item === id)) {
8869
- setIsDismissed(true);
8870
- isDismissed = true;
8871
- }
8872
- if (isPreviouslyDismissed) {
8873
- isPreviouslyDismissed(isDismissed);
8874
- }
8875
- }
8876
- setIsMounted(true);
8877
- // eslint-disable-next-line react-hooks/exhaustive-deps
8878
- }, [id, persistDismissal]);
8879
- if (persistDismissal && (isDismissed || !isMounted)) {
8880
- return null;
8881
- }
8882
- return /*#__PURE__*/jsxs("div", {
8883
- className: classNames('wds-nudge', className),
8884
- id: id,
8885
- children: [!!mediaName && /*#__PURE__*/jsx("div", {
8886
- className: "wds-nudge-media",
8887
- children: /*#__PURE__*/jsx(Illustration, {
8888
- name: mediaName,
8889
- className: classNames(`wds-nudge-media-${mediaName}`),
8890
- size: "small",
8891
- disablePadding: true,
8892
- alt: ""
8893
- })
8894
- }), /*#__PURE__*/jsxs("div", {
8895
- className: "wds-nudge-container",
8896
- children: [/*#__PURE__*/jsxs("div", {
8897
- className: "wds-nudge-content",
8898
- children: [/*#__PURE__*/jsx(Body, {
8899
- type: Typography.BODY_LARGE,
8900
- className: classNames('wds-nudge-body'),
8901
- children: title
8902
- }), link && /*#__PURE__*/jsx(Link, {
8903
- href: href,
8904
- type: Typography.LINK_LARGE,
8905
- className: "wds-nudge-link",
8906
- onClick: onClick,
8907
- children: link
8908
- })]
8909
- }), onDismiss || persistDismissal ? /*#__PURE__*/jsx(CloseButton, {
8910
- className: "wds-nudge-control",
8911
- size: "sm",
8912
- onClick: handleOnDismiss
8913
- }) : null]
8914
- })]
8282
+ return /*#__PURE__*/jsxs("div", {
8283
+ className: classNames('wds-nudge', className),
8284
+ id: id,
8285
+ children: [!!mediaName && /*#__PURE__*/jsx("div", {
8286
+ className: "wds-nudge-media",
8287
+ children: /*#__PURE__*/jsx(Illustration, {
8288
+ name: mediaName,
8289
+ className: classNames(`wds-nudge-media-${mediaName}`),
8290
+ size: "small",
8291
+ disablePadding: true,
8292
+ alt: ""
8293
+ })
8294
+ }), /*#__PURE__*/jsxs("div", {
8295
+ className: "wds-nudge-container",
8296
+ children: [/*#__PURE__*/jsxs("div", {
8297
+ className: "wds-nudge-content",
8298
+ children: [/*#__PURE__*/jsx(Body, {
8299
+ type: Typography.BODY_LARGE,
8300
+ className: classNames('wds-nudge-body'),
8301
+ children: title
8302
+ }), link && /*#__PURE__*/jsx(Link, {
8303
+ href: href,
8304
+ type: Typography.LINK_LARGE,
8305
+ className: "wds-nudge-link",
8306
+ onClick: onClick,
8307
+ children: link
8308
+ })]
8309
+ }), onDismiss || persistDismissal ? /*#__PURE__*/jsx(CloseButton, {
8310
+ className: "wds-nudge-control",
8311
+ size: "sm",
8312
+ onClick: handleOnDismiss
8313
+ }) : null]
8314
+ })]
8915
8315
  });
8916
8316
  };
8917
8317
 
@@ -11024,179 +10424,836 @@ const Radio = ({
11024
10424
  })]
11025
10425
  })
11026
10426
  });
11027
- };
11028
- Radio.propTypes = {
11029
- avatar: PropTypes.element,
11030
- checked: PropTypes.bool,
11031
- disabled: PropTypes.bool,
10427
+ };
10428
+ Radio.propTypes = {
10429
+ avatar: PropTypes.element,
10430
+ checked: PropTypes.bool,
10431
+ disabled: PropTypes.bool,
10432
+ id: PropTypes.string,
10433
+ label: PropTypes.string.isRequired,
10434
+ name: PropTypes.string.isRequired,
10435
+ onChange: PropTypes.func.isRequired,
10436
+ secondary: PropTypes.string,
10437
+ value: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
10438
+ className: PropTypes.string
10439
+ };
10440
+ Radio.defaultProps = {
10441
+ avatar: undefined,
10442
+ checked: false,
10443
+ disabled: false,
10444
+ id: null,
10445
+ secondary: null,
10446
+ value: '',
10447
+ className: undefined
10448
+ };
10449
+ var Radio$1 = Radio;
10450
+
10451
+ class RadioGroup extends Component {
10452
+ constructor(props) {
10453
+ super(props);
10454
+ this.state = {
10455
+ selectedValue: props.selectedValue
10456
+ };
10457
+ }
10458
+ handleOnChange = selectedValue => {
10459
+ const {
10460
+ onChange
10461
+ } = this.props;
10462
+ this.setState({
10463
+ selectedValue
10464
+ }, onChange && onChange(selectedValue));
10465
+ };
10466
+ render() {
10467
+ const {
10468
+ radios,
10469
+ name
10470
+ } = this.props;
10471
+ const {
10472
+ selectedValue
10473
+ } = this.state;
10474
+ return radios && radios.length > 0 ? /*#__PURE__*/jsx(Fragment, {
10475
+ children: radios.map(({
10476
+ id,
10477
+ avatar,
10478
+ value,
10479
+ label,
10480
+ disabled,
10481
+ secondary,
10482
+ readOnly
10483
+ }, index) => /*#__PURE__*/jsx(Radio$1
10484
+ // eslint-disable-next-line react/no-array-index-key
10485
+ , {
10486
+ id: id,
10487
+ value: value,
10488
+ label: label,
10489
+ name: name,
10490
+ disabled: disabled,
10491
+ checked: selectedValue === value,
10492
+ secondary: secondary,
10493
+ readOnly: readOnly,
10494
+ avatar: avatar,
10495
+ onChange: value_ => this.handleOnChange(value_)
10496
+ }, index))
10497
+ }) : null;
10498
+ }
10499
+ }
10500
+ RadioGroup.propTypes = {
10501
+ radios: PropTypes.arrayOf(PropTypes.shape({
10502
+ id: PropTypes.string,
10503
+ avatar: PropTypes.element,
10504
+ value: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
10505
+ secondary: PropTypes.string,
10506
+ label: PropTypes.string.isRequired,
10507
+ disabled: PropTypes.bool,
10508
+ readOnly: PropTypes.bool
10509
+ })).isRequired,
10510
+ onChange: PropTypes.func.isRequired,
10511
+ selectedValue: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
10512
+ name: PropTypes.string.isRequired
10513
+ };
10514
+ RadioGroup.defaultProps = {
10515
+ selectedValue: null
10516
+ };
10517
+ var RadioGroup$1 = RadioGroup;
10518
+
10519
+ const RadioOption = ({
10520
+ 'aria-label': ariaLabel,
10521
+ media,
10522
+ title,
10523
+ content,
10524
+ id,
10525
+ name,
10526
+ checked,
10527
+ onChange,
10528
+ complex,
10529
+ disabled,
10530
+ value,
10531
+ showMediaCircle,
10532
+ showMediaAtAllSizes,
10533
+ isContainerAligned
10534
+ }) => {
10535
+ const sharedProps = {
10536
+ 'aria-label': ariaLabel,
10537
+ media,
10538
+ title,
10539
+ content,
10540
+ name,
10541
+ complex,
10542
+ disabled,
10543
+ showMediaCircle,
10544
+ showMediaAtAllSizes,
10545
+ isContainerAligned
10546
+ };
10547
+ return /*#__PURE__*/jsx(Option$2, {
10548
+ ...sharedProps,
10549
+ button: /*#__PURE__*/jsx(RadioButton$1, {
10550
+ id: id,
10551
+ name: name,
10552
+ checked: checked,
10553
+ disabled: disabled,
10554
+ value: value,
10555
+ onChange: onChange
10556
+ })
10557
+ });
10558
+ };
10559
+ RadioOption.propTypes = {
10560
+ 'aria-label': PropTypes.string,
10561
+ media: PropTypes.node,
10562
+ id: PropTypes.string.isRequired,
10563
+ name: PropTypes.string.isRequired,
10564
+ title: PropTypes.node.isRequired,
10565
+ content: PropTypes.node,
10566
+ checked: PropTypes.bool,
10567
+ onChange: PropTypes.func.isRequired,
10568
+ complex: PropTypes.bool,
10569
+ disabled: PropTypes.bool,
10570
+ value: PropTypes.string,
10571
+ showMediaCircle: PropTypes.bool,
10572
+ showMediaAtAllSizes: PropTypes.bool,
10573
+ isContainerAligned: PropTypes.bool
10574
+ };
10575
+ RadioOption.defaultProps = {
10576
+ 'aria-label': undefined,
10577
+ media: null,
10578
+ content: null,
10579
+ checked: false,
10580
+ complex: false,
10581
+ disabled: false,
10582
+ showMediaCircle: true,
10583
+ showMediaAtAllSizes: false,
10584
+ isContainerAligned: false,
10585
+ value: ''
10586
+ };
10587
+ var RadioOption$1 = RadioOption;
10588
+
10589
+ const Section = ({
10590
+ children,
10591
+ className,
10592
+ withHorizontalPadding = false
10593
+ }) => {
10594
+ return /*#__PURE__*/jsx("div", {
10595
+ className: classNames('np-section', className, {
10596
+ 'np-section--with-horizontal-padding': withHorizontalPadding
10597
+ }),
10598
+ children: children
10599
+ });
10600
+ };
10601
+
10602
+ var messages$2 = defineMessages({
10603
+ searchPlaceholder: {
10604
+ id: "neptune.Select.searchPlaceholder"
10605
+ }
10606
+ });
10607
+
10608
+ // Option.tsx NEW
10609
+ function Option$1({
10610
+ label,
10611
+ currency = '',
10612
+ note = '',
10613
+ secondary = '',
10614
+ icon,
10615
+ classNames = {},
10616
+ selected = false
10617
+ }) {
10618
+ const {
10619
+ isModern
10620
+ } = useTheme();
10621
+ const style = classes => classes.map(className => classNames[className] || className).join(' ');
10622
+ const currencyClassNames = currency ? style(['currency-flag', `currency-flag-${currency.toLowerCase()}`]) : undefined;
10623
+ const iconElement = icon ? /*#__PURE__*/cloneElement(icon, {
10624
+ size: 24,
10625
+ className: 'tw-icon'
10626
+ }) : currency && /*#__PURE__*/jsx("i", {
10627
+ className: currencyClassNames
10628
+ });
10629
+ const titleAndNoteElement = /*#__PURE__*/jsxs(Body, {
10630
+ as: "span",
10631
+ type: Typography.BODY_LARGE,
10632
+ className: selected ? 'text-ellipsis' : undefined,
10633
+ children: [label, note && /*#__PURE__*/jsx(Body, {
10634
+ as: "span",
10635
+ className: isModern ? 'm-l-1' : 'm-l-1 body-2',
10636
+ children: note
10637
+ })]
10638
+ });
10639
+ const secondaryElementClassNames = () => {
10640
+ let classes = undefined;
10641
+ if (selected) {
10642
+ classes = 'text-ellipsis';
10643
+ }
10644
+ if (isModern) {
10645
+ return classes;
10646
+ }
10647
+ return `${classes ? classes + ' ' : ''}body-2`;
10648
+ };
10649
+ const secondaryElement = secondary && /*#__PURE__*/jsx(Body, {
10650
+ className: secondaryElementClassNames(),
10651
+ children: secondary
10652
+ });
10653
+ return iconElement ? /*#__PURE__*/jsxs("div", {
10654
+ className: "d-flex np-option-content",
10655
+ children: [/*#__PURE__*/jsx("div", {
10656
+ className: `d-flex flex-column${selected ? ' justify-content-center' : ''}`,
10657
+ children: iconElement
10658
+ }), /*#__PURE__*/jsxs("div", {
10659
+ className: "d-flex flex-column justify-content-center",
10660
+ children: [titleAndNoteElement, secondaryElement]
10661
+ })]
10662
+ }) : /*#__PURE__*/jsxs(Fragment, {
10663
+ children: [iconElement, titleAndNoteElement, secondaryElement]
10664
+ });
10665
+ }
10666
+
10667
+ const SearchBox = /*#__PURE__*/forwardRef(({
10668
+ id,
10669
+ classNames: classNames$1 = {},
10670
+ focusedOptionId,
10671
+ onChange,
10672
+ onClick,
10673
+ placeholder = undefined,
10674
+ value = ''
10675
+ }, reference) => {
10676
+ const style = className => classNames$1[className] || className;
10677
+ return /*#__PURE__*/jsx("li", {
10678
+ className: style('border-bottom'),
10679
+ children: /*#__PURE__*/jsx("a", {
10680
+ className: `${style('np-select-filter-link')} ${style('p-a-0')}`,
10681
+ children: /*#__PURE__*/jsxs("div", {
10682
+ className: style('input-group'),
10683
+ children: [/*#__PURE__*/jsx("span", {
10684
+ className: classNames('input-group-addon', 'input-group-addon--search'),
10685
+ children: /*#__PURE__*/jsx(Search, {
10686
+ className: classNames(style('tw-icon'), style('tw-icon-search')),
10687
+ size: 24
10688
+ })
10689
+ }), /*#__PURE__*/jsx(Input, {
10690
+ ref: reference,
10691
+ id: id,
10692
+ role: "searchbox",
10693
+ inputMode: "search",
10694
+ className: classNames(style('np-select-filter')),
10695
+ placeholder: placeholder,
10696
+ value: value,
10697
+ spellCheck: "false",
10698
+ "aria-activedescendant": focusedOptionId,
10699
+ onChange: onChange,
10700
+ onClick: onClick
10701
+ })]
10702
+ })
10703
+ })
10704
+ });
10705
+ });
10706
+ var SearchBox$1 = SearchBox;
10707
+
10708
+ const DEFAULT_SEARCH_VALUE = '';
10709
+ const DEFAULT_OPTIONS_PAGE_SIZE = 1000;
10710
+ const includesString = (string1, string2) => string1.toLowerCase().includes(string2.toLowerCase());
10711
+ function defaultFilterFunction(option, searchValue) {
10712
+ if (isPlaceholderOption(option)) {
10713
+ return true;
10714
+ }
10715
+ const {
10716
+ label,
10717
+ note,
10718
+ secondary,
10719
+ currency,
10720
+ searchStrings
10721
+ } = option;
10722
+ return !!label && includesString(label, searchValue) || !!note && includesString(note, searchValue) || !!secondary && includesString(secondary, searchValue) || !!currency && includesString(currency, searchValue) || !!searchStrings && searchStrings.some(string => includesString(string, searchValue));
10723
+ }
10724
+ function isActionableOption(option) {
10725
+ return !option.header && !option.separator && !option.disabled;
10726
+ }
10727
+ function isHeaderOption(option) {
10728
+ return option != null && 'header' in option;
10729
+ }
10730
+ function isSeparatorOption(option) {
10731
+ return option != null && 'separator' in option;
10732
+ }
10733
+ function clamp(from, to, value) {
10734
+ return Math.max(Math.min(to, value), from);
10735
+ }
10736
+
10737
+ /**
10738
+ * No option or placeholder option is selected
10739
+ */
10740
+ const DEFAULT_SELECTED_OPTION = null;
10741
+ function isPlaceholderOption(option) {
10742
+ return option === DEFAULT_SELECTED_OPTION || 'placeholder' in option;
10743
+ }
10744
+ function isSearchableOption(option) {
10745
+ return !isHeaderOption(option) && !isSeparatorOption(option) && !isPlaceholderOption(option);
10746
+ }
10747
+ const getUniqueIdForOption = (parentId = '', option) => {
10748
+ if (option == null) {
10749
+ return undefined;
10750
+ }
10751
+ const uniqueOptionId = option.value || (option.label?.replace(/\s/g, '') ?? '');
10752
+ return `option-${parentId}-${uniqueOptionId}`;
10753
+ };
10754
+
10755
+ /**
10756
+ * @deprecated Use `SelectInput` instead (https://neptune.wise.design/blog/2023-11-28-adopting-our-new-selectinput)
10757
+ */
10758
+ function Select({
10759
+ placeholder,
10760
+ id,
10761
+ required,
10762
+ disabled,
10763
+ inverse,
10764
+ dropdownWidth,
10765
+ size,
10766
+ block,
10767
+ selected,
10768
+ search,
10769
+ onChange,
10770
+ onFocus,
10771
+ onBlur,
10772
+ options: defaultOptions,
10773
+ onSearchChange,
10774
+ searchValue: initSearchValue,
10775
+ searchPlaceholder,
10776
+ // eslint-disable-next-line unicorn/prevent-abbreviations
10777
+ classNames: classNamesProp,
10778
+ dropdownUp,
10779
+ dropdownProps,
10780
+ buttonProps
10781
+ }) {
10782
+ const {
10783
+ formatMessage
10784
+ } = useIntl();
10785
+ const {
10786
+ isModern
10787
+ } = useTheme();
10788
+ const s = className => classNamesProp[className] || className;
10789
+ const [open, setOpen] = useState(false);
10790
+ const [searchValue, setSearchValue] = useState(DEFAULT_SEARCH_VALUE);
10791
+ const [keyboardFocusedOptionIndex, setKeyboardFocusedOptionIndex] = useState(null);
10792
+ const keyboardFocusedReference = useRef();
10793
+ const previousKeyboardFocusedOptionIndex = useRef();
10794
+ const [numberOfOptionsShown, setNumberOfOptionsShown] = useState(DEFAULT_OPTIONS_PAGE_SIZE);
10795
+ const searchBoxReference = useRef(null);
10796
+ const selectReference = useRef(null);
10797
+ const dropdownButtonReference = useRef(null);
10798
+ const optionsListReference = useRef(null);
10799
+ const isSearchEnabled = !!onSearchChange || !!search;
10800
+ const isDropdownAutoWidth = dropdownWidth == null;
10801
+ const fallbackButtonId = useMemo(() => getSimpleRandomId('np-select-'), []);
10802
+ const options = useMemo(() => {
10803
+ if (!search || !searchValue) {
10804
+ return defaultOptions;
10805
+ }
10806
+ return defaultOptions.filter(isSearchableOption).filter(option => {
10807
+ if (typeof search === 'function') {
10808
+ return search(option, searchValue);
10809
+ } else {
10810
+ return defaultFilterFunction(option, searchValue);
10811
+ }
10812
+ });
10813
+ }, [defaultOptions, search, searchValue]);
10814
+ const selectableOptions = useMemo(() => options.filter(isActionableOption), [options]);
10815
+ const focusedOption = selectableOptions[keyboardFocusedOptionIndex];
10816
+ const computedId = id || fallbackButtonId;
10817
+ const listboxId = `${computedId}-listbox`;
10818
+ const searchBoxId = `${computedId}-searchbox`;
10819
+ const {
10820
+ isMobile
10821
+ } = useLayout();
10822
+ useEffect(() => {
10823
+ let cancelled;
10824
+ if (keyboardFocusedOptionIndex >= 0) {
10825
+ requestAnimationFrame(() => {
10826
+ if (!cancelled) {
10827
+ if (isSearchEnabled) {
10828
+ keyboardFocusedReference.current?.scrollIntoView?.({
10829
+ block: 'center'
10830
+ });
10831
+ } else {
10832
+ keyboardFocusedReference.current?.focus();
10833
+ }
10834
+ }
10835
+ });
10836
+ return () => {
10837
+ cancelled = true;
10838
+ };
10839
+ }
10840
+ }, [keyboardFocusedOptionIndex, isSearchEnabled]);
10841
+ const handleOnClick = () => {
10842
+ setOpen(true);
10843
+ };
10844
+ const handleTouchStart = event => {
10845
+ if (event.currentTarget === event.target && open) {
10846
+ handleCloseOptions();
10847
+ }
10848
+ };
10849
+ const handleOnFocus = event => {
10850
+ if (onFocus) {
10851
+ onFocus(event);
10852
+ }
10853
+ };
10854
+ const handleOnBlur = event => {
10855
+ const {
10856
+ nativeEvent
10857
+ } = event;
10858
+ if (nativeEvent) {
10859
+ const elementReceivingFocus = nativeEvent.relatedTarget;
10860
+ const select = event.currentTarget;
10861
+ if (select && elementReceivingFocus && select.contains(elementReceivingFocus)) {
10862
+ return;
10863
+ }
10864
+ }
10865
+ if (onBlur) {
10866
+ onBlur(event);
10867
+ }
10868
+ };
10869
+ const handleSearchChange = event => {
10870
+ setNumberOfOptionsShown(DEFAULT_OPTIONS_PAGE_SIZE);
10871
+ setSearchValue(event.target.value);
10872
+ if (onSearchChange) {
10873
+ onSearchChange(event.target.value);
10874
+ }
10875
+ };
10876
+ const handleKeyDown = event => {
10877
+ switch (event.keyCode) {
10878
+ case KeyCodes.UP:
10879
+ case KeyCodes.DOWN:
10880
+ if (open) {
10881
+ moveFocusWithDifference(event.keyCode === KeyCodes.UP ? -1 : 1);
10882
+ } else {
10883
+ setOpen(true);
10884
+ }
10885
+ stopPropagation$1(event);
10886
+ break;
10887
+ case KeyCodes.SPACE:
10888
+ if (event.target !== searchBoxReference.current) {
10889
+ if (open) {
10890
+ selectKeyboardFocusedOption();
10891
+ } else {
10892
+ setOpen(true);
10893
+ }
10894
+ stopPropagation$1(event);
10895
+ }
10896
+ break;
10897
+ case KeyCodes.ENTER:
10898
+ if (open) {
10899
+ selectKeyboardFocusedOption();
10900
+ } else {
10901
+ setOpen(true);
10902
+ }
10903
+ stopPropagation$1(event);
10904
+ break;
10905
+ case KeyCodes.ESCAPE:
10906
+ handleCloseOptions();
10907
+ stopPropagation$1(event);
10908
+ break;
10909
+ case KeyCodes.TAB:
10910
+ if (open) {
10911
+ selectKeyboardFocusedOption();
10912
+ }
10913
+ break;
10914
+ }
10915
+ };
10916
+ function selectKeyboardFocusedOption() {
10917
+ if (keyboardFocusedOptionIndex != null) {
10918
+ selectableOptions.length > 0 && selectOption(selectableOptions[keyboardFocusedOptionIndex]);
10919
+ }
10920
+ }
10921
+ function moveFocusWithDifference(difference) {
10922
+ const selectedOptionIndex = selectableOptions.reduce((optionIndex, current, index) => {
10923
+ if (optionIndex != null) {
10924
+ return optionIndex;
10925
+ }
10926
+ if (isOptionSelected(selected, current)) {
10927
+ return index;
10928
+ }
10929
+ return null;
10930
+ }, null);
10931
+ const previousFocusedIndex = previousKeyboardFocusedOptionIndex.current ?? -1;
10932
+ let indexToStartMovingFrom = previousFocusedIndex;
10933
+ if (previousFocusedIndex === -1) {
10934
+ if (selectedOptionIndex == null) {
10935
+ setKeyboardFocusedOptionIndex(0);
10936
+ } else {
10937
+ indexToStartMovingFrom = selectedOptionIndex;
10938
+ }
10939
+ }
10940
+ const unClampedNewIndex = indexToStartMovingFrom + difference;
10941
+ const newIndex = clamp(0, selectableOptions.length - 1, unClampedNewIndex);
10942
+ setKeyboardFocusedOptionIndex(newIndex);
10943
+ }
10944
+ useEffect(() => {
10945
+ if (open) {
10946
+ if (!isMobile || searchValue) {
10947
+ if (isSearchEnabled && !!searchBoxReference.current) {
10948
+ searchBoxReference.current.focus();
10949
+ }
10950
+ if (!isSearchEnabled && optionsListReference.current && (previousKeyboardFocusedOptionIndex.current == null || Number.isNaN(previousKeyboardFocusedOptionIndex.current))) {
10951
+ optionsListReference.current.focus();
10952
+ }
10953
+ }
10954
+ previousKeyboardFocusedOptionIndex.current = keyboardFocusedOptionIndex;
10955
+ } else {
10956
+ previousKeyboardFocusedOptionIndex.current = null;
10957
+ }
10958
+ }, [open, searchValue, isSearchEnabled, isMobile, keyboardFocusedOptionIndex]);
10959
+ const handleCloseOptions = () => {
10960
+ setOpen(false);
10961
+ setKeyboardFocusedOptionIndex(null);
10962
+ if (dropdownButtonReference.current) {
10963
+ dropdownButtonReference.current.focus();
10964
+ }
10965
+ };
10966
+ function createSelectHandlerForOption(option) {
10967
+ return event => {
10968
+ stopPropagation$1(event);
10969
+ selectOption(option);
10970
+ };
10971
+ }
10972
+ function selectOption(option) {
10973
+ onChange(isPlaceholderOption(option) ? DEFAULT_SELECTED_OPTION : option);
10974
+ handleCloseOptions();
10975
+ }
10976
+ function renderOptionsList({
10977
+ className
10978
+ } = {}) {
10979
+ const dropdownClass = classNames(s('np-dropdown-menu'), {
10980
+ [s('np-dropdown-menu-desktop')]: !isMobile,
10981
+ [s(`np-dropdown-menu-${dropdownWidth}`)]: !isMobile && !isDropdownAutoWidth
10982
+ }, s(className));
10983
+ const showPlaceholder = !required && !isSearchEnabled && Boolean(placeholder);
10984
+ return /*#__PURE__*/jsxs("ul", {
10985
+ ref: optionsListReference,
10986
+ id: listboxId,
10987
+ role: "listbox",
10988
+ "aria-orientation": "vertical",
10989
+ "aria-activedescendant": getUniqueIdForOption(id, selected),
10990
+ tabIndex: "-1",
10991
+ className: dropdownClass,
10992
+ ...dropdownProps,
10993
+ children: [showPlaceholder && /*#__PURE__*/jsx(PlaceHolderOption, {}), isSearchEnabled && /*#__PURE__*/jsx(SearchBox$1, {
10994
+ ref: searchBoxReference,
10995
+ id: searchBoxId,
10996
+ classNames: classNamesProp,
10997
+ value: initSearchValue || searchValue,
10998
+ placeholder: searchPlaceholder || formatMessage(messages$2.searchPlaceholder),
10999
+ focusedOptionId: getUniqueIdForOption(id, focusedOption),
11000
+ onChange: handleSearchChange,
11001
+ onClick: stopPropagation$1
11002
+ }), options.slice(0, numberOfOptionsShown).map(renderOption), numberOfOptionsShown < options.length && /*#__PURE__*/jsx(ShowMoreOption, {})]
11003
+ });
11004
+ }
11005
+ function ShowMoreOption() {
11006
+ function handleOnClick(event) {
11007
+ stopPropagation$1(event);
11008
+ setNumberOfOptionsShown(numberOfOptionsShown + DEFAULT_OPTIONS_PAGE_SIZE);
11009
+ }
11010
+ return (
11011
+ /*#__PURE__*/
11012
+ /* eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions */
11013
+ jsx("li", {
11014
+ className: classNames(s('clickable'), s('border-bottom'), s('show-more')),
11015
+ onClick: handleOnClick,
11016
+ onKeyPress: handleOnClick,
11017
+ children: /*#__PURE__*/jsx("a", {
11018
+ children: "..."
11019
+ })
11020
+ })
11021
+ );
11022
+ }
11023
+ function PlaceHolderOption() {
11024
+ const placeholderOption = {
11025
+ placeholder
11026
+ };
11027
+ return (
11028
+ /*#__PURE__*/
11029
+ /* eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions */
11030
+ jsx("li", {
11031
+ className: classNames(s('clickable'), s('border-bottom')),
11032
+ onClick: createSelectHandlerForOption(placeholderOption),
11033
+ onKeyPress: createSelectHandlerForOption(placeholderOption),
11034
+ children: /*#__PURE__*/jsx("a", {
11035
+ children: placeholder
11036
+ })
11037
+ })
11038
+ );
11039
+ }
11040
+
11041
+ // eslint-disable-next-line react/prop-types
11042
+ function SeparatorOption() {
11043
+ return /*#__PURE__*/jsx("li", {
11044
+ className: s('np-separator'),
11045
+ "aria-hidden": true
11046
+ });
11047
+ }
11048
+
11049
+ // eslint-disable-next-line react/prop-types
11050
+ function HeaderOption({
11051
+ children
11052
+ }) {
11053
+ return /*#__PURE__*/jsx("li", {
11054
+ // eslint-disable-line jsx-a11y/no-noninteractive-element-interactions
11055
+ className: classNames(s('np-dropdown-header'), s('np-text-title-group')),
11056
+ onClick: stopPropagation$1,
11057
+ onKeyPress: stopPropagation$1,
11058
+ children: children
11059
+ });
11060
+ }
11061
+ function isOptionSelected(selected, option) {
11062
+ return selected?.value === option?.value;
11063
+ }
11064
+ const renderOption = (option, index) => {
11065
+ const separatorOption = option;
11066
+ if (isSeparatorOption(separatorOption) && separatorOption?.separator) {
11067
+ return /*#__PURE__*/jsx(SeparatorOption, {}, index);
11068
+ }
11069
+ const headerOption = option;
11070
+ if (isHeaderOption(headerOption) && headerOption.header) {
11071
+ return /*#__PURE__*/jsx(HeaderOption, {
11072
+ children: headerOption.header
11073
+ }, index);
11074
+ }
11075
+ const isActive = isOptionSelected(selected, option);
11076
+ const selectOption = option;
11077
+ const isFocusedWithKeyboard = !selectOption.disabled && keyboardFocusedOptionIndex === getIndexWithoutHeadersForIndexWithHeaders(index);
11078
+ const className = classNames(s('np-dropdown-item'), selectOption.disabled ? [s('disabled')] : s('clickable'), {
11079
+ [s('active')]: isActive,
11080
+ [s('np-dropdown-item--focused')]: isFocusedWithKeyboard
11081
+ });
11082
+ const handleOnClick = selectOption.disabled ? stopPropagation$1 : createSelectHandlerForOption(selectOption);
11083
+ return (
11084
+ /*#__PURE__*/
11085
+ /* eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions */
11086
+ jsx("li", {
11087
+ ref: isFocusedWithKeyboard ? keyboardFocusedReference : undefined,
11088
+ id: getUniqueIdForOption(id, option),
11089
+ "aria-selected": isActive,
11090
+ "aria-disabled": option.disabled,
11091
+ role: "option",
11092
+ tabIndex: "-1",
11093
+ className: className,
11094
+ onClick: handleOnClick,
11095
+ onKeyPress: handleOnClick,
11096
+ children: /*#__PURE__*/jsx("a", {
11097
+ disabled: selectOption.disabled,
11098
+ children: /*#__PURE__*/jsx(Option$1, {
11099
+ ...selectOption,
11100
+ classNames: classNamesProp
11101
+ })
11102
+ })
11103
+ }, index)
11104
+ );
11105
+ };
11106
+ function getIndexWithoutHeadersForIndexWithHeaders(index) {
11107
+ return options.reduce((sum, option, currentIndex) => {
11108
+ if (currentIndex < index && isActionableOption(option)) {
11109
+ return sum + 1;
11110
+ }
11111
+ return sum;
11112
+ }, 0);
11113
+ }
11114
+ const hasActiveOptions = !!defaultOptions.length;
11115
+ if (open && (initSearchValue || searchValue)) {
11116
+ if (hasActiveOptions && keyboardFocusedOptionIndex == null) {
11117
+ setKeyboardFocusedOptionIndex(0);
11118
+ }
11119
+ if (!hasActiveOptions && keyboardFocusedOptionIndex != null) {
11120
+ setKeyboardFocusedOptionIndex(null);
11121
+ }
11122
+ }
11123
+ return /*#__PURE__*/jsxs("div", {
11124
+ // eslint-disable-line jsx-a11y/no-static-element-interactions
11125
+ ref: selectReference,
11126
+ className: classNames(s('np-select'), block ? s('btn-block') : null, s('btn-group')),
11127
+ onKeyDown: handleKeyDown,
11128
+ onTouchMove: handleTouchStart,
11129
+ onFocus: handleOnFocus,
11130
+ onBlur: handleOnBlur,
11131
+ children: [/*#__PURE__*/jsxs(Button, {
11132
+ ref: dropdownButtonReference,
11133
+ id: computedId,
11134
+ block: block,
11135
+ size: size,
11136
+ htmlType: "button",
11137
+ className: classNames(s('np-dropdown-toggle'), s('np-text-body-large'), inverse ? s('np-dropdown-toggle-navy') : null)
11138
+ // reset Button's styles
11139
+ ,
11140
+ type: null,
11141
+ priority: null,
11142
+ disabled: disabled,
11143
+ "aria-controls": listboxId,
11144
+ "aria-expanded": open,
11145
+ "aria-autocomplete": "none",
11146
+ onClick: handleOnClick,
11147
+ ...buttonProps,
11148
+ children: [selected ? /*#__PURE__*/jsx(Option$1, {
11149
+ ...selected,
11150
+ classNames: classNamesProp,
11151
+ selected: true
11152
+ }) : /*#__PURE__*/jsx("span", {
11153
+ className: s('form-control-placeholder'),
11154
+ children: placeholder
11155
+ }), /*#__PURE__*/jsx(Chevron$1
11156
+ // disabled={disabled}
11157
+ , {
11158
+ className: classNames(s('tw-icon'), s('tw-chevron-up-icon'), s('tw-chevron'), s('bottom'), s('np-select-chevron'))
11159
+ })]
11160
+ }), isMobile ? isSearchEnabled ? /*#__PURE__*/jsx(Drawer$1, {
11161
+ open: open,
11162
+ headerTitle: searchPlaceholder || formatMessage(messages$2.searchPlaceholder),
11163
+ onClose: handleCloseOptions,
11164
+ children: renderOptionsList()
11165
+ }) : /*#__PURE__*/jsx(BottomSheet$2, {
11166
+ open: open,
11167
+ onClose: handleCloseOptions,
11168
+ children: renderOptionsList({
11169
+ className: isModern ? '' : 'p-a-1'
11170
+ })
11171
+ }) : /*#__PURE__*/jsx(Panel$1, {
11172
+ open: open,
11173
+ flip: false,
11174
+ altAxis: true,
11175
+ anchorRef: selectReference,
11176
+ anchorWidth: isDropdownAutoWidth,
11177
+ position: dropdownUp ? Position.TOP : Position.BOTTOM,
11178
+ onClose: handleCloseOptions,
11179
+ children: renderOptionsList({
11180
+ className: 'p-a-1'
11181
+ })
11182
+ })]
11183
+ });
11184
+ }
11185
+ Select.propTypes = {
11186
+ placeholder: PropTypes.string,
11032
11187
  id: PropTypes.string,
11033
- label: PropTypes.string.isRequired,
11034
- name: PropTypes.string.isRequired,
11188
+ required: PropTypes.bool,
11189
+ disabled: PropTypes.bool,
11190
+ inverse: PropTypes.bool,
11191
+ dropdownRight: PropTypes.oneOf(['xs', 'sm', 'md', 'lg', 'xl']),
11192
+ dropdownWidth: PropTypes.oneOf(['sm', 'md', 'lg']),
11193
+ size: PropTypes.oneOf(['sm', 'md', 'lg']),
11194
+ block: PropTypes.bool,
11195
+ selected: PropTypes.shape({
11196
+ value: PropTypes.any.isRequired,
11197
+ label: PropTypes.node,
11198
+ icon: PropTypes.node,
11199
+ currency: PropTypes.string,
11200
+ note: PropTypes.node,
11201
+ secondary: PropTypes.node
11202
+ }),
11203
+ /**
11204
+ * Search toggle
11205
+ * if `true` default search functionality being enabled (not case sensitive search in option labels & currency props)
11206
+ * if `function` you can define your own search function to implement custom search experience. This search function used while filtering the options array. The custom search function takes two parameters. First is the option the second is the keyword.
11207
+ */
11208
+ search: PropTypes.oneOfType([PropTypes.bool, PropTypes.func]),
11035
11209
  onChange: PropTypes.func.isRequired,
11036
- secondary: PropTypes.string,
11037
- value: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
11038
- className: PropTypes.string
11039
- };
11040
- Radio.defaultProps = {
11041
- avatar: undefined,
11042
- checked: false,
11043
- disabled: false,
11044
- id: null,
11045
- secondary: null,
11046
- value: '',
11047
- className: undefined
11048
- };
11049
- var Radio$1 = Radio;
11050
-
11051
- class RadioGroup extends Component {
11052
- constructor(props) {
11053
- super(props);
11054
- this.state = {
11055
- selectedValue: props.selectedValue
11056
- };
11057
- }
11058
- handleOnChange = selectedValue => {
11059
- const {
11060
- onChange
11061
- } = this.props;
11062
- this.setState({
11063
- selectedValue
11064
- }, onChange && onChange(selectedValue));
11065
- };
11066
- render() {
11067
- const {
11068
- radios,
11069
- name
11070
- } = this.props;
11071
- const {
11072
- selectedValue
11073
- } = this.state;
11074
- return radios && radios.length > 0 ? /*#__PURE__*/jsx(Fragment, {
11075
- children: radios.map(({
11076
- id,
11077
- avatar,
11078
- value,
11079
- label,
11080
- disabled,
11081
- secondary,
11082
- readOnly
11083
- }, index) => /*#__PURE__*/jsx(Radio$1
11084
- // eslint-disable-next-line react/no-array-index-key
11085
- , {
11086
- id: id,
11087
- value: value,
11088
- label: label,
11089
- name: name,
11090
- disabled: disabled,
11091
- checked: selectedValue === value,
11092
- secondary: secondary,
11093
- readOnly: readOnly,
11094
- avatar: avatar,
11095
- onChange: value_ => this.handleOnChange(value_)
11096
- }, index))
11097
- }) : null;
11098
- }
11099
- }
11100
- RadioGroup.propTypes = {
11101
- radios: PropTypes.arrayOf(PropTypes.shape({
11102
- id: PropTypes.string,
11103
- avatar: PropTypes.element,
11104
- value: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
11105
- secondary: PropTypes.string,
11106
- label: PropTypes.string.isRequired,
11210
+ onFocus: PropTypes.func,
11211
+ onBlur: PropTypes.func,
11212
+ options: PropTypes.arrayOf(PropTypes.shape({
11213
+ value: PropTypes.any,
11214
+ label: PropTypes.node,
11215
+ header: PropTypes.node,
11216
+ icon: PropTypes.node,
11217
+ currency: PropTypes.string,
11218
+ note: PropTypes.node,
11219
+ secondary: PropTypes.node,
11220
+ separator: PropTypes.bool,
11107
11221
  disabled: PropTypes.bool,
11108
- readOnly: PropTypes.bool
11222
+ searchStrings: PropTypes.arrayOf(PropTypes.string)
11109
11223
  })).isRequired,
11110
- onChange: PropTypes.func.isRequired,
11111
- selectedValue: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
11112
- name: PropTypes.string.isRequired
11113
- };
11114
- RadioGroup.defaultProps = {
11115
- selectedValue: null
11116
- };
11117
- var RadioGroup$1 = RadioGroup;
11118
-
11119
- const RadioOption = ({
11120
- 'aria-label': ariaLabel,
11121
- media,
11122
- title,
11123
- content,
11124
- id,
11125
- name,
11126
- checked,
11127
- onChange,
11128
- complex,
11129
- disabled,
11130
- value,
11131
- showMediaCircle,
11132
- showMediaAtAllSizes,
11133
- isContainerAligned
11134
- }) => {
11135
- const sharedProps = {
11136
- 'aria-label': ariaLabel,
11137
- media,
11138
- title,
11139
- content,
11140
- name,
11141
- complex,
11142
- disabled,
11143
- showMediaCircle,
11144
- showMediaAtAllSizes,
11145
- isContainerAligned
11146
- };
11147
- return /*#__PURE__*/jsx(Option$2, {
11148
- ...sharedProps,
11149
- button: /*#__PURE__*/jsx(RadioButton$1, {
11150
- id: id,
11151
- name: name,
11152
- checked: checked,
11153
- disabled: disabled,
11154
- value: value,
11155
- onChange: onChange
11156
- })
11157
- });
11158
- };
11159
- RadioOption.propTypes = {
11160
- 'aria-label': PropTypes.string,
11161
- media: PropTypes.node,
11162
- id: PropTypes.string.isRequired,
11163
- name: PropTypes.string.isRequired,
11164
- title: PropTypes.node.isRequired,
11165
- content: PropTypes.node,
11166
- checked: PropTypes.bool,
11167
- onChange: PropTypes.func.isRequired,
11168
- complex: PropTypes.bool,
11169
- disabled: PropTypes.bool,
11170
- value: PropTypes.string,
11171
- showMediaCircle: PropTypes.bool,
11172
- showMediaAtAllSizes: PropTypes.bool,
11173
- isContainerAligned: PropTypes.bool
11224
+ /**
11225
+ * To have full control of your search value and response use `onSearchChange` function combined with `searchValue` and custom filtering on the options array.
11226
+ * DO NOT USE TOGETHER WITH `search` PROPERTY
11227
+ */
11228
+ onSearchChange: PropTypes.func,
11229
+ searchValue: PropTypes.string,
11230
+ searchPlaceholder: PropTypes.string,
11231
+ classNames: PropTypes.objectOf(PropTypes.string),
11232
+ dropdownUp: PropTypes.bool,
11233
+ buttonProps: PropTypes.object,
11234
+ dropdownProps: PropTypes.object
11174
11235
  };
11175
- RadioOption.defaultProps = {
11176
- 'aria-label': undefined,
11177
- media: null,
11178
- content: null,
11179
- checked: false,
11180
- complex: false,
11236
+ Select.defaultProps = {
11237
+ id: undefined,
11238
+ placeholder: undefined,
11239
+ size: 'md',
11240
+ dropdownRight: null,
11241
+ dropdownWidth: null,
11242
+ inverse: false,
11243
+ required: false,
11181
11244
  disabled: false,
11182
- showMediaCircle: true,
11183
- showMediaAtAllSizes: false,
11184
- isContainerAligned: false,
11185
- value: ''
11186
- };
11187
- var RadioOption$1 = RadioOption;
11188
-
11189
- const Section = ({
11190
- children,
11191
- className,
11192
- withHorizontalPadding = false
11193
- }) => {
11194
- return /*#__PURE__*/jsx("div", {
11195
- className: classNames('np-section', className, {
11196
- 'np-section--with-horizontal-padding': withHorizontalPadding
11197
- }),
11198
- children: children
11199
- });
11245
+ block: true,
11246
+ selected: null,
11247
+ onFocus: null,
11248
+ onBlur: null,
11249
+ onSearchChange: undefined,
11250
+ search: false,
11251
+ searchValue: '',
11252
+ searchPlaceholder: undefined,
11253
+ classNames: {},
11254
+ dropdownUp: false,
11255
+ buttonProps: {},
11256
+ dropdownProps: {}
11200
11257
  };
11201
11258
 
11202
11259
  const CSS_TRANSITION_DURATION = 400;
@@ -14629,9 +14686,11 @@ var cs = {
14629
14686
  "neptune.DateLookup.twentyYears": "20 let",
14630
14687
  "neptune.DateLookup.year": "rok",
14631
14688
  "neptune.FlowNavigation.back": "back to previous step",
14689
+ "neptune.Info.ariaLabel": "Více informací",
14632
14690
  "neptune.Link.opensInNewTab": "(opens in new tab)",
14633
14691
  "neptune.MoneyInput.Select.placeholder": "Vybrat možnost...",
14634
14692
  "neptune.Select.searchPlaceholder": "Hledat...",
14693
+ "neptune.SelectInput.noResultsFound": "Nebyly nalezeny žádné výsledky",
14635
14694
  "neptune.Summary.statusDone": "Položka dokončena",
14636
14695
  "neptune.Summary.statusNotDone": "Položka k dokončení",
14637
14696
  "neptune.Summary.statusPending": "Čekající položka",
@@ -14682,9 +14741,11 @@ var de = {
14682
14741
  "neptune.DateLookup.twentyYears": "20 Jahre",
14683
14742
  "neptune.DateLookup.year": "Jahr",
14684
14743
  "neptune.FlowNavigation.back": "zurück zum vorherigen Schritt",
14744
+ "neptune.Info.ariaLabel": "Weitere Informationen",
14685
14745
  "neptune.Link.opensInNewTab": "(wird in einem neuen Tab geöffnet)",
14686
14746
  "neptune.MoneyInput.Select.placeholder": "Wähle eine der Möglichkeiten aus...",
14687
14747
  "neptune.Select.searchPlaceholder": "Wird gesucht...",
14748
+ "neptune.SelectInput.noResultsFound": "Keine Ergebnisse gefunden",
14688
14749
  "neptune.Summary.statusDone": "Schritt erledigt",
14689
14750
  "neptune.Summary.statusNotDone": "Schritt noch zu erledigen",
14690
14751
  "neptune.Summary.statusPending": "Schritt ausstehend",
@@ -14735,9 +14796,11 @@ var es = {
14735
14796
  "neptune.DateLookup.twentyYears": "20 años",
14736
14797
  "neptune.DateLookup.year": "año",
14737
14798
  "neptune.FlowNavigation.back": "volver al paso anterior",
14799
+ "neptune.Info.ariaLabel": "Más información",
14738
14800
  "neptune.Link.opensInNewTab": "(se abre en una pestaña nueva)",
14739
14801
  "neptune.MoneyInput.Select.placeholder": "Selecciona una opción...",
14740
14802
  "neptune.Select.searchPlaceholder": "Buscar...",
14803
+ "neptune.SelectInput.noResultsFound": "No se han encontrado resultados",
14741
14804
  "neptune.Summary.statusDone": "Apartado listo",
14742
14805
  "neptune.Summary.statusNotDone": "Apartado a completar",
14743
14806
  "neptune.Summary.statusPending": "Apartado pendiente",
@@ -14788,9 +14851,11 @@ var fr = {
14788
14851
  "neptune.DateLookup.twentyYears": "20 ans",
14789
14852
  "neptune.DateLookup.year": "année",
14790
14853
  "neptune.FlowNavigation.back": "revenir à l'étape précédente",
14854
+ "neptune.Info.ariaLabel": "Plus d'informations",
14791
14855
  "neptune.Link.opensInNewTab": "(ouvre dans un nouvel onglet)",
14792
14856
  "neptune.MoneyInput.Select.placeholder": "Sélectionner une option...",
14793
14857
  "neptune.Select.searchPlaceholder": "Recherche...",
14858
+ "neptune.SelectInput.noResultsFound": "Aucun résultat trouvé",
14794
14859
  "neptune.Summary.statusDone": "Validé",
14795
14860
  "neptune.Summary.statusNotDone": "À compléter",
14796
14861
  "neptune.Summary.statusPending": "En attente",
@@ -14841,9 +14906,11 @@ var hu = {
14841
14906
  "neptune.DateLookup.twentyYears": "20 év",
14842
14907
  "neptune.DateLookup.year": "év",
14843
14908
  "neptune.FlowNavigation.back": "vissza az előző lépéshez",
14909
+ "neptune.Info.ariaLabel": "További információ",
14844
14910
  "neptune.Link.opensInNewTab": "(új lapon nyílik meg)",
14845
14911
  "neptune.MoneyInput.Select.placeholder": "Válassz ki egy lehetőséget...",
14846
14912
  "neptune.Select.searchPlaceholder": "Keresés...",
14913
+ "neptune.SelectInput.noResultsFound": "Nincs találat",
14847
14914
  "neptune.Summary.statusDone": "Kész",
14848
14915
  "neptune.Summary.statusNotDone": "Hátravan",
14849
14916
  "neptune.Summary.statusPending": "Függőben",
@@ -14894,9 +14961,11 @@ var id = {
14894
14961
  "neptune.DateLookup.twentyYears": "20 tahun",
14895
14962
  "neptune.DateLookup.year": "tahun",
14896
14963
  "neptune.FlowNavigation.back": "kembali ke langkah sebelumnya",
14964
+ "neptune.Info.ariaLabel": "Informasi lebih lanjut",
14897
14965
  "neptune.Link.opensInNewTab": "(terbuka di tab baru)",
14898
14966
  "neptune.MoneyInput.Select.placeholder": "Pilih opsi...",
14899
14967
  "neptune.Select.searchPlaceholder": "Cari...",
14968
+ "neptune.SelectInput.noResultsFound": "Hasil tidak ditemukan",
14900
14969
  "neptune.Summary.statusDone": "Item selesai",
14901
14970
  "neptune.Summary.statusNotDone": "Item yang harus dilakukan",
14902
14971
  "neptune.Summary.statusPending": "Item tertunda",
@@ -14947,9 +15016,11 @@ var it = {
14947
15016
  "neptune.DateLookup.twentyYears": "20 anni",
14948
15017
  "neptune.DateLookup.year": "anno",
14949
15018
  "neptune.FlowNavigation.back": "torna al passaggio precedente",
15019
+ "neptune.Info.ariaLabel": "Maggiori informazioni",
14950
15020
  "neptune.Link.opensInNewTab": "(si apre in una nuova scheda)",
14951
15021
  "neptune.MoneyInput.Select.placeholder": "Seleziona un'opzione...",
14952
15022
  "neptune.Select.searchPlaceholder": "Cerca...",
15023
+ "neptune.SelectInput.noResultsFound": "Nessun risultato trovato",
14953
15024
  "neptune.Summary.statusDone": "Completato",
14954
15025
  "neptune.Summary.statusNotDone": "Da completare",
14955
15026
  "neptune.Summary.statusPending": "In corso",
@@ -15000,9 +15071,11 @@ var ja = {
15000
15071
  "neptune.DateLookup.twentyYears": "20年",
15001
15072
  "neptune.DateLookup.year": "年",
15002
15073
  "neptune.FlowNavigation.back": "前のステップに戻る",
15074
+ "neptune.Info.ariaLabel": "詳細",
15003
15075
  "neptune.Link.opensInNewTab": "(新しいタブで開きます)",
15004
15076
  "neptune.MoneyInput.Select.placeholder": "選択してください...",
15005
15077
  "neptune.Select.searchPlaceholder": "検索... ",
15078
+ "neptune.SelectInput.noResultsFound": "結果が見つかりませんでした",
15006
15079
  "neptune.Summary.statusDone": "完了",
15007
15080
  "neptune.Summary.statusNotDone": "未対応",
15008
15081
  "neptune.Summary.statusPending": "保留中",
@@ -15053,9 +15126,11 @@ var pl = {
15053
15126
  "neptune.DateLookup.twentyYears": "20 lat",
15054
15127
  "neptune.DateLookup.year": "rok",
15055
15128
  "neptune.FlowNavigation.back": "wróć do poprzedniego kroku",
15129
+ "neptune.Info.ariaLabel": "Więcej informacji",
15056
15130
  "neptune.Link.opensInNewTab": "(otworzy się w nowej zakładce)",
15057
15131
  "neptune.MoneyInput.Select.placeholder": "Wybierz opcję...",
15058
15132
  "neptune.Select.searchPlaceholder": "Wyszukaj...",
15133
+ "neptune.SelectInput.noResultsFound": "Nie znaleziono wyników",
15059
15134
  "neptune.Summary.statusDone": "Czynność wykonana",
15060
15135
  "neptune.Summary.statusNotDone": "Czynność do wykonania",
15061
15136
  "neptune.Summary.statusPending": "Czynność oczekująca",
@@ -15098,17 +15173,19 @@ var pt = {
15098
15173
  "neptune.DateInput.month.label": "Mês",
15099
15174
  "neptune.DateInput.year.label": "Ano",
15100
15175
  "neptune.DateLookup.day": "dia",
15101
- "neptune.DateLookup.goTo20YearView": "Go to 20 year view",
15176
+ "neptune.DateLookup.goTo20YearView": "Acessar a visualização de 20 anos",
15102
15177
  "neptune.DateLookup.month": "mês",
15103
15178
  "neptune.DateLookup.next": "próximo",
15104
15179
  "neptune.DateLookup.previous": "anterior",
15105
15180
  "neptune.DateLookup.selected": "selecionada",
15106
15181
  "neptune.DateLookup.twentyYears": "20 anos",
15107
15182
  "neptune.DateLookup.year": "ano",
15108
- "neptune.FlowNavigation.back": "back to previous step",
15109
- "neptune.Link.opensInNewTab": "(abrir a página em uma nova aba)",
15183
+ "neptune.FlowNavigation.back": "voltar à etapa anterior",
15184
+ "neptune.Info.ariaLabel": "Mais informações",
15185
+ "neptune.Link.opensInNewTab": "(abre em uma nova aba)",
15110
15186
  "neptune.MoneyInput.Select.placeholder": "Escolha uma opção...",
15111
15187
  "neptune.Select.searchPlaceholder": "Buscar...",
15188
+ "neptune.SelectInput.noResultsFound": "Nenhum resultado encontrado",
15112
15189
  "neptune.Summary.statusDone": "Pronto",
15113
15190
  "neptune.Summary.statusNotDone": "Não iniciado",
15114
15191
  "neptune.Summary.statusPending": "Pendente",
@@ -15152,16 +15229,18 @@ var ro = {
15152
15229
  "neptune.DateInput.year.label": "An",
15153
15230
  "neptune.DateLookup.day": "zi",
15154
15231
  "neptune.DateLookup.goTo20YearView": "Accesează vizualizarea pe 20 de ani",
15155
- "neptune.DateLookup.month": "luna",
15232
+ "neptune.DateLookup.month": "lună",
15156
15233
  "neptune.DateLookup.next": "înainte",
15157
- "neptune.DateLookup.previous": "precedenta",
15234
+ "neptune.DateLookup.previous": "înapoi",
15158
15235
  "neptune.DateLookup.selected": "selectată",
15159
15236
  "neptune.DateLookup.twentyYears": "20 de ani",
15160
- "neptune.DateLookup.year": "anul",
15237
+ "neptune.DateLookup.year": "an",
15161
15238
  "neptune.FlowNavigation.back": "înapoi la pasul anterior",
15239
+ "neptune.Info.ariaLabel": "Mai multe informații",
15162
15240
  "neptune.Link.opensInNewTab": "(se deschide într-o filă nouă)",
15163
15241
  "neptune.MoneyInput.Select.placeholder": "Selectează o opţiune...",
15164
15242
  "neptune.Select.searchPlaceholder": "Caută...",
15243
+ "neptune.SelectInput.noResultsFound": "Nu s-a găsit niciun rezultat",
15165
15244
  "neptune.Summary.statusDone": "Finalizat",
15166
15245
  "neptune.Summary.statusNotDone": "De făcut",
15167
15246
  "neptune.Summary.statusPending": "În așteptare",
@@ -15207,14 +15286,16 @@ var ru = {
15207
15286
  "neptune.DateLookup.goTo20YearView": "Перейти к обзору 20 лет",
15208
15287
  "neptune.DateLookup.month": "месяц",
15209
15288
  "neptune.DateLookup.next": "далее",
15210
- "neptune.DateLookup.previous": "предыдущий",
15289
+ "neptune.DateLookup.previous": "назад",
15211
15290
  "neptune.DateLookup.selected": "выбрано",
15212
15291
  "neptune.DateLookup.twentyYears": "20 лет",
15213
15292
  "neptune.DateLookup.year": "год",
15214
15293
  "neptune.FlowNavigation.back": "вернуться к предыдущему шагу",
15294
+ "neptune.Info.ariaLabel": "Подробнее",
15215
15295
  "neptune.Link.opensInNewTab": "(откроется в новой вкладке)",
15216
15296
  "neptune.MoneyInput.Select.placeholder": "Выберите вариант...",
15217
15297
  "neptune.Select.searchPlaceholder": "Поиск...",
15298
+ "neptune.SelectInput.noResultsFound": "Ничего не найдено",
15218
15299
  "neptune.Summary.statusDone": "Этап завершен",
15219
15300
  "neptune.Summary.statusNotDone": "Этап к выполнению",
15220
15301
  "neptune.Summary.statusPending": "Этап в процессе",
@@ -15265,9 +15346,11 @@ var th = {
15265
15346
  "neptune.DateLookup.twentyYears": "20 ปี",
15266
15347
  "neptune.DateLookup.year": "ปี",
15267
15348
  "neptune.FlowNavigation.back": "back to previous step",
15349
+ "neptune.Info.ariaLabel": "ข้อมูลเพิ่มเติม",
15268
15350
  "neptune.Link.opensInNewTab": "(opens in new tab)",
15269
15351
  "neptune.MoneyInput.Select.placeholder": "เลือกตัวเลือก...",
15270
15352
  "neptune.Select.searchPlaceholder": "ค้นหา...",
15353
+ "neptune.SelectInput.noResultsFound": "ไม่พบผลลัพธ์",
15271
15354
  "neptune.Summary.statusDone": "รายการที่ทำแล้ว",
15272
15355
  "neptune.Summary.statusNotDone": "รายการที่ต้องทำ",
15273
15356
  "neptune.Summary.statusPending": "รายการที่รอดำเนินการ",
@@ -15318,9 +15401,11 @@ var tr = {
15318
15401
  "neptune.DateLookup.twentyYears": "20 yıl",
15319
15402
  "neptune.DateLookup.year": "yıl",
15320
15403
  "neptune.FlowNavigation.back": "önceki adıma dön",
15404
+ "neptune.Info.ariaLabel": "Daha fazla bilgi",
15321
15405
  "neptune.Link.opensInNewTab": "(yeni sekmede açılır)",
15322
15406
  "neptune.MoneyInput.Select.placeholder": "Bir seçenek seçin...",
15323
15407
  "neptune.Select.searchPlaceholder": "Ara...",
15408
+ "neptune.SelectInput.noResultsFound": "Sonuç bulunamadı",
15324
15409
  "neptune.Summary.statusDone": "Tamamlanan aşama",
15325
15410
  "neptune.Summary.statusNotDone": "Yapılacak",
15326
15411
  "neptune.Summary.statusPending": "Bekliyor",
@@ -15371,9 +15456,11 @@ var uk = {
15371
15456
  "neptune.DateLookup.twentyYears": "20 років",
15372
15457
  "neptune.DateLookup.year": "рік",
15373
15458
  "neptune.FlowNavigation.back": "back to previous step",
15459
+ "neptune.Info.ariaLabel": "Більше відомостей",
15374
15460
  "neptune.Link.opensInNewTab": "(opens in new tab)",
15375
15461
  "neptune.MoneyInput.Select.placeholder": "Виберіть варіант…",
15376
15462
  "neptune.Select.searchPlaceholder": "Пошук…",
15463
+ "neptune.SelectInput.noResultsFound": "Нічого не знайдено",
15377
15464
  "neptune.Summary.statusDone": "Виконано",
15378
15465
  "neptune.Summary.statusNotDone": "Не виконано",
15379
15466
  "neptune.Summary.statusPending": "Виконується",
@@ -15410,23 +15497,25 @@ var uk = {
15410
15497
  var zhCN = {
15411
15498
  "neptune.Button.loadingAriaLabel": "正在加载",
15412
15499
  "neptune.Chips.ariaLabel": "清除 {choice}",
15413
- "neptune.ClearButton.ariaLabel": "清晰",
15500
+ "neptune.ClearButton.ariaLabel": "清除",
15414
15501
  "neptune.CloseButton.ariaLabel": "关闭",
15415
15502
  "neptune.DateInput.day.label": "日",
15416
15503
  "neptune.DateInput.month.label": "月",
15417
15504
  "neptune.DateInput.year.label": "年",
15418
15505
  "neptune.DateLookup.day": "日",
15419
- "neptune.DateLookup.goTo20YearView": "Go to 20 year view",
15506
+ "neptune.DateLookup.goTo20YearView": "转到 20 年视图",
15420
15507
  "neptune.DateLookup.month": "月",
15421
15508
  "neptune.DateLookup.next": "下一页",
15422
15509
  "neptune.DateLookup.previous": "上一页",
15423
15510
  "neptune.DateLookup.selected": "已选",
15424
- "neptune.DateLookup.twentyYears": "20年",
15511
+ "neptune.DateLookup.twentyYears": "20 年",
15425
15512
  "neptune.DateLookup.year": "年",
15426
- "neptune.FlowNavigation.back": "back to previous step",
15427
- "neptune.Link.opensInNewTab": "(opens in new tab)",
15513
+ "neptune.FlowNavigation.back": "返回上一步",
15514
+ "neptune.Info.ariaLabel": "更多信息",
15515
+ "neptune.Link.opensInNewTab": "(在新标签页中打开)",
15428
15516
  "neptune.MoneyInput.Select.placeholder": "请选择...",
15429
15517
  "neptune.Select.searchPlaceholder": "搜索",
15518
+ "neptune.SelectInput.noResultsFound": "找不到结果",
15430
15519
  "neptune.Summary.statusDone": "已完成",
15431
15520
  "neptune.Summary.statusNotDone": "未完成",
15432
15521
  "neptune.Summary.statusPending": "待处理",
@@ -15442,7 +15531,7 @@ var zhCN = {
15442
15531
  "neptune.Upload.usPlaceholder": "拖放小于 5MB 的文件",
15443
15532
  "neptune.UploadButton.allFileTypes": "所有文件类型",
15444
15533
  "neptune.UploadButton.dropFiles": "拖放文件开始上传",
15445
- "neptune.UploadButton.instructions": "{fileTypes},小于 {size}MB",
15534
+ "neptune.UploadButton.instructions": "{fileTypes},小于 {size} MB",
15446
15535
  "neptune.UploadButton.uploadFile": "上传文件",
15447
15536
  "neptune.UploadButton.uploadFiles": "上传文件",
15448
15537
  "neptune.UploadInput.deleteModalBody": "删除此文件会将其从我们的系统中删除",
@@ -15477,9 +15566,11 @@ var zhHK = {
15477
15566
  "neptune.DateLookup.twentyYears": "20年",
15478
15567
  "neptune.DateLookup.year": "年",
15479
15568
  "neptune.FlowNavigation.back": "返回上一個步驟",
15569
+ "neptune.Info.ariaLabel": "更多資訊",
15480
15570
  "neptune.Link.opensInNewTab": "(在新分頁中開啟)",
15481
15571
  "neptune.MoneyInput.Select.placeholder": "選擇一個選項…",
15482
15572
  "neptune.Select.searchPlaceholder": "搜尋…",
15573
+ "neptune.SelectInput.noResultsFound": "找不到任何結果",
15483
15574
  "neptune.Summary.statusDone": "已完成事項",
15484
15575
  "neptune.Summary.statusNotDone": "未完成事項",
15485
15576
  "neptune.Summary.statusPending": "待處理事項",