@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.esm.js
CHANGED
|
@@ -641,6 +641,7 @@ const AccordionItem = ({
|
|
|
641
641
|
'aria-label': ariaLabel,
|
|
642
642
|
id,
|
|
643
643
|
title,
|
|
644
|
+
subtitle,
|
|
644
645
|
content,
|
|
645
646
|
onClick,
|
|
646
647
|
open,
|
|
@@ -662,6 +663,7 @@ const AccordionItem = ({
|
|
|
662
663
|
as: "button",
|
|
663
664
|
media: iconElement,
|
|
664
665
|
title: title,
|
|
666
|
+
content: subtitle,
|
|
665
667
|
button: /*#__PURE__*/jsx(Chevron, {
|
|
666
668
|
orientation: open ? Position.TOP : Position.BOTTOM,
|
|
667
669
|
size: Size.MEDIUM
|
|
@@ -711,6 +713,7 @@ const Accordion = ({
|
|
|
711
713
|
children: items.map((item, index) => /*#__PURE__*/jsx(AccordionItem, {
|
|
712
714
|
open: itemsOpen[index],
|
|
713
715
|
title: item.title,
|
|
716
|
+
subtitle: item.subtitle,
|
|
714
717
|
content: item.content,
|
|
715
718
|
icon: item.icon,
|
|
716
719
|
onClick: () => handleOnClick(index)
|
|
@@ -6477,7 +6480,8 @@ function BottomSheet({
|
|
|
6477
6480
|
initialFocusRef,
|
|
6478
6481
|
padding = 'md',
|
|
6479
6482
|
children,
|
|
6480
|
-
onClose
|
|
6483
|
+
onClose,
|
|
6484
|
+
onCloseEnd
|
|
6481
6485
|
}) {
|
|
6482
6486
|
const {
|
|
6483
6487
|
refs,
|
|
@@ -6516,6 +6520,7 @@ function BottomSheet({
|
|
|
6516
6520
|
beforeEnter: () => {
|
|
6517
6521
|
setFloatingKey(prev => prev + 1);
|
|
6518
6522
|
},
|
|
6523
|
+
afterLeave: onCloseEnd,
|
|
6519
6524
|
children: /*#__PURE__*/jsxs(FocusBoundary, {
|
|
6520
6525
|
children: [/*#__PURE__*/jsx(Transition.Child, {
|
|
6521
6526
|
enter: "np-bottom-sheet-v2-backdrop-container--enter",
|
|
@@ -6606,7 +6611,8 @@ function Popover({
|
|
|
6606
6611
|
size: size$1 = 'md',
|
|
6607
6612
|
padding = 'md',
|
|
6608
6613
|
children,
|
|
6609
|
-
onClose
|
|
6614
|
+
onClose,
|
|
6615
|
+
onCloseEnd
|
|
6610
6616
|
}) {
|
|
6611
6617
|
const {
|
|
6612
6618
|
refs,
|
|
@@ -6663,6 +6669,7 @@ function Popover({
|
|
|
6663
6669
|
beforeEnter: () => {
|
|
6664
6670
|
setFloatingKey(prev => prev + 1);
|
|
6665
6671
|
},
|
|
6672
|
+
afterLeave: onCloseEnd,
|
|
6666
6673
|
children: /*#__PURE__*/jsx(FocusBoundary, {
|
|
6667
6674
|
children: /*#__PURE__*/jsx(FloatingFocusManager, {
|
|
6668
6675
|
context: context,
|
|
@@ -6816,6 +6823,7 @@ function SelectInputClearButton({
|
|
|
6816
6823
|
})
|
|
6817
6824
|
});
|
|
6818
6825
|
}
|
|
6826
|
+
const noop = () => {};
|
|
6819
6827
|
function SelectInput({
|
|
6820
6828
|
name,
|
|
6821
6829
|
placeholder,
|
|
@@ -6831,11 +6839,19 @@ function SelectInput({
|
|
|
6831
6839
|
disabled,
|
|
6832
6840
|
size = 'md',
|
|
6833
6841
|
className,
|
|
6842
|
+
onFilterChange = noop,
|
|
6834
6843
|
onChange,
|
|
6835
|
-
onSearchChange,
|
|
6836
6844
|
onClear
|
|
6837
6845
|
}) {
|
|
6838
6846
|
const [open, setOpen] = useState(false);
|
|
6847
|
+
const [filterQuery, _setFilterQuery] = useState('');
|
|
6848
|
+
const setFilterQuery = useEffectEvent(query => {
|
|
6849
|
+
_setFilterQuery(query);
|
|
6850
|
+
onFilterChange({
|
|
6851
|
+
query,
|
|
6852
|
+
queryNormalized: query ? searchableString(query) : null
|
|
6853
|
+
});
|
|
6854
|
+
});
|
|
6839
6855
|
const triggerRef = useRef(null);
|
|
6840
6856
|
const screenSm = useScreenSize(Breakpoint.SMALL);
|
|
6841
6857
|
const OptionsOverlay = screenSm ? Popover : BottomSheet;
|
|
@@ -6902,6 +6918,11 @@ function SelectInput({
|
|
|
6902
6918
|
onClose: () => {
|
|
6903
6919
|
setOpen(false);
|
|
6904
6920
|
},
|
|
6921
|
+
onCloseEnd: () => {
|
|
6922
|
+
if (filterQuery !== '') {
|
|
6923
|
+
setFilterQuery('');
|
|
6924
|
+
}
|
|
6925
|
+
},
|
|
6905
6926
|
children: /*#__PURE__*/jsx(SelectInputOptions, {
|
|
6906
6927
|
items: items,
|
|
6907
6928
|
renderValue: renderValue,
|
|
@@ -6910,7 +6931,8 @@ function SelectInput({
|
|
|
6910
6931
|
filterPlaceholder: filterPlaceholder,
|
|
6911
6932
|
searchInputRef: searchInputRef,
|
|
6912
6933
|
listboxRef: listboxRef,
|
|
6913
|
-
|
|
6934
|
+
filterQuery: filterQuery,
|
|
6935
|
+
onFilterChange: setFilterQuery
|
|
6914
6936
|
})
|
|
6915
6937
|
})
|
|
6916
6938
|
});
|
|
@@ -6981,17 +7003,17 @@ function SelectInputOptions({
|
|
|
6981
7003
|
filterPlaceholder,
|
|
6982
7004
|
searchInputRef,
|
|
6983
7005
|
listboxRef,
|
|
6984
|
-
|
|
7006
|
+
filterQuery,
|
|
7007
|
+
onFilterChange
|
|
6985
7008
|
}) {
|
|
6986
7009
|
const intl = useIntl();
|
|
6987
7010
|
const controllerRef = filterable ? searchInputRef : listboxRef;
|
|
6988
|
-
const [query, setQuery] = useState('');
|
|
6989
7011
|
const needle = useMemo(() => {
|
|
6990
7012
|
if (filterable) {
|
|
6991
|
-
return
|
|
7013
|
+
return filterQuery ? searchableString(filterQuery) : null;
|
|
6992
7014
|
}
|
|
6993
7015
|
return undefined;
|
|
6994
|
-
}, [
|
|
7016
|
+
}, [filterQuery, filterable]);
|
|
6995
7017
|
const resultsEmpty = needle != null && filterSelectInputItems(items, needle).length === 0;
|
|
6996
7018
|
const listboxContainerRef = useRef(null);
|
|
6997
7019
|
useEffect(() => {
|
|
@@ -7012,6 +7034,13 @@ function SelectInputOptions({
|
|
|
7012
7034
|
controllerRef.current.setAttribute('aria-activedescendant', value);
|
|
7013
7035
|
} else {
|
|
7014
7036
|
controllerRef.current.removeAttribute('aria-activedescendant');
|
|
7037
|
+
if (filterQuery) {
|
|
7038
|
+
// Ensure having an active option while filtering
|
|
7039
|
+
controllerRef.current.dispatchEvent(new KeyboardEvent('keydown', {
|
|
7040
|
+
key: 'Home',
|
|
7041
|
+
bubbles: true
|
|
7042
|
+
}));
|
|
7043
|
+
}
|
|
7015
7044
|
}
|
|
7016
7045
|
}
|
|
7017
7046
|
},
|
|
@@ -7021,7 +7050,7 @@ function SelectInputOptions({
|
|
|
7021
7050
|
ref: searchInputRef,
|
|
7022
7051
|
shape: "rectangle",
|
|
7023
7052
|
placeholder: filterPlaceholder,
|
|
7024
|
-
value:
|
|
7053
|
+
value: filterQuery,
|
|
7025
7054
|
"aria-controls": listboxId,
|
|
7026
7055
|
"aria-describedby": showStatus ? statusId : undefined,
|
|
7027
7056
|
onKeyDown: event => {
|
|
@@ -7032,10 +7061,7 @@ function SelectInputOptions({
|
|
|
7032
7061
|
}
|
|
7033
7062
|
},
|
|
7034
7063
|
onChange: event => {
|
|
7035
|
-
|
|
7036
|
-
if (onSearchChange) {
|
|
7037
|
-
onSearchChange(event.currentTarget.value);
|
|
7038
|
-
}
|
|
7064
|
+
onFilterChange(event.currentTarget.value);
|
|
7039
7065
|
}
|
|
7040
7066
|
})
|
|
7041
7067
|
}) : null, /*#__PURE__*/jsxs("section", {
|
|
@@ -7074,7 +7100,7 @@ function SelectInputOptions({
|
|
|
7074
7100
|
},
|
|
7075
7101
|
children: renderFooter({
|
|
7076
7102
|
resultsEmpty,
|
|
7077
|
-
|
|
7103
|
+
queryNormalized: needle
|
|
7078
7104
|
})
|
|
7079
7105
|
})
|
|
7080
7106
|
}) : null]
|
|
@@ -8086,7 +8112,11 @@ class MoneyInput extends Component {
|
|
|
8086
8112
|
disabled: disabled,
|
|
8087
8113
|
size: size,
|
|
8088
8114
|
onChange: this.handleSelectChange,
|
|
8089
|
-
|
|
8115
|
+
onFilterChange: ({
|
|
8116
|
+
queryNormalized
|
|
8117
|
+
}) => {
|
|
8118
|
+
this.handleSearchChange(queryNormalized ?? '');
|
|
8119
|
+
},
|
|
8090
8120
|
...selectProps
|
|
8091
8121
|
})
|
|
8092
8122
|
})]
|