@symply.io/basic-components 1.0.3 → 1.0.5

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/.gitignore CHANGED
@@ -12,4 +12,5 @@ yarn-debug.log*
12
12
  yarn-error.log*
13
13
  *.js
14
14
  *.d.ts
15
- dist
15
+ dist
16
+ .eslintrc.json
@@ -1,4 +1,4 @@
1
1
  /// <reference types="react" />
2
- import { BasicTableBodyProps } from "./types";
3
- declare const BasicTableBody: import("react").ForwardRefExoticComponent<BasicTableBodyProps & import("react").RefAttributes<HTMLDivElement>>;
4
- export default BasicTableBody;
2
+ import { BasicTableBodyProps, KvProps } from "./types";
3
+ declare const _default: import("react").ForwardRefExoticComponent<BasicTableBodyProps<KvProps, KvProps> & import("react").RefAttributes<HTMLDivElement>>;
4
+ export default _default;
@@ -12,11 +12,11 @@ var __assign = (this && this.__assign) || function () {
12
12
  import { jsx as _jsx } from "react/jsx-runtime";
13
13
  import { forwardRef } from "react";
14
14
  import Grid from "@mui/material/Grid";
15
- import useCustomTheme from "../useCustomTheme";
15
+ import useTheme from "@mui/material/styles/useTheme";
16
16
  import TableBodyRow from "./TableBodyRow";
17
- var BasicTableBody = forwardRef(function (props, ref) {
18
- var rows = props.rows, columns = props.columns, forFrozen = props.forFrozen, noDataText = props.noDataText;
19
- var theme = useCustomTheme();
17
+ function BasicTableBody(props, ref) {
18
+ var rows = props.rows, columns = props.columns, forFrozen = props.forFrozen, noDataText = props.noDataText, onRowClick = props.onRowClick;
19
+ var theme = useTheme();
20
20
  return (_jsx(Grid, __assign({ item: true, sx: {
21
21
  maxHeight: "41vh",
22
22
  overflowY: "auto",
@@ -26,8 +26,8 @@ var BasicTableBody = forwardRef(function (props, ref) {
26
26
  "&::-webkit-scrollbar": {
27
27
  width: forFrozen ? 0 : "initial"
28
28
  }
29
- } }, { children: _jsx("div", __assign({ ref: ref }, { children: rows && rows.length > 0 ? (rows.map(function (row, index) {
30
- return (_jsx(TableBodyRow, { row: row, rows: rows, columns: columns }, "BasicTable_".concat(index)));
29
+ } }, { children: _jsx("div", __assign({ ref: ref }, { children: rows.length > 0 ? (rows.map(function (row, index) {
30
+ return (_jsx(TableBodyRow, { row: row, rows: rows, forFrozen: forFrozen, columns: columns, onRowClick: onRowClick }, "BasicTable_".concat(index)));
31
31
  })) : (_jsx(Grid, __assign({ container: true, justifyContent: "space-around", alignItems: "center", wrap: "nowrap", sx: {
32
32
  height: theme.spacing(7.5),
33
33
  borderBottomWidth: "thin",
@@ -46,5 +46,5 @@ var BasicTableBody = forwardRef(function (props, ref) {
46
46
  paddingLeft: theme.spacing(0.625),
47
47
  paddingRight: theme.spacing(0.625)
48
48
  } }, { children: noDataText })) }))) })) })));
49
- });
50
- export default BasicTableBody;
49
+ }
50
+ export default forwardRef(BasicTableBody);
@@ -1,3 +1,3 @@
1
- import { BasicTableBodyRowProps } from "./types";
2
- declare function BasicTableBodyRow(props: BasicTableBodyRowProps): JSX.Element;
1
+ import { BasicTableBodyRowProps, KvProps } from "./types";
2
+ declare function BasicTableBodyRow<RowProps extends KvProps, ExtraProps extends KvProps>(props: BasicTableBodyRowProps<RowProps, ExtraProps>): JSX.Element;
3
3
  export default BasicTableBodyRow;
@@ -11,11 +11,12 @@ var __assign = (this && this.__assign) || function () {
11
11
  };
12
12
  import { jsx as _jsx } from "react/jsx-runtime";
13
13
  import { cloneElement } from "react";
14
+ import colorAlpha from "color-alpha";
14
15
  import Grid from "@mui/material/Grid";
15
- import useCustomTheme from "../useCustomTheme";
16
+ import useTheme from "@mui/material/styles/useTheme";
16
17
  function BasicTableBodyRow(props) {
17
- var row = props.row, rows = props.rows, columns = props.columns;
18
- var theme = useCustomTheme();
18
+ var row = props.row, rows = props.rows, columns = props.columns, forFrozen = props.forFrozen, onRowClick = props.onRowClick;
19
+ var theme = useTheme();
19
20
  return (_jsx(Grid, __assign({ container: true, justifyContent: "space-evenly", alignItems: "center", wrap: "nowrap", sx: {
20
21
  height: theme.spacing(7.5),
21
22
  borderBottomWidth: "thin",
@@ -23,6 +24,12 @@ function BasicTableBodyRow(props) {
23
24
  borderBottomStyle: "solid",
24
25
  padding: theme.spacing(0.5, 0),
25
26
  minHeight: theme.spacing(6),
27
+ "&:hover": {
28
+ cursor: !forFrozen && onRowClick ? "pointer" : "default",
29
+ backgroundColor: !forFrozen && onRowClick
30
+ ? colorAlpha(theme.palette.primary.main, 0.1)
31
+ : "initial"
32
+ },
26
33
  "& :nth-of-last-type(1)": {
27
34
  borderBottom: "none"
28
35
  },
@@ -30,7 +37,11 @@ function BasicTableBodyRow(props) {
30
37
  fontSize: "0.9rem",
31
38
  fontWeight: 600
32
39
  }
33
- } }, { children: columns.map(function (col) {
40
+ }, onClick: onRowClick
41
+ ? function () {
42
+ onRowClick(row);
43
+ }
44
+ : undefined }, { children: columns.map(function (col) {
34
45
  var accessor = col.accessor, Cell = col.Cell, _a = col.minWidth, minWidth = _a === void 0 ? "120px!important" : _a, width = col.width, _b = col.align, align = _b === void 0 ? "center" : _b;
35
46
  return (_jsx(Grid, __assign({ item: true, textAlign: align, sx: {
36
47
  minWidth: minWidth,
@@ -1,3 +1,3 @@
1
- import { BasicTableFooterProps } from "./types";
2
- declare function BasicTableFooter(props: BasicTableFooterProps): JSX.Element;
1
+ import { BasicTableFooterProps, KvProps } from "./types";
2
+ declare function BasicTableFooter<RowProps extends KvProps, ExtraProps extends KvProps>(props: BasicTableFooterProps<RowProps, ExtraProps>): JSX.Element;
3
3
  export default BasicTableFooter;
@@ -12,10 +12,10 @@ var __assign = (this && this.__assign) || function () {
12
12
  import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
13
13
  import { cloneElement } from "react";
14
14
  import Grid from "@mui/material/Grid";
15
- import useCustomTheme from "../useCustomTheme";
15
+ import useTheme from "@mui/material/styles/useTheme";
16
16
  function BasicTableFooter(props) {
17
17
  var footers = props.footers;
18
- var theme = useCustomTheme();
18
+ var theme = useTheme();
19
19
  return footers && footers.length > 0 ? (_jsx(Grid, __assign({ item: true, sx: {
20
20
  backgroundColor: "#eaf0f6",
21
21
  padding: theme.spacing(1.5, 0),
@@ -1,3 +1,3 @@
1
- import { BasicTableHeaderProps } from "./types";
2
- declare function BasicTableHeader(props: BasicTableHeaderProps): JSX.Element;
1
+ import { BasicTableHeaderProps, KvProps } from "./types";
2
+ declare function BasicTableHeader<RowProps extends KvProps, ExtraProps extends KvProps>(props: BasicTableHeaderProps<RowProps, ExtraProps>): JSX.Element;
3
3
  export default BasicTableHeader;
@@ -12,10 +12,10 @@ var __assign = (this && this.__assign) || function () {
12
12
  import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
13
13
  import { cloneElement } from "react";
14
14
  import Grid from "@mui/material/Grid";
15
- import useCustomTheme from "../useCustomTheme";
15
+ import useTheme from "@mui/material/styles/useTheme";
16
16
  function BasicTableHeader(props) {
17
17
  var headers = props.headers;
18
- var theme = useCustomTheme();
18
+ var theme = useTheme();
19
19
  return headers && headers.length > 0 ? (_jsx(Grid, __assign({ item: true, sx: {
20
20
  backgroundColor: "#eaf0f6",
21
21
  padding: theme.spacing(1.5, 0),
@@ -1,5 +1,5 @@
1
- import { BasicTableProps } from "./types";
2
- declare function BasicTable(props: BasicTableProps): JSX.Element;
1
+ import { BasicTableProps, KvProps } from "./types";
2
+ declare function BasicTable<RowProps extends KvProps, ExtraProps extends KvProps>(props: BasicTableProps<RowProps, ExtraProps>): JSX.Element;
3
3
  export default BasicTable;
4
4
  export * from "./types";
5
5
  export { default as useTable } from "./useTable";
@@ -22,7 +22,7 @@ import TableHeader from "./TableHeader";
22
22
  import TableFooter from "./TableFooter";
23
23
  function BasicTable(props) {
24
24
  var _a;
25
- var _b = props.columns, columns = _b === void 0 ? [] : _b, _c = props.rows, rows = _c === void 0 ? [] : _c, _d = props.headers, headers = _d === void 0 ? [] : _d, _e = props.footers, footers = _e === void 0 ? [] : _e, _f = props.noDataText, noDataText = _f === void 0 ? "No Data!" : _f, primaryColor = props.primaryColor, secondaryColor = props.secondaryColor;
25
+ var _b = props.columns, columns = _b === void 0 ? [] : _b, _c = props.rows, rows = _c === void 0 ? [] : _c, _d = props.headers, headers = _d === void 0 ? [] : _d, _e = props.footers, footers = _e === void 0 ? [] : _e, _f = props.noDataText, noDataText = _f === void 0 ? "No Data!" : _f, primaryColor = props.primaryColor, secondaryColor = props.secondaryColor, onRowClick = props.onRowClick;
26
26
  var theme = useCustomTheme({ primaryColor: primaryColor, secondaryColor: secondaryColor });
27
27
  var isUpMd = useMediaQuery(theme.breakpoints.up("md"));
28
28
  var fronzenColsCount = useMemo(function () { var _a; return (_a = columns.filter(function (col) { return col.canBeFrozen; })) === null || _a === void 0 ? void 0 : _a.length; }, [columns]);
@@ -63,7 +63,11 @@ function BasicTable(props) {
63
63
  zIndex: 999,
64
64
  backgroundColor: "Menu",
65
65
  boxShadow: "6px 0 6px -4px rgba(0,0,0,0.15)"
66
- } }, { children: _jsxs(Grid, __assign({ container: true, direction: "column", justifyContent: "center" }, { children: [_jsx(TableHeader, { headers: headers.filter(function (header) { return header.canBeFrozen; }) }), _jsx(TableBody, { forFrozen: true, rows: rows, ref: fixedRef, columns: columns.filter(function (col) { return col.canBeFrozen; }) }), _jsx(TableFooter, { footers: footers.filter(function (footer) { return footer.canBeFrozen; }) })] })) }))), _jsx(Grid, __assign({ item: true, style: {
66
+ } }, { children: _jsxs(Grid, __assign({ container: true, direction: "column", justifyContent: "center" }, { children: [_jsx(TableHeader, { headers: headers.filter(function (header) { return header.canBeFrozen; }) }), _jsx(TableBody, { forFrozen: true, rows: rows, ref: fixedRef, onRowClick: onRowClick
67
+ ? function (row) {
68
+ onRowClick(row);
69
+ }
70
+ : undefined, columns: columns.filter(function (col) { return col.canBeFrozen; }) }), _jsx(TableFooter, { footers: footers.filter(function (footer) { return footer.canBeFrozen; }) })] })) }))), _jsx(Grid, __assign({ item: true, style: {
67
71
  width: "100%",
68
72
  marginLeft: canFreeze ? frozenWidth || 0 : 0,
69
73
  overflow: "auto"
@@ -71,7 +75,11 @@ function BasicTable(props) {
71
75
  return isUpMd ? !header.canBeFrozen : true;
72
76
  }) }), _jsx(TableBody, { rows: rows, ref: dynamicRef, noDataText: noDataText, columns: columns.filter(function (col) {
73
77
  return isUpMd ? !col.canBeFrozen : true;
74
- }) }), _jsx(TableFooter, { footers: footers.filter(function (footer) {
78
+ }), onRowClick: onRowClick
79
+ ? function (row) {
80
+ onRowClick(row);
81
+ }
82
+ : undefined }), _jsx(TableFooter, { footers: footers.filter(function (footer) {
75
83
  return isUpMd ? !footer.canBeFrozen : true;
76
84
  }) })] })) }))] })) })) })));
77
85
  }
@@ -1,4 +1,5 @@
1
1
  import { ReactElement, CSSProperties } from "react";
2
+ export declare type KvProps = Record<string, unknown>;
2
3
  interface SortByProps {
3
4
  id: string;
4
5
  desc: boolean;
@@ -6,7 +7,15 @@ interface SortByProps {
6
7
  interface InitialStateProps {
7
8
  sortBy?: SortByProps;
8
9
  }
9
- export interface IColumn {
10
+ export interface SortingProps {
11
+ field: string;
12
+ isSorted?: boolean;
13
+ descending?: boolean;
14
+ }
15
+ export interface UseScrollProps {
16
+ canFreeze?: boolean;
17
+ }
18
+ export declare type ColumnBaseProps = {
10
19
  Header: ReactElement;
11
20
  headerTip?: string;
12
21
  Body: ReactElement;
@@ -17,57 +26,55 @@ export interface IColumn {
17
26
  canBeFrozen?: boolean;
18
27
  minWidth?: number;
19
28
  width?: number;
20
- [name: string]: any;
21
- }
22
- interface IHeader extends IColumn {
29
+ };
30
+ export declare type UseTableBaseProps<RowProps extends KvProps> = {
31
+ data: Array<RowProps>;
32
+ columns: Array<ColumnBaseProps>;
33
+ initialState?: InitialStateProps;
34
+ disableSortBy?: boolean;
35
+ onSort?: (props: SortingProps) => unknown;
36
+ };
37
+ export declare type UseTableProps<RowProps extends KvProps, ExtraProps extends KvProps> = UseTableBaseProps<RowProps> & ExtraProps;
38
+ export declare type HeaderProps<RowProps extends KvProps, ExtraProps extends KvProps> = ColumnBaseProps & Omit<UseTableProps<RowProps, ExtraProps>, keyof UseTableBaseProps<RowProps>> & {
23
39
  Cell: ReactElement;
24
40
  title: string;
25
41
  canSort?: boolean;
26
42
  onSort: (props: SortingProps) => unknown;
27
- }
28
- interface IFooter extends IColumn {
43
+ };
44
+ export declare type FooterProps<RowProps extends KvProps, ExtraProps extends KvProps> = ColumnBaseProps & Omit<UseTableProps<RowProps, ExtraProps>, keyof UseTableBaseProps<RowProps>> & {
29
45
  Cell: ReactElement;
30
- }
31
- interface IBodyColumn extends IColumn {
46
+ };
47
+ export declare type ColumnProps<RowProps extends KvProps, ExtraProps extends KvProps> = ColumnBaseProps & Omit<UseTableProps<RowProps, ExtraProps>, keyof UseTableBaseProps<RowProps>>;
48
+ export declare type ColumnWithCellProps<RowProps extends KvProps, ExtraProps extends KvProps> = ColumnProps<RowProps, ExtraProps> & {
32
49
  Cell: ReactElement;
50
+ };
51
+ export declare type UserTableReturns<RowProps extends KvProps, ExtraProps extends KvProps> = {
52
+ headers: Array<HeaderProps<RowProps, ExtraProps>>;
53
+ footers: Array<FooterProps<RowProps, ExtraProps>>;
54
+ columns: Array<ColumnWithCellProps<RowProps, ExtraProps>>;
55
+ rows: Array<RowProps>;
56
+ };
57
+ export interface BasicTableHeaderProps<RowProps extends KvProps, ExtraProps extends KvProps> {
58
+ headers: Array<HeaderProps<RowProps, ExtraProps>>;
33
59
  }
34
- export interface IRow {
35
- [name: string]: any;
36
- }
37
- export interface SortingProps {
38
- field: string;
39
- isSorted?: boolean;
40
- descending?: boolean;
41
- }
42
- export interface UseTableProps {
43
- data: Array<IRow>;
44
- columns: Array<IColumn>;
45
- initialState?: InitialStateProps;
46
- disableSortBy?: boolean;
47
- onSort?: (props: SortingProps) => unknown;
48
- [name: string]: any;
49
- }
50
- export interface UseScrollProps {
51
- canFreeze?: boolean;
52
- }
53
- export interface BasicTableHeaderProps {
54
- headers: Array<IHeader>;
55
- }
56
- export interface BasicTableFooterProps {
57
- footers: Array<IFooter>;
60
+ export interface BasicTableFooterProps<RowProps extends KvProps, ExtraProps extends KvProps> {
61
+ footers: Array<FooterProps<RowProps, ExtraProps>>;
58
62
  }
59
- export interface BasicTableBodyProps {
60
- columns: Array<IBodyColumn>;
61
- rows: Array<IRow>;
63
+ export interface BasicTableBodyProps<RowProps extends KvProps, ExtraProps extends KvProps> {
64
+ columns: Array<ColumnWithCellProps<RowProps, ExtraProps>>;
65
+ rows: Array<RowProps>;
62
66
  noDataText?: string;
63
67
  forFrozen?: boolean;
68
+ onRowClick?: (row: RowProps) => unknown;
64
69
  }
65
- export interface BasicTableBodyRowProps {
66
- columns: Array<IBodyColumn>;
67
- rows: Array<IRow>;
68
- row: IRow;
70
+ export interface BasicTableBodyRowProps<RowProps extends KvProps, ExtraProps extends KvProps> {
71
+ columns: Array<ColumnWithCellProps<RowProps, ExtraProps>>;
72
+ rows: Array<RowProps>;
73
+ row: RowProps;
74
+ forFrozen?: boolean;
75
+ onRowClick?: (row: RowProps) => unknown;
69
76
  }
70
- export declare type BasicTableProps = BasicTableHeaderProps & Omit<BasicTableBodyProps, "forFrozen"> & Partial<BasicTableFooterProps> & {
77
+ export declare type BasicTableProps<RowProps extends KvProps, ExtraProps extends KvProps> = BasicTableHeaderProps<RowProps, ExtraProps> & Omit<BasicTableBodyProps<RowProps, ExtraProps>, "forFrozen"> & Partial<BasicTableFooterProps<RowProps, ExtraProps>> & {
71
78
  primaryColor?: CSSProperties["color"];
72
79
  secondaryColor?: CSSProperties["color"];
73
80
  };
@@ -1,47 +1,3 @@
1
- /// <reference types="react" />
2
- import { UseTableProps, SortingProps } from "./types";
3
- declare function useTable(props: UseTableProps): {
4
- headers: {
5
- Header: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
6
- headerTip?: string | undefined;
7
- Body: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
8
- Footer?: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | undefined;
9
- align?: "left" | "right" | "center" | undefined;
10
- accessor: string;
11
- canSort: boolean | undefined;
12
- canBeFrozen?: boolean | undefined;
13
- minWidth?: number | undefined;
14
- width?: number | undefined;
15
- Cell: JSX.Element;
16
- title: string;
17
- onSort: ({ field }: Pick<SortingProps, "field">) => void;
18
- }[];
19
- footers: {
20
- Header: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
21
- headerTip?: string | undefined;
22
- Body: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
23
- Footer?: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | undefined;
24
- align?: "left" | "right" | "center" | undefined;
25
- accessor: string;
26
- canSort?: boolean | undefined;
27
- canBeFrozen?: boolean | undefined;
28
- minWidth?: number | undefined;
29
- width?: number | undefined;
30
- Cell: import("react").FunctionComponentElement<any>;
31
- }[];
32
- columns: {
33
- Header: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
34
- headerTip?: string | undefined;
35
- Body: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
36
- Footer?: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | undefined;
37
- align?: "left" | "right" | "center" | undefined;
38
- accessor: string;
39
- canSort?: boolean | undefined;
40
- canBeFrozen?: boolean | undefined;
41
- minWidth?: number | undefined;
42
- width?: number | undefined;
43
- Cell: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
44
- }[];
45
- rows: import("./types").IRow[];
46
- };
1
+ import { UseTableProps, KvProps, UserTableReturns } from "./types";
2
+ declare function useTable<T extends KvProps, F extends KvProps>(props: UseTableProps<T, F>): UserTableReturns<T, F>;
47
3
  export default useTable;
@@ -66,7 +66,7 @@ function useTable(props) {
66
66
  }
67
67
  return "↓";
68
68
  }, [sortingProps]);
69
- var rows = useMemo(function () { return data.map(function (d) { return d; }); }, [data]);
69
+ var rows = useMemo(function () { return data.map(function (d) { return (__assign({}, d)); }); }, [data]);
70
70
  var cols = useMemo(function () {
71
71
  return columns.map(function (col) {
72
72
  var Body = col.Body;
@@ -7,7 +7,7 @@ function useInteractions(props) {
7
7
  if (!event.target.value || /^\d+$/g.test(event.target.value)) {
8
8
  onChange(event.target.value);
9
9
  }
10
- }, []);
10
+ }, [onChange]);
11
11
  var onOpenTooltip = useCallback(function () {
12
12
  setTooltipOpen(true);
13
13
  }, []);
@@ -18,7 +18,7 @@ function useInteractions(props) {
18
18
  tooltipOpen: tooltipOpen,
19
19
  handleChange: handleChange,
20
20
  onOpenTooltip: onOpenTooltip,
21
- onCloseTooltip: onCloseTooltip,
21
+ onCloseTooltip: onCloseTooltip
22
22
  };
23
23
  }
24
24
  export default useInteractions;
@@ -2,7 +2,7 @@ import { useState, useCallback, useMemo } from "react";
2
2
  function useInteractions(props) {
3
3
  var value = props.value, integerOnly = props.integerOnly, _a = props.minValue, minValue = _a === void 0 ? Number.MIN_SAFE_INTEGER : _a, _b = props.maxValue, maxValue = _b === void 0 ? Number.MAX_SAFE_INTEGER : _b, onChange = props.onChange;
4
4
  var _c = useState(false), tooltipOpen = _c[0], setTooltipOpen = _c[1];
5
- var exceedError = useMemo(function () { return !!value && (Number(value) < minValue || Number(value) > maxValue); }, []);
5
+ var exceedError = useMemo(function () { return !!value && (Number(value) < minValue || Number(value) > maxValue); }, [value, minValue, maxValue]);
6
6
  var handleChange = useCallback(function (event) {
7
7
  event.preventDefault();
8
8
  var val = event.currentTarget.value;
@@ -15,7 +15,7 @@ function useInteractions(props) {
15
15
  else if (val !== "" && val !== "-" && !/^(-?\d*)(\.\d*)?$/g.test(val))
16
16
  return;
17
17
  onChange(val);
18
- }, []);
18
+ }, [onChange, minValue, integerOnly]);
19
19
  var handleBlur = useCallback(function () {
20
20
  var excludedValue = [
21
21
  null,
@@ -25,7 +25,7 @@ function useInteractions(props) {
25
25
  "-",
26
26
  "-.",
27
27
  "null",
28
- "undefined",
28
+ "undefined"
29
29
  ];
30
30
  var strVal = String(value).trim();
31
31
  if (strVal !== null && strVal.lastIndexOf(".") === strVal.length - 1) {
@@ -35,7 +35,7 @@ function useInteractions(props) {
35
35
  else if (excludedValue.includes(strVal)) {
36
36
  onChange("");
37
37
  }
38
- }, []);
38
+ }, [value, onChange]);
39
39
  var onOpenTooltip = useCallback(function () {
40
40
  setTooltipOpen(true);
41
41
  }, []);
@@ -48,7 +48,7 @@ function useInteractions(props) {
48
48
  handleBlur: handleBlur,
49
49
  handleChange: handleChange,
50
50
  onOpenTooltip: onOpenTooltip,
51
- onCloseTooltip: onCloseTooltip,
51
+ onCloseTooltip: onCloseTooltip
52
52
  };
53
53
  }
54
54
  export default useInteractions;
package/README.md CHANGED
@@ -214,7 +214,7 @@ import { BasicTable, useTable } from '@symply.io/basic-components';
214
214
  import BasicTable, { useTable } from '@symply.io/basic-components/BasicTable';
215
215
  ```
216
216
 
217
- <h5>Column Props (IColumn)</h5>
217
+ <h5>Column Props (ColumnBaseProps)</h5>
218
218
 
219
219
  | Name | Type | Default | Required | Description |
220
220
  | ----------- | --------------------------- | ------- | -------- | ----------------------------------------------------- |
@@ -231,32 +231,33 @@ import BasicTable, { useTable } from '@symply.io/basic-components/BasicTable';
231
231
 
232
232
  <h5>Hook Props</h5>
233
233
 
234
- | Name | Type | Default | Required | Description |
235
- | ------------- | -------------------------- | ------- | -------- | ------------------------------------------- |
236
- | columns | Array\<IColumn\> | | true | table columns |
237
- | data | Array<{ [name]: unknown }> | | true | table data/rows |
238
- | disableSortBy | bool | | false | If true, the whole table can't be sortable. |
239
- | initialState | { sortBy?: SortByProps } | | false | Set the initial states |
240
- | onSort | func | | false | The function for sorting rows. |
234
+ | Name | Type | Default | Required | Description |
235
+ | ------------- | ---------------------------------- | ------- | -------- | ------------------------------------------- |
236
+ | columns | Array\<ColumnBaseProps\> | | true | table columns |
237
+ | data | Array<{ [name: string]: unknown }> | | true | table data/rows |
238
+ | disableSortBy | bool | | false | If true, the whole table can't be sortable. |
239
+ | initialState | { sortBy?: SortByProps } | | false | Set the initial states |
240
+ | onSort | func | | false | The function for sorting rows. |
241
241
 
242
242
  <h5>Hook Returns</h5>
243
243
 
244
- | Name | Type | Description |
245
- | ------- | -------------------- | ------------------------- |
246
- | headers | Array\<IHeader\> | The cells for the header. |
247
- | columns | Array\<IBodyColumn\> | The cells for the body. |
248
- | footers | Array\<IFooter> | The cells for the footer. |
249
- | rows | Array<IRow\> | The rows for the table. |
244
+ | Name | Type | Description |
245
+ | ------- | ---------------------------- | ------------------------- |
246
+ | headers | Array\<HeaderProps\> | The cells for the header. |
247
+ | columns | Array\<ColumnWithCellProps\> | The cells for the body. |
248
+ | footers | Array\<FooterProps> | The cells for the footer. |
249
+ | rows | Array<RowProps\> | The rows for the table. |
250
250
 
251
251
  <h5>Component Props</h5>
252
252
 
253
- | Name | Type | Default | Required | Description |
254
- | ---------- | -------------------- | ---------- | -------- | ----------------------------------------- |
255
- | headers | Array\<IHeader\> | | true | The cells for the header. (from the hook) |
256
- | columns | Array\<IBodyColumn\> | | true | The cells for the body. (from the hook) |
257
- | footers | Array\<IFooter> | [] | false | The cells for the footer. (from the hook) |
258
- | noDataText | string | 'No Data!' | false | The text when no data rendered. |
259
- | rows | Array<IRow\> | | true | The rows for the table. (from the hook) |
253
+ | Name | Type | Default | Required | Description |
254
+ | ---------- | ---------------------------- | ---------- | -------- | ----------------------------------------- |
255
+ | headers | Array\<HeaderProps\> | | true | The cells for the header. (from the hook) |
256
+ | columns | Array\<ColumnWithCellProps\> | | true | The cells for the body. (from the hook) |
257
+ | footers | Array\<FooterProps> | [] | false | The cells for the footer. (from the hook) |
258
+ | onRowClick | func | | false | The function for row clicking. |
259
+ | noDataText | string | 'No Data!' | false | The text when no data rendered. |
260
+ | rows | Array<RowProps\> | | true | The rows for the table. (from the hook) |
260
261
 
261
262
 
262
263
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@symply.io/basic-components",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
4
4
  "description": "Basic and reusable components for all frontend of Symply apps",
5
5
  "keywords": [
6
6
  "react",