@bluemarble/bm-components 0.0.15 → 0.0.18

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.
Files changed (37) hide show
  1. package/dist/esm/index.js.map +1 -1
  2. package/dist/esm/types/components/Checkbox/index.d.ts +1 -0
  3. package/dist/esm/types/components/Grid/Grid.d.ts +2 -2
  4. package/dist/esm/types/components/Grid/Tr.d.ts +1 -1
  5. package/dist/esm/types/components/Radio/index.d.ts +1 -0
  6. package/dist/esm/types/components/Switch/index.d.ts +1 -0
  7. package/dist/esm/types/components/index.d.ts +0 -1
  8. package/dist/index.d.ts +5 -10
  9. package/package.json +1 -1
  10. package/dist/esm/types/components/Form/index.d.ts +0 -8
  11. package/dist/esm/types/components/Grid/hooks/useGrid.d.ts +0 -20
  12. package/dist/esm/types/components/GridV2/index.d.ts +0 -6
  13. package/dist/esm/types/playground/src/App.d.ts +0 -2
  14. package/dist/esm/types/playground/src/main.d.ts +0 -1
  15. package/dist/esm/types/playground/src/theme.d.ts +0 -1
  16. package/dist/esm/types/playground/vite.config.d.ts +0 -2
  17. package/dist/esm/types/src/components/Autocomplete/index.d.ts +0 -20
  18. package/dist/esm/types/src/components/Checkbox/index.d.ts +0 -18
  19. package/dist/esm/types/src/components/Grid/AutoCreatedRows.d.ts +0 -8
  20. package/dist/esm/types/src/components/Grid/EditableTableCell/DefaultInput.d.ts +0 -16
  21. package/dist/esm/types/src/components/Grid/EditableTableCell/InputMask.d.ts +0 -7
  22. package/dist/esm/types/src/components/Grid/EditableTableCell/index.d.ts +0 -23
  23. package/dist/esm/types/src/components/Grid/Filters.d.ts +0 -12
  24. package/dist/esm/types/src/components/Grid/Grid.d.ts +0 -32
  25. package/dist/esm/types/src/components/Grid/Header.d.ts +0 -10
  26. package/dist/esm/types/src/components/Grid/Td.d.ts +0 -3
  27. package/dist/esm/types/src/components/Grid/Tr.d.ts +0 -13
  28. package/dist/esm/types/src/components/Grid/index.d.ts +0 -6
  29. package/dist/esm/types/src/components/Grid/utils.d.ts +0 -5
  30. package/dist/esm/types/src/components/Input/index.d.ts +0 -12
  31. package/dist/esm/types/src/components/InputMask/index.d.ts +0 -12
  32. package/dist/esm/types/src/components/LargeButton/index.d.ts +0 -8
  33. package/dist/esm/types/src/components/Radio/index.d.ts +0 -22
  34. package/dist/esm/types/src/components/Select/index.d.ts +0 -17
  35. package/dist/esm/types/src/components/Switch/index.d.ts +0 -18
  36. package/dist/esm/types/src/components/index.d.ts +0 -9
  37. package/dist/esm/types/src/index.d.ts +0 -1
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { CheckboxProps as MuiCheckboxProps, FormControlLabelProps } from "@mui/material";
2
3
  declare type CheckboxProps = CheckboxWithFormik | CheckboxWithoutFormik;
3
4
  interface CheckboxWithFormik extends MuiCheckboxProps {
@@ -1,7 +1,7 @@
1
1
  import React, { PropsWithChildren, ReactNode } from "react";
2
2
  import { TableCellProps } from "@mui/material";
3
- export interface ColumnTitleProps<T = Record<string, any>> {
4
- name: keyof T | "-";
3
+ export interface ColumnTitleProps {
4
+ name: string;
5
5
  label: string;
6
6
  transformer?: (value: string | number | Date) => string;
7
7
  sx?: TableCellProps["sx"];
@@ -7,7 +7,7 @@ interface CustomTableRowProps extends TableRowProps {
7
7
  index?: number;
8
8
  rowData?: Record<string, any>;
9
9
  onSave?: (props: OnSaveProps) => void;
10
- children: React.ReactElement[];
10
+ children: React.ReactNode;
11
11
  }
12
12
  export declare const Tr: React.MemoExoticComponent<(props: CustomTableRowProps) => JSX.Element>;
13
13
  export {};
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { RadioGroupProps } from "@mui/material";
2
3
  declare type RadioOptionProps = {
3
4
  value: string | number | boolean;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { SwitchProps as MuiSwitchProps, FormControlLabelProps } from "@mui/material";
2
3
  declare type SwitchProps = SwitchWithFormik | SwitchWithoutFormik;
3
4
  interface SwitchWithFormik extends MuiSwitchProps {
@@ -1,5 +1,4 @@
1
1
  export { default as Grid, IFilter, ColumnTitleProps, FilterProps, filterData, Tr, Td, EditableTableCell, } from "./Grid";
2
- export { GridV2 } from "./GridV2";
3
2
  export { Input } from "./Input";
4
3
  export { InputMask } from "./InputMask";
5
4
  export { Select } from "./Select";
package/dist/index.d.ts CHANGED
@@ -1,11 +1,10 @@
1
1
  /// <reference types="react" />
2
- import React, { ReactNode, PropsWithChildren, FC } from 'react';
2
+ import React, { ReactNode, FC } from 'react';
3
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, CircularProgressProps } from '@mui/material';
4
- import { TableOptions } from 'react-table';
5
4
  import IMask$1 from 'imask';
6
5
 
7
- interface ColumnTitleProps<T = Record<string, any>> {
8
- name: keyof T | "-";
6
+ interface ColumnTitleProps {
7
+ name: string;
9
8
  label: string;
10
9
  transformer?: (value: string | number | Date) => string;
11
10
  sx?: TableCellProps["sx"];
@@ -66,16 +65,12 @@ interface CustomTableRowProps extends TableRowProps {
66
65
  index?: number;
67
66
  rowData?: Record<string, any>;
68
67
  onSave?: (props: OnSaveProps) => void;
69
- children: React.ReactElement[];
68
+ children: React.ReactNode;
70
69
  }
71
70
  declare const Tr: React.MemoExoticComponent<(props: CustomTableRowProps) => JSX.Element>;
72
71
 
73
72
  declare const Td: React.MemoExoticComponent<({ children, ...props }: TableCellProps) => JSX.Element>;
74
73
 
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
74
  interface InputProps extends StandardTextFieldProps {
80
75
  name: string;
81
76
  label: string;
@@ -179,4 +174,4 @@ interface LargeButtonProps extends ButtonProps {
179
174
  }
180
175
  declare const LargeButton: ({ loading, children, CircularProgressProps, ...rest }: LargeButtonProps) => JSX.Element;
181
176
 
182
- export { Autocomplete, Checkbox, ColumnTitleProps, EditableTableCell, FilterProps, Grid, GridV2, IFilter, Input, InputMask, LargeButton, Radio, Select, Switch, Td, Tr, filterData };
177
+ export { Autocomplete, Checkbox, ColumnTitleProps, EditableTableCell, FilterProps, Grid, 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.15",
3
+ "version": "0.0.18",
4
4
  "description": "BM components",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -1,8 +0,0 @@
1
- import { ReactNode } from "react";
2
- import { FormikProps, FormikHelpers } from "formik";
3
- interface FormProps<T> extends Partial<FormikProps<T>> {
4
- children: ReactNode;
5
- onSubmit: (fields: T, formikHelpers: FormikHelpers<T>) => void;
6
- }
7
- export declare function Form<T>({ children, initialValues, onSubmit, ...props }: FormProps<T>): JSX.Element;
8
- export {};
@@ -1,20 +0,0 @@
1
- import { MutableRefObject } from "react";
2
- import { FilterProps } from "../Grid";
3
- interface useGridResponseOptions<T> {
4
- tableData: T[];
5
- defaultData: FilterProps[];
6
- setDefaultData: MutableRefObject<T[]>;
7
- selectedFilters: (options: Array<T>) => void;
8
- setSelectedFilters: (options: Array<T>) => void;
9
- getAllProps: () => {
10
- tableData: T[];
11
- defaultData: FilterProps[];
12
- setDefaultData: MutableRefObject<T[]>;
13
- selectedFilters: (options: Array<T>) => void;
14
- setSelectedFilters: (options: Array<T>) => void;
15
- getAllProps: (options: FilterProps[]) => void;
16
- };
17
- }
18
- declare type useGridResponseProps<T> = [Array<T>, useGridResponseOptions<T>];
19
- export declare function useGrid<T>(): useGridResponseProps<T>;
20
- export {};
@@ -1,6 +0,0 @@
1
- import { PropsWithChildren } from "react";
2
- import { TableOptions } from "react-table";
3
- interface GridV2Props<T extends Record<string, unknown>> extends TableOptions<T> {
4
- }
5
- export declare function GridV2<T extends Record<string, any>>({ columns, data, }: PropsWithChildren<GridV2Props<T>>): JSX.Element;
6
- export {};
@@ -1,2 +0,0 @@
1
- declare function App(): JSX.Element;
2
- export default App;
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export declare const theme: import("@mui/material").Theme;
@@ -1,2 +0,0 @@
1
- declare const _default: import("vite").UserConfigExport;
2
- export default _default;
@@ -1,20 +0,0 @@
1
- import { ReactNode } from "react";
2
- import { Autocomplete as MuiAutocomplete, AutocompleteProps as MuiAutocompleteProps, AutocompleteRenderInputParams } from "@mui/material";
3
- declare type MuiAutocomplete<T> = Omit<MuiAutocompleteProps<T, boolean, undefined, boolean>, "renderInput">;
4
- declare type AutocompleteProps<T> = AutocompleteWithoutProps<T> | AutocompleteWithFormikProps<T>;
5
- interface AutocompleteWithoutProps<T> extends MuiAutocomplete<T> {
6
- name?: never;
7
- withFormik: false;
8
- getOptionValue?: never;
9
- label?: string;
10
- renderInput?: (params: AutocompleteRenderInputParams) => ReactNode;
11
- }
12
- interface AutocompleteWithFormikProps<T> extends MuiAutocomplete<T> {
13
- name: string;
14
- withFormik?: true;
15
- label?: string;
16
- renderInput?: (params: AutocompleteRenderInputParams) => ReactNode;
17
- getOptionValue: (option: T) => string | number;
18
- }
19
- export declare function Autocomplete<T>({ withFormik, name, getOptionValue, ...rest }: AutocompleteProps<T>): JSX.Element;
20
- export {};
@@ -1,18 +0,0 @@
1
- import { CheckboxProps as MuiCheckboxProps, FormControlLabelProps } from "@mui/material";
2
- declare type CheckboxProps = CheckboxWithFormik | CheckboxWithoutFormik;
3
- interface CheckboxWithFormik extends MuiCheckboxProps {
4
- name: string;
5
- label?: string;
6
- withFormik?: true;
7
- FormControlLabelProps?: Partial<FormControlLabelProps>;
8
- }
9
- interface CheckboxWithoutFormik extends MuiCheckboxProps {
10
- name?: never;
11
- label?: string;
12
- withFormik: false;
13
- FormControlLabelProps?: Partial<FormControlLabelProps>;
14
- }
15
- export declare const Checkbox: ({ withFormik, name, ...props }: CheckboxProps) => JSX.Element;
16
- export declare const BaseCheckbox: ({ label, FormControlLabelProps, ...props }: Omit<CheckboxWithoutFormik, "withFormik">) => JSX.Element;
17
- export declare const FormikCheckbox: ({ label, name, FormControlLabelProps, ...props }: Omit<CheckboxWithFormik, "withFormik">) => JSX.Element;
18
- export {};
@@ -1,8 +0,0 @@
1
- import { ColumnTitleProps } from "./Grid";
2
- interface AutoCreatedRows {
3
- columns: ColumnTitleProps[];
4
- tableData: any[];
5
- primaryKey: string;
6
- }
7
- export declare const AutoCreatedRows: ({ tableData, columns, primaryKey, }: AutoCreatedRows) => JSX.Element;
8
- export {};
@@ -1,16 +0,0 @@
1
- import { TextFieldProps } from "@mui/material";
2
- import { OnSaveProps } from ".";
3
- export interface DefaultInputProps {
4
- name: string;
5
- rowData: Record<string, any>;
6
- isEditing: boolean;
7
- fullWidth?: boolean;
8
- TextFieldProps?: TextFieldProps;
9
- type?: TextFieldProps["type"];
10
- formatInputDefautvalue?: (value: string) => string;
11
- setIsEditing(value: boolean): void;
12
- onUpdateValue: (value: string) => void;
13
- onSave: (props: OnSaveProps) => void;
14
- handleCancelEditing: () => void;
15
- }
16
- export declare const DefaultInput: (allProps: DefaultInputProps) => JSX.Element;
@@ -1,7 +0,0 @@
1
- import { DefaultInputProps } from "./DefaultInput";
2
- import IMask from "imask";
3
- interface InputMaskProps extends Omit<DefaultInputProps, "onUpdateValue"> {
4
- mask: IMask.AnyMaskedOptions;
5
- }
6
- export declare const InputMask: (allProps: InputMaskProps) => JSX.Element;
7
- export {};
@@ -1,23 +0,0 @@
1
- import { TableCellProps, TextFieldProps } from "@mui/material";
2
- interface EditableTableCellProps extends TableCellProps {
3
- name: string;
4
- TextFieldProps?: TextFieldProps;
5
- type?: TextFieldProps["type"];
6
- fullWidth?: boolean;
7
- rowData?: Record<string, any>;
8
- mask?: IMask.AnyMaskedOptions;
9
- bordered?: boolean;
10
- rowIndex?: string | number;
11
- formatCellValue?: (value: string) => string;
12
- formatInputDefautvalue?: (value: string) => string;
13
- onSave?: (props: OnSaveProps) => void;
14
- onCancel?: () => void;
15
- }
16
- export interface OnSaveProps {
17
- name: string;
18
- event: FocusEvent;
19
- value: string;
20
- data: Record<string, any>;
21
- }
22
- export declare const EditableTableCell: (allProps: EditableTableCellProps) => JSX.Element;
23
- export {};
@@ -1,12 +0,0 @@
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 {};
@@ -1,32 +0,0 @@
1
- import React, { PropsWithChildren, ReactNode } from "react";
2
- import { TableCellProps } from "@mui/material";
3
- export interface ColumnTitleProps<T = {}> {
4
- name: keyof T | "-";
5
- label: string;
6
- transformer?: (value: string | number | Date) => string;
7
- sx?: TableCellProps["sx"];
8
- }
9
- export interface FilterProps {
10
- column: string;
11
- value: string;
12
- transformer?: (value: string | number | Date) => string;
13
- }
14
- export declare type IFilter = FilterProps;
15
- export 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
- primaryKey?: string;
30
- }
31
- declare const Grid: <ObjectType>(props: React.PropsWithChildren<GridProps<ObjectType>>) => JSX.Element;
32
- export default Grid;
@@ -1,10 +0,0 @@
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 {};
@@ -1,3 +0,0 @@
1
- import React from "react";
2
- import { TableCellProps } from "@mui/material";
3
- export declare const Td: React.MemoExoticComponent<({ children, ...props }: TableCellProps) => JSX.Element>;
@@ -1,13 +0,0 @@
1
- import React from "react";
2
- import { TableRowProps } from "@mui/material";
3
- import { OnSaveProps } from "./EditableTableCell";
4
- interface CustomTableRowProps extends TableRowProps {
5
- striped?: boolean;
6
- bordered?: boolean;
7
- index?: number;
8
- rowData?: Record<string, any>;
9
- onSave?: (props: OnSaveProps) => void;
10
- children: React.ReactElement[];
11
- }
12
- export declare const Tr: React.MemoExoticComponent<(props: CustomTableRowProps) => JSX.Element>;
13
- export {};
@@ -1,6 +0,0 @@
1
- export { default } from "./Grid";
2
- export { ColumnTitleProps, IFilter, FilterProps } from "./Grid";
3
- export { filterData } from "./utils";
4
- export { Tr } from "./Tr";
5
- export { Td } from "./Td";
6
- export { EditableTableCell } from "./EditableTableCell";
@@ -1,5 +0,0 @@
1
- import { FilterProps } from "./Grid";
2
- export declare function filterData<T>(filters: FilterProps[], defaultData: {
3
- current: T[];
4
- }): T[];
5
- export declare function getPropertyValue(obj: Record<string, any>, property: string): string;
@@ -1,12 +0,0 @@
1
- import { FC } from "react";
2
- import { StandardTextFieldProps } from "@mui/material";
3
- interface InputProps extends StandardTextFieldProps {
4
- name: string;
5
- label: string;
6
- withFormik?: boolean;
7
- formik?: any;
8
- }
9
- export declare const Input: FC<InputProps>;
10
- export declare const BaseInput: (props: InputProps) => JSX.Element;
11
- export declare const FormikInput: FC<InputProps>;
12
- export {};
@@ -1,12 +0,0 @@
1
- import IMask from "imask";
2
- import { StandardTextFieldProps } from "@mui/material";
3
- interface InputMaskProps extends Partial<StandardTextFieldProps> {
4
- name: string;
5
- label: string;
6
- withFormik?: boolean;
7
- mask: IMask.AnyMaskedOptions;
8
- onChangeValue?: (value: string, unmaskedValue: string) => void;
9
- }
10
- export declare function InputMask({ withFormik, ...rest }: InputMaskProps): JSX.Element;
11
- export declare function FormikInputMask({ mask, defaultValue, name, ...rest }: InputMaskProps): JSX.Element;
12
- export {};
@@ -1,8 +0,0 @@
1
- import { ReactNode } from "react";
2
- import { ButtonProps } from "@mui/material";
3
- interface LargeButtonProps extends ButtonProps {
4
- loading?: boolean;
5
- children: ReactNode;
6
- }
7
- export declare const LargeButton: ({ loading, children, ...rest }: LargeButtonProps) => JSX.Element;
8
- export {};
@@ -1,22 +0,0 @@
1
- import { RadioGroupProps } from "@mui/material";
2
- declare type RadioOptionProps = {
3
- value: string | number | boolean;
4
- label: string;
5
- };
6
- declare type RadioOptionsProps = RadioWithFormik | RadioWithoutFormik;
7
- interface RadioWithFormik extends RadioGroupProps {
8
- name: string;
9
- label?: string;
10
- options: RadioOptionProps[];
11
- withFormik?: true;
12
- }
13
- interface RadioWithoutFormik extends RadioGroupProps {
14
- name?: never;
15
- label?: string;
16
- options: RadioOptionProps[];
17
- withFormik: false;
18
- }
19
- export declare const Radio: ({ name, withFormik, ...rest }: RadioOptionsProps) => JSX.Element;
20
- export declare const BaseRadio: ({ label, options, ...rest }: Omit<RadioWithoutFormik, "withFormik">) => JSX.Element;
21
- export declare const FormikRadio: ({ label, name, options, ...rest }: Omit<RadioWithFormik, "withFormik">) => JSX.Element;
22
- export {};
@@ -1,17 +0,0 @@
1
- import { FC } from "react";
2
- import { FormControlProps, InputLabelProps, SelectProps as MuiSelectProps } from "@mui/material";
3
- interface CustomInputLabelProps extends InputLabelProps {
4
- size?: "small";
5
- }
6
- interface SelectProps extends MuiSelectProps {
7
- name: string;
8
- label: string;
9
- defaultValue?: string;
10
- withFormik?: boolean;
11
- FormControlProps?: Partial<FormControlProps>;
12
- InputLabelProps?: Partial<CustomInputLabelProps>;
13
- }
14
- export declare const Select: FC<SelectProps>;
15
- export declare const BaseSelect: FC<SelectProps>;
16
- export declare const FormikSelect: FC<SelectProps>;
17
- export {};
@@ -1,18 +0,0 @@
1
- import { SwitchProps as MuiSwitchProps, FormControlLabelProps } from "@mui/material";
2
- declare type SwitchProps = SwitchWithFormik | SwitchWithoutFormik;
3
- interface SwitchWithFormik extends MuiSwitchProps {
4
- name: string;
5
- label?: string;
6
- withFormik?: true;
7
- FormControlLabelProps?: Partial<FormControlLabelProps>;
8
- }
9
- interface SwitchWithoutFormik extends MuiSwitchProps {
10
- name?: never;
11
- label?: string;
12
- withFormik: false;
13
- FormControlLabelProps?: Partial<FormControlLabelProps>;
14
- }
15
- export declare const Switch: ({ withFormik, name, ...props }: SwitchProps) => JSX.Element;
16
- export declare const BaseSwitch: ({ label, FormControlLabelProps, ...props }: Omit<SwitchWithoutFormik, "withFormik">) => JSX.Element;
17
- export declare const FormikSwitch: ({ label, name, FormControlLabelProps, ...props }: Omit<SwitchWithFormik, "withFormik">) => JSX.Element;
18
- export {};
@@ -1,9 +0,0 @@
1
- export { default as Grid, IFilter, ColumnTitleProps, FilterProps, filterData, Tr, Td, EditableTableCell, } from "./Grid";
2
- export { Input } from "./Input";
3
- export { InputMask } from "./InputMask";
4
- export { Select } from "./Select";
5
- export { Autocomplete } from "./Autocomplete";
6
- export { Checkbox } from "./Checkbox";
7
- export { Switch } from "./Switch";
8
- export { Radio } from "./Radio";
9
- export { LargeButton } from "./LargeButton";
@@ -1 +0,0 @@
1
- export * from "./components";