fix: InputSelect disabled state
This commit is contained in:
@@ -35,7 +35,7 @@ const RealButton = styled.button`
|
|||||||
border: 0;
|
border: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
&:hover {
|
&:hover:not(:disabled) {
|
||||||
background: ${(props) => darken(0.05, props.theme.buttonBackground)};
|
background: ${(props) => darken(0.05, props.theme.buttonBackground)};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -43,6 +43,10 @@ const RealButton = styled.button`
|
|||||||
cursor: default;
|
cursor: default;
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
color: ${(props) => props.theme.white50};
|
color: ${(props) => props.theme.white50};
|
||||||
|
|
||||||
|
svg {
|
||||||
|
fill: ${(props) => props.theme.white50};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
${(props) =>
|
${(props) =>
|
||||||
@@ -65,7 +69,7 @@ const RealButton = styled.button`
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
&:hover {
|
&:hover:not(:disabled) {
|
||||||
background: ${
|
background: ${
|
||||||
props.borderOnHover
|
props.borderOnHover
|
||||||
? props.theme.buttonNeutralBackground
|
? props.theme.buttonNeutralBackground
|
||||||
@@ -78,6 +82,10 @@ const RealButton = styled.button`
|
|||||||
|
|
||||||
&:disabled {
|
&:disabled {
|
||||||
color: ${props.theme.textTertiary};
|
color: ${props.theme.textTertiary};
|
||||||
|
|
||||||
|
svg {
|
||||||
|
fill: ${props.theme.textTertiary};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
`} ${(props) =>
|
`} ${(props) =>
|
||||||
props.danger &&
|
props.danger &&
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ export type Props = {
|
|||||||
nude?: boolean,
|
nude?: boolean,
|
||||||
ariaLabel: string,
|
ariaLabel: string,
|
||||||
short?: boolean,
|
short?: boolean,
|
||||||
|
disabled?: boolean,
|
||||||
className?: string,
|
className?: string,
|
||||||
labelHidden?: boolean,
|
labelHidden?: boolean,
|
||||||
options: Option[],
|
options: Option[],
|
||||||
@@ -44,6 +45,7 @@ const InputSelect = (props: Props) => {
|
|||||||
short,
|
short,
|
||||||
ariaLabel,
|
ariaLabel,
|
||||||
onChange,
|
onChange,
|
||||||
|
disabled,
|
||||||
nude,
|
nude,
|
||||||
} = props;
|
} = props;
|
||||||
|
|
||||||
@@ -57,6 +59,7 @@ const InputSelect = (props: Props) => {
|
|||||||
...select,
|
...select,
|
||||||
hideOnClickOutside: true,
|
hideOnClickOutside: true,
|
||||||
preventBodyScroll: true,
|
preventBodyScroll: true,
|
||||||
|
disabled,
|
||||||
});
|
});
|
||||||
|
|
||||||
const previousValue = React.useRef(value);
|
const previousValue = React.useRef(value);
|
||||||
@@ -93,7 +96,12 @@ const InputSelect = (props: Props) => {
|
|||||||
) : (
|
) : (
|
||||||
wrappedLabel
|
wrappedLabel
|
||||||
))}
|
))}
|
||||||
<Select {...select} aria-label={ariaLabel} ref={buttonRef}>
|
<Select
|
||||||
|
{...select}
|
||||||
|
disabled={disabled}
|
||||||
|
aria-label={ariaLabel}
|
||||||
|
ref={buttonRef}
|
||||||
|
>
|
||||||
{(props) => (
|
{(props) => (
|
||||||
<StyledButton
|
<StyledButton
|
||||||
neutral
|
neutral
|
||||||
@@ -135,6 +143,7 @@ const InputSelect = (props: Props) => {
|
|||||||
{...select}
|
{...select}
|
||||||
value={option.value}
|
value={option.value}
|
||||||
key={option.value}
|
key={option.value}
|
||||||
|
animating={select.animating}
|
||||||
>
|
>
|
||||||
{select.selectedValue !== undefined && (
|
{select.selectedValue !== undefined && (
|
||||||
<>
|
<>
|
||||||
@@ -191,6 +200,12 @@ const StyledButton = styled(Button)`
|
|||||||
|
|
||||||
export const StyledSelectOption = styled(SelectOption)`
|
export const StyledSelectOption = styled(SelectOption)`
|
||||||
${MenuAnchorCSS}
|
${MenuAnchorCSS}
|
||||||
|
|
||||||
|
${(props) =>
|
||||||
|
props.animating &&
|
||||||
|
css`
|
||||||
|
pointer-events: none;
|
||||||
|
`}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const Wrapper = styled.label`
|
const Wrapper = styled.label`
|
||||||
|
|||||||
Reference in New Issue
Block a user