@frontile/theme 0.18.6 → 0.18.8

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.
Files changed (37) hide show
  1. package/declarations/colors.d.ts +1 -0
  2. package/declarations/colors.d.ts.map +1 -1
  3. package/declarations/components/app-layout.d.ts +483 -0
  4. package/declarations/components/app-layout.d.ts.map +1 -0
  5. package/declarations/components/badge.d.ts +162 -0
  6. package/declarations/components/badge.d.ts.map +1 -0
  7. package/declarations/components/bottom-nav.d.ts +61 -0
  8. package/declarations/components/bottom-nav.d.ts.map +1 -0
  9. package/declarations/components/chip.d.ts +0 -18
  10. package/declarations/components/chip.d.ts.map +1 -1
  11. package/declarations/components/forms/forms.d.ts +5 -1
  12. package/declarations/components/forms/forms.d.ts.map +1 -1
  13. package/declarations/components/index.d.ts +5 -0
  14. package/declarations/components/index.d.ts.map +1 -1
  15. package/declarations/components/nav-color.d.ts +15 -0
  16. package/declarations/components/nav-color.d.ts.map +1 -0
  17. package/declarations/components/nav-item.d.ts +184 -0
  18. package/declarations/components/nav-item.d.ts.map +1 -0
  19. package/declarations/components/shared.d.ts +8 -0
  20. package/declarations/components/shared.d.ts.map +1 -1
  21. package/declarations/components/stepper.d.ts +364 -0
  22. package/declarations/components/stepper.d.ts.map +1 -0
  23. package/declarations/plugin/power-select.d.ts.map +1 -1
  24. package/declarations/plugin/resolve.d.ts.map +1 -1
  25. package/declarations/plugin/theme-context.d.ts +15 -0
  26. package/declarations/plugin/theme-context.d.ts.map +1 -0
  27. package/declarations/plugin.d.ts.map +1 -1
  28. package/dist/colors.js +1 -1
  29. package/dist/index.js +1507 -15
  30. package/dist/index.js.map +1 -1
  31. package/dist/plugin.js +87 -13
  32. package/dist/plugin.js.map +1 -1
  33. package/dist/{util-PU966Q_x.js → util-DrX1hjH-.js} +2 -2
  34. package/dist/{util-PU966Q_x.js.map → util-DrX1hjH-.js.map} +1 -1
  35. package/package.json +2 -2
  36. package/src/index.css +68 -3
  37. package/src/styles/theme.css +11 -1
package/dist/index.js CHANGED
@@ -12,7 +12,16 @@ const focusVisibleRing = ['outline-hidden', 'focus-visible:z-10', 'focus-visible
12
12
  * and each recipe keeps ownership of its own palette.
13
13
  */
14
14
  const statusRowCloseButton = ['shrink-0 self-center -mr-1 inline-block p-1.5 rounded-full', 'transition duration-200', 'hover:bg-surface-overlay-soft', ...focusVisibleRing];
15
- const focusVisibleWithinRing = ['outline-hidden', 'has-focus-visible:z-10', 'has-focus-visible:ring-3', 'has-[:focus-visible]:ring-focus', 'has-focus-visible:ring-offset-2', 'has-[:focus-visible]:ring-offset-background'];
15
+
16
+ /**
17
+ * `focusVisibleRing` for a container whose focusable element is a descendant
18
+ * (Switch's hidden input, a segmented control's radios). Every utility goes
19
+ * through the theme's own `focus-visible` variant, which matches
20
+ * `[data-focus-visible-added]` (see index.css). Spelling some of them with the
21
+ * native pseudo-class instead drew the ring at full width but left its color
22
+ * to whichever of the two focus states happened to agree.
23
+ */
24
+ const focusVisibleWithinRing = ['outline-hidden', 'has-focus-visible:z-10', 'has-focus-visible:ring-3', 'has-focus-visible:ring-focus', 'has-focus-visible:ring-offset-2', 'has-focus-visible:ring-offset-background'];
16
25
 
17
26
  /**
18
27
  * `surface` and `soft` wear the same outer box. `soft` carries its colour
@@ -412,6 +421,153 @@ const avatar = tv({
412
421
  }
413
422
  });
414
423
 
424
+ const badge = tv({
425
+ slots: {
426
+ base: 'inline-flex items-center whitespace-nowrap font-label leading-none',
427
+ // emphasized value, e.g. a price
428
+ value: 'font-bold tabular-nums leading-none',
429
+ // unit following the value, e.g. "/mo"
430
+ unit: 'opacity-80 leading-none',
431
+ // status dot before the content; sized per size, coloured per color
432
+ dot: 'shrink-0 rounded-full',
433
+ icon: 'inline-flex shrink-0 items-center justify-center [&>svg]:size-full'
434
+ },
435
+ variants: {
436
+ variant: {
437
+ soft: '',
438
+ outline: ''
439
+ },
440
+ color: {
441
+ neutral: {
442
+ dot: 'bg-neutral-strong'
443
+ },
444
+ primary: {
445
+ dot: 'bg-primary'
446
+ },
447
+ secondary: {
448
+ dot: 'bg-secondary'
449
+ },
450
+ tertiary: {
451
+ dot: 'bg-tertiary'
452
+ },
453
+ success: {
454
+ dot: 'bg-success'
455
+ },
456
+ danger: {
457
+ dot: 'bg-danger'
458
+ }
459
+ },
460
+ // Value and unit share the label's font size so their baselines line up;
461
+ // the value is set apart by weight only. Heights match Chip (20, 24, 28,
462
+ // 32px). Radius steps with size and is never a pill: that shape belongs
463
+ // to Chip.
464
+ size: {
465
+ xs: {
466
+ base: 'text-label-2xs h-5 px-1.5 gap-1 rounded-sm',
467
+ dot: 'size-1.5',
468
+ icon: 'size-3'
469
+ },
470
+ sm: {
471
+ base: 'text-label-2xs h-6 px-2 gap-1 rounded-sm',
472
+ dot: 'size-1.5',
473
+ icon: 'size-3'
474
+ },
475
+ md: {
476
+ base: 'text-label-xs h-7 px-2.5 gap-1.5 rounded-md',
477
+ dot: 'size-2',
478
+ icon: 'size-3.5'
479
+ },
480
+ lg: {
481
+ base: 'text-label-md h-8 px-3 gap-1.5 rounded-md',
482
+ dot: 'size-2.5',
483
+ icon: 'size-4'
484
+ }
485
+ }
486
+ },
487
+ compoundVariants: [
488
+ // VARIANT: soft (tonal). One level above Chip's `soft` (`-subtle`).
489
+ {
490
+ variant: 'soft',
491
+ color: 'neutral',
492
+ class: {
493
+ base: 'bg-neutral-muted text-on-neutral-muted'
494
+ }
495
+ }, {
496
+ variant: 'soft',
497
+ color: 'primary',
498
+ class: {
499
+ base: 'bg-primary-muted text-on-primary-muted'
500
+ }
501
+ }, {
502
+ variant: 'soft',
503
+ color: 'secondary',
504
+ class: {
505
+ base: 'bg-secondary-muted text-on-secondary-muted'
506
+ }
507
+ }, {
508
+ variant: 'soft',
509
+ color: 'tertiary',
510
+ class: {
511
+ base: 'bg-tertiary-muted text-on-tertiary-muted'
512
+ }
513
+ }, {
514
+ variant: 'soft',
515
+ color: 'success',
516
+ class: {
517
+ base: 'bg-success-muted text-on-success-muted'
518
+ }
519
+ }, {
520
+ variant: 'soft',
521
+ color: 'danger',
522
+ class: {
523
+ base: 'bg-danger-muted text-on-danger-muted'
524
+ }
525
+ },
526
+ // VARIANT: outline
527
+ {
528
+ variant: 'outline',
529
+ color: 'neutral',
530
+ class: {
531
+ base: 'border border-current text-neutral-strong'
532
+ }
533
+ }, {
534
+ variant: 'outline',
535
+ color: 'primary',
536
+ class: {
537
+ base: 'border border-current text-primary-strong'
538
+ }
539
+ }, {
540
+ variant: 'outline',
541
+ color: 'secondary',
542
+ class: {
543
+ base: 'border border-current text-secondary-strong'
544
+ }
545
+ }, {
546
+ variant: 'outline',
547
+ color: 'tertiary',
548
+ class: {
549
+ base: 'border border-current text-tertiary-strong'
550
+ }
551
+ }, {
552
+ variant: 'outline',
553
+ color: 'success',
554
+ class: {
555
+ base: 'border border-current text-success-strong'
556
+ }
557
+ }, {
558
+ variant: 'outline',
559
+ color: 'danger',
560
+ class: {
561
+ base: 'border border-current text-danger-strong'
562
+ }
563
+ }],
564
+ defaultVariants: {
565
+ size: 'md',
566
+ color: 'neutral',
567
+ variant: 'soft'
568
+ }
569
+ });
570
+
415
571
  /**
416
572
  * The separator is rendered *inside* each `<li>` and hidden on the last one
417
573
  * with `group-last/item:hidden` (the `<li>` carries `group/item`), so neither
@@ -842,14 +998,14 @@ const buttonSpinner = tv({
842
998
 
843
999
  const chip = tv({
844
1000
  slots: {
845
- base: ['whitespace-nowrap', 'inline-flex items-center justify-between box-border'],
1001
+ base: ['whitespace-nowrap', 'inline-flex items-center justify-between box-border rounded-full'],
846
1002
  // label text role (size set per size variant)
847
1003
  content: ['flex-1 text-inherit font-label'],
848
1004
  dot: ['shrink-0', 'ml-1', 'rounded-full'],
849
1005
  closeButton: ['shrink-0', 'p-0.5',
850
1006
  // The shared ring is drawn with a background-coloured offset, which
851
1007
  // inside a chip reads as a hole punched in the chip.
852
- 'focus-visible:ring-2 focus-visible:ring-offset-0', 'disabled:cursor-not-allowed']
1008
+ 'focus-visible:ring-2 focus-visible:ring-offset-0', 'cursor-pointer disabled:cursor-not-allowed']
853
1009
  },
854
1010
  variants: {
855
1011
  isDisabled: {
@@ -925,12 +1081,6 @@ const chip = tv({
925
1081
  dot: 'size-2.5',
926
1082
  closeButton: 'text-label-md'
927
1083
  }
928
- },
929
- radius: {
930
- none: 'rounded-none',
931
- sm: 'rounded-sm',
932
- lg: 'rounded-lg',
933
- full: 'rounded-full'
934
1084
  }
935
1085
  },
936
1086
  compoundVariants: [
@@ -1103,8 +1253,7 @@ const chip = tv({
1103
1253
  defaultVariants: {
1104
1254
  size: 'md',
1105
1255
  color: 'neutral',
1106
- variant: 'solid',
1107
- radius: 'full'
1256
+ variant: 'solid'
1108
1257
  }
1109
1258
  });
1110
1259
 
@@ -2281,7 +2430,7 @@ const segmentedControl = tv({
2281
2430
  // transitioned. `transform` is listed for overrides that use it.
2282
2431
  'group-data-[fr-si-ready]/segmented:transition-[transform,translate,width,height]', 'group-data-[fr-si-ready]/segmented:duration-200', 'group-data-[fr-si-ready]/segmented:ease-out', 'motion-reduce:transition-none'],
2283
2432
  // Both focus rings, not one per rendering mode: in button mode the item is
2284
- // the focusable element and `has-[:focus-visible]` has no descendant to
2433
+ // the focusable element and `has-focus-visible:` has no descendant to
2285
2434
  // match, while in form mode the label is not focusable and `focus-visible:`
2286
2435
  // never matches it. Only one set can ever apply, so a third rendering mode
2287
2436
  // needs no third branch.
@@ -2448,6 +2597,312 @@ const segmentedControl = tv({
2448
2597
  }
2449
2598
  });
2450
2599
 
2600
+ /**
2601
+ * Every state class keys off a `data-*` attribute the Step writes onto its
2602
+ * `<li>` (`data-part="item"`, the `group/item` anchor): `data-state`
2603
+ * (`complete | active | upcoming`), `data-invalid`, `data-loading`,
2604
+ * `data-disabled`. `data-invalid` and friends are written as the strings
2605
+ * "true"/"false", so they are tested with `=true`.
2606
+ *
2607
+ * Class strings are spelled out per color rather than built in a loop:
2608
+ * Tailwind generates nothing from an interpolated class name.
2609
+ */
2610
+ const stepper = tv({
2611
+ slots: {
2612
+ // The named container the responsive label rules (added alongside the
2613
+ // layout work) measure against.
2614
+ base: '@container/stepper flex w-full',
2615
+ list: 'm-0 flex w-full list-none p-0',
2616
+ item: 'group/item relative flex',
2617
+ step: [...focusVisibleRing, 'inline-flex items-center gap-2',
2618
+ // Hit area: at least 44px whatever the circle size, so the visual
2619
+ // size and the touch target are independent.
2620
+ 'min-h-11 min-w-11 justify-center rounded-md', 'cursor-pointer text-start', 'transition-colors duration-200 motion-reduce:transition-none', 'group-data-[disabled=true]/item:cursor-not-allowed', 'group-data-[disabled=true]/item:opacity-disabled'],
2621
+ indicator: ['inline-flex shrink-0 items-center justify-center rounded-full', 'border-2 font-medium tabular-nums', 'transition-colors duration-200 motion-reduce:transition-none',
2622
+ // Upcoming is the resting state; the other states override it.
2623
+ 'border-neutral-mild text-neutral-firm',
2624
+ // Hovering an enabled upcoming step firms its ring, the one hint that
2625
+ // it can be picked. Active and complete steps already carry color, so
2626
+ // the selector is scoped to upcoming, not overridden by them.
2627
+ '[li[data-state=upcoming][data-disabled=false]>button:hover_&]:border-neutral',
2628
+ // Invalid is always danger, whatever `color` is, and outranks the
2629
+ // active and complete treatments. Those are `group-data-[state=...]`
2630
+ // classes of equal specificity emitted later, so only `!` guarantees
2631
+ // the win -- without it a step that is both complete and invalid shows
2632
+ // the accent color.
2633
+ 'group-data-[invalid=true]/item:border-danger!', 'group-data-[invalid=true]/item:bg-danger-subtle!', 'group-data-[invalid=true]/item:text-danger!'],
2634
+ // The check mark inside a complete indicator. It animates only while the
2635
+ // Step has `data-just-completed` -- set for the moment after a step
2636
+ // *becomes* complete -- so steps that load already complete stay still.
2637
+ check: ['shrink-0', 'group-data-[just-completed=true]/item:animate-stepper-check-pop', 'group-data-[just-completed=true]/item:[&_path]:animate-stepper-check-draw',
2638
+ // `1 2`: a dash as long as the path (normalized to 1) and a gap longer
2639
+ // than it, so the undrawn state shows nothing, not even a round cap.
2640
+ 'group-data-[just-completed=true]/item:[&_path]:[stroke-dasharray:1_2]', 'motion-reduce:animate-none motion-reduce:[&_path]:animate-none'],
2641
+ // The track is neutral; an `::after` fill in the step's color grows along
2642
+ // it when the step completes, and shrinks back if the user returns. The
2643
+ // fill's axis and origin come from `orientation`, below.
2644
+ connector: ['relative shrink-0 overflow-hidden bg-neutral-mild', 'after:absolute after:inset-0 after:content-[""]', 'after:transition-transform after:duration-300 after:ease-out', 'motion-reduce:after:transition-none',
2645
+ // The last step has nothing to connect to.
2646
+ 'group-last/item:hidden'],
2647
+ // Collapsed (menu) mode only. The trigger shows the current step and opens
2648
+ // the list, which becomes a floating panel; see `collapsed` below.
2649
+ trigger: [...focusVisibleRing, 'flex min-h-11 w-full cursor-pointer items-center justify-between gap-3',
2650
+ // Same border as a form field: it reads as a control, like a Select.
2651
+ 'rounded-xl border border-neutral-soft bg-surface-input px-3 py-2 text-start', 'hover:bg-surface-overlay-soft', 'transition-colors duration-200 motion-reduce:transition-none', '[&_svg]:transition-transform motion-reduce:[&_svg]:transition-none', '[&[aria-expanded=true]_svg]:rotate-180'],
2652
+ // A zero-size sentinel the root reads to learn which side of the
2653
+ // threshold it is on. The threshold stays in CSS, where the label rules
2654
+ // already read it, so the two can never disagree.
2655
+ probe: 'hidden',
2656
+ // The trigger's two lines of text, and its chevron.
2657
+ triggerLabel: 'flex min-w-0 flex-col gap-1',
2658
+ chevron: 'size-4 shrink-0 text-neutral-firm',
2659
+ // "Step N of M" and the active step's title, in the trigger and in the
2660
+ // standalone summary line. The count is the quiet eyebrow; the title is
2661
+ // what the reader is looking for, so it carries the weight.
2662
+ summaryText: 'block text-neutral-firm',
2663
+ summaryTitle: 'block font-medium text-neutral-strong',
2664
+ // The invalid step's exclamation mark, the loading spinner, and the text
2665
+ // only screen readers get for an invalid step.
2666
+ mark: 'shrink-0',
2667
+ spinner: 'fill-current text-neutral-mild',
2668
+ invalidText: 'sr-only',
2669
+ // Titles use the tight-leading label scale, so the gap is what separates
2670
+ // a title from its description.
2671
+ label: 'flex min-w-0 flex-col gap-1',
2672
+ title: ['font-medium text-neutral-strong', 'group-data-[state=upcoming]/item:text-neutral-firm', 'group-data-[invalid=true]/item:text-danger'],
2673
+ // Body, not caption: the caption scale's 1px tracking suits small
2674
+ // standalone text, but beside a title it reads as a different typeface.
2675
+ description: 'text-neutral-firm',
2676
+ summary: 'flex flex-col gap-1',
2677
+ panel: [...focusVisibleRing, 'outline-none']
2678
+ },
2679
+ variants: {
2680
+ color: {
2681
+ neutral: {
2682
+ indicator: ['group-data-[state=complete]/item:border-neutral-strong group-data-[state=complete]/item:bg-neutral-strong group-data-[state=complete]/item:text-background', 'group-data-[state=active]/item:border-neutral-strong group-data-[state=active]/item:text-neutral-strong group-data-[state=active]/item:bg-neutral-subtle'],
2683
+ connector: 'group-data-[state=complete]/item:after:bg-neutral-strong'
2684
+ },
2685
+ primary: {
2686
+ indicator: ['group-data-[state=complete]/item:border-primary group-data-[state=complete]/item:bg-primary group-data-[state=complete]/item:text-on-primary', 'group-data-[state=active]/item:border-primary group-data-[state=active]/item:text-primary group-data-[state=active]/item:bg-primary-subtle'],
2687
+ connector: 'group-data-[state=complete]/item:after:bg-primary'
2688
+ },
2689
+ secondary: {
2690
+ indicator: ['group-data-[state=complete]/item:border-secondary group-data-[state=complete]/item:bg-secondary group-data-[state=complete]/item:text-on-secondary', 'group-data-[state=active]/item:border-secondary group-data-[state=active]/item:text-secondary group-data-[state=active]/item:bg-secondary-subtle'],
2691
+ connector: 'group-data-[state=complete]/item:after:bg-secondary'
2692
+ },
2693
+ tertiary: {
2694
+ indicator: ['group-data-[state=complete]/item:border-tertiary group-data-[state=complete]/item:bg-tertiary group-data-[state=complete]/item:text-on-tertiary', 'group-data-[state=active]/item:border-tertiary group-data-[state=active]/item:text-tertiary group-data-[state=active]/item:bg-tertiary-subtle'],
2695
+ connector: 'group-data-[state=complete]/item:after:bg-tertiary'
2696
+ },
2697
+ success: {
2698
+ indicator: ['group-data-[state=complete]/item:border-success group-data-[state=complete]/item:bg-success group-data-[state=complete]/item:text-on-success', 'group-data-[state=active]/item:border-success group-data-[state=active]/item:text-success group-data-[state=active]/item:bg-success-subtle'],
2699
+ connector: 'group-data-[state=complete]/item:after:bg-success'
2700
+ },
2701
+ warning: {
2702
+ indicator: ['group-data-[state=complete]/item:border-warning group-data-[state=complete]/item:bg-warning group-data-[state=complete]/item:text-on-warning', 'group-data-[state=active]/item:border-warning group-data-[state=active]/item:text-warning group-data-[state=active]/item:bg-warning-subtle'],
2703
+ connector: 'group-data-[state=complete]/item:after:bg-warning'
2704
+ },
2705
+ danger: {
2706
+ indicator: ['group-data-[state=complete]/item:border-danger group-data-[state=complete]/item:bg-danger group-data-[state=complete]/item:text-on-danger', 'group-data-[state=active]/item:border-danger group-data-[state=active]/item:text-danger group-data-[state=active]/item:bg-danger-subtle'],
2707
+ connector: 'group-data-[state=complete]/item:after:bg-danger'
2708
+ }
2709
+ },
2710
+ // `step` is the padding that brings indicator plus padding to 44px, so the
2711
+ // hit area is 44px whatever the circle size and the circle sits 22px in
2712
+ // from the button's edge in every layout. `item` carries how far a
2713
+ // bottom-label connector sits from the item's center: the circle's radius
2714
+ // plus a 4px gap.
2715
+ //
2716
+ // Type steps down one level per size: the number sits at about half the
2717
+ // circle's height, the title one step above the number, and the
2718
+ // description one step below the title.
2719
+ size: {
2720
+ sm: {
2721
+ step: 'p-2.5',
2722
+ item: '[--stepper-offset:1rem]',
2723
+ // `[&_svg]` outranks an icon's own size class, so the circle, not the
2724
+ // icon, decides the glyph size (about half the circle, 4-6px padding).
2725
+ indicator: 'size-6 text-label-2xs [&_svg]:size-3',
2726
+ title: 'text-label-xs',
2727
+ description: 'text-body-2xs',
2728
+ summaryText: 'text-body-2xs',
2729
+ summaryTitle: 'text-label-xs',
2730
+ panel: 'py-2'
2731
+ },
2732
+ md: {
2733
+ step: 'p-2',
2734
+ item: '[--stepper-offset:1.125rem]',
2735
+ indicator: 'size-7 text-label-xs [&_svg]:size-3.5',
2736
+ title: 'text-label-sm',
2737
+ description: 'text-body-xs',
2738
+ summaryText: 'text-body-xs',
2739
+ summaryTitle: 'text-label-sm',
2740
+ panel: 'py-3'
2741
+ },
2742
+ lg: {
2743
+ step: 'p-1',
2744
+ item: '[--stepper-offset:1.375rem]',
2745
+ indicator: 'size-9 text-label-sm [&_svg]:size-4.5',
2746
+ title: 'text-label-md',
2747
+ description: 'text-body-sm',
2748
+ summaryText: 'text-body-sm',
2749
+ summaryTitle: 'text-label-md',
2750
+ panel: 'py-4'
2751
+ }
2752
+ },
2753
+ orientation: {
2754
+ horizontal: {
2755
+ base: 'flex-col gap-4',
2756
+ list: 'flex-row items-start',
2757
+ item: 'flex-1 items-center last:flex-none',
2758
+ connector: ['mx-1 h-0.5 min-w-4 flex-1',
2759
+ // Grows from the start edge, which is the right in RTL.
2760
+ 'after:origin-left after:scale-x-0 rtl:after:origin-right', 'group-data-[state=complete]/item:after:scale-x-100']
2761
+ },
2762
+ vertical: {
2763
+ base: 'flex-col gap-4',
2764
+ list: 'flex-col',
2765
+ // `pb-4` is the space between steps; the connector spans it.
2766
+ item: 'relative flex-col items-start pb-4 last:pb-0',
2767
+ // Circle at the top, beside the title's first line, so a step with a
2768
+ // description does not push its circle (and its connector) down.
2769
+ step: 'items-start',
2770
+ // Drawn absolutely from this circle to the next one, so it bridges the
2771
+ // step's 44px hit-area padding and any description height alike. The
2772
+ // circle's center is 22px down; `--stepper-offset` is its radius plus
2773
+ // the 4px clearance a horizontal connector also keeps.
2774
+ connector: ['absolute start-[21px] w-0.5', 'top-[calc(22px+var(--stepper-offset))] bottom-[calc(var(--stepper-offset)-22px)]', 'after:origin-top after:scale-y-0', 'group-data-[state=complete]/item:after:scale-y-100']
2775
+ }
2776
+ },
2777
+ // Where the label sits relative to the circle. `end` is beside it;
2778
+ // `bottom` centers it underneath. Vertical orientation ignores this.
2779
+ labelPosition: {
2780
+ end: {},
2781
+ bottom: {}
2782
+ },
2783
+ // What a horizontal Stepper does when it is too narrow for its titles.
2784
+ // `menu` swaps the row for a trigger and a floating list; `summary` hides
2785
+ // the titles and shows a "Step N of M" line; `none` leaves it alone. The
2786
+ // label rules depend on orientation and labelPosition, so they are
2787
+ // compound variants below.
2788
+ collapse: {
2789
+ menu: {},
2790
+ summary: {},
2791
+ none: {}
2792
+ },
2793
+ // True while a `menu` Stepper is actually collapsed. The component sets it
2794
+ // (it measures the root), and passes `orientation: 'vertical'` alongside,
2795
+ // so the list reuses the vertical layout inside the panel.
2796
+ collapsed: {
2797
+ true: {
2798
+ list: ['inset-auto m-0 w-auto min-w-64 max-w-[calc(100vw-1rem)] overflow-auto p-2 text-inherit', 'max-h-[min(24rem,70vh)] rounded-xl border border-neutral-muted bg-surface-input shadow-elevation-3',
2799
+ // `display` on the list would beat the UA rule that hides a closed
2800
+ // popover, so the closed state is restated here.
2801
+ '[&:not(:popover-open)]:hidden'],
2802
+ // Rows sit closer in the menu than in a vertical Stepper: it is a
2803
+ // list to pick from, not a page-level layout.
2804
+ item: 'items-stretch pb-1',
2805
+ step: 'w-full justify-start hover:bg-surface-overlay-soft'
2806
+ }
2807
+ }
2808
+ },
2809
+ compoundVariants: [
2810
+ // -- label below the circle (horizontal only; vertical ignores it) --
2811
+ // Items are equal-width columns, and the connector is drawn from this
2812
+ // item's circle to the next one's, so it needs `relative` on the item and
2813
+ // an offset that clears the circle (radius plus a 4px gap, per size).
2814
+ // Logical properties (`start`/`end`, `ms`) so the layout mirrors in RTL.
2815
+ {
2816
+ orientation: 'horizontal',
2817
+ labelPosition: 'bottom',
2818
+ class: {
2819
+ item: 'relative flex-1 flex-col items-center last:flex-1',
2820
+ step: 'flex-col',
2821
+ label: 'items-center text-center',
2822
+ connector: ['absolute top-[21px] mx-0 min-w-0 flex-none', 'start-[calc(50%+var(--stepper-offset))] end-[calc(-50%+var(--stepper-offset))]']
2823
+ }
2824
+ },
2825
+ // -- vertical: the title's first line is centered on the circle --
2826
+ // Half of (circle height - one title line) of top padding, so a title
2827
+ // lines up with the circle's middle whether or not a description follows.
2828
+ {
2829
+ orientation: 'vertical',
2830
+ size: 'sm',
2831
+ class: {
2832
+ title: 'pt-[calc((1.5rem-1lh)/2)]'
2833
+ }
2834
+ }, {
2835
+ orientation: 'vertical',
2836
+ size: 'md',
2837
+ class: {
2838
+ title: 'pt-[calc((1.75rem-1lh)/2)]'
2839
+ }
2840
+ }, {
2841
+ orientation: 'vertical',
2842
+ size: 'lg',
2843
+ class: {
2844
+ title: 'pt-[calc((2.25rem-1lh)/2)]'
2845
+ }
2846
+ },
2847
+ // -- responsive label collapse (horizontal only) --
2848
+ // Narrow: the label is visually hidden (`sr-only` keeps it in the
2849
+ // accessibility tree) and the summary shows. Wider than the threshold the
2850
+ // label returns and the summary goes.
2851
+ //
2852
+ // The thresholds are Frontile-namespaced container tokens, not `@md` /
2853
+ // `@2xl`: those read `--container-*`, which apps commonly redefine (and
2854
+ // which `max-w-*` shares), so they would move the breakpoints -- possibly
2855
+ // inverting the two modes. `var()` is not allowed in a container query
2856
+ // condition, so a theme token is the only way to make them tunable.
2857
+ {
2858
+ orientation: 'horizontal',
2859
+ collapse: 'summary',
2860
+ labelPosition: 'bottom',
2861
+ class: {
2862
+ label: 'sr-only @fr-stepper-bottom/stepper:not-sr-only',
2863
+ // The bottom-label row is symmetric (equal columns, centered
2864
+ // circles), so the line beneath it is centered too.
2865
+ summary: 'items-center text-center @fr-stepper-bottom/stepper:hidden',
2866
+ // With the title hidden the step is just its circle, so the focus
2867
+ // ring follows the circle instead of boxing it.
2868
+ step: '@max-fr-stepper-bottom/stepper:rounded-full'
2869
+ }
2870
+ }, {
2871
+ orientation: 'horizontal',
2872
+ collapse: 'summary',
2873
+ labelPosition: 'end',
2874
+ class: {
2875
+ label: 'sr-only @fr-stepper-end/stepper:not-sr-only',
2876
+ summary: '@fr-stepper-end/stepper:hidden',
2877
+ step: '@max-fr-stepper-end/stepper:rounded-full'
2878
+ }
2879
+ },
2880
+ // The probe is `display: block` from the same threshold at which titles
2881
+ // would appear, i.e. when the full row fits.
2882
+ {
2883
+ orientation: 'horizontal',
2884
+ collapse: 'menu',
2885
+ labelPosition: 'bottom',
2886
+ class: {
2887
+ probe: '@fr-stepper-bottom/stepper:block'
2888
+ }
2889
+ }, {
2890
+ orientation: 'horizontal',
2891
+ collapse: 'menu',
2892
+ labelPosition: 'end',
2893
+ class: {
2894
+ probe: '@fr-stepper-end/stepper:block'
2895
+ }
2896
+ }],
2897
+ defaultVariants: {
2898
+ color: 'primary',
2899
+ size: 'md',
2900
+ orientation: 'horizontal',
2901
+ labelPosition: 'end',
2902
+ collapse: 'menu'
2903
+ }
2904
+ });
2905
+
2451
2906
  const tabs = tv({
2452
2907
  slots: {
2453
2908
  base: 'flex',
@@ -2629,6 +3084,992 @@ const tabs = tv({
2629
3084
  }
2630
3085
  });
2631
3086
 
3087
+ // Color for the app shell's navigation surfaces: the `AppLayout` frame, a
3088
+ // `Sidebar` and a `Navbar`. Two layers of custom properties:
3089
+ //
3090
+ // 1. The layout color, set from `@color`. It names one semantic category, so
3091
+ // the parts below read one set of properties whatever the color is:
3092
+ //
3093
+ // --app-layout-color the color: a solid fill, the tints' base
3094
+ // --app-layout-color-strong the current row's label on a tinted part
3095
+ // --app-layout-on-color text on a solid fill
3096
+ //
3097
+ // They are declared once, on the layout's root, and inherited by the parts
3098
+ // in it. Three places declare them again: the phone drawer (portalled out
3099
+ // of the layout, so it inherits nothing), a part with its own `@color`, and
3100
+ // a part rendered outside a layout. So an app sets a color outside the
3101
+ // theme on the root (`@classes` `base`), plus `mobileSidebar` for the
3102
+ // drawer.
3103
+ //
3104
+ // 2. The roles a navigation row, a sidebar group label and the layout's
3105
+ // toggles read (`--nav-item-*`, `--nav-folder-border`,
3106
+ // `--sidebar-group-label-fg`). Unset, each falls back to the neutral color
3107
+ // where it is read, so a neutral, plain shell sets nothing. A part's
3108
+ // surface sets them on the part from the layout color. They are computed
3109
+ // there: a layout color changed on an element inside the part does not
3110
+ // reach them.
3111
+ //
3112
+ // Every class below is a literal, written out per color: Tailwind only
3113
+ // generates classes it finds as whole strings in the source.
3114
+
3115
+ const layoutColor = {
3116
+ // Neutral's fill is its darkest level, as for a solid neutral `Button`: a
3117
+ // mid-grey bar would read as disabled.
3118
+ neutral: '[--app-layout-color:var(--color-neutral-bolder)] [--app-layout-color-strong:var(--color-neutral-strong)] [--app-layout-on-color:var(--color-on-neutral-bolder)]',
3119
+ primary: '[--app-layout-color:var(--color-primary)] [--app-layout-color-strong:var(--color-primary-strong)] [--app-layout-on-color:var(--color-on-primary)]',
3120
+ secondary: '[--app-layout-color:var(--color-secondary)] [--app-layout-color-strong:var(--color-secondary-strong)] [--app-layout-on-color:var(--color-on-secondary)]',
3121
+ tertiary: '[--app-layout-color:var(--color-tertiary)] [--app-layout-color-strong:var(--color-tertiary-strong)] [--app-layout-on-color:var(--color-on-tertiary)]',
3122
+ success: '[--app-layout-color:var(--color-success)] [--app-layout-color-strong:var(--color-success-strong)] [--app-layout-on-color:var(--color-on-success)]',
3123
+ warning: '[--app-layout-color:var(--color-warning)] [--app-layout-color-strong:var(--color-warning-strong)] [--app-layout-on-color:var(--color-on-warning)]',
3124
+ danger: '[--app-layout-color:var(--color-danger)] [--app-layout-color-strong:var(--color-danger-strong)] [--app-layout-on-color:var(--color-on-danger)]'
3125
+ };
3126
+
3127
+ // The non-neutral colors, for compound variants: neutral's plain surface is
3128
+ // the fallbacks, so it sets no roles.
3129
+ const tintedColors = ['primary', 'secondary', 'tertiary', 'success', 'warning', 'danger'];
3130
+
3131
+ // `plain`: the part keeps its own ground (the frame, or the attached
3132
+ // sidebar's surface) and its rows take the color. The fills are fixed
3133
+ // fractions of the color rather than its `soft`/`muted` levels, whose alpha
3134
+ // differs from one category to the next, so every color steps the same way
3135
+ // from hover to current. Resting text stays neutral.
3136
+ const navTint = ['[--nav-item-hover-bg:color-mix(in_oklab,var(--app-layout-color)_10%,transparent)]', '[--nav-item-active-bg:color-mix(in_oklab,var(--app-layout-color)_18%,transparent)]', '[--nav-item-active-fg:var(--app-layout-color-strong)]', '[--nav-folder-border:color-mix(in_oklab,var(--app-layout-color)_25%,transparent)]'];
3137
+
3138
+ // `solid`: the part is filled with the color. Text is the full contrast
3139
+ // color, which is chosen for contrast at full strength only, so a light color
3140
+ // (a yellow `warning`) gets dark rows and a dark one light rows. The fills are
3141
+ // fractions of it. The `dark:` background is repeated because the attached
3142
+ // variant's own `dark:` background would otherwise win.
3143
+ const navSolid = ['bg-(--app-layout-color) dark:bg-(--app-layout-color) text-(--app-layout-on-color)', '[--nav-item-fg:var(--app-layout-on-color)]', '[--nav-item-hover-fg:var(--app-layout-on-color)]', '[--nav-item-active-fg:var(--app-layout-on-color)]', '[--nav-item-hover-bg:color-mix(in_oklab,var(--app-layout-on-color)_12%,transparent)]', '[--nav-item-active-bg:color-mix(in_oklab,var(--app-layout-on-color)_20%,transparent)]', '[--nav-folder-border:color-mix(in_oklab,var(--app-layout-on-color)_25%,transparent)]', '[--sidebar-group-label-fg:var(--app-layout-on-color)]'];
3144
+
3145
+ // The frame's gradient stops, from the layout color.
3146
+ const frameGradientStops = ['[--app-frame-gradient-from:color-mix(in_oklab,var(--app-layout-color)_16%,transparent)]', '[--app-frame-gradient-to:color-mix(in_oklab,var(--color-neutral-subtle)_16%,transparent)]'];
3147
+
3148
+ // The shell is one CSS grid. The parts (sidebar, navbar, main, aside) are
3149
+ // siblings in whatever order the consumer writes them, so each places itself
3150
+ // in the grid rather than relying on a wrapper:
3151
+ //
3152
+ // col 1 col 2 col 3
3153
+ // row 1 sidebar | navbar | navbar
3154
+ // row 2 sidebar | main | aside
3155
+ //
3156
+ // row 3 bottom nav (all columns; only with `bottomNavRow: 'shown'`)
3157
+ //
3158
+ // Empty columns and rows are `auto` and collapse to nothing, so a layout with
3159
+ // no sidebar or aside needs no special casing. The inset card is a single
3160
+ // decorative element (`mainCard`) drawn behind the parts in the same grid
3161
+ // area; the parts round their own corners to match it.
3162
+ // The sidebar's drawn width per variant and collapse state, written once.
3163
+ // `sidebar` is the sidebar's own width class; `token` sets the root's
3164
+ // published `--app-sidebar-width` to the same length. The sidebar does NOT
3165
+ // read the token: the token is `0px` until a `Sidebar` registers with the
3166
+ // layout (after the first render), and the sidebar's width must not depend
3167
+ // on that. Class names are literal strings so Tailwind can see them.
3168
+ // The inset widths include the `pe-3`/`ps-3` gutter (border box).
3169
+ // `rail` is the narrow preset for a stacked-label rail (icon over a short
3170
+ // label). It is meant for `collapsible="none"`, so it has no collapsed row:
3171
+ // collapsed widths are the default size's.
3172
+ const sidebarWidths = {
3173
+ attached: {
3174
+ expanded: {
3175
+ sidebar: 'w-64',
3176
+ token: '[--app-sidebar-width:16rem]'
3177
+ },
3178
+ collapsed: {
3179
+ sidebar: 'w-16',
3180
+ token: '[--app-sidebar-width:4rem]'
3181
+ },
3182
+ rail: {
3183
+ sidebar: 'w-20',
3184
+ token: '[--app-sidebar-width:5rem]'
3185
+ }
3186
+ },
3187
+ inset: {
3188
+ expanded: {
3189
+ sidebar: 'w-60 [--sidebar-rail:3rem]',
3190
+ token: '[--app-sidebar-width:15rem]'
3191
+ },
3192
+ collapsed: {
3193
+ sidebar: 'w-[3.75rem] [--sidebar-rail:3rem]',
3194
+ token: '[--app-sidebar-width:3.75rem]'
3195
+ },
3196
+ // 80px plus the 12px `pe-3`/`ps-3` gutter.
3197
+ rail: {
3198
+ sidebar: 'w-[5.75rem]',
3199
+ token: '[--app-sidebar-width:5.75rem]'
3200
+ }
3201
+ }
3202
+ };
3203
+ const sidebarWidthVariants = ['attached', 'inset'].flatMap(variant => [
3204
+ // Collapsed widths are the same for every size.
3205
+ {
3206
+ variant,
3207
+ collapsed: true,
3208
+ class: {
3209
+ sidebar: sidebarWidths[variant].collapsed.sidebar
3210
+ }
3211
+ }, {
3212
+ variant,
3213
+ collapsed: false,
3214
+ sidebarSize: 'default',
3215
+ class: {
3216
+ sidebar: sidebarWidths[variant].expanded.sidebar
3217
+ }
3218
+ }, {
3219
+ variant,
3220
+ collapsed: false,
3221
+ sidebarSize: 'rail',
3222
+ class: {
3223
+ sidebar: sidebarWidths[variant].rail.sidebar
3224
+ }
3225
+ }, {
3226
+ variant,
3227
+ sidebarColumn: 'shown',
3228
+ sidebarSize: 'default',
3229
+ class: {
3230
+ base: sidebarWidths[variant].expanded.token
3231
+ }
3232
+ }, {
3233
+ variant,
3234
+ sidebarColumn: 'shown',
3235
+ sidebarSize: 'rail',
3236
+ class: {
3237
+ base: sidebarWidths[variant].rail.token
3238
+ }
3239
+ }, {
3240
+ variant,
3241
+ sidebarColumn: 'collapsed',
3242
+ class: {
3243
+ base: sidebarWidths[variant].collapsed.token
3244
+ }
3245
+ }]);
3246
+
3247
+ // Below the breakpoint the inset frame goes edge to edge: no gutter, no card
3248
+ // chrome, and the bottom bar needs no negative margins to escape the gutter.
3249
+ // Literal strings per breakpoint: Tailwind generates nothing from an
3250
+ // interpolated class. `max-sm` etc. are the exact complement of `sm:` etc.
3251
+ const edgeToEdge = {
3252
+ sm: {
3253
+ base: 'max-sm:p-0',
3254
+ card: 'max-sm:rounded-none max-sm:shadow-none max-sm:ring-0',
3255
+ radius: 'max-sm:rounded-none',
3256
+ bar: 'max-sm:mx-0 max-sm:mb-0'
3257
+ },
3258
+ md: {
3259
+ base: 'max-md:p-0',
3260
+ card: 'max-md:rounded-none max-md:shadow-none max-md:ring-0',
3261
+ radius: 'max-md:rounded-none',
3262
+ bar: 'max-md:mx-0 max-md:mb-0'
3263
+ },
3264
+ lg: {
3265
+ base: 'max-lg:p-0',
3266
+ card: 'max-lg:rounded-none max-lg:shadow-none max-lg:ring-0',
3267
+ radius: 'max-lg:rounded-none',
3268
+ bar: 'max-lg:mx-0 max-lg:mb-0'
3269
+ }
3270
+ };
3271
+ const edgeToEdgeVariants = ['sm', 'md', 'lg'].flatMap(breakpoint => {
3272
+ const e = edgeToEdge[breakpoint];
3273
+ return [{
3274
+ variant: 'inset',
3275
+ breakpoint,
3276
+ class: {
3277
+ base: e.base,
3278
+ mainCard: e.card,
3279
+ bottomNav: e.bar
3280
+ }
3281
+ }, {
3282
+ variant: 'inset',
3283
+ breakpoint,
3284
+ navbarPlacement: 'frame',
3285
+ class: {
3286
+ main: e.radius
3287
+ }
3288
+ }, {
3289
+ variant: 'inset',
3290
+ breakpoint,
3291
+ navbarPlacement: 'content',
3292
+ class: {
3293
+ navbar: e.radius,
3294
+ main: e.radius
3295
+ }
3296
+ }];
3297
+ });
3298
+
3299
+ // The layout's icon buttons (sidebar, menu and aside toggles). Same radius and
3300
+ // hover fill as a navigation row, so a toggle in the sidebar header reads as
3301
+ // one of its rows. `neutral-muted` stays visible on the frame's ground as
3302
+ // well as on the content surface. It reads the rows' color properties, so a
3303
+ // toggle in a colored sidebar or navbar takes its colors (see `nav-color.ts`).
3304
+ const iconButton = [...focusVisibleRing, 'inline-flex size-9 shrink-0 items-center justify-center rounded-lg', 'text-(--nav-item-fg,var(--color-neutral-firm))', 'hover:bg-(--nav-item-hover-bg,var(--color-neutral-muted))', 'hover:text-(--nav-item-hover-fg,var(--color-neutral-strong))'];
3305
+ // One variant entry per layout color, from the literal classes in
3306
+ // `nav-color.ts` (which is where Tailwind finds them).
3307
+ function perColor(entry) {
3308
+ return Object.fromEntries(Object.entries(layoutColor).map(([name, classes]) => [name, entry(classes)]));
3309
+ }
3310
+ const appLayout = tv({
3311
+ slots: {
3312
+ // Publishes the shell's sizes as custom properties, for the parts below
3313
+ // and for consumers (sticky offsets, custom parts):
3314
+ //
3315
+ // - `--app-navbar-height`: the height of the navbar and of the sidebar
3316
+ // header, so the two stay on one row.
3317
+ // - `--app-sidebar-width`: the sidebar's drawn width, border box (it
3318
+ // includes the inset variant's `pe-3`/`ps-3` gutter), set by the
3319
+ // `sidebarColumn` variant below. Published for consumers only (the
3320
+ // sidebar sizes itself): it settles after the first render, `0px` until
3321
+ // a Sidebar registers, so use a fallback where a flash matters. `0px`
3322
+ // when there is no sidebar column:
3323
+ // no Sidebar in the layout, below the breakpoint, or collapsed with
3324
+ // `collapsible="offcanvas"`.
3325
+ // - `--app-bottomnav-height`: the `BottomNav` bar's full height, the row
3326
+ // plus the safe-area inset (the literals in `bottom-nav.ts`), set
3327
+ // by the `bottomNavRow` variant below. `0px` when no bar is shown, so
3328
+ // consumers can offset by it unconditionally.
3329
+ //
3330
+ // The navbar and sidebar header read `--app-navbar-height` (always set)
3331
+ // with a literal fallback for parts rendered outside an `AppLayout`.
3332
+ base: ['relative grid w-full text-on-surface-app', 'grid-cols-[auto_minmax(0,1fr)_auto]', '[--app-navbar-height:3rem]',
3333
+ // The frame's gradient, painted over the variant's `bg-surface-*`
3334
+ // color. Its two stop colors are properties (set per `frameGradient`
3335
+ // below), so an app can swap a stop without rewriting the gradient:
3336
+ // `@classes={{hash base='[--app-frame-gradient-from:...]'}}`.
3337
+ // `--app-frame-gradient` itself takes any `<image>`, or `none`. The tint
3338
+ // holds at full strength across the sidebar and fades across the content,
3339
+ // so the first stop is the sidebar's edge (`--app-sidebar-width`). It
3340
+ // runs away from the sidebar: `--app-frame-gradient-direction` flips for
3341
+ // a right-to-left document and for `sidebarSide="end"` (a gradient has
3342
+ // no logical direction of its own).
3343
+ 'bg-(image:--app-frame-gradient)', '[--app-frame-gradient-direction:to_right] rtl:[--app-frame-gradient-direction:to_left]', '[--app-frame-gradient:linear-gradient(var(--app-frame-gradient-direction),var(--app-frame-gradient-from)_var(--app-sidebar-width,0px),var(--app-frame-gradient-to)_100%)]'],
3344
+ // `group/sidebar` plus `data-collapsed` on the element lets any descendant
3345
+ // react to the icon rail with `group-data-[collapsed=true]/sidebar:`.
3346
+ // Labels written as `<span data-sidebar-label>`, anywhere in the sidebar
3347
+ // (header, body or footer), are visually hidden in the icon rail but stay
3348
+ // in the accessibility tree (`sr-only`, never `display: none`).
3349
+ sidebar: ['group/sidebar col-start-1 row-[1/-1] shrink-0 flex-col', 'data-[collapsed=true]:[&_[data-sidebar-label]]:sr-only',
3350
+ // Expanding, a label fades in once the width has mostly opened. It is
3351
+ // already visually hidden when collapsing, so the fade-out is unseen.
3352
+ 'data-[collapsed=true]:[&_[data-sidebar-label]]:opacity-0', '[&_[data-sidebar-label]]:transition-opacity [&_[data-sidebar-label]]:delay-100 [&_[data-sidebar-label]]:duration-150',
3353
+ // `visibility` is listed so an offcanvas sidebar stays visible while it
3354
+ // closes and becomes hidden only once its width reaches 0.
3355
+ 'transition-[width,padding,visibility] duration-200', 'motion-reduce:transition-none motion-reduce:[&_[data-sidebar-label]]:transition-none'],
3356
+ // The sidebar's `nav` inside the mobile drawer: always expanded, as tall
3357
+ // as the drawer.
3358
+ mobileSidebar: 'group/sidebar flex min-h-0 flex-1 flex-col',
3359
+ // The drawer's close button, merged over the Drawer's own position. The
3360
+ // drawer is portalled out of the layout, so the layout's custom
3361
+ // properties do not reach it: the values are the defaults written out.
3362
+ // The 36px button is centered in the 3rem header row (top 6px), and its
3363
+ // icon ends 22px from the edge, where a row's trailing content does.
3364
+ drawerCloseButton: 'top-1.5 right-3.5 rtl:right-auto rtl:left-3.5',
3365
+ // In the icon rail the header stacks its children: the brand on its
3366
+ // content line (where the items' icons sit, so it does not move when the
3367
+ // rail opens) and the `Toggle` under it. The end is the gutter, so the
3368
+ // toggle's fill lines up with a row's.
3369
+ //
3370
+ // The layout flips in one frame while the width eases over 200ms, so the
3371
+ // header carries its own motion. Its content box is always the navbar
3372
+ // height (`box-content`), so the row centers the same way in both states;
3373
+ // the stacked toggle hangs below it in `padding-bottom`, which eases on the
3374
+ // width's curve, so the body glides rather than jumps. The toggle fades in
3375
+ // at its new spot on collapse, and `overflow-x-clip` keeps a toggle that is
3376
+ // still arriving inside the narrow rail on expand (0.375rem of clip margin
3377
+ // leaves its focus ring visible). A header that is only a `Toggle` keeps
3378
+ // its one row.
3379
+ //
3380
+ // The two ends mirror each other: the brand's start and the end toggle's
3381
+ // icon are both half a rail minus half an icon from the sidebar's edge,
3382
+ // the same inset a row gives its icon and its trailing chevron or badge.
3383
+ // The end padding is that inset less the toggle's 0.5rem icon padding.
3384
+ sidebarHeader: ['box-content flex h-(--app-navbar-height,3rem) shrink-0 items-center gap-2 pb-0 ps-[calc((var(--sidebar-rail,4rem)_-_1.25rem)/2)] pe-[calc(var(--sidebar-rail,4rem)/2_-_1.125rem)]', 'overflow-x-clip [overflow-clip-margin:0.375rem]', 'transition-[padding-bottom] duration-200 motion-reduce:transition-none', 'group-data-[collapsed=true]/sidebar:flex-col', 'group-data-[collapsed=true]/sidebar:items-start', 'group-data-[collapsed=true]/sidebar:*:shrink-0',
3385
+ // An `ml-auto` meant for the expanded row (a toggle pushed to the end)
3386
+ // would shove a stacked child aside.
3387
+ 'group-data-[collapsed=true]/sidebar:*:mx-0',
3388
+ // Brand and toggle: the brand's top is where a 1.25rem icon centered in
3389
+ // the navbar height sits, so only the toggle travels.
3390
+ 'group-data-[collapsed=true]/sidebar:has-[>*:not([data-part=sidebar-toggle])]:pb-10', 'group-data-[collapsed=true]/sidebar:has-[>*:not([data-part=sidebar-toggle])]:*:first:mt-[calc((var(--app-navbar-height,3rem)-1.25rem)/2)]', 'group-data-[collapsed=true]/sidebar:not-has-[>*:not([data-part=sidebar-toggle])]:justify-center',
3391
+ // The toggle's icon sits 0.5rem inside its fill; pull the fill back so
3392
+ // the icon lands on the content line, centered in the rail.
3393
+ 'group-data-[collapsed=true]/sidebar:*:data-[part=sidebar-toggle]:-ms-2', 'group-data-[collapsed=true]/sidebar:*:data-[part=sidebar-toggle]:animate-[frontile-fade-in_160ms_60ms_ease-out_backwards]', 'group-data-[collapsed=true]/sidebar:*:data-[part=sidebar-toggle]:motion-reduce:animate-none'],
3394
+ // Where a row's fill starts, from the sidebar's edge: `--sidebar-gutter`
3395
+ // (0.5rem by default, 0 in the inset variant, whose frame is the gutter).
3396
+ // The items' rail-centering, the header and the footer use it too.
3397
+ // `--sidebar-clip` is the room the scrolling body leaves for the focus
3398
+ // ring, which it would clip at its edge. It is padding with an equal
3399
+ // negative margin, so it does not move the rows: they start at the gutter.
3400
+ // The body is a column with the rows' 4px gap, so items placed straight in
3401
+ // it are spaced like those in a `Group` (a column that must not shrink).
3402
+ // With no header above it or footer below it, the body insets its first
3403
+ // and last rows by the gutter, as it does their sides. Inset's gutter is
3404
+ // 0: the frame's padding already holds them off the edge.
3405
+ sidebarBody: ['-mx-(--sidebar-clip,0px) flex min-h-0 flex-1 flex-col gap-1 overflow-y-auto *:shrink-0 px-[calc(var(--sidebar-gutter,0.5rem)+var(--sidebar-clip,0px))]', 'first:pt-(--sidebar-gutter,0.5rem) last:pb-(--sidebar-gutter,0.5rem)'],
3406
+ // A bare `Toggle` is offset so its icon sits on the content line.
3407
+ sidebarFooter: ['shrink-0 px-(--sidebar-gutter,0.5rem) py-2', '*:data-[part=sidebar-toggle]:ms-[calc((var(--sidebar-rail,4rem)_-_1.25rem)/2_-_var(--sidebar-gutter,0.5rem)_-_0.5rem)]'],
3408
+ // `Sidebar.Group`: a labelled set of items. The label is visually hidden
3409
+ // in the rail like any other sidebar label.
3410
+ sidebarGroup: 'flex flex-col gap-1 py-2',
3411
+ sidebarGroupLabel: ['truncate ps-[calc((var(--sidebar-rail,4rem)_-_1.25rem)/2_-_var(--sidebar-gutter,0.5rem))] pe-2 pb-1 font-label text-label-2xs text-(--sidebar-group-label-fg,var(--color-neutral-firm))', 'group-data-[collapsed=true]/sidebar:sr-only'],
3412
+ sidebarToggle: iconButton,
3413
+ // Opens the mobile drawer. Hidden from `breakpoint` up (see below).
3414
+ menuToggle: iconButton,
3415
+ // The navbar's side padding is the page header's, so its text lines up
3416
+ // with the page's. A toggle at either end is pulled back by its 0.5rem
3417
+ // icon padding, so its icon lines up instead of its fill.
3418
+ navbar: ['col-[2/-1] row-start-1 flex h-(--app-navbar-height,3rem) min-w-0 items-center gap-2 px-4', '[&>[data-part$=-toggle]:first-child]:-ms-2 [&>[data-part$=-toggle]:last-child]:-me-2'],
3419
+ main: 'col-start-2 row-start-2 min-h-0 min-w-0 outline-none',
3420
+ mainCard: 'pointer-events-none col-[2/-1]',
3421
+ // `BottomNav` inside the layout: the third row, across every column.
3422
+ // Merged over the bar's own (standalone, `fixed`) classes; the scroll
3423
+ // mode decides how it is positioned (see `scrollMode`).
3424
+ bottomNav: 'col-[1/-1] row-start-3',
3425
+ pageHeader: 'flex shrink-0 flex-wrap items-start gap-x-4 gap-y-2 px-4 py-4',
3426
+ pageHeaderContent: 'flex min-w-0 flex-1 flex-col gap-1',
3427
+ pageHeaderTitle: 'font-header text-header-lg text-neutral-strong',
3428
+ pageHeaderDescription: 'font-body text-body-sm text-neutral-firm',
3429
+ pageHeaderActions: 'flex shrink-0 items-center gap-2',
3430
+ // Literal `lg:block` here, not tied to `breakpoint`: the aside is a
3431
+ // wide-viewport affordance regardless of where the sidebar collapses.
3432
+ // Below `lg` the same block renders in a Drawer instead (`mobileAside`).
3433
+ aside: 'col-start-3 row-start-2 hidden w-72 shrink-0 overflow-y-auto p-4 font-body text-body-sm lg:block',
3434
+ // The aside's `aside` element inside the drawer: as tall as the drawer.
3435
+ mobileAside: 'min-h-0 flex-1 overflow-y-auto p-4 font-body text-body-sm',
3436
+ asideToggle: iconButton,
3437
+ skipLink: [...focusVisibleRing, 'sr-only focus:not-sr-only', 'focus:absolute focus:start-2 focus:top-2 focus:z-50', 'focus:rounded-md focus:bg-surface-app focus:px-3 focus:py-2', 'focus:text-on-surface-app focus:shadow-md']
3438
+ },
3439
+ variants: {
3440
+ variant: {
3441
+ // The tinted frame shows through a gutter around the card. The content
3442
+ // is the lit surface in both schemes: on a `canvas` frame in light, and
3443
+ // in dark, where `app` is black, a `card` veil (white at 7%) on an `app`
3444
+ // frame.
3445
+ inset: {
3446
+ base: 'bg-surface-canvas p-3 dark:bg-surface-app',
3447
+ // 0.375rem of clip room clears the 5px focus ring, which the
3448
+ // scrolling body would otherwise clip at its edge. The ground and
3449
+ // gutter depend on the sidebar's surface (see the compound variants).
3450
+ sidebar: '[--sidebar-clip:0.375rem]',
3451
+ mainCard: 'rounded-xl bg-surface-app shadow-sm ring-1 ring-neutral-muted dark:bg-surface-card',
3452
+ aside: 'border-s border-neutral-muted',
3453
+ // The bottom bar runs edge to edge: it pulls out over the frame's
3454
+ // side and bottom gutter (`p-3`).
3455
+ bottomNav: '-mx-3 -mb-3'
3456
+ },
3457
+ // The sidebar's ground and border are the layout's (see the compound
3458
+ // variants), so a standalone sidebar draws neither.
3459
+ attached: {
3460
+ base: 'bg-surface-app dark:bg-surface-canvas',
3461
+ // Edge-to-edge content: no card chrome. The element is not rendered.
3462
+ mainCard: 'hidden',
3463
+ navbar: 'border-b border-neutral-muted bg-surface-app dark:bg-surface-canvas',
3464
+ aside: 'border-s border-neutral-muted'
3465
+ }
3466
+ },
3467
+ // `frame`: the navbar is a row on the tinted frame, above the card.
3468
+ // `content`: the card grows to cover the navbar row too.
3469
+ navbarPlacement: {
3470
+ frame: {
3471
+ mainCard: 'row-[2/3]'
3472
+ },
3473
+ content: {
3474
+ mainCard: 'row-[1/3]'
3475
+ }
3476
+ },
3477
+ // Where the sidebar stops being an off-canvas drawer and becomes inline.
3478
+ // Literal strings per breakpoint: Tailwind generates nothing from an
3479
+ // interpolated class.
3480
+ breakpoint: {
3481
+ sm: {
3482
+ sidebar: 'hidden sm:flex',
3483
+ menuToggle: 'sm:hidden'
3484
+ },
3485
+ md: {
3486
+ sidebar: 'hidden md:flex',
3487
+ menuToggle: 'md:hidden'
3488
+ },
3489
+ lg: {
3490
+ sidebar: 'hidden lg:flex',
3491
+ menuToggle: 'lg:hidden'
3492
+ }
3493
+ },
3494
+ collapsed: {
3495
+ true: {},
3496
+ false: {}
3497
+ },
3498
+ // What the layout's root reports for `--app-sidebar-width`: `shown` and
3499
+ // `collapsed` take the width from `variant` (compound variants below);
3500
+ // `none` is no sidebar column. Set by `AppLayout` only.
3501
+ sidebarColumn: {
3502
+ shown: {},
3503
+ collapsed: {},
3504
+ none: {
3505
+ base: '[--app-sidebar-width:0px]'
3506
+ }
3507
+ },
3508
+ // Whether the layout shows a `BottomNav` row: `@mobileNav="bottom"`,
3509
+ // below the breakpoint, with a `BottomNav` registered. `shown` adds the
3510
+ // third `auto` row (compound variants below) and publishes the bar's
3511
+ // height; the row height and safe-area expression must match `bottom-nav.ts`,
3512
+ // written out because Tailwind generates nothing from an interpolated class.
3513
+ // Set by `AppLayout` only.
3514
+ bottomNavRow: {
3515
+ shown: {
3516
+ base: '[--app-bottomnav-height:calc(3.75rem+var(--bottomnav-safe-area,env(safe-area-inset-bottom,0px)))]'
3517
+ },
3518
+ none: {
3519
+ base: '[--app-bottomnav-height:0px]'
3520
+ }
3521
+ },
3522
+ // The sidebar's width preset: `default`, or `rail` for a narrow
3523
+ // icon-over-label rail. Set by `Sidebar`, and by `AppLayout` for the root's
3524
+ // token. Defaults to `default` so existing callers are unchanged.
3525
+ sidebarSize: {
3526
+ default: {},
3527
+ rail: {}
3528
+ },
3529
+ // `icon` shrinks to a rail, `offcanvas` hides entirely, `none` ignores
3530
+ // `collapsed` (the Sidebar passes `collapsed: false` for it).
3531
+ collapsible: {
3532
+ icon: {},
3533
+ // The sidebar closes to no width, so its contents fade rather than
3534
+ // being seen squeezed: out quickly on collapse, back in once the width
3535
+ // has mostly opened (the delay, cleared while collapsing).
3536
+ offcanvas: {
3537
+ sidebar: ['overflow-x-clip', '*:transition-opacity *:delay-100 *:duration-150 motion-reduce:*:transition-none']
3538
+ },
3539
+ none: {}
3540
+ },
3541
+ // The shell's color: one semantic category, published as the
3542
+ // `--app-layout-color*` properties (see `nav-color.ts`). Declared on the
3543
+ // root, which the parts inherit from, and on the drawer's sidebar, which
3544
+ // is portalled out of the layout. It also picks the parts' tints below.
3545
+ color: perColor(classes => ({
3546
+ base: classes,
3547
+ mobileSidebar: classes
3548
+ })),
3549
+ // The color a sidebar or navbar declares on itself: its own `@color`, or
3550
+ // the layout's when there is no layout around it to inherit from. Unset,
3551
+ // the part inherits the root's.
3552
+ partColor: perColor(classes => ({
3553
+ sidebar: classes,
3554
+ navbar: classes
3555
+ })),
3556
+ // How the sidebar and the navbar wear the color. `plain` keeps the part's
3557
+ // ground and tints its rows; `solid` fills it with the color. The classes
3558
+ // are compound variants below, after the variant's own, so they win over
3559
+ // the attached variant's background and border.
3560
+ sidebarSurface: {
3561
+ plain: {},
3562
+ solid: {}
3563
+ },
3564
+ navbarSurface: {
3565
+ plain: {},
3566
+ solid: {}
3567
+ },
3568
+ // The frame's gradient: a left-to-right tint of the layout's color fading to a neutral grey,
3569
+ // both at a low alpha, over the variant's own surface (black in dark
3570
+ // mode). Both stops are theme colors, so none of it is hard-coded.
3571
+ frameGradient: {
3572
+ true: {
3573
+ base: frameGradientStops
3574
+ },
3575
+ false: {
3576
+ base: '[--app-frame-gradient:none]'
3577
+ }
3578
+ },
3579
+ // `translucent` lets the frame (and its gradient) show through the inset
3580
+ // card: the app surface at 50%, which is black at 50% in dark mode (the
3581
+ // design's card) and white at 50% in light. `solid` keeps the opaque
3582
+ // surface. The dark class is repeated because the variant's own `dark:`
3583
+ // background would otherwise win.
3584
+ cardSurface: {
3585
+ solid: {},
3586
+ translucent: {
3587
+ mainCard: 'bg-surface-app/50 dark:bg-surface-app/50'
3588
+ }
3589
+ },
3590
+ // `end` moves the sidebar to the last column and the aside to the first,
3591
+ // so the two stay on opposite sides of the page. The grid is reordered,
3592
+ // not the DOM: aside and main take columns 1 and 2, with the navbar and
3593
+ // card spanning both. Logical utilities flip all of this in a
3594
+ // right-to-left document.
3595
+ sidebarSide: {
3596
+ start: {},
3597
+ end: {
3598
+ base: '[--app-frame-gradient-direction:to_left] rtl:[--app-frame-gradient-direction:to_right]',
3599
+ sidebar: 'col-start-3',
3600
+ navbar: 'col-[1/-2]',
3601
+ main: 'col-start-2',
3602
+ mainCard: 'col-[1/-2]',
3603
+ aside: 'col-start-1'
3604
+ }
3605
+ },
3606
+ // The sidebar rendered in the mobile drawer. The drawer's close button
3607
+ // sits at the end of the first row: the header leaves room for it, and a
3608
+ // body with no header above it leaves that row empty.
3609
+ inDrawer: {
3610
+ true: {
3611
+ sidebarHeader: 'pe-[3.625rem]',
3612
+ sidebarBody: 'first:pt-(--app-navbar-height,3rem)'
3613
+ },
3614
+ false: {}
3615
+ },
3616
+ // Outside an `AppLayout` there is no grid and no drawer breakpoint, so the
3617
+ // sidebar is always shown and as tall as its container.
3618
+ standalone: {
3619
+ true: {
3620
+ sidebar: 'flex h-full'
3621
+ },
3622
+ false: {}
3623
+ },
3624
+ // `content`: the shell fills the viewport and `main` scrolls itself.
3625
+ // `page`: the document scrolls and the sidebar sticks.
3626
+ scrollMode: {
3627
+ content: {
3628
+ base: 'h-dvh grid-rows-[auto_minmax(0,1fr)] overflow-hidden',
3629
+ main: 'overflow-y-auto',
3630
+ // A plain grid row under `main`, which scrolls on its own.
3631
+ bottomNav: 'static'
3632
+ },
3633
+ page: {
3634
+ // `isolate` keeps the z-indexes below (the sticky bar, the sidebar
3635
+ // lifted for a flyout) inside the shell. Overlays portal to the end
3636
+ // of the body with no z-index of their own, so they paint above the
3637
+ // whole shell by DOM order. Without it, any positive z-index in here
3638
+ // would paint over every Modal, Drawer and Popover.
3639
+ base: 'isolate min-h-dvh grid-rows-[auto_1fr]',
3640
+ // No z-index: nothing in `main` needs to pass under it, and overlays
3641
+ // (Modal, Drawer, Popover, Tooltip, a rail `NavFolder`'s menu) are
3642
+ // portalled out of the shell.
3643
+ sidebar: 'sticky top-0 h-dvh self-start',
3644
+ // The document scrolls, so the bar sticks to the bottom of the
3645
+ // viewport over the content. `z-10` lifts it over in-page layers
3646
+ // (z-10 is the highest used in content; a tie goes to the later
3647
+ // element, so the bar should come after `Main` in the DOM). The
3648
+ // root's `isolate` keeps it under overlays.
3649
+ bottomNav: 'sticky bottom-0 z-10'
3650
+ }
3651
+ }
3652
+ },
3653
+ compoundVariants: [
3654
+ // The sidebar's own width and the root's `--app-sidebar-width` both come
3655
+ // from `sidebarWidths`, so they cannot drift.
3656
+ ...sidebarWidthVariants,
3657
+ // The rail is 5rem wide, so its body gives up some side padding to the
3658
+ // stacked labels. 0.3125rem still clears the 5px focus ring.
3659
+ {
3660
+ sidebarSize: 'rail',
3661
+ class: {
3662
+ sidebar: '[--sidebar-gutter:0.3125rem]'
3663
+ }
3664
+ },
3665
+ // The rail's items are centered columns (icon over label), and the header
3666
+ // assumes a 4rem `--sidebar-rail` that this 5rem column does not set. Give
3667
+ // it the body's gutter on both sides and center its content, so a brand
3668
+ // sits over the same box as the items. A group label is centered likewise.
3669
+ {
3670
+ sidebarSize: 'rail',
3671
+ class: {
3672
+ sidebarHeader: 'ps-(--sidebar-gutter,0.5rem) pe-(--sidebar-gutter,0.5rem) justify-center',
3673
+ sidebarGroupLabel: 'ps-0 pe-0 text-center'
3674
+ }
3675
+ },
3676
+ // The inset sidebar floats on the frame, so it supplies its own spacing
3677
+ // to the card (the grid has no gap).
3678
+ {
3679
+ variant: 'inset',
3680
+ sidebarSide: 'start',
3681
+ class: {
3682
+ sidebar: 'pe-3'
3683
+ }
3684
+ }, {
3685
+ variant: 'inset',
3686
+ sidebarSide: 'end',
3687
+ class: {
3688
+ sidebar: 'ps-3'
3689
+ }
3690
+ },
3691
+ // Attached: the sidebar sits on the frame's ground, the same
3692
+ // ground the inset variant's sidebar floats on, with a border on
3693
+ // the side facing the content. Only in a layout: standalone, the sidebar
3694
+ // is transparent and borderless, and its container decides both.
3695
+ {
3696
+ variant: 'attached',
3697
+ standalone: false,
3698
+ class: {
3699
+ sidebar: 'border-e border-neutral-muted bg-surface-canvas dark:bg-surface-app'
3700
+ }
3701
+ }, {
3702
+ variant: 'attached',
3703
+ standalone: false,
3704
+ sidebarSide: 'end',
3705
+ class: {
3706
+ sidebar: 'border-e-0 border-s'
3707
+ }
3708
+ },
3709
+ // The aside sits at the start with `sidebarSide="end"`; its border
3710
+ // faces the content, on its end side.
3711
+ {
3712
+ variant: 'inset',
3713
+ sidebarSide: 'end',
3714
+ class: {
3715
+ aside: 'border-s-0 border-e'
3716
+ }
3717
+ }, {
3718
+ variant: 'attached',
3719
+ sidebarSide: 'end',
3720
+ class: {
3721
+ aside: 'border-s-0 border-e'
3722
+ }
3723
+ },
3724
+ // The bottom nav's row, after the navbar and main rows.
3725
+ {
3726
+ scrollMode: 'content',
3727
+ bottomNavRow: 'shown',
3728
+ class: {
3729
+ base: 'grid-rows-[auto_minmax(0,1fr)_auto]'
3730
+ }
3731
+ }, {
3732
+ scrollMode: 'page',
3733
+ bottomNavRow: 'shown',
3734
+ class: {
3735
+ base: 'grid-rows-[auto_1fr_auto]'
3736
+ }
3737
+ },
3738
+ // Page mode with the inset frame: the sticky sidebar sits inside the
3739
+ // root's `p-3` gutter, so it sticks below the top gutter and is shorter
3740
+ // by both gutters. With `top-0 h-dvh` the grid grew by the gutters and
3741
+ // the page always scrolled by 1.5rem.
3742
+ {
3743
+ variant: 'inset',
3744
+ scrollMode: 'page',
3745
+ class: {
3746
+ sidebar: 'top-3 h-[calc(100dvh-1.5rem)]'
3747
+ }
3748
+ },
3749
+ // A navbar on the frame is itself the top gutter: its row starts at the
3750
+ // frame's edge, so its content is centered between that edge and the
3751
+ // card instead of sitting a gutter low. Without a navbar, or with the
3752
+ // navbar inside the card (`content`), the card keeps the top gutter.
3753
+ {
3754
+ variant: 'inset',
3755
+ navbarPlacement: 'frame',
3756
+ class: {
3757
+ base: 'has-[>[data-part=navbar]]:pt-0'
3758
+ }
3759
+ },
3760
+ // The same in page mode: the sticky sidebar starts at the top and is
3761
+ // shorter by the bottom gutter only.
3762
+ {
3763
+ variant: 'inset',
3764
+ navbarPlacement: 'frame',
3765
+ scrollMode: 'page',
3766
+ class: {
3767
+ base: 'has-[>[data-part=navbar]]:[&>[data-part=sidebar]]:top-0 has-[>[data-part=navbar]]:[&>[data-part=sidebar]]:h-[calc(100dvh-0.75rem)]'
3768
+ }
3769
+ },
3770
+ // Offcanvas: collapsed is no width, no gutter, no border, and once the
3771
+ // width transition ends, `invisible`, so its links leave the tab order
3772
+ // and the accessibility tree. Comes after the width variants so `w-0`
3773
+ // wins.
3774
+ {
3775
+ collapsible: 'offcanvas',
3776
+ collapsed: true,
3777
+ class: {
3778
+ sidebar: 'invisible w-0 border-0 ps-0 pe-0 *:opacity-0 *:delay-0'
3779
+ }
3780
+ },
3781
+ // Main and navbar round their own corners to the card's, so content
3782
+ // scrolled inside `main` is clipped to the card's shape.
3783
+ {
3784
+ variant: 'inset',
3785
+ navbarPlacement: 'frame',
3786
+ class: {
3787
+ main: 'rounded-xl'
3788
+ }
3789
+ }, {
3790
+ variant: 'inset',
3791
+ navbarPlacement: 'content',
3792
+ class: {
3793
+ navbar: 'rounded-t-xl border-b border-neutral-muted',
3794
+ main: 'rounded-b-xl'
3795
+ }
3796
+ }, ...edgeToEdgeVariants,
3797
+ // Inset: a plain sidebar floats on the tinted frame, transparent, and the
3798
+ // frame's own padding is its gutter, so rows start at its edge.
3799
+ {
3800
+ variant: 'inset',
3801
+ sidebarSurface: 'plain',
3802
+ class: {
3803
+ sidebar: 'bg-transparent [--sidebar-gutter:0px]'
3804
+ }
3805
+ },
3806
+ // Color. Last, so the solid fill wins over the attached variant's
3807
+ // backgrounds and border.
3808
+ {
3809
+ color: tintedColors,
3810
+ sidebarSurface: 'plain',
3811
+ class: {
3812
+ sidebar: navTint
3813
+ }
3814
+ }, {
3815
+ color: tintedColors,
3816
+ navbarSurface: 'plain',
3817
+ class: {
3818
+ navbar: navTint
3819
+ }
3820
+ },
3821
+ // The phone drawer is a surface of its own (the drawer's), so its rows
3822
+ // are tinted whatever the sidebar's surface: inverted rows would be
3823
+ // unreadable on it. The bottom bar is the same.
3824
+ {
3825
+ color: tintedColors,
3826
+ class: {
3827
+ mobileSidebar: navTint,
3828
+ bottomNav: navTint
3829
+ }
3830
+ }, {
3831
+ sidebarSurface: 'solid',
3832
+ class: {
3833
+ sidebar: [...navSolid, 'border-transparent']
3834
+ }
3835
+ }, {
3836
+ navbarSurface: 'solid',
3837
+ class: {
3838
+ navbar: [...navSolid, 'border-transparent']
3839
+ }
3840
+ },
3841
+ // On the inset frame a solid part is a panel of its own, with the card's
3842
+ // corners. The sidebar keeps the default gutter, so its rows stay off the
3843
+ // fill's edge.
3844
+ {
3845
+ sidebarSurface: 'solid',
3846
+ variant: 'inset',
3847
+ class: {
3848
+ sidebar: 'rounded-xl'
3849
+ }
3850
+ }, {
3851
+ navbarSurface: 'solid',
3852
+ variant: 'inset',
3853
+ class: {
3854
+ navbar: 'rounded-xl'
3855
+ }
3856
+ }],
3857
+ defaultVariants: {
3858
+ variant: 'inset',
3859
+ navbarPlacement: 'frame',
3860
+ breakpoint: 'md',
3861
+ collapsed: false,
3862
+ collapsible: 'icon',
3863
+ sidebarColumn: 'shown',
3864
+ bottomNavRow: 'none',
3865
+ sidebarSide: 'start',
3866
+ sidebarSize: 'default',
3867
+ color: 'neutral',
3868
+ sidebarSurface: 'plain',
3869
+ navbarSurface: 'plain',
3870
+ frameGradient: false,
3871
+ cardSurface: 'solid',
3872
+ standalone: false,
3873
+ inDrawer: false,
3874
+ scrollMode: 'content'
3875
+ }
3876
+ });
3877
+
3878
+ // The icon's position never depends on the collapsed state, so the rail
3879
+ // closes over it instead of the icon sliding as the width animates.
3880
+ // Start padding puts it at the center of the rail's content box:
3881
+ // (rail - body padding on both sides - icon 1.25rem) / 2. The body's
3882
+ // side padding is `--sidebar-gutter` (0.5rem unless the variant sets it).
3883
+ // `--sidebar-rail` is the content width, so the inset variant excludes its
3884
+ // 0.75rem gap. Only the inline layout follows the rail.
3885
+ //
3886
+ // The end padding is the same inset, so a trailing chevron or badge sits as
3887
+ // far inside the row as the icon does. A `Toggle` at the header's end lines
3888
+ // its icon up with them (see `sidebarHeader` in `app-layout.ts`).
3889
+ const railInset = 'ps-[calc((var(--sidebar-rail,4rem)_-_2*var(--sidebar-gutter,0.5rem)_-_1.25rem)/2)] pe-[calc((var(--sidebar-rail,4rem)_-_2*var(--sidebar-gutter,0.5rem)_-_1.25rem)/2)]';
3890
+
3891
+ // A badge on an inline row with an icon: at the row's trailing end, like a
3892
+ // folder's chevron, and on the icon's top-end corner once the sidebar
3893
+ // collapses to the rail and the label is gone. The row is the containing
3894
+ // block, so the corner is measured from the row's start, where the icon
3895
+ // sits at the rail inset: 4px past the icon's 1.25rem end and above its
3896
+ // top. Written out in full: Tailwind only sees literal class names.
3897
+ const railBadge = ['ms-auto', 'group-data-[collapsed=true]/sidebar:absolute', 'group-data-[collapsed=true]/sidebar:start-[calc((var(--sidebar-rail,4rem)_-_2*var(--sidebar-gutter,0.5rem)_-_1.25rem)/2_+_1.5rem)]', 'group-data-[collapsed=true]/sidebar:top-[calc(50%_-_0.875rem)]', 'group-data-[collapsed=true]/sidebar:-translate-x-full rtl:group-data-[collapsed=true]/sidebar:translate-x-full'];
3898
+
3899
+ // A row's colors are custom properties, read with the neutral defaults as
3900
+ // fallbacks. Nothing sets them by default; a colored `Sidebar` or `Navbar`
3901
+ // (`@color`, `@surface`) sets them on its own element, and an app can set
3902
+ // them on any ancestor. See `navTint` and `navSolid` in `nav-color.ts`.
3903
+ //
3904
+ // --nav-item-fg (default `--color-neutral-firm`)
3905
+ // --nav-item-hover-bg (default `--color-neutral-muted`)
3906
+ // --nav-item-hover-fg (default `--color-neutral-strong`)
3907
+ // --nav-item-active-bg (default `--color-neutral-soft`), also while hovered
3908
+ // --nav-item-active-fg (default `--color-neutral-strong`)
3909
+ // --nav-folder-border (default `--color-neutral-muted`), a folder's guide
3910
+ const navRow = [...focusVisibleRing,
3911
+ // 36px with a mouse; 44px where the pointer is coarse (touch).
3912
+ 'flex min-h-9 w-full items-center gap-2 rounded-lg px-2 py-1.5 font-body text-body-sm pointer-coarse:min-h-11', 'text-(--nav-item-fg,var(--color-neutral-firm))', 'not-data-[disabled=true]:hover:bg-(--nav-item-hover-bg,var(--color-neutral-muted))', 'not-data-[disabled=true]:hover:text-(--nav-item-hover-fg,var(--color-neutral-strong))', 'data-[disabled=true]:cursor-not-allowed data-[disabled=true]:opacity-disabled'];
3913
+
3914
+ // An item is filled while it is the current page. A folder is never the
3915
+ // current page, so its trigger takes `navRow` alone.
3916
+ const navItemRow = [...navRow, 'data-[active=true]:bg-(--nav-item-active-bg,var(--color-neutral-soft)) data-[active=true]:font-medium',
3917
+ // Hovering the current page keeps its fill rather than lightening it.
3918
+ 'not-data-[disabled=true]:data-[active=true]:hover:bg-(--nav-item-active-bg,var(--color-neutral-soft))', 'data-[active=true]:text-(--nav-item-active-fg,var(--color-neutral-strong))', 'not-data-[disabled=true]:data-[active=true]:hover:text-(--nav-item-active-fg,var(--color-neutral-strong))'];
3919
+
3920
+ /**
3921
+ * Shared navigation row styles: `NavLink`, `NavItem` and `NavFolder`.
3922
+ * Slot names equal the kebab-cased `data-part` each component renders.
3923
+ */
3924
+ const navItem = tv({
3925
+ slots: {
3926
+ navItem: navItemRow,
3927
+ // The slot sizes the icon, so an SVG that brings its own size (Lucide's
3928
+ // 24px attributes, a utility class) still matches the other rows.
3929
+ // `text-[1.25rem]` is for icons that size by font-size instead, such as
3930
+ // FontAwesome's 1em SVGs: their stylesheet is unlayered, so it beats
3931
+ // `size-5` (Tailwind utilities live in a layer) whatever the specificity.
3932
+ // It is set on the SVG, not the slot, so a badge inside the slot keeps
3933
+ // its own size. Keep it equal to `size-5`.
3934
+ navItemIcon: 'relative inline-flex shrink-0 items-center justify-center [&>svg]:size-5 [&>svg]:text-[1.25rem]',
3935
+ navItemLabel: 'truncate',
3936
+ // The short text shown under the icon in the stacked layout. A label, not
3937
+ // body copy: semibold in the label face, and the same weight whether or
3938
+ // not the item is current. `leading-tight` is kept over the token's
3939
+ // line-height of 1, which `truncate` (overflow hidden) would clip.
3940
+ navItemShortLabel: 'max-w-full truncate font-label text-label-micro leading-tight',
3941
+ navItemBadge: 'inline-flex h-4 min-w-4 items-center justify-center rounded-full bg-danger px-1 font-label text-label-micro leading-none text-on-danger',
3942
+ // Screen-reader text appended to the label for a badge.
3943
+ navItemBadgeLabel: 'sr-only',
3944
+ navFolder: 'flex flex-col',
3945
+ // A button, which browsers do not give a pointer cursor on their own.
3946
+ navFolderTrigger: [...navRow, 'not-data-[disabled=true]:cursor-pointer'],
3947
+ navFolderChevron: ['ms-auto size-4 shrink-0 transition-transform data-[open=true]:rotate-90 motion-reduce:transition-none',
3948
+ // Mirrored right to left, so it points toward the inline end. CSS
3949
+ // applies `scale` before `rotate`, so the open state turns the other
3950
+ // way there to still point down.
3951
+ 'rtl:-scale-x-100 rtl:data-[open=true]:-rotate-90', 'group-data-[collapsed=true]/sidebar:hidden'],
3952
+ // The first child's top margin spaces it from the trigger. It lives
3953
+ // inside the panel because the collapsed panel clips it; a gap or
3954
+ // padding on the folder would show 4px while closed.
3955
+ navFolderPanel: 'ms-4 flex flex-col gap-1 border-s border-(--nav-folder-border,var(--color-neutral-muted)) ps-2 *:first:mt-1'
3956
+ },
3957
+ variants: {
3958
+ layout: {
3959
+ inline: {
3960
+ // The containing block for a badge on the icon's corner in the rail.
3961
+ navItem: ['relative', railInset],
3962
+ navFolderTrigger: railInset,
3963
+ navItemIcon: 'size-5',
3964
+ // Hidden in the icon rail.
3965
+ navItemLabel: 'group-data-[collapsed=true]/sidebar:sr-only'
3966
+ },
3967
+ // Small icon over text. Ignores the sidebar's collapsed state.
3968
+ stacked: {
3969
+ navItem: ['group/nav-item mx-auto min-h-14 w-full max-w-[72px] flex-col justify-center gap-0.5 px-0.5 py-1 text-body-4xs',
3970
+ // The active fill sits behind the icon, not the whole item.
3971
+ 'data-[active=true]:bg-transparent not-data-[disabled=true]:hover:bg-transparent', 'not-data-[disabled=true]:data-[active=true]:hover:bg-transparent'],
3972
+ // The pill is themable from the item or any ancestor, without
3973
+ // reaching into the part with a descendant selector. Each falls back
3974
+ // to the row's own property, so a colored sidebar colors the pill:
3975
+ // --nav-item-pill-radius (default `--radius-lg`)
3976
+ // --nav-item-pill-hover-bg (default `--nav-item-hover-bg`)
3977
+ // --nav-item-pill-active-bg (default `--nav-item-active-bg`), also
3978
+ // used while the current item is hovered
3979
+ navItemIcon: ['h-8 w-11 rounded-(--nav-item-pill-radius,var(--radius-lg))', 'group-data-[active=true]/nav-item:bg-(--nav-item-pill-active-bg,var(--nav-item-active-bg,var(--color-neutral-soft)))', 'group-not-data-[disabled=true]/nav-item:group-hover/nav-item:bg-(--nav-item-pill-hover-bg,var(--nav-item-hover-bg,var(--color-neutral-muted)))', 'group-not-data-[disabled=true]/nav-item:group-data-[active=true]/nav-item:group-hover/nav-item:bg-(--nav-item-pill-active-bg,var(--nav-item-active-bg,var(--color-neutral-soft)))']
3980
+ },
3981
+ // Icon only; the label is screen-reader text and a tooltip.
3982
+ icon: {
3983
+ navItem: 'size-11 min-h-11 justify-center rounded-lg px-0 py-0',
3984
+ navItemIcon: 'size-5',
3985
+ navItemLabel: 'sr-only'
3986
+ },
3987
+ // A row of a rail folder's `Dropdown` menu: the menu item draws the
3988
+ // row, the item only its icon, label and badge.
3989
+ menu: {
3990
+ navItemIcon: 'size-5'
3991
+ }
3992
+ },
3993
+ // The current page, in a rail folder's menu.
3994
+ current: {
3995
+ true: {
3996
+ navItemLabel: 'font-medium text-neutral-strong'
3997
+ }
3998
+ },
3999
+ // The visible text is the short label, so the full label is for
4000
+ // screen readers only.
4001
+ shortLabel: {
4002
+ true: {
4003
+ navItemLabel: 'sr-only'
4004
+ }
4005
+ },
4006
+ badgePlacement: {
4007
+ // At the icon's top-end corner.
4008
+ icon: {
4009
+ navItemBadge: 'absolute -top-1 -end-1'
4010
+ },
4011
+ end: {
4012
+ navItemBadge: 'ms-auto'
4013
+ },
4014
+ // At the end of an inline row with an icon; on the icon in the rail.
4015
+ rail: {
4016
+ navItemBadge: railBadge
4017
+ }
4018
+ },
4019
+ // A plain dot with no text (the More tab's "something inside has a
4020
+ // badge" marker).
4021
+ badgeDot: {
4022
+ true: {
4023
+ navItemBadge: 'size-2 min-w-2 p-0'
4024
+ }
4025
+ }
4026
+ },
4027
+ compoundVariants: [
4028
+ // The dot is smaller than the pill, so it sits closer to the corner.
4029
+ {
4030
+ badgeDot: true,
4031
+ badgePlacement: 'icon',
4032
+ class: {
4033
+ navItemBadge: '-top-0.5 -end-0.5'
4034
+ }
4035
+ }, {
4036
+ badgeDot: true,
4037
+ badgePlacement: 'rail',
4038
+ class: {
4039
+ navItemBadge: ['group-data-[collapsed=true]/sidebar:start-[calc((var(--sidebar-rail,4rem)_-_2*var(--sidebar-gutter,0.5rem)_-_1.25rem)/2_+_1.375rem)]', 'group-data-[collapsed=true]/sidebar:top-[calc(50%_-_0.75rem)]']
4040
+ }
4041
+ }],
4042
+ defaultVariants: {
4043
+ layout: 'inline'
4044
+ }
4045
+ });
4046
+
4047
+ /**
4048
+ * The mobile bottom tab bar. Slot names equal the kebab-cased `data-part`
4049
+ * each component renders.
4050
+ *
4051
+ * Standalone, the bar is fixed to the bottom of the viewport. There is no
4052
+ * z-index here on purpose; `AppLayout` positions it and layers it.
4053
+ */
4054
+ const bottomNav = tv({
4055
+ slots: {
4056
+ // Class names are literal strings so Tailwind can see them.
4057
+ bottomNav: ['fixed inset-x-0 bottom-0 box-border flex items-center justify-around', 'border-t border-neutral-muted bg-surface-app', 'min-h-[calc(3.75rem+var(--bottomnav-safe-area,env(safe-area-inset-bottom,0px)))]', 'pb-[var(--bottomnav-safe-area,env(safe-area-inset-bottom,0px))]'],
4058
+ // `BottomNav.More`: the copy of its block that is always rendered, out
4059
+ // of sight, so its items can report active and badge state while the
4060
+ // sheet is closed. `hidden` backs up the `hidden` attribute.
4061
+ bottomNavMoreRegistry: 'hidden',
4062
+ // The More sheet, merged into the bottom `Drawer`'s base: as tall as its
4063
+ // items, up to 80% of the viewport.
4064
+ bottomNavMoreSheet: 'h-auto max-h-[80dvh]',
4065
+ // The sheet's scrolling body, merged into the `Drawer`'s. The bottom
4066
+ // padding is the safe-area inset alone, like the bar's.
4067
+ bottomNavMoreBody: ['px-2 pt-6', 'pb-[var(--bottomnav-safe-area,env(safe-area-inset-bottom,0px))]'],
4068
+ // The `nav` inside the sheet that holds its items.
4069
+ bottomNavMoreNav: 'flex flex-col gap-0.5 pb-2'
4070
+ }
4071
+ });
4072
+
2632
4073
  const accordion = tv({
2633
4074
  slots: {
2634
4075
  base: 'flex flex-col',
@@ -3788,7 +5229,10 @@ const select = tv({
3788
5229
  listbox: 'scroll-py-6 max-h-64 overflow-y-auto',
3789
5230
  icon: 'w-5 h-5',
3790
5231
  clearButton: 'pointer-events-auto',
3791
- input: '[button]:cursor-default',
5232
+ // The button trigger cannot carry `aria-invalid` (the button role does not
5233
+ // support it), so the component sets `data-invalid` and the input slot's
5234
+ // `aria-invalid:` treatment is restated against that.
5235
+ input: ['[button]:cursor-default', 'data-[invalid=true]:border-danger', 'data-[invalid=true]:focus:ring-danger-muted'],
3792
5236
  emptyContent: 'p-2',
3793
5237
  displayLimitContent: 'p-2 text-body-2xs text-neutral-firm',
3794
5238
  // The wrapper around the trigger. It is rendered in every mode; the
@@ -3827,6 +5271,13 @@ const select = tv({
3827
5271
  isFilterable: {
3828
5272
  true: {},
3829
5273
  false: {}
5274
+ },
5275
+ // Whether any key is selected. In chips mode an empty field shows the
5276
+ // placeholder in the bare trigger, which has to be offset to where a
5277
+ // single select's placeholder sits (see the compound variants below).
5278
+ hasSelection: {
5279
+ true: {},
5280
+ false: {}
3830
5281
  }
3831
5282
  },
3832
5283
  compoundVariants: [
@@ -3860,6 +5311,34 @@ const select = tv({
3860
5311
  chipsField: 'p-2 gap-0 min-h-13.5'
3861
5312
  }
3862
5313
  },
5314
+ // That padding is tight so chips fit, which leaves an empty field's
5315
+ // placeholder closer to the border than a single select's (`p-2`/`p-3`/
5316
+ // `p-4` on `input`). The trigger makes up the difference while nothing is
5317
+ // selected. Listed before the start-content rules so their `ps-0` wins:
5318
+ // with start content `chipsField` already reserves the same `ps-8` a
5319
+ // single select's input does.
5320
+ {
5321
+ hasChips: true,
5322
+ hasSelection: false,
5323
+ size: 'sm',
5324
+ class: {
5325
+ input: 'ps-1'
5326
+ }
5327
+ }, {
5328
+ hasChips: true,
5329
+ hasSelection: false,
5330
+ size: 'md',
5331
+ class: {
5332
+ input: 'ps-1.5'
5333
+ }
5334
+ }, {
5335
+ hasChips: true,
5336
+ hasSelection: false,
5337
+ size: 'lg',
5338
+ class: {
5339
+ input: 'ps-2'
5340
+ }
5341
+ },
3863
5342
  // Chips have to clear the absolutely-positioned start/end content the same
3864
5343
  // way a bare `input` does, otherwise they run underneath the chevron and the
3865
5344
  // clear button.
@@ -3893,12 +5372,20 @@ const select = tv({
3893
5372
  },
3894
5373
  // Only the filterable trigger needs typing room -- and, since the field
3895
5374
  // itself no longer sets a gap, its own separation from the last chip.
3896
- // See `min-w-0` and `gap-0` above.
5375
+ // See `min-w-0` and `gap-0` above. With no chips there is no last chip to
5376
+ // clear, and the placeholder offset above positions the text instead.
3897
5377
  {
3898
5378
  hasChips: true,
3899
5379
  isFilterable: true,
3900
5380
  class: {
3901
- input: 'min-w-16 ms-1'
5381
+ input: 'min-w-16'
5382
+ }
5383
+ }, {
5384
+ hasChips: true,
5385
+ isFilterable: true,
5386
+ hasSelection: true,
5387
+ class: {
5388
+ input: 'ms-1'
3902
5389
  }
3903
5390
  }],
3904
5391
  defaultVariants: {
@@ -4351,9 +5838,12 @@ var components = /*#__PURE__*/Object.freeze({
4351
5838
  __proto__: null,
4352
5839
  accordion: accordion,
4353
5840
  alert: alert,
5841
+ appLayout: appLayout,
4354
5842
  autocomplete: autocomplete,
4355
5843
  avatar: avatar,
4356
5844
  backdrop: backdrop,
5845
+ badge: badge,
5846
+ bottomNav: bottomNav,
4357
5847
  breadcrumbs: breadcrumbs,
4358
5848
  button: button,
4359
5849
  buttonGroup: buttonGroup,
@@ -4389,6 +5879,7 @@ var components = /*#__PURE__*/Object.freeze({
4389
5879
  listboxItem: listboxItem,
4390
5880
  modal: modal,
4391
5881
  nativeSelect: nativeSelect,
5882
+ navItem: navItem,
4392
5883
  notificationCard: notificationCard,
4393
5884
  notificationsContainer: notificationsContainer,
4394
5885
  overlay: overlay,
@@ -4403,6 +5894,7 @@ var components = /*#__PURE__*/Object.freeze({
4403
5894
  select: select,
4404
5895
  skeleton: skeleton,
4405
5896
  spinner: spinner,
5897
+ stepper: stepper,
4406
5898
  switchInput: switchInput,
4407
5899
  table: table,
4408
5900
  tabs: tabs,