@bluemarble/bm-components 0.0.6 → 0.0.9
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 +8584 -27226
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/components/Autocomplete/index.d.ts +20 -0
- package/dist/esm/types/components/Checkbox/index.d.ts +19 -0
- package/dist/esm/types/components/Form/index.d.ts +8 -0
- package/dist/esm/types/components/Grid/AutoCreatedRows.d.ts +1 -0
- package/dist/esm/types/components/Grid/EditableTableCell/DefaultInput.d.ts +17 -0
- package/dist/esm/types/components/Grid/EditableTableCell/InputMask.d.ts +8 -0
- package/dist/esm/types/components/Grid/EditableTableCell/index.d.ts +24 -0
- package/dist/esm/types/components/Grid/Grid.d.ts +2 -2
- package/dist/esm/types/components/Grid/Header.d.ts +1 -0
- package/dist/esm/types/components/Grid/Td.d.ts +2 -20
- package/dist/esm/types/components/Grid/Tr.d.ts +6 -0
- package/dist/esm/types/components/Grid/hooks/useGrid.d.ts +20 -0
- package/dist/esm/types/components/Grid/index.d.ts +2 -1
- package/dist/esm/types/components/GridV2/index.d.ts +6 -0
- package/dist/esm/types/components/Input/index.d.ts +11 -0
- package/dist/esm/types/components/InputMask/index.d.ts +13 -0
- package/dist/esm/types/components/LargeButton/index.d.ts +8 -0
- package/dist/esm/types/components/Radio/index.d.ts +23 -0
- package/dist/esm/types/components/Select/index.d.ts +17 -0
- package/dist/esm/types/components/Switch/index.d.ts +19 -0
- package/dist/esm/types/components/index.d.ts +9 -0
- package/dist/esm/types/playground/src/App.d.ts +2 -0
- package/dist/esm/types/playground/src/main.d.ts +1 -0
- package/dist/esm/types/playground/src/theme.d.ts +1 -0
- package/dist/esm/types/playground/vite.config.d.ts +2 -0
- package/dist/esm/types/src/components/Autocomplete/index.d.ts +20 -0
- package/dist/esm/types/src/components/Checkbox/index.d.ts +18 -0
- package/dist/esm/types/src/components/Grid/AutoCreatedRows.d.ts +8 -0
- package/dist/esm/types/src/components/Grid/EditableTableCell/DefaultInput.d.ts +16 -0
- package/dist/esm/types/src/components/Grid/EditableTableCell/InputMask.d.ts +7 -0
- package/dist/esm/types/src/components/Grid/EditableTableCell/index.d.ts +23 -0
- package/dist/esm/types/src/components/Grid/Filters.d.ts +12 -0
- package/dist/esm/types/src/components/Grid/Grid.d.ts +32 -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 +13 -0
- package/dist/esm/types/src/components/Grid/index.d.ts +6 -0
- package/dist/esm/types/src/components/Grid/utils.d.ts +5 -0
- package/dist/esm/types/src/components/Input/index.d.ts +12 -0
- package/dist/esm/types/src/components/InputMask/index.d.ts +12 -0
- package/dist/esm/types/src/components/LargeButton/index.d.ts +8 -0
- package/dist/esm/types/src/components/Radio/index.d.ts +22 -0
- package/dist/esm/types/src/components/Select/index.d.ts +17 -0
- package/dist/esm/types/src/components/Switch/index.d.ts +18 -0
- package/dist/esm/types/src/components/index.d.ts +9 -0
- package/dist/esm/types/src/index.d.ts +1 -0
- package/dist/index.d.ts +133 -14
- package/package.json +13 -6
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import React, { ReactNode, PropsWithChildren, FC } from 'react';
|
|
3
|
+
import { TableCellProps, TextFieldProps, TableRowProps, StandardTextFieldProps, SelectProps as SelectProps$1, FormControlProps, InputLabelProps, AutocompleteRenderInputParams, AutocompleteProps as AutocompleteProps$1, CheckboxProps as CheckboxProps$1, FormControlLabelProps, SwitchProps as SwitchProps$1, RadioGroupProps, ButtonProps } from '@mui/material';
|
|
4
|
+
import { TableOptions } from 'react-table';
|
|
5
|
+
import IMask$1 from 'imask';
|
|
4
6
|
|
|
5
|
-
interface ColumnTitleProps {
|
|
6
|
-
name:
|
|
7
|
+
interface ColumnTitleProps<T = {}> {
|
|
8
|
+
name: keyof T | "-";
|
|
7
9
|
label: string;
|
|
8
10
|
transformer?: (value: string | number | Date) => string;
|
|
9
11
|
sx?: TableCellProps["sx"];
|
|
@@ -36,19 +38,19 @@ declare function filterData<T>(filters: FilterProps[], defaultData: {
|
|
|
36
38
|
current: T[];
|
|
37
39
|
}): T[];
|
|
38
40
|
|
|
39
|
-
interface CustomTableRowProps extends TableRowProps {
|
|
40
|
-
striped?: boolean;
|
|
41
|
-
}
|
|
42
|
-
declare const Tr: React.MemoExoticComponent<(props: CustomTableRowProps) => JSX.Element>;
|
|
43
|
-
|
|
44
41
|
interface EditableTableCellProps extends TableCellProps {
|
|
45
42
|
name: string;
|
|
46
43
|
TextFieldProps?: TextFieldProps;
|
|
47
44
|
type?: TextFieldProps["type"];
|
|
48
45
|
fullWidth?: boolean;
|
|
49
|
-
|
|
46
|
+
rowData?: Record<string, any>;
|
|
50
47
|
mask?: IMask.AnyMaskedOptions;
|
|
51
|
-
|
|
48
|
+
bordered?: boolean;
|
|
49
|
+
rowIndex?: string | number;
|
|
50
|
+
formatCellValue?: (value: string) => string;
|
|
51
|
+
formatInputDefautvalue?: (value: string) => string;
|
|
52
|
+
onSave?: (props: OnSaveProps) => void;
|
|
53
|
+
onCancel?: () => void;
|
|
52
54
|
}
|
|
53
55
|
interface OnSaveProps {
|
|
54
56
|
name: string;
|
|
@@ -56,7 +58,124 @@ interface OnSaveProps {
|
|
|
56
58
|
value: string;
|
|
57
59
|
data: Record<string, any>;
|
|
58
60
|
}
|
|
59
|
-
declare const EditableTableCell: (allProps: EditableTableCellProps) => JSX.Element;
|
|
61
|
+
declare const EditableTableCell: (allProps: EditableTableCellProps) => JSX.Element;
|
|
62
|
+
|
|
63
|
+
interface CustomTableRowProps extends TableRowProps {
|
|
64
|
+
striped?: boolean;
|
|
65
|
+
bordered?: boolean;
|
|
66
|
+
index?: number;
|
|
67
|
+
rowData?: Record<string, any>;
|
|
68
|
+
onSave?: (props: OnSaveProps) => void;
|
|
69
|
+
children: React.ReactElement[];
|
|
70
|
+
}
|
|
71
|
+
declare const Tr: React.MemoExoticComponent<(props: CustomTableRowProps) => JSX.Element>;
|
|
72
|
+
|
|
60
73
|
declare const Td: React.MemoExoticComponent<({ children, ...props }: TableCellProps) => JSX.Element>;
|
|
61
74
|
|
|
62
|
-
|
|
75
|
+
interface GridV2Props<T extends Record<string, unknown>> extends TableOptions<T> {
|
|
76
|
+
}
|
|
77
|
+
declare function GridV2<T extends Record<string, any>>({ columns, data, }: PropsWithChildren<GridV2Props<T>>): JSX.Element;
|
|
78
|
+
|
|
79
|
+
interface InputProps extends StandardTextFieldProps {
|
|
80
|
+
name: string;
|
|
81
|
+
label: string;
|
|
82
|
+
withFormik?: boolean;
|
|
83
|
+
}
|
|
84
|
+
declare const Input: FC<InputProps>;
|
|
85
|
+
|
|
86
|
+
interface InputMaskProps extends Partial<StandardTextFieldProps> {
|
|
87
|
+
name: string;
|
|
88
|
+
label: string;
|
|
89
|
+
withFormik?: boolean;
|
|
90
|
+
mask: IMask$1.AnyMaskedOptions;
|
|
91
|
+
onChangeValue?: (value: string, unmaskedValue: string) => void;
|
|
92
|
+
}
|
|
93
|
+
declare function InputMask({ withFormik, ...rest }: InputMaskProps): JSX.Element;
|
|
94
|
+
|
|
95
|
+
interface CustomInputLabelProps extends InputLabelProps {
|
|
96
|
+
size?: "small";
|
|
97
|
+
}
|
|
98
|
+
interface SelectProps extends SelectProps$1 {
|
|
99
|
+
name: string;
|
|
100
|
+
label: string;
|
|
101
|
+
defaultValue?: string;
|
|
102
|
+
withFormik?: boolean;
|
|
103
|
+
FormControlProps?: Partial<FormControlProps>;
|
|
104
|
+
InputLabelProps?: Partial<CustomInputLabelProps>;
|
|
105
|
+
}
|
|
106
|
+
declare const Select: FC<SelectProps>;
|
|
107
|
+
|
|
108
|
+
declare type MuiAutocomplete<T> = Omit<AutocompleteProps$1<T, boolean, undefined, boolean>, "renderInput">;
|
|
109
|
+
declare type AutocompleteProps<T> = AutocompleteWithoutProps<T> | AutocompleteWithFormikProps<T>;
|
|
110
|
+
interface AutocompleteWithoutProps<T> extends MuiAutocomplete<T> {
|
|
111
|
+
name?: never;
|
|
112
|
+
withFormik: false;
|
|
113
|
+
getOptionValue?: never;
|
|
114
|
+
label?: string;
|
|
115
|
+
renderInput?: (params: AutocompleteRenderInputParams) => ReactNode;
|
|
116
|
+
}
|
|
117
|
+
interface AutocompleteWithFormikProps<T> extends MuiAutocomplete<T> {
|
|
118
|
+
name: string;
|
|
119
|
+
withFormik?: true;
|
|
120
|
+
label?: string;
|
|
121
|
+
renderInput?: (params: AutocompleteRenderInputParams) => ReactNode;
|
|
122
|
+
getOptionValue: (option: T) => string | number;
|
|
123
|
+
}
|
|
124
|
+
declare function Autocomplete<T>({ withFormik, name, getOptionValue, ...rest }: AutocompleteProps<T>): JSX.Element;
|
|
125
|
+
|
|
126
|
+
declare type CheckboxProps = CheckboxWithFormik | CheckboxWithoutFormik;
|
|
127
|
+
interface CheckboxWithFormik extends CheckboxProps$1 {
|
|
128
|
+
name: string;
|
|
129
|
+
label?: string;
|
|
130
|
+
withFormik?: true;
|
|
131
|
+
FormControlLabelProps?: Partial<FormControlLabelProps>;
|
|
132
|
+
}
|
|
133
|
+
interface CheckboxWithoutFormik extends CheckboxProps$1 {
|
|
134
|
+
name?: never;
|
|
135
|
+
label?: string;
|
|
136
|
+
withFormik: false;
|
|
137
|
+
FormControlLabelProps?: Partial<FormControlLabelProps>;
|
|
138
|
+
}
|
|
139
|
+
declare const Checkbox: ({ withFormik, name, ...props }: CheckboxProps) => JSX.Element;
|
|
140
|
+
|
|
141
|
+
declare type SwitchProps = SwitchWithFormik | SwitchWithoutFormik;
|
|
142
|
+
interface SwitchWithFormik extends SwitchProps$1 {
|
|
143
|
+
name: string;
|
|
144
|
+
label?: string;
|
|
145
|
+
withFormik?: true;
|
|
146
|
+
FormControlLabelProps?: Partial<FormControlLabelProps>;
|
|
147
|
+
}
|
|
148
|
+
interface SwitchWithoutFormik extends SwitchProps$1 {
|
|
149
|
+
name?: never;
|
|
150
|
+
label?: string;
|
|
151
|
+
withFormik: false;
|
|
152
|
+
FormControlLabelProps?: Partial<FormControlLabelProps>;
|
|
153
|
+
}
|
|
154
|
+
declare const Switch: ({ withFormik, name, ...props }: SwitchProps) => JSX.Element;
|
|
155
|
+
|
|
156
|
+
declare type RadioOptionProps = {
|
|
157
|
+
value: string | number | boolean;
|
|
158
|
+
label: string;
|
|
159
|
+
};
|
|
160
|
+
declare type RadioOptionsProps = RadioWithFormik | RadioWithoutFormik;
|
|
161
|
+
interface RadioWithFormik extends RadioGroupProps {
|
|
162
|
+
name: string;
|
|
163
|
+
label?: string;
|
|
164
|
+
options: RadioOptionProps[];
|
|
165
|
+
withFormik?: true;
|
|
166
|
+
}
|
|
167
|
+
interface RadioWithoutFormik extends RadioGroupProps {
|
|
168
|
+
name?: never;
|
|
169
|
+
label?: string;
|
|
170
|
+
options: RadioOptionProps[];
|
|
171
|
+
withFormik: false;
|
|
172
|
+
}
|
|
173
|
+
declare const Radio: ({ name, withFormik, ...rest }: RadioOptionsProps) => JSX.Element;
|
|
174
|
+
|
|
175
|
+
interface LargeButtonProps extends ButtonProps {
|
|
176
|
+
loading?: boolean;
|
|
177
|
+
children: ReactNode;
|
|
178
|
+
}
|
|
179
|
+
declare const LargeButton: ({ loading, children, ...rest }: LargeButtonProps) => JSX.Element;
|
|
180
|
+
|
|
181
|
+
export { Autocomplete, Checkbox, ColumnTitleProps, EditableTableCell, FilterProps, Grid, GridV2, IFilter, Input, InputMask, LargeButton, Radio, Select, Switch, Td, Tr, filterData };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bluemarble/bm-components",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.9",
|
|
4
4
|
"description": "BM components",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -14,25 +14,32 @@
|
|
|
14
14
|
"keywords": [],
|
|
15
15
|
"author": "",
|
|
16
16
|
"license": "ISC",
|
|
17
|
-
"dependencies": {
|
|
17
|
+
"dependencies": {
|
|
18
|
+
"imask": "^6.4.2",
|
|
19
|
+
"moment": "^2.29.4",
|
|
20
|
+
"react": ">=17.0.2",
|
|
21
|
+
"react-dom": ">=17.0.2",
|
|
22
|
+
"react-icons": "^4.3.1",
|
|
23
|
+
"react-imask": "^6.4.2"
|
|
24
|
+
},
|
|
18
25
|
"peerDependencies": {
|
|
19
26
|
"@emotion/react": "^11.7.1",
|
|
20
27
|
"@emotion/styled": "^11.6.0",
|
|
21
28
|
"@mui/material": "^5.4.0",
|
|
22
|
-
"
|
|
23
|
-
"react-icons": "^4.3.1",
|
|
24
|
-
"imask": "^6.4.2",
|
|
25
|
-
"react-imask": "^6.4.2"
|
|
29
|
+
"formik": "^2.2.9"
|
|
26
30
|
},
|
|
27
31
|
"devDependencies": {
|
|
32
|
+
"@rollup/plugin-babel": "^5.3.1",
|
|
28
33
|
"@rollup/plugin-commonjs": "^21.0.3",
|
|
29
34
|
"@rollup/plugin-node-resolve": "^13.1.3",
|
|
30
35
|
"@rollup/plugin-typescript": "^8.3.1",
|
|
31
36
|
"@types/react": "^17.0.43",
|
|
37
|
+
"@types/react-table": "^7.7.12",
|
|
32
38
|
"eslint": "^8.12.0",
|
|
33
39
|
"prettier": "^2.6.2",
|
|
34
40
|
"rollup": "^2.70.1",
|
|
35
41
|
"rollup-plugin-dts": "^4.2.0",
|
|
42
|
+
"rollup-plugin-peer-deps-external": "^2.2.4",
|
|
36
43
|
"typescript": "^4.6.3"
|
|
37
44
|
}
|
|
38
45
|
}
|