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