braid-ui 1.0.50 → 1.0.51

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.cjs CHANGED
@@ -1279,7 +1279,7 @@ var DialogOverlay = React15__namespace.forwardRef(({ className, ...props }, ref)
1279
1279
  }
1280
1280
  ));
1281
1281
  DialogOverlay.displayName = DialogPrimitive__namespace.Overlay.displayName;
1282
- var DialogContent = React15__namespace.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsxs(DialogPortal, { children: [
1282
+ var DialogContent = React15__namespace.forwardRef(({ className, children, hideCloseButton, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsxs(DialogPortal, { children: [
1283
1283
  /* @__PURE__ */ jsxRuntime.jsx(DialogOverlay, {}),
1284
1284
  /* @__PURE__ */ jsxRuntime.jsxs(
1285
1285
  DialogPrimitive__namespace.Content,
@@ -1292,7 +1292,7 @@ var DialogContent = React15__namespace.forwardRef(({ className, children, ...pro
1292
1292
  ...props,
1293
1293
  children: [
1294
1294
  children,
1295
- /* @__PURE__ */ jsxRuntime.jsxs(DialogPrimitive__namespace.Close, { className: "absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground", children: [
1295
+ !hideCloseButton && /* @__PURE__ */ jsxRuntime.jsxs(DialogPrimitive__namespace.Close, { className: "absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground", children: [
1296
1296
  /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { className: "h-4 w-4" }),
1297
1297
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Close" })
1298
1298
  ] })
@@ -3099,7 +3099,7 @@ function AppSidebar() {
3099
3099
  ] });
3100
3100
  }
3101
3101
  var MainLayout = ({ children }) => {
3102
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex min-h-screen w-full", children: /* @__PURE__ */ jsxRuntime.jsx("main", { className: "flex-1", children }) });
3102
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex h-screen w-full overflow-hidden", children: /* @__PURE__ */ jsxRuntime.jsx("main", { className: "flex-1 overflow-hidden", children }) });
3103
3103
  };
3104
3104
  var useEditState = ({ initialEditing = false, onToggleEdit, onSave, onCancel }) => {
3105
3105
  const [localEditing, setLocalEditing] = React15.useState(initialEditing);
@@ -8257,7 +8257,7 @@ var StatementView = ({
8257
8257
  ] });
8258
8258
  };
8259
8259
  var ACHDetailsSection = ({ data }) => {
8260
- const formatCurrency = (value) => {
8260
+ const formatCurrency3 = (value) => {
8261
8261
  return new Intl.NumberFormat("en-US", {
8262
8262
  style: "currency",
8263
8263
  currency: "USD",
@@ -8293,7 +8293,7 @@ var ACHDetailsSection = ({ data }) => {
8293
8293
  layout: "horizontal"
8294
8294
  }
8295
8295
  ),
8296
- /* @__PURE__ */ jsxRuntime.jsx(InfoField, { label: "Amount", value: formatCurrency(data.amount), layout: "horizontal" }),
8296
+ /* @__PURE__ */ jsxRuntime.jsx(InfoField, { label: "Amount", value: formatCurrency3(data.amount), layout: "horizontal" }),
8297
8297
  /* @__PURE__ */ jsxRuntime.jsx(InfoField, { label: "SEC Code", value: data.secCode, layout: "horizontal" }),
8298
8298
  /* @__PURE__ */ jsxRuntime.jsx(InfoField, { label: "Company Entry Description", value: data.companyEntryDescription, layout: "horizontal" }),
8299
8299
  data.companyDiscretionaryData && /* @__PURE__ */ jsxRuntime.jsx(InfoField, { label: "Company Discretionary Data", value: data.companyDiscretionaryData, layout: "horizontal" }),
@@ -8376,6 +8376,37 @@ var WireDetailsSection = ({ data }) => {
8376
8376
  ) })
8377
8377
  ] });
8378
8378
  };
8379
+ var formatCurrency = (value) => {
8380
+ const numValue = typeof value === "string" ? parseFloat(value) : value;
8381
+ if (isNaN(numValue)) return "";
8382
+ return new Intl.NumberFormat("en-US", {
8383
+ style: "currency",
8384
+ currency: "USD",
8385
+ minimumFractionDigits: 2
8386
+ }).format(numValue);
8387
+ };
8388
+ var CurrencyInput = ({ value, onChange, ...props }) => {
8389
+ const [isFocused, setIsFocused] = React15__namespace.useState(false);
8390
+ const displayValue = value ? isFocused ? value : formatCurrency(value) : "";
8391
+ const handleChange = (e) => {
8392
+ const rawValue = e.target.value.replace(/[^0-9.]/g, "");
8393
+ const parts = rawValue.split(".");
8394
+ const sanitized = parts[0] + (parts.length > 1 ? "." + parts[1]?.slice(0, 2) : "");
8395
+ onChange(sanitized);
8396
+ };
8397
+ return /* @__PURE__ */ jsxRuntime.jsx(
8398
+ EnhancedInput,
8399
+ {
8400
+ ...props,
8401
+ value: displayValue,
8402
+ onChange: handleChange,
8403
+ onFocus: () => setIsFocused(true),
8404
+ onBlur: () => setIsFocused(false),
8405
+ inputMode: "decimal",
8406
+ placeholder: props.placeholder || "$0.00"
8407
+ }
8408
+ );
8409
+ };
8379
8410
  var Checkbox = React15__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
8380
8411
  CheckboxPrimitive__namespace.Root,
8381
8412
  {
@@ -8395,6 +8426,15 @@ var Checkbox = React15__namespace.forwardRef(({ className, ...props }, ref) => /
8395
8426
  }
8396
8427
  ));
8397
8428
  Checkbox.displayName = CheckboxPrimitive__namespace.Root.displayName;
8429
+ var formatCurrency2 = (value) => {
8430
+ const numValue = typeof value === "string" ? parseFloat(value) : value;
8431
+ if (isNaN(numValue)) return "-";
8432
+ return new Intl.NumberFormat("en-US", {
8433
+ style: "currency",
8434
+ currency: "USD",
8435
+ minimumFractionDigits: 2
8436
+ }).format(numValue);
8437
+ };
8398
8438
  var TRANSACTION_TYPES = [
8399
8439
  { value: "transfer", label: "Transfer", icon: lucideReact.ArrowLeftRight },
8400
8440
  { value: "adjustment", label: "Adjustment", icon: lucideReact.Settings },
@@ -8434,6 +8474,7 @@ var NewTransactionView = ({
8434
8474
  onCancel,
8435
8475
  onConfirmationClose,
8436
8476
  onConfirmationOpenChange,
8477
+ onNewTransaction,
8437
8478
  onCounterpartySearchChange,
8438
8479
  onCounterpartySelect,
8439
8480
  onCounterpartyDropdownClose,
@@ -8441,7 +8482,8 @@ var NewTransactionView = ({
8441
8482
  receiverAccountData,
8442
8483
  isReceiverAccountLoading,
8443
8484
  onReceiverAccountLookup,
8444
- onEditReceiverAccount
8485
+ onEditReceiverAccount,
8486
+ isReviewReady
8445
8487
  }) => {
8446
8488
  const transactionType = form.watch("transactionType");
8447
8489
  const accountNumber = form.watch("accountNumber");
@@ -8499,7 +8541,7 @@ var NewTransactionView = ({
8499
8541
  ] : [],
8500
8542
  ...isTransfer ? [{ label: "Receiver Account", value: receiverAccountNumber || "-" }] : [],
8501
8543
  ...requiresCounterparty ? [{ label: "Counterparty", value: counterpartyName || "-" }] : [],
8502
- { label: "Amount", value: amount ? `$${amount}` : "-" },
8544
+ { label: "Amount", value: amount ? formatCurrency2(amount) : "-" },
8503
8545
  { label: "Description", value: form.watch("description") || "N/A" }
8504
8546
  ];
8505
8547
  const reviewData = [
@@ -8508,356 +8550,365 @@ var NewTransactionView = ({
8508
8550
  items: reviewItems
8509
8551
  }
8510
8552
  ];
8511
- return /* @__PURE__ */ jsxRuntime.jsx(PageLayout, { title: "New Transaction", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "max-w-4xl mx-auto space-y-6", children: [
8512
- /* @__PURE__ */ jsxRuntime.jsx(FormProvider, { form, children: /* @__PURE__ */ jsxRuntime.jsxs("form", { onSubmit: (e) => e.preventDefault(), children: [
8513
- !accountLookedUp ? /* @__PURE__ */ jsxRuntime.jsx(FormCard, { title: "Account Lookup", variant: "default", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-3 items-start w-full", children: [
8514
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1", children: /* @__PURE__ */ jsxRuntime.jsx(
8515
- FormInput,
8553
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "container mx-auto p-6 space-y-6", children: [
8554
+ /* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsx("h1", { className: "text-3xl font-bold tracking-tight", children: "New Transaction" }) }),
8555
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "max-w-4xl space-y-6", children: [
8556
+ /* @__PURE__ */ jsxRuntime.jsx(FormProvider, { form, children: /* @__PURE__ */ jsxRuntime.jsxs("form", { onSubmit: (e) => e.preventDefault(), children: [
8557
+ !accountLookedUp ? /* @__PURE__ */ jsxRuntime.jsx(FormCard, { title: "Account Lookup", variant: "default", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-3 items-start w-full", children: [
8558
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1", children: /* @__PURE__ */ jsxRuntime.jsx(
8559
+ FormInput,
8560
+ {
8561
+ name: "accountNumber",
8562
+ placeholder: "Enter account number"
8563
+ }
8564
+ ) }),
8565
+ /* @__PURE__ */ jsxRuntime.jsx(
8566
+ Button,
8567
+ {
8568
+ onClick: onAccountLookup,
8569
+ disabled: !accountNumber || isAccountLoading,
8570
+ className: "shrink-0 mt-0 w-48",
8571
+ children: isAccountLoading ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
8572
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "h-4 w-4 mr-2 animate-spin" }),
8573
+ "Looking up..."
8574
+ ] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
8575
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Search, { className: "h-4 w-4 mr-2" }),
8576
+ "Lookup Account"
8577
+ ] })
8578
+ }
8579
+ )
8580
+ ] }) }) : /* @__PURE__ */ jsxRuntime.jsx(
8581
+ FormCard,
8516
8582
  {
8517
- name: "accountNumber",
8518
- placeholder: "Enter account number"
8583
+ title: "Account Information",
8584
+ variant: "subtle",
8585
+ headerActions: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
8586
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CheckCircle2, { className: "h-5 w-5 text-success" }),
8587
+ /* @__PURE__ */ jsxRuntime.jsxs(Button, { variant: "ghost", size: "sm", onClick: onEditAccount, children: [
8588
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Edit, { className: "h-4 w-4 mr-1" }),
8589
+ "Edit"
8590
+ ] })
8591
+ ] }),
8592
+ children: /* @__PURE__ */ jsxRuntime.jsx(DataGrid, { data: accountDataGrid, columns: 2 })
8519
8593
  }
8520
- ) }),
8594
+ ),
8521
8595
  /* @__PURE__ */ jsxRuntime.jsx(
8522
- Button,
8596
+ FormCard,
8523
8597
  {
8524
- onClick: onAccountLookup,
8525
- disabled: !accountNumber || isAccountLoading,
8526
- className: "shrink-0 mt-0 w-48",
8527
- children: isAccountLoading ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
8528
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "h-4 w-4 mr-2 animate-spin" }),
8529
- "Looking up..."
8530
- ] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
8531
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Search, { className: "h-4 w-4 mr-2" }),
8532
- "Lookup Account"
8533
- ] })
8534
- }
8535
- )
8536
- ] }) }) : /* @__PURE__ */ jsxRuntime.jsx(
8537
- FormCard,
8538
- {
8539
- title: "Account Information",
8540
- variant: "subtle",
8541
- headerActions: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
8542
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CheckCircle2, { className: "h-5 w-5 text-success" }),
8543
- /* @__PURE__ */ jsxRuntime.jsxs(Button, { variant: "ghost", size: "sm", onClick: onEditAccount, children: [
8544
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Edit, { className: "h-4 w-4 mr-1" }),
8545
- "Edit"
8546
- ] })
8547
- ] }),
8548
- children: /* @__PURE__ */ jsxRuntime.jsx(DataGrid, { data: accountDataGrid, columns: 2 })
8549
- }
8550
- ),
8551
- /* @__PURE__ */ jsxRuntime.jsx(
8552
- FormCard,
8553
- {
8554
- title: "Transaction Type",
8555
- variant: "default",
8556
- className: cn(!accountLookedUp && "opacity-50 pointer-events-none"),
8557
- children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid grid-cols-2 lg:grid-cols-4 gap-3 lg:gap-4", children: TRANSACTION_TYPES.map((type) => {
8558
- const Icon2 = type.icon;
8559
- const isSelected = transactionType === type.value;
8560
- return /* @__PURE__ */ jsxRuntime.jsxs(
8561
- "button",
8562
- {
8563
- type: "button",
8564
- onClick: () => onTransactionTypeChange(type.value),
8565
- disabled: !accountLookedUp,
8566
- className: cn(
8567
- "flex flex-col items-center justify-center p-4 lg:p-3 rounded-lg border-2 transition-all",
8568
- "hover:border-primary/50 hover:shadow-md",
8569
- isSelected ? "border-primary bg-primary/5 shadow-sm" : "border-border bg-card"
8570
- ),
8571
- children: [
8572
- /* @__PURE__ */ jsxRuntime.jsx(Icon2, { className: cn(
8573
- "h-6 w-6 lg:h-5 lg:w-5 mb-2",
8574
- isSelected ? "text-primary" : "text-muted-foreground"
8575
- ) }),
8576
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: cn(
8577
- "text-sm font-medium",
8578
- isSelected ? "text-primary" : "text-foreground"
8579
- ), children: type.label })
8580
- ]
8581
- },
8582
- type.value
8583
- );
8584
- }) })
8585
- }
8586
- ),
8587
- requiresCounterparty && (!counterpartyLookedUp ? /* @__PURE__ */ jsxRuntime.jsxs(
8588
- FormCard,
8589
- {
8590
- title: "Counterparty Search",
8591
- variant: "default",
8592
- className: cn(!transactionType && "opacity-50 pointer-events-none"),
8593
- children: [
8594
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative", children: [
8595
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative", children: [
8596
- /* @__PURE__ */ jsxRuntime.jsx(
8597
- "input",
8598
- {
8599
- type: "text",
8600
- placeholder: "Start typing to search counterparties...",
8601
- value: counterpartyName,
8602
- onChange: (e) => onCounterpartySearchChange(e.target.value),
8603
- disabled: !transactionType,
8604
- className: cn(
8605
- "flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm",
8606
- "ring-offset-background placeholder:text-muted-foreground",
8607
- "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
8608
- "disabled:cursor-not-allowed disabled:opacity-50",
8609
- isCounterpartySearching && "pr-10"
8610
- )
8611
- }
8612
- ),
8613
- isCounterpartySearching && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute right-3 top-1/2 -translate-y-1/2", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "h-4 w-4 animate-spin text-muted-foreground" }) })
8614
- ] }),
8615
- showCounterpartyDropdown && counterpartySearchResults.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute z-50 w-full mt-1 bg-popover border border-border rounded-md shadow-lg max-h-60 overflow-auto", children: counterpartySearchResults.map((result) => /* @__PURE__ */ jsxRuntime.jsxs(
8598
+ title: "Transaction Type",
8599
+ variant: "default",
8600
+ className: cn(!accountLookedUp && "opacity-50 pointer-events-none"),
8601
+ children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid grid-cols-2 lg:grid-cols-4 gap-3 lg:gap-4", children: TRANSACTION_TYPES.map((type) => {
8602
+ const Icon2 = type.icon;
8603
+ const isSelected = transactionType === type.value;
8604
+ return /* @__PURE__ */ jsxRuntime.jsxs(
8616
8605
  "button",
8617
8606
  {
8618
8607
  type: "button",
8619
- onClick: () => onCounterpartySelect(result),
8620
- className: "w-full px-3 py-2 text-left hover:bg-accent transition-colors",
8608
+ onClick: () => onTransactionTypeChange(type.value),
8609
+ disabled: !accountLookedUp,
8610
+ className: cn(
8611
+ "flex flex-col items-center justify-center p-4 lg:p-3 rounded-lg border-2 transition-all",
8612
+ "hover:border-primary/50 hover:shadow-md",
8613
+ isSelected ? "border-primary bg-primary/5 shadow-sm" : "border-border bg-card"
8614
+ ),
8621
8615
  children: [
8622
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "font-medium text-sm", children: result.name }),
8623
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-xs text-muted-foreground", children: result.id })
8616
+ /* @__PURE__ */ jsxRuntime.jsx(Icon2, { className: cn(
8617
+ "h-6 w-6 lg:h-5 lg:w-5 mb-2",
8618
+ isSelected ? "text-primary" : "text-muted-foreground"
8619
+ ) }),
8620
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: cn(
8621
+ "text-sm font-medium",
8622
+ isSelected ? "text-primary" : "text-foreground"
8623
+ ), children: type.label })
8624
8624
  ]
8625
8625
  },
8626
- result.id
8627
- )) }),
8628
- showCounterpartyDropdown && counterpartySearchResults.length === 0 && !isCounterpartySearching && counterpartyName.length >= 2 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute z-50 w-full mt-1 bg-popover border border-border rounded-md shadow-lg p-3", children: /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-sm text-muted-foreground", children: [
8629
- 'No counterparties found matching "',
8630
- counterpartyName,
8631
- '"'
8632
- ] }) })
8626
+ type.value
8627
+ );
8628
+ }) })
8629
+ }
8630
+ ),
8631
+ requiresCounterparty && (!counterpartyLookedUp ? /* @__PURE__ */ jsxRuntime.jsxs(
8632
+ FormCard,
8633
+ {
8634
+ title: "Counterparty Search",
8635
+ variant: "default",
8636
+ className: cn(!transactionType && "opacity-50 pointer-events-none"),
8637
+ children: [
8638
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative", children: [
8639
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative", children: [
8640
+ /* @__PURE__ */ jsxRuntime.jsx(
8641
+ "input",
8642
+ {
8643
+ type: "text",
8644
+ placeholder: "Start typing to search counterparties...",
8645
+ value: counterpartyName,
8646
+ onChange: (e) => onCounterpartySearchChange(e.target.value),
8647
+ disabled: !transactionType,
8648
+ className: cn(
8649
+ "flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm",
8650
+ "ring-offset-background placeholder:text-muted-foreground",
8651
+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
8652
+ "disabled:cursor-not-allowed disabled:opacity-50",
8653
+ isCounterpartySearching && "pr-10"
8654
+ )
8655
+ }
8656
+ ),
8657
+ isCounterpartySearching && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute right-3 top-1/2 -translate-y-1/2", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "h-4 w-4 animate-spin text-muted-foreground" }) })
8658
+ ] }),
8659
+ showCounterpartyDropdown && counterpartySearchResults.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute z-50 w-full mt-1 bg-popover border border-border rounded-md shadow-lg max-h-60 overflow-auto", children: counterpartySearchResults.map((result) => /* @__PURE__ */ jsxRuntime.jsxs(
8660
+ "button",
8661
+ {
8662
+ type: "button",
8663
+ onClick: () => onCounterpartySelect(result),
8664
+ className: "w-full px-3 py-2 text-left hover:bg-accent transition-colors",
8665
+ children: [
8666
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "font-medium text-sm", children: result.name }),
8667
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-xs text-muted-foreground", children: result.id })
8668
+ ]
8669
+ },
8670
+ result.id
8671
+ )) }),
8672
+ showCounterpartyDropdown && counterpartySearchResults.length === 0 && !isCounterpartySearching && counterpartyName.length >= 2 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute z-50 w-full mt-1 bg-popover border border-border rounded-md shadow-lg p-3", children: /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-sm text-muted-foreground", children: [
8673
+ 'No counterparties found matching "',
8674
+ counterpartyName,
8675
+ '"'
8676
+ ] }) })
8677
+ ] }),
8678
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground mt-2", children: "Type at least 2 characters to search" })
8679
+ ]
8680
+ }
8681
+ ) : /* @__PURE__ */ jsxRuntime.jsx(
8682
+ FormCard,
8683
+ {
8684
+ title: "Counterparty Information",
8685
+ variant: "subtle",
8686
+ headerActions: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
8687
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CheckCircle2, { className: "h-5 w-5 text-success" }),
8688
+ /* @__PURE__ */ jsxRuntime.jsxs(Button, { variant: "ghost", size: "sm", onClick: onEditCounterparty, children: [
8689
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Edit, { className: "h-4 w-4 mr-1" }),
8690
+ "Edit"
8691
+ ] })
8633
8692
  ] }),
8634
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground mt-2", children: "Type at least 2 characters to search" })
8635
- ]
8636
- }
8637
- ) : /* @__PURE__ */ jsxRuntime.jsx(
8638
- FormCard,
8639
- {
8640
- title: "Counterparty Information",
8641
- variant: "subtle",
8642
- headerActions: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
8643
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CheckCircle2, { className: "h-5 w-5 text-success" }),
8644
- /* @__PURE__ */ jsxRuntime.jsxs(Button, { variant: "ghost", size: "sm", onClick: onEditCounterparty, children: [
8645
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Edit, { className: "h-4 w-4 mr-1" }),
8646
- "Edit"
8647
- ] })
8648
- ] }),
8649
- children: /* @__PURE__ */ jsxRuntime.jsx(DataGrid, { data: counterpartyDataGrid, columns: 2 })
8650
- }
8651
- )),
8652
- isTransfer && (!receiverAccountLookedUp ? /* @__PURE__ */ jsxRuntime.jsx(
8653
- FormCard,
8654
- {
8655
- title: "Receiver Account",
8656
- variant: "default",
8657
- className: cn(!transactionType && "opacity-50 pointer-events-none"),
8658
- children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-3 items-start w-full", children: [
8659
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1", children: /* @__PURE__ */ jsxRuntime.jsx(
8660
- FormInput,
8661
- {
8662
- name: "receiverAccountNumber",
8663
- placeholder: "Enter receiver account number",
8664
- disabled: !transactionType
8665
- }
8666
- ) }),
8667
- /* @__PURE__ */ jsxRuntime.jsx(
8668
- Button,
8669
- {
8670
- onClick: onReceiverAccountLookup,
8671
- disabled: !receiverAccountNumber || isReceiverAccountLoading,
8672
- className: "shrink-0 mt-0 w-48",
8673
- children: isReceiverAccountLoading ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
8674
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "h-4 w-4 mr-2 animate-spin" }),
8675
- "Looking up..."
8676
- ] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
8677
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Search, { className: "h-4 w-4 mr-2" }),
8678
- "Lookup Receiver"
8679
- ] })
8680
- }
8681
- )
8682
- ] })
8683
- }
8684
- ) : /* @__PURE__ */ jsxRuntime.jsx(
8685
- FormCard,
8686
- {
8687
- title: "Receiver Account Information",
8688
- variant: "subtle",
8689
- headerActions: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
8690
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CheckCircle2, { className: "h-5 w-5 text-success" }),
8691
- /* @__PURE__ */ jsxRuntime.jsxs(Button, { variant: "ghost", size: "sm", onClick: onEditReceiverAccount, children: [
8692
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Edit, { className: "h-4 w-4 mr-1" }),
8693
- "Edit"
8694
- ] })
8695
- ] }),
8696
- children: /* @__PURE__ */ jsxRuntime.jsx(DataGrid, { data: receiverAccountDataGrid, columns: 2 })
8697
- }
8698
- )),
8699
- /* @__PURE__ */ jsxRuntime.jsx(
8700
- FormCard,
8701
- {
8702
- title: "Transaction Details",
8703
- variant: "default",
8704
- className: cn(
8705
- requiresCounterparty ? !counterpartyLookedUp && "opacity-50 pointer-events-none" : isTransfer ? !receiverAccountLookedUp && "opacity-50 pointer-events-none" : !transactionType && "opacity-50 pointer-events-none"
8706
- ),
8707
- children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-4", children: [
8708
- isAdjustment && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
8709
- /* @__PURE__ */ jsxRuntime.jsx(
8710
- FormSelect,
8693
+ children: /* @__PURE__ */ jsxRuntime.jsx(DataGrid, { data: counterpartyDataGrid, columns: 2 })
8694
+ }
8695
+ )),
8696
+ isTransfer && (!receiverAccountLookedUp ? /* @__PURE__ */ jsxRuntime.jsx(
8697
+ FormCard,
8698
+ {
8699
+ title: "Receiver Account",
8700
+ variant: "default",
8701
+ className: cn(!transactionType && "opacity-50 pointer-events-none"),
8702
+ children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-3 items-start w-full", children: [
8703
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1", children: /* @__PURE__ */ jsxRuntime.jsx(
8704
+ FormInput,
8711
8705
  {
8712
- name: "adjustmentDirection",
8713
- label: "Direction",
8714
- placeholder: "Select direction",
8715
- options: ADJUSTMENT_DIRECTION_OPTIONS,
8706
+ name: "receiverAccountNumber",
8707
+ placeholder: "Enter receiver account number",
8716
8708
  disabled: !transactionType
8717
8709
  }
8718
- ),
8710
+ ) }),
8719
8711
  /* @__PURE__ */ jsxRuntime.jsx(
8720
- FormSelect,
8712
+ Button,
8721
8713
  {
8722
- name: "adjustmentType",
8723
- label: "Adjustment Type",
8724
- placeholder: "Select type",
8725
- options: ADJUSTMENT_TYPE_OPTIONS,
8726
- disabled: !transactionType
8714
+ onClick: onReceiverAccountLookup,
8715
+ disabled: !receiverAccountNumber || isReceiverAccountLoading,
8716
+ className: "shrink-0 mt-0 w-48",
8717
+ children: isReceiverAccountLoading ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
8718
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "h-4 w-4 mr-2 animate-spin" }),
8719
+ "Looking up..."
8720
+ ] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
8721
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Search, { className: "h-4 w-4 mr-2" }),
8722
+ "Lookup Receiver"
8723
+ ] })
8727
8724
  }
8728
8725
  )
8726
+ ] })
8727
+ }
8728
+ ) : /* @__PURE__ */ jsxRuntime.jsx(
8729
+ FormCard,
8730
+ {
8731
+ title: "Receiver Account Information",
8732
+ variant: "subtle",
8733
+ headerActions: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
8734
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CheckCircle2, { className: "h-5 w-5 text-success" }),
8735
+ /* @__PURE__ */ jsxRuntime.jsxs(Button, { variant: "ghost", size: "sm", onClick: onEditReceiverAccount, children: [
8736
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Edit, { className: "h-4 w-4 mr-1" }),
8737
+ "Edit"
8738
+ ] })
8729
8739
  ] }),
8730
- /* @__PURE__ */ jsxRuntime.jsx(
8731
- FormInput,
8732
- {
8733
- name: "amount",
8734
- label: "Amount",
8735
- placeholder: "0.00",
8736
- type: "number",
8737
- disabled: requiresCounterparty ? !counterpartyLookedUp : isTransfer ? !receiverAccountLookedUp : !transactionType
8738
- }
8739
- ),
8740
- /* @__PURE__ */ jsxRuntime.jsx(
8741
- FormInput,
8742
- {
8743
- name: "description",
8744
- label: "Description (Optional)",
8745
- placeholder: "Enter transaction description",
8746
- disabled: requiresCounterparty ? !counterpartyLookedUp : isTransfer ? !receiverAccountLookedUp : !transactionType
8747
- }
8748
- )
8749
- ] })
8750
- }
8751
- ),
8752
- /* @__PURE__ */ jsxRuntime.jsx(FormCard, { title: "Review & Submit", variant: "default", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-6", children: [
8753
- /* @__PURE__ */ jsxRuntime.jsx(DataGrid, { data: reviewData, columns: 2 }),
8754
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "bg-muted/30 rounded-lg p-4 border border-border/50", children: /* @__PURE__ */ jsxRuntime.jsx(
8755
- reactHookForm.Controller,
8740
+ children: /* @__PURE__ */ jsxRuntime.jsx(DataGrid, { data: receiverAccountDataGrid, columns: 2 })
8741
+ }
8742
+ )),
8743
+ /* @__PURE__ */ jsxRuntime.jsx(
8744
+ FormCard,
8756
8745
  {
8757
- name: "certifyInformation",
8758
- control: form.control,
8759
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
8760
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start gap-3", children: [
8746
+ title: "Transaction Details",
8747
+ variant: "default",
8748
+ className: cn(
8749
+ requiresCounterparty ? !counterpartyLookedUp && "opacity-50 pointer-events-none" : isTransfer ? !receiverAccountLookedUp && "opacity-50 pointer-events-none" : !transactionType && "opacity-50 pointer-events-none"
8750
+ ),
8751
+ children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-4", children: [
8752
+ isAdjustment && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
8761
8753
  /* @__PURE__ */ jsxRuntime.jsx(
8762
- Checkbox,
8754
+ FormSelect,
8763
8755
  {
8764
- id: "certifyInformation",
8765
- checked: field.value,
8766
- onCheckedChange: field.onChange
8756
+ name: "adjustmentDirection",
8757
+ label: "Direction",
8758
+ placeholder: "Select direction",
8759
+ options: ADJUSTMENT_DIRECTION_OPTIONS,
8760
+ disabled: !transactionType
8767
8761
  }
8768
8762
  ),
8769
8763
  /* @__PURE__ */ jsxRuntime.jsx(
8770
- "label",
8764
+ FormSelect,
8771
8765
  {
8772
- htmlFor: "certifyInformation",
8773
- className: "text-sm font-medium leading-relaxed cursor-pointer select-none",
8774
- children: "I certify that all information entered is correct and accurate to the best of my knowledge"
8766
+ name: "adjustmentType",
8767
+ label: "Adjustment Type",
8768
+ placeholder: "Select type",
8769
+ options: ADJUSTMENT_TYPE_OPTIONS,
8770
+ disabled: !transactionType
8775
8771
  }
8776
8772
  )
8777
8773
  ] }),
8778
- form.formState.errors.certifyInformation && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-destructive ml-7", children: form.formState.errors.certifyInformation.message })
8774
+ /* @__PURE__ */ jsxRuntime.jsx(
8775
+ reactHookForm.Controller,
8776
+ {
8777
+ name: "amount",
8778
+ control: form.control,
8779
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsx(
8780
+ CurrencyInput,
8781
+ {
8782
+ label: "Amount",
8783
+ value: field.value,
8784
+ onChange: field.onChange,
8785
+ disabled: requiresCounterparty ? !counterpartyLookedUp : isTransfer ? !receiverAccountLookedUp : !transactionType,
8786
+ error: form.formState.errors.amount?.message
8787
+ }
8788
+ )
8789
+ }
8790
+ ),
8791
+ /* @__PURE__ */ jsxRuntime.jsx(
8792
+ FormInput,
8793
+ {
8794
+ name: "description",
8795
+ label: "Description (Optional)",
8796
+ placeholder: "Enter transaction description",
8797
+ disabled: requiresCounterparty ? !counterpartyLookedUp : isTransfer ? !receiverAccountLookedUp : !transactionType
8798
+ }
8799
+ )
8779
8800
  ] })
8780
8801
  }
8781
- ) }),
8782
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-3 justify-end pt-4 border-t border-border", children: [
8783
- /* @__PURE__ */ jsxRuntime.jsx(Button, { type: "button", variant: "outline", onClick: onCancel, className: "w-32", children: "Cancel" }),
8802
+ ),
8803
+ /* @__PURE__ */ jsxRuntime.jsx(FormCard, { title: "Review & Submit", variant: "default", className: cn(!isReviewReady && "opacity-50 pointer-events-none"), children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-6", children: [
8804
+ /* @__PURE__ */ jsxRuntime.jsx(DataGrid, { data: reviewData, columns: 2 }),
8805
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "bg-muted/30 rounded-lg p-4 border border-border/50", children: /* @__PURE__ */ jsxRuntime.jsx(
8806
+ reactHookForm.Controller,
8807
+ {
8808
+ name: "certifyInformation",
8809
+ control: form.control,
8810
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
8811
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start gap-3", children: [
8812
+ /* @__PURE__ */ jsxRuntime.jsx(
8813
+ Checkbox,
8814
+ {
8815
+ id: "certifyInformation",
8816
+ checked: field.value,
8817
+ onCheckedChange: field.onChange
8818
+ }
8819
+ ),
8820
+ /* @__PURE__ */ jsxRuntime.jsx(
8821
+ "label",
8822
+ {
8823
+ htmlFor: "certifyInformation",
8824
+ className: "text-sm font-medium leading-relaxed cursor-pointer select-none",
8825
+ children: "I certify that all information entered is correct and accurate to the best of my knowledge"
8826
+ }
8827
+ )
8828
+ ] }),
8829
+ form.formState.errors.certifyInformation && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-destructive ml-7", children: form.formState.errors.certifyInformation.message })
8830
+ ] })
8831
+ }
8832
+ ) }),
8833
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-3 justify-end pt-4 border-t border-border", children: [
8834
+ /* @__PURE__ */ jsxRuntime.jsx(Button, { type: "button", variant: "outline", onClick: onCancel, className: "w-32", children: "Cancel" }),
8835
+ /* @__PURE__ */ jsxRuntime.jsx(
8836
+ Button,
8837
+ {
8838
+ type: "button",
8839
+ onClick: onSubmit,
8840
+ className: "w-48",
8841
+ disabled: !transactionType || !accountNumber || requiresCounterparty && !counterpartyName || isTransfer && !receiverAccountLookedUp || isAdjustment && (!adjustmentDirection || !adjustmentType) || !amount || !form.watch("certifyInformation") || isSubmitting,
8842
+ children: isSubmitting ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
8843
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "h-4 w-4 mr-2 animate-spin" }),
8844
+ "Submitting..."
8845
+ ] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
8846
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CheckCircle2, { className: "h-4 w-4 mr-2" }),
8847
+ "Submit Transaction"
8848
+ ] })
8849
+ }
8850
+ )
8851
+ ] })
8852
+ ] }) })
8853
+ ] }) }),
8854
+ /* @__PURE__ */ jsxRuntime.jsx(Dialog, { open: confirmationOpen, onOpenChange: () => {
8855
+ }, children: /* @__PURE__ */ jsxRuntime.jsxs(DialogContent, { className: "sm:max-w-md", hideCloseButton: true, children: [
8856
+ /* @__PURE__ */ jsxRuntime.jsxs(DialogHeader, { children: [
8857
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3 mb-2", children: [
8858
+ submissionStatus === "success" ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-12 w-12 rounded-full bg-success/10 flex items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CheckCircle2, { className: "h-6 w-6 text-success" }) }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-12 w-12 rounded-full bg-destructive/10 flex items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.XCircle, { className: "h-6 w-6 text-destructive" }) }),
8859
+ /* @__PURE__ */ jsxRuntime.jsx(DialogTitle, { className: "text-xl", children: submissionStatus === "success" ? "Transaction Successful" : "Transaction Failed" })
8860
+ ] }),
8861
+ /* @__PURE__ */ jsxRuntime.jsx(DialogDescription, { className: "text-left", children: submissionStatus === "success" ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-4 pt-2", children: [
8862
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-foreground", children: "Your transaction has been successfully submitted and is being processed." }),
8863
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "bg-muted/50 rounded-lg p-4 space-y-2", children: [
8864
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-between text-sm", children: [
8865
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: "Transaction ID:" }),
8866
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-mono font-medium", children: transactionId })
8867
+ ] }),
8868
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-between text-sm", children: [
8869
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: "Amount:" }),
8870
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-medium", children: formatCurrency2(amount) })
8871
+ ] }),
8872
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-between text-sm", children: [
8873
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: "Type:" }),
8874
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-medium", children: TRANSACTION_TYPES.find((t) => t.value === transactionType)?.label })
8875
+ ] }),
8876
+ requiresCounterparty && counterpartyName && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-between text-sm", children: [
8877
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: "Counterparty:" }),
8878
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-medium", children: counterpartyName })
8879
+ ] })
8880
+ ] }),
8881
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start gap-2 p-3 bg-blue-500/10 border border-blue-500/20 rounded-lg", children: [
8882
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.AlertCircle, { className: "h-5 w-5 text-blue-500 mt-0.5 flex-shrink-0" }),
8883
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-blue-700 dark:text-blue-300", children: "You will receive a confirmation email once the transaction is completed." })
8884
+ ] })
8885
+ ] }) : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-4 pt-2", children: [
8886
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start gap-2 p-4 bg-destructive/10 border border-destructive/20 rounded-lg", children: [
8887
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.XCircle, { className: "h-5 w-5 text-destructive mt-0.5 flex-shrink-0" }),
8888
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1", children: [
8889
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm font-medium text-destructive", children: "Error Processing Transaction" }),
8890
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-muted-foreground", children: errorMessage })
8891
+ ] })
8892
+ ] }),
8893
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-muted-foreground", children: "Please review the error message above and try again. If the problem persists, contact support." })
8894
+ ] }) })
8895
+ ] }),
8896
+ /* @__PURE__ */ jsxRuntime.jsxs(DialogFooter, { className: "sm:justify-end gap-2", children: [
8897
+ submissionStatus === "error" && /* @__PURE__ */ jsxRuntime.jsx(Button, { type: "button", variant: "outline", onClick: () => onConfirmationOpenChange(false), children: "Edit" }),
8898
+ submissionStatus === "success" && /* @__PURE__ */ jsxRuntime.jsx(Button, { type: "button", variant: "outline", onClick: onNewTransaction, children: "New Transaction" }),
8784
8899
  /* @__PURE__ */ jsxRuntime.jsx(
8785
8900
  Button,
8786
8901
  {
8787
8902
  type: "button",
8788
- onClick: onSubmit,
8789
- className: "w-48",
8790
- disabled: !transactionType || !accountNumber || requiresCounterparty && !counterpartyName || isTransfer && !receiverAccountLookedUp || isAdjustment && (!adjustmentDirection || !adjustmentType) || !amount || !form.watch("certifyInformation") || isSubmitting,
8791
- children: isSubmitting ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
8792
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "h-4 w-4 mr-2 animate-spin" }),
8793
- "Submitting..."
8794
- ] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
8795
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CheckCircle2, { className: "h-4 w-4 mr-2" }),
8796
- "Submit Transaction"
8797
- ] })
8903
+ onClick: onConfirmationClose,
8904
+ variant: submissionStatus === "success" ? "default" : "outline",
8905
+ children: submissionStatus === "success" ? "View Transaction" : "Close"
8798
8906
  }
8799
8907
  )
8800
8908
  ] })
8801
8909
  ] }) })
8802
- ] }) }),
8803
- /* @__PURE__ */ jsxRuntime.jsx(Dialog, { open: confirmationOpen, onOpenChange: onConfirmationOpenChange, children: /* @__PURE__ */ jsxRuntime.jsxs(DialogContent, { className: "sm:max-w-md", children: [
8804
- /* @__PURE__ */ jsxRuntime.jsxs(DialogHeader, { children: [
8805
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3 mb-2", children: [
8806
- submissionStatus === "success" ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-12 w-12 rounded-full bg-success/10 flex items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CheckCircle2, { className: "h-6 w-6 text-success" }) }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-12 w-12 rounded-full bg-destructive/10 flex items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.XCircle, { className: "h-6 w-6 text-destructive" }) }),
8807
- /* @__PURE__ */ jsxRuntime.jsx(DialogTitle, { className: "text-xl", children: submissionStatus === "success" ? "Transaction Successful" : "Transaction Failed" })
8808
- ] }),
8809
- /* @__PURE__ */ jsxRuntime.jsx(DialogDescription, { className: "text-left", children: submissionStatus === "success" ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-4 pt-2", children: [
8810
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-foreground", children: "Your transaction has been successfully submitted and is being processed." }),
8811
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "bg-muted/50 rounded-lg p-4 space-y-2", children: [
8812
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-between text-sm", children: [
8813
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: "Transaction ID:" }),
8814
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-mono font-medium", children: transactionId })
8815
- ] }),
8816
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-between text-sm", children: [
8817
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: "Amount:" }),
8818
- /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "font-medium", children: [
8819
- "$",
8820
- amount
8821
- ] })
8822
- ] }),
8823
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-between text-sm", children: [
8824
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: "Type:" }),
8825
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-medium", children: TRANSACTION_TYPES.find((t) => t.value === transactionType)?.label })
8826
- ] }),
8827
- requiresCounterparty && counterpartyName && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-between text-sm", children: [
8828
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: "Counterparty:" }),
8829
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-medium", children: counterpartyName })
8830
- ] })
8831
- ] }),
8832
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start gap-2 p-3 bg-blue-500/10 border border-blue-500/20 rounded-lg", children: [
8833
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.AlertCircle, { className: "h-5 w-5 text-blue-500 mt-0.5 flex-shrink-0" }),
8834
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-blue-700 dark:text-blue-300", children: "You will receive a confirmation email once the transaction is completed." })
8835
- ] })
8836
- ] }) : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-4 pt-2", children: [
8837
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start gap-2 p-4 bg-destructive/10 border border-destructive/20 rounded-lg", children: [
8838
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.XCircle, { className: "h-5 w-5 text-destructive mt-0.5 flex-shrink-0" }),
8839
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1", children: [
8840
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm font-medium text-destructive", children: "Error Processing Transaction" }),
8841
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-muted-foreground", children: errorMessage })
8842
- ] })
8843
- ] }),
8844
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-muted-foreground", children: "Please review the error message above and try again. If the problem persists, contact support." })
8845
- ] }) })
8846
- ] }),
8847
- /* @__PURE__ */ jsxRuntime.jsxs(DialogFooter, { className: "sm:justify-end gap-2", children: [
8848
- submissionStatus === "error" && /* @__PURE__ */ jsxRuntime.jsx(Button, { type: "button", variant: "outline", onClick: () => onConfirmationOpenChange(false), children: "Try Again" }),
8849
- /* @__PURE__ */ jsxRuntime.jsx(
8850
- Button,
8851
- {
8852
- type: "button",
8853
- onClick: onConfirmationClose,
8854
- variant: submissionStatus === "success" ? "default" : "outline",
8855
- children: submissionStatus === "success" ? "View Transactions" : "Close"
8856
- }
8857
- )
8858
- ] })
8859
- ] }) })
8860
- ] }) });
8910
+ ] })
8911
+ ] });
8861
8912
  };
8862
8913
  var typeIcons = {
8863
8914
  checking: lucideReact.CreditCard,
@@ -13946,7 +13997,7 @@ var TransactionHistory = () => {
13946
13997
  setRowsPerPage(value);
13947
13998
  setCurrentPage(1);
13948
13999
  };
13949
- const formatCurrency = (value) => {
14000
+ const formatCurrency3 = (value) => {
13950
14001
  const formatted = new Intl.NumberFormat("en-US", {
13951
14002
  style: "currency",
13952
14003
  currency: "USD",
@@ -14123,23 +14174,19 @@ var TransactionHistory = () => {
14123
14174
  ),
14124
14175
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
14125
14176
  /* @__PURE__ */ jsxRuntime.jsx(
14126
- EnhancedInput,
14177
+ CurrencyInput,
14127
14178
  {
14128
14179
  label: "Min Amount",
14129
- type: "number",
14130
14180
  value: filters.minAmount,
14131
- onChange: (e) => handleFilterChange("minAmount", e.target.value),
14132
- placeholder: "0.00"
14181
+ onChange: (value) => handleFilterChange("minAmount", value)
14133
14182
  }
14134
14183
  ),
14135
14184
  /* @__PURE__ */ jsxRuntime.jsx(
14136
- EnhancedInput,
14185
+ CurrencyInput,
14137
14186
  {
14138
14187
  label: "Max Amount",
14139
- type: "number",
14140
14188
  value: filters.maxAmount,
14141
- onChange: (e) => handleFilterChange("maxAmount", e.target.value),
14142
- placeholder: "0.00"
14189
+ onChange: (value) => handleFilterChange("maxAmount", value)
14143
14190
  }
14144
14191
  )
14145
14192
  ] }),
@@ -14239,7 +14286,7 @@ var TransactionHistory = () => {
14239
14286
  children: [
14240
14287
  /* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-3 py-2 text-xs", children: transaction.created }),
14241
14288
  /* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-3 py-2 text-xs", children: transaction.accountNumber }),
14242
- /* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-3 py-2 text-xs text-right", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: transaction.amount < 0 ? "text-destructive" : "", children: formatCurrency(transaction.amount) }) }),
14289
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-3 py-2 text-xs text-right", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: transaction.amount < 0 ? "text-destructive" : "", children: formatCurrency3(transaction.amount) }) }),
14243
14290
  /* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-3 py-2", children: /* @__PURE__ */ jsxRuntime.jsx(Button, { variant: "link", className: "h-auto p-0 font-normal text-xs", children: transaction.customer }) }),
14244
14291
  /* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-3 py-2", children: /* @__PURE__ */ jsxRuntime.jsx(Button, { variant: "link", className: "h-auto p-0 font-normal text-xs", children: transaction.counterparty }) }),
14245
14292
  /* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-3 py-2 text-xs truncate", children: transaction.description }),
@@ -14609,15 +14656,57 @@ function NewTransaction() {
14609
14656
  setIsSubmitting(false);
14610
14657
  }
14611
14658
  };
14659
+ const resetForm = () => {
14660
+ form.reset({
14661
+ transactionType: "",
14662
+ accountNumber: "",
14663
+ counterpartyName: "",
14664
+ amount: "",
14665
+ description: "",
14666
+ certifyInformation: false,
14667
+ adjustmentDirection: "",
14668
+ adjustmentType: "",
14669
+ receiverAccountNumber: ""
14670
+ });
14671
+ setAccountLookedUp(false);
14672
+ setAccountData(null);
14673
+ setCounterpartyLookedUp(false);
14674
+ setCounterpartyData(null);
14675
+ setCounterpartySearchResults([]);
14676
+ setShowCounterpartyDropdown(false);
14677
+ setReceiverAccountLookedUp(false);
14678
+ setReceiverAccountData(null);
14679
+ setSubmissionStatus(null);
14680
+ setErrorMessage("");
14681
+ setTransactionId("");
14682
+ };
14612
14683
  const handleConfirmationClose = () => {
14613
14684
  setConfirmationOpen(false);
14614
14685
  if (submissionStatus === "success") {
14615
- navigate("/transactions/history");
14686
+ navigate(`/transactions/${transactionId}`);
14616
14687
  }
14617
14688
  };
14689
+ const handleNewTransaction = () => {
14690
+ setConfirmationOpen(false);
14691
+ resetForm();
14692
+ };
14618
14693
  const handleCancel = () => {
14619
14694
  navigate("/dashboard");
14620
14695
  };
14696
+ const isReviewReady = React15.useMemo(() => {
14697
+ const data = form.watch();
14698
+ const requiresCounterparty = ["ach", "wire"].includes(data.transactionType);
14699
+ if (!data.transactionType || !data.accountNumber || !data.amount) return false;
14700
+ if (requiresCounterparty && (!data.counterpartyName || !counterpartyLookedUp)) return false;
14701
+ if (!accountLookedUp) return false;
14702
+ if (data.transactionType === "adjustment") {
14703
+ if (!data.adjustmentDirection || !data.adjustmentType) return false;
14704
+ }
14705
+ if (data.transactionType === "transfer") {
14706
+ if (!data.receiverAccountNumber || !receiverAccountLookedUp) return false;
14707
+ }
14708
+ return true;
14709
+ }, [form.watch(), accountLookedUp, counterpartyLookedUp, receiverAccountLookedUp]);
14621
14710
  return /* @__PURE__ */ jsxRuntime.jsx(
14622
14711
  NewTransactionView,
14623
14712
  {
@@ -14647,11 +14736,13 @@ function NewTransaction() {
14647
14736
  onCancel: handleCancel,
14648
14737
  onConfirmationClose: handleConfirmationClose,
14649
14738
  onConfirmationOpenChange: setConfirmationOpen,
14739
+ onNewTransaction: handleNewTransaction,
14650
14740
  receiverAccountLookedUp,
14651
14741
  receiverAccountData,
14652
14742
  isReceiverAccountLoading,
14653
14743
  onReceiverAccountLookup: handleReceiverAccountLookup,
14654
- onEditReceiverAccount: handleEditReceiverAccount
14744
+ onEditReceiverAccount: handleEditReceiverAccount,
14745
+ isReviewReady
14655
14746
  }
14656
14747
  );
14657
14748
  }
@@ -14702,7 +14793,7 @@ var TransactionDetail = () => {
14702
14793
  return "outline";
14703
14794
  }
14704
14795
  };
14705
- const formatCurrency = (value) => {
14796
+ const formatCurrency3 = (value) => {
14706
14797
  return new Intl.NumberFormat("en-US", {
14707
14798
  style: "currency",
14708
14799
  currency: "USD",
@@ -14718,7 +14809,7 @@ var TransactionDetail = () => {
14718
14809
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: cn(
14719
14810
  "font-semibold",
14720
14811
  transaction.amount < 0 ? "text-destructive" : "text-success"
14721
- ), children: formatCurrency(transaction.amount) }),
14812
+ ), children: formatCurrency3(transaction.amount) }),
14722
14813
  /* @__PURE__ */ jsxRuntime.jsx(
14723
14814
  TransactionTypeBadge,
14724
14815
  {
@@ -15340,11 +15431,11 @@ function CreateVelocityLimit() {
15340
15431
  case "round_number":
15341
15432
  return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
15342
15433
  /* @__PURE__ */ jsxRuntime.jsx(
15343
- EnhancedInput,
15434
+ CurrencyInput,
15344
15435
  {
15345
15436
  label: "Amount Threshold",
15346
- placeholder: "Enter amount",
15347
- onChange: (e) => handleFieldChange("amountThreshold", e.target.value)
15437
+ value: formData.amountThreshold || "",
15438
+ onChange: (value) => handleFieldChange("amountThreshold", value)
15348
15439
  }
15349
15440
  ),
15350
15441
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -15457,11 +15548,11 @@ function CreateVelocityLimit() {
15457
15548
  }
15458
15549
  ),
15459
15550
  /* @__PURE__ */ jsxRuntime.jsx(
15460
- EnhancedInput,
15551
+ CurrencyInput,
15461
15552
  {
15462
15553
  label: "Max Transaction Amount",
15463
- placeholder: "Enter amount",
15464
- onChange: (e) => handleFieldChange("maxAmount", e.target.value)
15554
+ value: formData.maxAmount || "",
15555
+ onChange: (value) => handleFieldChange("maxAmount", value)
15465
15556
  }
15466
15557
  ),
15467
15558
  formData.aggregationLevel !== "transaction" && /* @__PURE__ */ jsxRuntime.jsx(