warqadui 0.0.41 → 0.0.42

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
@@ -499,8 +499,9 @@ interface SimpleTableProps<TData> {
499
499
  title?: string;
500
500
  enableSearch?: boolean;
501
501
  emptyState?: React__default.ReactNode;
502
+ skeletonCount?: number;
502
503
  }
503
- declare function SimpleTable<TData>({ columns: userColumns, data, className, renderFooter: componentFooter, rowPadding, verticalLines, index, startIndex, isLoading, title, enableSearch, emptyState, }: SimpleTableProps<TData>): react_jsx_runtime.JSX.Element;
504
+ declare function SimpleTable<TData>({ columns: userColumns, data, className, renderFooter: componentFooter, rowPadding, verticalLines, index, startIndex, isLoading, title, enableSearch, emptyState, skeletonCount, }: SimpleTableProps<TData>): react_jsx_runtime.JSX.Element;
504
505
 
505
506
  interface BadgeProps extends HTMLAttributes<HTMLSpanElement> {
506
507
  variant?: "primary" | "danger" | "warning" | "success";
@@ -571,13 +572,14 @@ declare const useApi: () => {
571
572
  }>;
572
573
  };
573
574
 
574
- declare const useA4StatementView: ({ url, v, delay, params, }?: {
575
+ declare const useA4StatementView: ({ url, v, delay, params, startPage, }?: {
575
576
  url?: string;
576
577
  v?: 0 | 1 | 2;
577
578
  delay?: number;
578
579
  params?: Record<string, any>;
580
+ startPage?: number;
579
581
  }) => {
580
- A4DataView: ({ columns, data, error, info, index, title, subtitle, printable, rowPadding, verticalLines, headers, tableTitle, }: {
582
+ A4DataView: ({ columns, data, error, info, index, title, subtitle, printable, rowPadding, verticalLines, headers, tableTitle, startPage: componentStartPage, isLoading: externalLoading, }: {
581
583
  tableTitle?: string;
582
584
  columns?: SimpleTableColumn<any>[];
583
585
  data?: any[];
@@ -590,14 +592,14 @@ declare const useA4StatementView: ({ url, v, delay, params, }?: {
590
592
  rowPadding?: string;
591
593
  verticalLines?: boolean;
592
594
  headers?: React.ReactNode;
595
+ startPage?: number;
596
+ isLoading?: boolean;
593
597
  }) => react_jsx_runtime.JSX.Element;
594
598
  data: any;
595
599
  isLoading: boolean;
596
600
  get: FetchFunction;
597
601
  reactToPrintFn: react_to_print.UseReactToPrintFn;
598
602
  };
599
- type A4DataViewProps = Parameters<ReturnType<typeof useA4StatementView>["A4DataView"]>[0] & Parameters<typeof useA4StatementView>[0];
600
- declare const A4DataView: (props: A4DataViewProps) => react_jsx_runtime.JSX.Element;
601
603
 
602
604
  declare const useTransaction: ({ url, v, delay, params, }: {
603
605
  url: string;
@@ -709,4 +711,4 @@ interface StorageManager {
709
711
  */
710
712
  declare const storage: StorageManager;
711
713
 
712
- export { A4DataView, Badge, type BadgeProps, Branding, type BrandingProps, Button, type ButtonProps, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, ClassicSpin, CodeBlock, DashboardLayout, DataTable, type DataTableColumn, DateInput, type DateInputProps, type DeleteFunction, type FetchFunction, type FetchProps, Fields, InfoGrid, Input, type InputProps, LoadingBox, LoadingSpin, Modal, type ModalProps, type NavItem, type NavItems, type Option, OverlaySpin, PageA4, PageHeader, type PdfOptions, PhoneInput, type PhoneInputProps, type PostFunction, PostTable, type PostTableActions, type PostTableChangeParams, type PutFunction, SearchApi, SearchApiContent, SearchApiInput, SearchApiItem, type SearchApiProps, SearchApiTrigger, Select, SelectContent, SelectItem, type SelectProps, SelectTrigger, SimpleTable, type SimpleTableColumn, type StorageManager, type StoreConfig, Textarea, type TextareaProps, type ThemeConfig, ThemeProvider, ThemeToggle, type UseModalReturn, type WarqadConfig, type WarqadConfigContextType, WarqadProvider, generatePdf, storage, useA4StatementView, useApi, useModal, useSearchApiContext, useSelectContext, useTheme, useTransaction, useWarqadConfig };
714
+ export { Badge, type BadgeProps, Branding, type BrandingProps, Button, type ButtonProps, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, ClassicSpin, CodeBlock, DashboardLayout, DataTable, type DataTableColumn, DateInput, type DateInputProps, type DeleteFunction, type FetchFunction, type FetchProps, Fields, InfoGrid, Input, type InputProps, LoadingBox, LoadingSpin, Modal, type ModalProps, type NavItem, type NavItems, type Option, OverlaySpin, PageA4, PageHeader, type PdfOptions, PhoneInput, type PhoneInputProps, type PostFunction, PostTable, type PostTableActions, type PostTableChangeParams, type PutFunction, SearchApi, SearchApiContent, SearchApiInput, SearchApiItem, type SearchApiProps, SearchApiTrigger, Select, SelectContent, SelectItem, type SelectProps, SelectTrigger, SimpleTable, type SimpleTableColumn, type StorageManager, type StoreConfig, Textarea, type TextareaProps, type ThemeConfig, ThemeProvider, ThemeToggle, type UseModalReturn, type WarqadConfig, type WarqadConfigContextType, WarqadProvider, generatePdf, storage, useA4StatementView, useApi, useModal, useSearchApiContext, useSelectContext, useTheme, useTransaction, useWarqadConfig };
package/dist/index.d.ts CHANGED
@@ -499,8 +499,9 @@ interface SimpleTableProps<TData> {
499
499
  title?: string;
500
500
  enableSearch?: boolean;
501
501
  emptyState?: React__default.ReactNode;
502
+ skeletonCount?: number;
502
503
  }
503
- declare function SimpleTable<TData>({ columns: userColumns, data, className, renderFooter: componentFooter, rowPadding, verticalLines, index, startIndex, isLoading, title, enableSearch, emptyState, }: SimpleTableProps<TData>): react_jsx_runtime.JSX.Element;
504
+ declare function SimpleTable<TData>({ columns: userColumns, data, className, renderFooter: componentFooter, rowPadding, verticalLines, index, startIndex, isLoading, title, enableSearch, emptyState, skeletonCount, }: SimpleTableProps<TData>): react_jsx_runtime.JSX.Element;
504
505
 
505
506
  interface BadgeProps extends HTMLAttributes<HTMLSpanElement> {
506
507
  variant?: "primary" | "danger" | "warning" | "success";
@@ -571,13 +572,14 @@ declare const useApi: () => {
571
572
  }>;
572
573
  };
573
574
 
574
- declare const useA4StatementView: ({ url, v, delay, params, }?: {
575
+ declare const useA4StatementView: ({ url, v, delay, params, startPage, }?: {
575
576
  url?: string;
576
577
  v?: 0 | 1 | 2;
577
578
  delay?: number;
578
579
  params?: Record<string, any>;
580
+ startPage?: number;
579
581
  }) => {
580
- A4DataView: ({ columns, data, error, info, index, title, subtitle, printable, rowPadding, verticalLines, headers, tableTitle, }: {
582
+ A4DataView: ({ columns, data, error, info, index, title, subtitle, printable, rowPadding, verticalLines, headers, tableTitle, startPage: componentStartPage, isLoading: externalLoading, }: {
581
583
  tableTitle?: string;
582
584
  columns?: SimpleTableColumn<any>[];
583
585
  data?: any[];
@@ -590,14 +592,14 @@ declare const useA4StatementView: ({ url, v, delay, params, }?: {
590
592
  rowPadding?: string;
591
593
  verticalLines?: boolean;
592
594
  headers?: React.ReactNode;
595
+ startPage?: number;
596
+ isLoading?: boolean;
593
597
  }) => react_jsx_runtime.JSX.Element;
594
598
  data: any;
595
599
  isLoading: boolean;
596
600
  get: FetchFunction;
597
601
  reactToPrintFn: react_to_print.UseReactToPrintFn;
598
602
  };
599
- type A4DataViewProps = Parameters<ReturnType<typeof useA4StatementView>["A4DataView"]>[0] & Parameters<typeof useA4StatementView>[0];
600
- declare const A4DataView: (props: A4DataViewProps) => react_jsx_runtime.JSX.Element;
601
603
 
602
604
  declare const useTransaction: ({ url, v, delay, params, }: {
603
605
  url: string;
@@ -709,4 +711,4 @@ interface StorageManager {
709
711
  */
710
712
  declare const storage: StorageManager;
711
713
 
712
- export { A4DataView, Badge, type BadgeProps, Branding, type BrandingProps, Button, type ButtonProps, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, ClassicSpin, CodeBlock, DashboardLayout, DataTable, type DataTableColumn, DateInput, type DateInputProps, type DeleteFunction, type FetchFunction, type FetchProps, Fields, InfoGrid, Input, type InputProps, LoadingBox, LoadingSpin, Modal, type ModalProps, type NavItem, type NavItems, type Option, OverlaySpin, PageA4, PageHeader, type PdfOptions, PhoneInput, type PhoneInputProps, type PostFunction, PostTable, type PostTableActions, type PostTableChangeParams, type PutFunction, SearchApi, SearchApiContent, SearchApiInput, SearchApiItem, type SearchApiProps, SearchApiTrigger, Select, SelectContent, SelectItem, type SelectProps, SelectTrigger, SimpleTable, type SimpleTableColumn, type StorageManager, type StoreConfig, Textarea, type TextareaProps, type ThemeConfig, ThemeProvider, ThemeToggle, type UseModalReturn, type WarqadConfig, type WarqadConfigContextType, WarqadProvider, generatePdf, storage, useA4StatementView, useApi, useModal, useSearchApiContext, useSelectContext, useTheme, useTransaction, useWarqadConfig };
714
+ export { Badge, type BadgeProps, Branding, type BrandingProps, Button, type ButtonProps, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, ClassicSpin, CodeBlock, DashboardLayout, DataTable, type DataTableColumn, DateInput, type DateInputProps, type DeleteFunction, type FetchFunction, type FetchProps, Fields, InfoGrid, Input, type InputProps, LoadingBox, LoadingSpin, Modal, type ModalProps, type NavItem, type NavItems, type Option, OverlaySpin, PageA4, PageHeader, type PdfOptions, PhoneInput, type PhoneInputProps, type PostFunction, PostTable, type PostTableActions, type PostTableChangeParams, type PutFunction, SearchApi, SearchApiContent, SearchApiInput, SearchApiItem, type SearchApiProps, SearchApiTrigger, Select, SelectContent, SelectItem, type SelectProps, SelectTrigger, SimpleTable, type SimpleTableColumn, type StorageManager, type StoreConfig, Textarea, type TextareaProps, type ThemeConfig, ThemeProvider, ThemeToggle, type UseModalReturn, type WarqadConfig, type WarqadConfigContextType, WarqadProvider, generatePdf, storage, useA4StatementView, useApi, useModal, useSearchApiContext, useSelectContext, useTheme, useTransaction, useWarqadConfig };
package/dist/index.js CHANGED
@@ -30,7 +30,6 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
30
30
  // src/index.ts
31
31
  var index_exports = {};
32
32
  __export(index_exports, {
33
- A4DataView: () => A4DataView,
34
33
  Badge: () => Badge,
35
34
  Branding: () => Branding,
36
35
  Button: () => Button,
@@ -3907,7 +3906,8 @@ function SimpleTable({
3907
3906
  isLoading = false,
3908
3907
  title,
3909
3908
  enableSearch = false,
3910
- emptyState
3909
+ emptyState,
3910
+ skeletonCount = 5
3911
3911
  }) {
3912
3912
  const columns = (0, import_react17.useMemo)(() => {
3913
3913
  const cols = userColumns.filter((col) => !col.hide).map((col) => ({
@@ -3923,9 +3923,9 @@ function SimpleTable({
3923
3923
  cols.unshift({
3924
3924
  header: "#",
3925
3925
  id: "index",
3926
- width: 45,
3927
- className: "whitespace-nowrap pr-2",
3928
- cell: (info) => info.row.index + 1 + startIndex
3926
+ width: 75,
3927
+ className: "whitespace-nowrap px-2 text-center",
3928
+ cell: (info) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "tabular-nums", children: info.row.index + 1 + startIndex })
3929
3929
  });
3930
3930
  }
3931
3931
  return cols;
@@ -3971,7 +3971,7 @@ function SimpleTable({
3971
3971
  },
3972
3972
  headerGroup.id
3973
3973
  )) }),
3974
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("tbody", { className: "text-black dark:text-white font-semibold font-sans tabular-nums", children: isLoading ? Array.from({ length: 5 }).map((_, i) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
3974
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("tbody", { className: "text-black dark:text-white font-semibold font-sans tabular-nums", children: isLoading && data.length === 0 ? Array.from({ length: skeletonCount }).map((_, i) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
3975
3975
  "tr",
3976
3976
  {
3977
3977
  className: `border-b ${verticalLines ? "border-black dark:border-white" : "border-gray-100 dark:border-zinc-800/60 last:border-0"}`,
@@ -3979,13 +3979,18 @@ function SimpleTable({
3979
3979
  "td",
3980
3980
  {
3981
3981
  className: `text-sm ${rowPadding} align-top ${verticalLines ? "border-x border-black dark:border-white" : ""}`,
3982
- children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "h-4 bg-gray-200 dark:bg-zinc-800 rounded-sm animate-pulse w-full" })
3982
+ children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
3983
+ "div",
3984
+ {
3985
+ className: `h-4 bg-gray-200 dark:bg-zinc-800/50 rounded-sm animate-pulse ${colIdx % 2 === 0 ? "w-3/4" : "w-1/2"} ${colIdx === 0 ? "w-4" : ""}`
3986
+ }
3987
+ )
3983
3988
  },
3984
3989
  `skeleton-col-${colIdx}`
3985
3990
  ))
3986
3991
  },
3987
3992
  `skeleton-row-${i}`
3988
- )) : data.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("tr", { children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
3993
+ )) : data.length === 0 && !isLoading ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("tr", { children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
3989
3994
  "td",
3990
3995
  {
3991
3996
  colSpan: columns.length,
@@ -4098,17 +4103,22 @@ var useA4StatementView = ({
4098
4103
  url,
4099
4104
  v = 1,
4100
4105
  delay,
4101
- params
4106
+ params,
4107
+ startPage = 1
4102
4108
  } = {}) => {
4103
4109
  const { data: apiData, isLoading, get, error: apiError } = useApis_default();
4104
4110
  const contentRef = (0, import_react19.useRef)(null);
4105
4111
  const reactToPrintFn = (0, import_react_to_print.useReactToPrint)({
4106
4112
  contentRef
4107
4113
  });
4108
- (0, import_react19.useEffect)(() => {
4114
+ const getData = async () => {
4109
4115
  if (url) {
4110
- get({ url, v, params, delay });
4116
+ console.log("url", delay);
4117
+ await get({ url, v, params, delay });
4111
4118
  }
4119
+ };
4120
+ (0, import_react19.useEffect)(() => {
4121
+ getData();
4112
4122
  }, [url, v, JSON.stringify(params), delay]);
4113
4123
  const A4DataViewComponent = ({
4114
4124
  columns = [
@@ -4132,13 +4142,18 @@ var useA4StatementView = ({
4132
4142
  rowPadding = "p-3",
4133
4143
  verticalLines = true,
4134
4144
  headers,
4135
- tableTitle = "Recent Transactions"
4145
+ tableTitle = "Recent Transactions",
4146
+ startPage: componentStartPage = startPage,
4147
+ isLoading: externalLoading
4136
4148
  }) => {
4137
4149
  const { store } = useWarqadConfig();
4150
+ const isActuallyLoading = externalLoading ?? isLoading;
4138
4151
  const measureContainerRef = (0, import_react19.useRef)(null);
4139
4152
  const [pages, setPages] = (0, import_react19.useState)([]);
4140
4153
  const [isMeasuring, setIsMeasuring] = (0, import_react19.useState)(true);
4141
4154
  const [globalFilter, setGlobalFilter] = (0, import_react19.useState)("");
4155
+ const [currentPageIndex, setCurrentPageIndex] = (0, import_react19.useState)(0);
4156
+ const [pageSearch, setPageSearch] = (0, import_react19.useState)("");
4142
4157
  const displayColumnsForSearch = columns.filter((col) => !col.hide);
4143
4158
  const filteredDisplayData = data.filter((row) => {
4144
4159
  if (!globalFilter) return true;
@@ -4187,11 +4202,15 @@ var useA4StatementView = ({
4187
4202
  if (filteredDisplayData && filteredDisplayData.length > 0) {
4188
4203
  setIsMeasuring(true);
4189
4204
  setPages((prev) => prev.length === 0 ? [[]] : prev);
4205
+ if (componentStartPage !== -1) {
4206
+ setCurrentPageIndex(Math.max(0, componentStartPage - 1));
4207
+ }
4190
4208
  } else {
4191
4209
  setIsMeasuring(false);
4192
4210
  setPages(
4193
4211
  (prev) => prev.length === 1 && prev[0].length === 0 ? prev : [[]]
4194
4212
  );
4213
+ setCurrentPageIndex(0);
4195
4214
  }
4196
4215
  }, [depsString]);
4197
4216
  (0, import_react19.useEffect)(() => {
@@ -4213,7 +4232,6 @@ var useA4StatementView = ({
4213
4232
  const thHeight = getH(tableHeaderEl);
4214
4233
  const tfHeight = getH(tableFooterEl);
4215
4234
  const finalTotalHeight = getH(finalTotalEl);
4216
- const MAX_CONTENT_HEIGHT = 950;
4217
4235
  let currentChunks = [];
4218
4236
  let currentChunk = [];
4219
4237
  let currentHeight = headerHeight + infoGridHeight + tableTitleHeight + thHeight + tfHeight;
@@ -4221,7 +4239,8 @@ var useA4StatementView = ({
4221
4239
  const rowHeight = getH(row);
4222
4240
  const isLastRow = i === rowEls.length - 1;
4223
4241
  const requiredHeight = isLastRow ? rowHeight + finalTotalHeight : rowHeight;
4224
- if (currentHeight + requiredHeight > MAX_CONTENT_HEIGHT) {
4242
+ const currentPageLimit = currentChunks.length === 0 ? 920 : 980;
4243
+ if (currentHeight + requiredHeight > currentPageLimit) {
4225
4244
  if (currentChunk.length > 0) {
4226
4245
  currentChunks.push([...currentChunk]);
4227
4246
  currentChunk = [];
@@ -4237,7 +4256,15 @@ var useA4StatementView = ({
4237
4256
  const validPages = currentChunks.filter(
4238
4257
  (chunk) => chunk && chunk.length > 0
4239
4258
  );
4240
- setPages(validPages.length > 0 ? validPages : [[]]);
4259
+ const finalPages = validPages.length > 0 ? validPages : [[]];
4260
+ setPages(finalPages);
4261
+ if (componentStartPage === -1) {
4262
+ setCurrentPageIndex(finalPages.length - 1);
4263
+ } else if (componentStartPage > 1) {
4264
+ setCurrentPageIndex(
4265
+ Math.min(componentStartPage - 1, finalPages.length - 1)
4266
+ );
4267
+ }
4241
4268
  setIsMeasuring(false);
4242
4269
  }, 150);
4243
4270
  return () => clearTimeout(timer);
@@ -4263,15 +4290,22 @@ var useA4StatementView = ({
4263
4290
  ]
4264
4291
  }
4265
4292
  );
4266
- const DisplayInfoGridEl = Array.isArray(info) && info.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { id: "a4-info-grid", className: "px-8", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(InfoGrid, { className: "mb-4", items: info, isLoading }) }) : null;
4267
- const emptyState = !isLoading && (error || !data || data.length === 0) ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "flex flex-col relative w-full items-center justify-center py-12 min-h-[300px]", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex flex-col items-center justify-center p-8 bg-gray-50/50 dark:bg-zinc-900/30 rounded-2xl border border-dashed border-gray-300 dark:border-zinc-700 w-full max-w-lg text-center shadow-sm", children: [
4268
- error ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "w-14 h-14 bg-red-100 dark:bg-red-500/10 rounded-full flex items-center justify-center mb-4", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_lucide_react12.AlertCircle, { className: "w-7 h-7 text-red-600 dark:text-red-500" }) }) : /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "w-14 h-14 bg-gray-200 dark:bg-zinc-800 rounded-full flex items-center justify-center mb-4", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_lucide_react12.FileX, { className: "w-7 h-7 text-gray-500 dark:text-gray-400" }) }),
4269
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("h3", { className: "text-lg font-bold text-gray-900 dark:text-white mb-2", children: error ? "Failed to Load Statement" : "No Records Found" }),
4270
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("p", { className: "text-sm text-gray-500 dark:text-gray-400 max-w-xs mb-6 leading-relaxed", children: error ? typeof error === "string" ? error : "An unexpected error occurred while fetching the statement data." : "There are no transactions or records available in this requested statement." }),
4271
- url && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
4293
+ const DisplayInfoGridEl = Array.isArray(info) && info.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { id: "a4-info-grid", className: "px-8", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4294
+ InfoGrid,
4295
+ {
4296
+ className: "mb-4",
4297
+ items: info,
4298
+ isLoading: isActuallyLoading
4299
+ }
4300
+ ) }) : null;
4301
+ const statusOverlay = isActuallyLoading || error || !data || data.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "flex flex-col relative w-full items-center justify-center py-12 min-h-[400px]", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex flex-col items-center justify-center p-8 bg-gray-50/50 dark:bg-zinc-900/30 rounded-2xl border border-dashed border-gray-300 dark:border-zinc-700 w-full max-w-lg text-center shadow-sm", children: [
4302
+ isActuallyLoading ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "mb-4", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ClassicSpin, {}) }) : error ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "w-14 h-14 bg-red-100 dark:bg-red-500/10 rounded-full flex items-center justify-center mb-4", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_lucide_react12.AlertCircle, { className: "w-7 h-7 text-red-600 dark:text-red-500" }) }) : /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "w-14 h-14 bg-gray-200 dark:bg-zinc-800 rounded-full flex items-center justify-center mb-4", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_lucide_react12.FileX, { className: "w-7 h-7 text-gray-500 dark:text-gray-400" }) }),
4303
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("h3", { className: "text-lg font-bold text-gray-900 dark:text-white mb-2", children: isActuallyLoading ? "Loading data..." : error ? "Failed to Load Statement" : "No Records Found" }),
4304
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("p", { className: "text-sm text-gray-500 dark:text-gray-400 max-w-xs mb-6 leading-relaxed", children: isActuallyLoading ? "Please wait while we prepare your statement." : error ? typeof error === "string" ? error : "An unexpected error occurred while fetching the statement data." : "There are no transactions or records available in this requested statement." }),
4305
+ url && !isActuallyLoading && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
4272
4306
  "button",
4273
4307
  {
4274
- onClick: () => get({ url, v, params, delay }),
4308
+ onClick: () => getData(),
4275
4309
  className: "flex items-center gap-2 px-5 py-2 bg-black dark:bg-white text-white dark:text-black font-semibold rounded-lg shadow-md hover:bg-gray-800 dark:hover:bg-gray-100 transition-all active:scale-95 text-sm",
4276
4310
  children: [
4277
4311
  /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_lucide_react12.RefreshCw, { size: 14 }),
@@ -4279,7 +4313,7 @@ var useA4StatementView = ({
4279
4313
  ]
4280
4314
  }
4281
4315
  )
4282
- ] }) }) : void 0;
4316
+ ] }) }) : null;
4283
4317
  return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex flex-col relative w-full items-center", children: [
4284
4318
  isMeasuring && filteredDisplayData.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "absolute top-0 opacity-0 pointer-events-none -left-full", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4285
4319
  "div",
@@ -4315,82 +4349,157 @@ var useA4StatementView = ({
4315
4349
  }
4316
4350
  ) }),
4317
4351
  /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "py-2 px-0 md:px-4 w-full", ref: contentRef, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "flex flex-col gap-8 print:block print:gap-0 w-full items-center", children: pages.map((pageData, pageIndex) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4318
- PageA4,
4352
+ "div",
4319
4353
  {
4320
- className: "w-full",
4321
- pageNumber: pageIndex + 1,
4322
- totalPages: pages.length,
4323
- isLastPage: pageIndex === pages.length - 1,
4324
- children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex flex-col h-full grow w-full", children: [
4325
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("header", { className: "flex justify-between gap-2 items-center px-8 pt-4 print:hidden", children: [
4326
- headers,
4327
- printable && pageIndex === 0 && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "flex items-center justify-end ", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex items-center gap-2", children: [
4328
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
4329
- "button",
4330
- {
4331
- onClick: () => url && get({ url, v, params, delay }),
4332
- disabled: isLoading,
4333
- className: "flex items-center gap-2 px-3 py-1.5 text-gray-600 dark:text-gray-300 hover:text-black dark:hover:text-white hover:bg-gray-100 dark:hover:bg-gray-800 rounded-lg transition-all disabled:opacity-50",
4334
- children: [
4354
+ className: pageIndex === currentPageIndex ? "w-full" : "hidden print:block w-full",
4355
+ children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4356
+ PageA4,
4357
+ {
4358
+ className: "w-full",
4359
+ pageNumber: pageIndex + 1,
4360
+ totalPages: pages.length,
4361
+ isLastPage: pageIndex === pages.length - 1,
4362
+ children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex flex-col h-full grow w-full", children: [
4363
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("header", { className: "flex justify-between gap-2 items-center px-8 pt-4 print:hidden", children: [
4364
+ headers,
4365
+ printable && pageIndex === currentPageIndex && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "flex items-center justify-end ", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex items-center gap-2", children: [
4366
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
4367
+ "button",
4368
+ {
4369
+ onClick: async () => await getData(),
4370
+ disabled: isLoading,
4371
+ className: "flex items-center gap-2 px-3 py-1.5 text-gray-600 dark:text-gray-300 hover:text-black dark:hover:text-white hover:bg-gray-100 dark:hover:bg-gray-800 rounded-lg transition-all disabled:opacity-50",
4372
+ children: [
4373
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4374
+ import_lucide_react12.RefreshCw,
4375
+ {
4376
+ size: 16,
4377
+ className: isLoading ? "animate-spin" : ""
4378
+ }
4379
+ ),
4380
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "text-xs font-semibold", children: "Reload" })
4381
+ ]
4382
+ }
4383
+ ),
4384
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
4385
+ "button",
4386
+ {
4387
+ onClick: () => reactToPrintFn(),
4388
+ className: "flex items-center gap-2 px-4 py-1.5 bg-black dark:bg-zinc-800 text-white rounded-md text-xs font-bold shadow-sm hover:bg-zinc-800 dark:hover:bg-zinc-700 transition-all active:scale-95",
4389
+ children: [
4390
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_lucide_react12.Printer, { size: 16 }),
4391
+ "Print"
4392
+ ]
4393
+ }
4394
+ ),
4395
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex items-center gap-1.5 ml-2 pl-2 border-l border-gray-200 dark:border-zinc-700", children: [
4335
4396
  /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4336
- import_lucide_react12.RefreshCw,
4397
+ "button",
4337
4398
  {
4338
- size: 16,
4339
- className: isLoading ? "animate-spin" : ""
4399
+ onClick: (e) => {
4400
+ e.stopPropagation();
4401
+ setCurrentPageIndex(
4402
+ (p) => Math.max(0, p - 1)
4403
+ );
4404
+ },
4405
+ disabled: currentPageIndex === 0,
4406
+ className: "p-1 rounded hover:bg-gray-100 dark:hover:bg-zinc-800 disabled:opacity-30 transition-colors text-gray-600 dark:text-gray-400",
4407
+ children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_lucide_react12.ChevronLeft, { size: 18 })
4340
4408
  }
4341
4409
  ),
4342
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "text-xs font-semibold", children: "Reload" })
4343
- ]
4344
- }
4345
- ),
4346
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
4347
- "button",
4348
- {
4349
- onClick: () => reactToPrintFn(),
4350
- className: "flex items-center gap-2 px-4 py-1.5 bg-black dark:bg-zinc-800 text-white rounded-md text-xs font-bold shadow-sm hover:bg-zinc-800 dark:hover:bg-zinc-700 transition-all active:scale-95",
4351
- children: [
4352
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_lucide_react12.Printer, { size: 16 }),
4353
- "Print"
4354
- ]
4355
- }
4356
- )
4357
- ] }) })
4358
- ] }),
4359
- pageIndex === 0 && HeaderEl,
4360
- pageIndex === 0 && DisplayInfoGridEl,
4361
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "grow w-full px-8 pb-8", children: [
4362
- pageIndex === 0 && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "mb-4 border-b border-gray-200 dark:border-zinc-800 print:border-gray-200 pb-2 flex items-center gap-2 justify-between px-2 mt-2 print:hidden", children: [
4363
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("h3", { className: "text-sm font-bold text-gray-800 dark:text-gray-100 print:text-gray-800 uppercase tracking-wide shrink-0", children: tableTitle }),
4364
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4365
- "input",
4366
- {
4367
- type: "text",
4368
- value: globalFilter,
4369
- onChange: (e) => setGlobalFilter(e.target.value),
4370
- placeholder: "Search...",
4371
- className: "block w-full max-w-xs px-3 py-2 border border-gray-300 rounded-md text-sm shadow-sm focus:outline-none focus:ring-1 focus:ring-blue-500 focus:border-blue-500 dark:bg-zinc-900 dark:border-zinc-700 dark:text-white"
4372
- }
4373
- )
4374
- ] }),
4375
- pageIndex === 0 && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "hidden print:flex mb-4 border-b border-gray-200 print:border-gray-200 pb-2 items-center gap-2 justify-between px-2 mt-2", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("h3", { className: "text-sm font-bold text-gray-800 print:text-gray-800 uppercase tracking-wide shrink-0", children: tableTitle }) }),
4376
- pageIndex > 0 && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "h-5 print:h-0" }),
4377
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4378
- SimpleTable,
4379
- {
4380
- columns,
4381
- data: pageData,
4382
- className: "bg-transparent!",
4383
- rowPadding,
4384
- index,
4385
- startIndex: pages.slice(0, pageIndex).reduce((acc, curr) => acc + curr.length, 0),
4386
- verticalLines,
4387
- emptyState,
4388
- isLoading: isLoading || isMeasuring && pages.length === 1 && pages[0].length === 0
4389
- }
4390
- ),
4391
- pageIndex === pages.length - 1 && !isLoading && DisplayFinalTotalEl
4392
- ] })
4393
- ] })
4410
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex items-center gap-1 text-[11px] font-bold tabular-nums", children: [
4411
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
4412
+ Select,
4413
+ {
4414
+ value: currentPageIndex + 1,
4415
+ onChange: (val) => {
4416
+ const num = Number(val);
4417
+ if (!isNaN(num)) {
4418
+ setCurrentPageIndex(num - 1);
4419
+ }
4420
+ },
4421
+ variant: "ghost",
4422
+ containerClassName: "inline-block",
4423
+ children: [
4424
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(SelectTrigger, { className: "h-7 px-2 min-w-[40px] border border-gray-200 dark:border-zinc-700 rounded flex items-center justify-center bg-white dark:bg-zinc-900 hover:bg-gray-100 dark:hover:bg-zinc-800 transition-colors", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "text-gray-900 dark:text-white", children: currentPageIndex + 1 }) }),
4425
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(SelectContent, { className: "min-w-[100px] max-h-64 overflow-y-auto p-0", children: [
4426
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "p-2 border-b border-gray-100 dark:border-zinc-800 sticky top-0 bg-white dark:bg-zinc-950 z-10", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4427
+ "input",
4428
+ {
4429
+ type: "text",
4430
+ placeholder: "Page...",
4431
+ className: "w-full px-2 py-1 text-[11px] border rounded bg-gray-50 dark:bg-zinc-900 border-gray-200 dark:border-zinc-800 outline-none focus:ring-1 focus:ring-blue-500 text-gray-900 dark:text-white",
4432
+ value: pageSearch,
4433
+ onChange: (e) => setPageSearch(e.target.value),
4434
+ onKeyDown: (e) => e.stopPropagation(),
4435
+ autoFocus: true
4436
+ }
4437
+ ) }),
4438
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "p-1", children: pages.map((_, i) => i + 1).filter(
4439
+ (p) => String(p).includes(pageSearch)
4440
+ ).map((p) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(SelectItem, { value: p, children: p }, p)) })
4441
+ ] })
4442
+ ]
4443
+ }
4444
+ ),
4445
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "text-gray-400 mx-0.5", children: "/" }),
4446
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "text-gray-600 dark:text-gray-400", children: pages.length })
4447
+ ] }),
4448
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4449
+ "button",
4450
+ {
4451
+ onClick: (e) => {
4452
+ e.stopPropagation();
4453
+ setCurrentPageIndex(
4454
+ (p) => Math.min(pages.length - 1, p + 1)
4455
+ );
4456
+ },
4457
+ disabled: currentPageIndex === pages.length - 1,
4458
+ className: "p-1 rounded hover:bg-gray-100 dark:hover:bg-zinc-800 disabled:opacity-30 transition-colors text-gray-600 dark:text-gray-400",
4459
+ children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_lucide_react12.ChevronRight, { size: 18 })
4460
+ }
4461
+ )
4462
+ ] })
4463
+ ] }) })
4464
+ ] }),
4465
+ pageIndex === 0 && HeaderEl,
4466
+ pageIndex === 0 && DisplayInfoGridEl,
4467
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "grow w-full px-8 pb-8", children: [
4468
+ pageIndex === 0 && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "mb-4 border-b border-gray-200 dark:border-zinc-700 print:border-gray-200 pb-2 flex items-center gap-2 justify-between px-2 mt-2 print:hidden", children: [
4469
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("h3", { className: "text-sm font-bold text-gray-800 dark:text-gray-100 print:text-gray-800 uppercase tracking-wide shrink-0", children: tableTitle }),
4470
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4471
+ "input",
4472
+ {
4473
+ type: "text",
4474
+ value: globalFilter,
4475
+ onChange: (e) => setGlobalFilter(e.target.value),
4476
+ placeholder: "Search...",
4477
+ className: "block w-full max-w-xs px-3 py-2 border border-gray-300 rounded-md text-sm shadow-sm focus:outline-none focus:ring-1 focus:ring-blue-500 focus:border-blue-500 dark:bg-zinc-900 dark:border-zinc-700 dark:text-white"
4478
+ }
4479
+ )
4480
+ ] }),
4481
+ pageIndex === 0 && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "hidden print:flex mb-4 border-b border-gray-200 print:border-gray-200 pb-2 items-center gap-2 justify-between px-2 mt-2", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("h3", { className: "text-sm font-bold text-gray-800 print:text-gray-800 uppercase tracking-wide shrink-0", children: tableTitle }) }),
4482
+ pageIndex > 0 && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "h-7 print:h-0" }),
4483
+ statusOverlay ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "px-8 pb-8", children: statusOverlay }) : /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4484
+ SimpleTable,
4485
+ {
4486
+ columns,
4487
+ data: pageData,
4488
+ className: "bg-transparent!",
4489
+ rowPadding,
4490
+ index,
4491
+ startIndex: pages.slice(0, pageIndex).reduce((acc, curr) => acc + curr.length, 0),
4492
+ verticalLines,
4493
+ emptyState: null,
4494
+ isLoading: isActuallyLoading || isMeasuring && pages.length === 1 && pages[0].length === 0
4495
+ }
4496
+ ),
4497
+ pageIndex === pages.length - 1 && !isActuallyLoading && !statusOverlay && DisplayFinalTotalEl
4498
+ ] })
4499
+ ] })
4500
+ },
4501
+ pageIndex
4502
+ )
4394
4503
  },
4395
4504
  pageIndex
4396
4505
  )) }) })
@@ -4404,11 +4513,6 @@ var useA4StatementView = ({
4404
4513
  reactToPrintFn
4405
4514
  };
4406
4515
  };
4407
- var A4DataView = (props) => {
4408
- const { url, v, delay, params, ...rest } = props;
4409
- const { A4DataView: View } = useA4StatementView({ url, v, delay, params });
4410
- return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(View, { ...rest });
4411
- };
4412
4516
  var useA4DataView_default = useA4StatementView;
4413
4517
 
4414
4518
  // src/hooks/Fetches/useTransaction.tsx
@@ -4429,12 +4533,13 @@ var useTransaction = ({
4429
4533
  if (date) dateObj.date = date;
4430
4534
  const { data: apiData, isLoading, get, error: apiError } = useApis_default();
4431
4535
  const getData = () => {
4536
+ console.log(dateObj);
4432
4537
  get({
4433
4538
  url,
4434
4539
  v,
4435
4540
  params: {
4436
- ...dateObj,
4437
- ...params
4541
+ ...params,
4542
+ ...dateObj
4438
4543
  },
4439
4544
  delay
4440
4545
  });
@@ -4477,7 +4582,7 @@ var useTransaction = ({
4477
4582
  url && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
4478
4583
  "button",
4479
4584
  {
4480
- onClick: () => get({ url, v, params, delay }),
4585
+ onClick: () => getData(),
4481
4586
  className: "flex items-center gap-2 px-5 py-2 bg-black dark:bg-white text-white dark:text-black font-semibold rounded-lg shadow-md hover:bg-gray-800 dark:hover:bg-gray-100 transition-all active:scale-95 text-sm",
4482
4587
  children: [
4483
4588
  /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_lucide_react13.RefreshCw, { size: 14 }),
@@ -4735,7 +4840,6 @@ var storage = {
4735
4840
  };
4736
4841
  // Annotate the CommonJS export names for ESM import in node:
4737
4842
  0 && (module.exports = {
4738
- A4DataView,
4739
4843
  Badge,
4740
4844
  Branding,
4741
4845
  Button,