DocSpace-client/packages/asc-web-components/input-with-chips/styled-inputwithchips.js

89 lines
1.7 KiB
JavaScript
Raw Normal View History

import styled from "styled-components";
import commonInputStyle from "../text-input/common-input-styles";
import Base from "../themes/base";
import TextInput from "../text-input";
const CHIPS_BORDER_RADIUS = "3px",
CHIPS_BACKGROUND = "#ECEEF1",
CHIPS_COLOR = "#333333";
const StyledChipWithInput = styled.div`
min-height: 32px;
max-height: 88px;
display: flex;
flex-wrap: wrap;
height: fit-content;
width: ${(props) => props.length === 0 && "100%"};
`;
const StyledContent = styled.div`
width: 469px;
height: 88px;
`;
const StyledChipGroup = styled.div`
height: fit-content;
${commonInputStyle} :focus-within {
border-color: ${(props) => props.theme.inputBlock.borderColor};
}
.scroll {
height: fit-content;
position: inherit !important;
display: flex;
flex-wrap: wrap;
}
input {
flex: 1 0 auto;
}
`;
StyledChipGroup.defaultProps = { theme: Base };
const StyledChip = styled.div`
width: fit-content;
display: flex;
align-items: center;
justify-content: center;
box-sizing: border-box;
background: ${CHIPS_BACKGROUND};
height: 20px;
margin: 4px;
padding: 2px 4px;
border-radius: ${CHIPS_BORDER_RADIUS} 0 0 ${CHIPS_BORDER_RADIUS};
border: ${(props) => props.isSelected && "1px dashed #000"};
.warning_icon_wrap {
cursor: pointer;
.warning_icon {
margin-right: 4px;
}
}
`;
const StyledChipValue = styled.div`
margin-right: 4px;
font-weight: normal;
font-size: 14px;
color: ${CHIPS_COLOR};
`;
const StyledChipInput = styled(TextInput)`
flex: 0 1 auto;
`;
export {
StyledChipWithInput,
StyledContent,
StyledChipGroup,
StyledChip,
StyledChipValue,
StyledChipInput,
};