react-sharesheet 1.0.0 → 1.1.0

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 (41) hide show
  1. package/README.md +40 -53
  2. package/dist/content.d.mts +3 -3
  3. package/dist/content.d.ts +3 -3
  4. package/dist/content.js +192 -268
  5. package/dist/content.js.map +1 -1
  6. package/dist/content.mjs +194 -270
  7. package/dist/content.mjs.map +1 -1
  8. package/dist/drawer.d.mts +3 -3
  9. package/dist/drawer.d.ts +3 -3
  10. package/dist/drawer.js +194 -272
  11. package/dist/drawer.js.map +1 -1
  12. package/dist/drawer.mjs +196 -274
  13. package/dist/drawer.mjs.map +1 -1
  14. package/dist/headless.d.mts +22 -3
  15. package/dist/headless.d.ts +22 -3
  16. package/dist/headless.js +72 -0
  17. package/dist/headless.js.map +1 -1
  18. package/dist/headless.mjs +70 -1
  19. package/dist/headless.mjs.map +1 -1
  20. package/dist/index.d.mts +2 -2
  21. package/dist/index.d.ts +2 -2
  22. package/dist/index.js +203 -272
  23. package/dist/index.js.map +1 -1
  24. package/dist/index.mjs +202 -274
  25. package/dist/index.mjs.map +1 -1
  26. package/dist/{platforms-DU1DVDFq.d.mts → platforms-CDJmSY8E.d.mts} +2 -19
  27. package/dist/{platforms-DU1DVDFq.d.ts → platforms-CDJmSY8E.d.ts} +2 -19
  28. package/package.json +12 -3
  29. package/src/ShareSheetContent.tsx +143 -306
  30. package/src/ShareSheetDrawer.tsx +2 -4
  31. package/src/__tests__/hooks.test.ts +213 -0
  32. package/src/__tests__/og-fetcher.test.ts +144 -0
  33. package/src/__tests__/platforms.test.ts +148 -0
  34. package/src/__tests__/setup.ts +22 -0
  35. package/src/__tests__/share-functions.test.ts +155 -0
  36. package/src/__tests__/utils.test.ts +64 -0
  37. package/src/headless.ts +4 -1
  38. package/src/hooks.ts +49 -1
  39. package/src/index.ts +4 -3
  40. package/src/og-fetcher.ts +64 -0
  41. package/src/types.ts +1 -20
package/dist/drawer.js CHANGED
@@ -55,6 +55,38 @@ var import_lucide_react2 = require("lucide-react");
55
55
  // src/hooks.ts
56
56
  var import_react = require("react");
57
57
 
58
+ // src/og-fetcher.ts
59
+ var ogCache = /* @__PURE__ */ new Map();
60
+ async function fetchOGData(url) {
61
+ if (ogCache.has(url)) {
62
+ return ogCache.get(url);
63
+ }
64
+ try {
65
+ const apiUrl = `https://api.microlink.io?url=${encodeURIComponent(url)}`;
66
+ const response = await fetch(apiUrl);
67
+ if (!response.ok) {
68
+ throw new Error(`Failed to fetch OG data: ${response.status}`);
69
+ }
70
+ const json = await response.json();
71
+ if (json.status !== "success" || !json.data) {
72
+ return null;
73
+ }
74
+ const { title, description, image, url: canonicalUrl, publisher } = json.data;
75
+ const ogData = {
76
+ title: title || void 0,
77
+ description: description || void 0,
78
+ image: image?.url || void 0,
79
+ url: canonicalUrl || url,
80
+ siteName: publisher || void 0
81
+ };
82
+ ogCache.set(url, ogData);
83
+ return ogData;
84
+ } catch (error) {
85
+ console.warn("[react-sharesheet] Failed to fetch OG data:", error);
86
+ return null;
87
+ }
88
+ }
89
+
58
90
  // src/share-functions.ts
59
91
  function shareToWhatsApp(url, text) {
60
92
  const encoded = encodeURIComponent(`${text}
@@ -231,6 +263,37 @@ function useShareSheet({
231
263
  shareReddit
232
264
  };
233
265
  }
266
+ function useOGData(url) {
267
+ const [ogData, setOgData] = (0, import_react.useState)(null);
268
+ const [loading, setLoading] = (0, import_react.useState)(false);
269
+ const [error, setError] = (0, import_react.useState)(null);
270
+ (0, import_react.useEffect)(() => {
271
+ if (!url) {
272
+ setOgData(null);
273
+ setLoading(false);
274
+ setError(null);
275
+ return;
276
+ }
277
+ let cancelled = false;
278
+ setLoading(true);
279
+ setError(null);
280
+ fetchOGData(url).then((data) => {
281
+ if (!cancelled) {
282
+ setOgData(data);
283
+ setLoading(false);
284
+ }
285
+ }).catch((err) => {
286
+ if (!cancelled) {
287
+ setError(err instanceof Error ? err.message : "Failed to fetch OG data");
288
+ setLoading(false);
289
+ }
290
+ });
291
+ return () => {
292
+ cancelled = true;
293
+ };
294
+ }, [url]);
295
+ return { ogData, loading, error };
296
+ }
234
297
 
235
298
  // src/platforms.tsx
236
299
  var import_lucide_react = require("lucide-react");
@@ -368,32 +431,6 @@ var CSS_VAR_DEFAULTS = CSS_VAR_UI_DEFAULTS;
368
431
  var import_jsx_runtime2 = require("react/jsx-runtime");
369
432
  var DEFAULT_BUTTON_SIZE = 45;
370
433
  var DEFAULT_ICON_SIZE = 22;
371
- var IMAGE_EXTENSIONS = ["jpg", "jpeg", "png", "gif", "webp", "svg", "bmp", "ico", "avif"];
372
- var VIDEO_EXTENSIONS = ["mp4", "webm", "mov", "avi", "mkv", "m4v", "ogv"];
373
- var AUDIO_EXTENSIONS = ["mp3", "wav", "ogg", "m4a", "aac", "flac", "wma"];
374
- function detectPreviewType(url) {
375
- try {
376
- const pathname = new URL(url, "http://localhost").pathname;
377
- const ext = pathname.split(".").pop()?.toLowerCase() || "";
378
- if (IMAGE_EXTENSIONS.includes(ext)) return "image";
379
- if (VIDEO_EXTENSIONS.includes(ext)) return "video";
380
- if (AUDIO_EXTENSIONS.includes(ext)) return "audio";
381
- if (url.includes("/api/og") || url.includes("og-image")) return "image";
382
- if (url.includes("youtube.com") || url.includes("vimeo.com")) return "video";
383
- return "link";
384
- } catch {
385
- return "link";
386
- }
387
- }
388
- function getFilenameFromUrl(url) {
389
- try {
390
- const pathname = new URL(url, "http://localhost").pathname;
391
- const filename = pathname.split("/").pop() || "";
392
- return decodeURIComponent(filename);
393
- } catch {
394
- return url;
395
- }
396
- }
397
434
  var defaultClasses = {
398
435
  root: "max-w-md mx-auto",
399
436
  header: "text-center mb-2",
@@ -402,12 +439,8 @@ var defaultClasses = {
402
439
  preview: "flex justify-center mb-4 px-4",
403
440
  previewSkeleton: "rounded-xl overflow-hidden",
404
441
  previewImage: "",
405
- previewVideo: "",
406
- previewFile: "",
407
- previewFileIcon: "",
408
- previewFilename: "truncate",
409
- previewLink: "",
410
- grid: "px-2 py-6 flex flex-row items-center gap-4 gap-y-6 flex-wrap justify-center",
442
+ previewMeta: "",
443
+ grid: "px-2 py-6 flex flex-row items-start gap-4 gap-y-6 flex-wrap justify-center",
411
444
  button: "flex flex-col items-center gap-0 text-xs w-[60px] outline-none cursor-pointer group",
412
445
  buttonIcon: "p-2 rounded-full transition-all flex items-center justify-center group-hover:scale-110 group-active:scale-95 mb-2",
413
446
  buttonLabel: ""
@@ -421,28 +454,10 @@ var shimmerKeyframes = `
421
454
  function cssVar(name, fallback) {
422
455
  return `var(${name}, ${fallback})`;
423
456
  }
424
- function normalizePreview(preview) {
425
- if (!preview) return null;
426
- if (typeof preview === "string") {
427
- const type2 = detectPreviewType(preview);
428
- return {
429
- url: preview,
430
- type: type2,
431
- filename: getFilenameFromUrl(preview)
432
- };
433
- }
434
- const type = preview.type === "auto" || !preview.type ? detectPreviewType(preview.url) : preview.type;
435
- return {
436
- ...preview,
437
- type,
438
- filename: preview.filename || getFilenameFromUrl(preview.url)
439
- };
440
- }
441
457
  function ShareSheetContent({
442
458
  title = "Share",
443
459
  shareUrl,
444
460
  shareText,
445
- preview,
446
461
  downloadUrl,
447
462
  downloadFilename,
448
463
  className,
@@ -457,15 +472,15 @@ function ShareSheetContent({
457
472
  labels = {},
458
473
  icons = {}
459
474
  }) {
460
- const [mediaLoaded, setMediaLoaded] = (0, import_react2.useState)(false);
461
- const [mediaError, setMediaError] = (0, import_react2.useState)(false);
462
- const handleMediaLoad = (0, import_react2.useCallback)(() => {
463
- setMediaLoaded(true);
475
+ const [imageLoaded, setImageLoaded] = (0, import_react2.useState)(false);
476
+ const [imageError, setImageError] = (0, import_react2.useState)(false);
477
+ const { ogData, loading: ogLoading } = useOGData(shareUrl);
478
+ const handleImageLoad = (0, import_react2.useCallback)(() => {
479
+ setImageLoaded(true);
464
480
  }, []);
465
- const handleMediaError = (0, import_react2.useCallback)(() => {
466
- setMediaError(true);
481
+ const handleImageError = (0, import_react2.useCallback)(() => {
482
+ setImageError(true);
467
483
  }, []);
468
- const previewConfig = (0, import_react2.useMemo)(() => normalizePreview(preview), [preview]);
469
484
  const shareSheet = useShareSheet({
470
485
  shareUrl,
471
486
  shareText,
@@ -522,49 +537,30 @@ function ShareSheetContent({
522
537
  return true;
523
538
  });
524
539
  }, [buttons, show, hide]);
525
- const showPreview = !!previewConfig;
540
+ const bgColor = cssVar(CSS_VARS_UI.previewBg, CSS_VAR_UI_DEFAULTS[CSS_VARS_UI.previewBg]);
541
+ const shimmerColor = cssVar(CSS_VARS_UI.previewShimmer, CSS_VAR_UI_DEFAULTS[CSS_VARS_UI.previewShimmer]);
542
+ const textColor = cssVar(CSS_VARS_UI.subtitleColor, CSS_VAR_UI_DEFAULTS[CSS_VARS_UI.subtitleColor]);
526
543
  const renderPreview = () => {
527
- if (!previewConfig) return null;
528
- const { type, url, filename, alt, poster } = previewConfig;
529
- const bgColor = cssVar(CSS_VARS_UI.previewBg, CSS_VAR_UI_DEFAULTS[CSS_VARS_UI.previewBg]);
530
- const shimmerColor = cssVar(CSS_VARS_UI.previewShimmer, CSS_VAR_UI_DEFAULTS[CSS_VARS_UI.previewShimmer]);
531
- const textColor = cssVar(CSS_VARS_UI.subtitleColor, CSS_VAR_UI_DEFAULTS[CSS_VARS_UI.subtitleColor]);
532
- const UrlLabel = ({ displayUrl = url }) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
533
- "div",
534
- {
535
- className: cn(defaultClasses.previewFilename, classNames.previewFilename),
536
- style: {
537
- color: textColor,
538
- fontSize: "10px",
539
- opacity: 0.5,
540
- textAlign: "center",
541
- marginTop: "6px"
542
- },
543
- children: displayUrl
544
- }
545
- );
546
- const PlaceholderCard = ({
547
- icon: IconComponent,
548
- isLoading = false,
549
- label,
550
- displayUrl
551
- }) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { style: { display: "flex", flexDirection: "column", alignItems: "center" }, children: [
552
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
544
+ const ogImage = ogData?.image;
545
+ const hasImage = ogImage && !imageError;
546
+ if (ogLoading) {
547
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { style: { display: "flex", flexDirection: "column", alignItems: "center", width: "100%" }, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
553
548
  "div",
554
549
  {
555
550
  className: cn(defaultClasses.previewSkeleton, classNames.previewSkeleton),
556
551
  style: {
557
552
  position: "relative",
558
553
  backgroundColor: bgColor,
559
- width: "200px",
560
- height: "120px",
554
+ width: "100%",
555
+ maxWidth: "320px",
556
+ aspectRatio: "1.91 / 1",
561
557
  overflow: "hidden",
562
558
  display: "flex",
563
559
  alignItems: "center",
564
560
  justifyContent: "center"
565
561
  },
566
562
  children: [
567
- isLoading && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { style: { position: "absolute", inset: 0, overflow: "hidden" }, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
563
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { style: { position: "absolute", inset: 0, overflow: "hidden" }, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
568
564
  "div",
569
565
  {
570
566
  style: {
@@ -575,197 +571,125 @@ function ShareSheetContent({
575
571
  }
576
572
  }
577
573
  ) }),
578
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
579
- "div",
580
- {
581
- style: {
582
- display: "flex",
583
- flexDirection: "column",
584
- alignItems: "center",
585
- justifyContent: "center",
586
- gap: "8px"
587
- },
588
- children: [
589
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(IconComponent, { size: 32, style: { color: textColor, opacity: 0.4 } }),
590
- label && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { style: { color: textColor, fontSize: "11px", opacity: 0.4 }, children: label })
591
- ]
592
- }
593
- )
574
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_lucide_react2.Link2, { size: 32, style: { color: textColor, opacity: 0.4 } })
594
575
  ]
595
576
  }
596
- ),
597
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(UrlLabel, { displayUrl })
598
- ] });
599
- if (mediaError && (type === "image" || type === "video")) {
600
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(PlaceholderCard, { icon: import_lucide_react2.Link2, displayUrl: url });
577
+ ) });
601
578
  }
602
- switch (type) {
603
- case "image":
604
- if (!mediaLoaded) {
605
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { style: { display: "flex", flexDirection: "column", alignItems: "center" }, children: [
606
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
607
- "div",
608
- {
609
- className: cn(defaultClasses.previewSkeleton, classNames.previewSkeleton),
610
- style: {
611
- position: "relative",
612
- backgroundColor: bgColor,
613
- width: "200px",
614
- height: "120px",
615
- overflow: "hidden",
616
- display: "flex",
617
- alignItems: "center",
618
- justifyContent: "center"
619
- },
620
- children: [
621
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { style: { position: "absolute", inset: 0, overflow: "hidden" }, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
622
- "div",
623
- {
624
- style: {
625
- position: "absolute",
626
- inset: 0,
627
- background: `linear-gradient(90deg, transparent, ${shimmerColor}, transparent)`,
628
- animation: "sharesheet-shimmer 1.5s infinite"
629
- }
630
- }
631
- ) }),
632
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_lucide_react2.Image, { size: 32, style: { color: textColor, opacity: 0.4 } })
633
- ]
634
- }
635
- ),
636
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(UrlLabel, {}),
637
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
638
- "img",
639
- {
640
- src: url,
641
- alt: alt || "Preview",
642
- onLoad: handleMediaLoad,
643
- onError: handleMediaError,
644
- style: { display: "none" }
645
- }
646
- )
647
- ] });
648
- }
649
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { style: { display: "flex", flexDirection: "column", alignItems: "center" }, children: [
650
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
651
- "img",
579
+ if (!ogData || !hasImage) {
580
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { style: { display: "flex", flexDirection: "column", alignItems: "center", width: "100%" }, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
581
+ "div",
582
+ {
583
+ className: cn(defaultClasses.previewSkeleton, classNames.previewSkeleton),
584
+ style: {
585
+ position: "relative",
586
+ backgroundColor: bgColor,
587
+ width: "100%",
588
+ maxWidth: "320px",
589
+ aspectRatio: "1.91 / 1",
590
+ overflow: "hidden",
591
+ display: "flex",
592
+ alignItems: "center",
593
+ justifyContent: "center"
594
+ },
595
+ children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
596
+ "div",
652
597
  {
653
- src: url,
654
- alt: alt || "Preview",
655
- className: cn(defaultClasses.previewImage, classNames.previewImage),
656
598
  style: {
657
- maxWidth: "100%",
658
- maxHeight: "180px",
659
- borderRadius: "12px",
660
- opacity: 1,
661
- transition: "opacity 0.3s ease-in-out"
662
- }
663
- }
664
- ),
665
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(UrlLabel, {})
666
- ] });
667
- case "video":
668
- if (!mediaLoaded) {
669
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { style: { display: "flex", flexDirection: "column", alignItems: "center" }, children: [
670
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
671
- "div",
672
- {
673
- className: cn(defaultClasses.previewSkeleton, classNames.previewSkeleton),
674
- style: {
675
- position: "relative",
676
- backgroundColor: bgColor,
677
- width: "200px",
678
- height: "120px",
679
- overflow: "hidden",
680
- display: "flex",
681
- alignItems: "center",
682
- justifyContent: "center"
683
- },
684
- children: [
685
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { style: { position: "absolute", inset: 0, overflow: "hidden" }, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
686
- "div",
687
- {
688
- style: {
689
- position: "absolute",
690
- inset: 0,
691
- background: `linear-gradient(90deg, transparent, ${shimmerColor}, transparent)`,
692
- animation: "sharesheet-shimmer 1.5s infinite"
693
- }
694
- }
695
- ) }),
696
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_lucide_react2.Film, { size: 32, style: { color: textColor, opacity: 0.4 } })
697
- ]
698
- }
699
- ),
700
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(UrlLabel, {}),
701
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
702
- "video",
703
- {
704
- src: url,
705
- poster,
706
- onLoadedData: handleMediaLoad,
707
- onError: handleMediaError,
708
- style: { display: "none" },
709
- muted: true,
710
- playsInline: true,
711
- preload: "metadata"
712
- }
713
- )
714
- ] });
715
- }
716
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { style: { display: "flex", flexDirection: "column", alignItems: "center" }, children: [
717
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { style: { position: "relative", borderRadius: "12px", overflow: "hidden" }, children: [
718
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
719
- "video",
720
- {
721
- src: url,
722
- poster,
723
- className: cn(defaultClasses.previewVideo, classNames.previewVideo),
724
- style: {
725
- maxWidth: "100%",
726
- maxHeight: "180px",
727
- display: "block"
728
- },
729
- muted: true,
730
- playsInline: true,
731
- preload: "metadata"
732
- }
733
- ),
734
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
735
- "div",
736
- {
737
- style: {
738
- position: "absolute",
739
- inset: 0,
740
- display: "flex",
741
- alignItems: "center",
742
- justifyContent: "center",
743
- pointerEvents: "none"
744
- },
745
- children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
746
- "div",
599
+ display: "flex",
600
+ flexDirection: "column",
601
+ alignItems: "center",
602
+ justifyContent: "center",
603
+ gap: "8px",
604
+ padding: "16px"
605
+ },
606
+ children: [
607
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_lucide_react2.Link2, { size: 32, style: { color: textColor, opacity: 0.4 } }),
608
+ ogData?.title && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
609
+ "span",
747
610
  {
748
611
  style: {
749
- backgroundColor: "rgba(0, 0, 0, 0.5)",
750
- borderRadius: "50%",
751
- padding: "10px"
612
+ color: textColor,
613
+ fontSize: "12px",
614
+ opacity: 0.6,
615
+ textAlign: "center",
616
+ maxWidth: "280px",
617
+ overflow: "hidden",
618
+ textOverflow: "ellipsis",
619
+ display: "-webkit-box",
620
+ WebkitLineClamp: 2,
621
+ WebkitBoxOrient: "vertical"
752
622
  },
753
- children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_lucide_react2.Play, { size: 20, fill: "white", color: "white" })
623
+ children: ogData.title
754
624
  }
755
625
  )
756
- }
757
- )
758
- ] }),
759
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(UrlLabel, {})
760
- ] });
761
- case "audio":
762
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(PlaceholderCard, { icon: import_lucide_react2.Music, label: filename || "Audio", displayUrl: url });
763
- case "file":
764
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(PlaceholderCard, { icon: import_lucide_react2.FileText, label: filename || "File", displayUrl: url });
765
- case "link":
766
- default:
767
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(PlaceholderCard, { icon: import_lucide_react2.Link2, displayUrl: url });
626
+ ]
627
+ }
628
+ )
629
+ }
630
+ ) });
631
+ }
632
+ if (!imageLoaded) {
633
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { style: { display: "flex", flexDirection: "column", alignItems: "center", width: "100%" }, children: [
634
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
635
+ "div",
636
+ {
637
+ className: cn(defaultClasses.previewSkeleton, classNames.previewSkeleton),
638
+ style: {
639
+ position: "relative",
640
+ backgroundColor: bgColor,
641
+ width: "100%",
642
+ maxWidth: "320px",
643
+ aspectRatio: "1.91 / 1",
644
+ overflow: "hidden",
645
+ display: "flex",
646
+ alignItems: "center",
647
+ justifyContent: "center"
648
+ },
649
+ children: [
650
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { style: { position: "absolute", inset: 0, overflow: "hidden" }, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
651
+ "div",
652
+ {
653
+ style: {
654
+ position: "absolute",
655
+ inset: 0,
656
+ background: `linear-gradient(90deg, transparent, ${shimmerColor}, transparent)`,
657
+ animation: "sharesheet-shimmer 1.5s infinite"
658
+ }
659
+ }
660
+ ) }),
661
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_lucide_react2.Image, { size: 32, style: { color: textColor, opacity: 0.4 } })
662
+ ]
663
+ }
664
+ ),
665
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
666
+ "img",
667
+ {
668
+ src: ogImage,
669
+ alt: ogData.title || "Preview",
670
+ onLoad: handleImageLoad,
671
+ onError: handleImageError,
672
+ style: { display: "none" }
673
+ }
674
+ )
675
+ ] });
768
676
  }
677
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { style: { display: "flex", flexDirection: "column", alignItems: "center", width: "100%" }, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
678
+ "img",
679
+ {
680
+ src: ogImage,
681
+ alt: ogData.title || "Preview",
682
+ className: cn(defaultClasses.previewImage, classNames.previewImage),
683
+ style: {
684
+ width: "100%",
685
+ maxWidth: "320px",
686
+ height: "auto",
687
+ borderRadius: "12px",
688
+ opacity: 1,
689
+ transition: "opacity 0.3s ease-in-out"
690
+ }
691
+ }
692
+ ) });
769
693
  };
770
694
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: cn(defaultClasses.root, classNames.root, className), children: [
771
695
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("style", { dangerouslySetInnerHTML: { __html: shimmerKeyframes } }),
@@ -787,7 +711,7 @@ function ShareSheetContent({
787
711
  }
788
712
  )
789
713
  ] }),
790
- showPreview && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: cn(defaultClasses.preview, classNames.preview), children: renderPreview() }),
714
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: cn(defaultClasses.preview, classNames.preview), children: renderPreview() }),
791
715
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: cn(defaultClasses.grid, classNames.grid), children: visibleButtons.map((btn) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
792
716
  "button",
793
717
  {
@@ -827,8 +751,8 @@ function ShareSheetContent({
827
751
  var import_jsx_runtime3 = require("react/jsx-runtime");
828
752
  var defaultDrawerClasses = {
829
753
  overlay: "fixed inset-0 z-[70]",
830
- drawer: "flex flex-col rounded-t-[14px] h-[70%] mt-24 fixed bottom-0 left-0 right-0 z-[80] border-t outline-none",
831
- drawerInner: "p-4 rounded-t-[14px] flex-1 overflow-auto",
754
+ drawer: "flex flex-col rounded-t-[14px] max-h-[90%] fixed bottom-0 left-0 right-0 z-[80] border-t outline-none",
755
+ drawerInner: "p-4 pb-8 rounded-t-[14px] overflow-auto",
832
756
  handle: "mx-auto w-12 h-1.5 shrink-0 rounded-full mb-6",
833
757
  trigger: ""
834
758
  };
@@ -839,7 +763,6 @@ function ShareSheetDrawer({
839
763
  title = "Share",
840
764
  shareUrl,
841
765
  shareText,
842
- preview,
843
766
  downloadUrl,
844
767
  downloadFilename,
845
768
  disabled,
@@ -917,7 +840,6 @@ function ShareSheetDrawer({
917
840
  title,
918
841
  shareUrl,
919
842
  shareText,
920
- preview,
921
843
  downloadUrl,
922
844
  downloadFilename,
923
845
  className,