@wordpress/components
Version:
UI components for WordPress.
81 lines (79 loc) • 2.73 kB
JavaScript
;
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// packages/components/src/animate/index.tsx
var animate_exports = {};
__export(animate_exports, {
Animate: () => Animate,
default: () => animate_default,
getAnimateClassName: () => getAnimateClassName
});
module.exports = __toCommonJS(animate_exports);
var import_clsx = __toESM(require("clsx"));
function getDefaultOrigin(type) {
return type === "appear" ? "top" : "left";
}
function getAnimateClassName(options) {
if (options.type === "loading") {
return "components-animate__loading";
}
const {
type,
origin = getDefaultOrigin(type)
} = options;
if (type === "appear") {
const [yAxis, xAxis = "center"] = origin.split(" ");
return (0, import_clsx.default)("components-animate__appear", {
["is-from-" + xAxis]: xAxis !== "center",
["is-from-" + yAxis]: yAxis !== "middle"
});
}
if (type === "slide-in") {
return (0, import_clsx.default)("components-animate__slide-in", "is-from-" + origin);
}
return void 0;
}
function Animate({
type,
options = {},
children
}) {
return children({
className: getAnimateClassName({
type,
...options
})
});
}
var animate_default = Animate;
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
Animate,
getAnimateClassName
});
//# sourceMappingURL=index.js.map