@redocly/theme 0.28.0 → 0.28.2
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/components/CodeBlock/CodeBlockControlButton.js +6 -3
- package/lib/components/Feedback/Comment.js +8 -8
- package/lib/components/Feedback/Mood.js +5 -5
- package/lib/components/Feedback/Rating.js +5 -5
- package/lib/components/Feedback/Reasons.js +10 -9
- package/lib/components/Feedback/Scale.js +4 -5
- package/lib/components/Feedback/Sentiment.js +5 -5
- package/lib/components/Feedback/types.d.ts +5 -5
- package/lib/components/Tooltip/Tooltip.js +1 -1
- package/lib/config.d.ts +8 -4
- package/lib/config.js +10 -2
- package/lib/icons/CopyIcon/CopyIcon.js +3 -3
- package/lib/icons/ReportIcon/ReportIcon.js +5 -5
- package/package.json +1 -1
- package/src/components/CodeBlock/CodeBlockControlButton.tsx +6 -3
- package/src/components/Feedback/Comment.tsx +9 -9
- package/src/components/Feedback/Mood.tsx +5 -5
- package/src/components/Feedback/Rating.tsx +5 -5
- package/src/components/Feedback/Reasons.tsx +13 -11
- package/src/components/Feedback/Scale.tsx +4 -5
- package/src/components/Feedback/Sentiment.tsx +5 -5
- package/src/components/Feedback/types.ts +5 -5
- package/src/components/Tooltip/Tooltip.tsx +1 -1
- package/src/config.ts +10 -2
- package/src/icons/CopyIcon/CopyIcon.tsx +4 -3
- package/src/icons/ReportIcon/ReportIcon.tsx +8 -7
|
@@ -28,6 +28,7 @@ const styled_components_1 = __importStar(require("styled-components"));
|
|
|
28
28
|
const Button_1 = require("../../components/Button");
|
|
29
29
|
exports.CodeBlockControlButton = (0, styled_components_1.default)(Button_1.Button) `
|
|
30
30
|
color: var(--code-block-controls-text-color);
|
|
31
|
+
border: none;
|
|
31
32
|
|
|
32
33
|
${({ asIcon }) => asIcon
|
|
33
34
|
? (0, styled_components_1.css) `
|
|
@@ -38,12 +39,14 @@ exports.CodeBlockControlButton = (0, styled_components_1.default)(Button_1.Butto
|
|
|
38
39
|
background-color: var(--code-block-text-controls-background-color);
|
|
39
40
|
`}
|
|
40
41
|
|
|
41
|
-
|
|
42
|
-
padding: ${({ asIcon }) => (asIcon ? '2px 10px' : '2px 20px')};
|
|
43
|
-
}
|
|
42
|
+
padding: 0;
|
|
44
43
|
|
|
45
44
|
:not(:first-child) {
|
|
46
45
|
margin-left: 5px;
|
|
47
46
|
}
|
|
47
|
+
|
|
48
|
+
&:hover {
|
|
49
|
+
border: none;
|
|
50
|
+
}
|
|
48
51
|
`;
|
|
49
52
|
//# sourceMappingURL=CodeBlockControlButton.js.map
|
|
@@ -62,8 +62,8 @@ const Comment = ({ settings, onSubmit, onCancel, className, standAlone = true, }
|
|
|
62
62
|
translate('theme.feedback.settings.comment.label', 'Please share your feedback with us.')),
|
|
63
63
|
React.createElement(TextArea, { rows: 3, onChange: handleTextAreaChange }),
|
|
64
64
|
standAlone && (React.createElement(ButtonsContainer, null,
|
|
65
|
-
React.createElement(
|
|
66
|
-
|
|
65
|
+
onCancel && (React.createElement(CancelButton, { "data-translation-key": "theme.feedback.settings.comment.cancel", onClick: onCancel }, translate('theme.feedback.settings.comment.cancel', 'Cancel'))),
|
|
66
|
+
React.createElement(SendButton, { "data-translation-key": "theme.feedback.settings.comment.send", onClick: send }, translate('theme.feedback.settings.comment.send', 'Send'))))));
|
|
67
67
|
};
|
|
68
68
|
exports.Comment = Comment;
|
|
69
69
|
const Wrapper = styled_components_1.default.div `
|
|
@@ -84,12 +84,12 @@ const StateWrapper = (0, styled_components_1.default)(Wrapper) `
|
|
|
84
84
|
width: 100%;
|
|
85
85
|
}
|
|
86
86
|
`;
|
|
87
|
-
const Label = styled_components_1.default.
|
|
88
|
-
font-family: var(--
|
|
89
|
-
font-weight: var(--
|
|
90
|
-
font-size: var(--
|
|
91
|
-
line-height: var(--
|
|
92
|
-
color: var(--
|
|
87
|
+
const Label = styled_components_1.default.h4 `
|
|
88
|
+
font-family: var(--h4-font-family);
|
|
89
|
+
font-weight: var(--font-weight-regular);
|
|
90
|
+
font-size: var(--h4-font-size);
|
|
91
|
+
line-height: var(--h4-line-height);
|
|
92
|
+
color: var(--h4-text-color);
|
|
93
93
|
margin-right: 15px;
|
|
94
94
|
`;
|
|
95
95
|
const TextArea = styled_components_1.default.textarea `
|
|
@@ -112,7 +112,7 @@ const Mood = ({ settings, onSubmit, className }) => {
|
|
|
112
112
|
displayReasons && (React.createElement(Feedback_1.Reasons, { settings: {
|
|
113
113
|
label: reasonsSettings === null || reasonsSettings === void 0 ? void 0 : reasonsSettings.label,
|
|
114
114
|
items: (reasonsSettings === null || reasonsSettings === void 0 ? void 0 : reasonsSettings.items) || [],
|
|
115
|
-
|
|
115
|
+
component: reasonsSettings === null || reasonsSettings === void 0 ? void 0 : reasonsSettings.component,
|
|
116
116
|
}, onChange: setReasons })),
|
|
117
117
|
displayComment && (React.createElement(Feedback_1.Comment, { standAlone: false, onSubmit: ({ comment }) => setComment(comment), settings: { label: renderCommentLabel(score) } }))),
|
|
118
118
|
displaySubmitBnt && (React.createElement(ButtonsContainer, null,
|
|
@@ -145,13 +145,13 @@ const Wrapper = styled_components_1.default.div `
|
|
|
145
145
|
width: 100%;
|
|
146
146
|
}
|
|
147
147
|
`;
|
|
148
|
-
const Label = styled_components_1.default.
|
|
149
|
-
margin-right: 15px;
|
|
148
|
+
const Label = styled_components_1.default.h4 `
|
|
150
149
|
font-family: var(--h4-font-family);
|
|
151
|
-
font-weight: var(--
|
|
150
|
+
font-weight: var(--font-weight-regular);
|
|
152
151
|
font-size: var(--h4-font-size);
|
|
153
152
|
line-height: var(--h4-line-height);
|
|
154
|
-
color: var(--
|
|
153
|
+
color: var(--h4-text-color);
|
|
154
|
+
margin-right: 15px;
|
|
155
155
|
`;
|
|
156
156
|
const Vote = styled_components_1.default.div `
|
|
157
157
|
cursor: pointer;
|
|
@@ -79,7 +79,7 @@ const Rating = ({ settings, onSubmit, className }) => {
|
|
|
79
79
|
displayReasons && (React.createElement(Feedback_1.Reasons, { settings: {
|
|
80
80
|
label: reasonsSettings === null || reasonsSettings === void 0 ? void 0 : reasonsSettings.label,
|
|
81
81
|
items: (reasonsSettings === null || reasonsSettings === void 0 ? void 0 : reasonsSettings.items) || [],
|
|
82
|
-
|
|
82
|
+
component: reasonsSettings === null || reasonsSettings === void 0 ? void 0 : reasonsSettings.component,
|
|
83
83
|
}, onChange: setReasons })),
|
|
84
84
|
displayComment && (React.createElement(Feedback_1.Comment, { standAlone: false, onSubmit: ({ comment }) => setComment(comment), settings: { label: commentSettings.label } }))),
|
|
85
85
|
displaySubmitBnt && (React.createElement(ButtonsContainer, null,
|
|
@@ -113,13 +113,13 @@ const Wrapper = styled_components_1.default.div `
|
|
|
113
113
|
width: 100%;
|
|
114
114
|
}
|
|
115
115
|
`;
|
|
116
|
-
const Label = styled_components_1.default.
|
|
117
|
-
margin-right: 15px;
|
|
116
|
+
const Label = styled_components_1.default.h4 `
|
|
118
117
|
font-family: var(--h4-font-family);
|
|
119
|
-
font-weight: var(--
|
|
118
|
+
font-weight: var(--font-weight-regular);
|
|
120
119
|
font-size: var(--h4-font-size);
|
|
121
120
|
line-height: var(--h4-line-height);
|
|
122
|
-
color: var(--
|
|
121
|
+
color: var(--h4-text-color);
|
|
122
|
+
margin-right: 15px;
|
|
123
123
|
`;
|
|
124
124
|
const SubmitButton = (0, styled_components_1.default)(components_1.Button).attrs(() => ({
|
|
125
125
|
color: 'primary',
|
|
@@ -31,15 +31,15 @@ const React = __importStar(require("react"));
|
|
|
31
31
|
const styled_components_1 = __importDefault(require("styled-components"));
|
|
32
32
|
const hooks_1 = require("../../mocks/hooks");
|
|
33
33
|
const Reasons = ({ settings, onChange, className }) => {
|
|
34
|
-
const { label,
|
|
34
|
+
const { label, component, items = [] } = settings;
|
|
35
35
|
const [checkedState, setCheckedState] = React.useState(new Array(items.length).fill(false));
|
|
36
36
|
const { translate } = (0, hooks_1.useTranslate)();
|
|
37
37
|
if (!items.length) {
|
|
38
38
|
return React.createElement(React.Fragment, null);
|
|
39
39
|
}
|
|
40
|
-
const input_type =
|
|
40
|
+
const input_type = component || 'checkbox';
|
|
41
41
|
const handleOptionChange = (position) => {
|
|
42
|
-
const updatedCheckedState =
|
|
42
|
+
const updatedCheckedState = component === 'checkbox'
|
|
43
43
|
? checkedState.map((item, index) => (index === position ? !item : item))
|
|
44
44
|
: items.map((_, idx) => position === idx);
|
|
45
45
|
setCheckedState(updatedCheckedState);
|
|
@@ -58,12 +58,12 @@ const Wrapper = styled_components_1.default.div `
|
|
|
58
58
|
display: flex;
|
|
59
59
|
flex-direction: column;
|
|
60
60
|
`;
|
|
61
|
-
const Label = styled_components_1.default.
|
|
62
|
-
font-family: var(--
|
|
63
|
-
font-weight: var(--
|
|
64
|
-
font-size: var(--
|
|
65
|
-
line-height: var(--
|
|
66
|
-
color: var(--
|
|
61
|
+
const Label = styled_components_1.default.h4 `
|
|
62
|
+
font-family: var(--h4-font-family);
|
|
63
|
+
font-weight: var(--font-weight-regular);
|
|
64
|
+
font-size: var(--h4-font-size);
|
|
65
|
+
line-height: var(--h4-line-height);
|
|
66
|
+
color: var(--h4-text-color);
|
|
67
67
|
margin-right: 15px;
|
|
68
68
|
`;
|
|
69
69
|
const OptionWrapper = styled_components_1.default.div `
|
|
@@ -76,6 +76,7 @@ const OptionWrapper = styled_components_1.default.div `
|
|
|
76
76
|
label {
|
|
77
77
|
font-size: var(--font-size-base);
|
|
78
78
|
cursor: pointer;
|
|
79
|
+
color: var(--text-secondary);
|
|
79
80
|
}
|
|
80
81
|
`;
|
|
81
82
|
//# sourceMappingURL=Reasons.js.map
|
|
@@ -86,7 +86,7 @@ const Scale = ({ settings, onSubmit, className }) => {
|
|
|
86
86
|
displayReasons && (React.createElement(Feedback_1.Reasons, { settings: {
|
|
87
87
|
label: reasonsSettings === null || reasonsSettings === void 0 ? void 0 : reasonsSettings.label,
|
|
88
88
|
items: (reasonsSettings === null || reasonsSettings === void 0 ? void 0 : reasonsSettings.items) || [],
|
|
89
|
-
|
|
89
|
+
component: reasonsSettings === null || reasonsSettings === void 0 ? void 0 : reasonsSettings.component,
|
|
90
90
|
}, onChange: setReasons })),
|
|
91
91
|
displayComment && (React.createElement(Feedback_1.Comment, { standAlone: false, onSubmit: ({ comment }) => setComment(comment), settings: { label: commentSettings.label } }))),
|
|
92
92
|
displaySubmitBnt && (React.createElement(ButtonsContainer, null,
|
|
@@ -107,13 +107,12 @@ const Wrapper = styled_components_1.default.div `
|
|
|
107
107
|
width: 100%;
|
|
108
108
|
}
|
|
109
109
|
`;
|
|
110
|
-
const Label = styled_components_1.default.
|
|
111
|
-
margin-right: 15px;
|
|
110
|
+
const Label = styled_components_1.default.h4 `
|
|
112
111
|
font-family: var(--h4-font-family);
|
|
113
|
-
font-weight: var(--
|
|
112
|
+
font-weight: var(--font-weight-regular);
|
|
114
113
|
font-size: var(--h4-font-size);
|
|
115
114
|
line-height: var(--h4-line-height);
|
|
116
|
-
color: var(--
|
|
115
|
+
color: var(--h4-text-color);
|
|
117
116
|
`;
|
|
118
117
|
const SubLabelContainer = styled_components_1.default.div `
|
|
119
118
|
display: flex;
|
|
@@ -90,7 +90,7 @@ const Sentiment = ({ settings, onSubmit, className }) => {
|
|
|
90
90
|
displayReasons && (React.createElement(Feedback_1.Reasons, { settings: {
|
|
91
91
|
label: reasonsSettings === null || reasonsSettings === void 0 ? void 0 : reasonsSettings.label,
|
|
92
92
|
items: (reasonsSettings === null || reasonsSettings === void 0 ? void 0 : reasonsSettings.items) || [],
|
|
93
|
-
|
|
93
|
+
component: reasonsSettings === null || reasonsSettings === void 0 ? void 0 : reasonsSettings.component,
|
|
94
94
|
}, onChange: setReasons })),
|
|
95
95
|
displayComment && (React.createElement(Feedback_1.Comment, { standAlone: false, onSubmit: ({ comment }) => setComment(comment), settings: { label: commentLabel } }))),
|
|
96
96
|
displaySubmitBnt && (React.createElement(ButtonsContainer, null,
|
|
@@ -111,13 +111,13 @@ const Wrapper = styled_components_1.default.div `
|
|
|
111
111
|
width: 100%;
|
|
112
112
|
}
|
|
113
113
|
`;
|
|
114
|
-
const Label = styled_components_1.default.
|
|
115
|
-
margin-right: 15px;
|
|
114
|
+
const Label = styled_components_1.default.h4 `
|
|
116
115
|
font-family: var(--h4-font-family);
|
|
117
|
-
font-weight: var(--
|
|
116
|
+
font-weight: var(--font-weight-regular);
|
|
118
117
|
font-size: var(--h4-font-size);
|
|
119
118
|
line-height: var(--h4-line-height);
|
|
120
|
-
color: var(--
|
|
119
|
+
color: var(--h4-text-color);
|
|
120
|
+
margin-right: 15px;
|
|
121
121
|
`;
|
|
122
122
|
const Vote = styled_components_1.default.div `
|
|
123
123
|
height: 32px;
|
|
@@ -17,7 +17,7 @@ export type RatingProps = {
|
|
|
17
17
|
reasons?: {
|
|
18
18
|
enable: boolean;
|
|
19
19
|
label?: string;
|
|
20
|
-
|
|
20
|
+
component?: string;
|
|
21
21
|
items: string[];
|
|
22
22
|
};
|
|
23
23
|
};
|
|
@@ -43,7 +43,7 @@ export type ScaleProps = {
|
|
|
43
43
|
reasons?: {
|
|
44
44
|
enable: boolean;
|
|
45
45
|
label?: string;
|
|
46
|
-
|
|
46
|
+
component?: string;
|
|
47
47
|
items: string[];
|
|
48
48
|
};
|
|
49
49
|
};
|
|
@@ -68,7 +68,7 @@ export type MoodProps = {
|
|
|
68
68
|
reasons?: {
|
|
69
69
|
enable: boolean;
|
|
70
70
|
label?: string;
|
|
71
|
-
|
|
71
|
+
component?: string;
|
|
72
72
|
items: string[];
|
|
73
73
|
};
|
|
74
74
|
};
|
|
@@ -92,7 +92,7 @@ export type SentimentProps = {
|
|
|
92
92
|
reasons?: {
|
|
93
93
|
enable: boolean;
|
|
94
94
|
label?: string;
|
|
95
|
-
|
|
95
|
+
component?: string;
|
|
96
96
|
items: string[];
|
|
97
97
|
};
|
|
98
98
|
};
|
|
@@ -115,7 +115,7 @@ export type ReasonsProps = {
|
|
|
115
115
|
onChange: (value: string[]) => void;
|
|
116
116
|
settings: {
|
|
117
117
|
label?: string;
|
|
118
|
-
|
|
118
|
+
component?: string;
|
|
119
119
|
items: string[];
|
|
120
120
|
};
|
|
121
121
|
className?: string;
|
package/lib/config.d.ts
CHANGED
|
@@ -1053,8 +1053,10 @@ export declare const themeConfigSchema: {
|
|
|
1053
1053
|
readonly buttonText: {
|
|
1054
1054
|
readonly type: "string";
|
|
1055
1055
|
};
|
|
1056
|
-
readonly
|
|
1057
|
-
readonly type: "
|
|
1056
|
+
readonly component: {
|
|
1057
|
+
readonly type: "string";
|
|
1058
|
+
readonly enum: readonly ["radio", "checkbox"];
|
|
1059
|
+
readonly default: "checkbox";
|
|
1058
1060
|
};
|
|
1059
1061
|
readonly items: {
|
|
1060
1062
|
readonly type: "array";
|
|
@@ -1076,8 +1078,10 @@ export declare const themeConfigSchema: {
|
|
|
1076
1078
|
readonly type: "boolean";
|
|
1077
1079
|
readonly default: true;
|
|
1078
1080
|
};
|
|
1079
|
-
readonly
|
|
1080
|
-
readonly type: "
|
|
1081
|
+
readonly component: {
|
|
1082
|
+
readonly type: "string";
|
|
1083
|
+
readonly enum: readonly ["radio", "checkbox"];
|
|
1084
|
+
readonly default: "checkbox";
|
|
1081
1085
|
};
|
|
1082
1086
|
readonly label: {
|
|
1083
1087
|
readonly type: "string";
|
package/lib/config.js
CHANGED
|
@@ -402,7 +402,11 @@ exports.themeConfigSchema = {
|
|
|
402
402
|
label: { type: 'string' },
|
|
403
403
|
submitText: { type: 'string' },
|
|
404
404
|
buttonText: { type: 'string' },
|
|
405
|
-
|
|
405
|
+
component: {
|
|
406
|
+
type: 'string',
|
|
407
|
+
enum: ['radio', 'checkbox'],
|
|
408
|
+
default: 'checkbox',
|
|
409
|
+
},
|
|
406
410
|
items: { type: 'array', items: { type: 'string' }, minItems: 1 },
|
|
407
411
|
leftScaleLabel: { type: 'string' },
|
|
408
412
|
rightScaleLabel: { type: 'string' },
|
|
@@ -410,7 +414,11 @@ exports.themeConfigSchema = {
|
|
|
410
414
|
type: 'object',
|
|
411
415
|
properties: {
|
|
412
416
|
enable: { type: 'boolean', default: true },
|
|
413
|
-
|
|
417
|
+
component: {
|
|
418
|
+
type: 'string',
|
|
419
|
+
enum: ['radio', 'checkbox'],
|
|
420
|
+
default: 'checkbox',
|
|
421
|
+
},
|
|
414
422
|
label: { type: 'string' },
|
|
415
423
|
items: { type: 'array', items: { type: 'string' } },
|
|
416
424
|
},
|
|
@@ -6,9 +6,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.CopyIcon = void 0;
|
|
7
7
|
const react_1 = __importDefault(require("react"));
|
|
8
8
|
const styled_components_1 = __importDefault(require("styled-components"));
|
|
9
|
-
const Icon = ({ className }) => (react_1.default.createElement("span", { "data-component-name": "icons/CopyIcon" },
|
|
10
|
-
react_1.default.createElement("svg", {
|
|
11
|
-
react_1.default.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "
|
|
9
|
+
const Icon = ({ className }) => (react_1.default.createElement("span", { "data-component-name": "icons/CopyIcon", className: className },
|
|
10
|
+
react_1.default.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 16 16", fill: "none" },
|
|
11
|
+
react_1.default.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M5.16667 2.66667C5.16667 2.57462 5.24129 2.5 5.33333 2.5H12C12.092 2.5 12.1667 2.57462 12.1667 2.66667V10.6667C12.1667 10.7587 12.092 10.8333 12 10.8333H10H5.33333C5.24129 10.8333 5.16667 10.7587 5.16667 10.6667V4.66667V2.66667ZM4.16667 4.16667V2.66667C4.16667 2.02233 4.689 1.5 5.33333 1.5H12C12.6443 1.5 13.1667 2.02233 13.1667 2.66667V10.6667C13.1667 11.311 12.6443 11.8333 12 11.8333H10.5V13.3333C10.5 13.6428 10.3771 13.9395 10.1583 14.1583C9.9395 14.3771 9.64275 14.5 9.33333 14.5H2.66667C2.35725 14.5 2.0605 14.3771 1.84171 14.1583C1.62292 13.9395 1.5 13.6428 1.5 13.3333V5.33333C1.5 5.02391 1.62292 4.72717 1.84171 4.50838C2.0605 4.28958 2.35725 4.16667 2.66667 4.16667H4.16667ZM9.5 11.8333V13.3333C9.5 13.3775 9.48244 13.4199 9.45118 13.4512C9.41993 13.4824 9.37754 13.5 9.33333 13.5H2.66667C2.62246 13.5 2.58007 13.4824 2.54882 13.4512C2.51756 13.4199 2.5 13.3775 2.5 13.3333V5.33333C2.5 5.28913 2.51756 5.24674 2.54882 5.21548C2.58007 5.18423 2.62246 5.16667 2.66667 5.16667H4.16667V10.6667C4.16667 11.311 4.689 11.8333 5.33333 11.8333H9.5Z", fill: "currentColor", fillOpacity: "1" }))));
|
|
12
12
|
exports.CopyIcon = (0, styled_components_1.default)(Icon) `
|
|
13
13
|
width: 1em;
|
|
14
14
|
height: 1em;
|
|
@@ -6,11 +6,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.ReportIcon = void 0;
|
|
7
7
|
const react_1 = __importDefault(require("react"));
|
|
8
8
|
const styled_components_1 = __importDefault(require("styled-components"));
|
|
9
|
-
const Icon = ({ className }) => (react_1.default.createElement("svg", { "
|
|
10
|
-
react_1.default.createElement("rect", { width: "
|
|
11
|
-
react_1.default.createElement("path", { d: "
|
|
12
|
-
react_1.default.createElement("path", { d: "
|
|
13
|
-
react_1.default.createElement("path", { d: "
|
|
9
|
+
const Icon = ({ className }) => (react_1.default.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", className: className },
|
|
10
|
+
react_1.default.createElement("rect", { width: "16", height: "16", fill: "none" }),
|
|
11
|
+
react_1.default.createElement("path", { d: "M8 10C7.85166 10 7.70666 10.044 7.58332 10.1264C7.45999 10.2088 7.36386 10.3259 7.30709 10.463C7.25032 10.6 7.23547 10.7508 7.26441 10.8963C7.29335 11.0418 7.36478 11.1754 7.46967 11.2803C7.57456 11.3852 7.7082 11.4566 7.85368 11.4856C7.99917 11.5145 8.14997 11.4997 8.28701 11.4429C8.42406 11.3861 8.54119 11.29 8.6236 11.1667C8.70601 11.0433 8.75 10.8983 8.75 10.75C8.75 10.5511 8.67098 10.3603 8.53033 10.2197C8.38968 10.079 8.19891 10 8 10Z", fill: "currentColor", fillOpacity: "1" }),
|
|
12
|
+
react_1.default.createElement("path", { d: "M8.5 4.5H7.5V9H8.5V4.5Z", fill: "currentColor", fillOpacity: "1" }),
|
|
13
|
+
react_1.default.createElement("path", { d: "M13 14H3C2.73488 13.9997 2.4807 13.8942 2.29323 13.7068C2.10576 13.5193 2.0003 13.2651 2 13V3C2.0003 2.73488 2.10576 2.4807 2.29323 2.29323C2.4807 2.10576 2.73488 2.0003 3 2H13C13.2651 2.0003 13.5193 2.10576 13.7068 2.29323C13.8942 2.4807 13.9997 2.73488 14 3V13C13.9997 13.2651 13.8942 13.5193 13.7068 13.7068C13.5193 13.8942 13.2651 13.9997 13 14ZM3 3V13H13.0006L13 3H3Z", fill: "currentColor", fillOpacity: "1" })));
|
|
14
14
|
exports.ReportIcon = (0, styled_components_1.default)(Icon) `
|
|
15
15
|
width: 1.3em;
|
|
16
16
|
height: 1.3em;
|
package/package.json
CHANGED
|
@@ -4,6 +4,7 @@ import { Button } from '@theme/components/Button';
|
|
|
4
4
|
|
|
5
5
|
export const CodeBlockControlButton = styled(Button)<{ asIcon?: boolean }>`
|
|
6
6
|
color: var(--code-block-controls-text-color);
|
|
7
|
+
border: none;
|
|
7
8
|
|
|
8
9
|
${({ asIcon }) =>
|
|
9
10
|
asIcon
|
|
@@ -15,11 +16,13 @@ export const CodeBlockControlButton = styled(Button)<{ asIcon?: boolean }>`
|
|
|
15
16
|
background-color: var(--code-block-text-controls-background-color);
|
|
16
17
|
`}
|
|
17
18
|
|
|
18
|
-
|
|
19
|
-
padding: ${({ asIcon }) => (asIcon ? '2px 10px' : '2px 20px')};
|
|
20
|
-
}
|
|
19
|
+
padding: 0;
|
|
21
20
|
|
|
22
21
|
:not(:first-child) {
|
|
23
22
|
margin-left: 5px;
|
|
24
23
|
}
|
|
24
|
+
|
|
25
|
+
&:hover {
|
|
26
|
+
border: none;
|
|
27
|
+
}
|
|
25
28
|
`;
|
|
@@ -61,9 +61,6 @@ export const Comment = ({
|
|
|
61
61
|
<TextArea rows={3} onChange={handleTextAreaChange} />
|
|
62
62
|
{standAlone && (
|
|
63
63
|
<ButtonsContainer>
|
|
64
|
-
<SendButton data-translation-key="theme.feedback.settings.comment.send" onClick={send}>
|
|
65
|
-
{translate('theme.feedback.settings.comment.send', 'Send')}
|
|
66
|
-
</SendButton>
|
|
67
64
|
{onCancel && (
|
|
68
65
|
<CancelButton
|
|
69
66
|
data-translation-key="theme.feedback.settings.comment.cancel"
|
|
@@ -72,6 +69,9 @@ export const Comment = ({
|
|
|
72
69
|
{translate('theme.feedback.settings.comment.cancel', 'Cancel')}
|
|
73
70
|
</CancelButton>
|
|
74
71
|
)}
|
|
72
|
+
<SendButton data-translation-key="theme.feedback.settings.comment.send" onClick={send}>
|
|
73
|
+
{translate('theme.feedback.settings.comment.send', 'Send')}
|
|
74
|
+
</SendButton>
|
|
75
75
|
</ButtonsContainer>
|
|
76
76
|
)}
|
|
77
77
|
</Wrapper>
|
|
@@ -98,12 +98,12 @@ const StateWrapper = styled(Wrapper)`
|
|
|
98
98
|
}
|
|
99
99
|
`;
|
|
100
100
|
|
|
101
|
-
const Label = styled.
|
|
102
|
-
font-family: var(--
|
|
103
|
-
font-weight: var(--
|
|
104
|
-
font-size: var(--
|
|
105
|
-
line-height: var(--
|
|
106
|
-
color: var(--
|
|
101
|
+
const Label = styled.h4`
|
|
102
|
+
font-family: var(--h4-font-family);
|
|
103
|
+
font-weight: var(--font-weight-regular);
|
|
104
|
+
font-size: var(--h4-font-size);
|
|
105
|
+
line-height: var(--h4-line-height);
|
|
106
|
+
color: var(--h4-text-color);
|
|
107
107
|
margin-right: 15px;
|
|
108
108
|
`;
|
|
109
109
|
|
|
@@ -126,7 +126,7 @@ export const Mood = ({ settings, onSubmit, className }: MoodProps): JSX.Element
|
|
|
126
126
|
settings={{
|
|
127
127
|
label: reasonsSettings?.label,
|
|
128
128
|
items: reasonsSettings?.items || [],
|
|
129
|
-
|
|
129
|
+
component: reasonsSettings?.component,
|
|
130
130
|
}}
|
|
131
131
|
onChange={setReasons}
|
|
132
132
|
/>
|
|
@@ -178,13 +178,13 @@ const Wrapper = styled.div`
|
|
|
178
178
|
}
|
|
179
179
|
`;
|
|
180
180
|
|
|
181
|
-
const Label = styled.
|
|
182
|
-
margin-right: 15px;
|
|
181
|
+
const Label = styled.h4`
|
|
183
182
|
font-family: var(--h4-font-family);
|
|
184
|
-
font-weight: var(--
|
|
183
|
+
font-weight: var(--font-weight-regular);
|
|
185
184
|
font-size: var(--h4-font-size);
|
|
186
185
|
line-height: var(--h4-line-height);
|
|
187
|
-
color: var(--
|
|
186
|
+
color: var(--h4-text-color);
|
|
187
|
+
margin-right: 15px;
|
|
188
188
|
`;
|
|
189
189
|
|
|
190
190
|
const Vote = styled.div`
|
|
@@ -77,7 +77,7 @@ export const Rating = ({ settings, onSubmit, className }: RatingProps): JSX.Elem
|
|
|
77
77
|
settings={{
|
|
78
78
|
label: reasonsSettings?.label,
|
|
79
79
|
items: reasonsSettings?.items || [],
|
|
80
|
-
|
|
80
|
+
component: reasonsSettings?.component,
|
|
81
81
|
}}
|
|
82
82
|
onChange={setReasons}
|
|
83
83
|
/>
|
|
@@ -133,13 +133,13 @@ const Wrapper = styled.div`
|
|
|
133
133
|
}
|
|
134
134
|
`;
|
|
135
135
|
|
|
136
|
-
const Label = styled.
|
|
137
|
-
margin-right: 15px;
|
|
136
|
+
const Label = styled.h4`
|
|
138
137
|
font-family: var(--h4-font-family);
|
|
139
|
-
font-weight: var(--
|
|
138
|
+
font-weight: var(--font-weight-regular);
|
|
140
139
|
font-size: var(--h4-font-size);
|
|
141
140
|
line-height: var(--h4-line-height);
|
|
142
|
-
color: var(--
|
|
141
|
+
color: var(--h4-text-color);
|
|
142
|
+
margin-right: 15px;
|
|
143
143
|
`;
|
|
144
144
|
|
|
145
145
|
const SubmitButton = styled(Button).attrs(() => ({
|
|
@@ -5,7 +5,7 @@ import type { ReasonsProps } from '@theme/components/Feedback';
|
|
|
5
5
|
import { useTranslate } from '@portal/hooks';
|
|
6
6
|
|
|
7
7
|
export const Reasons = ({ settings, onChange, className }: ReasonsProps): JSX.Element => {
|
|
8
|
-
const { label,
|
|
8
|
+
const { label, component, items = [] } = settings;
|
|
9
9
|
const [checkedState, setCheckedState] = React.useState(new Array(items.length).fill(false));
|
|
10
10
|
const { translate } = useTranslate();
|
|
11
11
|
|
|
@@ -13,12 +13,13 @@ export const Reasons = ({ settings, onChange, className }: ReasonsProps): JSX.El
|
|
|
13
13
|
return <></>;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
const input_type =
|
|
16
|
+
const input_type = component || 'checkbox';
|
|
17
17
|
|
|
18
18
|
const handleOptionChange = (position: number) => {
|
|
19
|
-
const updatedCheckedState =
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
const updatedCheckedState =
|
|
20
|
+
component === 'checkbox'
|
|
21
|
+
? checkedState.map((item, index) => (index === position ? !item : item))
|
|
22
|
+
: items.map((_, idx) => position === idx);
|
|
22
23
|
setCheckedState(updatedCheckedState);
|
|
23
24
|
|
|
24
25
|
onChange(items.filter((_, index) => !!updatedCheckedState[index]));
|
|
@@ -65,12 +66,12 @@ const Wrapper = styled.div`
|
|
|
65
66
|
flex-direction: column;
|
|
66
67
|
`;
|
|
67
68
|
|
|
68
|
-
const Label = styled.
|
|
69
|
-
font-family: var(--
|
|
70
|
-
font-weight: var(--
|
|
71
|
-
font-size: var(--
|
|
72
|
-
line-height: var(--
|
|
73
|
-
color: var(--
|
|
69
|
+
const Label = styled.h4`
|
|
70
|
+
font-family: var(--h4-font-family);
|
|
71
|
+
font-weight: var(--font-weight-regular);
|
|
72
|
+
font-size: var(--h4-font-size);
|
|
73
|
+
line-height: var(--h4-line-height);
|
|
74
|
+
color: var(--h4-text-color);
|
|
74
75
|
margin-right: 15px;
|
|
75
76
|
`;
|
|
76
77
|
|
|
@@ -84,5 +85,6 @@ const OptionWrapper = styled.div`
|
|
|
84
85
|
label {
|
|
85
86
|
font-size: var(--font-size-base);
|
|
86
87
|
cursor: pointer;
|
|
88
|
+
color: var(--text-secondary);
|
|
87
89
|
}
|
|
88
90
|
`;
|
|
@@ -105,7 +105,7 @@ export const Scale = ({ settings, onSubmit, className }: ScaleProps): JSX.Elemen
|
|
|
105
105
|
settings={{
|
|
106
106
|
label: reasonsSettings?.label,
|
|
107
107
|
items: reasonsSettings?.items || [],
|
|
108
|
-
|
|
108
|
+
component: reasonsSettings?.component,
|
|
109
109
|
}}
|
|
110
110
|
onChange={setReasons}
|
|
111
111
|
/>
|
|
@@ -144,13 +144,12 @@ const Wrapper = styled.div`
|
|
|
144
144
|
}
|
|
145
145
|
`;
|
|
146
146
|
|
|
147
|
-
const Label = styled.
|
|
148
|
-
margin-right: 15px;
|
|
147
|
+
const Label = styled.h4`
|
|
149
148
|
font-family: var(--h4-font-family);
|
|
150
|
-
font-weight: var(--
|
|
149
|
+
font-weight: var(--font-weight-regular);
|
|
151
150
|
font-size: var(--h4-font-size);
|
|
152
151
|
line-height: var(--h4-line-height);
|
|
153
|
-
color: var(--
|
|
152
|
+
color: var(--h4-text-color);
|
|
154
153
|
`;
|
|
155
154
|
|
|
156
155
|
const SubLabelContainer = styled.div`
|
|
@@ -96,7 +96,7 @@ export const Sentiment = ({ settings, onSubmit, className }: SentimentProps): JS
|
|
|
96
96
|
settings={{
|
|
97
97
|
label: reasonsSettings?.label,
|
|
98
98
|
items: reasonsSettings?.items || [],
|
|
99
|
-
|
|
99
|
+
component: reasonsSettings?.component,
|
|
100
100
|
}}
|
|
101
101
|
onChange={setReasons}
|
|
102
102
|
/>
|
|
@@ -135,13 +135,13 @@ const Wrapper = styled.div`
|
|
|
135
135
|
}
|
|
136
136
|
`;
|
|
137
137
|
|
|
138
|
-
const Label = styled.
|
|
139
|
-
margin-right: 15px;
|
|
138
|
+
const Label = styled.h4`
|
|
140
139
|
font-family: var(--h4-font-family);
|
|
141
|
-
font-weight: var(--
|
|
140
|
+
font-weight: var(--font-weight-regular);
|
|
142
141
|
font-size: var(--h4-font-size);
|
|
143
142
|
line-height: var(--h4-line-height);
|
|
144
|
-
color: var(--
|
|
143
|
+
color: var(--h4-text-color);
|
|
144
|
+
margin-right: 15px;
|
|
145
145
|
`;
|
|
146
146
|
|
|
147
147
|
const Vote = styled.div`
|
|
@@ -18,7 +18,7 @@ export type RatingProps = {
|
|
|
18
18
|
reasons?: {
|
|
19
19
|
enable: boolean;
|
|
20
20
|
label?: string;
|
|
21
|
-
|
|
21
|
+
component?: string;
|
|
22
22
|
items: string[];
|
|
23
23
|
};
|
|
24
24
|
};
|
|
@@ -45,7 +45,7 @@ export type ScaleProps = {
|
|
|
45
45
|
reasons?: {
|
|
46
46
|
enable: boolean;
|
|
47
47
|
label?: string;
|
|
48
|
-
|
|
48
|
+
component?: string;
|
|
49
49
|
items: string[];
|
|
50
50
|
};
|
|
51
51
|
};
|
|
@@ -66,7 +66,7 @@ export type MoodProps = {
|
|
|
66
66
|
reasons?: {
|
|
67
67
|
enable: boolean;
|
|
68
68
|
label?: string;
|
|
69
|
-
|
|
69
|
+
component?: string;
|
|
70
70
|
items: string[];
|
|
71
71
|
};
|
|
72
72
|
};
|
|
@@ -86,7 +86,7 @@ export type SentimentProps = {
|
|
|
86
86
|
reasons?: {
|
|
87
87
|
enable: boolean;
|
|
88
88
|
label?: string;
|
|
89
|
-
|
|
89
|
+
component?: string;
|
|
90
90
|
items: string[];
|
|
91
91
|
};
|
|
92
92
|
};
|
|
@@ -108,7 +108,7 @@ export type ReasonsProps = {
|
|
|
108
108
|
onChange: (value: string[]) => void;
|
|
109
109
|
settings: {
|
|
110
110
|
label?: string;
|
|
111
|
-
|
|
111
|
+
component?: string;
|
|
112
112
|
items: string[];
|
|
113
113
|
};
|
|
114
114
|
className?: string;
|
package/src/config.ts
CHANGED
|
@@ -458,7 +458,11 @@ export const themeConfigSchema = {
|
|
|
458
458
|
label: { type: 'string' },
|
|
459
459
|
submitText: { type: 'string' },
|
|
460
460
|
buttonText: { type: 'string' },
|
|
461
|
-
|
|
461
|
+
component: {
|
|
462
|
+
type: 'string',
|
|
463
|
+
enum: ['radio', 'checkbox'],
|
|
464
|
+
default: 'checkbox',
|
|
465
|
+
},
|
|
462
466
|
items: { type: 'array', items: { type: 'string' }, minItems: 1 },
|
|
463
467
|
leftScaleLabel: { type: 'string' },
|
|
464
468
|
rightScaleLabel: { type: 'string' },
|
|
@@ -466,7 +470,11 @@ export const themeConfigSchema = {
|
|
|
466
470
|
type: 'object',
|
|
467
471
|
properties: {
|
|
468
472
|
enable: { type: 'boolean', default: true },
|
|
469
|
-
|
|
473
|
+
component: {
|
|
474
|
+
type: 'string',
|
|
475
|
+
enum: ['radio', 'checkbox'],
|
|
476
|
+
default: 'checkbox',
|
|
477
|
+
},
|
|
470
478
|
label: { type: 'string' },
|
|
471
479
|
items: { type: 'array', items: { type: 'string' } },
|
|
472
480
|
},
|
|
@@ -6,13 +6,14 @@ interface IconProps {
|
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
const Icon = ({ className }: IconProps) => (
|
|
9
|
-
<span data-component-name="icons/CopyIcon">
|
|
10
|
-
<svg
|
|
9
|
+
<span data-component-name="icons/CopyIcon" className={className}>
|
|
10
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16" fill="none">
|
|
11
11
|
<path
|
|
12
12
|
fillRule="evenodd"
|
|
13
13
|
clipRule="evenodd"
|
|
14
|
-
d="
|
|
14
|
+
d="M5.16667 2.66667C5.16667 2.57462 5.24129 2.5 5.33333 2.5H12C12.092 2.5 12.1667 2.57462 12.1667 2.66667V10.6667C12.1667 10.7587 12.092 10.8333 12 10.8333H10H5.33333C5.24129 10.8333 5.16667 10.7587 5.16667 10.6667V4.66667V2.66667ZM4.16667 4.16667V2.66667C4.16667 2.02233 4.689 1.5 5.33333 1.5H12C12.6443 1.5 13.1667 2.02233 13.1667 2.66667V10.6667C13.1667 11.311 12.6443 11.8333 12 11.8333H10.5V13.3333C10.5 13.6428 10.3771 13.9395 10.1583 14.1583C9.9395 14.3771 9.64275 14.5 9.33333 14.5H2.66667C2.35725 14.5 2.0605 14.3771 1.84171 14.1583C1.62292 13.9395 1.5 13.6428 1.5 13.3333V5.33333C1.5 5.02391 1.62292 4.72717 1.84171 4.50838C2.0605 4.28958 2.35725 4.16667 2.66667 4.16667H4.16667ZM9.5 11.8333V13.3333C9.5 13.3775 9.48244 13.4199 9.45118 13.4512C9.41993 13.4824 9.37754 13.5 9.33333 13.5H2.66667C2.62246 13.5 2.58007 13.4824 2.54882 13.4512C2.51756 13.4199 2.5 13.3775 2.5 13.3333V5.33333C2.5 5.28913 2.51756 5.24674 2.54882 5.21548C2.58007 5.18423 2.62246 5.16667 2.66667 5.16667H4.16667V10.6667C4.16667 11.311 4.689 11.8333 5.33333 11.8333H9.5Z"
|
|
15
15
|
fill="currentColor"
|
|
16
|
+
fillOpacity="1"
|
|
16
17
|
/>
|
|
17
18
|
</svg>
|
|
18
19
|
</span>
|
|
@@ -7,21 +7,22 @@ interface IconProps {
|
|
|
7
7
|
|
|
8
8
|
const Icon = ({ className }: IconProps) => (
|
|
9
9
|
<svg
|
|
10
|
-
data-component-name="icons/ReportIcon"
|
|
11
|
-
viewBox="0 0 14 14"
|
|
12
|
-
fill="none"
|
|
13
10
|
xmlns="http://www.w3.org/2000/svg"
|
|
11
|
+
width="16"
|
|
12
|
+
height="16"
|
|
13
|
+
viewBox="0 0 16 16"
|
|
14
|
+
fill="none"
|
|
14
15
|
className={className}
|
|
15
16
|
>
|
|
16
|
-
<rect width="
|
|
17
|
+
<rect width="16" height="16" fill="none" />
|
|
17
18
|
<path
|
|
18
|
-
d="
|
|
19
|
+
d="M8 10C7.85166 10 7.70666 10.044 7.58332 10.1264C7.45999 10.2088 7.36386 10.3259 7.30709 10.463C7.25032 10.6 7.23547 10.7508 7.26441 10.8963C7.29335 11.0418 7.36478 11.1754 7.46967 11.2803C7.57456 11.3852 7.7082 11.4566 7.85368 11.4856C7.99917 11.5145 8.14997 11.4997 8.28701 11.4429C8.42406 11.3861 8.54119 11.29 8.6236 11.1667C8.70601 11.0433 8.75 10.8983 8.75 10.75C8.75 10.5511 8.67098 10.3603 8.53033 10.2197C8.38968 10.079 8.19891 10 8 10Z"
|
|
19
20
|
fill="currentColor"
|
|
20
21
|
fillOpacity="1"
|
|
21
22
|
/>
|
|
22
|
-
<path d="
|
|
23
|
+
<path d="M8.5 4.5H7.5V9H8.5V4.5Z" fill="currentColor" fillOpacity="1" />
|
|
23
24
|
<path
|
|
24
|
-
d="
|
|
25
|
+
d="M13 14H3C2.73488 13.9997 2.4807 13.8942 2.29323 13.7068C2.10576 13.5193 2.0003 13.2651 2 13V3C2.0003 2.73488 2.10576 2.4807 2.29323 2.29323C2.4807 2.10576 2.73488 2.0003 3 2H13C13.2651 2.0003 13.5193 2.10576 13.7068 2.29323C13.8942 2.4807 13.9997 2.73488 14 3V13C13.9997 13.2651 13.8942 13.5193 13.7068 13.7068C13.5193 13.8942 13.2651 13.9997 13 14ZM3 3V13H13.0006L13 3H3Z"
|
|
25
26
|
fill="currentColor"
|
|
26
27
|
fillOpacity="1"
|
|
27
28
|
/>
|