braid-ui 1.0.42 → 1.0.44

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, Shield, AlertCircle, RefreshCw, Landmark, Search, Repeat, Zap, Box, Settings, BarChart3, Key, ChevronLeft, AlertTriangle, XCircle, CheckCircle, Clock, Ban, Circle, Wallet, Filter, User, Loader2, ArrowDownRight, ArrowUpRight, CheckCircle2, ArrowLeft, StickyNote, FileUp, RotateCcw, Send, PlayCircle, UserPlus, ChevronsUpDown, ArrowRightLeft, UserCheck, CalendarIcon, Package, File, FileJson, DollarSign } 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, Shield, AlertCircle, RefreshCw, Landmark, Search, Repeat, Zap, Box, Settings, BarChart3, Key, ChevronLeft, AlertTriangle, Clock, XCircle, CheckCircle, Ban, Circle, Wallet, Filter, User, Loader2, ArrowDownRight, ArrowUpRight, CheckCircle2, ArrowLeft, StickyNote, FileUp, RotateCcw, Send, PlayCircle, UserPlus, ChevronsUpDown, ArrowRightLeft, UserCheck, CalendarIcon, Package, File, FileJson, DollarSign } 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';
@@ -3983,6 +3983,21 @@ var statusConfig = {
3983
3983
  variant: "secondary",
3984
3984
  label: "Cancelled",
3985
3985
  icon: XCircle
3986
+ },
3987
+ DELETED: {
3988
+ variant: "inactive",
3989
+ label: "Deleted",
3990
+ icon: XCircle
3991
+ },
3992
+ NEEDS_OFAC: {
3993
+ variant: "pending",
3994
+ label: "Needs OFAC",
3995
+ icon: AlertTriangle
3996
+ },
3997
+ PENDING_UNBLOCK: {
3998
+ variant: "pending",
3999
+ label: "Pending Unblock",
4000
+ icon: Clock
3986
4001
  }
3987
4002
  };
3988
4003
  var StatusBadge = ({ status, className }) => {
@@ -6141,10 +6156,12 @@ var CounterpartyDetailView = ({
6141
6156
  counterpartyType,
6142
6157
  currentStatus,
6143
6158
  isEditingProfile,
6159
+ counterpartyProfileData,
6144
6160
  mockPaymentMethods: mockPaymentMethods2,
6145
6161
  documents,
6146
6162
  onStatusChange,
6147
6163
  onToggleProfileEdit,
6164
+ onProfileDataChange,
6148
6165
  onAddPaymentMethod,
6149
6166
  onAddDocument,
6150
6167
  onEntityClick
@@ -6189,9 +6206,10 @@ var CounterpartyDetailView = ({
6189
6206
  value: currentStatus,
6190
6207
  options: [
6191
6208
  { value: "ACTIVE", label: "Active" },
6192
- { value: "INACTIVE", label: "Inactive" },
6193
- { value: "PENDING", label: "Pending" },
6194
- { value: "SUSPENDED", label: "Suspended" }
6209
+ { value: "BLOCKED", label: "Blocked" },
6210
+ { value: "DELETED", label: "Deleted" },
6211
+ { value: "NEEDS_OFAC", label: "Needs OFAC" },
6212
+ { value: "PENDING_UNBLOCK", label: "Pending Unblock" }
6195
6213
  ],
6196
6214
  onChange: onStatusChange,
6197
6215
  renderValue: (value) => /* @__PURE__ */ jsx(StatusBadge, { status: value }),
@@ -6206,8 +6224,10 @@ var CounterpartyDetailView = ({
6206
6224
  /* @__PURE__ */ jsx(
6207
6225
  CounterpartyProfileCard,
6208
6226
  {
6227
+ data: counterpartyProfileData,
6209
6228
  isEditing: isEditingProfile,
6210
6229
  onToggleEdit: onToggleProfileEdit,
6230
+ onDataChange: onProfileDataChange,
6211
6231
  onEntityClick
6212
6232
  }
6213
6233
  ),
@@ -6939,20 +6959,18 @@ var Label = React15.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
6939
6959
  }
6940
6960
  ));
6941
6961
  Label.displayName = LabelPrimitive.Root.displayName;
6942
- var CounterpartyBasicInfo = ({ onDataChange }) => {
6943
- const [formData, setFormData] = useState({
6944
- name: "",
6945
- type: "business",
6946
- email: "",
6947
- phone: "",
6948
- dateOfBirth: "",
6949
- idNumber: "",
6950
- idType: "product_id",
6951
- idValue: ""
6952
- });
6953
- const handleInputChange = (field, value) => {
6954
- const updatedData = { ...formData, [field]: value };
6955
- setFormData(updatedData);
6962
+ var CounterpartyBasicInfo = ({ value = {
6963
+ name: "",
6964
+ type: "business",
6965
+ email: "",
6966
+ phone: "",
6967
+ dateOfBirth: "",
6968
+ idNumber: "",
6969
+ idType: "product_id",
6970
+ idValue: ""
6971
+ }, onDataChange }) => {
6972
+ const handleInputChange = (field, newValue) => {
6973
+ const updatedData = { ...value, [field]: newValue };
6956
6974
  onDataChange?.(updatedData);
6957
6975
  };
6958
6976
  const handleTypeChange = (type) => {
@@ -6964,7 +6982,7 @@ var CounterpartyBasicInfo = ({ onDataChange }) => {
6964
6982
  EnhancedInput,
6965
6983
  {
6966
6984
  label: "Counterparty Name",
6967
- value: formData.name,
6985
+ value: value.name,
6968
6986
  onChange: (e) => handleInputChange("name", e.target.value),
6969
6987
  placeholder: "Enter counterparty name",
6970
6988
  required: true
@@ -6980,7 +6998,7 @@ var CounterpartyBasicInfo = ({ onDataChange }) => {
6980
6998
  type: "radio",
6981
6999
  name: "counterpartyType",
6982
7000
  value: "business",
6983
- checked: formData.type === "business",
7001
+ checked: value.type === "business",
6984
7002
  onChange: () => handleTypeChange("business"),
6985
7003
  className: "w-4 h-4 text-primary border-border focus:ring-primary focus:ring-2"
6986
7004
  }
@@ -6994,7 +7012,7 @@ var CounterpartyBasicInfo = ({ onDataChange }) => {
6994
7012
  type: "radio",
6995
7013
  name: "counterpartyType",
6996
7014
  value: "individual",
6997
- checked: formData.type === "individual",
7015
+ checked: value.type === "individual",
6998
7016
  onChange: () => handleTypeChange("individual"),
6999
7017
  className: "w-4 h-4 text-primary border-border focus:ring-primary focus:ring-2"
7000
7018
  }
@@ -7007,8 +7025,8 @@ var CounterpartyBasicInfo = ({ onDataChange }) => {
7007
7025
  EnhancedSelect,
7008
7026
  {
7009
7027
  label: "Associated with",
7010
- value: formData.idType,
7011
- onValueChange: (value) => handleInputChange("idType", value),
7028
+ value: value.idType,
7029
+ onValueChange: (val) => handleInputChange("idType", val),
7012
7030
  options: [
7013
7031
  { value: "product_id", label: "Product ID" },
7014
7032
  { value: "business_id", label: "Business ID" },
@@ -7020,10 +7038,10 @@ var CounterpartyBasicInfo = ({ onDataChange }) => {
7020
7038
  /* @__PURE__ */ jsx(
7021
7039
  EnhancedInput,
7022
7040
  {
7023
- label: formData.idType === "product_id" ? "Product ID" : formData.idType === "business_id" ? "Business ID" : formData.idType === "individual_id" ? "Individual ID" : "Account Number",
7024
- value: formData.idValue,
7041
+ label: value.idType === "product_id" ? "Product ID" : value.idType === "business_id" ? "Business ID" : value.idType === "individual_id" ? "Individual ID" : "Account Number",
7042
+ value: value.idValue,
7025
7043
  onChange: (e) => handleInputChange("idValue", e.target.value),
7026
- placeholder: `Enter ${formData.idType === "product_id" ? "product ID" : formData.idType === "business_id" ? "business ID" : formData.idType === "individual_id" ? "individual ID" : "account number"}`,
7044
+ placeholder: `Enter ${value.idType === "product_id" ? "product ID" : value.idType === "business_id" ? "business ID" : value.idType === "individual_id" ? "individual ID" : "account number"}`,
7027
7045
  required: true
7028
7046
  }
7029
7047
  )
@@ -7034,7 +7052,7 @@ var CounterpartyBasicInfo = ({ onDataChange }) => {
7034
7052
  {
7035
7053
  label: "Email",
7036
7054
  type: "email",
7037
- value: formData.email,
7055
+ value: value.email,
7038
7056
  onChange: (e) => handleInputChange("email", e.target.value),
7039
7057
  placeholder: "Enter email address"
7040
7058
  }
@@ -7044,7 +7062,7 @@ var CounterpartyBasicInfo = ({ onDataChange }) => {
7044
7062
  {
7045
7063
  label: "Phone Number",
7046
7064
  type: "tel",
7047
- value: formData.phone,
7065
+ value: value.phone,
7048
7066
  onChange: (e) => handleInputChange("phone", e.target.value),
7049
7067
  placeholder: "Enter phone number"
7050
7068
  }
@@ -7054,7 +7072,7 @@ var CounterpartyBasicInfo = ({ onDataChange }) => {
7054
7072
  {
7055
7073
  label: "Date of Birth",
7056
7074
  type: "date",
7057
- value: formData.dateOfBirth,
7075
+ value: value.dateOfBirth,
7058
7076
  onChange: (e) => handleInputChange("dateOfBirth", e.target.value),
7059
7077
  placeholder: "Select date of birth"
7060
7078
  }
@@ -7063,7 +7081,7 @@ var CounterpartyBasicInfo = ({ onDataChange }) => {
7063
7081
  EnhancedInput,
7064
7082
  {
7065
7083
  label: "ID Number",
7066
- value: formData.idNumber,
7084
+ value: value.idNumber,
7067
7085
  onChange: (e) => handleInputChange("idNumber", e.target.value),
7068
7086
  placeholder: "Enter ID number"
7069
7087
  }
@@ -11541,6 +11559,60 @@ var CounterpartyDetail = () => {
11541
11559
  const counterpartyDocuments = id ? mockBusinessDocuments[id] || [] : [];
11542
11560
  const [currentStatus, setCurrentStatus] = useState(counterparty?.status || "ACTIVE");
11543
11561
  const [isEditingProfile, setIsEditingProfile] = useState(false);
11562
+ const getInitialProfileData = () => {
11563
+ if (!counterparty) {
11564
+ return {
11565
+ idType: "product_id",
11566
+ idValue: "",
11567
+ email: "",
11568
+ phone: "",
11569
+ dateOfBirth: "",
11570
+ idNumber: "",
11571
+ address: {
11572
+ line1: "",
11573
+ line2: "",
11574
+ city: "",
11575
+ state: "",
11576
+ postalCode: "",
11577
+ countryCode: "US",
11578
+ type: ""
11579
+ }
11580
+ };
11581
+ }
11582
+ let idType = "product_id";
11583
+ let idValue = "";
11584
+ if (counterparty.productId) {
11585
+ idType = "product_id";
11586
+ idValue = counterparty.productId;
11587
+ } else if (counterparty.businessId) {
11588
+ idType = "business_id";
11589
+ idValue = counterparty.businessId;
11590
+ } else if (counterparty.individualId) {
11591
+ idType = "individual_id";
11592
+ idValue = counterparty.individualId;
11593
+ } else if (counterparty.accountNumber) {
11594
+ idType = "account_number";
11595
+ idValue = counterparty.accountNumber;
11596
+ }
11597
+ return {
11598
+ idType,
11599
+ idValue,
11600
+ email: "",
11601
+ phone: "",
11602
+ dateOfBirth: "",
11603
+ idNumber: "",
11604
+ address: {
11605
+ line1: "",
11606
+ line2: "",
11607
+ city: "",
11608
+ state: "",
11609
+ postalCode: "",
11610
+ countryCode: "US",
11611
+ type: ""
11612
+ }
11613
+ };
11614
+ };
11615
+ const [counterpartyProfileData, setCounterpartyProfileData] = useState(getInitialProfileData());
11544
11616
  const handleEntityClick = (entityType, entityId) => {
11545
11617
  switch (entityType) {
11546
11618
  case "business_id":
@@ -11560,6 +11632,9 @@ var CounterpartyDetail = () => {
11560
11632
  const handleToggleProfileEdit = () => {
11561
11633
  setIsEditingProfile(!isEditingProfile);
11562
11634
  };
11635
+ const handleProfileDataChange = (newData) => {
11636
+ setCounterpartyProfileData(newData);
11637
+ };
11563
11638
  const handleAddPaymentMethod = () => {
11564
11639
  console.log("Add payment method");
11565
11640
  };
@@ -11579,10 +11654,12 @@ var CounterpartyDetail = () => {
11579
11654
  counterpartyType: counterparty.type,
11580
11655
  currentStatus,
11581
11656
  isEditingProfile,
11657
+ counterpartyProfileData,
11582
11658
  mockPaymentMethods,
11583
11659
  documents: counterpartyDocuments,
11584
11660
  onStatusChange: handleStatusChange,
11585
11661
  onToggleProfileEdit: handleToggleProfileEdit,
11662
+ onProfileDataChange: handleProfileDataChange,
11586
11663
  onAddPaymentMethod: handleAddPaymentMethod,
11587
11664
  onAddDocument: handleAddDocument,
11588
11665
  onEntityClick: handleEntityClick
@@ -11591,6 +11668,7 @@ var CounterpartyDetail = () => {
11591
11668
  };
11592
11669
  var CounterpartyDetail_default = CounterpartyDetail;
11593
11670
  var CreateCounterpartyView = ({
11671
+ counterpartyData,
11594
11672
  paymentMethods,
11595
11673
  onPaymentMethodsChange,
11596
11674
  onBasicInfoChange,
@@ -11609,7 +11687,7 @@ var CreateCounterpartyView = ({
11609
11687
  children: /* @__PURE__ */ jsxs("div", { className: "space-y-6", children: [
11610
11688
  /* @__PURE__ */ jsxs(Card, { children: [
11611
11689
  /* @__PURE__ */ jsx(CardHeader, { children: /* @__PURE__ */ jsx(CardTitle, { children: "Basic Information" }) }),
11612
- /* @__PURE__ */ jsx(CardContent, { children: /* @__PURE__ */ jsx(CounterpartyBasicInfo, { onDataChange: onBasicInfoChange }) })
11690
+ /* @__PURE__ */ jsx(CardContent, { children: /* @__PURE__ */ jsx(CounterpartyBasicInfo, { value: counterpartyData, onDataChange: onBasicInfoChange }) })
11613
11691
  ] }),
11614
11692
  /* @__PURE__ */ jsxs(Card, { children: [
11615
11693
  /* @__PURE__ */ jsx(CardHeader, { children: /* @__PURE__ */ jsxs(CardTitle, { children: [
@@ -11639,7 +11717,16 @@ var CreateCounterpartyView = ({
11639
11717
  };
11640
11718
  var CreateCounterparty = () => {
11641
11719
  const navigate = useNavigate();
11642
- const [counterpartyData, setCounterpartyData] = useState(null);
11720
+ const [counterpartyData, setCounterpartyData] = useState({
11721
+ name: "",
11722
+ type: "business",
11723
+ email: "",
11724
+ phone: "",
11725
+ dateOfBirth: "",
11726
+ idNumber: "",
11727
+ idType: "product_id",
11728
+ idValue: ""
11729
+ });
11643
11730
  const [paymentMethods, setPaymentMethods] = useState([]);
11644
11731
  const handlePaymentMethodsChange = (methods) => {
11645
11732
  setPaymentMethods(methods);
@@ -11686,6 +11773,7 @@ var CreateCounterparty = () => {
11686
11773
  return /* @__PURE__ */ jsx(
11687
11774
  CreateCounterpartyView,
11688
11775
  {
11776
+ counterpartyData,
11689
11777
  paymentMethods,
11690
11778
  onPaymentMethodsChange: handlePaymentMethodsChange,
11691
11779
  onBasicInfoChange: handleBasicInfoChange,