@bwp-web/components 1.3.0 → 1.3.1

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.
@@ -57,6 +57,15 @@ export type BiampTableProps<TData> = BoxProps & RowClickProps<TData> & Selection
57
57
  empty?: boolean | ReactNode;
58
58
  /** Returns a human-readable name for a row, used in ARIA labels (e.g. "Select: Conference Room A"). Falls back to row index. */
59
59
  getRowLabel?: (row: TData) => string;
60
+ /**
61
+ * Returns a background color for a row (any valid CSS color). Applied to
62
+ * the row and to all sticky cells (selection column, sticky action columns)
63
+ * so the row reads as a single tinted band. Hover and selected backgrounds
64
+ * override the custom color — whatever the theme defines for those states
65
+ * wins. Use opaque colors so sticky cells fully cover scrolled content.
66
+ * Return `undefined` to leave a row at its default color.
67
+ */
68
+ setRowColor?: (row: TData) => string | undefined;
60
69
  /**
61
70
  * Per-slot props merged onto the internal MUI elements (`table`, `head`, `body`,
62
71
  * `headerRow`, `headerCell`, `row`, `cell`). `sx` composes with the defaults
@@ -66,6 +75,6 @@ export type BiampTableProps<TData> = BoxProps & RowClickProps<TData> & Selection
66
75
  */
67
76
  slotProps?: BiampTableSlotProps<TData>;
68
77
  };
69
- export declare function BiampTable<TData>({ table, onRowClick, isRowClickable, loading, error, empty, enableRowSelection, enableExpanding, hideSelectAll, selectChildrenWithParent, getRowLabel, slotProps, sx, ...boxProps }: BiampTableProps<TData>): import("react/jsx-runtime").JSX.Element;
78
+ export declare function BiampTable<TData>({ table, onRowClick, isRowClickable, loading, error, empty, enableRowSelection, enableExpanding, hideSelectAll, selectChildrenWithParent, getRowLabel, setRowColor, slotProps, sx, ...boxProps }: BiampTableProps<TData>): import("react/jsx-runtime").JSX.Element;
70
79
  export {};
71
80
  //# sourceMappingURL=BiampTable.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"BiampTable.d.ts","sourceRoot":"","sources":["../../src/BiampTable/BiampTable.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,K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,aAAa,EACb,wBAAgC,EAChC,WAAW,EACX,WAAW,EACX,SAAS,EACT,EAAE,EACF,GAAG,QAAQ,EACZ,EAAE,eAAe,CAAC,KAAK,CAAC,2CAiLxB"}
package/dist/index.cjs CHANGED
@@ -1166,6 +1166,7 @@ function BiampTableRowInner({
1166
1166
  selectChildrenWithParent,
1167
1167
  getRowLabel,
1168
1168
  hasExpandableRows,
1169
+ customColor,
1169
1170
  rowSlotProps,
1170
1171
  cellSlotProps
1171
1172
  }) {
@@ -1185,7 +1186,11 @@ function BiampTableRowInner({
1185
1186
  selected: enableRowSelection ? isSelected : void 0,
1186
1187
  role: clickable ? "button" : void 0,
1187
1188
  tabIndex: clickable ? 0 : void 0,
1188
- sx: mergeSx(clickable && rowCursorPointerSx, userRowSx),
1189
+ sx: mergeSx(
1190
+ clickable && rowCursorPointerSx,
1191
+ customColor ? { backgroundColor: customColor } : void 0,
1192
+ userRowSx
1193
+ ),
1189
1194
  onClick: clickable && onRowClick ? (e) => {
1190
1195
  onRowClick(row.original);
1191
1196
  userRowOnClick?.(e);
@@ -1198,23 +1203,33 @@ function BiampTableRowInner({
1198
1203
  userRowOnKeyDown?.(e);
1199
1204
  } : userRowOnKeyDown,
1200
1205
  children: [
1201
- enableRowSelection && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_material7.TableCell, { padding: "checkbox", sx: selectionCellSx, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1202
- import_material7.Checkbox,
1206
+ enableRowSelection && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1207
+ import_material7.TableCell,
1203
1208
  {
1204
- checked: isSelected,
1205
- disabled: !row.getCanSelect(),
1206
- onChange: (e) => row.toggleSelected(e.target.checked, {
1207
- selectChildren: selectChildrenWithParent
1208
- }),
1209
- onClick: (e) => e.stopPropagation(),
1210
- sx: !row.getCanSelect() ? checkboxHiddenSx : void 0,
1211
- slotProps: {
1212
- input: {
1213
- "aria-label": getRowLabel ? `Select ${getRowLabel(row.original)}` : `Select row ${row.index + 1}`
1209
+ padding: "checkbox",
1210
+ sx: mergeSx(
1211
+ selectionCellSx,
1212
+ customColor ? { backgroundColor: customColor } : void 0
1213
+ ),
1214
+ children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1215
+ import_material7.Checkbox,
1216
+ {
1217
+ checked: isSelected,
1218
+ disabled: !row.getCanSelect(),
1219
+ onChange: (e) => row.toggleSelected(e.target.checked, {
1220
+ selectChildren: selectChildrenWithParent
1221
+ }),
1222
+ onClick: (e) => e.stopPropagation(),
1223
+ sx: !row.getCanSelect() ? checkboxHiddenSx : void 0,
1224
+ slotProps: {
1225
+ input: {
1226
+ "aria-label": getRowLabel ? `Select ${getRowLabel(row.original)}` : `Select row ${row.index + 1}`
1227
+ }
1228
+ }
1214
1229
  }
1215
- }
1230
+ )
1216
1231
  }
1217
- ) }),
1232
+ ),
1218
1233
  row.getVisibleCells().map((cell, cellIndex, cells) => {
1219
1234
  const sticky = cell.column.columnDef.meta?.sticky;
1220
1235
  const isExpandCell = enableExpanding && !sticky && cellIndex === cells.findIndex((c) => !c.column.columnDef.meta?.sticky);
@@ -1232,6 +1247,7 @@ function BiampTableRowInner({
1232
1247
  sx: mergeSx(
1233
1248
  cellSx(sticky, cell.column.columnDef.meta?.minWidth, 2),
1234
1249
  { pl: isExpandCell ? "6px" : "12px" },
1250
+ sticky && customColor ? { backgroundColor: customColor } : void 0,
1235
1251
  userCellSx
1236
1252
  ),
1237
1253
  children: (() => {
@@ -1289,7 +1305,7 @@ function BiampTableRowInner({
1289
1305
  );
1290
1306
  }
1291
1307
  function biampTableRowPropsAreEqual(prev, next) {
1292
- return prev.row.id === next.row.id && prev.row.original === next.row.original && prev.isSelected === next.isSelected && prev.isExpanded === next.isExpanded && prev.row.getVisibleCells().length === next.row.getVisibleCells().length && prev.enableRowSelection === next.enableRowSelection && prev.enableExpanding === next.enableExpanding && prev.hasExpandableRows === next.hasExpandableRows && prev.selectChildrenWithParent === next.selectChildrenWithParent && prev.onRowClick === next.onRowClick && prev.isRowClickable === next.isRowClickable && prev.getRowLabel === next.getRowLabel && prev.rowSlotProps === next.rowSlotProps && prev.cellSlotProps === next.cellSlotProps;
1308
+ return prev.row.id === next.row.id && prev.row.original === next.row.original && prev.isSelected === next.isSelected && prev.isExpanded === next.isExpanded && prev.row.getVisibleCells().length === next.row.getVisibleCells().length && prev.enableRowSelection === next.enableRowSelection && prev.enableExpanding === next.enableExpanding && prev.hasExpandableRows === next.hasExpandableRows && prev.selectChildrenWithParent === next.selectChildrenWithParent && prev.onRowClick === next.onRowClick && prev.isRowClickable === next.isRowClickable && prev.getRowLabel === next.getRowLabel && prev.customColor === next.customColor && prev.rowSlotProps === next.rowSlotProps && prev.cellSlotProps === next.cellSlotProps;
1293
1309
  }
1294
1310
  var BiampTableRow = import_react4.default.memo(
1295
1311
  BiampTableRowInner,
@@ -1307,6 +1323,7 @@ function BiampTable({
1307
1323
  hideSelectAll,
1308
1324
  selectChildrenWithParent = false,
1309
1325
  getRowLabel,
1326
+ setRowColor,
1310
1327
  slotProps,
1311
1328
  sx,
1312
1329
  ...boxProps
@@ -1431,6 +1448,7 @@ function BiampTable({
1431
1448
  selectChildrenWithParent,
1432
1449
  getRowLabel,
1433
1450
  hasExpandableRows,
1451
+ customColor: setRowColor?.(row.original),
1434
1452
  rowSlotProps: slotProps?.row,
1435
1453
  cellSlotProps: slotProps?.cell
1436
1454
  },