UNPKG

@wordpress/components

Version:
101 lines (100 loc) • 1.86 kB
"use strict"; Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } }); let ___utils_values_ts = require("../utils/values.cjs"); // packages/components/src/h-stack/utils.ts const H_ALIGNMENTS = { bottom: { align: "flex-end", justify: "center" }, bottomLeft: { align: "flex-end", justify: "flex-start" }, bottomRight: { align: "flex-end", justify: "flex-end" }, center: { align: "center", justify: "center" }, edge: { align: "center", justify: "space-between" }, left: { align: "center", justify: "flex-start" }, right: { align: "center", justify: "flex-end" }, stretch: { align: "stretch" }, top: { align: "flex-start", justify: "center" }, topLeft: { align: "flex-start", justify: "flex-start" }, topRight: { align: "flex-start", justify: "flex-end" } }; const V_ALIGNMENTS = { bottom: { justify: "flex-end", align: "center" }, bottomLeft: { justify: "flex-end", align: "flex-start" }, bottomRight: { justify: "flex-end", align: "flex-end" }, center: { justify: "center", align: "center" }, edge: { justify: "space-between", align: "center" }, left: { justify: "center", align: "flex-start" }, right: { justify: "center", align: "flex-end" }, stretch: { align: "stretch" }, top: { justify: "flex-start", align: "center" }, topLeft: { justify: "flex-start", align: "flex-start" }, topRight: { justify: "flex-start", align: "flex-end" } }; function getAlignmentProps(alignment, direction = "row") { if (!(0, ___utils_values_ts.isValueDefined)(alignment)) return {}; const props = direction === "column" ? V_ALIGNMENTS : H_ALIGNMENTS; return alignment in props ? props[alignment] : { align: alignment }; } exports.getAlignmentProps = getAlignmentProps; //# sourceMappingURL=utils.cjs.map