@chayns-components/core
Version:
A set of beautiful React components for developing your own applications with chayns.
113 lines (108 loc) • 4.1 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.StyledTextAreaLabelWrapper = exports.StyledTextAreaLabel = exports.StyledTextAreaInput = exports.StyledTextAreaContentWrapper = exports.StyledTextAreaContent = exports.StyledTextArea = void 0;
var _styledComponents = _interopRequireWildcard(require("styled-components"));
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
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
}) => theme.colorMode === 'classic' || $shouldChangeColor ? theme['000'] : theme['100']};
border-radius: 3px;
border: 1px solid
${({
theme,
$isInvalid
}) => $isInvalid ? theme.wrong : 'rgba(160, 160, 160, 0.3)'};
width: 100%;
display: flex;
`;
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;
// Styles for custom scrollbar
${({
$browser,
theme
}) => $browser === 'firefox' ? (0, _styledComponents.css)`
scrollbar-color: rgba(${theme['text-rgb']}, 0.15) transparent;
scrollbar-width: thin;
` : (0, _styledComponents.css)`
&::-webkit-scrollbar {
width: 10px;
}
&::-webkit-scrollbar-track {
background-color: transparent;
}
&::-webkit-scrollbar-button {
background-color: transparent;
height: 5px;
}
&::-webkit-scrollbar-thumb {
background-color: rgba(${theme['text-rgb']}, 0.15);
border-radius: 20px;
background-clip: padding-box;
border: solid 3px transparent;
}
`}
`;
const StyledTextAreaLabelWrapper = exports.StyledTextAreaLabelWrapper = _styledComponents.default.label`
left: 10px;
top: 12px;
align-items: baseline;
display: flex;
flex: 0 0 auto;
gap: 4px;
line-height: 1.3;
pointer-events: none;
position: absolute;
user-select: none;
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;
`;
//# sourceMappingURL=TextArea.styles.js.map