@pollar/react 0.10.1-rc.3 → 0.10.1-rc.4

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
@@ -1035,11 +1035,62 @@ var PollarModalFooter = () => {
1035
1035
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-footer-name", children: "Pollar" }),
1036
1036
  /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "pollar-footer-version", children: [
1037
1037
  "v",
1038
- "0.10.1-rc.3"
1038
+ "0.10.1-rc.4"
1039
1039
  ] })
1040
1040
  ] })
1041
1041
  ] });
1042
1042
  };
1043
+ function CopyButton({ value, label = "Copy", className }) {
1044
+ const [copied, setCopied] = react.useState(false);
1045
+ const timerRef = react.useRef(null);
1046
+ react.useEffect(() => {
1047
+ return () => {
1048
+ if (timerRef.current !== null) clearTimeout(timerRef.current);
1049
+ };
1050
+ }, []);
1051
+ function handleCopy(e) {
1052
+ e.stopPropagation();
1053
+ if (!value || !navigator.clipboard) return;
1054
+ void navigator.clipboard.writeText(value).then(() => {
1055
+ setCopied(true);
1056
+ if (timerRef.current !== null) clearTimeout(timerRef.current);
1057
+ timerRef.current = setTimeout(() => {
1058
+ setCopied(false);
1059
+ timerRef.current = null;
1060
+ }, 1500);
1061
+ });
1062
+ }
1063
+ return /* @__PURE__ */ jsxRuntime.jsx(
1064
+ "button",
1065
+ {
1066
+ type: "button",
1067
+ className: `pollar-copy-btn${className ? ` ${className}` : ""}`,
1068
+ onClick: handleCopy,
1069
+ "aria-label": copied ? "Copied" : label,
1070
+ children: copied ? /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "13", height: "13", viewBox: "0 0 14 14", fill: "none", "aria-hidden": true, children: /* @__PURE__ */ jsxRuntime.jsx(
1071
+ "path",
1072
+ {
1073
+ d: "M3.5 7l2.5 2.5 4.5-5",
1074
+ stroke: "currentColor",
1075
+ strokeWidth: "1.5",
1076
+ strokeLinecap: "round",
1077
+ strokeLinejoin: "round"
1078
+ }
1079
+ ) }) : /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "13", height: "13", viewBox: "0 0 13 13", fill: "none", "aria-hidden": true, children: [
1080
+ /* @__PURE__ */ jsxRuntime.jsx("rect", { x: "4", y: "4", width: "8", height: "8", rx: "1.5", stroke: "currentColor", strokeWidth: "1.5" }),
1081
+ /* @__PURE__ */ jsxRuntime.jsx(
1082
+ "path",
1083
+ {
1084
+ d: "M3 9H2a1 1 0 01-1-1V2a1 1 0 011-1h6a1 1 0 011 1v1",
1085
+ stroke: "currentColor",
1086
+ strokeWidth: "1.5",
1087
+ strokeLinecap: "round"
1088
+ }
1089
+ )
1090
+ ] })
1091
+ }
1092
+ );
1093
+ }
1043
1094
  function ModalStatusBanner({ message, status, onCancel, onRetry }) {
1044
1095
  if (!message && status === "NONE") {
1045
1096
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-status" });
@@ -4637,6 +4688,7 @@ function TxHistoryModalTemplate({
4637
4688
  txHistory.step === "loaded" && records.length === 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-modal-empty", children: "No transactions yet." }),
4638
4689
  records.map((record) => {
4639
4690
  const explorerUrl = `https://stellar.expert/explorer/${record.network === "testnet" ? "testnet" : "public"}/tx/${record.hash}`;
4691
+ const destination = typeof record.details?.destination === "string" ? record.details.destination : void 0;
4640
4692
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-hist-item", children: [
4641
4693
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-hist-item-summary", children: record.summary }),
4642
4694
  /* @__PURE__ */ jsxRuntime.jsx(StatusBadge, { status: record.status }),
@@ -4655,6 +4707,10 @@ function TxHistoryModalTemplate({
4655
4707
  "\xB7 ",
4656
4708
  formatDate(record.createdAt)
4657
4709
  ] }),
4710
+ destination && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
4711
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: "\xB7" }),
4712
+ /* @__PURE__ */ jsxRuntime.jsx(CopyButton, { value: destination, label: "Copy wallet address", className: "pollar-copy-btn-sm" })
4713
+ ] }),
4658
4714
  /* @__PURE__ */ jsxRuntime.jsx("span", { children: "\xB7" }),
4659
4715
  /* @__PURE__ */ jsxRuntime.jsxs(
4660
4716
  "a",
@@ -4743,7 +4799,7 @@ function TxHistoryModal({ onClose }) {
4743
4799
  }
4744
4800
  function formatBalance2(balance) {
4745
4801
  const n = parseFloat(balance);
4746
- return isNaN(n) ? balance : n.toLocaleString(void 0, { maximumFractionDigits: 7 });
4802
+ return isNaN(n) ? balance : n.toLocaleString(void 0, { minimumFractionDigits: 7, maximumFractionDigits: 7 });
4747
4803
  }
4748
4804
  function cropAddress2(address) {
4749
4805
  if (address.length <= 16) return address;
@@ -4752,7 +4808,13 @@ function cropAddress2(address) {
4752
4808
  function BalanceItem({ record }) {
4753
4809
  const balanceDiffers = record.balance !== record.available;
4754
4810
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-bal-item", children: [
4755
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-bal-asset", children: record.code }),
4811
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-bal-asset-info", children: [
4812
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-bal-asset", children: record.code }),
4813
+ record.issuer && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "pollar-bal-issuer", children: [
4814
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-bal-issuer-addr", children: cropAddress2(record.issuer) }),
4815
+ /* @__PURE__ */ jsxRuntime.jsx(CopyButton, { value: record.issuer, label: "Copy issuer address", className: "pollar-copy-btn-sm" })
4816
+ ] })
4817
+ ] }),
4756
4818
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-bal-amounts", children: [
4757
4819
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-bal-amount", children: formatBalance2(record.balance) }),
4758
4820
  balanceDiffers && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "pollar-bal-available", children: [
@@ -4815,7 +4877,10 @@ function WalletBalanceModalTemplate({
4815
4877
  /* @__PURE__ */ jsxRuntime.jsx("button", { className: "pollar-modal-close", onClick: onClose, "aria-label": "Close", children: /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", "aria-hidden": true, children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M2 2l12 12M14 2L2 14", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" }) }) })
4816
4878
  ] })
4817
4879
  ] }),
4818
- walletAddress && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-bal-address", children: cropAddress2(walletAddress) }),
4880
+ walletAddress && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-bal-address-row", children: [
4881
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-bal-address", children: cropAddress2(walletAddress) }),
4882
+ /* @__PURE__ */ jsxRuntime.jsx(CopyButton, { value: walletAddress, label: "Copy wallet address" })
4883
+ ] }),
4819
4884
  isLoading && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-modal-empty", children: "Loading\u2026" }),
4820
4885
  walletBalance.step === "error" && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-modal-error", children: walletBalance.message }),
4821
4886
  data && !data.exists && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-modal-empty", children: [