@redocly/theme 0.37.1 → 0.37.3

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.
@@ -26,7 +26,7 @@ function Catalog(props) {
26
26
  return (react_1.default.createElement(CatalogHighlight_1.HighlightContext.Provider, { value: [filterTerm] },
27
27
  react_1.default.createElement(exports.CatalogPageWrapper, { "data-component-name": "Catalog/Catalog", withoutFilters: !filters.length },
28
28
  react_1.default.createElement(FiltersSidebar, { menu: react_1.default.createElement(FilterContent_1.FilterContent, { setFilterTerm: setFilterTerm, filters: filters, filterTerm: filterTerm, filterValuesCasing: catalogConfig.filterValuesCasing }) }),
29
- filterPopoverVisible && (react_1.default.createElement(FilterPopover_1.FilterPopover, { onClose: () => setFilterPopoverVisible(false), filters: filters, filterValuesCasing: catalogConfig.filterValuesCasing })),
29
+ filterPopoverVisible && (react_1.default.createElement(FilterPopover_1.FilterPopover, { onClose: () => setFilterPopoverVisible(false), setFilterTerm: setFilterTerm, filterTerm: filterTerm, filters: filters, filterValuesCasing: catalogConfig.filterValuesCasing })),
30
30
  react_1.default.createElement(CatalogActions_1.CatalogActions, { onOpenFilter: () => setFilterPopoverVisible(true), filters: filters, filterTerm: filterTerm }),
31
31
  react_1.default.createElement(exports.CatalogPageContent, null,
32
32
  react_1.default.createElement(exports.CatalogPageDescriptionWrapper, null,
@@ -4,5 +4,7 @@ export type FilterPopoverProps = {
4
4
  onClose: () => void;
5
5
  filters: ResolvedFilter[];
6
6
  filterValuesCasing?: NonNullable<ThemeConfig['catalog']>[string]['filterValuesCasing'];
7
+ filterTerm: string;
8
+ setFilterTerm: (term: string) => void;
7
9
  };
8
- export declare function FilterPopover({ onClose, filters, filterValuesCasing, }: FilterPopoverProps): JSX.Element;
10
+ export declare function FilterPopover({ onClose, filters, filterValuesCasing, filterTerm, setFilterTerm, }: FilterPopoverProps): JSX.Element;
@@ -9,8 +9,7 @@ const styled_components_1 = __importDefault(require("styled-components"));
9
9
  const utils_1 = require("../../core/utils");
10
10
  const hooks_1 = require("../../core/hooks");
11
11
  const FilterContent_1 = require("../../components/Filter/FilterContent");
12
- function FilterPopover({ onClose, filters, filterValuesCasing, }) {
13
- const [filterTerm, setFilterTerm] = react_1.default.useState('');
12
+ function FilterPopover({ onClose, filters, filterValuesCasing, filterTerm, setFilterTerm, }) {
14
13
  const { useTranslate } = (0, hooks_1.useThemeHooks)();
15
14
  const { translate } = useTranslate();
16
15
  return (react_1.default.createElement(FilterPopoverWrapper, { "data-component-name": "Filter/FilterPopover" },
@@ -11,7 +11,7 @@ const hooks_1 = require("../../../core/hooks");
11
11
  function Tabs({ children, className }) {
12
12
  var _a, _b;
13
13
  const childrenArray = react_1.default.Children.toArray(children);
14
- const initialTab = (_b = (_a = children[0]) === null || _a === void 0 ? void 0 : _a.props.label) !== null && _b !== void 0 ? _b : '';
14
+ const initialTab = (_b = (_a = childrenArray[0]) === null || _a === void 0 ? void 0 : _a.props.label) !== null && _b !== void 0 ? _b : '';
15
15
  const { activeTab, setTabRef, onTabClick, handleKeyboard, getTabId } = (0, hooks_1.useTabs)({
16
16
  initialTab,
17
17
  totalTabs: childrenArray.length,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redocly/theme",
3
- "version": "0.37.1",
3
+ "version": "0.37.3",
4
4
  "description": "Shared UI components lib",
5
5
  "keywords": [
6
6
  "theme",
@@ -47,6 +47,8 @@ export default function Catalog(props: CatalogProps): JSX.Element {
47
47
  {filterPopoverVisible && (
48
48
  <FilterPopover
49
49
  onClose={() => setFilterPopoverVisible(false)}
50
+ setFilterTerm={setFilterTerm}
51
+ filterTerm={filterTerm}
50
52
  filters={filters}
51
53
  filterValuesCasing={catalogConfig.filterValuesCasing}
52
54
  />
@@ -12,15 +12,17 @@ export type FilterPopoverProps = {
12
12
  onClose: () => void;
13
13
  filters: ResolvedFilter[];
14
14
  filterValuesCasing?: NonNullable<ThemeConfig['catalog']>[string]['filterValuesCasing'];
15
+ filterTerm: string;
16
+ setFilterTerm: (term: string) => void;
15
17
  };
16
18
 
17
19
  export function FilterPopover({
18
20
  onClose,
19
21
  filters,
20
22
  filterValuesCasing,
23
+ filterTerm,
24
+ setFilterTerm,
21
25
  }: FilterPopoverProps): JSX.Element {
22
- const [filterTerm, setFilterTerm] = React.useState('');
23
-
24
26
  const { useTranslate } = useThemeHooks();
25
27
  const { translate } = useTranslate();
26
28
 
@@ -10,7 +10,7 @@ type TabsProps = React.PropsWithChildren<{ children: Child[]; className?: string
10
10
  export function Tabs({ children, className }: TabsProps): JSX.Element {
11
11
  const childrenArray = React.Children.toArray(children) as React.ReactElement[];
12
12
 
13
- const initialTab = children[0]?.props.label ?? '';
13
+ const initialTab = childrenArray[0]?.props.label ?? '';
14
14
  const { activeTab, setTabRef, onTabClick, handleKeyboard, getTabId } = useTabs({
15
15
  initialTab,
16
16
  totalTabs: childrenArray.length,