UNPKG

@chayns-components/core

Version:

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

140 lines (135 loc) 4.53 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.StyledRadioButtonWrapper = exports.StyledRadioButtonPseudoCheckBox = exports.StyledRadioButtonLabel = exports.StyledRadioButtonCheckBoxMark = exports.StyledRadioButtonCheckBox = exports.StyledRadioButton = exports.StyledMotionRadioButtonChildren = exports.StyledLabelWrapper = 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 StyledRadioButton = exports.StyledRadioButton = _styledComponents.default.span` display: flex; flex-direction: column; position: relative; opacity: ${({ $isDisabled }) => $isDisabled ? 0.5 : 1}; ${({ $radioButtonRightElementMargin }) => { switch ($radioButtonRightElementMargin) { case 'BOTH': return (0, _styledComponents.css)` margin: 6px 0; `; case 'TOP': return (0, _styledComponents.css)` margin-top: 6px; `; case 'BOTTOM': return (0, _styledComponents.css)` margin-bottom: 6px; `; case 'NONE': default: return (0, _styledComponents.css)` margin: 0; `; } }} `; const StyledRadioButtonWrapper = exports.StyledRadioButtonWrapper = _styledComponents.default.div` display: flex; align-items: center; position: relative; gap: 5px; user-select: none; `; const StyledRadioButtonCheckBox = exports.StyledRadioButtonCheckBox = _styledComponents.default.input` opacity: 0; height: 15px; width: 15px; cursor: ${({ $isDisabled }) => $isDisabled ? 'default !important' : 'pointer !important'}; `; const StyledRadioButtonPseudoCheckBox = exports.StyledRadioButtonPseudoCheckBox = _styledComponents.default.div` background-color: ${({ theme, $isChecked }) => $isChecked ? theme['secondary-408'] : theme['secondary-403']}; opacity: 1; border: 1px solid rgba(${({ theme }) => theme['409-rgb']}, 0.5); width: 15px; height: 15px; position: absolute; border-radius: 100%; top: 50%; transform: translateY(-50%); cursor: ${({ $isDisabled }) => $isDisabled ? 'default !important' : 'pointer !important'}; `; const StyledRadioButtonCheckBoxMark = exports.StyledRadioButtonCheckBoxMark = _styledComponents.default.span` background-color: transparent; position: absolute; top: 1px; left: 3.925px; display: inline-block; transform: rotate(35deg); height: 9px; width: 5px; border-bottom: 2px solid white; border-right: 2px solid white; border-top: transparent; border-left: transparent; z-index: 2; cursor: ${({ $isDisabled }) => $isDisabled ? 'default !important' : 'pointer !important'}; ${({ $isHovered, $isSelected }) => { if ($isSelected) { return (0, _styledComponents.css)` opacity: 1; `; } if ($isHovered) { return (0, _styledComponents.css)` opacity: 0.5; `; } return (0, _styledComponents.css)` opacity: 0; `; }} `; const StyledRadioButtonLabel = exports.StyledRadioButtonLabel = _styledComponents.default.p` color: ${({ theme }) => theme.text}; margin: 0; cursor: ${({ $isDisabled }) => $isDisabled ? 'default !important' : 'pointer !important'}; `; const StyledLabelWrapper = exports.StyledLabelWrapper = _styledComponents.default.div` display: flex; align-items: center; justify-content: space-between; width: 100%; gap: 12px; `; const StyledMotionRadioButtonChildren = exports.StyledMotionRadioButtonChildren = (0, _styledComponents.default)(_react.motion.div)` margin-left: 20px; cursor: text; overflow: hidden; color: ${({ theme }) => theme.text}; `; //# sourceMappingURL=RadioButton.styles.js.map