warqadui 0.0.41 → 0.0.43

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.mjs CHANGED
@@ -3882,7 +3882,8 @@ function SimpleTable({
3882
3882
  isLoading = false,
3883
3883
  title,
3884
3884
  enableSearch = false,
3885
- emptyState
3885
+ emptyState,
3886
+ skeletonCount = 5
3886
3887
  }) {
3887
3888
  const columns = useMemo5(() => {
3888
3889
  const cols = userColumns.filter((col) => !col.hide).map((col) => ({
@@ -3898,9 +3899,9 @@ function SimpleTable({
3898
3899
  cols.unshift({
3899
3900
  header: "#",
3900
3901
  id: "index",
3901
- width: 45,
3902
- className: "whitespace-nowrap pr-2",
3903
- cell: (info) => info.row.index + 1 + startIndex
3902
+ width: 75,
3903
+ className: "whitespace-nowrap px-2 text-center",
3904
+ cell: (info) => /* @__PURE__ */ jsx25("span", { className: "tabular-nums", children: info.row.index + 1 + startIndex })
3904
3905
  });
3905
3906
  }
3906
3907
  return cols;
@@ -3946,7 +3947,7 @@ function SimpleTable({
3946
3947
  },
3947
3948
  headerGroup.id
3948
3949
  )) }),
3949
- /* @__PURE__ */ jsx25("tbody", { className: "text-black dark:text-white font-semibold font-sans tabular-nums", children: isLoading ? Array.from({ length: 5 }).map((_, i) => /* @__PURE__ */ jsx25(
3950
+ /* @__PURE__ */ jsx25("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__ */ jsx25(
3950
3951
  "tr",
3951
3952
  {
3952
3953
  className: `border-b ${verticalLines ? "border-black dark:border-white" : "border-gray-100 dark:border-zinc-800/60 last:border-0"}`,
@@ -3954,13 +3955,18 @@ function SimpleTable({
3954
3955
  "td",
3955
3956
  {
3956
3957
  className: `text-sm ${rowPadding} align-top ${verticalLines ? "border-x border-black dark:border-white" : ""}`,
3957
- children: /* @__PURE__ */ jsx25("div", { className: "h-4 bg-gray-200 dark:bg-zinc-800 rounded-sm animate-pulse w-full" })
3958
+ children: /* @__PURE__ */ jsx25(
3959
+ "div",
3960
+ {
3961
+ 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" : ""}`
3962
+ }
3963
+ )
3958
3964
  },
3959
3965
  `skeleton-col-${colIdx}`
3960
3966
  ))
3961
3967
  },
3962
3968
  `skeleton-row-${i}`
3963
- )) : data.length === 0 ? /* @__PURE__ */ jsx25("tr", { children: /* @__PURE__ */ jsx25(
3969
+ )) : data.length === 0 && !isLoading ? /* @__PURE__ */ jsx25("tr", { children: /* @__PURE__ */ jsx25(
3964
3970
  "td",
3965
3971
  {
3966
3972
  colSpan: columns.length,
@@ -4067,23 +4073,35 @@ var Branding = ({
4067
4073
  // src/hooks/Fetches/useA4DataView.tsx
4068
4074
  import { useEffect as useEffect11, useRef as useRef6, useState as useState16 } from "react";
4069
4075
  import { useReactToPrint } from "react-to-print";
4070
- import { RefreshCw, Printer, AlertCircle, FileX } from "lucide-react";
4076
+ import {
4077
+ RefreshCw,
4078
+ Printer,
4079
+ AlertCircle,
4080
+ FileX,
4081
+ ChevronLeft,
4082
+ ChevronRight as ChevronRight2
4083
+ } from "lucide-react";
4071
4084
  import { jsx as jsx28, jsxs as jsxs20 } from "react/jsx-runtime";
4072
4085
  var useA4StatementView = ({
4073
4086
  url,
4074
4087
  v = 1,
4075
4088
  delay,
4076
- params
4089
+ params,
4090
+ startPage = 1
4077
4091
  } = {}) => {
4078
4092
  const { data: apiData, isLoading, get, error: apiError } = useApis_default();
4079
4093
  const contentRef = useRef6(null);
4080
4094
  const reactToPrintFn = useReactToPrint({
4081
4095
  contentRef
4082
4096
  });
4083
- useEffect11(() => {
4097
+ const getData = async () => {
4084
4098
  if (url) {
4085
- get({ url, v, params, delay });
4099
+ console.log("url", delay);
4100
+ await get({ url, v, params, delay });
4086
4101
  }
4102
+ };
4103
+ useEffect11(() => {
4104
+ getData();
4087
4105
  }, [url, v, JSON.stringify(params), delay]);
4088
4106
  const A4DataViewComponent = ({
4089
4107
  columns = [
@@ -4107,13 +4125,18 @@ var useA4StatementView = ({
4107
4125
  rowPadding = "p-3",
4108
4126
  verticalLines = true,
4109
4127
  headers,
4110
- tableTitle = "Recent Transactions"
4128
+ tableTitle = "Recent Transactions",
4129
+ startPage: componentStartPage = startPage,
4130
+ isLoading: externalLoading
4111
4131
  }) => {
4112
4132
  const { store } = useWarqadConfig();
4133
+ const isActuallyLoading = externalLoading ?? isLoading;
4113
4134
  const measureContainerRef = useRef6(null);
4114
4135
  const [pages, setPages] = useState16([]);
4115
4136
  const [isMeasuring, setIsMeasuring] = useState16(true);
4116
4137
  const [globalFilter, setGlobalFilter] = useState16("");
4138
+ const [currentPageIndex, setCurrentPageIndex] = useState16(0);
4139
+ const [pageSearch, setPageSearch] = useState16("");
4117
4140
  const displayColumnsForSearch = columns.filter((col) => !col.hide);
4118
4141
  const filteredDisplayData = data.filter((row) => {
4119
4142
  if (!globalFilter) return true;
@@ -4162,11 +4185,15 @@ var useA4StatementView = ({
4162
4185
  if (filteredDisplayData && filteredDisplayData.length > 0) {
4163
4186
  setIsMeasuring(true);
4164
4187
  setPages((prev) => prev.length === 0 ? [[]] : prev);
4188
+ if (componentStartPage !== -1) {
4189
+ setCurrentPageIndex(Math.max(0, componentStartPage - 1));
4190
+ }
4165
4191
  } else {
4166
4192
  setIsMeasuring(false);
4167
4193
  setPages(
4168
4194
  (prev) => prev.length === 1 && prev[0].length === 0 ? prev : [[]]
4169
4195
  );
4196
+ setCurrentPageIndex(0);
4170
4197
  }
4171
4198
  }, [depsString]);
4172
4199
  useEffect11(() => {
@@ -4188,7 +4215,6 @@ var useA4StatementView = ({
4188
4215
  const thHeight = getH(tableHeaderEl);
4189
4216
  const tfHeight = getH(tableFooterEl);
4190
4217
  const finalTotalHeight = getH(finalTotalEl);
4191
- const MAX_CONTENT_HEIGHT = 950;
4192
4218
  let currentChunks = [];
4193
4219
  let currentChunk = [];
4194
4220
  let currentHeight = headerHeight + infoGridHeight + tableTitleHeight + thHeight + tfHeight;
@@ -4196,7 +4222,8 @@ var useA4StatementView = ({
4196
4222
  const rowHeight = getH(row);
4197
4223
  const isLastRow = i === rowEls.length - 1;
4198
4224
  const requiredHeight = isLastRow ? rowHeight + finalTotalHeight : rowHeight;
4199
- if (currentHeight + requiredHeight > MAX_CONTENT_HEIGHT) {
4225
+ const currentPageLimit = currentChunks.length === 0 ? 920 : 980;
4226
+ if (currentHeight + requiredHeight > currentPageLimit) {
4200
4227
  if (currentChunk.length > 0) {
4201
4228
  currentChunks.push([...currentChunk]);
4202
4229
  currentChunk = [];
@@ -4212,7 +4239,15 @@ var useA4StatementView = ({
4212
4239
  const validPages = currentChunks.filter(
4213
4240
  (chunk) => chunk && chunk.length > 0
4214
4241
  );
4215
- setPages(validPages.length > 0 ? validPages : [[]]);
4242
+ const finalPages = validPages.length > 0 ? validPages : [[]];
4243
+ setPages(finalPages);
4244
+ if (componentStartPage === -1) {
4245
+ setCurrentPageIndex(finalPages.length - 1);
4246
+ } else if (componentStartPage > 1) {
4247
+ setCurrentPageIndex(
4248
+ Math.min(componentStartPage - 1, finalPages.length - 1)
4249
+ );
4250
+ }
4216
4251
  setIsMeasuring(false);
4217
4252
  }, 150);
4218
4253
  return () => clearTimeout(timer);
@@ -4238,15 +4273,22 @@ var useA4StatementView = ({
4238
4273
  ]
4239
4274
  }
4240
4275
  );
4241
- const DisplayInfoGridEl = Array.isArray(info) && info.length > 0 ? /* @__PURE__ */ jsx28("div", { id: "a4-info-grid", className: "px-8", children: /* @__PURE__ */ jsx28(InfoGrid, { className: "mb-4", items: info, isLoading }) }) : null;
4242
- const emptyState = !isLoading && (error || !data || data.length === 0) ? /* @__PURE__ */ jsx28("div", { className: "flex flex-col relative w-full items-center justify-center py-12 min-h-[300px]", children: /* @__PURE__ */ jsxs20("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: [
4243
- error ? /* @__PURE__ */ jsx28("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__ */ jsx28(AlertCircle, { className: "w-7 h-7 text-red-600 dark:text-red-500" }) }) : /* @__PURE__ */ jsx28("div", { className: "w-14 h-14 bg-gray-200 dark:bg-zinc-800 rounded-full flex items-center justify-center mb-4", children: /* @__PURE__ */ jsx28(FileX, { className: "w-7 h-7 text-gray-500 dark:text-gray-400" }) }),
4244
- /* @__PURE__ */ jsx28("h3", { className: "text-lg font-bold text-gray-900 dark:text-white mb-2", children: error ? "Failed to Load Statement" : "No Records Found" }),
4245
- /* @__PURE__ */ jsx28("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." }),
4246
- url && /* @__PURE__ */ jsxs20(
4276
+ const DisplayInfoGridEl = Array.isArray(info) && info.length > 0 ? /* @__PURE__ */ jsx28("div", { id: "a4-info-grid", className: "px-8", children: /* @__PURE__ */ jsx28(
4277
+ InfoGrid,
4278
+ {
4279
+ className: "mb-4",
4280
+ items: info,
4281
+ isLoading: isActuallyLoading
4282
+ }
4283
+ ) }) : null;
4284
+ const statusOverlay = isActuallyLoading || error || !data || data.length === 0 ? /* @__PURE__ */ jsx28("div", { className: "flex flex-col relative w-full items-center justify-center py-12 min-h-[400px]", children: /* @__PURE__ */ jsxs20("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: [
4285
+ isActuallyLoading ? /* @__PURE__ */ jsx28("div", { className: "mb-4", children: /* @__PURE__ */ jsx28(ClassicSpin, {}) }) : error ? /* @__PURE__ */ jsx28("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__ */ jsx28(AlertCircle, { className: "w-7 h-7 text-red-600 dark:text-red-500" }) }) : /* @__PURE__ */ jsx28("div", { className: "w-14 h-14 bg-gray-200 dark:bg-zinc-800 rounded-full flex items-center justify-center mb-4", children: /* @__PURE__ */ jsx28(FileX, { className: "w-7 h-7 text-gray-500 dark:text-gray-400" }) }),
4286
+ /* @__PURE__ */ jsx28("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" }),
4287
+ /* @__PURE__ */ jsx28("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." }),
4288
+ url && !isActuallyLoading && /* @__PURE__ */ jsxs20(
4247
4289
  "button",
4248
4290
  {
4249
- onClick: () => get({ url, v, params, delay }),
4291
+ onClick: () => getData(),
4250
4292
  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",
4251
4293
  children: [
4252
4294
  /* @__PURE__ */ jsx28(RefreshCw, { size: 14 }),
@@ -4254,7 +4296,7 @@ var useA4StatementView = ({
4254
4296
  ]
4255
4297
  }
4256
4298
  )
4257
- ] }) }) : void 0;
4299
+ ] }) }) : null;
4258
4300
  return /* @__PURE__ */ jsxs20("div", { className: "flex flex-col relative w-full items-center", children: [
4259
4301
  isMeasuring && filteredDisplayData.length > 0 && /* @__PURE__ */ jsx28("div", { className: "absolute top-0 opacity-0 pointer-events-none -left-full", children: /* @__PURE__ */ jsx28(
4260
4302
  "div",
@@ -4290,82 +4332,157 @@ var useA4StatementView = ({
4290
4332
  }
4291
4333
  ) }),
4292
4334
  /* @__PURE__ */ jsx28("div", { className: "py-2 px-0 md:px-4 w-full", ref: contentRef, children: /* @__PURE__ */ jsx28("div", { className: "flex flex-col gap-8 print:block print:gap-0 w-full items-center", children: pages.map((pageData, pageIndex) => /* @__PURE__ */ jsx28(
4293
- PageA4,
4335
+ "div",
4294
4336
  {
4295
- className: "w-full",
4296
- pageNumber: pageIndex + 1,
4297
- totalPages: pages.length,
4298
- isLastPage: pageIndex === pages.length - 1,
4299
- children: /* @__PURE__ */ jsxs20("div", { className: "flex flex-col h-full grow w-full", children: [
4300
- /* @__PURE__ */ jsxs20("header", { className: "flex justify-between gap-2 items-center px-8 pt-4 print:hidden", children: [
4301
- headers,
4302
- printable && pageIndex === 0 && /* @__PURE__ */ jsx28("div", { className: "flex items-center justify-end ", children: /* @__PURE__ */ jsxs20("div", { className: "flex items-center gap-2", children: [
4303
- /* @__PURE__ */ jsxs20(
4304
- "button",
4305
- {
4306
- onClick: () => url && get({ url, v, params, delay }),
4307
- disabled: isLoading,
4308
- 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",
4309
- children: [
4337
+ className: pageIndex === currentPageIndex ? "w-full" : "hidden print:block w-full",
4338
+ children: /* @__PURE__ */ jsx28(
4339
+ PageA4,
4340
+ {
4341
+ className: "w-full",
4342
+ pageNumber: pageIndex + 1,
4343
+ totalPages: pages.length,
4344
+ isLastPage: pageIndex === pages.length - 1,
4345
+ children: /* @__PURE__ */ jsxs20("div", { className: "flex flex-col h-full grow w-full", children: [
4346
+ /* @__PURE__ */ jsxs20("header", { className: "flex justify-between gap-2 items-center px-8 pt-4 print:hidden", children: [
4347
+ headers,
4348
+ printable && pageIndex === currentPageIndex && /* @__PURE__ */ jsx28("div", { className: "flex items-center justify-end ", children: /* @__PURE__ */ jsxs20("div", { className: "flex items-center gap-2", children: [
4349
+ /* @__PURE__ */ jsxs20(
4350
+ "button",
4351
+ {
4352
+ onClick: async () => await getData(),
4353
+ disabled: isLoading,
4354
+ 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",
4355
+ children: [
4356
+ /* @__PURE__ */ jsx28(
4357
+ RefreshCw,
4358
+ {
4359
+ size: 16,
4360
+ className: isLoading ? "animate-spin" : ""
4361
+ }
4362
+ ),
4363
+ /* @__PURE__ */ jsx28("span", { className: "text-xs font-semibold", children: "Reload" })
4364
+ ]
4365
+ }
4366
+ ),
4367
+ /* @__PURE__ */ jsxs20(
4368
+ "button",
4369
+ {
4370
+ onClick: () => reactToPrintFn(),
4371
+ 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",
4372
+ children: [
4373
+ /* @__PURE__ */ jsx28(Printer, { size: 16 }),
4374
+ "Print"
4375
+ ]
4376
+ }
4377
+ ),
4378
+ /* @__PURE__ */ jsxs20("div", { className: "flex items-center gap-1.5 ml-2 pl-2 border-l border-gray-200 dark:border-zinc-700", children: [
4310
4379
  /* @__PURE__ */ jsx28(
4311
- RefreshCw,
4380
+ "button",
4312
4381
  {
4313
- size: 16,
4314
- className: isLoading ? "animate-spin" : ""
4382
+ onClick: (e) => {
4383
+ e.stopPropagation();
4384
+ setCurrentPageIndex(
4385
+ (p) => Math.max(0, p - 1)
4386
+ );
4387
+ },
4388
+ disabled: currentPageIndex === 0,
4389
+ 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",
4390
+ children: /* @__PURE__ */ jsx28(ChevronLeft, { size: 18 })
4315
4391
  }
4316
4392
  ),
4317
- /* @__PURE__ */ jsx28("span", { className: "text-xs font-semibold", children: "Reload" })
4318
- ]
4319
- }
4320
- ),
4321
- /* @__PURE__ */ jsxs20(
4322
- "button",
4323
- {
4324
- onClick: () => reactToPrintFn(),
4325
- 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",
4326
- children: [
4327
- /* @__PURE__ */ jsx28(Printer, { size: 16 }),
4328
- "Print"
4329
- ]
4330
- }
4331
- )
4332
- ] }) })
4333
- ] }),
4334
- pageIndex === 0 && HeaderEl,
4335
- pageIndex === 0 && DisplayInfoGridEl,
4336
- /* @__PURE__ */ jsxs20("div", { className: "grow w-full px-8 pb-8", children: [
4337
- pageIndex === 0 && /* @__PURE__ */ jsxs20("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: [
4338
- /* @__PURE__ */ jsx28("h3", { className: "text-sm font-bold text-gray-800 dark:text-gray-100 print:text-gray-800 uppercase tracking-wide shrink-0", children: tableTitle }),
4339
- /* @__PURE__ */ jsx28(
4340
- "input",
4341
- {
4342
- type: "text",
4343
- value: globalFilter,
4344
- onChange: (e) => setGlobalFilter(e.target.value),
4345
- placeholder: "Search...",
4346
- 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"
4347
- }
4348
- )
4349
- ] }),
4350
- pageIndex === 0 && /* @__PURE__ */ jsx28("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__ */ jsx28("h3", { className: "text-sm font-bold text-gray-800 print:text-gray-800 uppercase tracking-wide shrink-0", children: tableTitle }) }),
4351
- pageIndex > 0 && /* @__PURE__ */ jsx28("div", { className: "h-5 print:h-0" }),
4352
- /* @__PURE__ */ jsx28(
4353
- SimpleTable,
4354
- {
4355
- columns,
4356
- data: pageData,
4357
- className: "bg-transparent!",
4358
- rowPadding,
4359
- index,
4360
- startIndex: pages.slice(0, pageIndex).reduce((acc, curr) => acc + curr.length, 0),
4361
- verticalLines,
4362
- emptyState,
4363
- isLoading: isLoading || isMeasuring && pages.length === 1 && pages[0].length === 0
4364
- }
4365
- ),
4366
- pageIndex === pages.length - 1 && !isLoading && DisplayFinalTotalEl
4367
- ] })
4368
- ] })
4393
+ /* @__PURE__ */ jsxs20("div", { className: "flex items-center gap-1 text-[11px] font-bold tabular-nums", children: [
4394
+ /* @__PURE__ */ jsxs20(
4395
+ Select,
4396
+ {
4397
+ value: currentPageIndex + 1,
4398
+ onChange: (val) => {
4399
+ const num = Number(val);
4400
+ if (!isNaN(num)) {
4401
+ setCurrentPageIndex(num - 1);
4402
+ }
4403
+ },
4404
+ variant: "ghost",
4405
+ containerClassName: "inline-block",
4406
+ children: [
4407
+ /* @__PURE__ */ jsx28(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__ */ jsx28("span", { className: "text-gray-900 dark:text-white", children: currentPageIndex + 1 }) }),
4408
+ /* @__PURE__ */ jsxs20(SelectContent, { className: "min-w-[100px] max-h-64 overflow-y-auto p-0", children: [
4409
+ /* @__PURE__ */ jsx28("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__ */ jsx28(
4410
+ "input",
4411
+ {
4412
+ type: "text",
4413
+ placeholder: "Page...",
4414
+ 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",
4415
+ value: pageSearch,
4416
+ onChange: (e) => setPageSearch(e.target.value),
4417
+ onKeyDown: (e) => e.stopPropagation(),
4418
+ autoFocus: true
4419
+ }
4420
+ ) }),
4421
+ /* @__PURE__ */ jsx28("div", { className: "p-1", children: pages.map((_, i) => i + 1).filter(
4422
+ (p) => String(p).includes(pageSearch)
4423
+ ).map((p) => /* @__PURE__ */ jsx28(SelectItem, { value: p, children: p }, p)) })
4424
+ ] })
4425
+ ]
4426
+ }
4427
+ ),
4428
+ /* @__PURE__ */ jsx28("span", { className: "text-gray-400 mx-0.5", children: "/" }),
4429
+ /* @__PURE__ */ jsx28("span", { className: "text-gray-600 dark:text-gray-400", children: pages.length })
4430
+ ] }),
4431
+ /* @__PURE__ */ jsx28(
4432
+ "button",
4433
+ {
4434
+ onClick: (e) => {
4435
+ e.stopPropagation();
4436
+ setCurrentPageIndex(
4437
+ (p) => Math.min(pages.length - 1, p + 1)
4438
+ );
4439
+ },
4440
+ disabled: currentPageIndex === pages.length - 1,
4441
+ 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",
4442
+ children: /* @__PURE__ */ jsx28(ChevronRight2, { size: 18 })
4443
+ }
4444
+ )
4445
+ ] })
4446
+ ] }) })
4447
+ ] }),
4448
+ pageIndex === 0 && HeaderEl,
4449
+ pageIndex === 0 && DisplayInfoGridEl,
4450
+ /* @__PURE__ */ jsxs20("div", { className: "grow w-full px-8 pb-8", children: [
4451
+ pageIndex === 0 && /* @__PURE__ */ jsxs20("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: [
4452
+ /* @__PURE__ */ jsx28("h3", { className: "text-sm font-bold text-gray-800 dark:text-gray-100 print:text-gray-800 uppercase tracking-wide shrink-0", children: tableTitle }),
4453
+ /* @__PURE__ */ jsx28(
4454
+ "input",
4455
+ {
4456
+ type: "text",
4457
+ value: globalFilter,
4458
+ onChange: (e) => setGlobalFilter(e.target.value),
4459
+ placeholder: "Search...",
4460
+ 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"
4461
+ }
4462
+ )
4463
+ ] }),
4464
+ pageIndex === 0 && /* @__PURE__ */ jsx28("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__ */ jsx28("h3", { className: "text-sm font-bold text-gray-800 print:text-gray-800 uppercase tracking-wide shrink-0", children: tableTitle }) }),
4465
+ pageIndex > 0 && /* @__PURE__ */ jsx28("div", { className: "h-7 print:h-0" }),
4466
+ statusOverlay ? /* @__PURE__ */ jsx28("div", { className: "px-8 pb-8", children: statusOverlay }) : /* @__PURE__ */ jsx28(
4467
+ SimpleTable,
4468
+ {
4469
+ columns,
4470
+ data: pageData,
4471
+ className: "bg-transparent!",
4472
+ rowPadding,
4473
+ index,
4474
+ startIndex: pages.slice(0, pageIndex).reduce((acc, curr) => acc + curr.length, 0),
4475
+ verticalLines,
4476
+ emptyState: null,
4477
+ isLoading: isActuallyLoading || isMeasuring && pages.length === 1 && pages[0].length === 0
4478
+ }
4479
+ ),
4480
+ pageIndex === pages.length - 1 && !isActuallyLoading && !statusOverlay && DisplayFinalTotalEl
4481
+ ] })
4482
+ ] })
4483
+ },
4484
+ pageIndex
4485
+ )
4369
4486
  },
4370
4487
  pageIndex
4371
4488
  )) }) })
@@ -4379,11 +4496,6 @@ var useA4StatementView = ({
4379
4496
  reactToPrintFn
4380
4497
  };
4381
4498
  };
4382
- var A4DataView = (props) => {
4383
- const { url, v, delay, params, ...rest } = props;
4384
- const { A4DataView: View } = useA4StatementView({ url, v, delay, params });
4385
- return /* @__PURE__ */ jsx28(View, { ...rest });
4386
- };
4387
4499
  var useA4DataView_default = useA4StatementView;
4388
4500
 
4389
4501
  // src/hooks/Fetches/useTransaction.tsx
@@ -4395,21 +4507,23 @@ var useTransaction = ({
4395
4507
  url,
4396
4508
  v = 1,
4397
4509
  delay,
4398
- params = {}
4510
+ params = {},
4511
+ dateFilter = true
4399
4512
  }) => {
4400
4513
  const [date, setDate] = useState17(
4401
4514
  moment().format("DD/MM/YYYY")
4402
4515
  );
4403
4516
  const dateObj = {};
4404
- if (date) dateObj.date = date;
4517
+ if (date && dateFilter) dateObj.date = date;
4405
4518
  const { data: apiData, isLoading, get, error: apiError } = useApis_default();
4406
4519
  const getData = () => {
4520
+ console.log(dateObj);
4407
4521
  get({
4408
4522
  url,
4409
4523
  v,
4410
4524
  params: {
4411
- ...dateObj,
4412
- ...params
4525
+ ...params,
4526
+ ...dateObj
4413
4527
  },
4414
4528
  delay
4415
4529
  });
@@ -4452,7 +4566,7 @@ var useTransaction = ({
4452
4566
  url && /* @__PURE__ */ jsxs21(
4453
4567
  "button",
4454
4568
  {
4455
- onClick: () => get({ url, v, params, delay }),
4569
+ onClick: () => getData(),
4456
4570
  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",
4457
4571
  children: [
4458
4572
  /* @__PURE__ */ jsx29(RefreshCw2, { size: 14 }),
@@ -4470,7 +4584,7 @@ var useTransaction = ({
4470
4584
  /* @__PURE__ */ jsx29(Card.Description, { children: description })
4471
4585
  ] }),
4472
4586
  /* @__PURE__ */ jsxs21("section", { className: "flex gap-2 items-center", children: [
4473
- /* @__PURE__ */ jsx29(
4587
+ dateFilter && /* @__PURE__ */ jsx29(
4474
4588
  Fields_default.DateInput,
4475
4589
  {
4476
4590
  value: date,
@@ -4709,7 +4823,6 @@ var storage = {
4709
4823
  }
4710
4824
  };
4711
4825
  export {
4712
- A4DataView,
4713
4826
  Badge,
4714
4827
  Branding,
4715
4828
  Button,
package/dist/styles.js CHANGED
@@ -511,6 +511,10 @@ select:-webkit-autofill:focus {
511
511
  .z-50 {
512
512
  z-index: 50;
513
513
  }
514
+ .mx-0\\.5 {
515
+ margin-left: 0.125rem;
516
+ margin-right: 0.125rem;
517
+ }
514
518
  .mx-2 {
515
519
  margin-left: 0.5rem;
516
520
  margin-right: 0.5rem;
@@ -588,6 +592,9 @@ select:-webkit-autofill:focus {
588
592
  .block {
589
593
  display: block;
590
594
  }
595
+ .inline-block {
596
+ display: inline-block;
597
+ }
591
598
  .inline {
592
599
  display: inline;
593
600
  }
@@ -654,18 +661,27 @@ select:-webkit-autofill:focus {
654
661
  .max-h-60 {
655
662
  max-height: 15rem;
656
663
  }
664
+ .max-h-64 {
665
+ max-height: 16rem;
666
+ }
657
667
  .min-h-24 {
658
668
  min-height: 6rem;
659
669
  }
660
670
  .min-h-\\[300px\\] {
661
671
  min-height: 300px;
662
672
  }
673
+ .min-h-\\[400px\\] {
674
+ min-height: 400px;
675
+ }
663
676
  .min-h-screen {
664
677
  min-height: 100vh;
665
678
  }
666
679
  .w-1 {
667
680
  width: 0.25rem;
668
681
  }
682
+ .w-1\\/2 {
683
+ width: 50%;
684
+ }
669
685
  .w-10 {
670
686
  width: 2.5rem;
671
687
  }
@@ -717,6 +733,9 @@ select:-webkit-autofill:focus {
717
733
  .min-w-32 {
718
734
  min-width: 8rem;
719
735
  }
736
+ .min-w-\\[100px\\] {
737
+ min-width: 100px;
738
+ }
720
739
  .min-w-\\[40px\\] {
721
740
  min-width: 40px;
722
741
  }
@@ -974,6 +993,9 @@ select:-webkit-autofill:focus {
974
993
  .border-b-2 {
975
994
  border-bottom-width: 2px;
976
995
  }
996
+ .border-l {
997
+ border-left-width: 1px;
998
+ }
977
999
  .border-l-2 {
978
1000
  border-left-width: 2px;
979
1001
  }
@@ -1143,6 +1165,9 @@ select:-webkit-autofill:focus {
1143
1165
  -o-object-fit: cover;
1144
1166
  object-fit: cover;
1145
1167
  }
1168
+ .p-0 {
1169
+ padding: 0px;
1170
+ }
1146
1171
  .p-0\\.5 {
1147
1172
  padding: 0.125rem;
1148
1173
  }
@@ -1262,6 +1287,9 @@ select:-webkit-autofill:focus {
1262
1287
  .pl-10 {
1263
1288
  padding-left: 2.5rem;
1264
1289
  }
1290
+ .pl-2 {
1291
+ padding-left: 0.5rem;
1292
+ }
1265
1293
  .pl-2\\.5 {
1266
1294
  padding-left: 0.625rem;
1267
1295
  }
@@ -1333,6 +1361,9 @@ select:-webkit-autofill:focus {
1333
1361
  font-size: 2.25rem;
1334
1362
  line-height: 2.5rem;
1335
1363
  }
1364
+ .text-\\[11px\\] {
1365
+ font-size: 11px;
1366
+ }
1336
1367
  .text-base {
1337
1368
  font-size: 1rem;
1338
1369
  line-height: 1.5rem;
@@ -1897,6 +1928,9 @@ select:-webkit-autofill:focus {
1897
1928
  .disabled\\:cursor-not-allowed:disabled {
1898
1929
  cursor: not-allowed;
1899
1930
  }
1931
+ .disabled\\:opacity-30:disabled {
1932
+ opacity: 0.3;
1933
+ }
1900
1934
  .disabled\\:opacity-50:disabled {
1901
1935
  opacity: 0.5;
1902
1936
  }
@@ -2018,6 +2052,9 @@ select:-webkit-autofill:focus {
2018
2052
  --tw-bg-opacity: 1;
2019
2053
  background-color: rgb(39 39 42 / var(--tw-bg-opacity, 1));
2020
2054
  }
2055
+ .dark\\:bg-zinc-800\\/50:is(.dark *) {
2056
+ background-color: rgb(39 39 42 / 0.5);
2057
+ }
2021
2058
  .dark\\:bg-zinc-900:is(.dark *) {
2022
2059
  --tw-bg-opacity: 1;
2023
2060
  background-color: rgb(24 24 27 / var(--tw-bg-opacity, 1));