2021-02-08 14:20:47 +00:00
|
|
|
import styled from "styled-components";
|
2021-02-08 15:02:21 +00:00
|
|
|
import React from "react";
|
2021-02-08 14:20:47 +00:00
|
|
|
|
|
|
|
import commonInputStyle from "../text-input/common-input-styles";
|
2021-02-25 21:19:45 +00:00
|
|
|
import Base from "../themes/base";
|
2021-02-08 14:20:47 +00:00
|
|
|
|
|
|
|
const StyledIconBlock = styled.div`
|
|
|
|
display: ${(props) => props.theme.inputBlock.display};
|
|
|
|
align-items: ${(props) => props.theme.inputBlock.alignItems};
|
|
|
|
cursor: ${(props) =>
|
|
|
|
props.isDisabled || !props.isClickable ? "default" : "pointer"};
|
|
|
|
|
|
|
|
height: ${(props) => props.theme.inputBlock.height};
|
|
|
|
padding-right: ${(props) => props.theme.inputBlock.paddingRight};
|
|
|
|
padding-left: ${(props) => props.theme.inputBlock.paddingLeft};
|
|
|
|
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
|
|
|
|
`;
|
|
|
|
StyledIconBlock.defaultProps = { theme: Base };
|
|
|
|
|
|
|
|
const StyledChildrenBlock = styled.div`
|
|
|
|
display: ${(props) => props.theme.inputBlock.display};
|
|
|
|
align-items: ${(props) => props.theme.inputBlock.alignItems};
|
|
|
|
padding: ${(props) => props.theme.inputBlock.padding};
|
|
|
|
`;
|
|
|
|
StyledChildrenBlock.defaultProps = { theme: Base };
|
|
|
|
|
|
|
|
/* eslint-disable react/prop-types, no-unused-vars */
|
|
|
|
const CustomInputGroup = ({
|
|
|
|
isIconFill,
|
|
|
|
hasError,
|
|
|
|
hasWarning,
|
|
|
|
isDisabled,
|
|
|
|
scale,
|
|
|
|
...props
|
|
|
|
}) => <div {...props}></div>;
|
|
|
|
/* eslint-enable react/prop-types, no-unused-vars */
|
|
|
|
const StyledInputGroup = styled(CustomInputGroup)`
|
|
|
|
display: ${(props) => props.theme.inputBlock.display};
|
|
|
|
|
|
|
|
.prepend {
|
|
|
|
display: ${(props) => props.theme.inputBlock.display};
|
|
|
|
align-items: ${(props) => props.theme.inputBlock.alignItems};
|
|
|
|
}
|
|
|
|
|
|
|
|
.append {
|
|
|
|
align-items: ${(props) => props.theme.inputBlock.alignItems};
|
|
|
|
margin: ${(props) => props.theme.inputBlock.margin};
|
|
|
|
}
|
|
|
|
|
2022-01-24 09:09:26 +00:00
|
|
|
${commonInputStyle}
|
|
|
|
|
|
|
|
:focus-within {
|
|
|
|
border-color: ${(props) =>
|
|
|
|
(props.hasError && props.theme.input.focusErrorBorderColor) ||
|
|
|
|
props.theme.inputBlock.borderColor};
|
2021-02-08 14:20:47 +00:00
|
|
|
}
|
2021-12-12 13:07:10 +00:00
|
|
|
|
|
|
|
svg {
|
|
|
|
path {
|
|
|
|
fill: ${(props) =>
|
|
|
|
props.color
|
|
|
|
? props.color
|
|
|
|
: props.theme.inputBlock.iconColor} !important;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
&:hover {
|
|
|
|
svg {
|
|
|
|
path {
|
|
|
|
fill: ${(props) =>
|
|
|
|
props.hoverColor
|
|
|
|
? props.hoverColor
|
|
|
|
: props.theme.inputBlock.hoverIconColor} !important;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2021-02-08 14:20:47 +00:00
|
|
|
`;
|
|
|
|
StyledInputGroup.defaultProps = { theme: Base };
|
|
|
|
|
|
|
|
export { StyledInputGroup, StyledChildrenBlock, StyledIconBlock };
|