UNPKG

@bedrock-layout/stack

Version:

bedrock-layout stack layout primitive

23 lines (22 loc) 616 B
import { useTheme as d, getSafeGutter as l } from "@bedrock-layout/spacing-constants"; import { forwardRefWithAs as g } from "@bedrock-layout/type-utils"; import b from "react"; function k(e, t) { if (t !== void 0) return `${e}:${t}`; } const y = g(function({ as: t = "div", gutter: r, gap: n, align: o, style: i = {}, ...a }, c) { const u = d(), f = k("align", o), s = l(u, n ?? r), m = [f].filter(Boolean).join(" "); return /* @__PURE__ */ b.createElement( t, { ref: c, "data-bedrock-stack": m, style: { "--gutter": s, ...i }, ...a } ); }); export { y as Stack };