[];
content?: ReactNode;
}
+
export interface ISidebarFilterMenuProps<
T extends number | string,
C extends ElementType,
@@ -109,6 +110,8 @@ export function getRecursiveMenu<
});
}
+// eslint-disable-next-line no-warning-comments
+// TODO: use (and modify) SidebarMenu instead of a copy
export function SidebarFilterMenu<
T extends number | string,
C extends ElementType = 'button',
@@ -135,6 +138,7 @@ export function SidebarFilterMenu<
[]) as T[];
onMenuOpen?.(menuId, isOpened, openedMenuPath);
}
+
return (
{getRecursiveMenu(
diff --git a/packages/react-front-kit/src/Components/FiltersBar/SidebarFilterMenu/__snapshots__/SidebarFilterMenu.test.tsx.snap b/packages/react-front-kit/src/Components/SidebarFilters/SidebarFilterMenu/__snapshots__/SidebarFilterMenu.test.tsx.snap
similarity index 100%
rename from packages/react-front-kit/src/Components/FiltersBar/SidebarFilterMenu/__snapshots__/SidebarFilterMenu.test.tsx.snap
rename to packages/react-front-kit/src/Components/SidebarFilters/SidebarFilterMenu/__snapshots__/SidebarFilterMenu.test.tsx.snap
diff --git a/packages/react-front-kit/src/Components/FiltersBar/FitlersBar.mock.tsx b/packages/react-front-kit/src/Components/SidebarFilters/SidebarFilters.mock.tsx
similarity index 100%
rename from packages/react-front-kit/src/Components/FiltersBar/FitlersBar.mock.tsx
rename to packages/react-front-kit/src/Components/SidebarFilters/SidebarFilters.mock.tsx
diff --git a/packages/react-front-kit/src/Components/FiltersBar/FiltersBar.stories.tsx b/packages/react-front-kit/src/Components/SidebarFilters/SidebarFilters.stories.tsx
similarity index 84%
rename from packages/react-front-kit/src/Components/FiltersBar/FiltersBar.stories.tsx
rename to packages/react-front-kit/src/Components/SidebarFilters/SidebarFilters.stories.tsx
index 2680699f..924a1b0f 100644
--- a/packages/react-front-kit/src/Components/FiltersBar/FiltersBar.stories.tsx
+++ b/packages/react-front-kit/src/Components/SidebarFilters/SidebarFilters.stories.tsx
@@ -1,13 +1,13 @@
import type { Meta, StoryObj } from '@storybook/react';
-import { FiltersBar as Cmp } from './FiltersBar';
-import { activeFilters } from './FitlersBar.mock';
import { getMenu } from './SidebarFilterMenu/SidebarFilterMenu.mock';
+import { SidebarFilters as Cmp } from './SidebarFilters';
+import { activeFilters } from './SidebarFilters.mock';
const meta = {
component: Cmp,
tags: ['autodocs'],
- title: '3-custom/Components/FiltersBar',
+ title: '3-custom/Components/SidebarFilters',
} satisfies Meta;
export default meta;
diff --git a/packages/react-front-kit/src/Components/FiltersBar/FiltersBar.style.tsx b/packages/react-front-kit/src/Components/SidebarFilters/SidebarFilters.style.tsx
similarity index 100%
rename from packages/react-front-kit/src/Components/FiltersBar/FiltersBar.style.tsx
rename to packages/react-front-kit/src/Components/SidebarFilters/SidebarFilters.style.tsx
diff --git a/packages/react-front-kit/src/Components/FiltersBar/FiltersBar.test.tsx b/packages/react-front-kit/src/Components/SidebarFilters/SidebarFilters.test.tsx
similarity index 81%
rename from packages/react-front-kit/src/Components/FiltersBar/FiltersBar.test.tsx
rename to packages/react-front-kit/src/Components/SidebarFilters/SidebarFilters.test.tsx
index d1ba10b2..8065c4fa 100644
--- a/packages/react-front-kit/src/Components/FiltersBar/FiltersBar.test.tsx
+++ b/packages/react-front-kit/src/Components/SidebarFilters/SidebarFilters.test.tsx
@@ -1,13 +1,13 @@
import { renderWithProviders } from '@smile/react-front-kit-shared/test-utils';
-import { FiltersBar } from './FiltersBar';
-import { activeFilters } from './FitlersBar.mock';
import { menuWithoutContent } from './SidebarFilterMenu/SidebarFilterMenu.mock';
+import { SidebarFilters } from './SidebarFilters';
+import { activeFilters } from './SidebarFilters.mock';
describe('FiltersBar', () => {
it('matches snapshot', () => {
const { container } = renderWithProviders(
-
+ {topContent ? topContent
: null}
{activeView.dataView ?? ''}
);
diff --git a/packages/react-front-kit/src/index.tsx b/packages/react-front-kit/src/index.tsx
index 023245f4..eb2ad436 100644
--- a/packages/react-front-kit/src/index.tsx
+++ b/packages/react-front-kit/src/index.tsx
@@ -4,16 +4,16 @@
// component exports
export type { IPreviewProps } from './Components/Preview/Preview';
export { Preview } from './Components/Preview/Preview';
-export { FiltersCheckboxList } from './Components/FiltersCheckboxList/FiltersCheckboxList';
+export { SearchableCheckboxList } from './Components/SearchableCheckboxList/SearchableCheckboxList';
export type {
- IFilter,
- IFiltersCheckboxListProps,
-} from './Components/FiltersCheckboxList/FiltersCheckboxList';
-export { FiltersBar } from './Components/FiltersBar/FiltersBar';
+ ICheckbox,
+ ISearchableCheckboxListProps,
+} from './Components/SearchableCheckboxList/SearchableCheckboxList';
+export { SidebarFilters } from './Components/SidebarFilters/SidebarFilters';
export type {
- IFiltersProps,
+ ISidebarFiltersProps,
ISidebarFilter,
-} from './Components/FiltersBar/FiltersBar';
+} from './Components/SidebarFilters/SidebarFilters';
export { ActionBar } from './Components/ActionBar/ActionBar';
export type {
IActionBarAction,
diff --git a/packages/storybook-pages/src/Pages/BrowsingPage/BrowsingPage.mock.tsx b/packages/storybook-pages/src/Pages/BrowsingPage/BrowsingPage.mock.tsx
index 509f829d..0a004756 100644
--- a/packages/storybook-pages/src/Pages/BrowsingPage/BrowsingPage.mock.tsx
+++ b/packages/storybook-pages/src/Pages/BrowsingPage/BrowsingPage.mock.tsx
@@ -1,3 +1,4 @@
+import type { IFilter } from '@smile/react-front-kit-shared';
import type {
ITableGridViewGridProps,
ITableGridViewTableProps,
@@ -163,57 +164,49 @@ export const gridProps: ITableGridViewGridProps = {
verticalSpacing: 25,
};
-export const filtersCheckboxListProps = [
- { active: false, id: 1, label: 'Nom du filtre', value: 'FILTER_NAME' },
+export const SearchableCheckboxListProps: IFilter[] = [
+ { active: false, id: 1, label: 'Nom du filtre' },
{
active: false,
id: 2,
label: 'Blandit mollis nisi curabitur',
- value: 'BLANDI',
},
{
active: false,
id: 3,
label: 'Ultricies dui ut non massa eget',
- value: 'ULTRICIES',
},
{
active: false,
id: 4,
label: 'Lorem ipsum dolor ',
- value: 'LOREM',
},
- { active: true, id: 5, label: 'Dernière modification', value: 'LAST_UPDATE' },
- { active: true, id: 6, label: 'Type de document', value: 'DOCUMENT_TYPE' },
- { active: true, id: 7, label: 'Période', value: 'PERIOD' },
+ { active: true, id: 5, label: 'Dernière modification' },
+ { active: true, id: 6, label: 'Type de document' },
+ { active: true, id: 7, label: 'Période' },
{
active: false,
id: 8,
label: 'Lorem ipsum dolor ',
- value: 'LOREM2',
},
{
active: false,
id: 9,
label: 'Blandit mollis nisi curabitur',
- value: 'BLANDI2',
},
{
active: false,
id: 10,
label: 'Lorem ipsum dolor ',
- value: 'LOREM3',
},
{
active: false,
id: 11,
label: 'Ultricies dui ut non massa eget',
- value: 'ULTRICIES2',
},
{
active: false,
id: 12,
label: 'Blandit mollis nisi curabitur',
- value: 'BLANDI3',
},
];
diff --git a/packages/storybook-pages/src/Pages/BrowsingPage/BrowsingPage.tsx b/packages/storybook-pages/src/Pages/BrowsingPage/BrowsingPage.tsx
index 6f2de331..27d159ff 100644
--- a/packages/storybook-pages/src/Pages/BrowsingPage/BrowsingPage.tsx
+++ b/packages/storybook-pages/src/Pages/BrowsingPage/BrowsingPage.tsx
@@ -1,7 +1,7 @@
'use client';
-import type { IFilter } from '@smile/react-front-kit';
import type { IFile } from '@smile/react-front-kit-dropzone';
+import type { IFilter } from '@smile/react-front-kit-shared';
import type { FormEvent, ReactElement } from 'react';
import {
@@ -23,10 +23,10 @@ import {
} from '@phosphor-icons/react';
import {
Breadcrumbs,
- FiltersCheckboxList,
FoldableColumnLayout,
Header,
InfoCard,
+ SearchableCheckboxList,
SidebarMenu,
flattenNestedObjects,
} from '@smile/react-front-kit';
@@ -48,9 +48,9 @@ import {
} from '../pages.mock';
import {
+ SearchableCheckboxListProps,
actions,
data,
- filtersCheckboxListProps,
gridProps,
tableProps,
} from './BrowsingPage.mock';
@@ -68,7 +68,7 @@ export function BrowsingPage(): ReactElement {
const { primary, secondary } = useThemes();
const [filtersManagerModal, handleFiltersManagerModal] = useDisclosure(false);
const [globalFilters, setGlobalFilters] = useState(
- filtersCheckboxListProps,
+ SearchableCheckboxListProps,
);
const { classes } = useStyles();
const theme = useMantineTheme();
@@ -226,7 +226,7 @@ export function BrowsingPage(): ReactElement {
[
{globalFilters.map(
- (element) => element.active && `${element.label}, `,
+ (filter) => filter.active && `${filter.label}, `,
)}
]
@@ -256,9 +256,9 @@ export function BrowsingPage(): ReactElement {
size="md"
title="Gérer les filtres"
>
-
buttonLabel="Valider les modifications"
- filters={globalFilters}
+ checkboxes={globalFilters}
onClickButton={handleFiltersManagerSubmit}
placeholder="Chercher dans les filtres"
/>
diff --git a/packages/storybook-pages/src/Pages/SearchResults/SearchResults.tsx b/packages/storybook-pages/src/Pages/SearchResults/SearchResults.tsx
index 7ee2ac55..b8e514a1 100644
--- a/packages/storybook-pages/src/Pages/SearchResults/SearchResults.tsx
+++ b/packages/storybook-pages/src/Pages/SearchResults/SearchResults.tsx
@@ -19,12 +19,12 @@ import { DateInput } from '@mantine/dates';
import { CalendarBlank, CaretDown } from '@phosphor-icons/react';
import {
DocumentList,
- FiltersBar,
FoldableColumnLayout,
Header,
Motif,
Pagination,
SearchBar,
+ SidebarFilters,
} from '@smile/react-front-kit';
import {
isNotNullNorEmpty,
@@ -285,7 +285,7 @@ export function SearchResults(): ReactElement {
);
const totalPages = Math.ceil(typeFilteredResults / rowsPerPage);
- // Remove All filters on FiltersBar
+ // Remove All filters on SidebarFilters
const removeAllFilters = (): void => {
setActiveFilters([]);
setDupontFilter(false);
@@ -403,7 +403,7 @@ export function SearchResults(): ReactElement {
isColumnVisible={isColumnVisible}
onChangeIsColumnVisible={setIsColumnVisible}
sidebarContent={
-