@databiosphere/findable-ui 40.0.0 → 41.0.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/.release-please-manifest.json +1 -1
- package/CHANGELOG.md +22 -0
- package/lib/common/entities.d.ts +8 -0
- package/lib/common/entities.js +4 -1
- package/lib/components/DataDictionary/components/Description/description.js +2 -2
- package/lib/components/DataDictionary/components/Description/description.styles.d.ts +1 -1
- package/lib/components/DataDictionary/components/Description/description.styles.js +2 -2
- package/lib/components/DataDictionary/components/Entity/entity.styles.js +5 -0
- package/lib/components/DataDictionary/components/Filters/components/ColumnFilterTags/columnFilterTags.js +4 -1
- package/lib/components/DataDictionary/components/Filters/components/ColumnFilters/columnFilters.js +6 -1
- package/lib/components/DataDictionary/components/Filters/filters.styles.js +0 -5
- package/lib/components/DataDictionary/components/Filters/stories/constants.d.ts +1 -0
- package/lib/components/DataDictionary/components/Filters/stories/constants.js +1 -0
- package/lib/components/DataDictionary/components/Filters/stories/filters.stories.js +9 -3
- package/lib/components/DataDictionary/components/Filters/stories/utils.d.ts +7 -0
- package/lib/components/DataDictionary/components/Filters/stories/utils.js +12 -0
- package/lib/components/DataDictionary/components/Layout/components/EntitiesLayout/entitiesLayout.styles.js +2 -2
- package/lib/components/DataDictionary/components/Layout/components/FiltersLayout/filtersLayout.styles.js +6 -2
- package/lib/components/DataDictionary/components/Layout/components/OutlineLayout/outlineLayout.styles.js +2 -2
- package/lib/components/DataDictionary/components/Layout/components/TitleLayout/titleLayout.styles.js +6 -2
- package/lib/components/DataDictionary/components/Table/table.js +7 -4
- package/lib/components/DataDictionary/components/Table/table.styles.d.ts +1 -1
- package/lib/components/DataDictionary/components/Table/table.styles.js +2 -2
- package/lib/components/DataDictionary/components/Title/title.styles.js +2 -2
- package/lib/components/DataDictionary/dataDictionary.styles.d.ts +0 -1
- package/lib/components/DataDictionary/dataDictionary.styles.js +8 -8
- package/lib/components/Detail/components/Table/components/TableRows/components/CollapsableRows/collapsableRows.js +2 -2
- package/lib/components/Filter/components/Filter/filter.d.ts +3 -2
- package/lib/components/Filter/components/Filter/filter.js +13 -11
- package/lib/components/Filter/components/Filter/filter.styles.d.ts +3 -5
- package/lib/components/Filter/components/Filter/filter.styles.js +16 -19
- package/lib/components/Filter/components/Filter/stories/args.js +3 -2
- package/lib/components/Filter/components/FilterLabel/filterLabel.d.ts +3 -1
- package/lib/components/Filter/components/FilterLabel/filterLabel.js +3 -3
- package/lib/components/Filter/components/FilterLabel/filterLabel.stories.d.ts +3 -1
- package/lib/components/Filter/components/FilterLabel/filterLabel.stories.js +2 -0
- package/lib/components/Filter/components/FilterLabel/filterLabel.styles.d.ts +3 -6
- package/lib/components/Filter/components/FilterLabel/filterLabel.styles.js +16 -13
- package/lib/components/Filter/components/FilterList/filterList.styles.d.ts +1 -1
- package/lib/components/Filter/components/FilterList/filterList.styles.js +1 -1
- package/lib/components/Filter/components/FilterMenu/filterMenu.d.ts +3 -2
- package/lib/components/Filter/components/FilterMenu/filterMenu.js +11 -11
- package/lib/components/Filter/components/FilterMenu/filterMenu.stories.d.ts +3 -2
- package/lib/components/Filter/components/FilterMenu/filterMenu.stories.js +2 -1
- package/lib/components/Filter/components/FilterMenu/filterMenu.styles.d.ts +2 -6
- package/lib/components/Filter/components/FilterMenu/filterMenu.styles.js +7 -17
- package/lib/components/Filter/components/FilterMenuSearch/filterMenuSearch.d.ts +3 -1
- package/lib/components/Filter/components/FilterMenuSearch/filterMenuSearch.js +3 -3
- package/lib/components/Filter/components/FilterMenuSearch/filterMenuSearch.styles.d.ts +3 -2
- package/lib/components/Filter/components/FilterMenuSearch/filterMenuSearch.styles.js +9 -5
- package/lib/components/Filter/components/FilterRange/filterRange.d.ts +1 -1
- package/lib/components/Filter/components/FilterRange/filterRange.js +7 -8
- package/lib/components/Filter/components/FilterRange/filterRange.styles.d.ts +2 -1
- package/lib/components/Filter/components/FilterRange/filterRange.styles.js +20 -16
- package/lib/components/Filter/components/FilterRange/stories/args.js +2 -1
- package/lib/components/Filter/components/FilterRange/types.d.ts +2 -1
- package/lib/components/Filter/components/Filters/filters.d.ts +5 -2
- package/lib/components/Filter/components/Filters/filters.js +7 -8
- package/lib/components/Filter/components/Filters/filters.styles.d.ts +6 -5
- package/lib/components/Filter/components/Filters/filters.styles.js +11 -11
- package/lib/components/Filter/components/SearchAllFilters/components/VariableSizeList/VariableSizeList.js +2 -2
- package/lib/components/Filter/components/VariableSizeList/VariableSizeList.d.ts +3 -2
- package/lib/components/Filter/components/VariableSizeList/VariableSizeList.js +9 -8
- package/lib/components/Filter/components/adapters/tanstack/ColumnFiltersAdapter/columnFiltersAdapter.d.ts +3 -0
- package/lib/components/Filter/components/adapters/tanstack/ColumnFiltersAdapter/columnFiltersAdapter.js +24 -0
- package/lib/components/Filter/components/adapters/tanstack/ColumnFiltersAdapter/types.d.ts +6 -0
- package/lib/components/Filter/components/adapters/tanstack/ColumnFiltersAdapter/types.js +1 -0
- package/lib/components/Filter/components/adapters/tanstack/ColumnFiltersAdapter/utils.d.ts +14 -0
- package/lib/components/Filter/components/adapters/tanstack/ColumnFiltersAdapter/utils.js +67 -0
- package/lib/components/Filter/components/controls/Controls/controls.d.ts +6 -0
- package/lib/components/Filter/components/controls/Controls/controls.js +14 -0
- package/lib/components/Filter/components/controls/Controls/controls.styles.d.ts +7 -0
- package/lib/components/Filter/components/controls/Controls/controls.styles.js +9 -0
- package/lib/components/Filter/components/surfaces/drawer/Drawer/constants.d.ts +2 -0
- package/lib/components/Filter/components/surfaces/drawer/Drawer/constants.js +5 -0
- package/lib/components/Filter/components/surfaces/drawer/Drawer/drawer.d.ts +2 -0
- package/lib/components/Filter/components/surfaces/drawer/Drawer/drawer.js +17 -0
- package/lib/components/Filter/components/surfaces/drawer/Drawer/drawer.styles.d.ts +3 -0
- package/lib/components/Filter/components/surfaces/drawer/Drawer/drawer.styles.js +19 -0
- package/lib/components/Filter/components/surfaces/drawer/Drawer/types.d.ts +7 -0
- package/lib/components/Filter/components/surfaces/drawer/Drawer/types.js +1 -0
- package/lib/components/Filter/components/surfaces/drawer/components/Button/button.d.ts +7 -0
- package/lib/components/Filter/components/surfaces/drawer/components/Button/button.js +16 -0
- package/lib/components/Filter/components/surfaces/drawer/components/ButtonBase/buttonBase.d.ts +6 -0
- package/lib/components/Filter/components/surfaces/drawer/components/ButtonBase/buttonBase.js +14 -0
- package/lib/components/Filter/components/surfaces/drawer/components/ButtonBase/buttonBase.styles.d.ts +5 -0
- package/lib/components/Filter/components/surfaces/drawer/components/ButtonBase/buttonBase.styles.js +12 -0
- package/lib/components/Filter/components/surfaces/drawer/components/IconButton/constants.d.ts +3 -0
- package/lib/components/Filter/components/surfaces/drawer/components/IconButton/constants.js +9 -0
- package/lib/components/Filter/components/surfaces/drawer/components/IconButton/iconButton.d.ts +6 -0
- package/lib/components/Filter/components/surfaces/drawer/components/IconButton/iconButton.js +13 -0
- package/lib/components/Filter/components/surfaces/drawer/components/IconButton/iconButton.styles.d.ts +5 -0
- package/lib/components/Filter/components/surfaces/drawer/components/IconButton/iconButton.styles.js +9 -0
- package/lib/components/Filter/components/surfaces/types.d.ts +11 -0
- package/lib/components/Filter/components/surfaces/types.js +5 -0
- package/lib/components/Filter/components/views/select/SelectListItem/selectListItem.d.ts +3 -0
- package/lib/components/Filter/components/views/select/SelectListItem/selectListItem.js +9 -0
- package/lib/components/Filter/components/views/select/SelectListItem/types.d.ts +12 -0
- package/lib/components/Filter/components/views/select/SelectListItem/types.js +1 -0
- package/lib/components/Filter/components/views/select/components/Checkbox/checkbox.d.ts +3 -0
- package/lib/components/Filter/components/views/select/components/Checkbox/checkbox.js +7 -0
- package/lib/components/Filter/components/views/select/components/ListItemButton/listItemButton.d.ts +7 -0
- package/lib/components/Filter/components/views/select/components/ListItemButton/listItemButton.js +5 -0
- package/lib/components/Filter/components/views/select/components/ListItemButton/listItemButton.styles.d.ts +5 -0
- package/lib/components/Filter/components/views/select/components/ListItemButton/listItemButton.styles.js +11 -0
- package/lib/components/Filter/components/views/select/components/ListItemText/components/Count/count.d.ts +3 -0
- package/lib/components/Filter/components/views/select/components/ListItemText/components/Count/count.js +6 -0
- package/lib/components/Filter/components/views/select/components/ListItemText/components/Term/term.d.ts +3 -0
- package/lib/components/Filter/components/views/select/components/ListItemText/components/Term/term.js +6 -0
- package/lib/components/Filter/components/views/select/components/ListItemText/listItemText.d.ts +3 -0
- package/lib/components/Filter/components/views/select/components/ListItemText/listItemText.js +26 -0
- package/lib/components/Filter/components/views/select/components/ListItemText/listItemText.styles.d.ts +3 -0
- package/lib/components/Filter/components/views/select/components/ListItemText/listItemText.styles.js +12 -0
- package/lib/components/Table/components/TableFeatures/ColumnFilter/columnFilter.js +23 -8
- package/lib/components/Table/components/TableFeatures/ColumnFilter/constants.js +5 -0
- package/lib/components/common/Button/constants.js +4 -0
- package/lib/components/common/Drawer/provider/provider.d.ts +2 -4
- package/lib/components/common/Drawer/provider/provider.js +4 -2
- package/lib/components/common/Drawer/provider/types.d.ts +5 -1
- package/lib/hooks/useCategoryFilter.d.ts +2 -2
- package/lib/styles/common/mixins/breakpoints.d.ts +2 -0
- package/lib/styles/common/mixins/breakpoints.js +2 -0
- package/lib/styles/common/mui/typography.js +2 -0
- package/lib/utils/typeGuards.d.ts +6 -0
- package/lib/utils/typeGuards.js +8 -0
- package/lib/views/ExploreView/exploreView.js +4 -1
- package/package.json +1 -1
- package/src/common/entities.ts +10 -0
- package/src/components/DataDictionary/components/Description/description.styles.ts +2 -2
- package/src/components/DataDictionary/components/Description/description.tsx +3 -6
- package/src/components/DataDictionary/components/Entity/entity.styles.ts +5 -0
- package/src/components/DataDictionary/components/Filters/components/ColumnFilterTags/columnFilterTags.tsx +4 -1
- package/src/components/DataDictionary/components/Filters/components/ColumnFilters/columnFilters.tsx +12 -1
- package/src/components/DataDictionary/components/Filters/filters.styles.ts +0 -5
- package/src/components/DataDictionary/components/Filters/stories/constants.ts +2 -0
- package/src/components/DataDictionary/components/Filters/stories/filters.stories.tsx +11 -4
- package/src/components/DataDictionary/components/Filters/stories/utils.ts +15 -0
- package/src/components/DataDictionary/components/Layout/components/EntitiesLayout/entitiesLayout.styles.ts +2 -2
- package/src/components/DataDictionary/components/Layout/components/FiltersLayout/filtersLayout.styles.ts +9 -2
- package/src/components/DataDictionary/components/Layout/components/OutlineLayout/outlineLayout.styles.ts +2 -2
- package/src/components/DataDictionary/components/Layout/components/TitleLayout/titleLayout.styles.ts +9 -2
- package/src/components/DataDictionary/components/Table/table.styles.ts +2 -2
- package/src/components/DataDictionary/components/Table/table.tsx +8 -4
- package/src/components/DataDictionary/components/Title/title.styles.ts +2 -2
- package/src/components/DataDictionary/dataDictionary.styles.ts +11 -9
- package/src/components/Detail/components/Table/components/TableRows/components/CollapsableRows/collapsableRows.tsx +1 -1
- package/src/components/Filter/components/Filter/filter.styles.ts +18 -20
- package/src/components/Filter/components/Filter/filter.tsx +17 -19
- package/src/components/Filter/components/Filter/stories/args.ts +3 -2
- package/src/components/Filter/components/FilterLabel/filterLabel.stories.tsx +2 -0
- package/src/components/Filter/components/FilterLabel/filterLabel.styles.ts +20 -19
- package/src/components/Filter/components/FilterLabel/filterLabel.tsx +7 -3
- package/src/components/Filter/components/FilterList/filterList.styles.ts +1 -1
- package/src/components/Filter/components/FilterMenu/filterMenu.stories.tsx +2 -1
- package/src/components/Filter/components/FilterMenu/filterMenu.styles.ts +9 -18
- package/src/components/Filter/components/FilterMenu/filterMenu.tsx +15 -19
- package/src/components/Filter/components/FilterMenuSearch/filterMenuSearch.styles.ts +11 -5
- package/src/components/Filter/components/FilterMenuSearch/filterMenuSearch.tsx +5 -1
- package/src/components/Filter/components/FilterRange/filterRange.styles.ts +25 -19
- package/src/components/Filter/components/FilterRange/filterRange.tsx +8 -12
- package/src/components/Filter/components/FilterRange/stories/args.ts +2 -1
- package/src/components/Filter/components/FilterRange/types.ts +2 -1
- package/src/components/Filter/components/Filters/filters.styles.ts +16 -16
- package/src/components/Filter/components/Filters/filters.tsx +19 -13
- package/src/components/Filter/components/SearchAllFilters/components/VariableSizeList/VariableSizeList.tsx +2 -2
- package/src/components/Filter/components/VariableSizeList/VariableSizeList.tsx +10 -9
- package/src/components/Filter/components/adapters/tanstack/ColumnFiltersAdapter/columnFiltersAdapter.tsx +44 -0
- package/src/components/Filter/components/adapters/tanstack/ColumnFiltersAdapter/types.ts +7 -0
- package/src/components/Filter/components/adapters/tanstack/ColumnFiltersAdapter/utils.ts +90 -0
- package/src/components/Filter/components/controls/Controls/controls.styles.ts +10 -0
- package/src/components/Filter/components/controls/Controls/controls.tsx +31 -0
- package/src/components/Filter/components/surfaces/drawer/Drawer/constants.ts +7 -0
- package/src/components/Filter/components/surfaces/drawer/Drawer/drawer.styles.ts +20 -0
- package/src/components/Filter/components/surfaces/drawer/Drawer/drawer.tsx +46 -0
- package/src/components/Filter/components/surfaces/drawer/Drawer/types.ts +11 -0
- package/src/components/Filter/components/surfaces/drawer/components/Button/button.tsx +40 -0
- package/src/components/Filter/components/surfaces/drawer/components/ButtonBase/buttonBase.styles.ts +13 -0
- package/src/components/Filter/components/surfaces/drawer/components/ButtonBase/buttonBase.tsx +25 -0
- package/src/components/Filter/components/surfaces/drawer/components/IconButton/constants.ts +12 -0
- package/src/components/Filter/components/surfaces/drawer/components/IconButton/iconButton.styles.ts +10 -0
- package/src/components/Filter/components/surfaces/drawer/components/IconButton/iconButton.tsx +28 -0
- package/src/components/Filter/components/surfaces/types.ts +13 -0
- package/src/components/Filter/components/views/select/SelectListItem/selectListItem.tsx +19 -0
- package/src/components/Filter/components/views/select/SelectListItem/types.ts +14 -0
- package/src/components/Filter/components/views/select/components/Checkbox/checkbox.tsx +19 -0
- package/src/components/Filter/components/views/select/components/ListItemButton/listItemButton.styles.ts +12 -0
- package/src/components/Filter/components/views/select/components/ListItemButton/listItemButton.tsx +25 -0
- package/src/components/Filter/components/views/select/components/ListItemText/components/Count/count.tsx +20 -0
- package/src/components/Filter/components/views/select/components/ListItemText/components/Term/term.tsx +19 -0
- package/src/components/Filter/components/views/select/components/ListItemText/listItemText.styles.ts +13 -0
- package/src/components/Filter/components/views/select/components/ListItemText/listItemText.tsx +48 -0
- package/src/components/Table/components/TableFeatures/ColumnFilter/columnFilter.tsx +34 -35
- package/src/components/Table/components/TableFeatures/ColumnFilter/constants.ts +5 -0
- package/src/components/common/Button/constants.ts +4 -0
- package/src/components/common/Drawer/provider/provider.tsx +7 -8
- package/src/components/common/Drawer/provider/types.ts +6 -4
- package/src/hooks/useCategoryFilter.ts +2 -1
- package/src/styles/common/mixins/breakpoints.ts +6 -0
- package/src/styles/common/mui/typography.ts +2 -0
- package/src/utils/typeGuards.ts +8 -0
- package/src/views/ExploreView/exploreView.tsx +4 -0
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
import { SURFACE_TYPE } from "../surfaces/types";
|
|
2
3
|
import { FilterLabel } from "./filterLabel";
|
|
3
4
|
const meta = {
|
|
4
5
|
argTypes: {
|
|
@@ -22,5 +23,6 @@ export const FilterLabelStory = {
|
|
|
22
23
|
isOpen: false,
|
|
23
24
|
label: "Label",
|
|
24
25
|
onClick: () => { },
|
|
26
|
+
surfaceType: SURFACE_TYPE.MENU,
|
|
25
27
|
},
|
|
26
28
|
};
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
}
|
|
4
|
-
export declare const FilterLabel: import("@emotion/styled").StyledComponent<import("@mui/material").ButtonOwnProps & Omit<import("@mui/material").ButtonBaseOwnProps, "classes"> & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
|
|
1
|
+
import { FilterLabelProps } from "./filterLabel";
|
|
2
|
+
export declare const StyledButton: import("@emotion/styled").StyledComponent<import("@mui/material").ButtonOwnProps & Omit<import("@mui/material").ButtonBaseOwnProps, "classes"> & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
|
|
5
3
|
ref?: ((instance: HTMLButtonElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLButtonElement> | null | undefined;
|
|
6
4
|
}, "style" | "size" | "href" | "className" | "classes" | "children" | "color" | "sx" | "tabIndex" | "disabled" | "action" | "loading" | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "TouchRippleProps" | "touchRippleRef" | "disableElevation" | "disableFocusRipple" | "endIcon" | "fullWidth" | "loadingIndicator" | "loadingPosition" | "startIcon" | "variant"> & {
|
|
7
5
|
theme?: import("@emotion/react").Theme;
|
|
8
|
-
} &
|
|
9
|
-
export {};
|
|
6
|
+
} & Pick<FilterLabelProps, "isOpen" | "surfaceType">, {}, {}>;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { css } from "@emotion/react";
|
|
2
2
|
import styled from "@emotion/styled";
|
|
3
3
|
import { Button } from "@mui/material";
|
|
4
|
-
import {
|
|
4
|
+
import { PALETTE } from "../../../../styles/common/constants/palette";
|
|
5
5
|
import { inkLight, smokeMain } from "../../../../styles/common/mixins/colors";
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
import { SURFACE_TYPE } from "../surfaces/types";
|
|
7
|
+
export const StyledButton = styled(Button, {
|
|
8
|
+
shouldForwardProp: (prop) => prop !== "isOpen" && prop !== "surfaceType",
|
|
8
9
|
}) `
|
|
9
10
|
font-weight: inherit;
|
|
10
11
|
gap: 0;
|
|
@@ -27,22 +28,24 @@ export const FilterLabel = styled(Button, {
|
|
|
27
28
|
transform: rotate(-90deg);
|
|
28
29
|
}
|
|
29
30
|
|
|
30
|
-
${
|
|
31
|
-
|
|
31
|
+
${({ surfaceType }) => surfaceType === SURFACE_TYPE.MENU &&
|
|
32
|
+
css `
|
|
33
|
+
padding: 6px 8px;
|
|
32
34
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
& .MuiButton-endIcon {
|
|
36
|
+
transform: unset;
|
|
37
|
+
}
|
|
38
|
+
`}
|
|
37
39
|
|
|
38
|
-
${(
|
|
40
|
+
${({ isOpen, surfaceType }) => isOpen &&
|
|
39
41
|
css `
|
|
40
|
-
background-color: ${
|
|
42
|
+
background-color: ${PALETTE.SMOKE_MAIN};
|
|
41
43
|
|
|
42
|
-
${
|
|
44
|
+
${surfaceType === SURFACE_TYPE.MENU &&
|
|
45
|
+
css `
|
|
43
46
|
& .MuiButton-endIcon {
|
|
44
47
|
transform: rotate(180deg);
|
|
45
48
|
}
|
|
46
|
-
}
|
|
49
|
+
`}
|
|
47
50
|
`};
|
|
48
51
|
`;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export declare const MuiListItemButtonRoot: import("@emotion/react").SerializedStyles;
|
|
2
2
|
export declare const MuiListItemTextRoot: import("@emotion/react").SerializedStyles;
|
|
3
|
-
export declare const
|
|
3
|
+
export declare const StyledList: import("@emotion/styled").StyledComponent<import("@mui/material").ListOwnProps & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLUListElement>, HTMLUListElement>, "ref"> & {
|
|
4
4
|
ref?: ((instance: HTMLUListElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLUListElement> | null | undefined;
|
|
5
5
|
}, "style" | "className" | "classes" | "children" | "sx" | "dense" | "subheader" | "disablePadding"> & {
|
|
6
6
|
theme?: import("@emotion/react").Theme;
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import { CategoryKey, SelectCategoryValueView } from "../../../../common/entities";
|
|
2
2
|
import { OnFilterFn } from "../../../../hooks/useCategoryFilter";
|
|
3
3
|
import { FilterMenuSearchMatch } from "../../common/entities";
|
|
4
|
+
import { SURFACE_TYPE } from "../surfaces/types";
|
|
4
5
|
export interface FilterMenuProps {
|
|
5
6
|
categoryKey: CategoryKey;
|
|
6
7
|
categoryLabel: string;
|
|
7
8
|
categorySection?: string;
|
|
8
|
-
isFilterDrawer: boolean;
|
|
9
9
|
menuWidth?: number;
|
|
10
10
|
onCloseFilter: () => void;
|
|
11
11
|
onFilter: OnFilterFn;
|
|
12
|
+
surfaceType: SURFACE_TYPE;
|
|
12
13
|
values: SelectCategoryValueView[];
|
|
13
14
|
}
|
|
14
|
-
export declare const FilterMenu: ({ categoryKey, categoryLabel, categorySection,
|
|
15
|
+
export declare const FilterMenu: ({ categoryKey, categoryLabel, categorySection, menuWidth, onCloseFilter, onFilter, surfaceType, values, }: FilterMenuProps) => JSX.Element;
|
|
15
16
|
export declare function applyMenuFilter(values: SelectCategoryValueView[], searchTerm: string): FilterMenuSearchMatch[];
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
import React, { useState } from "react";
|
|
2
|
-
import { SouthIcon } from "../../../common/CustomIcon/components/SouthIcon/southIcon";
|
|
3
2
|
import { MAX_DISPLAYABLE_LIST_ITEMS } from "../../common/constants";
|
|
4
3
|
import { getSortMatchesFn } from "../../common/utils";
|
|
5
|
-
import {
|
|
4
|
+
import { StyledList } from "../FilterList/filterList.styles";
|
|
6
5
|
import { FilterMenuSearch } from "../FilterMenuSearch/filterMenuSearch";
|
|
7
6
|
import { FilterNoResultsFound } from "../FilterNoResultsFound/filterNoResultsFound";
|
|
7
|
+
import { ButtonBase } from "../surfaces/drawer/components/ButtonBase/buttonBase";
|
|
8
|
+
import { SURFACE_TYPE } from "../surfaces/types";
|
|
8
9
|
import { VariableSizeList } from "../VariableSizeList/VariableSizeList";
|
|
9
|
-
import { FilterView, FilterViewTools
|
|
10
|
-
export const FilterMenu = ({ categoryKey, categoryLabel, categorySection,
|
|
10
|
+
import { FilterView, FilterViewTools } from "./filterMenu.styles";
|
|
11
|
+
export const FilterMenu = ({ categoryKey, categoryLabel, categorySection, menuWidth = 312, onCloseFilter, onFilter, surfaceType, values, }) => {
|
|
11
12
|
const [searchTerm, setSearchTerm] = useState("");
|
|
12
|
-
const isSearchable =
|
|
13
|
+
const isSearchable = surfaceType === SURFACE_TYPE.DRAWER ||
|
|
14
|
+
values.length > MAX_DISPLAYABLE_LIST_ITEMS;
|
|
13
15
|
const matchedItems = applyMenuFilter(values, isSearchable ? searchTerm : "");
|
|
14
16
|
return (React.createElement(FilterView, { menuWidth: menuWidth },
|
|
15
|
-
React.createElement(FilterViewTools,
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
isSearchable && (React.createElement(FilterMenuSearch, { searchTerm: searchTerm, setSearchTerm: setSearchTerm }))),
|
|
20
|
-
matchedItems.length > 0 ? (React.createElement(VariableSizeList, { categorySection: categorySection, categoryKey: categoryKey, isFilterDrawer: isFilterDrawer, onFilter: onFilter, matchedItems: matchedItems })) : (React.createElement(List, null,
|
|
17
|
+
React.createElement(FilterViewTools, { surfaceType: surfaceType },
|
|
18
|
+
surfaceType === SURFACE_TYPE.DRAWER && (React.createElement(ButtonBase, { onClick: onCloseFilter }, categoryLabel)),
|
|
19
|
+
isSearchable && (React.createElement(FilterMenuSearch, { searchTerm: searchTerm, setSearchTerm: setSearchTerm, surfaceType: surfaceType }))),
|
|
20
|
+
matchedItems.length > 0 ? (React.createElement(VariableSizeList, { categorySection: categorySection, categoryKey: categoryKey, onFilter: onFilter, matchedItems: matchedItems, surfaceType: surfaceType })) : (React.createElement(StyledList, null,
|
|
21
21
|
React.createElement(FilterNoResultsFound, { onClearSearchTerm: () => setSearchTerm("") })))));
|
|
22
22
|
};
|
|
23
23
|
export function applyMenuFilter(values, searchTerm) {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { StoryObj } from "@storybook/react";
|
|
2
|
+
import { SURFACE_TYPE } from "../surfaces/types";
|
|
2
3
|
declare const meta: {
|
|
3
4
|
argTypes: {
|
|
4
5
|
categoryKey: {
|
|
@@ -20,15 +21,15 @@ declare const meta: {
|
|
|
20
21
|
};
|
|
21
22
|
};
|
|
22
23
|
};
|
|
23
|
-
component: ({ categoryKey, categoryLabel, categorySection,
|
|
24
|
+
component: ({ categoryKey, categoryLabel, categorySection, menuWidth, onCloseFilter, onFilter, surfaceType, values, }: import("./filterMenu").FilterMenuProps) => JSX.Element;
|
|
24
25
|
decorators: ((Story: import("@storybook/core/csf").PartialStoryFn<import("@storybook/react").ReactRenderer, {
|
|
25
26
|
categoryKey: import("../../../../common/entities").CategoryKey;
|
|
26
27
|
categoryLabel: string;
|
|
27
28
|
categorySection?: string | undefined;
|
|
28
|
-
isFilterDrawer: boolean;
|
|
29
29
|
menuWidth?: number | undefined;
|
|
30
30
|
onCloseFilter: () => void;
|
|
31
31
|
onFilter: import("../../../../hooks/useCategoryFilter").OnFilterFn;
|
|
32
|
+
surfaceType: SURFACE_TYPE;
|
|
32
33
|
values: import("../../../../common/entities").SelectCategoryValueView[];
|
|
33
34
|
}>) => JSX.Element)[];
|
|
34
35
|
title: string;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
import { SURFACE_TYPE } from "../surfaces/types";
|
|
2
3
|
import { FilterMenu } from "./filterMenu";
|
|
3
4
|
const meta = {
|
|
4
5
|
argTypes: {
|
|
@@ -19,10 +20,10 @@ export const FilterMenuStory = {
|
|
|
19
20
|
args: {
|
|
20
21
|
categoryKey: "donorDisease",
|
|
21
22
|
categoryLabel: "Donor Disease",
|
|
22
|
-
isFilterDrawer: false,
|
|
23
23
|
menuWidth: 312,
|
|
24
24
|
onCloseFilter: () => { },
|
|
25
25
|
onFilter: () => { },
|
|
26
|
+
surfaceType: SURFACE_TYPE.MENU,
|
|
26
27
|
values: [
|
|
27
28
|
{
|
|
28
29
|
count: 312,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { FilterProps } from "../Filter/filter";
|
|
1
2
|
interface Props {
|
|
2
3
|
menuWidth: number;
|
|
3
4
|
}
|
|
@@ -8,10 +9,5 @@ export declare const FilterView: import("@emotion/styled").StyledComponent<{
|
|
|
8
9
|
export declare const FilterViewTools: import("@emotion/styled").StyledComponent<{
|
|
9
10
|
theme?: import("@emotion/react").Theme;
|
|
10
11
|
as?: React.ElementType;
|
|
11
|
-
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
12
|
-
export declare const StyledButtonBase: import("@emotion/styled").StyledComponent<import("@mui/material").ButtonBaseOwnProps & Omit<import("@mui/material").ButtonBaseOwnProps, "classes"> & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
|
|
13
|
-
ref?: ((instance: HTMLButtonElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLButtonElement> | null | undefined;
|
|
14
|
-
}, "style" | "className" | "classes" | "children" | "sx" | "tabIndex" | "disabled" | "action" | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "TouchRippleProps" | "touchRippleRef"> & {
|
|
15
|
-
theme?: import("@emotion/react").Theme;
|
|
16
|
-
}, {}, {}>;
|
|
12
|
+
} & Pick<FilterProps, "surfaceType">, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
17
13
|
export {};
|
|
@@ -1,24 +1,14 @@
|
|
|
1
|
+
import { css } from "@emotion/react";
|
|
1
2
|
import styled from "@emotion/styled";
|
|
2
|
-
import {
|
|
3
|
-
import { mediaDesktopSmallUp } from "../../../../styles/common/mixins/breakpoints";
|
|
4
|
-
import { textBodyLarge500 } from "../../../../styles/common/mixins/fonts";
|
|
3
|
+
import { SURFACE_TYPE } from "../surfaces/types";
|
|
5
4
|
export const FilterView = styled.div `
|
|
6
5
|
width: ${({ menuWidth }) => `${menuWidth}px`};
|
|
7
6
|
`;
|
|
8
|
-
export const FilterViewTools = styled
|
|
7
|
+
export const FilterViewTools = styled("div") `
|
|
9
8
|
margin: 24px 0 8px;
|
|
10
9
|
|
|
11
|
-
${
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
15
|
-
`;
|
|
16
|
-
export const StyledButtonBase = styled(ButtonBase) `
|
|
17
|
-
${textBodyLarge500};
|
|
18
|
-
align-items: center;
|
|
19
|
-
display: flex;
|
|
20
|
-
gap: 8px;
|
|
21
|
-
justify-content: flex-start;
|
|
22
|
-
padding: 12px 16px;
|
|
23
|
-
width: 100%;
|
|
10
|
+
${({ surfaceType }) => surfaceType === SURFACE_TYPE.MENU &&
|
|
11
|
+
css `
|
|
12
|
+
margin: 0;
|
|
13
|
+
`}
|
|
24
14
|
`;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { SetSearchTermFn } from "../../common/entities";
|
|
2
|
+
import { SURFACE_TYPE } from "../surfaces/types";
|
|
2
3
|
export interface FilterMenuSearchProps {
|
|
3
4
|
searchTerm: string;
|
|
4
5
|
setSearchTerm: SetSearchTermFn;
|
|
6
|
+
surfaceType: SURFACE_TYPE;
|
|
5
7
|
}
|
|
6
|
-
export declare const FilterMenuSearch: ({ searchTerm, setSearchTerm, }: FilterMenuSearchProps) => JSX.Element;
|
|
8
|
+
export declare const FilterMenuSearch: ({ searchTerm, setSearchTerm, surfaceType, }: FilterMenuSearchProps) => JSX.Element;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { SearchIcon } from "../../../common/CustomIcon/components/SearchIcon/searchIcon";
|
|
3
|
-
import {
|
|
4
|
-
export const FilterMenuSearch = ({ searchTerm, setSearchTerm, }) => {
|
|
5
|
-
return (React.createElement(Search, { placeholder: "Search", searchTerm: searchTerm, setSearchTerm: setSearchTerm, StartAdornment: SearchIcon }));
|
|
3
|
+
import { StyledInput as Search } from "./filterMenuSearch.styles";
|
|
4
|
+
export const FilterMenuSearch = ({ searchTerm, setSearchTerm, surfaceType, }) => {
|
|
5
|
+
return (React.createElement(Search, { placeholder: "Search", searchTerm: searchTerm, setSearchTerm: setSearchTerm, StartAdornment: SearchIcon, surfaceType: surfaceType }));
|
|
6
6
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import { FilterMenuSearchProps } from "./filterMenuSearch";
|
|
2
|
+
export declare const StyledInput: import("@emotion/styled").StyledComponent<import("../../../common/Input/input").InputProps & {
|
|
2
3
|
theme?: import("@emotion/react").Theme;
|
|
3
|
-
}, {}, {}>;
|
|
4
|
+
} & Pick<FilterMenuSearchProps, "surfaceType">, {}, {}>;
|
|
@@ -1,15 +1,19 @@
|
|
|
1
|
+
import { css } from "@emotion/react";
|
|
1
2
|
import styled from "@emotion/styled";
|
|
2
|
-
import { mediaDesktopSmallUp } from "../../../../styles/common/mixins/breakpoints";
|
|
3
3
|
import { inkLight } from "../../../../styles/common/mixins/colors";
|
|
4
4
|
import { Input } from "../../../common/Input/input";
|
|
5
|
-
|
|
5
|
+
import { SURFACE_TYPE } from "../surfaces/types";
|
|
6
|
+
export const StyledInput = styled(Input, {
|
|
7
|
+
shouldForwardProp: (prop) => prop !== "surfaceType",
|
|
8
|
+
}) `
|
|
6
9
|
padding: 0 16px;
|
|
7
10
|
|
|
8
11
|
.MuiOutlinedInput-input {
|
|
9
12
|
color: ${inkLight};
|
|
10
13
|
}
|
|
11
14
|
|
|
12
|
-
${
|
|
13
|
-
|
|
14
|
-
|
|
15
|
+
${({ surfaceType }) => surfaceType === SURFACE_TYPE.MENU &&
|
|
16
|
+
css `
|
|
17
|
+
margin-top: 16px;
|
|
18
|
+
`}
|
|
15
19
|
`;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { FilterRangeProps } from "./types";
|
|
2
|
-
export declare const FilterRange: ({ categoryKey, categoryLabel, categorySection, className,
|
|
2
|
+
export declare const FilterRange: ({ categoryKey, categoryLabel, categorySection, className, max, min, onCloseFilter, onFilter, selectedMax, selectedMin, surfaceType, unit, }: FilterRangeProps) => JSX.Element;
|
|
@@ -1,26 +1,25 @@
|
|
|
1
1
|
import { Button, Divider, FormControl, FormHelperText, Grid, InputLabel, OutlinedInput, ToggleButton, ToggleButtonGroup, } from "@mui/material";
|
|
2
2
|
import React, { Fragment } from "react";
|
|
3
3
|
import { TEST_IDS } from "../../../../tests/testIds";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { FilterViewTools } from "../FilterMenu/filterMenu.styles";
|
|
5
|
+
import { ButtonBase } from "../surfaces/drawer/components/ButtonBase/buttonBase";
|
|
6
|
+
import { SURFACE_TYPE } from "../surfaces/types";
|
|
6
7
|
import { BUTTON_PROPS, DIVIDER_PROPS, INPUT_LABEL_PROPS, INPUT_PROPS, TOGGLE_BUTTON_GROUP_PROPS, } from "./constants";
|
|
7
8
|
import { StyledForm } from "./filterRange.styles";
|
|
8
9
|
import { FIELD_NAME } from "./hooks/UseFilterRange/constants";
|
|
9
10
|
import { useFilterRange } from "./hooks/UseFilterRange/hook";
|
|
10
11
|
import { RANGE_OPERATOR } from "./hooks/UseFilterRange/types";
|
|
11
12
|
import { getRangeOperator } from "./utils";
|
|
12
|
-
export const FilterRange = ({ categoryKey, categoryLabel, categorySection, className,
|
|
13
|
+
export const FilterRange = ({ categoryKey, categoryLabel, categorySection, className, max, min, onCloseFilter, onFilter, selectedMax, selectedMin, surfaceType, unit, }) => {
|
|
13
14
|
const rangeOperator = getRangeOperator({ selectedMax, selectedMin });
|
|
14
15
|
const { clearErrors, formState: { errors }, handleSubmit, onChange, value, } = useFilterRange(rangeOperator);
|
|
15
16
|
return (React.createElement(Fragment, null,
|
|
16
|
-
|
|
17
|
-
React.createElement(
|
|
18
|
-
React.createElement(SouthIcon, { fontSize: "small" }),
|
|
19
|
-
categoryLabel))),
|
|
17
|
+
surfaceType === SURFACE_TYPE.DRAWER && (React.createElement(FilterViewTools, { surfaceType: surfaceType },
|
|
18
|
+
React.createElement(ButtonBase, { onClick: onCloseFilter }, categoryLabel))),
|
|
20
19
|
React.createElement(StyledForm, { className: className, "data-testid": TEST_IDS.FILTER_RANGE, onSubmit: handleSubmit(onFilter, {
|
|
21
20
|
categoryKey,
|
|
22
21
|
categorySection,
|
|
23
|
-
}) },
|
|
22
|
+
}), surfaceType: surfaceType },
|
|
24
23
|
React.createElement(ToggleButtonGroup, { ...TOGGLE_BUTTON_GROUP_PROPS, onChange: (e, value) => {
|
|
25
24
|
clearErrors();
|
|
26
25
|
onChange?.(e, value);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
+
import { FilterRangeProps } from "./types";
|
|
1
2
|
export declare const StyledForm: import("@emotion/styled").StyledComponent<{
|
|
2
3
|
theme?: import("@emotion/react").Theme;
|
|
3
4
|
as?: React.ElementType;
|
|
4
|
-
}, import("react").DetailedHTMLProps<import("react").FormHTMLAttributes<HTMLFormElement>, HTMLFormElement>, {}>;
|
|
5
|
+
} & Pick<FilterRangeProps, "surfaceType">, import("react").DetailedHTMLProps<import("react").FormHTMLAttributes<HTMLFormElement>, HTMLFormElement>, {}>;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { css } from "@emotion/react";
|
|
1
2
|
import styled from "@emotion/styled";
|
|
2
3
|
import { PALETTE } from "../../../../styles/common/constants/palette";
|
|
3
|
-
import { mediaDesktopSmallDown } from "../../../../styles/common/mixins/breakpoints";
|
|
4
4
|
import { textBody400 } from "../../../../styles/common/mixins/fonts";
|
|
5
|
+
import { SURFACE_TYPE } from "../surfaces/types";
|
|
5
6
|
export const StyledForm = styled("form") `
|
|
6
7
|
padding: 16px;
|
|
7
8
|
width: 396px;
|
|
@@ -93,23 +94,26 @@ export const StyledForm = styled("form") `
|
|
|
93
94
|
grid-column: 1 / -1;
|
|
94
95
|
}
|
|
95
96
|
|
|
96
|
-
${
|
|
97
|
-
|
|
98
|
-
|
|
97
|
+
${({ surfaceType }) => surfaceType === SURFACE_TYPE.DRAWER &&
|
|
98
|
+
css `
|
|
99
|
+
{
|
|
100
|
+
padding: 0 16px;
|
|
101
|
+
width: 312px;
|
|
99
102
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
103
|
+
.MuiGrid-root {
|
|
104
|
+
gap: 16px 0;
|
|
105
|
+
grid-template-rows: auto auto;
|
|
106
|
+
margin: 16px 0;
|
|
104
107
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
108
|
+
.MuiFormControl-root {
|
|
109
|
+
grid-row: unset;
|
|
110
|
+
grid-template-rows: unset;
|
|
111
|
+
}
|
|
109
112
|
|
|
110
|
-
|
|
111
|
-
|
|
113
|
+
.MuiDivider-root {
|
|
114
|
+
display: none;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
112
117
|
}
|
|
113
|
-
}
|
|
114
|
-
}
|
|
118
|
+
`}
|
|
115
119
|
`;
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { fn } from "@storybook/test";
|
|
2
|
+
import { SURFACE_TYPE } from "../../surfaces/types";
|
|
2
3
|
export const DEFAULT_ARGS = {
|
|
3
4
|
categoryKey: "Weight",
|
|
4
5
|
categoryLabel: "Weight",
|
|
5
|
-
isFilterDrawer: false,
|
|
6
6
|
max: 2100,
|
|
7
7
|
min: 100,
|
|
8
8
|
onCloseFilter: fn(),
|
|
9
9
|
onFilter: fn(),
|
|
10
10
|
selectedMax: null,
|
|
11
11
|
selectedMin: null,
|
|
12
|
+
surfaceType: SURFACE_TYPE.MENU,
|
|
12
13
|
unit: "kg",
|
|
13
14
|
};
|
|
@@ -2,11 +2,12 @@ import { RangeCategoryView } from "../../../../common/categories/views/range/typ
|
|
|
2
2
|
import { CategoryKey } from "../../../../common/entities";
|
|
3
3
|
import { OnFilterFn } from "../../../../hooks/useCategoryFilter";
|
|
4
4
|
import { BaseComponentProps } from "../../../types";
|
|
5
|
+
import { SURFACE_TYPE } from "../surfaces/types";
|
|
5
6
|
export interface FilterRangeProps extends Omit<RangeCategoryView, "key" | "label">, BaseComponentProps {
|
|
6
7
|
categoryKey: CategoryKey;
|
|
7
8
|
categoryLabel: string;
|
|
8
9
|
categorySection?: string;
|
|
9
|
-
isFilterDrawer: boolean;
|
|
10
10
|
onCloseFilter: () => void;
|
|
11
11
|
onFilter: OnFilterFn;
|
|
12
|
+
surfaceType: SURFACE_TYPE;
|
|
12
13
|
}
|
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
import { CategoryView } from "../../../../common/categories/views/types";
|
|
2
2
|
import { TrackFilterOpenedFunction } from "../../../../config/entities";
|
|
3
3
|
import { OnFilterFn } from "../../../../hooks/useCategoryFilter";
|
|
4
|
+
import { BaseComponentProps } from "../../../types";
|
|
5
|
+
import { SURFACE_TYPE } from "../surfaces/types";
|
|
4
6
|
export interface CategoryFilter {
|
|
5
7
|
categoryViews: CategoryView[];
|
|
6
8
|
label?: string;
|
|
7
9
|
}
|
|
8
|
-
export interface FiltersProps {
|
|
10
|
+
export interface FiltersProps extends BaseComponentProps {
|
|
9
11
|
categoryFilters: CategoryFilter[];
|
|
10
12
|
disabled?: boolean;
|
|
11
13
|
onFilter: OnFilterFn;
|
|
14
|
+
surfaceType?: SURFACE_TYPE;
|
|
12
15
|
trackFilterOpened?: TrackFilterOpenedFunction;
|
|
13
16
|
}
|
|
14
|
-
export declare const Filters: ({ categoryFilters, disabled, onFilter, trackFilterOpened, }: FiltersProps) => JSX.Element;
|
|
17
|
+
export declare const Filters: ({ categoryFilters, className, disabled, onFilter, surfaceType, trackFilterOpened, }: FiltersProps) => JSX.Element;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { Divider } from "@mui/material";
|
|
2
2
|
import React, { Fragment, useEffect, useRef, useState } from "react";
|
|
3
3
|
import { isRangeCategoryView } from "../../../../common/categories/views/range/typeGuards";
|
|
4
|
-
import { BREAKPOINT_FN_NAME, useBreakpointHelper, } from "../../../../hooks/useBreakpointHelper";
|
|
5
4
|
import { useWindowResize } from "../../../../hooks/useWindowResize";
|
|
5
|
+
import { TYPOGRAPHY_PROPS } from "../../../../styles/common/mui/typography";
|
|
6
6
|
import { TEST_IDS } from "../../../../tests/testIds";
|
|
7
|
-
import { DESKTOP_SM } from "../../../../theme/common/breakpoints";
|
|
8
7
|
import { useDrawer } from "../../../common/Drawer/provider/hook";
|
|
9
8
|
import { Filter } from "../Filter/filter";
|
|
10
9
|
import { buildRangeTag } from "../FilterTag/utils";
|
|
11
10
|
import { FilterTags } from "../FilterTags/filterTags";
|
|
12
|
-
import {
|
|
11
|
+
import { SURFACE_TYPE } from "../surfaces/types";
|
|
12
|
+
import { Filters as FilterList, StyledTypography } from "./filters.styles";
|
|
13
13
|
/**
|
|
14
14
|
* Returns filter tags for the given category view.
|
|
15
15
|
* @param categoryView - View model of category to display.
|
|
@@ -43,19 +43,18 @@ function renderFilterTags(categoryView, onFilter) {
|
|
|
43
43
|
const tags = buildFilterTags(categoryView, onFilter);
|
|
44
44
|
return React.createElement(FilterTags, { tags: tags });
|
|
45
45
|
}
|
|
46
|
-
export const Filters = ({ categoryFilters, disabled = false, onFilter, trackFilterOpened, }) => {
|
|
46
|
+
export const Filters = ({ categoryFilters, className, disabled = false, onFilter, surfaceType = SURFACE_TYPE.MENU, trackFilterOpened, }) => {
|
|
47
47
|
const { onClose } = useDrawer();
|
|
48
|
-
const isFilterDrawer = useBreakpointHelper(BREAKPOINT_FN_NAME.DOWN, DESKTOP_SM);
|
|
49
48
|
const { height: windowHeight } = useWindowResize();
|
|
50
49
|
const filterListRef = useRef(null);
|
|
51
50
|
const [height, setHeight] = useState(0);
|
|
52
51
|
useEffect(() => {
|
|
53
52
|
setHeight(calculateListHeight(windowHeight, filterListRef.current));
|
|
54
53
|
}, [windowHeight]);
|
|
55
|
-
return (React.createElement(FilterList, { "data-testid": TEST_IDS.FILTERS, disabled: disabled, height: height, ref: filterListRef }, categoryFilters.map(({ categoryViews, label }, i) => (React.createElement(Fragment, { key: i },
|
|
54
|
+
return (React.createElement(FilterList, { className: className, "data-testid": TEST_IDS.FILTERS, disabled: disabled, height: height, ref: filterListRef, surfaceType: surfaceType }, categoryFilters.map(({ categoryViews, label }, i) => (React.createElement(Fragment, { key: i },
|
|
56
55
|
i !== 0 && React.createElement(Divider, null),
|
|
57
|
-
label && React.createElement(
|
|
58
|
-
categoryViews.map((categoryView) => (React.createElement(Filter, { key: categoryView.key, categorySection: label, categoryView: categoryView, closeAncestor: onClose,
|
|
56
|
+
label && (React.createElement(StyledTypography, { color: TYPOGRAPHY_PROPS.COLOR.INK_LIGHT, variant: TYPOGRAPHY_PROPS.VARIANT.TEXT_UPPERCASE_500 }, label)),
|
|
57
|
+
categoryViews.map((categoryView) => (React.createElement(Filter, { key: categoryView.key, categorySection: label, categoryView: categoryView, closeAncestor: onClose, onFilter: onFilter, surfaceType: surfaceType, trackFilterOpened: trackFilterOpened, tags: renderFilterTags(categoryView, onFilter) }))))))));
|
|
59
58
|
};
|
|
60
59
|
/**
|
|
61
60
|
* Returns given height of filter list.
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
+
import { FiltersProps } from "./filters";
|
|
1
2
|
interface Props {
|
|
2
|
-
disabled: boolean;
|
|
3
3
|
height: number;
|
|
4
4
|
}
|
|
5
5
|
export declare const Filters: import("@emotion/styled").StyledComponent<{
|
|
6
6
|
theme?: import("@emotion/react").Theme;
|
|
7
7
|
as?: React.ElementType;
|
|
8
|
-
} & Props, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
9
|
-
export declare const
|
|
8
|
+
} & Props & Pick<FiltersProps, "disabled" | "surfaceType">, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
9
|
+
export declare const StyledTypography: import("@emotion/styled").StyledComponent<import("@mui/material").TypographyOwnProps & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & {
|
|
10
|
+
ref?: ((instance: HTMLSpanElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLSpanElement> | null | undefined;
|
|
11
|
+
}, "p" | "style" | "order" | "bottom" | "height" | "left" | "right" | "top" | "width" | "className" | "classes" | "children" | "color" | "fontSize" | "sx" | "display" | "fontFamily" | "fontStyle" | "fontWeight" | "letterSpacing" | "overflow" | "visibility" | "align" | "bgcolor" | "border" | "boxShadow" | "zIndex" | "alignContent" | "alignItems" | "alignSelf" | "boxSizing" | "columnGap" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "justifyContent" | "justifyItems" | "justifySelf" | "lineHeight" | "marginBlockEnd" | "marginBlockStart" | "marginBottom" | "marginInlineEnd" | "marginInlineStart" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "paddingBlockEnd" | "paddingBlockStart" | "paddingBottom" | "paddingInlineEnd" | "paddingInlineStart" | "paddingLeft" | "paddingRight" | "paddingTop" | "position" | "rowGap" | "textAlign" | "textOverflow" | "textTransform" | "whiteSpace" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderTop" | "flex" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "margin" | "marginBlock" | "marginInline" | "padding" | "paddingBlock" | "paddingInline" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "typography" | "displayPrint" | "variant" | "gutterBottom" | "noWrap" | "paragraph" | "variantMapping"> & {
|
|
10
12
|
theme?: import("@emotion/react").Theme;
|
|
11
|
-
|
|
12
|
-
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
13
|
+
}, {}, {}>;
|
|
13
14
|
export {};
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { css } from "@emotion/react";
|
|
2
2
|
import styled from "@emotion/styled";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { textBody500
|
|
3
|
+
import { Typography } from "@mui/material";
|
|
4
|
+
import { inkMain } from "../../../../styles/common/mixins/colors";
|
|
5
|
+
import { textBody500 } from "../../../../styles/common/mixins/fonts";
|
|
6
|
+
import { SURFACE_TYPE } from "../surfaces/types";
|
|
6
7
|
export const Filters = styled("div") `
|
|
7
8
|
${textBody500};
|
|
8
9
|
color: ${inkMain};
|
|
@@ -21,14 +22,13 @@ export const Filters = styled("div") `
|
|
|
21
22
|
margin: 8px;
|
|
22
23
|
}
|
|
23
24
|
|
|
24
|
-
${
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
25
|
+
${({ surfaceType }) => surfaceType === SURFACE_TYPE.MENU &&
|
|
26
|
+
css `
|
|
27
|
+
height: unset;
|
|
28
|
+
overflow: unset;
|
|
29
|
+
padding: 0 8px;
|
|
30
|
+
`}
|
|
29
31
|
`;
|
|
30
|
-
export const
|
|
31
|
-
${textUppercase500};
|
|
32
|
-
color: ${inkLight};
|
|
32
|
+
export const StyledTypography = styled(Typography) `
|
|
33
33
|
padding: 8px;
|
|
34
34
|
`;
|
|
@@ -6,7 +6,7 @@ import { useWindowResize } from "../../../../../../hooks/useWindowResize";
|
|
|
6
6
|
import { DESKTOP_SM } from "../../../../../../theme/common/breakpoints";
|
|
7
7
|
import { LIST_ITEM_HEIGHT, LIST_MARGIN, MAX_DISPLAYABLE_LIST_ITEMS, MAX_LIST_HEIGHT_PX, } from "../../../../common/constants";
|
|
8
8
|
import { getSortMatchesFn } from "../../../../common/utils";
|
|
9
|
-
import {
|
|
9
|
+
import { StyledList } from "../../../FilterList/filterList.styles";
|
|
10
10
|
import { DIVIDER_HEIGHT, DIVIDER_ITEM, NO_RESULTS_ITEM, } from "../../common/constants";
|
|
11
11
|
import { ITEM_TYPE, } from "../../common/entites";
|
|
12
12
|
import VariableSizeListItem from "../VariableSizeListItem/variableSizeListItem";
|
|
@@ -56,7 +56,7 @@ export const VariableSizeList = forwardRef(function VariableSizeList({ autocompl
|
|
|
56
56
|
listRef.current?.resetAfterIndex(0);
|
|
57
57
|
}, [filteredItems]);
|
|
58
58
|
return (React.createElement(OuterElementContext.Provider, { value: { autocompleteListProps, autocompleteListRef } },
|
|
59
|
-
React.createElement(List, { height: height, innerElementType:
|
|
59
|
+
React.createElement(List, { height: height, innerElementType: StyledList, innerRef: innerRef, itemCount: filteredItems.length, itemData: {
|
|
60
60
|
filteredItems,
|
|
61
61
|
onFilter,
|
|
62
62
|
onUpdateItemSizeByItemKey,
|
|
@@ -2,16 +2,17 @@ import { VariableSizeListProps as ListProps } from "react-window";
|
|
|
2
2
|
import { CategoryKey } from "../../../../common/entities";
|
|
3
3
|
import { OnFilterFn } from "../../../../hooks/useCategoryFilter";
|
|
4
4
|
import { FilterMenuSearchMatch } from "../../common/entities";
|
|
5
|
+
import { SURFACE_TYPE } from "../surfaces/types";
|
|
5
6
|
export type ItemSizeByItemKey = Map<unknown, number>;
|
|
6
7
|
export interface VariableSizeListProps {
|
|
7
8
|
categoryKey: CategoryKey;
|
|
8
9
|
categorySection?: string;
|
|
9
10
|
height?: number;
|
|
10
|
-
isFilterDrawer: boolean;
|
|
11
11
|
itemSize?: number;
|
|
12
12
|
matchedItems: FilterMenuSearchMatch[];
|
|
13
13
|
onFilter: OnFilterFn;
|
|
14
14
|
overscanCount?: ListProps["overscanCount"];
|
|
15
|
+
surfaceType: SURFACE_TYPE;
|
|
15
16
|
width?: ListProps["width"];
|
|
16
17
|
}
|
|
17
|
-
export declare const VariableSizeList: ({ categoryKey, categorySection, height: initHeight,
|
|
18
|
+
export declare const VariableSizeList: ({ categoryKey, categorySection, height: initHeight, itemSize, matchedItems, onFilter, overscanCount, surfaceType, width, }: VariableSizeListProps) => JSX.Element;
|