@redocly/theme 0.47.0 → 0.48.0
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/Buttons/CopyButton.d.ts +8 -3
- package/lib/components/Buttons/CopyButton.js +4 -3
- package/lib/components/Feedback/Mood.d.ts +2 -2
- package/lib/components/Feedback/Mood.js +6 -6
- package/lib/components/Feedback/Rating.d.ts +2 -2
- package/lib/components/Feedback/Rating.js +6 -6
- package/lib/components/Feedback/Scale.d.ts +2 -2
- package/lib/components/Feedback/Scale.js +6 -6
- package/lib/components/Feedback/Sentiment.d.ts +2 -2
- package/lib/components/Feedback/Sentiment.js +6 -6
- package/lib/components/Search/SearchDialog.js +8 -8
- package/lib/components/Search/SearchFilter.d.ts +3 -2
- package/lib/components/Search/SearchFilter.js +2 -2
- package/lib/components/Search/SearchFilterField.d.ts +3 -2
- package/lib/components/Search/SearchFilterField.js +2 -2
- package/lib/components/Search/SearchGroups.d.ts +5 -4
- package/lib/components/Search/SearchGroups.js +3 -3
- package/lib/components/StatusCode/StatusCode.js +11 -14
- package/lib/core/constants/code-walkthrough.d.ts +1 -0
- package/lib/core/constants/code-walkthrough.js +5 -0
- package/lib/core/constants/index.d.ts +1 -0
- package/lib/core/constants/index.js +1 -0
- package/lib/core/contexts/CodeWalkthrough/CodeWalkthroughControlsContext.d.ts +2 -0
- package/lib/core/contexts/CodeWalkthrough/CodeWalkthroughControlsContext.js +18 -0
- package/lib/core/contexts/CodeWalkthrough/CodeWalkthroughStepsContext.d.ts +2 -0
- package/lib/core/contexts/CodeWalkthrough/CodeWalkthroughStepsContext.js +11 -0
- package/lib/core/contexts/index.d.ts +2 -0
- package/lib/core/contexts/index.js +2 -0
- package/lib/core/hooks/__mocks__/search/use-search-filter.d.ts +1 -1
- package/lib/core/hooks/__mocks__/search/use-search-filter.js +1 -1
- package/lib/core/hooks/code-walkthrough/__mocks__/MockIntersectionObserver.d.ts +10 -0
- package/lib/core/hooks/code-walkthrough/__mocks__/MockIntersectionObserver.js +55 -0
- package/lib/core/hooks/code-walkthrough/use-code-panel.d.ts +6 -0
- package/lib/core/hooks/code-walkthrough/use-code-panel.js +93 -0
- package/lib/core/hooks/code-walkthrough/use-code-walkthrough-controls.d.ts +22 -0
- package/lib/core/hooks/code-walkthrough/use-code-walkthrough-controls.js +183 -0
- package/lib/core/hooks/code-walkthrough/use-code-walkthrough-steps.d.ts +16 -0
- package/lib/core/hooks/code-walkthrough/use-code-walkthrough-steps.js +117 -0
- package/lib/core/hooks/code-walkthrough/use-code-walkthrough.d.ts +14 -0
- package/lib/core/hooks/code-walkthrough/use-code-walkthrough.js +22 -0
- package/lib/core/hooks/index.d.ts +4 -0
- package/lib/core/hooks/index.js +4 -0
- package/lib/core/hooks/search/use-search-filter.d.ts +2 -2
- package/lib/core/hooks/search/use-search-filter.js +5 -5
- package/lib/core/styles/global.js +2 -0
- package/lib/core/templates/Markdown.d.ts +8 -2
- package/lib/core/templates/Markdown.js +5 -2
- package/lib/core/types/hooks.d.ts +3 -0
- package/lib/core/types/l10n.d.ts +1 -1
- package/lib/core/types/search.d.ts +1 -2
- package/lib/core/utils/download-code-walkthrough.d.ts +4 -0
- package/lib/core/utils/download-code-walkthrough.js +32 -0
- package/lib/core/utils/get-code-walkthrough-file-text.d.ts +4 -0
- package/lib/core/utils/get-code-walkthrough-file-text.js +22 -0
- package/lib/core/utils/get-file-icon.d.ts +2 -0
- package/lib/core/utils/get-file-icon.js +31 -0
- package/lib/core/utils/index.d.ts +5 -0
- package/lib/core/utils/index.js +5 -0
- package/lib/core/utils/js-utils.d.ts +30 -0
- package/lib/core/utils/js-utils.js +41 -0
- package/lib/core/utils/match-code-walkthrough-conditions.d.ts +4 -0
- package/lib/core/utils/match-code-walkthrough-conditions.js +23 -0
- package/lib/core/utils/replace-inputs-with-value.d.ts +3 -0
- package/lib/core/utils/replace-inputs-with-value.js +16 -0
- package/lib/icons/DocumentCssIcon/DocumentCssIcon.d.ts +9 -0
- package/lib/icons/DocumentCssIcon/DocumentCssIcon.js +23 -0
- package/lib/icons/DocumentCssIcon/index.d.ts +1 -0
- package/lib/icons/DocumentCssIcon/index.js +6 -0
- package/lib/icons/DocumentGraphqlIcon/DocumentGraphqlIcon.d.ts +9 -0
- package/lib/icons/DocumentGraphqlIcon/DocumentGraphqlIcon.js +31 -0
- package/lib/icons/DocumentGraphqlIcon/index.d.ts +1 -0
- package/lib/icons/DocumentGraphqlIcon/index.js +6 -0
- package/lib/icons/DocumentHtmlIcon/DocumentHtmlIcon.d.ts +9 -0
- package/lib/icons/DocumentHtmlIcon/DocumentHtmlIcon.js +23 -0
- package/lib/icons/DocumentHtmlIcon/index.d.ts +1 -0
- package/lib/icons/DocumentHtmlIcon/index.js +6 -0
- package/lib/icons/DocumentJsIcon/DocumentJsIcon.d.ts +9 -0
- package/lib/icons/DocumentJsIcon/DocumentJsIcon.js +23 -0
- package/lib/icons/DocumentJsIcon/index.d.ts +1 -0
- package/lib/icons/DocumentJsIcon/index.js +6 -0
- package/lib/icons/DocumentJsonIcon/DocumentJsonIcon.d.ts +9 -0
- package/lib/icons/DocumentJsonIcon/DocumentJsonIcon.js +23 -0
- package/lib/icons/DocumentJsonIcon/index.d.ts +1 -0
- package/lib/icons/DocumentJsonIcon/index.js +6 -0
- package/lib/icons/DocumentMarkdownIcon/DocumentMarkdownIcon.d.ts +9 -0
- package/lib/icons/DocumentMarkdownIcon/DocumentMarkdownIcon.js +23 -0
- package/lib/icons/DocumentMarkdownIcon/index.d.ts +1 -0
- package/lib/icons/DocumentMarkdownIcon/index.js +6 -0
- package/lib/icons/DocumentReactIcon/DocumentReactIcon.d.ts +9 -0
- package/lib/icons/DocumentReactIcon/DocumentReactIcon.js +23 -0
- package/lib/icons/DocumentReactIcon/index.d.ts +1 -0
- package/lib/icons/DocumentReactIcon/index.js +6 -0
- package/lib/icons/DocumentTsIcon/DocumentTsIcon.d.ts +9 -0
- package/lib/icons/DocumentTsIcon/DocumentTsIcon.js +23 -0
- package/lib/icons/DocumentTsIcon/index.d.ts +1 -0
- package/lib/icons/DocumentTsIcon/index.js +6 -0
- package/lib/icons/DocumentYamlIcon/DocumentYamlIcon.d.ts +9 -0
- package/lib/icons/DocumentYamlIcon/DocumentYamlIcon.js +23 -0
- package/lib/icons/DocumentYamlIcon/index.d.ts +1 -0
- package/lib/icons/DocumentYamlIcon/index.js +6 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/layouts/CodeWalkthroughLayout.d.ts +5 -0
- package/lib/layouts/CodeWalkthroughLayout.js +72 -0
- package/lib/markdoc/attributes/code-walkthrough-filesets.d.ts +5 -0
- package/lib/markdoc/attributes/code-walkthrough-filesets.js +16 -0
- package/lib/markdoc/attributes/code-walkthrough-filters.d.ts +5 -0
- package/lib/markdoc/attributes/code-walkthrough-filters.js +16 -0
- package/lib/markdoc/components/CodeWalkthrough/CodeContainer.d.ts +5 -0
- package/lib/markdoc/components/CodeWalkthrough/CodeContainer.js +81 -0
- package/lib/markdoc/components/CodeWalkthrough/CodeFilters.d.ts +12 -0
- package/lib/markdoc/components/CodeWalkthrough/CodeFilters.js +58 -0
- package/lib/markdoc/components/CodeWalkthrough/CodePanel.d.ts +8 -0
- package/lib/markdoc/components/CodeWalkthrough/CodePanel.js +64 -0
- package/lib/markdoc/components/CodeWalkthrough/CodePanelHeader.d.ts +8 -0
- package/lib/markdoc/components/CodeWalkthrough/CodePanelHeader.js +155 -0
- package/lib/markdoc/components/CodeWalkthrough/CodePanelPreview.d.ts +2 -0
- package/lib/markdoc/components/CodeWalkthrough/CodePanelPreview.js +73 -0
- package/lib/markdoc/components/CodeWalkthrough/CodePanelToolbar.d.ts +5 -0
- package/lib/markdoc/components/CodeWalkthrough/CodePanelToolbar.js +47 -0
- package/lib/markdoc/components/CodeWalkthrough/CodeStep.d.ts +12 -0
- package/lib/markdoc/components/CodeWalkthrough/CodeStep.js +128 -0
- package/lib/markdoc/components/CodeWalkthrough/CodeToggle.d.ts +9 -0
- package/lib/markdoc/components/CodeWalkthrough/CodeToggle.js +69 -0
- package/lib/markdoc/components/CodeWalkthrough/CodeWalkthrough.d.ts +4 -0
- package/lib/markdoc/components/CodeWalkthrough/CodeWalkthrough.js +121 -0
- package/lib/markdoc/components/CodeWalkthrough/Input.d.ts +8 -0
- package/lib/markdoc/components/CodeWalkthrough/Input.js +99 -0
- package/lib/markdoc/components/CodeWalkthrough/variables.d.ts +1 -0
- package/lib/markdoc/components/CodeWalkthrough/variables.js +19 -0
- package/lib/markdoc/components/default.d.ts +5 -0
- package/lib/markdoc/components/default.js +5 -0
- package/lib/markdoc/default.js +8 -0
- package/lib/markdoc/tags/code-step.d.ts +2 -0
- package/lib/markdoc/tags/code-step.js +28 -0
- package/lib/markdoc/tags/code-toggle.d.ts +2 -0
- package/lib/markdoc/tags/code-toggle.js +40 -0
- package/lib/markdoc/tags/code-walkthrough.d.ts +8 -0
- package/lib/markdoc/tags/code-walkthrough.js +242 -0
- package/lib/markdoc/tags/input.d.ts +2 -0
- package/lib/markdoc/tags/input.js +37 -0
- package/lib/plugin.d.ts +2 -1
- package/lib/plugin.js +2 -4
- package/package.json +10 -3
- package/src/components/Buttons/CopyButton.tsx +24 -6
- package/src/components/Feedback/Mood.tsx +9 -10
- package/src/components/Feedback/Rating.tsx +9 -10
- package/src/components/Feedback/Scale.tsx +9 -10
- package/src/components/Feedback/Sentiment.tsx +9 -10
- package/src/components/Search/SearchDialog.tsx +11 -6
- package/src/components/Search/SearchFilter.tsx +6 -3
- package/src/components/Search/SearchFilterField.tsx +4 -2
- package/src/components/Search/SearchGroups.tsx +13 -8
- package/src/components/StatusCode/StatusCode.ts +11 -10
- package/src/core/constants/code-walkthrough.ts +1 -0
- package/src/core/constants/index.ts +1 -0
- package/src/core/contexts/CodeWalkthrough/CodeWalkthroughControlsContext.tsx +21 -0
- package/src/core/contexts/CodeWalkthrough/CodeWalkthroughStepsContext.tsx +10 -0
- package/src/core/contexts/index.ts +2 -0
- package/src/core/hooks/__mocks__/search/use-search-filter.ts +1 -1
- package/src/core/hooks/code-walkthrough/__mocks__/MockIntersectionObserver.ts +22 -0
- package/src/core/hooks/code-walkthrough/use-code-panel.ts +164 -0
- package/src/core/hooks/code-walkthrough/use-code-walkthrough-controls.ts +302 -0
- package/src/core/hooks/code-walkthrough/use-code-walkthrough-steps.ts +165 -0
- package/src/core/hooks/code-walkthrough/use-code-walkthrough.ts +51 -0
- package/src/core/hooks/index.ts +4 -0
- package/src/core/hooks/search/use-search-filter.ts +9 -5
- package/src/core/styles/global.ts +2 -0
- package/src/core/templates/Markdown.tsx +16 -5
- package/src/core/types/hooks.ts +3 -0
- package/src/core/types/l10n.ts +5 -3
- package/src/core/types/search.ts +1 -2
- package/src/core/utils/download-code-walkthrough.ts +25 -0
- package/src/core/utils/get-code-walkthrough-file-text.ts +32 -0
- package/src/core/utils/get-file-icon.ts +35 -0
- package/src/core/utils/index.ts +5 -0
- package/src/core/utils/js-utils.ts +48 -0
- package/src/core/utils/match-code-walkthrough-conditions.ts +29 -0
- package/src/core/utils/replace-inputs-with-value.ts +11 -0
- package/src/icons/DocumentCssIcon/DocumentCssIcon.tsx +36 -0
- package/src/icons/DocumentCssIcon/index.ts +1 -0
- package/src/icons/DocumentGraphqlIcon/DocumentGraphqlIcon.tsx +64 -0
- package/src/icons/DocumentGraphqlIcon/index.ts +1 -0
- package/src/icons/DocumentHtmlIcon/DocumentHtmlIcon.tsx +36 -0
- package/src/icons/DocumentHtmlIcon/index.ts +1 -0
- package/src/icons/DocumentJsIcon/DocumentJsIcon.tsx +36 -0
- package/src/icons/DocumentJsIcon/index.ts +1 -0
- package/src/icons/DocumentJsonIcon/DocumentJsonIcon.tsx +36 -0
- package/src/icons/DocumentJsonIcon/index.ts +1 -0
- package/src/icons/DocumentMarkdownIcon/DocumentMarkdownIcon.tsx +36 -0
- package/src/icons/DocumentMarkdownIcon/index.ts +1 -0
- package/src/icons/DocumentReactIcon/DocumentReactIcon.tsx +36 -0
- package/src/icons/DocumentReactIcon/index.ts +1 -0
- package/src/icons/DocumentTsIcon/DocumentTsIcon.tsx +38 -0
- package/src/icons/DocumentTsIcon/index.ts +1 -0
- package/src/icons/DocumentYamlIcon/DocumentYamlIcon.tsx +36 -0
- package/src/icons/DocumentYamlIcon/index.ts +1 -0
- package/src/index.ts +1 -0
- package/src/layouts/CodeWalkthroughLayout.tsx +78 -0
- package/src/markdoc/attributes/code-walkthrough-filesets.ts +9 -0
- package/src/markdoc/attributes/code-walkthrough-filters.ts +9 -0
- package/src/markdoc/components/CodeWalkthrough/CodeContainer.tsx +76 -0
- package/src/markdoc/components/CodeWalkthrough/CodeFilters.tsx +87 -0
- package/src/markdoc/components/CodeWalkthrough/CodePanel.tsx +68 -0
- package/src/markdoc/components/CodeWalkthrough/CodePanelHeader.tsx +192 -0
- package/src/markdoc/components/CodeWalkthrough/CodePanelPreview.tsx +53 -0
- package/src/markdoc/components/CodeWalkthrough/CodePanelToolbar.tsx +31 -0
- package/src/markdoc/components/CodeWalkthrough/CodeStep.tsx +149 -0
- package/src/markdoc/components/CodeWalkthrough/CodeToggle.tsx +63 -0
- package/src/markdoc/components/CodeWalkthrough/CodeWalkthrough.tsx +111 -0
- package/src/markdoc/components/CodeWalkthrough/Input.tsx +101 -0
- package/src/markdoc/components/CodeWalkthrough/variables.ts +16 -0
- package/src/markdoc/components/default.ts +5 -0
- package/src/markdoc/default.ts +8 -0
- package/src/markdoc/tags/code-step.ts +27 -0
- package/src/markdoc/tags/code-toggle.ts +37 -0
- package/src/markdoc/tags/code-walkthrough.ts +315 -0
- package/src/markdoc/tags/input.ts +35 -0
- package/src/plugin.js +2 -2
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { TooltipProps } from '../../components/Tooltip/Tooltip';
|
|
3
|
-
import type {
|
|
3
|
+
import type { ButtonProps } from '../../components/Button/Button';
|
|
4
4
|
export type CopyButtonProps = {
|
|
5
5
|
data: unknown;
|
|
6
|
-
type?:
|
|
6
|
+
type?: 'icon' | 'text' | 'compound';
|
|
7
7
|
toasterPlacement?: TooltipProps['placement'];
|
|
8
8
|
toasterText?: string;
|
|
9
9
|
toasterDuration?: number;
|
|
@@ -11,6 +11,11 @@ export type CopyButtonProps = {
|
|
|
11
11
|
onCopyClick?: (e: React.MouseEvent<HTMLElement>) => void;
|
|
12
12
|
dataTestId?: string;
|
|
13
13
|
className?: string;
|
|
14
|
-
variant?:
|
|
14
|
+
variant?: ButtonProps['variant'];
|
|
15
|
+
size?: ButtonProps['size'];
|
|
16
|
+
disabled?: ButtonProps['disabled'];
|
|
17
|
+
fullWidth?: ButtonProps['fullWidth'];
|
|
18
|
+
tone?: ButtonProps['tone'];
|
|
19
|
+
extraClass?: ButtonProps['extraClass'];
|
|
15
20
|
};
|
|
16
21
|
export declare const CopyButton: React.NamedExoticComponent<CopyButtonProps>;
|
|
@@ -30,7 +30,7 @@ const hooks_1 = require("../../core/hooks");
|
|
|
30
30
|
const Button_1 = require("../../components/Button/Button");
|
|
31
31
|
const CopyIcon_1 = require("../../icons/CopyIcon/CopyIcon");
|
|
32
32
|
const Tooltip_1 = require("../../components/Tooltip/Tooltip");
|
|
33
|
-
function CopyButtonComponent({ data, type = 'icon', toasterPlacement = 'top', toasterText, toasterDuration, buttonText, onCopyClick, dataTestId = 'copy-button', className, variant = 'text', }) {
|
|
33
|
+
function CopyButtonComponent({ data, type = 'icon', toasterPlacement = 'top', toasterText, toasterDuration, buttonText, onCopyClick, dataTestId = 'copy-button', className, variant = 'text', size = 'small', disabled, fullWidth, tone, extraClass, }) {
|
|
34
34
|
const { useTranslate } = (0, hooks_1.useThemeHooks)();
|
|
35
35
|
const tooltip = (0, hooks_1.useControl)();
|
|
36
36
|
const { translate } = useTranslate();
|
|
@@ -46,8 +46,9 @@ function CopyButtonComponent({ data, type = 'icon', toasterPlacement = 'top', to
|
|
|
46
46
|
showTooltip(duration);
|
|
47
47
|
onCopyClick === null || onCopyClick === void 0 ? void 0 : onCopyClick(e);
|
|
48
48
|
};
|
|
49
|
-
return (react_1.default.createElement(Tooltip_1.Tooltip, { className: `copy-button ${className ? className : ''}`, tip: translate('codeSnippet.copy.buttonText', toasterText || 'Copied!'), isOpen: tooltip.isOpened, placement: toasterPlacement },
|
|
50
|
-
react_1.default.createElement(Button_1.Button, { "data-component-name": "Buttons/CopyButton", onClick: (e) => copy(e, toasterDuration), "data-testid": dataTestId, icon: type === 'icon' ? react_1.default.createElement(CopyIcon_1.CopyIcon, null) : undefined, size:
|
|
49
|
+
return (react_1.default.createElement(Tooltip_1.Tooltip, { className: `copy-button ${className ? className : ''}`, tip: translate('codeSnippet.copy.buttonText', toasterText || 'Copied!'), isOpen: tooltip.isOpened, placement: toasterPlacement, width: "fit-content" },
|
|
50
|
+
react_1.default.createElement(Button_1.Button, { "data-component-name": "Buttons/CopyButton", onClick: (e) => copy(e, toasterDuration), "data-testid": dataTestId, icon: type === 'icon' || type === 'compound' ? react_1.default.createElement(CopyIcon_1.CopyIcon, null) : undefined, size: size, variant: variant, disabled: disabled, fullWidth: fullWidth, tone: tone, extraClass: extraClass }, (type === 'text' || type === 'compound') &&
|
|
51
|
+
translate('codeSnippet.copy.toasterText', buttonText || 'Copy'))));
|
|
51
52
|
}
|
|
52
53
|
exports.CopyButton = (0, react_1.memo)(CopyButtonComponent);
|
|
53
54
|
//# sourceMappingURL=CopyButton.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { OptionalEmailSettings, ReasonsSettingsSchema } from '@redocly/config';
|
|
2
2
|
export declare enum MOOD_STATES {
|
|
3
3
|
SATISFIED = "satisfied",
|
|
4
4
|
NEUTRAL = "neutral",
|
|
@@ -25,7 +25,7 @@ export type MoodProps = {
|
|
|
25
25
|
neutral?: ReasonsSettingsSchema;
|
|
26
26
|
dissatisfied?: ReasonsSettingsSchema;
|
|
27
27
|
};
|
|
28
|
-
|
|
28
|
+
optionalEmail?: OptionalEmailSettings;
|
|
29
29
|
};
|
|
30
30
|
className?: string;
|
|
31
31
|
};
|
|
@@ -46,7 +46,7 @@ var MOOD_STATES;
|
|
|
46
46
|
MOOD_STATES["DISSATISFIED"] = "dissatisfied";
|
|
47
47
|
})(MOOD_STATES || (exports.MOOD_STATES = MOOD_STATES = {}));
|
|
48
48
|
function Mood({ settings, onSubmit, className }) {
|
|
49
|
-
const { label, submitText, comment: commentSettings, reasons: reasonsSettings,
|
|
49
|
+
const { label, submitText, comment: commentSettings, reasons: reasonsSettings, optionalEmail: optionalEmailSettings, } = settings || {};
|
|
50
50
|
const [score, setScore] = React.useState('');
|
|
51
51
|
const [isSubmitted, setIsSubmitted] = React.useState(false);
|
|
52
52
|
const [comment, setComment] = React.useState('');
|
|
@@ -109,7 +109,7 @@ function Mood({ settings, onSubmit, className }) {
|
|
|
109
109
|
const displayReasons = checkIfShouldDisplayReasons(score);
|
|
110
110
|
const displayComment = !!(score && !(commentSettings === null || commentSettings === void 0 ? void 0 : commentSettings.hide));
|
|
111
111
|
const displaySubmitBnt = !!(score && (displayReasons || displayComment));
|
|
112
|
-
const displayFeedbackEmail = !!score && (
|
|
112
|
+
const displayFeedbackEmail = !!score && !(optionalEmailSettings === null || optionalEmailSettings === void 0 ? void 0 : optionalEmailSettings.hide) && !userData.isAuthenticated;
|
|
113
113
|
const onSubmitMoodForm = () => {
|
|
114
114
|
onSubmit({
|
|
115
115
|
score: remapScore(score),
|
|
@@ -160,10 +160,10 @@ function Mood({ settings, onSubmit, className }) {
|
|
|
160
160
|
}, onChange: setReasons })),
|
|
161
161
|
displayComment && (React.createElement(Comment_1.Comment, { standAlone: false, onSubmit: ({ comment }) => setComment(comment), settings: { label: renderCommentLabel(score) } })))),
|
|
162
162
|
displayFeedbackEmail && (React.createElement(StyledFormOptionalFields, null,
|
|
163
|
-
React.createElement(Label, { "data-translation-key": "feedback.settings.
|
|
164
|
-
translate('feedback.settings.
|
|
165
|
-
React.createElement(EmailInput, { onChange: onEmailChange, placeholder: (
|
|
166
|
-
translate('feedback.settings.
|
|
163
|
+
React.createElement(Label, { "data-translation-key": "feedback.settings.optionalEmail.label" }, (optionalEmailSettings === null || optionalEmailSettings === void 0 ? void 0 : optionalEmailSettings.label) ||
|
|
164
|
+
translate('feedback.settings.optionalEmail.label', 'Your email (optional, for follow-up)')),
|
|
165
|
+
React.createElement(EmailInput, { onChange: onEmailChange, placeholder: (optionalEmailSettings === null || optionalEmailSettings === void 0 ? void 0 : optionalEmailSettings.placeholder) ||
|
|
166
|
+
translate('feedback.settings.optionalEmail.placeholder', 'yourname@example.com'), type: "email", required: !!email }))),
|
|
167
167
|
displaySubmitBnt && (React.createElement(ButtonsContainer, null,
|
|
168
168
|
React.createElement(Button_1.Button, { onClick: onCancelMoodForm, variant: "text", size: "small" }, "Cancel"),
|
|
169
169
|
React.createElement(Button_1.Button, { type: "submit", variant: "secondary", size: "small" }, "Submit"))))));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { OptionalEmailSettings } from '@redocly/config';
|
|
2
2
|
export declare const FEEDBACK_MAX_RATING = 5;
|
|
3
3
|
export type RatingProps = {
|
|
4
4
|
onSubmit: (value: {
|
|
@@ -21,7 +21,7 @@ export type RatingProps = {
|
|
|
21
21
|
component?: string;
|
|
22
22
|
items: string[];
|
|
23
23
|
};
|
|
24
|
-
|
|
24
|
+
optionalEmail?: OptionalEmailSettings;
|
|
25
25
|
};
|
|
26
26
|
className?: string;
|
|
27
27
|
};
|
|
@@ -39,7 +39,7 @@ const Stars_1 = require("../../components/Feedback/Stars");
|
|
|
39
39
|
const Button_1 = require("../../components/Button/Button");
|
|
40
40
|
exports.FEEDBACK_MAX_RATING = 5;
|
|
41
41
|
function Rating({ settings, onSubmit, className }) {
|
|
42
|
-
const { label, submitText, comment: commentSettings, reasons: reasonsSettings,
|
|
42
|
+
const { label, submitText, comment: commentSettings, reasons: reasonsSettings, optionalEmail: optionalEmailSettings, } = settings || {};
|
|
43
43
|
const [isSubmitted, setIsSubmitted] = React.useState(false);
|
|
44
44
|
const [score, setScore] = React.useState(0);
|
|
45
45
|
const [reasons, setReasons] = React.useState([]);
|
|
@@ -71,7 +71,7 @@ function Rating({ settings, onSubmit, className }) {
|
|
|
71
71
|
const displayReasons = !!(score && reasonsSettings && !reasonsSettings.hide);
|
|
72
72
|
const displayComment = !!(score && !(commentSettings === null || commentSettings === void 0 ? void 0 : commentSettings.hide));
|
|
73
73
|
const displaySubmitBnt = !!(score && (displayReasons || displayComment));
|
|
74
|
-
const displayFeedbackEmail = !!score && (
|
|
74
|
+
const displayFeedbackEmail = !!score && !(optionalEmailSettings === null || optionalEmailSettings === void 0 ? void 0 : optionalEmailSettings.hide) && !userData.isAuthenticated;
|
|
75
75
|
(0, react_1.useEffect)(() => {
|
|
76
76
|
if (score && !displayComment && !displayReasons && !displayFeedbackEmail) {
|
|
77
77
|
onSubmitRatingForm();
|
|
@@ -102,10 +102,10 @@ function Rating({ settings, onSubmit, className }) {
|
|
|
102
102
|
translate('feedback.settings.comment.label', 'Please share your feedback with us.'),
|
|
103
103
|
} })))),
|
|
104
104
|
displayFeedbackEmail && (React.createElement(StyledFormOptionalFields, null,
|
|
105
|
-
React.createElement(Label, { "data-translation-key": "feedback.settings.
|
|
106
|
-
translate('feedback.settings.
|
|
107
|
-
React.createElement(EmailInput, { onChange: onEmailChange, placeholder: (
|
|
108
|
-
translate('feedback.settings.
|
|
105
|
+
React.createElement(Label, { "data-translation-key": "feedback.settings.optionalEmail.label" }, (optionalEmailSettings === null || optionalEmailSettings === void 0 ? void 0 : optionalEmailSettings.label) ||
|
|
106
|
+
translate('feedback.settings.optionalEmail.label', 'Your email (optional, for follow-up)')),
|
|
107
|
+
React.createElement(EmailInput, { onChange: onEmailChange, placeholder: (optionalEmailSettings === null || optionalEmailSettings === void 0 ? void 0 : optionalEmailSettings.placeholder) ||
|
|
108
|
+
translate('feedback.settings.optionalEmail.placeholder', 'yourname@example.com'), type: "email", required: !!email }))),
|
|
109
109
|
displaySubmitBnt && (React.createElement(ButtonsContainer, null,
|
|
110
110
|
React.createElement(Button_1.Button, { onClick: onCancelRatingForm, variant: "text", size: "small" }, "Cancel"),
|
|
111
111
|
React.createElement(Button_1.Button, { onClick: onSubmitRatingForm, variant: "secondary", size: "small" }, "Submit"))))));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { OptionalEmailSettings } from '@redocly/config';
|
|
2
2
|
export declare const MAX_SCALE = 10;
|
|
3
3
|
export type ScaleProps = {
|
|
4
4
|
onSubmit: (value: {
|
|
@@ -23,7 +23,7 @@ export type ScaleProps = {
|
|
|
23
23
|
component?: string;
|
|
24
24
|
items: string[];
|
|
25
25
|
};
|
|
26
|
-
|
|
26
|
+
optionalEmail?: OptionalEmailSettings;
|
|
27
27
|
};
|
|
28
28
|
className?: string;
|
|
29
29
|
};
|
|
@@ -39,7 +39,7 @@ const Reasons_1 = require("../../components/Feedback/Reasons");
|
|
|
39
39
|
const Button_1 = require("../../components/Button/Button");
|
|
40
40
|
exports.MAX_SCALE = 10;
|
|
41
41
|
function Scale({ settings, onSubmit, className }) {
|
|
42
|
-
const { label, submitText, leftScaleLabel, rightScaleLabel, comment: commentSettings, reasons: reasonsSettings,
|
|
42
|
+
const { label, submitText, leftScaleLabel, rightScaleLabel, comment: commentSettings, reasons: reasonsSettings, optionalEmail: optionalEmailSettings, } = settings || {};
|
|
43
43
|
const [score, setScore] = React.useState(0);
|
|
44
44
|
const [isSubmitted, setIsSubmitted] = React.useState(false);
|
|
45
45
|
const [comment, setComment] = React.useState('');
|
|
@@ -59,7 +59,7 @@ function Scale({ settings, onSubmit, className }) {
|
|
|
59
59
|
const displayReasons = !!score && reasonsSettings && !reasonsSettings.hide;
|
|
60
60
|
const displayComment = !!(score && !(commentSettings === null || commentSettings === void 0 ? void 0 : commentSettings.hide));
|
|
61
61
|
const displaySubmitBnt = !!score && (displayReasons || displayComment);
|
|
62
|
-
const displayFeedbackEmail = !!score && (
|
|
62
|
+
const displayFeedbackEmail = !!score && !(optionalEmailSettings === null || optionalEmailSettings === void 0 ? void 0 : optionalEmailSettings.hide) && !userData.isAuthenticated;
|
|
63
63
|
const handleCancel = () => {
|
|
64
64
|
setScore(0);
|
|
65
65
|
setComment('');
|
|
@@ -109,10 +109,10 @@ function Scale({ settings, onSubmit, className }) {
|
|
|
109
109
|
translate('feedback.settings.comment.label', 'Please share your feedback with us.'),
|
|
110
110
|
} }))),
|
|
111
111
|
displayFeedbackEmail && (React.createElement(StyledFormOptionalFields, null,
|
|
112
|
-
React.createElement(Label, { "data-translation-key": "feedback.settings.
|
|
113
|
-
translate('feedback.settings.
|
|
114
|
-
React.createElement(EmailInput, { onChange: onEmailChange, placeholder: (
|
|
115
|
-
translate('feedback.settings.
|
|
112
|
+
React.createElement(Label, { "data-translation-key": "feedback.settings.optionalEmail.label" }, (optionalEmailSettings === null || optionalEmailSettings === void 0 ? void 0 : optionalEmailSettings.label) ||
|
|
113
|
+
translate('feedback.settings.optionalEmail.label', 'Your email (optional, for follow-up)')),
|
|
114
|
+
React.createElement(EmailInput, { onChange: onEmailChange, placeholder: (optionalEmailSettings === null || optionalEmailSettings === void 0 ? void 0 : optionalEmailSettings.placeholder) ||
|
|
115
|
+
translate('feedback.settings.optionalEmail.placeholder', 'yourname@example.com'), type: "email", required: !!email }))),
|
|
116
116
|
displaySubmitBnt && (React.createElement(ButtonsContainer, null,
|
|
117
117
|
React.createElement(Button_1.Button, { "data-translation-key": "feedback.settings.comment.cancel", onClick: handleCancel, variant: "text", size: "small" }, translate('feedback.settings.comment.cancel', 'Cancel')),
|
|
118
118
|
React.createElement(Button_1.Button, { "data-translation-key": "feedback.settings.scale.send", type: "submit", variant: "secondary", size: "small" }, translate('feedback.settings.scale.send', 'Submit')))))));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { OptionalEmailSettings, ReasonsSettingsSchema } from '@redocly/config';
|
|
2
2
|
export type SentimentProps = {
|
|
3
3
|
onSubmit: (value: {
|
|
4
4
|
score: number;
|
|
@@ -18,7 +18,7 @@ export type SentimentProps = {
|
|
|
18
18
|
like?: ReasonsSettingsSchema;
|
|
19
19
|
dislike?: ReasonsSettingsSchema;
|
|
20
20
|
};
|
|
21
|
-
|
|
21
|
+
optionalEmail?: OptionalEmailSettings;
|
|
22
22
|
};
|
|
23
23
|
className?: string;
|
|
24
24
|
};
|
|
@@ -38,7 +38,7 @@ const Button_1 = require("../../components/Button/Button");
|
|
|
38
38
|
const ThumbDownIcon_1 = require("../../icons/ThumbDownIcon/ThumbDownIcon");
|
|
39
39
|
const ThumbUpIcon_1 = require("../../icons/ThumbUpIcon/ThumbUpIcon");
|
|
40
40
|
function Sentiment({ settings, onSubmit, className }) {
|
|
41
|
-
const { label, submitText, comment: commentSettings, reasons: reasonsSettings,
|
|
41
|
+
const { label, submitText, comment: commentSettings, reasons: reasonsSettings, optionalEmail: optionalEmailSettings, } = settings || {};
|
|
42
42
|
const [isSubmitted, setIsSubmitted] = React.useState(false);
|
|
43
43
|
const [score, setScore] = React.useState(0);
|
|
44
44
|
const [comment, setComment] = React.useState('');
|
|
@@ -74,7 +74,7 @@ function Sentiment({ settings, onSubmit, className }) {
|
|
|
74
74
|
const displayReasons = checkIfShouldDisplayReasons(score);
|
|
75
75
|
const displayComment = !!(score && !(commentSettings === null || commentSettings === void 0 ? void 0 : commentSettings.hide));
|
|
76
76
|
const displaySubmitBnt = !!(score && (displayReasons || displayComment));
|
|
77
|
-
const displayFeedbackEmail = !!score && (
|
|
77
|
+
const displayFeedbackEmail = !!score && !(optionalEmailSettings === null || optionalEmailSettings === void 0 ? void 0 : optionalEmailSettings.hide) && !userData.isAuthenticated;
|
|
78
78
|
const commentLabel = score === 1
|
|
79
79
|
? (commentSettings && commentSettings.likeLabel) ||
|
|
80
80
|
translate('feedback.settings.comment.likeLabel', 'What was most helpful?')
|
|
@@ -141,10 +141,10 @@ function Sentiment({ settings, onSubmit, className }) {
|
|
|
141
141
|
}, onChange: setReasons })),
|
|
142
142
|
displayComment && (React.createElement(Comment_1.Comment, { standAlone: false, onSubmit: ({ comment }) => setComment(comment), settings: { label: commentLabel } })))),
|
|
143
143
|
displayFeedbackEmail && (React.createElement(StyledFormOptionalFields, null,
|
|
144
|
-
React.createElement(Label, { "data-translation-key": "feedback.settings.
|
|
145
|
-
translate('feedback.settings.
|
|
146
|
-
React.createElement(EmailInput, { onChange: onEmailChange, placeholder: (
|
|
147
|
-
translate('feedback.settings.
|
|
144
|
+
React.createElement(Label, { "data-translation-key": "feedback.settings.optionalEmail.label" }, (optionalEmailSettings === null || optionalEmailSettings === void 0 ? void 0 : optionalEmailSettings.label) ||
|
|
145
|
+
translate('feedback.settings.optionalEmail.label', 'Your email (optional, for follow-up)')),
|
|
146
|
+
React.createElement(EmailInput, { onChange: onEmailChange, placeholder: (optionalEmailSettings === null || optionalEmailSettings === void 0 ? void 0 : optionalEmailSettings.placeholder) ||
|
|
147
|
+
translate('feedback.settings.optionalEmail.placeholder', 'yourname@example.com'), type: "email", required: !!email }))),
|
|
148
148
|
displaySubmitBnt && (React.createElement(ButtonsContainer, null,
|
|
149
149
|
React.createElement(Button_1.Button, { onClick: onCancelSentimentForm, variant: "text", size: "small" }, "Cancel"),
|
|
150
150
|
React.createElement(Button_1.Button, { onClick: onSubmitSentimentForm, variant: "secondary", size: "small" }, "Submit"))))));
|
|
@@ -52,8 +52,8 @@ function SearchDialog({ onClose, className }) {
|
|
|
52
52
|
const [product, setProduct] = (0, react_1.useState)(currentProduct);
|
|
53
53
|
const [mode, setMode] = (0, react_1.useState)('search');
|
|
54
54
|
const autoSearchDisabled = mode !== 'search';
|
|
55
|
-
const { query, setQuery, filter, setFilter, items, isSearchLoading, facets, setLoadMore, advancedSearch, askAi, } = useSearch(product === null || product === void 0 ? void 0 : product.name, autoSearchDisabled);
|
|
56
|
-
const { isFilterOpen, onFilterToggle, onFilterChange, onFilterReset, onFacetReset,
|
|
55
|
+
const { query, setQuery, filter, setFilter, items, isSearchLoading, facets, setLoadMore, advancedSearch, askAi, groupField, } = useSearch(product === null || product === void 0 ? void 0 : product.name, autoSearchDisabled);
|
|
56
|
+
const { isFilterOpen, onFilterToggle, onFilterChange, onFilterReset, onFacetReset, onQuickFilterReset, } = (0, hooks_1.useSearchFilter)(filter, setFilter);
|
|
57
57
|
const aiSearch = useAiSearch({ filter });
|
|
58
58
|
const modalRef = (0, react_1.useRef)(null);
|
|
59
59
|
const { translate } = useTranslate();
|
|
@@ -80,10 +80,10 @@ function SearchDialog({ onClose, className }) {
|
|
|
80
80
|
return react_1.default.createElement(SearchItem_1.SearchItem, { key: `${index}-${item.document.id}`, item: item, product: itemProduct });
|
|
81
81
|
};
|
|
82
82
|
const showLoadMore = (groupKey, currentCount = 0) => {
|
|
83
|
-
const
|
|
83
|
+
const groupFacet = facets.find((facet) => facet.field === groupField);
|
|
84
84
|
let needLoadMore = false;
|
|
85
|
-
if (
|
|
86
|
-
const groupValue =
|
|
85
|
+
if (groupFacet) {
|
|
86
|
+
const groupValue = groupFacet.values.find((value) => {
|
|
87
87
|
if (typeof value === 'object') {
|
|
88
88
|
return value.value === groupKey;
|
|
89
89
|
}
|
|
@@ -124,11 +124,11 @@ function SearchDialog({ onClose, className }) {
|
|
|
124
124
|
showSearchFilterButton && (react_1.default.createElement(SearchFilterToggleButton, { icon: react_1.default.createElement(SettingsIcon_1.SettingsIcon, null), onClick: onFilterToggle }))))),
|
|
125
125
|
react_1.default.createElement(SearchDialogBody, null, mode === 'search' ? (react_1.default.createElement(react_1.default.Fragment, null,
|
|
126
126
|
react_1.default.createElement(SearchDialogBodyMainView, null,
|
|
127
|
-
react_1.default.createElement(SearchGroups_1.SearchGroups, { facets: facets, searchFilter: filter, onFilterChange: onFilterChange,
|
|
127
|
+
react_1.default.createElement(SearchGroups_1.SearchGroups, { facets: facets, searchFilter: filter, onFilterChange: onFilterChange, onQuickFilterReset: onQuickFilterReset, groupField: groupField }),
|
|
128
128
|
showResults ? (items && Object.keys(items).some((key) => { var _a; return (_a = items[key]) === null || _a === void 0 ? void 0 : _a.length; }) ? (Object.keys(items).map((key) => {
|
|
129
129
|
var _a, _b, _c;
|
|
130
130
|
return ((_a = items[key]) === null || _a === void 0 ? void 0 : _a.length) ? (react_1.default.createElement(react_1.Fragment, { key: key },
|
|
131
|
-
react_1.default.createElement(SearchGroupTitle,
|
|
131
|
+
react_1.default.createElement(SearchGroupTitle, { "data-testid": "search-group-title" }, key), (_b = items[key]) === null || _b === void 0 ? void 0 :
|
|
132
132
|
_b.map(mapItem),
|
|
133
133
|
showLoadMore(key, ((_c = items[key]) === null || _c === void 0 ? void 0 : _c.length) || 0) && (react_1.default.createElement(SearchGroupFooter, { "data-translation-key": "search.showMore", onClick: () => { var _a; return setLoadMore({ groupKey: key, offset: ((_a = items[key]) === null || _a === void 0 ? void 0 : _a.length) || 0 }); } }, translate('search.showMore', 'Show more'))))) : null;
|
|
134
134
|
})) : isSearchLoading ? (react_1.default.createElement(SearchMessage, null,
|
|
@@ -138,7 +138,7 @@ function SearchDialog({ onClose, className }) {
|
|
|
138
138
|
react_1.default.createElement(SearchRecent_1.SearchRecent, { onSelect: setQuery }),
|
|
139
139
|
react_1.default.createElement(SearchSuggestedPages_1.SearchSuggestedPages, null)))),
|
|
140
140
|
advancedSearch && mode === 'search' && isFilterOpen && (react_1.default.createElement(SearchDialogBodyFilterView, null,
|
|
141
|
-
react_1.default.createElement(SearchFilter_1.SearchFilter, { facets: facets, filter: filter, query: query, onFilterChange: onFilterChange, onFilterReset: onFilterReset, onFacetReset: onFacetReset }))))) : (react_1.default.createElement(SearchAiResponse_1.SearchAiResponse, { question: aiSearch.question, isGeneratingResponse: aiSearch.isGeneratingResponse, response: aiSearch.response, resources: aiSearch.resources }))),
|
|
141
|
+
react_1.default.createElement(SearchFilter_1.SearchFilter, { facets: facets, filter: filter, query: query, quickFilterFields: [groupField], onFilterChange: onFilterChange, onFilterReset: onFilterReset, onFacetReset: onFacetReset }))))) : (react_1.default.createElement(SearchAiResponse_1.SearchAiResponse, { question: aiSearch.question, isGeneratingResponse: aiSearch.isGeneratingResponse, response: aiSearch.response, resources: aiSearch.resources }))),
|
|
142
142
|
mode === 'search' && (react_1.default.createElement(SearchDialogFooter, null,
|
|
143
143
|
react_1.default.createElement(SearchShortcuts, null,
|
|
144
144
|
react_1.default.createElement(SearchShortcut_1.SearchShortcut, { "data-translation-key": "search.keys.navigate", combination: "Tab", text: translate('search.keys.navigate', 'to navigate') }),
|
|
@@ -4,8 +4,9 @@ export type SearchFilterProps = {
|
|
|
4
4
|
facets: SearchFacet[];
|
|
5
5
|
filter: SearchFilterItem[];
|
|
6
6
|
query: string;
|
|
7
|
-
|
|
7
|
+
quickFilterFields: string[];
|
|
8
|
+
onFilterChange: (field: string, value: string | string[], isQuickFilter?: boolean) => void;
|
|
8
9
|
onFilterReset: () => void;
|
|
9
10
|
onFacetReset: (field: string) => void;
|
|
10
11
|
};
|
|
11
|
-
export declare function SearchFilter({ className, facets, filter, query, onFilterChange, onFilterReset, onFacetReset, }: SearchFilterProps): JSX.Element;
|
|
12
|
+
export declare function SearchFilter({ className, facets, filter, query, quickFilterFields, onFilterChange, onFilterReset, onFacetReset, }: SearchFilterProps): JSX.Element;
|
|
@@ -33,14 +33,14 @@ const Button_1 = require("../../components/Button/Button");
|
|
|
33
33
|
const CleanIcon_1 = require("../../icons/CleanIcon/CleanIcon");
|
|
34
34
|
const SearchFilterField_1 = require("../../components/Search/SearchFilterField");
|
|
35
35
|
const hooks_1 = require("../../core/hooks");
|
|
36
|
-
function SearchFilter({ className, facets, filter, query, onFilterChange, onFilterReset, onFacetReset, }) {
|
|
36
|
+
function SearchFilter({ className, facets, filter, query, quickFilterFields, onFilterChange, onFilterReset, onFacetReset, }) {
|
|
37
37
|
const { useTranslate } = (0, hooks_1.useThemeHooks)();
|
|
38
38
|
const { translate } = useTranslate();
|
|
39
39
|
return (React.createElement(SearchFilterWrapper, { "data-component-name": "Search/SearchFilter", className: className },
|
|
40
40
|
React.createElement(SearchFilterHeader, null,
|
|
41
41
|
React.createElement("span", { "data-translation-key": "search.filter.title" }, translate('search.filter.title', 'Advanced filter')),
|
|
42
42
|
React.createElement(Button_1.Button, { "data-translation-key": "search.filter.reset", onClick: onFilterReset, variant: "ghost", icon: React.createElement(CleanIcon_1.CleanIcon, null) }, translate('search.filter.reset', 'Reset filters'))),
|
|
43
|
-
React.createElement(SearchFilterFields, null, facets.map((facet, index) => (React.createElement(SearchFilterField_1.SearchFilterField, { key: `${facet.field}-${index}`, facet: facet,
|
|
43
|
+
React.createElement(SearchFilterFields, null, facets.map((facet, index) => (React.createElement(SearchFilterField_1.SearchFilterField, { key: `${facet.field}-${index}`, facet: facet, filter: filter, query: query, quickFilterFields: quickFilterFields, onFilterChange: onFilterChange, onFacetReset: onFacetReset }))))));
|
|
44
44
|
}
|
|
45
45
|
const SearchFilterWrapper = styled_components_1.default.div `
|
|
46
46
|
width: var(--search-filter-width);
|
|
@@ -4,8 +4,9 @@ type SearchFilterFieldProps = {
|
|
|
4
4
|
facet: SearchFacet;
|
|
5
5
|
filter: SearchFilterItem[];
|
|
6
6
|
query: string;
|
|
7
|
-
|
|
7
|
+
quickFilterFields: string[];
|
|
8
|
+
onFilterChange: (field: string, value: string | string[], isQuickFilter?: boolean) => void;
|
|
8
9
|
onFacetReset: (filed: string) => void;
|
|
9
10
|
};
|
|
10
|
-
export declare function SearchFilterField({ className, facet, filter, query, onFilterChange, onFacetReset, }: SearchFilterFieldProps): JSX.Element;
|
|
11
|
+
export declare function SearchFilterField({ className, facet, filter, query, quickFilterFields, onFilterChange, onFacetReset, }: SearchFilterFieldProps): JSX.Element;
|
|
11
12
|
export {};
|
|
@@ -11,13 +11,13 @@ const ResetIcon_1 = require("../../icons/ResetIcon/ResetIcon");
|
|
|
11
11
|
const hooks_1 = require("../../core/hooks");
|
|
12
12
|
const SearchFilterFieldSelect_1 = require("../../components/Search/FilterFields/SearchFilterFieldSelect");
|
|
13
13
|
const SearchFilterFieldTags_1 = require("../../components/Search/FilterFields/SearchFilterFieldTags");
|
|
14
|
-
function SearchFilterField({ className, facet, filter, query, onFilterChange, onFacetReset, }) {
|
|
14
|
+
function SearchFilterField({ className, facet, filter, query, quickFilterFields, onFilterChange, onFacetReset, }) {
|
|
15
15
|
var _a;
|
|
16
16
|
const { useTranslate } = (0, hooks_1.useThemeHooks)();
|
|
17
17
|
const { translate } = useTranslate();
|
|
18
18
|
const selectedValues = ((_a = filter.find((item) => item.field === facet.field)) === null || _a === void 0 ? void 0 : _a.values) || [];
|
|
19
19
|
const onChange = (value) => {
|
|
20
|
-
onFilterChange(facet.field, value, facet.
|
|
20
|
+
onFilterChange(facet.field, value, facet.field in quickFilterFields);
|
|
21
21
|
};
|
|
22
22
|
const onReset = () => {
|
|
23
23
|
onFacetReset(facet.field);
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type SearchFacet, type SearchFilterItem } from '../../core/types';
|
|
2
2
|
type SearchGroupsProps = {
|
|
3
3
|
facets: SearchFacet[];
|
|
4
4
|
searchFilter: SearchFilterItem[];
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
groupField: string;
|
|
6
|
+
onFilterChange: (field: string, value: string[], isQuickFilter?: boolean) => void;
|
|
7
|
+
onQuickFilterReset: () => void;
|
|
7
8
|
};
|
|
8
|
-
export declare function SearchGroups({ facets, searchFilter, onFilterChange,
|
|
9
|
+
export declare function SearchGroups({ facets, searchFilter, groupField, onFilterChange, onQuickFilterReset, }: SearchGroupsProps): JSX.Element;
|
|
9
10
|
export {};
|
|
@@ -30,8 +30,8 @@ exports.SearchGroups = SearchGroups;
|
|
|
30
30
|
const React = __importStar(require("react"));
|
|
31
31
|
const styled_components_1 = __importDefault(require("styled-components"));
|
|
32
32
|
const Tag_1 = require("../../components/Tag/Tag");
|
|
33
|
-
function SearchGroups({ facets, searchFilter, onFilterChange,
|
|
34
|
-
const groupFacets = facets.filter((facet) => facet.
|
|
33
|
+
function SearchGroups({ facets, searchFilter, groupField, onFilterChange, onQuickFilterReset, }) {
|
|
34
|
+
const groupFacets = facets.filter((facet) => facet.field === groupField);
|
|
35
35
|
const handleGroupTagClick = (value, fieldId, active, currentValues) => {
|
|
36
36
|
const values = active
|
|
37
37
|
? currentValues.filter((item) => item !== value)
|
|
@@ -39,7 +39,7 @@ function SearchGroups({ facets, searchFilter, onFilterChange, onTopFacetsReset,
|
|
|
39
39
|
onFilterChange(fieldId, values, true);
|
|
40
40
|
};
|
|
41
41
|
return (React.createElement(SearchGroupsWrapper, null,
|
|
42
|
-
React.createElement(GroupTag, { borderless: true, active: !searchFilter.some((item) => item.
|
|
42
|
+
React.createElement(GroupTag, { borderless: true, active: !searchFilter.some((item) => item.isQuickFilter), onClick: () => searchFilter.some((item) => item.isQuickFilter) && onQuickFilterReset() }, "All"),
|
|
43
43
|
React.createElement(Divider, null),
|
|
44
44
|
groupFacets.flatMap((facet) => facet.values.map((facetCount, index) => {
|
|
45
45
|
var _a;
|
|
@@ -20,20 +20,17 @@ exports.StatusCode = styled_components_1.default.button.attrs({ 'data-component-
|
|
|
20
20
|
width: var(--status-code-width);
|
|
21
21
|
border: var(--status-code-border);
|
|
22
22
|
background-color: ${({ status }) => {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
35
|
-
else {
|
|
36
|
-
return 'var(--status-code-100-bg-color)';
|
|
23
|
+
switch (true) {
|
|
24
|
+
case status.startsWith('2'):
|
|
25
|
+
return 'var(--status-code-200-bg-color)';
|
|
26
|
+
case status.startsWith('3'):
|
|
27
|
+
return 'var(--status-code-300-bg-color)';
|
|
28
|
+
case status.startsWith('4'):
|
|
29
|
+
return 'var(--status-code-400-bg-color)';
|
|
30
|
+
case status.startsWith('5'):
|
|
31
|
+
return 'var(--status-code-500-bg-color)';
|
|
32
|
+
default:
|
|
33
|
+
return 'var(--status-code-100-bg-color)';
|
|
37
34
|
}
|
|
38
35
|
}}
|
|
39
36
|
`;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const ACTIVE_STEP_QUERY_PARAM = "__step";
|
|
@@ -16,4 +16,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("../../core/constants/common"), exports);
|
|
18
18
|
__exportStar(require("../../core/constants/environments"), exports);
|
|
19
|
+
__exportStar(require("../../core/constants/code-walkthrough"), exports);
|
|
19
20
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CodeWalkthroughControlsStateContext = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
exports.CodeWalkthroughControlsStateContext = (0, react_1.createContext)({
|
|
6
|
+
activeFilters: [],
|
|
7
|
+
getToggleState: () => null,
|
|
8
|
+
changeToggleState: () => { },
|
|
9
|
+
getInputState: () => null,
|
|
10
|
+
changeInputState: () => { },
|
|
11
|
+
getFilterState: () => null,
|
|
12
|
+
changeFilterState: () => { },
|
|
13
|
+
getFileText: () => '',
|
|
14
|
+
areConditionsMet: () => false,
|
|
15
|
+
handleDownloadCode: () => Promise.resolve(),
|
|
16
|
+
populateInputsWithValue: (node) => node,
|
|
17
|
+
});
|
|
18
|
+
//# sourceMappingURL=CodeWalkthroughControlsContext.js.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CodeWalkthroughStepsContext = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
exports.CodeWalkthroughStepsContext = (0, react_1.createContext)({
|
|
6
|
+
activeStep: null,
|
|
7
|
+
setActiveStep: () => { },
|
|
8
|
+
register: () => { },
|
|
9
|
+
unregister: () => { },
|
|
10
|
+
});
|
|
11
|
+
//# sourceMappingURL=CodeWalkthroughStepsContext.js.map
|
|
@@ -15,4 +15,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("../../core/contexts/ThemeDataContext"), exports);
|
|
18
|
+
__exportStar(require("../../core/contexts/CodeWalkthrough/CodeWalkthroughControlsContext"), exports);
|
|
19
|
+
__exportStar(require("../../core/contexts/CodeWalkthrough/CodeWalkthroughStepsContext"), exports);
|
|
18
20
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare class MockIntersectionObserver {
|
|
2
|
+
readonly root: Element | Document | null;
|
|
3
|
+
readonly rootMargin: string;
|
|
4
|
+
readonly thresholds: ReadonlyArray<number>;
|
|
5
|
+
observe: (target: HTMLElement) => void;
|
|
6
|
+
unobserve: (target: HTMLElement) => void;
|
|
7
|
+
disconnect: () => void;
|
|
8
|
+
constructor(callback: IntersectionObserverCallback, options?: IntersectionObserverInit);
|
|
9
|
+
takeRecords(): any[];
|
|
10
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MockIntersectionObserver = void 0;
|
|
4
|
+
class MockIntersectionObserver {
|
|
5
|
+
// @ts-ignore
|
|
6
|
+
constructor(callback, options) {
|
|
7
|
+
Object.defineProperty(this, "root", {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
configurable: true,
|
|
10
|
+
writable: true,
|
|
11
|
+
value: void 0
|
|
12
|
+
});
|
|
13
|
+
Object.defineProperty(this, "rootMargin", {
|
|
14
|
+
enumerable: true,
|
|
15
|
+
configurable: true,
|
|
16
|
+
writable: true,
|
|
17
|
+
value: void 0
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(this, "thresholds", {
|
|
20
|
+
enumerable: true,
|
|
21
|
+
configurable: true,
|
|
22
|
+
writable: true,
|
|
23
|
+
value: void 0
|
|
24
|
+
});
|
|
25
|
+
Object.defineProperty(this, "observe", {
|
|
26
|
+
enumerable: true,
|
|
27
|
+
configurable: true,
|
|
28
|
+
writable: true,
|
|
29
|
+
value: void 0
|
|
30
|
+
});
|
|
31
|
+
Object.defineProperty(this, "unobserve", {
|
|
32
|
+
enumerable: true,
|
|
33
|
+
configurable: true,
|
|
34
|
+
writable: true,
|
|
35
|
+
value: void 0
|
|
36
|
+
});
|
|
37
|
+
Object.defineProperty(this, "disconnect", {
|
|
38
|
+
enumerable: true,
|
|
39
|
+
configurable: true,
|
|
40
|
+
writable: true,
|
|
41
|
+
value: void 0
|
|
42
|
+
});
|
|
43
|
+
this.root = null;
|
|
44
|
+
this.rootMargin = '0px';
|
|
45
|
+
this.thresholds = [1];
|
|
46
|
+
this.observe = jest.fn;
|
|
47
|
+
this.unobserve = jest.fn;
|
|
48
|
+
this.disconnect = jest.fn;
|
|
49
|
+
}
|
|
50
|
+
takeRecords() {
|
|
51
|
+
return [];
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
exports.MockIntersectionObserver = MockIntersectionObserver;
|
|
55
|
+
//# sourceMappingURL=MockIntersectionObserver.js.map
|