@transferwise/components 46.1.1 → 46.3.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 +45 -15
- package/build/index.esm.js.map +1 -1
- package/build/index.js +45 -15
- package/build/index.js.map +1 -1
- package/build/main.css +26 -13
- package/build/styles/common/card/Card.css +0 -4
- package/build/styles/criticalBanner/CriticalCommsBanner.css +0 -1
- package/build/styles/flowNavigation/FlowNavigation.css +26 -4
- package/build/styles/inputs/Input.css +0 -1
- package/build/styles/inputs/TextArea.css +0 -1
- package/build/styles/main.css +26 -13
- package/build/styles/nudge/Nudge.css +0 -3
- package/build/types/accordion/Accordion.d.ts +1 -0
- package/build/types/accordion/Accordion.d.ts.map +1 -1
- package/build/types/accordion/AccordionItem/AccordionItem.d.ts +3 -0
- package/build/types/accordion/AccordionItem/AccordionItem.d.ts.map +1 -1
- package/build/types/inputs/SelectInput.d.ts +6 -3
- package/build/types/inputs/SelectInput.d.ts.map +1 -1
- package/build/types/inputs/_BottomSheet.d.ts +2 -1
- package/build/types/inputs/_BottomSheet.d.ts.map +1 -1
- package/build/types/inputs/_Popover.d.ts +2 -1
- package/build/types/inputs/_Popover.d.ts.map +1 -1
- package/build/types/moneyInput/MoneyInput.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/accordion/Accordion.story.tsx +8 -0
- package/src/accordion/Accordion.tsx +2 -0
- package/src/accordion/AccordionItem/AccordionItem.tsx +5 -0
- package/src/common/card/Card.css +0 -4
- package/src/criticalBanner/CriticalCommsBanner.css +0 -1
- package/src/flowNavigation/FlowNavigation.css +26 -4
- package/src/inputs/Input.css +0 -1
- package/src/inputs/SelectInput.spec.tsx +52 -3
- package/src/inputs/SelectInput.story.tsx +1 -1
- package/src/inputs/SelectInput.tsx +36 -15
- package/src/inputs/TextArea.css +0 -1
- package/src/inputs/_BottomSheet.tsx +3 -0
- package/src/inputs/_Popover.tsx +3 -0
- package/src/main.css +26 -13
- package/src/moneyInput/MoneyInput.js +3 -1
- package/src/moneyInput/MoneyInput.spec.js +4 -1
- package/src/nudge/Nudge.css +0 -3
package/build/index.js
CHANGED
|
@@ -675,6 +675,7 @@ const AccordionItem = ({
|
|
|
675
675
|
'aria-label': ariaLabel,
|
|
676
676
|
id,
|
|
677
677
|
title,
|
|
678
|
+
subtitle,
|
|
678
679
|
content,
|
|
679
680
|
onClick,
|
|
680
681
|
open,
|
|
@@ -696,6 +697,7 @@ const AccordionItem = ({
|
|
|
696
697
|
as: "button",
|
|
697
698
|
media: iconElement,
|
|
698
699
|
title: title,
|
|
700
|
+
content: subtitle,
|
|
699
701
|
button: /*#__PURE__*/jsxRuntime.jsx(Chevron, {
|
|
700
702
|
orientation: open ? exports.Position.TOP : exports.Position.BOTTOM,
|
|
701
703
|
size: exports.Size.MEDIUM
|
|
@@ -745,6 +747,7 @@ const Accordion = ({
|
|
|
745
747
|
children: items.map((item, index) => /*#__PURE__*/jsxRuntime.jsx(AccordionItem, {
|
|
746
748
|
open: itemsOpen[index],
|
|
747
749
|
title: item.title,
|
|
750
|
+
subtitle: item.subtitle,
|
|
748
751
|
content: item.content,
|
|
749
752
|
icon: item.icon,
|
|
750
753
|
onClick: () => handleOnClick(index)
|
|
@@ -6511,7 +6514,8 @@ function BottomSheet({
|
|
|
6511
6514
|
initialFocusRef,
|
|
6512
6515
|
padding = 'md',
|
|
6513
6516
|
children,
|
|
6514
|
-
onClose
|
|
6517
|
+
onClose,
|
|
6518
|
+
onCloseEnd
|
|
6515
6519
|
}) {
|
|
6516
6520
|
const {
|
|
6517
6521
|
refs,
|
|
@@ -6550,6 +6554,7 @@ function BottomSheet({
|
|
|
6550
6554
|
beforeEnter: () => {
|
|
6551
6555
|
setFloatingKey(prev => prev + 1);
|
|
6552
6556
|
},
|
|
6557
|
+
afterLeave: onCloseEnd,
|
|
6553
6558
|
children: /*#__PURE__*/jsxRuntime.jsxs(FocusBoundary, {
|
|
6554
6559
|
children: [/*#__PURE__*/jsxRuntime.jsx(react$1.Transition.Child, {
|
|
6555
6560
|
enter: "np-bottom-sheet-v2-backdrop-container--enter",
|
|
@@ -6640,7 +6645,8 @@ function Popover({
|
|
|
6640
6645
|
size = 'md',
|
|
6641
6646
|
padding = 'md',
|
|
6642
6647
|
children,
|
|
6643
|
-
onClose
|
|
6648
|
+
onClose,
|
|
6649
|
+
onCloseEnd
|
|
6644
6650
|
}) {
|
|
6645
6651
|
const {
|
|
6646
6652
|
refs,
|
|
@@ -6697,6 +6703,7 @@ function Popover({
|
|
|
6697
6703
|
beforeEnter: () => {
|
|
6698
6704
|
setFloatingKey(prev => prev + 1);
|
|
6699
6705
|
},
|
|
6706
|
+
afterLeave: onCloseEnd,
|
|
6700
6707
|
children: /*#__PURE__*/jsxRuntime.jsx(FocusBoundary, {
|
|
6701
6708
|
children: /*#__PURE__*/jsxRuntime.jsx(react.FloatingFocusManager, {
|
|
6702
6709
|
context: context,
|
|
@@ -6850,6 +6857,7 @@ function SelectInputClearButton({
|
|
|
6850
6857
|
})
|
|
6851
6858
|
});
|
|
6852
6859
|
}
|
|
6860
|
+
const noop = () => {};
|
|
6853
6861
|
function SelectInput({
|
|
6854
6862
|
name,
|
|
6855
6863
|
placeholder,
|
|
@@ -6865,11 +6873,19 @@ function SelectInput({
|
|
|
6865
6873
|
disabled,
|
|
6866
6874
|
size = 'md',
|
|
6867
6875
|
className,
|
|
6876
|
+
onFilterChange = noop,
|
|
6868
6877
|
onChange,
|
|
6869
|
-
onSearchChange,
|
|
6870
6878
|
onClear
|
|
6871
6879
|
}) {
|
|
6872
6880
|
const [open, setOpen] = React.useState(false);
|
|
6881
|
+
const [filterQuery, _setFilterQuery] = React.useState('');
|
|
6882
|
+
const setFilterQuery = useEffectEvent(query => {
|
|
6883
|
+
_setFilterQuery(query);
|
|
6884
|
+
onFilterChange({
|
|
6885
|
+
query,
|
|
6886
|
+
queryNormalized: query ? searchableString(query) : null
|
|
6887
|
+
});
|
|
6888
|
+
});
|
|
6873
6889
|
const triggerRef = React.useRef(null);
|
|
6874
6890
|
const screenSm = useScreenSize(exports.Breakpoint.SMALL);
|
|
6875
6891
|
const OptionsOverlay = screenSm ? Popover : BottomSheet;
|
|
@@ -6936,6 +6952,11 @@ function SelectInput({
|
|
|
6936
6952
|
onClose: () => {
|
|
6937
6953
|
setOpen(false);
|
|
6938
6954
|
},
|
|
6955
|
+
onCloseEnd: () => {
|
|
6956
|
+
if (filterQuery !== '') {
|
|
6957
|
+
setFilterQuery('');
|
|
6958
|
+
}
|
|
6959
|
+
},
|
|
6939
6960
|
children: /*#__PURE__*/jsxRuntime.jsx(SelectInputOptions, {
|
|
6940
6961
|
items: items,
|
|
6941
6962
|
renderValue: renderValue,
|
|
@@ -6944,7 +6965,8 @@ function SelectInput({
|
|
|
6944
6965
|
filterPlaceholder: filterPlaceholder,
|
|
6945
6966
|
searchInputRef: searchInputRef,
|
|
6946
6967
|
listboxRef: listboxRef,
|
|
6947
|
-
|
|
6968
|
+
filterQuery: filterQuery,
|
|
6969
|
+
onFilterChange: setFilterQuery
|
|
6948
6970
|
})
|
|
6949
6971
|
})
|
|
6950
6972
|
});
|
|
@@ -7015,17 +7037,17 @@ function SelectInputOptions({
|
|
|
7015
7037
|
filterPlaceholder,
|
|
7016
7038
|
searchInputRef,
|
|
7017
7039
|
listboxRef,
|
|
7018
|
-
|
|
7040
|
+
filterQuery,
|
|
7041
|
+
onFilterChange
|
|
7019
7042
|
}) {
|
|
7020
7043
|
const intl = reactIntl.useIntl();
|
|
7021
7044
|
const controllerRef = filterable ? searchInputRef : listboxRef;
|
|
7022
|
-
const [query, setQuery] = React.useState('');
|
|
7023
7045
|
const needle = React.useMemo(() => {
|
|
7024
7046
|
if (filterable) {
|
|
7025
|
-
return
|
|
7047
|
+
return filterQuery ? searchableString(filterQuery) : null;
|
|
7026
7048
|
}
|
|
7027
7049
|
return undefined;
|
|
7028
|
-
}, [
|
|
7050
|
+
}, [filterQuery, filterable]);
|
|
7029
7051
|
const resultsEmpty = needle != null && filterSelectInputItems(items, needle).length === 0;
|
|
7030
7052
|
const listboxContainerRef = React.useRef(null);
|
|
7031
7053
|
React.useEffect(() => {
|
|
@@ -7046,6 +7068,13 @@ function SelectInputOptions({
|
|
|
7046
7068
|
controllerRef.current.setAttribute('aria-activedescendant', value);
|
|
7047
7069
|
} else {
|
|
7048
7070
|
controllerRef.current.removeAttribute('aria-activedescendant');
|
|
7071
|
+
if (filterQuery) {
|
|
7072
|
+
// Ensure having an active option while filtering
|
|
7073
|
+
controllerRef.current.dispatchEvent(new KeyboardEvent('keydown', {
|
|
7074
|
+
key: 'Home',
|
|
7075
|
+
bubbles: true
|
|
7076
|
+
}));
|
|
7077
|
+
}
|
|
7049
7078
|
}
|
|
7050
7079
|
}
|
|
7051
7080
|
},
|
|
@@ -7055,7 +7084,7 @@ function SelectInputOptions({
|
|
|
7055
7084
|
ref: searchInputRef,
|
|
7056
7085
|
shape: "rectangle",
|
|
7057
7086
|
placeholder: filterPlaceholder,
|
|
7058
|
-
value:
|
|
7087
|
+
value: filterQuery,
|
|
7059
7088
|
"aria-controls": listboxId,
|
|
7060
7089
|
"aria-describedby": showStatus ? statusId : undefined,
|
|
7061
7090
|
onKeyDown: event => {
|
|
@@ -7066,10 +7095,7 @@ function SelectInputOptions({
|
|
|
7066
7095
|
}
|
|
7067
7096
|
},
|
|
7068
7097
|
onChange: event => {
|
|
7069
|
-
|
|
7070
|
-
if (onSearchChange) {
|
|
7071
|
-
onSearchChange(event.currentTarget.value);
|
|
7072
|
-
}
|
|
7098
|
+
onFilterChange(event.currentTarget.value);
|
|
7073
7099
|
}
|
|
7074
7100
|
})
|
|
7075
7101
|
}) : null, /*#__PURE__*/jsxRuntime.jsxs("section", {
|
|
@@ -7108,7 +7134,7 @@ function SelectInputOptions({
|
|
|
7108
7134
|
},
|
|
7109
7135
|
children: renderFooter({
|
|
7110
7136
|
resultsEmpty,
|
|
7111
|
-
|
|
7137
|
+
queryNormalized: needle
|
|
7112
7138
|
})
|
|
7113
7139
|
})
|
|
7114
7140
|
}) : null]
|
|
@@ -8120,7 +8146,11 @@ class MoneyInput extends React.Component {
|
|
|
8120
8146
|
disabled: disabled,
|
|
8121
8147
|
size: size,
|
|
8122
8148
|
onChange: this.handleSelectChange,
|
|
8123
|
-
|
|
8149
|
+
onFilterChange: ({
|
|
8150
|
+
queryNormalized
|
|
8151
|
+
}) => {
|
|
8152
|
+
this.handleSearchChange(queryNormalized ?? '');
|
|
8153
|
+
},
|
|
8124
8154
|
...selectProps
|
|
8125
8155
|
})
|
|
8126
8156
|
})]
|