@vertigis/react-ui 9.2.0 → 9.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/Switch/Switch.d.ts +2 -1
- package/Switch/Switch.js +8 -1
- package/package.json +1 -1
- package/styles/createTheme.js +1 -3
package/Switch/Switch.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ButtonBaseClasses } from "@mui/material/ButtonBase";
|
|
2
2
|
import type { IconButtonClasses } from "@mui/material/IconButton";
|
|
3
|
-
import
|
|
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
|
|
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;
|
package/package.json
CHANGED
package/styles/createTheme.js
CHANGED
|
@@ -557,6 +557,7 @@ function getOverrides(theme) {
|
|
|
557
557
|
},
|
|
558
558
|
MuiSwitch: {
|
|
559
559
|
defaultProps: {
|
|
560
|
+
color: "secondary",
|
|
560
561
|
focusRipple: false,
|
|
561
562
|
},
|
|
562
563
|
styleOverrides: {
|
|
@@ -568,8 +569,6 @@ function getOverrides(theme) {
|
|
|
568
569
|
"&::before": {
|
|
569
570
|
content: "'•'",
|
|
570
571
|
position: "absolute",
|
|
571
|
-
// Get contrast text color based on track color
|
|
572
|
-
color: palette.getContrastText(palette.secondary.main),
|
|
573
572
|
left: 14,
|
|
574
573
|
top: 7,
|
|
575
574
|
fontSize: 18,
|
|
@@ -618,7 +617,6 @@ function getOverrides(theme) {
|
|
|
618
617
|
transform: "translateX(33%)",
|
|
619
618
|
},
|
|
620
619
|
"&.Mui-checked + .MuiSwitch-track": {
|
|
621
|
-
backgroundColor: palette.secondary.main,
|
|
622
620
|
opacity: 1,
|
|
623
621
|
},
|
|
624
622
|
},
|