@matteoaliano/forest-ui 0.8.7 → 0.8.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.
@@ -865,6 +865,28 @@ function buildComponents(tokens) {
865
865
  avatarColors: avatarColors6,
866
866
  breadcrumbColors: breadcrumbColors6
867
867
  } = tokens;
868
+ const containedFill = {
869
+ backgroundColor: buttonColors6.primary.bg,
870
+ color: buttonColors6.primary.fg,
871
+ "&:hover": {
872
+ backgroundColor: buttonColors6.primary.bgHover
873
+ }
874
+ };
875
+ const outlinedFill = {
876
+ borderColor: buttonColors6.secondaryColor.border,
877
+ color: buttonColors6.secondaryColor.fg,
878
+ "&:hover": {
879
+ // Darken the whole outlined button on hover via brightness (< 1) — single
880
+ // mechanism, no separate border-color change. 0.97 is a barely-there darken.
881
+ filter: "brightness(0.97)"
882
+ }
883
+ };
884
+ const textFill = {
885
+ color: buttonColors6.tertiaryColor.fg,
886
+ "&:hover": {
887
+ backgroundColor: buttonColors6.tertiaryColor.bgHover
888
+ }
889
+ };
868
890
  return {
869
891
  // ─── CssBaseline (global) ───────────────────────────────────────
870
892
  MuiCssBaseline: {
@@ -880,50 +902,115 @@ function buildComponents(tokens) {
880
902
  disableElevation: true
881
903
  },
882
904
  styleOverrides: {
883
- root: {
884
- borderRadius: radius6.md,
885
- fontWeight: 600,
886
- boxShadow: tokenShadows.xs,
887
- height: 32,
888
- padding: "6px 12px",
889
- fontSize: 14,
890
- lineHeight: "20px",
891
- "&:focus-visible": {
892
- boxShadow: focusRings6.brandShadowXs
893
- }
894
- },
895
- containedPrimary: {
896
- backgroundColor: buttonColors6.primary.bg,
897
- "&:hover": {
898
- backgroundColor: buttonColors6.primary.bgHover
899
- }
900
- },
901
- outlinedPrimary: {
902
- borderColor: buttonColors6.secondaryColor.border,
903
- color: buttonColors6.secondaryColor.fg,
904
- "&:hover": {
905
- backgroundColor: buttonColors6.secondaryColor.bgHover,
906
- borderColor: buttonColors6.secondaryColor.borderHover
907
- }
908
- },
909
- containedSecondary: {
910
- backgroundColor: buttonColors6.secondary.bg,
911
- color: buttonColors6.secondary.fg,
912
- border: `1px solid ${buttonColors6.secondary.border}`,
913
- "&:hover": {
914
- backgroundColor: buttonColors6.secondary.bgHover,
915
- borderColor: buttonColors6.secondary.borderHover
916
- }
905
+ // The interactive behaviour (faux-3D bevel that flips on hover, a
906
+ // light sweep via ::before, brightness lift on filled, active press)
907
+ // mirrors the forest-web Button. Colors are untouched — the bevel and
908
+ // sweep use translucent `currentColor` so they adapt per variant.
909
+ // Applied to `contained` + `outlined`; `text` keeps its flat styling.
910
+ root: ({ ownerState }) => {
911
+ const interactive = ownerState.variant !== "text";
912
+ const isContained = ownerState.variant === "contained";
913
+ const isOutlined = ownerState.variant === "outlined";
914
+ const sweepColor = isOutlined ? "color-mix(in srgb, currentColor 45%, #fff)" : "currentColor";
915
+ const colorScales = { error: error2, warning: warning2, success: success2, info: info3 };
916
+ const faceScale = ownerState.color ? colorScales[ownerState.color] : void 0;
917
+ return {
918
+ borderRadius: radius6.md,
919
+ fontWeight: 600,
920
+ boxShadow: tokenShadows.xs,
921
+ height: 32,
922
+ padding: "6px 12px",
923
+ fontSize: 14,
924
+ lineHeight: "20px",
925
+ "&:focus-visible": {
926
+ boxShadow: focusRings6.brandShadowXs
927
+ },
928
+ ...interactive && {
929
+ position: "relative",
930
+ overflow: "hidden",
931
+ transition: "filter 300ms ease, border-width 300ms ease, border-radius 300ms ease, opacity 300ms ease, background-color 300ms ease",
932
+ borderStyle: "solid",
933
+ borderTopWidth: 1,
934
+ borderRightWidth: 1,
935
+ borderLeftWidth: 1,
936
+ borderBottomWidth: 4,
937
+ // Round the thick-bevel side more than the rest so the inner
938
+ // surface isn't squared off. Follows the bevel: bottom at rest,
939
+ // top on hover.
940
+ borderBottomLeftRadius: radius6.lg,
941
+ borderBottomRightRadius: radius6.lg,
942
+ // Contained buttons have no border of their own — give them a
943
+ // translucent bevel. Outlined keeps its own border color.
944
+ ...isContained && {
945
+ // Greyscale bevel — visible on both the charcoal face and a
946
+ // light page (white washed out on hover). Semantic colors keep
947
+ // their in-hue bevel.
948
+ borderColor: faceScale ? faceScale[700] : gray[600]
949
+ },
950
+ "&::before": {
951
+ content: '""',
952
+ position: "absolute",
953
+ left: 0,
954
+ top: "-150%",
955
+ width: "100%",
956
+ height: 5,
957
+ borderRadius: 4,
958
+ backgroundColor: sweepColor,
959
+ boxShadow: `0 0 24px 4px ${sweepColor}`,
960
+ opacity: isOutlined ? 0.2 : 0.3,
961
+ filter: isOutlined ? "blur(3px)" : "blur(2px)",
962
+ pointerEvents: "none",
963
+ transition: "top 500ms ease-in-out"
964
+ },
965
+ "&:hover": {
966
+ borderTopWidth: 4,
967
+ borderBottomWidth: 1,
968
+ borderTopLeftRadius: radius6.lg,
969
+ borderTopRightRadius: radius6.lg,
970
+ borderBottomLeftRadius: radius6.md,
971
+ borderBottomRightRadius: radius6.md,
972
+ // One step lighter than the default bevel (60% → 70%) so it
973
+ // stays visible against the brightened face on hover.
974
+ ...isContained && {
975
+ filter: "brightness(1.5)",
976
+ // Charcoal (non-semantic) keeps its default gray[600] border —
977
+ // the brightness lift lightens it on hover. Semantic colors
978
+ // darken to [900] so their bevel survives the brightness.
979
+ ...faceScale && { borderColor: faceScale[900] }
980
+ }
981
+ },
982
+ "&:hover::before": {
983
+ top: "150%"
984
+ },
985
+ // Press: collapse the raised top bevel back to a thin edge so the
986
+ // surface visibly sinks — the button reads as pushed deeper into
987
+ // the page. Animated by the shared border-width transition above.
988
+ "&:active": {
989
+ // Snap the press faster than the 300ms hover flip so it feels
990
+ // like a tactile click rather than a slow settle.
991
+ transition: "border-width 120ms ease, border-radius 120ms ease, opacity 120ms ease",
992
+ borderTopWidth: 1,
993
+ borderTopLeftRadius: radius6.md,
994
+ borderTopRightRadius: radius6.md,
995
+ opacity: 0.75
996
+ },
997
+ "@media (prefers-reduced-motion: reduce)": {
998
+ transition: "none",
999
+ "&::before": { display: "none" }
1000
+ }
1001
+ }
1002
+ };
917
1003
  },
1004
+ // Primary and Secondary are intentionally identical (greyscale system).
1005
+ containedPrimary: containedFill,
1006
+ containedSecondary: containedFill,
1007
+ outlinedPrimary: outlinedFill,
1008
+ outlinedSecondary: outlinedFill,
918
1009
  text: {
919
1010
  boxShadow: "none"
920
1011
  },
921
- textPrimary: {
922
- color: buttonColors6.tertiaryColor.fg,
923
- "&:hover": {
924
- backgroundColor: buttonColors6.tertiaryColor.bgHover
925
- }
926
- }
1012
+ textPrimary: textFill,
1013
+ textSecondary: textFill
927
1014
  }
928
1015
  },
929
1016
  // ─── Button Group ───────────────────────────────────────────────
@@ -1128,6 +1215,12 @@ function buildComponents(tokens) {
1128
1215
  "&.Mui-selected": {
1129
1216
  backgroundColor: info3[50],
1130
1217
  color: info3[700],
1218
+ // ListItemText primary hardcodes its own color (text.secondary),
1219
+ // which beats the inherited MenuItem color — re-point it here so
1220
+ // selected labels actually take the info color (e.g. MultiSelect).
1221
+ "& .MuiListItemText-primary": {
1222
+ color: info3[700]
1223
+ },
1131
1224
  "&:hover": {
1132
1225
  backgroundColor: info3[100]
1133
1226
  }
@@ -3997,4 +4090,4 @@ export {
3997
4090
  forestTheme,
3998
4091
  forestThemeOptions
3999
4092
  };
4000
- //# sourceMappingURL=chunk-YFN5RIF5.mjs.map
4093
+ //# sourceMappingURL=chunk-2XQSGP7X.mjs.map