@ctlyst.id/internal-ui 4.1.16 → 4.2.1

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.mjs CHANGED
@@ -1085,7 +1085,17 @@ var useDataTable = ({
1085
1085
  };
1086
1086
  var DataTable = React5.forwardRef((props, ref) => {
1087
1087
  var _a, _b, _c, _d, _e, _f, _g;
1088
- const { isLoading, styles, headerSticky, onRowClick, container, columnPinning, isRowDisabled } = props;
1088
+ const {
1089
+ isLoading,
1090
+ styles,
1091
+ headerSticky,
1092
+ onRowClick,
1093
+ container,
1094
+ columnPinning,
1095
+ disabledRow,
1096
+ highlightedRow,
1097
+ cellLineClamp = 2
1098
+ } = props;
1089
1099
  const { table, toggleAllRowsSelected, generateColumn } = useDataTable(props);
1090
1100
  const refTable = React5.useRef(null);
1091
1101
  React5.useImperativeHandle(ref, () => ({
@@ -1210,14 +1220,14 @@ var DataTable = React5.forwardRef((props, ref) => {
1210
1220
  }
1211
1221
  ),
1212
1222
  /* @__PURE__ */ jsx24(Tbody, { ...styles == null ? void 0 : styles.tableBody, children: table.getRowModel().rows.map((row) => {
1213
- const disabledRow = isRowDisabled && isRowDisabled(row.original);
1223
+ const isDisabledRow = disabledRow && disabledRow(row.original);
1224
+ const isHighlightedRow = highlightedRow && highlightedRow(row.original);
1214
1225
  return /* @__PURE__ */ jsx24(
1215
1226
  Tr,
1216
1227
  {
1217
1228
  "data-test-id": "-RU0hNYGRzeVM3HQ4cXHl",
1218
- tabindex: "0",
1219
1229
  ...styles == null ? void 0 : styles.tableRow,
1220
- "aria-disabled": disabledRow,
1230
+ "aria-selected": isHighlightedRow,
1221
1231
  css: css`
1222
1232
  &:last-child {
1223
1233
  td {
@@ -1225,10 +1235,10 @@ var DataTable = React5.forwardRef((props, ref) => {
1225
1235
  }
1226
1236
  }
1227
1237
  `,
1228
- cursor: disabledRow ? "default" : "pointer",
1238
+ cursor: isDisabledRow ? "default" : "pointer",
1229
1239
  onMouseDown: (e) => {
1230
1240
  var _a2;
1231
- if (!disabledRow) {
1241
+ if (!isDisabledRow && !isHighlightedRow) {
1232
1242
  (_a2 = e.currentTarget) == null ? void 0 : _a2.setAttribute("data-active", "true");
1233
1243
  }
1234
1244
  },
@@ -1238,7 +1248,7 @@ var DataTable = React5.forwardRef((props, ref) => {
1238
1248
  },
1239
1249
  onClick: () => {
1240
1250
  if (onRowClick) {
1241
- if (disabledRow) return;
1251
+ if (isDisabledRow) return;
1242
1252
  onRowClick(row.original);
1243
1253
  }
1244
1254
  },
@@ -1271,10 +1281,12 @@ var DataTable = React5.forwardRef((props, ref) => {
1271
1281
  onClick: (e) => {
1272
1282
  e.stopPropagation();
1273
1283
  },
1274
- noOfLines: 2,
1275
- sx: {
1276
- display: "-webkit-inline-box"
1277
- },
1284
+ ...cellLineClamp > 0 ? {
1285
+ noOfLines: cellLineClamp,
1286
+ sx: {
1287
+ display: "-webkit-inline-box"
1288
+ }
1289
+ } : {},
1278
1290
  children: flexRender(cell.column.columnDef.cell, cell.getContext())
1279
1291
  }
1280
1292
  )
@@ -7353,6 +7365,11 @@ var baseStyle11 = definePartsStyle10({
7353
7365
  td: {
7354
7366
  backgroundColor: "neutral.200"
7355
7367
  }
7368
+ },
7369
+ '&[aria-selected="true"]': {
7370
+ td: {
7371
+ backgroundColor: "danger.50"
7372
+ }
7356
7373
  }
7357
7374
  }
7358
7375
  }