@indico-data/design-system 2.50.0 → 2.51.1
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/lib/components/tanstackTable/TankstackTable.types.d.ts +45 -0
- package/lib/components/tanstackTable/TanstackTable.stories.d.ts +16 -0
- package/lib/components/tanstackTable/TanstakTable.d.ts +4 -0
- package/lib/components/tanstackTable/__tests__/TanstackTable.test.d.ts +1 -0
- package/lib/components/tanstackTable/__tests__/__mocks__/test-mock-data.d.ts +8 -0
- package/lib/components/tanstackTable/components/ActionBar/ActionBar.d.ts +17 -0
- package/lib/components/tanstackTable/components/ActionBar/ActionBar.stories.d.ts +10 -0
- package/lib/components/tanstackTable/components/ActionBar/__tests__/ActionBar.test.d.ts +1 -0
- package/lib/components/tanstackTable/components/ActionBar/index.d.ts +1 -0
- package/lib/components/tanstackTable/components/NoResults/NoResults.d.ts +7 -0
- package/lib/components/tanstackTable/components/NoResults/__tests__/NoResult.test.d.ts +1 -0
- package/lib/components/tanstackTable/components/NoResults/index.d.ts +1 -0
- package/lib/components/tanstackTable/components/TableBody/TableBody.d.ts +11 -0
- package/lib/components/tanstackTable/components/TableBody/index.d.ts +1 -0
- package/lib/components/tanstackTable/components/TableHeader/TableHeader.d.ts +6 -0
- package/lib/components/tanstackTable/components/TableHeader/index.d.ts +1 -0
- package/lib/components/tanstackTable/components/TablePagination/TablePagination.d.ts +9 -0
- package/lib/components/tanstackTable/components/TablePagination/__tests__/TablePagination.test.d.ts +1 -0
- package/lib/components/tanstackTable/components/TablePagination/index.d.ts +1 -0
- package/lib/components/tanstackTable/docs/pinnedColumns/PinnedColumn.stories.d.ts +7 -0
- package/lib/components/tanstackTable/docs/withRowClick/WithRowClick.stories.d.ts +7 -0
- package/lib/components/tanstackTable/helpers.d.ts +830 -0
- package/lib/components/tanstackTable/index.d.ts +2 -0
- package/lib/components/tanstackTable/mock-data/mock-data.d.ts +14 -0
- package/lib/components/tanstackTable/mock-data/table-configuration.d.ts +3 -0
- package/lib/components/tanstackTable/useTanstackTable.d.ts +14 -0
- package/lib/index.css +262 -0
- package/lib/index.d.ts +67 -17
- package/lib/index.esm.css +262 -0
- package/lib/index.esm.js +20432 -56
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +20432 -55
- package/lib/index.js.map +1 -1
- package/package.json +2 -1
- package/src/components/tanstackTable/TankstackTable.types.ts +44 -0
- package/src/components/tanstackTable/TanstackTable.mdx +122 -0
- package/src/components/tanstackTable/TanstackTable.stories.tsx +284 -0
- package/src/components/tanstackTable/TanstakTable.tsx +156 -0
- package/src/components/tanstackTable/__tests__/TanstackTable.test.tsx +73 -0
- package/src/components/tanstackTable/__tests__/__mocks__/test-mock-data.tsx +83 -0
- package/src/components/tanstackTable/components/ActionBar/ActionBar.mdx +10 -0
- package/src/components/tanstackTable/components/ActionBar/ActionBar.scss +30 -0
- package/src/components/tanstackTable/components/ActionBar/ActionBar.stories.tsx +98 -0
- package/src/components/tanstackTable/components/ActionBar/ActionBar.tsx +43 -0
- package/src/components/tanstackTable/components/ActionBar/__tests__/ActionBar.test.tsx +65 -0
- package/src/components/tanstackTable/components/ActionBar/index.ts +1 -0
- package/src/components/tanstackTable/components/NoResults/NoResults.scss +24 -0
- package/src/components/tanstackTable/components/NoResults/NoResults.tsx +22 -0
- package/src/components/tanstackTable/components/NoResults/__tests__/NoResult.test.tsx +25 -0
- package/src/components/tanstackTable/components/NoResults/index.ts +1 -0
- package/src/components/tanstackTable/components/TableBody/TableBody.tsx +77 -0
- package/src/components/tanstackTable/components/TableBody/index.ts +1 -0
- package/src/components/tanstackTable/components/TableHeader/TableHeader.tsx +49 -0
- package/src/components/tanstackTable/components/TableHeader/index.ts +1 -0
- package/src/components/tanstackTable/components/TablePagination/TablePagination.tsx +45 -0
- package/src/components/tanstackTable/components/TablePagination/__tests__/TablePagination.test.tsx +18 -0
- package/src/components/tanstackTable/components/TablePagination/index.ts +1 -0
- package/src/components/tanstackTable/docs/pinnedColumns/PinnedColumn.mdx +34 -0
- package/src/components/tanstackTable/docs/pinnedColumns/PinnedColumn.stories.tsx +40 -0
- package/src/components/tanstackTable/docs/withRowClick/WithRowClick.mdx +48 -0
- package/src/components/tanstackTable/docs/withRowClick/WithRowClick.stories.tsx +32 -0
- package/src/components/tanstackTable/helpers.ts +45 -0
- package/src/components/tanstackTable/index.ts +2 -0
- package/src/components/tanstackTable/mock-data/mock-data.ts +256 -0
- package/src/components/tanstackTable/mock-data/table-configuration.tsx +222 -0
- package/src/components/tanstackTable/styles/_variables.scss +35 -0
- package/src/components/tanstackTable/styles/table.scss +218 -0
- package/src/components/tanstackTable/styles/test.scss +19 -0
- package/src/components/tanstackTable/tanstack-table.d.ts +19 -0
- package/src/components/tanstackTable/useTanstackTable.tsx +39 -0
- package/src/index.ts +1 -0
- package/src/legacy/components/loading-indicators/CirclePulse/CirclePulse.tsx +1 -0
- package/src/styles/index.scss +1 -0
- package/src/stylesAndAnimations/utilityClasses/UtilityClassesTable.tsx +16 -2
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { Row, ColumnDef } from '@tanstack/react-table';
|
|
2
|
+
export type WithPaginationProps = {
|
|
3
|
+
rowsPerPage: number;
|
|
4
|
+
rowCount: number;
|
|
5
|
+
onChangePage: (page: number) => void;
|
|
6
|
+
currentPage: number;
|
|
7
|
+
totalEntriesText?: string;
|
|
8
|
+
showPagination: true;
|
|
9
|
+
};
|
|
10
|
+
export type WithoutPaginationProps = {
|
|
11
|
+
rowsPerPage?: number;
|
|
12
|
+
rowCount?: number;
|
|
13
|
+
onChangePage?: (page: number) => void;
|
|
14
|
+
currentPage?: number;
|
|
15
|
+
totalEntriesText?: string;
|
|
16
|
+
showPagination?: false;
|
|
17
|
+
};
|
|
18
|
+
export type PaginationProps = WithPaginationProps | WithoutPaginationProps;
|
|
19
|
+
export type Props<T extends object> = {
|
|
20
|
+
data: T[];
|
|
21
|
+
columns: ColumnDef<T & {
|
|
22
|
+
id: string;
|
|
23
|
+
}>[];
|
|
24
|
+
className?: string;
|
|
25
|
+
actionBarClassName?: string;
|
|
26
|
+
TableActions?: React.ComponentType<{
|
|
27
|
+
selectedItems: Row<any>[];
|
|
28
|
+
unselectRows: () => void;
|
|
29
|
+
}>;
|
|
30
|
+
error?: {
|
|
31
|
+
hasError: boolean;
|
|
32
|
+
errorMessage?: string;
|
|
33
|
+
};
|
|
34
|
+
enableRowSelection?: boolean | ((row: Row<T>) => boolean);
|
|
35
|
+
clearFilters?: () => void;
|
|
36
|
+
hasFilters?: boolean;
|
|
37
|
+
isLoading?: boolean;
|
|
38
|
+
defaultPinnedColumns?: string[];
|
|
39
|
+
onClickRow?: ((row: Row<T>) => void) | null;
|
|
40
|
+
onRowClick?: (row: T) => void;
|
|
41
|
+
activeRows?: string[];
|
|
42
|
+
rowSelection?: Record<string, boolean>;
|
|
43
|
+
onRowSelectionChange?: (updater: Record<string, boolean>) => void;
|
|
44
|
+
onSelectAllChange?: (isSelected: boolean) => void;
|
|
45
|
+
} & PaginationProps;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { TanstackTable } from './TanstakTable';
|
|
3
|
+
import { Person } from './mock-data/mock-data';
|
|
4
|
+
declare const meta: Meta;
|
|
5
|
+
export default meta;
|
|
6
|
+
type Story = StoryObj<typeof TanstackTable<Person>>;
|
|
7
|
+
export declare const Default: Story;
|
|
8
|
+
export declare const WithRowClick: Story;
|
|
9
|
+
export declare const PinnedColumns: Story;
|
|
10
|
+
export declare const WithTableActions: Story;
|
|
11
|
+
export declare const NoResults: Story;
|
|
12
|
+
export declare const NoResultsWithFilters: Story;
|
|
13
|
+
export declare const IsLoading: Story;
|
|
14
|
+
export declare const IsLoadingWithData: Story;
|
|
15
|
+
export declare const WithPagination: Story;
|
|
16
|
+
export declare const WithRowSelection: Story;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { Props } from './TankstackTable.types';
|
|
2
|
+
export declare function TanstackTable<T extends object>({ columns: defaultColumns, data, className, currentPage, rowCount, rowsPerPage, onChangePage, totalEntriesText, TableActions, error, enableRowSelection, clearFilters, hasFilters, showPagination, isLoading, defaultPinnedColumns, onRowClick, activeRows, actionBarClassName, ...rest }: Props<T & {
|
|
3
|
+
id: string;
|
|
4
|
+
}>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@testing-library/jest-dom';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Row, Table } from '@tanstack/react-table';
|
|
3
|
+
type Props<T extends object> = {
|
|
4
|
+
table: Table<T & {
|
|
5
|
+
id: string;
|
|
6
|
+
}>;
|
|
7
|
+
TableActions?: React.ComponentType<{
|
|
8
|
+
selectedItems: Row<T & {
|
|
9
|
+
id: string;
|
|
10
|
+
}>[];
|
|
11
|
+
unselectRows: () => void;
|
|
12
|
+
}>;
|
|
13
|
+
className?: string;
|
|
14
|
+
children?: React.ReactNode;
|
|
15
|
+
};
|
|
16
|
+
export declare function ActionBar<T extends object>({ table, TableActions, className, children, }: Props<T>): import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { ActionBar } from './ActionBar';
|
|
3
|
+
declare const meta: Meta;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof ActionBar<{
|
|
6
|
+
id: string;
|
|
7
|
+
}>>;
|
|
8
|
+
export declare const Default: Story;
|
|
9
|
+
export declare const WithCustomTableActions: Story;
|
|
10
|
+
export declare const WithChildren: Story;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ActionBar } from './ActionBar';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { NoResults } from './NoResults';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Table } from '@tanstack/react-table';
|
|
2
|
+
export type Props<T> = {
|
|
3
|
+
table: Table<T>;
|
|
4
|
+
onRowClick?: ((row: T & {
|
|
5
|
+
id: string;
|
|
6
|
+
}) => void) | null | undefined;
|
|
7
|
+
isLoading: boolean;
|
|
8
|
+
columnsLength: number;
|
|
9
|
+
activeRows: string[];
|
|
10
|
+
};
|
|
11
|
+
export declare const TableBody: <T>({ table, onRowClick, isLoading, columnsLength, activeRows, }: Props<T>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { TableBody } from './TableBody';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { TableHeader } from './TableHeader';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
interface TablePaginationProps {
|
|
2
|
+
rowsPerPage: number;
|
|
3
|
+
rowCount: number;
|
|
4
|
+
onChangePage: (page: number) => void;
|
|
5
|
+
currentPage: number;
|
|
6
|
+
totalEntriesText?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare const TablePagination: ({ rowsPerPage, rowCount, onChangePage, currentPage, totalEntriesText, }: TablePaginationProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export {};
|
package/lib/components/tanstackTable/components/TablePagination/__tests__/TablePagination.test.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './TablePagination';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { TanstackTable } from '../../TanstakTable';
|
|
3
|
+
import { Person } from '../../mock-data/mock-data';
|
|
4
|
+
declare const meta: Meta;
|
|
5
|
+
export default meta;
|
|
6
|
+
type Story = StoryObj<typeof TanstackTable<Person>>;
|
|
7
|
+
export declare const PinnedColumns: Story;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { TanstackTable } from '../../TanstakTable';
|
|
3
|
+
import { Person } from '../../mock-data/mock-data';
|
|
4
|
+
declare const meta: Meta;
|
|
5
|
+
export default meta;
|
|
6
|
+
type Story = StoryObj<typeof TanstackTable<Person>>;
|
|
7
|
+
export declare const WithRowClick: Story;
|