@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
|
@@ -5,14 +5,14 @@ import type { ChangeEvent, SyntheticEvent } from 'react';
|
|
|
5
5
|
|
|
6
6
|
import { SearchIcon } from '@redocly/theme/icons/SearchIcon/SearchIcon';
|
|
7
7
|
import { Spinner } from '@redocly/theme/icons/Spinner/Spinner';
|
|
8
|
-
import { CloseIcon } from '@redocly/theme/icons/CloseIcon/CloseIcon';
|
|
9
8
|
import { Button } from '@redocly/theme/components/Button/Button';
|
|
10
9
|
import { useThemeHooks } from '@redocly/theme/core/hooks';
|
|
10
|
+
import { CloseFilledIcon } from '@redocly/theme/icons/CloseFilledIcon/CloseFilledIcon';
|
|
11
11
|
|
|
12
12
|
export type SearchInputProps = {
|
|
13
13
|
placeholder?: string;
|
|
14
14
|
value: string;
|
|
15
|
-
onChange(value: string)
|
|
15
|
+
onChange: (value: string) => void;
|
|
16
16
|
inputRef?: React.RefObject<HTMLInputElement>;
|
|
17
17
|
isLoading: boolean;
|
|
18
18
|
className?: string;
|
|
@@ -52,7 +52,9 @@ export function SearchInput({
|
|
|
52
52
|
onChange={handleOnChange}
|
|
53
53
|
onClick={stopPropagation}
|
|
54
54
|
/>
|
|
55
|
-
{!!value &&
|
|
55
|
+
{!!value && (
|
|
56
|
+
<ResetButton variant="ghost" onClick={handleOnReset} icon={<CloseFilledIcon />} />
|
|
57
|
+
)}
|
|
56
58
|
</SearchInputWrapper>
|
|
57
59
|
);
|
|
58
60
|
}
|
|
@@ -82,3 +84,7 @@ const SearchInputField = styled.input`
|
|
|
82
84
|
color: var(--search-input-placeholder-color);
|
|
83
85
|
}
|
|
84
86
|
`;
|
|
87
|
+
|
|
88
|
+
const ResetButton = styled(Button)`
|
|
89
|
+
color: var(--color-warm-grey-5);
|
|
90
|
+
`;
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import React, { useEffect, useRef } from 'react';
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
|
|
4
|
-
import type {
|
|
4
|
+
import type { SearchItemData } from '@redocly/theme/core/types';
|
|
5
5
|
|
|
6
6
|
import { HttpTag } from '@redocly/theme/components/Tags/HttpTag';
|
|
7
7
|
import { Link } from '@redocly/theme/components/Link/Link';
|
|
8
8
|
import { Image } from '@redocly/theme/components/Image/Image';
|
|
9
|
-
import {
|
|
9
|
+
import { searchHighlight } from '@redocly/theme/components/Search/SearchHighlight';
|
|
10
10
|
import { Badge } from '@redocly/theme/components/Badge/Badge';
|
|
11
|
+
import { trimText } from '@redocly/theme/core/utils';
|
|
11
12
|
|
|
12
13
|
type ActiveItem<T> = T & { active?: boolean };
|
|
13
14
|
export type SearchItemProps = {
|
|
14
|
-
item: ActiveItem<
|
|
15
|
+
item: ActiveItem<SearchItemData>;
|
|
15
16
|
product?: {
|
|
16
17
|
name: string;
|
|
17
18
|
icon?: string;
|
|
@@ -28,12 +29,16 @@ export function SearchItem({ item, className, product }: SearchItemProps): JSX.E
|
|
|
28
29
|
}
|
|
29
30
|
}, [item.active]);
|
|
30
31
|
|
|
31
|
-
const
|
|
32
|
+
const { document, highlight } = item;
|
|
33
|
+
|
|
34
|
+
const parameter =
|
|
35
|
+
highlight.parameters && highlight.parameters.length ? highlight.parameters[0] : null;
|
|
36
|
+
const shouldShowPath = document.path && document.path?.length > 1;
|
|
32
37
|
|
|
33
38
|
return (
|
|
34
39
|
<SearchItemWrapper
|
|
35
40
|
className={className}
|
|
36
|
-
to={
|
|
41
|
+
to={document.url}
|
|
37
42
|
tabIndex={0}
|
|
38
43
|
innerRef={ref}
|
|
39
44
|
data-component-name="Search/SearchItem"
|
|
@@ -45,41 +50,49 @@ export function SearchItem({ item, className, product }: SearchItemProps): JSX.E
|
|
|
45
50
|
{product.name}
|
|
46
51
|
</SearchItemProductTag>
|
|
47
52
|
)}
|
|
48
|
-
{
|
|
53
|
+
{document.httpMethod ? (
|
|
49
54
|
<SearchItemOperation>
|
|
50
|
-
<SearchItemOperationTag color={
|
|
51
|
-
{
|
|
55
|
+
<SearchItemOperationTag color={document.httpMethod}>
|
|
56
|
+
{document.httpMethod.toUpperCase()}
|
|
52
57
|
</SearchItemOperationTag>
|
|
53
|
-
{
|
|
58
|
+
{highlight.httpPath ? searchHighlight(highlight.httpPath) : document.httpPath}
|
|
54
59
|
</SearchItemOperation>
|
|
55
60
|
) : null}
|
|
56
61
|
<SearchItemTitleWrapper>
|
|
57
|
-
<SearchItemTitle>
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
62
|
+
<SearchItemTitle>
|
|
63
|
+
{highlight.title ? searchHighlight(highlight.title) : document.title}
|
|
64
|
+
</SearchItemTitle>
|
|
65
|
+
{document.deprecated ? <SearchItemBadge deprecated>Deprecated</SearchItemBadge> : null}
|
|
66
|
+
{document.badges
|
|
67
|
+
? document.badges.map(({ name, color }) => (
|
|
61
68
|
<SearchItemBadge color={color || 'var(--color-info-base)'} key={name}>
|
|
62
69
|
{name}
|
|
63
70
|
</SearchItemBadge>
|
|
64
71
|
))
|
|
65
72
|
: null}
|
|
66
73
|
</SearchItemTitleWrapper>
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
74
|
+
<SearchItemDescription>
|
|
75
|
+
{highlight.text ? searchHighlight(highlight.text) : trimText(document.text)}
|
|
76
|
+
</SearchItemDescription>
|
|
70
77
|
</SearchItemHeader>
|
|
71
|
-
{
|
|
78
|
+
{parameter ? (
|
|
72
79
|
<SearchItemPlace>
|
|
73
80
|
<div>
|
|
74
|
-
{
|
|
75
|
-
|
|
76
|
-
}
|
|
77
|
-
{
|
|
81
|
+
{searchHighlight(parameter.place)}
|
|
82
|
+
{` → `}
|
|
83
|
+
{parameter.path?.length ? searchHighlight(parameter.path?.join(' → ')) + ' → ' : ''}
|
|
84
|
+
{searchHighlight(parameter.name)}
|
|
78
85
|
</div>
|
|
79
|
-
<div>{
|
|
86
|
+
<div>{searchHighlight(parameter.description)}</div>
|
|
80
87
|
</SearchItemPlace>
|
|
81
88
|
) : (
|
|
82
|
-
|
|
89
|
+
shouldShowPath && (
|
|
90
|
+
<SearchItemPath>
|
|
91
|
+
{highlight.path && highlight.path.length
|
|
92
|
+
? searchHighlight(highlight.path.join(' → '))
|
|
93
|
+
: document.path?.join(' → ')}
|
|
94
|
+
</SearchItemPath>
|
|
95
|
+
)
|
|
83
96
|
)}
|
|
84
97
|
</SearchItemWrapper>
|
|
85
98
|
);
|
|
@@ -92,7 +105,7 @@ const SearchItemWrapper = styled(Link)`
|
|
|
92
105
|
background-color: var(--search-item-bg-color);
|
|
93
106
|
transition: background-color 0.3s ease;
|
|
94
107
|
text-decoration: none;
|
|
95
|
-
white-space:
|
|
108
|
+
white-space: normal;
|
|
96
109
|
outline: none;
|
|
97
110
|
border-top: 1px solid var(--search-item-border-color);
|
|
98
111
|
border-bottom: 1px solid var(--search-item-border-color);
|
|
@@ -160,6 +173,7 @@ const SearchItemPath = styled.div`
|
|
|
160
173
|
font-size: var(--font-size-sm);
|
|
161
174
|
line-height: var(--line-height-sm);
|
|
162
175
|
font-weight: var(--font-weight-regular);
|
|
176
|
+
margin-top: var(--spacing-sm);
|
|
163
177
|
`;
|
|
164
178
|
|
|
165
179
|
const SearchItemPlace = styled.div`
|
|
@@ -170,6 +184,7 @@ const SearchItemPlace = styled.div`
|
|
|
170
184
|
font-size: var(--font-size-sm);
|
|
171
185
|
line-height: var(--line-height-sm);
|
|
172
186
|
font-weight: var(--font-weight-regular);
|
|
187
|
+
margin-top: var(--spacing-sm);
|
|
173
188
|
|
|
174
189
|
&:first-child {
|
|
175
190
|
padding-top: 0;
|
|
@@ -34,8 +34,8 @@ export function SearchRecent({ onSelect, className }: SearchRecentProps): JSX.El
|
|
|
34
34
|
|
|
35
35
|
return (
|
|
36
36
|
<SearchRecentWrapper data-component-name="Search/SearchRecent" className={className}>
|
|
37
|
-
<SearchRecentTitle data-translation-key="
|
|
38
|
-
{translate('
|
|
37
|
+
<SearchRecentTitle data-translation-key="search.recent">
|
|
38
|
+
{translate('search.recent', 'Recent searches')}
|
|
39
39
|
</SearchRecentTitle>
|
|
40
40
|
<SearchRecentItems>
|
|
41
41
|
{items.map((item) => (
|
|
@@ -17,8 +17,8 @@ export function SearchSuggestedPages({ className }: SearchSuggestedPagesProps):
|
|
|
17
17
|
|
|
18
18
|
return (
|
|
19
19
|
<SearchSuggestedWrapper data-component-name="Search/SearchSuggestedPages" className={className}>
|
|
20
|
-
<SearchSuggestedTitle data-translation-key="
|
|
21
|
-
{translate('
|
|
20
|
+
<SearchSuggestedTitle data-translation-key="search.suggested">
|
|
21
|
+
{translate('search.suggested', 'Suggested pages')}
|
|
22
22
|
</SearchSuggestedTitle>
|
|
23
23
|
<SearchSuggestedItems>
|
|
24
24
|
{pages.map((page) =>
|
|
@@ -43,10 +43,10 @@ export function SearchTrigger({ onClick, className }: SearchTriggerProps): JSX.E
|
|
|
43
43
|
/>
|
|
44
44
|
<SearchTriggerInput
|
|
45
45
|
data-testid="search-trigger-input"
|
|
46
|
-
data-translation-key="
|
|
46
|
+
data-translation-key="search.navbar.label"
|
|
47
47
|
>
|
|
48
48
|
<SearchIcon />
|
|
49
|
-
{translate('
|
|
49
|
+
{translate('search.navbar.label', 'Search')}
|
|
50
50
|
{mainShortcutKey && <span>{mainShortcutKey}</span>}
|
|
51
51
|
</SearchTriggerInput>
|
|
52
52
|
</SearchTriggerWrapper>
|
|
@@ -4,11 +4,18 @@ export const search = css`
|
|
|
4
4
|
/**
|
|
5
5
|
* @tokens Search
|
|
6
6
|
*/
|
|
7
|
-
--search-modal-width:
|
|
8
|
-
--search-modal-min-height:
|
|
7
|
+
--search-modal-width: 1100px;
|
|
8
|
+
--search-modal-min-height: 705px;
|
|
9
9
|
--search-modal-bg-color: var(--modal-bg-color);
|
|
10
10
|
--search-modal-box-shadow: var(--modal-box-shadow);
|
|
11
11
|
--search-modal-border-radius: var(--border-radius-lg);
|
|
12
|
+
--search-modal-border: 1px solid var(--border-color-secondary);
|
|
13
|
+
|
|
14
|
+
--search-modal-header-bg-color: var(--bg-color-tonal); // @presenter Color
|
|
15
|
+
--search-modal-header-padding: var(--spacing-sm);
|
|
16
|
+
|
|
17
|
+
--search-modal-footer-padding: var(--spacing-sm);
|
|
18
|
+
--search-modal-footer-gap: var(--spacing-md);
|
|
12
19
|
|
|
13
20
|
--search-highlight-bg-color: none; // @presenter Color
|
|
14
21
|
--search-highlight-text-color: var(--color-info-base); // @presenter Color
|
|
@@ -27,6 +34,11 @@ export const search = css`
|
|
|
27
34
|
--search-input-border: none;
|
|
28
35
|
--search-input-border-radius: var(--border-radius); // @presenter BorderRadius
|
|
29
36
|
|
|
37
|
+
--search-group-title-padding: var(--spacing-sm);
|
|
38
|
+
--search-group-title-bg-color: var(--bg-color-tonal); // @presenter Color
|
|
39
|
+
--search-group-footer-padding: var(--spacing-sm);
|
|
40
|
+
--search-group-footer-text-color: var(--link-color-primary); // @presenter Color
|
|
41
|
+
|
|
30
42
|
--search-item-text-color: var(--text-color-secondary); // @presenter Color
|
|
31
43
|
--search-item-text-color-hover: var(--text-color-primary); // @presenter Color
|
|
32
44
|
--search-item-title-font-size: var(--font-size-base); // @presenter FontSize
|
|
@@ -74,6 +86,40 @@ export const search = css`
|
|
|
74
86
|
--search-suggested-item-bg-color-active: var(--layer-color); // @presenter Color
|
|
75
87
|
--search-suggested-item-border-color-focused: var(--color-blue-4); // @presenter Color
|
|
76
88
|
|
|
89
|
+
--search-shortcuts-gap: var(--spacing-xs);
|
|
90
|
+
|
|
91
|
+
--search-message-font-size: var(--font-size-lg); // @presenter FontSize
|
|
92
|
+
--search-message-font-weight: var(--font-weight-regular); // @presenter FontWeight
|
|
93
|
+
--search-message-line-height: var(--line-height-lg); // @presenter LineHeight
|
|
94
|
+
--search-message-text-color: var(--text-color-secondary); // @presenter Color
|
|
95
|
+
--search-message-gap: var(--spacing-md);
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* @tokens Search filter
|
|
99
|
+
*/
|
|
100
|
+
--search-filter-width: 450px;
|
|
101
|
+
--search-filter-bg-color: var(--search-modal-bg-color);
|
|
102
|
+
--search-filter-padding: var(--spacing-lg);
|
|
103
|
+
--search-filter-font-size: var(--font-size-base);
|
|
104
|
+
--search-filter-font-weight: var(--font-weight-regular);
|
|
105
|
+
--search-filter-line-height: var(--line-height-base);
|
|
106
|
+
|
|
107
|
+
--search-filter-header-padding: var(--spacing-md) 0;
|
|
108
|
+
--search-filter-header-text-color: var(--text-color-helper);
|
|
109
|
+
--search-filter-header-z-index: var(--z-index-raised);
|
|
110
|
+
|
|
111
|
+
--search-filter-fields-gap: var(--spacing-base);
|
|
112
|
+
|
|
113
|
+
--search-filter-field-select-option-gap: var(--spacing-unit);
|
|
114
|
+
--search-filter-field-select-option-text-padding: 0 0 0 var(--spacing-unit);
|
|
115
|
+
--search-filter-field-select-footer-padding: 0 0 0 var(--spacing-unit);
|
|
116
|
+
--search-filter-field-select-footer-text-color: var(--text-color-helper);
|
|
117
|
+
|
|
118
|
+
--search-filter-field-tags-gap: var(--spacing-unit);
|
|
119
|
+
--search-filter-field-tags-tag-margin: var(--spacing-unit) 0 0 0;
|
|
120
|
+
|
|
121
|
+
// @tokens End
|
|
122
|
+
|
|
77
123
|
/**
|
|
78
124
|
* @tokens Navbar Search Trigger
|
|
79
125
|
*/
|
|
@@ -2,14 +2,14 @@ import React from 'react';
|
|
|
2
2
|
import styled, { css } from 'styled-components';
|
|
3
3
|
|
|
4
4
|
import type { ReactElement } from 'react';
|
|
5
|
-
import type { SelectOption } from '@redocly/theme/core/types/select
|
|
5
|
+
import type { SelectOption } from '@redocly/theme/core/types/select';
|
|
6
6
|
|
|
7
7
|
import { typedMemo } from '@redocly/theme/core/hoc/typedMemo';
|
|
8
8
|
|
|
9
9
|
export type SegmentedProps<T> = {
|
|
10
10
|
options: SelectOption<T>[];
|
|
11
11
|
value: T;
|
|
12
|
-
onChange: ({ label, value }:
|
|
12
|
+
onChange: ({ label, value }: SelectOption<T>) => void;
|
|
13
13
|
className?: string;
|
|
14
14
|
size?: 'regular' | 'small';
|
|
15
15
|
};
|