baaz-custom-components 5.2.0 → 5.2.2

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.mts CHANGED
@@ -1,5 +1,5 @@
1
- import * as react from 'react';
2
- import react__default, { ReactNode } from 'react';
1
+ import * as React$1 from 'react';
2
+ import React__default, { ReactNode } from 'react';
3
3
  import { IApi } from '@svar-ui/react-grid';
4
4
 
5
5
  type NavbarData = NavbarEntry[];
@@ -48,7 +48,7 @@ interface NavbarProps {
48
48
  hubIdChangeHandler: (value: string) => void;
49
49
  }
50
50
 
51
- declare function Navbar({ navbarData, userData, onLogout, notificationData, router, hubDetails, hubIdEnable, hubIdChangeHandler, notificationHandler, }: NavbarProps): react.JSX.Element | null;
51
+ declare function Navbar({ navbarData, userData, onLogout, notificationData, router, hubDetails, hubIdEnable, hubIdChangeHandler, notificationHandler, }: NavbarProps): React$1.JSX.Element | null;
52
52
 
53
53
  type BreadcrumbProps = {
54
54
  layoutName: string;
@@ -57,7 +57,7 @@ type BreadcrumbProps = {
57
57
  pathname?: string;
58
58
  };
59
59
 
60
- declare const CustomBreadcrumb: ({ layoutName, includeFrom, pathname, }: BreadcrumbProps) => react.JSX.Element;
60
+ declare const CustomBreadcrumb: ({ layoutName, includeFrom, pathname, }: BreadcrumbProps) => React$1.JSX.Element;
61
61
 
62
62
  type SortOrder = "asc" | "desc";
63
63
 
@@ -145,8 +145,7 @@ type AnyRow = {
145
145
  interface SelectionAction {
146
146
  id: string;
147
147
  label: string;
148
- icon?: react__default.ReactNode;
149
- needsConfirmation?: boolean;
148
+ icon?: React__default.ReactNode;
150
149
  }
151
150
  interface GridSelectionProps {
152
151
  selectionEnabled?: boolean;
@@ -162,7 +161,7 @@ interface GridHeaderSelectionProps {
162
161
  onClearSelection?: () => void;
163
162
  }
164
163
 
165
- declare const Grid: react.ForwardRefExoticComponent<GridProps & GridSelectionProps & GridHeaderSelectionProps & react.RefAttributes<IApi | null>>;
164
+ declare const _default$1: React__default.NamedExoticComponent<GridProps & GridSelectionProps & GridHeaderSelectionProps & React__default.RefAttributes<IApi | null>>;
166
165
 
167
166
  type Props = {
168
167
  cell: {
@@ -173,7 +172,7 @@ type Props = {
173
172
  sortOrder?: SortOrder | null;
174
173
  onSortChange?: (key: string, order: SortOrder) => void;
175
174
  };
176
- declare const _default: react__default.MemoExoticComponent<({ cell, sortKey, sortOrder, onSortChange }: Props) => react__default.JSX.Element>;
175
+ declare const _default: React__default.MemoExoticComponent<({ cell, sortKey, sortOrder, onSortChange }: Props) => React__default.JSX.Element>;
177
176
 
178
177
  type Pagination$1 = {
179
178
  totalCount: number;
@@ -187,7 +186,7 @@ type Pagination$1 = {
187
186
  sizeChangerOptions?: number[];
188
187
  };
189
188
 
190
- declare function Pagination({ totalCount, count, currentPage, totalPages, pageSize, onPageChange, onPageSizeChange, showSizeChanger, sizeChangerOptions, }: Pagination$1): react.JSX.Element;
189
+ declare function Pagination({ totalCount, count, currentPage, totalPages, pageSize, onPageChange, onPageSizeChange, showSizeChanger, sizeChangerOptions, }: Pagination$1): React$1.JSX.Element;
191
190
 
192
191
  interface ToolbarItem {
193
192
  id: string;
@@ -207,4 +206,4 @@ interface SlideToolbarProps {
207
206
 
208
207
  declare const SlideToolbar: React.FC<SlideToolbarProps>;
209
208
 
210
- export { type BreadcrumbProps, CustomBreadcrumb, Grid, type GridProps, Navbar, type NavbarData, type NavbarEntry, type NavbarProps, type NotificationDataTypes, Pagination, type Pagination$1 as PaginationProps, type RouteTree, type RouterAdapter, SlideToolbar, type SlideToolbarProps, _default as SortableHeaderCell, type ToolbarItem, type UserData };
209
+ export { type BreadcrumbProps, CustomBreadcrumb, _default$1 as Grid, type GridProps, Navbar, type NavbarData, type NavbarEntry, type NavbarProps, type NotificationDataTypes, Pagination, type Pagination$1 as PaginationProps, type RouteTree, type RouterAdapter, SlideToolbar, type SlideToolbarProps, _default as SortableHeaderCell, type ToolbarItem, type UserData };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import * as react from 'react';
2
- import react__default, { ReactNode } from 'react';
1
+ import * as React$1 from 'react';
2
+ import React__default, { ReactNode } from 'react';
3
3
  import { IApi } from '@svar-ui/react-grid';
4
4
 
5
5
  type NavbarData = NavbarEntry[];
@@ -48,7 +48,7 @@ interface NavbarProps {
48
48
  hubIdChangeHandler: (value: string) => void;
49
49
  }
50
50
 
51
- declare function Navbar({ navbarData, userData, onLogout, notificationData, router, hubDetails, hubIdEnable, hubIdChangeHandler, notificationHandler, }: NavbarProps): react.JSX.Element | null;
51
+ declare function Navbar({ navbarData, userData, onLogout, notificationData, router, hubDetails, hubIdEnable, hubIdChangeHandler, notificationHandler, }: NavbarProps): React$1.JSX.Element | null;
52
52
 
53
53
  type BreadcrumbProps = {
54
54
  layoutName: string;
@@ -57,7 +57,7 @@ type BreadcrumbProps = {
57
57
  pathname?: string;
58
58
  };
59
59
 
60
- declare const CustomBreadcrumb: ({ layoutName, includeFrom, pathname, }: BreadcrumbProps) => react.JSX.Element;
60
+ declare const CustomBreadcrumb: ({ layoutName, includeFrom, pathname, }: BreadcrumbProps) => React$1.JSX.Element;
61
61
 
62
62
  type SortOrder = "asc" | "desc";
63
63
 
@@ -145,8 +145,7 @@ type AnyRow = {
145
145
  interface SelectionAction {
146
146
  id: string;
147
147
  label: string;
148
- icon?: react__default.ReactNode;
149
- needsConfirmation?: boolean;
148
+ icon?: React__default.ReactNode;
150
149
  }
151
150
  interface GridSelectionProps {
152
151
  selectionEnabled?: boolean;
@@ -162,7 +161,7 @@ interface GridHeaderSelectionProps {
162
161
  onClearSelection?: () => void;
163
162
  }
164
163
 
165
- declare const Grid: react.ForwardRefExoticComponent<GridProps & GridSelectionProps & GridHeaderSelectionProps & react.RefAttributes<IApi | null>>;
164
+ declare const _default$1: React__default.NamedExoticComponent<GridProps & GridSelectionProps & GridHeaderSelectionProps & React__default.RefAttributes<IApi | null>>;
166
165
 
167
166
  type Props = {
168
167
  cell: {
@@ -173,7 +172,7 @@ type Props = {
173
172
  sortOrder?: SortOrder | null;
174
173
  onSortChange?: (key: string, order: SortOrder) => void;
175
174
  };
176
- declare const _default: react__default.MemoExoticComponent<({ cell, sortKey, sortOrder, onSortChange }: Props) => react__default.JSX.Element>;
175
+ declare const _default: React__default.MemoExoticComponent<({ cell, sortKey, sortOrder, onSortChange }: Props) => React__default.JSX.Element>;
177
176
 
178
177
  type Pagination$1 = {
179
178
  totalCount: number;
@@ -187,7 +186,7 @@ type Pagination$1 = {
187
186
  sizeChangerOptions?: number[];
188
187
  };
189
188
 
190
- declare function Pagination({ totalCount, count, currentPage, totalPages, pageSize, onPageChange, onPageSizeChange, showSizeChanger, sizeChangerOptions, }: Pagination$1): react.JSX.Element;
189
+ declare function Pagination({ totalCount, count, currentPage, totalPages, pageSize, onPageChange, onPageSizeChange, showSizeChanger, sizeChangerOptions, }: Pagination$1): React$1.JSX.Element;
191
190
 
192
191
  interface ToolbarItem {
193
192
  id: string;
@@ -207,4 +206,4 @@ interface SlideToolbarProps {
207
206
 
208
207
  declare const SlideToolbar: React.FC<SlideToolbarProps>;
209
208
 
210
- export { type BreadcrumbProps, CustomBreadcrumb, Grid, type GridProps, Navbar, type NavbarData, type NavbarEntry, type NavbarProps, type NotificationDataTypes, Pagination, type Pagination$1 as PaginationProps, type RouteTree, type RouterAdapter, SlideToolbar, type SlideToolbarProps, _default as SortableHeaderCell, type ToolbarItem, type UserData };
209
+ export { type BreadcrumbProps, CustomBreadcrumb, _default$1 as Grid, type GridProps, Navbar, type NavbarData, type NavbarEntry, type NavbarProps, type NotificationDataTypes, Pagination, type Pagination$1 as PaginationProps, type RouteTree, type RouterAdapter, SlideToolbar, type SlideToolbarProps, _default as SortableHeaderCell, type ToolbarItem, type UserData };
package/dist/index.js CHANGED
@@ -1947,7 +1947,7 @@ var CustomBreadcrumb = ({
1947
1947
  var breadcrumb_default = CustomBreadcrumb;
1948
1948
 
1949
1949
  // src/components/custom/grid/index.tsx
1950
- var import_react10 = require("react");
1950
+ var import_react10 = __toESM(require("react"));
1951
1951
  var import_react_grid = require("@svar-ui/react-grid");
1952
1952
 
1953
1953
  // src/utils/exportPdf.ts
@@ -1981,7 +1981,7 @@ function exportExcel(rows, name) {
1981
1981
  }
1982
1982
 
1983
1983
  // src/components/custom/grid/gridHeader/index.tsx
1984
- var import_react6 = require("react");
1984
+ var import_react6 = __toESM(require("react"));
1985
1985
  var import_lucide_react14 = require("lucide-react");
1986
1986
 
1987
1987
  // src/components/custom/grid/gridHeader/components/filters.tsx
@@ -2412,6 +2412,7 @@ function GridHeader({
2412
2412
  onSelectionAction,
2413
2413
  onClearSelection
2414
2414
  }) {
2415
+ console.log("GridHeader rendered");
2415
2416
  const [downloadMenu, setDownloadMenu] = (0, import_react6.useState)(false);
2416
2417
  const [searchOpen, setSearchOpen] = (0, import_react6.useState)(false);
2417
2418
  const downloadRef = (0, import_react6.useRef)(null);
@@ -2509,13 +2510,20 @@ function GridHeader({
2509
2510
  value: searchValue
2510
2511
  }
2511
2512
  ),
2512
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("button", { onClick: () => setSearchOpen(false), className: "cursor-pointer", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_lucide_react14.X, { size: 16 }) })
2513
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
2514
+ "button",
2515
+ {
2516
+ onClick: () => setSearchOpen(false),
2517
+ className: "cursor-pointer",
2518
+ children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_lucide_react14.X, { size: 16 })
2519
+ }
2520
+ )
2513
2521
  ] })
2514
2522
  }
2515
2523
  ) })
2516
2524
  ] });
2517
2525
  }
2518
- var gridHeader_default = GridHeader;
2526
+ var gridHeader_default = import_react6.default.memo(GridHeader);
2519
2527
 
2520
2528
  // src/components/custom/grid/checkboxCell/checkBoxCell.tsx
2521
2529
  var import_react8 = __toESM(require("react"));
@@ -2565,6 +2573,7 @@ function useStore(store, name) {
2565
2573
  // src/components/custom/grid/checkboxCell/checkBoxCell.tsx
2566
2574
  var import_jsx_runtime26 = require("react/jsx-runtime");
2567
2575
  var CheckboxCell = ({ row, api, column }) => {
2576
+ console.log("CheckboxCell rendered");
2568
2577
  const selectedRows = useStore(api, "selectedRows");
2569
2578
  const isSelected = selectedRows.includes(row.id);
2570
2579
  const handleChange = (e) => {
@@ -2592,7 +2601,9 @@ var CheckboxCell = ({ row, api, column }) => {
2592
2601
  }
2593
2602
  );
2594
2603
  };
2595
- var checkBoxCell_default = import_react8.default.memo(CheckboxCell);
2604
+ var checkBoxCell_default = import_react8.default.memo(CheckboxCell, (prev, next) => {
2605
+ return prev.row.id !== next.row.id;
2606
+ });
2596
2607
 
2597
2608
  // src/components/custom/grid/checkboxCell/headerCheckBox.tsx
2598
2609
  var import_react9 = __toESM(require("react"));
@@ -2741,6 +2752,7 @@ var Grid = (0, import_react10.forwardRef)(
2741
2752
  "onClearSelection"
2742
2753
  ]);
2743
2754
  var _a2;
2755
+ console.log("Grid rendered");
2744
2756
  const apiRef = (0, import_react10.useRef)(null);
2745
2757
  const containerRef = (0, import_react10.useRef)(null);
2746
2758
  const dataRef = (0, import_react10.useRef)(data);
@@ -2764,6 +2776,7 @@ var Grid = (0, import_react10.forwardRef)(
2764
2776
  prevSelectedCountRef.current = selectedCount != null ? selectedCount : 0;
2765
2777
  const resolvedColumns = (0, import_react10.useMemo)(() => {
2766
2778
  if (!selectionEnabled) return columns;
2779
+ if (columns.length === 0) return columns;
2767
2780
  const checkboxCol = buildCheckboxColumn({
2768
2781
  getPageData: () => {
2769
2782
  var _a3;
@@ -2905,7 +2918,7 @@ var Grid = (0, import_react10.forwardRef)(
2905
2918
  ] });
2906
2919
  }
2907
2920
  );
2908
- var grid_default = Grid;
2921
+ var grid_default = import_react10.default.memo(Grid);
2909
2922
 
2910
2923
  // src/components/custom/grid/sortableHeaderCell.tsx
2911
2924
  var import_lucide_react15 = require("lucide-react");
package/dist/index.mjs CHANGED
@@ -1909,7 +1909,7 @@ var CustomBreadcrumb = ({
1909
1909
  var breadcrumb_default = CustomBreadcrumb;
1910
1910
 
1911
1911
  // src/components/custom/grid/index.tsx
1912
- import {
1912
+ import React6, {
1913
1913
  useCallback as useCallback2,
1914
1914
  useRef as useRef5,
1915
1915
  useImperativeHandle,
@@ -1950,7 +1950,7 @@ function exportExcel(rows, name) {
1950
1950
  }
1951
1951
 
1952
1952
  // src/components/custom/grid/gridHeader/index.tsx
1953
- import { useEffect as useEffect6, useRef as useRef2, useState as useState7 } from "react";
1953
+ import React3, { useEffect as useEffect6, useRef as useRef2, useState as useState7 } from "react";
1954
1954
  import { FileText, FileSpreadsheet, Search, Ellipsis, X as X4 } from "lucide-react";
1955
1955
 
1956
1956
  // src/components/custom/grid/gridHeader/components/filters.tsx
@@ -2381,6 +2381,7 @@ function GridHeader({
2381
2381
  onSelectionAction,
2382
2382
  onClearSelection
2383
2383
  }) {
2384
+ console.log("GridHeader rendered");
2384
2385
  const [downloadMenu, setDownloadMenu] = useState7(false);
2385
2386
  const [searchOpen, setSearchOpen] = useState7(false);
2386
2387
  const downloadRef = useRef2(null);
@@ -2478,16 +2479,23 @@ function GridHeader({
2478
2479
  value: searchValue
2479
2480
  }
2480
2481
  ),
2481
- /* @__PURE__ */ jsx25("button", { onClick: () => setSearchOpen(false), className: "cursor-pointer", children: /* @__PURE__ */ jsx25(X4, { size: 16 }) })
2482
+ /* @__PURE__ */ jsx25(
2483
+ "button",
2484
+ {
2485
+ onClick: () => setSearchOpen(false),
2486
+ className: "cursor-pointer",
2487
+ children: /* @__PURE__ */ jsx25(X4, { size: 16 })
2488
+ }
2489
+ )
2482
2490
  ] })
2483
2491
  }
2484
2492
  ) })
2485
2493
  ] });
2486
2494
  }
2487
- var gridHeader_default = GridHeader;
2495
+ var gridHeader_default = React3.memo(GridHeader);
2488
2496
 
2489
2497
  // src/components/custom/grid/checkboxCell/checkBoxCell.tsx
2490
- import React3 from "react";
2498
+ import React4 from "react";
2491
2499
 
2492
2500
  // node_modules/@svar-ui/lib-react/dist/index.js
2493
2501
  import { useState as useState8, useRef as useRef3, useEffect as useEffect7 } from "react";
@@ -2534,6 +2542,7 @@ function useStore(store, name) {
2534
2542
  // src/components/custom/grid/checkboxCell/checkBoxCell.tsx
2535
2543
  import { jsx as jsx26 } from "react/jsx-runtime";
2536
2544
  var CheckboxCell = ({ row, api, column }) => {
2545
+ console.log("CheckboxCell rendered");
2537
2546
  const selectedRows = useStore(api, "selectedRows");
2538
2547
  const isSelected = selectedRows.includes(row.id);
2539
2548
  const handleChange = (e) => {
@@ -2561,10 +2570,12 @@ var CheckboxCell = ({ row, api, column }) => {
2561
2570
  }
2562
2571
  );
2563
2572
  };
2564
- var checkBoxCell_default = React3.memo(CheckboxCell);
2573
+ var checkBoxCell_default = React4.memo(CheckboxCell, (prev, next) => {
2574
+ return prev.row.id !== next.row.id;
2575
+ });
2565
2576
 
2566
2577
  // src/components/custom/grid/checkboxCell/headerCheckBox.tsx
2567
- import React4, { useEffect as useEffect8, useRef as useRef4, useReducer } from "react";
2578
+ import React5, { useEffect as useEffect8, useRef as useRef4, useReducer } from "react";
2568
2579
  import { jsx as jsx27 } from "react/jsx-runtime";
2569
2580
  var HeaderCheckbox = ({ api, column }) => {
2570
2581
  var _a;
@@ -2630,7 +2641,7 @@ var HeaderCheckbox = ({ api, column }) => {
2630
2641
  }
2631
2642
  );
2632
2643
  };
2633
- var headerCheckBox_default = React4.memo(HeaderCheckbox);
2644
+ var headerCheckBox_default = React5.memo(HeaderCheckbox);
2634
2645
 
2635
2646
  // src/components/custom/grid/utils/buildCheckboxColumn.tsx
2636
2647
  function buildCheckboxColumn({
@@ -2710,6 +2721,7 @@ var Grid = forwardRef(
2710
2721
  "onClearSelection"
2711
2722
  ]);
2712
2723
  var _a2;
2724
+ console.log("Grid rendered");
2713
2725
  const apiRef = useRef5(null);
2714
2726
  const containerRef = useRef5(null);
2715
2727
  const dataRef = useRef5(data);
@@ -2733,6 +2745,7 @@ var Grid = forwardRef(
2733
2745
  prevSelectedCountRef.current = selectedCount != null ? selectedCount : 0;
2734
2746
  const resolvedColumns = useMemo4(() => {
2735
2747
  if (!selectionEnabled) return columns;
2748
+ if (columns.length === 0) return columns;
2736
2749
  const checkboxCol = buildCheckboxColumn({
2737
2750
  getPageData: () => {
2738
2751
  var _a3;
@@ -2874,11 +2887,11 @@ var Grid = forwardRef(
2874
2887
  ] });
2875
2888
  }
2876
2889
  );
2877
- var grid_default = Grid;
2890
+ var grid_default = React6.memo(Grid);
2878
2891
 
2879
2892
  // src/components/custom/grid/sortableHeaderCell.tsx
2880
2893
  import { MoveDown, MoveUp, ArrowUpDown } from "lucide-react";
2881
- import React5 from "react";
2894
+ import React7 from "react";
2882
2895
  import { jsx as jsx29, jsxs as jsxs21 } from "react/jsx-runtime";
2883
2896
  var SortableHeaderCell = ({ cell, sortKey, sortOrder, onSortChange }) => {
2884
2897
  if (!(cell == null ? void 0 : cell.id)) return /* @__PURE__ */ jsx29("span", { children: cell == null ? void 0 : cell.text });
@@ -2908,7 +2921,7 @@ var SortableHeaderCell = ({ cell, sortKey, sortOrder, onSortChange }) => {
2908
2921
  }
2909
2922
  );
2910
2923
  };
2911
- var sortableHeaderCell_default = React5.memo(SortableHeaderCell, (prev, next) => {
2924
+ var sortableHeaderCell_default = React7.memo(SortableHeaderCell, (prev, next) => {
2912
2925
  var _a, _b, _c, _d;
2913
2926
  if (((_a = prev.cell) == null ? void 0 : _a.id) !== ((_b = next.cell) == null ? void 0 : _b.id)) return false;
2914
2927
  if (((_c = prev.cell) == null ? void 0 : _c.text) !== ((_d = next.cell) == null ? void 0 : _d.text)) return false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "baaz-custom-components",
3
- "version": "5.2.0",
3
+ "version": "5.2.2",
4
4
  "private": false,
5
5
  "sideEffects": false,
6
6
  "main": "dist/index.js",