UNPKG

@chayns-components/core

Version:

A set of beautiful React components for developing your own applications with chayns.

92 lines (91 loc) 2.44 kB
import styled from 'styled-components'; import { motion } from 'motion/react'; import { keyboardFocusHighlightingRingCss } from '../../utils/keyboardFocusHighlighting.styles'; export const StyledTextArea = styled.div` display: flex; flex: 1 1 auto; min-width: 0; opacity: ${({ $isDisabled }) => $isDisabled ? 0.5 : 1}; position: relative; `; export const StyledTextAreaContentWrapper = styled.div` background-color: ${({ theme, $shouldChangeColor, $backgroundColor }) => $backgroundColor ?? (theme.colorMode === 'classic' || $shouldChangeColor ? theme['000'] : theme['100'])}; border-radius: 3px; border: 1px solid ${({ theme, $isInvalid, $borderColor }) => $borderColor ?? ($isInvalid ? theme.wrong : 'rgba(160, 160, 160, 0.3)')}; width: 100%; display: flex; &[data-should-show-keyboard-highlighting='true'] { &:focus-within { transition: none; ${keyboardFocusHighlightingRingCss} } } `; export const StyledTextAreaContent = styled.div` position: relative; display: flex; width: 100%; `; export const StyledTextAreaInput = styled.textarea` color: ${({ theme, $isInvalid }) => $isInvalid ? theme.wrong : theme.text}; background: none; border: none; resize: none; overflow-y: ${({ $isOverflowing }) => $isOverflowing ? 'scroll' : 'hidden'}; max-height: ${({ $maxHeight }) => typeof $maxHeight === 'number' ? `${$maxHeight}px` : $maxHeight}; min-height: ${({ $minHeight }) => typeof $minHeight === 'number' ? `${$minHeight}px` : $minHeight}; width: 100%; padding: 8px 10px; cursor: text; `; export const StyledTextAreaLabelWrapper = styled(motion.label)` align-items: center; display: flex; flex: 0 0 auto; gap: 4px; line-height: 1.3; pointer-events: none; position: absolute; user-select: none; max-width: calc(100% - 20px); cursor: text; `; export const StyledTextAreaLabel = styled.label` color: ${({ theme, $isInvalid }) => $isInvalid ? theme.wrong : `rgba(${theme['text-rgb'] ?? ''}, 0.45)`}; line-height: 1.3; width: 100%; white-space: nowrap; overflow: hidden; cursor: text; text-overflow: ellipsis; `; export const StyledRightElementWrapper = styled.div` display: flex; justify-content: center; align-items: center; height: 100%; `; //# sourceMappingURL=TextArea.styles.js.map