@matteoaliano/forest-ui 0.8.7 → 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.js CHANGED
@@ -1173,6 +1173,28 @@ function buildComponents(tokens) {
1173
1173
  avatarColors: avatarColors6,
1174
1174
  breadcrumbColors: breadcrumbColors6
1175
1175
  } = tokens;
1176
+ const containedFill = {
1177
+ backgroundColor: buttonColors6.primary.bg,
1178
+ color: buttonColors6.primary.fg,
1179
+ "&:hover": {
1180
+ backgroundColor: buttonColors6.primary.bgHover
1181
+ }
1182
+ };
1183
+ const outlinedFill = {
1184
+ borderColor: buttonColors6.secondaryColor.border,
1185
+ color: buttonColors6.secondaryColor.fg,
1186
+ "&:hover": {
1187
+ // Darken the whole outlined button on hover via brightness (< 1) — single
1188
+ // mechanism, no separate border-color change. 0.97 is a barely-there darken.
1189
+ filter: "brightness(0.97)"
1190
+ }
1191
+ };
1192
+ const textFill = {
1193
+ color: buttonColors6.tertiaryColor.fg,
1194
+ "&:hover": {
1195
+ backgroundColor: buttonColors6.tertiaryColor.bgHover
1196
+ }
1197
+ };
1176
1198
  return {
1177
1199
  // ─── CssBaseline (global) ───────────────────────────────────────
1178
1200
  MuiCssBaseline: {
@@ -1188,50 +1210,106 @@ function buildComponents(tokens) {
1188
1210
  disableElevation: true
1189
1211
  },
1190
1212
  styleOverrides: {
1191
- root: {
1192
- borderRadius: radius6.md,
1193
- fontWeight: 600,
1194
- boxShadow: tokenShadows.xs,
1195
- height: 32,
1196
- padding: "6px 12px",
1197
- fontSize: 14,
1198
- lineHeight: "20px",
1199
- "&:focus-visible": {
1200
- boxShadow: focusRings6.brandShadowXs
1201
- }
1202
- },
1203
- containedPrimary: {
1204
- backgroundColor: buttonColors6.primary.bg,
1205
- "&:hover": {
1206
- backgroundColor: buttonColors6.primary.bgHover
1207
- }
1208
- },
1209
- outlinedPrimary: {
1210
- borderColor: buttonColors6.secondaryColor.border,
1211
- color: buttonColors6.secondaryColor.fg,
1212
- "&:hover": {
1213
- backgroundColor: buttonColors6.secondaryColor.bgHover,
1214
- borderColor: buttonColors6.secondaryColor.borderHover
1215
- }
1216
- },
1217
- containedSecondary: {
1218
- backgroundColor: buttonColors6.secondary.bg,
1219
- color: buttonColors6.secondary.fg,
1220
- border: `1px solid ${buttonColors6.secondary.border}`,
1221
- "&:hover": {
1222
- backgroundColor: buttonColors6.secondary.bgHover,
1223
- borderColor: buttonColors6.secondary.borderHover
1224
- }
1213
+ // The interactive behaviour (faux-3D bevel that flips on hover, a
1214
+ // light sweep via ::before, brightness lift on filled, active press)
1215
+ // mirrors the forest-web Button. Colors are untouched — the bevel and
1216
+ // sweep use translucent `currentColor` so they adapt per variant.
1217
+ // Applied to `contained` + `outlined`; `text` keeps its flat styling.
1218
+ root: ({ ownerState }) => {
1219
+ const interactive = ownerState.variant !== "text";
1220
+ const isContained = ownerState.variant === "contained";
1221
+ const isOutlined = ownerState.variant === "outlined";
1222
+ const sweepColor = isOutlined ? "color-mix(in srgb, currentColor 45%, #fff)" : "currentColor";
1223
+ const colorScales = { error: error2, warning: warning2, success: success2, info: info3 };
1224
+ const faceScale = ownerState.color ? colorScales[ownerState.color] : void 0;
1225
+ return {
1226
+ borderRadius: radius6.md,
1227
+ fontWeight: 600,
1228
+ boxShadow: tokenShadows.xs,
1229
+ height: 32,
1230
+ padding: "6px 12px",
1231
+ fontSize: 14,
1232
+ lineHeight: "20px",
1233
+ "&:focus-visible": {
1234
+ boxShadow: focusRings6.brandShadowXs
1235
+ },
1236
+ ...interactive && {
1237
+ position: "relative",
1238
+ overflow: "hidden",
1239
+ transition: "filter 300ms ease, border-width 300ms ease, border-radius 300ms ease, opacity 300ms ease, background-color 300ms ease",
1240
+ borderStyle: "solid",
1241
+ borderTopWidth: 1,
1242
+ borderRightWidth: 1,
1243
+ borderLeftWidth: 1,
1244
+ borderBottomWidth: 4,
1245
+ // Round the thick-bevel side more than the rest so the inner
1246
+ // surface isn't squared off. Follows the bevel: bottom at rest,
1247
+ // top on hover.
1248
+ borderBottomLeftRadius: radius6.lg,
1249
+ borderBottomRightRadius: radius6.lg,
1250
+ // Contained buttons have no border of their own — give them a
1251
+ // translucent bevel. Outlined keeps its own border color.
1252
+ ...isContained && {
1253
+ // Greyscale bevel — visible on both the charcoal face and a
1254
+ // light page (white washed out on hover). Semantic colors keep
1255
+ // their in-hue bevel.
1256
+ borderColor: faceScale ? faceScale[700] : gray[600]
1257
+ },
1258
+ "&::before": {
1259
+ content: '""',
1260
+ position: "absolute",
1261
+ left: 0,
1262
+ top: "-150%",
1263
+ width: "100%",
1264
+ height: 5,
1265
+ borderRadius: 4,
1266
+ backgroundColor: sweepColor,
1267
+ boxShadow: `0 0 24px 4px ${sweepColor}`,
1268
+ opacity: isOutlined ? 0.2 : 0.3,
1269
+ filter: isOutlined ? "blur(3px)" : "blur(2px)",
1270
+ pointerEvents: "none",
1271
+ transition: "top 500ms ease-in-out"
1272
+ },
1273
+ "&:hover": {
1274
+ borderTopWidth: 4,
1275
+ borderBottomWidth: 1,
1276
+ borderTopLeftRadius: radius6.lg,
1277
+ borderTopRightRadius: radius6.lg,
1278
+ borderBottomLeftRadius: radius6.md,
1279
+ borderBottomRightRadius: radius6.md,
1280
+ // One step lighter than the default bevel (60% → 70%) so it
1281
+ // stays visible against the brightened face on hover.
1282
+ ...isContained && {
1283
+ filter: "brightness(1.5)",
1284
+ // Charcoal (non-semantic) keeps its default gray[600] border —
1285
+ // the brightness lift lightens it on hover. Semantic colors
1286
+ // darken to [900] so their bevel survives the brightness.
1287
+ ...faceScale && { borderColor: faceScale[900] }
1288
+ }
1289
+ },
1290
+ "&:hover::before": {
1291
+ top: "150%"
1292
+ },
1293
+ "&:active": {
1294
+ opacity: 0.75
1295
+ },
1296
+ "@media (prefers-reduced-motion: reduce)": {
1297
+ transition: "none",
1298
+ "&::before": { display: "none" }
1299
+ }
1300
+ }
1301
+ };
1225
1302
  },
1303
+ // Primary and Secondary are intentionally identical (greyscale system).
1304
+ containedPrimary: containedFill,
1305
+ containedSecondary: containedFill,
1306
+ outlinedPrimary: outlinedFill,
1307
+ outlinedSecondary: outlinedFill,
1226
1308
  text: {
1227
1309
  boxShadow: "none"
1228
1310
  },
1229
- textPrimary: {
1230
- color: buttonColors6.tertiaryColor.fg,
1231
- "&:hover": {
1232
- backgroundColor: buttonColors6.tertiaryColor.bgHover
1233
- }
1234
- }
1311
+ textPrimary: textFill,
1312
+ textSecondary: textFill
1235
1313
  }
1236
1314
  },
1237
1315
  // ─── Button Group ───────────────────────────────────────────────
@@ -1436,6 +1514,12 @@ function buildComponents(tokens) {
1436
1514
  "&.Mui-selected": {
1437
1515
  backgroundColor: info3[50],
1438
1516
  color: info3[700],
1517
+ // ListItemText primary hardcodes its own color (text.secondary),
1518
+ // which beats the inherited MenuItem color — re-point it here so
1519
+ // selected labels actually take the info color (e.g. MultiSelect).
1520
+ "& .MuiListItemText-primary": {
1521
+ color: info3[700]
1522
+ },
1439
1523
  "&:hover": {
1440
1524
  backgroundColor: info3[100]
1441
1525
  }