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