UNPKG

@chayns-components/core

Version:

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

69 lines (65 loc) 3 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.StyledTruncationPseudoContent = exports.StyledTruncationClampWrapper = exports.StyledTruncationClampFocusWrapper = exports.StyledTruncationClamp = exports.StyledTruncation = exports.StyledMotionTruncationContent = void 0; var _react = require("motion/react"); var _styledComponents = _interopRequireWildcard(require("styled-components")); var _truncation = require("../../types/truncation"); 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 StyledTruncation = exports.StyledTruncation = _styledComponents.default.div` position: relative; overflow: hidden; `; // Fix framer-motion bug const StyledMotionTruncationContent = exports.StyledMotionTruncationContent = (0, _styledComponents.default)(_react.motion.div)` overflow: hidden; position: relative; `; const StyledTruncationPseudoContent = exports.StyledTruncationPseudoContent = _styledComponents.default.div` visibility: hidden; position: absolute; width: 100%; `; const StyledTruncationClampWrapper = exports.StyledTruncationClampWrapper = _styledComponents.default.div` display: flex; ${({ $position }) => { switch ($position) { case _truncation.ClampPosition.Left: return (0, _styledComponents.css)` justify-content: left; `; case _truncation.ClampPosition.Middle: return (0, _styledComponents.css)` justify-content: center; `; default: return (0, _styledComponents.css)` justify-content: right; `; } }} `; const StyledTruncationClampFocusWrapper = exports.StyledTruncationClampFocusWrapper = _styledComponents.default.div` display: inline-block; border-radius: 3px; ${({ $shouldShowKeyboardHighlighting }) => $shouldShowKeyboardHighlighting && (0, _styledComponents.css)` &:focus-within { transition: none; ${_keyboardFocusHighlighting.keyboardFocusHighlightingRingCss}; color: inherit; } `} `; const StyledTruncationClamp = exports.StyledTruncationClamp = _styledComponents.default.a` cursor: pointer; z-index: 2; display: inline-block; line-height: 1.2; `; //# sourceMappingURL=Truncation.styles.js.map