@junyiacademy/ui-test 1.5.7 → 1.5.10
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/declarations/libs/ui/src/lib/menu-item/SelectMenuItem.d.ts +1 -2
- package/dist/libs/ui/src/lib/button/Button.js +1 -0
- package/dist/libs/ui/src/lib/button-group/ButtonGroup.js +0 -1
- package/dist/libs/ui/src/lib/menu-item/SelectMenuItem.js +13 -15
- package/dist/libs/ui/src/lib/select/OutlinedSelect.js +14 -12
- package/dist/libs/ui/src/lib/text-field/TextField.js +7 -11
- package/package.json +1 -1
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import { MenuItemProps } from '@mui/material';
|
|
3
2
|
export interface SelectMenuItemProps extends MenuItemProps {
|
|
4
3
|
value?: any;
|
|
5
4
|
disabled?: boolean;
|
|
6
5
|
}
|
|
7
|
-
declare const SelectMenuItem:
|
|
6
|
+
declare const SelectMenuItem: ({ children, value, disabled, ...otherProps }: SelectMenuItemProps) => JSX.Element;
|
|
8
7
|
export default SelectMenuItem;
|
|
@@ -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 Button_1 = require("@mui/material/Button");
|
|
9
|
+
//utils
|
|
9
10
|
const Capitalize_1 = tslib_1.__importDefault(require("../../utils/Capitalize"));
|
|
10
11
|
const StyledButton = styles_1.styled(material_1.Button, {
|
|
11
12
|
shouldForwardProp: (prop) => prop !== 'active',
|
|
@@ -6,7 +6,6 @@ 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
9
|
// self-defined-components
|
|
11
10
|
const StyledButtonGroup = styles_1.styled(material_1.ButtonGroup)(({ theme }) => ({
|
|
12
11
|
[`& .${ButtonGroup_1.buttonGroupClasses.groupedOutlinedPrimary}.${ButtonGroup_1.buttonGroupClasses.grouped}.${ButtonGroup_1.buttonGroupClasses.disabled}`]: {
|
|
@@ -2,21 +2,19 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
const react_1 = tslib_1.__importDefault(require("react"));
|
|
5
|
-
const styles_1 = require("@mui/material/styles");
|
|
6
5
|
const material_1 = require("@mui/material");
|
|
7
6
|
const MenuItem_1 = require("@mui/material/MenuItem");
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
});
|
|
7
|
+
const SelectMenuItem = (_a) => {
|
|
8
|
+
var { children, value = '', disabled = false } = _a, otherProps = tslib_1.__rest(_a, ["children", "value", "disabled"]);
|
|
9
|
+
return (react_1.default.createElement(material_1.MenuItem, Object.assign({ sx: (theme) => ({
|
|
10
|
+
whiteSpace: 'unset',
|
|
11
|
+
color: theme.palette.text.primary,
|
|
12
|
+
[`&.${MenuItem_1.menuItemClasses.selected}`]: {
|
|
13
|
+
backgroundColor: theme.palette.grey[300],
|
|
14
|
+
'&:hover': {
|
|
15
|
+
backgroundColor: theme.palette.grey[200],
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
}), value: value }, otherProps), children));
|
|
19
|
+
};
|
|
22
20
|
exports.default = SelectMenuItem;
|
|
@@ -5,19 +5,10 @@ const tslib_1 = require("tslib");
|
|
|
5
5
|
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
|
+
const FormHelperText_1 = require("@mui/material/FormHelperText");
|
|
8
9
|
const InputLabel_1 = require("@mui/material/InputLabel");
|
|
9
10
|
const OutlinedInput_1 = require("@mui/material/OutlinedInput");
|
|
10
11
|
const InputBase_1 = require("@mui/material/InputBase");
|
|
11
|
-
const StyledFormControl = styles_1.styled(material_1.FormControl, {
|
|
12
|
-
shouldForwardProp: (prop) => prop !== 'color',
|
|
13
|
-
})(({ color, theme }) => ({
|
|
14
|
-
backgroundColor: 'white',
|
|
15
|
-
'&:hover': {
|
|
16
|
-
[`& :not(.${OutlinedInput_1.outlinedInputClasses.disabled}):not(.${OutlinedInput_1.outlinedInputClasses.error}) .${OutlinedInput_1.outlinedInputClasses.notchedOutline}`]: {
|
|
17
|
-
borderColor: theme.palette[color].main,
|
|
18
|
-
},
|
|
19
|
-
},
|
|
20
|
-
}));
|
|
21
12
|
const StyledInputLabel = styles_1.styled(material_1.InputLabel, {
|
|
22
13
|
shouldForwardProp: (prop) => prop !== 'color',
|
|
23
14
|
})(({ color, theme }) => ({
|
|
@@ -59,7 +50,14 @@ const StyledOutlinedInput = styles_1.styled(material_1.OutlinedInput)(({ theme }
|
|
|
59
50
|
}));
|
|
60
51
|
const OutlinedSelect = ({ label, helperText, InputProps, SelectProps, className, children, color = 'primary', size = 'small', paperMaxHeight = 'auto', error = false, hasLabel = true, hasShrink = false, value = '', disabled = false, }) => {
|
|
61
52
|
const hasHelperText = !!helperText;
|
|
62
|
-
return (react_1.default.createElement(
|
|
53
|
+
return (react_1.default.createElement(material_1.FormControl, { sx: (theme) => ({
|
|
54
|
+
backgroundColor: 'white',
|
|
55
|
+
'&:hover': {
|
|
56
|
+
[`& :not(.${OutlinedInput_1.outlinedInputClasses.disabled}):not(.${OutlinedInput_1.outlinedInputClasses.error}) .${OutlinedInput_1.outlinedInputClasses.notchedOutline}`]: {
|
|
57
|
+
borderColor: theme.palette[color].main,
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
}), size: size, disabled: disabled, error: error, color: color, className: className },
|
|
63
61
|
hasLabel && (react_1.default.createElement(StyledInputLabel, { color: color, shrink: hasShrink ? true : undefined }, label)),
|
|
64
62
|
react_1.default.createElement(material_1.Select, Object.assign({ value: value, label: hasLabel ? label : undefined, MenuProps: {
|
|
65
63
|
PaperProps: {
|
|
@@ -77,7 +75,11 @@ const OutlinedSelect = ({ label, helperText, InputProps, SelectProps, className,
|
|
|
77
75
|
horizontal: 'left',
|
|
78
76
|
},
|
|
79
77
|
}, input: react_1.default.createElement(StyledOutlinedInput, Object.assign({ color: color, label: hasLabel ? label : undefined, disabled: disabled }, InputProps)) }, SelectProps), children),
|
|
80
|
-
hasHelperText && react_1.default.createElement(material_1.FormHelperText,
|
|
78
|
+
hasHelperText && (react_1.default.createElement(material_1.FormHelperText, { sx: {
|
|
79
|
+
[`&.${FormHelperText_1.formHelperTextClasses.root}`]: {
|
|
80
|
+
marginLeft: 0,
|
|
81
|
+
},
|
|
82
|
+
} }, helperText))));
|
|
81
83
|
};
|
|
82
84
|
exports.OutlinedSelect = OutlinedSelect;
|
|
83
85
|
exports.default = exports.OutlinedSelect;
|
|
@@ -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
|
-
[
|
|
28
|
-
borderColor: theme.palette.
|
|
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
|
-
[
|
|
43
|
-
borderColor: theme.palette.
|
|
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
|
}));
|