UNPKG

@wordpress/editor

Version:
48 lines (47 loc) 1.29 kB
// packages/editor/src/components/collaborators-presence/avatar-group/component.tsx import clsx from "clsx"; import { Children } from "@wordpress/element"; import { sprintf, _n } from "@wordpress/i18n"; import { jsx, jsxs } from "react/jsx-runtime"; function AvatarGroup({ className, max = 3, children, ...props }) { const childArray = Children.toArray(children); const visible = childArray.slice(0, max); const overflowCount = childArray.length - max; return /* @__PURE__ */ jsxs( "div", { role: "group", className: clsx("editor-avatar-group", className), ...props, children: [ visible, overflowCount > 0 && /* @__PURE__ */ jsx( "span", { className: "editor-avatar-group__overflow", "aria-label": sprintf( /* translators: %d: number of additional collaborators not shown */ _n( "%d more collaborator", "%d more collaborators", overflowCount ), overflowCount ), children: `+${overflowCount}` } ) ] } ); } var component_default = AvatarGroup; export { component_default as default }; //# sourceMappingURL=component.mjs.map