@slotted/styles 0.1.0-beta.39 → 0.1.0-beta.40

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.
@@ -1,39 +1,25 @@
1
1
  @layer slotted.components {
2
2
  /**
3
- * ── A datetime field, a trigger, and two surfaces behind them ──────────
3
+ * ── A datetime field, a trigger, a month and a clock behind them ───────
4
4
  *
5
5
  * ┌─ root ──────────────────────────────────────────────────────────┐
6
6
  * │ ┌─ control ─────────────────────────────────────────────────┐ │
7
7
  * │ │ datetime-field ┌ trigger ┐ │ │
8
8
  * │ └───────────────────────────────────────────────────────────┘ │
9
9
  * └─────────────────────────────────────────────────────────────────┘
10
- * ┌─ positioner ─ the layer ────────────────────────────────┐
11
- * │ ┌─ content ─ role="dialog" ────────────────────────┐ │
12
- * │ │ head: now │ presets │ │
13
- * │ │ ┌─ panels ────────────────────────────────────┐ │ │
14
- * │ │ │ date-panel ─ calendar │ time-panel ─ list │ │ │
15
- * │ │ └─────────────────────────────────────────────┘ │ │
16
- * │ │ footer │ │
17
- * │ └──────────────────────────────────────────────────┘ │
18
- * └────────────────────────────────────────────────────────┘
10
+ * the panel is `picker-panel`'s, the month in it `calendar`'s and the
11
+ * hours `clock`'s
19
12
  *
20
- * **The only family in the library holding two surfaces.** One layer, one
21
- * dialog, and inside it a `grid` that `calendar` draws and a `listbox` that
22
- * this family draws. Both are in the DOM at every width: a `tablist` that
23
- * exists on a narrow container and not on a wide one tells assistive
24
- * technology two different stories about the same component, and Kendo's tabs
25
- * and MUI's mobile tabs are what that decline is against.
26
- *
27
- * `datetime-field` and `calendar` inside keep their own `data-ui`, so nothing
28
- * here restyles a segment or a day cell. This stylesheet owns the box the
29
- * positioner measures, the trigger inside the field, the layer, and the list.
13
+ * The families inside keep their own `data-ui`, so nothing here restyles a
14
+ * segment, a day or an hour: this stylesheet owns the frame that holds the
15
+ * field, and the trigger.
30
16
  */
31
17
  [data-ui-datetime-picker][data-part-root] {
32
18
  display: block;
33
19
  /* In a flex row the item's basis is its content, not the whole row. */
34
20
  flex-basis: content;
35
- /* The anchor the positioner measures is the control, and a block root lets
36
- the frame take the width the form gave it. */
21
+ /* The anchor the positioner measures is the control, and a block root
22
+ lets the frame take the width the form gave it. */
37
23
  inline-size: 100%;
38
24
  }
39
25
 
@@ -41,7 +27,10 @@
41
27
  * The box the positioner measures, and nothing else.
42
28
  *
43
29
  * It draws no frame: the `datetime-field` inside it draws its own, and the
44
- * trigger is handed to that field's `end` slot by the binding.
30
+ * trigger is handed to that field's `end` slot by the binding. A second
31
+ * border here would be a second place to fix one defect, and this stylesheet
32
+ * would then have to reach into another family's parts to suppress the first
33
+ * — which is the rule the whole family is built to keep.
45
34
  */
46
35
  [data-ui-datetime-picker] [data-part-control] {
47
36
  --_icon-size: var(--slotted-control-icon-size-md, 16px);
@@ -74,14 +63,9 @@
74
63
  }
75
64
 
76
65
  /**
77
- * The button that opens the panel.
78
- *
79
- * Its mark is a calendar, which is the mark `input[type=datetime-local]`
80
- * draws for the same control and the one `date-picker` already uses. The
81
- * panel holds two surfaces and each names itself inside; the trigger names
82
- * the kind of value the control holds, which is the one thing about it that
83
- * never changes — so it does not turn while the panel is open either. It is
84
- * a `Glyph` the binding draws inside an `icon` box, at the field's icon step.
66
+ * The button that opens the panel. It sits inside the field's frame, at
67
+ * the reading end, and takes the same inner-control box every other family
68
+ * puts inside a frame.
85
69
  *
86
70
  * It is always drawn. Angular Material records why: ChromeOS turns
87
71
  * `Alt`+`ArrowDown` into `PageDown` before the browser sees it, so the chord
@@ -154,6 +138,14 @@
154
138
  }
155
139
  }
156
140
 
141
+ /**
142
+ * The mark is the calendar `Glyph` the binding draws inside an `icon` box, at
143
+ * the field's icon step, and the one `input[type=datetime-local]` draws. It
144
+ * does not turn while the panel is open: the state is carried by
145
+ * `aria-expanded` and by the surface itself, and the trigger goes on saying
146
+ * what kind of value it holds.
147
+ */
148
+
157
149
  [data-ui-datetime-picker] [data-part-trigger]:hover:not(:disabled):not([data-disabled]) {
158
150
  background-color: var(
159
151
  --slotted-datetime-picker-trigger-hover-background,
@@ -186,711 +178,4 @@
186
178
  color: var(--slotted-disabled-foreground);
187
179
  cursor: not-allowed;
188
180
  }
189
-
190
- /* ── The layer ────────────────────────────────────────────────────────
191
- *
192
- * What `packages/core/src/positioner` writes `position`, `left` and `top`
193
- * onto. The painted surface is one element in, as every anchored family in
194
- * the library is built.
195
- */
196
- [data-ui-datetime-picker][data-part-positioner] {
197
- /* Only the block inset: the positioner writes `left` and never `right`,
198
- and `inset-inline-start` would resolve to `right` in a right-to-left
199
- document and win over the measured value. */
200
- position: absolute;
201
- inset-block-start: 0;
202
-
203
- box-sizing: border-box;
204
- isolation: isolate;
205
- /* The layer is only a frame around the surface; the surface takes the
206
- pointer, and the frame must not swallow a press meant for the page. */
207
- pointer-events: none;
208
- z-index: calc(var(--slotted-z-index-popover, 1100) + var(--slotted-layer-depth, 0));
209
-
210
- /* The layer arrives along the axis it opens on and never along the inline
211
- one, which is the rule `select` records. */
212
- --_enter-distance: var(--slotted-space-2, 0.25rem);
213
- opacity: 0;
214
- translate: 0 calc(-1 * var(--_enter-distance));
215
- transition:
216
- opacity var(--slotted-duration-short) var(--slotted-easing-exit),
217
- translate var(--slotted-duration-short) var(--slotted-easing-exit);
218
- }
219
-
220
- [data-ui-datetime-picker][data-part-positioner][data-side='top'] {
221
- translate: 0 var(--_enter-distance);
222
- }
223
-
224
- /* A lateral side has no block direction to arrive from, so it only fades. */
225
- [data-ui-datetime-picker][data-part-positioner]:is([data-side='left'], [data-side='right']) {
226
- translate: 0 0;
227
- }
228
-
229
- [data-ui-datetime-picker][data-part-positioner][data-open] {
230
- opacity: 1;
231
- translate: 0 0;
232
- transition: none;
233
- }
234
-
235
- /**
236
- * The entrance is a keyframe animation and not a transition, for the reason
237
- * `select` records: a transition starts from the style the browser computed
238
- * last, and the positioner writes `data-side` in the same style update as the
239
- * family opens the layer. A layer written open in static markup — the
240
- * harness, a docs snippet — is simply there, and is photographed where it
241
- * stands.
242
- */
243
- [data-ui-datetime-picker][data-part-positioner][data-open][data-positioned] {
244
- animation: slotted-datetime-picker-enter-down var(--slotted-duration-medium)
245
- var(--slotted-easing-enter);
246
- }
247
-
248
- [data-ui-datetime-picker][data-part-positioner][data-open][data-positioned][data-side='top'] {
249
- animation-name: slotted-datetime-picker-enter-up;
250
- }
251
-
252
- [data-ui-datetime-picker][data-part-positioner][data-open][data-positioned]:is(
253
- [data-side='left'],
254
- [data-side='right']
255
- ) {
256
- animation-name: slotted-datetime-picker-fade;
257
- }
258
-
259
- @keyframes slotted-datetime-picker-enter-down {
260
- from {
261
- opacity: 0;
262
- translate: 0 calc(-1 * var(--_enter-distance));
263
- }
264
- }
265
-
266
- @keyframes slotted-datetime-picker-enter-up {
267
- from {
268
- opacity: 0;
269
- translate: 0 var(--_enter-distance);
270
- }
271
- }
272
-
273
- @keyframes slotted-datetime-picker-fade {
274
- from {
275
- opacity: 0;
276
- }
277
- }
278
-
279
- /* Stillness keeps the fade and drops the movement. */
280
- @media (prefers-reduced-motion: reduce) {
281
- [data-ui-datetime-picker][data-part-positioner],
282
- [data-ui-datetime-picker][data-part-positioner][data-side='top'],
283
- [data-ui-datetime-picker][data-part-positioner][data-side='left'],
284
- [data-ui-datetime-picker][data-part-positioner][data-side='right'] {
285
- translate: 0 0;
286
- transition: opacity var(--slotted-duration-short) var(--slotted-easing-exit);
287
- }
288
-
289
- [data-ui-datetime-picker][data-part-positioner][data-open][data-positioned],
290
- [data-ui-datetime-picker][data-part-positioner][data-open][data-positioned][data-side='top'],
291
- [data-ui-datetime-picker][data-part-positioner][data-open][data-positioned][data-side='left'],
292
- [data-ui-datetime-picker][data-part-positioner][data-open][data-positioned][data-side='right'] {
293
- animation-name: slotted-datetime-picker-fade;
294
- }
295
- }
296
-
297
- /* The anchor scrolled out of its own clipper. The panel is still open and
298
- still belongs to a control the reader can no longer see. */
299
- [data-ui-datetime-picker][data-part-positioner][data-detached] {
300
- visibility: hidden;
301
- }
302
-
303
- /**
304
- * The surface.
305
- *
306
- * It is shrink-wrapped from the two panels and capped by the room the
307
- * positioner measured, rather than sized to the anchor: a calendar has a
308
- * width of its own and a field narrower than one would squeeze the month
309
- * rather than the panel. That is also why there is **no container query
310
- * here**. `container-type: inline-size` would make the surface's inline size
311
- * independent of its contents, which is the opposite of what a panel sized to
312
- * a calendar needs; the two panels wrap instead, which needs no threshold to
313
- * guess at and cannot be wrong at a width nobody tested.
314
- */
315
- [data-ui-datetime-picker] [data-part-content] {
316
- --_content-radius: var(--slotted-datetime-picker-content-radius, var(--slotted-radius-lg, 8px));
317
- --_content-padding: var(
318
- --slotted-datetime-picker-content-padding,
319
- var(--slotted-space-3, 0.375rem)
320
- );
321
- /* Concentric with the panel: its radius less the inset, floored at 0. */
322
- --_option-radius: var(
323
- --slotted-datetime-picker-option-radius,
324
- max(0px, calc(var(--_content-radius) - var(--_content-padding)))
325
- );
326
-
327
- background-color: var(--slotted-datetime-picker-surface, var(--slotted-surface-raised, Canvas));
328
- border: var(--slotted-border-width-thin, 1px) solid
329
- var(
330
- --slotted-datetime-picker-content-border-color,
331
- var(--slotted-border-subtle, ButtonBorder)
332
- );
333
- border-radius: var(--_content-radius);
334
- box-shadow: var(--slotted-datetime-picker-content-shadow, var(--slotted-shadow-md));
335
- box-sizing: border-box;
336
- color: var(--slotted-datetime-picker-content-color, var(--slotted-text, CanvasText));
337
-
338
- /**
339
- * One row's height, stated once, because the list's cap is counted in rows
340
- * at every density. Read from the control scale rather than from the target
341
- * floor alone, so a dense panel shrinks its rows and its cap together — the
342
- * alternative shrinks only the cap and shows fewer options, which is
343
- * density changing what a reader can see rather than how much room it
344
- * takes.
345
- */
346
- --_row: max(var(--slotted-target-min, 24px), var(--slotted-control-height-sm, 30px));
347
- --_row-pitch: calc(var(--_row) + var(--slotted-space-1, 0.125rem));
348
-
349
- display: grid;
350
- gap: var(--slotted-space-2, 0.25rem);
351
- grid-template-areas: 'head' 'panels' 'footer';
352
- grid-template-columns: minmax(0, 1fr);
353
- inline-size: auto;
354
- max-inline-size: min(34rem, var(--slotted-positioner-available-width, 34rem));
355
- padding: var(--_content-padding);
356
- /* The layer above gave up the pointer; the surface takes it back. */
357
- pointer-events: auto;
358
- }
359
-
360
- /**
361
- * The head band.
362
- *
363
- * It says what the reader has chosen **so far**, which is the one thing
364
- * neither surface can show: a month grid says which day is chosen and a
365
- * column of times says which time is, and a reader who chose a day and is now
366
- * reading a column of times has nothing telling them which day those times
367
- * belong to. No surveyed panel says it at all.
368
- *
369
- * It replaces a pair of labels — `Data` and `Hora`, each with a mark small
370
- * enough to sit in eleven-pixel text — that were decoration twice over: a
371
- * month grid is a date and a column of times is times, which is why none of
372
- * the four surveyed panels labels either, and a mark that small is a mark
373
- * nobody can read. The listbox's name is written in `aria-label` instead,
374
- * where a name belongs when the thing it names says what it is.
375
- *
376
- * The rule under it is what makes this a band rather than a line of text
377
- * floating over two columns.
378
- */
379
- [data-ui-datetime-picker] [data-part-head] {
380
- /**
381
- * The band renders at the panel's width and contributes nothing to it.
382
- *
383
- * A grid track sizes to the widest thing in it, so a row of the consumer's
384
- * own shortcuts stretched the whole panel — and with it the column of
385
- * times, which then ran the width of a page. `inline-size: 0` takes the
386
- * band out of that measurement and `min-inline-size: 100%` puts it back at
387
- * the track's own width, so the two surfaces decide how wide the panel is
388
- * and the band wraps inside whatever they decide.
389
- */
390
- /* `border-box`, and it is load-bearing: under `content-box` the percentage
391
- resolves to the content box and the padding is added on top, so the band
392
- came out twelve pixels wider than the area it sits in and pushed the
393
- control at its end six pixels past the panel's own edge. */
394
- box-sizing: border-box;
395
- inline-size: 0;
396
- min-inline-size: 100%;
397
-
398
- align-items: center;
399
- border-block-end: var(--slotted-border-width-thin, 1px) solid
400
- var(
401
- --slotted-datetime-picker-content-border-color,
402
- var(--slotted-border-subtle, ButtonBorder)
403
- );
404
- column-gap: var(--slotted-space-4, 0.5rem);
405
- display: flex;
406
- flex-wrap: wrap;
407
- grid-area: head;
408
- justify-content: space-between;
409
- /**
410
- * No inline padding of its own. The surface's own padding is the panel's
411
- * one gutter, and every box under this band starts and ends on it: the
412
- * month's column, the page trigger inside it, the list's column and the
413
- * ground of every row in it. With six pixels more here the title stood six
414
- * pixels inside the month below it and the control at the end stopped six
415
- * pixels short of the rows below *it* — two edges that almost line up,
416
- * which reads worse than two that plainly do not.
417
- *
418
- * Measured on the default theme at `comfortable`, 720 pixels: the surface's
419
- * inner edges are 32 and 405.4, and the month's column, the list's column
420
- * and this band now all begin and end there.
421
- */
422
- /**
423
- * Air under the controls before the rule — the same step the footer keeps
424
- * between its own rule and its buttons, so the two bands hold the surface
425
- * symmetrically. With none, the rule read as an underline on `now` and on
426
- * the consumer's shortcuts rather than as the bottom of the band they
427
- * stand in.
428
- */
429
- padding-block-end: var(--slotted-space-3, 0.375rem);
430
- row-gap: var(--slotted-space-2, 0.25rem);
431
- }
432
-
433
- /**
434
- * The value as it stands. It is the panel's own title, so it takes the
435
- * surface's ink and a step of weight, and its digits line up with the list's
436
- * below it.
437
- */
438
- [data-ui-datetime-picker] [data-part-head-value] {
439
- color: var(--slotted-datetime-picker-content-color, var(--slotted-text, CanvasText));
440
- font-size: var(--slotted-font-size-sm, 13px);
441
- font-variant-numeric: tabular-nums;
442
- font-weight: var(--slotted-font-weight-medium, 500);
443
- min-inline-size: 0;
444
- /* A datetime in words is a mixed run — a month name beside two numbers — so
445
- it is laid out by its own content rather than by the paragraph, which is
446
- the rule the field's own preview records. */
447
- unicode-bidi: plaintext;
448
- }
449
-
450
- /**
451
- * The half the reader has not written yet, drawn as its placeholder beside
452
- * the half they have. It is the family's own answer to a value that is not
453
- * whole, said where the reader is looking rather than only in the field.
454
- */
455
- [data-ui-datetime-picker] [data-part-head-value] [data-placeholder] {
456
- color: var(--slotted-datetime-picker-label-color, var(--slotted-text-muted, GrayText));
457
- }
458
-
459
- /**
460
- * One press for the current datetime — what a reader who never discovers that
461
- * `+` opens an expression still has.
462
- *
463
- * It is drawn as a control and not as a link. `time-picker` writes its own
464
- * `now` as accent text, and alone at the head of a single list that reads
465
- * correctly; here it stands at the end of a band opposite a title, where bare
466
- * colored text is a third register beside the panel's plain ink and its one
467
- * solid accent block — it read as a stray link rather than as the shortcut it
468
- * is. A quiet bordered control at the small step is the shape the library
469
- * already gives an action of this weight, and the divergence from the sibling
470
- * is the band around it.
471
- *
472
- * It carries the clock, which is the second of the family's two marks and the
473
- * only place one earns its keep: this is the control that writes a time, so
474
- * the mark names what it does, and at the control glyph size inside a control
475
- * it is legible rather than a speck beside a word.
476
- */
477
- [data-ui-datetime-picker] [data-part-now] {
478
- align-items: center;
479
- appearance: none;
480
- background-color: var(--slotted-datetime-picker-now-background, transparent);
481
- /* The control's own border token rather than the surface's subtle one: this
482
- button stands *on* the raised surface, where `--slotted-border-subtle` is
483
- within a shade of the ground and the dark capture showed no edge at all. */
484
- border: var(--slotted-control-border-width, 1px) solid
485
- var(
486
- --slotted-datetime-picker-now-border-color,
487
- var(--slotted-control-border-color, ButtonBorder)
488
- );
489
- border-radius: var(--slotted-datetime-picker-radius, var(--slotted-control-radius, 4px));
490
- color: var(--slotted-datetime-picker-now-color, var(--slotted-text, CanvasText));
491
- cursor: pointer;
492
- display: inline-flex;
493
- flex: 0 0 auto;
494
- font: inherit;
495
- font-size: var(--slotted-control-font-size-sm, 12px);
496
- gap: var(--slotted-space-2, 0.25rem);
497
- justify-content: center;
498
- min-block-size: var(--slotted-control-height-sm, 30px);
499
- padding-block: 0;
500
- padding-inline: var(--slotted-control-padding-inline-sm, 10px);
501
- touch-action: manipulation;
502
- transition:
503
- background-color var(--slotted-control-transition-duration)
504
- var(--slotted-control-transition-easing),
505
- border-color var(--slotted-control-transition-duration)
506
- var(--slotted-control-transition-easing);
507
- white-space: nowrap;
508
- -webkit-tap-highlight-color: transparent;
509
- }
510
-
511
- /**
512
- * The mark — the clock `Glyph` the binding draws before the label, at the
513
- * `sm` icon step — takes the muted ink the label does not, so the pair reads
514
- * as one control with a glyph rather than as two things of equal weight.
515
- */
516
- [data-ui-datetime-picker] [data-part-now] > [data-ui-icon] {
517
- /* No system color: a theme that never loaded should let the mark take the
518
- label's ink rather than the operating system's own grey, which is the
519
- rule `fallbacks.test.mjs` holds. */
520
- color: var(--slotted-datetime-picker-now-icon-color, var(--slotted-text-muted));
521
- }
522
-
523
- [data-ui-datetime-picker] [data-part-now]:hover:not(:disabled):not([data-disabled]) {
524
- background-color: var(
525
- --slotted-datetime-picker-now-hover-background,
526
- var(--slotted-tone-secondary-subtle-hover)
527
- );
528
- border-color: var(
529
- --slotted-datetime-picker-now-hover-border-color,
530
- var(--slotted-tone-accent-border)
531
- );
532
- }
533
-
534
- [data-ui-datetime-picker] [data-part-now]:active:not(:disabled):not([data-disabled]) {
535
- background-color: var(
536
- --slotted-datetime-picker-now-active-background,
537
- var(--slotted-tone-secondary-subtle-active)
538
- );
539
- }
540
-
541
- [data-ui-datetime-picker] [data-part-now]:focus-visible {
542
- outline: var(--slotted-focus-ring-width, 2px) solid var(--slotted-focus-ring-color, Highlight);
543
- outline-offset: calc(var(--slotted-focus-ring-offset, 2px) * -1);
544
- }
545
-
546
- /**
547
- * The consumer's own shortcuts. This family ships no list of them: "tomorrow
548
- * at nine" is a business clock, and a library that guessed at one would be
549
- * guessing at an industry. What it ships is the row they stand in, at the
550
- * reading end of the head beside `now`.
551
- */
552
- [data-ui-datetime-picker] [data-part-presets] {
553
- align-items: center;
554
- display: flex;
555
- flex-wrap: wrap;
556
- gap: var(--slotted-space-2, 0.25rem);
557
- }
558
-
559
- /* ── The two panels ───────────────────────────────────────────────────
560
- *
561
- * A wrapping flex row of exactly two items, in the value's own order. Where
562
- * the positioner measured room for both, they stand side by side; where it
563
- * did not, the time panel wraps under the date panel and nothing is hidden.
564
- *
565
- * The reflow is the row's own, at every width. `openTo` does not reorder it:
566
- * moving a whole calendar because focus starts elsewhere would make one
567
- * setting look like a different component, and what answers the narrow case
568
- * is `scrollIntoView` on the surface focus lands in.
569
- */
570
- [data-ui-datetime-picker] [data-part-panels] {
571
- /**
572
- * The two columns are told apart by the air between them and by what they
573
- * hold, not by a rule. A rule would have to be on one inline edge, and the
574
- * same declaration is a divider beside the month in one arrangement and a
575
- * stray line under it in the other — the arrangement is the row's own and
576
- * no selector can tell which one is on screen.
577
- */
578
- column-gap: var(--slotted-space-6, 1rem);
579
- display: flex;
580
- flex-wrap: wrap;
581
- grid-area: panels;
582
- min-inline-size: 0;
583
- row-gap: var(--slotted-space-4, 0.5rem);
584
- }
585
-
586
- /**
587
- * The month's column never shrinks below the month.
588
- *
589
- * A calendar has an intrinsic width — its cell is a share of its own
590
- * container — and this column is that width. A flexible basis with
591
- * `min-inline-size: 0` would let the grid be squeezed under it, and a squeezed
592
- * month is the half of this panel a reader came for. When the room runs out it
593
- * is the time panel that wraps instead, which is the arrangement this family
594
- * already draws.
595
- */
596
- [data-ui-datetime-picker] [data-part-date-panel] {
597
- flex: 0 0 auto;
598
- }
599
-
600
- /**
601
- * The list's column.
602
- *
603
- * `flex-grow: 1` against a basis of seven rem does two things at once and
604
- * needs no query to tell them apart. Beside the month, the surface is
605
- * shrink-wrapped to the sum of the two bases, so there is no free space to
606
- * grow into and the column stays the narrow one it should be — a column of
607
- * times spread across half a panel is a column of numbers nobody chose that
608
- * shape for. Wrapped onto a line of its own, the free space is the whole line
609
- * and the column takes it, so the times read as a section rather than as a
610
- * narrow strip under a wide month.
611
- */
612
- [data-ui-datetime-picker] [data-part-time-panel] {
613
- display: flex;
614
- flex: 1 1 var(--slotted-datetime-picker-time-panel-inline-size, 7rem);
615
- flex-direction: column;
616
- gap: var(--slotted-space-2, 0.25rem);
617
- min-inline-size: var(--slotted-datetime-picker-time-panel-inline-size, 7rem);
618
- }
619
-
620
- /* ── The list ─────────────────────────────────────────────────────────
621
- *
622
- * One column of times on the day the reader is on, capped in control heights
623
- * so the cap holds at every density and every type step, and scrolled rather
624
- * than truncated: a day of quarter-hours is ninety-six rows and every one of
625
- * them is choosable.
626
- */
627
- [data-ui-datetime-picker] [data-part-list] {
628
- display: flex;
629
- flex: 1 1 auto;
630
- flex-direction: column;
631
- /**
632
- * One step of air between rows, so the chosen row's painted ground and the
633
- * focused row's inset ring never share an edge. Touching, the two read as
634
- * one band with a dark underline rather than as two states of two rows.
635
- */
636
- gap: var(--slotted-space-1, 0.125rem);
637
- /**
638
- * Seven rows and a half, which is deliberately *shorter* than a six-week
639
- * month: the month is what governs the height of a panel holding both, and
640
- * a list one row taller left the calendar's column with dead space under it
641
- * and cut the list's last row against the panel's own border. Under the cap
642
- * the list stretches to whatever the month leaves, so the two surfaces end
643
- * on the same line at every density and in every month.
644
- *
645
- * The half is the point wherever the cap is what applies — the wrapped
646
- * arrangement and the sheet: a list cut on a row boundary looks like the
647
- * whole list, and a reader who cannot see that ninety-six times are
648
- * available never scrolls for them.
649
- */
650
- max-block-size: var(--slotted-datetime-picker-list-block-size, calc(var(--_row-pitch) * 7.5));
651
- /* Beside a month, the column is stretched to the month's height and the
652
- list fills what the label leaves — so the list is as tall as the calendar
653
- rather than a number of rows chosen against nothing. The cap above is
654
- what holds when there is no month beside it, which is the wrapped
655
- arrangement and the sheet. */
656
- min-block-size: 0;
657
- min-inline-size: 0;
658
- overflow-y: auto;
659
- /* A highlight moved by a key lands whole rather than half under the edge. */
660
- scroll-padding-block: var(--slotted-space-2, 0.25rem);
661
- }
662
-
663
- /**
664
- * One time on the day the reader is on.
665
- *
666
- * The row carries the time and nothing else. The day is the calendar's to
667
- * say, and repeating it ninety-six times beside a month that already shows it
668
- * would spend the whole column on one word.
669
- */
670
- [data-ui-datetime-picker] [data-part-option] {
671
- align-items: center;
672
- background-color: transparent;
673
- border-radius: var(--_option-radius);
674
- color: inherit;
675
- cursor: pointer;
676
- display: flex;
677
- flex: 0 0 auto;
678
- font-variant-numeric: tabular-nums;
679
- gap: var(--slotted-space-2, 0.25rem);
680
- /* The row *is* `--_row`: no block padding on top of it, so eight rows are
681
- eight rows and the cap that counts them is arithmetic rather than an
682
- estimate. A time never wraps, so there is nothing for the padding to
683
- protect. */
684
- min-block-size: var(--_row);
685
- padding-inline: var(--slotted-space-3, 0.375rem);
686
- transition:
687
- background-color var(--slotted-control-transition-duration)
688
- var(--slotted-control-transition-easing),
689
- color var(--slotted-control-transition-duration) var(--slotted-control-transition-easing);
690
- user-select: none;
691
- -webkit-tap-highlight-color: transparent;
692
- }
693
-
694
- /* ── Option states ────────────────────────────────────────────────────
695
- *
696
- * Written strongest last, and each weaker one guarded against every stronger
697
- * one it can meet, which is the order `STATE_PRECEDENCE` sets: the chosen
698
- * time outranks the highlight, and the highlight outranks the pointer.
699
- *
700
- * Specificity is what makes this a rule rather than an ordering: a hover
701
- * selector carrying `:hover` and one `:not()` outweighs a plain
702
- * `[data-selected]`, so a chosen row turns grey under the pointer however far
703
- * down the file its own rule is written. Found by the reviewer at
704
- * `time-picker`'s visual gate and inherited whole.
705
- */
706
- [data-ui-datetime-picker]
707
- [data-part-option]:hover:not([data-disabled]):not([data-selected]):not([data-current]) {
708
- background-color: var(
709
- --slotted-datetime-picker-option-hover-background,
710
- var(--slotted-tone-secondary-subtle-hover)
711
- );
712
- }
713
-
714
- [data-ui-datetime-picker] [data-part-option][data-current]:not([data-selected]) {
715
- background-color: var(
716
- --slotted-datetime-picker-option-current-background,
717
- var(--slotted-tone-secondary-subtle-active)
718
- );
719
- }
720
-
721
- [data-ui-datetime-picker] [data-part-option]:focus-visible {
722
- outline: var(--slotted-focus-ring-width, 2px) solid var(--slotted-focus-ring-color, Highlight);
723
- outline-offset: calc(var(--slotted-focus-ring-offset, 2px) * -1);
724
- }
725
-
726
- [data-ui-datetime-picker] [data-part-option][data-selected] {
727
- background-color: var(
728
- --slotted-datetime-picker-option-selected-background,
729
- var(--slotted-tone-accent-solid)
730
- );
731
- color: var(
732
- --slotted-datetime-picker-option-selected-color,
733
- var(--slotted-tone-accent-on-solid)
734
- );
735
- }
736
-
737
- /* The chosen row still answers the pointer — one step along its own tone,
738
- rather than the grey every other row takes. A row that swapped color
739
- family under the pointer read as a different row. */
740
- [data-ui-datetime-picker] [data-part-option][data-selected]:hover:not([data-disabled]) {
741
- background-color: var(
742
- --slotted-datetime-picker-option-selected-hover-background,
743
- var(--slotted-tone-accent-solid-hover)
744
- );
745
- }
746
-
747
- /**
748
- * A time a bound or a predicate refuses. It stays in the list by default,
749
- * because a list that silently drops rows is a list whose step the reader
750
- * cannot infer — and it is muted to the color the theme measures rather than
751
- * faded by opacity, so it stays readable.
752
- */
753
- [data-ui-datetime-picker] [data-part-option][data-disabled] {
754
- background-color: transparent;
755
- color: var(--slotted-disabled-foreground);
756
- cursor: not-allowed;
757
- }
758
-
759
- /**
760
- * The day the reader is on offers no time at all — a closed Saturday, a
761
- * window `minTime` and `maxTime` leave empty, a predicate that refuses every
762
- * step. It is a sentence rather than an empty box, and it is the state that
763
- * makes the list worth recomputing as the reader moves through the month.
764
- */
765
- [data-ui-datetime-picker] [data-part-empty] {
766
- align-items: center;
767
- color: var(--slotted-datetime-picker-label-color, var(--slotted-text-muted, GrayText));
768
- display: flex;
769
- flex: 1 1 auto;
770
- justify-content: center;
771
- min-block-size: calc(var(--_row) * 2);
772
- padding: var(--slotted-space-4, 0.5rem);
773
- text-align: center;
774
- text-wrap: balance;
775
- }
776
-
777
- [data-ui-datetime-picker] [data-part-footer] {
778
- /* The band's rule, for the same reason: a consumer's two buttons are not
779
- what decides how wide a month is drawn — and `border-box` with it, or the
780
- padding pushes the last button past the panel's edge. */
781
- box-sizing: border-box;
782
- inline-size: 0;
783
- min-inline-size: 100%;
784
-
785
- align-items: center;
786
- border-block-start: var(--slotted-border-width-thin, 1px) solid
787
- var(
788
- --slotted-datetime-picker-content-border-color,
789
- var(--slotted-border-subtle, ButtonBorder)
790
- );
791
- display: flex;
792
- gap: var(--slotted-space-2, 0.25rem);
793
- grid-area: footer;
794
- justify-content: flex-end;
795
- /* The same one gutter: the last button ends where the rows above it end. */
796
- padding-block-start: var(--slotted-space-3, 0.375rem);
797
- }
798
-
799
- /* ── Narrow, on a finger ──────────────────────────────────────────────
800
- *
801
- * §2.7 of `docs/component-features.md` asks for it by name: a popover on the
802
- * desktop and a sheet in a narrow viewport. The DOM does not change, so the
803
- * decision is testable without a device — and the query is on the viewport
804
- * rather than on a container because a layer in a portal has no container to
805
- * ask, and the question really is how much screen there is.
806
- */
807
- @media (max-width: 480px) and (pointer: coarse) {
808
- [data-ui-datetime-picker][data-part-positioner][data-presentation='sheet'] {
809
- /* The positioner's own measurement is overridden here on purpose: a sheet
810
- is not placed against an anchor, it is placed against the screen. */
811
- inset: auto 0 0;
812
- position: fixed;
813
- translate: 0 var(--slotted-space-9, 2rem);
814
- }
815
-
816
- [data-ui-datetime-picker][data-part-positioner][data-presentation='sheet'][data-open] {
817
- translate: 0 0;
818
- }
819
-
820
- [data-ui-datetime-picker][data-part-positioner][data-presentation='sheet'] [data-part-content] {
821
- border-end-end-radius: 0;
822
- border-end-start-radius: 0;
823
- border-inline: 0;
824
- border-block-end: 0;
825
- inline-size: var(--slotted-datetime-picker-sheet-inline-size, 100%);
826
- max-inline-size: none;
827
- /* The two surfaces are stacked here and the sheet has the screen's height
828
- to spend, so the whole panel scrolls rather than each surface scrolling
829
- inside its own box. */
830
- max-block-size: 85vh;
831
- overflow-y: auto;
832
- }
833
-
834
- /* Stacked under a month, the list gets a shorter run: the reader scrolls
835
- the sheet to reach it, and a full-height list would put the footer out of
836
- reach behind ninety-six rows. */
837
- [data-ui-datetime-picker][data-part-positioner][data-presentation='sheet'] [data-part-list] {
838
- max-block-size: calc(var(--_row-pitch) * 5.5);
839
- }
840
-
841
- /**
842
- * The grip every bottom sheet carries, in the drawer's geometry and line
843
- * color: a pill three rem by a quarter, centerd in a row one target tall
844
- * that the content keeps clear at its top. A pull down on it dismisses the
845
- * sheet; Escape and the press outside stay the accessible ways out.
846
- */
847
- [data-ui-datetime-picker][data-part-positioner][data-presentation='sheet']
848
- > [data-part-content] {
849
- padding-block-start: var(--slotted-target-min, 24px);
850
- position: relative;
851
- }
852
-
853
- [data-ui-datetime-picker][data-part-positioner][data-presentation='sheet']
854
- > [data-part-content]
855
- > [data-part-grip] {
856
- background-clip: content-box;
857
- background-color: var(
858
- --slotted-drawer-resizer-line-color,
859
- var(--slotted-border-strong, ButtonBorder)
860
- );
861
- block-size: var(--slotted-space-2, 0.25rem);
862
- border-radius: var(--slotted-radius-full, 9999px);
863
- box-sizing: content-box;
864
- cursor: grab;
865
- inline-size: var(--slotted-space-11, 3rem);
866
- inset-block-start: 0;
867
- inset-inline: 0;
868
- margin-inline: auto;
869
- padding-block: calc((var(--slotted-target-min, 24px) - var(--slotted-space-2, 0.25rem)) / 2);
870
- position: absolute;
871
- touch-action: none;
872
- }
873
- }
874
-
875
- @media (forced-colors: active) {
876
- /* The chosen row and the highlighted row both lose their painted grounds,
877
- so each says what it is with a system pair the operating system
878
- guarantees legible together. */
879
- [data-ui-datetime-picker] [data-part-option][data-selected] {
880
- background-color: Highlight;
881
- color: HighlightText;
882
- forced-color-adjust: none;
883
- }
884
-
885
- [data-ui-datetime-picker] [data-part-option][data-current]:not([data-selected]) {
886
- outline: var(--slotted-focus-ring-width, 2px) solid Highlight;
887
- outline-offset: calc(var(--slotted-focus-ring-offset, 2px) * -1);
888
- }
889
-
890
- /* No rule between the two surfaces is added here. The gap between them is
891
- only space, but each panel already carries a label with its own mark
892
- above it, and a label is a boundary that reads in both arrangements — a
893
- border on one inline edge would be a divider beside the month in one and
894
- a stray rule under it in the other. */
895
- }
896
181
  }