@apicurio/common-ui-components 1.0.3 → 1.0.4
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/dist/table/ChipFilter/ChipFilter.d.ts +9 -0
- package/dist/table/ChipFilter/components/FilterCheckbox.d.ts +4 -0
- package/dist/table/ChipFilter/components/FilterSearch.d.ts +5 -0
- package/dist/table/ChipFilter/components/FilterSelector.d.ts +6 -0
- package/dist/table/ChipFilter/components/index.d.ts +3 -0
- package/dist/table/ChipFilter/index.d.ts +4 -0
- package/dist/table/ChipFilter/types.d.ts +20 -0
- package/dist/table/Loading.d.ts +1 -0
- package/dist/table/Pagination.d.ts +9 -0
- package/dist/table/ResponsiveTable.d.ts +79 -0
- package/dist/table/TableSkeleton.d.ts +8 -0
- package/dist/table/index.d.ts +1 -0
- package/package.json +14 -9
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ToolbarToggleGroupProps } from "@patternfly/react-core";
|
|
2
|
+
import type { FilterType } from "./types";
|
|
3
|
+
export type ChipFilterProps = {
|
|
4
|
+
filters: {
|
|
5
|
+
[label: string]: FilterType;
|
|
6
|
+
};
|
|
7
|
+
breakpoint?: ToolbarToggleGroupProps["breakpoint"];
|
|
8
|
+
};
|
|
9
|
+
export declare function ChipFilter({ filters, breakpoint }: ChipFilterProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export type SearchType = {
|
|
2
|
+
type: "search";
|
|
3
|
+
validate: (value: string) => boolean;
|
|
4
|
+
errorMessage: string;
|
|
5
|
+
chips: string[];
|
|
6
|
+
onSearch: (value: string) => void;
|
|
7
|
+
onRemoveChip: (value: string) => void;
|
|
8
|
+
onRemoveGroup: () => void;
|
|
9
|
+
};
|
|
10
|
+
export type CheckboxType<T extends string | number> = {
|
|
11
|
+
type: "checkbox";
|
|
12
|
+
chips: string[];
|
|
13
|
+
options: {
|
|
14
|
+
[key in T]: string;
|
|
15
|
+
};
|
|
16
|
+
onToggle: (value: T) => void;
|
|
17
|
+
onRemoveChip: (value: T) => void;
|
|
18
|
+
onRemoveGroup: () => void;
|
|
19
|
+
};
|
|
20
|
+
export type FilterType = SearchType | CheckboxType<any>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function Loading(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { PaginationProps as PFPaginationProps } from "@patternfly/react-core";
|
|
2
|
+
export type PaginationProps = {
|
|
3
|
+
itemCount: number;
|
|
4
|
+
page: number;
|
|
5
|
+
perPage: number;
|
|
6
|
+
isCompact?: boolean;
|
|
7
|
+
onChange: (page: number, perPage: number) => void;
|
|
8
|
+
} & Pick<PFPaginationProps, "variant">;
|
|
9
|
+
export declare function Pagination({ itemCount, page, perPage, isCompact, onChange, variant, }: PaginationProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import type { ActionsColumnProps, TableVariant, TdProps, ThProps } from "@patternfly/react-table";
|
|
2
|
+
import { ActionsColumn, Td, Th } from "@patternfly/react-table";
|
|
3
|
+
import type { PropsWithChildren, ReactElement } from "react";
|
|
4
|
+
export type RenderHeaderCb<TCol> = (props: {
|
|
5
|
+
Th: typeof Th;
|
|
6
|
+
key: string;
|
|
7
|
+
column: TCol;
|
|
8
|
+
colIndex: number;
|
|
9
|
+
}) => ReactElement<ResponsiveThProps>;
|
|
10
|
+
export type RenderCellCb<TRow, TCol> = (props: {
|
|
11
|
+
Td: typeof Td;
|
|
12
|
+
key: string;
|
|
13
|
+
column: TCol;
|
|
14
|
+
colIndex: number;
|
|
15
|
+
rowIndex: number;
|
|
16
|
+
row: TRow;
|
|
17
|
+
}) => ReactElement<ResponsiveTdProps>;
|
|
18
|
+
export type RenderActionsCb<TRow> = (props: {
|
|
19
|
+
ActionsColumn: typeof ActionsColumn;
|
|
20
|
+
row: TRow;
|
|
21
|
+
rowIndex: number;
|
|
22
|
+
}) => ReactElement<ActionsColumnProps> | undefined;
|
|
23
|
+
export type ResponsiveTableProps<TRow, TCol> = {
|
|
24
|
+
ariaLabel: string;
|
|
25
|
+
minimumColumnWidth?: number;
|
|
26
|
+
columns: readonly TCol[];
|
|
27
|
+
data: TRow[] | undefined;
|
|
28
|
+
renderHeader: RenderHeaderCb<TCol>;
|
|
29
|
+
renderCell: RenderCellCb<TRow, TCol>;
|
|
30
|
+
renderActions?: RenderActionsCb<TRow>;
|
|
31
|
+
isColumnSortable?: (column: TCol) => (ResponsiveThProps["sort"] & {
|
|
32
|
+
label: string;
|
|
33
|
+
}) | undefined;
|
|
34
|
+
isRowDeleted?: (props: RowProps<TRow>) => boolean;
|
|
35
|
+
isRowSelected?: (props: RowProps<TRow>) => boolean;
|
|
36
|
+
expectedLength?: number;
|
|
37
|
+
onRowClick?: (props: RowProps<TRow>) => void;
|
|
38
|
+
setActionCellOuiaId?: (props: RowProps<TRow>) => string;
|
|
39
|
+
setRowOuiaId?: (props: RowProps<TRow>) => string;
|
|
40
|
+
tableOuiaId?: string;
|
|
41
|
+
variant?: TableVariant;
|
|
42
|
+
};
|
|
43
|
+
type RowProps<TRow> = {
|
|
44
|
+
row: TRow;
|
|
45
|
+
rowIndex: number;
|
|
46
|
+
};
|
|
47
|
+
export declare const ResponsiveTable: <TRow, TCol>({ ariaLabel, minimumColumnWidth, columns, data, renderHeader, renderCell, renderActions, isColumnSortable, isRowDeleted, isRowSelected, expectedLength, onRowClick, setActionCellOuiaId, setRowOuiaId, tableOuiaId, children, variant, }: PropsWithChildren<ResponsiveTableProps<TRow, TCol>>) => import("react/jsx-runtime").JSX.Element;
|
|
48
|
+
export type ResponsiveThProps = {
|
|
49
|
+
position: number;
|
|
50
|
+
tableWidth: number;
|
|
51
|
+
columnWidth: number;
|
|
52
|
+
canHide: boolean;
|
|
53
|
+
} & Omit<ThProps, "ref">;
|
|
54
|
+
export declare const ResponsiveTh: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<{
|
|
55
|
+
position: number;
|
|
56
|
+
tableWidth: number;
|
|
57
|
+
columnWidth: number;
|
|
58
|
+
canHide: boolean;
|
|
59
|
+
} & Omit<ThProps, "ref"> & import("react").RefAttributes<HTMLTableCellElement>>>;
|
|
60
|
+
export type ResponsiveTdProps = {
|
|
61
|
+
position: number;
|
|
62
|
+
tableWidth: number;
|
|
63
|
+
columnWidth: number;
|
|
64
|
+
canHide: boolean;
|
|
65
|
+
} & Omit<TdProps, "ref">;
|
|
66
|
+
export declare const ResponsiveTd: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<{
|
|
67
|
+
position: number;
|
|
68
|
+
tableWidth: number;
|
|
69
|
+
columnWidth: number;
|
|
70
|
+
canHide: boolean;
|
|
71
|
+
} & Omit<TdProps, "ref"> & import("react").RefAttributes<HTMLTableCellElement>>>;
|
|
72
|
+
export type DeletableRowProps = PropsWithChildren<{
|
|
73
|
+
isSelected: boolean;
|
|
74
|
+
isDeleted: boolean;
|
|
75
|
+
onClick?: () => void;
|
|
76
|
+
rowOuiaId?: string;
|
|
77
|
+
}>;
|
|
78
|
+
export declare const DeletableRow: import("react").NamedExoticComponent<DeletableRowProps>;
|
|
79
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Td } from "@patternfly/react-table";
|
|
2
|
+
type Props = {
|
|
3
|
+
columns: number;
|
|
4
|
+
rows: number;
|
|
5
|
+
getTd?: (index: number) => typeof Td;
|
|
6
|
+
};
|
|
7
|
+
export declare function TableSkeleton({ columns, rows, getTd }: Props): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./ResponsiveTable";
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@apicurio/common-ui-components",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.4",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/main.js",
|
|
7
7
|
"types": "dist/main.d.ts",
|
|
@@ -15,16 +15,23 @@
|
|
|
15
15
|
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0"
|
|
16
16
|
},
|
|
17
17
|
"peerDependencies": {
|
|
18
|
-
"react": "18.2.0",
|
|
19
|
-
"react-dom": "18.2.0",
|
|
20
|
-
"react-router-dom": "6.18.0",
|
|
21
18
|
"@patternfly/patternfly": "5.1.0",
|
|
22
19
|
"@patternfly/react-core": "5.1.1",
|
|
23
20
|
"@patternfly/react-icons": "5.1.1",
|
|
24
|
-
"@patternfly/react-table": "5.1.1"
|
|
21
|
+
"@patternfly/react-table": "5.1.1",
|
|
22
|
+
"luxon": "3.4.3",
|
|
23
|
+
"react": "18.2.0",
|
|
24
|
+
"react-dom": "18.2.0",
|
|
25
|
+
"react-router-dom": "6.18.0",
|
|
26
|
+
"use-resize-observer": "9.1.0"
|
|
25
27
|
},
|
|
26
28
|
"devDependencies": {
|
|
27
29
|
"@apicurio/eslint-config": "0.2.0",
|
|
30
|
+
"@patternfly/patternfly": "5.1.0",
|
|
31
|
+
"@patternfly/react-core": "5.1.1",
|
|
32
|
+
"@patternfly/react-icons": "5.1.1",
|
|
33
|
+
"@patternfly/react-table": "5.1.1",
|
|
34
|
+
"@types/luxon": "3.3.5",
|
|
28
35
|
"@types/node": "18.18.13",
|
|
29
36
|
"@types/react": "18.2.39",
|
|
30
37
|
"@types/react-dom": "18.2.17",
|
|
@@ -34,6 +41,7 @@
|
|
|
34
41
|
"eslint": "8.45.0",
|
|
35
42
|
"eslint-plugin-react-hooks": "4.6.0",
|
|
36
43
|
"eslint-plugin-react-refresh": "0.4.3",
|
|
44
|
+
"luxon": "3.4.3",
|
|
37
45
|
"rimraf": "5.0.5",
|
|
38
46
|
"typescript": "5.0.2",
|
|
39
47
|
"vite": "4.4.5",
|
|
@@ -41,9 +49,6 @@
|
|
|
41
49
|
"react": "18.2.0",
|
|
42
50
|
"react-dom": "18.2.0",
|
|
43
51
|
"react-router-dom": "6.18.0",
|
|
44
|
-
"
|
|
45
|
-
"@patternfly/react-core": "5.1.1",
|
|
46
|
-
"@patternfly/react-icons": "5.1.1",
|
|
47
|
-
"@patternfly/react-table": "5.1.1"
|
|
52
|
+
"use-resize-observer": "9.1.0"
|
|
48
53
|
}
|
|
49
54
|
}
|