@bluemarble/bm-components 0.0.2
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/esm/index.js +28609 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/types/components/Grid/Filters.d.ts +12 -0
- package/dist/esm/types/components/Grid/Grid.d.ts +29 -0
- package/dist/esm/types/components/Grid/Header.d.ts +11 -0
- package/dist/esm/types/components/Grid/Td.d.ts +3 -0
- package/dist/esm/types/components/Grid/Tr.d.ts +7 -0
- package/dist/esm/types/components/Grid/index.d.ts +5 -0
- package/dist/esm/types/components/Grid/utils.d.ts +5 -0
- package/dist/esm/types/components/index.d.ts +1 -0
- package/dist/esm/types/index.d.ts +1 -0
- package/dist/esm/types/src/components/Grid/Grid.d.ts +27 -0
- package/dist/esm/types/src/components/Grid/Header.d.ts +10 -0
- package/dist/esm/types/src/components/Grid/Td.d.ts +3 -0
- package/dist/esm/types/src/components/Grid/Tr.d.ts +3 -0
- package/dist/esm/types/src/components/Grid/index.d.ts +5 -0
- package/dist/esm/types/src/components/Grid/utils.d.ts +5 -0
- package/dist/esm/types/src/components/index.d.ts +1 -0
- package/dist/esm/types/src/index.d.ts +1 -0
- package/dist/esm/types/tests/src/App.d.ts +2 -0
- package/dist/esm/types/tests/src/main.d.ts +1 -0
- package/dist/esm/types/tests/vite.config.d.ts +2 -0
- package/dist/index.d.ts +43 -0
- package/package.json +36 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { FC, MutableRefObject, ReactNode } from "react";
|
|
2
|
+
interface FiltersProps {
|
|
3
|
+
selectedFilters: Record<string, any>[];
|
|
4
|
+
handleCloseFilter: (item: any) => void;
|
|
5
|
+
customButtons: ReactNode;
|
|
6
|
+
noFilterButtons?: boolean;
|
|
7
|
+
searchAnchorEl: MutableRefObject<HTMLElement | null>;
|
|
8
|
+
setOpenSearch: (value: boolean) => void;
|
|
9
|
+
setAnchorEl: (item: HTMLElement) => void;
|
|
10
|
+
}
|
|
11
|
+
export declare const FiltersBar: FC<FiltersProps>;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import React, { PropsWithChildren, ReactNode } from "react";
|
|
2
|
+
export interface ColumnTitleProps {
|
|
3
|
+
name: string;
|
|
4
|
+
label: string;
|
|
5
|
+
transformer?: (value: string | number | Date) => string;
|
|
6
|
+
}
|
|
7
|
+
export interface FilterProps {
|
|
8
|
+
column: string;
|
|
9
|
+
value: string;
|
|
10
|
+
transformer?: (value: string | number | Date) => string;
|
|
11
|
+
}
|
|
12
|
+
export declare type IFilter = FilterProps;
|
|
13
|
+
export interface GridProps<T> {
|
|
14
|
+
columnTitles: ColumnTitleProps[];
|
|
15
|
+
defaultData: T[];
|
|
16
|
+
tableData: T[];
|
|
17
|
+
selectedFilters: FilterProps[];
|
|
18
|
+
setSelectedFilters(value: FilterProps[]): void;
|
|
19
|
+
setTableData(value: T[]): void;
|
|
20
|
+
updateFilters(value: Record<string, any>[]): void;
|
|
21
|
+
rowOptions?: number[];
|
|
22
|
+
footer?: ReactNode;
|
|
23
|
+
customButtons?: ReactNode;
|
|
24
|
+
isLoading?: boolean;
|
|
25
|
+
noFilterButtons?: boolean;
|
|
26
|
+
noPagination?: boolean;
|
|
27
|
+
}
|
|
28
|
+
declare const Grid: <ObjectType>(props: React.PropsWithChildren<GridProps<ObjectType>>) => JSX.Element;
|
|
29
|
+
export default Grid;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { ColumnTitleProps } from "./Grid";
|
|
3
|
+
interface GridHeaderProps {
|
|
4
|
+
titles?: ColumnTitleProps[];
|
|
5
|
+
orderBy: string;
|
|
6
|
+
order: 'desc' | 'asc' | undefined;
|
|
7
|
+
setOrder(value: string | undefined): void;
|
|
8
|
+
setOrderBy(value: string): void;
|
|
9
|
+
}
|
|
10
|
+
export declare const GridHeader: ({ setOrder, setOrderBy, order, orderBy, titles }: GridHeaderProps) => JSX.Element;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { TableRowProps } from "@mui/material";
|
|
3
|
+
interface CustomTableRowProps extends TableRowProps {
|
|
4
|
+
striped?: boolean;
|
|
5
|
+
}
|
|
6
|
+
export declare const Tr: React.MemoExoticComponent<(props: CustomTableRowProps) => JSX.Element>;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Grid, IFilter, ColumnTitleProps, FilterProps, filterData, Tr, Td } from "./Grid";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./components";
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
export interface ColumnTitleProps {
|
|
3
|
+
name: string;
|
|
4
|
+
label: string;
|
|
5
|
+
}
|
|
6
|
+
export interface FilterProps {
|
|
7
|
+
column: string;
|
|
8
|
+
value: string;
|
|
9
|
+
transformer?: (value: string | number | Date) => string;
|
|
10
|
+
}
|
|
11
|
+
export declare type IFilter = FilterProps;
|
|
12
|
+
export interface GridProps {
|
|
13
|
+
columnTitles: ColumnTitleProps[];
|
|
14
|
+
children: ReactElement;
|
|
15
|
+
defaultData: Record<string, any>[];
|
|
16
|
+
tableData: Record<string, any>[];
|
|
17
|
+
selectedFilters: FilterProps[];
|
|
18
|
+
setSelectedFilters(value: FilterProps[]): void;
|
|
19
|
+
setTableData(value: Record<string, any>[]): void;
|
|
20
|
+
updateFilters(value: Record<string, any>[]): void;
|
|
21
|
+
rowOptions?: number[];
|
|
22
|
+
footer?: ReactElement;
|
|
23
|
+
customButtons?: ReactElement;
|
|
24
|
+
isLoading?: boolean;
|
|
25
|
+
}
|
|
26
|
+
declare const Grid: (props: GridProps) => JSX.Element;
|
|
27
|
+
export default Grid;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ColumnTitleProps } from "./Grid";
|
|
2
|
+
interface GridHeaderProps {
|
|
3
|
+
titles?: ColumnTitleProps[];
|
|
4
|
+
orderBy: string;
|
|
5
|
+
order: 'desc' | 'asc' | undefined;
|
|
6
|
+
setOrder(value: string | undefined): void;
|
|
7
|
+
setOrderBy(value: string): void;
|
|
8
|
+
}
|
|
9
|
+
export declare const GridHeader: ({ setOrder, setOrderBy, order, orderBy, titles }: GridHeaderProps) => JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { FilterProps } from "./Grid";
|
|
2
|
+
export declare function filterData(filters: FilterProps[], defaultData: {
|
|
3
|
+
current: Record<string, any>[];
|
|
4
|
+
}): Record<string, any>[];
|
|
5
|
+
export declare function getPropertyValue(obj: Record<string, any>, property: string): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Grid, IFilter, ColumnTitleProps, FilterProps, filterData, Tr, Td } from "./Grid";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./components";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
import { TableRowProps, TableCellProps } from '@mui/material';
|
|
3
|
+
|
|
4
|
+
interface ColumnTitleProps {
|
|
5
|
+
name: string;
|
|
6
|
+
label: string;
|
|
7
|
+
transformer?: (value: string | number | Date) => string;
|
|
8
|
+
}
|
|
9
|
+
interface FilterProps {
|
|
10
|
+
column: string;
|
|
11
|
+
value: string;
|
|
12
|
+
transformer?: (value: string | number | Date) => string;
|
|
13
|
+
}
|
|
14
|
+
declare type IFilter = FilterProps;
|
|
15
|
+
interface GridProps<T> {
|
|
16
|
+
columnTitles: ColumnTitleProps[];
|
|
17
|
+
defaultData: T[];
|
|
18
|
+
tableData: T[];
|
|
19
|
+
selectedFilters: FilterProps[];
|
|
20
|
+
setSelectedFilters(value: FilterProps[]): void;
|
|
21
|
+
setTableData(value: T[]): void;
|
|
22
|
+
updateFilters(value: Record<string, any>[]): void;
|
|
23
|
+
rowOptions?: number[];
|
|
24
|
+
footer?: ReactNode;
|
|
25
|
+
customButtons?: ReactNode;
|
|
26
|
+
isLoading?: boolean;
|
|
27
|
+
noFilterButtons?: boolean;
|
|
28
|
+
noPagination?: boolean;
|
|
29
|
+
}
|
|
30
|
+
declare const Grid: <ObjectType>(props: React.PropsWithChildren<GridProps<ObjectType>>) => JSX.Element;
|
|
31
|
+
|
|
32
|
+
declare function filterData<T>(filters: FilterProps[], defaultData: {
|
|
33
|
+
current: T[];
|
|
34
|
+
}): T[];
|
|
35
|
+
|
|
36
|
+
interface CustomTableRowProps extends TableRowProps {
|
|
37
|
+
striped?: boolean;
|
|
38
|
+
}
|
|
39
|
+
declare const Tr: React.MemoExoticComponent<(props: CustomTableRowProps) => JSX.Element>;
|
|
40
|
+
|
|
41
|
+
declare const Td: React.MemoExoticComponent<({ children, ...props }: TableCellProps) => JSX.Element>;
|
|
42
|
+
|
|
43
|
+
export { ColumnTitleProps, FilterProps, Grid, IFilter, Td, Tr, filterData };
|
package/package.json
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@bluemarble/bm-components",
|
|
3
|
+
"version": "0.0.2",
|
|
4
|
+
"description": "BM components",
|
|
5
|
+
"main": "dist/cjs/index.js",
|
|
6
|
+
"module": "dist/esm/index.js",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist"
|
|
9
|
+
],
|
|
10
|
+
"types": "dist/index.d.ts",
|
|
11
|
+
"scripts": {
|
|
12
|
+
"rollup": "rollup -c"
|
|
13
|
+
},
|
|
14
|
+
"keywords": [],
|
|
15
|
+
"author": "",
|
|
16
|
+
"license": "ISC",
|
|
17
|
+
"dependencies": {},
|
|
18
|
+
"peerDependencies": {
|
|
19
|
+
"@emotion/react": "^11.8.2",
|
|
20
|
+
"@emotion/styled": "^11.8.1",
|
|
21
|
+
"@mui/material": "^5.5.3",
|
|
22
|
+
"react": "^17.0.2",
|
|
23
|
+
"react-icons": "^4.3.1"
|
|
24
|
+
},
|
|
25
|
+
"devDependencies": {
|
|
26
|
+
"@rollup/plugin-commonjs": "^21.0.3",
|
|
27
|
+
"@rollup/plugin-node-resolve": "^13.1.3",
|
|
28
|
+
"@rollup/plugin-typescript": "^8.3.1",
|
|
29
|
+
"@types/react": "^17.0.43",
|
|
30
|
+
"eslint": "^8.12.0",
|
|
31
|
+
"prettier": "^2.6.2",
|
|
32
|
+
"rollup": "^2.70.1",
|
|
33
|
+
"rollup-plugin-dts": "^4.2.0",
|
|
34
|
+
"typescript": "^4.6.3"
|
|
35
|
+
}
|
|
36
|
+
}
|