@threadlabs/looma 0.25.2 → 0.25.4

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.
@@ -14,7 +14,10 @@
14
14
  <prop name="size" type="keyword" values="xs, md" default="md"
15
15
  >Scale. xs is a compact count beside small controls; md is the usual text badge. A square is 24px at xs and 32px at md with default spacing.</prop>
16
16
  </defs>
17
- <span><span class="label"><slot></slot></span></span>
17
+ <span>
18
+ <span class="icon" aria-hidden="true"><slot name="icon"></slot></span>
19
+ <span class="label"><slot></slot></span>
20
+ </span>
18
21
  <style>
19
22
  /* This component's hooks style the element they are set on, and never a nested one. */
20
23
  @property --ui-badge-border {
@@ -89,6 +92,7 @@
89
92
  display: inline-flex;
90
93
  align-items: center;
91
94
  justify-content: center;
95
+ gap: var(--ui-space-1);
92
96
  box-sizing: border-box;
93
97
  min-inline-size: 0;
94
98
  max-inline-size: 100%;
@@ -113,8 +117,43 @@
113
117
  text-overflow: ellipsis;
114
118
  }
115
119
 
116
- /* Trim leading while retaining the font's ascent and descent. A cap-to-baseline box
117
- would crop glyphs where the label clips horizontal overflow for ellipsis. */
120
+ .label:empty {
121
+ display: none;
122
+ }
123
+
124
+ /* Icon content has its own flex item so label ellipsis never clips its strokes. */
125
+ .icon {
126
+ display: inline-flex;
127
+ align-items: center;
128
+ justify-content: center;
129
+ flex: none;
130
+ }
131
+
132
+ .icon:empty {
133
+ display: none;
134
+ }
135
+
136
+ .icon :slotted(svg) {
137
+ display: block;
138
+ inline-size: 1em;
139
+ block-size: 1em;
140
+ flex: none;
141
+ }
142
+
143
+ /* Ordinary icon-plus-text children keep inline ellipsis, with explicit glyph spacing. */
144
+ .label :slotted(svg) {
145
+ inline-size: 1em;
146
+ block-size: 1em;
147
+ vertical-align: middle;
148
+ margin-inline-end: var(--ui-space-1);
149
+ }
150
+
151
+ .label:has(svg) {
152
+ text-box-trim: none;
153
+ }
154
+
155
+ /* Text-only badges retain their trimmed inline baseline. Icon content needs a flex row;
156
+ trimming its label separately keeps the glyph centered without changing adjacent lines. */
118
157
  @supports (text-box-trim: trim-both) {
119
158
  :host {
120
159
  display: inline-block;
@@ -124,6 +163,15 @@
124
163
  text-box-trim: trim-both;
125
164
  text-box-edge: text;
126
165
  }
166
+ :host:has(.icon:not(:empty)),
167
+ :host:has(.label svg) {
168
+ display: inline-flex;
169
+ text-box-trim: none;
170
+ }
171
+ :host:has(.icon:not(:empty)) .label {
172
+ text-box-trim: trim-both;
173
+ text-box-edge: text;
174
+ }
127
175
  }
128
176
 
129
177
  :host([size="xs"]) {
@@ -262,6 +310,14 @@
262
310
  justify-content: center;
263
311
  }
264
312
 
313
+ :host([shape="square"]) .label :slotted(svg) {
314
+ margin-inline-end: 0;
315
+ }
316
+
317
+ :host([shape="square"]) .label:empty {
318
+ display: none;
319
+ }
320
+
265
321
  /* A dot uses the badge's tone recipe; only its silhouette and visible label change. */
266
322
  :host([shape="dot"]) {
267
323
  position: relative;
@@ -181,6 +181,7 @@
181
181
  display: inline-flex;
182
182
  align-items: center;
183
183
  justify-content: center;
184
+ column-gap: var(--ui-space-2);
184
185
  vertical-align: middle;
185
186
  color: var(--_tone-text);
186
187
  }
@@ -230,7 +231,6 @@
230
231
  .spinner-wrap {
231
232
  display: inline-flex;
232
233
  flex: none;
233
- margin-inline-end: var(--ui-space-2);
234
234
  vertical-align: middle;
235
235
  }
236
236
 
@@ -293,7 +293,7 @@
293
293
  transform: translateY(-20%) rotate(45deg);
294
294
  }
295
295
 
296
- :host[aria-expanded="true"] .disclosure-icon {
296
+ :host[aria-expanded="true"] > .row > .disclosure > .disclosure-icon {
297
297
  transform: rotate(0deg);
298
298
  }
299
299