tobogganSe connecter

library

Prebuilt pebble components: drop-in custom elements, no compiler needed

Clone avec HTTPS, un jeton personnel en mot de passe, ou avec SSH, une clé ajoutée dans vos paramètres.

Dernier runAucun
0Étoiles
0Forks
2Issues
118 lignes · 3422 octetsBrut · Historique
1/* Combobox: the suggestions popup of <pebble-combobox>, under the server's
2 search form, as full-width rows of poster, title and year.
3
4 One sheet, two uses: the element adopts it as is (define's scoped: false),
5 and dist/combobox.css is the same rules raw, for the page to <link>. So
6 every selector starts at the tag: that is its scope (inside @scope (tag)
7 the tag itself would not match). The form itself is the page's to style; the sheet only gives the field and the
8 button their 44px.
9
10 Each option is the server's <li> around a link; the sheet lays the link out
11 as a row and sizes an <img> in it as a small poster. State is attributes:
12 [data-open] and [data-loading] on the host, [data-active] (and
13 aria-selected="true") on the active option, [hidden] on the popup.
14
15 Theming: every value is a --pebble-combobox-* custom property with a
16 fallback, light and dark defaults chosen by prefers-color-scheme; page
17 tokens (--accent) inherit in. */
18
19pebble-combobox {
20 --_ink: var(--pebble-combobox-ink, #1a1a1a);
21 --_muted: var(--pebble-combobox-muted, #5c5f66);
22 --_surface: var(--pebble-combobox-surface, #ffffff);
23 --_border: var(--pebble-combobox-border, #d0d0d0);
24 --_active: var(--pebble-combobox-active, #e7f0fb);
25 --_shadow: var(--pebble-combobox-shadow, 0 8px 24px rgba(0, 0, 0, 0.18));
26 --_focus: var(--pebble-combobox-focus, var(--accent, #1971c2));
27
28 position: relative;
29 display: block;
30}
31
32@media (prefers-color-scheme: dark) {
33 pebble-combobox {
34 --_ink: var(--pebble-combobox-ink, #f1f3f5);
35 --_muted: var(--pebble-combobox-muted, #adb5bd);
36 --_surface: var(--pebble-combobox-surface, #1f1f1f);
37 --_border: var(--pebble-combobox-border, #495057);
38 --_active: var(--pebble-combobox-active, #1c3a5e);
39 --_shadow: var(--pebble-combobox-shadow, 0 8px 24px rgba(0, 0, 0, 0.6));
40 }
41}
42
43pebble-combobox input:not([type="hidden"]),
44pebble-combobox button {
45 min-height: var(--pebble-combobox-size, 44px);
46 box-sizing: border-box;
47}
48
49pebble-combobox .popup {
50 position: absolute;
51 top: calc(100% + var(--pebble-combobox-offset, 0.25rem));
52 inset-inline: 0;
53 z-index: var(--pebble-combobox-z-index, 50);
54 max-height: var(--pebble-combobox-max-height, min(60vh, 26rem));
55 overflow-y: auto;
56 overscroll-behavior: contain;
57 border: 1px solid var(--_border);
58 border-radius: var(--pebble-combobox-radius, 0.5rem);
59 background: var(--_surface);
60 color: var(--_ink);
61 box-shadow: var(--_shadow);
62
63 &[hidden] {
64 display: none;
65 }
66}
67
68pebble-combobox .listbox {
69 margin: 0;
70 padding: 0.25rem 0;
71 list-style: none;
72
73 & > li {
74 margin: 0;
75 padding: 0;
76 }
77
78 & > li > a,
79 & > li:not(:has(a)) {
80 display: flex;
81 align-items: center;
82 gap: 0.75rem;
83 box-sizing: border-box;
84 min-height: var(--pebble-combobox-size, 44px);
85 padding: 0.375rem 0.75rem;
86 color: inherit;
87 text-decoration: none;
88 }
89
90 & img {
91 flex: none;
92 width: var(--pebble-combobox-poster-width, 2.5rem);
93 aspect-ratio: 2 / 3;
94 height: auto;
95 object-fit: cover;
96 border-radius: 0.25rem;
97 background: var(--_border);
98 }
99
100 & small,
101 & time {
102 color: var(--_muted);
103 }
104
105 & > li[data-active],
106 & > li:hover {
107 background: var(--_active);
108 }
109
110 & > li[data-active] {
111 outline: 2px solid var(--_focus);
112 outline-offset: -2px;
113 }
114}
115
116pebble-combobox[data-loading] input:not([type="hidden"]) {
117 cursor: progress;
118}