@junyiacademy/ui-test 1.5.8 → 1.5.11

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.
@@ -1,8 +1,6 @@
1
- import React from 'react';
2
1
  import { MenuItemProps } from '@mui/material';
3
2
  export interface SelectMenuItemProps extends MenuItemProps {
4
3
  value?: any;
5
- disabled?: boolean;
6
4
  }
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>>;
5
+ declare const SelectMenuItem: ({ children, value, ...otherProps }: SelectMenuItemProps) => JSX.Element;
8
6
  export default SelectMenuItem;
@@ -7,12 +7,12 @@ 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
9
  //utils
10
- const Capitalize_1 = tslib_1.__importDefault(require("../../utils/Capitalize"));
10
+ const lodash_1 = tslib_1.__importDefault(require("lodash"));
11
11
  const StyledButton = styles_1.styled(material_1.Button, {
12
12
  shouldForwardProp: (prop) => prop !== 'active',
13
13
  })(({ active, color = 'primary', theme }) => ({
14
14
  // For variant: outlined
15
- [`&.${Button_1.buttonClasses.outlined}${Capitalize_1.default(color)}`]: {
15
+ [`&.${Button_1.buttonClasses.outlined}${lodash_1.default.capitalize(color)}`]: {
16
16
  backgroundColor: active
17
17
  ? theme.palette[color].main
18
18
  : theme.palette.common.white,
@@ -30,12 +30,7 @@ const StyledButton = styles_1.styled(material_1.Button, {
30
30
  },
31
31
  },
32
32
  // For variant: text
33
- [`&.${Button_1.buttonClasses.text}${Capitalize_1.default(color)}`]: {
34
- '&:hover': {
35
- backgroundColor: styles_1.alpha(theme.palette[color].main, 0.1),
36
- },
37
- },
38
- [`&.${Button_1.buttonClasses.text}${Capitalize_1.default(color)}`]: {
33
+ [`&.${Button_1.buttonClasses.text}${lodash_1.default.capitalize(color)}`]: {
39
34
  '&:hover': {
40
35
  backgroundColor: styles_1.alpha(theme.palette[color].main, 0.1),
41
36
  },
@@ -6,15 +6,13 @@ 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
+ const lodash_1 = tslib_1.__importDefault(require("lodash"));
9
11
  // self-defined-components
10
- const StyledButtonGroup = styles_1.styled(material_1.ButtonGroup)(({ theme }) => ({
11
- [`& .${ButtonGroup_1.buttonGroupClasses.groupedOutlinedPrimary}.${ButtonGroup_1.buttonGroupClasses.grouped}.${ButtonGroup_1.buttonGroupClasses.disabled}`]: {
12
- borderColor: styles_1.alpha(theme.palette.primary.main, 0.5),
13
- color: styles_1.alpha(theme.palette.primary.main, 0.5),
14
- },
15
- [`& .${ButtonGroup_1.buttonGroupClasses.groupedOutlinedSecondary}.${ButtonGroup_1.buttonGroupClasses.grouped}.${ButtonGroup_1.buttonGroupClasses.disabled}`]: {
16
- borderColor: styles_1.alpha(theme.palette.secondary.main, 0.5),
17
- color: styles_1.alpha(theme.palette.secondary.main, 0.5),
12
+ const StyledButtonGroup = styles_1.styled(material_1.ButtonGroup)(({ color = 'primary', theme }) => ({
13
+ [`& .${ButtonGroup_1.buttonGroupClasses.groupedOutlined}${lodash_1.default.capitalize(color)}.${ButtonGroup_1.buttonGroupClasses.grouped}.${ButtonGroup_1.buttonGroupClasses.disabled}`]: {
14
+ borderColor: styles_1.alpha(theme.palette[color].main, 0.5),
15
+ color: styles_1.alpha(theme.palette[color].main, 0.5),
18
16
  },
19
17
  }));
20
18
  const ButtonGroup = (_a) => {
@@ -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 StyledMenuItem = styles_1.styled(material_1.MenuItem)(({ theme }) => ({
9
- whiteSpace: 'unset',
10
- color: theme.palette.text.primary,
11
- [`&.${MenuItem_1.menuItemClasses.selected}`]: {
12
- backgroundColor: theme.palette.grey[300],
13
- '&:hover': {
14
- backgroundColor: theme.palette.grey[200],
15
- },
16
- },
17
- }));
18
- const SelectMenuItem = react_1.default.forwardRef((_a, ref) => {
7
+ const SelectMenuItem = (_a) => {
19
8
  var { children, value = '' } = _a, otherProps = tslib_1.__rest(_a, ["children", "value"]);
20
- return (react_1.default.createElement(StyledMenuItem, Object.assign({ value: value }, otherProps), children));
21
- });
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 }) => ({
@@ -40,14 +31,11 @@ const StyledInputLabel = styles_1.styled(material_1.InputLabel, {
40
31
  }));
41
32
  const StyledOutlinedInput = styles_1.styled(material_1.OutlinedInput)(({ theme }) => ({
42
33
  [`&.${OutlinedInput_1.outlinedInputClasses.root}`]: {
43
- [`&.${InputBase_1.inputBaseClasses.sizeSmall}`]: {
44
- height: 48,
45
- },
46
34
  [`&.${OutlinedInput_1.outlinedInputClasses.error}.${OutlinedInput_1.outlinedInputClasses.focused} .${OutlinedInput_1.outlinedInputClasses.notchedOutline}`]: {
47
35
  borderColor: `${theme.palette.error.main}`,
48
36
  },
49
37
  [`& .${InputBase_1.inputBaseClasses.inputSizeSmall}`]: {
50
- padding: '14.5px 15px 14.5px 12px',
38
+ padding: '12.5px 15px 12.5px 12px',
51
39
  },
52
40
  },
53
41
  [`& .${OutlinedInput_1.outlinedInputClasses.input}`]: {
@@ -59,7 +47,14 @@ const StyledOutlinedInput = styles_1.styled(material_1.OutlinedInput)(({ theme }
59
47
  }));
60
48
  const OutlinedSelect = ({ label, helperText, InputProps, SelectProps, className, children, color = 'primary', size = 'small', paperMaxHeight = 'auto', error = false, hasLabel = true, hasShrink = false, value = '', disabled = false, }) => {
61
49
  const hasHelperText = !!helperText;
62
- return (react_1.default.createElement(StyledFormControl, { size: size, disabled: disabled, error: error, color: color, className: className },
50
+ return (react_1.default.createElement(material_1.FormControl, { sx: (theme) => ({
51
+ backgroundColor: 'white',
52
+ '&:hover': {
53
+ [`& :not(.${OutlinedInput_1.outlinedInputClasses.disabled}):not(.${OutlinedInput_1.outlinedInputClasses.error}) .${OutlinedInput_1.outlinedInputClasses.notchedOutline}`]: {
54
+ borderColor: theme.palette[color].main,
55
+ },
56
+ },
57
+ }), size: size, disabled: disabled, error: error, color: color, className: className },
63
58
  hasLabel && (react_1.default.createElement(StyledInputLabel, { color: color, shrink: hasShrink ? true : undefined }, label)),
64
59
  react_1.default.createElement(material_1.Select, Object.assign({ value: value, label: hasLabel ? label : undefined, MenuProps: {
65
60
  PaperProps: {
@@ -77,7 +72,11 @@ const OutlinedSelect = ({ label, helperText, InputProps, SelectProps, className,
77
72
  horizontal: 'left',
78
73
  },
79
74
  }, 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, null, helperText)));
75
+ hasHelperText && (react_1.default.createElement(material_1.FormHelperText, { sx: {
76
+ [`&.${FormHelperText_1.formHelperTextClasses.root}`]: {
77
+ marginLeft: 0,
78
+ },
79
+ } }, helperText))));
81
80
  };
82
81
  exports.OutlinedSelect = OutlinedSelect;
83
82
  exports.default = exports.OutlinedSelect;
@@ -10,7 +10,7 @@ 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
12
  //utils
13
- const Capitalize_1 = tslib_1.__importDefault(require("../../utils/Capitalize"));
13
+ const lodash_1 = tslib_1.__importDefault(require("lodash"));
14
14
  // self-defined-components
15
15
  const StyledTextField = styles_1.styled(material_1.TextField)(({ color = 'primary', theme }) => ({
16
16
  [`& .${InputLabel_1.inputLabelClasses.error}`]: {
@@ -26,7 +26,7 @@ const StyledTextField = styles_1.styled(material_1.TextField)(({ color = 'primar
26
26
  },
27
27
  // For variant: standard | filled
28
28
  [`& .${Input_1.inputClasses.underline}:not(.${Input_1.inputClasses.disabled})`]: {
29
- [`&.MuiInputBase-color${Capitalize_1.default(color)}:hover:before`]: {
29
+ [`&.MuiInputBase-color${lodash_1.default.capitalize(color)}:hover:before`]: {
30
30
  borderColor: theme.palette[color].main,
31
31
  },
32
32
  },
@@ -38,7 +38,7 @@ const StyledTextField = styles_1.styled(material_1.TextField)(({ color = 'primar
38
38
  borderColor: theme.palette.error.main,
39
39
  },
40
40
  [`&.${TextField_1.textFieldClasses.root} :not(.${Input_1.inputClasses.disabled}):not(.${Input_1.inputClasses.error})`]: {
41
- [`&.MuiInputBase-color${Capitalize_1.default(color)}:hover .${OutlinedInput_1.outlinedInputClasses.notchedOutline}`]: {
41
+ [`&.MuiInputBase-color${lodash_1.default.capitalize(color)}:hover .${OutlinedInput_1.outlinedInputClasses.notchedOutline}`]: {
42
42
  borderColor: theme.palette[color].main,
43
43
  },
44
44
  },
@@ -46,14 +46,8 @@ const StyledTextField = styles_1.styled(material_1.TextField)(({ color = 'primar
46
46
  const TextField = (props) => {
47
47
  var _a;
48
48
  const hasEndAdornment = !!((_a = props === null || props === void 0 ? void 0 : props.InputProps) === null || _a === void 0 ? void 0 : _a.endAdornment);
49
- return (react_1.default.createElement(StyledTextField, Object.assign({ InputLabelProps: Object.assign(Object.assign({}, props.InputLabelProps), { classes: {
50
- error: InputLabel_1.inputLabelClasses.error,
51
- disabled: InputLabel_1.inputLabelClasses.disabled,
52
- shrink: InputLabel_1.inputLabelClasses.shrink,
53
- focused: InputLabel_1.inputLabelClasses.focused,
54
- }, 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'
55
- ? { notchedOutline: OutlinedInput_1.outlinedInputClasses.notchedOutline }
56
- : { underline: Input_1.inputClasses.underline })) }) }, props)));
49
+ const { InputLabelProps, InputProps } = props, otherProps = tslib_1.__rest(props, ["InputLabelProps", "InputProps"]);
50
+ return (react_1.default.createElement(StyledTextField, Object.assign({ InputLabelProps: Object.assign(Object.assign({}, InputLabelProps), { shrink: hasEndAdornment ? true : undefined }), InputProps: Object.assign({}, InputProps) }, otherProps)));
57
51
  };
58
52
  exports.TextField = TextField;
59
53
  exports.default = exports.TextField;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@junyiacademy/ui-test",
3
- "version": "1.5.8",
3
+ "version": "1.5.11",
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",
@@ -21,10 +21,11 @@
21
21
  "@emotion/styled": "11.6.0",
22
22
  "@mui/icons-material": "5.2.5",
23
23
  "@mui/material": "5.2.7",
24
- "@mui/styles": "5.2.3",
24
+ "lodash": "^4.17.21",
25
25
  "react": "17.0.2"
26
26
  },
27
27
  "devDependencies": {
28
+ "@types/lodash": "^4.14.179",
28
29
  "typescript": "~4.1.4"
29
30
  }
30
31
  }