@junyiacademy/ui-test 1.5.3 → 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.
- package/declarations/libs/ui/src/utils/Capitalize.d.ts +1 -0
- package/dist/libs/ui/src/lib/button/Button.js +14 -28
- package/dist/libs/ui/src/lib/button-group/ButtonGroup.js +2 -0
- package/dist/libs/ui/src/lib/radio/Radio.js +1 -0
- package/dist/libs/ui/src/lib/select/OutlinedSelect.js +4 -4
- package/dist/libs/ui/src/lib/select/StandardSelect.js +0 -1
- package/dist/libs/ui/src/lib/topic-filter/TopicFilter.js +1 -1
- package/dist/libs/ui/src/utils/Capitalize.js +6 -0
- package/package.json +1 -1
|
@@ -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
|
-
|
|
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.
|
|
16
|
+
? theme.palette[color].main
|
|
15
17
|
: theme.palette.common.white,
|
|
16
|
-
color: active ? theme.palette.common.white : theme.palette.
|
|
17
|
-
borderColor: theme.palette.
|
|
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.
|
|
21
|
-
: styles_1.alpha(theme.palette.
|
|
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
|
-
|
|
30
|
-
|
|
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.
|
|
34
|
+
backgroundColor: styles_1.alpha(theme.palette[color].main, 0.1),
|
|
49
35
|
},
|
|
50
36
|
},
|
|
51
|
-
[`&.${Button_1.buttonClasses.
|
|
37
|
+
[`&.${Button_1.buttonClasses.text}${Capitalize_1.default(color)}`]: {
|
|
52
38
|
'&:hover': {
|
|
53
|
-
backgroundColor: styles_1.alpha(theme.palette.
|
|
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,
|
|
@@ -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
|
-
|
|
55
|
+
'&:focus': {
|
|
56
56
|
background: 'rgba(0,0,0,0)',
|
|
57
57
|
},
|
|
58
58
|
},
|
|
@@ -60,8 +60,8 @@ const StyledOutlinedInput = styles_1.styled(material_1.OutlinedInput)(({ theme }
|
|
|
60
60
|
const OutlinedSelect = ({ label, helperText, InputProps, SelectProps, className, children, color = 'primary', size = 'small', paperMaxHeight = 'auto', error = false, hasLabel = true, hasShrink = false, value = '', disabled = false, }) => {
|
|
61
61
|
const hasHelperText = !!helperText;
|
|
62
62
|
return (react_1.default.createElement(StyledFormControl, { size: size, disabled: disabled, error: error, color: color, className: className },
|
|
63
|
-
hasLabel && (react_1.default.createElement(StyledInputLabel, { color: color,
|
|
64
|
-
react_1.default.createElement(material_1.Select, Object.assign({ label: label
|
|
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, label: hasLabel ? label : undefined, MenuProps: {
|
|
65
65
|
PaperProps: {
|
|
66
66
|
sx: {
|
|
67
67
|
maxHeight: paperMaxHeight,
|
|
@@ -76,7 +76,7 @@ const OutlinedSelect = ({ label, helperText, InputProps, SelectProps, className,
|
|
|
76
76
|
vertical: 'top',
|
|
77
77
|
horizontal: 'left',
|
|
78
78
|
},
|
|
79
|
-
}, input: react_1.default.createElement(StyledOutlinedInput, Object.assign({ color: color, label: hasLabel ? label :
|
|
79
|
+
}, input: react_1.default.createElement(StyledOutlinedInput, Object.assign({ color: color, label: hasLabel ? label : undefined, disabled: disabled }, InputProps)) }, SelectProps), children),
|
|
80
80
|
hasHelperText && react_1.default.createElement(material_1.FormHelperText, null, helperText)));
|
|
81
81
|
};
|
|
82
82
|
exports.OutlinedSelect = OutlinedSelect;
|
|
@@ -107,7 +107,7 @@ const TopicFilter = ({ topicTree, onTopicSelected, isLastLayer, hasArrow, initSe
|
|
|
107
107
|
});
|
|
108
108
|
},
|
|
109
109
|
} },
|
|
110
|
-
react_1.default.createElement(SelectMenuItem_1.default, { disabled: true }, LABEL),
|
|
110
|
+
react_1.default.createElement(SelectMenuItem_1.default, { disabled: true, value: '' }, LABEL),
|
|
111
111
|
layeredTopic.childTopics.map((childTopic) => (react_1.default.createElement(SelectMenuItem_1.default, { key: childTopic.id, value: childTopic.id, "data-testid": `layered-menuitem-${layerNumber}`, "data-is-content-topic": childTopic.isContentTopic }, childTopic.title)))),
|
|
112
112
|
hasArrow && layerNumber !== layeredTopicList.length - 1 && (react_1.default.createElement(ArrowRightRounded_1.default, { sx: (theme) => ({
|
|
113
113
|
margin: theme.spacing(-1, -1.5),
|