@frontile/theme 0.18.7 → 0.18.9
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.
- package/declarations/colors.d.ts +1 -0
- package/declarations/colors.d.ts.map +1 -1
- package/declarations/components/app-layout.d.ts +93 -0
- package/declarations/components/app-layout.d.ts.map +1 -1
- package/declarations/components/badge.d.ts +162 -0
- package/declarations/components/badge.d.ts.map +1 -0
- package/declarations/components/chip.d.ts +0 -18
- package/declarations/components/chip.d.ts.map +1 -1
- package/declarations/components/forms/forms.d.ts +1 -1
- package/declarations/components/forms/forms.d.ts.map +1 -1
- package/declarations/components/index.d.ts +1 -0
- package/declarations/components/index.d.ts.map +1 -1
- package/declarations/components/nav-color.d.ts +15 -0
- package/declarations/components/nav-color.d.ts.map +1 -0
- package/declarations/components/nav-item.d.ts.map +1 -1
- package/declarations/components/shared.d.ts +8 -0
- package/declarations/components/shared.d.ts.map +1 -1
- package/declarations/plugin/power-select.d.ts.map +1 -1
- package/declarations/plugin/resolve.d.ts.map +1 -1
- package/declarations/plugin/theme-context.d.ts +15 -0
- package/declarations/plugin/theme-context.d.ts.map +1 -0
- package/declarations/plugin.d.ts.map +1 -1
- package/dist/colors.js +1 -1
- package/dist/index.js +406 -33
- package/dist/index.js.map +1 -1
- package/dist/plugin.js +78 -13
- package/dist/plugin.js.map +1 -1
- package/dist/{util-PU966Q_x.js → util-DrX1hjH-.js} +2 -2
- package/dist/{util-PU966Q_x.js.map → util-DrX1hjH-.js.map} +1 -1
- package/package.json +2 -2
- package/src/index.css +42 -3
- package/src/styles/theme.css +1 -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
|
-
|
|
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-
|
|
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.
|
|
@@ -2935,6 +3084,67 @@ const tabs = tv({
|
|
|
2935
3084
|
}
|
|
2936
3085
|
});
|
|
2937
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
|
+
|
|
2938
3148
|
// The shell is one CSS grid. The parts (sidebar, navbar, main, aside) are
|
|
2939
3149
|
// siblings in whatever order the consumer writes them, so each places itself
|
|
2940
3150
|
// in the grid rather than relying on a wrapper:
|
|
@@ -3089,8 +3299,14 @@ const edgeToEdgeVariants = ['sm', 'md', 'lg'].flatMap(breakpoint => {
|
|
|
3089
3299
|
// The layout's icon buttons (sidebar, menu and aside toggles). Same radius and
|
|
3090
3300
|
// hover fill as a navigation row, so a toggle in the sidebar header reads as
|
|
3091
3301
|
// one of its rows. `neutral-muted` stays visible on the frame's ground as
|
|
3092
|
-
// well as on the content surface.
|
|
3093
|
-
|
|
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
|
+
}
|
|
3094
3310
|
const appLayout = tv({
|
|
3095
3311
|
slots: {
|
|
3096
3312
|
// Publishes the shell's sizes as custom properties, for the parts below
|
|
@@ -3113,7 +3329,18 @@ const appLayout = tv({
|
|
|
3113
3329
|
//
|
|
3114
3330
|
// The navbar and sidebar header read `--app-navbar-height` (always set)
|
|
3115
3331
|
// with a literal fallback for parts rendered outside an `AppLayout`.
|
|
3116
|
-
base: ['relative grid w-full text-on-surface-app', 'grid-cols-[auto_minmax(0,1fr)_auto]', '[--app-navbar-height:3rem]'
|
|
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%)]'],
|
|
3117
3344
|
// `group/sidebar` plus `data-collapsed` on the element lets any descendant
|
|
3118
3345
|
// react to the icon rail with `group-data-[collapsed=true]/sidebar:`.
|
|
3119
3346
|
// Labels written as `<span data-sidebar-label>`, anywhere in the sidebar
|
|
@@ -3181,7 +3408,7 @@ const appLayout = tv({
|
|
|
3181
3408
|
// `Sidebar.Group`: a labelled set of items. The label is visually hidden
|
|
3182
3409
|
// in the rail like any other sidebar label.
|
|
3183
3410
|
sidebarGroup: 'flex flex-col gap-1 py-2',
|
|
3184
|
-
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-neutral-firm', 'group-data-[collapsed=true]/sidebar:sr-only'],
|
|
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'],
|
|
3185
3412
|
sidebarToggle: iconButton,
|
|
3186
3413
|
// Opens the mobile drawer. Hidden from `breakpoint` up (see below).
|
|
3187
3414
|
menuToggle: iconButton,
|
|
@@ -3213,15 +3440,15 @@ const appLayout = tv({
|
|
|
3213
3440
|
variant: {
|
|
3214
3441
|
// The tinted frame shows through a gutter around the card. The content
|
|
3215
3442
|
// is the lit surface in both schemes: on a `canvas` frame in light, and
|
|
3216
|
-
// in dark, where `app` is black, `
|
|
3443
|
+
// in dark, where `app` is black, a `card` veil (white at 7%) on an `app`
|
|
3444
|
+
// frame.
|
|
3217
3445
|
inset: {
|
|
3218
3446
|
base: 'bg-surface-canvas p-3 dark:bg-surface-app',
|
|
3219
|
-
//
|
|
3220
|
-
//
|
|
3221
|
-
//
|
|
3222
|
-
|
|
3223
|
-
|
|
3224
|
-
mainCard: 'rounded-xl bg-surface-app shadow-sm ring-1 ring-neutral-muted dark:bg-surface-canvas',
|
|
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',
|
|
3225
3452
|
aside: 'border-s border-neutral-muted',
|
|
3226
3453
|
// The bottom bar runs edge to edge: it pulls out over the frame's
|
|
3227
3454
|
// side and bottom gutter (`p-3`).
|
|
@@ -3311,6 +3538,55 @@ const appLayout = tv({
|
|
|
3311
3538
|
},
|
|
3312
3539
|
none: {}
|
|
3313
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
|
+
},
|
|
3314
3590
|
// `end` moves the sidebar to the last column and the aside to the first,
|
|
3315
3591
|
// so the two stay on opposite sides of the page. The grid is reordered,
|
|
3316
3592
|
// not the DOM: aside and main take columns 1 and 2, with the navbar and
|
|
@@ -3319,6 +3595,7 @@ const appLayout = tv({
|
|
|
3319
3595
|
sidebarSide: {
|
|
3320
3596
|
start: {},
|
|
3321
3597
|
end: {
|
|
3598
|
+
base: '[--app-frame-gradient-direction:to_left] rtl:[--app-frame-gradient-direction:to_right]',
|
|
3322
3599
|
sidebar: 'col-start-3',
|
|
3323
3600
|
navbar: 'col-[1/-2]',
|
|
3324
3601
|
main: 'col-start-2',
|
|
@@ -3516,7 +3793,67 @@ const appLayout = tv({
|
|
|
3516
3793
|
navbar: 'rounded-t-xl border-b border-neutral-muted',
|
|
3517
3794
|
main: 'rounded-b-xl'
|
|
3518
3795
|
}
|
|
3519
|
-
}, ...edgeToEdgeVariants
|
|
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
|
+
}],
|
|
3520
3857
|
defaultVariants: {
|
|
3521
3858
|
variant: 'inset',
|
|
3522
3859
|
navbarPlacement: 'frame',
|
|
@@ -3527,6 +3864,11 @@ const appLayout = tv({
|
|
|
3527
3864
|
bottomNavRow: 'none',
|
|
3528
3865
|
sidebarSide: 'start',
|
|
3529
3866
|
sidebarSize: 'default',
|
|
3867
|
+
color: 'neutral',
|
|
3868
|
+
sidebarSurface: 'plain',
|
|
3869
|
+
navbarSurface: 'plain',
|
|
3870
|
+
frameGradient: false,
|
|
3871
|
+
cardSurface: 'solid',
|
|
3530
3872
|
standalone: false,
|
|
3531
3873
|
inDrawer: false,
|
|
3532
3874
|
scrollMode: 'content'
|
|
@@ -3553,15 +3895,27 @@ const railInset = 'ps-[calc((var(--sidebar-rail,4rem)_-_2*var(--sidebar-gutter,0
|
|
|
3553
3895
|
// sits at the rail inset: 4px past the icon's 1.25rem end and above its
|
|
3554
3896
|
// top. Written out in full: Tailwind only sees literal class names.
|
|
3555
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
|
|
3556
3910
|
const navRow = [...focusVisibleRing,
|
|
3557
3911
|
// 36px with a mouse; 44px where the pointer is coarse (touch).
|
|
3558
|
-
'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-neutral-firm', 'not-data-[disabled=true]:hover:bg-neutral-muted', 'not-data-[disabled=true]:hover:text-neutral-strong', 'data-[disabled=true]:cursor-not-allowed data-[disabled=true]:opacity-disabled'];
|
|
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'];
|
|
3559
3913
|
|
|
3560
3914
|
// An item is filled while it is the current page. A folder is never the
|
|
3561
3915
|
// current page, so its trigger takes `navRow` alone.
|
|
3562
|
-
const navItemRow = [...navRow, 'data-[active=true]:bg-neutral-soft data-[active=true]:font-medium',
|
|
3916
|
+
const navItemRow = [...navRow, 'data-[active=true]:bg-(--nav-item-active-bg,var(--color-neutral-soft)) data-[active=true]:font-medium',
|
|
3563
3917
|
// Hovering the current page keeps its fill rather than lightening it.
|
|
3564
|
-
'not-data-[disabled=true]:data-[active=true]:hover:bg-neutral-soft', 'data-[active=true]:text-neutral-strong'];
|
|
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))'];
|
|
3565
3919
|
|
|
3566
3920
|
/**
|
|
3567
3921
|
* Shared navigation row styles: `NavLink`, `NavItem` and `NavFolder`.
|
|
@@ -3572,10 +3926,18 @@ const navItem = tv({
|
|
|
3572
3926
|
navItem: navItemRow,
|
|
3573
3927
|
// The slot sizes the icon, so an SVG that brings its own size (Lucide's
|
|
3574
3928
|
// 24px attributes, a utility class) still matches the other rows.
|
|
3575
|
-
|
|
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]',
|
|
3576
3935
|
navItemLabel: 'truncate',
|
|
3577
|
-
// The short text shown under the icon in the stacked layout.
|
|
3578
|
-
|
|
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',
|
|
3579
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',
|
|
3580
3942
|
// Screen-reader text appended to the label for a badge.
|
|
3581
3943
|
navItemBadgeLabel: 'sr-only',
|
|
@@ -3590,7 +3952,7 @@ const navItem = tv({
|
|
|
3590
3952
|
// The first child's top margin spaces it from the trigger. It lives
|
|
3591
3953
|
// inside the panel because the collapsed panel clips it; a gap or
|
|
3592
3954
|
// padding on the folder would show 4px while closed.
|
|
3593
|
-
navFolderPanel: 'ms-4 flex flex-col gap-1 border-s border-neutral-muted ps-2 *:first:mt-1'
|
|
3955
|
+
navFolderPanel: 'ms-4 flex flex-col gap-1 border-s border-(--nav-folder-border,var(--color-neutral-muted)) ps-2 *:first:mt-1'
|
|
3594
3956
|
},
|
|
3595
3957
|
variants: {
|
|
3596
3958
|
layout: {
|
|
@@ -3607,7 +3969,14 @@ const navItem = tv({
|
|
|
3607
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',
|
|
3608
3970
|
// The active fill sits behind the icon, not the whole item.
|
|
3609
3971
|
'data-[active=true]:bg-transparent not-data-[disabled=true]:hover:bg-transparent', 'not-data-[disabled=true]:data-[active=true]:hover:bg-transparent'],
|
|
3610
|
-
|
|
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)))']
|
|
3611
3980
|
},
|
|
3612
3981
|
// Icon only; the label is screen-reader text and a tooltip.
|
|
3613
3982
|
icon: {
|
|
@@ -4860,7 +5229,10 @@ const select = tv({
|
|
|
4860
5229
|
listbox: 'scroll-py-6 max-h-64 overflow-y-auto',
|
|
4861
5230
|
icon: 'w-5 h-5',
|
|
4862
5231
|
clearButton: 'pointer-events-auto',
|
|
4863
|
-
|
|
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'],
|
|
4864
5236
|
emptyContent: 'p-2',
|
|
4865
5237
|
displayLimitContent: 'p-2 text-body-2xs text-neutral-firm',
|
|
4866
5238
|
// The wrapper around the trigger. It is rendered in every mode; the
|
|
@@ -5470,6 +5842,7 @@ var components = /*#__PURE__*/Object.freeze({
|
|
|
5470
5842
|
autocomplete: autocomplete,
|
|
5471
5843
|
avatar: avatar,
|
|
5472
5844
|
backdrop: backdrop,
|
|
5845
|
+
badge: badge,
|
|
5473
5846
|
bottomNav: bottomNav,
|
|
5474
5847
|
breadcrumbs: breadcrumbs,
|
|
5475
5848
|
button: button,
|