@wealthx/shadcn 1.5.12 → 1.5.14

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.
Files changed (40) hide show
  1. package/.turbo/turbo-build.log +79 -79
  2. package/CHANGELOG.md +12 -0
  3. package/dist/{chunk-TC43SMIN.mjs → chunk-7N6O3VPJ.mjs} +6 -6
  4. package/dist/{chunk-CPM6P63C.mjs → chunk-GMF7INNS.mjs} +59 -30
  5. package/dist/chunk-KICT4VQL.mjs +508 -0
  6. package/dist/{chunk-BXL74CM2.mjs → chunk-UXWNUMQA.mjs} +4 -4
  7. package/dist/chunk-V23CBULF.mjs +432 -0
  8. package/dist/components/ui/appointment-calendar-view.js +177 -176
  9. package/dist/components/ui/appointment-calendar-view.mjs +1 -1
  10. package/dist/components/ui/bank-statement-document-table.js +6 -6
  11. package/dist/components/ui/bank-statement-document-table.mjs +1 -1
  12. package/dist/components/ui/bank-statement-generate-dialog.js +164 -77
  13. package/dist/components/ui/bank-statement-generate-dialog.mjs +2 -1
  14. package/dist/components/ui/bank-statement-pdf-viewer.js +4 -4
  15. package/dist/components/ui/bank-statement-pdf-viewer.mjs +1 -1
  16. package/dist/components/ui/resource-center/index.js +1030 -0
  17. package/dist/components/ui/resource-center/index.mjs +29 -0
  18. package/dist/index.js +556 -380
  19. package/dist/index.mjs +17 -15
  20. package/dist/styles.css +1 -1
  21. package/package.json +4 -4
  22. package/src/components/index.tsx +2 -0
  23. package/src/components/ui/appointment-calendar-view.tsx +211 -199
  24. package/src/components/ui/bank-statement-document-table.tsx +12 -6
  25. package/src/components/ui/bank-statement-generate-dialog.tsx +125 -97
  26. package/src/components/ui/bank-statement-pdf-viewer.tsx +4 -4
  27. package/src/components/ui/resource-center/index.tsx +35 -0
  28. package/src/components/ui/resource-center/resource-cards.tsx +218 -0
  29. package/src/components/ui/resource-center/resource-carousel.tsx +122 -0
  30. package/src/components/ui/resource-center/resource-center-header.tsx +95 -0
  31. package/src/components/ui/resource-center/resource-email-editor-dialog.tsx +131 -0
  32. package/src/components/ui/resource-center/resource-modal.tsx +76 -0
  33. package/src/components/ui/resource-center/types.ts +81 -0
  34. package/src/styles/styles-css.ts +1 -1
  35. package/tsup.config.ts +1 -1
  36. package/dist/chunk-IODGRCQG.mjs +0 -438
  37. package/dist/chunk-XYWEGBAA.mjs +0 -348
  38. package/dist/components/ui/resource-center.js +0 -748
  39. package/dist/components/ui/resource-center.mjs +0 -24
  40. package/src/components/ui/resource-center.tsx +0 -539
@@ -2,6 +2,9 @@ import {
2
2
  Field,
3
3
  FieldLabel
4
4
  } from "./chunk-MUV4EGDW.mjs";
5
+ import {
6
+ PaginationNavButtons
7
+ } from "./chunk-SSUK6C2K.mjs";
5
8
  import {
6
9
  Table,
7
10
  TableBody,
@@ -47,11 +50,12 @@ import {
47
50
  // src/components/ui/bank-statement-generate-dialog.tsx
48
51
  import { useEffect, useMemo, useState } from "react";
49
52
  import { format, parseISO, subDays } from "date-fns";
50
- import { jsx, jsxs } from "react/jsx-runtime";
53
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
51
54
  var APPLICANT_TYPE_LABELS = {
52
55
  primary: "Main applicant",
53
56
  secondary: "Co-applicant"
54
57
  };
58
+ var ACCOUNTS_PAGE_SIZE = 5;
55
59
  function toIsoDate(date) {
56
60
  return date.toISOString().slice(0, 10);
57
61
  }
@@ -81,25 +85,31 @@ function BankStatementGenerateDialog({
81
85
  const [toDate, setToDate] = useState(() => presetToDateRange(90).to);
82
86
  const [applicantType, setApplicantType] = useState("");
83
87
  const [selectedAccountIds, setSelectedAccountIds] = useState([]);
88
+ const [accountPage, setAccountPage] = useState(1);
84
89
  useEffect(() => {
85
90
  if (!open) return;
86
91
  const timer = setTimeout(() => {
87
- setStatementName("Bank Statement 1");
88
- setApplicantType("");
89
- setSelectedAccountIds([]);
90
92
  const { from, to } = presetToDateRange(90);
93
+ setStatementName("Bank Statement 1");
91
94
  setRangePreset(90);
92
95
  setFromDate(from);
93
96
  setToDate(to);
97
+ setApplicantType("");
98
+ setSelectedAccountIds([]);
99
+ setAccountPage(1);
94
100
  }, 0);
95
101
  return () => clearTimeout(timer);
96
102
  }, [open]);
97
103
  const handleApplicantTypeChange = (type) => {
98
104
  setApplicantType(type);
99
105
  setSelectedAccountIds([]);
106
+ setAccountPage(1);
100
107
  onApplicantTypeChange == null ? void 0 : onApplicantTypeChange(type);
101
108
  };
102
- const applyPreset = (preset) => {
109
+ const handlePresetChange = (val) => {
110
+ if (val.length === 0) return;
111
+ const raw = val[0];
112
+ const preset = raw === "custom" ? "custom" : Number(raw);
103
113
  setRangePreset(preset);
104
114
  if (preset !== "custom") {
105
115
  const { from, to } = presetToDateRange(preset);
@@ -107,11 +117,6 @@ function BankStatementGenerateDialog({
107
117
  setToDate(to);
108
118
  }
109
119
  };
110
- const handlePresetChange = (val) => {
111
- if (val.length === 0) return;
112
- const raw = val[0];
113
- applyPreset(raw === "custom" ? "custom" : Number(raw));
114
- };
115
120
  const areAllSelected = bankAccounts.length > 0 && selectedAccountIds.length === bankAccounts.length;
116
121
  const isSomeSelected = selectedAccountIds.length > 0 && !areAllSelected;
117
122
  const handleToggleAccount = (id) => {
@@ -120,12 +125,13 @@ function BankStatementGenerateDialog({
120
125
  );
121
126
  };
122
127
  const handleToggleAll = () => {
123
- if (areAllSelected) {
124
- setSelectedAccountIds([]);
125
- } else {
126
- setSelectedAccountIds(bankAccounts.map((a) => a.id));
127
- }
128
+ setSelectedAccountIds(areAllSelected ? [] : bankAccounts.map((a) => a.id));
128
129
  };
130
+ const accountPageCount = Math.ceil(bankAccounts.length / ACCOUNTS_PAGE_SIZE);
131
+ const pagedAccounts = bankAccounts.slice(
132
+ (accountPage - 1) * ACCOUNTS_PAGE_SIZE,
133
+ accountPage * ACCOUNTS_PAGE_SIZE
134
+ );
129
135
  const periodLabel = useMemo(() => {
130
136
  if (fromDate && toDate) {
131
137
  return `${format(parseISO(fromDate), "dd MMM yyyy")} \u2013 ${format(parseISO(toDate), "dd MMM yyyy")}`;
@@ -218,10 +224,8 @@ function BankStatementGenerateDialog({
218
224
  ]
219
225
  }
220
226
  ),
221
- applicantType && /* @__PURE__ */ jsxs("div", { className: "mt-1", children: [
222
- isLoadingAccounts && /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center p-6", children: /* @__PURE__ */ jsx(Spinner, { size: "lg" }) }),
223
- !isLoadingAccounts && bankAccounts.length === 0 && /* @__PURE__ */ jsx("p", { className: "py-4 text-center text-body-medium text-muted-foreground", children: "No bank accounts found for the selected applicant" }),
224
- !isLoadingAccounts && bankAccounts.length > 0 && /* @__PURE__ */ jsxs(Table, { children: [
227
+ applicantType && /* @__PURE__ */ jsx("div", { className: "mt-1", children: isLoadingAccounts ? /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center p-6", children: /* @__PURE__ */ jsx(Spinner, { size: "lg" }) }) : bankAccounts.length === 0 ? /* @__PURE__ */ jsx("p", { className: "py-4 text-center text-body-medium text-muted-foreground", children: "No bank accounts found for the selected applicant" }) : /* @__PURE__ */ jsxs(Fragment, { children: [
228
+ /* @__PURE__ */ jsxs(Table, { className: "table-fixed", children: [
225
229
  /* @__PURE__ */ jsx(TableHeader, { children: /* @__PURE__ */ jsxs(TableRow, { children: [
226
230
  /* @__PURE__ */ jsx(TableHead, { className: "w-10", children: /* @__PURE__ */ jsx(
227
231
  Checkbox,
@@ -233,11 +237,11 @@ function BankStatementGenerateDialog({
233
237
  }
234
238
  ) }),
235
239
  /* @__PURE__ */ jsx(TableHead, { children: "Account Name" }),
236
- /* @__PURE__ */ jsx(TableHead, { children: "Account Number" }),
237
- /* @__PURE__ */ jsx(TableHead, { children: "Period" }),
238
- /* @__PURE__ */ jsx(TableHead, { children: "Last Updated" })
240
+ /* @__PURE__ */ jsx(TableHead, { className: "w-40", children: "Account Number" }),
241
+ /* @__PURE__ */ jsx(TableHead, { className: "w-52", children: "Period" }),
242
+ /* @__PURE__ */ jsx(TableHead, { className: "w-28", children: "Last Updated" })
239
243
  ] }) }),
240
- /* @__PURE__ */ jsx(TableBody, { children: bankAccounts.map((account) => {
244
+ /* @__PURE__ */ jsx(TableBody, { children: pagedAccounts.map((account) => {
241
245
  var _a, _b;
242
246
  const isSelected = selectedAccountIds.includes(
243
247
  account.id
@@ -255,20 +259,20 @@ function BankStatementGenerateDialog({
255
259
  "aria-label": `Select ${account.name}`
256
260
  }
257
261
  ) }),
258
- /* @__PURE__ */ jsx(TableCell, { children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
262
+ /* @__PURE__ */ jsx(TableCell, { children: /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 items-center gap-2", children: [
259
263
  account.institutionLogo && /* @__PURE__ */ jsx(
260
264
  "img",
261
265
  {
262
266
  src: account.institutionLogo,
263
267
  alt: (_a = account.institutionName) != null ? _a : "",
264
- className: "size-8 object-cover"
268
+ className: "size-8 shrink-0 object-cover"
265
269
  }
266
270
  ),
267
- /* @__PURE__ */ jsx("span", { className: "text-body-medium font-semibold", children: account.name || account.institutionName || "\u2014" })
271
+ /* @__PURE__ */ jsx("span", { className: "truncate text-body-medium font-semibold", children: account.name || account.institutionName || "\u2014" })
268
272
  ] }) }),
269
- /* @__PURE__ */ jsx(TableCell, { children: /* @__PURE__ */ jsx("span", { className: "text-body-medium", children: (_b = account.accountNo) != null ? _b : "\u2014" }) }),
270
- /* @__PURE__ */ jsx(TableCell, { children: /* @__PURE__ */ jsx("span", { className: "text-body-medium", children: periodLabel }) }),
271
- /* @__PURE__ */ jsx(TableCell, { children: /* @__PURE__ */ jsx("span", { className: "text-body-medium", children: account.lastUpdated ? format(
273
+ /* @__PURE__ */ jsx(TableCell, { children: /* @__PURE__ */ jsx("span", { className: "truncate text-body-medium", children: (_b = account.accountNo) != null ? _b : "\u2014" }) }),
274
+ /* @__PURE__ */ jsx(TableCell, { children: /* @__PURE__ */ jsx("span", { className: "truncate text-body-medium", children: periodLabel }) }),
275
+ /* @__PURE__ */ jsx(TableCell, { children: /* @__PURE__ */ jsx("span", { className: "truncate text-body-medium", children: account.lastUpdated ? format(
272
276
  parseISO(account.lastUpdated),
273
277
  "dd MMM yyyy"
274
278
  ) : "\u2014" }) })
@@ -277,8 +281,33 @@ function BankStatementGenerateDialog({
277
281
  account.id
278
282
  );
279
283
  }) })
284
+ ] }),
285
+ accountPageCount > 1 && /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between pt-2", children: [
286
+ /* @__PURE__ */ jsxs("span", { className: "text-body-small text-muted-foreground", children: [
287
+ (accountPage - 1) * ACCOUNTS_PAGE_SIZE + 1,
288
+ "\u2013",
289
+ Math.min(
290
+ accountPage * ACCOUNTS_PAGE_SIZE,
291
+ bankAccounts.length
292
+ ),
293
+ " ",
294
+ "of ",
295
+ bankAccounts.length,
296
+ " accounts"
297
+ ] }),
298
+ /* @__PURE__ */ jsx(
299
+ PaginationNavButtons,
300
+ {
301
+ hasPrev: accountPage > 1,
302
+ hasNext: accountPage < accountPageCount,
303
+ onFirst: () => setAccountPage(1),
304
+ onPrev: () => setAccountPage((p) => p - 1),
305
+ onNext: () => setAccountPage((p) => p + 1),
306
+ onLast: () => setAccountPage(accountPageCount)
307
+ }
308
+ )
280
309
  ] })
281
- ] })
310
+ ] }) })
282
311
  ] }),
283
312
  /* @__PURE__ */ jsxs(DialogFooter, { children: [
284
313
  /* @__PURE__ */ jsx(Button, { variant: "ghost", onClick: onClose, children: "Cancel" }),