@wealthx/shadcn 1.5.12 → 1.5.13

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 (32) hide show
  1. package/.turbo/turbo-build.log +74 -74
  2. package/CHANGELOG.md +6 -0
  3. package/dist/{chunk-CPM6P63C.mjs → chunk-BF5FKUF6.mjs} +53 -24
  4. package/dist/chunk-KICT4VQL.mjs +508 -0
  5. package/dist/chunk-V23CBULF.mjs +432 -0
  6. package/dist/components/ui/appointment-calendar-view.js +177 -176
  7. package/dist/components/ui/appointment-calendar-view.mjs +1 -1
  8. package/dist/components/ui/bank-statement-generate-dialog.js +163 -76
  9. package/dist/components/ui/bank-statement-generate-dialog.mjs +2 -1
  10. package/dist/components/ui/resource-center/index.js +1030 -0
  11. package/dist/components/ui/resource-center/index.mjs +29 -0
  12. package/dist/index.js +540 -364
  13. package/dist/index.mjs +15 -13
  14. package/dist/styles.css +1 -1
  15. package/package.json +4 -4
  16. package/src/components/index.tsx +2 -0
  17. package/src/components/ui/appointment-calendar-view.tsx +211 -199
  18. package/src/components/ui/bank-statement-generate-dialog.tsx +125 -97
  19. package/src/components/ui/resource-center/index.tsx +35 -0
  20. package/src/components/ui/resource-center/resource-cards.tsx +218 -0
  21. package/src/components/ui/resource-center/resource-carousel.tsx +122 -0
  22. package/src/components/ui/resource-center/resource-center-header.tsx +95 -0
  23. package/src/components/ui/resource-center/resource-email-editor-dialog.tsx +131 -0
  24. package/src/components/ui/resource-center/resource-modal.tsx +76 -0
  25. package/src/components/ui/resource-center/types.ts +81 -0
  26. package/src/styles/styles-css.ts +1 -1
  27. package/tsup.config.ts +1 -1
  28. package/dist/chunk-IODGRCQG.mjs +0 -438
  29. package/dist/chunk-XYWEGBAA.mjs +0 -348
  30. package/dist/components/ui/resource-center.js +0 -748
  31. package/dist/components/ui/resource-center.mjs +0 -24
  32. 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
@@ -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" }),
@@ -0,0 +1,508 @@
1
+ import {
2
+ Dialog,
3
+ DialogContent,
4
+ DialogHeader,
5
+ DialogTitle
6
+ } from "./chunk-LI2CTS5O.mjs";
7
+ import {
8
+ Badge
9
+ } from "./chunk-X6RC5UWB.mjs";
10
+ import {
11
+ ToggleGroup,
12
+ ToggleGroupItem
13
+ } from "./chunk-OWFQSXVD.mjs";
14
+ import {
15
+ Input
16
+ } from "./chunk-LBTHZSBT.mjs";
17
+ import {
18
+ Button
19
+ } from "./chunk-NOOEKOWY.mjs";
20
+ import {
21
+ cn
22
+ } from "./chunk-AFML43VJ.mjs";
23
+
24
+ // src/components/ui/resource-center/resource-carousel.tsx
25
+ import { useRef, useState } from "react";
26
+ import {
27
+ ChevronLeft,
28
+ ChevronRight,
29
+ GalleryHorizontal,
30
+ LayoutGrid
31
+ } from "lucide-react";
32
+ import { jsx, jsxs } from "react/jsx-runtime";
33
+ function ResourceCarousel({
34
+ title,
35
+ items,
36
+ headerAction,
37
+ onViewModeChange,
38
+ className
39
+ }) {
40
+ const scrollRef = useRef(null);
41
+ const [viewMode, setViewMode] = useState("compact");
42
+ function scrollLeft() {
43
+ var _a;
44
+ (_a = scrollRef.current) == null ? void 0 : _a.scrollBy({ left: -380, behavior: "smooth" });
45
+ }
46
+ function scrollRight() {
47
+ var _a;
48
+ (_a = scrollRef.current) == null ? void 0 : _a.scrollBy({ left: 380, behavior: "smooth" });
49
+ }
50
+ return /* @__PURE__ */ jsxs("div", { className: cn("flex flex-col gap-4", className), children: [
51
+ (title || headerAction) && /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-4", children: [
52
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-1 items-center gap-4 min-w-0", children: [
53
+ title && /* @__PURE__ */ jsx("h2", { className: "text-h3 text-foreground", children: title }),
54
+ headerAction && /* @__PURE__ */ jsx("div", { className: "flex-1 flex justify-end", children: headerAction })
55
+ ] }),
56
+ /* @__PURE__ */ jsxs(
57
+ ToggleGroup,
58
+ {
59
+ type: "single",
60
+ variant: "outline",
61
+ value: [viewMode],
62
+ onValueChange: (v) => {
63
+ if (v.length > 0) {
64
+ const mode = v[0];
65
+ setViewMode(mode);
66
+ onViewModeChange == null ? void 0 : onViewModeChange(mode);
67
+ }
68
+ },
69
+ "aria-label": "View mode",
70
+ children: [
71
+ /* @__PURE__ */ jsx(ToggleGroupItem, { value: "compact", "aria-label": "Compact view", children: /* @__PURE__ */ jsx(GalleryHorizontal, { className: "size-4" }) }),
72
+ /* @__PURE__ */ jsx(ToggleGroupItem, { value: "grid", "aria-label": "Grid view", children: /* @__PURE__ */ jsx(LayoutGrid, { className: "size-4" }) })
73
+ ]
74
+ }
75
+ )
76
+ ] }),
77
+ items.length === 0 ? /* @__PURE__ */ jsx("p", { className: "py-8 text-center text-body-small text-muted-foreground", children: "No items available" }) : viewMode === "grid" ? /* @__PURE__ */ jsx("div", { className: "grid grid-cols-4 gap-6 max-[1280px]:grid-cols-3 max-[900px]:grid-cols-2 max-[600px]:grid-cols-1", children: items.map((item, i) => /* @__PURE__ */ jsx("div", { children: item }, i)) }) : /* @__PURE__ */ jsxs("div", { className: "group/track relative", children: [
78
+ /* @__PURE__ */ jsx(
79
+ "button",
80
+ {
81
+ type: "button",
82
+ onClick: scrollLeft,
83
+ "aria-label": "Scroll left",
84
+ className: cn(
85
+ "absolute left-0 top-1/2 z-10 -translate-x-1/2 -translate-y-1/2",
86
+ "flex size-9 items-center justify-center",
87
+ "border border-border bg-background shadow-sm",
88
+ "opacity-0 transition-opacity duration-200 group-hover/track:opacity-100",
89
+ "hover:bg-muted focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
90
+ ),
91
+ children: /* @__PURE__ */ jsx(ChevronLeft, { className: "size-4 text-foreground" })
92
+ }
93
+ ),
94
+ /* @__PURE__ */ jsx(
95
+ "div",
96
+ {
97
+ ref: scrollRef,
98
+ className: "flex gap-4 overflow-x-auto scroll-smooth pb-2",
99
+ style: { scrollbarWidth: "none" },
100
+ children: items.map((item, i) => /* @__PURE__ */ jsx("div", { className: "w-[360px] shrink-0", children: item }, i))
101
+ }
102
+ ),
103
+ /* @__PURE__ */ jsx(
104
+ "button",
105
+ {
106
+ type: "button",
107
+ onClick: scrollRight,
108
+ "aria-label": "Scroll right",
109
+ className: cn(
110
+ "absolute right-0 top-1/2 z-10 translate-x-1/2 -translate-y-1/2",
111
+ "flex size-9 items-center justify-center",
112
+ "border border-border bg-background shadow-sm",
113
+ "opacity-0 transition-opacity duration-200 group-hover/track:opacity-100",
114
+ "hover:bg-muted focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
115
+ ),
116
+ children: /* @__PURE__ */ jsx(ChevronRight, { className: "size-4 text-foreground" })
117
+ }
118
+ )
119
+ ] })
120
+ ] });
121
+ }
122
+
123
+ // src/components/ui/resource-center/resource-center-header.tsx
124
+ import { useState as useState2 } from "react";
125
+ import { Play } from "lucide-react";
126
+
127
+ // src/components/ui/resource-center/resource-modal.tsx
128
+ import { Download } from "lucide-react";
129
+ import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
130
+ function ResourceModal({
131
+ open,
132
+ onClose,
133
+ title,
134
+ videoUrl,
135
+ tags,
136
+ attachments
137
+ }) {
138
+ return /* @__PURE__ */ jsx2(Dialog, { open, onOpenChange: (v) => !v && onClose(), children: /* @__PURE__ */ jsxs2(
139
+ DialogContent,
140
+ {
141
+ size: "2xl",
142
+ className: "flex flex-col gap-4 p-0 overflow-hidden",
143
+ children: [
144
+ /* @__PURE__ */ jsxs2(DialogHeader, { className: "px-6 pt-6 pb-0", children: [
145
+ /* @__PURE__ */ jsx2(DialogTitle, { className: "text-h5", children: title }),
146
+ tags && tags.length > 0 && /* @__PURE__ */ jsx2("div", { className: "flex flex-wrap gap-1.5 pt-1", children: tags.map((tag) => /* @__PURE__ */ jsx2(Badge, { variant: "secondary", children: tag }, tag)) })
147
+ ] }),
148
+ videoUrl && /* @__PURE__ */ jsx2("div", { className: "aspect-video w-full bg-foreground", children: /* @__PURE__ */ jsx2(
149
+ "iframe",
150
+ {
151
+ src: videoUrl,
152
+ title,
153
+ className: "h-full w-full",
154
+ allow: "accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",
155
+ allowFullScreen: true
156
+ }
157
+ ) }),
158
+ attachments && attachments.length > 0 && /* @__PURE__ */ jsxs2("div", { className: "flex flex-col gap-2 px-6 pb-6", children: [
159
+ /* @__PURE__ */ jsx2("p", { className: "text-body-small font-medium text-foreground", children: "Attachments" }),
160
+ /* @__PURE__ */ jsx2("div", { className: "flex flex-col gap-1", children: attachments.map((attachment, i) => /* @__PURE__ */ jsxs2(
161
+ "a",
162
+ {
163
+ href: attachment.url,
164
+ download: true,
165
+ className: "flex items-center gap-2 text-body-small text-primary hover:underline",
166
+ children: [
167
+ /* @__PURE__ */ jsx2(Download, { className: "size-3.5 shrink-0" }),
168
+ attachment.name
169
+ ]
170
+ },
171
+ i
172
+ )) })
173
+ ] }),
174
+ (!attachments || attachments.length === 0) && /* @__PURE__ */ jsx2("div", { className: "pb-2" })
175
+ ]
176
+ }
177
+ ) });
178
+ }
179
+
180
+ // src/components/ui/resource-center/resource-center-header.tsx
181
+ import { Fragment, jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
182
+ function ResourceCenterHeader({
183
+ title,
184
+ description,
185
+ backgroundImageUrl,
186
+ backgroundVideoUrl,
187
+ watchVideoUrl
188
+ }) {
189
+ const [watchModalOpen, setWatchModalOpen] = useState2(false);
190
+ const hasBackground = !!backgroundImageUrl || !!backgroundVideoUrl;
191
+ return /* @__PURE__ */ jsxs3(Fragment, { children: [
192
+ /* @__PURE__ */ jsxs3(
193
+ "div",
194
+ {
195
+ className: cn(
196
+ "relative flex min-h-[480px] w-full items-center overflow-hidden max-[900px]:min-h-[360px] max-[600px]:min-h-[260px]"
197
+ ),
198
+ children: [
199
+ /* @__PURE__ */ jsx3(
200
+ "div",
201
+ {
202
+ className: cn(
203
+ "absolute inset-0 z-[0]",
204
+ hasBackground ? "bg-foreground" : "bg-gradient-to-br from-primary to-foreground"
205
+ )
206
+ }
207
+ ),
208
+ backgroundImageUrl && !backgroundVideoUrl && /* @__PURE__ */ jsx3(
209
+ "img",
210
+ {
211
+ src: backgroundImageUrl,
212
+ alt: "",
213
+ "aria-hidden": "true",
214
+ className: "absolute inset-0 h-full w-full object-cover z-[1]"
215
+ }
216
+ ),
217
+ backgroundVideoUrl && /* @__PURE__ */ jsx3(
218
+ "video",
219
+ {
220
+ className: "absolute inset-0 h-full w-full object-cover z-[1]",
221
+ src: backgroundVideoUrl,
222
+ autoPlay: true,
223
+ muted: true,
224
+ loop: true,
225
+ playsInline: true
226
+ }
227
+ ),
228
+ /* @__PURE__ */ jsx3(
229
+ "div",
230
+ {
231
+ className: cn(
232
+ "absolute inset-0 z-[2]",
233
+ hasBackground ? "bg-black/50" : "bg-black/20"
234
+ )
235
+ }
236
+ ),
237
+ /* @__PURE__ */ jsxs3("div", { className: "relative z-[3] flex flex-col gap-4 px-8 py-12 md:px-16 max-w-3xl", children: [
238
+ /* @__PURE__ */ jsx3("h1", { className: "text-[56px] font-bold text-white leading-none max-[900px]:text-[40px] max-[600px]:text-[32px]", children: title }),
239
+ /* @__PURE__ */ jsx3("p", { className: "text-body-medium text-white/80 leading-relaxed", children: description }),
240
+ watchVideoUrl && /* @__PURE__ */ jsx3("div", { className: "pt-2", children: /* @__PURE__ */ jsxs3(Button, { variant: "default", onClick: () => setWatchModalOpen(true), children: [
241
+ /* @__PURE__ */ jsx3(Play, { className: "mr-2 size-4" }),
242
+ "Watch Now"
243
+ ] }) })
244
+ ] })
245
+ ]
246
+ }
247
+ ),
248
+ watchVideoUrl && /* @__PURE__ */ jsx3(
249
+ ResourceModal,
250
+ {
251
+ open: watchModalOpen,
252
+ onClose: () => setWatchModalOpen(false),
253
+ title,
254
+ videoUrl: watchVideoUrl
255
+ }
256
+ )
257
+ ] });
258
+ }
259
+
260
+ // src/components/ui/resource-center/resource-cards.tsx
261
+ import { useState as useState3 } from "react";
262
+ import { Download as Download2, Play as Play2 } from "lucide-react";
263
+ import { Fragment as Fragment2, jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
264
+ function ResourceVideoCard({ video }) {
265
+ const [modalOpen, setModalOpen] = useState3(false);
266
+ return /* @__PURE__ */ jsxs4(Fragment2, { children: [
267
+ /* @__PURE__ */ jsxs4(
268
+ "button",
269
+ {
270
+ type: "button",
271
+ onClick: () => setModalOpen(true),
272
+ className: "group relative flex w-full flex-col gap-2 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
273
+ children: [
274
+ /* @__PURE__ */ jsxs4("div", { className: "relative w-full overflow-hidden bg-muted aspect-video", children: [
275
+ video.thumbnailUrl ? /* @__PURE__ */ jsx4(
276
+ "img",
277
+ {
278
+ src: video.thumbnailUrl,
279
+ alt: video.title,
280
+ className: "h-full w-full object-cover transition-transform duration-200 group-hover:scale-105"
281
+ }
282
+ ) : /* @__PURE__ */ jsx4("div", { className: "flex h-full w-full items-center justify-center", children: /* @__PURE__ */ jsx4(Play2, { className: "size-10 text-muted-foreground opacity-40" }) }),
283
+ /* @__PURE__ */ jsx4("div", { className: "absolute inset-0 flex items-center justify-center bg-black/30 opacity-0 transition-opacity duration-200 group-hover:opacity-100", children: /* @__PURE__ */ jsx4("div", { className: "flex size-12 items-center justify-center bg-background/90", children: /* @__PURE__ */ jsx4(Play2, { className: "size-5 text-foreground" }) }) }),
284
+ video.duration && /* @__PURE__ */ jsx4("span", { className: "absolute bottom-2 right-2 bg-black/70 px-1.5 py-0.5 text-caption text-white", children: video.duration })
285
+ ] }),
286
+ /* @__PURE__ */ jsx4("p", { className: "text-body-medium font-semibold text-foreground leading-snug line-clamp-2", children: video.title })
287
+ ]
288
+ }
289
+ ),
290
+ /* @__PURE__ */ jsx4(
291
+ ResourceModal,
292
+ {
293
+ open: modalOpen,
294
+ onClose: () => setModalOpen(false),
295
+ title: video.title,
296
+ videoUrl: video.videoUrl,
297
+ tags: video.tags,
298
+ attachments: video.attachments
299
+ }
300
+ )
301
+ ] });
302
+ }
303
+ function ResourceEmailTemplateCard({
304
+ template,
305
+ onClick
306
+ }) {
307
+ if (template.isAddTemplate) {
308
+ return /* @__PURE__ */ jsxs4(
309
+ "button",
310
+ {
311
+ type: "button",
312
+ onClick,
313
+ className: cn(
314
+ "flex w-full flex-col items-center justify-center gap-3",
315
+ "border-2 border-dashed border-border bg-muted/40",
316
+ "aspect-video hover:border-primary hover:bg-muted/70 transition-colors",
317
+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
318
+ ),
319
+ children: [
320
+ /* @__PURE__ */ jsx4("div", { className: "flex size-10 items-center justify-center border-2 border-dashed border-muted-foreground/40", children: /* @__PURE__ */ jsx4("span", { className: "text-2xl text-muted-foreground/60", children: "+" }) }),
321
+ /* @__PURE__ */ jsx4("p", { className: "text-body-small font-medium text-muted-foreground", children: "Add Template" })
322
+ ]
323
+ }
324
+ );
325
+ }
326
+ return /* @__PURE__ */ jsxs4(
327
+ "button",
328
+ {
329
+ type: "button",
330
+ onClick,
331
+ className: "group relative flex w-full flex-col gap-2 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
332
+ children: [
333
+ /* @__PURE__ */ jsxs4("div", { className: "relative w-full overflow-hidden border border-border bg-background aspect-video", children: [
334
+ template.htmlContent ? /* @__PURE__ */ jsx4(
335
+ "iframe",
336
+ {
337
+ srcDoc: template.htmlContent,
338
+ title: template.title,
339
+ className: "h-full w-full pointer-events-none",
340
+ style: {
341
+ transform: "scale(0.5)",
342
+ transformOrigin: "top left",
343
+ width: "200%",
344
+ height: "200%"
345
+ },
346
+ sandbox: "allow-same-origin"
347
+ }
348
+ ) : /* @__PURE__ */ jsx4("div", { className: "flex h-full w-full items-center justify-center bg-muted", children: /* @__PURE__ */ jsx4("p", { className: "text-caption text-muted-foreground", children: "No preview available" }) }),
349
+ /* @__PURE__ */ jsx4("div", { className: "absolute inset-0 flex items-center justify-center bg-foreground/60 opacity-0 transition-opacity duration-200 group-hover:opacity-100", children: /* @__PURE__ */ jsx4("span", { className: "text-body-small font-medium text-white", children: "Use Template" }) })
350
+ ] }),
351
+ /* @__PURE__ */ jsxs4("div", { className: "flex items-center justify-between gap-2", children: [
352
+ /* @__PURE__ */ jsx4("p", { className: "text-body-small font-medium text-foreground leading-snug line-clamp-1", children: template.title }),
353
+ template.type && /* @__PURE__ */ jsx4(Badge, { variant: "secondary", className: "shrink-0", children: template.type === "system" ? "System" : "Company" })
354
+ ] })
355
+ ]
356
+ }
357
+ );
358
+ }
359
+ function ResourceDocumentCard({
360
+ document,
361
+ onClick
362
+ }) {
363
+ return /* @__PURE__ */ jsxs4("div", { className: "flex w-full flex-col gap-2", children: [
364
+ /* @__PURE__ */ jsxs4(
365
+ "button",
366
+ {
367
+ type: "button",
368
+ onClick,
369
+ className: "group relative w-full overflow-hidden border border-border bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring aspect-video",
370
+ children: [
371
+ document.pdfUrl ? /* @__PURE__ */ jsx4(
372
+ "iframe",
373
+ {
374
+ src: document.pdfUrl,
375
+ title: document.title,
376
+ className: "h-full w-full pointer-events-none"
377
+ }
378
+ ) : document.thumbnailUrl ? /* @__PURE__ */ jsx4(
379
+ "img",
380
+ {
381
+ src: document.thumbnailUrl,
382
+ alt: document.title,
383
+ className: "h-full w-full object-cover"
384
+ }
385
+ ) : /* @__PURE__ */ jsxs4("div", { className: "flex h-full w-full flex-col items-center justify-center gap-2", children: [
386
+ /* @__PURE__ */ jsx4("div", { className: "flex items-center justify-center bg-muted-foreground/10 p-4", children: /* @__PURE__ */ jsx4(Download2, { className: "size-8 text-muted-foreground opacity-50" }) }),
387
+ /* @__PURE__ */ jsx4("span", { className: "text-caption text-muted-foreground", children: document.title })
388
+ ] }),
389
+ /* @__PURE__ */ jsx4("div", { className: "absolute inset-0 bg-foreground/40 opacity-0 transition-opacity duration-200 group-hover:opacity-100" })
390
+ ]
391
+ }
392
+ ),
393
+ /* @__PURE__ */ jsxs4("div", { className: "flex items-center justify-between gap-2", children: [
394
+ /* @__PURE__ */ jsxs4("div", { className: "flex flex-col gap-1 min-w-0", children: [
395
+ /* @__PURE__ */ jsx4("p", { className: "text-body-small font-medium text-foreground leading-snug line-clamp-1", children: document.title }),
396
+ document.tags && document.tags.length > 0 && /* @__PURE__ */ jsx4("div", { className: "flex flex-wrap gap-1", children: document.tags.map((tag) => /* @__PURE__ */ jsx4(Badge, { variant: "secondary", children: tag }, tag)) })
397
+ ] }),
398
+ document.downloadUrl && /* @__PURE__ */ jsx4(
399
+ "a",
400
+ {
401
+ href: document.downloadUrl,
402
+ download: true,
403
+ onClick: (e) => e.stopPropagation(),
404
+ className: "shrink-0",
405
+ "aria-label": `Download ${document.title}`,
406
+ children: /* @__PURE__ */ jsx4(Button, { variant: "outline", size: "icon", className: "size-8", children: /* @__PURE__ */ jsx4(Download2, { className: "size-4" }) })
407
+ }
408
+ )
409
+ ] })
410
+ ] });
411
+ }
412
+
413
+ // src/components/ui/resource-center/resource-email-editor-dialog.tsx
414
+ import { useState as useState4 } from "react";
415
+ import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
416
+ var EDITOR_CONTENT_TYPES = [
417
+ "Columns",
418
+ "Button",
419
+ "Divider",
420
+ "Heading",
421
+ "Paragraph",
422
+ "Image",
423
+ "Social",
424
+ "Menu",
425
+ "HTML"
426
+ ];
427
+ function ResourceEmailEditorDialog({
428
+ open,
429
+ onClose,
430
+ onSave,
431
+ editorSlot
432
+ }) {
433
+ const [templateName, setTemplateName] = useState4("");
434
+ function handleSave() {
435
+ onSave(templateName);
436
+ }
437
+ function handleClose() {
438
+ setTemplateName("");
439
+ onClose();
440
+ }
441
+ return /* @__PURE__ */ jsx5(Dialog, { open, onOpenChange: (v) => !v && handleClose(), children: /* @__PURE__ */ jsxs5(
442
+ DialogContent,
443
+ {
444
+ size: "4xl",
445
+ className: "flex flex-col gap-0 p-0 overflow-hidden h-[90vh]",
446
+ children: [
447
+ /* @__PURE__ */ jsxs5("div", { className: "shrink-0 border-b border-border px-6 py-4", children: [
448
+ /* @__PURE__ */ jsx5("p", { className: "text-label-small text-muted-foreground mb-1", children: "Template Name" }),
449
+ /* @__PURE__ */ jsx5(
450
+ Input,
451
+ {
452
+ placeholder: "Enter template name",
453
+ value: templateName,
454
+ onChange: (e) => setTemplateName(e.target.value),
455
+ className: "border-none shadow-none px-0 text-body-medium h-auto focus-visible:ring-0 bg-transparent"
456
+ }
457
+ )
458
+ ] }),
459
+ /* @__PURE__ */ jsx5("div", { className: "flex-1 overflow-hidden", children: editorSlot != null ? editorSlot : /* @__PURE__ */ jsx5(EditorPlaceholder, {}) }),
460
+ /* @__PURE__ */ jsxs5("div", { className: "shrink-0 flex items-center justify-between border-t border-border px-6 py-4", children: [
461
+ /* @__PURE__ */ jsx5(Button, { variant: "outline", onClick: handleClose, children: "Back" }),
462
+ /* @__PURE__ */ jsx5(Button, { variant: "default", onClick: handleSave, children: "Save Email" })
463
+ ] })
464
+ ]
465
+ }
466
+ ) });
467
+ }
468
+ function EditorPlaceholder() {
469
+ return /* @__PURE__ */ jsxs5("div", { className: "flex h-full", children: [
470
+ /* @__PURE__ */ jsx5("div", { className: "flex flex-1 items-center justify-center bg-[#f4f4f4]", children: /* @__PURE__ */ jsx5("div", { className: "max-w-[500px] w-full border-2 border-dashed border-[#9ecbf0] bg-[#e8f4ff] px-16 py-10 text-center", children: /* @__PURE__ */ jsx5("p", { className: "text-body-small text-[#5c9fd8]", children: "No content here. Drag content from right." }) }) }),
471
+ /* @__PURE__ */ jsxs5("div", { className: "w-[280px] shrink-0 flex flex-col border-l border-border bg-background", children: [
472
+ /* @__PURE__ */ jsx5("div", { className: "flex border-b border-border", children: ["Content", "Blocks", "Body"].map((tab, i) => /* @__PURE__ */ jsx5(
473
+ "button",
474
+ {
475
+ type: "button",
476
+ className: cn(
477
+ "flex flex-1 flex-col items-center gap-1 py-3 text-caption",
478
+ i === 0 ? "text-foreground border-b-2 border-foreground" : "text-muted-foreground"
479
+ ),
480
+ children: tab
481
+ },
482
+ tab
483
+ )) }),
484
+ /* @__PURE__ */ jsx5("div", { className: "grid grid-cols-3 gap-2 p-3", children: EDITOR_CONTENT_TYPES.map((item) => /* @__PURE__ */ jsxs5(
485
+ "div",
486
+ {
487
+ className: "flex flex-col items-center gap-1.5 border border-border p-2 hover:bg-muted transition-colors cursor-grab",
488
+ children: [
489
+ /* @__PURE__ */ jsx5("div", { className: "size-6 bg-foreground/10 flex items-center justify-center", children: /* @__PURE__ */ jsx5("span", { className: "text-[10px] text-foreground/40", children: "\u25A4" }) }),
490
+ /* @__PURE__ */ jsx5("span", { className: "text-[11px] text-foreground leading-none text-center", children: item })
491
+ ]
492
+ },
493
+ item
494
+ )) }),
495
+ /* @__PURE__ */ jsx5("div", { className: "mt-auto border-t border-border py-2.5 text-center", children: /* @__PURE__ */ jsx5("span", { className: "text-caption text-muted-foreground", children: "\u26A1 by Unlayer Editor" }) })
496
+ ] })
497
+ ] });
498
+ }
499
+
500
+ export {
501
+ ResourceCarousel,
502
+ ResourceModal,
503
+ ResourceCenterHeader,
504
+ ResourceVideoCard,
505
+ ResourceEmailTemplateCard,
506
+ ResourceDocumentCard,
507
+ ResourceEmailEditorDialog
508
+ };