@matteoaliano/forest-ui 1.1.1 → 1.2.1

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/theme.js CHANGED
@@ -515,6 +515,20 @@ function buildComponents(tokens2) {
515
515
  borderTopRightRadius: radius4.md,
516
516
  opacity: 0.75
517
517
  },
518
+ // Unified disabled treatment across the button family (Button,
519
+ // IconButton, Fab, ButtonGroup, ToggleButton): transparent face,
520
+ // disabled border, disabled text — matching the outlined
521
+ // IconButton reference. Contained's fill is dropped and the bevel
522
+ // geometry re-asserted (MUI's outlined disabled `border: 1px`
523
+ // shorthand would otherwise flatten it).
524
+ "&.Mui-disabled": {
525
+ backgroundColor: "transparent",
526
+ borderColor: border4.disabled,
527
+ borderTopWidth: 1,
528
+ borderRightWidth: 1,
529
+ borderLeftWidth: 1,
530
+ borderBottomWidth: 4
531
+ },
518
532
  "@media (prefers-reduced-motion: reduce)": {
519
533
  transition: "none",
520
534
  "&::before": { display: "none" }
@@ -556,6 +570,13 @@ function buildComponents(tokens2) {
556
570
  "&.MuiButtonGroup-contained .MuiButtonGroup-grouped:not(.Mui-disabled)": {
557
571
  borderColor: fg4.tertiary
558
572
  },
573
+ // Disabled grouped children: MUI's per-position grouped-contained
574
+ // border wins over the child Button's own .Mui-disabled rule on the
575
+ // first/middle buttons — pin the unified disabled border here so the
576
+ // whole group matches the standalone disabled Button.
577
+ "&.MuiButtonGroup-contained .MuiButtonGroup-grouped.Mui-disabled": {
578
+ borderColor: border4.disabled
579
+ },
559
580
  // outlined group → the outlined-Button look (outlinedFill), including
560
581
  // its lightened hover sweep (the forced-contained children would
561
582
  // otherwise sweep at full currentColor strength).
@@ -620,6 +641,13 @@ function buildComponents(tokens2) {
620
641
  },
621
642
  "&.ForestIconButton": {
622
643
  ...bevel3D,
644
+ // Square 32×32 with border-box so the faux-3D bevel (1px top + 4px
645
+ // bottom, 1px left/right) is absorbed rather than added on top —
646
+ // otherwise it rendered a 37×34 control instead of matching the
647
+ // standalone Button's 32px height.
648
+ height: 32,
649
+ width: 32,
650
+ boxSizing: "border-box",
623
651
  boxShadow: tokenShadows.xs,
624
652
  "&:focus-visible": {
625
653
  boxShadow: focusRings4.brandShadowXs
@@ -657,15 +685,13 @@ function buildComponents(tokens2) {
657
685
  filter: "brightness(0.97)"
658
686
  }
659
687
  },
660
- // Disabled parity with the Button variants: MUI IconButton's own
661
- // .Mui-disabled (transparent bg + action.disabled icon) ties with the
662
- // variant faces at (0,2,0) and loses on insertion order pin the
663
- // disabled treatment one class higher.
664
- "&.ForestIconButton-contained.Mui-disabled": {
665
- backgroundColor: (theme.vars || theme).palette.action.disabledBackground,
666
- color: (theme.vars || theme).palette.action.disabled
667
- },
668
- "&.ForestIconButton-outlined.Mui-disabled": {
688
+ // Unified disabled treatment for both variants: transparent face,
689
+ // disabled border, disabled icon bevel geometry retained. This is
690
+ // the reference the rest of the button family matches. The two-class
691
+ // selector out-specifies the single-class variant faces so contained's
692
+ // fill is dropped.
693
+ "&.ForestIconButton.Mui-disabled": {
694
+ backgroundColor: "transparent",
669
695
  color: (theme.vars || theme).palette.action.disabled,
670
696
  borderColor: border4.disabled
671
697
  }
@@ -732,6 +758,13 @@ function buildComponents(tokens2) {
732
758
  "&:focus-visible": {
733
759
  boxShadow: focusRings4.brandShadowSm
734
760
  },
761
+ // Same unified disabled treatment as Button/IconButton: drop the
762
+ // contained fill for a transparent, disabled-bordered face.
763
+ "&.Mui-disabled": {
764
+ backgroundColor: "transparent",
765
+ borderColor: border4.disabled,
766
+ color: (theme.vars || theme).palette.action.disabled
767
+ },
735
768
  "@media (prefers-reduced-motion: reduce)": {
736
769
  transition: "none",
737
770
  "&::before": { display: "none" }
@@ -1021,7 +1054,19 @@ function buildComponents(tokens2) {
1021
1054
  root: {
1022
1055
  width: 44,
1023
1056
  height: 24,
1024
- padding: 0
1057
+ padding: 0,
1058
+ // MUI's `size="small"` variant only half-applies here: the theme pins
1059
+ // the track at the wide 44px medium geometry, but MUI still shrinks the
1060
+ // thumb (16px), bumps switchBase padding (4px), and cuts the checked
1061
+ // travel to 16px — leaving the thumb parked mid-track. Forest ships a
1062
+ // single calibrated 24px switch, so neutralize `small` back to it.
1063
+ "&.MuiSwitch-sizeSmall": {
1064
+ "& .MuiSwitch-switchBase": {
1065
+ padding: 2,
1066
+ "&.Mui-checked": { transform: "translateX(20px)" }
1067
+ },
1068
+ "& .MuiSwitch-thumb": { width: 20, height: 20 }
1069
+ }
1025
1070
  },
1026
1071
  switchBase: {
1027
1072
  padding: 2,
@@ -1115,16 +1160,16 @@ function buildComponents(tokens2) {
1115
1160
  borderTopRightRadius: radius4.md
1116
1161
  }
1117
1162
  },
1118
- // Disabled parity with the disabled contained Button: greyed face +
1119
- // disabled fg, bevel geometry retained. MUI's own .Mui-disabled rule
1120
- // only swaps color and border-shorthands the bevel away — and ties
1121
- // with .Mui-selected at (0,2,0) — so this block sits AFTER selected
1122
- // to win both.
1163
+ // Disabled parity with the rest of the button family: transparent
1164
+ // face, disabled border + fg, bevel geometry retained. MUI's own
1165
+ // .Mui-disabled rule only swaps color and border-shorthands the bevel
1166
+ // away — and ties with .Mui-selected at (0,2,0) — so this block sits
1167
+ // AFTER selected to win both.
1123
1168
  "&.Mui-disabled": {
1124
- backgroundColor: (theme.vars || theme).palette.action.disabledBackground,
1169
+ backgroundColor: "transparent",
1125
1170
  color: (theme.vars || theme).palette.action.disabled,
1126
1171
  borderStyle: "solid",
1127
- borderColor: fg4.tertiary,
1172
+ borderColor: border4.disabled,
1128
1173
  borderTopWidth: 1,
1129
1174
  borderRightWidth: 1,
1130
1175
  borderLeftWidth: 1,