@databiosphere/findable-ui 42.0.1 → 43.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 +27 -0
- package/lib/common/categories/config/range/typeGuards.d.ts +8 -0
- package/lib/common/categories/config/range/typeGuards.js +9 -0
- package/lib/components/Filter/components/Filters/filters.js +1 -1
- package/lib/components/Filter/components/Filters/filters.styles.d.ts +2 -5
- package/lib/components/Filter/components/SearchAllFilters/common/constants.d.ts +3 -13
- package/lib/components/Filter/components/SearchAllFilters/common/constants.js +12 -36
- package/lib/components/Filter/components/SearchAllFilters/components/OutlinedInput/constants.d.ts +2 -0
- package/lib/components/Filter/components/SearchAllFilters/components/OutlinedInput/constants.js +7 -0
- package/lib/components/Filter/components/SearchAllFilters/components/OutlinedInput/outlinedInput.d.ts +2 -0
- package/lib/components/Filter/components/SearchAllFilters/components/OutlinedInput/outlinedInput.js +13 -0
- package/lib/components/Filter/components/SearchAllFilters/components/OutlinedInput/utils.d.ts +11 -0
- package/lib/components/Filter/components/SearchAllFilters/components/OutlinedInput/utils.js +17 -0
- package/lib/components/Filter/components/SearchAllFilters/components/VariableSizeList/VariableSizeList.d.ts +2 -0
- package/lib/components/Filter/components/SearchAllFilters/components/VariableSizeList/VariableSizeList.js +9 -10
- package/lib/components/Filter/components/SearchAllFilters/context/context.d.ts +2 -0
- package/lib/components/Filter/components/SearchAllFilters/context/context.js +10 -0
- package/lib/components/Filter/components/SearchAllFilters/context/hook.d.ts +6 -0
- package/lib/components/Filter/components/SearchAllFilters/context/hook.js +9 -0
- package/lib/components/Filter/components/SearchAllFilters/context/types.d.ts +11 -0
- package/lib/components/Filter/components/SearchAllFilters/context/types.js +1 -0
- package/lib/components/Filter/components/SearchAllFilters/searchAllFilters.d.ts +2 -19
- package/lib/components/Filter/components/SearchAllFilters/searchAllFilters.js +37 -74
- package/lib/components/Filter/components/SearchAllFilters/searchAllFilters.styles.d.ts +2 -2
- package/lib/components/Filter/components/SearchAllFilters/searchAllFilters.styles.js +7 -8
- package/lib/components/Filter/components/SearchAllFilters/stories/args.d.ts +3 -0
- package/lib/components/Filter/components/SearchAllFilters/stories/args.js +8 -0
- package/lib/components/Filter/components/SearchAllFilters/stories/searchAllFilters.stories.d.ts +6 -0
- package/lib/components/Filter/components/SearchAllFilters/stories/searchAllFilters.stories.js +19 -0
- package/lib/components/Filter/components/SearchAllFilters/types.d.ts +10 -0
- package/lib/components/Filter/components/SearchAllFilters/types.js +1 -0
- package/lib/components/Filter/components/adapters/tanstack/ColumnFiltersAdapter/columnFiltersAdapter.js +10 -1
- package/lib/components/Filter/components/adapters/tanstack/ColumnFiltersAdapter/types.d.ts +5 -1
- package/lib/components/Filter/components/adapters/tanstack/ColumnFiltersAdapter/utils.js +105 -10
- package/lib/components/Filter/components/surfaces/popper/Popper/popper.styles.d.ts +6 -0
- package/lib/components/Filter/components/surfaces/popper/Popper/popper.styles.js +18 -0
- package/lib/components/Filter/components/surfaces/types.d.ts +3 -1
- package/lib/components/Filter/components/surfaces/types.js +2 -0
- package/lib/components/Table/components/PaginationSummary/paginationSummary.js +3 -0
- package/lib/styles/common/mixins/typography.d.ts +8 -0
- package/lib/styles/common/mixins/typography.js +11 -0
- package/lib/styles/common/mui/textField.d.ts +11 -0
- package/lib/styles/common/mui/textField.js +22 -0
- package/lib/theme/common/typography.js +8 -3
- package/lib/views/ExploreView/exploreView.js +1 -1
- package/package.json +1 -1
- package/src/common/categories/config/range/typeGuards.ts +14 -0
- package/src/components/Filter/components/Filters/filters.styles.ts +1 -1
- package/src/components/Filter/components/Filters/filters.tsx +1 -0
- package/src/components/Filter/components/SearchAllFilters/common/constants.ts +24 -37
- package/src/components/Filter/components/SearchAllFilters/components/OutlinedInput/constants.ts +9 -0
- package/src/components/Filter/components/SearchAllFilters/components/OutlinedInput/outlinedInput.tsx +31 -0
- package/src/components/Filter/components/SearchAllFilters/components/OutlinedInput/utils.ts +22 -0
- package/src/components/Filter/components/SearchAllFilters/components/VariableSizeList/VariableSizeList.tsx +12 -13
- package/src/components/Filter/components/SearchAllFilters/context/context.ts +12 -0
- package/src/components/Filter/components/SearchAllFilters/context/hook.ts +11 -0
- package/src/components/Filter/components/SearchAllFilters/context/types.ts +12 -0
- package/src/components/Filter/components/SearchAllFilters/searchAllFilters.styles.ts +8 -9
- package/src/components/Filter/components/SearchAllFilters/searchAllFilters.tsx +70 -132
- package/src/components/Filter/components/SearchAllFilters/stories/args.ts +15 -0
- package/src/components/Filter/components/SearchAllFilters/stories/searchAllFilters.stories.tsx +29 -0
- package/src/components/Filter/components/SearchAllFilters/types.ts +16 -0
- package/src/components/Filter/components/adapters/tanstack/ColumnFiltersAdapter/columnFiltersAdapter.tsx +12 -1
- package/src/components/Filter/components/adapters/tanstack/ColumnFiltersAdapter/types.ts +10 -1
- package/src/components/Filter/components/adapters/tanstack/ColumnFiltersAdapter/utils.ts +147 -12
- package/src/components/Filter/components/surfaces/popper/Popper/popper.styles.ts +20 -0
- package/src/components/Filter/components/surfaces/types.ts +2 -0
- package/src/components/Table/components/PaginationSummary/paginationSummary.tsx +3 -3
- package/src/styles/common/mixins/typography.ts +15 -0
- package/src/styles/common/mui/textField.ts +33 -0
- package/src/theme/common/typography.ts +8 -3
- package/src/views/ExploreView/exploreView.tsx +3 -0
- package/lib/components/Filter/components/SearchAllFilters/components/AutocompletePopper/autocompletePopper.styles.d.ts +0 -3
- package/lib/components/Filter/components/SearchAllFilters/components/AutocompletePopper/autocompletePopper.styles.js +0 -15
- package/lib/components/Filter/components/SearchAllFilters/searchAllFilters.stories.d.ts +0 -6
- package/lib/components/Filter/components/SearchAllFilters/searchAllFilters.stories.js +0 -82
- package/lib/components/Filter/components/SearchAllFiltersSearch/components/SearchCloseButton/searchCloseButton.d.ts +0 -1
- package/lib/components/Filter/components/SearchAllFiltersSearch/components/SearchCloseButton/searchCloseButton.js +0 -13
- package/lib/components/Filter/components/SearchAllFiltersSearch/searchAllFiltersSearch.d.ts +0 -2
- package/lib/components/Filter/components/SearchAllFiltersSearch/searchAllFiltersSearch.js +0 -12
- package/lib/components/Filter/components/SearchAllFiltersSearch/searchAllFiltersSearch.styles.d.ts +0 -5
- package/lib/components/Filter/components/SearchAllFiltersSearch/searchAllFiltersSearch.styles.js +0 -34
- package/src/components/Filter/components/SearchAllFilters/components/AutocompletePopper/autocompletePopper.styles.ts +0 -16
- package/src/components/Filter/components/SearchAllFilters/searchAllFilters.stories.tsx +0 -92
- package/src/components/Filter/components/SearchAllFiltersSearch/components/SearchCloseButton/searchCloseButton.tsx +0 -25
- package/src/components/Filter/components/SearchAllFiltersSearch/searchAllFiltersSearch.styles.ts +0 -35
- package/src/components/Filter/components/SearchAllFiltersSearch/searchAllFiltersSearch.tsx +0 -29
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { TextFieldProps } from "@mui/material";
|
|
2
|
+
|
|
3
|
+
type TextFieldPropsOptions = {
|
|
4
|
+
COLOR: typeof COLOR;
|
|
5
|
+
SIZE: typeof SIZE;
|
|
6
|
+
VARIANT: typeof VARIANT;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
const COLOR: Record<string, TextFieldProps["color"]> = {
|
|
10
|
+
ERROR: "error",
|
|
11
|
+
INFO: "info",
|
|
12
|
+
PRIMARY: "primary",
|
|
13
|
+
SECONDARY: "secondary",
|
|
14
|
+
SUCCESS: "success",
|
|
15
|
+
WARNING: "warning",
|
|
16
|
+
} as const;
|
|
17
|
+
|
|
18
|
+
const SIZE: Record<string, TextFieldProps["size"]> = {
|
|
19
|
+
MEDIUM: "medium",
|
|
20
|
+
SMALL: "small",
|
|
21
|
+
} as const;
|
|
22
|
+
|
|
23
|
+
const VARIANT: Record<string, TextFieldProps["variant"]> = {
|
|
24
|
+
FILLED: "filled",
|
|
25
|
+
OUTLINED: "outlined",
|
|
26
|
+
STANDARD: "standard",
|
|
27
|
+
} as const;
|
|
28
|
+
|
|
29
|
+
export const TEXT_FIELD_PROPS: TextFieldPropsOptions = {
|
|
30
|
+
COLOR,
|
|
31
|
+
SIZE,
|
|
32
|
+
VARIANT,
|
|
33
|
+
};
|
|
@@ -72,9 +72,11 @@ const heading = (theme: Theme): TypographyStyle => ({
|
|
|
72
72
|
fontFamily: "Inter",
|
|
73
73
|
fontSize: "20px",
|
|
74
74
|
fontWeight: 500,
|
|
75
|
+
letterSpacing: "-0.2px",
|
|
75
76
|
lineHeight: "28px",
|
|
76
77
|
[bpUpSm({ theme })]: {
|
|
77
78
|
fontSize: "24px",
|
|
79
|
+
letterSpacing: "-0.4px",
|
|
78
80
|
lineHeight: "32px",
|
|
79
81
|
},
|
|
80
82
|
});
|
|
@@ -83,9 +85,11 @@ const headingLarge = (theme: Theme): TypographyStyle => ({
|
|
|
83
85
|
fontFamily: "Inter",
|
|
84
86
|
fontSize: "24px",
|
|
85
87
|
fontWeight: 500,
|
|
88
|
+
letterSpacing: "-0.4px",
|
|
86
89
|
lineHeight: "32px",
|
|
87
90
|
[bpUpSm({ theme })]: {
|
|
88
|
-
fontSize: "
|
|
91
|
+
fontSize: "30px",
|
|
92
|
+
letterSpacing: "-0.8px",
|
|
89
93
|
lineHeight: "40px",
|
|
90
94
|
},
|
|
91
95
|
});
|
|
@@ -97,6 +101,7 @@ const headingSmall = (theme: Theme): TypographyStyle => ({
|
|
|
97
101
|
lineHeight: "26px",
|
|
98
102
|
[bpUpSm({ theme })]: {
|
|
99
103
|
fontSize: "20px",
|
|
104
|
+
letterSpacing: "-0.2px",
|
|
100
105
|
lineHeight: "28px",
|
|
101
106
|
},
|
|
102
107
|
});
|
|
@@ -109,8 +114,8 @@ const headingXLarge = (theme: Theme): TypographyStyle => ({
|
|
|
109
114
|
lineHeight: "40px",
|
|
110
115
|
[bpUpSm({ theme })]: {
|
|
111
116
|
fontSize: "40px",
|
|
112
|
-
letterSpacing: "-
|
|
113
|
-
lineHeight: "
|
|
117
|
+
letterSpacing: "-1.4px",
|
|
118
|
+
lineHeight: "56px",
|
|
114
119
|
},
|
|
115
120
|
});
|
|
116
121
|
|
|
@@ -135,6 +135,9 @@ export const ExploreView = (props: ExploreViewProps): JSX.Element => {
|
|
|
135
135
|
<SearchAllFilters
|
|
136
136
|
categoryViews={categoryViews}
|
|
137
137
|
onFilter={onFilterChange.bind(null, true)}
|
|
138
|
+
surfaceType={
|
|
139
|
+
mdDown ? SURFACE_TYPE.POPPER_DRAWER : SURFACE_TYPE.POPPER_MENU
|
|
140
|
+
}
|
|
138
141
|
/>
|
|
139
142
|
</SidebarTools>
|
|
140
143
|
<Filters
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import styled from "@emotion/styled";
|
|
2
|
-
import { Popper as MPopper } from "@mui/material";
|
|
3
|
-
import { PALETTE } from "../../../../../../styles/common/constants/palette";
|
|
4
|
-
import { bpDownMd } from "../../../../../../styles/common/mixins/breakpoints";
|
|
5
|
-
export const AutocompletePopper = styled(MPopper) `
|
|
6
|
-
${bpDownMd} {
|
|
7
|
-
.MuiPaper-root {
|
|
8
|
-
background-color: ${PALETTE.SMOKE_LIGHT};
|
|
9
|
-
|
|
10
|
-
.MuiList-root {
|
|
11
|
-
margin: 0;
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
`;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { Meta, StoryObj } from "@storybook/react";
|
|
2
|
-
import { SearchAllFilters } from "./searchAllFilters";
|
|
3
|
-
declare const _default: Meta<typeof SearchAllFilters>;
|
|
4
|
-
export default _default;
|
|
5
|
-
type Story = StoryObj<typeof SearchAllFilters>;
|
|
6
|
-
export declare const SearchAllFiltersStory: Story;
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { FilterMenuStory } from "../FilterMenu/filterMenu.stories";
|
|
3
|
-
import { SearchAllFilters } from "./searchAllFilters";
|
|
4
|
-
export default {
|
|
5
|
-
argTypes: {
|
|
6
|
-
onFilter: { control: { disable: true } },
|
|
7
|
-
},
|
|
8
|
-
component: SearchAllFilters,
|
|
9
|
-
decorators: [
|
|
10
|
-
(Story) => (React.createElement("div", { style: { width: 264 } },
|
|
11
|
-
React.createElement(Story, null))),
|
|
12
|
-
],
|
|
13
|
-
title: "Components/Filter/SearchAllFilters",
|
|
14
|
-
};
|
|
15
|
-
const onFilter = () => {
|
|
16
|
-
// onFilter function
|
|
17
|
-
};
|
|
18
|
-
const defaultValues = [
|
|
19
|
-
{
|
|
20
|
-
count: 1,
|
|
21
|
-
key: "item1",
|
|
22
|
-
label: "Item 1",
|
|
23
|
-
selected: false,
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
count: 10,
|
|
27
|
-
key: "item2",
|
|
28
|
-
label: "Item 2",
|
|
29
|
-
selected: false,
|
|
30
|
-
},
|
|
31
|
-
];
|
|
32
|
-
export const SearchAllFiltersStory = {
|
|
33
|
-
args: {
|
|
34
|
-
categoryViews: [
|
|
35
|
-
{
|
|
36
|
-
isDisabled: false,
|
|
37
|
-
key: "genusSpecies",
|
|
38
|
-
label: "Genus Species",
|
|
39
|
-
values: [
|
|
40
|
-
{
|
|
41
|
-
count: 12,
|
|
42
|
-
key: "homoSapiens",
|
|
43
|
-
label: "Homo sapiens",
|
|
44
|
-
selected: false,
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
count: 6,
|
|
48
|
-
key: "musMusculus",
|
|
49
|
-
label: "Mus musculus",
|
|
50
|
-
selected: false,
|
|
51
|
-
},
|
|
52
|
-
],
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
isDisabled: false,
|
|
56
|
-
key: "donorDisease",
|
|
57
|
-
label: "Donor Disease",
|
|
58
|
-
values: FilterMenuStory.args?.values || defaultValues,
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
isDisabled: true,
|
|
62
|
-
key: "anatomicalEntity",
|
|
63
|
-
label: "Anatomical Entity",
|
|
64
|
-
values: [
|
|
65
|
-
{
|
|
66
|
-
count: 12,
|
|
67
|
-
key: "oralCavity",
|
|
68
|
-
label: "oral cavity",
|
|
69
|
-
selected: true,
|
|
70
|
-
},
|
|
71
|
-
{
|
|
72
|
-
count: 6,
|
|
73
|
-
key: "pancreas",
|
|
74
|
-
label: "pancreas",
|
|
75
|
-
selected: false,
|
|
76
|
-
},
|
|
77
|
-
],
|
|
78
|
-
},
|
|
79
|
-
],
|
|
80
|
-
onFilter: onFilter,
|
|
81
|
-
},
|
|
82
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const SearchCloseButton: () => JSX.Element;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { CloseRounded } from "@mui/icons-material";
|
|
2
|
-
import { IconButton } from "@mui/material";
|
|
3
|
-
import React, { Fragment, useContext } from "react";
|
|
4
|
-
import { BREAKPOINT_FN_NAME, useBreakpointHelper, } from "../../../../../../hooks/useBreakpointHelper";
|
|
5
|
-
import { ListboxContext } from "../../../SearchAllFilters/searchAllFilters";
|
|
6
|
-
export const SearchCloseButton = () => {
|
|
7
|
-
const bpDownMd = useBreakpointHelper(BREAKPOINT_FN_NAME.DOWN, "md");
|
|
8
|
-
const { onClearSearch, onCloseSearch, open, searchTerm } = useContext(ListboxContext);
|
|
9
|
-
const showButton = open && (bpDownMd || searchTerm);
|
|
10
|
-
const onClickFn = bpDownMd ? onCloseSearch : onClearSearch;
|
|
11
|
-
return (React.createElement(Fragment, null, showButton && (React.createElement(IconButton, { onClick: onClickFn, size: "large" },
|
|
12
|
-
React.createElement(CloseRounded, { fontSize: "small" })))));
|
|
13
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import React, { useContext } from "react";
|
|
2
|
-
import { SearchIcon } from "../../../common/CustomIcon/components/SearchIcon/searchIcon";
|
|
3
|
-
import { ListboxContext } from "../SearchAllFilters/searchAllFilters";
|
|
4
|
-
import { InputField } from "./searchAllFiltersSearch.styles";
|
|
5
|
-
export const SearchAllFiltersSearch = ({ inputProps, InputProps, ...props }) => {
|
|
6
|
-
const { searchTerm } = useContext(ListboxContext);
|
|
7
|
-
delete inputProps?.value; // Control input value from the search term.
|
|
8
|
-
return (React.createElement(InputField, { ...props, fullWidth: true, InputProps: {
|
|
9
|
-
...(InputProps || {}),
|
|
10
|
-
startAdornment: React.createElement(SearchIcon, { fontSize: "small" }),
|
|
11
|
-
}, inputProps: { ...(inputProps || {}), spellCheck: false }, placeholder: "Search all filters...", size: "small", value: searchTerm, variant: "outlined" }));
|
|
12
|
-
};
|
package/lib/components/Filter/components/SearchAllFiltersSearch/searchAllFiltersSearch.styles.d.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export declare const InputField: import("@emotion/styled").StyledComponent<{
|
|
2
|
-
variant?: import("@mui/material").TextFieldVariants | undefined;
|
|
3
|
-
} & Omit<import("@mui/material").OutlinedTextFieldProps | import("@mui/material").FilledTextFieldProps | import("@mui/material").StandardTextFieldProps, "variant"> & {
|
|
4
|
-
theme?: import("@emotion/react").Theme;
|
|
5
|
-
}, {}, {}>;
|
package/lib/components/Filter/components/SearchAllFiltersSearch/searchAllFiltersSearch.styles.js
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import styled from "@emotion/styled";
|
|
2
|
-
import { TextField } from "@mui/material";
|
|
3
|
-
import { PALETTE } from "../../../../styles/common/constants/palette";
|
|
4
|
-
export const InputField = styled(TextField) `
|
|
5
|
-
&& {
|
|
6
|
-
display: flex;
|
|
7
|
-
flex-direction: column;
|
|
8
|
-
gap: 8px;
|
|
9
|
-
|
|
10
|
-
.MuiInputBase-root {
|
|
11
|
-
& ::placeholder {
|
|
12
|
-
color: ${PALETTE.INK_LIGHT};
|
|
13
|
-
opacity: 0.8;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
&.Mui-focused {
|
|
17
|
-
& ::placeholder {
|
|
18
|
-
opacity: 0;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
.MuiOutlinedInput-root {
|
|
24
|
-
&.MuiInputBase-sizeSmall {
|
|
25
|
-
padding: 0 0 0 12px;
|
|
26
|
-
|
|
27
|
-
.MuiAutocomplete-input {
|
|
28
|
-
color: ${PALETTE.INK_MAIN};
|
|
29
|
-
padding: 10px 14px 10px 0;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
`;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import styled from "@emotion/styled";
|
|
2
|
-
import { Popper as MPopper } from "@mui/material";
|
|
3
|
-
import { PALETTE } from "../../../../../../styles/common/constants/palette";
|
|
4
|
-
import { bpDownMd } from "../../../../../../styles/common/mixins/breakpoints";
|
|
5
|
-
|
|
6
|
-
export const AutocompletePopper = styled(MPopper)`
|
|
7
|
-
${bpDownMd} {
|
|
8
|
-
.MuiPaper-root {
|
|
9
|
-
background-color: ${PALETTE.SMOKE_LIGHT};
|
|
10
|
-
|
|
11
|
-
.MuiList-root {
|
|
12
|
-
margin: 0;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
`;
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import { Meta, StoryObj } from "@storybook/react";
|
|
2
|
-
import React from "react";
|
|
3
|
-
import { FilterMenuStory } from "../FilterMenu/filterMenu.stories";
|
|
4
|
-
import { SearchAllFilters } from "./searchAllFilters";
|
|
5
|
-
|
|
6
|
-
export default {
|
|
7
|
-
argTypes: {
|
|
8
|
-
onFilter: { control: { disable: true } },
|
|
9
|
-
},
|
|
10
|
-
component: SearchAllFilters,
|
|
11
|
-
decorators: [
|
|
12
|
-
(Story): JSX.Element => (
|
|
13
|
-
<div style={{ width: 264 }}>
|
|
14
|
-
<Story />
|
|
15
|
-
</div>
|
|
16
|
-
),
|
|
17
|
-
],
|
|
18
|
-
title: "Components/Filter/SearchAllFilters",
|
|
19
|
-
} as Meta<typeof SearchAllFilters>;
|
|
20
|
-
|
|
21
|
-
type Story = StoryObj<typeof SearchAllFilters>;
|
|
22
|
-
|
|
23
|
-
const onFilter = (): void => {
|
|
24
|
-
// onFilter function
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
const defaultValues = [
|
|
28
|
-
{
|
|
29
|
-
count: 1,
|
|
30
|
-
key: "item1",
|
|
31
|
-
label: "Item 1",
|
|
32
|
-
selected: false,
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
count: 10,
|
|
36
|
-
key: "item2",
|
|
37
|
-
label: "Item 2",
|
|
38
|
-
selected: false,
|
|
39
|
-
},
|
|
40
|
-
];
|
|
41
|
-
|
|
42
|
-
export const SearchAllFiltersStory: Story = {
|
|
43
|
-
args: {
|
|
44
|
-
categoryViews: [
|
|
45
|
-
{
|
|
46
|
-
isDisabled: false,
|
|
47
|
-
key: "genusSpecies",
|
|
48
|
-
label: "Genus Species",
|
|
49
|
-
values: [
|
|
50
|
-
{
|
|
51
|
-
count: 12,
|
|
52
|
-
key: "homoSapiens",
|
|
53
|
-
label: "Homo sapiens",
|
|
54
|
-
selected: false,
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
count: 6,
|
|
58
|
-
key: "musMusculus",
|
|
59
|
-
label: "Mus musculus",
|
|
60
|
-
selected: false,
|
|
61
|
-
},
|
|
62
|
-
],
|
|
63
|
-
},
|
|
64
|
-
{
|
|
65
|
-
isDisabled: false,
|
|
66
|
-
key: "donorDisease",
|
|
67
|
-
label: "Donor Disease",
|
|
68
|
-
values: FilterMenuStory.args?.values || defaultValues,
|
|
69
|
-
},
|
|
70
|
-
{
|
|
71
|
-
isDisabled: true,
|
|
72
|
-
key: "anatomicalEntity",
|
|
73
|
-
label: "Anatomical Entity",
|
|
74
|
-
values: [
|
|
75
|
-
{
|
|
76
|
-
count: 12,
|
|
77
|
-
key: "oralCavity",
|
|
78
|
-
label: "oral cavity",
|
|
79
|
-
selected: true,
|
|
80
|
-
},
|
|
81
|
-
{
|
|
82
|
-
count: 6,
|
|
83
|
-
key: "pancreas",
|
|
84
|
-
label: "pancreas",
|
|
85
|
-
selected: false,
|
|
86
|
-
},
|
|
87
|
-
],
|
|
88
|
-
},
|
|
89
|
-
],
|
|
90
|
-
onFilter: onFilter,
|
|
91
|
-
},
|
|
92
|
-
};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { CloseRounded } from "@mui/icons-material";
|
|
2
|
-
import { IconButton } from "@mui/material";
|
|
3
|
-
import React, { Fragment, useContext } from "react";
|
|
4
|
-
import {
|
|
5
|
-
BREAKPOINT_FN_NAME,
|
|
6
|
-
useBreakpointHelper,
|
|
7
|
-
} from "../../../../../../hooks/useBreakpointHelper";
|
|
8
|
-
import { ListboxContext } from "../../../SearchAllFilters/searchAllFilters";
|
|
9
|
-
|
|
10
|
-
export const SearchCloseButton = (): JSX.Element => {
|
|
11
|
-
const bpDownMd = useBreakpointHelper(BREAKPOINT_FN_NAME.DOWN, "md");
|
|
12
|
-
const { onClearSearch, onCloseSearch, open, searchTerm } =
|
|
13
|
-
useContext(ListboxContext);
|
|
14
|
-
const showButton = open && (bpDownMd || searchTerm);
|
|
15
|
-
const onClickFn = bpDownMd ? onCloseSearch : onClearSearch;
|
|
16
|
-
return (
|
|
17
|
-
<Fragment>
|
|
18
|
-
{showButton && (
|
|
19
|
-
<IconButton onClick={onClickFn} size="large">
|
|
20
|
-
<CloseRounded fontSize="small" />
|
|
21
|
-
</IconButton>
|
|
22
|
-
)}
|
|
23
|
-
</Fragment>
|
|
24
|
-
);
|
|
25
|
-
};
|
package/src/components/Filter/components/SearchAllFiltersSearch/searchAllFiltersSearch.styles.ts
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import styled from "@emotion/styled";
|
|
2
|
-
import { TextField } from "@mui/material";
|
|
3
|
-
import { PALETTE } from "../../../../styles/common/constants/palette";
|
|
4
|
-
|
|
5
|
-
export const InputField = styled(TextField)`
|
|
6
|
-
&& {
|
|
7
|
-
display: flex;
|
|
8
|
-
flex-direction: column;
|
|
9
|
-
gap: 8px;
|
|
10
|
-
|
|
11
|
-
.MuiInputBase-root {
|
|
12
|
-
& ::placeholder {
|
|
13
|
-
color: ${PALETTE.INK_LIGHT};
|
|
14
|
-
opacity: 0.8;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
&.Mui-focused {
|
|
18
|
-
& ::placeholder {
|
|
19
|
-
opacity: 0;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
.MuiOutlinedInput-root {
|
|
25
|
-
&.MuiInputBase-sizeSmall {
|
|
26
|
-
padding: 0 0 0 12px;
|
|
27
|
-
|
|
28
|
-
.MuiAutocomplete-input {
|
|
29
|
-
color: ${PALETTE.INK_MAIN};
|
|
30
|
-
padding: 10px 14px 10px 0;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
`;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { TextFieldProps } from "@mui/material";
|
|
2
|
-
import React, { useContext } from "react";
|
|
3
|
-
import { SearchIcon } from "../../../common/CustomIcon/components/SearchIcon/searchIcon";
|
|
4
|
-
import { ListboxContext } from "../SearchAllFilters/searchAllFilters";
|
|
5
|
-
import { InputField } from "./searchAllFiltersSearch.styles";
|
|
6
|
-
|
|
7
|
-
export const SearchAllFiltersSearch = ({
|
|
8
|
-
inputProps,
|
|
9
|
-
InputProps,
|
|
10
|
-
...props
|
|
11
|
-
}: TextFieldProps): JSX.Element => {
|
|
12
|
-
const { searchTerm } = useContext(ListboxContext);
|
|
13
|
-
delete inputProps?.value; // Control input value from the search term.
|
|
14
|
-
return (
|
|
15
|
-
<InputField
|
|
16
|
-
{...props}
|
|
17
|
-
fullWidth
|
|
18
|
-
InputProps={{
|
|
19
|
-
...(InputProps || {}),
|
|
20
|
-
startAdornment: <SearchIcon fontSize="small" />,
|
|
21
|
-
}}
|
|
22
|
-
inputProps={{ ...(inputProps || {}), spellCheck: false }}
|
|
23
|
-
placeholder="Search all filters..."
|
|
24
|
-
size="small"
|
|
25
|
-
value={searchTerm}
|
|
26
|
-
variant="outlined"
|
|
27
|
-
/>
|
|
28
|
-
);
|
|
29
|
-
};
|