@junyiacademy/ui-test 1.5.6 → 1.5.7

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.
@@ -0,0 +1 @@
1
+ export default function capitalize(string: any): any;
@@ -6,19 +6,21 @@ const react_1 = tslib_1.__importDefault(require("react"));
6
6
  const styles_1 = require("@mui/material/styles");
7
7
  const material_1 = require("@mui/material");
8
8
  const Button_1 = require("@mui/material/Button");
9
+ const Capitalize_1 = tslib_1.__importDefault(require("../../utils/Capitalize"));
9
10
  const StyledButton = styles_1.styled(material_1.Button, {
10
11
  shouldForwardProp: (prop) => prop !== 'active',
11
- })(({ active, theme }) => ({
12
- [`&.${Button_1.buttonClasses.outlinedPrimary}`]: {
12
+ })(({ active, color = 'primary', theme }) => ({
13
+ // For variant: outlined
14
+ [`&.${Button_1.buttonClasses.outlined}${Capitalize_1.default(color)}`]: {
13
15
  backgroundColor: active
14
- ? theme.palette.primary.main
16
+ ? theme.palette[color].main
15
17
  : theme.palette.common.white,
16
- color: active ? theme.palette.common.white : theme.palette.primary.main,
17
- borderColor: theme.palette.primary.main,
18
+ color: active ? theme.palette.common.white : theme.palette[color].main,
19
+ borderColor: theme.palette[color].main,
18
20
  '&:hover': {
19
21
  backgroundColor: active
20
- ? theme.palette.primary.main
21
- : styles_1.alpha(theme.palette.primary.main, 0.1),
22
+ ? theme.palette[color].main
23
+ : styles_1.alpha(theme.palette[color].main, 0.1),
22
24
  },
23
25
  [`&.${Button_1.buttonClasses.disabled}`]: {
24
26
  backgroundColor: theme.palette.common.white,
@@ -26,31 +28,15 @@ const StyledButton = styles_1.styled(material_1.Button, {
26
28
  color: theme.palette.action.disabled,
27
29
  },
28
30
  },
29
- [`&.${Button_1.buttonClasses.outlinedSecondary}`]: {
30
- backgroundColor: active
31
- ? theme.palette.secondary.main
32
- : theme.palette.common.white,
33
- color: active ? theme.palette.common.white : theme.palette.secondary.main,
34
- borderColor: theme.palette.secondary.main,
35
- '&:hover': {
36
- backgroundColor: active
37
- ? theme.palette.secondary.main
38
- : styles_1.alpha(theme.palette.secondary.main, 0.1),
39
- },
40
- [`&.${Button_1.buttonClasses.disabled}`]: {
41
- backgroundColor: theme.palette.common.white,
42
- borderColor: theme.palette.action.disabledBackground,
43
- color: theme.palette.action.disabled,
44
- },
45
- },
46
- [`&.${Button_1.buttonClasses.textPrimary}`]: {
31
+ // For variant: text
32
+ [`&.${Button_1.buttonClasses.text}${Capitalize_1.default(color)}`]: {
47
33
  '&:hover': {
48
- backgroundColor: styles_1.alpha(theme.palette.primary.main, 0.1),
34
+ backgroundColor: styles_1.alpha(theme.palette[color].main, 0.1),
49
35
  },
50
36
  },
51
- [`&.${Button_1.buttonClasses.textSecondary}`]: {
37
+ [`&.${Button_1.buttonClasses.text}${Capitalize_1.default(color)}`]: {
52
38
  '&:hover': {
53
- backgroundColor: styles_1.alpha(theme.palette.secondary.main, 0.1),
39
+ backgroundColor: styles_1.alpha(theme.palette[color].main, 0.1),
54
40
  },
55
41
  },
56
42
  }));
@@ -6,6 +6,8 @@ const react_1 = tslib_1.__importDefault(require("react"));
6
6
  const styles_1 = require("@mui/material/styles");
7
7
  const material_1 = require("@mui/material");
8
8
  const ButtonGroup_1 = require("@mui/material/ButtonGroup");
9
+ //utils
10
+ // self-defined-components
9
11
  const StyledButtonGroup = styles_1.styled(material_1.ButtonGroup)(({ theme }) => ({
10
12
  [`& .${ButtonGroup_1.buttonGroupClasses.groupedOutlinedPrimary}.${ButtonGroup_1.buttonGroupClasses.grouped}.${ButtonGroup_1.buttonGroupClasses.disabled}`]: {
11
13
  borderColor: styles_1.alpha(theme.palette.primary.main, 0.5),
@@ -7,6 +7,7 @@ const styles_1 = require("@mui/material/styles");
7
7
  const material_1 = require("@mui/material");
8
8
  const FormControlLabel_1 = require("@mui/material/FormControlLabel");
9
9
  const Radio_1 = require("@mui/material/Radio");
10
+ // self-defined-components
10
11
  const StyledFormControlLabel = styles_1.styled(material_1.FormControlLabel)(({ theme }) => ({
11
12
  [`& .${FormControlLabel_1.formControlLabelClasses.label}`]: {
12
13
  color: theme.palette.text.secondary,
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ function capitalize(string) {
4
+ return string.charAt(0).toUpperCase() + string.slice(1);
5
+ }
6
+ exports.default = capitalize;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@junyiacademy/ui-test",
3
- "version": "1.5.6",
3
+ "version": "1.5.7",
4
4
  "description": "junyiacademy ui library",
5
5
  "main": "./dist/libs/ui/src/index.js",
6
6
  "typings": "./declarations/libs/ui/src/index.d.ts",