@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
|
@@ -25,7 +25,7 @@ export const CollapsableRows = <T extends RowData>({
|
|
|
25
25
|
return (
|
|
26
26
|
<Fragment>
|
|
27
27
|
{(leafOrSubRows || rows).map((row) => {
|
|
28
|
-
if (row.depth > 0) return null; // Hide sub rows.
|
|
28
|
+
if (row.depth > 0 && !leafOrSubRows) return null; // Hide sub rows that are not already leaf or sub rows.
|
|
29
29
|
return (
|
|
30
30
|
<StyledTableRow
|
|
31
31
|
key={row.id}
|
|
@@ -1,28 +1,26 @@
|
|
|
1
|
+
import { css } from "@emotion/react";
|
|
1
2
|
import styled from "@emotion/styled";
|
|
2
3
|
import { Popover } from "@mui/material";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { PALETTE } from "../../../../styles/common/constants/palette";
|
|
5
|
+
import { SURFACE_TYPE } from "../surfaces/types";
|
|
6
|
+
import { FilterProps } from "./filter";
|
|
6
7
|
|
|
7
|
-
export const
|
|
8
|
+
export const StyledPopover = styled(Popover, {
|
|
9
|
+
shouldForwardProp: (prop) => prop !== "surfaceType",
|
|
10
|
+
})<Pick<FilterProps, "surfaceType">>`
|
|
8
11
|
.MuiPaper-menu {
|
|
9
12
|
margin: 4px 0;
|
|
10
13
|
}
|
|
11
14
|
|
|
12
|
-
${
|
|
13
|
-
.
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
export const IconButton = styled(DXIconButton)`
|
|
24
|
-
color: ${white};
|
|
25
|
-
left: calc(100% + 4px);
|
|
26
|
-
position: absolute;
|
|
27
|
-
top: 4px;
|
|
15
|
+
${({ surfaceType }) =>
|
|
16
|
+
surfaceType === SURFACE_TYPE.DRAWER &&
|
|
17
|
+
css`
|
|
18
|
+
.MuiPaper-root {
|
|
19
|
+
background-color: ${PALETTE.SMOKE_LIGHT};
|
|
20
|
+
height: 100%;
|
|
21
|
+
margin: 0;
|
|
22
|
+
max-height: 100%;
|
|
23
|
+
overflow: visible; // required; allows backdrop button to render outside of drawer container.
|
|
24
|
+
}
|
|
25
|
+
`}
|
|
28
26
|
`;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { CloseRounded } from "@mui/icons-material";
|
|
2
1
|
import { Grow, PopoverPosition, PopoverProps } from "@mui/material";
|
|
3
2
|
import React, { MouseEvent, ReactNode, useState } from "react";
|
|
4
3
|
import { isRangeCategoryView } from "../../../../common/categories/views/range/typeGuards";
|
|
@@ -9,8 +8,10 @@ import { TEST_IDS } from "../../../../tests/testIds";
|
|
|
9
8
|
import { FilterLabel } from "../FilterLabel/filterLabel";
|
|
10
9
|
import { FilterMenu } from "../FilterMenu/filterMenu";
|
|
11
10
|
import { FilterRange } from "../FilterRange/filterRange";
|
|
11
|
+
import { IconButton } from "../surfaces/drawer/components/IconButton/iconButton";
|
|
12
|
+
import { SURFACE_TYPE } from "../surfaces/types";
|
|
12
13
|
import { DrawerTransition } from "./components/DrawerTransition/drawerTransition";
|
|
13
|
-
import {
|
|
14
|
+
import { StyledPopover } from "./filter.styles";
|
|
14
15
|
|
|
15
16
|
/**
|
|
16
17
|
* Filter component.
|
|
@@ -30,8 +31,8 @@ export interface FilterProps {
|
|
|
30
31
|
categorySection?: string;
|
|
31
32
|
categoryView: CategoryView;
|
|
32
33
|
closeAncestor?: () => void;
|
|
33
|
-
isFilterDrawer: boolean;
|
|
34
34
|
onFilter: OnFilterFn;
|
|
35
|
+
surfaceType: SURFACE_TYPE;
|
|
35
36
|
tags?: ReactNode; // e.g. filter tags
|
|
36
37
|
trackFilterOpened?: TrackFilterOpenedFunction;
|
|
37
38
|
}
|
|
@@ -40,18 +41,19 @@ export const Filter = ({
|
|
|
40
41
|
categorySection,
|
|
41
42
|
categoryView,
|
|
42
43
|
closeAncestor,
|
|
43
|
-
isFilterDrawer,
|
|
44
44
|
onFilter,
|
|
45
|
+
surfaceType,
|
|
45
46
|
tags,
|
|
46
47
|
trackFilterOpened,
|
|
47
48
|
}: FilterProps): JSX.Element => {
|
|
48
49
|
const [isOpen, setIsOpen] = useState<boolean>(false);
|
|
49
50
|
const [position, setPosition] = useState<PopoverPosition>(DEFAULT_POSITION);
|
|
50
|
-
const
|
|
51
|
-
const
|
|
52
|
-
const
|
|
51
|
+
const isDrawer = surfaceType === SURFACE_TYPE.DRAWER;
|
|
52
|
+
const anchorPosition = isDrawer ? DEFAULT_POSITION : position;
|
|
53
|
+
const slotProps = isDrawer ? DRAWER_SLOT_PROPS : DEFAULT_SLOT_PROPS;
|
|
54
|
+
const TransitionComponent = isDrawer ? DrawerTransition : Grow;
|
|
53
55
|
const transitionDuration = isOpen ? 250 : 300;
|
|
54
|
-
const TransitionDuration =
|
|
56
|
+
const TransitionDuration = isDrawer ? transitionDuration : undefined;
|
|
55
57
|
const isRangeView = isRangeCategoryView(categoryView);
|
|
56
58
|
|
|
57
59
|
/**
|
|
@@ -93,8 +95,9 @@ export const Filter = ({
|
|
|
93
95
|
isOpen={isOpen}
|
|
94
96
|
label={categoryView.label}
|
|
95
97
|
onClick={onOpenFilter}
|
|
98
|
+
surfaceType={surfaceType}
|
|
96
99
|
/>
|
|
97
|
-
<
|
|
100
|
+
<StyledPopover
|
|
98
101
|
anchorPosition={anchorPosition}
|
|
99
102
|
anchorReference="anchorPosition"
|
|
100
103
|
data-testid={TEST_IDS.FILTER_POPOVER}
|
|
@@ -103,27 +106,22 @@ export const Filter = ({
|
|
|
103
106
|
open={isOpen}
|
|
104
107
|
slotProps={slotProps}
|
|
105
108
|
slots={{ transition: TransitionComponent }}
|
|
109
|
+
surfaceType={surfaceType}
|
|
106
110
|
transitionDuration={TransitionDuration}
|
|
107
111
|
>
|
|
108
|
-
{
|
|
109
|
-
<IconButton
|
|
110
|
-
Icon={CloseRounded}
|
|
111
|
-
onClick={onCloseFilters}
|
|
112
|
-
size="medium"
|
|
113
|
-
/>
|
|
114
|
-
)}
|
|
112
|
+
{isDrawer && <IconButton onClick={onCloseFilters} />}
|
|
115
113
|
{isRangeView ? (
|
|
116
114
|
<FilterRange
|
|
117
115
|
categoryKey={categoryView.key}
|
|
118
116
|
categoryLabel={categoryView.label}
|
|
119
117
|
categorySection={categorySection}
|
|
120
|
-
isFilterDrawer={isFilterDrawer}
|
|
121
118
|
max={categoryView.max}
|
|
122
119
|
min={categoryView.min}
|
|
123
120
|
selectedMax={categoryView.selectedMax}
|
|
124
121
|
selectedMin={categoryView.selectedMin}
|
|
125
122
|
onCloseFilter={onCloseFilter}
|
|
126
123
|
onFilter={onFilter}
|
|
124
|
+
surfaceType={surfaceType}
|
|
127
125
|
unit={categoryView.unit}
|
|
128
126
|
/>
|
|
129
127
|
) : (
|
|
@@ -131,13 +129,13 @@ export const Filter = ({
|
|
|
131
129
|
categoryKey={categoryView.key}
|
|
132
130
|
categoryLabel={categoryView.label}
|
|
133
131
|
categorySection={categorySection}
|
|
134
|
-
isFilterDrawer={isFilterDrawer}
|
|
135
132
|
onCloseFilter={onCloseFilter}
|
|
136
133
|
onFilter={onFilter}
|
|
134
|
+
surfaceType={surfaceType}
|
|
137
135
|
values={categoryView.values}
|
|
138
136
|
/>
|
|
139
137
|
)}
|
|
140
|
-
</
|
|
138
|
+
</StyledPopover>
|
|
141
139
|
{tags}
|
|
142
140
|
</>
|
|
143
141
|
);
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { fn } from "@storybook/test";
|
|
2
2
|
import { ComponentProps } from "react";
|
|
3
3
|
import { DONOR_COUNT, GENUS_SPECIES } from "../../Filters/stories/constants";
|
|
4
|
+
import { SURFACE_TYPE } from "../../surfaces/types";
|
|
4
5
|
import { Filter } from "../filter";
|
|
5
6
|
|
|
6
7
|
export const SELECT_ARGS: ComponentProps<typeof Filter> = {
|
|
7
8
|
categoryView: GENUS_SPECIES,
|
|
8
|
-
isFilterDrawer: false,
|
|
9
9
|
onFilter: fn(),
|
|
10
|
+
surfaceType: SURFACE_TYPE.MENU,
|
|
10
11
|
};
|
|
11
12
|
|
|
12
13
|
export const DISABLED_SELECT_ARGS: ComponentProps<typeof Filter> = {
|
|
@@ -19,6 +20,6 @@ export const DISABLED_SELECT_ARGS: ComponentProps<typeof Filter> = {
|
|
|
19
20
|
|
|
20
21
|
export const RANGE_ARGS: ComponentProps<typeof Filter> = {
|
|
21
22
|
categoryView: DONOR_COUNT,
|
|
22
|
-
isFilterDrawer: false,
|
|
23
23
|
onFilter: fn(),
|
|
24
|
+
surfaceType: SURFACE_TYPE.MENU,
|
|
24
25
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Meta, StoryObj } from "@storybook/react";
|
|
2
2
|
import React from "react";
|
|
3
|
+
import { SURFACE_TYPE } from "../surfaces/types";
|
|
3
4
|
import { FilterLabel } from "./filterLabel";
|
|
4
5
|
|
|
5
6
|
const meta = {
|
|
@@ -31,5 +32,6 @@ export const FilterLabelStory: Story = {
|
|
|
31
32
|
isOpen: false,
|
|
32
33
|
label: "Label",
|
|
33
34
|
onClick: () => {},
|
|
35
|
+
surfaceType: SURFACE_TYPE.MENU,
|
|
34
36
|
},
|
|
35
37
|
};
|
|
@@ -1,16 +1,14 @@
|
|
|
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
|
+
import { SURFACE_TYPE } from "../surfaces/types";
|
|
7
|
+
import { FilterLabelProps } from "./filterLabel";
|
|
6
8
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export const FilterLabel = styled(Button, {
|
|
12
|
-
shouldForwardProp: (prop) => prop !== "isOpen",
|
|
13
|
-
})<Props>`
|
|
9
|
+
export const StyledButton = styled(Button, {
|
|
10
|
+
shouldForwardProp: (prop) => prop !== "isOpen" && prop !== "surfaceType",
|
|
11
|
+
})<Pick<FilterLabelProps, "isOpen" | "surfaceType">>`
|
|
14
12
|
font-weight: inherit;
|
|
15
13
|
gap: 0;
|
|
16
14
|
justify-content: space-between;
|
|
@@ -32,23 +30,26 @@ export const FilterLabel = styled(Button, {
|
|
|
32
30
|
transform: rotate(-90deg);
|
|
33
31
|
}
|
|
34
32
|
|
|
35
|
-
${
|
|
36
|
-
|
|
33
|
+
${({ surfaceType }) =>
|
|
34
|
+
surfaceType === SURFACE_TYPE.MENU &&
|
|
35
|
+
css`
|
|
36
|
+
padding: 6px 8px;
|
|
37
37
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
38
|
+
& .MuiButton-endIcon {
|
|
39
|
+
transform: unset;
|
|
40
|
+
}
|
|
41
|
+
`}
|
|
42
42
|
|
|
43
|
-
${(
|
|
44
|
-
|
|
43
|
+
${({ isOpen, surfaceType }) =>
|
|
44
|
+
isOpen &&
|
|
45
45
|
css`
|
|
46
|
-
background-color: ${
|
|
46
|
+
background-color: ${PALETTE.SMOKE_MAIN};
|
|
47
47
|
|
|
48
|
-
${
|
|
48
|
+
${surfaceType === SURFACE_TYPE.MENU &&
|
|
49
|
+
css`
|
|
49
50
|
& .MuiButton-endIcon {
|
|
50
51
|
transform: rotate(180deg);
|
|
51
52
|
}
|
|
52
|
-
}
|
|
53
|
+
`}
|
|
53
54
|
`};
|
|
54
55
|
`;
|
|
@@ -2,7 +2,8 @@ import { ArrowDropDownRounded } from "@mui/icons-material";
|
|
|
2
2
|
import React, { MouseEvent } from "react";
|
|
3
3
|
import { DataDictionaryAnnotation } from "../../../../common/entities";
|
|
4
4
|
import { Tooltip } from "../../../DataDictionary/components/Tooltip/tooltip";
|
|
5
|
-
import {
|
|
5
|
+
import { SURFACE_TYPE } from "../surfaces/types";
|
|
6
|
+
import { StyledButton } from "./filterLabel.styles";
|
|
6
7
|
|
|
7
8
|
export interface FilterLabelProps {
|
|
8
9
|
annotation?: DataDictionaryAnnotation;
|
|
@@ -11,6 +12,7 @@ export interface FilterLabelProps {
|
|
|
11
12
|
isOpen: boolean;
|
|
12
13
|
label: string;
|
|
13
14
|
onClick: (event: MouseEvent<HTMLButtonElement>) => void;
|
|
15
|
+
surfaceType: SURFACE_TYPE;
|
|
14
16
|
}
|
|
15
17
|
|
|
16
18
|
export const FilterLabel = ({
|
|
@@ -20,20 +22,22 @@ export const FilterLabel = ({
|
|
|
20
22
|
isOpen,
|
|
21
23
|
label,
|
|
22
24
|
onClick,
|
|
25
|
+
surfaceType,
|
|
23
26
|
}: FilterLabelProps): JSX.Element => {
|
|
24
27
|
const filterLabel = count ? `${label}\xa0(${count})` : label; // When the count is present, a non-breaking space is used to prevent it from being on its own line
|
|
25
28
|
return (
|
|
26
29
|
<Tooltip description={annotation?.description} title={annotation?.label}>
|
|
27
|
-
<
|
|
30
|
+
<StyledButton
|
|
28
31
|
color="inherit"
|
|
29
32
|
disabled={disabled}
|
|
30
33
|
endIcon={<ArrowDropDownRounded fontSize="small" />}
|
|
31
34
|
fullWidth
|
|
32
35
|
isOpen={isOpen}
|
|
33
36
|
onClick={onClick}
|
|
37
|
+
surfaceType={surfaceType}
|
|
34
38
|
>
|
|
35
39
|
{filterLabel}
|
|
36
|
-
</
|
|
40
|
+
</StyledButton>
|
|
37
41
|
</Tooltip>
|
|
38
42
|
);
|
|
39
43
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Meta, StoryObj } from "@storybook/react";
|
|
2
2
|
import React from "react";
|
|
3
|
+
import { SURFACE_TYPE } from "../surfaces/types";
|
|
3
4
|
import { FilterMenu } from "./filterMenu";
|
|
4
5
|
|
|
5
6
|
const meta = {
|
|
@@ -28,10 +29,10 @@ export const FilterMenuStory: Story = {
|
|
|
28
29
|
args: {
|
|
29
30
|
categoryKey: "donorDisease",
|
|
30
31
|
categoryLabel: "Donor Disease",
|
|
31
|
-
isFilterDrawer: false,
|
|
32
32
|
menuWidth: 312,
|
|
33
33
|
onCloseFilter: () => {},
|
|
34
34
|
onFilter: () => {},
|
|
35
|
+
surfaceType: SURFACE_TYPE.MENU,
|
|
35
36
|
values: [
|
|
36
37
|
{
|
|
37
38
|
count: 312,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { css } from "@emotion/react";
|
|
1
2
|
import styled from "@emotion/styled";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { textBodyLarge500 } from "../../../../styles/common/mixins/fonts";
|
|
3
|
+
import { FilterProps } from "../Filter/filter";
|
|
4
|
+
import { SURFACE_TYPE } from "../surfaces/types";
|
|
5
5
|
|
|
6
6
|
interface Props {
|
|
7
7
|
menuWidth: number;
|
|
@@ -11,21 +11,12 @@ export const FilterView = styled.div<Props>`
|
|
|
11
11
|
width: ${({ menuWidth }) => `${menuWidth}px`};
|
|
12
12
|
`;
|
|
13
13
|
|
|
14
|
-
export const FilterViewTools = styled
|
|
14
|
+
export const FilterViewTools = styled("div")<Pick<FilterProps, "surfaceType">>`
|
|
15
15
|
margin: 24px 0 8px;
|
|
16
16
|
|
|
17
|
-
${
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
export const StyledButtonBase = styled(ButtonBase)`
|
|
24
|
-
${textBodyLarge500};
|
|
25
|
-
align-items: center;
|
|
26
|
-
display: flex;
|
|
27
|
-
gap: 8px;
|
|
28
|
-
justify-content: flex-start;
|
|
29
|
-
padding: 12px 16px;
|
|
30
|
-
width: 100%;
|
|
17
|
+
${({ surfaceType }) =>
|
|
18
|
+
surfaceType === SURFACE_TYPE.MENU &&
|
|
19
|
+
css`
|
|
20
|
+
margin: 0;
|
|
21
|
+
`}
|
|
31
22
|
`;
|
|
@@ -4,28 +4,25 @@ import {
|
|
|
4
4
|
SelectCategoryValueView,
|
|
5
5
|
} from "../../../../common/entities";
|
|
6
6
|
import { OnFilterFn } from "../../../../hooks/useCategoryFilter";
|
|
7
|
-
import { SouthIcon } from "../../../common/CustomIcon/components/SouthIcon/southIcon";
|
|
8
7
|
import { MAX_DISPLAYABLE_LIST_ITEMS } from "../../common/constants";
|
|
9
8
|
import { FilterMenuSearchMatch } from "../../common/entities";
|
|
10
9
|
import { getSortMatchesFn } from "../../common/utils";
|
|
11
|
-
import {
|
|
10
|
+
import { StyledList } from "../FilterList/filterList.styles";
|
|
12
11
|
import { FilterMenuSearch } from "../FilterMenuSearch/filterMenuSearch";
|
|
13
12
|
import { FilterNoResultsFound } from "../FilterNoResultsFound/filterNoResultsFound";
|
|
13
|
+
import { ButtonBase } from "../surfaces/drawer/components/ButtonBase/buttonBase";
|
|
14
|
+
import { SURFACE_TYPE } from "../surfaces/types";
|
|
14
15
|
import { VariableSizeList } from "../VariableSizeList/VariableSizeList";
|
|
15
|
-
import {
|
|
16
|
-
FilterView,
|
|
17
|
-
FilterViewTools,
|
|
18
|
-
StyledButtonBase,
|
|
19
|
-
} from "./filterMenu.styles";
|
|
16
|
+
import { FilterView, FilterViewTools } from "./filterMenu.styles";
|
|
20
17
|
|
|
21
18
|
export interface FilterMenuProps {
|
|
22
19
|
categoryKey: CategoryKey;
|
|
23
20
|
categoryLabel: string;
|
|
24
21
|
categorySection?: string;
|
|
25
|
-
isFilterDrawer: boolean;
|
|
26
22
|
menuWidth?: number;
|
|
27
23
|
onCloseFilter: () => void;
|
|
28
24
|
onFilter: OnFilterFn;
|
|
25
|
+
surfaceType: SURFACE_TYPE;
|
|
29
26
|
values: SelectCategoryValueView[];
|
|
30
27
|
}
|
|
31
28
|
|
|
@@ -33,29 +30,28 @@ export const FilterMenu = ({
|
|
|
33
30
|
categoryKey,
|
|
34
31
|
categoryLabel,
|
|
35
32
|
categorySection,
|
|
36
|
-
isFilterDrawer,
|
|
37
33
|
menuWidth = 312,
|
|
38
34
|
onCloseFilter,
|
|
39
35
|
onFilter,
|
|
36
|
+
surfaceType,
|
|
40
37
|
values,
|
|
41
38
|
}: FilterMenuProps): JSX.Element => {
|
|
42
39
|
const [searchTerm, setSearchTerm] = useState<string>("");
|
|
43
40
|
const isSearchable =
|
|
44
|
-
|
|
41
|
+
surfaceType === SURFACE_TYPE.DRAWER ||
|
|
42
|
+
values.length > MAX_DISPLAYABLE_LIST_ITEMS;
|
|
45
43
|
const matchedItems = applyMenuFilter(values, isSearchable ? searchTerm : "");
|
|
46
44
|
return (
|
|
47
45
|
<FilterView menuWidth={menuWidth}>
|
|
48
|
-
<FilterViewTools>
|
|
49
|
-
{
|
|
50
|
-
<
|
|
51
|
-
<SouthIcon fontSize="small" />
|
|
52
|
-
{categoryLabel}
|
|
53
|
-
</StyledButtonBase>
|
|
46
|
+
<FilterViewTools surfaceType={surfaceType}>
|
|
47
|
+
{surfaceType === SURFACE_TYPE.DRAWER && (
|
|
48
|
+
<ButtonBase onClick={onCloseFilter}>{categoryLabel}</ButtonBase>
|
|
54
49
|
)}
|
|
55
50
|
{isSearchable && (
|
|
56
51
|
<FilterMenuSearch
|
|
57
52
|
searchTerm={searchTerm}
|
|
58
53
|
setSearchTerm={setSearchTerm}
|
|
54
|
+
surfaceType={surfaceType}
|
|
59
55
|
/>
|
|
60
56
|
)}
|
|
61
57
|
</FilterViewTools>
|
|
@@ -63,16 +59,16 @@ export const FilterMenu = ({
|
|
|
63
59
|
<VariableSizeList
|
|
64
60
|
categorySection={categorySection}
|
|
65
61
|
categoryKey={categoryKey}
|
|
66
|
-
isFilterDrawer={isFilterDrawer}
|
|
67
62
|
onFilter={onFilter}
|
|
68
63
|
matchedItems={matchedItems}
|
|
64
|
+
surfaceType={surfaceType}
|
|
69
65
|
/>
|
|
70
66
|
) : (
|
|
71
|
-
<
|
|
67
|
+
<StyledList>
|
|
72
68
|
<FilterNoResultsFound
|
|
73
69
|
onClearSearchTerm={(): void => setSearchTerm("")}
|
|
74
70
|
/>
|
|
75
|
-
</
|
|
71
|
+
</StyledList>
|
|
76
72
|
)}
|
|
77
73
|
</FilterView>
|
|
78
74
|
);
|
|
@@ -1,16 +1,22 @@
|
|
|
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
|
+
import { SURFACE_TYPE } from "../surfaces/types";
|
|
6
|
+
import { FilterMenuSearchProps } from "./filterMenuSearch";
|
|
5
7
|
|
|
6
|
-
export const
|
|
8
|
+
export const StyledInput = styled(Input, {
|
|
9
|
+
shouldForwardProp: (prop) => prop !== "surfaceType",
|
|
10
|
+
})<Pick<FilterMenuSearchProps, "surfaceType">>`
|
|
7
11
|
padding: 0 16px;
|
|
8
12
|
|
|
9
13
|
.MuiOutlinedInput-input {
|
|
10
14
|
color: ${inkLight};
|
|
11
15
|
}
|
|
12
16
|
|
|
13
|
-
${
|
|
14
|
-
|
|
15
|
-
|
|
17
|
+
${({ surfaceType }) =>
|
|
18
|
+
surfaceType === SURFACE_TYPE.MENU &&
|
|
19
|
+
css`
|
|
20
|
+
margin-top: 16px;
|
|
21
|
+
`}
|
|
16
22
|
`;
|
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { SearchIcon } from "../../../common/CustomIcon/components/SearchIcon/searchIcon";
|
|
3
3
|
import { SetSearchTermFn } from "../../common/entities";
|
|
4
|
-
import {
|
|
4
|
+
import { SURFACE_TYPE } from "../surfaces/types";
|
|
5
|
+
import { StyledInput as Search } from "./filterMenuSearch.styles";
|
|
5
6
|
|
|
6
7
|
export interface FilterMenuSearchProps {
|
|
7
8
|
searchTerm: string;
|
|
8
9
|
setSearchTerm: SetSearchTermFn;
|
|
10
|
+
surfaceType: SURFACE_TYPE;
|
|
9
11
|
}
|
|
10
12
|
|
|
11
13
|
export const FilterMenuSearch = ({
|
|
12
14
|
searchTerm,
|
|
13
15
|
setSearchTerm,
|
|
16
|
+
surfaceType,
|
|
14
17
|
}: FilterMenuSearchProps): JSX.Element => {
|
|
15
18
|
return (
|
|
16
19
|
<Search
|
|
@@ -18,6 +21,7 @@ export const FilterMenuSearch = ({
|
|
|
18
21
|
searchTerm={searchTerm}
|
|
19
22
|
setSearchTerm={setSearchTerm}
|
|
20
23
|
StartAdornment={SearchIcon}
|
|
24
|
+
surfaceType={surfaceType}
|
|
21
25
|
/>
|
|
22
26
|
);
|
|
23
27
|
};
|
|
@@ -1,9 +1,11 @@
|
|
|
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";
|
|
6
|
+
import { FilterRangeProps } from "./types";
|
|
5
7
|
|
|
6
|
-
export const StyledForm = styled("form")
|
|
8
|
+
export const StyledForm = styled("form")<Pick<FilterRangeProps, "surfaceType">>`
|
|
7
9
|
padding: 16px;
|
|
8
10
|
width: 396px;
|
|
9
11
|
|
|
@@ -94,23 +96,27 @@ export const StyledForm = styled("form")`
|
|
|
94
96
|
grid-column: 1 / -1;
|
|
95
97
|
}
|
|
96
98
|
|
|
97
|
-
${
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
99
|
+
${({ surfaceType }) =>
|
|
100
|
+
surfaceType === SURFACE_TYPE.DRAWER &&
|
|
101
|
+
css`
|
|
102
|
+
{
|
|
103
|
+
padding: 0 16px;
|
|
104
|
+
width: 312px;
|
|
105
|
+
|
|
106
|
+
.MuiGrid-root {
|
|
107
|
+
gap: 16px 0;
|
|
108
|
+
grid-template-rows: auto auto;
|
|
109
|
+
margin: 16px 0;
|
|
110
|
+
|
|
111
|
+
.MuiFormControl-root {
|
|
112
|
+
grid-row: unset;
|
|
113
|
+
grid-template-rows: unset;
|
|
114
|
+
}
|
|
110
115
|
|
|
111
|
-
|
|
112
|
-
|
|
116
|
+
.MuiDivider-root {
|
|
117
|
+
display: none;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
113
120
|
}
|
|
114
|
-
}
|
|
115
|
-
}
|
|
121
|
+
`}
|
|
116
122
|
`;
|
|
@@ -11,11 +11,9 @@ import {
|
|
|
11
11
|
} from "@mui/material";
|
|
12
12
|
import React, { Fragment } from "react";
|
|
13
13
|
import { TEST_IDS } from "../../../../tests/testIds";
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
|
|
17
|
-
StyledButtonBase,
|
|
18
|
-
} from "../FilterMenu/filterMenu.styles";
|
|
14
|
+
import { FilterViewTools } from "../FilterMenu/filterMenu.styles";
|
|
15
|
+
import { ButtonBase } from "../surfaces/drawer/components/ButtonBase/buttonBase";
|
|
16
|
+
import { SURFACE_TYPE } from "../surfaces/types";
|
|
19
17
|
import {
|
|
20
18
|
BUTTON_PROPS,
|
|
21
19
|
DIVIDER_PROPS,
|
|
@@ -35,13 +33,13 @@ export const FilterRange = ({
|
|
|
35
33
|
categoryLabel,
|
|
36
34
|
categorySection,
|
|
37
35
|
className,
|
|
38
|
-
isFilterDrawer,
|
|
39
36
|
max,
|
|
40
37
|
min,
|
|
41
38
|
onCloseFilter,
|
|
42
39
|
onFilter,
|
|
43
40
|
selectedMax,
|
|
44
41
|
selectedMin,
|
|
42
|
+
surfaceType,
|
|
45
43
|
unit,
|
|
46
44
|
}: FilterRangeProps): JSX.Element => {
|
|
47
45
|
const rangeOperator = getRangeOperator({ selectedMax, selectedMin });
|
|
@@ -54,12 +52,9 @@ export const FilterRange = ({
|
|
|
54
52
|
} = useFilterRange(rangeOperator);
|
|
55
53
|
return (
|
|
56
54
|
<Fragment>
|
|
57
|
-
{
|
|
58
|
-
<FilterViewTools>
|
|
59
|
-
<
|
|
60
|
-
<SouthIcon fontSize="small" />
|
|
61
|
-
{categoryLabel}
|
|
62
|
-
</StyledButtonBase>
|
|
55
|
+
{surfaceType === SURFACE_TYPE.DRAWER && (
|
|
56
|
+
<FilterViewTools surfaceType={surfaceType}>
|
|
57
|
+
<ButtonBase onClick={onCloseFilter}>{categoryLabel}</ButtonBase>
|
|
63
58
|
</FilterViewTools>
|
|
64
59
|
)}
|
|
65
60
|
<StyledForm
|
|
@@ -69,6 +64,7 @@ export const FilterRange = ({
|
|
|
69
64
|
categoryKey,
|
|
70
65
|
categorySection,
|
|
71
66
|
})}
|
|
67
|
+
surfaceType={surfaceType}
|
|
72
68
|
>
|
|
73
69
|
<ToggleButtonGroup
|
|
74
70
|
{...TOGGLE_BUTTON_GROUP_PROPS}
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import { fn } from "@storybook/test";
|
|
2
2
|
import { ComponentProps } from "react";
|
|
3
|
+
import { SURFACE_TYPE } from "../../surfaces/types";
|
|
3
4
|
import { FilterRange } from "../filterRange";
|
|
4
5
|
|
|
5
6
|
export const DEFAULT_ARGS: ComponentProps<typeof FilterRange> = {
|
|
6
7
|
categoryKey: "Weight",
|
|
7
8
|
categoryLabel: "Weight",
|
|
8
|
-
isFilterDrawer: false,
|
|
9
9
|
max: 2100,
|
|
10
10
|
min: 100,
|
|
11
11
|
onCloseFilter: fn(),
|
|
12
12
|
onFilter: fn(),
|
|
13
13
|
selectedMax: null,
|
|
14
14
|
selectedMin: null,
|
|
15
|
+
surfaceType: SURFACE_TYPE.MENU,
|
|
15
16
|
unit: "kg",
|
|
16
17
|
};
|