@redocly/theme 0.41.0-rc.3 → 0.41.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/CodeBlock/CodeBlockControls.js +2 -1
- package/lib/components/Dropdown/DropdownMenu.d.ts +0 -2
- package/lib/components/Dropdown/DropdownMenu.js +1 -3
- package/lib/components/Search/Search.js +1 -1
- package/lib/components/Search/SearchDialog.js +26 -103
- package/lib/components/Search/SearchHighlight.d.ts +1 -1
- package/lib/components/Search/SearchHighlight.js +5 -28
- package/lib/components/Search/SearchInput.d.ts +2 -3
- package/lib/components/Search/SearchInput.js +3 -11
- package/lib/components/Search/SearchItem.d.ts +2 -2
- package/lib/components/Search/SearchItem.js +15 -23
- package/lib/components/Search/variables.js +2 -48
- package/lib/components/Segmented/Segmented.d.ts +5 -2
- package/lib/components/Select/Select.d.ts +36 -2
- package/lib/components/Select/Select.js +98 -134
- package/lib/components/Select/variables.js +1 -11
- package/lib/components/Tag/Tag.d.ts +2 -4
- package/lib/components/Tag/Tag.js +4 -40
- package/lib/components/Tag/variables.dark.js +5 -20
- package/lib/components/Tag/variables.js +17 -49
- package/lib/components/VersionPicker/VersionPicker.d.ts +3 -2
- package/lib/components/VersionPicker/VersionPicker.js +30 -13
- package/lib/core/hooks/__mocks__/index.d.ts +1 -1
- package/lib/core/hooks/__mocks__/index.js +1 -1
- package/lib/core/hooks/__mocks__/use-theme-hooks.d.ts +1 -1
- package/lib/core/hooks/__mocks__/use-theme-hooks.js +1 -1
- package/lib/core/hooks/index.d.ts +1 -2
- package/lib/core/hooks/index.js +1 -2
- package/lib/core/hooks/search/use-recent-searches.js +0 -2
- package/lib/core/hooks/{search/use-search-dialog.d.ts → use-search.d.ts} +1 -1
- package/lib/core/hooks/{search/use-search-dialog.js → use-search.js} +5 -5
- package/lib/core/types/hooks.d.ts +4 -16
- package/lib/core/types/index.d.ts +1 -1
- package/lib/core/types/index.js +1 -1
- package/lib/core/types/l10n.d.ts +2 -1
- package/lib/core/types/search.d.ts +2 -43
- package/lib/core/types/select-option.d.ts +4 -0
- package/lib/core/types/{select.js → select-option.js} +1 -1
- package/lib/index.d.ts +1 -7
- package/lib/index.js +1 -7
- package/package.json +2 -2
- package/src/components/CodeBlock/CodeBlockControls.tsx +1 -1
- package/src/components/Dropdown/DropdownMenu.tsx +1 -2
- package/src/components/Filter/FilterSelect.tsx +3 -3
- package/src/components/Search/Search.tsx +2 -2
- package/src/components/Search/SearchDialog.tsx +42 -168
- package/src/components/Search/SearchHighlight.tsx +2 -29
- package/src/components/Search/SearchInput.tsx +3 -17
- package/src/components/Search/SearchItem.tsx +24 -38
- package/src/components/Search/variables.ts +2 -48
- package/src/components/Segmented/Segmented.tsx +2 -2
- package/src/components/Select/Select.tsx +157 -200
- package/src/components/Select/variables.ts +1 -11
- package/src/components/Tag/Tag.tsx +6 -57
- package/src/components/Tag/variables.dark.ts +5 -20
- package/src/components/Tag/variables.ts +17 -49
- package/src/components/VersionPicker/VersionPicker.tsx +39 -15
- package/src/core/hooks/__mocks__/index.ts +1 -1
- package/src/core/hooks/__mocks__/use-theme-hooks.ts +1 -1
- package/src/core/hooks/index.ts +1 -2
- package/src/core/hooks/search/use-recent-searches.ts +0 -3
- package/src/core/hooks/{search/use-search-dialog.ts → use-search.ts} +1 -1
- package/src/core/types/hooks.ts +4 -24
- package/src/core/types/index.ts +1 -1
- package/src/core/types/l10n.ts +37 -7
- package/src/core/types/search.ts +2 -54
- package/src/core/types/select-option.ts +4 -0
- package/src/index.ts +1 -7
- package/lib/components/Loaders/SpinnerLoader.d.ts +0 -5
- package/lib/components/Loaders/SpinnerLoader.js +0 -32
- package/lib/components/Search/FilterFields/SearchFilterFieldSelect.d.ts +0 -12
- package/lib/components/Search/FilterFields/SearchFilterFieldSelect.js +0 -113
- package/lib/components/Search/FilterFields/SearchFilterFieldTags.d.ts +0 -10
- package/lib/components/Search/FilterFields/SearchFilterFieldTags.js +0 -37
- package/lib/components/Search/SearchFilter.d.ts +0 -11
- package/lib/components/Search/SearchFilter.js +0 -71
- package/lib/components/Search/SearchFilterField.d.ts +0 -11
- package/lib/components/Search/SearchFilterField.js +0 -43
- package/lib/components/Search/SearchGroups.d.ts +0 -9
- package/lib/components/Search/SearchGroups.js +0 -69
- package/lib/components/Select/SelectInput.d.ts +0 -23
- package/lib/components/Select/SelectInput.js +0 -129
- package/lib/core/hooks/search/use-search-filter.d.ts +0 -9
- package/lib/core/hooks/search/use-search-filter.js +0 -50
- package/lib/core/types/select.d.ts +0 -30
- package/lib/icons/ResetIcon/ResetIcon.d.ts +0 -9
- package/lib/icons/ResetIcon/ResetIcon.js +0 -22
- package/lib/icons/SettingsIcon/SettingsIcon.d.ts +0 -9
- package/lib/icons/SettingsIcon/SettingsIcon.js +0 -23
- package/src/components/Loaders/SpinnerLoader.tsx +0 -31
- package/src/components/Search/FilterFields/SearchFilterFieldSelect.tsx +0 -134
- package/src/components/Search/FilterFields/SearchFilterFieldTags.tsx +0 -61
- package/src/components/Search/SearchFilter.tsx +0 -90
- package/src/components/Search/SearchFilterField.tsx +0 -84
- package/src/components/Search/SearchGroups.tsx +0 -80
- package/src/components/Select/SelectInput.tsx +0 -201
- package/src/core/hooks/search/use-search-filter.ts +0 -57
- package/src/core/types/select.ts +0 -32
- package/src/icons/ResetIcon/ResetIcon.tsx +0 -26
- package/src/icons/SettingsIcon/SettingsIcon.tsx +0 -30
- /package/lib/components/{Loaders → Loading}/Loading.d.ts +0 -0
- /package/lib/components/{Loaders → Loading}/Loading.js +0 -0
- /package/src/components/{Loaders → Loading}/Loading.tsx +0 -0
|
@@ -31,7 +31,6 @@ const React = __importStar(require("react"));
|
|
|
31
31
|
const styled_components_1 = __importDefault(require("styled-components"));
|
|
32
32
|
const hooks_1 = require("../../core/hooks");
|
|
33
33
|
const Select_1 = require("../../components/Select/Select");
|
|
34
|
-
const SelectInput_1 = require("../../components/Select/SelectInput");
|
|
35
34
|
function VersionPicker(props) {
|
|
36
35
|
var _a;
|
|
37
36
|
const themeConfig = (0, hooks_1.useThemeConfig)();
|
|
@@ -39,24 +38,22 @@ function VersionPicker(props) {
|
|
|
39
38
|
const { useTranslate } = (0, hooks_1.useThemeHooks)();
|
|
40
39
|
const { translate } = useTranslate();
|
|
41
40
|
const { versions = [], onChange } = props;
|
|
42
|
-
const options = versions.map((
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
41
|
+
const options = versions.map((version) => {
|
|
42
|
+
return {
|
|
43
|
+
element: version.label || version.version,
|
|
44
|
+
value: version,
|
|
45
|
+
active: version.active,
|
|
46
|
+
};
|
|
47
|
+
});
|
|
48
48
|
if (versionPicker === null || versionPicker === void 0 ? void 0 : versionPicker.hide) {
|
|
49
49
|
return null;
|
|
50
50
|
}
|
|
51
|
-
const
|
|
52
|
-
const selectedVersion = versions.find((v) => v.version === value);
|
|
53
|
-
onChange(selectedVersion);
|
|
54
|
-
};
|
|
51
|
+
const value = (_a = options.find((item) => item.active)) === null || _a === void 0 ? void 0 : _a.value;
|
|
55
52
|
if (!options.length && !(versionPicker === null || versionPicker === void 0 ? void 0 : versionPicker.showForUnversioned))
|
|
56
53
|
return null;
|
|
57
54
|
return (React.createElement(VersionsPickerWrapper, { "data-component-name": "VersionPicker/VersionPicker" },
|
|
58
55
|
React.createElement(VersionPickerLabel, { "data-translation-key": "theme.versionPicker.label" }, translate('theme.versionPicker.label', 'Version:')),
|
|
59
|
-
React.createElement(exports.VersionPickerSelect, { placeholder: translate('theme.versionPicker.unversioned', 'All versions'), disabled: !options.length, options: options, value: value, onChange:
|
|
56
|
+
React.createElement(exports.VersionPickerSelect, { placeholder: translate('theme.versionPicker.unversioned', 'All versions'), disabled: !options.length, options: options, value: value, onChange: onChange })));
|
|
60
57
|
}
|
|
61
58
|
exports.VersionPicker = VersionPicker;
|
|
62
59
|
const VersionPickerLabel = styled_components_1.default.label `
|
|
@@ -75,12 +72,32 @@ exports.VersionPickerSelect = (0, styled_components_1.default)(Select_1.Select)
|
|
|
75
72
|
line-height: var(--version-picker-line-height);
|
|
76
73
|
color: var(--version-picker-text-color);
|
|
77
74
|
|
|
78
|
-
${
|
|
75
|
+
${Select_1.SelectInput} {
|
|
79
76
|
border: var(--version-picker-input-border);
|
|
80
77
|
border-radius: var(--version-picker-input-border-radius);
|
|
81
78
|
padding: var(--version-picker-input-padding-vertical)
|
|
82
79
|
var(--version-picker-input-padding-horizontal);
|
|
83
80
|
}
|
|
81
|
+
|
|
82
|
+
${Select_1.SelectList} {
|
|
83
|
+
right: 0;
|
|
84
|
+
width: 100%;
|
|
85
|
+
min-width: var(--version-picker-list-min-width);
|
|
86
|
+
max-width: var(--version-picker-list-max-width);
|
|
87
|
+
padding: var(--version-picker-list-padding);
|
|
88
|
+
background-color: var(--version-picker-list-bg-color);
|
|
89
|
+
border-radius: var(--version-picker-list-border-radius);
|
|
90
|
+
box-shadow: var(--version-picker-list-box-shadow);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
${Select_1.SelectListItem} {
|
|
94
|
+
border-radius: var(--version-picker-list-item-border-radius);
|
|
95
|
+
|
|
96
|
+
& > * {
|
|
97
|
+
padding: var(--version-picker-list-item-vertical-padding)
|
|
98
|
+
var(--version-picker-list-item-horizontal-padding);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
84
101
|
`;
|
|
85
102
|
const VersionsPickerWrapper = styled_components_1.default.div `
|
|
86
103
|
display: flex;
|
|
@@ -20,5 +20,5 @@ export * from '../../../core/hooks/menu/use-menu-item-expanded';
|
|
|
20
20
|
export * from '../../../core/hooks/menu/use-mobile-menu-levels';
|
|
21
21
|
export * from '../../../core/hooks/feedback/use-report-dialog';
|
|
22
22
|
export * from '../../../core/hooks/use-product-picker';
|
|
23
|
-
export * from '../../../core/hooks/
|
|
23
|
+
export * from '../../../core/hooks/use-search';
|
|
24
24
|
export * from '../../../core/hooks/use-language-picker';
|
|
@@ -36,6 +36,6 @@ __exportStar(require("../../../core/hooks/menu/use-menu-item-expanded"), exports
|
|
|
36
36
|
__exportStar(require("../../../core/hooks/menu/use-mobile-menu-levels"), exports);
|
|
37
37
|
__exportStar(require("../../../core/hooks/feedback/use-report-dialog"), exports);
|
|
38
38
|
__exportStar(require("../../../core/hooks/use-product-picker"), exports);
|
|
39
|
-
__exportStar(require("../../../core/hooks/
|
|
39
|
+
__exportStar(require("../../../core/hooks/use-search"), exports);
|
|
40
40
|
__exportStar(require("../../../core/hooks/use-language-picker"), exports);
|
|
41
41
|
//# sourceMappingURL=index.js.map
|
|
@@ -30,7 +30,7 @@ export declare const useThemeHooks: jest.Mock<{
|
|
|
30
30
|
}, [], any>;
|
|
31
31
|
useCurrentProduct: jest.Mock<any, any, any>;
|
|
32
32
|
useProducts: jest.Mock<never[], [], any>;
|
|
33
|
-
|
|
33
|
+
useFuseSearch: jest.Mock<{
|
|
34
34
|
query: jest.Mock<any, any, any>;
|
|
35
35
|
setQuery: jest.Mock<any, any, any>;
|
|
36
36
|
items: never[];
|
|
@@ -37,7 +37,7 @@ exports.useThemeHooks = jest.fn(() => ({
|
|
|
37
37
|
})),
|
|
38
38
|
useCurrentProduct: jest.fn(),
|
|
39
39
|
useProducts: jest.fn(() => []),
|
|
40
|
-
|
|
40
|
+
useFuseSearch: jest.fn(() => ({
|
|
41
41
|
query: jest.fn().mockReturnValue(''),
|
|
42
42
|
setQuery: jest.fn(),
|
|
43
43
|
items: [],
|
|
@@ -24,7 +24,6 @@ export * from '../../core/hooks/use-tabs';
|
|
|
24
24
|
export * from '../../core/hooks/use-focus-trap';
|
|
25
25
|
export * from '../../core/hooks/use-language-picker';
|
|
26
26
|
export * from '../../core/hooks/use-product-picker';
|
|
27
|
-
export * from '../../core/hooks/
|
|
28
|
-
export * from '../../core/hooks/search/use-search-filter';
|
|
27
|
+
export * from '../../core/hooks/use-search';
|
|
29
28
|
export * from '../../core/hooks/use-controlled-state';
|
|
30
29
|
export * from '../../core/hooks/use-codeblock-tabs-controls';
|
package/lib/core/hooks/index.js
CHANGED
|
@@ -40,8 +40,7 @@ __exportStar(require("../../core/hooks/use-tabs"), exports);
|
|
|
40
40
|
__exportStar(require("../../core/hooks/use-focus-trap"), exports);
|
|
41
41
|
__exportStar(require("../../core/hooks/use-language-picker"), exports);
|
|
42
42
|
__exportStar(require("../../core/hooks/use-product-picker"), exports);
|
|
43
|
-
__exportStar(require("../../core/hooks/
|
|
44
|
-
__exportStar(require("../../core/hooks/search/use-search-filter"), exports);
|
|
43
|
+
__exportStar(require("../../core/hooks/use-search"), exports);
|
|
45
44
|
__exportStar(require("../../core/hooks/use-controlled-state"), exports);
|
|
46
45
|
__exportStar(require("../../core/hooks/use-codeblock-tabs-controls"), exports);
|
|
47
46
|
//# sourceMappingURL=index.js.map
|
|
@@ -17,8 +17,6 @@ function updateRecentSearches(value, isAdd) {
|
|
|
17
17
|
if (!(0, utils_1.isBrowser)())
|
|
18
18
|
return [];
|
|
19
19
|
const recentSearches = getRecentSearches();
|
|
20
|
-
if (value === '')
|
|
21
|
-
return recentSearches;
|
|
22
20
|
const valueIndex = recentSearches.indexOf(value);
|
|
23
21
|
if (valueIndex !== -1)
|
|
24
22
|
recentSearches.splice(valueIndex, 1);
|
|
@@ -3,12 +3,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.useSearch = void 0;
|
|
7
7
|
const react_1 = require("react");
|
|
8
8
|
const react_router_dom_1 = require("react-router-dom");
|
|
9
9
|
const hotkeys_js_1 = __importDefault(require("hotkeys-js"));
|
|
10
|
-
const hooks_1 = require("
|
|
11
|
-
function
|
|
10
|
+
const hooks_1 = require("../../core/hooks");
|
|
11
|
+
function useSearch() {
|
|
12
12
|
var _a, _b;
|
|
13
13
|
const [isOpen, setIsOpen] = (0, react_1.useState)(false);
|
|
14
14
|
const themeSettings = (0, hooks_1.useThemeConfig)();
|
|
@@ -40,5 +40,5 @@ function useSearchDialog() {
|
|
|
40
40
|
(0, react_1.useEffect)(onClose, [location]);
|
|
41
41
|
return { isOpen, onOpen, onClose };
|
|
42
42
|
}
|
|
43
|
-
exports.
|
|
44
|
-
//# sourceMappingURL=use-search
|
|
43
|
+
exports.useSearch = useSearch;
|
|
44
|
+
//# sourceMappingURL=use-search.js.map
|
|
@@ -2,7 +2,7 @@ import type { PageProps, ResolvedNavItemWithLink, Version } from '@redocly/confi
|
|
|
2
2
|
import type { Callback, TFunction as TFunc } from 'i18next';
|
|
3
3
|
import type { To, Location } from 'react-router-dom';
|
|
4
4
|
import type { CatalogConfig, ProductUiConfig } from '../../config';
|
|
5
|
-
import type { UserMenuData, FilteredCatalog, ItemState,
|
|
5
|
+
import type { UserMenuData, FilteredCatalog, ItemState, SearchDocument, SubmitFeedbackParams, TFunction, BreadcrumbItem, DrilldownMenuItemDetails } from '../../core/types';
|
|
6
6
|
export type ThemeHooks = {
|
|
7
7
|
useTranslate: () => {
|
|
8
8
|
translate: TFunction;
|
|
@@ -45,23 +45,11 @@ export type ThemeHooks = {
|
|
|
45
45
|
location: Location;
|
|
46
46
|
};
|
|
47
47
|
useBreadcrumbs: () => BreadcrumbItem[];
|
|
48
|
-
|
|
48
|
+
useFuseSearch: (product?: string) => {
|
|
49
49
|
query: string;
|
|
50
50
|
setQuery: React.Dispatch<React.SetStateAction<string>>;
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
items: Record<string, SearchItemData[] | null>;
|
|
54
|
-
isSearchLoading: boolean;
|
|
55
|
-
facets: SearchFacet[];
|
|
56
|
-
setLoadMore: React.Dispatch<React.SetStateAction<{
|
|
57
|
-
groupKey: string;
|
|
58
|
-
offset: number;
|
|
59
|
-
} | undefined>>;
|
|
60
|
-
};
|
|
61
|
-
useFacetQuery: (field: string) => {
|
|
62
|
-
searchFacet: SearchFacet | null;
|
|
63
|
-
setSearchFacet: React.Dispatch<React.SetStateAction<SearchFacet | null>>;
|
|
64
|
-
setSearchFacetQuery: React.Dispatch<React.SetStateAction<SearchFacetQuery | null>>;
|
|
51
|
+
items: SearchDocument[] | null;
|
|
52
|
+
isLoading: boolean;
|
|
65
53
|
};
|
|
66
54
|
useSidebarItems: (activeVersion?: Version | null) => {
|
|
67
55
|
currentItems: ItemState[];
|
|
@@ -6,7 +6,7 @@ export * from '../../core/types/hooks';
|
|
|
6
6
|
export * from '../../core/types/markdown';
|
|
7
7
|
export * from '../../core/types/navbar';
|
|
8
8
|
export * from '../../core/types/search';
|
|
9
|
-
export * from '../../core/types/select';
|
|
9
|
+
export * from '../../core/types/select-option';
|
|
10
10
|
export * from '../../core/types/sidebar';
|
|
11
11
|
export * from '../../core/types/filter';
|
|
12
12
|
export * from '../../core/types/user-menu';
|
package/lib/core/types/index.js
CHANGED
|
@@ -22,7 +22,7 @@ __exportStar(require("../../core/types/hooks"), exports);
|
|
|
22
22
|
__exportStar(require("../../core/types/markdown"), exports);
|
|
23
23
|
__exportStar(require("../../core/types/navbar"), exports);
|
|
24
24
|
__exportStar(require("../../core/types/search"), exports);
|
|
25
|
-
__exportStar(require("../../core/types/select"), exports);
|
|
25
|
+
__exportStar(require("../../core/types/select-option"), exports);
|
|
26
26
|
__exportStar(require("../../core/types/sidebar"), exports);
|
|
27
27
|
__exportStar(require("../../core/types/filter"), exports);
|
|
28
28
|
__exportStar(require("../../core/types/user-menu"), exports);
|
package/lib/core/types/l10n.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { TOptions } from 'i18next';
|
|
2
|
-
export type TranslationKey = 'dev.newApp' | 'dev.newApp.text' | 'dev.sidebar.header' | 'dev.sidebar.footer.text' | 'dev.create.app.dialog.appName.placeholder' | 'dev.create.app.dialog.appName.error' | 'dev.create.app.dialog.selectAPIs' | 'dev.create.app.dialog.description' | 'dev.create.app.dialog.description.placeholder' | 'dev.create.app.dialog.create' | 'dev.create.app.dialog.cancel' | 'dev.main.tab.appKeys' | 'dev.main.tab.logs' | 'dev.app.description.title' | 'dev.edit.description.dialog.title' | 'dev.edit.description.dialog.save' | 'dev.edit.description.dialog.cancel' | 'dev.edit.apis.dialog.selectedAPIs' | 'dev.app.key.create' | 'dev.create.key.dialog.title' | 'dev.create.key.dialog.create' | 'dev.create.key.dialog.cancel' | 'dev.app.edit' | 'dev.app.delete' | 'dev.edit.app.dialog.title' | 'dev.edit.app.dialog.save' | 'dev.edit.app.dialog.cancel' | 'dev.delete.app.dialog.title' | 'dev.delete.app.dialog.confirmation' | 'dev.delete.app.dialog.delete' | 'dev.delete.app.dialog.cancel' | 'dev.app.key.roll' | 'dev.roll.key.dialog.title' | 'dev.roll.key.dialog.apiKey' | 'dev.roll.key.dialog.expires' | 'dev.roll.key.dialog.confirmation' | 'dev.roll.key.dialog.cancel' | 'dev.roll.key.dialog.roll' | 'dev.update.key.dialog.title' | 'dev.update.key.dialog.update' | 'dev.update.key.dialog.cancel' | 'dev.app.key.api.name' | 'dev.app.key.api.status' | 'dev.app.key.api.edit' | 'dev.edit.apis.dialog.title' | 'dev.edit.apis.dialog.apiKey' | 'dev.edit.apis.dialog.save' | 'dev.edit.apis.dialog.cancel' | 'dev.select.placeholder' | 'dev.app.overview.status.pending' | 'dev.app.overview.status.approved' | 'dev.app.overview.status.revoked' | 'dev.app.overview.status' | 'dev.app.overview.non-production' | 'dev.app.overview.production' | 'dev.app.overview.clientId' | 'dev.app.overview.apiKey' | 'dev.app.key.revoke' | 'dev.revoke.key.dialog.title' | 'dev.revoke.key.dialog.apiKey' | 'dev.revoke.key.dialog.expires' | 'dev.revoke.key.dialog.confirmation' | 'dev.revoke.key.dialog.revoke' | 'dev.revoke.key.dialog.cancel' | 'dev.app.overview.expires' | 'dev.app.overview.created' | 'dev.app.overview.visibilityToggle.hide' | 'dev.app.overview.visibilityToggle.show' | 'theme.search.
|
|
2
|
+
export type TranslationKey = 'dev.newApp' | 'dev.newApp.text' | 'dev.sidebar.header' | 'dev.sidebar.footer.text' | 'dev.create.app.dialog.appName.placeholder' | 'dev.create.app.dialog.appName.error' | 'dev.create.app.dialog.selectAPIs' | 'dev.create.app.dialog.description' | 'dev.create.app.dialog.description.placeholder' | 'dev.create.app.dialog.create' | 'dev.create.app.dialog.cancel' | 'dev.main.tab.appKeys' | 'dev.main.tab.logs' | 'dev.app.description.title' | 'dev.edit.description.dialog.title' | 'dev.edit.description.dialog.save' | 'dev.edit.description.dialog.cancel' | 'dev.edit.apis.dialog.selectedAPIs' | 'dev.app.key.create' | 'dev.create.key.dialog.title' | 'dev.create.key.dialog.create' | 'dev.create.key.dialog.cancel' | 'dev.app.edit' | 'dev.app.delete' | 'dev.edit.app.dialog.title' | 'dev.edit.app.dialog.save' | 'dev.edit.app.dialog.cancel' | 'dev.delete.app.dialog.title' | 'dev.delete.app.dialog.confirmation' | 'dev.delete.app.dialog.delete' | 'dev.delete.app.dialog.cancel' | 'dev.app.key.roll' | 'dev.roll.key.dialog.title' | 'dev.roll.key.dialog.apiKey' | 'dev.roll.key.dialog.expires' | 'dev.roll.key.dialog.confirmation' | 'dev.roll.key.dialog.cancel' | 'dev.roll.key.dialog.roll' | 'dev.update.key.dialog.title' | 'dev.update.key.dialog.update' | 'dev.update.key.dialog.cancel' | 'dev.app.key.api.name' | 'dev.app.key.api.status' | 'dev.app.key.api.edit' | 'dev.edit.apis.dialog.title' | 'dev.edit.apis.dialog.apiKey' | 'dev.edit.apis.dialog.save' | 'dev.edit.apis.dialog.cancel' | 'dev.select.placeholder' | 'dev.app.overview.status.pending' | 'dev.app.overview.status.approved' | 'dev.app.overview.status.revoked' | 'dev.app.overview.status' | 'dev.app.overview.non-production' | 'dev.app.overview.production' | 'dev.app.overview.clientId' | 'dev.app.overview.apiKey' | 'dev.app.key.revoke' | 'dev.revoke.key.dialog.title' | 'dev.revoke.key.dialog.apiKey' | 'dev.revoke.key.dialog.expires' | 'dev.revoke.key.dialog.confirmation' | 'dev.revoke.key.dialog.revoke' | 'dev.revoke.key.dialog.cancel' | 'dev.app.overview.expires' | 'dev.app.overview.created' | 'dev.app.overview.visibilityToggle.hide' | 'dev.app.overview.visibilityToggle.show' | 'theme.search.noResults' | 'theme.search.keys.navigate' | 'theme.search.keys.select' | 'theme.search.keys.exit' | 'theme.search.label' | 'theme.search.cancel' | 'theme.search.recent' | 'theme.search.navbar.label' | 'theme.search.suggested' | 'theme.toc.header' | 'theme.footer.copyrightText' | 'theme.page.homeButton' | 'theme.page.forbidden.title' | 'theme.page.notFound.title' | 'theme.page.notFound.description' | 'theme.page.lastUpdated.timeago' | 'theme.page.lastUpdated.on' | 'theme.catalog.filters.placeholder' | 'theme.catalog.filters.title' | 'theme.catalog.filters.clearAll' | 'theme.catalog.filters.select.addFilter' | 'theme.catalog.filters.select.all' | 'theme.catalog.filters.done' | 'theme.sidebar.menu.backLabel' | 'theme.sidebar.actions.show' | 'theme.sidebar.actions.hide' | 'theme.sidebar.actions.changeLayout' | 'theme.versionPicker.label' | 'theme.versionPicker.unversioned' | 'theme.codeSnippet.copy.buttonText' | 'theme.codeSnippet.copy.tooltipText' | 'theme.codeSnippet.copy.toasterText' | 'theme.markdown.editPage.text' | 'theme.feedback.settings.comment.submitText' | 'theme.feedback.settings.comment.label' | 'theme.feedback.settings.comment.send' | 'theme.feedback.settings.comment.cancel' | 'theme.feedback.settings.comment.satisfiedLabel' | 'theme.feedback.settings.comment.neutralLabel' | 'theme.feedback.settings.comment.dissatisfiedLabel' | 'theme.feedback.settings.submitText' | 'theme.feedback.settings.label' | 'theme.feedback.settings.reasons.label' | 'theme.feedback.settings.reasons.send' | 'theme.feedback.settings.comment.likeLabel' | 'theme.feedback.settings.comment.dislikeLabel' | 'theme.feedback.sentiment.thumbUp' | 'theme.feedback.sentiment.thumbDown' | 'theme.feedback.settings.leftScaleLabel' | 'theme.feedback.settings.rightScaleLabel' | 'theme.codeSnippet.report.buttonText' | 'theme.codeSnippet.report.tooltipText' | 'theme.codeSnippet.report.label' | 'theme.userMenu.login' | 'theme.userMenu.logout' | 'theme.userMenu.devOnboardingLabel' | 'theme.mobileMenu.mainMenu' | 'theme.mobileMenu.previous' | 'theme.mobileMenu.products' | 'theme.page.nextButton' | 'theme.page.previousButton';
|
|
3
|
+
export type GraphQLTranslationKey = 'graphql.sidebar.group.queries' | 'graphql.sidebar.group.mutations' | 'graphql.sidebar.group.subscriptions' | 'graphql.sidebar.group.directives' | 'graphql.sidebar.group.objects' | 'graphql.sidebar.group.interfaces' | 'graphql.sidebar.group.unions' | 'graphql.sidebar.group.enums' | 'graphql.sidebar.group.inputs' | 'graphql.sidebar.group.scalars' | 'graphql.sidebar.group.scalars' | 'graphql.content.arguments.label' | 'graphql.content.arguments.show' | 'graphql.content.arguments.hide' | 'graphql.content.returnTypes.label' | 'graphql.content.returnTypes.show' | 'graphql.content.returnTypes.hide' | 'graphql.content.defaultValue' | 'graphql.content.deprecationReason' | 'graphql.content.implementedInterfaces' | 'graphql.content.argumentsHere' | 'graphql.content.nonNull' | 'graphql.content.required' | 'graphql.content.deprecated' | 'graphql.rightSection.variables' | 'graphql.rightSection.querySample' | 'graphql.rightSection.mutationSample' | 'graphql.rightSection.subscriptionSample' | 'graphql.rightSection.responseSample' | 'graphql.rightSection.locations' | 'graphql.rightSection.sample' | 'graphql.rightSection.referenced' | 'graphql.navigation.next' | 'graphql.navigation.previous';
|
|
3
4
|
export type Locale = {
|
|
4
5
|
code: string;
|
|
5
6
|
name: string;
|
|
@@ -12,9 +12,9 @@ export type SearchDocument = {
|
|
|
12
12
|
title: string | string[];
|
|
13
13
|
text: string | string[];
|
|
14
14
|
path?: string[];
|
|
15
|
-
|
|
16
|
-
httpPath?: string | string[];
|
|
15
|
+
httpVerb?: string;
|
|
17
16
|
deprecated?: boolean;
|
|
17
|
+
pathName?: string | string[];
|
|
18
18
|
parameters?: OperationParameter[];
|
|
19
19
|
metadata?: Record<string, any>;
|
|
20
20
|
version?: string;
|
|
@@ -29,45 +29,4 @@ export type SearchDocument = {
|
|
|
29
29
|
fsPath?: string;
|
|
30
30
|
};
|
|
31
31
|
badges?: ItemBadge[];
|
|
32
|
-
facets?: Record<string, string>;
|
|
33
|
-
filterTags?: string[];
|
|
34
|
-
parametersNames?: string[];
|
|
35
|
-
parametersDescriptons?: string[];
|
|
36
|
-
};
|
|
37
|
-
export type ParameterHighlight = {
|
|
38
|
-
name: string;
|
|
39
|
-
description: string;
|
|
40
|
-
place: string;
|
|
41
|
-
path: string[];
|
|
42
|
-
};
|
|
43
|
-
export type SearchItemData = {
|
|
44
|
-
document: SearchDocument;
|
|
45
|
-
highlight: Record<string, string> & {
|
|
46
|
-
parameters?: ParameterHighlight[];
|
|
47
|
-
path?: string[];
|
|
48
|
-
};
|
|
49
|
-
};
|
|
50
|
-
export type SearchFacet = {
|
|
51
|
-
name: string;
|
|
52
|
-
field: string;
|
|
53
|
-
type: SearchFacetType;
|
|
54
|
-
values: string[] | SearchFacetCount[];
|
|
55
|
-
isTop?: boolean;
|
|
56
|
-
index?: number;
|
|
57
|
-
};
|
|
58
|
-
export type SearchFacetCount = {
|
|
59
|
-
value: string;
|
|
60
|
-
count: number;
|
|
61
|
-
isCounterVisible?: boolean;
|
|
62
|
-
};
|
|
63
|
-
export type SearchFacetQuery = {
|
|
64
|
-
query: string;
|
|
65
|
-
filter: SearchFilterItem[];
|
|
66
|
-
facetQuery: string;
|
|
67
|
-
};
|
|
68
|
-
export type SearchFacetType = 'input' | 'multi-select' | 'select' | 'switch' | 'radio' | 'tags' | 'checkbox';
|
|
69
|
-
export type SearchFilterItem = {
|
|
70
|
-
field: string;
|
|
71
|
-
values: string[];
|
|
72
|
-
isTop?: boolean;
|
|
73
32
|
};
|
package/lib/index.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ export * from './components/Badge/Badge';
|
|
|
11
11
|
export * from './components/Dropdown/Dropdown';
|
|
12
12
|
export * from './components/Dropdown/DropdownMenu';
|
|
13
13
|
export * from './components/Dropdown/DropdownMenuItem';
|
|
14
|
-
export * from './components/
|
|
14
|
+
export * from './components/Loading/Loading';
|
|
15
15
|
export * from './components/Link/Link';
|
|
16
16
|
export * from './components/Portal/Portal';
|
|
17
17
|
export * from './components/Segmented/Segmented';
|
|
@@ -112,10 +112,6 @@ export * from './components/Search/SearchShortcut';
|
|
|
112
112
|
export * from './components/Search/SearchTrigger';
|
|
113
113
|
export * from './components/Search/SearchRecent';
|
|
114
114
|
export * from './components/Search/SearchSuggestedPages';
|
|
115
|
-
export * from './components/Search/SearchFilter';
|
|
116
|
-
export * from './components/Search/SearchFilterField';
|
|
117
|
-
export * from './components/Search/FilterFields/SearchFilterFieldSelect';
|
|
118
|
-
export * from './components/Search/FilterFields/SearchFilterFieldTags';
|
|
119
115
|
export * from './icons/ArrowRightIcon/ArrowRightIcon';
|
|
120
116
|
export * from './icons/ArrowUpRightIcon/ArrowUpRightIcon';
|
|
121
117
|
export * from './icons/ArrowLeftIcon/ArrowLeftIcon';
|
|
@@ -130,7 +126,6 @@ export * from './icons/FolderAddIcon/FolderAddIcon';
|
|
|
130
126
|
export * from './icons/FolderIcon/FolderIcon';
|
|
131
127
|
export * from './icons/FolderMoveToIcon/FolderMoveToIcon';
|
|
132
128
|
export * from './icons/SelectIcon/SelectIcon';
|
|
133
|
-
export * from './icons/SettingsIcon/SettingsIcon';
|
|
134
129
|
export * from './icons/CloseIcon/CloseIcon';
|
|
135
130
|
export * from './icons/CloseOutlineIcon/CloseOutlineIcon';
|
|
136
131
|
export * from './icons/CloseFilledIcon/CloseFilledIcon';
|
|
@@ -178,7 +173,6 @@ export * from './icons/MobileSidebarIcon/MobileSidebarIcon';
|
|
|
178
173
|
export * from './icons/CopyLinkIcon/CopyLinkIcon';
|
|
179
174
|
export * from './icons/OverflowMenuHorizontalIcon/OverflowMenuHorizontalIcon';
|
|
180
175
|
export * from './icons/RenewIcon/RenewIcon';
|
|
181
|
-
export * from './icons/ResetIcon/ResetIcon';
|
|
182
176
|
export * from './icons/WarningAltIcon/WarningAltIcon';
|
|
183
177
|
export * from './icons/MoonIcon/MoonIcon';
|
|
184
178
|
export * from './icons/SunIcon/SunIcon';
|
package/lib/index.js
CHANGED
|
@@ -41,7 +41,7 @@ __exportStar(require("./components/Badge/Badge"), exports);
|
|
|
41
41
|
__exportStar(require("./components/Dropdown/Dropdown"), exports);
|
|
42
42
|
__exportStar(require("./components/Dropdown/DropdownMenu"), exports);
|
|
43
43
|
__exportStar(require("./components/Dropdown/DropdownMenuItem"), exports);
|
|
44
|
-
__exportStar(require("./components/
|
|
44
|
+
__exportStar(require("./components/Loading/Loading"), exports);
|
|
45
45
|
__exportStar(require("./components/Link/Link"), exports);
|
|
46
46
|
__exportStar(require("./components/Portal/Portal"), exports);
|
|
47
47
|
__exportStar(require("./components/Segmented/Segmented"), exports);
|
|
@@ -163,10 +163,6 @@ __exportStar(require("./components/Search/SearchShortcut"), exports);
|
|
|
163
163
|
__exportStar(require("./components/Search/SearchTrigger"), exports);
|
|
164
164
|
__exportStar(require("./components/Search/SearchRecent"), exports);
|
|
165
165
|
__exportStar(require("./components/Search/SearchSuggestedPages"), exports);
|
|
166
|
-
__exportStar(require("./components/Search/SearchFilter"), exports);
|
|
167
|
-
__exportStar(require("./components/Search/SearchFilterField"), exports);
|
|
168
|
-
__exportStar(require("./components/Search/FilterFields/SearchFilterFieldSelect"), exports);
|
|
169
|
-
__exportStar(require("./components/Search/FilterFields/SearchFilterFieldTags"), exports);
|
|
170
166
|
/* Icons */
|
|
171
167
|
__exportStar(require("./icons/ArrowRightIcon/ArrowRightIcon"), exports);
|
|
172
168
|
__exportStar(require("./icons/ArrowUpRightIcon/ArrowUpRightIcon"), exports);
|
|
@@ -182,7 +178,6 @@ __exportStar(require("./icons/FolderAddIcon/FolderAddIcon"), exports);
|
|
|
182
178
|
__exportStar(require("./icons/FolderIcon/FolderIcon"), exports);
|
|
183
179
|
__exportStar(require("./icons/FolderMoveToIcon/FolderMoveToIcon"), exports);
|
|
184
180
|
__exportStar(require("./icons/SelectIcon/SelectIcon"), exports);
|
|
185
|
-
__exportStar(require("./icons/SettingsIcon/SettingsIcon"), exports);
|
|
186
181
|
__exportStar(require("./icons/CloseIcon/CloseIcon"), exports);
|
|
187
182
|
__exportStar(require("./icons/CloseOutlineIcon/CloseOutlineIcon"), exports);
|
|
188
183
|
__exportStar(require("./icons/CloseFilledIcon/CloseFilledIcon"), exports);
|
|
@@ -230,7 +225,6 @@ __exportStar(require("./icons/MobileSidebarIcon/MobileSidebarIcon"), exports);
|
|
|
230
225
|
__exportStar(require("./icons/CopyLinkIcon/CopyLinkIcon"), exports);
|
|
231
226
|
__exportStar(require("./icons/OverflowMenuHorizontalIcon/OverflowMenuHorizontalIcon"), exports);
|
|
232
227
|
__exportStar(require("./icons/RenewIcon/RenewIcon"), exports);
|
|
233
|
-
__exportStar(require("./icons/ResetIcon/ResetIcon"), exports);
|
|
234
228
|
__exportStar(require("./icons/WarningAltIcon/WarningAltIcon"), exports);
|
|
235
229
|
__exportStar(require("./icons/MoonIcon/MoonIcon"), exports);
|
|
236
230
|
__exportStar(require("./icons/SunIcon/SunIcon"), exports);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@redocly/theme",
|
|
3
|
-
"version": "0.41.0
|
|
3
|
+
"version": "0.41.0",
|
|
4
4
|
"description": "Shared UI components lib",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"theme",
|
|
@@ -99,7 +99,7 @@
|
|
|
99
99
|
"timeago.js": "^4.0.2",
|
|
100
100
|
"i18next": "^22.4.12",
|
|
101
101
|
"nprogress": "^0.2.0",
|
|
102
|
-
"@redocly/config": "0.11.0
|
|
102
|
+
"@redocly/config": "0.11.0"
|
|
103
103
|
},
|
|
104
104
|
"scripts": {
|
|
105
105
|
"start": "npm-run-all --parallel storybook storybook:tokens:watch",
|
|
@@ -7,7 +7,7 @@ import type { DropdownMenuItemProps } from '@redocly/theme/components/Dropdown/D
|
|
|
7
7
|
import { DropdownMenuItem } from '@redocly/theme/components/Dropdown/DropdownMenuItem';
|
|
8
8
|
|
|
9
9
|
export type DropdownMenuProps =
|
|
10
|
-
| { className?: string; role?: string
|
|
10
|
+
| { className?: string; role?: string } & (
|
|
11
11
|
| {
|
|
12
12
|
items: DropdownMenuItemProps[];
|
|
13
13
|
}
|
|
@@ -37,7 +37,6 @@ export function DropdownMenu(props: DropdownMenuProps): JSX.Element {
|
|
|
37
37
|
role={props.role || 'menu'}
|
|
38
38
|
>
|
|
39
39
|
{content}
|
|
40
|
-
{props.footer || null}
|
|
41
40
|
</DropdownMenuWrapper>
|
|
42
41
|
);
|
|
43
42
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
|
|
4
|
-
import type { FilterProps
|
|
4
|
+
import type { FilterProps } 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: { value: string; element: React.ReactNode }[] = [];
|
|
19
19
|
|
|
20
20
|
const defaultOptionCount = filter.filteredOptions.reduce((acc, option) => acc + option.count, 0);
|
|
21
21
|
|
|
@@ -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)`
|
|
68
68
|
--select-list-max-width: var(--filter-select-max-width);
|
|
69
69
|
|
|
70
70
|
min-height: var(--filter-select-min-height);
|
|
@@ -3,14 +3,14 @@ import styled from 'styled-components';
|
|
|
3
3
|
|
|
4
4
|
import { SearchTrigger } from '@redocly/theme/components/Search/SearchTrigger';
|
|
5
5
|
import { SearchDialog } from '@redocly/theme/components/Search/SearchDialog';
|
|
6
|
-
import {
|
|
6
|
+
import { useSearch } from '@redocly/theme/core/hooks';
|
|
7
7
|
|
|
8
8
|
export type SearchProps = {
|
|
9
9
|
className?: string;
|
|
10
10
|
};
|
|
11
11
|
|
|
12
12
|
export function Search({ className }: SearchProps): JSX.Element {
|
|
13
|
-
const { isOpen, onOpen, onClose } =
|
|
13
|
+
const { isOpen, onOpen, onClose } = useSearch();
|
|
14
14
|
|
|
15
15
|
return (
|
|
16
16
|
<SearchWrapper data-component-name="Search/Search" className={className}>
|