@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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@loja-integrada/admin-components",
3
- "version": "0.9.7",
3
+ "version": "0.9.8",
4
4
  "author": "Loja Integrada Front-End Team",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -63,6 +63,8 @@ const ModalComponent = ({
63
63
  {headerTitle}
64
64
  </span>
65
65
  <button
66
+ type="button"
67
+ id="btnCloseModal"
66
68
  className={`${
67
69
  preventClose ? 'hidden' : 'flex'
68
70
  } items-center p-2 pb-1 -mr-2 -mt-3 text-sm font-semibold text-inverted-2 hover:text-inverted-1`}
@@ -117,6 +117,7 @@ export default {
117
117
  title: 'Components/Table',
118
118
  component: Table,
119
119
  args: {
120
+ id: 'tableTest',
120
121
  columns: columns,
121
122
  rows: rows,
122
123
  selectable: false,
@@ -42,6 +42,7 @@ const TableComponent = ({
42
42
  onChange,
43
43
  selectedData,
44
44
  disabledRows = [],
45
+ id,
45
46
  }: TableProps) => {
46
47
  const rowsPropsMemoized = React.useMemo(() => rowsProps, [rowsProps])
47
48
  const [selectedRows, setSelectedRows] = React.useState<number[]>([])
@@ -145,10 +146,15 @@ const TableComponent = ({
145
146
  return selectable ? columns.length + 1 : columns.length
146
147
  }, [columns, selectable])
147
148
 
149
+ const tableId = React.useMemo(() => {
150
+ return id ? `${id.charAt(0).toUpperCase()}${id.slice(1)}` : ''
151
+ }, [id])
152
+
148
153
  return (
149
154
  <div className="max-w-full overflow-x-auto">
150
155
  <table
151
156
  {...getTableProps()}
157
+ id={id}
152
158
  className={`w-full bg-base-1 rounded border-separate border border-card-stroke`}
153
159
  cellSpacing="0"
154
160
  >
@@ -170,6 +176,7 @@ const TableComponent = ({
170
176
  checked={isHeaderSelectChecked}
171
177
  indeterminate={isHeaderSelectedIndeterminate}
172
178
  disabled={isHeaderSelectDisabled}
179
+ id={`checkboxSelectAllRows${tableId}`}
173
180
  />
174
181
  </th>
175
182
  )}
@@ -237,6 +244,7 @@ const TableComponent = ({
237
244
  onChange={(e) => handleSelectRow(index, e)}
238
245
  checked={isRowChecked}
239
246
  disabled={isRowDisabled}
247
+ id={`checkboxRow${index}${tableId}`}
240
248
  />
241
249
  </td>
242
250
  )}
@@ -337,4 +345,9 @@ export interface TableProps {
337
345
  * @default []
338
346
  */
339
347
  disabledRows?: number[]
348
+ /**
349
+ * Id of the table.
350
+ * @default undefined
351
+ */
352
+ id?: string
340
353
  }