@webority/theme 0.138.0 → 0.139.0

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.
@@ -0,0 +1,551 @@
1
+ // The select family: <wui-select> in every mode (single, multiple, search, tag, country),
2
+ // its menu and its parts (chips, draft input, option rows).
3
+
4
+ .wui-select {
5
+ position: relative;
6
+ min-width: 0;
7
+ }
8
+ .wui-select-control {
9
+ display: flex;
10
+ align-items: center;
11
+ justify-content: space-between;
12
+ gap: var(--wui-space-sm);
13
+ padding: 0 var(--wui-space-md);
14
+ border-radius: var(--wui-radius-sm);
15
+ color: var(--color-text-body);
16
+ text-align: left;
17
+ cursor: pointer;
18
+ width: 100%;
19
+ min-width: 0;
20
+ }
21
+ .wui-select-control > span {
22
+ min-width: 0;
23
+ overflow: hidden;
24
+ text-overflow: ellipsis;
25
+ white-space: nowrap;
26
+ }
27
+ .wui-select-control:disabled {
28
+ cursor: not-allowed;
29
+ opacity: var(--wui-disabled-opacity);
30
+ }
31
+ .wui-select-control:hover:not(:disabled):not([aria-invalid="true"]):not([aria-disabled="true"]) {
32
+ // Not while invalid: an errored control (aria-invalid mirrored from the host) holds its red
33
+ // border on hover rather than reverting to the grey hover one.
34
+ border-color: var(--color-field-border-hover);
35
+ }
36
+ .wui-select-control:focus:not([aria-invalid="true"]):not(.error):not(.is-invalid) {
37
+ background: var(--color-field-bg);
38
+ border-color: var(--color-field-border);
39
+ }
40
+ // Keyboard focus draws a ring, not just the 1px border change: a control that only recolours its
41
+ // border fails WCAG 2.4.7 / 2.4.11. A single-select button and a multi-select div hold focus
42
+ // themselves; the typing variants (autocomplete, tag input, allow-custom multi-select) keep it on
43
+ // an inner input, so the ring follows `:has(:focus-visible)`. It uses the shared keyboard ring
44
+ // colour, not the soft field focus border, so it clears 3:1 in both themes.
45
+ .wui-select-control:focus-visible,
46
+ .wui-select-control:has(> .wui-select-input:focus-visible),
47
+ .wui-select-control:has(.wui-select-draft:focus-visible) {
48
+ outline: var(--wui-focus-ring-width) solid var(--color-focus-ring);
49
+ outline-offset: var(--wui-focus-ring-offset);
50
+ }
51
+ .wui-select-caret {
52
+ flex-shrink: 0;
53
+ color: var(--color-text-subtle);
54
+ --wui-select-ease: ease;
55
+ transition: transform var(--wui-duration-fast) var(--wui-select-ease);
56
+ }
57
+ .wui-select-caret path {
58
+ stroke-width: 2px;
59
+ }
60
+ .wui-select-control.open .wui-select-caret {
61
+ transform: rotate(180deg);
62
+ }
63
+ .wui-select-placeholder {
64
+ color: var(--color-text-subtle);
65
+ }
66
+ .wui-select-value {
67
+ flex: 1 1 auto;
68
+ min-width: 0;
69
+ overflow: hidden;
70
+ text-overflow: ellipsis;
71
+ white-space: nowrap;
72
+ }
73
+
74
+ // Sizes: mirror AppInput's .input-sm / .input-lg so a select lines up with the
75
+ // text fields beside it. md is the base .wui-select-control height.
76
+ .wui-select-sm .wui-select-control {
77
+ height: var(--wui-control-sm);
78
+ min-height: var(--wui-control-sm);
79
+ --wui-select-font-size: 13px;
80
+ font-size: var(--wui-select-font-size);
81
+ border-radius: var(--wui-radius-sm);
82
+ }
83
+ .wui-select-lg .wui-select-control {
84
+ height: var(--wui-control-lg);
85
+ min-height: var(--wui-control-lg);
86
+ --wui-select-font-size: 16px;
87
+ font-size: var(--wui-select-font-size);
88
+ border-radius: var(--wui-radius-sm);
89
+ }
90
+ // Multi-select grows with its chips, so a size sets the FLOOR (min-height from the rule
91
+ // above) but never a fixed height: reset height:auto so a second row of chips can appear.
92
+ .wui-select-sm .wui-select-multi,
93
+ .wui-select-lg .wui-select-multi {
94
+ height: auto;
95
+ }
96
+
97
+ // Clear (✕): sits between the value and the caret, shown only once a value is
98
+ // chosen. It is a <span role="button"> inside the trigger <button> (a nested
99
+ // <button> is invalid); the JS stops its click from toggling the menu.
100
+ .wui-select-control > span[data-label] {
101
+ flex: 1;
102
+ }
103
+ .wui-select-reset {
104
+ flex-shrink: 0;
105
+ display: grid;
106
+ place-items: center;
107
+ width: 20px;
108
+ height: 20px;
109
+ border-radius: 50%;
110
+ --wui-select-reset-font-size: 12px;
111
+ --wui-select-hover-duration: 0.12s;
112
+ --wui-select-ease: ease;
113
+ font-size: var(--wui-select-reset-font-size);
114
+ color: var(--color-text-subtle);
115
+ cursor: pointer;
116
+ transition:
117
+ background var(--wui-select-hover-duration) var(--wui-select-ease),
118
+ color var(--wui-select-hover-duration) var(--wui-select-ease);
119
+ }
120
+ .wui-select-reset:hover {
121
+ background: var(--color-bg-muted);
122
+ color: var(--color-text);
123
+ }
124
+
125
+ // Leading icon + static prefix (e.g. a funnel glyph, or "Sort:"): cluster at the
126
+ // start of the control, before the value. Mainly for the mini toolbar picker.
127
+ .wui-select-icon {
128
+ flex-shrink: 0;
129
+ display: inline-flex;
130
+ color: var(--color-text-muted);
131
+ --wui-select-icon-size: 15px;
132
+ font-size: var(--wui-select-icon-size);
133
+ }
134
+ .wui-select-prefix {
135
+ flex-shrink: 0;
136
+ color: var(--color-text-subtle);
137
+ font-weight: var(--wui-fw-normal);
138
+ }
139
+
140
+ // Per-option leading glyph: wraps icon + label as one node (menu row, the selected
141
+ // value in the control, and chips all render through optionLabelHtml). The icon inherits
142
+ // the row's colour so it recolours with the label on hover / when selected.
143
+ .wui-opt-label {
144
+ display: inline-flex;
145
+ align-items: center;
146
+ gap: var(--wui-space-sm);
147
+ min-width: 0;
148
+ vertical-align: middle;
149
+ }
150
+ .wui-opt-label > .wui-icon {
151
+ flex-shrink: 0;
152
+ width: 15px;
153
+ height: 15px;
154
+ }
155
+
156
+ .wui-select-menu {
157
+ position: absolute;
158
+ z-index: 40;
159
+ top: calc(100% + 6px);
160
+ left: 0;
161
+ right: 0;
162
+ background: var(--color-bg-subtle);
163
+ border: 1px solid var(--color-border);
164
+ border-radius: var(--wui-radius-sm);
165
+ corner-shape: squircle;
166
+ box-shadow: var(--wui-shadow-popover);
167
+ padding: var(--wui-space-xs);
168
+ overflow: hidden;
169
+ }
170
+ // Portalled to <body>: fixed-positioned (top/left set inline from the
171
+ // trigger rect) so the menu overlays instead of being clipped by a
172
+ // scrollable modal / table card. Sits above the modal layer.
173
+ .wui-select-menu-fixed {
174
+ position: fixed;
175
+ z-index: var(--wui-z-menu);
176
+ right: auto;
177
+ top: auto;
178
+ left: auto;
179
+ }
180
+ // Search box matches the search bar: rounded field, leading icon turns
181
+ // primary.
182
+ .wui-select-search {
183
+ position: relative;
184
+ display: flex;
185
+ align-items: center;
186
+ gap: var(--wui-space-sm);
187
+ margin-bottom: var(--wui-space-xs);
188
+ padding: 0 var(--wui-space-md);
189
+ height: 40px;
190
+ border-bottom: 1px solid var(--color-border);
191
+ color: var(--color-text-subtle);
192
+ }
193
+ .wui-select-search:focus-within svg {
194
+ color: var(--color-primary-text);
195
+ }
196
+ .wui-select-clear {
197
+ display: grid;
198
+ place-items: center;
199
+ width: 26px;
200
+ height: 26px;
201
+ border: none;
202
+ background: transparent;
203
+ padding: 0;
204
+ // Sits at the box's 12px right padding; a small negative margin nudges it
205
+ // closer to the edge so it lines up with the field's own trailing controls.
206
+ margin-right: calc(-1 * var(--wui-space-xs));
207
+ --wui-select-clear-font-size: 20px;
208
+ --wui-select-clear-line-height: 1;
209
+ font-size: var(--wui-select-clear-font-size);
210
+ // Tight line box: at normal line-height the icon's box is taller than the
211
+ // button, so bootstrap-icons' baseline offset drifts the glyph low.
212
+ line-height: var(--wui-select-clear-line-height);
213
+ cursor: pointer;
214
+ color: var(--color-text-subtle);
215
+ }
216
+ .wui-select-clear:hover {
217
+ color: var(--color-text);
218
+ }
219
+ .wui-select-input {
220
+ flex: 1;
221
+ border: none;
222
+ outline: none;
223
+ font-size: var(--wui-fs-sm);
224
+ font-family: inherit;
225
+ color: var(--color-text-body);
226
+ background: transparent;
227
+ }
228
+ // AppInput's placeholder colour, not the browser default grey.
229
+ .wui-select-input::placeholder {
230
+ color: var(--color-text-subtle);
231
+ }
232
+ .wui-select-options {
233
+ max-height: 300px;
234
+ overflow-y: auto;
235
+ padding: var(--wui-space-xs);
236
+ display: flex;
237
+ flex-direction: column;
238
+ }
239
+ .wui-select-option {
240
+ display: flex;
241
+ align-items: center;
242
+ justify-content: space-between;
243
+ gap: var(--wui-space-sm);
244
+ width: 100%;
245
+ text-align: left;
246
+ padding: var(--wui-space-sm) var(--wui-space-md);
247
+ --wui-select-option-line-height: 1.4;
248
+ line-height: var(--wui-select-option-line-height);
249
+ border: none;
250
+ border-radius: var(--wui-radius-sm);
251
+ corner-shape: squircle;
252
+ background: transparent;
253
+ font-size: var(--wui-fs-sm);
254
+ color: var(--color-text-body);
255
+ cursor: pointer;
256
+ --wui-select-hover-duration: 0.12s;
257
+ --wui-select-ease: ease;
258
+ transition:
259
+ background var(--wui-select-hover-duration) var(--wui-select-ease),
260
+ color var(--wui-select-hover-duration) var(--wui-select-ease);
261
+ }
262
+ // The row under the pointer or the keyboard takes the muted fill, with no outline.
263
+ .wui-select-option:hover,
264
+ .wui-select-option.is-active {
265
+ background: var(--color-bg-muted);
266
+ }
267
+ .wui-select-option.selected,
268
+ .wui-select-option[aria-selected='true'] {
269
+ background: var(--color-primary-soft);
270
+ color: var(--color-primary-text);
271
+ font-weight: var(--wui-fw-semibold);
272
+ }
273
+ .wui-select-empty,
274
+ .wui-select-hint {
275
+ --wui-select-note-padding-x: 10px;
276
+ --wui-select-note-font-size: 13px;
277
+ padding: var(--wui-space-md) var(--wui-select-note-padding-x);
278
+ font-size: var(--wui-select-note-font-size);
279
+ color: var(--color-text-subtle);
280
+ text-align: center;
281
+ }
282
+
283
+ .wui-select-multi[aria-disabled="true"] {
284
+ background: var(--color-bg-muted);
285
+ border-color: var(--color-field-border);
286
+ color: var(--color-text-subtle);
287
+ cursor: not-allowed;
288
+ }
289
+ .wui-select-spinner {
290
+ flex: none;
291
+ width: 1rem;
292
+ height: 1rem;
293
+ color: var(--color-text-subtle);
294
+ border-width: 2px;
295
+ }
296
+
297
+ /* ── Multi-select (chips in the control; check-list dropdown; extends .wui-select) ── */
298
+ .wui-select-multi {
299
+ align-items: center;
300
+ gap: var(--wui-space-sm);
301
+ // The md field height is the floor, so a one-row multi-select lines up with the inputs and buttons beside it.
302
+ min-height: var(--wui-control-md);
303
+ height: auto;
304
+ padding-top: var(--wui-space-xs);
305
+ padding-bottom: var(--wui-space-xs);
306
+ flex-wrap: nowrap;
307
+ }
308
+ .wui-select-chips {
309
+ display: flex;
310
+ flex-wrap: wrap;
311
+ gap: var(--wui-space-xs);
312
+ flex: 1 1 auto;
313
+ min-width: 0;
314
+ align-items: center;
315
+ }
316
+ // Collapse mode (collapse-chips): chips stay on one row; the element folds the overflow into
317
+ // a "+N" counter.
318
+ wui-select[mode="multiple"][collapse-chips] .wui-select-chips {
319
+ flex-wrap: nowrap;
320
+ overflow: hidden;
321
+ }
322
+ .wui-select-multi .wui-select-caret,
323
+ .wui-select-multi .wui-select-icon {
324
+ align-self: center;
325
+ }
326
+ .wui-select-check {
327
+ display: inline-flex;
328
+ align-items: center;
329
+ justify-content: center;
330
+ width: 16px;
331
+ height: 16px;
332
+ flex: none;
333
+ color: var(--color-primary-text);
334
+ opacity: 0;
335
+ }
336
+ .wui-select-option[aria-selected='true'] .wui-select-check {
337
+ opacity: 1;
338
+ }
339
+ .chip-more {
340
+ flex-shrink: 0;
341
+ background: var(--color-primary-soft);
342
+ border-color: transparent;
343
+ color: var(--color-primary-text);
344
+ font-weight: var(--wui-fw-semibold);
345
+ }
346
+ .wui-select-opt-name {
347
+ flex: 1;
348
+ min-width: 0;
349
+ overflow: hidden;
350
+ text-overflow: ellipsis;
351
+ text-align: left;
352
+ }
353
+ .wui-select-multi .wui-select-option {
354
+ display: flex;
355
+ align-items: center;
356
+ gap: var(--wui-space-sm);
357
+ }
358
+ // Rich rows (option `description` / `avatar` / `initials` / `disabled`): the avatar or icon leads
359
+ // the row, and the label and description stack in the text block after it.
360
+ .wui-select-option-rich {
361
+ padding-top: var(--wui-space-sm);
362
+ padding-bottom: var(--wui-space-sm);
363
+ }
364
+ .wui-select-option-rich .wui-opt-avatar {
365
+ order: -1;
366
+ }
367
+ .wui-select-option-text {
368
+ display: flex;
369
+ flex: 1;
370
+ flex-direction: column;
371
+ gap: var(--wui-space-xxs);
372
+ min-width: 0;
373
+ }
374
+ .wui-opt-name,
375
+ .wui-select-opt-desc {
376
+ display: block;
377
+ overflow: hidden;
378
+ text-overflow: ellipsis;
379
+ white-space: nowrap;
380
+ }
381
+ .wui-select-opt-desc {
382
+ font-size: var(--wui-fs-xs);
383
+ font-weight: var(--wui-fw-normal);
384
+ color: var(--color-text-subtle);
385
+ }
386
+ .wui-opt-hint {
387
+ flex: none;
388
+ --wui-select-hint-font-size: 0.75rem;
389
+ font-size: var(--wui-select-hint-font-size);
390
+ color: var(--color-text-muted);
391
+ }
392
+ // A disabled row stays readable and reachable by the keyboard, but never looks choosable:
393
+ // no primary tint on hover or when the arrow keys land on it.
394
+ .wui-select-option[aria-disabled='true'] {
395
+ cursor: not-allowed;
396
+ color: var(--color-text-muted);
397
+ }
398
+ .wui-select-option[aria-disabled='true']:hover,
399
+ .wui-select-option[aria-disabled='true'].is-active {
400
+ background: var(--color-bg-subtle);
401
+ color: var(--color-text-muted);
402
+ }
403
+ .wui-select-option[aria-disabled='true'] .wui-opt-avatar {
404
+ opacity: var(--wui-disabled-opacity);
405
+ }
406
+ // allow-custom: the inline text input wraps with the chips and keeps enough room to type.
407
+ .wui-select-chips > .wui-select-draft {
408
+ flex: 1 0 8ch;
409
+ }
410
+ .wui-select-error:empty {
411
+ display: none;
412
+ }
413
+ .wui-select-draft {
414
+ flex: 1;
415
+ min-width: 60px;
416
+ border: none;
417
+ background: transparent;
418
+ font: inherit;
419
+ color: var(--color-text-body);
420
+ padding: 0;
421
+ margin: 0;
422
+ }
423
+ .wui-select-draft::placeholder {
424
+ color: var(--color-text-subtle);
425
+ }
426
+ .wui-select-draft:focus {
427
+ outline: none;
428
+ }
429
+
430
+ // Floating label for AppSelect: the trigger is a <button>, so there is no
431
+ // :placeholder-shown to key off. :has() raises the label when the control is
432
+ // focused/open, or once a value is chosen (the label span drops
433
+ // .wui-select-placeholder the moment something is selected).
434
+ .field-float:has(.wui-select-control:focus) .float-label,
435
+ .field-float:has(.wui-select-control.open) .float-label,
436
+ .field-float:has([data-label]:not(.wui-select-placeholder)) .float-label {
437
+ top: 0;
438
+ transform: translateY(-50%) scale(0.86);
439
+ }
440
+ .field-float:has(.wui-select-control.open) .float-label {
441
+ color: var(--color-primary-text);
442
+ // The open trigger keeps the field fill, so the label mask takes that same fill.
443
+ background: var(--color-field-bg);
444
+ }
445
+ // Above placement for AppSelect: the same triggers, resting above the box as the input's does.
446
+ .field-float.wui-float-above:has(.wui-select-control:focus) .float-label,
447
+ .field-float.wui-float-above:has(.wui-select-control.open) .float-label,
448
+ .field-float.wui-float-above:has([data-label]:not(.wui-select-placeholder)) .float-label {
449
+ top: 0;
450
+ left: 0;
451
+ padding: 0;
452
+ transform: scale(0.86);
453
+ font-weight: var(--wui-fw-medium);
454
+ }
455
+ .field-float.wui-float-above:has([data-label]:not(.wui-select-placeholder)):not(:has(.wui-select-control.open)) .float-label {
456
+ color: var(--color-text);
457
+ }
458
+ .field-float.wui-float-above:has(.wui-select-control.open) .float-label {
459
+ background: transparent;
460
+ }
461
+
462
+ // A chosen value's photo or initials sits at the control's start edge, and the start padding makes
463
+ // room for it: the avatar's own width plus the control's gap. The width is .avatar-xs's fixed size,
464
+ // a layout constant with no token. Logical properties, so the start edge follows the reading direction.
465
+ .wui-select-control.wui-has-value-avatar {
466
+ --wui-select-value-avatar-size: 20px;
467
+ position: relative;
468
+ padding-inline-start: calc(var(--wui-space-md) + var(--wui-select-value-avatar-size) + var(--wui-space-sm));
469
+ }
470
+ .wui-select-control.wui-has-value-avatar > .wui-select-value-avatar {
471
+ position: absolute;
472
+ inset-inline-start: var(--wui-space-md);
473
+ top: 50%;
474
+ transform: translateY(-50%);
475
+ display: inline-flex;
476
+ pointer-events: none;
477
+ }
478
+
479
+ // density="compact" is the host attribute (page size, range switch, toolbar picker). Its sm rung
480
+ // is the 32px control; lg sits one rung below the lg field, never taller than md.
481
+ wui-select[density="compact"] {
482
+ display: inline-block;
483
+ width: auto;
484
+ max-width: 100%;
485
+ }
486
+ wui-select[density="compact"] .wui-select-control {
487
+ height: var(--wui-control-sm);
488
+ min-height: var(--wui-control-sm);
489
+ min-width: 64px;
490
+ padding: 0 var(--wui-space-md);
491
+ font-size: var(--wui-fs-sm);
492
+ font-weight: var(--wui-fw-semibold);
493
+ }
494
+ wui-select[density="compact"] .wui-select-caret {
495
+ --wui-select-caret-font-size: 12px;
496
+ font-size: var(--wui-select-caret-font-size);
497
+ }
498
+ wui-select[density="compact"] .wui-select-sm .wui-select-control {
499
+ height: var(--wui-control-sm);
500
+ min-height: var(--wui-control-sm);
501
+ font-size: var(--wui-fs-sm);
502
+ }
503
+ wui-select[density="compact"] .wui-select-lg .wui-select-control {
504
+ height: var(--wui-control-md);
505
+ min-height: var(--wui-control-md);
506
+ font-size: var(--wui-fs-sm);
507
+ }
508
+
509
+ .wui-select-group {
510
+ padding: var(--wui-space-sm) var(--wui-space-md) var(--wui-space-xs);
511
+ font-size: var(--wui-fs-xs);
512
+ font-weight: var(--wui-fw-semibold);
513
+ color: var(--color-text-subtle);
514
+ }
515
+ .wui-select-opt-meta {
516
+ flex: none;
517
+ margin-inline-start: auto;
518
+ font-size: var(--wui-fs-sm);
519
+ color: var(--color-text-subtle);
520
+ }
521
+ .wui-select-add {
522
+ color: var(--color-primary-text);
523
+ font-weight: var(--wui-fw-semibold);
524
+ }
525
+ .wui-select-loading {
526
+ display: flex;
527
+ align-items: center;
528
+ padding: var(--wui-space-md);
529
+ font-size: var(--wui-fs-sm);
530
+ color: var(--color-text-subtle);
531
+ }
532
+ .wui-select-footer {
533
+ display: flex;
534
+ align-items: center;
535
+ justify-content: space-between;
536
+ gap: var(--wui-space-sm);
537
+ margin-top: var(--wui-space-xs);
538
+ padding: var(--wui-space-sm) var(--wui-space-md) var(--wui-space-xs);
539
+ border-top: 1px solid var(--color-border);
540
+ font-size: var(--wui-fs-xs);
541
+ color: var(--color-text-subtle);
542
+ }
543
+ .wui-select-clear-all {
544
+ padding: 0;
545
+ border: 0;
546
+ background: none;
547
+ font-size: var(--wui-fs-xs);
548
+ font-weight: var(--wui-fw-semibold);
549
+ color: var(--color-primary-text);
550
+ cursor: pointer;
551
+ }