@vertigis/react-ui 9.1.0 → 9.2.2

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.
@@ -1,6 +1,6 @@
1
1
  import type { ButtonBaseClasses } from "@mui/material/ButtonBase";
2
2
  import type { IconButtonClasses } from "@mui/material/IconButton";
3
- import Switch, { SwitchProps as MUISwitchProps, SwitchClasses as MUISwitchClasses } from "@mui/material/Switch";
3
+ import { SwitchProps as MUISwitchProps, SwitchClasses as MUISwitchClasses } from "@mui/material/Switch";
4
4
  export * from "@mui/material/Switch";
5
5
  export interface SwitchClasses extends MUISwitchClasses, IconButtonClasses, ButtonBaseClasses {
6
6
  }
@@ -8,4 +8,5 @@ export declare type SwitchClassKey = keyof SwitchClasses;
8
8
  export declare type SwitchProps = Omit<MUISwitchProps, "classes"> & {
9
9
  classes?: Partial<SwitchClasses>;
10
10
  };
11
+ declare const Switch: import("@emotion/styled").StyledComponent<MUISwitchProps & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles/createTheme").Theme>, {}, {}>;
11
12
  export default Switch;
package/Switch/Switch.js CHANGED
@@ -1,4 +1,11 @@
1
- import Switch from "@mui/material/Switch";
1
+ import SwitchBase from "@mui/material/Switch";
2
+ import { styled } from "../styles";
2
3
  // MUST be the first export, since some of the exports are overridden below.
3
4
  export * from "@mui/material/Switch";
5
+ const Switch = styled(SwitchBase)(({ color = "secondary", theme: { palette } }) => ({
6
+ "&::before": {
7
+ // Calculate dot color based on track color.
8
+ color: palette.getContrastText(palette[color].main),
9
+ }
10
+ }));
4
11
  export default Switch;
@@ -0,0 +1,3 @@
1
+ import Color from "./Color";
2
+ declare const darkRed: Color;
3
+ export default darkRed;
@@ -0,0 +1,17 @@
1
+ const darkRed = {
2
+ 50: "#F8E8E7",
3
+ 100: "#ECC2BE",
4
+ 200: "#E09E98",
5
+ 300: "#D47D75",
6
+ 400: "#C85F55",
7
+ 500: "#BC4438",
8
+ 600: "#A43B31",
9
+ 700: "#8D332A",
10
+ 800: "#752A23",
11
+ 900: "#5D221C",
12
+ A100: "#FFCECC",
13
+ A200: "#FF9E99",
14
+ A400: "#FF6D66",
15
+ A700: "#FF554C",
16
+ };
17
+ export default darkRed;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vertigis/react-ui",
3
- "version": "9.1.0",
3
+ "version": "9.2.2",
4
4
  "description": "Utilities and React components used in VertiGIS applications.",
5
5
  "keywords": [
6
6
  "vertigis",
@@ -465,6 +465,31 @@ function getOverrides(theme) {
465
465
  },
466
466
  },
467
467
  MuiListItem: {
468
+ styleOverrides: {
469
+ root: {
470
+ "&.MuiListItem-secondaryAction, &>.MuiListItemButton-root": {
471
+ // Disable the right padding of 48px that MUI uses
472
+ // to make room for secondary actions, since we use
473
+ // flex for those rather than absolute positioning
474
+ // (see MuiListItemSecondaryAction overrides). Note
475
+ // that there are two distinct cases we need to
476
+ // handle, depending on whether a
477
+ // <ListItemSecondaryAction> element is used
478
+ // explicitly, or whether the ListItem's
479
+ // `secondaryAction` prop is used.
480
+ paddingRight: spacing(1),
481
+ },
482
+ },
483
+ container: {
484
+ // A wrapper element with this class is added around a
485
+ // list item when a <ListItemSecondaryAction> child is
486
+ // present. Use flex to position the secondary actions
487
+ // next to the list item content rather than absolute
488
+ // positioning so that nothing overlaps.
489
+ display: "flex",
490
+ alignItems: "center",
491
+ },
492
+ },
468
493
  variants: [
469
494
  {
470
495
  // HACK: The button prop is deprecated in MUI 5 in favor
@@ -478,6 +503,18 @@ function getOverrides(theme) {
478
503
  },
479
504
  ],
480
505
  },
506
+ MuiListItemSecondaryAction: {
507
+ styleOverrides: {
508
+ root: {
509
+ // We use flex instead of absolute positioning so that
510
+ // secondary buttons don't overlap the item text.
511
+ position: "static",
512
+ transform: "unset",
513
+ flex: "0 0 auto",
514
+ paddingRight: spacing(1),
515
+ },
516
+ },
517
+ },
481
518
  MuiListItemText: {
482
519
  styleOverrides: {
483
520
  primary: {
@@ -557,6 +594,7 @@ function getOverrides(theme) {
557
594
  },
558
595
  MuiSwitch: {
559
596
  defaultProps: {
597
+ color: "secondary",
560
598
  focusRipple: false,
561
599
  },
562
600
  styleOverrides: {
@@ -568,8 +606,6 @@ function getOverrides(theme) {
568
606
  "&::before": {
569
607
  content: "'•'",
570
608
  position: "absolute",
571
- // Get contrast text color based on track color
572
- color: palette.getContrastText(palette.secondary.main),
573
609
  left: 14,
574
610
  top: 7,
575
611
  fontSize: 18,
@@ -618,7 +654,6 @@ function getOverrides(theme) {
618
654
  transform: "translateX(33%)",
619
655
  },
620
656
  "&.Mui-checked + .MuiSwitch-track": {
621
- backgroundColor: palette.secondary.main,
622
657
  opacity: 1,
623
658
  },
624
659
  },