UNPKG

@payfit/unity-components

Version:

39 lines (38 loc) 1.55 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 { useIntl as o } from "react-intl"; //#region src/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(), v = o(), y = c ?? `+${r}`, b = v.formatMessage({ id: "unity:component:avatar-group:more-members-label", defaultMessage: "{count, plural, one {# more member} other {# more members}}" }, { 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 };