@redocly/theme 0.42.3 → 0.44.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.js +2 -2
- package/lib/components/Buttons/EditPageButton.js +1 -1
- package/lib/components/Catalog/CatalogActions.js +1 -1
- package/lib/components/Dropdown/DropdownMenu.d.ts +2 -0
- package/lib/components/Dropdown/DropdownMenu.js +3 -1
- package/lib/components/Feedback/Comment.js +6 -6
- package/lib/components/Feedback/Mood.js +7 -7
- package/lib/components/Feedback/Rating.js +4 -4
- package/lib/components/Feedback/Reasons.js +3 -3
- package/lib/components/Feedback/Scale.js +10 -10
- package/lib/components/Feedback/Sentiment.js +5 -5
- package/lib/components/Filter/FilterContent.js +2 -2
- package/lib/components/Filter/FilterInput.js +1 -1
- package/lib/components/Filter/FilterPopover.js +2 -2
- package/lib/components/Filter/FilterSelect.js +1 -1
- package/lib/components/Footer/FooterCopyright.js +2 -2
- package/lib/components/LastUpdated/LastUpdated.js +1 -1
- package/lib/components/Loaders/SpinnerLoader.d.ts +5 -0
- package/lib/components/Loaders/SpinnerLoader.js +32 -0
- package/lib/components/PageNavigation/NextButton.js +1 -1
- package/lib/components/PageNavigation/PreviousButton.js +1 -1
- package/lib/components/Product/ProductPicker.js +1 -1
- package/lib/components/Search/FilterFields/SearchFilterFieldSelect.d.ts +12 -0
- package/lib/components/Search/FilterFields/SearchFilterFieldSelect.js +113 -0
- package/lib/components/Search/FilterFields/SearchFilterFieldTags.d.ts +10 -0
- package/lib/components/Search/FilterFields/SearchFilterFieldTags.js +37 -0
- package/lib/components/Search/Search.js +1 -1
- package/lib/components/Search/SearchDialog.js +113 -31
- package/lib/components/Search/SearchFilter.d.ts +11 -0
- package/lib/components/Search/SearchFilter.js +71 -0
- package/lib/components/Search/SearchFilterField.d.ts +11 -0
- package/lib/components/Search/SearchFilterField.js +43 -0
- package/lib/components/Search/SearchGroups.d.ts +9 -0
- package/lib/components/Search/SearchGroups.js +69 -0
- package/lib/components/Search/SearchHighlight.d.ts +1 -1
- package/lib/components/Search/SearchHighlight.js +28 -5
- package/lib/components/Search/SearchInput.d.ts +1 -1
- package/lib/components/Search/SearchInput.js +5 -2
- package/lib/components/Search/SearchItem.d.ts +2 -2
- package/lib/components/Search/SearchItem.js +24 -15
- package/lib/components/Search/SearchRecent.js +1 -1
- package/lib/components/Search/SearchSuggestedPages.js +1 -1
- package/lib/components/Search/SearchTrigger.js +2 -2
- package/lib/components/Search/variables.js +48 -2
- package/lib/components/Segmented/Segmented.d.ts +2 -5
- package/lib/components/Select/Select.d.ts +2 -36
- package/lib/components/Select/Select.js +136 -98
- package/lib/components/Select/SelectInput.d.ts +23 -0
- package/lib/components/Select/SelectInput.js +129 -0
- package/lib/components/Select/variables.js +12 -1
- package/lib/components/SidebarActions/ChangeViewButton.js +1 -1
- package/lib/components/SidebarActions/SidebarActions.js +2 -2
- package/lib/components/TableOfContent/TableOfContent.js +1 -1
- package/lib/components/Tag/Tag.d.ts +4 -2
- package/lib/components/Tag/Tag.js +40 -4
- package/lib/components/Tag/variables.dark.js +20 -5
- package/lib/components/Tag/variables.js +49 -17
- package/lib/components/UserMenu/LoginButton.js +1 -1
- package/lib/components/UserMenu/LogoutMenuItem.js +1 -1
- package/lib/components/UserMenu/UserMenu.js +1 -1
- package/lib/components/VersionPicker/VersionPicker.d.ts +2 -3
- package/lib/components/VersionPicker/VersionPicker.js +14 -31
- package/lib/core/hooks/__mocks__/index.d.ts +2 -1
- package/lib/core/hooks/__mocks__/index.js +2 -1
- package/lib/core/hooks/__mocks__/search/use-search-filter.d.ts +9 -0
- package/lib/core/hooks/__mocks__/search/use-search-filter.js +14 -0
- package/lib/core/hooks/__mocks__/use-theme-hooks.d.ts +6 -1
- package/lib/core/hooks/__mocks__/use-theme-hooks.js +6 -1
- package/lib/core/hooks/feedback/use-report-dialog.js +3 -3
- package/lib/core/hooks/index.d.ts +2 -1
- package/lib/core/hooks/index.js +2 -1
- package/lib/core/hooks/menu/use-mobile-menu-items.js +1 -1
- package/lib/core/hooks/menu/use-mobile-menu-levels.js +2 -2
- package/lib/core/hooks/search/use-recent-searches.js +2 -0
- package/lib/core/hooks/{use-search.d.ts → search/use-search-dialog.d.ts} +1 -1
- package/lib/core/hooks/{use-search.js → search/use-search-dialog.js} +5 -5
- package/lib/core/hooks/search/use-search-filter.d.ts +9 -0
- package/lib/core/hooks/search/use-search-filter.js +50 -0
- package/lib/core/types/hooks.d.ts +17 -4
- package/lib/core/types/index.d.ts +1 -1
- package/lib/core/types/index.js +1 -1
- package/lib/core/types/l10n.d.ts +1 -2
- package/lib/core/types/search.d.ts +42 -2
- package/lib/core/types/select.d.ts +31 -0
- package/lib/core/types/{select-option.js → select.js} +1 -1
- package/lib/core/utils/index.d.ts +1 -0
- package/lib/core/utils/index.js +1 -0
- package/lib/core/utils/menu.js +1 -1
- package/lib/core/utils/text-trimmer.d.ts +1 -0
- package/lib/core/utils/text-trimmer.js +16 -0
- package/lib/icons/ResetIcon/ResetIcon.d.ts +9 -0
- package/lib/icons/ResetIcon/ResetIcon.js +22 -0
- package/lib/icons/SettingsIcon/SettingsIcon.d.ts +9 -0
- package/lib/icons/SettingsIcon/SettingsIcon.js +23 -0
- package/lib/index.d.ts +8 -1
- package/lib/index.js +8 -1
- package/lib/layouts/Forbidden.js +2 -2
- package/lib/layouts/NotFound.js +3 -3
- package/lib/layouts/OIDCForbidden.js +1 -1
- package/lib/markdoc/tags/partial.js +1 -1
- package/package.json +9 -9
- package/src/components/Buttons/CopyButton.tsx +2 -2
- package/src/components/Buttons/EditPageButton.tsx +2 -2
- package/src/components/Catalog/CatalogActions.tsx +2 -2
- package/src/components/Dropdown/DropdownMenu.tsx +2 -1
- package/src/components/Feedback/Comment.tsx +8 -8
- package/src/components/Feedback/Mood.tsx +8 -8
- package/src/components/Feedback/Rating.tsx +5 -5
- package/src/components/Feedback/Reasons.tsx +4 -4
- package/src/components/Feedback/Scale.tsx +13 -13
- package/src/components/Feedback/Sentiment.tsx +6 -6
- package/src/components/Filter/FilterContent.tsx +3 -3
- package/src/components/Filter/FilterInput.tsx +1 -1
- package/src/components/Filter/FilterPopover.tsx +3 -3
- package/src/components/Filter/FilterSelect.tsx +5 -5
- package/src/components/Footer/FooterCopyright.tsx +3 -3
- package/src/components/LastUpdated/LastUpdated.tsx +1 -2
- package/src/components/Loaders/SpinnerLoader.tsx +31 -0
- package/src/components/PageNavigation/NextButton.tsx +1 -1
- package/src/components/PageNavigation/PreviousButton.tsx +1 -1
- package/src/components/Product/ProductPicker.tsx +2 -2
- package/src/components/Search/FilterFields/SearchFilterFieldSelect.tsx +135 -0
- package/src/components/Search/FilterFields/SearchFilterFieldTags.tsx +61 -0
- package/src/components/Search/Search.tsx +2 -2
- package/src/components/Search/SearchDialog.tsx +190 -51
- package/src/components/Search/SearchFilter.tsx +90 -0
- package/src/components/Search/SearchFilterField.tsx +84 -0
- package/src/components/Search/SearchGroups.tsx +81 -0
- package/src/components/Search/SearchHighlight.tsx +29 -2
- package/src/components/Search/SearchInput.tsx +9 -3
- package/src/components/Search/SearchItem.tsx +39 -24
- package/src/components/Search/SearchRecent.tsx +2 -2
- package/src/components/Search/SearchSuggestedPages.tsx +2 -2
- package/src/components/Search/SearchTrigger.tsx +2 -2
- package/src/components/Search/variables.ts +48 -2
- package/src/components/Segmented/Segmented.tsx +2 -2
- package/src/components/Select/Select.tsx +208 -157
- package/src/components/Select/SelectInput.tsx +201 -0
- package/src/components/Select/variables.ts +12 -1
- package/src/components/SidebarActions/ChangeViewButton.tsx +1 -1
- package/src/components/SidebarActions/SidebarActions.tsx +2 -2
- package/src/components/TableOfContent/TableOfContent.tsx +2 -2
- package/src/components/Tag/Tag.tsx +57 -6
- package/src/components/Tag/variables.dark.ts +20 -5
- package/src/components/Tag/variables.ts +49 -17
- package/src/components/UserMenu/LoginButton.tsx +2 -2
- package/src/components/UserMenu/LogoutMenuItem.tsx +2 -2
- package/src/components/UserMenu/UserMenu.tsx +2 -2
- package/src/components/VersionPicker/VersionPicker.tsx +18 -42
- package/src/core/hooks/__mocks__/index.ts +2 -1
- package/src/core/hooks/__mocks__/search/use-search-filter.ts +10 -0
- package/src/core/hooks/__mocks__/use-theme-hooks.ts +6 -1
- package/src/core/hooks/feedback/use-report-dialog.ts +3 -3
- package/src/core/hooks/index.ts +2 -1
- package/src/core/hooks/menu/use-mobile-menu-items.ts +1 -1
- package/src/core/hooks/menu/use-mobile-menu-levels.ts +2 -2
- package/src/core/hooks/search/use-recent-searches.ts +3 -0
- package/src/core/hooks/{use-search.ts → search/use-search-dialog.ts} +1 -1
- package/src/core/hooks/search/use-search-filter.ts +57 -0
- package/src/core/types/hooks.ts +25 -4
- package/src/core/types/index.ts +1 -1
- package/src/core/types/l10n.ts +169 -97
- package/src/core/types/search.ts +53 -2
- package/src/core/types/select.ts +33 -0
- package/src/core/utils/index.ts +1 -0
- package/src/core/utils/menu.ts +1 -1
- package/src/core/utils/text-trimmer.ts +7 -0
- package/src/icons/ResetIcon/ResetIcon.tsx +26 -0
- package/src/icons/SettingsIcon/SettingsIcon.tsx +30 -0
- package/src/index.ts +8 -1
- package/src/layouts/Forbidden.tsx +4 -9
- package/src/layouts/NotFound.tsx +6 -6
- package/src/layouts/OIDCForbidden.tsx +2 -2
- package/src/markdoc/tags/partial.ts +1 -1
- package/lib/core/types/select-option.d.ts +0 -4
- package/src/core/types/select-option.ts +0 -4
- /package/lib/components/{Loading → Loaders}/Loading.d.ts +0 -0
- /package/lib/components/{Loading → Loaders}/Loading.js +0 -0
- /package/src/components/{Loading → Loaders}/Loading.tsx +0 -0
|
@@ -46,8 +46,8 @@ 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('
|
|
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: "small", variant: variant }, type !== 'icon' && translate('
|
|
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: "small", variant: variant }, type !== 'icon' && translate('codeSnippet.copy.toasterText', buttonText || 'Copy'))));
|
|
51
51
|
}
|
|
52
52
|
exports.CopyButton = (0, react_1.memo)(CopyButtonComponent);
|
|
53
53
|
//# sourceMappingURL=CopyButton.js.map
|
|
@@ -15,7 +15,7 @@ function EditPageButton({ to }) {
|
|
|
15
15
|
const telemetry = useTelemetry();
|
|
16
16
|
return (react_1.default.createElement(EditPageButtonWrapper, { "data-component-name": "Buttons/EditPageButton", target: "_blank", to: to, onClick: () => telemetry.send('edit_page_link_clicked', {}) },
|
|
17
17
|
react_1.default.createElement(ButtonIcon, null),
|
|
18
|
-
react_1.default.createElement(ButtonText, { "data-translation-key": "
|
|
18
|
+
react_1.default.createElement(ButtonText, { "data-translation-key": "markdown.editPage.text" }, translate('markdown.editPage.text', 'Edit'))));
|
|
19
19
|
}
|
|
20
20
|
exports.EditPageButton = EditPageButton;
|
|
21
21
|
const EditPageButtonWrapper = (0, styled_components_1.default)(Link_1.Link) `
|
|
@@ -52,7 +52,7 @@ function CatalogActions(props) {
|
|
|
52
52
|
React.createElement(Button_1.Button, { variant: "ghost", size: "small", icon: React.createElement(FilterIcon_1.FilterIcon, null), iconPosition: "left", onClick: () => {
|
|
53
53
|
onOpenFilter();
|
|
54
54
|
telemetry.send('catalog_actions_button_clicked', {});
|
|
55
|
-
}, "data-translation-key": "
|
|
55
|
+
}, "data-translation-key": "catalog.filters.title" }, translate('catalog.filters.title', 'Filters')),
|
|
56
56
|
activeFilters > 0 ? React.createElement(CounterTag_1.CounterTag, { borderless: true }, activeFilters) : null));
|
|
57
57
|
}
|
|
58
58
|
exports.CatalogActions = CatalogActions;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
1
2
|
import type { ReactNode } from 'react';
|
|
2
3
|
import type { DropdownMenuItemProps } from '../../components/Dropdown/DropdownMenuItem';
|
|
3
4
|
export type DropdownMenuProps = {
|
|
4
5
|
className?: string;
|
|
5
6
|
role?: string;
|
|
7
|
+
footer?: React.ReactNode;
|
|
6
8
|
} & ({
|
|
7
9
|
items: DropdownMenuItemProps[];
|
|
8
10
|
} | {
|
|
@@ -15,7 +15,9 @@ function DropdownMenu(props) {
|
|
|
15
15
|
if ('items' in props) {
|
|
16
16
|
content = props.items.map((item, idx) => (react_1.default.createElement(DropdownMenuItem_1.DropdownMenuItem, Object.assign({ key: idx }, item), item.content)));
|
|
17
17
|
}
|
|
18
|
-
return (react_1.default.createElement(DropdownMenuWrapper, { "data-component-name": "Dropdown/DropdownMenu", "data-testid": "dropdown-menu", className: props.className, role: props.role || 'menu' },
|
|
18
|
+
return (react_1.default.createElement(DropdownMenuWrapper, { "data-component-name": "Dropdown/DropdownMenu", "data-testid": "dropdown-menu", className: props.className, role: props.role || 'menu' },
|
|
19
|
+
content,
|
|
20
|
+
props.footer || null));
|
|
19
21
|
}
|
|
20
22
|
exports.DropdownMenu = DropdownMenu;
|
|
21
23
|
const DropdownMenuWrapper = styled_components_1.default.ul `
|
|
@@ -53,17 +53,17 @@ function Comment({ settings, onSubmit, onCancel, className, standAlone = true, i
|
|
|
53
53
|
if (submitValue) {
|
|
54
54
|
return (react_1.default.createElement(StateWrapper, { "data-component-name": "Feedback/Comment", className: className },
|
|
55
55
|
react_1.default.createElement(StyledFormMandatoryFields, null,
|
|
56
|
-
react_1.default.createElement(Label, { "data-translation-key": "
|
|
57
|
-
translate('
|
|
56
|
+
react_1.default.createElement(Label, { "data-translation-key": "feedback.settings.comment.submitText", standAlone: standAlone }, submitText ||
|
|
57
|
+
translate('feedback.settings.comment.submitText', 'Thank you for helping improve our documentation!')),
|
|
58
58
|
react_1.default.createElement(RadioCheckButtonIcon_1.RadioCheckButtonIcon, null))));
|
|
59
59
|
}
|
|
60
60
|
return (react_1.default.createElement(CommentWrapper, { ref: modalRef, "data-component-name": "Feedback/Comment", className: className, style: standAlone ? { width: 'var(--feedback-report-dialog-width)' } : { width: 'auto' } },
|
|
61
|
-
react_1.default.createElement(Label, { "data-translation-key": "
|
|
62
|
-
translate('
|
|
61
|
+
react_1.default.createElement(Label, { "data-translation-key": "feedback.settings.comment.label", standAlone: standAlone }, label ||
|
|
62
|
+
translate('feedback.settings.comment.label', 'Please share your feedback with us.')),
|
|
63
63
|
react_1.default.createElement(TextArea, { rows: 3, onChange: handleTextAreaChange }),
|
|
64
64
|
standAlone && (react_1.default.createElement(ButtonsContainer, null,
|
|
65
|
-
onCancel && (react_1.default.createElement(Button_1.Button, { "data-translation-key": "
|
|
66
|
-
react_1.default.createElement(Button_1.Button, { "data-translation-key": "
|
|
65
|
+
onCancel && (react_1.default.createElement(Button_1.Button, { "data-translation-key": "feedback.settings.comment.cancel", onClick: onCancel, variant: "text", size: "small" }, translate('feedback.settings.comment.cancel', 'Cancel'))),
|
|
66
|
+
react_1.default.createElement(Button_1.Button, { "data-translation-key": "feedback.settings.comment.send", onClick: send, variant: isDialog ? 'primary' : 'secondary', size: "small" }, translate('feedback.settings.comment.send', 'Send'))))));
|
|
67
67
|
}
|
|
68
68
|
exports.Comment = Comment;
|
|
69
69
|
const StyledFormMandatoryFields = styled_components_1.default.div `
|
|
@@ -58,15 +58,15 @@ function Mood({ settings, onSubmit, className }) {
|
|
|
58
58
|
switch (score) {
|
|
59
59
|
case MOOD_STATES.SATISFIED:
|
|
60
60
|
return (commentSettings.satisfiedLabel ||
|
|
61
|
-
translate('
|
|
61
|
+
translate('feedback.settings.comment.satisfiedLabel', 'What was most helpful?'));
|
|
62
62
|
case MOOD_STATES.NEUTRAL:
|
|
63
63
|
return (commentSettings.neutralLabel ||
|
|
64
|
-
translate('
|
|
64
|
+
translate('feedback.settings.comment.neutralLabel', 'What can we improve?'));
|
|
65
65
|
case MOOD_STATES.DISSATISFIED:
|
|
66
66
|
return (commentSettings.dissatisfiedLabel ||
|
|
67
|
-
translate('
|
|
67
|
+
translate('feedback.settings.comment.dissatisfiedLabel', 'What can we improve?'));
|
|
68
68
|
default:
|
|
69
|
-
return translate('
|
|
69
|
+
return translate('feedback.settings.comment.satisfiedLabel', 'What can we improve?');
|
|
70
70
|
}
|
|
71
71
|
};
|
|
72
72
|
const displayReasons = !!(score && reasonsSettings && !reasonsSettings.hide);
|
|
@@ -92,14 +92,14 @@ function Mood({ settings, onSubmit, className }) {
|
|
|
92
92
|
if (isSubmitted) {
|
|
93
93
|
return (React.createElement(MoodWrapper, { "data-component-name": "Feedback/Mood" },
|
|
94
94
|
React.createElement(StyledFormMandatoryFields, null,
|
|
95
|
-
React.createElement(Label, { "data-translation-key": "
|
|
96
|
-
translate('
|
|
95
|
+
React.createElement(Label, { "data-translation-key": "feedback.settings.submitText" }, submitText ||
|
|
96
|
+
translate('feedback.settings.submitText', 'Thank you for helping improve our documentation!')),
|
|
97
97
|
React.createElement(RadioCheckButtonIcon_1.RadioCheckButtonIcon, null))));
|
|
98
98
|
}
|
|
99
99
|
return (React.createElement(MoodWrapper, { "data-component-name": "Feedback/Mood", className: className },
|
|
100
100
|
React.createElement(StyledForm, null,
|
|
101
101
|
React.createElement(StyledFormMandatoryFields, null,
|
|
102
|
-
React.createElement(Label, { "data-translation-key": "
|
|
102
|
+
React.createElement(Label, { "data-translation-key": "feedback.settings.label" }, label || translate('feedback.settings.label', 'Was this helpful?')),
|
|
103
103
|
React.createElement(StyledMandatoryFieldContainer, null,
|
|
104
104
|
React.createElement(Button_1.Button, { type: "button", size: "medium", variant: score === MOOD_STATES.DISSATISFIED ? 'primary' : 'secondary', tone: score === MOOD_STATES.DISSATISFIED ? 'danger' : 'default', onClick: () => {
|
|
105
105
|
setScore(MOOD_STATES.DISSATISFIED);
|
|
@@ -69,14 +69,14 @@ function Rating({ settings, onSubmit, className }) {
|
|
|
69
69
|
if (isSubmitted) {
|
|
70
70
|
return (React.createElement(RatingWrapper, { "data-component-name": "Feedback/Rating" },
|
|
71
71
|
React.createElement(StyledFormMandatoryFields, null,
|
|
72
|
-
React.createElement(Label, { "data-translation-key": "
|
|
73
|
-
translate('
|
|
72
|
+
React.createElement(Label, { "data-translation-key": "feedback.settings.submitText" }, submitText ||
|
|
73
|
+
translate('feedback.settings.submitText', 'Thank you for helping improve our documentation!')),
|
|
74
74
|
React.createElement(RadioCheckButtonIcon_1.RadioCheckButtonIcon, null))));
|
|
75
75
|
}
|
|
76
76
|
return (React.createElement(RatingWrapper, { "data-component-name": "Feedback/Rating", className: className },
|
|
77
77
|
React.createElement(StyledForm, null,
|
|
78
78
|
React.createElement(StyledFormMandatoryFields, null,
|
|
79
|
-
React.createElement(Label, { "data-translation-key": "
|
|
79
|
+
React.createElement(Label, { "data-translation-key": "feedback.settings.label" }, label || translate('feedback.settings.label', 'Was this helpful?')),
|
|
80
80
|
React.createElement(StyledMandatoryFieldContainer, null,
|
|
81
81
|
React.createElement(Stars_1.Stars, { max: exports.FEEDBACK_MAX_RATING, onChange: setScore, value: score }))),
|
|
82
82
|
(displayReasons || displayComment) && (React.createElement(StyledFormOptionalFields, null,
|
|
@@ -87,7 +87,7 @@ function Rating({ settings, onSubmit, className }) {
|
|
|
87
87
|
}, onChange: setReasons })),
|
|
88
88
|
displayComment && (React.createElement(Comment_1.Comment, { standAlone: false, onSubmit: ({ comment }) => setComment(comment), settings: {
|
|
89
89
|
label: (commentSettings === null || commentSettings === void 0 ? void 0 : commentSettings.label) ||
|
|
90
|
-
translate('
|
|
90
|
+
translate('feedback.settings.comment.label', 'Please share your feedback with us.'),
|
|
91
91
|
} })))),
|
|
92
92
|
displaySubmitBnt && (React.createElement(ButtonsContainer, null,
|
|
93
93
|
React.createElement(Button_1.Button, { onClick: onCancelRatingForm, variant: "text", size: "small" }, "Cancel"),
|
|
@@ -46,12 +46,12 @@ function Reasons({ settings, onChange, className }) {
|
|
|
46
46
|
setCheckedState(updatedCheckedState);
|
|
47
47
|
onChange(items.filter((_, index) => !!updatedCheckedState[index]));
|
|
48
48
|
};
|
|
49
|
-
return (React.createElement(ReasonsWrapper, { "data-component-name": "Feedback/Reasons", "data-translation-key": "
|
|
49
|
+
return (React.createElement(ReasonsWrapper, { "data-component-name": "Feedback/Reasons", "data-translation-key": "feedback.settings.reasons.label", className: className },
|
|
50
50
|
React.createElement(Label, null, label ||
|
|
51
|
-
translate('
|
|
51
|
+
translate('feedback.settings.reasons.label', 'Which statement describes your thoughts about this page?')),
|
|
52
52
|
items.map((reason, idx) => (React.createElement(OptionWrapper, { key: reason },
|
|
53
53
|
React.createElement("input", { type: input_type, value: reason, checked: checkedState[idx], name: "reasons", onChange: () => handleOptionChange(idx) }),
|
|
54
|
-
React.createElement("label", { "data-translation-key": `
|
|
54
|
+
React.createElement("label", { "data-translation-key": `feedback.settings.reasons.items.${idx + 1}`, id: reason, onClick: () => handleOptionChange(idx) }, translate(`feedback.settings.reasons.items.${idx + 1}`, reason)))))));
|
|
55
55
|
}
|
|
56
56
|
exports.Reasons = Reasons;
|
|
57
57
|
const ReasonsWrapper = styled_components_1.default.div `
|
|
@@ -74,20 +74,20 @@ function Scale({ settings, onSubmit, className }) {
|
|
|
74
74
|
}, [score, displayComment, displayReasons]);
|
|
75
75
|
if (isSubmitted) {
|
|
76
76
|
return (React.createElement(ScaleWrapper, { "data-component-name": "Feedback/Scale" },
|
|
77
|
-
React.createElement(Label, { "data-translation-key": "
|
|
78
|
-
translate('
|
|
77
|
+
React.createElement(Label, { "data-translation-key": "feedback.settings.submitText" }, submitText ||
|
|
78
|
+
translate('feedback.settings.submitText', 'Thank you for helping improve our documentation!')),
|
|
79
79
|
React.createElement(RadioCheckButtonIcon_1.RadioCheckButtonIcon, null)));
|
|
80
80
|
}
|
|
81
81
|
return (React.createElement(ScaleWrapper, { "data-component-name": "Feedback/Scale", className: className },
|
|
82
82
|
React.createElement(StyledForm, null,
|
|
83
83
|
React.createElement(StyledFormMandatoryFields, null,
|
|
84
|
-
React.createElement(Label, { "data-translation-key": "
|
|
84
|
+
React.createElement(Label, { "data-translation-key": "feedback.settings.label" }, label || translate('feedback.settings.label', 'Was this helpful?')),
|
|
85
85
|
React.createElement(ScaleOptionsWrapper, null, scaleOptions),
|
|
86
86
|
React.createElement(SubLabelContainer, null,
|
|
87
|
-
React.createElement(SubLabel, { "data-translation-key": "
|
|
88
|
-
translate('
|
|
89
|
-
React.createElement(SubLabel, { "data-translation-key": "
|
|
90
|
-
translate('
|
|
87
|
+
React.createElement(SubLabel, { "data-translation-key": "feedback.settings.leftScaleLabel" }, leftScaleLabel ||
|
|
88
|
+
translate('feedback.settings.leftScaleLabel', 'Not helpful at all')),
|
|
89
|
+
React.createElement(SubLabel, { "data-translation-key": "feedback.settings.rightScaleLabel" }, rightScaleLabel ||
|
|
90
|
+
translate('feedback.settings.rightScaleLabel', 'Extremely helpful')))),
|
|
91
91
|
React.createElement(StyledFormOptionalFields, null,
|
|
92
92
|
displayReasons && (React.createElement(Reasons_1.Reasons, { settings: {
|
|
93
93
|
label: reasonsSettings === null || reasonsSettings === void 0 ? void 0 : reasonsSettings.label,
|
|
@@ -96,11 +96,11 @@ function Scale({ settings, onSubmit, className }) {
|
|
|
96
96
|
}, onChange: setReasons })),
|
|
97
97
|
displayComment && (React.createElement(Comment_1.Comment, { standAlone: false, onSubmit: ({ comment }) => setComment(comment), settings: {
|
|
98
98
|
label: (commentSettings === null || commentSettings === void 0 ? void 0 : commentSettings.label) ||
|
|
99
|
-
translate('
|
|
99
|
+
translate('feedback.settings.comment.label', 'Please share your feedback with us.'),
|
|
100
100
|
} }))),
|
|
101
101
|
displaySubmitBnt && (React.createElement(ButtonsContainer, null,
|
|
102
|
-
React.createElement(Button_1.Button, { "data-translation-key": "
|
|
103
|
-
React.createElement(Button_1.Button, { "data-translation-key": "
|
|
102
|
+
React.createElement(Button_1.Button, { "data-translation-key": "feedback.settings.comment.cancel", onClick: handleCancel, variant: "text", size: "small" }, translate('feedback.settings.comment.cancel', 'Cancel')),
|
|
103
|
+
React.createElement(Button_1.Button, { "data-translation-key": "feedback.settings.scale.send", onClick: onSubmitScaleForm, variant: "secondary", size: "small" }, translate('feedback.settings.scale.send', 'Submit')))))));
|
|
104
104
|
}
|
|
105
105
|
exports.Scale = Scale;
|
|
106
106
|
const ScaleWrapper = styled_components_1.default.div `
|
|
@@ -50,9 +50,9 @@ function Sentiment({ settings, onSubmit, className }) {
|
|
|
50
50
|
const displaySubmitBnt = !!(score && (displayReasons || displayComment));
|
|
51
51
|
const commentLabel = score === 1
|
|
52
52
|
? (commentSettings && commentSettings.likeLabel) ||
|
|
53
|
-
translate('
|
|
53
|
+
translate('feedback.settings.comment.likeLabel', 'What was most helpful?')
|
|
54
54
|
: (commentSettings && commentSettings.dislikeLabel) ||
|
|
55
|
-
translate('
|
|
55
|
+
translate('feedback.settings.comment.dislikeLabel', 'What can we improve?');
|
|
56
56
|
const onSubmitSentimentForm = () => {
|
|
57
57
|
onSubmit({
|
|
58
58
|
score,
|
|
@@ -73,14 +73,14 @@ function Sentiment({ settings, onSubmit, className }) {
|
|
|
73
73
|
if (isSubmitted) {
|
|
74
74
|
return (React.createElement(SentimentWrapper, { "data-component-name": "Feedback/Sentiment" },
|
|
75
75
|
React.createElement(StyledFormMandatoryFields, null,
|
|
76
|
-
React.createElement(Label, { "data-translation-key": "
|
|
77
|
-
translate('
|
|
76
|
+
React.createElement(Label, { "data-translation-key": "feedback.settings.submitText" }, submitText ||
|
|
77
|
+
translate('feedback.settings.submitText', 'Thank you for helping improve our documentation!')),
|
|
78
78
|
React.createElement(RadioCheckButtonIcon_1.RadioCheckButtonIcon, null))));
|
|
79
79
|
}
|
|
80
80
|
return (React.createElement(SentimentWrapper, { "data-component-name": "Feedback/Sentiment", className: className },
|
|
81
81
|
React.createElement(StyledForm, null,
|
|
82
82
|
React.createElement(StyledFormMandatoryFields, null,
|
|
83
|
-
React.createElement(Label, { "data-translation-key": "
|
|
83
|
+
React.createElement(Label, { "data-translation-key": "feedback.settings.label" }, label || translate('feedback.settings.label', 'Was this helpful?')),
|
|
84
84
|
React.createElement(StyledMandatoryFieldContainer, null,
|
|
85
85
|
React.createElement(Button_1.Button, { type: "button", size: "medium", variant: score === 1 ? 'primary' : 'secondary', onClick: () => {
|
|
86
86
|
setScore(1);
|
|
@@ -29,8 +29,8 @@ function FilterContent({ setFilterTerm, filters, filterTerm, filterValuesCasing,
|
|
|
29
29
|
};
|
|
30
30
|
return (react_1.default.createElement(FilterContentWrapper, { "data-component-name": "Filter/FilterContent" },
|
|
31
31
|
react_1.default.createElement(FiltersHeader, null,
|
|
32
|
-
react_1.default.createElement(FiltersTitle, { "data-translation-key": "
|
|
33
|
-
hasActiveFilters ? (react_1.default.createElement(Button_1.Button, { size: "medium", tone: "danger", variant: "ghost", onClick: handleClearAll }, translate('
|
|
32
|
+
react_1.default.createElement(FiltersTitle, { "data-translation-key": "catalog.filters.title" }, translate('catalog.filters.title', 'Filters')),
|
|
33
|
+
hasActiveFilters ? (react_1.default.createElement(Button_1.Button, { size: "medium", tone: "danger", variant: "ghost", onClick: handleClearAll }, translate('catalog.filters.clearAll', 'Clear filters'))) : null),
|
|
34
34
|
react_1.default.createElement(FilterInput_1.FilterInput, { value: filterTerm, onChange: (updatedTerm) => setFilterTerm(updatedTerm) }),
|
|
35
35
|
react_1.default.createElement(FilterItems, null, filters.map((filter, idx) => (react_1.default.createElement(Filter_1.Filter, { filter: filter, key: filter.property + '-' + idx, filterValuesCasing: filterValuesCasing }))))));
|
|
36
36
|
}
|
|
@@ -14,7 +14,7 @@ function FilterInput(props) {
|
|
|
14
14
|
const { translate } = useTranslate();
|
|
15
15
|
return (react_1.default.createElement(InputWrapper, { "data-component-name": "Filter/FilterInput" },
|
|
16
16
|
react_1.default.createElement(InputIcon, null),
|
|
17
|
-
react_1.default.createElement(Input, { value: value, onChange: (e) => onChange(e.target.value), placeholder: translate('
|
|
17
|
+
react_1.default.createElement(Input, { value: value, onChange: (e) => onChange(e.target.value), placeholder: translate('catalog.filters.placeholder', 'Type to filter...') })));
|
|
18
18
|
}
|
|
19
19
|
exports.FilterInput = FilterInput;
|
|
20
20
|
const InputWrapper = styled_components_1.default.div `
|
|
@@ -14,8 +14,8 @@ function FilterPopover({ onClose, filters, filterValuesCasing, filterTerm, setFi
|
|
|
14
14
|
const { translate } = useTranslate();
|
|
15
15
|
return (react_1.default.createElement(FilterPopoverWrapper, { "data-component-name": "Filter/FilterPopover" },
|
|
16
16
|
react_1.default.createElement(FilterPopoverHeader, null,
|
|
17
|
-
react_1.default.createElement(FilterPopoverHeaderLabel, { "data-translation-key": "
|
|
18
|
-
react_1.default.createElement(FilterPopoverHeaderButton, { onClick: onClose }, translate('
|
|
17
|
+
react_1.default.createElement(FilterPopoverHeaderLabel, { "data-translation-key": "catalog.filters.add" }, translate('catalog.filters.add', 'Add Filter')),
|
|
18
|
+
react_1.default.createElement(FilterPopoverHeaderButton, { onClick: onClose }, translate('catalog.filters.done', 'Done'))),
|
|
19
19
|
react_1.default.createElement(FilterContent_1.FilterContent, { setFilterTerm: setFilterTerm, filters: filters, filterTerm: filterTerm, filterValuesCasing: filterValuesCasing })));
|
|
20
20
|
}
|
|
21
21
|
exports.FilterPopover = FilterPopover;
|
|
@@ -23,7 +23,7 @@ function FilterSelect({ filter, filterValuesCasing }) {
|
|
|
23
23
|
{
|
|
24
24
|
value: '',
|
|
25
25
|
element: (react_1.default.createElement(FilterOption_1.FilterOption, { key: "all", onClick: () => filter.selectOption('') },
|
|
26
|
-
react_1.default.createElement(FilterOptionLabel_1.FilterOptionLabel, { "data-translation-key": "
|
|
26
|
+
react_1.default.createElement(FilterOptionLabel_1.FilterOptionLabel, { "data-translation-key": "catalog.filters.select.all" }, translate('catalog.filters.select.all', 'All')),
|
|
27
27
|
react_1.default.createElement(CounterTag_1.CounterTag, { borderless: true }, defaultOptionCount))),
|
|
28
28
|
},
|
|
29
29
|
...filter.filteredOptions.map((option) => ({
|
|
@@ -12,8 +12,8 @@ function FooterCopyright({ copyrightText = '', className, }) {
|
|
|
12
12
|
const { useTranslate, useL10n } = (0, hooks_1.useThemeHooks)();
|
|
13
13
|
const { translate } = useTranslate();
|
|
14
14
|
const { changeLanguage } = useL10n();
|
|
15
|
-
return copyrightText ? (react_1.default.createElement(FooterCopyrightWrapper, { className: className, "data-component-name": "Footer/FooterCopyright", "data-translation-key": "
|
|
16
|
-
react_1.default.createElement(FooterCopyrightLabel, { "data-translation-key": "
|
|
15
|
+
return copyrightText ? (react_1.default.createElement(FooterCopyrightWrapper, { className: className, "data-component-name": "Footer/FooterCopyright", "data-translation-key": "footer.copyrightText" },
|
|
16
|
+
react_1.default.createElement(FooterCopyrightLabel, { "data-translation-key": "footer.copyrightText" }, translate('footer.copyrightText', copyrightText)),
|
|
17
17
|
react_1.default.createElement(LanguagePicker_1.LanguagePicker, { onChangeLanguage: changeLanguage, placement: "top", alignment: "end" }))) : null;
|
|
18
18
|
}
|
|
19
19
|
exports.FooterCopyright = FooterCopyright;
|
|
@@ -53,7 +53,7 @@ function LastUpdated(props) {
|
|
|
53
53
|
(currentLocale !== constants_1.DEFAULT_LOCALE_PLACEHOLDER ? currentLocale || 'en-US' : 'en-US');
|
|
54
54
|
const isoDate = lastModified.toISOString().split('T')[0];
|
|
55
55
|
const lastUpdatedString = FORMATS[format](lastModified, locale);
|
|
56
|
-
const translationKey = format === 'timeago' ? '
|
|
56
|
+
const translationKey = format === 'timeago' ? 'page.lastUpdated.timeago' : 'page.lastUpdated.on';
|
|
57
57
|
const text = format === 'timeago'
|
|
58
58
|
? translate(translationKey, 'Last updated') + ' '
|
|
59
59
|
: translate(translationKey, 'Last updated on');
|
|
@@ -0,0 +1,32 @@
|
|
|
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.SpinnerLoader = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const styled_components_1 = __importDefault(require("styled-components"));
|
|
9
|
+
function SpinnerLoader({ color, size }) {
|
|
10
|
+
return react_1.default.createElement(Spinner, { color: color, size: size });
|
|
11
|
+
}
|
|
12
|
+
exports.SpinnerLoader = SpinnerLoader;
|
|
13
|
+
const Spinner = styled_components_1.default.div `
|
|
14
|
+
width: ${({ size }) => size};
|
|
15
|
+
height: ${({ size }) => size};
|
|
16
|
+
border: 3px solid ${({ color }) => color};
|
|
17
|
+
border-bottom-color: transparent;
|
|
18
|
+
border-radius: 50%;
|
|
19
|
+
display: inline-block;
|
|
20
|
+
box-sizing: border-box;
|
|
21
|
+
animation: rotation 1s linear infinite;
|
|
22
|
+
|
|
23
|
+
@keyframes rotation {
|
|
24
|
+
0% {
|
|
25
|
+
transform: rotate(0deg);
|
|
26
|
+
}
|
|
27
|
+
100% {
|
|
28
|
+
transform: rotate(360deg);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
`;
|
|
32
|
+
//# sourceMappingURL=SpinnerLoader.js.map
|
|
@@ -42,7 +42,7 @@ function NextButton({ nextPage, className }) {
|
|
|
42
42
|
}
|
|
43
43
|
const nextPageText = nextPage.label || nextPage.routeSlug || '';
|
|
44
44
|
const defaultLabel = ((_b = navigation === null || navigation === void 0 ? void 0 : navigation.nextButton) === null || _b === void 0 ? void 0 : _b.text) || 'Next page';
|
|
45
|
-
const translationKey = '
|
|
45
|
+
const translationKey = 'page.nextButton';
|
|
46
46
|
const label = translate(translationKey, { defaultValue: defaultLabel });
|
|
47
47
|
return (React.createElement(NextButtonWrapper, { "data-component-name": "PageNavigation/NextButton", "data-translation-key": translationKey },
|
|
48
48
|
React.createElement(NextPageLabel, null, label),
|
|
@@ -19,7 +19,7 @@ function PreviousButton({ prevPage, className }) {
|
|
|
19
19
|
}
|
|
20
20
|
const prevPageText = prevPage.label || prevPage.routeSlug || '';
|
|
21
21
|
const defaultLabel = ((_b = navigation === null || navigation === void 0 ? void 0 : navigation.previousButton) === null || _b === void 0 ? void 0 : _b.text) || 'Previous page';
|
|
22
|
-
const translationKey = '
|
|
22
|
+
const translationKey = 'page.previousButton';
|
|
23
23
|
const label = translate(translationKey, { defaultValue: defaultLabel });
|
|
24
24
|
return (react_1.default.createElement(PreviousButtonWrapper, { "data-component-name": "PageNavigation/PreviousButton", "data-translation-key": translationKey },
|
|
25
25
|
react_1.default.createElement(PreviousPageLabel, null, label),
|
|
@@ -25,7 +25,7 @@ function ProductPicker() {
|
|
|
25
25
|
},
|
|
26
26
|
active: product === currentProduct,
|
|
27
27
|
}));
|
|
28
|
-
return products.length ? (react_1.default.createElement(ProductDropdown, { withArrow: true, trigger: react_1.default.createElement(Button_1.Button, { variant: "ghost" }, currentProduct ? (react_1.default.createElement(Product_1.Product, { product: currentProduct })) : (react_1.default.createElement("span", { "data-translation-key": "
|
|
28
|
+
return products.length ? (react_1.default.createElement(ProductDropdown, { withArrow: true, trigger: react_1.default.createElement(Button_1.Button, { variant: "ghost" }, currentProduct ? (react_1.default.createElement(Product_1.Product, { product: currentProduct })) : (react_1.default.createElement("span", { "data-translation-key": "navbar.products" }, translate('navbar.products', 'Products')))), triggerEvent: "hover" },
|
|
29
29
|
react_1.default.createElement(DropdownMenu_1.DropdownMenu, { items: productComponents }))) : null;
|
|
30
30
|
}
|
|
31
31
|
exports.ProductPicker = ProductPicker;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { SearchFacet, SearchFilterItem } from '../../../core/types';
|
|
3
|
+
type SearchFilterFieldSelectProps = {
|
|
4
|
+
className?: string;
|
|
5
|
+
facet: SearchFacet;
|
|
6
|
+
filter: SearchFilterItem[];
|
|
7
|
+
query: string;
|
|
8
|
+
selectedValues: string[];
|
|
9
|
+
onChange: (value: string | string[]) => void;
|
|
10
|
+
};
|
|
11
|
+
export declare function SearchFilterFieldSelect({ facet, filter, query, selectedValues, onChange, }: SearchFilterFieldSelectProps): React.JSX.Element;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,113 @@
|
|
|
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.SearchFilterFieldSelect = void 0;
|
|
30
|
+
const react_1 = __importStar(require("react"));
|
|
31
|
+
const styled_components_1 = __importDefault(require("styled-components"));
|
|
32
|
+
const hooks_1 = require("../../../core/hooks");
|
|
33
|
+
const Select_1 = require("../../../components/Select/Select");
|
|
34
|
+
const CounterTag_1 = require("../../../components/Tags/CounterTag");
|
|
35
|
+
function SearchFilterFieldSelect({ facet, filter, query, selectedValues, onChange, }) {
|
|
36
|
+
const MAX_SELECT_OPTIONS = 20;
|
|
37
|
+
const { useFacetQuery, useTranslate } = (0, hooks_1.useThemeHooks)();
|
|
38
|
+
const { translate } = useTranslate();
|
|
39
|
+
const { searchFacet, setSearchFacet, setSearchFacetQuery } = useFacetQuery(facet.field);
|
|
40
|
+
const [selectOptions, setSelectOptions] = (0, react_1.useState)([]);
|
|
41
|
+
const isMultiple = facet.type === 'multi-select';
|
|
42
|
+
(0, react_1.useEffect)(() => {
|
|
43
|
+
setSelectOptions(getSelectOptions());
|
|
44
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
45
|
+
}, [searchFacet, facet]);
|
|
46
|
+
const onSearch = (value) => {
|
|
47
|
+
if (value === null) {
|
|
48
|
+
setSearchFacet(null);
|
|
49
|
+
setSearchFacetQuery(null);
|
|
50
|
+
}
|
|
51
|
+
else if (typeof value === 'string') {
|
|
52
|
+
setSearchFacetQuery({
|
|
53
|
+
query,
|
|
54
|
+
filter,
|
|
55
|
+
facetQuery: value,
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
const getSelectOptions = () => {
|
|
60
|
+
return searchFacet
|
|
61
|
+
? searchFacet.values.map(facetValueToSelectOption)
|
|
62
|
+
: facet.values.map(facetValueToSelectOption);
|
|
63
|
+
};
|
|
64
|
+
const facetValueToSelectOption = (facetValue) => {
|
|
65
|
+
if (!facetValue) {
|
|
66
|
+
return { element: null, value: '' };
|
|
67
|
+
}
|
|
68
|
+
if (typeof facetValue === 'string') {
|
|
69
|
+
return {
|
|
70
|
+
element: (react_1.default.createElement(FilterSelectOptionWrapper, null,
|
|
71
|
+
react_1.default.createElement(FilterSelectOptionText, null, facetValue))),
|
|
72
|
+
value: facetValue,
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
const { value, count, isCounterVisible } = facetValue;
|
|
77
|
+
return {
|
|
78
|
+
element: (react_1.default.createElement(FilterSelectOptionWrapper, null,
|
|
79
|
+
react_1.default.createElement(FilterSelectOptionText, null, value),
|
|
80
|
+
isCounterVisible && react_1.default.createElement(CounterTag_1.CounterTag, null, count))),
|
|
81
|
+
value: value,
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
return (react_1.default.createElement(Select_1.Select, { value: selectedValues.length
|
|
86
|
+
? isMultiple
|
|
87
|
+
? selectedValues.map((value) => facetValueToSelectOption(value))
|
|
88
|
+
: facetValueToSelectOption(selectedValues[0])
|
|
89
|
+
: undefined, options: selectOptions, onChange: onChange, placeholder: `${translate('search.filter.field.placeholder', 'Search')} ${facet.name.toLowerCase()}...`, alignment: "start", multiple: isMultiple, searchable: true, footer: selectOptions.length === MAX_SELECT_OPTIONS ? (react_1.default.createElement(FilterSelectFooter, null, "Search to show more items...")) : null, onSearch: onSearch, checkmarkIconPosition: "start" }));
|
|
90
|
+
}
|
|
91
|
+
exports.SearchFilterFieldSelect = SearchFilterFieldSelect;
|
|
92
|
+
const FilterSelectOptionWrapper = styled_components_1.default.div `
|
|
93
|
+
width: 100%;
|
|
94
|
+
display: flex;
|
|
95
|
+
justify-content: space-between;
|
|
96
|
+
align-items: center;
|
|
97
|
+
gap: var(--search-filter-field-select-option-gap);
|
|
98
|
+
`;
|
|
99
|
+
const FilterSelectOptionText = styled_components_1.default.span `
|
|
100
|
+
overflow: hidden;
|
|
101
|
+
text-overflow: ellipsis;
|
|
102
|
+
white-space: nowrap;
|
|
103
|
+
width: 100%;
|
|
104
|
+
padding: var(--search-filter-field-select-option-text-padding);
|
|
105
|
+
`;
|
|
106
|
+
const FilterSelectFooter = styled_components_1.default.div `
|
|
107
|
+
display: flex;
|
|
108
|
+
align-items: center;
|
|
109
|
+
justify-content: center;
|
|
110
|
+
padding: var(--search-filter-field-select-footer-padding);
|
|
111
|
+
color: var(--search-filter-field-select-footer-text-color);
|
|
112
|
+
`;
|
|
113
|
+
//# sourceMappingURL=SearchFilterFieldSelect.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { SearchFacet } from '../../../core/types';
|
|
3
|
+
type SearchFilterFieldTagsProps = {
|
|
4
|
+
className?: string;
|
|
5
|
+
facet: SearchFacet;
|
|
6
|
+
selectedValues: string[];
|
|
7
|
+
onChange: (value: string | string[]) => void;
|
|
8
|
+
};
|
|
9
|
+
export declare function SearchFilterFieldTags({ className, facet, selectedValues, onChange, }: SearchFilterFieldTagsProps): React.JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,37 @@
|
|
|
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.SearchFilterFieldTags = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const styled_components_1 = __importDefault(require("styled-components"));
|
|
9
|
+
const Tag_1 = require("../../../components/Tag/Tag");
|
|
10
|
+
function SearchFilterFieldTags({ className, facet, selectedValues, onChange, }) {
|
|
11
|
+
return (react_1.default.createElement(FilterTagsWrapper, { "data-component-name": "Search/FilterFields/SearchFilterFieldTags", className: className }, facet.values.map((facetCount, index) => {
|
|
12
|
+
const { value, count, isCounterVisible } = facetCount;
|
|
13
|
+
const active = selectedValues.includes(value);
|
|
14
|
+
return (react_1.default.createElement(FilterTagWrapper, { key: `${count}-${index}`, color: value, onClick: () => {
|
|
15
|
+
const values = active
|
|
16
|
+
? selectedValues.filter((item) => item !== value)
|
|
17
|
+
: [...selectedValues, value];
|
|
18
|
+
onChange(values);
|
|
19
|
+
}, active: active, borderless: true },
|
|
20
|
+
value,
|
|
21
|
+
" ",
|
|
22
|
+
isCounterVisible && react_1.default.createElement("span", null, count)));
|
|
23
|
+
})));
|
|
24
|
+
}
|
|
25
|
+
exports.SearchFilterFieldTags = SearchFilterFieldTags;
|
|
26
|
+
const FilterTagsWrapper = styled_components_1.default.div `
|
|
27
|
+
display: flex;
|
|
28
|
+
flex-wrap: wrap;
|
|
29
|
+
gap: var(--search-filter-field-tags-gap);
|
|
30
|
+
`;
|
|
31
|
+
const FilterTagWrapper = (0, styled_components_1.default)(Tag_1.Tag) `
|
|
32
|
+
text-transform: uppercase;
|
|
33
|
+
cursor: pointer;
|
|
34
|
+
${({ color }) => color && `background-color: var(--tag-operation-bg-color-${color});`}
|
|
35
|
+
margin: var(--search-filter-field-tags-tag-margin);
|
|
36
|
+
`;
|
|
37
|
+
//# sourceMappingURL=SearchFilterFieldTags.js.map
|
|
@@ -10,7 +10,7 @@ const SearchTrigger_1 = require("../../components/Search/SearchTrigger");
|
|
|
10
10
|
const SearchDialog_1 = require("../../components/Search/SearchDialog");
|
|
11
11
|
const hooks_1 = require("../../core/hooks");
|
|
12
12
|
function Search({ className }) {
|
|
13
|
-
const { isOpen, onOpen, onClose } = (0, hooks_1.
|
|
13
|
+
const { isOpen, onOpen, onClose } = (0, hooks_1.useSearchDialog)();
|
|
14
14
|
return (react_1.default.createElement(SearchWrapper, { "data-component-name": "Search/Search", className: className },
|
|
15
15
|
react_1.default.createElement(SearchTrigger_1.SearchTrigger, { onClick: onOpen }),
|
|
16
16
|
isOpen && react_1.default.createElement(SearchDialog_1.SearchDialog, { onClose: onClose })));
|