@redocly/theme 0.6.5 → 0.7.1
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/lib/Feedback/Comment.d.ts +3 -0
- package/lib/Feedback/Comment.js +80 -0
- package/lib/Feedback/Rating.js +23 -10
- package/lib/Feedback/Reasons.d.ts +3 -0
- package/lib/Feedback/Reasons.js +85 -0
- package/lib/Feedback/Sentiment.js +28 -4
- package/lib/Feedback/index.d.ts +4 -2
- package/lib/Feedback/index.js +7 -3
- package/lib/Feedback/types.d.ts +48 -3
- package/lib/Markdown/Tabs/Tab.js +11 -5
- package/lib/Markdown/Tabs/Tabs.js +14 -5
- package/lib/Navbar/Navbar.js +3 -1
- package/lib/Pages/Forbidden.d.ts +2 -0
- package/lib/Pages/Forbidden.js +39 -0
- package/lib/Pages/NotFound.d.ts +2 -0
- package/lib/Pages/NotFound.js +39 -0
- package/lib/Pages/index.d.ts +1 -0
- package/lib/Pages/index.js +18 -0
- package/lib/Search/Autocomplete.d.ts +4 -1
- package/lib/Search/Autocomplete.js +19 -3
- package/lib/Search/ClearIcon.js +1 -1
- package/lib/Search/Input.js +1 -1
- package/lib/Search/Search.js +6 -1
- package/lib/Search/SearchIcon.js +1 -1
- package/lib/Search/ShortcutKey.d.ts +7 -0
- package/lib/Search/ShortcutKey.js +35 -0
- package/lib/config.d.ts +11 -0
- package/lib/config.js +2 -0
- package/lib/globalStyle.js +59 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/mocks/Link.js +1 -1
- package/lib/mocks/hooks/index.js +5 -1
- package/lib/mocks/search.js +18 -5
- package/lib/ui/darkColors.js +5 -0
- package/package.json +8 -4
- package/src/Feedback/Comment.tsx +64 -0
- package/src/Feedback/Rating.tsx +45 -17
- package/src/Feedback/Reasons.tsx +81 -0
- package/src/Feedback/Sentiment.tsx +44 -5
- package/src/Feedback/index.ts +4 -2
- package/src/Feedback/types.ts +37 -3
- package/src/Markdown/Tabs/Tab.tsx +11 -5
- package/src/Markdown/Tabs/Tabs.tsx +14 -5
- package/src/Navbar/Navbar.tsx +5 -1
- package/src/Pages/Forbidden.tsx +42 -0
- package/src/Pages/NotFound.tsx +42 -0
- package/src/Pages/index.ts +1 -0
- package/src/Search/Autocomplete.tsx +26 -2
- package/src/Search/ClearIcon.tsx +1 -1
- package/src/Search/Input.tsx +1 -1
- package/src/Search/Search.tsx +3 -0
- package/src/Search/SearchIcon.tsx +1 -1
- package/src/Search/ShortcutKey.tsx +35 -0
- package/src/config.ts +5 -0
- package/src/globalStyle.ts +60 -1
- package/src/index.ts +1 -0
- package/src/mocks/Link.tsx +2 -1
- package/src/mocks/hooks/index.ts +5 -1
- package/src/mocks/search.ts +20 -5
- package/src/ui/darkColors.tsx +5 -0
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.Comment = void 0;
|
|
30
|
+
const React = __importStar(require("react"));
|
|
31
|
+
const styled_components_1 = __importDefault(require("styled-components"));
|
|
32
|
+
const _theme_1 = require("../index.js");
|
|
33
|
+
const Comment = ({ settings, onSubmit }) => {
|
|
34
|
+
const { label, submitText } = settings || {};
|
|
35
|
+
const [text, setText] = React.useState('');
|
|
36
|
+
const [submitValue, setSubmitValue] = React.useState('');
|
|
37
|
+
const send = () => {
|
|
38
|
+
if (!text)
|
|
39
|
+
return;
|
|
40
|
+
setSubmitValue(text);
|
|
41
|
+
onSubmit({ comment: text });
|
|
42
|
+
};
|
|
43
|
+
const handleTextAreaChange = (e) => {
|
|
44
|
+
setText(e.target.value);
|
|
45
|
+
};
|
|
46
|
+
if (submitValue) {
|
|
47
|
+
return (React.createElement(Wrapper, null,
|
|
48
|
+
React.createElement(Label, null, submitText || 'Thank you for helping improve our documentation!')));
|
|
49
|
+
}
|
|
50
|
+
return (React.createElement(Wrapper, { "data-component-name": "Feedback/Comment" },
|
|
51
|
+
React.createElement(Label, null, label || 'Please share your feedback with us:'),
|
|
52
|
+
React.createElement(TextArea, { rows: 3, onChange: handleTextAreaChange }),
|
|
53
|
+
React.createElement(SendButton, { onClick: send }, "Send")));
|
|
54
|
+
};
|
|
55
|
+
exports.Comment = Comment;
|
|
56
|
+
const Wrapper = styled_components_1.default.div `
|
|
57
|
+
font-family: var(--font-family-base);
|
|
58
|
+
display: flex;
|
|
59
|
+
flex-direction: column;
|
|
60
|
+
width: 100%;
|
|
61
|
+
`;
|
|
62
|
+
const Label = styled_components_1.default.h3 `
|
|
63
|
+
margin-right: 15px;
|
|
64
|
+
`;
|
|
65
|
+
const TextArea = styled_components_1.default.textarea `
|
|
66
|
+
font-family: var(--font-family-base);
|
|
67
|
+
border: 1px solid #ccc;
|
|
68
|
+
border-radius: 5px;
|
|
69
|
+
color: black;
|
|
70
|
+
margin: 0 0 10px 0;
|
|
71
|
+
padding: 10px;
|
|
72
|
+
`;
|
|
73
|
+
const SendButton = (0, styled_components_1.default)(_theme_1.Button).attrs(() => ({
|
|
74
|
+
color: 'primary',
|
|
75
|
+
})) `
|
|
76
|
+
width: 100px;
|
|
77
|
+
margin-left: 0;
|
|
78
|
+
margin-right: 0;
|
|
79
|
+
`;
|
|
80
|
+
//# sourceMappingURL=Comment.js.map
|
package/lib/Feedback/Rating.js
CHANGED
|
@@ -29,19 +29,32 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
29
29
|
exports.Rating = void 0;
|
|
30
30
|
const React = __importStar(require("react"));
|
|
31
31
|
const styled_components_1 = __importDefault(require("styled-components"));
|
|
32
|
+
const Feedback_1 = require("../Feedback");
|
|
32
33
|
const Rating = ({ settings, onSubmit }) => {
|
|
33
|
-
const { label, max, submitText } = settings || {};
|
|
34
|
-
const [
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
const { label, max, submitText, comment: commentSettings, reasons: reasonsSettings, } = settings || {};
|
|
35
|
+
const [score, setScore] = React.useState(0);
|
|
36
|
+
const [comment, setComment] = React.useState('');
|
|
37
|
+
const [reasons, setReasons] = React.useState([]);
|
|
38
|
+
if (score && (reasonsSettings === null || reasonsSettings === void 0 ? void 0 : reasonsSettings.enable) && !reasons.length) {
|
|
39
|
+
const { label: reasonsLabel, items, multi } = reasonsSettings;
|
|
40
|
+
const buttonText = (commentSettings === null || commentSettings === void 0 ? void 0 : commentSettings.enable) ? 'Next' : 'Send';
|
|
41
|
+
return (React.createElement(Feedback_1.Reasons, { onSubmit: ({ reasons }) => setReasons(reasons), settings: { label: reasonsLabel, items, multi, buttonText } }));
|
|
42
|
+
}
|
|
43
|
+
if (score && (commentSettings === null || commentSettings === void 0 ? void 0 : commentSettings.enable) && !comment) {
|
|
44
|
+
return (React.createElement(Feedback_1.Comment, { onSubmit: ({ comment }) => setComment(comment), settings: { label: commentSettings.label } }));
|
|
45
|
+
}
|
|
46
|
+
if (score) {
|
|
47
|
+
onSubmit({
|
|
48
|
+
score,
|
|
49
|
+
comment,
|
|
50
|
+
reasons,
|
|
51
|
+
});
|
|
52
|
+
return (React.createElement(Wrapper, null,
|
|
37
53
|
React.createElement(Label, null, submitText || 'Thank you for helping improve our documentation!')));
|
|
38
54
|
}
|
|
39
|
-
return (React.createElement(
|
|
55
|
+
return (React.createElement(Wrapper, { "data-component-name": "Feedback/Rating" },
|
|
40
56
|
React.createElement(Label, null, label || 'How helpful was this page?'),
|
|
41
|
-
React.createElement(Stars, { max: max || 5, onSubmit:
|
|
42
|
-
setSubmitValue(value);
|
|
43
|
-
onSubmit(value);
|
|
44
|
-
} })));
|
|
57
|
+
React.createElement(Stars, { max: max || 5, onSubmit: setScore })));
|
|
45
58
|
};
|
|
46
59
|
exports.Rating = Rating;
|
|
47
60
|
const Stars = ({ max, onSubmit }) => {
|
|
@@ -55,7 +68,7 @@ const Stars = ({ max, onSubmit }) => {
|
|
|
55
68
|
}
|
|
56
69
|
return React.createElement(React.Fragment, null, stars);
|
|
57
70
|
};
|
|
58
|
-
const
|
|
71
|
+
const Wrapper = styled_components_1.default.div `
|
|
59
72
|
display: flex;
|
|
60
73
|
align-items: center;
|
|
61
74
|
`;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.Reasons = void 0;
|
|
30
|
+
const React = __importStar(require("react"));
|
|
31
|
+
const styled_components_1 = __importDefault(require("styled-components"));
|
|
32
|
+
const _theme_1 = require("../index.js");
|
|
33
|
+
const Reasons = ({ settings, onSubmit }) => {
|
|
34
|
+
const { label, multi, buttonText, items = [] } = settings;
|
|
35
|
+
const [checkedState, setCheckedState] = React.useState(new Array(items.length).fill(false));
|
|
36
|
+
if (!items.length) {
|
|
37
|
+
return React.createElement(React.Fragment, null);
|
|
38
|
+
}
|
|
39
|
+
const input_type = multi ? 'checkbox' : 'radio';
|
|
40
|
+
const handleOptionChange = (position) => {
|
|
41
|
+
const updatedCheckedState = multi
|
|
42
|
+
? checkedState.map((item, index) => (index === position ? !item : item))
|
|
43
|
+
: items.map((_, idx) => position === idx);
|
|
44
|
+
setCheckedState(updatedCheckedState);
|
|
45
|
+
};
|
|
46
|
+
const submitForm = () => {
|
|
47
|
+
onSubmit({ reasons: items.filter((_, index) => !!checkedState[index]) });
|
|
48
|
+
};
|
|
49
|
+
return (React.createElement(Wrapper, { "data-component-name": "Feedback/Reasons" },
|
|
50
|
+
React.createElement(Label, null, label || 'Which statement describes your thoughts about this page?'),
|
|
51
|
+
items.map((reason, idx) => (React.createElement(OptionWrapper, { key: reason },
|
|
52
|
+
React.createElement("input", { type: input_type, value: reason, checked: checkedState[idx], name: "reasons", onChange: () => handleOptionChange(idx) }),
|
|
53
|
+
React.createElement("label", { id: reason, onClick: () => handleOptionChange(idx) }, reason)))),
|
|
54
|
+
React.createElement(SendButton, { onClick: submitForm }, buttonText || 'Send')));
|
|
55
|
+
};
|
|
56
|
+
exports.Reasons = Reasons;
|
|
57
|
+
const Wrapper = styled_components_1.default.div `
|
|
58
|
+
font-family: var(--font-family-base);
|
|
59
|
+
display: flex;
|
|
60
|
+
flex-direction: column;
|
|
61
|
+
`;
|
|
62
|
+
const Label = styled_components_1.default.h3 `
|
|
63
|
+
margin-right: 15px;
|
|
64
|
+
`;
|
|
65
|
+
const SendButton = (0, styled_components_1.default)(_theme_1.Button).attrs(() => ({
|
|
66
|
+
color: 'primary',
|
|
67
|
+
})) `
|
|
68
|
+
width: 100px;
|
|
69
|
+
margin-left: 0;
|
|
70
|
+
margin-right: 0;
|
|
71
|
+
margin-top: 15px;
|
|
72
|
+
`;
|
|
73
|
+
const OptionWrapper = styled_components_1.default.div `
|
|
74
|
+
margin: 5px 0;
|
|
75
|
+
display: flex;
|
|
76
|
+
input {
|
|
77
|
+
margin-right: 10px;
|
|
78
|
+
cursor: pointer;
|
|
79
|
+
}
|
|
80
|
+
label {
|
|
81
|
+
font-size: 14px;
|
|
82
|
+
cursor: pointer;
|
|
83
|
+
}
|
|
84
|
+
`;
|
|
85
|
+
//# sourceMappingURL=Reasons.js.map
|
|
@@ -29,14 +29,38 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
29
29
|
exports.Sentiment = void 0;
|
|
30
30
|
const React = __importStar(require("react"));
|
|
31
31
|
const styled_components_1 = __importDefault(require("styled-components"));
|
|
32
|
+
const Feedback_1 = require("../Feedback");
|
|
32
33
|
const Thumbs_1 = require("./Thumbs");
|
|
33
34
|
const Sentiment = ({ settings, onSubmit }) => {
|
|
34
|
-
const { label } = settings || {};
|
|
35
|
-
|
|
35
|
+
const { label, submitText, comment: commentSettings, reasons: reasonsSettings } = settings || {};
|
|
36
|
+
const [score, setScore] = React.useState(0);
|
|
37
|
+
const [comment, setComment] = React.useState('');
|
|
38
|
+
const [reasons, setReasons] = React.useState([]);
|
|
39
|
+
if (score && (reasonsSettings === null || reasonsSettings === void 0 ? void 0 : reasonsSettings.enable) && !reasons.length) {
|
|
40
|
+
const { label: reasonsLabel, items, multi } = reasonsSettings;
|
|
41
|
+
const buttonText = (commentSettings === null || commentSettings === void 0 ? void 0 : commentSettings.enable) ? 'Next' : 'Send';
|
|
42
|
+
return (React.createElement(Feedback_1.Reasons, { onSubmit: ({ reasons }) => setReasons(reasons), settings: { label: reasonsLabel, items, multi, buttonText } }));
|
|
43
|
+
}
|
|
44
|
+
if (score && (commentSettings === null || commentSettings === void 0 ? void 0 : commentSettings.enable) && !comment) {
|
|
45
|
+
const commentLabel = score === 1
|
|
46
|
+
? commentSettings.likeLabel || 'What was most helpful?'
|
|
47
|
+
: commentSettings.dislikeLabel || 'What can we improve?';
|
|
48
|
+
return (React.createElement(Feedback_1.Comment, { onSubmit: ({ comment }) => setComment(comment), settings: { label: commentLabel } }));
|
|
49
|
+
}
|
|
50
|
+
if (score) {
|
|
51
|
+
onSubmit({
|
|
52
|
+
score,
|
|
53
|
+
comment,
|
|
54
|
+
reasons,
|
|
55
|
+
});
|
|
56
|
+
return (React.createElement(Wrapper, null,
|
|
57
|
+
React.createElement(Label, null, submitText || 'Thank you for helping improve our documentation!')));
|
|
58
|
+
}
|
|
59
|
+
return (React.createElement(Wrapper, { "data-component-name": "Feedback/Sentiment" },
|
|
36
60
|
React.createElement(Label, null, label || 'Was this page helpful?'),
|
|
37
|
-
React.createElement(Vote, { onClick: () =>
|
|
61
|
+
React.createElement(Vote, { onClick: () => setScore(1) },
|
|
38
62
|
React.createElement(Thumbs_1.ThumbUp, { text: "Yes" })),
|
|
39
|
-
React.createElement(Vote, { onClick: () =>
|
|
63
|
+
React.createElement(Vote, { onClick: () => setScore(-1) },
|
|
40
64
|
React.createElement(Thumbs_1.ThumbDown, null))));
|
|
41
65
|
};
|
|
42
66
|
exports.Sentiment = Sentiment;
|
package/lib/Feedback/index.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
-
export { Rating } from '
|
|
2
|
-
export { Sentiment } from '
|
|
1
|
+
export { Rating } from '../Feedback/Rating';
|
|
2
|
+
export { Sentiment } from '../Feedback/Sentiment';
|
|
3
|
+
export { Comment } from '../Feedback/Comment';
|
|
4
|
+
export { Reasons } from '../Feedback/Reasons';
|
|
3
5
|
export * from './types';
|
package/lib/Feedback/index.js
CHANGED
|
@@ -14,10 +14,14 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.Sentiment = exports.Rating = void 0;
|
|
18
|
-
var Rating_1 = require("
|
|
17
|
+
exports.Reasons = exports.Comment = exports.Sentiment = exports.Rating = void 0;
|
|
18
|
+
var Rating_1 = require("../Feedback/Rating");
|
|
19
19
|
Object.defineProperty(exports, "Rating", { enumerable: true, get: function () { return Rating_1.Rating; } });
|
|
20
|
-
var Sentiment_1 = require("
|
|
20
|
+
var Sentiment_1 = require("../Feedback/Sentiment");
|
|
21
21
|
Object.defineProperty(exports, "Sentiment", { enumerable: true, get: function () { return Sentiment_1.Sentiment; } });
|
|
22
|
+
var Comment_1 = require("../Feedback/Comment");
|
|
23
|
+
Object.defineProperty(exports, "Comment", { enumerable: true, get: function () { return Comment_1.Comment; } });
|
|
24
|
+
var Reasons_1 = require("../Feedback/Reasons");
|
|
25
|
+
Object.defineProperty(exports, "Reasons", { enumerable: true, get: function () { return Reasons_1.Reasons; } });
|
|
22
26
|
__exportStar(require("./types"), exports);
|
|
23
27
|
//# sourceMappingURL=index.js.map
|
package/lib/Feedback/types.d.ts
CHANGED
|
@@ -1,21 +1,66 @@
|
|
|
1
1
|
export type RatingProps = {
|
|
2
|
-
onSubmit: (value:
|
|
2
|
+
onSubmit: (value: {
|
|
3
|
+
score: number;
|
|
4
|
+
comment?: string;
|
|
5
|
+
reasons?: string[];
|
|
6
|
+
}) => void;
|
|
3
7
|
settings?: {
|
|
4
8
|
label?: string;
|
|
5
9
|
max?: number;
|
|
6
10
|
submitText?: string;
|
|
11
|
+
comment?: {
|
|
12
|
+
enable: boolean;
|
|
13
|
+
label?: string;
|
|
14
|
+
};
|
|
15
|
+
reasons?: {
|
|
16
|
+
enable: boolean;
|
|
17
|
+
label?: string;
|
|
18
|
+
multi?: boolean;
|
|
19
|
+
items: string[];
|
|
20
|
+
};
|
|
7
21
|
};
|
|
8
22
|
};
|
|
9
23
|
export type SentimentProps = {
|
|
10
|
-
onSubmit: (value:
|
|
24
|
+
onSubmit: (value: {
|
|
25
|
+
score: number;
|
|
26
|
+
comment?: string;
|
|
27
|
+
reasons?: string[];
|
|
28
|
+
}) => void;
|
|
11
29
|
settings?: {
|
|
12
30
|
label?: string;
|
|
31
|
+
submitText?: string;
|
|
32
|
+
comment?: {
|
|
33
|
+
enable: boolean;
|
|
34
|
+
likeLabel?: string;
|
|
35
|
+
dislikeLabel?: string;
|
|
36
|
+
};
|
|
37
|
+
reasons?: {
|
|
38
|
+
enable: boolean;
|
|
39
|
+
label?: string;
|
|
40
|
+
multi?: boolean;
|
|
41
|
+
items: string[];
|
|
42
|
+
};
|
|
13
43
|
};
|
|
14
44
|
};
|
|
15
45
|
export type CommentProps = {
|
|
16
|
-
onSubmit: (value:
|
|
46
|
+
onSubmit: (value: {
|
|
47
|
+
comment: string;
|
|
48
|
+
}) => void;
|
|
17
49
|
settings?: {
|
|
18
50
|
label?: string;
|
|
51
|
+
submitText?: string;
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
export type ReasonsProps = {
|
|
55
|
+
onSubmit: (value: {
|
|
56
|
+
reasons: string[];
|
|
57
|
+
}) => void;
|
|
58
|
+
settings: {
|
|
59
|
+
label?: string;
|
|
60
|
+
multi?: boolean;
|
|
61
|
+
items: string[];
|
|
62
|
+
submitText?: string;
|
|
63
|
+
buttonText?: string;
|
|
19
64
|
};
|
|
20
65
|
};
|
|
21
66
|
export type ProblemProps = {
|
package/lib/Markdown/Tabs/Tab.js
CHANGED
|
@@ -14,15 +14,21 @@ exports.Tab = Tab;
|
|
|
14
14
|
const TabItem = styled_components_1.default.li `
|
|
15
15
|
display: inline-block;
|
|
16
16
|
list-style: none;
|
|
17
|
-
margin-bottom: -1px;
|
|
18
17
|
padding: 0.75rem 1rem;
|
|
19
18
|
cursor: pointer;
|
|
20
19
|
|
|
21
|
-
${({ active }) => active
|
|
20
|
+
${({ active }) => active
|
|
21
|
+
? `
|
|
22
|
+
background-color: var(--background-color);
|
|
23
|
+
border: solid var(--md-tabs-active-tab-border-color);
|
|
24
|
+
border-width: 0 0 1px 0;
|
|
25
|
+
color: var(--text-color);
|
|
22
26
|
`
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
27
|
+
: `
|
|
28
|
+
&:hover {
|
|
29
|
+
border: solid var(--md-tabs-hover-tab-border-color);
|
|
30
|
+
border-width: 0 0 1px 0;
|
|
31
|
+
}
|
|
26
32
|
`}
|
|
27
33
|
`;
|
|
28
34
|
//# sourceMappingURL=Tab.js.map
|
|
@@ -47,16 +47,25 @@ function Tabs({ children }) {
|
|
|
47
47
|
exports.Tabs = Tabs;
|
|
48
48
|
const TabsContainer = styled_components_1.default.div `
|
|
49
49
|
margin: 10px 0;
|
|
50
|
+
|
|
51
|
+
ol[class^='Tabs__TabList'] {
|
|
52
|
+
margin: 0;
|
|
53
|
+
padding: 0;
|
|
54
|
+
}
|
|
50
55
|
`;
|
|
51
56
|
const TabList = styled_components_1.default.ol `
|
|
52
|
-
|
|
57
|
+
color: var(--md-tabs-tab-text-color);
|
|
53
58
|
padding: 0;
|
|
54
59
|
margin-block-end: 0;
|
|
60
|
+
border: solid var(--color-secondary-400);
|
|
61
|
+
border-width: 0 0 1px 0;
|
|
62
|
+
|
|
63
|
+
li[class^='Tab__TabItem'] {
|
|
64
|
+
margin: 0;
|
|
65
|
+
margin-bottom: -1px;
|
|
66
|
+
}
|
|
55
67
|
`;
|
|
56
68
|
const TabContent = styled_components_1.default.div `
|
|
57
|
-
padding:
|
|
58
|
-
border: 1px solid #ccc;
|
|
59
|
-
border-top: none;
|
|
60
|
-
padding: 1rem;
|
|
69
|
+
padding: 1rem 0;
|
|
61
70
|
`;
|
|
62
71
|
//# sourceMappingURL=Tabs.js.map
|
package/lib/Navbar/Navbar.js
CHANGED
|
@@ -8,6 +8,7 @@ const react_1 = __importDefault(require("react"));
|
|
|
8
8
|
const styled_components_1 = __importDefault(require("styled-components"));
|
|
9
9
|
const Navbar_1 = require("../Navbar");
|
|
10
10
|
const useMobileMenu_1 = require("../hooks/useMobileMenu");
|
|
11
|
+
const utils_1 = require("../utils");
|
|
11
12
|
const MobileNavbarMenuButton_1 = require("../Navbar/MobileNavbarMenuButton");
|
|
12
13
|
const MobileNavbarMenu_1 = require("../Navbar/MobileNavbarMenu");
|
|
13
14
|
const ColorModeSwitcher_1 = require("../ColorModeSwitcher/ColorModeSwitcher");
|
|
@@ -22,8 +23,9 @@ function Navbar({ menu, logo, search, profile }) {
|
|
|
22
23
|
}
|
|
23
24
|
const openMobileMenu = () => setIsOpen(true);
|
|
24
25
|
const closeMobileMenu = () => setIsOpen(false);
|
|
26
|
+
const menuItemsExist = !(0, utils_1.isPrimitive)(menu) && !(0, utils_1.isEmptyArray)(menu);
|
|
25
27
|
return (react_1.default.createElement(exports.NavbarContainer, { "data-component-name": "Navbar/Navbar" },
|
|
26
|
-
react_1.default.createElement(MobileNavbarMenuButton_1.MobileNavbarMenuButton, { onClick: openMobileMenu }),
|
|
28
|
+
menuItemsExist && react_1.default.createElement(MobileNavbarMenuButton_1.MobileNavbarMenuButton, { onClick: openMobileMenu }),
|
|
27
29
|
isOpen && (react_1.default.createElement(MobileNavbarMenu_1.MobileNavbarMenu, { closeMenu: closeMobileMenu, menuItems: menu, search: hideSearch ? null : search })),
|
|
28
30
|
react_1.default.createElement(exports.NavbarRow, null,
|
|
29
31
|
logo,
|
|
@@ -0,0 +1,39 @@
|
|
|
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.Forbidden = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const styled_components_1 = __importDefault(require("styled-components"));
|
|
9
|
+
const Button_1 = require("../Button");
|
|
10
|
+
function Forbidden() {
|
|
11
|
+
return (react_1.default.createElement(Wrapper, { "data-component-name": "Pages/Forbidden" },
|
|
12
|
+
react_1.default.createElement(Header, null, "403"),
|
|
13
|
+
react_1.default.createElement(Description, null, "Access forbidden"),
|
|
14
|
+
react_1.default.createElement(HomeButton, { color: "primary", size: "large", to: "/" }, "Open Homepage")));
|
|
15
|
+
}
|
|
16
|
+
exports.Forbidden = Forbidden;
|
|
17
|
+
const Wrapper = styled_components_1.default.div `
|
|
18
|
+
margin: 25px auto;
|
|
19
|
+
font-family: var(--page-403-font-family);
|
|
20
|
+
text-align: center;
|
|
21
|
+
`;
|
|
22
|
+
const Header = styled_components_1.default.div `
|
|
23
|
+
color: var(--page-403-header-text-color);
|
|
24
|
+
margin: var(--page-403-header-margin);
|
|
25
|
+
font-size: var(--page-403-header-font-size);
|
|
26
|
+
line-height: var(--page-403-header-line-height);
|
|
27
|
+
font-weight: var(--page-403-header-font-weight);
|
|
28
|
+
`;
|
|
29
|
+
const Description = styled_components_1.default.div `
|
|
30
|
+
color: var(--page-403-description-text-color);
|
|
31
|
+
margin: var(--page-403-description-margin);
|
|
32
|
+
font-size: var(--page-403-description-font-size);
|
|
33
|
+
line-height: var(--page-403-description-line-height);
|
|
34
|
+
font-weight: var(--page-403-description-font-weight);
|
|
35
|
+
`;
|
|
36
|
+
const HomeButton = (0, styled_components_1.default)(Button_1.Button) `
|
|
37
|
+
margin-top: var(--page-403-button-margin);
|
|
38
|
+
`;
|
|
39
|
+
//# sourceMappingURL=Forbidden.js.map
|
|
@@ -0,0 +1,39 @@
|
|
|
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.NotFound = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const styled_components_1 = __importDefault(require("styled-components"));
|
|
9
|
+
const Button_1 = require("../Button");
|
|
10
|
+
function NotFound() {
|
|
11
|
+
return (react_1.default.createElement(Wrapper, { "data-component-name": "Pages/NotFound" },
|
|
12
|
+
react_1.default.createElement(Header, null, "404"),
|
|
13
|
+
react_1.default.createElement(Description, null, "It looks like you're lost"),
|
|
14
|
+
react_1.default.createElement(HomeButton, { color: "primary", size: "large", to: "/" }, "Open Homepage")));
|
|
15
|
+
}
|
|
16
|
+
exports.NotFound = NotFound;
|
|
17
|
+
const Wrapper = styled_components_1.default.div `
|
|
18
|
+
margin: 25px auto;
|
|
19
|
+
font-family: var(--page-404-font-family);
|
|
20
|
+
text-align: center;
|
|
21
|
+
`;
|
|
22
|
+
const Header = styled_components_1.default.div `
|
|
23
|
+
color: var(--page-404-header-text-color);
|
|
24
|
+
margin: var(--page-404-header-margin);
|
|
25
|
+
font-size: var(--page-404-header-font-size);
|
|
26
|
+
line-height: var(--page-404-header-line-height);
|
|
27
|
+
font-weight: var(--page-404-header-font-weight);
|
|
28
|
+
`;
|
|
29
|
+
const Description = styled_components_1.default.div `
|
|
30
|
+
color: var(--page-404-description-text-color);
|
|
31
|
+
margin: var(--page-404-description-margin);
|
|
32
|
+
font-size: var(--page-404-description-font-size);
|
|
33
|
+
line-height: var(--page-404-description-line-height);
|
|
34
|
+
font-weight: var(--page-404-description-font-weight);
|
|
35
|
+
`;
|
|
36
|
+
const HomeButton = (0, styled_components_1.default)(Button_1.Button) `
|
|
37
|
+
margin-top: var(--page-404-button-margin);
|
|
38
|
+
`;
|
|
39
|
+
//# sourceMappingURL=NotFound.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../Pages/NotFound';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("../Pages/NotFound"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import React from 'react';
|
|
1
2
|
import type { ReactNode } from 'react';
|
|
2
3
|
import type { ActiveItem } from '../mocks/types';
|
|
3
4
|
interface AutocompleteProps<T> {
|
|
@@ -8,6 +9,8 @@ interface AutocompleteProps<T> {
|
|
|
8
9
|
change(value: string): void;
|
|
9
10
|
select(item: T): void;
|
|
10
11
|
children?(isOpen: boolean, close: () => void): ReactNode;
|
|
12
|
+
inputRef?: React.RefObject<HTMLInputElement>;
|
|
13
|
+
keyShortcuts?: string[];
|
|
11
14
|
}
|
|
12
|
-
export declare function Autocomplete<T>({ placeholder, value, items, change, select, renderItem, children, }: AutocompleteProps<T>): JSX.Element;
|
|
15
|
+
export declare function Autocomplete<T>({ placeholder, value, items, change, select, renderItem, children, keyShortcuts, }: AutocompleteProps<T>): JSX.Element;
|
|
13
16
|
export {};
|
|
@@ -30,12 +30,26 @@ exports.Autocomplete = void 0;
|
|
|
30
30
|
const react_1 = __importStar(require("react"));
|
|
31
31
|
const react_router_dom_1 = require("react-router-dom");
|
|
32
32
|
const styled_components_1 = __importDefault(require("styled-components"));
|
|
33
|
+
const hotkeys_js_1 = __importDefault(require("hotkeys-js"));
|
|
33
34
|
const Input_1 = require("../Search/Input");
|
|
34
35
|
const Popover_1 = require("../Search/Popover");
|
|
35
|
-
|
|
36
|
+
const ShortcutKey_1 = require("../Search/ShortcutKey");
|
|
37
|
+
function Autocomplete({ placeholder, value, items, change, select, renderItem, children, keyShortcuts, }) {
|
|
36
38
|
const location = (0, react_router_dom_1.useLocation)();
|
|
37
39
|
const [isOpen, setIsOpen] = (0, react_1.useState)(false);
|
|
38
40
|
const [activeIdx, setActiveIdx] = (0, react_1.useState)(-1);
|
|
41
|
+
const refInput = (0, react_1.useRef)(null);
|
|
42
|
+
const hotkeysKeys = keyShortcuts === null || keyShortcuts === void 0 ? void 0 : keyShortcuts.join(',');
|
|
43
|
+
(0, react_1.useEffect)(() => {
|
|
44
|
+
if (hotkeysKeys) {
|
|
45
|
+
(0, hotkeys_js_1.default)(hotkeysKeys, (ev) => {
|
|
46
|
+
var _a;
|
|
47
|
+
(_a = refInput.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
48
|
+
ev.preventDefault();
|
|
49
|
+
});
|
|
50
|
+
return () => hotkeys_js_1.default.unbind(hotkeysKeys);
|
|
51
|
+
}
|
|
52
|
+
}, [hotkeysKeys]);
|
|
39
53
|
const open = () => setIsOpen(true);
|
|
40
54
|
const close = () => {
|
|
41
55
|
setIsOpen(false);
|
|
@@ -66,6 +80,7 @@ function Autocomplete({ placeholder, value, items, change, select, renderItem, c
|
|
|
66
80
|
break;
|
|
67
81
|
case 'Enter':
|
|
68
82
|
if (activeIdx > -1) {
|
|
83
|
+
reset();
|
|
69
84
|
select(items[activeIdx]);
|
|
70
85
|
}
|
|
71
86
|
break;
|
|
@@ -78,9 +93,10 @@ function Autocomplete({ placeholder, value, items, change, select, renderItem, c
|
|
|
78
93
|
(0, react_1.useEffect)(close, [location]);
|
|
79
94
|
return (react_1.default.createElement(Wrapper, { "data-component-name": "Search/Autocomplete" },
|
|
80
95
|
isOpen ? react_1.default.createElement(Overlay, { onClick: close }) : null,
|
|
81
|
-
react_1.default.createElement(AutocompleteBox, { onKeyDown: onKeydown },
|
|
82
|
-
react_1.default.createElement(Input_1.FormInput, { value: value, placeholder: placeholder, onChange: onChange, onFocus: open, onClick: stopPropagation }), children === null || children === void 0 ? void 0 :
|
|
96
|
+
react_1.default.createElement(AutocompleteBox, { onKeyDown: onKeydown }, children === null || children === void 0 ? void 0 :
|
|
83
97
|
children(isOpen, reset),
|
|
98
|
+
react_1.default.createElement(Input_1.FormInput, { value: value, placeholder: placeholder, onChange: onChange, onFocus: open, onClick: stopPropagation, ref: refInput }),
|
|
99
|
+
!isOpen && react_1.default.createElement(ShortcutKey_1.ShortcutKey, { keyShortcuts: keyShortcuts }),
|
|
84
100
|
isOpen && value ? (react_1.default.createElement(Popover_1.Popover, null, items.length ? items.map(mapItem) : react_1.default.createElement(Message, null, "No results"))) : null)));
|
|
85
101
|
}
|
|
86
102
|
exports.Autocomplete = Autocomplete;
|
package/lib/Search/ClearIcon.js
CHANGED
package/lib/Search/Input.js
CHANGED
|
@@ -8,7 +8,7 @@ const styled_components_1 = __importDefault(require("styled-components"));
|
|
|
8
8
|
exports.FormInput = styled_components_1.default.input.attrs(() => ({
|
|
9
9
|
'data-component-name': 'Search/Input',
|
|
10
10
|
})) `
|
|
11
|
-
padding: 1em 2.5em 1em
|
|
11
|
+
padding: 1em 2.5em 1em 2.5em;
|
|
12
12
|
background-color: var(--search-input-background-color);
|
|
13
13
|
border-radius: var(--search-input-border-radius);
|
|
14
14
|
border: var(--search-input-border);
|