@redocly/theme 0.58.0-next.8 → 0.58.0-next.9

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.
@@ -11,6 +11,7 @@ const utils_1 = require("../../core/utils");
11
11
  const hooks_1 = require("../../core/hooks");
12
12
  const H2_1 = require("../../components/Typography/H2");
13
13
  const FilterContent_1 = require("../../components/Filter/FilterContent");
14
+ const FilterInput_1 = require("../../components/Filter/FilterInput");
14
15
  const FilterPopover_1 = require("../../components/Filter/FilterPopover");
15
16
  const CatalogClassicHighlight_1 = require("../../components/CatalogClassic/CatalogClassicHighlight");
16
17
  const CatalogClassicActions_1 = require("../../components/CatalogClassic/CatalogClassicActions");
@@ -25,7 +26,7 @@ function CatalogClassic(props) {
25
26
  (0, hooks_1.useModalScrollLock)(filterPopoverVisible);
26
27
  return (react_1.default.createElement(CatalogClassicHighlight_1.HighlightContext.Provider, { value: [filterTerm] },
27
28
  react_1.default.createElement(exports.CatalogPageWrapper, { "data-component-name": "CatalogClassic/CatalogClassic", withoutFilters: !filters.length },
28
- react_1.default.createElement(FiltersSidebar, { menu: react_1.default.createElement(FilterContent_1.FilterContent, { setFilterTerm: setFilterTerm, filters: filters, filterTerm: filterTerm, filterValuesCasing: catalogConfig.filterValuesCasing }) }),
29
+ Boolean(filters.length) && (react_1.default.createElement(FiltersSidebar, { menu: react_1.default.createElement(FilterContent_1.FilterContent, { setFilterTerm: setFilterTerm, filters: filters, filterTerm: filterTerm, filterValuesCasing: catalogConfig.filterValuesCasing }) })),
29
30
  filterPopoverVisible && (react_1.default.createElement(FilterPopover_1.FilterPopover, { onClose: () => setFilterPopoverVisible(false), setFilterTerm: setFilterTerm, filterTerm: filterTerm, filters: filters, filterValuesCasing: catalogConfig.filterValuesCasing })),
30
31
  react_1.default.createElement(CatalogClassicActions_1.CatalogClassicActions, { onOpenFilter: () => setFilterPopoverVisible(true), filters: filters, filterTerm: filterTerm }),
31
32
  react_1.default.createElement(exports.CatalogPageContent, null,
@@ -37,7 +38,9 @@ function CatalogClassic(props) {
37
38
  catalogConfig.description ? (react_1.default.createElement(exports.CatalogDescription, { "data-translation-key": catalogConfig.descriptionTranslationKey },
38
39
  ' ',
39
40
  translate(catalogConfig.descriptionTranslationKey, catalogConfig.description),
40
- ' ')) : null),
41
+ ' ')) : null,
42
+ !filters.length && (react_1.default.createElement(CatalogSearchWrapper, null,
43
+ react_1.default.createElement(FilterInput_1.FilterInput, { value: filterTerm, onChange: (updatedTerm) => setFilterTerm(updatedTerm) })))),
41
44
  react_1.default.createElement(CatalogClassicVirtualizedGroups_1.CatalogClassicVirtualizedGroups, { groups: groups, filters: filters, filterTerm: filterTerm })))));
42
45
  }
43
46
  exports.CatalogPageContent = styled_components_1.default.main `
@@ -110,4 +113,8 @@ const FiltersSidebar = (0, styled_components_1.default)(Sidebar_1.Sidebar) `
110
113
  }
111
114
  --menu-container-padding-top: 0;
112
115
  `;
116
+ const CatalogSearchWrapper = styled_components_1.default.div `
117
+ margin-top: var(--spacing-base);
118
+ max-width: 300px;
119
+ `;
113
120
  //# sourceMappingURL=CatalogClassic.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redocly/theme",
3
- "version": "0.58.0-next.8",
3
+ "version": "0.58.0-next.9",
4
4
  "description": "Shared UI components lib",
5
5
  "keywords": [
6
6
  "theme",
@@ -88,7 +88,7 @@
88
88
  "react-calendar": "5.1.0",
89
89
  "react-date-picker": "11.0.0",
90
90
  "@redocly/config": "0.35.0",
91
- "@redocly/realm-asyncapi-sdk": "0.4.0-next.3"
91
+ "@redocly/realm-asyncapi-sdk": "0.4.0-next.4"
92
92
  },
93
93
  "scripts": {
94
94
  "watch": "tsc -p tsconfig.build.json && (concurrently \"tsc -w -p tsconfig.build.json\" \"tsc-alias -w -p tsconfig.build.json\")",
@@ -8,6 +8,7 @@ import { breakpoints } from '@redocly/theme/core/utils';
8
8
  import { useThemeHooks, useModalScrollLock } from '@redocly/theme/core/hooks';
9
9
  import { H2 } from '@redocly/theme/components/Typography/H2';
10
10
  import { FilterContent } from '@redocly/theme/components/Filter/FilterContent';
11
+ import { FilterInput } from '@redocly/theme/components/Filter/FilterInput';
11
12
  import { FilterPopover } from '@redocly/theme/components/Filter/FilterPopover';
12
13
  import { HighlightContext } from '@redocly/theme/components/CatalogClassic/CatalogClassicHighlight';
13
14
  import { CatalogClassicActions } from '@redocly/theme/components/CatalogClassic/CatalogClassicActions';
@@ -37,16 +38,18 @@ export default function CatalogClassic(props: CatalogClassicProps): JSX.Element
37
38
  data-component-name="CatalogClassic/CatalogClassic"
38
39
  withoutFilters={!filters.length}
39
40
  >
40
- <FiltersSidebar
41
- menu={
42
- <FilterContent
43
- setFilterTerm={setFilterTerm}
44
- filters={filters}
45
- filterTerm={filterTerm}
46
- filterValuesCasing={catalogConfig.filterValuesCasing}
47
- />
48
- }
49
- />
41
+ {Boolean(filters.length) && (
42
+ <FiltersSidebar
43
+ menu={
44
+ <FilterContent
45
+ setFilterTerm={setFilterTerm}
46
+ filters={filters}
47
+ filterTerm={filterTerm}
48
+ filterValuesCasing={catalogConfig.filterValuesCasing}
49
+ />
50
+ }
51
+ />
52
+ )}
50
53
  {filterPopoverVisible && (
51
54
  <FilterPopover
52
55
  onClose={() => setFilterPopoverVisible(false)}
@@ -75,6 +78,14 @@ export default function CatalogClassic(props: CatalogClassicProps): JSX.Element
75
78
  {translate(catalogConfig.descriptionTranslationKey, catalogConfig.description)}{' '}
76
79
  </CatalogDescription>
77
80
  ) : null}
81
+ {!filters.length && (
82
+ <CatalogSearchWrapper>
83
+ <FilterInput
84
+ value={filterTerm}
85
+ onChange={(updatedTerm) => setFilterTerm(updatedTerm)}
86
+ />
87
+ </CatalogSearchWrapper>
88
+ )}
78
89
  </CatalogPageDescriptionWrapper>
79
90
 
80
91
  <CatalogClassicVirtualizedGroups
@@ -163,3 +174,8 @@ const FiltersSidebar = styled(Sidebar)`
163
174
  }
164
175
  --menu-container-padding-top: 0;
165
176
  `;
177
+
178
+ const CatalogSearchWrapper = styled.div`
179
+ margin-top: var(--spacing-base);
180
+ max-width: 300px;
181
+ `;