UNPKG

@chayns-components/core

Version:

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

187 lines (177 loc) 5.83 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.StyledMotionMentionFinderPopup = exports.StyledMentionFinderOverlay = exports.StyledMentionFinderItemList = exports.StyledMentionFinderDragHandleInner = exports.StyledMentionFinderDragHandle = exports.StyledMentionFinder = void 0; var _react = require("motion/react"); var _styledComponents = _interopRequireWildcard(require("styled-components")); var _mentionFinder = require("../../constants/mentionFinder"); 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 StyledMentionFinder = exports.StyledMentionFinder = _styledComponents.default.div` position: relative; z-index: 2; `; const StyledMentionFinderDragHandle = exports.StyledMentionFinderDragHandle = _styledComponents.default.div` align-items: center; background-color: ${({ theme }) => theme['000']}; border: 0; cursor: grab; display: flex; flex: 0 0 auto; justify-content: center; padding: 8px 0; pointer-events: none; position: sticky; width: 100%; z-index: 2; ${({ $alignment }) => $alignment === _mentionFinder.MentionFinderPopupAlignment.Top ? (0, _styledComponents.css)` border-bottom: 0; top: 0; ` : (0, _styledComponents.css)` border-top: 0; bottom: 0; `} `; const StyledMentionFinderDragHandleInner = exports.StyledMentionFinderDragHandleInner = _styledComponents.default.div` background-color: ${({ theme }) => theme['005']}; border: 0; border-radius: 2px; cursor: ${({ $isDragging }) => $isDragging ? 'grabbing' : 'grab'}; display: flex; height: 4px; justify-content: center; margin: 0 auto; pointer-events: auto; position: relative; touch-action: none; user-select: none; -webkit-touch-callout: none; -webkit-user-select: none; width: 50px; &::before { content: ''; height: 36px; left: 50%; pointer-events: auto; position: absolute; top: 50%; touch-action: none; user-select: none; -webkit-touch-callout: none; -webkit-user-select: none; transform: translate(-50%, -50%); width: 120px; } `; const StyledMotionMentionFinderPopup = exports.StyledMotionMentionFinderPopup = (0, _styledComponents.default)(_react.motion.div)` background-color: ${({ theme }) => theme['000']}; border: 1px solid rgba(0, 0, 0, 0.1); border-bottom: 0; border-radius: 3px; display: flex; flex-direction: column; ${({ $isDragging, $popupAlignment }) => { if (!$isDragging) return (0, _styledComponents.css)` z-index: 5; `; switch ($popupAlignment) { case _mentionFinder.MentionFinderPopupAlignment.Bottom: return (0, _styledComponents.css)` border-bottom-left-radius: 15px; border-bottom-right-radius: 15px; z-index: 2; `; case _mentionFinder.MentionFinderPopupAlignment.Top: return (0, _styledComponents.css)` border-top-left-radius: 15px; border-top-right-radius: 15px; z-index: 2; `; default: return (0, _styledComponents.css)``; } }} box-shadow: 1px 3px 8px rgba(0, 0, 0, 0.1); left: 0; max-height: 275px; overflow: hidden; position: absolute; width: 100%; ${({ $popupAlignment }) => { switch ($popupAlignment) { case _mentionFinder.MentionFinderPopupAlignment.Bottom: return (0, _styledComponents.css)` top: 0; `; case _mentionFinder.MentionFinderPopupAlignment.Top: return (0, _styledComponents.css)` bottom: 0; `; default: return undefined; } }} `; const StyledMentionFinderItemList = exports.StyledMentionFinderItemList = _styledComponents.default.div` flex: 1 1 auto; max-height: inherit; overflow-y: auto; // Styles for custom scrollbar &::-webkit-scrollbar { width: 5px; } &::-webkit-scrollbar-track { background-color: transparent; } &::-webkit-scrollbar-button { background-color: transparent; height: 5px; } &::-webkit-scrollbar-thumb { background-color: rgba( ${({ theme }) => theme['text-rgb']}, 0.15 ); border-radius: 20px; } // Scrollbar styles for Firefox. The above styles are not supported in Firefox, these styles are // only supported in Firefox: * { scrollbar-color: rgba( ${({ theme }) => theme['text-rgb']}, 0.15 ) transparent; scrollbar-width: thin; } `; const StyledMentionFinderOverlay = exports.StyledMentionFinderOverlay = (0, _styledComponents.default)(_react.motion.div)` -webkit-backdrop-filter: blur(5px); backdrop-filter: blur(5px); background: radial-gradient(#000000a6 0, #000000bf 100%); inset: 0; opacity: 0; pointer-events: all; position: absolute; z-index: 1; `; //# sourceMappingURL=MentionFinder.styles.js.map