@matteoaliano/forest-ui 0.8.6 → 0.8.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.
package/dist/index.mjs CHANGED
@@ -41,7 +41,7 @@ import {
41
41
  toggleColors,
42
42
  warning,
43
43
  widths
44
- } from "./chunk-MIJBSV5Z.mjs";
44
+ } from "./chunk-I3T6PQLZ.mjs";
45
45
 
46
46
  // src/provider/ForestProvider.tsx
47
47
  import { useMemo } from "react";
package/dist/theme.js CHANGED
@@ -936,12 +936,34 @@ function buildComponents(tokens) {
936
936
  avatarColors: avatarColors6,
937
937
  breadcrumbColors: breadcrumbColors6
938
938
  } = tokens;
939
+ const containedFill = {
940
+ backgroundColor: buttonColors6.primary.bg,
941
+ color: buttonColors6.primary.fg,
942
+ "&:hover": {
943
+ backgroundColor: buttonColors6.primary.bgHover
944
+ }
945
+ };
946
+ const outlinedFill = {
947
+ borderColor: buttonColors6.secondaryColor.border,
948
+ color: buttonColors6.secondaryColor.fg,
949
+ "&:hover": {
950
+ // Darken the whole outlined button on hover via brightness (< 1) — single
951
+ // mechanism, no separate border-color change. 0.97 is a barely-there darken.
952
+ filter: "brightness(0.97)"
953
+ }
954
+ };
955
+ const textFill = {
956
+ color: buttonColors6.tertiaryColor.fg,
957
+ "&:hover": {
958
+ backgroundColor: buttonColors6.tertiaryColor.bgHover
959
+ }
960
+ };
939
961
  return {
940
962
  // ─── CssBaseline (global) ───────────────────────────────────────
941
963
  MuiCssBaseline: {
942
964
  styleOverrides: {
943
965
  body: {
944
- fontFeatureSettings: '"ss01", "ss02", "cv11"'
966
+ fontFeatureSettings: "normal"
945
967
  }
946
968
  }
947
969
  },
@@ -951,50 +973,106 @@ function buildComponents(tokens) {
951
973
  disableElevation: true
952
974
  },
953
975
  styleOverrides: {
954
- root: {
955
- borderRadius: radius6.md,
956
- fontWeight: 600,
957
- boxShadow: tokenShadows.xs,
958
- height: 32,
959
- padding: "6px 12px",
960
- fontSize: 14,
961
- lineHeight: "20px",
962
- "&:focus-visible": {
963
- boxShadow: focusRings6.brandShadowXs
964
- }
965
- },
966
- containedPrimary: {
967
- backgroundColor: buttonColors6.primary.bg,
968
- "&:hover": {
969
- backgroundColor: buttonColors6.primary.bgHover
970
- }
971
- },
972
- outlinedPrimary: {
973
- borderColor: buttonColors6.secondaryColor.border,
974
- color: buttonColors6.secondaryColor.fg,
975
- "&:hover": {
976
- backgroundColor: buttonColors6.secondaryColor.bgHover,
977
- borderColor: buttonColors6.secondaryColor.borderHover
978
- }
979
- },
980
- containedSecondary: {
981
- backgroundColor: buttonColors6.secondary.bg,
982
- color: buttonColors6.secondary.fg,
983
- border: `1px solid ${buttonColors6.secondary.border}`,
984
- "&:hover": {
985
- backgroundColor: buttonColors6.secondary.bgHover,
986
- borderColor: buttonColors6.secondary.borderHover
987
- }
976
+ // The interactive behaviour (faux-3D bevel that flips on hover, a
977
+ // light sweep via ::before, brightness lift on filled, active press)
978
+ // mirrors the forest-web Button. Colors are untouched — the bevel and
979
+ // sweep use translucent `currentColor` so they adapt per variant.
980
+ // Applied to `contained` + `outlined`; `text` keeps its flat styling.
981
+ root: ({ ownerState }) => {
982
+ const interactive = ownerState.variant !== "text";
983
+ const isContained = ownerState.variant === "contained";
984
+ const isOutlined = ownerState.variant === "outlined";
985
+ const sweepColor = isOutlined ? "color-mix(in srgb, currentColor 45%, #fff)" : "currentColor";
986
+ const colorScales = { error: error2, warning: warning2, success: success2, info: info3 };
987
+ const faceScale = ownerState.color ? colorScales[ownerState.color] : void 0;
988
+ return {
989
+ borderRadius: radius6.md,
990
+ fontWeight: 600,
991
+ boxShadow: tokenShadows.xs,
992
+ height: 32,
993
+ padding: "6px 12px",
994
+ fontSize: 14,
995
+ lineHeight: "20px",
996
+ "&:focus-visible": {
997
+ boxShadow: focusRings6.brandShadowXs
998
+ },
999
+ ...interactive && {
1000
+ position: "relative",
1001
+ overflow: "hidden",
1002
+ transition: "filter 300ms ease, border-width 300ms ease, border-radius 300ms ease, opacity 300ms ease, background-color 300ms ease",
1003
+ borderStyle: "solid",
1004
+ borderTopWidth: 1,
1005
+ borderRightWidth: 1,
1006
+ borderLeftWidth: 1,
1007
+ borderBottomWidth: 4,
1008
+ // Round the thick-bevel side more than the rest so the inner
1009
+ // surface isn't squared off. Follows the bevel: bottom at rest,
1010
+ // top on hover.
1011
+ borderBottomLeftRadius: radius6.lg,
1012
+ borderBottomRightRadius: radius6.lg,
1013
+ // Contained buttons have no border of their own — give them a
1014
+ // translucent bevel. Outlined keeps its own border color.
1015
+ ...isContained && {
1016
+ // Greyscale bevel — visible on both the charcoal face and a
1017
+ // light page (white washed out on hover). Semantic colors keep
1018
+ // their in-hue bevel.
1019
+ borderColor: faceScale ? faceScale[700] : gray[600]
1020
+ },
1021
+ "&::before": {
1022
+ content: '""',
1023
+ position: "absolute",
1024
+ left: 0,
1025
+ top: "-150%",
1026
+ width: "100%",
1027
+ height: 5,
1028
+ borderRadius: 4,
1029
+ backgroundColor: sweepColor,
1030
+ boxShadow: `0 0 24px 4px ${sweepColor}`,
1031
+ opacity: isOutlined ? 0.2 : 0.3,
1032
+ filter: isOutlined ? "blur(3px)" : "blur(2px)",
1033
+ pointerEvents: "none",
1034
+ transition: "top 500ms ease-in-out"
1035
+ },
1036
+ "&:hover": {
1037
+ borderTopWidth: 4,
1038
+ borderBottomWidth: 1,
1039
+ borderTopLeftRadius: radius6.lg,
1040
+ borderTopRightRadius: radius6.lg,
1041
+ borderBottomLeftRadius: radius6.md,
1042
+ borderBottomRightRadius: radius6.md,
1043
+ // One step lighter than the default bevel (60% → 70%) so it
1044
+ // stays visible against the brightened face on hover.
1045
+ ...isContained && {
1046
+ filter: "brightness(1.5)",
1047
+ // Charcoal (non-semantic) keeps its default gray[600] border —
1048
+ // the brightness lift lightens it on hover. Semantic colors
1049
+ // darken to [900] so their bevel survives the brightness.
1050
+ ...faceScale && { borderColor: faceScale[900] }
1051
+ }
1052
+ },
1053
+ "&:hover::before": {
1054
+ top: "150%"
1055
+ },
1056
+ "&:active": {
1057
+ opacity: 0.75
1058
+ },
1059
+ "@media (prefers-reduced-motion: reduce)": {
1060
+ transition: "none",
1061
+ "&::before": { display: "none" }
1062
+ }
1063
+ }
1064
+ };
988
1065
  },
1066
+ // Primary and Secondary are intentionally identical (greyscale system).
1067
+ containedPrimary: containedFill,
1068
+ containedSecondary: containedFill,
1069
+ outlinedPrimary: outlinedFill,
1070
+ outlinedSecondary: outlinedFill,
989
1071
  text: {
990
1072
  boxShadow: "none"
991
1073
  },
992
- textPrimary: {
993
- color: buttonColors6.tertiaryColor.fg,
994
- "&:hover": {
995
- backgroundColor: buttonColors6.tertiaryColor.bgHover
996
- }
997
- }
1074
+ textPrimary: textFill,
1075
+ textSecondary: textFill
998
1076
  }
999
1077
  },
1000
1078
  // ─── Button Group ───────────────────────────────────────────────
@@ -1199,6 +1277,12 @@ function buildComponents(tokens) {
1199
1277
  "&.Mui-selected": {
1200
1278
  backgroundColor: info3[50],
1201
1279
  color: info3[700],
1280
+ // ListItemText primary hardcodes its own color (text.secondary),
1281
+ // which beats the inherited MenuItem color — re-point it here so
1282
+ // selected labels actually take the info color (e.g. MultiSelect).
1283
+ "& .MuiListItemText-primary": {
1284
+ color: info3[700]
1285
+ },
1202
1286
  "&:hover": {
1203
1287
  backgroundColor: info3[100]
1204
1288
  }