UNPKG

@hakit/components

Version:
87 lines (86 loc) 3.4 kB
import { withEmotionCache as j, ThemeContext as x } from "@emotion/react"; import { serializeStyles as R } from "@emotion/serialize"; import { u as A } from "./emotion-use-insertion-effect-with-fallbacks.browser.esm-o5bKZLsy.js"; import { getRegisteredStyles as D, registerStyles as U, insertStyles as V } from "@emotion/utils"; import * as c from "react"; import W from "@emotion/is-prop-valid"; function S() { return S = Object.assign ? Object.assign.bind() : function(s) { for (var e = 1; e < arguments.length; e++) { var r = arguments[e]; for (var a in r) ({}).hasOwnProperty.call(r, a) && (s[a] = r[a]); } return s; }, S.apply(null, arguments); } var q = W, B = function(e) { return e !== "theme"; }, T = function(e) { return typeof e == "string" && // 96 is one less than the char code // for "a" so this is checking that // it's a lowercase character e.charCodeAt(0) > 96 ? q : B; }, z = function(e, r, a) { var n; if (r) { var i = r.shouldForwardProp; n = e.__emotion_forwardProp && i ? function(u) { return e.__emotion_forwardProp(u) && i(u); } : i; } return typeof n != "function" && a && (n = e.__emotion_forwardProp), n; }, G = function(e) { var r = e.cache, a = e.serialized, n = e.isStringTag; return U(r, a, n), A(function() { return V(r, a, n); }), null; }, Q = function s(e, r) { var a = e.__emotion_real === e, n = a && e.__emotion_base || e, i, u; r !== void 0 && (i = r.label, u = r.target); var p = z(e, r, a), F = p || T(n), P = !F("as"); return function() { var d = arguments, l = a && e.__emotion_styles !== void 0 ? e.__emotion_styles.slice(0) : []; if (i !== void 0 && l.push("label:" + i + ";"), d[0] == null || d[0].raw === void 0) l.push.apply(l, d); else { var b = d[0]; l.push(b[0]); for (var E = d.length, v = 1; v < E; v++) l.push(d[v], b[v]); } var o = j(function(t, f, _) { var w = P && t.as || n, m = "", C = [], h = t; if (t.theme == null) { h = {}; for (var N in t) h[N] = t[N]; h.theme = c.useContext(x); } typeof t.className == "string" ? m = D(f.registered, C, t.className) : t.className != null && (m = t.className + " "); var O = R(l.concat(C), f.registered, h); m += f.key + "-" + O.name, u !== void 0 && (m += " " + u); var I = P && p === void 0 ? T(w) : F, g = {}; for (var y in t) P && y === "as" || I(y) && (g[y] = t[y]); return g.className = m, _ && (g.ref = _), /* @__PURE__ */ c.createElement(c.Fragment, null, /* @__PURE__ */ c.createElement(G, { cache: f, serialized: O, isStringTag: typeof w == "string" }), /* @__PURE__ */ c.createElement(w, g)); }); return o.displayName = i !== void 0 ? i : "Styled(" + (typeof n == "string" ? n : n.displayName || n.name || "Component") + ")", o.defaultProps = e.defaultProps, o.__emotion_real = o, o.__emotion_base = n, o.__emotion_styles = l, o.__emotion_forwardProp = p, Object.defineProperty(o, "toString", { value: function() { return "." + u; } }), o.withComponent = function(t, f) { var _ = s(t, S({}, r, f, { shouldForwardProp: z(o, f, !0) })); return _.apply(void 0, l); }, o; }; }; export { Q as c }; //# sourceMappingURL=emotion-styled-base.browser.esm-Dyg8Y4aq.js.map