braid-ui 1.0.6 → 1.0.7

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
@@ -5615,7 +5615,8 @@ var StatementView = ({
5615
5615
  onEdit,
5616
5616
  onDownloadCSV,
5617
5617
  onPrintPDF,
5618
- isGenerateDisabled
5618
+ isGenerateDisabled,
5619
+ isLoading
5619
5620
  }) => {
5620
5621
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "container mx-auto p-6 space-y-6", children: [
5621
5622
  /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
@@ -5722,12 +5723,15 @@ var StatementView = ({
5722
5723
  ] })
5723
5724
  ] })
5724
5725
  ] }),
5725
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-end", children: /* @__PURE__ */ jsxRuntime.jsx(
5726
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-end", children: /* @__PURE__ */ jsxRuntime.jsxs(
5726
5727
  Button,
5727
5728
  {
5728
5729
  onClick: onGenerateStatement,
5729
- disabled: isGenerateDisabled,
5730
- children: "Generate Statement"
5730
+ disabled: isGenerateDisabled || isLoading,
5731
+ children: [
5732
+ isLoading && /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "h-4 w-4 animate-spin" }),
5733
+ isLoading ? "Generating..." : "Generate Statement"
5734
+ ]
5731
5735
  }
5732
5736
  ) })
5733
5737
  ] })
@@ -8615,6 +8619,7 @@ function Statement() {
8615
8619
  const [startDate, setStartDate] = React15.useState();
8616
8620
  const [endDate, setEndDate] = React15.useState();
8617
8621
  const [statementGenerated, setStatementGenerated] = React15.useState(false);
8622
+ const [isLoading, setIsLoading] = React15.useState(false);
8618
8623
  const [programs] = React15.useState(mockPrograms);
8619
8624
  const [products] = React15.useState(mockProducts);
8620
8625
  const [statementHeader, setStatementHeader] = React15.useState(null);
@@ -8625,22 +8630,28 @@ function Statement() {
8625
8630
  setSelectedProduct("");
8626
8631
  setAccountNumber("");
8627
8632
  };
8628
- const handleGenerateStatement = () => {
8633
+ const handleGenerateStatement = async () => {
8629
8634
  if (!statementType || !startDate || !endDate) return;
8630
8635
  if (statementType === "program" && !selectedProgram) return;
8631
8636
  if (statementType === "product" && !selectedProduct) return;
8632
8637
  if (statementType === "account" && !accountNumber) return;
8633
- console.log("Generating statement with:", {
8634
- statementType,
8635
- selectedProgram,
8636
- selectedProduct,
8637
- accountNumber,
8638
- startDate,
8639
- endDate
8640
- });
8641
- setStatementHeader(mockStatementHeader);
8642
- setStatementTransactions(mockStatementTransactions);
8643
- setStatementGenerated(true);
8638
+ setIsLoading(true);
8639
+ try {
8640
+ console.log("Generating statement with:", {
8641
+ statementType,
8642
+ selectedProgram,
8643
+ selectedProduct,
8644
+ accountNumber,
8645
+ startDate,
8646
+ endDate
8647
+ });
8648
+ await new Promise((resolve) => setTimeout(resolve, 1e3));
8649
+ setStatementHeader(mockStatementHeader);
8650
+ setStatementTransactions(mockStatementTransactions);
8651
+ setStatementGenerated(true);
8652
+ } finally {
8653
+ setIsLoading(false);
8654
+ }
8644
8655
  };
8645
8656
  const isGenerateDisabled = () => {
8646
8657
  if (!statementType || !startDate || !endDate) return true;
@@ -8682,7 +8693,8 @@ function Statement() {
8682
8693
  onEdit: handleEdit,
8683
8694
  onDownloadCSV: handleDownloadCSV,
8684
8695
  onPrintPDF: handlePrintPDF,
8685
- isGenerateDisabled: isGenerateDisabled()
8696
+ isGenerateDisabled: isGenerateDisabled(),
8697
+ isLoading
8686
8698
  }
8687
8699
  );
8688
8700
  }