UNPKG

@payfit/unity-components

Version:

54 lines (53 loc) 1.68 kB
import { processPaddingProp as e } from "../../utils/spacing.js"; import { NavigationCardContext as t } from "./NavigationCard.context.js"; import { navigationCard as n } from "./NavigationCard.variants.js"; import { forwardRef as r, useMemo as i } from "react"; import { jsx as a, jsxs as o } from "react/jsx-runtime"; import { Button as s } from "react-aria-components/Button"; import { Link as c } from "react-aria-components/Link"; import { useId as l } from "react-aria/useId"; //#region src/components/navigation-card/NavigationCard.tsx var u = r(({ children: r, asElement: u = "a", prefix: d, suffix: f, padding: p = "$300", paddingBlock: m, paddingInline: h, gap: g = "$150", ..._ }, v) => { let y = l(), b = u === "a" || "href" in _, x = _, S = { id: `unity-navigation-card-${y}`, labelId: _["aria-labelledby"] ?? `unity-navigation-card-label-${y}`, descriptionId: _["aria-describedby"] ?? `unity-navigation-card-description-${y}` }, { base: C, prefix: w, body: T, suffix: E } = i(() => n({ ...e(p, m, h), gap: g }), [ p, m, h, g ]), D = b ? c : s; return /* @__PURE__ */ a(t.Provider, { value: S, children: /* @__PURE__ */ o(D, { "data-dd-privacy": "allow", id: S.id, "aria-labelledby": S.labelId, "aria-describedby": S.descriptionId, ...x, ref: v, className: C(), children: [ d && /* @__PURE__ */ a("div", { className: w(), children: d }), /* @__PURE__ */ a("div", { className: T(), children: r }), f && /* @__PURE__ */ a("div", { className: E(), children: f }) ] }) }); }); u.displayName = "RawNavigationCard"; //#endregion export { u as RawNavigationCard };