kwikid-components-react
Version:
KwikID's Component Library in React
32 lines (31 loc) • 5.78 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.KwikUIStyleTooltipParentContainer = exports.KwikUIStyleTooltipContainer = exports.KwikUIStyleTooltipChildren = void 0;
var _styledComponents = _interopRequireWildcard(require("styled-components"));
var _Tooltip = require("./Tooltip.definition");
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9;
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); }
function _taggedTemplateLiteral(e, t) { return t || (t = e.slice(0)), Object.freeze(Object.defineProperties(e, { raw: { value: Object.freeze(t) } })); }
// Add subtle fade-in animation
const fadeIn = (0, _styledComponents.keyframes)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n from { opacity: 0; }\n to { opacity: 1; }\n"])));
const KwikUIStyleTooltipParentContainer = exports.KwikUIStyleTooltipParentContainer = _styledComponents.default.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n position: relative;\n width: fit-content;\n max-width: 500px;\n word-wrap: break-word;\n"])));
const KwikUIStyleTooltipContainer = exports.KwikUIStyleTooltipContainer = _styledComponents.default.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n border: 1px solid #e2e8f0;\n border-radius: var(--kwikui-radius-m);\n box-shadow: 0 4px 8px rgba(0, 0, 0, 0.08);\n background-color: white;\n display: flex;\n flex-direction: column;\n gap: var(--kwikui-radius-m);\n width: max-content;\n position: absolute;\n padding: var(--kwikui-space-m);\n z-index: 10000;\n margin-top: -15px;\n animation: ", " 0.2s ease;\n\n // Better text rendering\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n\n &::before {\n content: \"\";\n position: absolute;\n background: transparent;\n /* background-color: red; */\n width: 100%;\n height: 100%;\n }\n\n &::after {\n content: \"\";\n background-color: white;\n position: absolute;\n width: 10px;\n height: 10px;\n }\n\n ", "\n"])), fadeIn, _ref => {
let {
position
} = _ref;
switch (position) {
case _Tooltip.IKwikUITooltipPosition.BOTTOM:
return (0, _styledComponents.css)(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n transform: translateX(-50%);\n left: 50%;\n top: calc(100% + 20px);\n &::before {\n bottom: 20%;\n }\n &::after {\n right: 50%;\n bottom: 100%;\n border-top: 1px solid #e2e8f0;\n border-right: 1px solid #e2e8f0;\n margin: 0 -5px -5px 0;\n transform: rotate(-45deg);\n }\n "])));
case _Tooltip.IKwikUITooltipPosition.TOP:
return (0, _styledComponents.css)(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n transform: translateX(-50%);\n left: 50%;\n bottom: calc(100% + 8px);\n &::before {\n top: 20%;\n }\n &::after {\n right: 50%;\n top: 100%;\n border-bottom: 1px solid #e2e8f0;\n border-right: 1px solid #e2e8f0;\n margin: -5px -5px 0 0;\n transform: rotate(45deg);\n }\n "])));
case _Tooltip.IKwikUITooltipPosition.LEFT:
return (0, _styledComponents.css)(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n right: calc(100% + 8px);\n &::before {\n left: 20%;\n }\n &::after {\n left: 100%;\n border-top: 1px solid #e2e8f0;\n border-right: 1px solid #e2e8f0;\n margin: 5px 5px -5px -5px;\n transform: rotate(45deg);\n }\n "])));
case _Tooltip.IKwikUITooltipPosition.RIGHT:
return (0, _styledComponents.css)(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n left: calc(100% + 8px);\n &::before {\n right: 20%;\n }\n &::after {\n right: 100%;\n border-top: 1px solid #e2e8f0;\n border-left: 1px solid #e2e8f0;\n margin: 5px -5px -5px 0;\n transform: rotate(-45deg);\n }\n "])));
default:
return (0, _styledComponents.css)(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n left: calc(100% + 8px);\n &::before {\n right: 20%;\n }\n &::after {\n right: 100%;\n border-top: 1px solid #e2e8f0;\n border-left: 1px solid #e2e8f0;\n margin: 5px -5px -5px 0;\n transform: rotate(-45deg);\n }\n "])));
}
});
const KwikUIStyleTooltipChildren = exports.KwikUIStyleTooltipChildren = _styledComponents.default.div(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n position: relative;\n z-index: 1;\n max-width: 500px;\n word-wrap: break-word;\n font-size: 0.875rem;\n line-height: 1.5;\n color: #2d3748;\n"])));