@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
|
@@ -53,12 +53,12 @@ export function Comment({
|
|
|
53
53
|
<StateWrapper data-component-name="Feedback/Comment" className={className}>
|
|
54
54
|
<StyledFormMandatoryFields>
|
|
55
55
|
<Label
|
|
56
|
-
data-translation-key="
|
|
56
|
+
data-translation-key="feedback.settings.comment.submitText"
|
|
57
57
|
standAlone={standAlone}
|
|
58
58
|
>
|
|
59
59
|
{submitText ||
|
|
60
60
|
translate(
|
|
61
|
-
'
|
|
61
|
+
'feedback.settings.comment.submitText',
|
|
62
62
|
'Thank you for helping improve our documentation!',
|
|
63
63
|
)}
|
|
64
64
|
</Label>
|
|
@@ -75,30 +75,30 @@ export function Comment({
|
|
|
75
75
|
className={className}
|
|
76
76
|
style={standAlone ? { width: 'var(--feedback-report-dialog-width)' } : { width: 'auto' }}
|
|
77
77
|
>
|
|
78
|
-
<Label data-translation-key="
|
|
78
|
+
<Label data-translation-key="feedback.settings.comment.label" standAlone={standAlone}>
|
|
79
79
|
{label ||
|
|
80
|
-
translate('
|
|
80
|
+
translate('feedback.settings.comment.label', 'Please share your feedback with us.')}
|
|
81
81
|
</Label>
|
|
82
82
|
<TextArea rows={3} onChange={handleTextAreaChange} />
|
|
83
83
|
{standAlone && (
|
|
84
84
|
<ButtonsContainer>
|
|
85
85
|
{onCancel && (
|
|
86
86
|
<Button
|
|
87
|
-
data-translation-key="
|
|
87
|
+
data-translation-key="feedback.settings.comment.cancel"
|
|
88
88
|
onClick={onCancel}
|
|
89
89
|
variant="text"
|
|
90
90
|
size="small"
|
|
91
91
|
>
|
|
92
|
-
{translate('
|
|
92
|
+
{translate('feedback.settings.comment.cancel', 'Cancel')}
|
|
93
93
|
</Button>
|
|
94
94
|
)}
|
|
95
95
|
<Button
|
|
96
|
-
data-translation-key="
|
|
96
|
+
data-translation-key="feedback.settings.comment.send"
|
|
97
97
|
onClick={send}
|
|
98
98
|
variant={isDialog ? 'primary' : 'secondary'}
|
|
99
99
|
size="small"
|
|
100
100
|
>
|
|
101
|
-
{translate('
|
|
101
|
+
{translate('feedback.settings.comment.send', 'Send')}
|
|
102
102
|
</Button>
|
|
103
103
|
</ButtonsContainer>
|
|
104
104
|
)}
|
|
@@ -56,20 +56,20 @@ export function Mood({ settings, onSubmit, className }: MoodProps): JSX.Element
|
|
|
56
56
|
case MOOD_STATES.SATISFIED:
|
|
57
57
|
return (
|
|
58
58
|
commentSettings.satisfiedLabel ||
|
|
59
|
-
translate('
|
|
59
|
+
translate('feedback.settings.comment.satisfiedLabel', 'What was most helpful?')
|
|
60
60
|
);
|
|
61
61
|
case MOOD_STATES.NEUTRAL:
|
|
62
62
|
return (
|
|
63
63
|
commentSettings.neutralLabel ||
|
|
64
|
-
translate('
|
|
64
|
+
translate('feedback.settings.comment.neutralLabel', 'What can we improve?')
|
|
65
65
|
);
|
|
66
66
|
case MOOD_STATES.DISSATISFIED:
|
|
67
67
|
return (
|
|
68
68
|
commentSettings.dissatisfiedLabel ||
|
|
69
|
-
translate('
|
|
69
|
+
translate('feedback.settings.comment.dissatisfiedLabel', 'What can we improve?')
|
|
70
70
|
);
|
|
71
71
|
default:
|
|
72
|
-
return translate('
|
|
72
|
+
return translate('feedback.settings.comment.satisfiedLabel', 'What can we improve?');
|
|
73
73
|
}
|
|
74
74
|
};
|
|
75
75
|
|
|
@@ -101,10 +101,10 @@ export function Mood({ settings, onSubmit, className }: MoodProps): JSX.Element
|
|
|
101
101
|
return (
|
|
102
102
|
<MoodWrapper data-component-name="Feedback/Mood">
|
|
103
103
|
<StyledFormMandatoryFields>
|
|
104
|
-
<Label data-translation-key="
|
|
104
|
+
<Label data-translation-key="feedback.settings.submitText">
|
|
105
105
|
{submitText ||
|
|
106
106
|
translate(
|
|
107
|
-
'
|
|
107
|
+
'feedback.settings.submitText',
|
|
108
108
|
'Thank you for helping improve our documentation!',
|
|
109
109
|
)}
|
|
110
110
|
</Label>
|
|
@@ -118,8 +118,8 @@ export function Mood({ settings, onSubmit, className }: MoodProps): JSX.Element
|
|
|
118
118
|
<MoodWrapper data-component-name="Feedback/Mood" className={className}>
|
|
119
119
|
<StyledForm>
|
|
120
120
|
<StyledFormMandatoryFields>
|
|
121
|
-
<Label data-translation-key="
|
|
122
|
-
{label || translate('
|
|
121
|
+
<Label data-translation-key="feedback.settings.label">
|
|
122
|
+
{label || translate('feedback.settings.label', 'Was this helpful?')}
|
|
123
123
|
</Label>
|
|
124
124
|
<StyledMandatoryFieldContainer>
|
|
125
125
|
<Button
|
|
@@ -70,10 +70,10 @@ export function Rating({ settings, onSubmit, className }: RatingProps): JSX.Elem
|
|
|
70
70
|
return (
|
|
71
71
|
<RatingWrapper data-component-name="Feedback/Rating">
|
|
72
72
|
<StyledFormMandatoryFields>
|
|
73
|
-
<Label data-translation-key="
|
|
73
|
+
<Label data-translation-key="feedback.settings.submitText">
|
|
74
74
|
{submitText ||
|
|
75
75
|
translate(
|
|
76
|
-
'
|
|
76
|
+
'feedback.settings.submitText',
|
|
77
77
|
'Thank you for helping improve our documentation!',
|
|
78
78
|
)}
|
|
79
79
|
</Label>
|
|
@@ -87,8 +87,8 @@ export function Rating({ settings, onSubmit, className }: RatingProps): JSX.Elem
|
|
|
87
87
|
<RatingWrapper data-component-name="Feedback/Rating" className={className}>
|
|
88
88
|
<StyledForm>
|
|
89
89
|
<StyledFormMandatoryFields>
|
|
90
|
-
<Label data-translation-key="
|
|
91
|
-
{label || translate('
|
|
90
|
+
<Label data-translation-key="feedback.settings.label">
|
|
91
|
+
{label || translate('feedback.settings.label', 'Was this helpful?')}
|
|
92
92
|
</Label>
|
|
93
93
|
|
|
94
94
|
<StyledMandatoryFieldContainer>
|
|
@@ -117,7 +117,7 @@ export function Rating({ settings, onSubmit, className }: RatingProps): JSX.Elem
|
|
|
117
117
|
label:
|
|
118
118
|
commentSettings?.label ||
|
|
119
119
|
translate(
|
|
120
|
-
'
|
|
120
|
+
'feedback.settings.comment.label',
|
|
121
121
|
'Please share your feedback with us.',
|
|
122
122
|
),
|
|
123
123
|
}}
|
|
@@ -38,13 +38,13 @@ export function Reasons({ settings, onChange, className }: ReasonsProps): JSX.El
|
|
|
38
38
|
return (
|
|
39
39
|
<ReasonsWrapper
|
|
40
40
|
data-component-name="Feedback/Reasons"
|
|
41
|
-
data-translation-key="
|
|
41
|
+
data-translation-key="feedback.settings.reasons.label"
|
|
42
42
|
className={className}
|
|
43
43
|
>
|
|
44
44
|
<Label>
|
|
45
45
|
{label ||
|
|
46
46
|
translate(
|
|
47
|
-
'
|
|
47
|
+
'feedback.settings.reasons.label',
|
|
48
48
|
'Which statement describes your thoughts about this page?',
|
|
49
49
|
)}
|
|
50
50
|
</Label>
|
|
@@ -58,11 +58,11 @@ export function Reasons({ settings, onChange, className }: ReasonsProps): JSX.El
|
|
|
58
58
|
onChange={() => handleOptionChange(idx)}
|
|
59
59
|
/>
|
|
60
60
|
<label
|
|
61
|
-
data-translation-key={`
|
|
61
|
+
data-translation-key={`feedback.settings.reasons.items.${idx + 1}`}
|
|
62
62
|
id={reason}
|
|
63
63
|
onClick={() => handleOptionChange(idx)}
|
|
64
64
|
>
|
|
65
|
-
{translate(`
|
|
65
|
+
{translate(`feedback.settings.reasons.items.${idx + 1}`, reason)}
|
|
66
66
|
</label>
|
|
67
67
|
</OptionWrapper>
|
|
68
68
|
))}
|
|
@@ -96,10 +96,10 @@ export function Scale({ settings, onSubmit, className }: ScaleProps): JSX.Elemen
|
|
|
96
96
|
if (isSubmitted) {
|
|
97
97
|
return (
|
|
98
98
|
<ScaleWrapper data-component-name="Feedback/Scale">
|
|
99
|
-
<Label data-translation-key="
|
|
99
|
+
<Label data-translation-key="feedback.settings.submitText">
|
|
100
100
|
{submitText ||
|
|
101
101
|
translate(
|
|
102
|
-
'
|
|
102
|
+
'feedback.settings.submitText',
|
|
103
103
|
'Thank you for helping improve our documentation!',
|
|
104
104
|
)}
|
|
105
105
|
</Label>
|
|
@@ -112,20 +112,20 @@ export function Scale({ settings, onSubmit, className }: ScaleProps): JSX.Elemen
|
|
|
112
112
|
<ScaleWrapper data-component-name="Feedback/Scale" className={className}>
|
|
113
113
|
<StyledForm>
|
|
114
114
|
<StyledFormMandatoryFields>
|
|
115
|
-
<Label data-translation-key="
|
|
116
|
-
{label || translate('
|
|
115
|
+
<Label data-translation-key="feedback.settings.label">
|
|
116
|
+
{label || translate('feedback.settings.label', 'Was this helpful?')}
|
|
117
117
|
</Label>
|
|
118
118
|
|
|
119
119
|
<ScaleOptionsWrapper>{scaleOptions}</ScaleOptionsWrapper>
|
|
120
120
|
|
|
121
121
|
<SubLabelContainer>
|
|
122
|
-
<SubLabel data-translation-key="
|
|
122
|
+
<SubLabel data-translation-key="feedback.settings.leftScaleLabel">
|
|
123
123
|
{leftScaleLabel ||
|
|
124
|
-
translate('
|
|
124
|
+
translate('feedback.settings.leftScaleLabel', 'Not helpful at all')}
|
|
125
125
|
</SubLabel>
|
|
126
|
-
<SubLabel data-translation-key="
|
|
126
|
+
<SubLabel data-translation-key="feedback.settings.rightScaleLabel">
|
|
127
127
|
{rightScaleLabel ||
|
|
128
|
-
translate('
|
|
128
|
+
translate('feedback.settings.rightScaleLabel', 'Extremely helpful')}
|
|
129
129
|
</SubLabel>
|
|
130
130
|
</SubLabelContainer>
|
|
131
131
|
</StyledFormMandatoryFields>
|
|
@@ -149,7 +149,7 @@ export function Scale({ settings, onSubmit, className }: ScaleProps): JSX.Elemen
|
|
|
149
149
|
label:
|
|
150
150
|
commentSettings?.label ||
|
|
151
151
|
translate(
|
|
152
|
-
'
|
|
152
|
+
'feedback.settings.comment.label',
|
|
153
153
|
'Please share your feedback with us.',
|
|
154
154
|
),
|
|
155
155
|
}}
|
|
@@ -159,21 +159,21 @@ export function Scale({ settings, onSubmit, className }: ScaleProps): JSX.Elemen
|
|
|
159
159
|
{displaySubmitBnt && (
|
|
160
160
|
<ButtonsContainer>
|
|
161
161
|
<Button
|
|
162
|
-
data-translation-key="
|
|
162
|
+
data-translation-key="feedback.settings.comment.cancel"
|
|
163
163
|
onClick={handleCancel}
|
|
164
164
|
variant="text"
|
|
165
165
|
size="small"
|
|
166
166
|
>
|
|
167
|
-
{translate('
|
|
167
|
+
{translate('feedback.settings.comment.cancel', 'Cancel')}
|
|
168
168
|
</Button>
|
|
169
169
|
|
|
170
170
|
<Button
|
|
171
|
-
data-translation-key="
|
|
171
|
+
data-translation-key="feedback.settings.scale.send"
|
|
172
172
|
onClick={onSubmitScaleForm}
|
|
173
173
|
variant="secondary"
|
|
174
174
|
size="small"
|
|
175
175
|
>
|
|
176
|
-
{translate('
|
|
176
|
+
{translate('feedback.settings.scale.send', 'Submit')}
|
|
177
177
|
</Button>
|
|
178
178
|
</ButtonsContainer>
|
|
179
179
|
)}
|
|
@@ -48,9 +48,9 @@ export function Sentiment({ settings, onSubmit, className }: SentimentProps): JS
|
|
|
48
48
|
const commentLabel =
|
|
49
49
|
score === 1
|
|
50
50
|
? (commentSettings && commentSettings.likeLabel) ||
|
|
51
|
-
translate('
|
|
51
|
+
translate('feedback.settings.comment.likeLabel', 'What was most helpful?')
|
|
52
52
|
: (commentSettings && commentSettings.dislikeLabel) ||
|
|
53
|
-
translate('
|
|
53
|
+
translate('feedback.settings.comment.dislikeLabel', 'What can we improve?');
|
|
54
54
|
|
|
55
55
|
const onSubmitSentimentForm = () => {
|
|
56
56
|
onSubmit({
|
|
@@ -76,10 +76,10 @@ export function Sentiment({ settings, onSubmit, className }: SentimentProps): JS
|
|
|
76
76
|
return (
|
|
77
77
|
<SentimentWrapper data-component-name="Feedback/Sentiment">
|
|
78
78
|
<StyledFormMandatoryFields>
|
|
79
|
-
<Label data-translation-key="
|
|
79
|
+
<Label data-translation-key="feedback.settings.submitText">
|
|
80
80
|
{submitText ||
|
|
81
81
|
translate(
|
|
82
|
-
'
|
|
82
|
+
'feedback.settings.submitText',
|
|
83
83
|
'Thank you for helping improve our documentation!',
|
|
84
84
|
)}
|
|
85
85
|
</Label>
|
|
@@ -93,8 +93,8 @@ export function Sentiment({ settings, onSubmit, className }: SentimentProps): JS
|
|
|
93
93
|
<SentimentWrapper data-component-name="Feedback/Sentiment" className={className}>
|
|
94
94
|
<StyledForm>
|
|
95
95
|
<StyledFormMandatoryFields>
|
|
96
|
-
<Label data-translation-key="
|
|
97
|
-
{label || translate('
|
|
96
|
+
<Label data-translation-key="feedback.settings.label">
|
|
97
|
+
{label || translate('feedback.settings.label', 'Was this helpful?')}
|
|
98
98
|
</Label>
|
|
99
99
|
|
|
100
100
|
<StyledMandatoryFieldContainer>
|
|
@@ -42,12 +42,12 @@ export function FilterContent({
|
|
|
42
42
|
return (
|
|
43
43
|
<FilterContentWrapper data-component-name="Filter/FilterContent">
|
|
44
44
|
<FiltersHeader>
|
|
45
|
-
<FiltersTitle data-translation-key="
|
|
46
|
-
{translate('
|
|
45
|
+
<FiltersTitle data-translation-key="catalog.filters.title">
|
|
46
|
+
{translate('catalog.filters.title', 'Filters')}
|
|
47
47
|
</FiltersTitle>
|
|
48
48
|
{hasActiveFilters ? (
|
|
49
49
|
<Button size="medium" tone="danger" variant="ghost" onClick={handleClearAll}>
|
|
50
|
-
{translate('
|
|
50
|
+
{translate('catalog.filters.clearAll', 'Clear filters')}
|
|
51
51
|
</Button>
|
|
52
52
|
) : null}
|
|
53
53
|
</FiltersHeader>
|
|
@@ -21,7 +21,7 @@ export function FilterInput(props: FilterInputProps): JSX.Element {
|
|
|
21
21
|
<Input
|
|
22
22
|
value={value}
|
|
23
23
|
onChange={(e) => onChange(e.target.value)}
|
|
24
|
-
placeholder={translate('
|
|
24
|
+
placeholder={translate('catalog.filters.placeholder', 'Type to filter...')}
|
|
25
25
|
/>
|
|
26
26
|
</InputWrapper>
|
|
27
27
|
);
|
|
@@ -29,11 +29,11 @@ export function FilterPopover({
|
|
|
29
29
|
return (
|
|
30
30
|
<FilterPopoverWrapper data-component-name="Filter/FilterPopover">
|
|
31
31
|
<FilterPopoverHeader>
|
|
32
|
-
<FilterPopoverHeaderLabel data-translation-key="
|
|
33
|
-
{translate('
|
|
32
|
+
<FilterPopoverHeaderLabel data-translation-key="catalog.filters.add">
|
|
33
|
+
{translate('catalog.filters.add', 'Add Filter')}
|
|
34
34
|
</FilterPopoverHeaderLabel>
|
|
35
35
|
<FilterPopoverHeaderButton onClick={onClose}>
|
|
36
|
-
{translate('
|
|
36
|
+
{translate('catalog.filters.done', 'Done')}
|
|
37
37
|
</FilterPopoverHeaderButton>
|
|
38
38
|
</FilterPopoverHeader>
|
|
39
39
|
<FilterContent
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
|
|
4
|
-
import type { FilterProps } from '@redocly/theme/core/types';
|
|
4
|
+
import type { FilterProps, SelectProps, SelectOption } from '@redocly/theme/core/types';
|
|
5
5
|
|
|
6
6
|
import { FilterOption } from '@redocly/theme/components/Filter/FilterOption';
|
|
7
7
|
import { FilterOptionLabel } from '@redocly/theme/components/Filter/FilterOptionLabel';
|
|
@@ -15,7 +15,7 @@ export function FilterSelect({ filter, filterValuesCasing }: FilterProps): JSX.E
|
|
|
15
15
|
const { useTranslate } = useThemeHooks();
|
|
16
16
|
const { translate } = useTranslate();
|
|
17
17
|
|
|
18
|
-
let selectOptions:
|
|
18
|
+
let selectOptions: SelectOption<string>[] = [];
|
|
19
19
|
|
|
20
20
|
const defaultOptionCount = filter.filteredOptions.reduce((acc, option) => acc + option.count, 0);
|
|
21
21
|
|
|
@@ -24,8 +24,8 @@ export function FilterSelect({ filter, filterValuesCasing }: FilterProps): JSX.E
|
|
|
24
24
|
value: '',
|
|
25
25
|
element: (
|
|
26
26
|
<FilterOption key="all" onClick={() => filter.selectOption('')}>
|
|
27
|
-
<FilterOptionLabel data-translation-key="
|
|
28
|
-
{translate('
|
|
27
|
+
<FilterOptionLabel data-translation-key="catalog.filters.select.all">
|
|
28
|
+
{translate('catalog.filters.select.all', 'All')}
|
|
29
29
|
</FilterOptionLabel>
|
|
30
30
|
<CounterTag borderless>{defaultOptionCount}</CounterTag>
|
|
31
31
|
</FilterOption>
|
|
@@ -64,7 +64,7 @@ const FilterSelectWrapper = styled.div`
|
|
|
64
64
|
gap: var(--filter-select-wrapper-gap);
|
|
65
65
|
`;
|
|
66
66
|
|
|
67
|
-
const StyledSelect = styled(Select)
|
|
67
|
+
const StyledSelect = styled(Select)<SelectProps>`
|
|
68
68
|
--select-list-max-width: var(--filter-select-max-width);
|
|
69
69
|
|
|
70
70
|
min-height: var(--filter-select-min-height);
|
|
@@ -21,10 +21,10 @@ export function FooterCopyright({
|
|
|
21
21
|
<FooterCopyrightWrapper
|
|
22
22
|
className={className}
|
|
23
23
|
data-component-name="Footer/FooterCopyright"
|
|
24
|
-
data-translation-key="
|
|
24
|
+
data-translation-key="footer.copyrightText"
|
|
25
25
|
>
|
|
26
|
-
<FooterCopyrightLabel data-translation-key="
|
|
27
|
-
{translate('
|
|
26
|
+
<FooterCopyrightLabel data-translation-key="footer.copyrightText">
|
|
27
|
+
{translate('footer.copyrightText', copyrightText)}
|
|
28
28
|
</FooterCopyrightLabel>
|
|
29
29
|
<LanguagePicker onChangeLanguage={changeLanguage} placement="top" alignment="end" />
|
|
30
30
|
</FooterCopyrightWrapper>
|
|
@@ -41,8 +41,7 @@ export function LastUpdated(props: LastUpdatedProps): JSX.Element | null {
|
|
|
41
41
|
const isoDate = lastModified.toISOString().split('T')[0];
|
|
42
42
|
|
|
43
43
|
const lastUpdatedString = FORMATS[format as keyof typeof FORMATS](lastModified, locale);
|
|
44
|
-
const translationKey =
|
|
45
|
-
format === 'timeago' ? 'theme.page.lastUpdated.timeago' : 'theme.page.lastUpdated.on';
|
|
44
|
+
const translationKey = format === 'timeago' ? 'page.lastUpdated.timeago' : 'page.lastUpdated.on';
|
|
46
45
|
|
|
47
46
|
const text =
|
|
48
47
|
format === 'timeago'
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
|
|
4
|
+
export type LoadingProps = {
|
|
5
|
+
color: string;
|
|
6
|
+
size: string;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export function SpinnerLoader({ color, size }: LoadingProps): JSX.Element {
|
|
10
|
+
return <Spinner color={color} size={size} />;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const Spinner = styled.div<{ color: string; size: string }>`
|
|
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
|
+
`;
|
|
@@ -23,7 +23,7 @@ export function NextButton({ nextPage, className }: NextPageType): JSX.Element {
|
|
|
23
23
|
|
|
24
24
|
const nextPageText = nextPage.label || nextPage.routeSlug || '';
|
|
25
25
|
const defaultLabel = navigation?.nextButton?.text || 'Next page';
|
|
26
|
-
const translationKey = '
|
|
26
|
+
const translationKey = 'page.nextButton';
|
|
27
27
|
const label = translate(translationKey, { defaultValue: defaultLabel });
|
|
28
28
|
|
|
29
29
|
return (
|
|
@@ -23,7 +23,7 @@ export function PreviousButton({ prevPage, className }: PreviousPageType): JSX.E
|
|
|
23
23
|
|
|
24
24
|
const prevPageText = prevPage.label || prevPage.routeSlug || '';
|
|
25
25
|
const defaultLabel = navigation?.previousButton?.text || 'Previous page';
|
|
26
|
-
const translationKey = '
|
|
26
|
+
const translationKey = 'page.previousButton';
|
|
27
27
|
const label = translate(translationKey, { defaultValue: defaultLabel });
|
|
28
28
|
|
|
29
29
|
return (
|
|
@@ -31,8 +31,8 @@ export function ProductPicker(): JSX.Element | null {
|
|
|
31
31
|
{currentProduct ? (
|
|
32
32
|
<Product product={currentProduct} />
|
|
33
33
|
) : (
|
|
34
|
-
<span data-translation-key="
|
|
35
|
-
{translate('
|
|
34
|
+
<span data-translation-key="navbar.products">
|
|
35
|
+
{translate('navbar.products', 'Products')}
|
|
36
36
|
</span>
|
|
37
37
|
)}
|
|
38
38
|
</Button>
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
|
|
4
|
+
import type { SearchFacet, SearchFacetCount, SearchFilterItem } from '@redocly/theme/core/types';
|
|
5
|
+
|
|
6
|
+
import { useThemeHooks } from '@redocly/theme/core/hooks';
|
|
7
|
+
import { Select } from '@redocly/theme/components/Select/Select';
|
|
8
|
+
import { CounterTag } from '@redocly/theme/components/Tags/CounterTag';
|
|
9
|
+
|
|
10
|
+
type SearchFilterFieldSelectProps = {
|
|
11
|
+
className?: string;
|
|
12
|
+
facet: SearchFacet;
|
|
13
|
+
filter: SearchFilterItem[];
|
|
14
|
+
query: string;
|
|
15
|
+
selectedValues: string[];
|
|
16
|
+
onChange: (value: string | string[]) => void;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export function SearchFilterFieldSelect({
|
|
20
|
+
facet,
|
|
21
|
+
filter,
|
|
22
|
+
query,
|
|
23
|
+
selectedValues,
|
|
24
|
+
onChange,
|
|
25
|
+
}: SearchFilterFieldSelectProps) {
|
|
26
|
+
const MAX_SELECT_OPTIONS = 20;
|
|
27
|
+
const { useFacetQuery, useTranslate } = useThemeHooks();
|
|
28
|
+
const { translate } = useTranslate();
|
|
29
|
+
const { searchFacet, setSearchFacet, setSearchFacetQuery } = useFacetQuery(facet.field);
|
|
30
|
+
const [selectOptions, setSelectOptions] = useState<any[]>([]);
|
|
31
|
+
const isMultiple = facet.type === 'multi-select';
|
|
32
|
+
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
setSelectOptions(getSelectOptions());
|
|
35
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
36
|
+
}, [searchFacet, facet]);
|
|
37
|
+
|
|
38
|
+
const onSearch = (value: string | null) => {
|
|
39
|
+
if (value === null) {
|
|
40
|
+
setSearchFacet(null);
|
|
41
|
+
setSearchFacetQuery(null);
|
|
42
|
+
} else if (typeof value === 'string') {
|
|
43
|
+
setSearchFacetQuery({
|
|
44
|
+
query,
|
|
45
|
+
filter,
|
|
46
|
+
facetQuery: value,
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
const getSelectOptions = () => {
|
|
52
|
+
return searchFacet
|
|
53
|
+
? searchFacet.values.map(facetValueToSelectOption)
|
|
54
|
+
: facet.values.map(facetValueToSelectOption);
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
const facetValueToSelectOption = (facetValue?: SearchFacetCount | string) => {
|
|
58
|
+
if (!facetValue) {
|
|
59
|
+
return { element: null, value: '' };
|
|
60
|
+
}
|
|
61
|
+
if (typeof facetValue === 'string') {
|
|
62
|
+
return {
|
|
63
|
+
element: (
|
|
64
|
+
<FilterSelectOptionWrapper>
|
|
65
|
+
<FilterSelectOptionText>{facetValue}</FilterSelectOptionText>
|
|
66
|
+
</FilterSelectOptionWrapper>
|
|
67
|
+
),
|
|
68
|
+
value: facetValue,
|
|
69
|
+
};
|
|
70
|
+
} else {
|
|
71
|
+
const { value, count, isCounterVisible } = facetValue as SearchFacetCount;
|
|
72
|
+
return {
|
|
73
|
+
element: (
|
|
74
|
+
<FilterSelectOptionWrapper>
|
|
75
|
+
<FilterSelectOptionText>{value}</FilterSelectOptionText>
|
|
76
|
+
{isCounterVisible && <CounterTag>{count}</CounterTag>}
|
|
77
|
+
</FilterSelectOptionWrapper>
|
|
78
|
+
),
|
|
79
|
+
value: value,
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
return (
|
|
85
|
+
<Select
|
|
86
|
+
value={
|
|
87
|
+
selectedValues.length
|
|
88
|
+
? isMultiple
|
|
89
|
+
? selectedValues.map((value) => facetValueToSelectOption(value))
|
|
90
|
+
: facetValueToSelectOption(selectedValues[0])
|
|
91
|
+
: undefined
|
|
92
|
+
}
|
|
93
|
+
options={selectOptions}
|
|
94
|
+
onChange={onChange}
|
|
95
|
+
placeholder={`${translate(
|
|
96
|
+
'search.filter.field.placeholder',
|
|
97
|
+
'Search',
|
|
98
|
+
)} ${facet.name.toLowerCase()}...`}
|
|
99
|
+
alignment="start"
|
|
100
|
+
multiple={isMultiple}
|
|
101
|
+
searchable={true}
|
|
102
|
+
footer={
|
|
103
|
+
selectOptions.length === MAX_SELECT_OPTIONS ? (
|
|
104
|
+
<FilterSelectFooter>Search to show more items...</FilterSelectFooter>
|
|
105
|
+
) : null
|
|
106
|
+
}
|
|
107
|
+
onSearch={onSearch}
|
|
108
|
+
checkmarkIconPosition="start"
|
|
109
|
+
/>
|
|
110
|
+
);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
const FilterSelectOptionWrapper = styled.div`
|
|
114
|
+
width: 100%;
|
|
115
|
+
display: flex;
|
|
116
|
+
justify-content: space-between;
|
|
117
|
+
align-items: center;
|
|
118
|
+
gap: var(--search-filter-field-select-option-gap);
|
|
119
|
+
`;
|
|
120
|
+
|
|
121
|
+
const FilterSelectOptionText = styled.span`
|
|
122
|
+
overflow: hidden;
|
|
123
|
+
text-overflow: ellipsis;
|
|
124
|
+
white-space: nowrap;
|
|
125
|
+
width: 100%;
|
|
126
|
+
padding: var(--search-filter-field-select-option-text-padding);
|
|
127
|
+
`;
|
|
128
|
+
|
|
129
|
+
const FilterSelectFooter = styled.div`
|
|
130
|
+
display: flex;
|
|
131
|
+
align-items: center;
|
|
132
|
+
justify-content: center;
|
|
133
|
+
padding: var(--search-filter-field-select-footer-padding);
|
|
134
|
+
color: var(--search-filter-field-select-footer-text-color);
|
|
135
|
+
`;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
|
|
4
|
+
import type { SearchFacet, SearchFacetCount } from '@redocly/theme/core/types';
|
|
5
|
+
|
|
6
|
+
import { Tag, type TagProps } from '@redocly/theme/components/Tag/Tag';
|
|
7
|
+
|
|
8
|
+
type SearchFilterFieldTagsProps = {
|
|
9
|
+
className?: string;
|
|
10
|
+
facet: SearchFacet;
|
|
11
|
+
selectedValues: string[];
|
|
12
|
+
onChange: (value: string | string[]) => void;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export function SearchFilterFieldTags({
|
|
16
|
+
className,
|
|
17
|
+
facet,
|
|
18
|
+
selectedValues,
|
|
19
|
+
onChange,
|
|
20
|
+
}: SearchFilterFieldTagsProps) {
|
|
21
|
+
return (
|
|
22
|
+
<FilterTagsWrapper
|
|
23
|
+
data-component-name="Search/FilterFields/SearchFilterFieldTags"
|
|
24
|
+
className={className}
|
|
25
|
+
>
|
|
26
|
+
{facet.values.map((facetCount, index) => {
|
|
27
|
+
const { value, count, isCounterVisible } = facetCount as SearchFacetCount;
|
|
28
|
+
const active = selectedValues.includes(value);
|
|
29
|
+
return (
|
|
30
|
+
<FilterTagWrapper
|
|
31
|
+
key={`${count}-${index}`}
|
|
32
|
+
color={value}
|
|
33
|
+
onClick={() => {
|
|
34
|
+
const values = active
|
|
35
|
+
? selectedValues.filter((item) => item !== value)
|
|
36
|
+
: [...selectedValues, value];
|
|
37
|
+
onChange(values);
|
|
38
|
+
}}
|
|
39
|
+
active={active}
|
|
40
|
+
borderless
|
|
41
|
+
>
|
|
42
|
+
{value} {isCounterVisible && <span>{count}</span>}
|
|
43
|
+
</FilterTagWrapper>
|
|
44
|
+
);
|
|
45
|
+
})}
|
|
46
|
+
</FilterTagsWrapper>
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const FilterTagsWrapper = styled.div`
|
|
51
|
+
display: flex;
|
|
52
|
+
flex-wrap: wrap;
|
|
53
|
+
gap: var(--search-filter-field-tags-gap);
|
|
54
|
+
`;
|
|
55
|
+
|
|
56
|
+
const FilterTagWrapper = styled(Tag)<{ color: TagProps['color'] }>`
|
|
57
|
+
text-transform: uppercase;
|
|
58
|
+
cursor: pointer;
|
|
59
|
+
${({ color }) => color && `background-color: var(--tag-operation-bg-color-${color});`}
|
|
60
|
+
margin: var(--search-filter-field-tags-tag-margin);
|
|
61
|
+
`;
|