UNPKG

@payfit/unity-components

Version:

77 lines (76 loc) 2.18 kB
import e, { forwardRef as t } from "react"; import { uyTv as n } from "@payfit/unity-themes"; import { jsx as r, jsxs as i } from "react/jsx-runtime"; import { useId as a } from "react-aria/useId"; //#region src/components/navigation-card/parts/NavigationCardGroup.tsx var o = n({ slots: { base: ["uy:flex uy:flex-col uy:gap-100"], label: ["uy:typography-action"], list: ["uy:flex uy:list-none uy:group"], listItem: [ "uy:contents", "uy:data-[variant=compact]:*:rounded-none", "uy:data-[variant=compact]:*:border-b-0", "uy:data-[variant=compact]:first:*:rounded-t-lg", "uy:data-[variant=compact]:last:*:rounded-b-lg", "uy:data-[variant=compact]:last:*:border-b-1", "uy:data-[variant=compact]:first:last:*:rounded-lg" ] }, variants: { orientation: { horizontal: { list: "uy:flex-col uy:sm:flex-row" }, vertical: { list: "uy:flex-col" } }, variant: { compact: { list: "uy:gap-0" }, comfortable: { list: "uy:gap-100" } }, showLabel: { true: { label: "" }, false: { label: "uy:sr-only" } } }, defaultVariants: { orientation: "vertical", variant: "comfortable", showLabel: !0 } }), s = t(({ children: t, label: n, isLabelHidden: s = !1, orientation: c = "vertical", variant: l = "comfortable", ...u }, d) => { let f = a(), { base: p, label: m, list: h, listItem: g } = o({ orientation: c, variant: l, showLabel: !s }), _ = e.Children.toArray(t), v = _.length, y = `navcard-group-label-${f}`; return /* @__PURE__ */ i("nav", { ...u, ref: d, className: p(), "aria-labelledby": y, children: [/* @__PURE__ */ r("span", { className: m(), id: y, children: n }), /* @__PURE__ */ r("ul", { className: h(), "data-variant": l, children: _.map((t, n) => { if (e.isValidElement(t)) { let e = n === 0, i = n === v - 1; return /* @__PURE__ */ r("li", { className: g(), "data-variant": l, "data-unity-first": e ? "" : void 0, "data-unity-last": i ? "" : void 0, children: t }, t.key); } return t; }) })] }); }); s.displayName = "NavigationCardGroup"; //#endregion export { s as NavigationCardGroup, o as navigationCardGroup };