@threadlabs/looma 0.23.3 → 0.23.5
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.
- package/components/ui-badge/ui-badge.html +37 -3
- package/components/ui-list-item/ui-list-item.html +8 -1
- package/components/ui-tree/ui-tree.html +6 -1
- package/components/ui-tree/ui-tree.js +8 -0
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/styles/ui-badge.css +35 -0
- package/styles/ui-list-item.css +5 -1
- package/vanilla/UiBadge.d.ts +1 -1
- package/vanilla/UiBadge.js +5 -2
- package/vanilla/UiListItem.d.ts +1 -0
- package/vanilla/UiListItem.js +3 -1
- package/vanilla/UiTree.d.ts +1 -0
- package/vanilla/UiTree.js +1 -1
- package/vue/UiBadge.d.ts +3 -3
- package/vue/UiBadge.vue +39 -6
- package/vue/UiListItem.d.ts +9 -0
- package/vue/UiListItem.vue +28 -2
- package/vue/UiTree.d.ts +8 -0
- package/vue/UiTree.vue +9 -1
- package/vue/chunks/UiBadge.js +10 -5
- package/vue/chunks/UiListItem.js +23 -1
- package/vue/chunks/UiTree.js +5 -2
- package/vue/components.css +91 -57
|
@@ -7,17 +7,22 @@
|
|
|
7
7
|
>Which colour the badge speaks in. neutral is a quiet grey for plain labels; accent draws the eye in the accent colour; info, success, warning, and danger
|
|
8
8
|
mark a status, so match the tone to what the badge says. For a category rather than a status, set the --ui-badge-color hook on the badge instead: any CSS
|
|
9
9
|
colour, which overrides the tone.</prop>
|
|
10
|
-
<prop name="shape" type="keyword" values="pill, tag" default="pill"
|
|
11
|
-
>Silhouette. pill is rounded at both ends; tag is a label
|
|
10
|
+
<prop name="shape" type="keyword" values="pill, tag, dot" default="pill"
|
|
11
|
+
>Silhouette. pill is rounded at both ends; tag is a pointed label. dot is a compact circular signal with visually hidden text: include a state label, or set
|
|
12
|
+
aria-hidden when the surrounding control already names that state.</prop>
|
|
12
13
|
<prop name="size" type="keyword" values="xs, md" default="md">Scale. xs is a compact count beside small controls; md is the usual text badge.</prop>
|
|
13
14
|
</defs>
|
|
14
|
-
<span><slot></slot></span>
|
|
15
|
+
<span><span class="label"><slot></slot></span></span>
|
|
15
16
|
<style>
|
|
16
17
|
/* This component's hooks style the element they are set on, and never a nested one. */
|
|
17
18
|
@property --ui-badge-border {
|
|
18
19
|
syntax: "*";
|
|
19
20
|
inherits: false;
|
|
20
21
|
}
|
|
22
|
+
@property --ui-badge-dot-size {
|
|
23
|
+
syntax: "*";
|
|
24
|
+
inherits: false;
|
|
25
|
+
}
|
|
21
26
|
@property --ui-badge-color {
|
|
22
27
|
syntax: "*";
|
|
23
28
|
inherits: false;
|
|
@@ -216,6 +221,29 @@
|
|
|
216
221
|
--_badge-text: var(--ui-info-subtle-text, var(--ui-info-solid));
|
|
217
222
|
}
|
|
218
223
|
|
|
224
|
+
/* A dot uses the badge's tone recipe; only its silhouette and visible label change. */
|
|
225
|
+
:host-state([shape="dot"]) {
|
|
226
|
+
position: relative;
|
|
227
|
+
box-sizing: border-box;
|
|
228
|
+
flex: none;
|
|
229
|
+
inline-size: var(--ui-badge-dot-size, var(--ui-space-2));
|
|
230
|
+
block-size: var(--ui-badge-dot-size, var(--ui-space-2));
|
|
231
|
+
min-inline-size: var(--ui-badge-dot-size, var(--ui-space-2));
|
|
232
|
+
min-block-size: var(--ui-badge-dot-size, var(--ui-space-2));
|
|
233
|
+
padding: 0;
|
|
234
|
+
border-radius: var(--ui-radius-round);
|
|
235
|
+
text-box-trim: none;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
:host-state([shape="dot"]) .label {
|
|
239
|
+
position: absolute;
|
|
240
|
+
inline-size: 1px;
|
|
241
|
+
block-size: 1px;
|
|
242
|
+
overflow: hidden;
|
|
243
|
+
clip-path: inset(50%);
|
|
244
|
+
white-space: nowrap;
|
|
245
|
+
}
|
|
246
|
+
|
|
219
247
|
/* The clipped point needs an inset surface over an outer border-colour shape: a native border
|
|
220
248
|
has no diagonal edge to follow. Keep this edge for every tag variant. */
|
|
221
249
|
:host-state([shape="tag"]) {
|
|
@@ -251,6 +279,12 @@
|
|
|
251
279
|
}
|
|
252
280
|
|
|
253
281
|
@media (forced-colors: active) {
|
|
282
|
+
:host-state([shape="dot"]) {
|
|
283
|
+
forced-color-adjust: none;
|
|
284
|
+
border-color: CanvasText;
|
|
285
|
+
background: CanvasText;
|
|
286
|
+
}
|
|
287
|
+
|
|
254
288
|
:host-state([shape="tag"]) {
|
|
255
289
|
forced-color-adjust: none;
|
|
256
290
|
background: CanvasText;
|
|
@@ -6,6 +6,9 @@
|
|
|
6
6
|
<prop name="current" type="boolean" default="false"
|
|
7
7
|
>Marks the item as the current one, such as the site you are in: it takes the selected surface and aria-current="true", which assistive technology
|
|
8
8
|
announces. Set it on one item at a time.</prop>
|
|
9
|
+
<prop name="highlighted" type="boolean" default="false"
|
|
10
|
+
>Gives an item a quiet accent wash without changing its text or announcing selection. Several items may be highlighted, such as new messages. Describe the
|
|
11
|
+
reason in the item's text; use current only for the current destination.</prop>
|
|
9
12
|
</defs>
|
|
10
13
|
<li from:aria-current="current">
|
|
11
14
|
<span class="leading"><slot name="leading"></slot></span>
|
|
@@ -77,6 +80,10 @@
|
|
|
77
80
|
border-color: var(--ui-border-strong);
|
|
78
81
|
}
|
|
79
82
|
|
|
83
|
+
:host-state([highlighted]) {
|
|
84
|
+
background: var(--ui-selection-surface);
|
|
85
|
+
}
|
|
86
|
+
|
|
80
87
|
:host-state([current]) {
|
|
81
88
|
background: var(--ui-selection-surface);
|
|
82
89
|
color: var(--ui-selection-text);
|
|
@@ -169,7 +176,7 @@
|
|
|
169
176
|
outline: var(--ui-focus-width) solid Highlight;
|
|
170
177
|
outline-offset: calc(-1 * var(--ui-focus-width));
|
|
171
178
|
}
|
|
172
|
-
:host-state([current]):not(:has(a:focus-visible)) {
|
|
179
|
+
:is(:host-state([current]), :host-state([highlighted])):not(:has(a:focus-visible)) {
|
|
173
180
|
outline: var(--ui-border-width) solid Highlight;
|
|
174
181
|
outline-offset: calc(-1 * var(--ui-border-width));
|
|
175
182
|
}
|
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
<prop name="label" type="string" default="Tree">The tree's accessible name, announced when focus enters it. Name what the tree holds.</prop>
|
|
7
7
|
<prop name="selection" type="keyword" values="none, single, multiple" default="none"
|
|
8
8
|
>How selection works. None keeps rows for navigation and expansion; single requests one selected item; multiple shows checkboxes and requests an item with
|
|
9
|
-
its descendants. The application owns each Tree Item's selected state and responds to select
|
|
9
|
+
its descendants. The application owns each Tree Item's selected state and responds to select. Single-selection rows also request activate on a row click
|
|
10
|
+
or Enter, including an already selected row. Space requests selection only; controls and disabled rows do not activate.</prop>
|
|
10
11
|
<prop name="hoverExpandDelay" type="number" default="700"
|
|
11
12
|
>How long, in milliseconds, a dragged item must hover over the middle of a collapsed branch before the branch opens to receive it. 0 opens it at
|
|
12
13
|
once.</prop>
|
|
@@ -41,6 +42,10 @@
|
|
|
41
42
|
<prop name="resultingDepth" required type="integer"></prop>
|
|
42
43
|
<prop name="trigger" required type="keyword" values="keyboard, pointer, programmatic"></prop>
|
|
43
44
|
</event>
|
|
45
|
+
<event name="activate" type="object">
|
|
46
|
+
<prop name="id" required type="string"></prop>
|
|
47
|
+
<prop name="trigger" required type="keyword" values="keyboard, pointer"></prop>
|
|
48
|
+
</event>
|
|
44
49
|
<event name="select" type="object">
|
|
45
50
|
<prop name="ids" required type="list">
|
|
46
51
|
<prop type="string"></prop>
|
|
@@ -202,6 +202,7 @@ export default function controller(host) {
|
|
|
202
202
|
event.stopPropagation();
|
|
203
203
|
selectItem(item, "pointer");
|
|
204
204
|
focusItem(item);
|
|
205
|
+
if (selectionMode() === "single" && !checkbox) host.dispatch("activate", { id: itemId(item), trigger: "pointer" });
|
|
205
206
|
if (checkbox) requestAnimationFrame(syncSelection);
|
|
206
207
|
return;
|
|
207
208
|
}
|
|
@@ -382,6 +383,13 @@ export default function controller(host) {
|
|
|
382
383
|
if (interactive(event)) return;
|
|
383
384
|
const current = itemFromEvent(event);
|
|
384
385
|
if (!current) return;
|
|
386
|
+
if (event.key === "Enter" && selectionMode() === "single" && !event.altKey && !event.ctrlKey && !event.metaKey) {
|
|
387
|
+
if (current.getAttribute("aria-disabled") === "true") return;
|
|
388
|
+
event.preventDefault();
|
|
389
|
+
selectItem(current, "keyboard");
|
|
390
|
+
host.dispatch("activate", { id: itemId(current), trigger: "keyboard" });
|
|
391
|
+
return;
|
|
392
|
+
}
|
|
385
393
|
if (event.key === " " && selectionMode() !== "none") {
|
|
386
394
|
event.preventDefault();
|
|
387
395
|
selectItem(current, "keyboard");
|