UNPKG

@primer/react-brand

Version:

Primer Brand is a GitHub's design system for creating React-based marketing websites and digital experiences.

92 lines (91 loc) 4.37 kB
import e from "../../node_modules/clsx/dist/clsx.js"; import { useAnimation as t } from "../../animation/useAnimation.js"; import { Text as n } from "../../Text/Text.js"; import { EyebrowText as r } from "../../EyebrowText/EyebrowText.js"; import { Heading as i } from "../../Heading/Heading.js"; import '../../packages/design-tokens/lib/design-tokens/css/tokens/functional/components/river/river-QteO10lt.css';import '../../packages/design-tokens/lib/design-tokens/css/tokens/functional/components/river/base-Ue-p74RC.css';/* empty css */ import a from "../../component-helpers/shared.module.js"; import { Link as o } from "../../Link/Link.js"; import { Label as s } from "../../Label/Label.js"; /* empty css */ import c from "../river-shared.module.js"; import l, { forwardRef as u, useMemo as d } from "react"; import { jsx as f, jsxs as p } from "react/jsx-runtime"; //#region src/river/River/River.tsx var m = "50:50", h = "start", g = "default", _ = u(({ animate: n, imageTextRatio: r = m, align: i = h, variant: o = g, className: s, children: u, style: d, ...f }, _) => { let { classes: b, styles: x } = t(n), { Visual: S, Content: C } = l.Children.toArray(u).reduce((e, t) => (l.isValidElement(t) && typeof t.type != "string" && (t.type === y && (e.Visual = t), t.type === v && (e.Content = t)), e), { Visual: null, Content: null }); return /* @__PURE__ */ p("section", { ref: _, className: e(c.River, c[`River--${r.replace(":", "-")}`], c[`River--align-${i}`], c[`River--variant-${o}`], o === "gridline" && a.gridline, b, s), style: { ...x, ...d }, ...f, children: [C, S] }); }), v = u(({ align: a = "center", animate: u, children: m, className: h, leadingComponent: g, trailingComponent: _, trailingComponentDivider: v = !1, style: y, ...b }, x) => { let { classes: S, styles: C } = t(u), w = d(() => l.Children.toArray(m), [m]), T = w.find((e) => l.isValidElement(e) && e.type === i), E = w.find((e) => l.isValidElement(e) && e.type === n), D = w.find((e) => l.isValidElement(e) && e.type === o), O = w.find((e) => l.isValidElement(e) && e.type === s), k = w.find((e) => l.isValidElement(e) && e.type === r); return /* @__PURE__ */ p("div", { ref: x, className: e(S, c.River__content, c[`River__content--align-${a}`], h), style: { ...C, ...y }, ...b, children: [ l.isValidElement(O) && !g && /* @__PURE__ */ f("div", { className: c.River__label, children: l.cloneElement(O, {}) }), !O && l.isValidElement(k) && !g && /* @__PURE__ */ f("div", { className: c.River__label, children: k }), !O && !k && g && /* @__PURE__ */ f("div", { children: /* @__PURE__ */ f(g, {}) }), l.isValidElement(T) && /* @__PURE__ */ f("div", { className: c.River__heading, children: l.cloneElement(T, { as: T.props.as || "h3", size: T.props.size || "5", weight: T.props.weight, className: e(T.props.className, c["River__heading-inner"]) }) }), l.isValidElement(E) && /* @__PURE__ */ f("div", { className: c["River__body-text"], children: l.cloneElement(E, { variant: "muted", as: "p", className: e(c.River__text, E.props.className) }) }), l.isValidElement(D) && /* @__PURE__ */ f("div", { className: c["River__call-to-action"], children: l.cloneElement(D, { size: "medium", variant: D.props.variant || "accent" }) }), _ && /* @__PURE__ */ f("div", { className: e(c.River__trailingComponent, v && c["River__trailingComponent--divider"]), children: /* @__PURE__ */ f(_, {}) }) ] }); }), y = u(({ fillMedia: t = !0, children: n, className: r, hasShadow: i = !1, rounded: a = !0, imageBackgroundColor: o, ...s }, l) => /* @__PURE__ */ f("div", { ref: l, className: e(c.River__visual, i && c["River__visual--has-shadow"], t && c["River__visual--fill-media"], a && c["River__visual--rounded"], o === "subtle" && c["River__visual--has-background"], r), ...s, children: n })), b = Object.assign(_, { Visual: y, Content: v }); //#endregion export { b as River, v as RiverContent, y as Visual, h as defaultRiverAlign, m as defaultRiverImageTextRatio, g as defaultRiverVariant }; //# sourceMappingURL=River.js.map