Skip to content

Commit a00901c

Browse files
committed
1 parent 94f7210 commit a00901c

6 files changed

Lines changed: 148 additions & 133 deletions

File tree

‎ui/src/components/select-picker.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { html, nothing } from "lit";
22
import "./web-awesome-select.ts";
3+
import "../styles/select-picker.css";
34

45
export type PickerOption = {
56
value: string;

‎ui/src/pages/config/language-select.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { html } from "lit";
22
import "../../components/web-awesome-select.ts";
3+
import "../../styles/select-picker.css";
34
import { SUPPORTED_LOCALES, t, type Locale } from "../../i18n/index.ts";
45

56
export function languageLabel(locale: Locale) {

‎ui/src/pages/workboard/workboard.e2e.test.ts‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -408,6 +408,21 @@ suite.define(() => {
408408
.locator(".workboard-toolbar__filters .workboard-select")
409409
.nth(1);
410410
const priorityCombobox = prioritySelect.getByRole("combobox");
411+
const directRoutePickerStyles = await prioritySelect.evaluate((select) => {
412+
const label = select.querySelector(".picker-select__label");
413+
const copy = select.querySelector(".picker-select__copy");
414+
if (!label || !copy) {
415+
throw new Error("Workboard picker style probe did not render");
416+
}
417+
return {
418+
copyDisplay: getComputedStyle(copy).display,
419+
labelFontWeight: getComputedStyle(label).fontWeight,
420+
};
421+
});
422+
expect(directRoutePickerStyles).toEqual({
423+
copyDisplay: "grid",
424+
labelFontWeight: "650",
425+
});
411426
await priorityCombobox.focus();
412427
await writable.page.keyboard.press("ArrowDown");
413428
await expect.poll(() => priorityCombobox.getAttribute("aria-expanded")).toBe("true");

‎ui/src/styles/select-picker.css‎

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
wa-select.settings-select {
2+
--wa-form-control-activated-color: var(--primary);
3+
}
4+
5+
wa-select.settings-select::part(combobox) {
6+
min-height: var(--settings-control-height);
7+
padding-inline: 10px;
8+
border: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
9+
border-radius: var(--radius-md);
10+
background: color-mix(in srgb, var(--bg) 80%, var(--bg-elevated) 20%);
11+
color: var(--text);
12+
cursor: var(--cursor-action);
13+
transition: border-color var(--duration-fast) var(--ease-out);
14+
}
15+
16+
/* [open] is required alongside :focus-within: Chromium does not propagate
17+
:focus-within to the host while a slotted option holds focus, so the open
18+
state must key off the reflected attribute or the stock ring leaks through. */
19+
wa-select.settings-select[open]::part(combobox),
20+
wa-select.settings-select:focus-within::part(combobox) {
21+
outline: none;
22+
border-color: color-mix(in srgb, var(--accent) 55%, var(--border) 45%);
23+
box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 18%, transparent);
24+
}
25+
26+
wa-select.settings-select::part(expand-icon) {
27+
margin-inline-start: var(--space-2);
28+
font-size: var(--control-ui-text-sm);
29+
color: var(--muted);
30+
}
31+
32+
wa-select.settings-select::part(listbox) {
33+
/* Keep Web Awesome's collision-aware bound in the cap; replacing it outright
34+
would let the listbox overflow when the popup has little room to open. */
35+
max-height: min(320px, var(--auto-size-available-height, calc(100vh - 48px)));
36+
padding: 6px;
37+
border: 1px solid color-mix(in srgb, var(--border-strong) 86%, transparent);
38+
border-radius: var(--radius-md);
39+
background: var(--bg-elevated);
40+
box-shadow: var(--shadow-lg);
41+
color: var(--text);
42+
}
43+
44+
wa-select.settings-select wa-option {
45+
padding: 6px 8px;
46+
border-radius: calc(var(--radius-md) - 4px);
47+
font-size: var(--control-ui-text-md);
48+
color: var(--text);
49+
cursor: var(--cursor-action);
50+
}
51+
52+
/* The roving "current" option already carries the accent fill; the global
53+
:focus-visible accent outline on top of it is pure noise. */
54+
wa-select.settings-select wa-option:focus-visible {
55+
outline: none;
56+
}
57+
58+
wa-select.settings-select wa-option:state(current) {
59+
color: var(--primary-foreground);
60+
}
61+
62+
.picker-select__option {
63+
color: var(--text);
64+
}
65+
66+
.picker-select [slot="start"] {
67+
display: inline-flex;
68+
align-items: center;
69+
}
70+
71+
.picker-select__label {
72+
min-width: 0;
73+
overflow: hidden;
74+
text-overflow: ellipsis;
75+
white-space: nowrap;
76+
font-weight: 650;
77+
}
78+
79+
.picker-select__copy {
80+
display: grid;
81+
gap: 2px;
82+
min-width: 0;
83+
}
84+
85+
.picker-select__description {
86+
min-width: 0;
87+
overflow: hidden;
88+
color: var(--muted);
89+
font-size: 0.75rem;
90+
line-height: 1.2;
91+
text-overflow: ellipsis;
92+
white-space: normal;
93+
}
94+
95+
/* The model picker composes the shared picker and loads this same stylesheet. */
96+
.model-picker {
97+
display: grid;
98+
gap: 6px;
99+
min-width: 0;
100+
}
101+
102+
.model-picker__provider-icon {
103+
width: 20px;
104+
height: 20px;
105+
flex: 0 0 20px;
106+
}
107+
108+
.model-picker__provider-icon.provider-brand-icon--fallback {
109+
font-size: 9px;
110+
}
111+
112+
.model-picker__custom[hidden] {
113+
display: none;
114+
}
115+
116+
/* Forced colors suppresses the box-shadow ring and accent fill that stand in
117+
for the outlines removed above, so restore system-color outlines there. */
118+
@media (forced-colors: active) {
119+
wa-select.settings-select[open]::part(combobox),
120+
wa-select.settings-select:focus-within::part(combobox) {
121+
outline: 2px solid SelectedItem;
122+
outline-offset: 2px;
123+
}
124+
125+
wa-select.settings-select wa-option:focus-visible {
126+
outline: 2px solid SelectedItem;
127+
outline-offset: 2px;
128+
}
129+
}

‎ui/src/styles/settings-controls.css‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,8 @@ select.settings-select:not([multiple]) {
107107
font-size: var(--control-ui-input-text-size);
108108
}
109109

110-
/* Native controls own their box. Web Awesome selects are styled by the full
111-
settings workspace stylesheet. */
110+
/* Native controls own their box. Web Awesome selects are styled by their
111+
component-owned stylesheet. */
112112
.settings-input,
113113
select.settings-select {
114114
border: 1px solid color-mix(in srgb, var(--border) 70%, transparent);

‎ui/src/styles/settings.css‎

Lines changed: 0 additions & 131 deletions
Original file line numberDiff line numberDiff line change
@@ -535,137 +535,6 @@ wa-switch.settings-toggle {
535535
top: 6px;
536536
}
537537

538-
/* ── Web Awesome select ── */
539-
540-
wa-select.settings-select {
541-
--wa-form-control-activated-color: var(--primary);
542-
}
543-
544-
wa-select.settings-select::part(combobox) {
545-
min-height: var(--settings-control-height);
546-
padding-inline: 10px;
547-
border: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
548-
border-radius: var(--radius-md);
549-
background: color-mix(in srgb, var(--bg) 80%, var(--bg-elevated) 20%);
550-
color: var(--text);
551-
cursor: var(--cursor-action);
552-
transition: border-color var(--duration-fast) var(--ease-out);
553-
}
554-
555-
/* [open] is required alongside :focus-within: Chromium does not propagate
556-
:focus-within to the host while a slotted option holds focus, so the open
557-
state must key off the reflected attribute or the stock ring leaks through. */
558-
wa-select.settings-select[open]::part(combobox),
559-
wa-select.settings-select:focus-within::part(combobox) {
560-
outline: none;
561-
border-color: color-mix(in srgb, var(--accent) 55%, var(--border) 45%);
562-
box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 18%, transparent);
563-
}
564-
565-
wa-select.settings-select::part(expand-icon) {
566-
margin-inline-start: var(--space-2);
567-
font-size: var(--control-ui-text-sm);
568-
color: var(--muted);
569-
}
570-
571-
wa-select.settings-select::part(listbox) {
572-
/* Keep Web Awesome's collision-aware bound in the cap; replacing it outright
573-
would let the listbox overflow when the popup has little room to open. */
574-
max-height: min(320px, var(--auto-size-available-height, calc(100vh - 48px)));
575-
padding: 6px;
576-
border: 1px solid color-mix(in srgb, var(--border-strong) 86%, transparent);
577-
border-radius: var(--radius-md);
578-
background: var(--bg-elevated);
579-
box-shadow: var(--shadow-lg);
580-
color: var(--text);
581-
}
582-
583-
wa-select.settings-select wa-option {
584-
padding: 6px 8px;
585-
border-radius: calc(var(--radius-md) - 4px);
586-
font-size: var(--control-ui-text-md);
587-
color: var(--text);
588-
cursor: var(--cursor-action);
589-
}
590-
591-
/* The roving "current" option already carries the accent fill; the global
592-
:focus-visible accent outline on top of it is pure noise. */
593-
wa-select.settings-select wa-option:focus-visible {
594-
outline: none;
595-
}
596-
597-
wa-select.settings-select wa-option:state(current) {
598-
color: var(--primary-foreground);
599-
}
600-
601-
.picker-select__option {
602-
color: var(--text);
603-
}
604-
605-
.picker-select [slot="start"] {
606-
display: inline-flex;
607-
align-items: center;
608-
}
609-
610-
.picker-select__label {
611-
min-width: 0;
612-
overflow: hidden;
613-
text-overflow: ellipsis;
614-
white-space: nowrap;
615-
font-weight: 650;
616-
}
617-
618-
.picker-select__copy {
619-
display: grid;
620-
gap: 2px;
621-
min-width: 0;
622-
}
623-
624-
.picker-select__description {
625-
min-width: 0;
626-
overflow: hidden;
627-
color: var(--muted);
628-
font-size: 0.75rem;
629-
line-height: 1.2;
630-
text-overflow: ellipsis;
631-
white-space: normal;
632-
}
633-
634-
.model-picker {
635-
display: grid;
636-
gap: 6px;
637-
min-width: 0;
638-
}
639-
640-
.model-picker__provider-icon {
641-
width: 20px;
642-
height: 20px;
643-
flex: 0 0 20px;
644-
}
645-
646-
.model-picker__provider-icon.provider-brand-icon--fallback {
647-
font-size: 9px;
648-
}
649-
650-
.model-picker__custom[hidden] {
651-
display: none;
652-
}
653-
654-
/* Forced colors suppresses the box-shadow ring and accent fill that stand in
655-
for the outlines removed above, so restore system-color outlines there. */
656-
@media (forced-colors: active) {
657-
wa-select.settings-select[open]::part(combobox),
658-
wa-select.settings-select:focus-within::part(combobox) {
659-
outline: 2px solid SelectedItem;
660-
outline-offset: 2px;
661-
}
662-
663-
wa-select.settings-select wa-option:focus-visible {
664-
outline: 2px solid SelectedItem;
665-
outline-offset: 2px;
666-
}
667-
}
668-
669538
textarea.settings-input {
670539
min-height: 88px;
671540
resize: vertical;

0 commit comments

Comments
 (0)