@transferwise/components 45.25.1 → 45.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/index.esm.js +28 -19
- package/build/index.esm.js.map +1 -1
- package/build/index.js +30 -21
- package/build/index.js.map +1 -1
- package/build/main.css +1 -1
- package/build/styles/chips/Chip.css +1 -1
- package/build/styles/main.css +1 -1
- package/build/types/select/Select.d.ts.map +1 -1
- package/build/types/test-utils/window-mock.d.ts +1 -0
- package/build/types/test-utils/window-mock.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/chips/Chip.css +1 -1
- package/src/chips/Chip.less +9 -21
- package/src/dateInput/DateInput.js +8 -8
- package/src/dateInput/DateInput.spec.js +12 -136
- package/src/dateInput/DateInput.story.tsx +6 -1
- package/src/inputs/SelectInput.spec.tsx +3 -27
- package/src/main.css +1 -1
- package/src/phoneNumberInput/PhoneNumberInput.spec.js +4 -20
- package/src/select/Select.js +3 -0
- package/src/test-utils/window-mock.ts +11 -0
package/build/index.esm.js
CHANGED
|
@@ -7,19 +7,19 @@ import { ChevronUp, CrossCircleFill, Cross, NavigateAway, Check, Info as Info$1,
|
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import { defineMessages, useIntl, injectIntl, IntlProvider } from 'react-intl';
|
|
9
9
|
import { useTheme, ThemeProvider } from '@wise/components-theming';
|
|
10
|
-
import { formatDate, formatNumber, formatMoney, formatAmount } from '@transferwise/formatting';
|
|
11
|
-
import throttle from 'lodash.throttle';
|
|
12
|
-
import { CSSTransition } from 'react-transition-group';
|
|
13
|
-
import { createPortal } from 'react-dom';
|
|
14
|
-
import { FocusScope } from '@react-aria/focus';
|
|
15
|
-
import mergeRefs from 'react-merge-refs';
|
|
16
|
-
import { useSyncExternalStore } from 'use-sync-external-store/shim';
|
|
17
|
-
import { isUndefined, isKey, isNumber, isEmpty, isNull, isArray } from '@transferwise/neptune-validation';
|
|
18
|
-
import { usePopper } from 'react-popper';
|
|
19
10
|
import { Transition, Listbox } from '@headlessui/react';
|
|
20
11
|
import mergeProps from 'merge-props';
|
|
12
|
+
import mergeRefs from 'react-merge-refs';
|
|
13
|
+
import { useSyncExternalStore } from 'use-sync-external-store/shim';
|
|
21
14
|
import { useFloating, useDismiss, useRole, useInteractions, FloatingPortal, FloatingFocusManager, offset, flip, shift, size, autoUpdate } from '@floating-ui/react';
|
|
15
|
+
import { FocusScope } from '@react-aria/focus';
|
|
22
16
|
import { usePreventScroll } from '@react-aria/overlays';
|
|
17
|
+
import { formatDate, formatNumber, formatMoney, formatAmount } from '@transferwise/formatting';
|
|
18
|
+
import { CSSTransition } from 'react-transition-group';
|
|
19
|
+
import { usePopper } from 'react-popper';
|
|
20
|
+
import throttle from 'lodash.throttle';
|
|
21
|
+
import { createPortal } from 'react-dom';
|
|
22
|
+
import { isUndefined, isKey, isNumber, isEmpty, isNull, isArray } from '@transferwise/neptune-validation';
|
|
23
23
|
import { Illustration } from '@wise/art';
|
|
24
24
|
import clamp$2 from 'lodash.clamp';
|
|
25
25
|
import debounce from 'lodash.debounce';
|
|
@@ -2965,22 +2965,24 @@ const DateInput = ({
|
|
|
2965
2965
|
}
|
|
2966
2966
|
};
|
|
2967
2967
|
const getSelectElement = () => {
|
|
2968
|
-
const
|
|
2968
|
+
const monthOptions = getMonthsOptions();
|
|
2969
2969
|
return /*#__PURE__*/jsxs("label", {
|
|
2970
|
+
className: "d-flex flex-column",
|
|
2970
2971
|
children: [/*#__PURE__*/jsx("span", {
|
|
2971
2972
|
className: "sr-only",
|
|
2972
2973
|
children: monthLabel
|
|
2973
|
-
}), /*#__PURE__*/jsx(
|
|
2974
|
-
id: id ? `${id}-select` : undefined,
|
|
2974
|
+
}), /*#__PURE__*/jsx(SelectInput, {
|
|
2975
2975
|
name: "month",
|
|
2976
2976
|
disabled: disabled,
|
|
2977
2977
|
placeholder: placeholders.month,
|
|
2978
|
-
|
|
2978
|
+
items: monthOptions,
|
|
2979
2979
|
size: size,
|
|
2980
|
-
|
|
2981
|
-
|
|
2982
|
-
label
|
|
2983
|
-
},
|
|
2980
|
+
value: monthOptions.find(item => item.value.value === month)?.value,
|
|
2981
|
+
renderValue: ({
|
|
2982
|
+
label
|
|
2983
|
+
}) => /*#__PURE__*/jsx(SelectInputOptionContent, {
|
|
2984
|
+
title: label
|
|
2985
|
+
}),
|
|
2984
2986
|
onChange: selectedValue => handleMonthChange(selectedValue),
|
|
2985
2987
|
...selectProps
|
|
2986
2988
|
})]
|
|
@@ -2991,8 +2993,11 @@ const DateInput = ({
|
|
|
2991
2993
|
const months = getMonthNames(locale, monthFormat);
|
|
2992
2994
|
months.forEach((label, index) => {
|
|
2993
2995
|
options.push({
|
|
2994
|
-
|
|
2995
|
-
|
|
2996
|
+
type: 'option',
|
|
2997
|
+
value: {
|
|
2998
|
+
label,
|
|
2999
|
+
value: index
|
|
3000
|
+
}
|
|
2996
3001
|
});
|
|
2997
3002
|
});
|
|
2998
3003
|
return options;
|
|
@@ -7838,6 +7843,10 @@ const getUniqueIdForOption = (parentId = '', option) => {
|
|
|
7838
7843
|
const uniqueOptionId = option.value || (option.label?.replace(/\s/g, '') ?? '');
|
|
7839
7844
|
return `option-${parentId}-${uniqueOptionId}`;
|
|
7840
7845
|
};
|
|
7846
|
+
|
|
7847
|
+
/**
|
|
7848
|
+
* @deprecated Use `SelectInput` instead (https://neptune.wise.design/blog/2023-11-28-adopting-our-new-selectinput)
|
|
7849
|
+
*/
|
|
7841
7850
|
function Select({
|
|
7842
7851
|
placeholder,
|
|
7843
7852
|
id,
|