@threadlabs/looma 0.13.0 → 0.13.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,6 +5,8 @@
5
5
  the badge.</prop>
6
6
  <prop name="label" type="string" default="People"
7
7
  >The group's accessible name, announced for the set of avatars as a whole. Name who they are rather than repeating the default.</prop>
8
+ <prop name="size" type="sm | md" default="md"
9
+ >The size of the avatars inside, matched by the +N badge and the overlap. Give each Avatar the same size.</prop>
8
10
  <state name="overflowCount" :value="0"></state>
9
11
  </defs>
10
12
  <div role="group" :aria-label="label">
@@ -72,6 +74,12 @@
72
74
  flex-shrink: 0;
73
75
  }
74
76
 
77
+ :host-state([size="sm"]) .overflow {
78
+ margin-inline-start: -0.25rem;
79
+ inline-size: 1.75rem;
80
+ block-size: 1.75rem;
81
+ }
82
+
75
83
  .overflow[hidden] {
76
84
  display: none;
77
85
  }
@@ -6,9 +6,11 @@ export default function controller(host) {
6
6
  const max = Number(host.state.max);
7
7
  const visible = Number.isFinite(max) ? Math.max(0, Math.floor(max)) : 0;
8
8
  const avatars = Array.from(element.children).filter((child) => child !== host.refs.overflow);
9
+ // Small avatars overlap less, so their initials stay clear of the next one.
10
+ const overlap = host.state.size === "sm" ? "-0.25rem" : "-0.5rem";
9
11
  avatars.forEach((avatar, index) => {
10
12
  avatar.style.display = index >= visible ? "none" : "";
11
- avatar.style.marginInlineStart = index === 0 ? "0px" : "-0.5rem";
13
+ avatar.style.marginInlineStart = index === 0 ? "0px" : overlap;
12
14
  avatar.style.borderRadius = "999px";
13
15
  // Later avatars cast a crisp shadow back onto the one they overlap; the first overlaps nothing.
14
16
  avatar.style.boxShadow = index === 0