UNPKG

@chayns-components/core

Version:

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

158 lines (153 loc) 5.39 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.StyledMotionInputLabelWrapper = exports.StyledMotionInputElement = exports.StyledMotionInputClearIcon = exports.StyledInputRightElement = exports.StyledInputLabel = exports.StyledInputIconWrapper = exports.StyledInputField = exports.StyledInputContentWrapper = exports.StyledInputContent = exports.StyledInput = void 0; var _react = require("motion/react"); 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 StyledInput = exports.StyledInput = _styledComponents.default.div` opacity: ${({ $isDisabled }) => $isDisabled ? 0.5 : 1}; display: flex; width: 100%; `; const StyledInputContentWrapper = exports.StyledInputContentWrapper = _styledComponents.default.div` align-items: center; background-color: ${({ theme, $shouldChangeColor }) => theme.colorMode === 'classic' || $shouldChangeColor ? theme['000'] : theme['100']}; border: 1px solid ${({ theme, $isInvalid }) => $isInvalid ? theme.wrong : 'rgba(160, 160, 160, 0.3)'}; color: ${({ theme }) => theme['006']}; display: flex; justify-content: space-between; width: 100%; transition: opacity 0.3s ease; ${({ $size }) => $size === 'small' && (0, _styledComponents.css)` height: 32px; `} ${({ $shouldShowOnlyBottomBorder, $size }) => !$shouldShowOnlyBottomBorder && (0, _styledComponents.css)` min-height: ${$size === 'medium' ? '42px' : '32px'}; `} ${({ $shouldRoundRightCorners, $shouldShowOnlyBottomBorder, theme }) => { if ($shouldShowOnlyBottomBorder) { return (0, _styledComponents.css)` border-top: none; border-right: none; border-left: none; background-color: transparent; border-color: ${theme['408']}; `; } if ($shouldRoundRightCorners) { return (0, _styledComponents.css)` border-radius: 3px; `; } return (0, _styledComponents.css)` border-bottom-left-radius: 3px; border-top-left-radius: 3px; border-right: none; `; }} `; const StyledInputContent = exports.StyledInputContent = _styledComponents.default.div` display: flex; flex: 1 1 auto; min-width: 0; margin: ${({ $shouldShowOnlyBottomBorder }) => !$shouldShowOnlyBottomBorder ? '8px 10px' : '4px 0'}; position: relative; `; const StyledInputField = exports.StyledInputField = _styledComponents.default.input` background: none; border: none; color: ${({ theme, $isInvalid }) => $isInvalid ? theme.wrong : theme.text}; padding: 0; width: ${({ $placeholderWidth }) => `calc(100% - ${$placeholderWidth}px)`}; line-height: 1em; ${({ $shouldShowCenteredContent }) => $shouldShowCenteredContent && (0, _styledComponents.css)` text-align: center; `} `; const StyledMotionInputLabelWrapper = exports.StyledMotionInputLabelWrapper = (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: 100%; `; const StyledMotionInputElement = exports.StyledMotionInputElement = (0, _styledComponents.default)(_react.motion.div)` display: flex; `; const StyledInputLabel = exports.StyledInputLabel = _styledComponents.default.label` line-height: 1.3; pointer-events: none; width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: ${({ theme, $isInvalid }) => $isInvalid ? theme.wrong : `rgba(${theme['text-rgb'] ?? ''}, 0.45)`}; `; const StyledMotionInputClearIcon = exports.StyledMotionInputClearIcon = (0, _styledComponents.default)(_react.motion.div)` align-items: center; border-left: ${({ $shouldShowOnlyBottomBorder }) => $shouldShowOnlyBottomBorder ? 'none' : '1px solid rgba(160, 160, 160, 0.3)'}; cursor: pointer; display: flex; flex: 0 0 auto; height: ${({ $size }) => $size === 'medium' ? '40px' : '30px'}; justify-content: center; width: ${({ $size }) => $size === 'medium' ? '40px' : '30px'}; `; const StyledInputIconWrapper = exports.StyledInputIconWrapper = _styledComponents.default.div` align-items: baseline; display: flex; flex: 0 0 auto; justify-content: center; margin-left: 10px; `; const StyledInputRightElement = exports.StyledInputRightElement = _styledComponents.default.div` border-bottom-right-radius: 3px; border-top-right-radius: 3px; overflow: hidden; flex: 0 0 auto; `; //# sourceMappingURL=Input.styles.js.map