react-icon-mask-lib
Version:
React компонент Icon с поддержкой кастомных SVG через mask-image
294 lines (293 loc) • 9.55 kB
JavaScript
import K from "react";
var S = { exports: {} }, R = {};
/**
* @license React
* react-jsx-runtime.production.js
*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
var I;
function ee() {
if (I)
return R;
I = 1;
var i = Symbol.for("react.transitional.element"), d = Symbol.for("react.fragment");
function f(o, a, u) {
var n = null;
if (u !== void 0 && (n = "" + u), a.key !== void 0 && (n = "" + a.key), "key" in a) {
u = {};
for (var b in a)
b !== "key" && (u[b] = a[b]);
} else
u = a;
return a = u.ref, {
$$typeof: i,
type: o,
key: n,
ref: a !== void 0 ? a : null,
props: u
};
}
return R.Fragment = d, R.jsx = f, R.jsxs = f, R;
}
var _ = {};
/**
* @license React
* react-jsx-runtime.development.js
*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
var F;
function re() {
return F || (F = 1, process.env.NODE_ENV !== "production" && function() {
function i(e) {
if (e == null)
return null;
if (typeof e == "function")
return e.$$typeof === Z ? null : e.displayName || e.name || null;
if (typeof e == "string")
return e;
switch (e) {
case v:
return "Fragment";
case U:
return "Profiler";
case W:
return "StrictMode";
case J:
return "Suspense";
case X:
return "SuspenseList";
case H:
return "Activity";
}
if (typeof e == "object")
switch (typeof e.tag == "number" && console.error(
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
), e.$$typeof) {
case L:
return "Portal";
case q:
return (e.displayName || "Context") + ".Provider";
case V:
return (e._context.displayName || "Context") + ".Consumer";
case G:
var r = e.render;
return e = e.displayName, e || (e = r.displayName || r.name || "", e = e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"), e;
case B:
return r = e.displayName || null, r !== null ? r : i(e.type) || "Memo";
case j:
r = e._payload, e = e._init;
try {
return i(e(r));
} catch {
}
}
return null;
}
function d(e) {
return "" + e;
}
function f(e) {
try {
d(e);
var r = !1;
} catch {
r = !0;
}
if (r) {
r = console;
var t = r.error, c = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
return t.call(
r,
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
c
), d(e);
}
}
function o(e) {
if (e === v)
return "<>";
if (typeof e == "object" && e !== null && e.$$typeof === j)
return "<...>";
try {
var r = i(e);
return r ? "<" + r + ">" : "<...>";
} catch {
return "<...>";
}
}
function a() {
var e = T.A;
return e === null ? null : e.getOwner();
}
function u() {
return Error("react-stack-top-frame");
}
function n(e) {
if (h.call(e, "key")) {
var r = Object.getOwnPropertyDescriptor(e, "key").get;
if (r && r.isReactWarning)
return !1;
}
return e.key !== void 0;
}
function b(e, r) {
function t() {
y || (y = !0, console.error(
"%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
r
));
}
t.isReactWarning = !0, Object.defineProperty(e, "key", {
get: t,
configurable: !0
});
}
function D() {
var e = i(this.type);
return N[e] || (N[e] = !0, console.error(
"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
)), e = this.props.ref, e !== void 0 ? e : null;
}
function M(e, r, t, c, m, l, O, g) {
return t = l.ref, e = {
$$typeof: x,
type: e,
key: r,
props: l,
_owner: m
}, (t !== void 0 ? t : null) !== null ? Object.defineProperty(e, "ref", {
enumerable: !1,
get: D
}) : Object.defineProperty(e, "ref", { enumerable: !1, value: null }), e._store = {}, Object.defineProperty(e._store, "validated", {
configurable: !1,
enumerable: !1,
writable: !0,
value: 0
}), Object.defineProperty(e, "_debugInfo", {
configurable: !1,
enumerable: !1,
writable: !0,
value: null
}), Object.defineProperty(e, "_debugStack", {
configurable: !1,
enumerable: !1,
writable: !0,
value: O
}), Object.defineProperty(e, "_debugTask", {
configurable: !1,
enumerable: !1,
writable: !0,
value: g
}), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
}
function P(e, r, t, c, m, l, O, g) {
var s = r.children;
if (s !== void 0)
if (c)
if (Q(s)) {
for (c = 0; c < s.length; c++)
w(s[c]);
Object.freeze && Object.freeze(s);
} else
console.error(
"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
);
else
w(s);
if (h.call(r, "key")) {
s = i(e);
var E = Object.keys(r).filter(function(z) {
return z !== "key";
});
c = 0 < E.length ? "{key: someKey, " + E.join(": ..., ") + ": ...}" : "{key: someKey}", Y[s + c] || (E = 0 < E.length ? "{" + E.join(": ..., ") + ": ...}" : "{}", console.error(
`A props object containing a "key" prop is being spread into JSX:
let props = %s;
<%s {...props} />
React keys must be passed directly to JSX without using spread:
let props = %s;
<%s key={someKey} {...props} />`,
c,
s,
E,
s
), Y[s + c] = !0);
}
if (s = null, t !== void 0 && (f(t), s = "" + t), n(r) && (f(r.key), s = "" + r.key), "key" in r) {
t = {};
for (var A in r)
A !== "key" && (t[A] = r[A]);
} else
t = r;
return s && b(
t,
typeof e == "function" ? e.displayName || e.name || "Unknown" : e
), M(
e,
s,
l,
m,
a(),
t,
O,
g
);
}
function w(e) {
typeof e == "object" && e !== null && e.$$typeof === x && e._store && (e._store.validated = 1);
}
var p = K, x = Symbol.for("react.transitional.element"), L = Symbol.for("react.portal"), v = Symbol.for("react.fragment"), W = Symbol.for("react.strict_mode"), U = Symbol.for("react.profiler"), V = Symbol.for("react.consumer"), q = Symbol.for("react.context"), G = Symbol.for("react.forward_ref"), J = Symbol.for("react.suspense"), X = Symbol.for("react.suspense_list"), B = Symbol.for("react.memo"), j = Symbol.for("react.lazy"), H = Symbol.for("react.activity"), Z = Symbol.for("react.client.reference"), T = p.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, h = Object.prototype.hasOwnProperty, Q = Array.isArray, k = console.createTask ? console.createTask : function() {
return null;
};
p = {
"react-stack-bottom-frame": function(e) {
return e();
}
};
var y, N = {}, C = p["react-stack-bottom-frame"].bind(
p,
u
)(), $ = k(o(u)), Y = {};
_.Fragment = v, _.jsx = function(e, r, t, c, m) {
var l = 1e4 > T.recentlyCreatedOwnerStacks++;
return P(
e,
r,
t,
!1,
c,
m,
l ? Error("react-stack-top-frame") : C,
l ? k(o(e)) : $
);
}, _.jsxs = function(e, r, t, c, m) {
var l = 1e4 > T.recentlyCreatedOwnerStacks++;
return P(
e,
r,
t,
!0,
c,
m,
l ? Error("react-stack-top-frame") : C,
l ? k(o(e)) : $
);
};
}()), _;
}
process.env.NODE_ENV === "production" ? S.exports = ee() : S.exports = re();
var te = S.exports;
const oe = ({ children: i, className: d = "", color: f, size: o, name: a, ...u }) => {
const n = {};
return f && (n.backgroundColor = f), o && (n.width = typeof o == "number" ? `${o}px` : o, n.height = typeof o == "number" ? `${o}px` : o, n.flex = `0 0 ${typeof o == "number" ? `${o}px` : o}`), a && (n.maskImage = `url(/icons/${a}.svg)`, n.webkitMaskImage = `url(/icons/${a}.svg)`, n.maskRepeat = "no-repeat", n.maskSize = "contain", n.maskPosition = "center", n.backgroundColor = f || "currentColor"), /* @__PURE__ */ te.jsx("i", { className: `icon ${d}`, style: n, ...u, children: !a && i });
};
export {
oe as Icon
};