@junyiacademy/ui-test 1.6.6 → 1.6.9
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/README.md +66 -4
- package/package.json +27 -11
- package/dist/index.d.ts +0 -7
- package/dist/index.js +0 -20
- package/dist/interfaces/index.d.ts +0 -29
- package/dist/interfaces/index.js +0 -2
- package/dist/lib/button/Button.d.ts +0 -6
- package/dist/lib/button/Button.js +0 -73
- package/dist/lib/button-group/ButtonGroup.d.ts +0 -3
- package/dist/lib/button-group/ButtonGroup.js +0 -51
- package/dist/lib/menu-item/SelectMenuItem.d.ts +0 -6
- package/dist/lib/menu-item/SelectMenuItem.js +0 -58
- package/dist/lib/radio/Radio.d.ts +0 -11
- package/dist/lib/radio/Radio.js +0 -76
- package/dist/lib/select/OutlinedSelect.d.ts +0 -3
- package/dist/lib/select/OutlinedSelect.js +0 -133
- package/dist/lib/select/Select.d.ts +0 -3
- package/dist/lib/select/Select.js +0 -40
- package/dist/lib/select/StandardSelect.d.ts +0 -3
- package/dist/lib/select/StandardSelect.js +0 -88
- package/dist/lib/text-field/TextField.d.ts +0 -3
- package/dist/lib/text-field/TextField.js +0 -110
- package/dist/lib/topic-filter/TopicFilter.d.ts +0 -13
- package/dist/lib/topic-filter/TopicFilter.js +0 -151
- package/dist/styles/theme.d.ts +0 -24
- package/dist/styles/theme.js +0 -42
- package/dist/utils/Capitalize.d.ts +0 -1
- package/dist/utils/Capitalize.js +0 -6
- package/dist/utils/topicTree.d.ts +0 -2
- package/dist/utils/topicTree.js +0 -177
package/README.md
CHANGED
|
@@ -1,7 +1,69 @@
|
|
|
1
|
-
#
|
|
1
|
+
# React + TypeScript + Vite
|
|
2
2
|
|
|
3
|
-
This
|
|
3
|
+
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Currently, two official plugins are available:
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Babel](https://babeljs.io/) for Fast Refresh
|
|
8
|
+
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
|
|
9
|
+
|
|
10
|
+
## Expanding the ESLint configuration
|
|
11
|
+
|
|
12
|
+
If you are developing a production application, we recommend updating the configuration to enable type-aware lint rules:
|
|
13
|
+
|
|
14
|
+
```js
|
|
15
|
+
export default tseslint.config([
|
|
16
|
+
globalIgnores(['dist']),
|
|
17
|
+
{
|
|
18
|
+
files: ['**/*.{ts,tsx}'],
|
|
19
|
+
extends: [
|
|
20
|
+
// Other configs...
|
|
21
|
+
|
|
22
|
+
// Remove tseslint.configs.recommended and replace with this
|
|
23
|
+
...tseslint.configs.recommendedTypeChecked,
|
|
24
|
+
// Alternatively, use this for stricter rules
|
|
25
|
+
...tseslint.configs.strictTypeChecked,
|
|
26
|
+
// Optionally, add this for stylistic rules
|
|
27
|
+
...tseslint.configs.stylisticTypeChecked,
|
|
28
|
+
|
|
29
|
+
// Other configs...
|
|
30
|
+
],
|
|
31
|
+
languageOptions: {
|
|
32
|
+
parserOptions: {
|
|
33
|
+
project: ['./tsconfig.node.json', './tsconfig.app.json'],
|
|
34
|
+
tsconfigRootDir: import.meta.dirname,
|
|
35
|
+
},
|
|
36
|
+
// other options...
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
]);
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
You can also install [eslint-plugin-react-x](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-x) and [eslint-plugin-react-dom](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-dom) for React-specific lint rules:
|
|
43
|
+
|
|
44
|
+
```js
|
|
45
|
+
// eslint.config.js
|
|
46
|
+
import reactDom from 'eslint-plugin-react-dom';
|
|
47
|
+
import reactX from 'eslint-plugin-react-x';
|
|
48
|
+
|
|
49
|
+
export default tseslint.config([
|
|
50
|
+
globalIgnores(['dist']),
|
|
51
|
+
{
|
|
52
|
+
files: ['**/*.{ts,tsx}'],
|
|
53
|
+
extends: [
|
|
54
|
+
// Other configs...
|
|
55
|
+
// Enable lint rules for React
|
|
56
|
+
reactX.configs['recommended-typescript'],
|
|
57
|
+
// Enable lint rules for React DOM
|
|
58
|
+
reactDom.configs.recommended,
|
|
59
|
+
],
|
|
60
|
+
languageOptions: {
|
|
61
|
+
parserOptions: {
|
|
62
|
+
project: ['./tsconfig.node.json', './tsconfig.app.json'],
|
|
63
|
+
tsconfigRootDir: import.meta.dirname,
|
|
64
|
+
},
|
|
65
|
+
// other options...
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
]);
|
|
69
|
+
```
|
package/package.json
CHANGED
|
@@ -1,29 +1,45 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@junyiacademy/ui-test",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.9",
|
|
4
4
|
"description": "junyiacademy ui library",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
|
-
"
|
|
6
|
+
"types": "./dist/index.d.ts",
|
|
7
|
+
"directories": {
|
|
8
|
+
"lib": "lib"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"dist"
|
|
12
|
+
],
|
|
7
13
|
"scripts": {
|
|
8
14
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
9
|
-
"build": "
|
|
15
|
+
"build": "rm -rf ./dist && tsc && vite build"
|
|
10
16
|
},
|
|
11
17
|
"keywords": [
|
|
12
18
|
"junyiacademy"
|
|
13
19
|
],
|
|
14
|
-
"author": "
|
|
20
|
+
"author": "junyiacademy",
|
|
15
21
|
"license": "MIT",
|
|
16
22
|
"publishConfig": {
|
|
17
23
|
"access": "public"
|
|
18
24
|
},
|
|
19
|
-
"
|
|
20
|
-
"@emotion/react": "11.
|
|
21
|
-
"@emotion/styled": "11.
|
|
22
|
-
"@mui/icons-material": "
|
|
23
|
-
"@mui/material": "
|
|
24
|
-
"
|
|
25
|
+
"peerDependencies": {
|
|
26
|
+
"@emotion/react": ">=11.11.1",
|
|
27
|
+
"@emotion/styled": ">=11.11.0",
|
|
28
|
+
"@mui/icons-material": ">=7.3.1",
|
|
29
|
+
"@mui/material": ">=7.3.1",
|
|
30
|
+
"axios": ">=1.13.2",
|
|
31
|
+
"react": ">=18.2.0",
|
|
32
|
+
"react-dom": ">=18.2.0"
|
|
25
33
|
},
|
|
26
34
|
"devDependencies": {
|
|
27
|
-
"
|
|
35
|
+
"@emotion/react": "^11.0.0",
|
|
36
|
+
"@emotion/styled": "^11.0.0",
|
|
37
|
+
"@mui/material": "^7.3.1",
|
|
38
|
+
"@types/react": "^18.0.0",
|
|
39
|
+
"axios": "~1.13.2",
|
|
40
|
+
"react": "^18.2.0",
|
|
41
|
+
"react-dom": "^=18.2.0",
|
|
42
|
+
"typescript": "^5.8.3",
|
|
43
|
+
"vite-plugin-dts": "^4.5.4"
|
|
28
44
|
}
|
|
29
45
|
}
|
package/dist/index.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export { default as TopicFilter } from './lib/topic-filter/TopicFilter';
|
|
2
|
-
export { default as SelectMenuItem } from './lib/menu-item/SelectMenuItem';
|
|
3
|
-
export { default as Button } from './lib/button/Button';
|
|
4
|
-
export { default as ButtonGroup } from './lib/button-group/ButtonGroup';
|
|
5
|
-
export { default as Radio } from './lib/radio/Radio';
|
|
6
|
-
export { default as TextField } from './lib/text-field/TextField';
|
|
7
|
-
export { default as Select } from './lib/select/Select';
|
package/dist/index.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.Select = exports.TextField = exports.Radio = exports.ButtonGroup = exports.Button = exports.SelectMenuItem = exports.TopicFilter = void 0;
|
|
7
|
-
var TopicFilter_1 = require("./lib/topic-filter/TopicFilter");
|
|
8
|
-
Object.defineProperty(exports, "TopicFilter", { enumerable: true, get: function () { return __importDefault(TopicFilter_1).default; } });
|
|
9
|
-
var SelectMenuItem_1 = require("./lib/menu-item/SelectMenuItem");
|
|
10
|
-
Object.defineProperty(exports, "SelectMenuItem", { enumerable: true, get: function () { return __importDefault(SelectMenuItem_1).default; } });
|
|
11
|
-
var Button_1 = require("./lib/button/Button");
|
|
12
|
-
Object.defineProperty(exports, "Button", { enumerable: true, get: function () { return __importDefault(Button_1).default; } });
|
|
13
|
-
var ButtonGroup_1 = require("./lib/button-group/ButtonGroup");
|
|
14
|
-
Object.defineProperty(exports, "ButtonGroup", { enumerable: true, get: function () { return __importDefault(ButtonGroup_1).default; } });
|
|
15
|
-
var Radio_1 = require("./lib/radio/Radio");
|
|
16
|
-
Object.defineProperty(exports, "Radio", { enumerable: true, get: function () { return __importDefault(Radio_1).default; } });
|
|
17
|
-
var TextField_1 = require("./lib/text-field/TextField");
|
|
18
|
-
Object.defineProperty(exports, "TextField", { enumerable: true, get: function () { return __importDefault(TextField_1).default; } });
|
|
19
|
-
var Select_1 = require("./lib/select/Select");
|
|
20
|
-
Object.defineProperty(exports, "Select", { enumerable: true, get: function () { return __importDefault(Select_1).default; } });
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { ChangeEvent } from 'react';
|
|
2
|
-
import { SelectProps as MuiSelectProp, InputProps as MuiInputProps, FormControlProps as MuiFormControlProps, InputLabelProps as MuiInputLabelProps, OutlinedInputProps, FormHelperTextProps as MuiFormHelperTextProps } from '@mui/material';
|
|
3
|
-
export interface ITopicTreeNode {
|
|
4
|
-
childTopics: ITopicTreeNode[];
|
|
5
|
-
id: string;
|
|
6
|
-
isContentTopic: boolean;
|
|
7
|
-
key: string;
|
|
8
|
-
tags: string[];
|
|
9
|
-
title: string;
|
|
10
|
-
}
|
|
11
|
-
export interface SelectProps extends MuiSelectProp {
|
|
12
|
-
helperText?: string;
|
|
13
|
-
FormControlProps?: Partial<MuiFormControlProps>;
|
|
14
|
-
InputLabelProps?: Partial<MuiInputLabelProps>;
|
|
15
|
-
InputProps?: (Partial<OutlinedInputProps> & {
|
|
16
|
-
onChange: (e: ChangeEvent<HTMLInputElement>) => void;
|
|
17
|
-
}) | (object & Partial<MuiInputProps>);
|
|
18
|
-
SelectProps?: object | Partial<MuiSelectProp>;
|
|
19
|
-
FormHelperTextProps?: Partial<MuiFormHelperTextProps>;
|
|
20
|
-
color?: 'primary' | 'secondary';
|
|
21
|
-
size?: 'medium' | 'small';
|
|
22
|
-
paperMaxHeight?: number | string;
|
|
23
|
-
error?: boolean;
|
|
24
|
-
hasLabel?: boolean;
|
|
25
|
-
hasShrink?: boolean;
|
|
26
|
-
disabled?: boolean;
|
|
27
|
-
className?: string;
|
|
28
|
-
otherProps?: any;
|
|
29
|
-
}
|
package/dist/interfaces/index.js
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
14
|
-
var t = {};
|
|
15
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
16
|
-
t[p] = s[p];
|
|
17
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
18
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
19
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
20
|
-
t[p[i]] = s[p[i]];
|
|
21
|
-
}
|
|
22
|
-
return t;
|
|
23
|
-
};
|
|
24
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
25
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
26
|
-
};
|
|
27
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
|
-
exports.Button = void 0;
|
|
29
|
-
var react_1 = __importDefault(require("react"));
|
|
30
|
-
var styles_1 = require("@mui/material/styles");
|
|
31
|
-
var material_1 = require("@mui/material");
|
|
32
|
-
var Button_1 = require("@mui/material/Button");
|
|
33
|
-
// utils
|
|
34
|
-
var Capitalize_1 = __importDefault(require("../../utils/Capitalize"));
|
|
35
|
-
var StyledButton = styles_1.styled(material_1.Button, {
|
|
36
|
-
shouldForwardProp: function (prop) { return prop !== 'active'; },
|
|
37
|
-
})(function (_a) {
|
|
38
|
-
var _b, _c;
|
|
39
|
-
var active = _a.active, _d = _a.color, color = _d === void 0 ? 'primary' : _d, theme = _a.theme;
|
|
40
|
-
return (_b = {},
|
|
41
|
-
// For variant: outlined
|
|
42
|
-
_b["&." + Button_1.buttonClasses.outlined + Capitalize_1.default(color)] = (_c = {
|
|
43
|
-
backgroundColor: active
|
|
44
|
-
? theme.palette[color].main
|
|
45
|
-
: theme.palette.common.white,
|
|
46
|
-
color: active ? theme.palette.common.white : theme.palette[color].main,
|
|
47
|
-
borderColor: theme.palette[color].main,
|
|
48
|
-
'&:hover': {
|
|
49
|
-
backgroundColor: active
|
|
50
|
-
? theme.palette[color].main
|
|
51
|
-
: styles_1.alpha(theme.palette[color].main, 0.1),
|
|
52
|
-
}
|
|
53
|
-
},
|
|
54
|
-
_c["&." + Button_1.buttonClasses.disabled] = {
|
|
55
|
-
backgroundColor: theme.palette.common.white,
|
|
56
|
-
borderColor: theme.palette.action.disabledBackground,
|
|
57
|
-
color: theme.palette.action.disabled,
|
|
58
|
-
},
|
|
59
|
-
_c),
|
|
60
|
-
// For variant: text
|
|
61
|
-
_b["&." + Button_1.buttonClasses.text + Capitalize_1.default(color)] = {
|
|
62
|
-
'&:hover': {
|
|
63
|
-
backgroundColor: styles_1.alpha(theme.palette[color].main, 0.1),
|
|
64
|
-
},
|
|
65
|
-
},
|
|
66
|
-
_b);
|
|
67
|
-
});
|
|
68
|
-
var Button = function (_a) {
|
|
69
|
-
var active = _a.active, children = _a.children, otherProps = __rest(_a, ["active", "children"]);
|
|
70
|
-
return (react_1.default.createElement(StyledButton, __assign({ active: active }, otherProps), children));
|
|
71
|
-
};
|
|
72
|
-
exports.Button = Button;
|
|
73
|
-
exports.default = exports.Button;
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
14
|
-
var t = {};
|
|
15
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
16
|
-
t[p] = s[p];
|
|
17
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
18
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
19
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
20
|
-
t[p[i]] = s[p[i]];
|
|
21
|
-
}
|
|
22
|
-
return t;
|
|
23
|
-
};
|
|
24
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
25
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
26
|
-
};
|
|
27
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
|
-
exports.ButtonGroup = void 0;
|
|
29
|
-
var react_1 = __importDefault(require("react"));
|
|
30
|
-
var styles_1 = require("@mui/material/styles");
|
|
31
|
-
var material_1 = require("@mui/material");
|
|
32
|
-
var ButtonGroup_1 = require("@mui/material/ButtonGroup");
|
|
33
|
-
// utils
|
|
34
|
-
var Capitalize_1 = __importDefault(require("../../utils/Capitalize"));
|
|
35
|
-
// self-defined-components
|
|
36
|
-
var StyledButtonGroup = styles_1.styled(material_1.ButtonGroup)(function (_a) {
|
|
37
|
-
var _b;
|
|
38
|
-
var _c = _a.color, color = _c === void 0 ? 'primary' : _c, theme = _a.theme;
|
|
39
|
-
return (_b = {},
|
|
40
|
-
_b["& ." + ButtonGroup_1.buttonGroupClasses.groupedOutlined + Capitalize_1.default(color) + "." + ButtonGroup_1.buttonGroupClasses.grouped + "." + ButtonGroup_1.buttonGroupClasses.disabled] = {
|
|
41
|
-
borderColor: styles_1.alpha(theme.palette[color].main, 0.5),
|
|
42
|
-
color: styles_1.alpha(theme.palette[color].main, 0.5),
|
|
43
|
-
},
|
|
44
|
-
_b);
|
|
45
|
-
});
|
|
46
|
-
var ButtonGroup = function (_a) {
|
|
47
|
-
var children = _a.children, otherProps = __rest(_a, ["children"]);
|
|
48
|
-
return (react_1.default.createElement(StyledButtonGroup, __assign({}, otherProps), children));
|
|
49
|
-
};
|
|
50
|
-
exports.ButtonGroup = ButtonGroup;
|
|
51
|
-
exports.default = exports.ButtonGroup;
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
14
|
-
var t = {};
|
|
15
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
16
|
-
t[p] = s[p];
|
|
17
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
18
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
19
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
20
|
-
t[p[i]] = s[p[i]];
|
|
21
|
-
}
|
|
22
|
-
return t;
|
|
23
|
-
};
|
|
24
|
-
var __spreadArrays = (this && this.__spreadArrays) || function () {
|
|
25
|
-
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
|
|
26
|
-
for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
|
27
|
-
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
|
28
|
-
r[k] = a[j];
|
|
29
|
-
return r;
|
|
30
|
-
};
|
|
31
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
32
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
33
|
-
};
|
|
34
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
|
-
var react_1 = __importDefault(require("react"));
|
|
36
|
-
var material_1 = require("@mui/material");
|
|
37
|
-
var MenuItem_1 = require("@mui/material/MenuItem");
|
|
38
|
-
var SelectMenuItem = function (_a) {
|
|
39
|
-
var children = _a.children, _b = _a.value, value = _b === void 0 ? '' : _b, otherProps = __rest(_a, ["children", "value"]);
|
|
40
|
-
var menuItemSx = otherProps.sx, otherMenuItemProps = __rest(otherProps, ["sx"]);
|
|
41
|
-
return (react_1.default.createElement(material_1.MenuItem, __assign({ sx: __spreadArrays([
|
|
42
|
-
function (theme) {
|
|
43
|
-
var _a;
|
|
44
|
-
return (_a = {
|
|
45
|
-
whiteSpace: 'unset',
|
|
46
|
-
color: theme.palette.text.primary
|
|
47
|
-
},
|
|
48
|
-
_a["&." + MenuItem_1.menuItemClasses.selected] = {
|
|
49
|
-
backgroundColor: theme.palette.grey[300],
|
|
50
|
-
'&:hover': {
|
|
51
|
-
backgroundColor: theme.palette.grey[200],
|
|
52
|
-
},
|
|
53
|
-
},
|
|
54
|
-
_a);
|
|
55
|
-
}
|
|
56
|
-
], (Array.isArray(menuItemSx) ? menuItemSx : [menuItemSx])), value: value }, otherMenuItemProps), children));
|
|
57
|
-
};
|
|
58
|
-
exports.default = SelectMenuItem;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { RadioProps as MuiRadioProps, FormControlLabelProps as MuiFormControlLabelProps, TypographyProps as MuiTypographyProps } from '@mui/material';
|
|
2
|
-
export interface RadioProps extends MuiFormControlLabelProps {
|
|
3
|
-
color?: 'primary' | 'secondary' | 'default';
|
|
4
|
-
size?: 'medium' | 'small';
|
|
5
|
-
caption?: string;
|
|
6
|
-
FormControlLabelProps?: Partial<MuiFormControlLabelProps>;
|
|
7
|
-
RadioProps?: Partial<MuiRadioProps>;
|
|
8
|
-
TypographyProps?: Partial<MuiTypographyProps>;
|
|
9
|
-
}
|
|
10
|
-
export declare const Radio: ({ checked, disabled, label, labelPlacement, value, FormControlLabelProps, RadioProps, TypographyProps, color, size, caption, }: RadioProps) => JSX.Element;
|
|
11
|
-
export default Radio;
|
package/dist/lib/radio/Radio.js
DELETED
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
14
|
-
var t = {};
|
|
15
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
16
|
-
t[p] = s[p];
|
|
17
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
18
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
19
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
20
|
-
t[p[i]] = s[p[i]];
|
|
21
|
-
}
|
|
22
|
-
return t;
|
|
23
|
-
};
|
|
24
|
-
var __spreadArrays = (this && this.__spreadArrays) || function () {
|
|
25
|
-
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
|
|
26
|
-
for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
|
27
|
-
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
|
28
|
-
r[k] = a[j];
|
|
29
|
-
return r;
|
|
30
|
-
};
|
|
31
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
32
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
33
|
-
};
|
|
34
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
|
-
exports.Radio = void 0;
|
|
36
|
-
var react_1 = __importDefault(require("react"));
|
|
37
|
-
var styles_1 = require("@mui/material/styles");
|
|
38
|
-
var material_1 = require("@mui/material");
|
|
39
|
-
var FormControlLabel_1 = require("@mui/material/FormControlLabel");
|
|
40
|
-
var Radio_1 = require("@mui/material/Radio");
|
|
41
|
-
// self-defined-components
|
|
42
|
-
var StyledFormControlLabel = styles_1.styled(material_1.FormControlLabel)(function (_a) {
|
|
43
|
-
var _b, _c;
|
|
44
|
-
var theme = _a.theme;
|
|
45
|
-
return (_b = {},
|
|
46
|
-
_b["& ." + FormControlLabel_1.formControlLabelClasses.label] = (_c = {
|
|
47
|
-
color: theme.palette.text.secondary
|
|
48
|
-
},
|
|
49
|
-
_c["&." + FormControlLabel_1.formControlLabelClasses.disabled] = {
|
|
50
|
-
color: theme.palette.text.disabled,
|
|
51
|
-
},
|
|
52
|
-
_c),
|
|
53
|
-
_b["& ." + Radio_1.radioClasses.checked + " + ." + FormControlLabel_1.formControlLabelClasses.label] = {
|
|
54
|
-
color: theme.palette.text.primary,
|
|
55
|
-
},
|
|
56
|
-
_b);
|
|
57
|
-
});
|
|
58
|
-
var Radio = function (_a) {
|
|
59
|
-
var checked = _a.checked, disabled = _a.disabled, label = _a.label, labelPlacement = _a.labelPlacement, value = _a.value, _b = _a.FormControlLabelProps, FormControlLabelProps = _b === void 0 ? {} : _b, _c = _a.RadioProps, RadioProps = _c === void 0 ? {} : _c, _d = _a.TypographyProps, TypographyProps = _d === void 0 ? {} : _d, _e = _a.color, color = _e === void 0 ? 'secondary' : _e, _f = _a.size, size = _f === void 0 ? 'medium' : _f, _g = _a.caption, caption = _g === void 0 ? '' : _g;
|
|
60
|
-
var _h = RadioProps.sx, radioSx = _h === void 0 ? [] : _h, otherRadioProps = __rest(RadioProps, ["sx"]);
|
|
61
|
-
var _j = TypographyProps.sx, typographySx = _j === void 0 ? [] : _j, otherTypographyProps = __rest(TypographyProps, ["sx"]);
|
|
62
|
-
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
63
|
-
react_1.default.createElement(StyledFormControlLabel, __assign({ control: react_1.default.createElement(material_1.Radio, __assign({ sx: __spreadArrays([
|
|
64
|
-
function (theme) { return ({
|
|
65
|
-
color: theme.palette.text.primary,
|
|
66
|
-
}); }
|
|
67
|
-
], (Array.isArray(radioSx) ? radioSx : [radioSx])), color: color, size: size }, otherRadioProps)), checked: checked, disabled: disabled, label: label, labelPlacement: labelPlacement, value: value }, FormControlLabelProps)),
|
|
68
|
-
caption && (react_1.default.createElement(material_1.Typography, __assign({ sx: __spreadArrays([
|
|
69
|
-
function (theme) { return ({
|
|
70
|
-
color: theme.palette.text.disabled,
|
|
71
|
-
margin: '0 0 0 30px',
|
|
72
|
-
}); }
|
|
73
|
-
], (Array.isArray(typographySx) ? typographySx : [typographySx])), variant: "body2" }, otherTypographyProps), caption))));
|
|
74
|
-
};
|
|
75
|
-
exports.Radio = Radio;
|
|
76
|
-
exports.default = exports.Radio;
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { SelectProps as ISelectProps } from '../../interfaces';
|
|
2
|
-
export declare const OutlinedSelect: ({ label, helperText, FormControlProps, InputLabelProps, InputProps, SelectProps, FormHelperTextProps, className, children, color, size, paperMaxHeight, error, hasLabel, hasShrink, value, disabled, }: ISelectProps) => JSX.Element;
|
|
3
|
-
export default OutlinedSelect;
|
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
14
|
-
var t = {};
|
|
15
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
16
|
-
t[p] = s[p];
|
|
17
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
18
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
19
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
20
|
-
t[p[i]] = s[p[i]];
|
|
21
|
-
}
|
|
22
|
-
return t;
|
|
23
|
-
};
|
|
24
|
-
var __spreadArrays = (this && this.__spreadArrays) || function () {
|
|
25
|
-
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
|
|
26
|
-
for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
|
27
|
-
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
|
28
|
-
r[k] = a[j];
|
|
29
|
-
return r;
|
|
30
|
-
};
|
|
31
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
32
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
33
|
-
};
|
|
34
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
|
-
exports.OutlinedSelect = void 0;
|
|
36
|
-
var react_1 = __importDefault(require("react"));
|
|
37
|
-
var styles_1 = require("@mui/material/styles");
|
|
38
|
-
var material_1 = require("@mui/material");
|
|
39
|
-
var FormHelperText_1 = require("@mui/material/FormHelperText");
|
|
40
|
-
var InputLabel_1 = require("@mui/material/InputLabel");
|
|
41
|
-
var OutlinedInput_1 = require("@mui/material/OutlinedInput");
|
|
42
|
-
var InputBase_1 = require("@mui/material/InputBase");
|
|
43
|
-
var StyledInputLabel = styles_1.styled(material_1.InputLabel, {
|
|
44
|
-
shouldForwardProp: function (prop) { return prop !== 'color'; },
|
|
45
|
-
})(function (_a) {
|
|
46
|
-
var _b, _c;
|
|
47
|
-
var color = _a.color, theme = _a.theme;
|
|
48
|
-
return (_b = {
|
|
49
|
-
color: theme.palette.text.secondary
|
|
50
|
-
},
|
|
51
|
-
_b["&." + InputLabel_1.inputLabelClasses.outlined] = (_c = {},
|
|
52
|
-
_c["&:not(." + InputLabel_1.inputLabelClasses.disabled + ") ." + InputLabel_1.inputLabelClasses.focused] = {
|
|
53
|
-
color: theme.palette.action.active,
|
|
54
|
-
},
|
|
55
|
-
_c["&." + InputLabel_1.inputLabelClasses.sizeSmall + ":not(." + InputLabel_1.inputLabelClasses.shrink + ")"] = {
|
|
56
|
-
transform: 'translate(12px, 12px) scale(1)',
|
|
57
|
-
},
|
|
58
|
-
_c),
|
|
59
|
-
// eslint-disable-next-line
|
|
60
|
-
_b["&." + InputLabel_1.inputLabelClasses.shrink + ":not(." + InputLabel_1.inputLabelClasses.error + "):not(." + InputLabel_1.inputLabelClasses.disabled + ")." + InputLabel_1.inputLabelClasses.focused] = {
|
|
61
|
-
color: theme.palette[color].main,
|
|
62
|
-
},
|
|
63
|
-
_b["&." + InputLabel_1.inputLabelClasses.shrink] = {
|
|
64
|
-
backgroundColor: '#ffffff',
|
|
65
|
-
padding: '0 2px',
|
|
66
|
-
},
|
|
67
|
-
_b);
|
|
68
|
-
});
|
|
69
|
-
var StyledOutlinedInput = styles_1.styled(material_1.OutlinedInput)(function (_a) {
|
|
70
|
-
var _b, _c;
|
|
71
|
-
var theme = _a.theme;
|
|
72
|
-
return (_b = {},
|
|
73
|
-
_b["&." + OutlinedInput_1.outlinedInputClasses.root] = (_c = {},
|
|
74
|
-
_c["&." + OutlinedInput_1.outlinedInputClasses.error + "." + OutlinedInput_1.outlinedInputClasses.focused + " ." + OutlinedInput_1.outlinedInputClasses.notchedOutline] = {
|
|
75
|
-
borderColor: "" + theme.palette.error.main,
|
|
76
|
-
},
|
|
77
|
-
_c["& ." + InputBase_1.inputBaseClasses.inputSizeSmall] = {
|
|
78
|
-
padding: '12.5px 15px 12.5px 12px',
|
|
79
|
-
},
|
|
80
|
-
_c),
|
|
81
|
-
_b["& ." + OutlinedInput_1.outlinedInputClasses.input] = {
|
|
82
|
-
color: theme.palette.text.primary,
|
|
83
|
-
'&:focus': {
|
|
84
|
-
background: 'rgba(0,0,0,0)',
|
|
85
|
-
},
|
|
86
|
-
},
|
|
87
|
-
_b);
|
|
88
|
-
});
|
|
89
|
-
var OutlinedSelect = function (_a) {
|
|
90
|
-
var _b;
|
|
91
|
-
var label = _a.label, helperText = _a.helperText, _c = _a.FormControlProps, FormControlProps = _c === void 0 ? {} : _c, _d = _a.InputLabelProps, InputLabelProps = _d === void 0 ? {} : _d, _e = _a.InputProps, InputProps = _e === void 0 ? {} : _e, _f = _a.SelectProps, SelectProps = _f === void 0 ? {} : _f, _g = _a.FormHelperTextProps, FormHelperTextProps = _g === void 0 ? {} : _g, className = _a.className, children = _a.children, _h = _a.color, color = _h === void 0 ? 'primary' : _h, _j = _a.size, size = _j === void 0 ? 'small' : _j, _k = _a.paperMaxHeight, paperMaxHeight = _k === void 0 ? 'auto' : _k, _l = _a.error, error = _l === void 0 ? false : _l, _m = _a.hasLabel, hasLabel = _m === void 0 ? true : _m, _o = _a.hasShrink, hasShrink = _o === void 0 ? false : _o, _p = _a.value, value = _p === void 0 ? '' : _p, _q = _a.disabled, disabled = _q === void 0 ? false : _q;
|
|
92
|
-
var hasHelperText = !!helperText;
|
|
93
|
-
var _r = FormControlProps.sx, formControlSx = _r === void 0 ? [] : _r, otherFormControlProps = __rest(FormControlProps, ["sx"]);
|
|
94
|
-
var _s = FormHelperTextProps.sx, formHelperTextSx = _s === void 0 ? [] : _s, otherFormHelperTextProps = __rest(FormHelperTextProps, ["sx"]);
|
|
95
|
-
return (react_1.default.createElement(material_1.FormControl, __assign({ sx: __spreadArrays([
|
|
96
|
-
function (theme) {
|
|
97
|
-
var _a;
|
|
98
|
-
return ({
|
|
99
|
-
backgroundColor: 'white',
|
|
100
|
-
'&:hover': (_a = {},
|
|
101
|
-
// eslint-disable-next-line
|
|
102
|
-
_a["& :not(." + OutlinedInput_1.outlinedInputClasses.disabled + "):not(." + OutlinedInput_1.outlinedInputClasses.error + ") ." + OutlinedInput_1.outlinedInputClasses.notchedOutline] = {
|
|
103
|
-
borderColor: theme.palette[color].main,
|
|
104
|
-
},
|
|
105
|
-
_a),
|
|
106
|
-
});
|
|
107
|
-
}
|
|
108
|
-
], (Array.isArray(formControlSx) ? formControlSx : [formControlSx])), size: size, disabled: disabled, error: error, color: color, className: className }, otherFormControlProps),
|
|
109
|
-
hasLabel && (react_1.default.createElement(StyledInputLabel, __assign({ color: color, shrink: hasShrink ? true : undefined }, InputLabelProps), label)),
|
|
110
|
-
react_1.default.createElement(material_1.Select, __assign({ value: value, label: hasLabel ? label : undefined, MenuProps: {
|
|
111
|
-
PaperProps: {
|
|
112
|
-
sx: {
|
|
113
|
-
maxHeight: paperMaxHeight,
|
|
114
|
-
},
|
|
115
|
-
},
|
|
116
|
-
disableAutoFocusItem: true,
|
|
117
|
-
anchorOrigin: {
|
|
118
|
-
vertical: 2,
|
|
119
|
-
horizontal: 'left',
|
|
120
|
-
},
|
|
121
|
-
transformOrigin: {
|
|
122
|
-
vertical: 'top',
|
|
123
|
-
horizontal: 'left',
|
|
124
|
-
},
|
|
125
|
-
}, input: react_1.default.createElement(StyledOutlinedInput, __assign({ color: color, label: hasLabel ? label : undefined, disabled: disabled }, InputProps)) }, SelectProps), children),
|
|
126
|
-
hasHelperText && (react_1.default.createElement(material_1.FormHelperText, __assign({ sx: __assign((_b = {}, _b["&." + FormHelperText_1.formHelperTextClasses.root] = {
|
|
127
|
-
marginLeft: 0,
|
|
128
|
-
}, _b), (Array.isArray(formHelperTextSx)
|
|
129
|
-
? formHelperTextSx
|
|
130
|
-
: [formHelperTextSx])) }, otherFormHelperTextProps), helperText))));
|
|
131
|
-
};
|
|
132
|
-
exports.OutlinedSelect = OutlinedSelect;
|
|
133
|
-
exports.default = exports.OutlinedSelect;
|