@junyiacademy/ui-test 1.4.2 → 1.5.0
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/interfaces/index.d.ts +2 -1
- package/declarations/libs/ui/src/lib/button/Button.d.ts +1 -1
- package/declarations/libs/ui/src/lib/button-group/ButtonGroup.d.ts +1 -1
- package/declarations/libs/ui/src/lib/menu-item/SelectMenuItem.d.ts +2 -2
- package/declarations/libs/ui/src/lib/radio/Radio.d.ts +1 -1
- package/declarations/libs/ui/src/lib/text-field/TextField.d.ts +1 -1
- package/dist/libs/ui/src/lib/button/Button.js +15 -24
- package/dist/libs/ui/src/lib/button-group/ButtonGroup.js +10 -19
- package/dist/libs/ui/src/lib/menu-item/SelectMenuItem.js +6 -10
- package/dist/libs/ui/src/lib/radio/Radio.js +15 -26
- package/dist/libs/ui/src/lib/select/OutlinedSelect.js +41 -79
- package/dist/libs/ui/src/lib/select/StandardSelect.js +34 -58
- package/dist/libs/ui/src/lib/text-field/TextField.js +26 -38
- package/dist/libs/ui/src/lib/topic-filter/TopicFilter.js +18 -22
- package/package.json +6 -3
- package/dist/libs/.DS_Store +0 -0
- package/dist/libs/ui/.DS_Store +0 -0
- package/dist/libs/ui/src/.DS_Store +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ChangeEvent } from 'react';
|
|
2
|
-
import { SelectProps as MuiSelectProp, InputProps as MuiInputProps, OutlinedInputProps } from '@material
|
|
2
|
+
import { SelectProps as MuiSelectProp, InputProps as MuiInputProps, OutlinedInputProps } from '@mui/material';
|
|
3
3
|
export interface ITopicTreeNode {
|
|
4
4
|
childTopics: ITopicTreeNode[];
|
|
5
5
|
id: string;
|
|
@@ -23,4 +23,5 @@ export interface SelectProps extends MuiSelectProp {
|
|
|
23
23
|
hasShrink?: boolean;
|
|
24
24
|
disabled?: boolean;
|
|
25
25
|
className?: string;
|
|
26
|
+
otherProps?: any;
|
|
26
27
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { ButtonGroupProps as MuiButtonGroupProps } from '@material
|
|
1
|
+
import { ButtonGroupProps as MuiButtonGroupProps } from '@mui/material';
|
|
2
2
|
export declare const ButtonGroup: ({ children, ...otherProps }: MuiButtonGroupProps) => JSX.Element;
|
|
3
3
|
export default ButtonGroup;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { MenuItemProps } from '@material
|
|
2
|
+
import { MenuItemProps } from '@mui/material';
|
|
3
3
|
export interface SelectMenuItemProps extends MenuItemProps {
|
|
4
4
|
value?: any;
|
|
5
5
|
disabled?: boolean;
|
|
6
6
|
}
|
|
7
|
-
declare const SelectMenuItem: React.ForwardRefExoticComponent<Pick<React.PropsWithChildren<SelectMenuItemProps>, "classes" | "
|
|
7
|
+
declare const SelectMenuItem: React.ForwardRefExoticComponent<Pick<React.PropsWithChildren<SelectMenuItemProps>, "classes" | "value" | "onChange" | "children" | "onKeyUp" | "onKeyDown" | "onBlur" | "onFocus" | "defaultValue" | "defaultChecked" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "slot" | "spellCheck" | "style" | "tabIndex" | "title" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocusCapture" | "onBlurCapture" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "autoFocus" | "disabled" | "sx" | "key" | "action" | "dense" | "selected" | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "TouchRippleProps" | "disableGutters" | "divider"> & React.RefAttributes<HTMLLIElement>>;
|
|
8
8
|
export default SelectMenuItem;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RadioProps as MuiRadioProps, FormControlLabelProps } from '@material
|
|
1
|
+
import { RadioProps as MuiRadioProps, FormControlLabelProps } from '@mui/material';
|
|
2
2
|
export interface RadioProps extends FormControlLabelProps {
|
|
3
3
|
color?: 'primary' | 'secondary' | 'default';
|
|
4
4
|
size?: 'medium' | 'small';
|
|
@@ -3,22 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.Button = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const react_1 = tslib_1.__importDefault(require("react"));
|
|
6
|
-
const styles_1 = require("@material
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
outlinedPrimary: `${PREFIX}-outlinedPrimary`,
|
|
12
|
-
outlinedSecondary: `${PREFIX}-outlinedSecondary`,
|
|
13
|
-
textPrimary: `${PREFIX}-textPrimary`,
|
|
14
|
-
textSecondary: `${PREFIX}-textSecondary`,
|
|
15
|
-
disabled: `${PREFIX}-disabled`,
|
|
16
|
-
};
|
|
17
|
-
const StyledButton = styles_1.styled((_a) => {
|
|
18
|
-
var { active: _active } = _a, other = tslib_1.__rest(_a, ["active"]);
|
|
19
|
-
return (react_1.default.createElement(core_1.Button, Object.assign({ classes: classes }, other)));
|
|
6
|
+
const styles_1 = require("@mui/material/styles");
|
|
7
|
+
const material_1 = require("@mui/material");
|
|
8
|
+
const Button_1 = require("@mui/material/Button");
|
|
9
|
+
const StyledButton = styles_1.styled(material_1.Button, {
|
|
10
|
+
shouldForwardProp: (prop) => prop !== 'active',
|
|
20
11
|
})(({ active, theme }) => ({
|
|
21
|
-
[`&.${
|
|
12
|
+
[`&.${Button_1.buttonClasses.outlinedPrimary}`]: {
|
|
22
13
|
backgroundColor: active
|
|
23
14
|
? theme.palette.primary.main
|
|
24
15
|
: theme.palette.common.white,
|
|
@@ -27,15 +18,15 @@ const StyledButton = styles_1.styled((_a) => {
|
|
|
27
18
|
'&:hover': {
|
|
28
19
|
backgroundColor: active
|
|
29
20
|
? theme.palette.primary.main
|
|
30
|
-
: styles_1.
|
|
21
|
+
: styles_1.alpha(theme.palette.primary.main, 0.1),
|
|
31
22
|
},
|
|
32
|
-
[`&.${
|
|
23
|
+
[`&.${Button_1.buttonClasses.disabled}`]: {
|
|
33
24
|
backgroundColor: theme.palette.common.white,
|
|
34
25
|
borderColor: theme.palette.action.disabledBackground,
|
|
35
26
|
color: theme.palette.action.disabled,
|
|
36
27
|
},
|
|
37
28
|
},
|
|
38
|
-
[`&.${
|
|
29
|
+
[`&.${Button_1.buttonClasses.outlinedSecondary}`]: {
|
|
39
30
|
backgroundColor: active
|
|
40
31
|
? theme.palette.secondary.main
|
|
41
32
|
: theme.palette.common.white,
|
|
@@ -44,22 +35,22 @@ const StyledButton = styles_1.styled((_a) => {
|
|
|
44
35
|
'&:hover': {
|
|
45
36
|
backgroundColor: active
|
|
46
37
|
? theme.palette.secondary.main
|
|
47
|
-
: styles_1.
|
|
38
|
+
: styles_1.alpha(theme.palette.secondary.main, 0.1),
|
|
48
39
|
},
|
|
49
|
-
[`&.${
|
|
40
|
+
[`&.${Button_1.buttonClasses.disabled}`]: {
|
|
50
41
|
backgroundColor: theme.palette.common.white,
|
|
51
42
|
borderColor: theme.palette.action.disabledBackground,
|
|
52
43
|
color: theme.palette.action.disabled,
|
|
53
44
|
},
|
|
54
45
|
},
|
|
55
|
-
[`&.${
|
|
46
|
+
[`&.${Button_1.buttonClasses.textPrimary}`]: {
|
|
56
47
|
'&:hover': {
|
|
57
|
-
backgroundColor: styles_1.
|
|
48
|
+
backgroundColor: styles_1.alpha(theme.palette.primary.main, 0.1),
|
|
58
49
|
},
|
|
59
50
|
},
|
|
60
|
-
[`&.${
|
|
51
|
+
[`&.${Button_1.buttonClasses.textSecondary}`]: {
|
|
61
52
|
'&:hover': {
|
|
62
|
-
backgroundColor: styles_1.
|
|
53
|
+
backgroundColor: styles_1.alpha(theme.palette.secondary.main, 0.1),
|
|
63
54
|
},
|
|
64
55
|
},
|
|
65
56
|
}));
|
|
@@ -3,26 +3,17 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.ButtonGroup = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const react_1 = tslib_1.__importDefault(require("react"));
|
|
6
|
-
const styles_1 = require("@material
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
grouped:
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
disabled: `${PREFIX}-disabled`,
|
|
14
|
-
};
|
|
15
|
-
const StyledButtonGroup = styles_1.styled((_a) => {
|
|
16
|
-
var props = tslib_1.__rest(_a, []);
|
|
17
|
-
return (react_1.default.createElement(core_1.ButtonGroup, Object.assign({ classes: classes }, props)));
|
|
18
|
-
})(({ theme }) => ({
|
|
19
|
-
[`& .${classes.groupedOutlinedPrimary}.${classes.grouped}.${classes.disabled}`]: {
|
|
20
|
-
borderColor: styles_1.fade(theme.palette.primary.main, 0.5),
|
|
21
|
-
color: styles_1.fade(theme.palette.primary.main, 0.5),
|
|
6
|
+
const styles_1 = require("@mui/material/styles");
|
|
7
|
+
const material_1 = require("@mui/material");
|
|
8
|
+
const ButtonGroup_1 = require("@mui/material/ButtonGroup");
|
|
9
|
+
const StyledButtonGroup = styles_1.styled(material_1.ButtonGroup)(({ theme }) => ({
|
|
10
|
+
[`& .${ButtonGroup_1.buttonGroupClasses.groupedOutlinedPrimary}.${ButtonGroup_1.buttonGroupClasses.grouped}.${ButtonGroup_1.buttonGroupClasses.disabled}`]: {
|
|
11
|
+
borderColor: styles_1.alpha(theme.palette.primary.main, 0.5),
|
|
12
|
+
color: styles_1.alpha(theme.palette.primary.main, 0.5),
|
|
22
13
|
},
|
|
23
|
-
[`& .${
|
|
24
|
-
borderColor: styles_1.
|
|
25
|
-
color: styles_1.
|
|
14
|
+
[`& .${ButtonGroup_1.buttonGroupClasses.groupedOutlinedSecondary}.${ButtonGroup_1.buttonGroupClasses.grouped}.${ButtonGroup_1.buttonGroupClasses.disabled}`]: {
|
|
15
|
+
borderColor: styles_1.alpha(theme.palette.secondary.main, 0.5),
|
|
16
|
+
color: styles_1.alpha(theme.palette.secondary.main, 0.5),
|
|
26
17
|
},
|
|
27
18
|
}));
|
|
28
19
|
const ButtonGroup = (_a) => {
|
|
@@ -2,17 +2,13 @@
|
|
|
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("@material
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
const
|
|
9
|
-
const classes = {
|
|
10
|
-
menuItemSelected: `${PREFIX}-menuItemSelected`,
|
|
11
|
-
};
|
|
12
|
-
const StyledMenuItem = styles_1.styled((props) => (react_1.default.createElement(core_1.MenuItem, Object.assign({ classes: { selected: classes.menuItemSelected } }, props))))(({ theme }) => ({
|
|
5
|
+
const styles_1 = require("@mui/material/styles");
|
|
6
|
+
const material_1 = require("@mui/material");
|
|
7
|
+
const MenuItem_1 = require("@mui/material/MenuItem");
|
|
8
|
+
const StyledMenuItem = styles_1.styled(material_1.MenuItem)(({ theme }) => ({
|
|
13
9
|
whiteSpace: 'unset',
|
|
14
10
|
color: theme.palette.text.primary,
|
|
15
|
-
[`&.${
|
|
11
|
+
[`&.${MenuItem_1.menuItemClasses.selected}`]: {
|
|
16
12
|
backgroundColor: theme.palette.grey[300],
|
|
17
13
|
'&:hover': {
|
|
18
14
|
backgroundColor: theme.palette.grey[200],
|
|
@@ -21,6 +17,6 @@ const StyledMenuItem = styles_1.styled((props) => (react_1.default.createElement
|
|
|
21
17
|
}));
|
|
22
18
|
const SelectMenuItem = react_1.default.forwardRef((_a, ref) => {
|
|
23
19
|
var { children, value = '' } = _a, otherProps = tslib_1.__rest(_a, ["children", "value"]);
|
|
24
|
-
return (react_1.default.createElement(StyledMenuItem, Object.assign({
|
|
20
|
+
return (react_1.default.createElement(StyledMenuItem, Object.assign({ value: value }, otherProps), children));
|
|
25
21
|
});
|
|
26
22
|
exports.default = SelectMenuItem;
|
|
@@ -3,41 +3,30 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.Radio = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const react_1 = tslib_1.__importDefault(require("react"));
|
|
6
|
-
const styles_1 = require("@material
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
radioChecked: `${PREFIX}-radio-checked`,
|
|
13
|
-
};
|
|
14
|
-
const StyledFormControlLabel = styles_1.styled((props) => (react_1.default.createElement(core_1.FormControlLabel, Object.assign({ classes: {
|
|
15
|
-
label: classes.formControlLabel,
|
|
16
|
-
disabled: classes.formControlDisabled,
|
|
17
|
-
} }, props))))(({ theme }) => ({
|
|
18
|
-
[`& .${classes.formControlLabel}`]: {
|
|
6
|
+
const styles_1 = require("@mui/material/styles");
|
|
7
|
+
const material_1 = require("@mui/material");
|
|
8
|
+
const FormControlLabel_1 = require("@mui/material/FormControlLabel");
|
|
9
|
+
const Radio_1 = require("@mui/material/Radio");
|
|
10
|
+
const StyledFormControlLabel = styles_1.styled(material_1.FormControlLabel)(({ theme }) => ({
|
|
11
|
+
[`& .${FormControlLabel_1.formControlLabelClasses.label}`]: {
|
|
19
12
|
color: theme.palette.text.secondary,
|
|
20
|
-
[`&.${
|
|
13
|
+
[`&.${FormControlLabel_1.formControlLabelClasses.disabled}`]: {
|
|
21
14
|
color: theme.palette.text.disabled,
|
|
22
15
|
},
|
|
23
16
|
},
|
|
24
|
-
[`& .${
|
|
17
|
+
[`& .${Radio_1.radioClasses.checked} + .${FormControlLabel_1.formControlLabelClasses.label}`]: {
|
|
25
18
|
color: theme.palette.text.primary,
|
|
26
19
|
},
|
|
27
20
|
}));
|
|
28
|
-
const StyledRadio = styles_1.styled((props) => (react_1.default.createElement(core_1.Radio, Object.assign({ classes: {
|
|
29
|
-
checked: classes.radioChecked,
|
|
30
|
-
} }, props))))(({ theme }) => ({
|
|
31
|
-
color: theme.palette.text.primary,
|
|
32
|
-
}));
|
|
33
|
-
const StyledTypography = styles_1.styled(core_1.Typography)(({ theme }) => ({
|
|
34
|
-
color: theme.palette.text.disabled,
|
|
35
|
-
margin: '0 0 0 30px',
|
|
36
|
-
}));
|
|
37
21
|
const Radio = ({ checked, disabled, label, labelPlacement, value, formControlLabelProps, radioProps, color = 'secondary', size = 'medium', caption = '', }) => {
|
|
38
22
|
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
39
|
-
react_1.default.createElement(StyledFormControlLabel, Object.assign({ control: react_1.default.createElement(
|
|
40
|
-
|
|
23
|
+
react_1.default.createElement(StyledFormControlLabel, Object.assign({ control: react_1.default.createElement(material_1.Radio, Object.assign({ sx: (theme) => ({
|
|
24
|
+
color: theme.palette.text.primary,
|
|
25
|
+
}), color: color, size: size }, radioProps)), checked: checked, disabled: disabled, label: label, labelPlacement: labelPlacement, value: value }, formControlLabelProps)),
|
|
26
|
+
caption && (react_1.default.createElement(material_1.Typography, { sx: (theme) => ({
|
|
27
|
+
color: theme.palette.text.disabled,
|
|
28
|
+
margin: '0 0 0 30px',
|
|
29
|
+
}), variant: 'body2' }, caption))));
|
|
41
30
|
};
|
|
42
31
|
exports.Radio = Radio;
|
|
43
32
|
exports.default = exports.Radio;
|
|
@@ -3,119 +3,81 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.OutlinedSelect = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const react_1 = tslib_1.__importDefault(require("react"));
|
|
6
|
-
const styles_1 = require("@material
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
inputLabelMarginDense: `${PREFIX}-inputLabelMarginDense`,
|
|
14
|
-
inputLabelShrink: `${PREFIX}-inputLabelShrink`,
|
|
15
|
-
inputLabelError: `${PREFIX}-inputLabelError`,
|
|
16
|
-
inputLabelDisabled: `${PREFIX}-inputLabelDisabled`,
|
|
17
|
-
outlineInputInput: `${PREFIX}-input`,
|
|
18
|
-
outlineInputRoot: `${PREFIX}-inputRoot`,
|
|
19
|
-
outlineInputInputMarginDense: `${PREFIX}-inputMarginDense`,
|
|
20
|
-
outlineInputNotchedOutline: `${PREFIX}-notchedOutline`,
|
|
21
|
-
outlineInputDisabled: `${PREFIX}-inputDisabled`,
|
|
22
|
-
outlineInputError: `${PREFIX}-outlinedInputError`,
|
|
23
|
-
outlineInputFocused: `${PREFIX}-focused`,
|
|
24
|
-
selectPaper: `${PREFIX}-menuPaper`,
|
|
25
|
-
};
|
|
26
|
-
const StyledFormControl = styles_1.styled((_a) => {
|
|
27
|
-
var { color: _color } = _a, props = tslib_1.__rest(_a, ["color"]);
|
|
28
|
-
return (react_1.default.createElement(core_1.FormControl, Object.assign({}, props)));
|
|
6
|
+
const styles_1 = require("@mui/material/styles");
|
|
7
|
+
const material_1 = require("@mui/material");
|
|
8
|
+
const InputLabel_1 = require("@mui/material/InputLabel");
|
|
9
|
+
const OutlinedInput_1 = require("@mui/material/OutlinedInput");
|
|
10
|
+
const InputBase_1 = require("@mui/material/InputBase");
|
|
11
|
+
const StyledFormControl = styles_1.styled(material_1.FormControl, {
|
|
12
|
+
shouldForwardProp: (prop) => prop !== 'color',
|
|
29
13
|
})(({ color, theme }) => ({
|
|
30
14
|
backgroundColor: 'white',
|
|
31
15
|
'&:hover': {
|
|
32
|
-
[`& :not(.${
|
|
16
|
+
[`& :not(.${OutlinedInput_1.outlinedInputClasses.disabled}):not(.${OutlinedInput_1.outlinedInputClasses.error}) .${OutlinedInput_1.outlinedInputClasses.notchedOutline}`]: {
|
|
33
17
|
borderColor: theme.palette[color].main,
|
|
34
18
|
},
|
|
35
19
|
},
|
|
36
20
|
}));
|
|
37
|
-
const StyledInputLabel = styles_1.styled(
|
|
38
|
-
|
|
39
|
-
return (react_1.default.createElement(core_1.InputLabel, Object.assign({ classes: {
|
|
40
|
-
outlined: classes.inputLabelOutlined,
|
|
41
|
-
marginDense: classes.inputLabelMarginDense,
|
|
42
|
-
shrink: classes.inputLabelShrink,
|
|
43
|
-
focused: classes.inputLabelFocused,
|
|
44
|
-
disabled: classes.inputLabelDisabled,
|
|
45
|
-
error: classes.inputLabelError,
|
|
46
|
-
} }, props)));
|
|
21
|
+
const StyledInputLabel = styles_1.styled(material_1.InputLabel, {
|
|
22
|
+
shouldForwardProp: (prop) => prop !== 'color',
|
|
47
23
|
})(({ color, theme }) => ({
|
|
48
24
|
color: theme.palette.text.secondary,
|
|
49
|
-
[`&.${
|
|
50
|
-
[`&:not(.${
|
|
25
|
+
[`&.${InputLabel_1.inputLabelClasses.outlined}`]: {
|
|
26
|
+
[`&:not(.${InputLabel_1.inputLabelClasses.disabled}) .${InputLabel_1.inputLabelClasses.focused}`]: {
|
|
51
27
|
color: theme.palette.action.active,
|
|
52
28
|
},
|
|
53
|
-
[`&.${
|
|
54
|
-
transform: 'translate(12px,
|
|
29
|
+
[`&.${InputLabel_1.inputLabelClasses.sizeSmall}:not(.${InputLabel_1.inputLabelClasses.shrink})`]: {
|
|
30
|
+
transform: 'translate(12px, 12px) scale(1)',
|
|
55
31
|
},
|
|
56
32
|
},
|
|
57
|
-
[`&.${
|
|
33
|
+
[`&.${InputLabel_1.inputLabelClasses.shrink}:not(.${InputLabel_1.inputLabelClasses.error}):not(.${InputLabel_1.inputLabelClasses.disabled}).${InputLabel_1.inputLabelClasses.focused}`]: {
|
|
58
34
|
color: theme.palette[color].main,
|
|
59
35
|
},
|
|
60
|
-
[`&.${
|
|
36
|
+
[`&.${InputLabel_1.inputLabelClasses.shrink}`]: {
|
|
61
37
|
backgroundColor: '#ffffff',
|
|
62
38
|
padding: '0 2px',
|
|
63
39
|
},
|
|
64
40
|
}));
|
|
65
|
-
const StyledOutlinedInput = styles_1.styled((
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
notchedOutline:
|
|
71
|
-
disabled: classes.outlineInputDisabled,
|
|
72
|
-
error: classes.outlineInputError,
|
|
73
|
-
} }, props))))(({ theme }) => ({
|
|
74
|
-
[`&.${classes.outlineInputRoot}`]: {
|
|
75
|
-
[`&.${classes.outlineInputError}.${classes.outlineInputFocused} .${classes.outlineInputNotchedOutline}`]: {
|
|
41
|
+
const StyledOutlinedInput = styles_1.styled(material_1.OutlinedInput)(({ theme }) => ({
|
|
42
|
+
[`&.${OutlinedInput_1.outlinedInputClasses.root}`]: {
|
|
43
|
+
[`&.${InputBase_1.inputBaseClasses.sizeSmall}`]: {
|
|
44
|
+
height: 48,
|
|
45
|
+
},
|
|
46
|
+
[`&.${OutlinedInput_1.outlinedInputClasses.error}.${OutlinedInput_1.outlinedInputClasses.focused} .${OutlinedInput_1.outlinedInputClasses.notchedOutline}`]: {
|
|
76
47
|
borderColor: `${theme.palette.error.main}`,
|
|
77
48
|
},
|
|
78
|
-
[`& .${
|
|
49
|
+
[`& .${InputBase_1.inputBaseClasses.inputSizeSmall}`]: {
|
|
79
50
|
padding: '14.5px 15px 14.5px 12px',
|
|
80
51
|
},
|
|
81
52
|
},
|
|
82
|
-
[`& .${
|
|
53
|
+
[`& .${OutlinedInput_1.outlinedInputClasses.input}`]: {
|
|
83
54
|
color: theme.palette.text.primary,
|
|
84
55
|
['&:focus']: {
|
|
85
56
|
background: 'rgba(0,0,0,0)',
|
|
86
57
|
},
|
|
87
58
|
},
|
|
88
59
|
}));
|
|
89
|
-
const StyledSelect = styles_1.styled((_a) => {
|
|
90
|
-
var { paperMaxHeight: _paperMaxHeight, hasAdornment: _hasAdornment, className } = _a, props = tslib_1.__rest(_a, ["paperMaxHeight", "hasAdornment", "className"]);
|
|
91
|
-
return (react_1.default.createElement(core_1.Select, Object.assign({ MenuProps: {
|
|
92
|
-
disableAutoFocusItem: true,
|
|
93
|
-
anchorOrigin: {
|
|
94
|
-
vertical: 2,
|
|
95
|
-
horizontal: 'left',
|
|
96
|
-
},
|
|
97
|
-
transformOrigin: {
|
|
98
|
-
vertical: 'top',
|
|
99
|
-
horizontal: 'left',
|
|
100
|
-
},
|
|
101
|
-
getContentAnchorEl: null,
|
|
102
|
-
classes: {
|
|
103
|
-
paper: className,
|
|
104
|
-
},
|
|
105
|
-
} }, props)));
|
|
106
|
-
})(({ hasAdornment, paperMaxHeight }) => ({
|
|
107
|
-
'&': {
|
|
108
|
-
maxHeight: paperMaxHeight,
|
|
109
|
-
left: hasAdornment ? '24px !important' : '70px',
|
|
110
|
-
},
|
|
111
|
-
}));
|
|
112
60
|
const OutlinedSelect = ({ placeholder, helperText, InputProps, SelectProps, className, children, color = 'primary', size = 'small', paperMaxHeight = 'auto', error = false, hasLabel = true, hasShrink = false, value = '', disabled = false, }) => {
|
|
113
|
-
const hasAdornment = !!(InputProps === null || InputProps === void 0 ? void 0 : InputProps.startAdornment);
|
|
114
61
|
const hasHelperText = !!helperText;
|
|
115
62
|
return (react_1.default.createElement(StyledFormControl, { size: size, disabled: disabled, error: error, color: color, className: className },
|
|
116
63
|
hasLabel && (react_1.default.createElement(StyledInputLabel, { color: color, variant: 'outlined', shrink: hasShrink ? true : undefined }, placeholder)),
|
|
117
|
-
react_1.default.createElement(
|
|
118
|
-
|
|
64
|
+
react_1.default.createElement(material_1.Select, Object.assign({ value: value, MenuProps: {
|
|
65
|
+
PaperProps: {
|
|
66
|
+
sx: {
|
|
67
|
+
maxHeight: paperMaxHeight,
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
disableAutoFocusItem: true,
|
|
71
|
+
anchorOrigin: {
|
|
72
|
+
vertical: 2,
|
|
73
|
+
horizontal: 'left',
|
|
74
|
+
},
|
|
75
|
+
transformOrigin: {
|
|
76
|
+
vertical: 'top',
|
|
77
|
+
horizontal: 'left',
|
|
78
|
+
},
|
|
79
|
+
}, input: react_1.default.createElement(StyledOutlinedInput, Object.assign({ color: color, label: hasLabel ? placeholder : undefined, disabled: disabled }, InputProps)) }, SelectProps), children),
|
|
80
|
+
hasHelperText && react_1.default.createElement(material_1.FormHelperText, null, helperText)));
|
|
119
81
|
};
|
|
120
82
|
exports.OutlinedSelect = OutlinedSelect;
|
|
121
83
|
exports.default = exports.OutlinedSelect;
|
|
@@ -3,88 +3,64 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.StandardSelect = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const react_1 = tslib_1.__importDefault(require("react"));
|
|
6
|
-
const styles_1 = require("@material
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
inputLabelMarginDense: `${PREFIX}-inputLabelMarginDense`,
|
|
13
|
-
inputLabelError: `${PREFIX}-inputLabelError`,
|
|
14
|
-
inputFocused: `${PREFIX}-inputFocused`,
|
|
15
|
-
inputInput: `${PREFIX}-input`,
|
|
16
|
-
inputUnderline: `${PREFIX}-inputUnderline`,
|
|
17
|
-
inputError: `${PREFIX}-inputError`,
|
|
18
|
-
inputDisabled: `${PREFIX}-inputDisabled`,
|
|
19
|
-
inputAdornmentRoot: `${PREFIX}-inputAdornmentRoot`,
|
|
20
|
-
selectPaper: `${PREFIX}-menuPaper`,
|
|
21
|
-
selectDisabled: `${PREFIX}-selectDisabled`,
|
|
22
|
-
};
|
|
23
|
-
const StyledInputLabel = styles_1.styled((_a) => {
|
|
24
|
-
var { color: _color } = _a, props = tslib_1.__rest(_a, ["color"]);
|
|
25
|
-
return (react_1.default.createElement(core_1.InputLabel, Object.assign({ classes: {
|
|
26
|
-
focused: classes.inputLabelFocused,
|
|
27
|
-
error: classes.inputLabelError,
|
|
28
|
-
} }, props)));
|
|
6
|
+
const styles_1 = require("@mui/material/styles");
|
|
7
|
+
const material_1 = require("@mui/material");
|
|
8
|
+
const InputLabel_1 = require("@mui/material/InputLabel");
|
|
9
|
+
const Input_1 = require("@mui/material/Input");
|
|
10
|
+
const StyledInputLabel = styles_1.styled(material_1.InputLabel, {
|
|
11
|
+
shouldForwardProp: (prop) => prop !== 'color',
|
|
29
12
|
})(({ color, theme }) => ({
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
13
|
+
[`&.${InputLabel_1.inputLabelClasses.root}`]: {
|
|
14
|
+
color: theme.palette.text.disabled,
|
|
15
|
+
},
|
|
16
|
+
[`&.${InputLabel_1.inputLabelClasses.focused}`]: {
|
|
33
17
|
color: theme.palette[color].main,
|
|
34
18
|
},
|
|
35
|
-
[`&.${
|
|
19
|
+
[`&.${InputLabel_1.inputLabelClasses.error}`]: {
|
|
36
20
|
color: theme.palette.error.main,
|
|
37
21
|
},
|
|
38
22
|
}));
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
return (react_1.default.createElement(core_1.Select, Object.assign({ MenuProps: {
|
|
42
|
-
classes: { paper: className },
|
|
43
|
-
transformOrigin: {
|
|
44
|
-
vertical: 'top',
|
|
45
|
-
horizontal: 'left',
|
|
46
|
-
},
|
|
47
|
-
getContentAnchorEl: null,
|
|
48
|
-
} }, props)));
|
|
49
|
-
})(({ hasAdornment, paperMaxHeight }) => ({
|
|
50
|
-
'&&': {
|
|
51
|
-
maxHeight: paperMaxHeight,
|
|
52
|
-
left: hasAdornment ? '48px !important' : '70px',
|
|
53
|
-
},
|
|
54
|
-
}));
|
|
55
|
-
const StyledInput = styles_1.styled((_a) => {
|
|
56
|
-
var { color: _color } = _a, props = tslib_1.__rest(_a, ["color"]);
|
|
57
|
-
return (react_1.default.createElement(core_1.Input, Object.assign({ classes: {
|
|
58
|
-
input: classes.inputInput,
|
|
59
|
-
disabled: classes.inputDisabled,
|
|
60
|
-
underline: classes.inputUnderline,
|
|
61
|
-
error: classes.inputError,
|
|
62
|
-
} }, props)));
|
|
23
|
+
const StyledInput = styles_1.styled(material_1.Input, {
|
|
24
|
+
shouldForwardProp: (prop) => prop !== 'color',
|
|
63
25
|
})(({ color, theme }) => ({
|
|
64
26
|
color: theme.palette.text.primary,
|
|
65
|
-
[`& .${
|
|
27
|
+
[`& .${Input_1.inputClasses.input}`]: {
|
|
66
28
|
'&:focus': {
|
|
67
29
|
background: 'rgba(0,0,0,0)',
|
|
68
30
|
},
|
|
69
31
|
},
|
|
70
|
-
[`&.${
|
|
32
|
+
[`&.${Input_1.inputClasses.underline}:not(.${Input_1.inputClasses.disabled}):not(.${Input_1.inputClasses.error})`]: {
|
|
71
33
|
'&:after,&:hover:before': {
|
|
72
34
|
borderBottomColor: theme.palette[color].main,
|
|
73
35
|
},
|
|
74
36
|
},
|
|
75
|
-
[`&.${
|
|
37
|
+
[`&.${Input_1.inputClasses.underline}.${Input_1.inputClasses.error}:not(.${Input_1.inputClasses.disabled})`]: {
|
|
76
38
|
'&:after,&:hover:before': {
|
|
77
39
|
borderBottomColor: theme.palette.error.main,
|
|
78
40
|
},
|
|
79
41
|
},
|
|
80
42
|
}));
|
|
81
43
|
function StandardSelect({ placeholder, helperText, InputProps, SelectProps, className, children, color = 'primary', size = 'small', paperMaxHeight = 'auto', error = false, hasShrink = false, value = '', disabled = false, }) {
|
|
82
|
-
const hasAdornment = !!(InputProps === null || InputProps === void 0 ? void 0 : InputProps.startAdornment);
|
|
83
44
|
const hasHelperText = !!helperText;
|
|
84
|
-
return (react_1.default.createElement(
|
|
45
|
+
return (react_1.default.createElement(material_1.FormControl, { variant: 'standard', color: color, size: size, disabled: disabled, error: error, className: className },
|
|
85
46
|
react_1.default.createElement(StyledInputLabel, { color: color, shrink: hasShrink ? true : undefined }, placeholder),
|
|
86
|
-
react_1.default.createElement(
|
|
87
|
-
|
|
47
|
+
react_1.default.createElement(material_1.Select, Object.assign({ value: value, MenuProps: {
|
|
48
|
+
PaperProps: {
|
|
49
|
+
sx: {
|
|
50
|
+
maxHeight: paperMaxHeight,
|
|
51
|
+
top: '30px !important',
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
anchorOrigin: {
|
|
55
|
+
vertical: 2,
|
|
56
|
+
horizontal: 'left',
|
|
57
|
+
},
|
|
58
|
+
transformOrigin: {
|
|
59
|
+
vertical: 'top',
|
|
60
|
+
horizontal: 'left',
|
|
61
|
+
},
|
|
62
|
+
}, input: react_1.default.createElement(StyledInput, Object.assign({ color: color }, InputProps)) }, SelectProps), children),
|
|
63
|
+
hasHelperText && react_1.default.createElement(material_1.FormHelperText, null, helperText)));
|
|
88
64
|
}
|
|
89
65
|
exports.StandardSelect = StandardSelect;
|
|
90
66
|
exports.default = StandardSelect;
|
|
@@ -3,65 +3,46 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.TextField = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const react_1 = tslib_1.__importDefault(require("react"));
|
|
6
|
-
const styles_1 = require("@material
|
|
7
|
-
const
|
|
6
|
+
const styles_1 = require("@mui/material/styles");
|
|
7
|
+
const material_1 = require("@mui/material");
|
|
8
|
+
const TextField_1 = require("@mui/material/TextField");
|
|
9
|
+
const Input_1 = require("@mui/material/Input");
|
|
10
|
+
const InputLabel_1 = require("@mui/material/InputLabel");
|
|
11
|
+
const OutlinedInput_1 = require("@mui/material/OutlinedInput");
|
|
8
12
|
// self-defined-components
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
inputLabelDisabled: `${PREFIX}-inputLabel-disabled`,
|
|
13
|
-
inputLabelShrink: `${PREFIX}-inputLabel-shrink`,
|
|
14
|
-
inputLabelFocused: `${PREFIX}-inputLabel-focused`,
|
|
15
|
-
inputNotchedOutline: `${PREFIX}-input-notchedOutline`,
|
|
16
|
-
inputUnderline: `${PREFIX}-input-underline`,
|
|
17
|
-
inputColorSecondary: `${PREFIX}-input-colorSecondary`,
|
|
18
|
-
inputDisabled: `${PREFIX}-input-disabled`,
|
|
19
|
-
inputError: `${PREFIX}-input-error`,
|
|
20
|
-
inputFocused: `${PREFIX}-input-focused`,
|
|
21
|
-
};
|
|
22
|
-
const StyledTextField = styles_1.styled((_a) => {
|
|
23
|
-
var { hasEndAdornment, InputLabelProps, InputProps } = _a, otherProps = tslib_1.__rest(_a, ["hasEndAdornment", "InputLabelProps", "InputProps"]);
|
|
24
|
-
return (react_1.default.createElement(core_1.TextField, Object.assign({ InputLabelProps: Object.assign(Object.assign({}, InputLabelProps), { classes: {
|
|
25
|
-
error: classes.inputLabelError,
|
|
26
|
-
disabled: classes.inputLabelDisabled,
|
|
27
|
-
shrink: classes.inputLabelShrink,
|
|
28
|
-
focused: classes.inputLabelFocused,
|
|
29
|
-
}, shrink: hasEndAdornment ? true : undefined }), InputProps: Object.assign(Object.assign({}, InputProps), { classes: Object.assign({ colorSecondary: classes.inputColorSecondary, disabled: classes.inputDisabled, error: classes.inputError, focused: classes.inputFocused }, ((otherProps === null || otherProps === void 0 ? void 0 : otherProps.variant) === 'outlined'
|
|
30
|
-
? { notchedOutline: classes.inputNotchedOutline }
|
|
31
|
-
: { underline: classes.inputUnderline })) }) }, otherProps)));
|
|
32
|
-
})(({ theme }) => ({
|
|
33
|
-
[`& .${classes.inputLabelError}`]: {
|
|
34
|
-
[`&:not(.${classes.inputLabelShrink})`]: {
|
|
13
|
+
const StyledTextField = styles_1.styled(material_1.TextField)(({ theme }) => ({
|
|
14
|
+
[`& .${InputLabel_1.inputLabelClasses.error}`]: {
|
|
15
|
+
[`&:not(.${InputLabel_1.inputLabelClasses.shrink})`]: {
|
|
35
16
|
color: theme.palette.text.secondary,
|
|
36
17
|
},
|
|
37
|
-
[`&.${
|
|
18
|
+
[`&.${InputLabel_1.inputLabelClasses.disabled}`]: {
|
|
38
19
|
color: theme.palette.text.disabled,
|
|
39
20
|
},
|
|
40
21
|
},
|
|
41
|
-
[`& .${
|
|
22
|
+
[`& .${InputLabel_1.inputLabelClasses.error}.${InputLabel_1.inputLabelClasses.focused}`]: {
|
|
42
23
|
color: theme.palette.error.main,
|
|
43
24
|
},
|
|
44
25
|
// For variant: standard | filled
|
|
45
|
-
[`& .${
|
|
26
|
+
[`& .${Input_1.inputClasses.underline}:not(.${Input_1.inputClasses.disabled})`]: {
|
|
46
27
|
[`&:hover:before`]: {
|
|
47
28
|
borderColor: theme.palette.primary.main,
|
|
48
29
|
},
|
|
49
|
-
[`&.${
|
|
30
|
+
[`&.${Input_1.inputClasses.colorSecondary}:hover:before`]: {
|
|
50
31
|
borderColor: theme.palette.secondary.main,
|
|
51
32
|
},
|
|
52
33
|
},
|
|
53
34
|
// For variant: outlined
|
|
54
|
-
[`& .${
|
|
35
|
+
[`& .${Input_1.inputClasses.disabled} .${OutlinedInput_1.outlinedInputClasses.notchedOutline}`]: {
|
|
55
36
|
borderStyle: 'dotted',
|
|
56
37
|
},
|
|
57
|
-
[`& .${
|
|
38
|
+
[`& .${Input_1.inputClasses.error}.${Input_1.inputClasses.focused} .${OutlinedInput_1.outlinedInputClasses.notchedOutline}`]: {
|
|
58
39
|
borderColor: theme.palette.error.main,
|
|
59
40
|
},
|
|
60
|
-
[
|
|
61
|
-
[`&:hover .${
|
|
41
|
+
[`&.${TextField_1.textFieldClasses.root} :not(.${Input_1.inputClasses.disabled}):not(.${Input_1.inputClasses.error})`]: {
|
|
42
|
+
[`&:hover .${OutlinedInput_1.outlinedInputClasses.notchedOutline}`]: {
|
|
62
43
|
borderColor: theme.palette.primary.main,
|
|
63
44
|
},
|
|
64
|
-
[`&.${
|
|
45
|
+
[`&.${Input_1.inputClasses.colorSecondary}:hover .${OutlinedInput_1.outlinedInputClasses.notchedOutline}`]: {
|
|
65
46
|
borderColor: theme.palette.secondary.main,
|
|
66
47
|
},
|
|
67
48
|
},
|
|
@@ -69,7 +50,14 @@ const StyledTextField = styles_1.styled((_a) => {
|
|
|
69
50
|
const TextField = (props) => {
|
|
70
51
|
var _a;
|
|
71
52
|
const hasEndAdornment = !!((_a = props === null || props === void 0 ? void 0 : props.InputProps) === null || _a === void 0 ? void 0 : _a.endAdornment);
|
|
72
|
-
return react_1.default.createElement(StyledTextField, Object.assign({
|
|
53
|
+
return (react_1.default.createElement(StyledTextField, Object.assign({ InputLabelProps: Object.assign(Object.assign({}, props.InputLabelProps), { classes: {
|
|
54
|
+
error: InputLabel_1.inputLabelClasses.error,
|
|
55
|
+
disabled: InputLabel_1.inputLabelClasses.disabled,
|
|
56
|
+
shrink: InputLabel_1.inputLabelClasses.shrink,
|
|
57
|
+
focused: InputLabel_1.inputLabelClasses.focused,
|
|
58
|
+
}, shrink: hasEndAdornment ? true : undefined }), InputProps: Object.assign(Object.assign({}, props.InputProps), { classes: Object.assign({ colorSecondary: Input_1.inputClasses.colorSecondary, disabled: Input_1.inputClasses.disabled, error: Input_1.inputClasses.error, focused: Input_1.inputClasses.focused }, ((props === null || props === void 0 ? void 0 : props.variant) === 'outlined'
|
|
59
|
+
? { notchedOutline: OutlinedInput_1.outlinedInputClasses.notchedOutline }
|
|
60
|
+
: { underline: Input_1.inputClasses.underline })) }) }, props)));
|
|
73
61
|
};
|
|
74
62
|
exports.TextField = TextField;
|
|
75
63
|
exports.default = exports.TextField;
|
|
@@ -3,32 +3,17 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.TopicFilter = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const react_1 = tslib_1.__importStar(require("react"));
|
|
6
|
-
const styles_1 = require("@material
|
|
7
|
-
const ArrowRightRounded_1 = tslib_1.__importDefault(require("@
|
|
6
|
+
const styles_1 = require("@mui/material/styles");
|
|
7
|
+
const ArrowRightRounded_1 = tslib_1.__importDefault(require("@mui/icons-material/ArrowRightRounded"));
|
|
8
|
+
const material_1 = require("@mui/material");
|
|
8
9
|
const Select_1 = tslib_1.__importDefault(require("../select/Select"));
|
|
9
10
|
const SelectMenuItem_1 = tslib_1.__importDefault(require("../menu-item/SelectMenuItem"));
|
|
10
11
|
// self-defined-configs
|
|
11
12
|
const PLACEHOLDER = '請選擇';
|
|
12
|
-
// self-defined-components
|
|
13
|
-
const PREFIX = 'JuiTopicFilter';
|
|
14
|
-
const FiltersWrapper = styles_1.styled('div')({
|
|
15
|
-
display: 'flex',
|
|
16
|
-
alignItems: 'center',
|
|
17
|
-
flexWrap: 'wrap',
|
|
18
|
-
});
|
|
19
|
-
const SelectWrapper = styles_1.styled('div')({
|
|
20
|
-
display: 'flex',
|
|
21
|
-
alignItems: 'center',
|
|
22
|
-
});
|
|
23
13
|
const StyledSelect = styles_1.styled(Select_1.default)(({ theme }) => ({
|
|
24
14
|
width: 220,
|
|
25
15
|
margin: theme.spacing(1),
|
|
26
16
|
}));
|
|
27
|
-
const StyledArrowRightRoundedIcon = styles_1.styled(ArrowRightRounded_1.default)(({ theme }) => ({
|
|
28
|
-
margin: theme.spacing(-1, -1.5),
|
|
29
|
-
fontSize: theme.spacing(7),
|
|
30
|
-
color: '#444',
|
|
31
|
-
}));
|
|
32
17
|
const TopicFilter = ({ topicTree, onTopicSelected, isLastLayer, hasArrow, initSelectedTopicIds, }) => {
|
|
33
18
|
const [selectedTopicIds, setSelectedTopicIds] = react_1.useState([]);
|
|
34
19
|
const [layeredTopicList, setLayeredTopicList] = react_1.useState([]);
|
|
@@ -88,10 +73,17 @@ const TopicFilter = ({ topicTree, onTopicSelected, isLastLayer, hasArrow, initSe
|
|
|
88
73
|
if (layeredTopicList.length === 0) {
|
|
89
74
|
return (react_1.default.createElement(StyledSelect, { variant: 'outlined', size: 'small', placeholder: '\u8F09\u5165\u8CC7\u6599\u4E2D...', disabled: true }));
|
|
90
75
|
}
|
|
91
|
-
return (react_1.default.createElement(
|
|
76
|
+
return (react_1.default.createElement(material_1.Box, { sx: {
|
|
77
|
+
display: 'flex',
|
|
78
|
+
alignItems: 'center',
|
|
79
|
+
flexWrap: 'wrap',
|
|
80
|
+
} }, layeredTopicList.map((layeredTopic, layerNumber) => {
|
|
92
81
|
const hasLabel = isFocusedList[layerNumber] || !selectedTopicIds[layerNumber];
|
|
93
|
-
return (react_1.default.createElement(
|
|
94
|
-
|
|
82
|
+
return (react_1.default.createElement(material_1.Box, { sx: {
|
|
83
|
+
display: 'flex',
|
|
84
|
+
alignItems: 'center',
|
|
85
|
+
}, key: layeredTopic.id },
|
|
86
|
+
react_1.default.createElement(StyledSelect, { variant: 'outlined', size: 'small', paperMaxHeight: 412, hasLabel: hasLabel, placeholder: PLACEHOLDER, value: (selectedTopicIds === null || selectedTopicIds === void 0 ? void 0 : selectedTopicIds[layerNumber]) || '', SelectProps: {
|
|
95
87
|
'data-testid': `layered-topic-${layerNumber}`,
|
|
96
88
|
}, InputProps: {
|
|
97
89
|
inputProps: {
|
|
@@ -117,7 +109,11 @@ const TopicFilter = ({ topicTree, onTopicSelected, isLastLayer, hasArrow, initSe
|
|
|
117
109
|
} },
|
|
118
110
|
react_1.default.createElement(SelectMenuItem_1.default, { disabled: true }, PLACEHOLDER),
|
|
119
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)))),
|
|
120
|
-
hasArrow && layerNumber !== layeredTopicList.length - 1 && (react_1.default.createElement(
|
|
112
|
+
hasArrow && layerNumber !== layeredTopicList.length - 1 && (react_1.default.createElement(ArrowRightRounded_1.default, { sx: (theme) => ({
|
|
113
|
+
margin: theme.spacing(-1, -1.5),
|
|
114
|
+
fontSize: theme.spacing(7),
|
|
115
|
+
color: '#444',
|
|
116
|
+
}), fontSize: 'large', "data-testid": 'topic-filter-arrow' }))));
|
|
121
117
|
})));
|
|
122
118
|
};
|
|
123
119
|
exports.TopicFilter = TopicFilter;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@junyiacademy/ui-test",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.0",
|
|
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",
|
|
@@ -17,8 +17,11 @@
|
|
|
17
17
|
"access": "public"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@
|
|
21
|
-
"@
|
|
20
|
+
"@emotion/react": "11.7.1",
|
|
21
|
+
"@emotion/styled": "11.6.0",
|
|
22
|
+
"@mui/icons-material": "5.2.5",
|
|
23
|
+
"@mui/material": "5.2.7",
|
|
24
|
+
"@mui/styles": "5.2.3",
|
|
22
25
|
"react": "17.0.2"
|
|
23
26
|
},
|
|
24
27
|
"devDependencies": {
|
package/dist/libs/.DS_Store
DELETED
|
Binary file
|
package/dist/libs/ui/.DS_Store
DELETED
|
Binary file
|
|
Binary file
|