braid-ui 1.0.40 → 1.0.41

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
@@ -5807,9 +5807,9 @@ var CounterpartyProfileCard = ({
5807
5807
  isEditing = false,
5808
5808
  onToggleEdit,
5809
5809
  hideActions = false,
5810
- className
5810
+ className,
5811
+ onEntityClick
5811
5812
  }) => {
5812
- const navigate = reactRouterDom.useNavigate();
5813
5813
  const form = useFormWithEditState({
5814
5814
  schema: counterpartyDetailSchema,
5815
5815
  defaultValues: { ...defaultCounterpartyDetail, ...data },
@@ -5932,20 +5932,6 @@ var CounterpartyProfileCard = ({
5932
5932
  ] }) });
5933
5933
  const formValues = form.watch();
5934
5934
  const idTypeLabel = formValues?.idType === "product_id" ? "Product ID" : formValues?.idType === "business_id" ? "Business ID" : formValues?.idType === "individual_id" ? "Individual ID" : "Account Number";
5935
- const getEntityLink = () => {
5936
- if (!formValues?.idValue) return null;
5937
- switch (formValues?.idType) {
5938
- case "business_id":
5939
- return `/business/${formValues.idValue}`;
5940
- case "individual_id":
5941
- return `/individual/${formValues.idValue}`;
5942
- case "account_number":
5943
- return `/account/${formValues.idValue}`;
5944
- default:
5945
- return null;
5946
- }
5947
- };
5948
- const entityLink = getEntityLink();
5949
5935
  const viewContent = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-3", children: [
5950
5936
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
5951
5937
  /* @__PURE__ */ jsxRuntime.jsx(InfoField, { label: "Associated with", value: formValues?.idType === "product_id" ? "Product ID" : formValues?.idType === "business_id" ? "Business ID" : formValues?.idType === "individual_id" ? "Individual ID" : "Account Number", layout: "horizontal" }),
@@ -5953,12 +5939,12 @@ var CounterpartyProfileCard = ({
5953
5939
  InfoField,
5954
5940
  {
5955
5941
  label: idTypeLabel,
5956
- value: entityLink ? /* @__PURE__ */ jsxRuntime.jsx(
5942
+ value: formValues?.idValue && formValues?.idType && onEntityClick ? /* @__PURE__ */ jsxRuntime.jsx(
5957
5943
  "button",
5958
5944
  {
5959
5945
  onClick: (e) => {
5960
5946
  e.preventDefault();
5961
- navigate(entityLink);
5947
+ onEntityClick(formValues.idType, formValues.idValue);
5962
5948
  },
5963
5949
  className: "text-primary hover:underline font-medium text-left cursor-pointer",
5964
5950
  children: formValues?.idValue || "-"
@@ -6188,12 +6174,41 @@ var CounterpartyDetailView = ({
6188
6174
  currentStatus,
6189
6175
  isEditingProfile,
6190
6176
  mockPaymentMethods: mockPaymentMethods2,
6191
- documentsTable,
6177
+ documents,
6192
6178
  onStatusChange,
6193
6179
  onToggleProfileEdit,
6194
6180
  onAddPaymentMethod,
6195
- onAddDocument
6181
+ onAddDocument,
6182
+ onEntityClick
6196
6183
  }) => {
6184
+ const documentColumns = [
6185
+ {
6186
+ key: "name",
6187
+ title: "Document Name",
6188
+ sortable: true,
6189
+ width: "40%"
6190
+ },
6191
+ {
6192
+ key: "type",
6193
+ title: "Type",
6194
+ sortable: true,
6195
+ width: "20%"
6196
+ },
6197
+ {
6198
+ key: "uploadedDate",
6199
+ title: "Uploaded",
6200
+ sortable: true,
6201
+ width: "20%"
6202
+ },
6203
+ {
6204
+ key: "status",
6205
+ title: "Status",
6206
+ sortable: true,
6207
+ width: "20%",
6208
+ align: "right",
6209
+ render: (value) => /* @__PURE__ */ jsxRuntime.jsx("span", { className: "capitalize", children: value })
6210
+ }
6211
+ ];
6197
6212
  return /* @__PURE__ */ jsxRuntime.jsx(
6198
6213
  PageLayout,
6199
6214
  {
@@ -6224,7 +6239,8 @@ var CounterpartyDetailView = ({
6224
6239
  CounterpartyProfileCard,
6225
6240
  {
6226
6241
  isEditing: isEditingProfile,
6227
- onToggleEdit: onToggleProfileEdit
6242
+ onToggleEdit: onToggleProfileEdit,
6243
+ onEntityClick
6228
6244
  }
6229
6245
  ),
6230
6246
  /* @__PURE__ */ jsxRuntime.jsxs(Card, { children: [
@@ -6248,7 +6264,16 @@ var CounterpartyDetailView = ({
6248
6264
  "Document"
6249
6265
  ] })
6250
6266
  ] }),
6251
- /* @__PURE__ */ jsxRuntime.jsx(CardContent, { children: documentsTable })
6267
+ /* @__PURE__ */ jsxRuntime.jsx(CardContent, { children: documents.length === 0 ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-center gap-2 py-4 text-sm text-muted-foreground", children: [
6268
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.FileText, { className: "h-5 w-5 opacity-50" }),
6269
+ /* @__PURE__ */ jsxRuntime.jsx("p", { children: "No documents found" })
6270
+ ] }) : /* @__PURE__ */ jsxRuntime.jsx(
6271
+ DataTable,
6272
+ {
6273
+ columns: documentColumns,
6274
+ data: documents
6275
+ }
6276
+ ) })
6252
6277
  ] })
6253
6278
  ] }),
6254
6279
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "lg:w-64", children: /* @__PURE__ */ jsxRuntime.jsx(CounterpartyStatusCard, { isEditing: false, onToggleEdit: () => {
@@ -11541,39 +11566,24 @@ var mockPaymentMethods = [
11541
11566
  ];
11542
11567
  var CounterpartyDetail = () => {
11543
11568
  const { id } = reactRouterDom.useParams();
11544
- reactRouterDom.useNavigate();
11569
+ const navigate = reactRouterDom.useNavigate();
11545
11570
  const counterparty = mockCounterpartiesList.find((c) => c.id === id);
11546
11571
  const counterpartyDocuments = id ? mockBusinessDocuments[id] || [] : [];
11547
11572
  const [currentStatus, setCurrentStatus] = React15.useState(counterparty?.status || "ACTIVE");
11548
11573
  const [isEditingProfile, setIsEditingProfile] = React15.useState(false);
11549
- const documentColumns = [
11550
- {
11551
- key: "name",
11552
- title: "Document Name",
11553
- sortable: true,
11554
- width: "40%"
11555
- },
11556
- {
11557
- key: "type",
11558
- title: "Type",
11559
- sortable: true,
11560
- width: "20%"
11561
- },
11562
- {
11563
- key: "uploadedDate",
11564
- title: "Uploaded",
11565
- sortable: true,
11566
- width: "20%"
11567
- },
11568
- {
11569
- key: "status",
11570
- title: "Status",
11571
- sortable: true,
11572
- width: "20%",
11573
- align: "right",
11574
- render: (value) => /* @__PURE__ */ jsxRuntime.jsx("span", { className: "capitalize", children: value })
11574
+ const handleEntityClick = (entityType, entityId) => {
11575
+ switch (entityType) {
11576
+ case "business_id":
11577
+ navigate(`/business/${entityId}`);
11578
+ break;
11579
+ case "individual_id":
11580
+ navigate(`/individual/${entityId}`);
11581
+ break;
11582
+ case "account_number":
11583
+ navigate(`/account/${entityId}`);
11584
+ break;
11575
11585
  }
11576
- ];
11586
+ };
11577
11587
  const handleStatusChange = (newStatus) => {
11578
11588
  setCurrentStatus(newStatus);
11579
11589
  };
@@ -11586,21 +11596,6 @@ var CounterpartyDetail = () => {
11586
11596
  const handleAddDocument = () => {
11587
11597
  console.log("Add document");
11588
11598
  };
11589
- const documentsTable = React15.useMemo(() => {
11590
- if (counterpartyDocuments.length === 0) {
11591
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-center gap-2 py-4 text-sm text-muted-foreground", children: [
11592
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.FileText, { className: "h-5 w-5 opacity-50" }),
11593
- /* @__PURE__ */ jsxRuntime.jsx("p", { children: "No documents found" })
11594
- ] });
11595
- }
11596
- return /* @__PURE__ */ jsxRuntime.jsx(
11597
- DataTable,
11598
- {
11599
- columns: documentColumns,
11600
- data: counterpartyDocuments
11601
- }
11602
- );
11603
- }, [counterpartyDocuments, documentColumns]);
11604
11599
  if (!counterparty) {
11605
11600
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "container mx-auto px-4 py-8", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-center", children: [
11606
11601
  /* @__PURE__ */ jsxRuntime.jsx("h1", { className: "text-2xl font-bold mb-2", children: "Counterparty Not Found" }),
@@ -11615,11 +11610,12 @@ var CounterpartyDetail = () => {
11615
11610
  currentStatus,
11616
11611
  isEditingProfile,
11617
11612
  mockPaymentMethods,
11618
- documentsTable,
11613
+ documents: counterpartyDocuments,
11619
11614
  onStatusChange: handleStatusChange,
11620
11615
  onToggleProfileEdit: handleToggleProfileEdit,
11621
11616
  onAddPaymentMethod: handleAddPaymentMethod,
11622
- onAddDocument: handleAddDocument
11617
+ onAddDocument: handleAddDocument,
11618
+ onEntityClick: handleEntityClick
11623
11619
  }
11624
11620
  );
11625
11621
  };