UNPKG

@chayns-components/core

Version:

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

99 lines (97 loc) 3.23 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.StyledTextAreaLabelWrapper = exports.StyledTextAreaLabel = exports.StyledTextAreaInput = exports.StyledTextAreaContentWrapper = exports.StyledTextAreaContent = exports.StyledTextArea = exports.StyledRightElementWrapper = void 0; var _styledComponents = _interopRequireDefault(require("styled-components")); var _react = require("motion/react"); var _keyboardFocusHighlighting = require("../../utils/keyboardFocusHighlighting.styles"); function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; } const StyledTextArea = exports.StyledTextArea = _styledComponents.default.div` display: flex; flex: 1 1 auto; min-width: 0; opacity: ${({ $isDisabled }) => $isDisabled ? 0.5 : 1}; position: relative; `; const StyledTextAreaContentWrapper = exports.StyledTextAreaContentWrapper = _styledComponents.default.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; ${_keyboardFocusHighlighting.keyboardFocusHighlightingRingCss} } } `; const StyledTextAreaContent = exports.StyledTextAreaContent = _styledComponents.default.div` position: relative; display: flex; width: 100%; `; const StyledTextAreaInput = exports.StyledTextAreaInput = _styledComponents.default.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; `; const StyledTextAreaLabelWrapper = exports.StyledTextAreaLabelWrapper = (0, _styledComponents.default)(_react.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; `; const StyledTextAreaLabel = exports.StyledTextAreaLabel = _styledComponents.default.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; `; const StyledRightElementWrapper = exports.StyledRightElementWrapper = _styledComponents.default.div` display: flex; justify-content: center; align-items: center; height: 100%; `; //# sourceMappingURL=TextArea.styles.js.map