@threadlabs/looma 0.21.5 → 0.21.6

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.
@@ -10,8 +10,9 @@
10
10
  >Accessible label for the overflow badge. Replace {count} with the number of people beyond the visible avatars.</prop>
11
11
  <prop name="label" type="string" default="People"
12
12
  >The group's accessible name, announced for the set of avatars as a whole. Name who they are rather than repeating the default.</prop>
13
- <prop name="size" type="keyword" values="sm, md" default="md"
14
- >The size of the avatars inside, matched by the +N badge and the overlap. Give each Avatar the same size.</prop>
13
+ <prop name="size" type="keyword" values="xs, sm, md" default="md"
14
+ >The size of the avatars inside, matched by the +N badge and the overlap. Give each Avatar the same size. xs suits a group inside a line of small text, such
15
+ as the people listed under a title.</prop>
15
16
  <state name="overflowCount" :value="0"></state>
16
17
  <state name="overflowAnnouncement" :value="''"></state>
17
18
  </defs>
@@ -88,6 +89,15 @@
88
89
  block-size: 1.75rem;
89
90
  }
90
91
 
92
+ :host-state([size="xs"]) .overflow {
93
+ margin-inline-start: -0.1875rem;
94
+ inline-size: 1.25rem;
95
+ block-size: 1.25rem;
96
+ /* Matches the xs Avatar's initials. */
97
+ font-size: calc(var(--ui-font-size) * 0.5625);
98
+ line-height: 1;
99
+ }
100
+
91
101
  .overflow[hidden] {
92
102
  display: none;
93
103
  }
@@ -7,7 +7,7 @@ export default function controller(host) {
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
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";
10
+ const overlap = { xs: "-0.1875rem", sm: "-0.25rem" }[host.state.size] ?? "-0.5rem";
11
11
  avatars.forEach((avatar, index) => {
12
12
  avatar.style.display = index >= visible ? "none" : "";
13
13
  avatar.style.marginInlineStart = index === 0 ? "0px" : overlap;
@@ -6,8 +6,8 @@
6
6
  hovered, and link is an inline text action that reads as a link. danger is solid in the danger tone, kept for the call sites that name it.</prop>
7
7
  <prop name="size" type="keyword" values="xs, sm, md, lg" default="md"
8
8
  >Height, padding, and type size. xs is 1.5rem with the smallest text, for a control inside a line of small text; sm is the small control height (2rem by
9
- default) with tighter padding and smaller text, md is the standard control height (2.5rem), and lg is taller (3rem) with roomier padding. Under touch, xs
10
- and sm grow to the touch minimum.</prop>
9
+ default) with tighter padding and smaller text, md is the standard control height (2.5rem), and lg is taller (3rem) with roomier padding. Under touch, sm
10
+ grows to the touch minimum, while xs keeps its size inside its line and gains an invisible touch-sized hit area.</prop>
11
11
  <prop name="shape" type="keyword" values="rounded, pill" default="rounded"
12
12
  >rounded uses the theme's action radius; pill rounds the ends fully, for a compact choice such as a status or a person.</prop>
13
13
  <prop name="tone" type="keyword" values="accent, neutral, danger, success, warning, info" default="accent"
@@ -213,7 +213,7 @@
213
213
 
214
214
  :host-state([size="xs"]) {
215
215
  min-block-size: 1.5rem;
216
- padding: var(--ui-space-0-5) calc(var(--ui-space-1) * 1.5);
216
+ padding: calc(var(--ui-space-0-5) * 1.5) calc(var(--ui-space-1) * 1.25);
217
217
  font-size: var(--ui-font-size-xs);
218
218
  }
219
219
 
@@ -368,7 +368,7 @@
368
368
 
369
369
  /* The size states outrank :host, so sm is named too, or a small button would stay small. */
370
370
  @media (pointer: coarse) {
371
- :host, :host-state([size="sm"]), :host-state([size="xs"]) {
371
+ :host, :host-state([size="sm"]) {
372
372
  min-block-size: var(--ui-control-min-block-size);
373
373
  }
374
374
  }
@@ -376,12 +376,15 @@
376
376
  /* Under touch, a link-style button's press lands within the control minimum: an invisible hit
377
377
  area, centred on it, like IconButton's. A boxed button grows to the minimum itself (below);
378
378
  a link-style one keeps its text size, so a standalone one ("See all" under a list) needs the
379
- area. Only the link needs it: a hit area on every button would reach over its neighbours. */
380
- html[data-ui-input-modality="touch"] :host-state([variant="link"]) {
379
+ area. xs sits inside a line of text the same way, so it keeps its size and gains the area too.
380
+ Only these need it: a hit area on every button would reach over its neighbours. */
381
+ html[data-ui-input-modality="touch"] :host-state([variant="link"]),
382
+ html[data-ui-input-modality="touch"] :host-state([size="xs"]) {
381
383
  position: relative;
382
384
  }
383
385
 
384
- html[data-ui-input-modality="touch"] :host-state([variant="link"])::after {
386
+ html[data-ui-input-modality="touch"] :host-state([variant="link"])::after,
387
+ html[data-ui-input-modality="touch"] :host-state([size="xs"])::after {
385
388
  position: absolute;
386
389
  inset: 50% auto auto 50%;
387
390
  inline-size: max(100%, var(--ui-control-min-block-size));