nillud-data-table 1.3.1 → 1.3.3

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/index.d.ts CHANGED
@@ -18,6 +18,7 @@ type Column = {
18
18
  selectable?: boolean;
19
19
  filterPlaceholder?: string;
20
20
  };
21
+ type Columns = Column[];
21
22
  type TableProps = {
22
23
  tableData: TableData;
23
24
  columns: Array<Column>;
@@ -43,4 +44,4 @@ type DataTableRef = {
43
44
 
44
45
  declare const DataTable: React.ForwardRefExoticComponent<TableProps & React.RefAttributes<DataTableRef>>;
45
46
 
46
- export { type Column, DataTable, type DataTableRef, type TableElement, type TableProps };
47
+ export { type Column, type Columns, DataTable, type DataTableRef, type TableData, type TableElement, type TableProps };
package/dist/index.js CHANGED
@@ -125,7 +125,7 @@ var Cell = ({
125
125
  children: content
126
126
  }
127
127
  );
128
- const renderSelectableCell = () => /* @__PURE__ */ jsx5("div", { className: "ndt-cell ndt-checkbox-cell", children: /* @__PURE__ */ jsx5("input", { type: "checkbox", checked: !!isRowSelected, onChange: onRowSelect }) });
128
+ const renderSelectableCell = () => /* @__PURE__ */ jsx5("label", { className: "ndt-cell ndt-checkbox-cell", children: /* @__PURE__ */ jsx5("input", { type: "checkbox", checked: !!isRowSelected }) });
129
129
  return /* @__PURE__ */ jsx5(Fragment3, { children: column.selectable ? renderSelectableCell() : renderCell() });
130
130
  };
131
131
  var Cell_default = Cell;
@@ -142,18 +142,27 @@ var Row = ({
142
142
  isRowSelected,
143
143
  onRowSelect
144
144
  }) => {
145
- return /* @__PURE__ */ jsx6("div", { className: "ndt-table-row", style: { gridTemplateColumns: widths }, children: columns.map((column, id) => /* @__PURE__ */ jsx6(
146
- Cell_default,
145
+ const isSelectable = columns.find((element) => element.selectable);
146
+ return /* @__PURE__ */ jsx6(
147
+ "div",
147
148
  {
148
- row,
149
- column,
150
- displayId,
151
- isTitles,
152
- isRowSelected,
153
- onRowSelect
154
- },
155
- `cell-${rowId}-${id}`
156
- )) });
149
+ className: `ndt-table-row ${isSelectable && "ndt-table-row-selectable"} ${isRowSelected && "ndt-table-row-selected"}`,
150
+ style: { gridTemplateColumns: widths },
151
+ onClick: onRowSelect,
152
+ children: columns.map((column, id) => /* @__PURE__ */ jsx6(
153
+ Cell_default,
154
+ {
155
+ row,
156
+ column,
157
+ displayId,
158
+ isTitles,
159
+ isRowSelected,
160
+ onRowSelect
161
+ },
162
+ `cell-${rowId}-${id}`
163
+ ))
164
+ }
165
+ );
157
166
  };
158
167
  var Row_default = Row;
159
168
 
package/dist/styles.css CHANGED
@@ -89,7 +89,19 @@
89
89
  border-bottom: 1px solid #ddd;
90
90
  }
91
91
  .ndt-table-container .ndt-table .ndt-table-body .ndt-table-row:nth-child(2n) {
92
- background-color: rgba(0, 0, 0, 0.05);
92
+ background-color: rgba(0, 0, 0, 0.04);
93
+ }
94
+ .ndt-table-container .ndt-table .ndt-table-body .ndt-table-row:hover, .ndt-table-container .ndt-table .ndt-table-body .ndt-table-row:nth-child(2n) {
95
+ background-color: rgba(0, 0, 0, 0.08);
96
+ }
97
+ .ndt-table-container .ndt-table .ndt-table-body .ndt-table-row.ndt-table-row-selectable {
98
+ cursor: pointer;
99
+ }
100
+ .ndt-table-container .ndt-table .ndt-table-body .ndt-table-row.ndt-table-row-selectable:hover, .ndt-table-container .ndt-table .ndt-table-body .ndt-table-row.ndt-table-row-selectable:nth-child(2n):hover {
101
+ background-color: rgba(144, 202, 249, 0.08);
102
+ }
103
+ .ndt-table-container .ndt-table .ndt-table-body .ndt-table-row.ndt-table-row-selected {
104
+ background-color: rgb(144, 202, 249);
93
105
  }
94
106
  .ndt-table-container .ndt-table .ndt-table-body .ndt-table-row .ndt-cell {
95
107
  display: flex;
@@ -1 +1 @@
1
- {"version":3,"sourceRoot":"","sources":["../components/data-table/styles/data-table.scss"],"names":[],"mappings":";AACI;EACI;EACA;;AAEA;AAAA;EAEI;;AAGJ;AAAA;EAEI;;AAGJ;EACI;;AAEA;EACI;;AAEA;EACI;;AAGJ;EACI;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;EACI;EACA;EACA;EACA;;AAGJ;EACI;EACA;EACA;EACA;;AAEA;EACI;EACA;;AAMR;EACI;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAMhB;EACI;;AAEA;EACI;EACA;EACA;;AAGA;EACI;AACA;;AAGJ;EACI;AACA;EACA;AACA;;AAGJ;EACI;AACA;EACA;AACA;;AAGJ;EACI;AACA;;AAKJ;EACI;;AAGJ;EACI;;AAGJ;EACI;EACA;EACA;EACA;EACA;;AAEA;EACI;;AAMhB;EACI;EACA;EACA;EACA;EACA;;AAEA;EACI;EACA;;AAGJ;EACI;;AAGI;EACI;EACA;;AAGJ;EACI;EACA;EACA;EACA;;AAIR;EACI;EACA;;AAEA;EACI;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;EACI;EACA;;AAGJ;EAGI;;AAGJ;EACI;EACA;;AAIR;EACI;EACA;;AAEA;EACI;;AAEA;EACI;EACA;EACA;;;AAUhC;EACI;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;AAGJ;EACI;EACA;EACA;EACA;EACA;;;AAGJ;EACI;;;AAGJ;EACI;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;EACI;;AAEA;EAGI;EACA;EACA;;AAIR;EACI;;AAEA;EAGI;EACA;EACA;;;AAKZ;EACI;EACA;EACA;EACA;EACA;;AAIA;EACI","file":"styles.css"}
1
+ {"version":3,"sourceRoot":"","sources":["../components/data-table/styles/data-table.scss"],"names":[],"mappings":";AACI;EACI;EACA;;AAEA;AAAA;EAEI;;AAGJ;AAAA;EAEI;;AAGJ;EACI;;AAEA;EACI;;AAEA;EACI;;AAGJ;EACI;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;EACI;EACA;EACA;EACA;;AAGJ;EACI;EACA;EACA;EACA;;AAEA;EACI;EACA;;AAMR;EACI;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAMhB;EACI;;AAEA;EACI;EACA;EACA;;AAGA;EACI;AACA;;AAGJ;EACI;AACA;EACA;AACA;;AAGJ;EACI;AACA;EACA;AACA;;AAGJ;EACI;AACA;;AAKJ;EACI;;AAGJ;EACI;;AAGJ;EAEI;;AAGJ;EACI;;AAEA;EAEI;;AAIR;EACI;;AAGJ;EACI;EACA;EACA;EACA;EACA;;AAEA;EACI;;AAMhB;EACI;EACA;EACA;EACA;EACA;;AAEA;EACI;EACA;;AAGJ;EACI;;AAGI;EACI;EACA;;AAGJ;EACI;EACA;EACA;EACA;;AAIR;EACI;EACA;;AAEA;EACI;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;EACI;EACA;;AAGJ;EAGI;;AAGJ;EACI;EACA;;AAIR;EACI;EACA;;AAEA;EACI;;AAEA;EACI;EACA;EACA;;;AAUhC;EACI;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;AAGJ;EACI;EACA;EACA;EACA;EACA;;;AAGJ;EACI;;;AAGJ;EACI;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;EACI;;AAEA;EAGI;EACA;EACA;;AAIR;EACI;;AAEA;EAGI;EACA;EACA;;;AAKZ;EACI;EACA;EACA;EACA;EACA;;AAIA;EACI","file":"styles.css"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nillud-data-table",
3
- "version": "1.3.1",
3
+ "version": "1.3.3",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",