@transferwise/components 0.0.0-experimental-b089b8c → 0.0.0-experimental-c5b4324
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 +35 -15
- package/build/index.esm.js.map +1 -1
- package/build/index.js +35 -15
- package/build/index.js.map +1 -1
- package/build/main.css +26 -4
- package/build/styles/flowNavigation/FlowNavigation.css +26 -4
- package/build/styles/main.css +26 -4
- 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 +3 -3
- package/src/flowNavigation/FlowNavigation.css +26 -4
- package/src/inputs/SelectInput.spec.tsx +52 -3
- package/src/inputs/SelectInput.story.tsx +1 -1
- package/src/inputs/SelectInput.tsx +30 -15
- package/src/inputs/_BottomSheet.tsx +3 -0
- package/src/inputs/_Popover.tsx +3 -0
- package/src/main.css +26 -4
- package/src/moneyInput/MoneyInput.js +3 -1
- package/src/moneyInput/MoneyInput.spec.js +4 -1
package/build/index.esm.js
CHANGED
|
@@ -6477,7 +6477,8 @@ function BottomSheet({
|
|
|
6477
6477
|
initialFocusRef,
|
|
6478
6478
|
padding = 'md',
|
|
6479
6479
|
children,
|
|
6480
|
-
onClose
|
|
6480
|
+
onClose,
|
|
6481
|
+
onCloseEnd
|
|
6481
6482
|
}) {
|
|
6482
6483
|
const {
|
|
6483
6484
|
refs,
|
|
@@ -6516,6 +6517,7 @@ function BottomSheet({
|
|
|
6516
6517
|
beforeEnter: () => {
|
|
6517
6518
|
setFloatingKey(prev => prev + 1);
|
|
6518
6519
|
},
|
|
6520
|
+
afterLeave: onCloseEnd,
|
|
6519
6521
|
children: /*#__PURE__*/jsxs(FocusBoundary, {
|
|
6520
6522
|
children: [/*#__PURE__*/jsx(Transition.Child, {
|
|
6521
6523
|
enter: "np-bottom-sheet-v2-backdrop-container--enter",
|
|
@@ -6606,7 +6608,8 @@ function Popover({
|
|
|
6606
6608
|
size: size$1 = 'md',
|
|
6607
6609
|
padding = 'md',
|
|
6608
6610
|
children,
|
|
6609
|
-
onClose
|
|
6611
|
+
onClose,
|
|
6612
|
+
onCloseEnd
|
|
6610
6613
|
}) {
|
|
6611
6614
|
const {
|
|
6612
6615
|
refs,
|
|
@@ -6663,6 +6666,7 @@ function Popover({
|
|
|
6663
6666
|
beforeEnter: () => {
|
|
6664
6667
|
setFloatingKey(prev => prev + 1);
|
|
6665
6668
|
},
|
|
6669
|
+
afterLeave: onCloseEnd,
|
|
6666
6670
|
children: /*#__PURE__*/jsx(FocusBoundary, {
|
|
6667
6671
|
children: /*#__PURE__*/jsx(FloatingFocusManager, {
|
|
6668
6672
|
context: context,
|
|
@@ -6816,6 +6820,7 @@ function SelectInputClearButton({
|
|
|
6816
6820
|
})
|
|
6817
6821
|
});
|
|
6818
6822
|
}
|
|
6823
|
+
const noop = () => {};
|
|
6819
6824
|
function SelectInput({
|
|
6820
6825
|
name,
|
|
6821
6826
|
placeholder,
|
|
@@ -6831,11 +6836,19 @@ function SelectInput({
|
|
|
6831
6836
|
disabled,
|
|
6832
6837
|
size = 'md',
|
|
6833
6838
|
className,
|
|
6839
|
+
onFilterChange = noop,
|
|
6834
6840
|
onChange,
|
|
6835
|
-
onSearchChange,
|
|
6836
6841
|
onClear
|
|
6837
6842
|
}) {
|
|
6838
6843
|
const [open, setOpen] = useState(false);
|
|
6844
|
+
const [filterQuery, _setFilterQuery] = useState('');
|
|
6845
|
+
const setFilterQuery = useEffectEvent(query => {
|
|
6846
|
+
_setFilterQuery(query);
|
|
6847
|
+
onFilterChange({
|
|
6848
|
+
query,
|
|
6849
|
+
queryNormalized: query ? searchableString(query) : null
|
|
6850
|
+
});
|
|
6851
|
+
});
|
|
6839
6852
|
const triggerRef = useRef(null);
|
|
6840
6853
|
const screenSm = useScreenSize(Breakpoint.SMALL);
|
|
6841
6854
|
const OptionsOverlay = screenSm ? Popover : BottomSheet;
|
|
@@ -6902,6 +6915,11 @@ function SelectInput({
|
|
|
6902
6915
|
onClose: () => {
|
|
6903
6916
|
setOpen(false);
|
|
6904
6917
|
},
|
|
6918
|
+
onCloseEnd: () => {
|
|
6919
|
+
if (filterQuery !== '') {
|
|
6920
|
+
setFilterQuery('');
|
|
6921
|
+
}
|
|
6922
|
+
},
|
|
6905
6923
|
children: /*#__PURE__*/jsx(SelectInputOptions, {
|
|
6906
6924
|
items: items,
|
|
6907
6925
|
renderValue: renderValue,
|
|
@@ -6910,7 +6928,8 @@ function SelectInput({
|
|
|
6910
6928
|
filterPlaceholder: filterPlaceholder,
|
|
6911
6929
|
searchInputRef: searchInputRef,
|
|
6912
6930
|
listboxRef: listboxRef,
|
|
6913
|
-
|
|
6931
|
+
filterQuery: filterQuery,
|
|
6932
|
+
onFilterChange: setFilterQuery
|
|
6914
6933
|
})
|
|
6915
6934
|
})
|
|
6916
6935
|
});
|
|
@@ -6981,17 +7000,17 @@ function SelectInputOptions({
|
|
|
6981
7000
|
filterPlaceholder,
|
|
6982
7001
|
searchInputRef,
|
|
6983
7002
|
listboxRef,
|
|
6984
|
-
|
|
7003
|
+
filterQuery,
|
|
7004
|
+
onFilterChange
|
|
6985
7005
|
}) {
|
|
6986
7006
|
const intl = useIntl();
|
|
6987
7007
|
const controllerRef = filterable ? searchInputRef : listboxRef;
|
|
6988
|
-
const [query, setQuery] = useState('');
|
|
6989
7008
|
const needle = useMemo(() => {
|
|
6990
7009
|
if (filterable) {
|
|
6991
|
-
return
|
|
7010
|
+
return filterQuery ? searchableString(filterQuery) : null;
|
|
6992
7011
|
}
|
|
6993
7012
|
return undefined;
|
|
6994
|
-
}, [
|
|
7013
|
+
}, [filterQuery, filterable]);
|
|
6995
7014
|
const resultsEmpty = needle != null && filterSelectInputItems(items, needle).length === 0;
|
|
6996
7015
|
const listboxContainerRef = useRef(null);
|
|
6997
7016
|
useEffect(() => {
|
|
@@ -7021,7 +7040,7 @@ function SelectInputOptions({
|
|
|
7021
7040
|
ref: searchInputRef,
|
|
7022
7041
|
shape: "rectangle",
|
|
7023
7042
|
placeholder: filterPlaceholder,
|
|
7024
|
-
value:
|
|
7043
|
+
value: filterQuery,
|
|
7025
7044
|
"aria-controls": listboxId,
|
|
7026
7045
|
"aria-describedby": showStatus ? statusId : undefined,
|
|
7027
7046
|
onKeyDown: event => {
|
|
@@ -7032,10 +7051,7 @@ function SelectInputOptions({
|
|
|
7032
7051
|
}
|
|
7033
7052
|
},
|
|
7034
7053
|
onChange: event => {
|
|
7035
|
-
|
|
7036
|
-
if (onSearchChange) {
|
|
7037
|
-
onSearchChange(event.currentTarget.value);
|
|
7038
|
-
}
|
|
7054
|
+
onFilterChange(event.currentTarget.value);
|
|
7039
7055
|
}
|
|
7040
7056
|
})
|
|
7041
7057
|
}) : null, /*#__PURE__*/jsxs("section", {
|
|
@@ -7074,7 +7090,7 @@ function SelectInputOptions({
|
|
|
7074
7090
|
},
|
|
7075
7091
|
children: renderFooter({
|
|
7076
7092
|
resultsEmpty,
|
|
7077
|
-
|
|
7093
|
+
queryNormalized: needle
|
|
7078
7094
|
})
|
|
7079
7095
|
})
|
|
7080
7096
|
}) : null]
|
|
@@ -8086,7 +8102,11 @@ class MoneyInput extends Component {
|
|
|
8086
8102
|
disabled: disabled,
|
|
8087
8103
|
size: size,
|
|
8088
8104
|
onChange: this.handleSelectChange,
|
|
8089
|
-
|
|
8105
|
+
onFilterChange: ({
|
|
8106
|
+
queryNormalized
|
|
8107
|
+
}) => {
|
|
8108
|
+
this.handleSearchChange(queryNormalized ?? '');
|
|
8109
|
+
},
|
|
8090
8110
|
...selectProps
|
|
8091
8111
|
})
|
|
8092
8112
|
})]
|