@octoguide/mui-ui-toolkit 0.7.0 → 0.7.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.
- package/dist/index.d.mts +7 -2
- package/dist/index.d.ts +7 -2
- package/dist/index.js +34 -31
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +34 -31
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -503,9 +503,10 @@ function resolveThemeName() {
|
|
|
503
503
|
|
|
504
504
|
// src/themes/createMuiTheme.ts
|
|
505
505
|
import { createTheme, alpha, darken } from "@mui/material/styles";
|
|
506
|
-
function createMuiTheme(tokens) {
|
|
506
|
+
function createMuiTheme(tokens, darkMode = false) {
|
|
507
507
|
return createTheme({
|
|
508
508
|
palette: {
|
|
509
|
+
mode: darkMode ? "dark" : "light",
|
|
509
510
|
primary: {
|
|
510
511
|
main: tokens.colors.primary,
|
|
511
512
|
dark: tokens.colors.primaryDark,
|
|
@@ -523,17 +524,17 @@ function createMuiTheme(tokens) {
|
|
|
523
524
|
error: { main: tokens.colors.error },
|
|
524
525
|
info: { main: tokens.colors.info },
|
|
525
526
|
background: {
|
|
526
|
-
default: tokens.colors.background,
|
|
527
|
-
paper: tokens.colors.backgroundPaper,
|
|
528
|
-
subtle: tokens.colors.backgroundSubtle
|
|
527
|
+
default: darkMode ? "#0d0d0d" : tokens.colors.background,
|
|
528
|
+
paper: darkMode ? "#1a1a1a" : tokens.colors.backgroundPaper,
|
|
529
|
+
subtle: darkMode ? "#2a2a2a" : tokens.colors.backgroundSubtle
|
|
529
530
|
},
|
|
530
531
|
border: tokens.colors.border,
|
|
531
|
-
text: {
|
|
532
|
+
text: darkMode ? void 0 : {
|
|
532
533
|
primary: tokens.colors.textPrimary,
|
|
533
534
|
secondary: tokens.colors.textSecondary,
|
|
534
535
|
disabled: tokens.colors.textDisabled
|
|
535
536
|
},
|
|
536
|
-
divider: tokens.colors.divider
|
|
537
|
+
divider: darkMode ? void 0 : tokens.colors.divider
|
|
537
538
|
},
|
|
538
539
|
typography: {
|
|
539
540
|
fontFamily: tokens.typography.fontFamilyBase,
|
|
@@ -684,14 +685,14 @@ function createMuiTheme(tokens) {
|
|
|
684
685
|
},
|
|
685
686
|
MuiTextField: {
|
|
686
687
|
styleOverrides: {
|
|
687
|
-
root: {
|
|
688
|
+
root: ({ theme }) => ({
|
|
688
689
|
"& .MuiOutlinedInput-root": {
|
|
689
690
|
borderRadius: tokens.components.input.borderRadius,
|
|
690
|
-
backgroundColor: tokens.components.input.background,
|
|
691
|
+
backgroundColor: theme.palette.mode === "dark" ? theme.palette.background.paper : tokens.components.input.background,
|
|
691
692
|
minHeight: tokens.components.input.minHeight,
|
|
692
693
|
"& fieldset": {
|
|
693
694
|
borderWidth: tokens.components.input.borderWidth,
|
|
694
|
-
borderColor: tokens.colors.border
|
|
695
|
+
borderColor: theme.palette.mode === "dark" ? theme.palette.divider : tokens.colors.border
|
|
695
696
|
},
|
|
696
697
|
"&:hover fieldset": {
|
|
697
698
|
borderColor: tokens.colors.primary
|
|
@@ -701,7 +702,7 @@ function createMuiTheme(tokens) {
|
|
|
701
702
|
borderColor: tokens.colors.borderFocus
|
|
702
703
|
},
|
|
703
704
|
"&.Mui-disabled": {
|
|
704
|
-
backgroundColor: tokens.components.input.backgroundDisabled
|
|
705
|
+
backgroundColor: theme.palette.mode === "dark" ? theme.palette.action.disabledBackground : tokens.components.input.backgroundDisabled
|
|
705
706
|
}
|
|
706
707
|
},
|
|
707
708
|
"& .MuiInputLabel-root": {
|
|
@@ -710,17 +711,17 @@ function createMuiTheme(tokens) {
|
|
|
710
711
|
"& .MuiFormHelperText-root": {
|
|
711
712
|
fontSize: tokens.components.input.helperFontSize
|
|
712
713
|
}
|
|
713
|
-
}
|
|
714
|
+
})
|
|
714
715
|
}
|
|
715
716
|
},
|
|
716
717
|
MuiCard: {
|
|
717
718
|
styleOverrides: {
|
|
718
|
-
root: {
|
|
719
|
+
root: ({ theme }) => ({
|
|
719
720
|
borderRadius: tokens.components.card.borderRadius,
|
|
720
|
-
backgroundColor: tokens.components.card.background,
|
|
721
|
+
backgroundColor: theme.palette.mode === "dark" ? theme.palette.background.paper : tokens.components.card.background,
|
|
721
722
|
boxShadow: tokens.shadows.sm,
|
|
722
|
-
border: `${tokens.components.card.borderWidth} solid ${
|
|
723
|
-
}
|
|
723
|
+
border: `${tokens.components.card.borderWidth} solid ${theme.palette.divider}`
|
|
724
|
+
})
|
|
724
725
|
}
|
|
725
726
|
},
|
|
726
727
|
MuiCardContent: {
|
|
@@ -804,11 +805,11 @@ function createMuiTheme(tokens) {
|
|
|
804
805
|
},
|
|
805
806
|
MuiDialog: {
|
|
806
807
|
styleOverrides: {
|
|
807
|
-
paper: {
|
|
808
|
+
paper: ({ theme }) => ({
|
|
808
809
|
borderRadius: tokens.components.dialog.borderRadius,
|
|
809
|
-
backgroundColor: tokens.components.dialog.background,
|
|
810
|
+
backgroundColor: theme.palette.mode === "dark" ? theme.palette.background.paper : tokens.components.dialog.background,
|
|
810
811
|
maxWidth: tokens.components.dialog.maxWidth
|
|
811
|
-
}
|
|
812
|
+
})
|
|
812
813
|
}
|
|
813
814
|
},
|
|
814
815
|
MuiDialogContent: {
|
|
@@ -820,26 +821,27 @@ function createMuiTheme(tokens) {
|
|
|
820
821
|
},
|
|
821
822
|
MuiTableCell: {
|
|
822
823
|
styleOverrides: {
|
|
823
|
-
root: {
|
|
824
|
+
root: ({ theme }) => ({
|
|
824
825
|
paddingLeft: tokens.components.table.cellPaddingX,
|
|
825
826
|
paddingRight: tokens.components.table.cellPaddingX,
|
|
826
827
|
paddingTop: tokens.components.table.cellPaddingY,
|
|
827
828
|
paddingBottom: tokens.components.table.cellPaddingY,
|
|
828
|
-
borderBottom: `${tokens.components.table.borderWidth} solid ${tokens.components.table.borderColor}`
|
|
829
|
-
},
|
|
830
|
-
head: {
|
|
829
|
+
borderBottom: `${tokens.components.table.borderWidth} solid ${theme.palette.mode === "dark" ? theme.palette.divider : tokens.components.table.borderColor}`
|
|
830
|
+
}),
|
|
831
|
+
head: ({ theme }) => ({
|
|
831
832
|
fontWeight: tokens.components.table.headerFontWeight,
|
|
832
|
-
backgroundColor: tokens.components.table.headerBackground
|
|
833
|
-
|
|
833
|
+
backgroundColor: theme.palette.mode === "dark" ? theme.palette.background.default : tokens.components.table.headerBackground,
|
|
834
|
+
color: theme.palette.text.secondary
|
|
835
|
+
})
|
|
834
836
|
}
|
|
835
837
|
},
|
|
836
838
|
MuiTableRow: {
|
|
837
839
|
styleOverrides: {
|
|
838
|
-
root: {
|
|
840
|
+
root: ({ theme }) => ({
|
|
839
841
|
"&:hover": {
|
|
840
|
-
backgroundColor: tokens.components.table.rowHoverBackground
|
|
842
|
+
backgroundColor: theme.palette.mode === "dark" ? theme.palette.action.hover : tokens.components.table.rowHoverBackground
|
|
841
843
|
}
|
|
842
|
-
}
|
|
844
|
+
})
|
|
843
845
|
}
|
|
844
846
|
},
|
|
845
847
|
MuiAvatar: {
|
|
@@ -1088,11 +1090,12 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
1088
1090
|
function ToolkitThemeProvider({
|
|
1089
1091
|
theme,
|
|
1090
1092
|
children,
|
|
1091
|
-
injectCssBaseline = true
|
|
1093
|
+
injectCssBaseline = true,
|
|
1094
|
+
darkMode = false
|
|
1092
1095
|
}) {
|
|
1093
1096
|
const themeName = theme ?? resolveThemeName();
|
|
1094
1097
|
const tokens = getThemeTokens(themeName);
|
|
1095
|
-
const muiTheme = createMuiTheme(tokens);
|
|
1098
|
+
const muiTheme = createMuiTheme(tokens, darkMode);
|
|
1096
1099
|
return /* @__PURE__ */ jsxs(MuiThemeProvider, { theme: muiTheme, children: [
|
|
1097
1100
|
injectCssBaseline && /* @__PURE__ */ jsx(CssBaseline, {}),
|
|
1098
1101
|
children
|
|
@@ -2444,7 +2447,7 @@ var StyledParagraph = styled13("p", {
|
|
|
2444
2447
|
outline: "transparent",
|
|
2445
2448
|
fontSize: theme.tokens.typography.fontSizeLg,
|
|
2446
2449
|
lineHeight: theme.tokens.typography.lineHeightBase,
|
|
2447
|
-
color: $isOnDarkBg ? theme.palette.common.white : theme.tokens.colors.textPrimary,
|
|
2450
|
+
color: $isOnDarkBg || theme.palette.mode === "dark" ? theme.palette.common.white : theme.tokens.colors.textPrimary,
|
|
2448
2451
|
...$variant === "regular" && {
|
|
2449
2452
|
fontWeight: theme.tokens.typography.fontWeightRegular
|
|
2450
2453
|
},
|
|
@@ -2461,7 +2464,7 @@ var StyledParagraph = styled13("p", {
|
|
|
2461
2464
|
fontWeight: theme.tokens.typography.fontWeightBold
|
|
2462
2465
|
},
|
|
2463
2466
|
...$variant === "overline" && {
|
|
2464
|
-
color: $isOnDarkBg ? theme.tokens.colors.overlayLight75 : theme.tokens.colors.textSecondary,
|
|
2467
|
+
color: $isOnDarkBg || theme.palette.mode === "dark" ? theme.tokens.colors.overlayLight75 : theme.tokens.colors.textSecondary,
|
|
2465
2468
|
fontWeight: theme.tokens.typography.fontWeightBold,
|
|
2466
2469
|
letterSpacing: "0.125rem",
|
|
2467
2470
|
textTransform: "uppercase"
|