Fix select dropdown border issue. #5661

This commit is contained in:
Aditya Toshniwal 2023-01-09 18:42:48 +05:30 committed by GitHub
parent 1c705cf9be
commit 42220b1cb2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -774,6 +774,16 @@ OptionView.propTypes = {
label: PropTypes.string, label: PropTypes.string,
}; };
function CustomSelectInput(props) {
const { maxLength } = props.selectProps;
return (
<RSComponents.Input {...props} maxLength={maxLength} />
);
}
CustomSelectInput.propTypes = {
selectProps: PropTypes.object,
};
function CustomSelectOption(props) { function CustomSelectOption(props) {
return ( return (
<RSComponents.Option {...props}> <RSComponents.Option {...props}>
@ -918,9 +928,9 @@ export const InputSelect = forwardRef(({
components: { components: {
Option: CustomSelectOption, Option: CustomSelectOption,
SingleValue: CustomSelectSingleValue, SingleValue: CustomSelectSingleValue,
IndicatorSeparator: (props) => controlProps.noDropdown ? null: <RSComponents.IndicatorSeparator {...props} />, IndicatorSeparator: controlProps.noDropdown ? null: RSComponents.IndicatorSeparator,
DropdownIndicator: (props) => controlProps.noDropdown ? null: <RSComponents.DropdownIndicator {...props} />, DropdownIndicator: controlProps.noDropdown ? null: RSComponents.DropdownIndicator,
Input: props => <RSComponents.Input {...props} maxLength={controlProps.maxLength} /> Input: CustomSelectInput,
}, },
isMulti: Boolean(controlProps.multiple), isMulti: Boolean(controlProps.multiple),
openMenuOnClick: !readonly, openMenuOnClick: !readonly,
@ -932,6 +942,7 @@ export const InputSelect = forwardRef(({
styles: styles, styles: styles,
inputId: cid, inputId: cid,
placeholder: (readonly || disabled) ? '' : controlProps.placeholder || gettext('Select an item...'), placeholder: (readonly || disabled) ? '' : controlProps.placeholder || gettext('Select an item...'),
maxLength: controlProps.maxLength,
...otherProps, ...otherProps,
...props, ...props,
}; };