@frontile/theme 0.18.11 → 0.18.13

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/dist/index.js CHANGED
@@ -423,7 +423,9 @@ const avatar = tv({
423
423
 
424
424
  const badge = tv({
425
425
  slots: {
426
- base: 'inline-flex items-center whitespace-nowrap font-label leading-none',
426
+ // Semibold; the `text-strong-*` size tokens would set bold, so the
427
+ // weight is pinned here and only `value` is heavier.
428
+ base: 'inline-flex items-center whitespace-nowrap font-label font-semibold leading-none',
427
429
  // emphasized value, e.g. a price
428
430
  value: 'font-bold tabular-nums leading-none',
429
431
  // unit following the value, e.g. "/mo"
@@ -434,6 +436,7 @@ const badge = tv({
434
436
  },
435
437
  variants: {
436
438
  variant: {
439
+ solid: '',
437
440
  soft: '',
438
441
  outline: ''
439
442
  },
@@ -457,36 +460,98 @@ const badge = tv({
457
460
  dot: 'bg-danger'
458
461
  }
459
462
  },
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. Facet 2.0 sizes map to these by height (spec 21/24/30/34 -> 20/24/28/32
464
- // nearest), so radii are unchanged; only the text steps down, via the
465
- // body scale (10.84, 12.34, 14.05px).
463
+ // Text follows Button's ramp: the same `@size` gives the same
464
+ // `text-strong-*` token on Badge, Chip and Button. Value and unit share
465
+ // the label's font size so their baselines line up; the value is set apart
466
+ // by weight only. Heights and padding are Badge's own, chosen so the text
467
+ // fits. Radius steps with size and is never a pill: that shape belongs
468
+ // to Chip.
466
469
  size: {
467
- xs: {
468
- base: 'text-body-4xs h-5 px-1.5 gap-1 rounded-sm',
470
+ // Smaller than Button's smallest size: the next `text-strong-*` step
471
+ // down (12.3px), 20px tall.
472
+ '2xs': {
473
+ base: 'text-strong-2xs h-5 px-1.5 gap-1 rounded-sm',
469
474
  dot: 'size-1.5',
470
475
  icon: 'size-3'
471
476
  },
477
+ xs: {
478
+ base: 'text-strong-xs h-6 px-2 gap-1 rounded-sm',
479
+ dot: 'size-2',
480
+ icon: 'size-3.5'
481
+ },
472
482
  sm: {
473
- base: 'text-body-4xs h-6 px-2 gap-1 rounded-sm',
474
- dot: 'size-1.5',
475
- icon: 'size-3'
483
+ base: 'text-strong-sm h-7 px-2.5 gap-1.5 rounded-sm',
484
+ dot: 'size-2',
485
+ icon: 'size-4'
476
486
  },
477
487
  md: {
478
- base: 'text-body-2xs h-7 px-2.5 gap-1.5 rounded-md',
488
+ base: 'text-strong-md h-8 px-3 gap-1.5 rounded-md',
479
489
  dot: 'size-2',
480
- icon: 'size-3.5'
490
+ icon: 'size-4'
481
491
  },
482
492
  lg: {
483
- base: 'text-body-sm h-8 px-3 gap-1.5 rounded-md',
493
+ base: 'text-strong-lg h-10 px-4 gap-2 rounded-md',
484
494
  dot: 'size-2.5',
485
- icon: 'size-4'
495
+ icon: 'size-5'
496
+ },
497
+ xl: {
498
+ base: 'text-strong-xl h-11 px-5 gap-2 rounded-lg',
499
+ dot: 'size-3',
500
+ icon: 'size-6'
501
+ },
502
+ '2xl': {
503
+ base: 'text-strong-2xl h-14 px-6 gap-2.5 rounded-lg',
504
+ dot: 'size-3.5',
505
+ icon: 'size-8'
486
506
  }
487
507
  }
488
508
  },
489
509
  compoundVariants: [
510
+ // VARIANT: solid (filled). The fill is the color's DEFAULT level, as on
511
+ // Chip; neutral steps up to `-bolder` because its DEFAULT is too light to
512
+ // read as a fill. The dot follows the text color so it stays visible.
513
+ {
514
+ variant: 'solid',
515
+ class: {
516
+ dot: 'bg-current'
517
+ }
518
+ }, {
519
+ variant: 'solid',
520
+ color: 'neutral',
521
+ class: {
522
+ base: 'bg-neutral-bolder text-on-neutral-bolder'
523
+ }
524
+ }, {
525
+ variant: 'solid',
526
+ color: 'primary',
527
+ class: {
528
+ base: 'bg-primary text-on-primary'
529
+ }
530
+ }, {
531
+ variant: 'solid',
532
+ color: 'secondary',
533
+ class: {
534
+ base: 'bg-secondary text-on-secondary'
535
+ }
536
+ }, {
537
+ variant: 'solid',
538
+ color: 'tertiary',
539
+ class: {
540
+ base: 'bg-tertiary text-on-tertiary'
541
+ }
542
+ }, {
543
+ variant: 'solid',
544
+ color: 'success',
545
+ class: {
546
+ base: 'bg-success text-on-success'
547
+ }
548
+ }, {
549
+ variant: 'solid',
550
+ color: 'danger',
551
+ class: {
552
+ base: 'bg-danger text-on-danger'
553
+ }
554
+ },
490
555
  // VARIANT: soft (tonal). One level above Chip's `soft` (`-subtle`).
491
556
  {
492
557
  variant: 'soft',
@@ -564,9 +629,9 @@ const badge = tv({
564
629
  }
565
630
  }],
566
631
  defaultVariants: {
567
- size: 'md',
632
+ size: 'xs',
568
633
  color: 'neutral',
569
- variant: 'soft'
634
+ variant: 'solid'
570
635
  }
571
636
  });
572
637
 
@@ -668,7 +733,7 @@ const breadcrumbs = tv({
668
733
  });
669
734
 
670
735
  const baseButton = tv({
671
- base: ['inline-flex items-center justify-center', '[&_svg]:size-[1em]', 'font-header', 'border', 'border-transparent', 'disabled:cursor-not-allowed', 'disabled:opacity-disabled', ...focusVisibleRing],
736
+ base: ['inline-flex items-center justify-center', '[&_svg]:size-[1em]', 'font-header', 'border', 'border-transparent', 'cursor-pointer', 'disabled:cursor-not-allowed', 'disabled:opacity-disabled', ...focusVisibleRing],
672
737
  variants: {
673
738
  variant: {
674
739
  outline: ''
@@ -728,6 +793,7 @@ const baseButton = tv({
728
793
  color: 'neutral'
729
794
  }
730
795
  });
796
+ const glassColors = ['neutral', 'primary', 'secondary', 'tertiary', 'success', 'warning', 'danger'];
731
797
  const button = tv({
732
798
  extend: baseButton,
733
799
  base: [''],
@@ -739,7 +805,9 @@ const button = tv({
739
805
  outline: '',
740
806
  ghost: '',
741
807
  plain: '',
742
- custom: ''
808
+ custom: '',
809
+ glass: '',
810
+ link: ''
743
811
  },
744
812
  isLoading: {
745
813
  true: 'disabled:cursor-progress'
@@ -792,7 +860,7 @@ const button = tv({
792
860
  }, {
793
861
  variant: 'subtle',
794
862
  color: 'tertiary',
795
- class: 'bg-tertiary-soft border-tertiary-strong text-tertiary-strong hover:bg-tertiary-subtle hover:border-tertiary-firm hover:text-tertiary active:bg-tertiary-muted active:border-tertiary-bolder active:text-tertiary-bolder'
863
+ class: 'bg-tertiary-soft border-tertiary-strong text-tertiary-strong hover:bg-tertiary-subtle hover:border-tertiary-firm hover:text-tertiary-firm active:bg-tertiary-muted active:border-tertiary-bolder active:text-tertiary-bolder'
796
864
  }, {
797
865
  variant: 'subtle',
798
866
  color: 'success',
@@ -822,7 +890,7 @@ const button = tv({
822
890
  }, {
823
891
  variant: 'plain',
824
892
  color: 'tertiary',
825
- class: 'text-tertiary-strong hover:text-tertiary active:text-tertiary-bolder'
893
+ class: 'text-tertiary-strong hover:text-tertiary-firm active:text-tertiary-bolder'
826
894
  }, {
827
895
  variant: 'plain',
828
896
  color: 'success',
@@ -841,7 +909,7 @@ const button = tv({
841
909
  {
842
910
  variant: 'ghost',
843
911
  color: 'neutral',
844
- class: 'text-neutral-bolder hover:bg-neutral-subtle hover:text-neutral-firm/80 active:bg-neutral-muted active:text-neutral-firm'
912
+ class: 'text-neutral-bolder hover:bg-neutral-subtle hover:text-neutral-strong active:bg-neutral-muted active:text-neutral-firm'
845
913
  }, {
846
914
  variant: 'ghost',
847
915
  color: 'primary',
@@ -926,7 +994,28 @@ const button = tv({
926
994
  variant: 'custom',
927
995
  color: 'danger',
928
996
  class: 'text-danger-strong'
929
- }],
997
+ },
998
+ // VARIANT: link — ink only, no side padding, underline on hover, so it sits
999
+ // inline with text. Ink steps follow `plain`; neutral keeps its ink on hover
1000
+ // and only underlines. `px-0` comes after the size's `px-*`, so
1001
+ // tailwind-merge drops the size padding.
1002
+ ...[['neutral', 'text-on-neutral-subtle active:text-neutral-firm'], ['primary', 'text-primary hover:text-primary-mild active:text-primary-firm'], ['secondary', 'text-secondary-strong hover:text-secondary-firm active:text-secondary-bolder'], ['tertiary', 'text-tertiary-strong hover:text-tertiary-firm active:text-tertiary-bolder'], ['success', 'text-success-strong hover:text-success-firm active:text-success-bolder'], ['warning', 'text-warning-strong hover:text-warning-firm active:text-warning-bolder'], ['danger', 'text-danger hover:text-danger-mild active:text-danger-firm']].map(([color, ink]) => ({
1003
+ variant: 'link',
1004
+ color,
1005
+ class: [ink, 'px-0 hover:underline underline-offset-4 disabled:no-underline']
1006
+ })),
1007
+ // VARIANT: glass — a translucent scrim for use over a colored or imaged
1008
+ // surface: black with white ink in light mode, white with black ink in
1009
+ // dark mode. It flips with the app theme, but deliberately not through the
1010
+ // scope tokens: brand fills go dark in light mode and light in dark mode,
1011
+ // so the page's own ink (`on-surface`) would be the wrong pairing for them. `color` is ignored: every
1012
+ // color gets the same classes, and the non-neutral ones also reset the
1013
+ // focus ring that `baseButton` tints per color.
1014
+ ...glassColors.map(color => ({
1015
+ variant: 'glass',
1016
+ color,
1017
+ class: ['bg-black/20 text-white backdrop-blur-md', 'hover:bg-black/30 active:bg-black/40', 'dark:bg-white/20 dark:text-black dark:hover:bg-white/30 dark:active:bg-white/40', color === 'neutral' ? '' : 'focus-visible:ring-focus']
1018
+ }))],
930
1019
  defaultVariants: {
931
1020
  size: 'md',
932
1021
  color: 'primary',
@@ -998,11 +1087,37 @@ const buttonSpinner = tv({
998
1087
  base: 'size-[1em] text-current/25 fill-current'
999
1088
  });
1000
1089
 
1090
+ // An icon-only button is a circle. IconButton passes this recipe's classes as
1091
+ // Button's `class`, where tailwind-merge lets `px-0` replace Button's
1092
+ // horizontal padding. Without text there is no line to give the height, and CSS cannot derive a width from an auto height, so each
1093
+ // size sets both dimensions to Button's own height at that size: one line, plus the
1094
+ // two vertical paddings (Button's `py-*` times two, in spacing units), plus the
1095
+ // 1px borders. The height is therefore Button's, and an IconButton lines up
1096
+ // with a Button of the same size. If Button's vertical padding changes, change
1097
+ // the multipliers here; the "as tall as a Button" test catches a mismatch.
1098
+ // Written out in full so Tailwind sees each class.
1099
+ const iconButton$1 = tv({
1100
+ base: 'px-0',
1101
+ variants: {
1102
+ size: {
1103
+ xs: 'size-[calc(1lh+var(--spacing)*1+2px)]',
1104
+ sm: 'size-[calc(1lh+var(--spacing)*2+2px)]',
1105
+ md: 'size-[calc(1lh+var(--spacing)*3+2px)]',
1106
+ lg: 'size-[calc(1lh+var(--spacing)*4+2px)]',
1107
+ xl: 'size-[calc(1lh+var(--spacing)*5+2px)]',
1108
+ '2xl': 'size-[calc(1lh+var(--spacing)*6+2px)]'
1109
+ }
1110
+ },
1111
+ defaultVariants: {
1112
+ size: 'md'
1113
+ }
1114
+ });
1115
+
1001
1116
  const chip = tv({
1002
1117
  slots: {
1003
1118
  base: ['whitespace-nowrap', 'inline-flex items-center justify-between box-border rounded-full',
1004
- // Regular weight, matching Badge (the `text-label-*` sizes would set
1005
- // semibold). Heights are set per size below and match Badge's.
1119
+ // Regular weight, matching Badge (the `text-strong-*` sizes would set
1120
+ // bold). Text size follows Button's ramp; heights are Chip's own.
1006
1121
  'font-normal'],
1007
1122
  // label text role (size set per size variant)
1008
1123
  content: ['flex-1 text-inherit font-label'],
@@ -1056,35 +1171,56 @@ const chip = tv({
1056
1171
  closeButton: 'bg-danger-muted text-on-danger-muted'
1057
1172
  }
1058
1173
  },
1174
+ // Text follows Button's ramp (`2xs` extends it one step below Button's `xs`): the same `@size` gives the same
1175
+ // `text-strong-*` token on Chip, Badge and Button. `xs`, the default, keeps
1176
+ // the geometry of the old `md` for dense UI (table cells, list rows,
1177
+ // multi-select fields). The close button takes only the label's font size
1178
+ // (not the weight or line-height that `text-strong-*` bundles), so its
1179
+ // circle (icon plus `p-0.5`) stays round and fits the chip.
1059
1180
  size: {
1060
- // For dense UI — table cells, list rows, multi-select fields. It keeps
1061
- // `sm`'s text size and loses height and padding instead: 12px is about
1062
- // as small as a label stays readable. The close button drops to
1063
- // `label-micro` so its circle (icon plus `p-0.5`) still fits the 20px
1064
- // chip.
1065
- xs: {
1066
- base: 'text-label-2xs px-0.5 h-5',
1181
+ // Smaller than Button's smallest size, for the densest UI. Text is the
1182
+ // next `text-strong-*` step down (12.3px) and the chip is 20px tall.
1183
+ '2xs': {
1184
+ base: 'text-strong-2xs px-0.5 h-5',
1067
1185
  content: 'px-1 leading-4',
1068
1186
  dot: 'size-1.5',
1069
- closeButton: 'text-label-micro'
1187
+ closeButton: 'text-(length:--text-strong-3xs)'
1070
1188
  },
1071
- sm: {
1072
- base: 'text-label-2xs px-1 h-6',
1073
- content: 'px-1 leading-4',
1074
- dot: 'size-1.5',
1075
- closeButton: 'text-label-2xs'
1189
+ xs: {
1190
+ base: 'text-strong-xs px-1 h-7',
1191
+ content: 'px-2 leading-5',
1192
+ dot: 'size-2',
1193
+ closeButton: 'text-(length:--text-strong-xs)'
1076
1194
  },
1077
- md: {
1078
- base: 'text-label-xs px-1 h-7',
1195
+ sm: {
1196
+ base: 'text-strong-sm px-1 h-8',
1079
1197
  content: 'px-2 leading-5',
1080
1198
  dot: 'size-2',
1081
- closeButton: 'text-label-xs'
1199
+ closeButton: 'text-(length:--text-strong-sm)'
1082
1200
  },
1083
- lg: {
1084
- base: 'text-label-md px-2 h-8',
1085
- content: 'px-2 leading-6',
1201
+ md: {
1202
+ base: 'text-strong-md px-1.5 h-9',
1203
+ content: 'px-2.5 leading-6',
1086
1204
  dot: 'size-2.5',
1087
- closeButton: 'text-label-md'
1205
+ closeButton: 'text-(length:--text-strong-md)'
1206
+ },
1207
+ lg: {
1208
+ base: 'text-strong-lg px-2 h-11',
1209
+ content: 'px-3 leading-7',
1210
+ dot: 'size-3',
1211
+ closeButton: 'text-(length:--text-strong-lg)'
1212
+ },
1213
+ xl: {
1214
+ base: 'text-strong-xl px-2 h-12',
1215
+ content: 'px-4 leading-8',
1216
+ dot: 'size-3.5',
1217
+ closeButton: 'text-(length:--text-strong-xl)'
1218
+ },
1219
+ '2xl': {
1220
+ base: 'text-strong-2xl px-3 h-14',
1221
+ content: 'px-5 leading-9',
1222
+ dot: 'size-4',
1223
+ closeButton: 'text-(length:--text-strong-2xl)'
1088
1224
  }
1089
1225
  }
1090
1226
  },
@@ -1256,12 +1392,213 @@ const chip = tv({
1256
1392
  }
1257
1393
  }],
1258
1394
  defaultVariants: {
1259
- size: 'md',
1395
+ size: 'xs',
1260
1396
  color: 'neutral',
1261
1397
  variant: 'solid'
1262
1398
  }
1263
1399
  });
1264
1400
 
1401
+ const ROLES = ['neutral', 'primary', 'secondary', 'tertiary', 'success', 'warning', 'danger'];
1402
+ // Fill and ink per color and variant, from the design artifact's Icon spec.
1403
+ // The artifact picks a different level per role (soft is `*-soft` for most and
1404
+ // `*-muted` for neutral and warning), so these are tables, not a rule. Where
1405
+ // Frontile's auto-generated `on-*` token differs from the artifact's ink (the
1406
+ // artifact has `on-neutral` white on its mid-gray fill, Frontile black), the
1407
+ // level that gives the artifact's ink is used instead, and the tests check the
1408
+ // ink itself. Every class is written out in full so Tailwind can find it.
1409
+ const SOLID = {
1410
+ neutral: 'bg-on-neutral-subtle text-on-neutral-strong',
1411
+ primary: 'bg-primary text-on-primary',
1412
+ secondary: 'bg-secondary text-on-secondary',
1413
+ tertiary: 'bg-tertiary text-on-tertiary',
1414
+ success: 'bg-success text-on-success',
1415
+ warning: 'bg-warning text-on-warning',
1416
+ danger: 'bg-danger text-on-danger'
1417
+ };
1418
+ const SOFT = {
1419
+ neutral: 'bg-neutral-muted text-on-neutral-muted',
1420
+ primary: 'bg-primary-soft text-on-primary-soft',
1421
+ secondary: 'bg-secondary-soft text-on-secondary-soft',
1422
+ tertiary: 'bg-tertiary-soft text-on-tertiary-soft',
1423
+ success: 'bg-success-soft text-on-success-soft',
1424
+ warning: 'bg-warning-muted text-on-warning-soft',
1425
+ danger: 'bg-danger-soft text-on-danger-soft'
1426
+ };
1427
+ const SUBTLE = {
1428
+ neutral: 'bg-neutral-subtle text-neutral-strong',
1429
+ primary: 'bg-primary-soft text-primary',
1430
+ secondary: 'bg-secondary-soft text-secondary',
1431
+ tertiary: 'bg-tertiary-muted text-tertiary-strong',
1432
+ success: 'bg-success-muted text-success-strong',
1433
+ warning: 'bg-warning-subtle text-warning',
1434
+ danger: 'bg-danger-muted text-danger'
1435
+ };
1436
+
1437
+ // The icon color for the variants with no fill behind it. The outline ring
1438
+ // takes the same color.
1439
+ const INK = {
1440
+ neutral: 'text-on-neutral-subtle',
1441
+ primary: 'text-primary',
1442
+ secondary: 'text-secondary',
1443
+ tertiary: 'text-tertiary-strong',
1444
+ success: 'text-success-strong',
1445
+ warning: 'text-warning',
1446
+ danger: 'text-danger'
1447
+ };
1448
+ const BY_VARIANT = {
1449
+ solid: SOLID,
1450
+ soft: SOFT,
1451
+ subtle: SUBTLE,
1452
+ outline: INK,
1453
+ plain: INK
1454
+ };
1455
+
1456
+ // A circle that centers an icon, sized from the design artifact: the circle
1457
+ // diameter, the icon inside it, and for `plain` a tighter box with no circle.
1458
+ // The icon is the `svg` the block contains, so it needs no size class of its
1459
+ // own. These are the artifact's pixel values, not the `size-icon-*` ramp, which
1460
+ // follows the label text. Outline draws its ring as an inset shadow in the
1461
+ // icon color, 0.5px at 4xs up to 2.5px at 3xl.
1462
+ //
1463
+ // One deliberate difference from the artifact: it has `xl` the same as `lg`
1464
+ // (64px circle, 40px plain box), which looks like a Figma slip, so `xl` is 72px
1465
+ // and 44px, between `lg` and `2xl`. Confirm with the designer.
1466
+ const icon = tv({
1467
+ base: 'box-border inline-flex shrink-0 items-center justify-center rounded-full align-middle',
1468
+ variants: {
1469
+ size: {
1470
+ '4xs': 'size-4 [&_svg]:size-[8px]',
1471
+ '3xs': 'size-5 [&_svg]:size-[10px]',
1472
+ '2xs': 'size-6 [&_svg]:size-[12px]',
1473
+ xs: 'size-8 [&_svg]:size-[16px]',
1474
+ sm: 'size-10 [&_svg]:size-[20px]',
1475
+ md: 'size-12 [&_svg]:size-[28px]',
1476
+ lg: 'size-16 [&_svg]:size-[32px]',
1477
+ xl: 'size-18 [&_svg]:size-[40px]',
1478
+ '2xl': 'size-20 [&_svg]:size-[48px]',
1479
+ '3xl': 'size-24 [&_svg]:size-[56px]'
1480
+ },
1481
+ color: {
1482
+ neutral: '',
1483
+ primary: '',
1484
+ secondary: '',
1485
+ tertiary: '',
1486
+ success: '',
1487
+ warning: '',
1488
+ danger: ''
1489
+ },
1490
+ variant: {
1491
+ solid: '',
1492
+ soft: '',
1493
+ subtle: '',
1494
+ outline: '',
1495
+ plain: ''
1496
+ },
1497
+ // For an icon on a surface of the other scheme. See the compound variants.
1498
+ inverse: {
1499
+ true: ''
1500
+ }
1501
+ },
1502
+ compoundVariants: [...ROLES.flatMap(color => Object.keys(BY_VARIANT).map(variant => ({
1503
+ color,
1504
+ variant,
1505
+ class: BY_VARIANT[variant][color]
1506
+ }))),
1507
+ // Inverse. Neutral solid, outline and plain swap their tokens, as the
1508
+ // artifact does: the fill and the icon change places, and the ink takes
1509
+ // `on-neutral`. Everything else re-resolves its tokens to the opposite
1510
+ // scheme with `theme-inverse`.
1511
+ {
1512
+ inverse: true,
1513
+ color: 'neutral',
1514
+ variant: 'solid',
1515
+ class: 'bg-on-neutral-strong text-on-neutral-subtle'
1516
+ }, {
1517
+ inverse: true,
1518
+ color: 'neutral',
1519
+ variant: ['outline', 'plain'],
1520
+ class: 'text-on-neutral-strong'
1521
+ }, {
1522
+ inverse: true,
1523
+ color: 'neutral',
1524
+ variant: ['soft', 'subtle'],
1525
+ class: 'theme-inverse'
1526
+ }, {
1527
+ inverse: true,
1528
+ color: ['primary', 'secondary', 'tertiary', 'success', 'warning', 'danger'],
1529
+ class: 'theme-inverse'
1530
+ },
1531
+ // Plain has no circle, so its box is tighter. The icon size is unchanged.
1532
+ {
1533
+ variant: 'plain',
1534
+ size: '4xs',
1535
+ class: 'size-3'
1536
+ }, {
1537
+ variant: 'plain',
1538
+ size: '3xs',
1539
+ class: 'size-3.5'
1540
+ }, {
1541
+ variant: 'plain',
1542
+ size: '2xs',
1543
+ class: 'size-4'
1544
+ }, {
1545
+ variant: 'plain',
1546
+ size: 'xs',
1547
+ class: 'size-5'
1548
+ }, {
1549
+ variant: 'plain',
1550
+ size: 'sm',
1551
+ class: 'size-6'
1552
+ }, {
1553
+ variant: 'plain',
1554
+ size: 'md',
1555
+ class: 'size-8'
1556
+ }, {
1557
+ variant: 'plain',
1558
+ size: 'lg',
1559
+ class: 'size-10'
1560
+ }, {
1561
+ variant: 'plain',
1562
+ size: 'xl',
1563
+ class: 'size-11'
1564
+ }, {
1565
+ variant: 'plain',
1566
+ size: '2xl',
1567
+ class: 'size-12'
1568
+ }, {
1569
+ variant: 'plain',
1570
+ size: '3xl',
1571
+ class: 'size-14'
1572
+ },
1573
+ // The ring, in the icon color.
1574
+ {
1575
+ variant: 'outline',
1576
+ size: ['4xs', '3xs'],
1577
+ class: 'shadow-[inset_0_0_0_0.5px_currentColor]'
1578
+ }, {
1579
+ variant: 'outline',
1580
+ size: ['2xs', 'xs'],
1581
+ class: 'shadow-[inset_0_0_0_1px_currentColor]'
1582
+ }, {
1583
+ variant: 'outline',
1584
+ size: 'sm',
1585
+ class: 'shadow-[inset_0_0_0_1.5px_currentColor]'
1586
+ }, {
1587
+ variant: 'outline',
1588
+ size: ['md', 'lg', 'xl', '2xl'],
1589
+ class: 'shadow-[inset_0_0_0_2px_currentColor]'
1590
+ }, {
1591
+ variant: 'outline',
1592
+ size: '3xl',
1593
+ class: 'shadow-[inset_0_0_0_2.5px_currentColor]'
1594
+ }],
1595
+ // `color` has no default: a plain icon without one inherits the text color.
1596
+ defaultVariants: {
1597
+ size: 'md',
1598
+ variant: 'plain'
1599
+ }
1600
+ });
1601
+
1265
1602
  const progressBar = tv({
1266
1603
  slots: {
1267
1604
  base: ['overflow-hidden w-full bg-surface-overlay-soft'],
@@ -1981,6 +2318,200 @@ const divider = tv({
1981
2318
  }
1982
2319
  });
1983
2320
 
2321
+ /**
2322
+ * Card is a surface and nothing else: it owns the fill, border, radius,
2323
+ * padding and the states a surface can be in. What goes inside is the call
2324
+ * site's business, and so is selection behaviour — `isSelected` only changes
2325
+ * how the surface looks.
2326
+ *
2327
+ * The border is `border` (1px) in every variant and state, so moving between
2328
+ * states never shifts the contents. `flat` and `soft` keep the same border
2329
+ * width but make it transparent. Hover and selected add weight without
2330
+ * changing that width: a second 1px layer, drawn inside the border in the same
2331
+ * colour with `inset-shadow-[0_0_0_1px_…]`, so the edge reads as 2px.
2332
+ *
2333
+ * That layer is an `inset-shadow`, not a `ring` or an `outline`. `ring-*`
2334
+ * shares its `--tw-ring-*` variables with the focus ring (`focusVisibleRing`),
2335
+ * so a focused selected card would get an inset focus ring; `outline` is the
2336
+ * focus indicator in forced-colors (`outline-hidden`). `inset-shadow` has its
2337
+ * own variable and stacks with `shadow-elevation-*` and the focus ring.
2338
+ *
2339
+ * `box-shadow` is not drawn in forced-colors, so a selected card widens its
2340
+ * border to 3px in that mode instead (`forced-colors:border-[3px]`). A layout
2341
+ * shift is acceptable there; losing the selected cue is not.
2342
+ *
2343
+ * Everything that depends on more than one variant lives in
2344
+ * `compoundVariants`. tv() applies those after the plain variants and
2345
+ * resolves conflicts with tailwind-merge, so a state's border or fill wins
2346
+ * over the variant's resting one without relying on declaration order.
2347
+ */
2348
+ const card = tv({
2349
+ base: [
2350
+ // A positioning context for the selection indicator.
2351
+ 'relative', 'border rounded-[20px]', 'transition-[color,background-color,border-color,box-shadow] duration-200', 'motion-reduce:transition-none'],
2352
+ variants: {
2353
+ variant: {
2354
+ outline: 'bg-surface-card',
2355
+ flat: 'bg-surface-card border-transparent',
2356
+ // `overlay-soft`, not `-subtle`: in dark mode `surface-card` and
2357
+ // `surface-overlay-subtle` are the same colour (white @ 7%), which would
2358
+ // make `soft` identical to `flat`. The same pairing rules out
2359
+ // `overlay-subtle` for any hover or pressed fill below.
2360
+ soft: 'bg-surface-overlay-soft border-transparent'
2361
+ },
2362
+ // Colour only steers the hover and selected border. The resting border
2363
+ // is neutral for both, as in the design.
2364
+ color: {
2365
+ neutral: '',
2366
+ primary: ''
2367
+ },
2368
+ density: {
2369
+ compact: 'p-3',
2370
+ comfortable: 'p-5',
2371
+ spacious: 'p-8'
2372
+ },
2373
+ // Only `outline` is ever raised; `flat` and `soft` have no shadow in
2374
+ // either setting.
2375
+ elevation: {
2376
+ raised: '',
2377
+ none: ''
2378
+ },
2379
+ isSelected: {
2380
+ true: '',
2381
+ false: ''
2382
+ },
2383
+ isInteractive: {
2384
+ true: '',
2385
+ false: ''
2386
+ },
2387
+ isDisabled: {
2388
+ true: 'opacity-disabled cursor-not-allowed',
2389
+ false: ''
2390
+ }
2391
+ },
2392
+ compoundVariants: [
2393
+ // RESTING SURFACE
2394
+ {
2395
+ variant: 'outline',
2396
+ isSelected: false,
2397
+ class: 'border-neutral-muted'
2398
+ }, {
2399
+ variant: 'outline',
2400
+ elevation: 'raised',
2401
+ class: 'shadow-elevation-2'
2402
+ },
2403
+ // SELECTED. The fill is unchanged; the border takes the colour and a
2404
+ // second 1px layer inside it makes the edge read as 2px. Forced-colors
2405
+ // draws no box-shadow, so it gets a real, thicker border instead.
2406
+ {
2407
+ isSelected: true,
2408
+ color: 'primary',
2409
+ class: ['border-primary', 'inset-shadow-[0_0_0_1px_var(--color-primary)]', 'forced-colors:border-[3px]']
2410
+ }, {
2411
+ isSelected: true,
2412
+ color: 'neutral',
2413
+ class: ['border-neutral-bolder', 'inset-shadow-[0_0_0_1px_var(--color-neutral-bolder)]', 'forced-colors:border-[3px]']
2414
+ },
2415
+ // INTERACTIVE. Disabled wins: no hover, pressed, focus ring or pointer.
2416
+ {
2417
+ isInteractive: true,
2418
+ isDisabled: false,
2419
+ class: ['cursor-pointer', ...focusVisibleRing]
2420
+ },
2421
+ // PRESSED sits one overlay level above each variant's hover, so it is a
2422
+ // distinct step in light and dark. Outline has no hover fill, so it goes
2423
+ // straight to `overlay-soft` off the card fill.
2424
+ {
2425
+ variant: 'outline',
2426
+ isInteractive: true,
2427
+ isDisabled: false,
2428
+ class: 'active:bg-surface-overlay-soft'
2429
+ }, {
2430
+ variant: 'flat',
2431
+ isInteractive: true,
2432
+ isDisabled: false,
2433
+ class: 'active:bg-surface-overlay-mild'
2434
+ }, {
2435
+ variant: 'soft',
2436
+ isInteractive: true,
2437
+ isDisabled: false,
2438
+ class: 'active:bg-surface-overlay-firm'
2439
+ },
2440
+ // HOVER, unselected. Hover is scoped to the unselected state so it never
2441
+ // ties on specificity with the selected border. The border colour is
2442
+ // joined by a 1px inset layer in the same colour, so it reads as 2px.
2443
+ {
2444
+ variant: 'outline',
2445
+ isInteractive: true,
2446
+ isDisabled: false,
2447
+ isSelected: false,
2448
+ color: 'primary',
2449
+ class: ['hover:border-primary-muted', 'hover:inset-shadow-[0_0_0_1px_var(--color-primary-muted)]']
2450
+ }, {
2451
+ variant: 'outline',
2452
+ isInteractive: true,
2453
+ isDisabled: false,
2454
+ isSelected: false,
2455
+ color: 'neutral',
2456
+ class: ['hover:border-neutral-soft', 'hover:inset-shadow-[0_0_0_1px_var(--color-neutral-soft)]']
2457
+ }, {
2458
+ variant: 'flat',
2459
+ isInteractive: true,
2460
+ isDisabled: false,
2461
+ isSelected: false,
2462
+ class: 'hover:bg-surface-overlay-soft'
2463
+ }, {
2464
+ variant: 'soft',
2465
+ isInteractive: true,
2466
+ isDisabled: false,
2467
+ isSelected: false,
2468
+ class: 'hover:bg-surface-overlay-mild'
2469
+ },
2470
+ // HOVER LIFT. Raised outline cards step up an elevation level, selected
2471
+ // or not.
2472
+ {
2473
+ variant: 'outline',
2474
+ elevation: 'raised',
2475
+ isInteractive: true,
2476
+ isDisabled: false,
2477
+ class: 'hover:shadow-elevation-3'
2478
+ }],
2479
+ defaultVariants: {
2480
+ variant: 'outline',
2481
+ color: 'neutral',
2482
+ density: 'comfortable',
2483
+ elevation: 'raised',
2484
+ isSelected: false,
2485
+ isInteractive: false,
2486
+ isDisabled: false
2487
+ }
2488
+ });
2489
+
2490
+ /**
2491
+ * The selection indicator: a small solid circle overhanging a card's top-right
2492
+ * corner, holding whatever icon the call site passes in the `indicator` block.
2493
+ * Card renders it only while selected, so it has no state of its own. The
2494
+ * overhang is why `card` is `relative` and has no `overflow-hidden`.
2495
+ *
2496
+ * `starting:` gives it a short fade and scale in when it mounts; reduced
2497
+ * motion drops the transition.
2498
+ */
2499
+ const cardIndicator = tv({
2500
+ base: [
2501
+ // Offsets are measured from the padding box, inside the 1px border, so
2502
+ // 1.25 (5px) leaves the circle 4px past the card's outer edge.
2503
+ 'pointer-events-none absolute -top-1.25 -right-1.25 z-10', 'inline-flex size-5 items-center justify-center rounded-full', '[&>svg]:size-3', 'transition-[opacity,scale] duration-200', 'starting:opacity-0 starting:scale-75', 'motion-reduce:transition-none'],
2504
+ variants: {
2505
+ color: {
2506
+ neutral: 'bg-neutral-bolder text-on-neutral-bolder',
2507
+ primary: 'bg-primary text-on-primary'
2508
+ }
2509
+ },
2510
+ defaultVariants: {
2511
+ color: 'neutral'
2512
+ }
2513
+ });
2514
+
1984
2515
  const externalLink = tv({
1985
2516
  slots: {
1986
2517
  // `inline`, not `inline-flex`. An external link's home is running text, and
@@ -3458,6 +3989,8 @@ const appLayout = tv({
3458
3989
  // The aside's `aside` element inside the drawer: as tall as the drawer.
3459
3990
  mobileAside: 'min-h-0 flex-1 overflow-y-auto p-4 font-body text-body-sm',
3460
3991
  asideToggle: iconButton,
3992
+ // A `layout.Region`: its children lay out as children of its parent.
3993
+ region: 'contents',
3461
3994
  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']
3462
3995
  },
3463
3996
  variants: {
@@ -4489,39 +5022,47 @@ const tooltip = tv({
4489
5022
  // one wraps instead of running off the viewport. `origin-*` is keyed off
4490
5023
  // the resolved placement the content carries as `data-placement`, so the
4491
5024
  // enter transition grows out of the anchor rather than out of nowhere.
4492
- base: ['relative w-max max-w-xs rounded-lg shadow-md overflow-visible', 'data-[placement^=top]:origin-bottom', 'data-[placement^=bottom]:origin-top', 'data-[placement^=left]:origin-right', 'data-[placement^=right]:origin-left'],
5025
+ //
5026
+ // Type is the `body` role, not `label`: a tooltip is a sentence read in
5027
+ // passing, so it wants regular weight and running-text leading. `label`
5028
+ // is semibold at a leading of 1, which renders a short tip heavy and
5029
+ // packs a wrapped one into touching lines. `antialiased` keeps light
5030
+ // text on the dark fill from blooming on macOS.
5031
+ base: ['relative w-max max-w-xs rounded-md shadow-md overflow-visible', 'font-body antialiased', 'data-[placement^=top]:origin-bottom', 'data-[placement^=bottom]:origin-top', 'data-[placement^=left]:origin-right', 'data-[placement^=right]:origin-left'],
4493
5032
  arrow: ''
4494
5033
  },
4495
5034
  variants: {
4496
5035
  size: {
4497
5036
  sm: {
4498
- base: 'px-2 py-1 text-label-sm'
5037
+ base: 'px-1.5 py-0.5 text-body-2xs'
4499
5038
  },
4500
5039
  md: {
4501
- base: 'px-2.5 py-1.5 text-label-sm'
5040
+ base: 'px-2 py-1 text-body-xs'
4502
5041
  },
4503
5042
  lg: {
4504
- base: 'px-3 py-2 text-label-md'
5043
+ base: 'px-2.5 py-1.5 text-body-sm'
4505
5044
  }
4506
5045
  },
4507
5046
  // `bg-inherit` on the arrow (see `overlayArrow`) means each color only
4508
- // has to state the background once, on `base`. The border is stated on
4509
- // both `base` and `arrow` for every color so the two agree at the join:
4510
- // `default` carries a visible `border-neutral-soft` on each (the arrow's
4511
- // own shadow-less edge needs a level with more contrast than the body's
4512
- // `shadow-md` gets away with), and every coloured color clears both to
4513
- // `border-transparent`. The body needs this explicitly, not just the
4514
- // arrow: `Content`'s classNames (`popover.gts`) run this `base` class
4515
- // through the *`popover`* tv, whose own base carries
4516
- // `border border-neutral-subtle` (`popover.ts`) -- twMerge only drops
4517
- // that when a later class from the same border-color group replaces it,
4518
- // so a coloured color with no border class of its own left that
4519
- // neutral border showing on the body while the arrow (fixed here to
4520
- // `border-transparent`) went invisible, a visible seam at the join.
5047
+ // has to state the background once, on `base`. The border is cleared to
5048
+ // `border-transparent` on both `base` and `arrow` for every color. The
5049
+ // body needs it explicitly: `Content`'s classNames (`popover.gts`) run
5050
+ // this `base` class through the *`popover`* tv, whose own base carries
5051
+ // `border border-neutral-subtle` (`popover.ts`), and twMerge only drops
5052
+ // that when a later class from the same border-color group replaces it.
5053
+ // Leaving it would show a hairline on the body that the arrow lacks, a
5054
+ // seam at the join.
5055
+ //
5056
+ // `neutral` is a raised warm gray in *both* schemes rather than a
5057
+ // scheme-following surface. `surface-input` is pure black in dark mode,
5058
+ // which sits *below* a warm-black page and leaves a border to do all the
5059
+ // separating. `neutral-strong` (light) and `neutral-muted` (dark) resolve
5060
+ // to the same step of the gray ramp, so the tooltip reads as a lifted
5061
+ // chip on either ground, and its edge comes from the fill, not a border.
4521
5062
  color: {
4522
5063
  neutral: {
4523
- base: 'bg-surface-input text-on-surface-input border border-neutral-soft',
4524
- arrow: 'border-neutral-soft'
5064
+ base: ['bg-neutral-strong text-on-neutral-strong border-transparent', 'dark:bg-neutral-muted dark:text-on-neutral-muted'],
5065
+ arrow: 'border-transparent'
4525
5066
  },
4526
5067
  primary: {
4527
5068
  base: 'bg-primary text-on-primary border-transparent',
@@ -5887,6 +6428,8 @@ var components = /*#__PURE__*/Object.freeze({
5887
6428
  buttonGroup: buttonGroup,
5888
6429
  buttonSpinner: buttonSpinner,
5889
6430
  calendar: calendar,
6431
+ card: card,
6432
+ cardIndicator: cardIndicator,
5890
6433
  checkbox: checkbox,
5891
6434
  checkboxGroup: checkboxGroup,
5892
6435
  chip: chip,
@@ -5908,6 +6451,8 @@ var components = /*#__PURE__*/Object.freeze({
5908
6451
  formRadioGroup: formRadioGroup,
5909
6452
  formSelect: formSelect,
5910
6453
  formTextarea: formTextarea,
6454
+ icon: icon,
6455
+ iconButton: iconButton$1,
5911
6456
  input: input,
5912
6457
  inputOtp: inputOtp,
5913
6458
  kbd: kbd,