braid-ui 1.0.6 → 1.0.8

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.js CHANGED
@@ -4,7 +4,7 @@ import { cva } from 'class-variance-authority';
4
4
  import { clsx } from 'clsx';
5
5
  import { twMerge } from 'tailwind-merge';
6
6
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
7
- import { ChevronDown, ChevronUp, Check, X, PanelLeft, Edit, Home, Globe, CreditCard, Building, MoreVertical, Minus, TrendingDown, TrendingUp, ChevronRight, Eye, Trash2, Plus, MessageSquare, Upload, FileText, Download, Copy, LayoutDashboard, Bell, Briefcase, FileCheck, Receipt, ArrowLeftRight, Users, Building2, Zap, Shield, AlertCircle, RefreshCw, Landmark, Search, Repeat, Box, Settings, BarChart3, Key, Heart, User, AlertTriangle, XCircle, CheckCircle, Clock, CalendarIcon, ArrowDownRight, ArrowUpRight, Filter, ChevronLeft, Calendar as Calendar$1, CheckCircle2, StickyNote, FileUp, Circle, UserPlus, ChevronsUpDown, FileJson } from 'lucide-react';
7
+ import { ChevronDown, ChevronUp, Check, X, PanelLeft, Edit, Home, Globe, CreditCard, Building, MoreVertical, Minus, TrendingDown, TrendingUp, ChevronRight, Eye, Trash2, Plus, MessageSquare, Upload, FileText, Download, Copy, LayoutDashboard, Bell, Briefcase, FileCheck, Receipt, ArrowLeftRight, Users, Building2, Zap, Shield, AlertCircle, RefreshCw, Landmark, Search, Repeat, Box, Settings, BarChart3, Key, Heart, User, AlertTriangle, XCircle, CheckCircle, Clock, Loader2, ArrowDownRight, ArrowUpRight, Filter, ChevronLeft, CheckCircle2, StickyNote, FileUp, RotateCcw, Send, PlayCircle, Circle, UserPlus, ChevronsUpDown, CalendarIcon, FileJson } from 'lucide-react';
8
8
  import { createPortal } from 'react-dom';
9
9
  import { Slot } from '@radix-ui/react-slot';
10
10
  import * as SelectPrimitive from '@radix-ui/react-select';
@@ -290,6 +290,12 @@ var AlertTimeline = ({ events }) => {
290
290
  if (action.includes("Alert Approved")) return /* @__PURE__ */ jsx(CheckCircle, { className: "h-4 w-4" });
291
291
  if (action.includes("Alert Declined")) return /* @__PURE__ */ jsx(XCircle, { className: "h-4 w-4" });
292
292
  if (action.includes("RFI Status change")) return /* @__PURE__ */ jsx(RefreshCw, { className: "h-4 w-4" });
293
+ if (action.includes("Manual Review")) return /* @__PURE__ */ jsx(Eye, { className: "h-4 w-4" });
294
+ if (action.includes("Returned")) return /* @__PURE__ */ jsx(RotateCcw, { className: "h-4 w-4" });
295
+ if (action.includes("Cancelled")) return /* @__PURE__ */ jsx(XCircle, { className: "h-4 w-4" });
296
+ if (action.includes("Sent")) return /* @__PURE__ */ jsx(Send, { className: "h-4 w-4" });
297
+ if (action.includes("Submitted")) return /* @__PURE__ */ jsx(FileUp, { className: "h-4 w-4" });
298
+ if (action.includes("Initiated")) return /* @__PURE__ */ jsx(PlayCircle, { className: "h-4 w-4" });
293
299
  if (action.includes("Created")) return /* @__PURE__ */ jsx(Circle, { className: "h-4 w-4" });
294
300
  if (action.includes("Assigned")) return /* @__PURE__ */ jsx(UserPlus, { className: "h-4 w-4" });
295
301
  if (action.includes("Updated") || action.includes("Modified")) return /* @__PURE__ */ jsx(Edit, { className: "h-4 w-4" });
@@ -303,6 +309,12 @@ var AlertTimeline = ({ events }) => {
303
309
  if (action?.includes("Alert Approved")) return "text-success";
304
310
  if (action?.includes("Alert Declined")) return "text-destructive";
305
311
  if (action?.includes("RFI Status change")) return "text-warning";
312
+ if (action?.includes("Manual Review")) return "text-warning";
313
+ if (action?.includes("Returned")) return "text-warning";
314
+ if (action?.includes("Cancelled")) return "text-destructive";
315
+ if (action?.includes("Sent")) return "text-success";
316
+ if (action?.includes("Submitted")) return "text-blue-500";
317
+ if (action?.includes("Initiated")) return "text-blue-500";
306
318
  switch (status) {
307
319
  case "Unassigned":
308
320
  return "text-destructive";
@@ -5312,7 +5324,100 @@ var ListPage = React15.forwardRef(
5312
5324
  }
5313
5325
  );
5314
5326
  ListPage.displayName = "ListPage";
5327
+
5328
+ // src/lib/mock-data/statement-data.ts
5329
+ var calculateBalanceChange = (startingBalance, endingBalance) => {
5330
+ const parseCurrency = (str) => {
5331
+ return parseFloat(str.replace(/[$,]/g, ""));
5332
+ };
5333
+ const start = parseCurrency(startingBalance);
5334
+ const end = parseCurrency(endingBalance);
5335
+ const change = end - start;
5336
+ const isPositive = change >= 0;
5337
+ const prefix = isPositive ? "+" : "";
5338
+ return {
5339
+ amount: change,
5340
+ formatted: `${prefix}$${Math.abs(change).toLocaleString("en-US", {
5341
+ minimumFractionDigits: 2,
5342
+ maximumFractionDigits: 2
5343
+ })}`,
5344
+ isPositive
5345
+ };
5346
+ };
5347
+ var mockStatementHeader = {
5348
+ account: "1234567890",
5349
+ productId: "PROD-001",
5350
+ programId: "PROG-001",
5351
+ startDate: "01/01/2024 00:00:00",
5352
+ endDate: "01/31/2024 23:59:59",
5353
+ startingBalance: "$125,450.00",
5354
+ endingBalance: "$158,320.50"
5355
+ };
5356
+ var mockStatementTransactions = [
5357
+ { transactionType: "ACH Credit", direction: "CREDIT", amount: 45e3, count: 12 },
5358
+ { transactionType: "ACH Debit", direction: "DEBIT", amount: 23500, count: 8 },
5359
+ { transactionType: "Wire Transfer In", direction: "CREDIT", amount: 15e3, count: 3 },
5360
+ { transactionType: "Wire Transfer Out", direction: "DEBIT", amount: 8200, count: 2 },
5361
+ { transactionType: "Card Purchase", direction: "DEBIT", amount: 5430.5, count: 45 },
5362
+ { transactionType: "Direct Deposit", direction: "CREDIT", amount: 12500, count: 5 },
5363
+ { transactionType: "ATM Withdrawal", direction: "DEBIT", amount: 3200, count: 16 },
5364
+ { transactionType: "Check Deposit", direction: "CREDIT", amount: 8900, count: 4 },
5365
+ { transactionType: "Bill Payment", direction: "DEBIT", amount: 6780, count: 18 },
5366
+ { transactionType: "Transfer In", direction: "CREDIT", amount: 5200, count: 7 },
5367
+ { transactionType: "Transfer Out", direction: "DEBIT", amount: 4350, count: 6 },
5368
+ { transactionType: "Fee", direction: "DEBIT", amount: 125, count: 3 },
5369
+ { transactionType: "Interest", direction: "CREDIT", amount: 85.5, count: 1 },
5370
+ { transactionType: "Refund", direction: "CREDIT", amount: 450, count: 2 }
5371
+ ];
5372
+ var mockPrograms = [
5373
+ { value: "PROG-001", label: "Consumer Banking Program" },
5374
+ { value: "PROG-002", label: "Business Banking Program" },
5375
+ { value: "PROG-003", label: "Premium Rewards Program" },
5376
+ { value: "PROG-004", label: "Premium Rewards Program 1" },
5377
+ { value: "PROG-005", label: "Premium Rewards Program 2" },
5378
+ { value: "PROG-006", label: "Premium Rewards Program 3" },
5379
+ { value: "PROG-007", label: "Premium Rewards Program 4" },
5380
+ { value: "PROG-008", label: "Premium Rewards Program 5" },
5381
+ { value: "PROG-009", label: "Premium Rewards Program 6" },
5382
+ { value: "PROG-0010", label: "Consumer Banking Program" },
5383
+ { value: "PROG-0011", label: "Business Banking Program" },
5384
+ { value: "PROG-0013", label: "Premium Rewards Program" },
5385
+ { value: "PROG-0041", label: "Premium Rewards Program 1" },
5386
+ { value: "PROG-0051", label: "Premium Rewards Program 2" },
5387
+ { value: "PROG-0061", label: "Premium Rewards Program 3" },
5388
+ { value: "PROG-0071", label: "Premium Rewards Program 4" },
5389
+ { value: "PROG-0081", label: "Premium Rewards Program 5" },
5390
+ { value: "PROG-0091", label: "Premium Rewards Program 6" },
5391
+ { value: "PROG-0014", label: "Consumer Banking Program" },
5392
+ { value: "PROG-0024", label: "Business Banking Program" },
5393
+ { value: "PROG-0034", label: "Premium Rewards Program" },
5394
+ { value: "PROG-0044", label: "Premium Rewards Program 1" },
5395
+ { value: "PROG-0054", label: "Premium Rewards Program 2" },
5396
+ { value: "PROG-0064", label: "Premium Rewards Program 3" },
5397
+ { value: "PROG-0074", label: "Premium Rewards Program 4" },
5398
+ { value: "PROG-0084", label: "Premium Rewards Program 5" },
5399
+ { value: "PROG-0094", label: "Premium Rewards Program 6" },
5400
+ { value: "PROG-00104", label: "Consumer Banking Program" },
5401
+ { value: "PROG-00114", label: "Business Banking Program" },
5402
+ { value: "PROG-00134", label: "Premium Rewards Program" },
5403
+ { value: "PROG-00414", label: "Premium Rewards Program 1" },
5404
+ { value: "PROG-00514", label: "Premium Rewards Program 2" },
5405
+ { value: "PROG-00614", label: "Premium Rewards Program 3" },
5406
+ { value: "PROG-00714", label: "Premium Rewards Program 4" },
5407
+ { value: "PROG-00814", label: "Premium Rewards Program 5" },
5408
+ { value: "PROG-00914", label: "Premium Rewards Program 6" }
5409
+ ];
5410
+ var mockProducts = [
5411
+ { value: "PROD-001", label: "Checking Account" },
5412
+ { value: "PROD-002", label: "Savings Account" },
5413
+ { value: "PROD-003", label: "Money Market Account" },
5414
+ { value: "PROD-004", label: "Business Checking" }
5415
+ ];
5315
5416
  var StatementHeader = ({ data, onEdit }) => {
5417
+ const hasValue = (value) => {
5418
+ return value !== void 0 && value !== null && value.trim() !== "";
5419
+ };
5420
+ const balanceChange = data.startingBalance && data.endingBalance ? calculateBalanceChange(data.startingBalance, data.endingBalance) : null;
5316
5421
  return /* @__PURE__ */ jsxs(Card, { children: [
5317
5422
  /* @__PURE__ */ jsxs(CardHeader, { direction: "row", children: [
5318
5423
  /* @__PURE__ */ jsx(CardTitle, { size: "md", children: "Statement Summary" }),
@@ -5322,7 +5427,7 @@ var StatementHeader = ({ data, onEdit }) => {
5322
5427
  ] })
5323
5428
  ] }),
5324
5429
  /* @__PURE__ */ jsx(CardContent, { children: /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6", children: [
5325
- /* @__PURE__ */ jsx(
5430
+ hasValue(data.account) && /* @__PURE__ */ jsx(
5326
5431
  InfoField,
5327
5432
  {
5328
5433
  label: "Account",
@@ -5330,7 +5435,7 @@ var StatementHeader = ({ data, onEdit }) => {
5330
5435
  layout: "horizontal"
5331
5436
  }
5332
5437
  ),
5333
- /* @__PURE__ */ jsx(
5438
+ hasValue(data.productId) && /* @__PURE__ */ jsx(
5334
5439
  InfoField,
5335
5440
  {
5336
5441
  label: "Product ID",
@@ -5338,7 +5443,7 @@ var StatementHeader = ({ data, onEdit }) => {
5338
5443
  layout: "horizontal"
5339
5444
  }
5340
5445
  ),
5341
- /* @__PURE__ */ jsx(
5446
+ hasValue(data.programId) && /* @__PURE__ */ jsx(
5342
5447
  InfoField,
5343
5448
  {
5344
5449
  label: "Program ID",
@@ -5346,7 +5451,7 @@ var StatementHeader = ({ data, onEdit }) => {
5346
5451
  layout: "horizontal"
5347
5452
  }
5348
5453
  ),
5349
- /* @__PURE__ */ jsx(
5454
+ hasValue(data.startDate) && /* @__PURE__ */ jsx(
5350
5455
  InfoField,
5351
5456
  {
5352
5457
  label: "Start Date",
@@ -5354,7 +5459,7 @@ var StatementHeader = ({ data, onEdit }) => {
5354
5459
  layout: "horizontal"
5355
5460
  }
5356
5461
  ),
5357
- /* @__PURE__ */ jsx(
5462
+ hasValue(data.endDate) && /* @__PURE__ */ jsx(
5358
5463
  InfoField,
5359
5464
  {
5360
5465
  label: "End Date",
@@ -5362,7 +5467,7 @@ var StatementHeader = ({ data, onEdit }) => {
5362
5467
  layout: "horizontal"
5363
5468
  }
5364
5469
  ),
5365
- /* @__PURE__ */ jsx(
5470
+ hasValue(data.startingBalance) && /* @__PURE__ */ jsx(
5366
5471
  InfoField,
5367
5472
  {
5368
5473
  label: "Starting Balance",
@@ -5370,13 +5475,21 @@ var StatementHeader = ({ data, onEdit }) => {
5370
5475
  layout: "horizontal"
5371
5476
  }
5372
5477
  ),
5373
- /* @__PURE__ */ jsx(
5478
+ hasValue(data.endingBalance) && /* @__PURE__ */ jsx(
5374
5479
  InfoField,
5375
5480
  {
5376
5481
  label: "Ending Balance",
5377
5482
  value: data.endingBalance,
5378
5483
  layout: "horizontal"
5379
5484
  }
5485
+ ),
5486
+ balanceChange && /* @__PURE__ */ jsx(
5487
+ InfoField,
5488
+ {
5489
+ label: "Balance Change",
5490
+ value: /* @__PURE__ */ jsx("span", { className: balanceChange.isPositive ? "text-green-600 font-medium" : "text-red-600 font-medium", children: balanceChange.formatted }),
5491
+ layout: "horizontal"
5492
+ }
5380
5493
  )
5381
5494
  ] }) })
5382
5495
  ] });
@@ -5437,6 +5550,52 @@ var PopoverContent = React15.forwardRef(({ className, align = "center", sideOffs
5437
5550
  }
5438
5551
  ) }));
5439
5552
  PopoverContent.displayName = PopoverPrimitive.Content.displayName;
5553
+ function DatePicker({
5554
+ date,
5555
+ onDateChange,
5556
+ placeholder = "Pick a date",
5557
+ disabled = false,
5558
+ className,
5559
+ buttonClassName,
5560
+ calendarClassName,
5561
+ align = "start",
5562
+ disabledDates
5563
+ }) {
5564
+ const [open, setOpen] = React15.useState(false);
5565
+ const handleSelect = (selectedDate) => {
5566
+ onDateChange?.(selectedDate);
5567
+ setOpen(false);
5568
+ };
5569
+ return /* @__PURE__ */ jsxs(Popover, { open, onOpenChange: setOpen, children: [
5570
+ /* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
5571
+ Button,
5572
+ {
5573
+ variant: "outline",
5574
+ disabled,
5575
+ className: cn(
5576
+ "justify-start text-left font-normal",
5577
+ !date && "text-muted-foreground",
5578
+ buttonClassName
5579
+ ),
5580
+ children: [
5581
+ /* @__PURE__ */ jsx(CalendarIcon, { className: "mr-2 h-4 w-4" }),
5582
+ date ? format(date, "MM/dd/yyyy") : placeholder
5583
+ ]
5584
+ }
5585
+ ) }),
5586
+ /* @__PURE__ */ jsx(PopoverContent, { className: cn("w-auto p-0", className), align, children: /* @__PURE__ */ jsx(
5587
+ Calendar,
5588
+ {
5589
+ mode: "single",
5590
+ selected: date,
5591
+ onSelect: handleSelect,
5592
+ disabled: disabledDates,
5593
+ initialFocus: true,
5594
+ className: cn("pointer-events-auto", calendarClassName)
5595
+ }
5596
+ ) })
5597
+ ] });
5598
+ }
5440
5599
  function DataTable({
5441
5600
  columns: columns2,
5442
5601
  data,
@@ -5573,6 +5732,10 @@ var StatementView = ({
5573
5732
  products,
5574
5733
  statementHeader,
5575
5734
  statementTransactions,
5735
+ programsLoading,
5736
+ productsLoading,
5737
+ programsError,
5738
+ productsError,
5576
5739
  onStatementTypeChange,
5577
5740
  onProgramChange,
5578
5741
  onProductChange,
@@ -5583,7 +5746,10 @@ var StatementView = ({
5583
5746
  onEdit,
5584
5747
  onDownloadCSV,
5585
5748
  onPrintPDF,
5586
- isGenerateDisabled
5749
+ onRetryFetch,
5750
+ shouldShowRetry,
5751
+ isGenerateDisabled,
5752
+ isLoading
5587
5753
  }) => {
5588
5754
  return /* @__PURE__ */ jsxs("div", { className: "container mx-auto p-6 space-y-6", children: [
5589
5755
  /* @__PURE__ */ jsxs("div", { children: [
@@ -5604,24 +5770,34 @@ var StatementView = ({
5604
5770
  onValueChange: onStatementTypeChange
5605
5771
  }
5606
5772
  ),
5773
+ statementType === "program" && programsError && /* @__PURE__ */ jsx("div", { className: "col-span-full", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 p-3 bg-destructive/10 border border-destructive/20 rounded-md text-sm text-destructive", children: [
5774
+ /* @__PURE__ */ jsx(AlertCircle, { className: "h-4 w-4" }),
5775
+ /* @__PURE__ */ jsx("span", { children: programsError })
5776
+ ] }) }),
5777
+ statementType === "product" && productsError && /* @__PURE__ */ jsx("div", { className: "col-span-full", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 p-3 bg-destructive/10 border border-destructive/20 rounded-md text-sm text-destructive", children: [
5778
+ /* @__PURE__ */ jsx(AlertCircle, { className: "h-4 w-4" }),
5779
+ /* @__PURE__ */ jsx("span", { children: productsError })
5780
+ ] }) }),
5607
5781
  statementType === "program" && /* @__PURE__ */ jsx(
5608
5782
  EnhancedSelect,
5609
5783
  {
5610
5784
  label: "Program Name",
5611
- placeholder: "Select program",
5785
+ placeholder: programsLoading ? "Loading programs..." : "Select program",
5612
5786
  options: programs,
5613
5787
  value: selectedProgram,
5614
- onValueChange: onProgramChange
5788
+ onValueChange: onProgramChange,
5789
+ disabled: programsLoading || !!programsError
5615
5790
  }
5616
5791
  ),
5617
5792
  statementType === "product" && /* @__PURE__ */ jsx(
5618
5793
  EnhancedSelect,
5619
5794
  {
5620
5795
  label: "Product Name",
5621
- placeholder: "Select product",
5796
+ placeholder: productsLoading ? "Loading products..." : "Select product",
5622
5797
  options: products,
5623
5798
  value: selectedProduct,
5624
- onValueChange: onProductChange
5799
+ onValueChange: onProductChange,
5800
+ disabled: productsLoading || !!productsError
5625
5801
  }
5626
5802
  ),
5627
5803
  statementType === "account" && /* @__PURE__ */ jsx(
@@ -5635,67 +5811,52 @@ var StatementView = ({
5635
5811
  ),
5636
5812
  /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
5637
5813
  /* @__PURE__ */ jsx("label", { className: "text-sm font-medium", children: "Start Date" }),
5638
- /* @__PURE__ */ jsxs(Popover, { children: [
5639
- /* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
5640
- Button,
5641
- {
5642
- variant: "outline",
5643
- className: cn(
5644
- "justify-start text-left font-normal",
5645
- !startDate && "text-muted-foreground"
5646
- ),
5647
- children: [
5648
- /* @__PURE__ */ jsx(CalendarIcon, { className: "mr-2 h-4 w-4" }),
5649
- startDate ? format(startDate, "MM/dd/yyyy") : "Select date"
5650
- ]
5651
- }
5652
- ) }),
5653
- /* @__PURE__ */ jsx(PopoverContent, { className: "w-auto p-0", align: "start", children: /* @__PURE__ */ jsx(
5654
- Calendar,
5655
- {
5656
- mode: "single",
5657
- selected: startDate,
5658
- onSelect: onStartDateChange,
5659
- initialFocus: true
5660
- }
5661
- ) })
5662
- ] })
5814
+ /* @__PURE__ */ jsx(
5815
+ DatePicker,
5816
+ {
5817
+ date: startDate,
5818
+ onDateChange: onStartDateChange,
5819
+ placeholder: "Select start date",
5820
+ buttonClassName: "w-full"
5821
+ }
5822
+ )
5663
5823
  ] }),
5664
5824
  /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
5665
5825
  /* @__PURE__ */ jsx("label", { className: "text-sm font-medium", children: "End Date" }),
5666
- /* @__PURE__ */ jsxs(Popover, { children: [
5667
- /* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
5668
- Button,
5669
- {
5670
- variant: "outline",
5671
- className: cn(
5672
- "justify-start text-left font-normal",
5673
- !endDate && "text-muted-foreground"
5674
- ),
5675
- children: [
5676
- /* @__PURE__ */ jsx(CalendarIcon, { className: "mr-2 h-4 w-4" }),
5677
- endDate ? format(endDate, "MM/dd/yyyy") : "Select date"
5678
- ]
5679
- }
5680
- ) }),
5681
- /* @__PURE__ */ jsx(PopoverContent, { className: "w-auto p-0", align: "start", children: /* @__PURE__ */ jsx(
5682
- Calendar,
5683
- {
5684
- mode: "single",
5685
- selected: endDate,
5686
- onSelect: onEndDateChange,
5687
- initialFocus: true
5688
- }
5689
- ) })
5690
- ] })
5826
+ /* @__PURE__ */ jsx(
5827
+ DatePicker,
5828
+ {
5829
+ date: endDate,
5830
+ onDateChange: onEndDateChange,
5831
+ placeholder: "Select end date",
5832
+ buttonClassName: "w-full"
5833
+ }
5834
+ )
5691
5835
  ] })
5692
5836
  ] }),
5693
- /* @__PURE__ */ jsx("div", { className: "flex justify-end", children: /* @__PURE__ */ jsx(
5837
+ /* @__PURE__ */ jsx("div", { className: "flex justify-end", children: shouldShowRetry ? /* @__PURE__ */ jsxs(
5838
+ Button,
5839
+ {
5840
+ onClick: onRetryFetch,
5841
+ variant: "outline",
5842
+ disabled: programsLoading || productsLoading,
5843
+ children: [
5844
+ (programsLoading || productsLoading) && /* @__PURE__ */ jsx(Loader2, { className: "h-4 w-4 animate-spin" }),
5845
+ programsLoading || productsLoading ? "Retrying..." : /* @__PURE__ */ jsxs(Fragment, { children: [
5846
+ /* @__PURE__ */ jsx(RefreshCw, { className: "h-4 w-4" }),
5847
+ "Retry"
5848
+ ] })
5849
+ ]
5850
+ }
5851
+ ) : /* @__PURE__ */ jsxs(
5694
5852
  Button,
5695
5853
  {
5696
5854
  onClick: onGenerateStatement,
5697
- disabled: isGenerateDisabled,
5698
- children: "Generate Statement"
5855
+ disabled: isGenerateDisabled || isLoading,
5856
+ children: [
5857
+ isLoading && /* @__PURE__ */ jsx(Loader2, { className: "h-4 w-4 animate-spin" }),
5858
+ isLoading ? "Generating..." : "Generate Statement"
5859
+ ]
5699
5860
  }
5700
5861
  ) })
5701
5862
  ] })
@@ -7888,61 +8049,29 @@ var Businesses = () => {
7888
8049
  /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
7889
8050
  /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
7890
8051
  /* @__PURE__ */ jsx("label", { className: "text-sm font-medium", children: "Created Date Start" }),
7891
- /* @__PURE__ */ jsxs(Popover, { children: [
7892
- /* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
7893
- Button,
7894
- {
7895
- variant: "outline",
7896
- className: cn(
7897
- "w-full justify-start text-left font-normal",
7898
- !filters.createdDateStart && "text-muted-foreground"
7899
- ),
7900
- children: [
7901
- /* @__PURE__ */ jsx(Calendar$1, { className: "mr-2 h-4 w-4" }),
7902
- filters.createdDateStart ? format(filters.createdDateStart, "MM/dd/yyyy") : /* @__PURE__ */ jsx("span", { children: "MM/DD/YYYY" })
7903
- ]
7904
- }
7905
- ) }),
7906
- /* @__PURE__ */ jsx(PopoverContent, { className: "w-auto p-0 bg-background z-50", align: "start", children: /* @__PURE__ */ jsx(
7907
- Calendar,
7908
- {
7909
- mode: "single",
7910
- selected: filters.createdDateStart,
7911
- onSelect: (date) => handleFilterChange("createdDateStart", date),
7912
- initialFocus: true,
7913
- className: "pointer-events-auto"
7914
- }
7915
- ) })
7916
- ] })
8052
+ /* @__PURE__ */ jsx(
8053
+ DatePicker,
8054
+ {
8055
+ date: filters.createdDateStart,
8056
+ onDateChange: (date) => handleFilterChange("createdDateStart", date),
8057
+ placeholder: "MM/DD/YYYY",
8058
+ buttonClassName: "w-full",
8059
+ className: "bg-background z-50"
8060
+ }
8061
+ )
7917
8062
  ] }),
7918
8063
  /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
7919
8064
  /* @__PURE__ */ jsx("label", { className: "text-sm font-medium", children: "Created Date End" }),
7920
- /* @__PURE__ */ jsxs(Popover, { children: [
7921
- /* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
7922
- Button,
7923
- {
7924
- variant: "outline",
7925
- className: cn(
7926
- "w-full justify-start text-left font-normal",
7927
- !filters.createdDateEnd && "text-muted-foreground"
7928
- ),
7929
- children: [
7930
- /* @__PURE__ */ jsx(Calendar$1, { className: "mr-2 h-4 w-4" }),
7931
- filters.createdDateEnd ? format(filters.createdDateEnd, "MM/dd/yyyy") : /* @__PURE__ */ jsx("span", { children: "MM/DD/YYYY" })
7932
- ]
7933
- }
7934
- ) }),
7935
- /* @__PURE__ */ jsx(PopoverContent, { className: "w-auto p-0 bg-background z-50", align: "start", children: /* @__PURE__ */ jsx(
7936
- Calendar,
7937
- {
7938
- mode: "single",
7939
- selected: filters.createdDateEnd,
7940
- onSelect: (date) => handleFilterChange("createdDateEnd", date),
7941
- initialFocus: true,
7942
- className: "pointer-events-auto"
7943
- }
7944
- ) })
7945
- ] })
8065
+ /* @__PURE__ */ jsx(
8066
+ DatePicker,
8067
+ {
8068
+ date: filters.createdDateEnd,
8069
+ onDateChange: (date) => handleFilterChange("createdDateEnd", date),
8070
+ placeholder: "MM/DD/YYYY",
8071
+ buttonClassName: "w-full",
8072
+ className: "bg-background z-50"
8073
+ }
8074
+ )
7946
8075
  ] })
7947
8076
  ] })
7948
8077
  ] }),
@@ -8537,86 +8666,118 @@ var NotFound = () => {
8537
8666
  ] }) });
8538
8667
  };
8539
8668
  var NotFound_default = NotFound;
8540
-
8541
- // src/lib/mock-data/statement-data.ts
8542
- var mockStatementHeader = {
8543
- account: "1234567890",
8544
- productId: "PROD-001",
8545
- programId: "PROG-001",
8546
- startDate: "01/01/2024 00:00:00",
8547
- endDate: "01/31/2024 23:59:59",
8548
- startingBalance: "$125,450.00",
8549
- endingBalance: "$158,320.50"
8550
- };
8551
- var mockStatementTransactions = [
8552
- { transactionType: "ACH Credit", direction: "CREDIT", amount: 45e3, count: 12 },
8553
- { transactionType: "ACH Debit", direction: "DEBIT", amount: 23500, count: 8 },
8554
- { transactionType: "Wire Transfer In", direction: "CREDIT", amount: 15e3, count: 3 },
8555
- { transactionType: "Wire Transfer Out", direction: "DEBIT", amount: 8200, count: 2 },
8556
- { transactionType: "Card Purchase", direction: "DEBIT", amount: 5430.5, count: 45 },
8557
- { transactionType: "Direct Deposit", direction: "CREDIT", amount: 12500, count: 5 },
8558
- { transactionType: "ATM Withdrawal", direction: "DEBIT", amount: 3200, count: 16 },
8559
- { transactionType: "Check Deposit", direction: "CREDIT", amount: 8900, count: 4 },
8560
- { transactionType: "Bill Payment", direction: "DEBIT", amount: 6780, count: 18 },
8561
- { transactionType: "Transfer In", direction: "CREDIT", amount: 5200, count: 7 },
8562
- { transactionType: "Transfer Out", direction: "DEBIT", amount: 4350, count: 6 },
8563
- { transactionType: "Fee", direction: "DEBIT", amount: 125, count: 3 },
8564
- { transactionType: "Interest", direction: "CREDIT", amount: 85.5, count: 1 },
8565
- { transactionType: "Refund", direction: "CREDIT", amount: 450, count: 2 }
8566
- ];
8567
- var mockPrograms = [
8568
- { value: "PROG-001", label: "Consumer Banking Program" },
8569
- { value: "PROG-002", label: "Business Banking Program" },
8570
- { value: "PROG-003", label: "Premium Rewards Program" }
8571
- ];
8572
- var mockProducts = [
8573
- { value: "PROD-001", label: "Checking Account" },
8574
- { value: "PROD-002", label: "Savings Account" },
8575
- { value: "PROD-003", label: "Money Market Account" },
8576
- { value: "PROD-004", label: "Business Checking" }
8577
- ];
8578
8669
  function Statement() {
8579
- const [statementType, setStatementType] = useState("");
8670
+ const [statementType, setStatementType] = useState("root");
8580
8671
  const [selectedProgram, setSelectedProgram] = useState("");
8581
8672
  const [selectedProduct, setSelectedProduct] = useState("");
8582
8673
  const [accountNumber, setAccountNumber] = useState("");
8583
- const [startDate, setStartDate] = useState();
8584
- const [endDate, setEndDate] = useState();
8674
+ const [startDate, setStartDate] = useState(() => {
8675
+ const now = /* @__PURE__ */ new Date();
8676
+ return new Date(now.getFullYear(), now.getMonth(), 1);
8677
+ });
8678
+ const [endDate, setEndDate] = useState(/* @__PURE__ */ new Date());
8585
8679
  const [statementGenerated, setStatementGenerated] = useState(false);
8586
- const [programs] = useState(mockPrograms);
8587
- const [products] = useState(mockProducts);
8680
+ const [isLoading, setIsLoading] = useState(false);
8681
+ const [programs, setPrograms] = useState([]);
8682
+ const [products, setProducts] = useState([]);
8683
+ const [programsLoading, setProgramsLoading] = useState(false);
8684
+ const [productsLoading, setProductsLoading] = useState(false);
8685
+ const [programsError, setProgramsError] = useState(null);
8686
+ const [productsError, setProductsError] = useState(null);
8588
8687
  const [statementHeader, setStatementHeader] = useState(null);
8589
8688
  const [statementTransactions, setStatementTransactions] = useState([]);
8689
+ const fetchPrograms = async () => {
8690
+ setProgramsLoading(true);
8691
+ setProgramsError(null);
8692
+ try {
8693
+ await new Promise((resolve) => setTimeout(resolve, 1e3));
8694
+ setPrograms(mockPrograms);
8695
+ } catch (error) {
8696
+ const errorMessage = error instanceof Error ? error.message : "Failed to load programs";
8697
+ setProgramsError(errorMessage);
8698
+ setPrograms([]);
8699
+ toast({
8700
+ title: "Error loading programs",
8701
+ description: errorMessage,
8702
+ variant: "destructive"
8703
+ });
8704
+ } finally {
8705
+ setProgramsLoading(false);
8706
+ }
8707
+ };
8708
+ const fetchProducts = async () => {
8709
+ setProductsLoading(true);
8710
+ setProductsError(null);
8711
+ try {
8712
+ await new Promise((resolve) => setTimeout(resolve, 1e3));
8713
+ setProducts(mockProducts);
8714
+ } catch (error) {
8715
+ const errorMessage = error instanceof Error ? error.message : "Failed to load products";
8716
+ setProductsError(errorMessage);
8717
+ setProducts([]);
8718
+ toast({
8719
+ title: "Error loading products",
8720
+ description: errorMessage,
8721
+ variant: "destructive"
8722
+ });
8723
+ } finally {
8724
+ setProductsLoading(false);
8725
+ }
8726
+ };
8727
+ useEffect(() => {
8728
+ fetchPrograms();
8729
+ fetchProducts();
8730
+ }, []);
8590
8731
  const handleStatementTypeChange = (value) => {
8591
8732
  setStatementType(value);
8592
8733
  setSelectedProgram("");
8593
8734
  setSelectedProduct("");
8594
8735
  setAccountNumber("");
8595
8736
  };
8596
- const handleGenerateStatement = () => {
8737
+ const handleGenerateStatement = async () => {
8597
8738
  if (!statementType || !startDate || !endDate) return;
8598
8739
  if (statementType === "program" && !selectedProgram) return;
8599
8740
  if (statementType === "product" && !selectedProduct) return;
8600
8741
  if (statementType === "account" && !accountNumber) return;
8601
- console.log("Generating statement with:", {
8602
- statementType,
8603
- selectedProgram,
8604
- selectedProduct,
8605
- accountNumber,
8606
- startDate,
8607
- endDate
8608
- });
8609
- setStatementHeader(mockStatementHeader);
8610
- setStatementTransactions(mockStatementTransactions);
8611
- setStatementGenerated(true);
8742
+ setIsLoading(true);
8743
+ try {
8744
+ console.log("Generating statement with:", {
8745
+ statementType,
8746
+ selectedProgram,
8747
+ selectedProduct,
8748
+ accountNumber,
8749
+ startDate,
8750
+ endDate
8751
+ });
8752
+ await new Promise((resolve) => setTimeout(resolve, 1e3));
8753
+ setStatementHeader(mockStatementHeader);
8754
+ setStatementTransactions(mockStatementTransactions);
8755
+ setStatementGenerated(true);
8756
+ } finally {
8757
+ setIsLoading(false);
8758
+ }
8612
8759
  };
8613
8760
  const isGenerateDisabled = () => {
8614
8761
  if (!statementType || !startDate || !endDate) return true;
8762
+ if (statementType === "program" && (programsError || programsLoading)) return true;
8763
+ if (statementType === "product" && (productsError || productsLoading)) return true;
8615
8764
  if (statementType === "program" && !selectedProgram) return true;
8616
8765
  if (statementType === "product" && !selectedProduct) return true;
8617
8766
  if (statementType === "account" && !accountNumber) return true;
8618
8767
  return false;
8619
8768
  };
8769
+ const handleRetryFetch = () => {
8770
+ if (statementType === "program" && programsError) {
8771
+ fetchPrograms();
8772
+ } else if (statementType === "product" && productsError) {
8773
+ fetchProducts();
8774
+ }
8775
+ };
8776
+ const shouldShowRetry = () => {
8777
+ if (statementType === "program" && programsError) return true;
8778
+ if (statementType === "product" && productsError) return true;
8779
+ return false;
8780
+ };
8620
8781
  const handleDownloadCSV = () => {
8621
8782
  console.log("Downloading CSV...");
8622
8783
  };
@@ -8640,6 +8801,10 @@ function Statement() {
8640
8801
  products,
8641
8802
  statementHeader,
8642
8803
  statementTransactions,
8804
+ programsLoading,
8805
+ productsLoading,
8806
+ programsError,
8807
+ productsError,
8643
8808
  onStatementTypeChange: handleStatementTypeChange,
8644
8809
  onProgramChange: setSelectedProgram,
8645
8810
  onProductChange: setSelectedProduct,
@@ -8650,7 +8815,10 @@ function Statement() {
8650
8815
  onEdit: handleEdit,
8651
8816
  onDownloadCSV: handleDownloadCSV,
8652
8817
  onPrintPDF: handlePrintPDF,
8653
- isGenerateDisabled: isGenerateDisabled()
8818
+ onRetryFetch: handleRetryFetch,
8819
+ shouldShowRetry: shouldShowRetry(),
8820
+ isGenerateDisabled: isGenerateDisabled(),
8821
+ isLoading
8654
8822
  }
8655
8823
  );
8656
8824
  }
@@ -9208,121 +9376,57 @@ var TransactionHistory = () => {
9208
9376
  /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
9209
9377
  /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
9210
9378
  /* @__PURE__ */ jsx("label", { className: "text-sm font-medium", children: "Creation Date Start" }),
9211
- /* @__PURE__ */ jsxs(Popover, { children: [
9212
- /* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
9213
- Button,
9214
- {
9215
- variant: "outline",
9216
- className: cn(
9217
- "w-full justify-start text-left font-normal",
9218
- !filters.creationDateStart && "text-muted-foreground"
9219
- ),
9220
- children: [
9221
- /* @__PURE__ */ jsx(Calendar$1, { className: "mr-2 h-4 w-4" }),
9222
- filters.creationDateStart ? format(filters.creationDateStart, "MM/dd/yyyy") : /* @__PURE__ */ jsx("span", { children: "MM/DD/YYYY" })
9223
- ]
9224
- }
9225
- ) }),
9226
- /* @__PURE__ */ jsx(PopoverContent, { className: "w-auto p-0 bg-background z-50", align: "start", children: /* @__PURE__ */ jsx(
9227
- Calendar,
9228
- {
9229
- mode: "single",
9230
- selected: filters.creationDateStart,
9231
- onSelect: (date) => handleFilterChange("creationDateStart", date),
9232
- initialFocus: true,
9233
- className: "pointer-events-auto"
9234
- }
9235
- ) })
9236
- ] })
9379
+ /* @__PURE__ */ jsx(
9380
+ DatePicker,
9381
+ {
9382
+ date: filters.creationDateStart,
9383
+ onDateChange: (date) => handleFilterChange("creationDateStart", date),
9384
+ placeholder: "MM/DD/YYYY",
9385
+ buttonClassName: "w-full",
9386
+ className: "bg-background z-50"
9387
+ }
9388
+ )
9237
9389
  ] }),
9238
9390
  /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
9239
9391
  /* @__PURE__ */ jsx("label", { className: "text-sm font-medium", children: "Creation Date End" }),
9240
- /* @__PURE__ */ jsxs(Popover, { children: [
9241
- /* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
9242
- Button,
9243
- {
9244
- variant: "outline",
9245
- className: cn(
9246
- "w-full justify-start text-left font-normal",
9247
- !filters.creationDateEnd && "text-muted-foreground"
9248
- ),
9249
- children: [
9250
- /* @__PURE__ */ jsx(Calendar$1, { className: "mr-2 h-4 w-4" }),
9251
- filters.creationDateEnd ? format(filters.creationDateEnd, "MM/dd/yyyy") : /* @__PURE__ */ jsx("span", { children: "MM/DD/YYYY" })
9252
- ]
9253
- }
9254
- ) }),
9255
- /* @__PURE__ */ jsx(PopoverContent, { className: "w-auto p-0 bg-background z-50", align: "start", children: /* @__PURE__ */ jsx(
9256
- Calendar,
9257
- {
9258
- mode: "single",
9259
- selected: filters.creationDateEnd,
9260
- onSelect: (date) => handleFilterChange("creationDateEnd", date),
9261
- initialFocus: true,
9262
- className: "pointer-events-auto"
9263
- }
9264
- ) })
9265
- ] })
9392
+ /* @__PURE__ */ jsx(
9393
+ DatePicker,
9394
+ {
9395
+ date: filters.creationDateEnd,
9396
+ onDateChange: (date) => handleFilterChange("creationDateEnd", date),
9397
+ placeholder: "MM/DD/YYYY",
9398
+ buttonClassName: "w-full",
9399
+ className: "bg-background z-50"
9400
+ }
9401
+ )
9266
9402
  ] })
9267
9403
  ] }),
9268
9404
  /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
9269
9405
  /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
9270
9406
  /* @__PURE__ */ jsx("label", { className: "text-sm font-medium", children: "Post Date Start" }),
9271
- /* @__PURE__ */ jsxs(Popover, { children: [
9272
- /* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
9273
- Button,
9274
- {
9275
- variant: "outline",
9276
- className: cn(
9277
- "w-full justify-start text-left font-normal",
9278
- !filters.postDateStart && "text-muted-foreground"
9279
- ),
9280
- children: [
9281
- /* @__PURE__ */ jsx(Calendar$1, { className: "mr-2 h-4 w-4" }),
9282
- filters.postDateStart ? format(filters.postDateStart, "MM/dd/yyyy") : /* @__PURE__ */ jsx("span", { children: "MM/DD/YYYY" })
9283
- ]
9284
- }
9285
- ) }),
9286
- /* @__PURE__ */ jsx(PopoverContent, { className: "w-auto p-0 bg-background z-50", align: "start", children: /* @__PURE__ */ jsx(
9287
- Calendar,
9288
- {
9289
- mode: "single",
9290
- selected: filters.postDateStart,
9291
- onSelect: (date) => handleFilterChange("postDateStart", date),
9292
- initialFocus: true,
9293
- className: "pointer-events-auto"
9294
- }
9295
- ) })
9296
- ] })
9407
+ /* @__PURE__ */ jsx(
9408
+ DatePicker,
9409
+ {
9410
+ date: filters.postDateStart,
9411
+ onDateChange: (date) => handleFilterChange("postDateStart", date),
9412
+ placeholder: "MM/DD/YYYY",
9413
+ buttonClassName: "w-full",
9414
+ className: "bg-background z-50"
9415
+ }
9416
+ )
9297
9417
  ] }),
9298
9418
  /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
9299
9419
  /* @__PURE__ */ jsx("label", { className: "text-sm font-medium", children: "Post Date End" }),
9300
- /* @__PURE__ */ jsxs(Popover, { children: [
9301
- /* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
9302
- Button,
9303
- {
9304
- variant: "outline",
9305
- className: cn(
9306
- "w-full justify-start text-left font-normal",
9307
- !filters.postDateEnd && "text-muted-foreground"
9308
- ),
9309
- children: [
9310
- /* @__PURE__ */ jsx(Calendar$1, { className: "mr-2 h-4 w-4" }),
9311
- filters.postDateEnd ? format(filters.postDateEnd, "MM/dd/yyyy") : /* @__PURE__ */ jsx("span", { children: "MM/DD/YYYY" })
9312
- ]
9313
- }
9314
- ) }),
9315
- /* @__PURE__ */ jsx(PopoverContent, { className: "w-auto p-0 bg-background z-50", align: "start", children: /* @__PURE__ */ jsx(
9316
- Calendar,
9317
- {
9318
- mode: "single",
9319
- selected: filters.postDateEnd,
9320
- onSelect: (date) => handleFilterChange("postDateEnd", date),
9321
- initialFocus: true,
9322
- className: "pointer-events-auto"
9323
- }
9324
- ) })
9325
- ] })
9420
+ /* @__PURE__ */ jsx(
9421
+ DatePicker,
9422
+ {
9423
+ date: filters.postDateEnd,
9424
+ onDateChange: (date) => handleFilterChange("postDateEnd", date),
9425
+ placeholder: "MM/DD/YYYY",
9426
+ buttonClassName: "w-full",
9427
+ className: "bg-background z-50"
9428
+ }
9429
+ )
9326
9430
  ] })
9327
9431
  ] })
9328
9432
  ] }),