UNPKG

@payfit/unity-components

Version:

36 lines (35 loc) • 1.47 kB
import { Actionable as e } from "../../actionable/Actionable.js"; import { useAvatarGroupContext as t } from "../AvatarGroup.context.js"; import { avatarGroupCount as n } from "../AvatarGroup.variants.js"; import * as r from "react"; import { cn as i } from "@payfit/unity-themes"; import { jsx as a } from "react/jsx-runtime"; import { useTranslation as o } from "react-i18next"; //#region src/core/components/avatar-group/parts/AvatarGroupCount.tsx var s = r.forwardRef(({ count: r, "aria-label": s, children: c, className: l, isInteractive: u = !1, onPress: d, onPressStart: f, onPressEnd: p, onPressChange: m, ...h }, g) => { let _ = t(), { t: v } = o("unity"), y = c ?? `+${r}`, b = v((e) => e.unity.component.avatarGroup.moreMembersLabel, { count: r }), x = s ?? b, S = i(n({ size: _?.defaultSize === "sm" ? "sm" : "md" }), "uy:relative uy:z-10", u && "uy:cursor-pointer uy:outline-none uy:data-[focus-visible=true]:ring-2 uy:data-[focus-visible=true]:ring-utility-focus-ring uy:data-[focus-visible=true]:ring-offset-2", l); return u ? /* @__PURE__ */ a(e, { ref: g, asElement: "button", isUnstyled: !0, type: "button", "aria-label": x, className: S, onPress: d, onPressStart: f, onPressEnd: p, onPressChange: m, ...h, children: y }) : /* @__PURE__ */ a("span", { ref: g, role: "status", "aria-label": x, className: S, ...h, children: y }); }); s.displayName = "AvatarGroupCount"; //#endregion export { s as AvatarGroupCount };