najm-kit 0.0.24 → 0.0.26

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