braid-ui 1.0.51 → 1.0.52

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
@@ -3067,7 +3067,7 @@ function AppSidebar() {
3067
3067
  ] });
3068
3068
  }
3069
3069
  var MainLayout = ({ children }) => {
3070
- return /* @__PURE__ */ jsx("div", { className: "flex h-screen w-full overflow-hidden", children: /* @__PURE__ */ jsx("main", { className: "flex-1 overflow-hidden", children }) });
3070
+ return /* @__PURE__ */ jsx("main", { className: "flex-1 h-full overflow-y-auto", children });
3071
3071
  };
3072
3072
  var useEditState = ({ initialEditing = false, onToggleEdit, onSave, onCancel }) => {
3073
3073
  const [localEditing, setLocalEditing] = useState(initialEditing);
@@ -8518,364 +8518,362 @@ var NewTransactionView = ({
8518
8518
  items: reviewItems
8519
8519
  }
8520
8520
  ];
8521
- return /* @__PURE__ */ jsxs("div", { className: "container mx-auto p-6 space-y-6", children: [
8521
+ return /* @__PURE__ */ jsxs("div", { className: "container mx-auto p-6 space-y-6 max-w-4xl", children: [
8522
8522
  /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx("h1", { className: "text-3xl font-bold tracking-tight", children: "New Transaction" }) }),
8523
- /* @__PURE__ */ jsxs("div", { className: "max-w-4xl space-y-6", children: [
8524
- /* @__PURE__ */ jsx(FormProvider, { form, children: /* @__PURE__ */ jsxs("form", { onSubmit: (e) => e.preventDefault(), children: [
8525
- !accountLookedUp ? /* @__PURE__ */ jsx(FormCard, { title: "Account Lookup", variant: "default", children: /* @__PURE__ */ jsxs("div", { className: "flex gap-3 items-start w-full", children: [
8526
- /* @__PURE__ */ jsx("div", { className: "flex-1", children: /* @__PURE__ */ jsx(
8527
- FormInput,
8528
- {
8529
- name: "accountNumber",
8530
- placeholder: "Enter account number"
8531
- }
8532
- ) }),
8533
- /* @__PURE__ */ jsx(
8534
- Button,
8535
- {
8536
- onClick: onAccountLookup,
8537
- disabled: !accountNumber || isAccountLoading,
8538
- className: "shrink-0 mt-0 w-48",
8539
- children: isAccountLoading ? /* @__PURE__ */ jsxs(Fragment, { children: [
8540
- /* @__PURE__ */ jsx(Loader2, { className: "h-4 w-4 mr-2 animate-spin" }),
8541
- "Looking up..."
8542
- ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
8543
- /* @__PURE__ */ jsx(Search, { className: "h-4 w-4 mr-2" }),
8544
- "Lookup Account"
8545
- ] })
8546
- }
8547
- )
8548
- ] }) }) : /* @__PURE__ */ jsx(
8549
- FormCard,
8523
+ /* @__PURE__ */ jsx(FormProvider, { form, children: /* @__PURE__ */ jsxs("form", { onSubmit: (e) => e.preventDefault(), children: [
8524
+ !accountLookedUp ? /* @__PURE__ */ jsx(FormCard, { title: "Account Lookup", variant: "default", children: /* @__PURE__ */ jsxs("div", { className: "flex gap-3 items-start w-full", children: [
8525
+ /* @__PURE__ */ jsx("div", { className: "flex-1", children: /* @__PURE__ */ jsx(
8526
+ FormInput,
8550
8527
  {
8551
- title: "Account Information",
8552
- variant: "subtle",
8553
- headerActions: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
8554
- /* @__PURE__ */ jsx(CheckCircle2, { className: "h-5 w-5 text-success" }),
8555
- /* @__PURE__ */ jsxs(Button, { variant: "ghost", size: "sm", onClick: onEditAccount, children: [
8556
- /* @__PURE__ */ jsx(Edit, { className: "h-4 w-4 mr-1" }),
8557
- "Edit"
8558
- ] })
8559
- ] }),
8560
- children: /* @__PURE__ */ jsx(DataGrid, { data: accountDataGrid, columns: 2 })
8528
+ name: "accountNumber",
8529
+ placeholder: "Enter account number"
8561
8530
  }
8562
- ),
8531
+ ) }),
8563
8532
  /* @__PURE__ */ jsx(
8564
- FormCard,
8533
+ Button,
8565
8534
  {
8566
- title: "Transaction Type",
8567
- variant: "default",
8568
- className: cn(!accountLookedUp && "opacity-50 pointer-events-none"),
8569
- children: /* @__PURE__ */ jsx("div", { className: "grid grid-cols-2 lg:grid-cols-4 gap-3 lg:gap-4", children: TRANSACTION_TYPES.map((type) => {
8570
- const Icon2 = type.icon;
8571
- const isSelected = transactionType === type.value;
8572
- return /* @__PURE__ */ jsxs(
8535
+ onClick: onAccountLookup,
8536
+ disabled: !accountNumber || isAccountLoading,
8537
+ className: "shrink-0 mt-0 w-48",
8538
+ children: isAccountLoading ? /* @__PURE__ */ jsxs(Fragment, { children: [
8539
+ /* @__PURE__ */ jsx(Loader2, { className: "h-4 w-4 mr-2 animate-spin" }),
8540
+ "Looking up..."
8541
+ ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
8542
+ /* @__PURE__ */ jsx(Search, { className: "h-4 w-4 mr-2" }),
8543
+ "Lookup Account"
8544
+ ] })
8545
+ }
8546
+ )
8547
+ ] }) }) : /* @__PURE__ */ jsx(
8548
+ FormCard,
8549
+ {
8550
+ title: "Account Information",
8551
+ variant: "subtle",
8552
+ headerActions: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
8553
+ /* @__PURE__ */ jsx(CheckCircle2, { className: "h-5 w-5 text-success" }),
8554
+ /* @__PURE__ */ jsxs(Button, { variant: "ghost", size: "sm", onClick: onEditAccount, children: [
8555
+ /* @__PURE__ */ jsx(Edit, { className: "h-4 w-4 mr-1" }),
8556
+ "Edit"
8557
+ ] })
8558
+ ] }),
8559
+ children: /* @__PURE__ */ jsx(DataGrid, { data: accountDataGrid, columns: 2 })
8560
+ }
8561
+ ),
8562
+ /* @__PURE__ */ jsx(
8563
+ FormCard,
8564
+ {
8565
+ title: "Transaction Type",
8566
+ variant: "default",
8567
+ className: cn(!accountLookedUp && "opacity-50 pointer-events-none"),
8568
+ children: /* @__PURE__ */ jsx("div", { className: "grid grid-cols-2 lg:grid-cols-4 gap-3 lg:gap-4", children: TRANSACTION_TYPES.map((type) => {
8569
+ const Icon2 = type.icon;
8570
+ const isSelected = transactionType === type.value;
8571
+ return /* @__PURE__ */ jsxs(
8572
+ "button",
8573
+ {
8574
+ type: "button",
8575
+ onClick: () => onTransactionTypeChange(type.value),
8576
+ disabled: !accountLookedUp,
8577
+ className: cn(
8578
+ "flex flex-col items-center justify-center p-4 lg:p-3 rounded-lg border-2 transition-all",
8579
+ "hover:border-primary/50 hover:shadow-md",
8580
+ isSelected ? "border-primary bg-primary/5 shadow-sm" : "border-border bg-card"
8581
+ ),
8582
+ children: [
8583
+ /* @__PURE__ */ jsx(Icon2, { className: cn(
8584
+ "h-6 w-6 lg:h-5 lg:w-5 mb-2",
8585
+ isSelected ? "text-primary" : "text-muted-foreground"
8586
+ ) }),
8587
+ /* @__PURE__ */ jsx("span", { className: cn(
8588
+ "text-sm font-medium",
8589
+ isSelected ? "text-primary" : "text-foreground"
8590
+ ), children: type.label })
8591
+ ]
8592
+ },
8593
+ type.value
8594
+ );
8595
+ }) })
8596
+ }
8597
+ ),
8598
+ requiresCounterparty && (!counterpartyLookedUp ? /* @__PURE__ */ jsxs(
8599
+ FormCard,
8600
+ {
8601
+ title: "Counterparty Search",
8602
+ variant: "default",
8603
+ className: cn(!transactionType && "opacity-50 pointer-events-none"),
8604
+ children: [
8605
+ /* @__PURE__ */ jsxs("div", { className: "relative", children: [
8606
+ /* @__PURE__ */ jsxs("div", { className: "relative", children: [
8607
+ /* @__PURE__ */ jsx(
8608
+ "input",
8609
+ {
8610
+ type: "text",
8611
+ placeholder: "Start typing to search counterparties...",
8612
+ value: counterpartyName,
8613
+ onChange: (e) => onCounterpartySearchChange(e.target.value),
8614
+ disabled: !transactionType,
8615
+ className: cn(
8616
+ "flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm",
8617
+ "ring-offset-background placeholder:text-muted-foreground",
8618
+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
8619
+ "disabled:cursor-not-allowed disabled:opacity-50",
8620
+ isCounterpartySearching && "pr-10"
8621
+ )
8622
+ }
8623
+ ),
8624
+ isCounterpartySearching && /* @__PURE__ */ jsx("div", { className: "absolute right-3 top-1/2 -translate-y-1/2", children: /* @__PURE__ */ jsx(Loader2, { className: "h-4 w-4 animate-spin text-muted-foreground" }) })
8625
+ ] }),
8626
+ showCounterpartyDropdown && counterpartySearchResults.length > 0 && /* @__PURE__ */ 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__ */ jsxs(
8573
8627
  "button",
8574
8628
  {
8575
8629
  type: "button",
8576
- onClick: () => onTransactionTypeChange(type.value),
8577
- disabled: !accountLookedUp,
8578
- className: cn(
8579
- "flex flex-col items-center justify-center p-4 lg:p-3 rounded-lg border-2 transition-all",
8580
- "hover:border-primary/50 hover:shadow-md",
8581
- isSelected ? "border-primary bg-primary/5 shadow-sm" : "border-border bg-card"
8582
- ),
8630
+ onClick: () => onCounterpartySelect(result),
8631
+ className: "w-full px-3 py-2 text-left hover:bg-accent transition-colors",
8583
8632
  children: [
8584
- /* @__PURE__ */ jsx(Icon2, { className: cn(
8585
- "h-6 w-6 lg:h-5 lg:w-5 mb-2",
8586
- isSelected ? "text-primary" : "text-muted-foreground"
8587
- ) }),
8588
- /* @__PURE__ */ jsx("span", { className: cn(
8589
- "text-sm font-medium",
8590
- isSelected ? "text-primary" : "text-foreground"
8591
- ), children: type.label })
8633
+ /* @__PURE__ */ jsx("div", { className: "font-medium text-sm", children: result.name }),
8634
+ /* @__PURE__ */ jsx("div", { className: "text-xs text-muted-foreground", children: result.id })
8592
8635
  ]
8593
8636
  },
8594
- type.value
8595
- );
8596
- }) })
8597
- }
8598
- ),
8599
- requiresCounterparty && (!counterpartyLookedUp ? /* @__PURE__ */ jsxs(
8600
- FormCard,
8601
- {
8602
- title: "Counterparty Search",
8603
- variant: "default",
8604
- className: cn(!transactionType && "opacity-50 pointer-events-none"),
8605
- children: [
8606
- /* @__PURE__ */ jsxs("div", { className: "relative", children: [
8607
- /* @__PURE__ */ jsxs("div", { className: "relative", children: [
8608
- /* @__PURE__ */ jsx(
8609
- "input",
8610
- {
8611
- type: "text",
8612
- placeholder: "Start typing to search counterparties...",
8613
- value: counterpartyName,
8614
- onChange: (e) => onCounterpartySearchChange(e.target.value),
8615
- disabled: !transactionType,
8616
- className: cn(
8617
- "flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm",
8618
- "ring-offset-background placeholder:text-muted-foreground",
8619
- "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
8620
- "disabled:cursor-not-allowed disabled:opacity-50",
8621
- isCounterpartySearching && "pr-10"
8622
- )
8623
- }
8624
- ),
8625
- isCounterpartySearching && /* @__PURE__ */ jsx("div", { className: "absolute right-3 top-1/2 -translate-y-1/2", children: /* @__PURE__ */ jsx(Loader2, { className: "h-4 w-4 animate-spin text-muted-foreground" }) })
8626
- ] }),
8627
- showCounterpartyDropdown && counterpartySearchResults.length > 0 && /* @__PURE__ */ 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__ */ jsxs(
8628
- "button",
8629
- {
8630
- type: "button",
8631
- onClick: () => onCounterpartySelect(result),
8632
- className: "w-full px-3 py-2 text-left hover:bg-accent transition-colors",
8633
- children: [
8634
- /* @__PURE__ */ jsx("div", { className: "font-medium text-sm", children: result.name }),
8635
- /* @__PURE__ */ jsx("div", { className: "text-xs text-muted-foreground", children: result.id })
8636
- ]
8637
- },
8638
- result.id
8639
- )) }),
8640
- showCounterpartyDropdown && counterpartySearchResults.length === 0 && !isCounterpartySearching && counterpartyName.length >= 2 && /* @__PURE__ */ jsx("div", { className: "absolute z-50 w-full mt-1 bg-popover border border-border rounded-md shadow-lg p-3", children: /* @__PURE__ */ jsxs("p", { className: "text-sm text-muted-foreground", children: [
8641
- 'No counterparties found matching "',
8642
- counterpartyName,
8643
- '"'
8644
- ] }) })
8645
- ] }),
8646
- /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground mt-2", children: "Type at least 2 characters to search" })
8647
- ]
8648
- }
8649
- ) : /* @__PURE__ */ jsx(
8650
- FormCard,
8651
- {
8652
- title: "Counterparty Information",
8653
- variant: "subtle",
8654
- headerActions: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
8655
- /* @__PURE__ */ jsx(CheckCircle2, { className: "h-5 w-5 text-success" }),
8656
- /* @__PURE__ */ jsxs(Button, { variant: "ghost", size: "sm", onClick: onEditCounterparty, children: [
8657
- /* @__PURE__ */ jsx(Edit, { className: "h-4 w-4 mr-1" }),
8658
- "Edit"
8659
- ] })
8637
+ result.id
8638
+ )) }),
8639
+ showCounterpartyDropdown && counterpartySearchResults.length === 0 && !isCounterpartySearching && counterpartyName.length >= 2 && /* @__PURE__ */ jsx("div", { className: "absolute z-50 w-full mt-1 bg-popover border border-border rounded-md shadow-lg p-3", children: /* @__PURE__ */ jsxs("p", { className: "text-sm text-muted-foreground", children: [
8640
+ 'No counterparties found matching "',
8641
+ counterpartyName,
8642
+ '"'
8643
+ ] }) })
8660
8644
  ] }),
8661
- children: /* @__PURE__ */ jsx(DataGrid, { data: counterpartyDataGrid, columns: 2 })
8662
- }
8663
- )),
8664
- isTransfer && (!receiverAccountLookedUp ? /* @__PURE__ */ jsx(
8665
- FormCard,
8666
- {
8667
- title: "Receiver Account",
8668
- variant: "default",
8669
- className: cn(!transactionType && "opacity-50 pointer-events-none"),
8670
- children: /* @__PURE__ */ jsxs("div", { className: "flex gap-3 items-start w-full", children: [
8671
- /* @__PURE__ */ jsx("div", { className: "flex-1", children: /* @__PURE__ */ jsx(
8672
- FormInput,
8645
+ /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground mt-2", children: "Type at least 2 characters to search" })
8646
+ ]
8647
+ }
8648
+ ) : /* @__PURE__ */ jsx(
8649
+ FormCard,
8650
+ {
8651
+ title: "Counterparty Information",
8652
+ variant: "subtle",
8653
+ headerActions: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
8654
+ /* @__PURE__ */ jsx(CheckCircle2, { className: "h-5 w-5 text-success" }),
8655
+ /* @__PURE__ */ jsxs(Button, { variant: "ghost", size: "sm", onClick: onEditCounterparty, children: [
8656
+ /* @__PURE__ */ jsx(Edit, { className: "h-4 w-4 mr-1" }),
8657
+ "Edit"
8658
+ ] })
8659
+ ] }),
8660
+ children: /* @__PURE__ */ jsx(DataGrid, { data: counterpartyDataGrid, columns: 2 })
8661
+ }
8662
+ )),
8663
+ isTransfer && (!receiverAccountLookedUp ? /* @__PURE__ */ jsx(
8664
+ FormCard,
8665
+ {
8666
+ title: "Receiver Account",
8667
+ variant: "default",
8668
+ className: cn(!transactionType && "opacity-50 pointer-events-none"),
8669
+ children: /* @__PURE__ */ jsxs("div", { className: "flex gap-3 items-start w-full", children: [
8670
+ /* @__PURE__ */ jsx("div", { className: "flex-1", children: /* @__PURE__ */ jsx(
8671
+ FormInput,
8672
+ {
8673
+ name: "receiverAccountNumber",
8674
+ placeholder: "Enter receiver account number",
8675
+ disabled: !transactionType
8676
+ }
8677
+ ) }),
8678
+ /* @__PURE__ */ jsx(
8679
+ Button,
8680
+ {
8681
+ onClick: onReceiverAccountLookup,
8682
+ disabled: !receiverAccountNumber || isReceiverAccountLoading,
8683
+ className: "shrink-0 mt-0 w-48",
8684
+ children: isReceiverAccountLoading ? /* @__PURE__ */ jsxs(Fragment, { children: [
8685
+ /* @__PURE__ */ jsx(Loader2, { className: "h-4 w-4 mr-2 animate-spin" }),
8686
+ "Looking up..."
8687
+ ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
8688
+ /* @__PURE__ */ jsx(Search, { className: "h-4 w-4 mr-2" }),
8689
+ "Lookup Receiver"
8690
+ ] })
8691
+ }
8692
+ )
8693
+ ] })
8694
+ }
8695
+ ) : /* @__PURE__ */ jsx(
8696
+ FormCard,
8697
+ {
8698
+ title: "Receiver Account Information",
8699
+ variant: "subtle",
8700
+ headerActions: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
8701
+ /* @__PURE__ */ jsx(CheckCircle2, { className: "h-5 w-5 text-success" }),
8702
+ /* @__PURE__ */ jsxs(Button, { variant: "ghost", size: "sm", onClick: onEditReceiverAccount, children: [
8703
+ /* @__PURE__ */ jsx(Edit, { className: "h-4 w-4 mr-1" }),
8704
+ "Edit"
8705
+ ] })
8706
+ ] }),
8707
+ children: /* @__PURE__ */ jsx(DataGrid, { data: receiverAccountDataGrid, columns: 2 })
8708
+ }
8709
+ )),
8710
+ /* @__PURE__ */ jsx(
8711
+ FormCard,
8712
+ {
8713
+ title: "Transaction Details",
8714
+ variant: "default",
8715
+ className: cn(
8716
+ requiresCounterparty ? !counterpartyLookedUp && "opacity-50 pointer-events-none" : isTransfer ? !receiverAccountLookedUp && "opacity-50 pointer-events-none" : !transactionType && "opacity-50 pointer-events-none"
8717
+ ),
8718
+ children: /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
8719
+ isAdjustment && /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
8720
+ /* @__PURE__ */ jsx(
8721
+ FormSelect,
8673
8722
  {
8674
- name: "receiverAccountNumber",
8675
- placeholder: "Enter receiver account number",
8723
+ name: "adjustmentDirection",
8724
+ label: "Direction",
8725
+ placeholder: "Select direction",
8726
+ options: ADJUSTMENT_DIRECTION_OPTIONS,
8676
8727
  disabled: !transactionType
8677
8728
  }
8678
- ) }),
8729
+ ),
8679
8730
  /* @__PURE__ */ jsx(
8680
- Button,
8731
+ FormSelect,
8681
8732
  {
8682
- onClick: onReceiverAccountLookup,
8683
- disabled: !receiverAccountNumber || isReceiverAccountLoading,
8684
- className: "shrink-0 mt-0 w-48",
8685
- children: isReceiverAccountLoading ? /* @__PURE__ */ jsxs(Fragment, { children: [
8686
- /* @__PURE__ */ jsx(Loader2, { className: "h-4 w-4 mr-2 animate-spin" }),
8687
- "Looking up..."
8688
- ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
8689
- /* @__PURE__ */ jsx(Search, { className: "h-4 w-4 mr-2" }),
8690
- "Lookup Receiver"
8691
- ] })
8733
+ name: "adjustmentType",
8734
+ label: "Adjustment Type",
8735
+ placeholder: "Select type",
8736
+ options: ADJUSTMENT_TYPE_OPTIONS,
8737
+ disabled: !transactionType
8692
8738
  }
8693
8739
  )
8694
- ] })
8695
- }
8696
- ) : /* @__PURE__ */ jsx(
8697
- FormCard,
8698
- {
8699
- title: "Receiver Account Information",
8700
- variant: "subtle",
8701
- headerActions: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
8702
- /* @__PURE__ */ jsx(CheckCircle2, { className: "h-5 w-5 text-success" }),
8703
- /* @__PURE__ */ jsxs(Button, { variant: "ghost", size: "sm", onClick: onEditReceiverAccount, children: [
8704
- /* @__PURE__ */ jsx(Edit, { className: "h-4 w-4 mr-1" }),
8705
- "Edit"
8706
- ] })
8707
8740
  ] }),
8708
- children: /* @__PURE__ */ jsx(DataGrid, { data: receiverAccountDataGrid, columns: 2 })
8709
- }
8710
- )),
8711
- /* @__PURE__ */ jsx(
8712
- FormCard,
8713
- {
8714
- title: "Transaction Details",
8715
- variant: "default",
8716
- className: cn(
8717
- requiresCounterparty ? !counterpartyLookedUp && "opacity-50 pointer-events-none" : isTransfer ? !receiverAccountLookedUp && "opacity-50 pointer-events-none" : !transactionType && "opacity-50 pointer-events-none"
8741
+ /* @__PURE__ */ jsx(
8742
+ Controller,
8743
+ {
8744
+ name: "amount",
8745
+ control: form.control,
8746
+ render: ({ field }) => /* @__PURE__ */ jsx(
8747
+ CurrencyInput,
8748
+ {
8749
+ label: "Amount",
8750
+ value: field.value,
8751
+ onChange: field.onChange,
8752
+ disabled: requiresCounterparty ? !counterpartyLookedUp : isTransfer ? !receiverAccountLookedUp : !transactionType,
8753
+ error: form.formState.errors.amount?.message
8754
+ }
8755
+ )
8756
+ }
8718
8757
  ),
8719
- children: /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
8720
- isAdjustment && /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
8758
+ /* @__PURE__ */ jsx(
8759
+ FormInput,
8760
+ {
8761
+ name: "description",
8762
+ label: "Description (Optional)",
8763
+ placeholder: "Enter transaction description",
8764
+ disabled: requiresCounterparty ? !counterpartyLookedUp : isTransfer ? !receiverAccountLookedUp : !transactionType
8765
+ }
8766
+ )
8767
+ ] })
8768
+ }
8769
+ ),
8770
+ /* @__PURE__ */ jsx(FormCard, { title: "Review & Submit", variant: "default", className: cn(!isReviewReady && "opacity-50 pointer-events-none"), children: /* @__PURE__ */ jsxs("div", { className: "space-y-6", children: [
8771
+ /* @__PURE__ */ jsx(DataGrid, { data: reviewData, columns: 2 }),
8772
+ /* @__PURE__ */ jsx("div", { className: "bg-muted/30 rounded-lg p-4 border border-border/50", children: /* @__PURE__ */ jsx(
8773
+ Controller,
8774
+ {
8775
+ name: "certifyInformation",
8776
+ control: form.control,
8777
+ render: ({ field }) => /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
8778
+ /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-3", children: [
8721
8779
  /* @__PURE__ */ jsx(
8722
- FormSelect,
8780
+ Checkbox,
8723
8781
  {
8724
- name: "adjustmentDirection",
8725
- label: "Direction",
8726
- placeholder: "Select direction",
8727
- options: ADJUSTMENT_DIRECTION_OPTIONS,
8728
- disabled: !transactionType
8782
+ id: "certifyInformation",
8783
+ checked: field.value,
8784
+ onCheckedChange: field.onChange
8729
8785
  }
8730
8786
  ),
8731
8787
  /* @__PURE__ */ jsx(
8732
- FormSelect,
8788
+ "label",
8733
8789
  {
8734
- name: "adjustmentType",
8735
- label: "Adjustment Type",
8736
- placeholder: "Select type",
8737
- options: ADJUSTMENT_TYPE_OPTIONS,
8738
- disabled: !transactionType
8790
+ htmlFor: "certifyInformation",
8791
+ className: "text-sm font-medium leading-relaxed cursor-pointer select-none",
8792
+ children: "I certify that all information entered is correct and accurate to the best of my knowledge"
8739
8793
  }
8740
8794
  )
8741
8795
  ] }),
8742
- /* @__PURE__ */ jsx(
8743
- Controller,
8744
- {
8745
- name: "amount",
8746
- control: form.control,
8747
- render: ({ field }) => /* @__PURE__ */ jsx(
8748
- CurrencyInput,
8749
- {
8750
- label: "Amount",
8751
- value: field.value,
8752
- onChange: field.onChange,
8753
- disabled: requiresCounterparty ? !counterpartyLookedUp : isTransfer ? !receiverAccountLookedUp : !transactionType,
8754
- error: form.formState.errors.amount?.message
8755
- }
8756
- )
8757
- }
8758
- ),
8759
- /* @__PURE__ */ jsx(
8760
- FormInput,
8761
- {
8762
- name: "description",
8763
- label: "Description (Optional)",
8764
- placeholder: "Enter transaction description",
8765
- disabled: requiresCounterparty ? !counterpartyLookedUp : isTransfer ? !receiverAccountLookedUp : !transactionType
8766
- }
8767
- )
8796
+ form.formState.errors.certifyInformation && /* @__PURE__ */ jsx("p", { className: "text-xs text-destructive ml-7", children: form.formState.errors.certifyInformation.message })
8768
8797
  ] })
8769
8798
  }
8770
- ),
8771
- /* @__PURE__ */ jsx(FormCard, { title: "Review & Submit", variant: "default", className: cn(!isReviewReady && "opacity-50 pointer-events-none"), children: /* @__PURE__ */ jsxs("div", { className: "space-y-6", children: [
8772
- /* @__PURE__ */ jsx(DataGrid, { data: reviewData, columns: 2 }),
8773
- /* @__PURE__ */ jsx("div", { className: "bg-muted/30 rounded-lg p-4 border border-border/50", children: /* @__PURE__ */ jsx(
8774
- Controller,
8775
- {
8776
- name: "certifyInformation",
8777
- control: form.control,
8778
- render: ({ field }) => /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
8779
- /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-3", children: [
8780
- /* @__PURE__ */ jsx(
8781
- Checkbox,
8782
- {
8783
- id: "certifyInformation",
8784
- checked: field.value,
8785
- onCheckedChange: field.onChange
8786
- }
8787
- ),
8788
- /* @__PURE__ */ jsx(
8789
- "label",
8790
- {
8791
- htmlFor: "certifyInformation",
8792
- className: "text-sm font-medium leading-relaxed cursor-pointer select-none",
8793
- children: "I certify that all information entered is correct and accurate to the best of my knowledge"
8794
- }
8795
- )
8796
- ] }),
8797
- form.formState.errors.certifyInformation && /* @__PURE__ */ jsx("p", { className: "text-xs text-destructive ml-7", children: form.formState.errors.certifyInformation.message })
8798
- ] })
8799
- }
8800
- ) }),
8801
- /* @__PURE__ */ jsxs("div", { className: "flex gap-3 justify-end pt-4 border-t border-border", children: [
8802
- /* @__PURE__ */ jsx(Button, { type: "button", variant: "outline", onClick: onCancel, className: "w-32", children: "Cancel" }),
8803
- /* @__PURE__ */ jsx(
8804
- Button,
8805
- {
8806
- type: "button",
8807
- onClick: onSubmit,
8808
- className: "w-48",
8809
- disabled: !transactionType || !accountNumber || requiresCounterparty && !counterpartyName || isTransfer && !receiverAccountLookedUp || isAdjustment && (!adjustmentDirection || !adjustmentType) || !amount || !form.watch("certifyInformation") || isSubmitting,
8810
- children: isSubmitting ? /* @__PURE__ */ jsxs(Fragment, { children: [
8811
- /* @__PURE__ */ jsx(Loader2, { className: "h-4 w-4 mr-2 animate-spin" }),
8812
- "Submitting..."
8813
- ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
8814
- /* @__PURE__ */ jsx(CheckCircle2, { className: "h-4 w-4 mr-2" }),
8815
- "Submit Transaction"
8816
- ] })
8817
- }
8818
- )
8819
- ] })
8820
- ] }) })
8821
- ] }) }),
8822
- /* @__PURE__ */ jsx(Dialog, { open: confirmationOpen, onOpenChange: () => {
8823
- }, children: /* @__PURE__ */ jsxs(DialogContent, { className: "sm:max-w-md", hideCloseButton: true, children: [
8824
- /* @__PURE__ */ jsxs(DialogHeader, { children: [
8825
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3 mb-2", children: [
8826
- submissionStatus === "success" ? /* @__PURE__ */ jsx("div", { className: "h-12 w-12 rounded-full bg-success/10 flex items-center justify-center", children: /* @__PURE__ */ jsx(CheckCircle2, { className: "h-6 w-6 text-success" }) }) : /* @__PURE__ */ jsx("div", { className: "h-12 w-12 rounded-full bg-destructive/10 flex items-center justify-center", children: /* @__PURE__ */ jsx(XCircle, { className: "h-6 w-6 text-destructive" }) }),
8827
- /* @__PURE__ */ jsx(DialogTitle, { className: "text-xl", children: submissionStatus === "success" ? "Transaction Successful" : "Transaction Failed" })
8828
- ] }),
8829
- /* @__PURE__ */ jsx(DialogDescription, { className: "text-left", children: submissionStatus === "success" ? /* @__PURE__ */ jsxs("div", { className: "space-y-4 pt-2", children: [
8830
- /* @__PURE__ */ jsx("p", { className: "text-foreground", children: "Your transaction has been successfully submitted and is being processed." }),
8831
- /* @__PURE__ */ jsxs("div", { className: "bg-muted/50 rounded-lg p-4 space-y-2", children: [
8832
- /* @__PURE__ */ jsxs("div", { className: "flex justify-between text-sm", children: [
8833
- /* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: "Transaction ID:" }),
8834
- /* @__PURE__ */ jsx("span", { className: "font-mono font-medium", children: transactionId })
8835
- ] }),
8836
- /* @__PURE__ */ jsxs("div", { className: "flex justify-between text-sm", children: [
8837
- /* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: "Amount:" }),
8838
- /* @__PURE__ */ jsx("span", { className: "font-medium", children: formatCurrency2(amount) })
8839
- ] }),
8840
- /* @__PURE__ */ jsxs("div", { className: "flex justify-between text-sm", children: [
8841
- /* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: "Type:" }),
8842
- /* @__PURE__ */ jsx("span", { className: "font-medium", children: TRANSACTION_TYPES.find((t) => t.value === transactionType)?.label })
8843
- ] }),
8844
- requiresCounterparty && counterpartyName && /* @__PURE__ */ jsxs("div", { className: "flex justify-between text-sm", children: [
8845
- /* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: "Counterparty:" }),
8846
- /* @__PURE__ */ jsx("span", { className: "font-medium", children: counterpartyName })
8847
- ] })
8848
- ] }),
8849
- /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-2 p-3 bg-blue-500/10 border border-blue-500/20 rounded-lg", children: [
8850
- /* @__PURE__ */ jsx(AlertCircle, { className: "h-5 w-5 text-blue-500 mt-0.5 flex-shrink-0" }),
8851
- /* @__PURE__ */ jsx("p", { className: "text-sm text-blue-700 dark:text-blue-300", children: "You will receive a confirmation email once the transaction is completed." })
8852
- ] })
8853
- ] }) : /* @__PURE__ */ jsxs("div", { className: "space-y-4 pt-2", children: [
8854
- /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-2 p-4 bg-destructive/10 border border-destructive/20 rounded-lg", children: [
8855
- /* @__PURE__ */ jsx(XCircle, { className: "h-5 w-5 text-destructive mt-0.5 flex-shrink-0" }),
8856
- /* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
8857
- /* @__PURE__ */ jsx("p", { className: "text-sm font-medium text-destructive", children: "Error Processing Transaction" }),
8858
- /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: errorMessage })
8859
- ] })
8860
- ] }),
8861
- /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: "Please review the error message above and try again. If the problem persists, contact support." })
8862
- ] }) })
8863
- ] }),
8864
- /* @__PURE__ */ jsxs(DialogFooter, { className: "sm:justify-end gap-2", children: [
8865
- submissionStatus === "error" && /* @__PURE__ */ jsx(Button, { type: "button", variant: "outline", onClick: () => onConfirmationOpenChange(false), children: "Edit" }),
8866
- submissionStatus === "success" && /* @__PURE__ */ jsx(Button, { type: "button", variant: "outline", onClick: onNewTransaction, children: "New Transaction" }),
8799
+ ) }),
8800
+ /* @__PURE__ */ jsxs("div", { className: "flex gap-3 justify-end pt-4 border-t border-border", children: [
8801
+ /* @__PURE__ */ jsx(Button, { type: "button", variant: "outline", onClick: onCancel, className: "w-32", children: "Cancel" }),
8867
8802
  /* @__PURE__ */ jsx(
8868
8803
  Button,
8869
8804
  {
8870
8805
  type: "button",
8871
- onClick: onConfirmationClose,
8872
- variant: submissionStatus === "success" ? "default" : "outline",
8873
- children: submissionStatus === "success" ? "View Transaction" : "Close"
8806
+ onClick: onSubmit,
8807
+ className: "w-48",
8808
+ disabled: !transactionType || !accountNumber || requiresCounterparty && !counterpartyName || isTransfer && !receiverAccountLookedUp || isAdjustment && (!adjustmentDirection || !adjustmentType) || !amount || !form.watch("certifyInformation") || isSubmitting,
8809
+ children: isSubmitting ? /* @__PURE__ */ jsxs(Fragment, { children: [
8810
+ /* @__PURE__ */ jsx(Loader2, { className: "h-4 w-4 mr-2 animate-spin" }),
8811
+ "Submitting..."
8812
+ ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
8813
+ /* @__PURE__ */ jsx(CheckCircle2, { className: "h-4 w-4 mr-2" }),
8814
+ "Submit Transaction"
8815
+ ] })
8874
8816
  }
8875
8817
  )
8876
8818
  ] })
8877
8819
  ] }) })
8878
- ] })
8820
+ ] }) }),
8821
+ /* @__PURE__ */ jsx(Dialog, { open: confirmationOpen, onOpenChange: () => {
8822
+ }, children: /* @__PURE__ */ jsxs(DialogContent, { className: "sm:max-w-md", hideCloseButton: true, children: [
8823
+ /* @__PURE__ */ jsxs(DialogHeader, { children: [
8824
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3 mb-2", children: [
8825
+ submissionStatus === "success" ? /* @__PURE__ */ jsx("div", { className: "h-12 w-12 rounded-full bg-success/10 flex items-center justify-center", children: /* @__PURE__ */ jsx(CheckCircle2, { className: "h-6 w-6 text-success" }) }) : /* @__PURE__ */ jsx("div", { className: "h-12 w-12 rounded-full bg-destructive/10 flex items-center justify-center", children: /* @__PURE__ */ jsx(XCircle, { className: "h-6 w-6 text-destructive" }) }),
8826
+ /* @__PURE__ */ jsx(DialogTitle, { className: "text-xl", children: submissionStatus === "success" ? "Transaction Successful" : "Transaction Failed" })
8827
+ ] }),
8828
+ /* @__PURE__ */ jsx(DialogDescription, { className: "text-left", children: submissionStatus === "success" ? /* @__PURE__ */ jsxs("div", { className: "space-y-4 pt-2", children: [
8829
+ /* @__PURE__ */ jsx("p", { className: "text-foreground", children: "Your transaction has been successfully submitted and is being processed." }),
8830
+ /* @__PURE__ */ jsxs("div", { className: "bg-muted/50 rounded-lg p-4 space-y-2", children: [
8831
+ /* @__PURE__ */ jsxs("div", { className: "flex justify-between text-sm", children: [
8832
+ /* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: "Transaction ID:" }),
8833
+ /* @__PURE__ */ jsx("span", { className: "font-mono font-medium", children: transactionId })
8834
+ ] }),
8835
+ /* @__PURE__ */ jsxs("div", { className: "flex justify-between text-sm", children: [
8836
+ /* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: "Amount:" }),
8837
+ /* @__PURE__ */ jsx("span", { className: "font-medium", children: formatCurrency2(amount) })
8838
+ ] }),
8839
+ /* @__PURE__ */ jsxs("div", { className: "flex justify-between text-sm", children: [
8840
+ /* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: "Type:" }),
8841
+ /* @__PURE__ */ jsx("span", { className: "font-medium", children: TRANSACTION_TYPES.find((t) => t.value === transactionType)?.label })
8842
+ ] }),
8843
+ requiresCounterparty && counterpartyName && /* @__PURE__ */ jsxs("div", { className: "flex justify-between text-sm", children: [
8844
+ /* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: "Counterparty:" }),
8845
+ /* @__PURE__ */ jsx("span", { className: "font-medium", children: counterpartyName })
8846
+ ] })
8847
+ ] }),
8848
+ /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-2 p-3 bg-blue-500/10 border border-blue-500/20 rounded-lg", children: [
8849
+ /* @__PURE__ */ jsx(AlertCircle, { className: "h-5 w-5 text-blue-500 mt-0.5 flex-shrink-0" }),
8850
+ /* @__PURE__ */ jsx("p", { className: "text-sm text-blue-700 dark:text-blue-300", children: "You will receive a confirmation email once the transaction is completed." })
8851
+ ] })
8852
+ ] }) : /* @__PURE__ */ jsxs("div", { className: "space-y-4 pt-2", children: [
8853
+ /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-2 p-4 bg-destructive/10 border border-destructive/20 rounded-lg", children: [
8854
+ /* @__PURE__ */ jsx(XCircle, { className: "h-5 w-5 text-destructive mt-0.5 flex-shrink-0" }),
8855
+ /* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
8856
+ /* @__PURE__ */ jsx("p", { className: "text-sm font-medium text-destructive", children: "Error Processing Transaction" }),
8857
+ /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: errorMessage })
8858
+ ] })
8859
+ ] }),
8860
+ /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: "Please review the error message above and try again. If the problem persists, contact support." })
8861
+ ] }) })
8862
+ ] }),
8863
+ /* @__PURE__ */ jsxs(DialogFooter, { className: "sm:justify-end gap-2", children: [
8864
+ submissionStatus === "error" && /* @__PURE__ */ jsx(Button, { type: "button", variant: "outline", onClick: () => onConfirmationOpenChange(false), children: "Edit" }),
8865
+ submissionStatus === "success" && /* @__PURE__ */ jsx(Button, { type: "button", variant: "outline", onClick: onNewTransaction, children: "New Transaction" }),
8866
+ /* @__PURE__ */ jsx(
8867
+ Button,
8868
+ {
8869
+ type: "button",
8870
+ onClick: onConfirmationClose,
8871
+ variant: submissionStatus === "success" ? "default" : "outline",
8872
+ children: submissionStatus === "success" ? "View Transaction" : "Close"
8873
+ }
8874
+ )
8875
+ ] })
8876
+ ] }) })
8879
8877
  ] });
8880
8878
  };
8881
8879
  var typeIcons = {