@junyiacademy/ui-test 1.6.3 → 1.6.6
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/dist/index.js +20 -7
- package/dist/interfaces/index.js +2 -1
- package/dist/lib/button/Button.js +59 -36
- package/dist/lib/button-group/ButtonGroup.js +37 -15
- package/dist/lib/menu-item/SelectMenuItem.js +45 -19
- package/dist/lib/radio/Radio.js +59 -30
- package/dist/lib/select/OutlinedSelect.js +101 -63
- package/dist/lib/select/Select.js +26 -8
- package/dist/lib/select/StandardSelect.js +71 -43
- package/dist/lib/text-field/TextField.js +91 -59
- package/dist/lib/topic-filter/TopicFilter.js +90 -54
- package/dist/styles/theme.js +5 -3
- package/dist/utils/Capitalize.js +5 -2
- package/dist/utils/topicTree.js +4 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1,7 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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; } });
|
package/dist/interfaces/index.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -1,3 +1,15 @@
|
|
|
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
|
+
};
|
|
1
13
|
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
14
|
var t = {};
|
|
3
15
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
@@ -9,42 +21,53 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
9
21
|
}
|
|
10
22
|
return t;
|
|
11
23
|
};
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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");
|
|
16
33
|
// utils
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
shouldForwardProp: (prop)
|
|
20
|
-
})((
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
:
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
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
|
+
},
|
|
43
65
|
},
|
|
44
|
-
|
|
45
|
-
})
|
|
46
|
-
|
|
47
|
-
var
|
|
48
|
-
return (
|
|
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));
|
|
49
71
|
};
|
|
50
|
-
|
|
72
|
+
exports.Button = Button;
|
|
73
|
+
exports.default = exports.Button;
|
|
@@ -1,3 +1,15 @@
|
|
|
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
|
+
};
|
|
1
13
|
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
14
|
var t = {};
|
|
3
15
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
@@ -9,21 +21,31 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
9
21
|
}
|
|
10
22
|
return t;
|
|
11
23
|
};
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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");
|
|
16
33
|
// utils
|
|
17
|
-
|
|
34
|
+
var Capitalize_1 = __importDefault(require("../../utils/Capitalize"));
|
|
18
35
|
// self-defined-components
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
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));
|
|
28
49
|
};
|
|
29
|
-
|
|
50
|
+
exports.ButtonGroup = ButtonGroup;
|
|
51
|
+
exports.default = exports.ButtonGroup;
|
|
@@ -1,3 +1,15 @@
|
|
|
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
|
+
};
|
|
1
13
|
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
14
|
var t = {};
|
|
3
15
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
@@ -9,24 +21,38 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
9
21
|
}
|
|
10
22
|
return t;
|
|
11
23
|
};
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
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
|
+
},
|
|
26
53
|
},
|
|
27
|
-
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
], value: value }, otherMenuItemProps), children));
|
|
54
|
+
_a);
|
|
55
|
+
}
|
|
56
|
+
], (Array.isArray(menuItemSx) ? menuItemSx : [menuItemSx])), value: value }, otherMenuItemProps), children));
|
|
31
57
|
};
|
|
32
|
-
|
|
58
|
+
exports.default = SelectMenuItem;
|
package/dist/lib/radio/Radio.js
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
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
|
+
};
|
|
1
13
|
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
14
|
var t = {};
|
|
3
15
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
@@ -9,39 +21,56 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
9
21
|
}
|
|
10
22
|
return t;
|
|
11
23
|
};
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
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");
|
|
17
41
|
// self-defined-components
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
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,
|
|
23
55
|
},
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
},
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
React.createElement(StyledFormControlLabel, Object.assign({ control: React.createElement(MuiRadio, Object.assign({ sx: [
|
|
34
|
-
(theme) => ({
|
|
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 ({
|
|
35
65
|
color: theme.palette.text.primary,
|
|
36
|
-
})
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
(theme) => ({
|
|
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 ({
|
|
41
70
|
color: theme.palette.text.disabled,
|
|
42
71
|
margin: '0 0 0 30px',
|
|
43
|
-
})
|
|
44
|
-
|
|
45
|
-
], variant: "body2" }, otherTypographyProps), caption))));
|
|
72
|
+
}); }
|
|
73
|
+
], (Array.isArray(typographySx) ? typographySx : [typographySx])), variant: "body2" }, otherTypographyProps), caption))));
|
|
46
74
|
};
|
|
47
|
-
|
|
75
|
+
exports.Radio = Radio;
|
|
76
|
+
exports.default = exports.Radio;
|
|
@@ -1,3 +1,15 @@
|
|
|
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
|
+
};
|
|
1
13
|
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
14
|
var t = {};
|
|
3
15
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
@@ -9,68 +21,93 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
9
21
|
}
|
|
10
22
|
return t;
|
|
11
23
|
};
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
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
|
|
29
50
|
},
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
[`&.${outlinedInputClasses.root}`]: {
|
|
42
|
-
[`&.${outlinedInputClasses.error}.${outlinedInputClasses.focused} .${outlinedInputClasses.notchedOutline}`]: {
|
|
43
|
-
borderColor: `${theme.palette.error.main}`,
|
|
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,
|
|
44
62
|
},
|
|
45
|
-
[
|
|
46
|
-
|
|
63
|
+
_b["&." + InputLabel_1.inputLabelClasses.shrink] = {
|
|
64
|
+
backgroundColor: '#ffffff',
|
|
65
|
+
padding: '0 2px',
|
|
47
66
|
},
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
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
|
+
},
|
|
53
86
|
},
|
|
54
|
-
|
|
55
|
-
})
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
},
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
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: {
|
|
74
111
|
PaperProps: {
|
|
75
112
|
sx: {
|
|
76
113
|
maxHeight: paperMaxHeight,
|
|
@@ -85,11 +122,12 @@ export const OutlinedSelect = ({ label, helperText, FormControlProps = {}, Input
|
|
|
85
122
|
vertical: 'top',
|
|
86
123
|
horizontal: 'left',
|
|
87
124
|
},
|
|
88
|
-
}, input:
|
|
89
|
-
hasHelperText && (
|
|
90
|
-
|
|
91
|
-
|
|
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)
|
|
92
129
|
? formHelperTextSx
|
|
93
130
|
: [formHelperTextSx])) }, otherFormHelperTextProps), helperText))));
|
|
94
131
|
};
|
|
95
|
-
|
|
132
|
+
exports.OutlinedSelect = OutlinedSelect;
|
|
133
|
+
exports.default = exports.OutlinedSelect;
|
|
@@ -1,3 +1,15 @@
|
|
|
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
|
+
};
|
|
1
13
|
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
14
|
var t = {};
|
|
3
15
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
@@ -9,14 +21,20 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
9
21
|
}
|
|
10
22
|
return t;
|
|
11
23
|
};
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
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.Select = void 0;
|
|
29
|
+
var react_1 = __importDefault(require("react"));
|
|
30
|
+
var OutlinedSelect_1 = require("./OutlinedSelect");
|
|
31
|
+
var StandardSelect_1 = require("./StandardSelect");
|
|
32
|
+
function Select(_a) {
|
|
33
|
+
var variant = _a.variant, props = __rest(_a, ["variant"]);
|
|
17
34
|
if (variant === 'outlined') {
|
|
18
|
-
return
|
|
35
|
+
return react_1.default.createElement(OutlinedSelect_1.OutlinedSelect, __assign({}, props));
|
|
19
36
|
}
|
|
20
|
-
return
|
|
37
|
+
return react_1.default.createElement(StandardSelect_1.StandardSelect, __assign({}, props));
|
|
21
38
|
}
|
|
22
|
-
|
|
39
|
+
exports.Select = Select;
|
|
40
|
+
exports.default = Select;
|
|
@@ -1,46 +1,73 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
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 __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.StandardSelect = void 0;
|
|
18
|
+
var react_1 = __importDefault(require("react"));
|
|
19
|
+
var styles_1 = require("@mui/material/styles");
|
|
20
|
+
var material_1 = require("@mui/material");
|
|
21
|
+
var InputLabel_1 = require("@mui/material/InputLabel");
|
|
22
|
+
var Input_1 = require("@mui/material/Input");
|
|
23
|
+
var StyledInputLabel = styles_1.styled(material_1.InputLabel, {
|
|
24
|
+
shouldForwardProp: function (prop) { return prop !== 'color'; },
|
|
25
|
+
})(function (_a) {
|
|
26
|
+
var _b;
|
|
27
|
+
var color = _a.color, theme = _a.theme;
|
|
28
|
+
return (_b = {},
|
|
29
|
+
_b["&." + InputLabel_1.inputLabelClasses.root] = {
|
|
30
|
+
color: theme.palette.text.disabled,
|
|
26
31
|
},
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
'&:after,&:hover:before': {
|
|
30
|
-
borderBottomColor: theme.palette[color].main,
|
|
32
|
+
_b["&." + InputLabel_1.inputLabelClasses.focused] = {
|
|
33
|
+
color: theme.palette[color].main,
|
|
31
34
|
},
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
'&:after,&:hover:before': {
|
|
35
|
-
borderBottomColor: theme.palette.error.main,
|
|
35
|
+
_b["&." + InputLabel_1.inputLabelClasses.error] = {
|
|
36
|
+
color: theme.palette.error.main,
|
|
36
37
|
},
|
|
37
|
-
|
|
38
|
-
})
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
38
|
+
_b);
|
|
39
|
+
});
|
|
40
|
+
var StyledInput = styles_1.styled(material_1.Input, {
|
|
41
|
+
shouldForwardProp: function (prop) { return prop !== 'color'; },
|
|
42
|
+
})(function (_a) {
|
|
43
|
+
var _b;
|
|
44
|
+
var color = _a.color, theme = _a.theme;
|
|
45
|
+
return (_b = {
|
|
46
|
+
color: theme.palette.text.primary
|
|
47
|
+
},
|
|
48
|
+
_b["& ." + Input_1.inputClasses.input] = {
|
|
49
|
+
'&:focus': {
|
|
50
|
+
background: 'rgba(0,0,0,0)',
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
_b["&." + Input_1.inputClasses.underline + ":not(." + Input_1.inputClasses.disabled + "):not(." + Input_1.inputClasses.error + ")"] = {
|
|
54
|
+
'&:after,&:hover:before': {
|
|
55
|
+
borderBottomColor: theme.palette[color].main,
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
_b["&." + Input_1.inputClasses.underline + "." + Input_1.inputClasses.error + ":not(." + Input_1.inputClasses.disabled + ")"] = {
|
|
59
|
+
'&:after,&:hover:before': {
|
|
60
|
+
borderBottomColor: theme.palette.error.main,
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
_b);
|
|
64
|
+
});
|
|
65
|
+
function StandardSelect(_a) {
|
|
66
|
+
var label = _a.label, helperText = _a.helperText, _b = _a.FormControlProps, FormControlProps = _b === void 0 ? {} : _b, _c = _a.InputLabelProps, InputLabelProps = _c === void 0 ? {} : _c, _d = _a.InputProps, InputProps = _d === void 0 ? {} : _d, _e = _a.SelectProps, SelectProps = _e === void 0 ? {} : _e, _f = _a.FormHelperTextProps, FormHelperTextProps = _f === void 0 ? {} : _f, className = _a.className, children = _a.children, _g = _a.color, color = _g === void 0 ? 'primary' : _g, _h = _a.size, size = _h === void 0 ? 'small' : _h, _j = _a.paperMaxHeight, paperMaxHeight = _j === void 0 ? 'auto' : _j, _k = _a.error, error = _k === void 0 ? false : _k, _l = _a.hasShrink, hasShrink = _l === void 0 ? false : _l, _m = _a.value, value = _m === void 0 ? '' : _m, _o = _a.disabled, disabled = _o === void 0 ? false : _o;
|
|
67
|
+
var hasHelperText = !!helperText;
|
|
68
|
+
return (react_1.default.createElement(material_1.FormControl, __assign({ variant: "standard", color: color, size: size, disabled: disabled, error: error, className: className }, FormControlProps),
|
|
69
|
+
react_1.default.createElement(StyledInputLabel, __assign({ color: color, shrink: hasShrink ? true : undefined }, InputLabelProps), label),
|
|
70
|
+
react_1.default.createElement(material_1.Select, __assign({ label: label, value: value, MenuProps: {
|
|
44
71
|
PaperProps: {
|
|
45
72
|
sx: {
|
|
46
73
|
maxHeight: paperMaxHeight,
|
|
@@ -54,7 +81,8 @@ export function StandardSelect({ label, helperText, FormControlProps = {}, Input
|
|
|
54
81
|
vertical: 'top',
|
|
55
82
|
horizontal: 'left',
|
|
56
83
|
},
|
|
57
|
-
}, input:
|
|
58
|
-
hasHelperText && (
|
|
84
|
+
}, input: react_1.default.createElement(StyledInput, __assign({ color: color }, InputProps)) }, SelectProps), children),
|
|
85
|
+
hasHelperText && (react_1.default.createElement(material_1.FormHelperText, __assign({}, FormHelperTextProps), helperText))));
|
|
59
86
|
}
|
|
60
|
-
|
|
87
|
+
exports.StandardSelect = StandardSelect;
|
|
88
|
+
exports.default = StandardSelect;
|
|
@@ -1,3 +1,15 @@
|
|
|
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
|
+
};
|
|
1
13
|
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
14
|
var t = {};
|
|
3
15
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
@@ -9,70 +21,90 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
9
21
|
}
|
|
10
22
|
return t;
|
|
11
23
|
};
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
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.TextField = 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 TextField_1 = require("@mui/material/TextField");
|
|
40
|
+
var Input_1 = require("@mui/material/Input");
|
|
41
|
+
var InputLabel_1 = require("@mui/material/InputLabel");
|
|
42
|
+
var OutlinedInput_1 = require("@mui/material/OutlinedInput");
|
|
43
|
+
var FormHelperText_1 = require("@mui/material/FormHelperText");
|
|
20
44
|
// utils
|
|
21
|
-
|
|
45
|
+
var Capitalize_1 = __importDefault(require("../../utils/Capitalize"));
|
|
22
46
|
// self-defined-components
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
},
|
|
28
|
-
|
|
29
|
-
|
|
47
|
+
var StyledTextField = styles_1.styled(material_1.TextField)(function (_a) {
|
|
48
|
+
var _b, _c, _d, _e;
|
|
49
|
+
var label = _a.label, _f = _a.color, color = _f === void 0 ? 'primary' : _f, theme = _a.theme;
|
|
50
|
+
return (_b = {},
|
|
51
|
+
_b["& ." + InputLabel_1.inputLabelClasses.error] = (_c = {},
|
|
52
|
+
_c["&:not(." + InputLabel_1.inputLabelClasses.shrink + ")"] = {
|
|
53
|
+
color: theme.palette.text.secondary,
|
|
54
|
+
},
|
|
55
|
+
_c["&." + InputLabel_1.inputLabelClasses.disabled] = {
|
|
56
|
+
color: theme.palette.text.disabled,
|
|
57
|
+
},
|
|
58
|
+
_c),
|
|
59
|
+
_b["& ." + InputLabel_1.inputLabelClasses.error + "." + InputLabel_1.inputLabelClasses.focused] = {
|
|
60
|
+
color: theme.palette.error.main,
|
|
30
61
|
},
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
62
|
+
// For variant: standard | filled
|
|
63
|
+
_b["& ." + Input_1.inputClasses.underline + ":not(." + Input_1.inputClasses.disabled + ")"] = (_d = {},
|
|
64
|
+
_d["&.MuiInputBase-color" + Capitalize_1.default(color) + ":hover:before"] = {
|
|
65
|
+
borderColor: theme.palette[color].main,
|
|
66
|
+
},
|
|
67
|
+
_d),
|
|
68
|
+
// For variant: outlined
|
|
69
|
+
_b["& ." + Input_1.inputClasses.disabled + " ." + OutlinedInput_1.outlinedInputClasses.notchedOutline] = {
|
|
70
|
+
borderStyle: 'dotted',
|
|
39
71
|
},
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
[`& .${inputClasses.disabled} .${outlinedInputClasses.notchedOutline}`]: {
|
|
43
|
-
borderStyle: 'dotted',
|
|
44
|
-
},
|
|
45
|
-
[`& .${inputClasses.error}.${inputClasses.focused} .${outlinedInputClasses.notchedOutline}`]: {
|
|
46
|
-
borderColor: theme.palette.error.main,
|
|
47
|
-
},
|
|
48
|
-
[`&.${textFieldClasses.root} :not(.${inputClasses.disabled}):not(.${inputClasses.error})`]: {
|
|
49
|
-
[`&.MuiInputBase-color${capitalize(color)}:hover .${outlinedInputClasses.notchedOutline}`]: {
|
|
50
|
-
borderColor: theme.palette[color].main,
|
|
72
|
+
_b["& ." + Input_1.inputClasses.error + "." + Input_1.inputClasses.focused + " ." + OutlinedInput_1.outlinedInputClasses.notchedOutline] = {
|
|
73
|
+
borderColor: theme.palette.error.main,
|
|
51
74
|
},
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
75
|
+
_b["&." + TextField_1.textFieldClasses.root + " :not(." + Input_1.inputClasses.disabled + "):not(." + Input_1.inputClasses.error + ")"] = (_e = {},
|
|
76
|
+
_e["&.MuiInputBase-color" + Capitalize_1.default(color) + ":hover ." + OutlinedInput_1.outlinedInputClasses.notchedOutline] = {
|
|
77
|
+
borderColor: theme.palette[color].main,
|
|
78
|
+
},
|
|
79
|
+
_e),
|
|
80
|
+
_b["& ." + OutlinedInput_1.outlinedInputClasses.notchedOutline] = {
|
|
81
|
+
'& > legend': {
|
|
82
|
+
maxWidth: label === '' && 0,
|
|
83
|
+
},
|
|
56
84
|
},
|
|
57
|
-
|
|
58
|
-
})
|
|
59
|
-
|
|
85
|
+
_b);
|
|
86
|
+
});
|
|
87
|
+
var TextField = function (props) {
|
|
60
88
|
var _a;
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
return (
|
|
65
|
-
(theme)
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
[
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
89
|
+
var hasEndAdornment = !!((_a = props === null || props === void 0 ? void 0 : props.InputProps) === null || _a === void 0 ? void 0 : _a.endAdornment);
|
|
90
|
+
var InputLabelProps = props.InputLabelProps, InputProps = props.InputProps, _b = props.FormHelperTextProps, FormHelperTextProps = _b === void 0 ? {} : _b, otherProps = __rest(props, ["InputLabelProps", "InputProps", "FormHelperTextProps"]);
|
|
91
|
+
var _c = FormHelperTextProps.sx, formHelperTextSx = _c === void 0 ? [] : _c, otherFormHelperTextProps = __rest(FormHelperTextProps, ["sx"]);
|
|
92
|
+
return (react_1.default.createElement(StyledTextField, __assign({ InputLabelProps: __assign(__assign({}, InputLabelProps), { shrink: hasEndAdornment ? true : undefined }), FormHelperTextProps: __assign({ sx: __spreadArrays([
|
|
93
|
+
function (theme) {
|
|
94
|
+
var _a, _b;
|
|
95
|
+
return (_a = {},
|
|
96
|
+
_a["&." + FormHelperText_1.formHelperTextClasses.root] = (_b = {
|
|
97
|
+
marginLeft: 0
|
|
98
|
+
},
|
|
99
|
+
_b["&." + Input_1.inputClasses.error] = {
|
|
100
|
+
color: theme.palette.error.main,
|
|
101
|
+
},
|
|
102
|
+
_b),
|
|
103
|
+
_a);
|
|
104
|
+
}
|
|
105
|
+
], (Array.isArray(formHelperTextSx)
|
|
106
|
+
? formHelperTextSx
|
|
107
|
+
: [formHelperTextSx])) }, otherFormHelperTextProps), InputProps: __assign({}, InputProps) }, otherProps)));
|
|
77
108
|
};
|
|
78
|
-
|
|
109
|
+
exports.TextField = TextField;
|
|
110
|
+
exports.default = exports.TextField;
|
|
@@ -1,62 +1,97 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const LABEL = '請選擇';
|
|
9
|
-
const StyledSelect = styled(Select)(({ theme }) => ({
|
|
10
|
-
width: 220,
|
|
11
|
-
margin: theme.spacing(1),
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
12
8
|
}));
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
9
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
+
}) : function(o, v) {
|
|
12
|
+
o["default"] = v;
|
|
13
|
+
});
|
|
14
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
+
if (mod && mod.__esModule) return mod;
|
|
16
|
+
var result = {};
|
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
+
__setModuleDefault(result, mod);
|
|
19
|
+
return result;
|
|
20
|
+
};
|
|
21
|
+
var __spreadArrays = (this && this.__spreadArrays) || function () {
|
|
22
|
+
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
|
|
23
|
+
for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
|
24
|
+
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
|
25
|
+
r[k] = a[j];
|
|
26
|
+
return r;
|
|
27
|
+
};
|
|
28
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
29
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
30
|
+
};
|
|
31
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
32
|
+
exports.TopicFilter = void 0;
|
|
33
|
+
var react_1 = __importStar(require("react"));
|
|
34
|
+
var styles_1 = require("@mui/material/styles");
|
|
35
|
+
var ArrowRightRounded_1 = __importDefault(require("@mui/icons-material/ArrowRightRounded"));
|
|
36
|
+
var material_1 = require("@mui/material");
|
|
37
|
+
var Select_1 = __importDefault(require("../select/Select"));
|
|
38
|
+
var SelectMenuItem_1 = __importDefault(require("../menu-item/SelectMenuItem"));
|
|
39
|
+
// self-defined-configs
|
|
40
|
+
var LABEL = '請選擇';
|
|
41
|
+
var StyledSelect = styles_1.styled(Select_1.default)(function (_a) {
|
|
42
|
+
var theme = _a.theme;
|
|
43
|
+
return ({
|
|
44
|
+
width: 220,
|
|
45
|
+
margin: theme.spacing(1),
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
var TopicFilter = function (_a) {
|
|
49
|
+
var topicTree = _a.topicTree, onTopicSelected = _a.onTopicSelected, isLastLayer = _a.isLastLayer, hasArrow = _a.hasArrow, initSelectedTopicIds = _a.initSelectedTopicIds;
|
|
50
|
+
var _b = react_1.useState([]), selectedTopicIds = _b[0], setSelectedTopicIds = _b[1];
|
|
51
|
+
var _c = react_1.useState([]), layeredTopicList = _c[0], setLayeredTopicList = _c[1];
|
|
52
|
+
var _d = react_1.useState([]), isFocusedList = _d[0], setIsFocusedList = _d[1];
|
|
53
|
+
var initSelectedLayers = function () {
|
|
54
|
+
var newLayeredTopicList = initSelectedTopicIds.reduce(function (topicListAccumulator, topicId, index) {
|
|
19
55
|
var _a, _b;
|
|
20
|
-
|
|
56
|
+
var selectedTopic = (_b = (_a = topicListAccumulator[index]) === null || _a === void 0 ? void 0 : _a.childTopics) === null || _b === void 0 ? void 0 : _b.find(function (childTopic) { return childTopic.id === topicId; });
|
|
21
57
|
if (!selectedTopic) {
|
|
22
58
|
return topicListAccumulator;
|
|
23
59
|
}
|
|
24
60
|
if (isLastLayer(selectedTopic)) {
|
|
25
61
|
return topicListAccumulator;
|
|
26
62
|
}
|
|
27
|
-
return
|
|
63
|
+
return __spreadArrays(topicListAccumulator, [selectedTopic]);
|
|
28
64
|
}, [topicTree]);
|
|
29
65
|
setLayeredTopicList(newLayeredTopicList);
|
|
30
66
|
setSelectedTopicIds(initSelectedTopicIds.slice(0, newLayeredTopicList.length));
|
|
31
67
|
setIsFocusedList(Array(newLayeredTopicList.length).fill(false));
|
|
32
68
|
};
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
...selectedTopicIds.slice(0, layerNumber),
|
|
69
|
+
var handleChange = function (e, layerNumber, layeredTopic) {
|
|
70
|
+
var selectedTopic = layeredTopic.childTopics.find(function (childTopic) { return childTopic.id === e.target.value; });
|
|
71
|
+
var newSelectedTopicIds = __spreadArrays(selectedTopicIds.slice(0, layerNumber), [
|
|
37
72
|
selectedTopic.id,
|
|
38
|
-
];
|
|
73
|
+
]);
|
|
39
74
|
setSelectedTopicIds(newSelectedTopicIds);
|
|
40
75
|
onTopicSelected(selectedTopic, {
|
|
41
|
-
layerNumber,
|
|
76
|
+
layerNumber: layerNumber,
|
|
42
77
|
selectedTopicIds: newSelectedTopicIds,
|
|
43
78
|
});
|
|
44
79
|
if (isLastLayer(selectedTopic)) {
|
|
45
|
-
setLayeredTopicList((prevTopicList)
|
|
46
|
-
|
|
80
|
+
setLayeredTopicList(function (prevTopicList) {
|
|
81
|
+
return prevTopicList.slice(0, layerNumber + 1);
|
|
82
|
+
});
|
|
83
|
+
setIsFocusedList(function (prevList) { return prevList.slice(0, layerNumber + 1); });
|
|
47
84
|
}
|
|
48
85
|
else {
|
|
49
|
-
setLayeredTopicList((prevTopicList)
|
|
50
|
-
...prevTopicList.slice(0, layerNumber + 1),
|
|
86
|
+
setLayeredTopicList(function (prevTopicList) { return __spreadArrays(prevTopicList.slice(0, layerNumber + 1), [
|
|
51
87
|
selectedTopic,
|
|
52
|
-
]);
|
|
53
|
-
setIsFocusedList((prevList)
|
|
54
|
-
...prevList.slice(0, layerNumber + 1),
|
|
88
|
+
]); });
|
|
89
|
+
setIsFocusedList(function (prevList) { return __spreadArrays(prevList.slice(0, layerNumber + 1), [
|
|
55
90
|
false,
|
|
56
|
-
]);
|
|
91
|
+
]); });
|
|
57
92
|
}
|
|
58
93
|
};
|
|
59
|
-
useEffect(()
|
|
94
|
+
react_1.useEffect(function () {
|
|
60
95
|
if (!topicTree || Object.keys(topicTree).length === 0) {
|
|
61
96
|
return;
|
|
62
97
|
}
|
|
@@ -67,49 +102,50 @@ export const TopicFilter = ({ topicTree, onTopicSelected, isLastLayer, hasArrow,
|
|
|
67
102
|
setLayeredTopicList([topicTree]);
|
|
68
103
|
}, [topicTree]);
|
|
69
104
|
if (layeredTopicList.length === 0) {
|
|
70
|
-
return (
|
|
105
|
+
return (react_1.default.createElement(StyledSelect, { variant: "outlined", size: "small", label: "\u8F09\u5165\u8CC7\u6599\u4E2D...", disabled: true }));
|
|
71
106
|
}
|
|
72
|
-
return (
|
|
107
|
+
return (react_1.default.createElement(material_1.Box, { sx: {
|
|
73
108
|
display: 'flex',
|
|
74
109
|
alignItems: 'center',
|
|
75
110
|
flexWrap: 'wrap',
|
|
76
|
-
} }, layeredTopicList.map((layeredTopic, layerNumber)
|
|
77
|
-
|
|
78
|
-
return (
|
|
111
|
+
} }, layeredTopicList.map(function (layeredTopic, layerNumber) {
|
|
112
|
+
var hasLabel = isFocusedList[layerNumber] || !selectedTopicIds[layerNumber];
|
|
113
|
+
return (react_1.default.createElement(material_1.Box, { sx: {
|
|
79
114
|
display: 'flex',
|
|
80
115
|
alignItems: 'center',
|
|
81
116
|
}, key: layeredTopic.id },
|
|
82
|
-
|
|
83
|
-
'data-testid':
|
|
117
|
+
react_1.default.createElement(StyledSelect, { variant: "outlined", size: "small", label: LABEL, paperMaxHeight: 412, hasLabel: hasLabel, value: (selectedTopicIds === null || selectedTopicIds === void 0 ? void 0 : selectedTopicIds[layerNumber]) || '', SelectProps: {
|
|
118
|
+
'data-testid': "layered-topic-" + layerNumber,
|
|
84
119
|
}, InputProps: {
|
|
85
120
|
inputProps: {
|
|
86
|
-
'aria-label':
|
|
121
|
+
'aria-label': "layered-topic-" + layerNumber,
|
|
87
122
|
},
|
|
88
|
-
onChange: (e)
|
|
123
|
+
onChange: function (e) {
|
|
89
124
|
handleChange(e, layerNumber, layeredTopic);
|
|
90
125
|
},
|
|
91
|
-
onFocus: ()
|
|
92
|
-
setIsFocusedList((prevList)
|
|
93
|
-
|
|
126
|
+
onFocus: function () {
|
|
127
|
+
setIsFocusedList(function (prevList) {
|
|
128
|
+
var newList = __spreadArrays(prevList);
|
|
94
129
|
newList[layerNumber] = true;
|
|
95
130
|
return newList;
|
|
96
131
|
});
|
|
97
132
|
},
|
|
98
|
-
onBlur: ()
|
|
99
|
-
setIsFocusedList((prevList)
|
|
100
|
-
|
|
133
|
+
onBlur: function () {
|
|
134
|
+
setIsFocusedList(function (prevList) {
|
|
135
|
+
var newList = __spreadArrays(prevList);
|
|
101
136
|
newList[layerNumber] = false;
|
|
102
137
|
return newList;
|
|
103
138
|
});
|
|
104
139
|
},
|
|
105
140
|
} },
|
|
106
|
-
|
|
107
|
-
layeredTopic.childTopics.map((childTopic)
|
|
108
|
-
hasArrow && layerNumber !== layeredTopicList.length - 1 && (
|
|
141
|
+
react_1.default.createElement(SelectMenuItem_1.default, { disabled: true, value: "" }, LABEL),
|
|
142
|
+
layeredTopic.childTopics.map(function (childTopic) { return (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)); })),
|
|
143
|
+
hasArrow && layerNumber !== layeredTopicList.length - 1 && (react_1.default.createElement(ArrowRightRounded_1.default, { sx: function (theme) { return ({
|
|
109
144
|
margin: theme.spacing(-1, -1.5),
|
|
110
145
|
fontSize: theme.spacing(7),
|
|
111
146
|
color: '#444',
|
|
112
|
-
}), fontSize: "large", "data-testid": "topic-filter-arrow" }))));
|
|
147
|
+
}); }, fontSize: "large", "data-testid": "topic-filter-arrow" }))));
|
|
113
148
|
})));
|
|
114
149
|
};
|
|
115
|
-
|
|
150
|
+
exports.TopicFilter = TopicFilter;
|
|
151
|
+
exports.default = exports.TopicFilter;
|
package/dist/styles/theme.js
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
/**
|
|
2
3
|
* Copyright (c) 2020 Junyi Academy.
|
|
3
4
|
*
|
|
4
5
|
* This source code is licensed under the MIT license found in the
|
|
5
6
|
* LICENSE file in the root directory of this source tree.
|
|
6
7
|
*/
|
|
7
|
-
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
var styles_1 = require("@mui/material/styles");
|
|
8
10
|
// Create a theme instance.
|
|
9
|
-
|
|
11
|
+
var theme = styles_1.createTheme({
|
|
10
12
|
typography: {
|
|
11
13
|
fontFamily: ['Noto Sans TC', 'Helvetica', 'Arial', 'sans-serif'].join(','),
|
|
12
14
|
},
|
|
@@ -37,4 +39,4 @@ const theme = createTheme({
|
|
|
37
39
|
},
|
|
38
40
|
},
|
|
39
41
|
});
|
|
40
|
-
|
|
42
|
+
exports.default = theme;
|
package/dist/utils/Capitalize.js
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
function capitalize(string) {
|
|
4
|
+
return "" + string.charAt(0).toUpperCase() + string.slice(1);
|
|
3
5
|
}
|
|
6
|
+
exports.default = capitalize;
|
package/dist/utils/topicTree.js
CHANGED
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@junyiacademy/ui-test",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.6",
|
|
4
4
|
"description": "junyiacademy ui library",
|
|
5
|
-
"main": "./dist/
|
|
6
|
-
"typings": "./dist/
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
|
+
"typings": "./dist/index.d.ts",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
9
9
|
"build": "tsc --build --clean && tsc --build"
|