najm-kit 0.0.24 → 0.0.25

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
@@ -2287,6 +2287,7 @@ interface TableState {
2287
2287
  onRowContextMenu: any;
2288
2288
  onBackgroundContextMenu: ((e: MouseEvent) => void) | null;
2289
2289
  openRowMenu: ((e: MouseEvent, row: any) => void) | null;
2290
+ getRowClassName: ((row: any) => string | undefined | null | false) | null;
2290
2291
  menuButton: boolean;
2291
2292
  onCellClick: any;
2292
2293
  onBulkDelete: any;
@@ -2402,6 +2403,7 @@ declare const createTableStore: () => {
2402
2403
  onRowContextMenu: () => any;
2403
2404
  onBackgroundContextMenu: () => (e: MouseEvent) => void;
2404
2405
  openRowMenu: () => (e: MouseEvent, row: any) => void;
2406
+ getRowClassName: () => (row: any) => string | undefined | null | false;
2405
2407
  menuButton: () => boolean;
2406
2408
  onCellClick: () => any;
2407
2409
  onBulkDelete: () => any;
@@ -2587,6 +2589,7 @@ interface NTableProps<T = any, M extends ViewMode = ViewMode> {
2587
2589
  showCheckbox?: boolean;
2588
2590
  onRowClick?: (row: T) => void;
2589
2591
  onRowContextMenu?: (e: React__default.MouseEvent, row: T) => void;
2592
+ getRowClassName?: (row: T) => string | undefined | null | false;
2590
2593
  menu?: NTableMenuProp<T>;
2591
2594
  menuButton?: boolean;
2592
2595
  onCellEdit?: (row: T, columnId: string, value: any) => Promise<any>;
@@ -2758,6 +2761,7 @@ declare const TableStoreContext: React$1.Context<{
2758
2761
  onRowContextMenu: () => any;
2759
2762
  onBackgroundContextMenu: () => (e: React$1.MouseEvent) => void;
2760
2763
  openRowMenu: () => (e: React$1.MouseEvent, row: any) => void;
2764
+ getRowClassName: () => (row: any) => string | undefined | null | false;
2761
2765
  menuButton: () => boolean;
2762
2766
  onCellClick: () => any;
2763
2767
  onBulkDelete: () => any;
@@ -2877,6 +2881,7 @@ declare function useStoreSync(props: any): {
2877
2881
  onRowContextMenu: () => any;
2878
2882
  onBackgroundContextMenu: () => (e: React__default.MouseEvent) => void;
2879
2883
  openRowMenu: () => (e: React__default.MouseEvent, row: any) => void;
2884
+ getRowClassName: () => (row: any) => string | undefined | null | false;
2880
2885
  menuButton: () => boolean;
2881
2886
  onCellClick: () => any;
2882
2887
  onBulkDelete: () => any;
package/dist/index.mjs CHANGED
@@ -7947,6 +7947,7 @@ var createTableStore = () => {
7947
7947
  onRowContextMenu: null,
7948
7948
  onBackgroundContextMenu: null,
7949
7949
  openRowMenu: null,
7950
+ getRowClassName: null,
7950
7951
  menuButton: false,
7951
7952
  onCellClick: null,
7952
7953
  onBulkDelete: null,
@@ -8515,6 +8516,7 @@ function NTableContent({ effectiveMode }) {
8515
8516
  const onRowClick = useTableStore.use.onRowClick();
8516
8517
  const onRowContextMenu = useTableStore.use.onRowContextMenu();
8517
8518
  const onBackgroundContextMenu = useTableStore.use.onBackgroundContextMenu();
8519
+ const getRowClassName = useTableStore.use.getRowClassName();
8518
8520
  const onCellEdit = useTableStore.use.onCellEdit();
8519
8521
  const isLoading = useTableStore.use.isLoading();
8520
8522
  const error = useTableStore.use.error();
@@ -8599,6 +8601,7 @@ function NTableContent({ effectiveMode }) {
8599
8601
  const canExpand = hasExpansion && row.getCanExpand();
8600
8602
  const isExpanded = canExpand && row.getIsExpanded();
8601
8603
  const totalCols = row.getVisibleCells().length + (showCheckbox ? 1 : 0) + (hasExpansion ? 1 : 0);
8604
+ const rowClassName = getRowClassName?.(row.original);
8602
8605
  return /* @__PURE__ */ jsxs(React__default.Fragment, { children: [
8603
8606
  /* @__PURE__ */ jsxs(
8604
8607
  TableRow,
@@ -8613,7 +8616,7 @@ function NTableContent({ effectiveMode }) {
8613
8616
  onRowContextMenu(e, row.original);
8614
8617
  } : void 0,
8615
8618
  style: rowBorderStyle,
8616
- className: cn(classNames?.row, onRowClick && "cursor-pointer", isSelectedByRowId && "bg-primary/5 hover:bg-primary/5", bordered === true && "border-border"),
8619
+ className: cn(classNames?.row, rowClassName, onRowClick && "cursor-pointer", isSelectedByRowId && "bg-primary/5 hover:bg-primary/5", bordered === true && "border-border"),
8617
8620
  children: [
8618
8621
  showCheckbox && /* @__PURE__ */ jsx(TableCell, { className: "h-14 w-10 text-center", children: /* @__PURE__ */ jsx(
8619
8622
  Checkbox,
@@ -8799,6 +8802,7 @@ function NTableCards({ effectiveMode }) {
8799
8802
  const onRowClick = useTableStore.use.onRowClick();
8800
8803
  const onRowContextMenu = useTableStore.use.onRowContextMenu();
8801
8804
  const onBackgroundContextMenu = useTableStore.use.onBackgroundContextMenu();
8805
+ const getRowClassName = useTableStore.use.getRowClassName();
8802
8806
  const openRowMenu = useTableStore.use.openRowMenu();
8803
8807
  const menuButton = useTableStore.use.menuButton();
8804
8808
  const onView = useTableStore.use.onView();
@@ -8857,6 +8861,7 @@ function NTableCards({ effectiveMode }) {
8857
8861
  const canExpand = hasExpansion && row.getCanExpand();
8858
8862
  const isExpanded = canExpand && row.getIsExpanded();
8859
8863
  const handleClick = onRowClick ? () => onRowClick(row.original) : void 0;
8864
+ const rowClassName = getRowClassName?.(row.original);
8860
8865
  const handleCardContextMenu = onRowContextMenu ? (e) => {
8861
8866
  if (isRowContextHandled(e)) return;
8862
8867
  markRowContextHandled(e);
@@ -8869,7 +8874,7 @@ function NTableCards({ effectiveMode }) {
8869
8874
  onContextMenu: handleCardContextMenu,
8870
8875
  "data-row": "true",
8871
8876
  "data-row-id": row.id,
8872
- className: "group relative",
8877
+ className: cn("group relative", rowClassName),
8873
8878
  children: [
8874
8879
  menuButton && openRowMenu && /* @__PURE__ */ jsx(
8875
8880
  "button",
@@ -8916,6 +8921,7 @@ function NTableCards({ effectiveMode }) {
8916
8921
  openRowMenu,
8917
8922
  menuButton,
8918
8923
  bordered,
8924
+ className: rowClassName || void 0,
8919
8925
  children: /* @__PURE__ */ jsx(
8920
8926
  CardComponent,
8921
8927
  {
@@ -9519,6 +9525,7 @@ function NTable(props) {
9519
9525
  onRowContextMenu: onRowContextMenu || effectiveRowMenu ? handleRowContextMenu : null,
9520
9526
  onBackgroundContextMenu: normalizedMenu.background ? handleBackgroundContextMenu : null,
9521
9527
  openRowMenu: autoOpenRowMenu,
9528
+ getRowClassName: props.getRowClassName ?? null,
9522
9529
  menuButton: effectiveMenuButton,
9523
9530
  onCellEdit: props.onCellEdit ?? null,
9524
9531
  onBulkDelete: props.onBulkDelete ?? null,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "najm-kit",
3
- "version": "0.0.24",
3
+ "version": "0.0.25",
4
4
  "type": "module",
5
5
  "description": "Reusable React UI component package for Najm framework",
6
6
  "main": "./dist/index.mjs",