stellar-wallet-kit 2.0.2 → 2.0.3

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.mjs CHANGED
@@ -577,216 +577,149 @@ function WalletModal({
577
577
  appIcon
578
578
  }) {
579
579
  useEffect(() => {
580
- const handleEsc = (e) => {
580
+ const onEsc = (e) => {
581
581
  if (e.key === "Escape") onClose();
582
582
  };
583
583
  if (isOpen) {
584
- document.addEventListener("keydown", handleEsc);
584
+ document.addEventListener("keydown", onEsc);
585
585
  document.body.style.overflow = "hidden";
586
586
  }
587
587
  return () => {
588
- document.removeEventListener("keydown", handleEsc);
589
- document.body.style.overflow = "unset";
588
+ document.removeEventListener("keydown", onEsc);
589
+ document.body.style.overflow = "auto";
590
590
  };
591
591
  }, [isOpen, onClose]);
592
592
  if (!isOpen) return null;
593
- const themeMode = theme?.mode || "light";
594
- const isDark = themeMode === "dark" || themeMode === "auto" && window.matchMedia("(prefers-color-scheme: dark)").matches;
595
- const styles = {
596
- overlay: {
597
- position: "fixed",
598
- top: 0,
599
- left: 0,
600
- right: 0,
601
- bottom: 0,
602
- backgroundColor: theme?.overlayBackground || (isDark ? "rgba(0, 0, 0, 0.8)" : "rgba(0, 0, 0, 0.5)"),
603
- display: "flex",
604
- alignItems: "center",
605
- justifyContent: "center",
606
- zIndex: 9999,
607
- animation: "swk-fade-in 0.2s ease-out"
608
- },
609
- modal: {
610
- backgroundColor: theme?.modalBackground || (isDark ? "#1a1a1a" : "#ffffff"),
611
- borderRadius: theme?.borderRadius || "16px",
612
- padding: "24px",
613
- maxWidth: "420px",
614
- width: "90%",
615
- maxHeight: "80vh",
616
- overflowY: "auto",
617
- boxShadow: isDark ? "0 8px 32px rgba(0, 0, 0, 0.4)" : "0 8px 32px rgba(0, 0, 0, 0.1)",
618
- animation: "swk-slide-up 0.3s ease-out",
619
- fontFamily: theme?.fontFamily || '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif'
620
- },
621
- header: {
622
- display: "flex",
623
- alignItems: "center",
624
- justifyContent: "space-between",
625
- marginBottom: "24px"
626
- },
627
- title: {
628
- fontSize: "20px",
629
- fontWeight: 600,
630
- color: theme?.textColor || (isDark ? "#ffffff" : "#000000"),
631
- margin: 0,
632
- display: "flex",
633
- alignItems: "center",
634
- gap: "12px"
635
- },
636
- closeButton: {
637
- background: "none",
638
- border: "none",
639
- fontSize: "24px",
640
- cursor: "pointer",
641
- padding: "4px",
642
- color: theme?.textColor || (isDark ? "#888888" : "#666666"),
643
- transition: "color 0.2s",
644
- lineHeight: 1
645
- },
646
- walletList: {
647
- display: "flex",
648
- flexDirection: "column",
649
- gap: "12px"
650
- },
651
- walletButton: {
652
- display: "flex",
653
- alignItems: "center",
654
- gap: "16px",
655
- padding: "16px",
656
- border: `1px solid ${isDark ? "#333333" : "#e5e5e5"}`,
657
- borderRadius: theme?.borderRadius || "12px",
658
- background: "none",
659
- cursor: "pointer",
660
- transition: "all 0.2s",
661
- width: "100%",
662
- textAlign: "left",
663
- fontFamily: "inherit"
664
- },
665
- walletIcon: {
666
- width: "40px",
667
- height: "40px",
668
- borderRadius: "8px",
669
- flexShrink: 0
670
- },
671
- walletInfo: {
672
- flex: 1
673
- },
674
- walletName: {
675
- fontSize: "16px",
676
- fontWeight: 500,
677
- color: theme?.textColor || (isDark ? "#ffffff" : "#000000"),
678
- margin: 0,
679
- marginBottom: "4px"
680
- },
681
- walletDescription: {
682
- fontSize: "13px",
683
- color: theme?.textColor || (isDark ? "#888888" : "#666666"),
684
- margin: 0
685
- },
686
- badge: {
687
- padding: "4px 8px",
688
- borderRadius: "6px",
689
- fontSize: "12px",
690
- fontWeight: 500,
691
- flexShrink: 0
692
- },
693
- installedBadge: {
694
- backgroundColor: theme?.primaryColor || (isDark ? "#4CAF50" : "#4CAF50"),
695
- color: "#ffffff"
696
- },
697
- notInstalledBadge: {
698
- backgroundColor: isDark ? "#333333" : "#f0f0f0",
699
- color: isDark ? "#888888" : "#666666"
700
- },
701
- footer: {
702
- marginTop: "24px",
703
- paddingTop: "16px",
704
- borderTop: `1px solid ${isDark ? "#333333" : "#e5e5e5"}`,
705
- fontSize: "13px",
706
- color: isDark ? "#888888" : "#666666",
707
- textAlign: "center"
708
- },
709
- link: {
710
- color: theme?.primaryColor || "#8b5cf6",
711
- textDecoration: "none"
712
- }
713
- };
714
- const handleWalletClick = (wallet) => {
715
- if (wallet.installed) {
716
- onSelectWallet(wallet.id);
717
- } else if (wallet.downloadUrl) {
718
- window.open(wallet.downloadUrl, "_blank");
719
- }
720
- };
593
+ const isDark = theme?.mode === "dark" || theme?.mode === "auto" && window.matchMedia("(prefers-color-scheme: dark)").matches;
594
+ const bg = theme?.modalBackground || (isDark ? "#0f0f11" : "#ffffff");
595
+ const text = theme?.textColor || (isDark ? "#ffffff" : "#0a0a0a");
596
+ const muted = isDark ? "#8b8b8b" : "#6b6b6b";
597
+ const border = isDark ? "#1f1f23" : "#eaeaea";
598
+ const hover = theme?.buttonHoverColor || (isDark ? "#1a1a1f" : "#f6f6f6");
721
599
  return /* @__PURE__ */ React3.createElement(React3.Fragment, null, /* @__PURE__ */ React3.createElement("style", null, `
722
- @keyframes swk-fade-in {
723
- from { opacity: 0; }
724
- to { opacity: 1; }
600
+ .swk-overlay {
601
+ position: fixed;
602
+ inset: 0;
603
+ background: rgba(0,0,0,0.55);
604
+ display: flex;
605
+ align-items: center;
606
+ justify-content: center;
607
+ z-index: 9999;
725
608
  }
726
- @keyframes swk-slide-up {
727
- from {
728
- opacity: 0;
729
- transform: translateY(20px);
730
- }
731
- to {
732
- opacity: 1;
733
- transform: translateY(0);
734
- }
609
+
610
+ .swk-modal {
611
+ width: 420px;
612
+ max-width: 92vw;
613
+ background: ${bg};
614
+ border-radius: 20px;
615
+ padding: 28px;
616
+ box-shadow: 0 20px 60px rgba(0,0,0,0.4);
617
+ font-family: ${theme?.fontFamily || "Inter, system-ui, sans-serif"};
618
+ }
619
+
620
+ .swk-wallet {
621
+ display: flex;
622
+ align-items: center;
623
+ gap: 14px;
624
+ padding: 14px 16px;
625
+ border-radius: 14px;
626
+ cursor: pointer;
627
+ transition: background 0.15s ease;
735
628
  }
736
- .swk-wallet-button:hover {
737
- background-color: ${theme?.buttonHoverColor || (isDark ? "#252525" : "#f5f5f5")} !important;
738
- border-color: ${theme?.primaryColor || "#8b5cf6"} !important;
629
+
630
+ .swk-wallet:hover {
631
+ background: ${hover};
739
632
  }
740
- .swk-close-button:hover {
741
- color: ${theme?.primaryColor || "#8b5cf6"} !important;
633
+
634
+ .swk-pill {
635
+ font-size: 12px;
636
+ padding: 4px 10px;
637
+ border-radius: 999px;
638
+ background: ${theme?.primaryColor || "#6c5ce7"};
639
+ color: white;
640
+ font-weight: 500;
742
641
  }
743
- `), /* @__PURE__ */ React3.createElement("div", { style: styles.overlay, onClick: onClose }, /* @__PURE__ */ React3.createElement("div", { style: styles.modal, onClick: (e) => e.stopPropagation() }, /* @__PURE__ */ React3.createElement("div", { style: styles.header }, /* @__PURE__ */ React3.createElement("h2", { style: styles.title }, appIcon && /* @__PURE__ */ React3.createElement("img", { src: appIcon, alt: "", style: { width: "32px", height: "32px", borderRadius: "8px" } }), "Connect Wallet"), /* @__PURE__ */ React3.createElement(
744
- "button",
642
+ `), /* @__PURE__ */ React3.createElement("div", { className: "swk-overlay", onClick: onClose }, /* @__PURE__ */ React3.createElement("div", { className: "swk-modal", onClick: (e) => e.stopPropagation() }, /* @__PURE__ */ React3.createElement("div", { style: { marginBottom: 24 } }, /* @__PURE__ */ React3.createElement(
643
+ "div",
745
644
  {
746
- className: "swk-close-button",
747
- style: styles.closeButton,
748
- onClick: onClose,
749
- "aria-label": "Close modal"
645
+ style: {
646
+ display: "flex",
647
+ alignItems: "center",
648
+ gap: 12,
649
+ marginBottom: 8
650
+ }
750
651
  },
751
- "\xD7"
752
- )), /* @__PURE__ */ React3.createElement("div", { style: styles.walletList }, wallets.map((wallet) => /* @__PURE__ */ React3.createElement(
753
- "button",
652
+ appIcon && /* @__PURE__ */ React3.createElement(
653
+ "img",
654
+ {
655
+ src: appIcon,
656
+ alt: "",
657
+ style: { width: 32, height: 32, borderRadius: 8 }
658
+ }
659
+ ),
660
+ /* @__PURE__ */ React3.createElement("span", { style: { color: muted, fontSize: 14 } }, "Log in or sign up")
661
+ ), /* @__PURE__ */ React3.createElement(
662
+ "h2",
663
+ {
664
+ style: {
665
+ margin: 0,
666
+ fontSize: 22,
667
+ fontWeight: 600,
668
+ color: text
669
+ }
670
+ },
671
+ appName
672
+ )), /* @__PURE__ */ React3.createElement("div", { style: { display: "flex", flexDirection: "column", gap: 8 } }, wallets.map((wallet, i) => /* @__PURE__ */ React3.createElement(
673
+ "div",
754
674
  {
755
675
  key: wallet.id,
756
- className: "swk-wallet-button",
757
- style: styles.walletButton,
758
- onClick: () => handleWalletClick(wallet),
759
- disabled: !wallet.installed && !wallet.downloadUrl
676
+ className: "swk-wallet",
677
+ onClick: () => onSelectWallet(wallet.id)
760
678
  },
761
679
  /* @__PURE__ */ React3.createElement(
762
680
  "img",
763
681
  {
764
682
  src: wallet.icon,
765
- alt: `${wallet.name} icon`,
766
- style: styles.walletIcon
683
+ alt: wallet.name,
684
+ style: { width: 36, height: 36, borderRadius: 10 }
767
685
  }
768
686
  ),
769
- /* @__PURE__ */ React3.createElement("div", { style: styles.walletInfo }, /* @__PURE__ */ React3.createElement("p", { style: styles.walletName }, wallet.name), wallet.description && /* @__PURE__ */ React3.createElement("p", { style: styles.walletDescription }, wallet.description)),
770
- /* @__PURE__ */ React3.createElement(
687
+ /* @__PURE__ */ React3.createElement("div", { style: { flex: 1 } }, /* @__PURE__ */ React3.createElement(
771
688
  "div",
772
689
  {
773
690
  style: {
774
- ...styles.badge,
775
- ...wallet.installed ? styles.installedBadge : styles.notInstalledBadge
691
+ fontSize: 15,
692
+ fontWeight: 500,
693
+ color: text
776
694
  }
777
695
  },
778
- wallet.installed ? "Installed" : "Get"
779
- )
780
- ))), /* @__PURE__ */ React3.createElement("div", { style: styles.footer }, /* @__PURE__ */ React3.createElement("p", { style: { margin: 0 } }, "Don't have a wallet?", " ", /* @__PURE__ */ React3.createElement(
781
- "a",
696
+ wallet.name
697
+ ), wallet.description && /* @__PURE__ */ React3.createElement(
698
+ "div",
699
+ {
700
+ style: {
701
+ fontSize: 13,
702
+ color: muted,
703
+ marginTop: 2
704
+ }
705
+ },
706
+ wallet.description
707
+ )),
708
+ i === 0 && /* @__PURE__ */ React3.createElement("div", { className: "swk-pill" }, "Recent")
709
+ ))), /* @__PURE__ */ React3.createElement(
710
+ "div",
782
711
  {
783
- href: "https://www.stellar.org/ecosystem/projects#wallets",
784
- target: "_blank",
785
- rel: "noopener noreferrer",
786
- style: styles.link
712
+ style: {
713
+ marginTop: 24,
714
+ paddingTop: 16,
715
+ borderTop: `1px solid ${border}`,
716
+ textAlign: "center",
717
+ fontSize: 13,
718
+ color: muted
719
+ }
787
720
  },
788
- "Learn more"
789
- ))))));
721
+ "Powered by Stellar Wallet Kit"
722
+ ))));
790
723
  }
791
724
 
792
725
  // src/components/ConnectButton.tsx