@transferwise/components 45.19.6 → 45.20.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 +22 -12
- package/build/index.esm.js.map +1 -1
- package/build/index.js +22 -12
- package/build/index.js.map +1 -1
- package/build/main.css +1 -1
- package/build/styles/inputs/SelectInput.css +1 -1
- package/build/styles/main.css +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/_Popover.d.ts +2 -2
- package/build/types/inputs/_Popover.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/inputs/SelectInput.css +1 -1
- package/src/inputs/SelectInput.less +17 -7
- package/src/inputs/SelectInput.tsx +36 -11
- package/src/inputs/_Popover.tsx +2 -2
- package/src/main.css +1 -1
package/build/index.js
CHANGED
|
@@ -6631,7 +6631,13 @@ function inferSearchableStrings(value) {
|
|
|
6631
6631
|
}
|
|
6632
6632
|
return [];
|
|
6633
6633
|
}
|
|
6634
|
-
const
|
|
6634
|
+
const SelectInputItemCheckPaddingContext = /*#__PURE__*/React.createContext(false);
|
|
6635
|
+
function useSelectInputItemCheckPadding() {
|
|
6636
|
+
const checkPadding = React.useContext(SelectInputItemCheckPaddingContext);
|
|
6637
|
+
// Avoid layout shifts during transitions via caching
|
|
6638
|
+
const [initialCheckPadding] = React.useState(checkPadding);
|
|
6639
|
+
return initialCheckPadding;
|
|
6640
|
+
}
|
|
6635
6641
|
const SelectInputTriggerButtonPropsContext = /*#__PURE__*/React.createContext({});
|
|
6636
6642
|
const SelectInputOptionContentWithinTriggerContext = /*#__PURE__*/React.createContext(false);
|
|
6637
6643
|
function dedupeSelectInputOptionItem(item, existingValues) {
|
|
@@ -6758,9 +6764,10 @@ function SelectInput({
|
|
|
6758
6764
|
children: ({
|
|
6759
6765
|
disabled: uiDisabled,
|
|
6760
6766
|
value
|
|
6761
|
-
}) => /*#__PURE__*/jsxRuntime.jsx(
|
|
6762
|
-
value: value != null,
|
|
6767
|
+
}) => /*#__PURE__*/jsxRuntime.jsx(SelectInputItemCheckPaddingContext.Provider, {
|
|
6768
|
+
value: Boolean(filterable) || value != null,
|
|
6763
6769
|
children: /*#__PURE__*/jsxRuntime.jsx(OptionsOverlay, {
|
|
6770
|
+
placement: "bottom-start",
|
|
6764
6771
|
open: open,
|
|
6765
6772
|
renderTrigger: ({
|
|
6766
6773
|
ref,
|
|
@@ -6861,7 +6868,7 @@ const SelectInputOptionsContainer = /*#__PURE__*/React.forwardRef(function Selec
|
|
|
6861
6868
|
function SelectInputOptions({
|
|
6862
6869
|
items,
|
|
6863
6870
|
renderValue = wrapInFragment,
|
|
6864
|
-
filterable,
|
|
6871
|
+
filterable = false,
|
|
6865
6872
|
filterPlaceholder,
|
|
6866
6873
|
searchInputRef,
|
|
6867
6874
|
listboxRef
|
|
@@ -6977,6 +6984,7 @@ function SelectInputGroupItemView({
|
|
|
6977
6984
|
needle
|
|
6978
6985
|
}) {
|
|
6979
6986
|
const headerId = reactId.useId();
|
|
6987
|
+
const checkPadding = useSelectInputItemCheckPadding();
|
|
6980
6988
|
return (
|
|
6981
6989
|
/*#__PURE__*/
|
|
6982
6990
|
// An empty container may be rendered when no options match `needle`
|
|
@@ -6985,11 +6993,13 @@ function SelectInputGroupItemView({
|
|
|
6985
6993
|
role: "group",
|
|
6986
6994
|
"aria-labelledby": headerId,
|
|
6987
6995
|
className: classNames__default.default(needle === null && 'np-select-input-group-item--without-needle'),
|
|
6988
|
-
children: [needle == null ? /*#__PURE__*/jsxRuntime.
|
|
6996
|
+
children: [needle == null ? /*#__PURE__*/jsxRuntime.jsxs("header", {
|
|
6989
6997
|
id: headerId,
|
|
6990
6998
|
role: "presentation",
|
|
6991
6999
|
className: "np-select-input-group-item-header np-text-title-group",
|
|
6992
|
-
children:
|
|
7000
|
+
children: [checkPadding ? /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
7001
|
+
className: "np-select-input-option-check-placeholder"
|
|
7002
|
+
}) : null, item.label]
|
|
6993
7003
|
}) : null, item.options.map((option, index) => /*#__PURE__*/jsxRuntime.jsx(SelectInputItemView
|
|
6994
7004
|
// eslint-disable-next-line react/no-array-index-key
|
|
6995
7005
|
, {
|
|
@@ -7005,24 +7015,24 @@ function SelectInputOption({
|
|
|
7005
7015
|
disabled,
|
|
7006
7016
|
children
|
|
7007
7017
|
}) {
|
|
7018
|
+
const checkPadding = useSelectInputItemCheckPadding();
|
|
7008
7019
|
return /*#__PURE__*/jsxRuntime.jsx(react$1.Listbox.Option, {
|
|
7009
7020
|
as: "div",
|
|
7010
7021
|
value: value,
|
|
7011
7022
|
disabled: disabled,
|
|
7012
7023
|
className: ({
|
|
7013
7024
|
active,
|
|
7014
|
-
selected,
|
|
7015
7025
|
disabled: uiDisabled
|
|
7016
|
-
}) => classNames__default.default('np-select-input-option-container np-text-body-large', active && 'np-select-input-option-container--active',
|
|
7026
|
+
}) => classNames__default.default('np-select-input-option-container np-text-body-large', active && 'np-select-input-option-container--active', uiDisabled && 'np-select-input-option-container--disabled'),
|
|
7017
7027
|
children: ({
|
|
7018
7028
|
selected
|
|
7019
7029
|
}) => /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
7020
|
-
children: [/*#__PURE__*/jsxRuntime.jsx(
|
|
7030
|
+
children: [checkPadding ? /*#__PURE__*/jsxRuntime.jsx(icons.Check, {
|
|
7031
|
+
size: 16,
|
|
7032
|
+
className: classNames__default.default('np-select-input-option-check', !selected && 'np-select-input-option-check--not-selected')
|
|
7033
|
+
}) : null, /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
7021
7034
|
className: "np-select-input-option",
|
|
7022
7035
|
children: children
|
|
7023
|
-
}), selected && /*#__PURE__*/jsxRuntime.jsx(icons.Check, {
|
|
7024
|
-
size: 24,
|
|
7025
|
-
className: classNames__default.default('np-select-input-option-check')
|
|
7026
7036
|
})]
|
|
7027
7037
|
})
|
|
7028
7038
|
});
|