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.mjs CHANGED
@@ -17,10 +17,42 @@ function getSafeUrl(shareUrl) {
17
17
 
18
18
  // src/ShareSheetContent.tsx
19
19
  import { useMemo as useMemo2, useState as useState2, useCallback as useCallback2 } from "react";
20
- import { Image, FileText, Music, Film, Link2, Play } from "lucide-react";
20
+ import { Image, Link2 } from "lucide-react";
21
21
 
22
22
  // src/hooks.ts
23
- import { useMemo, useState, useCallback } from "react";
23
+ import { useMemo, useState, useCallback, useEffect } from "react";
24
+
25
+ // src/og-fetcher.ts
26
+ var ogCache = /* @__PURE__ */ new Map();
27
+ async function fetchOGData(url) {
28
+ if (ogCache.has(url)) {
29
+ return ogCache.get(url);
30
+ }
31
+ try {
32
+ const apiUrl = `https://api.microlink.io?url=${encodeURIComponent(url)}`;
33
+ const response = await fetch(apiUrl);
34
+ if (!response.ok) {
35
+ throw new Error(`Failed to fetch OG data: ${response.status}`);
36
+ }
37
+ const json = await response.json();
38
+ if (json.status !== "success" || !json.data) {
39
+ return null;
40
+ }
41
+ const { title, description, image, url: canonicalUrl, publisher } = json.data;
42
+ const ogData = {
43
+ title: title || void 0,
44
+ description: description || void 0,
45
+ image: image?.url || void 0,
46
+ url: canonicalUrl || url,
47
+ siteName: publisher || void 0
48
+ };
49
+ ogCache.set(url, ogData);
50
+ return ogData;
51
+ } catch (error) {
52
+ console.warn("[react-sharesheet] Failed to fetch OG data:", error);
53
+ return null;
54
+ }
55
+ }
24
56
 
25
57
  // src/share-functions.ts
26
58
  function shareToWhatsApp(url, text) {
@@ -198,6 +230,37 @@ function useShareSheet({
198
230
  shareReddit
199
231
  };
200
232
  }
233
+ function useOGData(url) {
234
+ const [ogData, setOgData] = useState(null);
235
+ const [loading, setLoading] = useState(false);
236
+ const [error, setError] = useState(null);
237
+ useEffect(() => {
238
+ if (!url) {
239
+ setOgData(null);
240
+ setLoading(false);
241
+ setError(null);
242
+ return;
243
+ }
244
+ let cancelled = false;
245
+ setLoading(true);
246
+ setError(null);
247
+ fetchOGData(url).then((data) => {
248
+ if (!cancelled) {
249
+ setOgData(data);
250
+ setLoading(false);
251
+ }
252
+ }).catch((err) => {
253
+ if (!cancelled) {
254
+ setError(err instanceof Error ? err.message : "Failed to fetch OG data");
255
+ setLoading(false);
256
+ }
257
+ });
258
+ return () => {
259
+ cancelled = true;
260
+ };
261
+ }, [url]);
262
+ return { ogData, loading, error };
263
+ }
201
264
 
202
265
  // src/platforms.tsx
203
266
  import {
@@ -349,32 +412,6 @@ var CSS_VAR_DEFAULTS = CSS_VAR_UI_DEFAULTS;
349
412
  import { jsx as jsx2, jsxs } from "react/jsx-runtime";
350
413
  var DEFAULT_BUTTON_SIZE = 45;
351
414
  var DEFAULT_ICON_SIZE = 22;
352
- var IMAGE_EXTENSIONS = ["jpg", "jpeg", "png", "gif", "webp", "svg", "bmp", "ico", "avif"];
353
- var VIDEO_EXTENSIONS = ["mp4", "webm", "mov", "avi", "mkv", "m4v", "ogv"];
354
- var AUDIO_EXTENSIONS = ["mp3", "wav", "ogg", "m4a", "aac", "flac", "wma"];
355
- function detectPreviewType(url) {
356
- try {
357
- const pathname = new URL(url, "http://localhost").pathname;
358
- const ext = pathname.split(".").pop()?.toLowerCase() || "";
359
- if (IMAGE_EXTENSIONS.includes(ext)) return "image";
360
- if (VIDEO_EXTENSIONS.includes(ext)) return "video";
361
- if (AUDIO_EXTENSIONS.includes(ext)) return "audio";
362
- if (url.includes("/api/og") || url.includes("og-image")) return "image";
363
- if (url.includes("youtube.com") || url.includes("vimeo.com")) return "video";
364
- return "link";
365
- } catch {
366
- return "link";
367
- }
368
- }
369
- function getFilenameFromUrl(url) {
370
- try {
371
- const pathname = new URL(url, "http://localhost").pathname;
372
- const filename = pathname.split("/").pop() || "";
373
- return decodeURIComponent(filename);
374
- } catch {
375
- return url;
376
- }
377
- }
378
415
  var defaultClasses = {
379
416
  root: "max-w-md mx-auto",
380
417
  header: "text-center mb-2",
@@ -383,12 +420,8 @@ var defaultClasses = {
383
420
  preview: "flex justify-center mb-4 px-4",
384
421
  previewSkeleton: "rounded-xl overflow-hidden",
385
422
  previewImage: "",
386
- previewVideo: "",
387
- previewFile: "",
388
- previewFileIcon: "",
389
- previewFilename: "truncate",
390
- previewLink: "",
391
- grid: "px-2 py-6 flex flex-row items-center gap-4 gap-y-6 flex-wrap justify-center",
423
+ previewMeta: "",
424
+ grid: "px-2 py-6 flex flex-row items-start gap-4 gap-y-6 flex-wrap justify-center",
392
425
  button: "flex flex-col items-center gap-0 text-xs w-[60px] outline-none cursor-pointer group",
393
426
  buttonIcon: "p-2 rounded-full transition-all flex items-center justify-center group-hover:scale-110 group-active:scale-95 mb-2",
394
427
  buttonLabel: ""
@@ -402,28 +435,10 @@ var shimmerKeyframes = `
402
435
  function cssVar(name, fallback) {
403
436
  return `var(${name}, ${fallback})`;
404
437
  }
405
- function normalizePreview(preview) {
406
- if (!preview) return null;
407
- if (typeof preview === "string") {
408
- const type2 = detectPreviewType(preview);
409
- return {
410
- url: preview,
411
- type: type2,
412
- filename: getFilenameFromUrl(preview)
413
- };
414
- }
415
- const type = preview.type === "auto" || !preview.type ? detectPreviewType(preview.url) : preview.type;
416
- return {
417
- ...preview,
418
- type,
419
- filename: preview.filename || getFilenameFromUrl(preview.url)
420
- };
421
- }
422
438
  function ShareSheetContent({
423
439
  title = "Share",
424
440
  shareUrl,
425
441
  shareText,
426
- preview,
427
442
  downloadUrl,
428
443
  downloadFilename,
429
444
  className,
@@ -438,15 +453,15 @@ function ShareSheetContent({
438
453
  labels = {},
439
454
  icons = {}
440
455
  }) {
441
- const [mediaLoaded, setMediaLoaded] = useState2(false);
442
- const [mediaError, setMediaError] = useState2(false);
443
- const handleMediaLoad = useCallback2(() => {
444
- setMediaLoaded(true);
456
+ const [imageLoaded, setImageLoaded] = useState2(false);
457
+ const [imageError, setImageError] = useState2(false);
458
+ const { ogData, loading: ogLoading } = useOGData(shareUrl);
459
+ const handleImageLoad = useCallback2(() => {
460
+ setImageLoaded(true);
445
461
  }, []);
446
- const handleMediaError = useCallback2(() => {
447
- setMediaError(true);
462
+ const handleImageError = useCallback2(() => {
463
+ setImageError(true);
448
464
  }, []);
449
- const previewConfig = useMemo2(() => normalizePreview(preview), [preview]);
450
465
  const shareSheet = useShareSheet({
451
466
  shareUrl,
452
467
  shareText,
@@ -503,49 +518,30 @@ function ShareSheetContent({
503
518
  return true;
504
519
  });
505
520
  }, [buttons, show, hide]);
506
- const showPreview = !!previewConfig;
521
+ const bgColor = cssVar(CSS_VARS_UI.previewBg, CSS_VAR_UI_DEFAULTS[CSS_VARS_UI.previewBg]);
522
+ const shimmerColor = cssVar(CSS_VARS_UI.previewShimmer, CSS_VAR_UI_DEFAULTS[CSS_VARS_UI.previewShimmer]);
523
+ const textColor = cssVar(CSS_VARS_UI.subtitleColor, CSS_VAR_UI_DEFAULTS[CSS_VARS_UI.subtitleColor]);
507
524
  const renderPreview = () => {
508
- if (!previewConfig) return null;
509
- const { type, url, filename, alt, poster } = previewConfig;
510
- const bgColor = cssVar(CSS_VARS_UI.previewBg, CSS_VAR_UI_DEFAULTS[CSS_VARS_UI.previewBg]);
511
- const shimmerColor = cssVar(CSS_VARS_UI.previewShimmer, CSS_VAR_UI_DEFAULTS[CSS_VARS_UI.previewShimmer]);
512
- const textColor = cssVar(CSS_VARS_UI.subtitleColor, CSS_VAR_UI_DEFAULTS[CSS_VARS_UI.subtitleColor]);
513
- const UrlLabel = ({ displayUrl = url }) => /* @__PURE__ */ jsx2(
514
- "div",
515
- {
516
- className: cn(defaultClasses.previewFilename, classNames.previewFilename),
517
- style: {
518
- color: textColor,
519
- fontSize: "10px",
520
- opacity: 0.5,
521
- textAlign: "center",
522
- marginTop: "6px"
523
- },
524
- children: displayUrl
525
- }
526
- );
527
- const PlaceholderCard = ({
528
- icon: IconComponent,
529
- isLoading = false,
530
- label,
531
- displayUrl
532
- }) => /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", alignItems: "center" }, children: [
533
- /* @__PURE__ */ jsxs(
525
+ const ogImage = ogData?.image;
526
+ const hasImage = ogImage && !imageError;
527
+ if (ogLoading) {
528
+ return /* @__PURE__ */ jsx2("div", { style: { display: "flex", flexDirection: "column", alignItems: "center", width: "100%" }, children: /* @__PURE__ */ jsxs(
534
529
  "div",
535
530
  {
536
531
  className: cn(defaultClasses.previewSkeleton, classNames.previewSkeleton),
537
532
  style: {
538
533
  position: "relative",
539
534
  backgroundColor: bgColor,
540
- width: "200px",
541
- height: "120px",
535
+ width: "100%",
536
+ maxWidth: "320px",
537
+ aspectRatio: "1.91 / 1",
542
538
  overflow: "hidden",
543
539
  display: "flex",
544
540
  alignItems: "center",
545
541
  justifyContent: "center"
546
542
  },
547
543
  children: [
548
- isLoading && /* @__PURE__ */ jsx2("div", { style: { position: "absolute", inset: 0, overflow: "hidden" }, children: /* @__PURE__ */ jsx2(
544
+ /* @__PURE__ */ jsx2("div", { style: { position: "absolute", inset: 0, overflow: "hidden" }, children: /* @__PURE__ */ jsx2(
549
545
  "div",
550
546
  {
551
547
  style: {
@@ -556,197 +552,125 @@ function ShareSheetContent({
556
552
  }
557
553
  }
558
554
  ) }),
559
- /* @__PURE__ */ jsxs(
560
- "div",
561
- {
562
- style: {
563
- display: "flex",
564
- flexDirection: "column",
565
- alignItems: "center",
566
- justifyContent: "center",
567
- gap: "8px"
568
- },
569
- children: [
570
- /* @__PURE__ */ jsx2(IconComponent, { size: 32, style: { color: textColor, opacity: 0.4 } }),
571
- label && /* @__PURE__ */ jsx2("span", { style: { color: textColor, fontSize: "11px", opacity: 0.4 }, children: label })
572
- ]
573
- }
574
- )
555
+ /* @__PURE__ */ jsx2(Link2, { size: 32, style: { color: textColor, opacity: 0.4 } })
575
556
  ]
576
557
  }
577
- ),
578
- /* @__PURE__ */ jsx2(UrlLabel, { displayUrl })
579
- ] });
580
- if (mediaError && (type === "image" || type === "video")) {
581
- return /* @__PURE__ */ jsx2(PlaceholderCard, { icon: Link2, displayUrl: url });
558
+ ) });
582
559
  }
583
- switch (type) {
584
- case "image":
585
- if (!mediaLoaded) {
586
- return /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", alignItems: "center" }, children: [
587
- /* @__PURE__ */ jsxs(
588
- "div",
589
- {
590
- className: cn(defaultClasses.previewSkeleton, classNames.previewSkeleton),
591
- style: {
592
- position: "relative",
593
- backgroundColor: bgColor,
594
- width: "200px",
595
- height: "120px",
596
- overflow: "hidden",
597
- display: "flex",
598
- alignItems: "center",
599
- justifyContent: "center"
600
- },
601
- children: [
602
- /* @__PURE__ */ jsx2("div", { style: { position: "absolute", inset: 0, overflow: "hidden" }, children: /* @__PURE__ */ jsx2(
603
- "div",
604
- {
605
- style: {
606
- position: "absolute",
607
- inset: 0,
608
- background: `linear-gradient(90deg, transparent, ${shimmerColor}, transparent)`,
609
- animation: "sharesheet-shimmer 1.5s infinite"
610
- }
611
- }
612
- ) }),
613
- /* @__PURE__ */ jsx2(Image, { size: 32, style: { color: textColor, opacity: 0.4 } })
614
- ]
615
- }
616
- ),
617
- /* @__PURE__ */ jsx2(UrlLabel, {}),
618
- /* @__PURE__ */ jsx2(
619
- "img",
620
- {
621
- src: url,
622
- alt: alt || "Preview",
623
- onLoad: handleMediaLoad,
624
- onError: handleMediaError,
625
- style: { display: "none" }
626
- }
627
- )
628
- ] });
629
- }
630
- return /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", alignItems: "center" }, children: [
631
- /* @__PURE__ */ jsx2(
632
- "img",
560
+ if (!ogData || !hasImage) {
561
+ return /* @__PURE__ */ jsx2("div", { style: { display: "flex", flexDirection: "column", alignItems: "center", width: "100%" }, children: /* @__PURE__ */ jsx2(
562
+ "div",
563
+ {
564
+ className: cn(defaultClasses.previewSkeleton, classNames.previewSkeleton),
565
+ style: {
566
+ position: "relative",
567
+ backgroundColor: bgColor,
568
+ width: "100%",
569
+ maxWidth: "320px",
570
+ aspectRatio: "1.91 / 1",
571
+ overflow: "hidden",
572
+ display: "flex",
573
+ alignItems: "center",
574
+ justifyContent: "center"
575
+ },
576
+ children: /* @__PURE__ */ jsxs(
577
+ "div",
633
578
  {
634
- src: url,
635
- alt: alt || "Preview",
636
- className: cn(defaultClasses.previewImage, classNames.previewImage),
637
579
  style: {
638
- maxWidth: "100%",
639
- maxHeight: "180px",
640
- borderRadius: "12px",
641
- opacity: 1,
642
- transition: "opacity 0.3s ease-in-out"
643
- }
644
- }
645
- ),
646
- /* @__PURE__ */ jsx2(UrlLabel, {})
647
- ] });
648
- case "video":
649
- if (!mediaLoaded) {
650
- return /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", alignItems: "center" }, children: [
651
- /* @__PURE__ */ jsxs(
652
- "div",
653
- {
654
- className: cn(defaultClasses.previewSkeleton, classNames.previewSkeleton),
655
- style: {
656
- position: "relative",
657
- backgroundColor: bgColor,
658
- width: "200px",
659
- height: "120px",
660
- overflow: "hidden",
661
- display: "flex",
662
- alignItems: "center",
663
- justifyContent: "center"
664
- },
665
- children: [
666
- /* @__PURE__ */ jsx2("div", { style: { position: "absolute", inset: 0, overflow: "hidden" }, children: /* @__PURE__ */ jsx2(
667
- "div",
668
- {
669
- style: {
670
- position: "absolute",
671
- inset: 0,
672
- background: `linear-gradient(90deg, transparent, ${shimmerColor}, transparent)`,
673
- animation: "sharesheet-shimmer 1.5s infinite"
674
- }
675
- }
676
- ) }),
677
- /* @__PURE__ */ jsx2(Film, { size: 32, style: { color: textColor, opacity: 0.4 } })
678
- ]
679
- }
680
- ),
681
- /* @__PURE__ */ jsx2(UrlLabel, {}),
682
- /* @__PURE__ */ jsx2(
683
- "video",
684
- {
685
- src: url,
686
- poster,
687
- onLoadedData: handleMediaLoad,
688
- onError: handleMediaError,
689
- style: { display: "none" },
690
- muted: true,
691
- playsInline: true,
692
- preload: "metadata"
693
- }
694
- )
695
- ] });
696
- }
697
- return /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", alignItems: "center" }, children: [
698
- /* @__PURE__ */ jsxs("div", { style: { position: "relative", borderRadius: "12px", overflow: "hidden" }, children: [
699
- /* @__PURE__ */ jsx2(
700
- "video",
701
- {
702
- src: url,
703
- poster,
704
- className: cn(defaultClasses.previewVideo, classNames.previewVideo),
705
- style: {
706
- maxWidth: "100%",
707
- maxHeight: "180px",
708
- display: "block"
709
- },
710
- muted: true,
711
- playsInline: true,
712
- preload: "metadata"
713
- }
714
- ),
715
- /* @__PURE__ */ jsx2(
716
- "div",
717
- {
718
- style: {
719
- position: "absolute",
720
- inset: 0,
721
- display: "flex",
722
- alignItems: "center",
723
- justifyContent: "center",
724
- pointerEvents: "none"
725
- },
726
- children: /* @__PURE__ */ jsx2(
727
- "div",
580
+ display: "flex",
581
+ flexDirection: "column",
582
+ alignItems: "center",
583
+ justifyContent: "center",
584
+ gap: "8px",
585
+ padding: "16px"
586
+ },
587
+ children: [
588
+ /* @__PURE__ */ jsx2(Link2, { size: 32, style: { color: textColor, opacity: 0.4 } }),
589
+ ogData?.title && /* @__PURE__ */ jsx2(
590
+ "span",
728
591
  {
729
592
  style: {
730
- backgroundColor: "rgba(0, 0, 0, 0.5)",
731
- borderRadius: "50%",
732
- padding: "10px"
593
+ color: textColor,
594
+ fontSize: "12px",
595
+ opacity: 0.6,
596
+ textAlign: "center",
597
+ maxWidth: "280px",
598
+ overflow: "hidden",
599
+ textOverflow: "ellipsis",
600
+ display: "-webkit-box",
601
+ WebkitLineClamp: 2,
602
+ WebkitBoxOrient: "vertical"
733
603
  },
734
- children: /* @__PURE__ */ jsx2(Play, { size: 20, fill: "white", color: "white" })
604
+ children: ogData.title
735
605
  }
736
606
  )
737
- }
738
- )
739
- ] }),
740
- /* @__PURE__ */ jsx2(UrlLabel, {})
741
- ] });
742
- case "audio":
743
- return /* @__PURE__ */ jsx2(PlaceholderCard, { icon: Music, label: filename || "Audio", displayUrl: url });
744
- case "file":
745
- return /* @__PURE__ */ jsx2(PlaceholderCard, { icon: FileText, label: filename || "File", displayUrl: url });
746
- case "link":
747
- default:
748
- return /* @__PURE__ */ jsx2(PlaceholderCard, { icon: Link2, displayUrl: url });
607
+ ]
608
+ }
609
+ )
610
+ }
611
+ ) });
612
+ }
613
+ if (!imageLoaded) {
614
+ return /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", alignItems: "center", width: "100%" }, children: [
615
+ /* @__PURE__ */ jsxs(
616
+ "div",
617
+ {
618
+ className: cn(defaultClasses.previewSkeleton, classNames.previewSkeleton),
619
+ style: {
620
+ position: "relative",
621
+ backgroundColor: bgColor,
622
+ width: "100%",
623
+ maxWidth: "320px",
624
+ aspectRatio: "1.91 / 1",
625
+ overflow: "hidden",
626
+ display: "flex",
627
+ alignItems: "center",
628
+ justifyContent: "center"
629
+ },
630
+ children: [
631
+ /* @__PURE__ */ jsx2("div", { style: { position: "absolute", inset: 0, overflow: "hidden" }, children: /* @__PURE__ */ jsx2(
632
+ "div",
633
+ {
634
+ style: {
635
+ position: "absolute",
636
+ inset: 0,
637
+ background: `linear-gradient(90deg, transparent, ${shimmerColor}, transparent)`,
638
+ animation: "sharesheet-shimmer 1.5s infinite"
639
+ }
640
+ }
641
+ ) }),
642
+ /* @__PURE__ */ jsx2(Image, { size: 32, style: { color: textColor, opacity: 0.4 } })
643
+ ]
644
+ }
645
+ ),
646
+ /* @__PURE__ */ jsx2(
647
+ "img",
648
+ {
649
+ src: ogImage,
650
+ alt: ogData.title || "Preview",
651
+ onLoad: handleImageLoad,
652
+ onError: handleImageError,
653
+ style: { display: "none" }
654
+ }
655
+ )
656
+ ] });
749
657
  }
658
+ return /* @__PURE__ */ jsx2("div", { style: { display: "flex", flexDirection: "column", alignItems: "center", width: "100%" }, children: /* @__PURE__ */ jsx2(
659
+ "img",
660
+ {
661
+ src: ogImage,
662
+ alt: ogData.title || "Preview",
663
+ className: cn(defaultClasses.previewImage, classNames.previewImage),
664
+ style: {
665
+ width: "100%",
666
+ maxWidth: "320px",
667
+ height: "auto",
668
+ borderRadius: "12px",
669
+ opacity: 1,
670
+ transition: "opacity 0.3s ease-in-out"
671
+ }
672
+ }
673
+ ) });
750
674
  };
751
675
  return /* @__PURE__ */ jsxs("div", { className: cn(defaultClasses.root, classNames.root, className), children: [
752
676
  /* @__PURE__ */ jsx2("style", { dangerouslySetInnerHTML: { __html: shimmerKeyframes } }),
@@ -768,7 +692,7 @@ function ShareSheetContent({
768
692
  }
769
693
  )
770
694
  ] }),
771
- showPreview && /* @__PURE__ */ jsx2("div", { className: cn(defaultClasses.preview, classNames.preview), children: renderPreview() }),
695
+ /* @__PURE__ */ jsx2("div", { className: cn(defaultClasses.preview, classNames.preview), children: renderPreview() }),
772
696
  /* @__PURE__ */ jsx2("div", { className: cn(defaultClasses.grid, classNames.grid), children: visibleButtons.map((btn) => /* @__PURE__ */ jsxs(
773
697
  "button",
774
698
  {
@@ -808,8 +732,8 @@ function ShareSheetContent({
808
732
  import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
809
733
  var defaultDrawerClasses = {
810
734
  overlay: "fixed inset-0 z-[70]",
811
- drawer: "flex flex-col rounded-t-[14px] h-[70%] mt-24 fixed bottom-0 left-0 right-0 z-[80] border-t outline-none",
812
- drawerInner: "p-4 rounded-t-[14px] flex-1 overflow-auto",
735
+ drawer: "flex flex-col rounded-t-[14px] max-h-[90%] fixed bottom-0 left-0 right-0 z-[80] border-t outline-none",
736
+ drawerInner: "p-4 pb-8 rounded-t-[14px] overflow-auto",
813
737
  handle: "mx-auto w-12 h-1.5 shrink-0 rounded-full mb-6",
814
738
  trigger: ""
815
739
  };
@@ -820,7 +744,6 @@ function ShareSheetDrawer({
820
744
  title = "Share",
821
745
  shareUrl,
822
746
  shareText,
823
- preview,
824
747
  downloadUrl,
825
748
  downloadFilename,
826
749
  disabled,
@@ -898,7 +821,6 @@ function ShareSheetDrawer({
898
821
  title,
899
822
  shareUrl,
900
823
  shareText,
901
- preview,
902
824
  downloadUrl,
903
825
  downloadFilename,
904
826
  className,