@junyiacademy/ui-test 1.5.4 → 1.5.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.
@@ -0,0 +1 @@
1
+ export default function capitalize(string: any): any;
@@ -6,19 +6,22 @@ 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
+ //utils
10
+ const Capitalize_1 = tslib_1.__importDefault(require("../../utils/Capitalize"));
9
11
  const StyledButton = styles_1.styled(material_1.Button, {
10
12
  shouldForwardProp: (prop) => prop !== 'active',
11
- })(({ active, theme }) => ({
12
- [`&.${Button_1.buttonClasses.outlinedPrimary}`]: {
13
+ })(({ active, color = 'primary', theme }) => ({
14
+ // For variant: outlined
15
+ [`&.${Button_1.buttonClasses.outlined}${Capitalize_1.default(color)}`]: {
13
16
  backgroundColor: active
14
- ? theme.palette.primary.main
17
+ ? theme.palette[color].main
15
18
  : theme.palette.common.white,
16
- color: active ? theme.palette.common.white : theme.palette.primary.main,
17
- borderColor: theme.palette.primary.main,
19
+ color: active ? theme.palette.common.white : theme.palette[color].main,
20
+ borderColor: theme.palette[color].main,
18
21
  '&:hover': {
19
22
  backgroundColor: active
20
- ? theme.palette.primary.main
21
- : styles_1.alpha(theme.palette.primary.main, 0.1),
23
+ ? theme.palette[color].main
24
+ : styles_1.alpha(theme.palette[color].main, 0.1),
22
25
  },
23
26
  [`&.${Button_1.buttonClasses.disabled}`]: {
24
27
  backgroundColor: theme.palette.common.white,
@@ -26,31 +29,15 @@ const StyledButton = styles_1.styled(material_1.Button, {
26
29
  color: theme.palette.action.disabled,
27
30
  },
28
31
  },
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}`]: {
32
+ // For variant: text
33
+ [`&.${Button_1.buttonClasses.text}${Capitalize_1.default(color)}`]: {
47
34
  '&:hover': {
48
- backgroundColor: styles_1.alpha(theme.palette.primary.main, 0.1),
35
+ backgroundColor: styles_1.alpha(theme.palette[color].main, 0.1),
49
36
  },
50
37
  },
51
- [`&.${Button_1.buttonClasses.textSecondary}`]: {
38
+ [`&.${Button_1.buttonClasses.text}${Capitalize_1.default(color)}`]: {
52
39
  '&:hover': {
53
- backgroundColor: styles_1.alpha(theme.palette.secondary.main, 0.1),
40
+ backgroundColor: styles_1.alpha(theme.palette[color].main, 0.1),
54
41
  },
55
42
  },
56
43
  }));
@@ -6,6 +6,7 @@ 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
+ // self-defined-components
9
10
  const StyledButtonGroup = styles_1.styled(material_1.ButtonGroup)(({ theme }) => ({
10
11
  [`& .${ButtonGroup_1.buttonGroupClasses.groupedOutlinedPrimary}.${ButtonGroup_1.buttonGroupClasses.grouped}.${ButtonGroup_1.buttonGroupClasses.disabled}`]: {
11
12
  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,
@@ -52,7 +52,7 @@ const StyledOutlinedInput = styles_1.styled(material_1.OutlinedInput)(({ theme }
52
52
  },
53
53
  [`& .${OutlinedInput_1.outlinedInputClasses.input}`]: {
54
54
  color: theme.palette.text.primary,
55
- ['&:focus']: {
55
+ '&:focus': {
56
56
  background: 'rgba(0,0,0,0)',
57
57
  },
58
58
  },
@@ -61,7 +61,7 @@ const OutlinedSelect = ({ label, helperText, InputProps, SelectProps, className,
61
61
  const hasHelperText = !!helperText;
62
62
  return (react_1.default.createElement(StyledFormControl, { size: size, disabled: disabled, error: error, color: color, className: className },
63
63
  hasLabel && (react_1.default.createElement(StyledInputLabel, { color: color, shrink: hasShrink ? true : undefined }, label)),
64
- react_1.default.createElement(material_1.Select, Object.assign({ value: value, MenuProps: {
64
+ react_1.default.createElement(material_1.Select, Object.assign({ value: value, label: hasLabel ? label : undefined, MenuProps: {
65
65
  PaperProps: {
66
66
  sx: {
67
67
  maxHeight: paperMaxHeight,
@@ -48,7 +48,6 @@ function StandardSelect({ label, helperText, InputProps, SelectProps, className,
48
48
  PaperProps: {
49
49
  sx: {
50
50
  maxHeight: paperMaxHeight,
51
- top: '30px !important',
52
51
  },
53
52
  },
54
53
  anchorOrigin: {
@@ -9,8 +9,10 @@ const TextField_1 = require("@mui/material/TextField");
9
9
  const Input_1 = require("@mui/material/Input");
10
10
  const InputLabel_1 = require("@mui/material/InputLabel");
11
11
  const OutlinedInput_1 = require("@mui/material/OutlinedInput");
12
+ //utils
13
+ const Capitalize_1 = tslib_1.__importDefault(require("../../utils/Capitalize"));
12
14
  // self-defined-components
13
- const StyledTextField = styles_1.styled(material_1.TextField)(({ theme }) => ({
15
+ const StyledTextField = styles_1.styled(material_1.TextField)(({ color = 'primary', theme }) => ({
14
16
  [`& .${InputLabel_1.inputLabelClasses.error}`]: {
15
17
  [`&:not(.${InputLabel_1.inputLabelClasses.shrink})`]: {
16
18
  color: theme.palette.text.secondary,
@@ -24,11 +26,8 @@ const StyledTextField = styles_1.styled(material_1.TextField)(({ theme }) => ({
24
26
  },
25
27
  // For variant: standard | filled
26
28
  [`& .${Input_1.inputClasses.underline}:not(.${Input_1.inputClasses.disabled})`]: {
27
- [`&:hover:before`]: {
28
- borderColor: theme.palette.primary.main,
29
- },
30
- [`&.${Input_1.inputClasses.colorSecondary}:hover:before`]: {
31
- borderColor: theme.palette.secondary.main,
29
+ [`&.MuiInputBase-color${Capitalize_1.default(color)}:hover:before`]: {
30
+ borderColor: theme.palette[color].main,
32
31
  },
33
32
  },
34
33
  // For variant: outlined
@@ -39,11 +38,8 @@ const StyledTextField = styles_1.styled(material_1.TextField)(({ theme }) => ({
39
38
  borderColor: theme.palette.error.main,
40
39
  },
41
40
  [`&.${TextField_1.textFieldClasses.root} :not(.${Input_1.inputClasses.disabled}):not(.${Input_1.inputClasses.error})`]: {
42
- [`&:hover .${OutlinedInput_1.outlinedInputClasses.notchedOutline}`]: {
43
- borderColor: theme.palette.primary.main,
44
- },
45
- [`&.${Input_1.inputClasses.colorSecondary}:hover .${OutlinedInput_1.outlinedInputClasses.notchedOutline}`]: {
46
- borderColor: theme.palette.secondary.main,
41
+ [`&.MuiInputBase-color${Capitalize_1.default(color)}:hover .${OutlinedInput_1.outlinedInputClasses.notchedOutline}`]: {
42
+ borderColor: theme.palette[color].main,
47
43
  },
48
44
  },
49
45
  }));
@@ -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.4",
3
+ "version": "1.5.8",
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",