UNPKG

@chayns-components/core

Version:

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

121 lines (114 loc) 4.15 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.StyledMotionWaitCursorWrapper = exports.StyledMotionChildrenWrapper = exports.StyledMotionButton = exports.StyledIconWrapper = void 0; var _react = require("motion/react"); var _styledComponents = _interopRequireWildcard(require("styled-components")); var _keyboardFocusHighlighting = require("../../utils/keyboardFocusHighlighting.styles"); 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 StyledMotionButton = exports.StyledMotionButton = (0, _styledComponents.default)(_react.motion.button)` ${({ $shouldShowTextAsRobotoMedium, $shouldShowAsSelectButton }) => $shouldShowTextAsRobotoMedium && !$shouldShowAsSelectButton && (0, _styledComponents.css)` font-size: 110%; font-family: 'Roboto Medium', serif; `} align-items: center; ${({ $isSecondary, $shouldShowAsSelectButton, $effectiveButtonDesign, theme }) => { if ($isSecondary || $shouldShowAsSelectButton) { return (0, _styledComponents.css)` color: ${theme.text}; `; } return (0, _styledComponents.css)` color: ${$effectiveButtonDesign === 2 ? theme.buttonColor ?? theme.buttonBackgroundColor ?? 'white' : theme.buttonColor ?? 'white'}; `; }} ${({ theme, $isSecondary, $shouldShowAsSelectButton, $effectiveButtonDesign }) => { if ($effectiveButtonDesign === 2 && !$shouldShowAsSelectButton) { return (0, _styledComponents.css)` border: 1px solid ${$isSecondary ? theme['202'] : theme.buttonBackgroundColor}; box-shadow: none; `; } return (0, _styledComponents.css)` border: none; box-shadow: 1px 2px 3px rgba(0, 0, 0, 0.2); `; }} border-radius: 3px; cursor: ${({ $isDisabled }) => $isDisabled ? 'default' : 'pointer'}; display: inline-flex; flex: 0 0 auto; line-height: 22px; min-height: 32px; position: relative; user-select: none; width: fit-content; ${({ $shouldShowKeyboardHighlighting }) => $shouldShowKeyboardHighlighting && (0, _styledComponents.css)` &:focus-visible { transition: none; ${_keyboardFocusHighlighting.keyboardFocusHighlightingRingCss} } `} ${({ $hasIcon, $hasChildren, $shouldShowWaitCursor }) => { if ($shouldShowWaitCursor) { return (0, _styledComponents.css)` padding: 4px 12px; `; } if ($hasIcon) { if ($hasChildren) { return (0, _styledComponents.css)` padding: 6px 12px 6px 42px; `; } return (0, _styledComponents.css)` padding: 6px 12px 6px 18px; `; } return (0, _styledComponents.css)` padding: 6px 12px 6px 12px; `; }} `; const StyledIconWrapper = exports.StyledIconWrapper = _styledComponents.default.span` align-items: center; background-color: rgba(255, 255, 255, 0.2); bottom: 0; display: flex; justify-content: center; left: 0; position: absolute; top: 0; width: 30px; `; const StyledMotionChildrenWrapper = exports.StyledMotionChildrenWrapper = (0, _styledComponents.default)(_react.motion.div)` will-change: unset !important; `; const StyledMotionWaitCursorWrapper = exports.StyledMotionWaitCursorWrapper = (0, _styledComponents.default)(_react.motion.div)` align-items: center; display: flex; justify-content: center; `; //# sourceMappingURL=Button.styles.js.map