@loja-integrada/admin-components 0.9.7 → 0.9.8

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.
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { Row } from 'react-table';
3
- export declare const Table: React.MemoExoticComponent<({ columns: columnsProps, rows: rowsProps, selectable, isLoading, emptyText, onChange, selectedData, disabledRows, }: TableProps) => JSX.Element>;
3
+ export declare const Table: React.MemoExoticComponent<({ columns: columnsProps, rows: rowsProps, selectable, isLoading, emptyText, onChange, selectedData, disabledRows, id, }: TableProps) => JSX.Element>;
4
4
  declare type CellWrapperProp = React.ComponentClass<any> | React.FunctionComponent<any>;
5
5
  declare type TextAlignProp = 'left' | 'right' | 'center';
6
6
  declare type TableRowProp = {
@@ -72,5 +72,10 @@ export interface TableProps {
72
72
  * @default []
73
73
  */
74
74
  disabledRows?: number[];
75
+ /**
76
+ * Id of the table.
77
+ * @default undefined
78
+ */
79
+ id?: string;
75
80
  }
76
81
  export {};
@@ -1717,7 +1717,8 @@ var TableComponent = function TableComponent(_ref2) {
1717
1717
  onChange = _ref2.onChange,
1718
1718
  selectedData = _ref2.selectedData,
1719
1719
  _ref2$disabledRows = _ref2.disabledRows,
1720
- disabledRows = _ref2$disabledRows === void 0 ? [] : _ref2$disabledRows;
1720
+ disabledRows = _ref2$disabledRows === void 0 ? [] : _ref2$disabledRows,
1721
+ id = _ref2.id;
1721
1722
  var rowsPropsMemoized = React__default.useMemo(function () {
1722
1723
  return rowsProps;
1723
1724
  }, [rowsProps]);
@@ -1820,9 +1821,13 @@ var TableComponent = function TableComponent(_ref2) {
1820
1821
  var columnsLength = React__default.useMemo(function () {
1821
1822
  return selectable ? columns.length + 1 : columns.length;
1822
1823
  }, [columns, selectable]);
1824
+ var tableId = React__default.useMemo(function () {
1825
+ return id ? "" + id.charAt(0).toUpperCase() + id.slice(1) : '';
1826
+ }, [id]);
1823
1827
  return React__default.createElement("div", {
1824
1828
  className: "max-w-full overflow-x-auto"
1825
1829
  }, React__default.createElement("table", Object.assign({}, getTableProps(), {
1830
+ id: id,
1826
1831
  className: "w-full bg-base-1 rounded border-separate border border-card-stroke",
1827
1832
  cellSpacing: "0"
1828
1833
  }), React__default.createElement("thead", {
@@ -1845,7 +1850,8 @@ var TableComponent = function TableComponent(_ref2) {
1845
1850
  },
1846
1851
  checked: isHeaderSelectChecked,
1847
1852
  indeterminate: isHeaderSelectedIndeterminate,
1848
- disabled: isHeaderSelectDisabled
1853
+ disabled: isHeaderSelectDisabled,
1854
+ id: "checkboxSelectAllRows" + tableId
1849
1855
  })), headerGroup.headers.map(function (column) {
1850
1856
  var _column$getHeaderProp = column.getHeaderProps(),
1851
1857
  key = _column$getHeaderProp.key,
@@ -1891,7 +1897,8 @@ var TableComponent = function TableComponent(_ref2) {
1891
1897
  return handleSelectRow(index, e);
1892
1898
  },
1893
1899
  checked: isRowChecked,
1894
- disabled: isRowDisabled
1900
+ disabled: isRowDisabled,
1901
+ id: "checkboxRow" + index + tableId
1895
1902
  })), row.cells.map(function (cell) {
1896
1903
  var _cell$getCellProps = cell.getCellProps(),
1897
1904
  key = _cell$getCellProps.key,
@@ -2126,6 +2133,8 @@ var ModalComponent = function ModalComponent(_ref) {
2126
2133
  }, React__default.createElement("span", {
2127
2134
  className: "min-w-0 text-inverted-2 text-xs font-semibold uppercase break-words " + (headerTitle ? 'pb-3' : '')
2128
2135
  }, headerTitle), React__default.createElement("button", {
2136
+ type: "button",
2137
+ id: "btnCloseModal",
2129
2138
  className: (preventClose ? 'hidden' : 'flex') + " items-center p-2 pb-1 -mr-2 -mt-3 text-sm font-semibold text-inverted-2 hover:text-inverted-1",
2130
2139
  onClick: handleRequestCloseFunc
2131
2140
  }, headerClose !== false && React__default.createElement("span", {