cilantro-react 0.1.0 → 0.1.1
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/README.md +155 -2
- package/dist/index.d.mts +132 -15
- package/dist/index.d.ts +132 -15
- package/dist/index.js +604 -315
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +535 -253
- package/dist/index.mjs.map +1 -1
- package/dist/themes/default.css +43 -0
- package/package.json +4 -3
package/dist/index.mjs
CHANGED
|
@@ -423,6 +423,18 @@ function CilantroProvider({
|
|
|
423
423
|
);
|
|
424
424
|
}
|
|
425
425
|
|
|
426
|
+
// src/hooks/useSelectedWallet.ts
|
|
427
|
+
function useSelectedWallet() {
|
|
428
|
+
const { selectedWallet, isLoading, refreshWallets } = useWallets();
|
|
429
|
+
return { selectedWallet, isLoading, refreshWallets };
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
// src/hooks/useWalletAddress.ts
|
|
433
|
+
function useWalletAddress() {
|
|
434
|
+
const { selectedWallet } = useWallets();
|
|
435
|
+
return selectedWallet?.address ?? selectedWallet?.walletAddress ?? null;
|
|
436
|
+
}
|
|
437
|
+
|
|
426
438
|
// src/hooks/useSigners.ts
|
|
427
439
|
import { useState as useState3, useEffect as useEffect4, useCallback } from "react";
|
|
428
440
|
|
|
@@ -570,8 +582,76 @@ function useSigners(options = {}) {
|
|
|
570
582
|
return { signers, isLoading, error, refresh };
|
|
571
583
|
}
|
|
572
584
|
|
|
573
|
-
// src/hooks/
|
|
585
|
+
// src/hooks/useSignersForSelectedWallet.ts
|
|
586
|
+
function useSignersForSelectedWallet(options = {}) {
|
|
587
|
+
const { walletId: walletIdOverride } = options;
|
|
588
|
+
const { selectedWallet } = useWallets();
|
|
589
|
+
const effectiveWalletId = walletIdOverride ?? selectedWallet?.id ?? selectedWallet?.walletId ?? null;
|
|
590
|
+
return useSigners({ walletId: effectiveWalletId });
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
// src/hooks/useDelegatedKeys.ts
|
|
574
594
|
import { useState as useState4, useEffect as useEffect5, useCallback as useCallback2 } from "react";
|
|
595
|
+
import { findAll } from "cilantro-sdk/delegated-keys";
|
|
596
|
+
function normalizeKeys(list) {
|
|
597
|
+
return list.filter((k) => k != null && typeof k === "object" && "id" in k).map((k) => ({
|
|
598
|
+
id: String(k.id ?? ""),
|
|
599
|
+
walletId: String(k.walletId ?? ""),
|
|
600
|
+
name: k.name,
|
|
601
|
+
publicKey: String(k.publicKey ?? ""),
|
|
602
|
+
permissions: k.permissions ?? {},
|
|
603
|
+
isActive: k.isActive !== false,
|
|
604
|
+
createdAt: k.createdAt,
|
|
605
|
+
expiresAt: k.expiresAt,
|
|
606
|
+
...k
|
|
607
|
+
}));
|
|
608
|
+
}
|
|
609
|
+
function useDelegatedKeys(options = {}) {
|
|
610
|
+
const { walletId, filterActive = true } = options;
|
|
611
|
+
const { token } = useCilantroAuth();
|
|
612
|
+
const [keys, setKeys] = useState4([]);
|
|
613
|
+
const [isLoading, setIsLoading] = useState4(false);
|
|
614
|
+
const [error, setError] = useState4(null);
|
|
615
|
+
const loadKeys = useCallback2(async () => {
|
|
616
|
+
if (!walletId) {
|
|
617
|
+
setKeys([]);
|
|
618
|
+
return;
|
|
619
|
+
}
|
|
620
|
+
setIsLoading(true);
|
|
621
|
+
setError(null);
|
|
622
|
+
try {
|
|
623
|
+
if (token) setSdkAuth(token);
|
|
624
|
+
const result = await findAll(walletId);
|
|
625
|
+
const keysData = extractResponseData(result) ?? [];
|
|
626
|
+
const list = Array.isArray(keysData) ? keysData : [];
|
|
627
|
+
let loaded = normalizeKeys(list);
|
|
628
|
+
if (filterActive) {
|
|
629
|
+
const now = Date.now();
|
|
630
|
+
loaded = loaded.filter((key) => {
|
|
631
|
+
if (!key.isActive) return false;
|
|
632
|
+
const exp = key.expiresAt ? new Date(key.expiresAt).getTime() : null;
|
|
633
|
+
return exp === null || exp > now;
|
|
634
|
+
});
|
|
635
|
+
}
|
|
636
|
+
setKeys(loaded);
|
|
637
|
+
} catch (err) {
|
|
638
|
+
setError(err instanceof Error ? err.message : String(err));
|
|
639
|
+
setKeys([]);
|
|
640
|
+
} finally {
|
|
641
|
+
setIsLoading(false);
|
|
642
|
+
}
|
|
643
|
+
}, [walletId, token, filterActive]);
|
|
644
|
+
useEffect5(() => {
|
|
645
|
+
loadKeys();
|
|
646
|
+
}, [loadKeys]);
|
|
647
|
+
const refresh = useCallback2(async () => {
|
|
648
|
+
if (walletId) await loadKeys();
|
|
649
|
+
}, [walletId, loadKeys]);
|
|
650
|
+
return { keys, isLoading, error, refresh };
|
|
651
|
+
}
|
|
652
|
+
|
|
653
|
+
// src/hooks/useSignerSelection.ts
|
|
654
|
+
import { useState as useState5, useEffect as useEffect6, useCallback as useCallback3 } from "react";
|
|
575
655
|
function useSignerSelection(options = {}) {
|
|
576
656
|
const { walletId: walletIdOverride, signingMethod = "sdk-signer" } = options;
|
|
577
657
|
const { selectedWallet } = useWallets();
|
|
@@ -579,17 +659,17 @@ function useSignerSelection(options = {}) {
|
|
|
579
659
|
const { signers: availableSigners, isLoading: isLoadingSigners } = useSigners({
|
|
580
660
|
walletId: effectiveWalletId || null
|
|
581
661
|
});
|
|
582
|
-
const [selectedWalletId, setSelectedWalletId] =
|
|
583
|
-
const [selectedSigner, setSelectedSigner] =
|
|
584
|
-
|
|
662
|
+
const [selectedWalletId, setSelectedWalletId] = useState5(effectiveWalletId);
|
|
663
|
+
const [selectedSigner, setSelectedSigner] = useState5(null);
|
|
664
|
+
useEffect6(() => {
|
|
585
665
|
setSelectedWalletId(effectiveWalletId);
|
|
586
666
|
}, [effectiveWalletId]);
|
|
587
|
-
|
|
667
|
+
useEffect6(() => {
|
|
588
668
|
if (signingMethod !== "sdk-signer") {
|
|
589
669
|
setSelectedSigner(null);
|
|
590
670
|
}
|
|
591
671
|
}, [signingMethod]);
|
|
592
|
-
const reset =
|
|
672
|
+
const reset = useCallback3(() => {
|
|
593
673
|
setSelectedWalletId("");
|
|
594
674
|
setSelectedSigner(null);
|
|
595
675
|
}, []);
|
|
@@ -604,8 +684,43 @@ function useSignerSelection(options = {}) {
|
|
|
604
684
|
};
|
|
605
685
|
}
|
|
606
686
|
|
|
687
|
+
// src/hooks/useCanSign.ts
|
|
688
|
+
import { useMemo } from "react";
|
|
689
|
+
function useCanSign(options = {}) {
|
|
690
|
+
const {
|
|
691
|
+
signingMethod = "sdk-signer",
|
|
692
|
+
requireSigner = true,
|
|
693
|
+
walletAdapterConnected
|
|
694
|
+
} = options;
|
|
695
|
+
const { token } = useCilantroAuth();
|
|
696
|
+
const { selectedWallet } = useWallets();
|
|
697
|
+
const { selectedSigner } = useSignerSelection({ signingMethod });
|
|
698
|
+
return useMemo(() => {
|
|
699
|
+
const hasToken = !!token;
|
|
700
|
+
const hasWallet = !!selectedWallet?.id || !!selectedWallet?.walletId;
|
|
701
|
+
const isSdkSigner = signingMethod === "sdk-signer";
|
|
702
|
+
const hasSigner = isSdkSigner ? !!selectedSigner : walletAdapterConnected !== void 0 ? walletAdapterConnected : hasWallet;
|
|
703
|
+
const canSign = hasToken && hasWallet && (requireSigner ? hasSigner : true);
|
|
704
|
+
return {
|
|
705
|
+
hasToken,
|
|
706
|
+
hasWallet,
|
|
707
|
+
hasSigner,
|
|
708
|
+
canSignMessage: canSign,
|
|
709
|
+
canSignTransaction: canSign
|
|
710
|
+
};
|
|
711
|
+
}, [
|
|
712
|
+
token,
|
|
713
|
+
selectedWallet?.id,
|
|
714
|
+
selectedWallet?.walletId,
|
|
715
|
+
selectedSigner,
|
|
716
|
+
signingMethod,
|
|
717
|
+
requireSigner,
|
|
718
|
+
walletAdapterConnected
|
|
719
|
+
]);
|
|
720
|
+
}
|
|
721
|
+
|
|
607
722
|
// src/hooks/useMessageSigning.ts
|
|
608
|
-
import { useState as
|
|
723
|
+
import { useState as useState6 } from "react";
|
|
609
724
|
|
|
610
725
|
// src/core/signer-signing/core.ts
|
|
611
726
|
import { PublicKey } from "@solana/web3.js";
|
|
@@ -1181,9 +1296,9 @@ function useMessageSigning(options) {
|
|
|
1181
1296
|
walletAdapterSignMessage,
|
|
1182
1297
|
walletAdapterPublicKey
|
|
1183
1298
|
} = options;
|
|
1184
|
-
const [messageText, setMessageText] =
|
|
1185
|
-
const [signResultState, setSignResultState] =
|
|
1186
|
-
const [isSigning, setIsSigning] =
|
|
1299
|
+
const [messageText, setMessageText] = useState6("Hello, Solana!");
|
|
1300
|
+
const [signResultState, setSignResultState] = useState6({ status: "idle" });
|
|
1301
|
+
const [isSigning, setIsSigning] = useState6(false);
|
|
1187
1302
|
const handleSign = async () => {
|
|
1188
1303
|
setIsSigning(true);
|
|
1189
1304
|
setSignResultState({ status: "loading" });
|
|
@@ -1241,7 +1356,7 @@ function useMessageSigning(options) {
|
|
|
1241
1356
|
}
|
|
1242
1357
|
|
|
1243
1358
|
// src/hooks/useTransactionSigning.ts
|
|
1244
|
-
import { useState as
|
|
1359
|
+
import { useState as useState7 } from "react";
|
|
1245
1360
|
function useTransactionSigning(options) {
|
|
1246
1361
|
const {
|
|
1247
1362
|
token,
|
|
@@ -1252,9 +1367,9 @@ function useTransactionSigning(options) {
|
|
|
1252
1367
|
walletAdapterPublicKey,
|
|
1253
1368
|
connection
|
|
1254
1369
|
} = options;
|
|
1255
|
-
const [transactionResultState, setTransactionResultState] =
|
|
1256
|
-
const [isSigningTransaction, setIsSigningTransaction] =
|
|
1257
|
-
const [isSendingTransaction, setIsSendingTransaction] =
|
|
1370
|
+
const [transactionResultState, setTransactionResultState] = useState7({ status: "idle" });
|
|
1371
|
+
const [isSigningTransaction, setIsSigningTransaction] = useState7(false);
|
|
1372
|
+
const [isSendingTransaction, setIsSendingTransaction] = useState7(false);
|
|
1258
1373
|
const signTransaction = async (transaction) => {
|
|
1259
1374
|
setIsSigningTransaction(true);
|
|
1260
1375
|
setTransactionResultState({ status: "loading" });
|
|
@@ -1433,14 +1548,30 @@ var SelectItem = React.forwardRef(({ className, children, ...props }, ref) => /*
|
|
|
1433
1548
|
));
|
|
1434
1549
|
SelectItem.displayName = SelectPrimitive.Item.displayName;
|
|
1435
1550
|
|
|
1551
|
+
// src/ui/skeleton.tsx
|
|
1552
|
+
import * as React2 from "react";
|
|
1553
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
1554
|
+
var Skeleton = React2.forwardRef(
|
|
1555
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx5(
|
|
1556
|
+
"div",
|
|
1557
|
+
{
|
|
1558
|
+
ref,
|
|
1559
|
+
className: cn("rounded-md bg-muted animate-pulse", className),
|
|
1560
|
+
...props
|
|
1561
|
+
}
|
|
1562
|
+
)
|
|
1563
|
+
);
|
|
1564
|
+
Skeleton.displayName = "Skeleton";
|
|
1565
|
+
|
|
1436
1566
|
// src/components/WalletSelector.tsx
|
|
1437
|
-
import { Fragment, jsx as
|
|
1567
|
+
import { Fragment, jsx as jsx6, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
1438
1568
|
function WalletSelector(props) {
|
|
1439
1569
|
const {
|
|
1440
1570
|
value,
|
|
1441
1571
|
onWalletChange,
|
|
1442
1572
|
className,
|
|
1443
1573
|
classNames,
|
|
1574
|
+
useSkeleton = true,
|
|
1444
1575
|
placeholder = "Select a wallet",
|
|
1445
1576
|
renderTrigger,
|
|
1446
1577
|
renderList,
|
|
@@ -1458,7 +1589,7 @@ function WalletSelector(props) {
|
|
|
1458
1589
|
onWalletChange?.(id, wallets.find((w) => w.id === id || w.walletId === id) ?? null);
|
|
1459
1590
|
};
|
|
1460
1591
|
if (children) {
|
|
1461
|
-
return /* @__PURE__ */
|
|
1592
|
+
return /* @__PURE__ */ jsx6(Fragment, { children: children({
|
|
1462
1593
|
wallets,
|
|
1463
1594
|
selectedWallet: selected,
|
|
1464
1595
|
selectWallet: (id) => {
|
|
@@ -1476,17 +1607,38 @@ function WalletSelector(props) {
|
|
|
1476
1607
|
renderList?.({ wallets, selectedWallet: selected, onSelect: handleSelect, isLoading })
|
|
1477
1608
|
] });
|
|
1478
1609
|
}
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1610
|
+
if (isLoading && useSkeleton) {
|
|
1611
|
+
return /* @__PURE__ */ jsx6(
|
|
1612
|
+
"div",
|
|
1613
|
+
{
|
|
1614
|
+
className: cn(className, classNames?.root, classNames?.loading),
|
|
1615
|
+
"data-cilantro-wallet-selector": true,
|
|
1616
|
+
"aria-busy": "true",
|
|
1617
|
+
"aria-live": "polite",
|
|
1618
|
+
children: /* @__PURE__ */ jsx6(
|
|
1619
|
+
"div",
|
|
1620
|
+
{
|
|
1621
|
+
className: cn(
|
|
1622
|
+
"flex h-9 w-full items-center justify-between rounded-md border border-input bg-transparent px-3 py-2",
|
|
1623
|
+
classNames?.trigger
|
|
1624
|
+
),
|
|
1625
|
+
children: /* @__PURE__ */ jsx6(Skeleton, { className: cn("h-4 flex-1 rounded", classNames?.skeleton) })
|
|
1626
|
+
}
|
|
1627
|
+
)
|
|
1628
|
+
}
|
|
1629
|
+
);
|
|
1630
|
+
}
|
|
1631
|
+
return /* @__PURE__ */ jsx6("div", { className: cn(className, classNames?.root), "data-cilantro-wallet-selector": true, children: /* @__PURE__ */ jsxs2(Select, { value: effectiveValue || void 0, onValueChange: handleValueChange, disabled: isLoading, children: [
|
|
1632
|
+
/* @__PURE__ */ jsx6(SelectTrigger, { className: classNames?.trigger, "aria-label": "Select wallet", children: /* @__PURE__ */ jsx6(SelectValue, { placeholder: isLoading ? "Loading..." : placeholder }) }),
|
|
1633
|
+
/* @__PURE__ */ jsx6(SelectContent, { className: classNames?.content, children: wallets.map((w) => /* @__PURE__ */ jsx6(SelectItem, { value: w.id, className: classNames?.item, children: w.walletName || w.id }, w.id)) })
|
|
1482
1634
|
] }) });
|
|
1483
1635
|
}
|
|
1484
1636
|
|
|
1485
1637
|
// src/ui/button.tsx
|
|
1486
|
-
import * as
|
|
1638
|
+
import * as React3 from "react";
|
|
1487
1639
|
import { Slot } from "@radix-ui/react-slot";
|
|
1488
1640
|
import { cva } from "class-variance-authority";
|
|
1489
|
-
import { jsx as
|
|
1641
|
+
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
1490
1642
|
var buttonVariants = cva(
|
|
1491
1643
|
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
|
|
1492
1644
|
{
|
|
@@ -1503,7 +1655,8 @@ var buttonVariants = cva(
|
|
|
1503
1655
|
default: "h-10 px-4 py-2",
|
|
1504
1656
|
sm: "h-9 rounded-md px-3",
|
|
1505
1657
|
lg: "h-11 rounded-md px-8",
|
|
1506
|
-
icon: "h-10 w-10"
|
|
1658
|
+
icon: "h-10 w-10",
|
|
1659
|
+
touch: "h-12 min-h-[44px] min-w-[44px] rounded-md px-4"
|
|
1507
1660
|
}
|
|
1508
1661
|
},
|
|
1509
1662
|
defaultVariants: {
|
|
@@ -1512,16 +1665,16 @@ var buttonVariants = cva(
|
|
|
1512
1665
|
}
|
|
1513
1666
|
}
|
|
1514
1667
|
);
|
|
1515
|
-
var Button =
|
|
1668
|
+
var Button = React3.forwardRef(
|
|
1516
1669
|
({ className, variant, size, asChild = false, ...props }, ref) => {
|
|
1517
1670
|
const Comp = asChild ? Slot : "button";
|
|
1518
|
-
return /* @__PURE__ */
|
|
1671
|
+
return /* @__PURE__ */ jsx7(Comp, { className: cn(buttonVariants({ variant, size, className })), ref, ...props });
|
|
1519
1672
|
}
|
|
1520
1673
|
);
|
|
1521
1674
|
Button.displayName = "Button";
|
|
1522
1675
|
|
|
1523
1676
|
// src/components/SignerSelector.tsx
|
|
1524
|
-
import { Fragment as Fragment2, jsx as
|
|
1677
|
+
import { Fragment as Fragment2, jsx as jsx8, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
1525
1678
|
function SignerSelector({
|
|
1526
1679
|
selectedWalletId,
|
|
1527
1680
|
availableSigners,
|
|
@@ -1530,15 +1683,16 @@ function SignerSelector({
|
|
|
1530
1683
|
onSignerSelect,
|
|
1531
1684
|
className,
|
|
1532
1685
|
classNames,
|
|
1686
|
+
useSkeleton = true,
|
|
1533
1687
|
renderList,
|
|
1534
1688
|
children
|
|
1535
1689
|
}) {
|
|
1536
1690
|
if (!selectedWalletId) return null;
|
|
1537
1691
|
if (children) {
|
|
1538
|
-
return /* @__PURE__ */
|
|
1692
|
+
return /* @__PURE__ */ jsx8(Fragment2, { children: children({ signers: availableSigners, selectedSigner, onSignerSelect, isLoading: isLoadingSigners }) });
|
|
1539
1693
|
}
|
|
1540
1694
|
if (renderList) {
|
|
1541
|
-
return /* @__PURE__ */
|
|
1695
|
+
return /* @__PURE__ */ jsx8("div", { className: cn(className, classNames?.root), "data-cilantro-signer-selector": true, children: renderList({
|
|
1542
1696
|
signers: availableSigners,
|
|
1543
1697
|
selectedSigner,
|
|
1544
1698
|
onSelect: onSignerSelect,
|
|
@@ -1548,29 +1702,53 @@ function SignerSelector({
|
|
|
1548
1702
|
getSignerUniqueId
|
|
1549
1703
|
}) });
|
|
1550
1704
|
}
|
|
1551
|
-
|
|
1552
|
-
|
|
1705
|
+
const loadingContent = isLoadingSigners && useSkeleton ? /* @__PURE__ */ jsx8(
|
|
1706
|
+
"div",
|
|
1553
1707
|
{
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1708
|
+
className: cn("space-y-1", classNames?.loading),
|
|
1709
|
+
"aria-busy": "true",
|
|
1710
|
+
"aria-live": "polite",
|
|
1711
|
+
children: [1, 2, 3].map((i) => /* @__PURE__ */ jsx8(
|
|
1712
|
+
Skeleton,
|
|
1713
|
+
{
|
|
1714
|
+
className: cn("h-8 w-full rounded-md", classNames?.skeleton)
|
|
1715
|
+
},
|
|
1716
|
+
i
|
|
1717
|
+
))
|
|
1718
|
+
}
|
|
1719
|
+
) : isLoadingSigners ? /* @__PURE__ */ jsx8("p", { className: cn("text-sm text-muted-foreground", classNames?.message), children: "Loading signers..." }) : null;
|
|
1720
|
+
return /* @__PURE__ */ jsx8(
|
|
1721
|
+
"div",
|
|
1722
|
+
{
|
|
1723
|
+
className: cn(className, classNames?.root),
|
|
1724
|
+
"data-cilantro-signer-selector": true,
|
|
1725
|
+
role: "listbox",
|
|
1726
|
+
"aria-label": "Select signer",
|
|
1727
|
+
"aria-busy": isLoadingSigners,
|
|
1728
|
+
"aria-live": "polite",
|
|
1729
|
+
children: loadingContent ?? (availableSigners.length === 0 ? /* @__PURE__ */ jsx8("p", { className: cn("text-sm text-muted-foreground", classNames?.message), children: "No signers for this wallet." }) : /* @__PURE__ */ jsx8("ul", { className: cn("space-y-1", classNames?.list), children: availableSigners.map((signer) => /* @__PURE__ */ jsx8("li", { children: /* @__PURE__ */ jsxs3(
|
|
1730
|
+
Button,
|
|
1731
|
+
{
|
|
1732
|
+
type: "button",
|
|
1733
|
+
variant: selectedSigner?.id === signer.id ? "secondary" : "ghost",
|
|
1734
|
+
size: "sm",
|
|
1735
|
+
className: cn("w-full justify-start", classNames?.item),
|
|
1736
|
+
onClick: () => onSignerSelect(signer),
|
|
1737
|
+
"aria-pressed": selectedSigner?.id === signer.id,
|
|
1738
|
+
children: [
|
|
1739
|
+
getSignerDisplayName(signer),
|
|
1740
|
+
" (",
|
|
1741
|
+
getSignerTypeLabel(signer.type || signer.signerType || ""),
|
|
1742
|
+
")"
|
|
1743
|
+
]
|
|
1744
|
+
}
|
|
1745
|
+
) }, signer.id)) }))
|
|
1566
1746
|
}
|
|
1567
|
-
)
|
|
1747
|
+
);
|
|
1568
1748
|
}
|
|
1569
1749
|
|
|
1570
1750
|
// src/components/DelegatedKeySelector.tsx
|
|
1571
|
-
import {
|
|
1572
|
-
import { findAll } from "cilantro-sdk/delegated-keys";
|
|
1573
|
-
import { Fragment as Fragment3, jsx as jsx8, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1751
|
+
import { Fragment as Fragment3, jsx as jsx9, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1574
1752
|
function DelegatedKeySelector(props) {
|
|
1575
1753
|
const {
|
|
1576
1754
|
walletId,
|
|
@@ -1579,55 +1757,14 @@ function DelegatedKeySelector(props) {
|
|
|
1579
1757
|
filterActive = true,
|
|
1580
1758
|
className,
|
|
1581
1759
|
classNames,
|
|
1760
|
+
useSkeleton = true,
|
|
1582
1761
|
placeholder = "Select a delegated key",
|
|
1583
1762
|
children
|
|
1584
1763
|
} = props;
|
|
1585
|
-
const {
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
const loadKeys = useCallback3(async () => {
|
|
1590
|
-
if (!walletId) {
|
|
1591
|
-
setKeys([]);
|
|
1592
|
-
return;
|
|
1593
|
-
}
|
|
1594
|
-
setIsLoading(true);
|
|
1595
|
-
setError(null);
|
|
1596
|
-
try {
|
|
1597
|
-
if (token) setSdkAuth(token);
|
|
1598
|
-
const result = await findAll(walletId);
|
|
1599
|
-
const keysData = extractResponseData(result) ?? [];
|
|
1600
|
-
const list = Array.isArray(keysData) ? keysData : [];
|
|
1601
|
-
let loaded = list.filter((k) => k != null && typeof k === "object" && "id" in k).map((k) => ({
|
|
1602
|
-
id: String(k.id ?? ""),
|
|
1603
|
-
walletId: String(k.walletId ?? ""),
|
|
1604
|
-
name: k.name,
|
|
1605
|
-
publicKey: String(k.publicKey ?? ""),
|
|
1606
|
-
permissions: k.permissions ?? {},
|
|
1607
|
-
isActive: k.isActive !== false,
|
|
1608
|
-
createdAt: k.createdAt,
|
|
1609
|
-
expiresAt: k.expiresAt,
|
|
1610
|
-
...k
|
|
1611
|
-
}));
|
|
1612
|
-
if (filterActive) {
|
|
1613
|
-
const now = Date.now();
|
|
1614
|
-
loaded = loaded.filter((key) => {
|
|
1615
|
-
if (!key.isActive) return false;
|
|
1616
|
-
const exp = key.expiresAt ? new Date(key.expiresAt).getTime() : null;
|
|
1617
|
-
return exp === null || exp > now;
|
|
1618
|
-
});
|
|
1619
|
-
}
|
|
1620
|
-
setKeys(loaded);
|
|
1621
|
-
} catch (err) {
|
|
1622
|
-
setError(err instanceof Error ? err.message : String(err));
|
|
1623
|
-
setKeys([]);
|
|
1624
|
-
} finally {
|
|
1625
|
-
setIsLoading(false);
|
|
1626
|
-
}
|
|
1627
|
-
}, [walletId, token, filterActive]);
|
|
1628
|
-
useEffect6(() => {
|
|
1629
|
-
loadKeys();
|
|
1630
|
-
}, [loadKeys]);
|
|
1764
|
+
const { keys, isLoading, error, refresh: loadKeys } = useDelegatedKeys({
|
|
1765
|
+
walletId,
|
|
1766
|
+
filterActive
|
|
1767
|
+
});
|
|
1631
1768
|
const onSelect = (key) => {
|
|
1632
1769
|
onChange?.(key.id, key);
|
|
1633
1770
|
};
|
|
@@ -1636,22 +1773,52 @@ function DelegatedKeySelector(props) {
|
|
|
1636
1773
|
onChange?.(id, key);
|
|
1637
1774
|
};
|
|
1638
1775
|
if (children) {
|
|
1639
|
-
return /* @__PURE__ */
|
|
1776
|
+
return /* @__PURE__ */ jsx9(Fragment3, { children: children({ keys, selectedKeyId: value, onSelect, isLoading, error, refresh: loadKeys }) });
|
|
1640
1777
|
}
|
|
1641
1778
|
if (!walletId) {
|
|
1642
|
-
return /* @__PURE__ */
|
|
1779
|
+
return /* @__PURE__ */ jsx9("div", { className: cn(className, classNames?.root, "text-sm text-muted-foreground"), children: "Select a wallet first" });
|
|
1643
1780
|
}
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1781
|
+
if (isLoading && useSkeleton) {
|
|
1782
|
+
return /* @__PURE__ */ jsx9(
|
|
1783
|
+
"div",
|
|
1784
|
+
{
|
|
1785
|
+
className: cn(className, classNames?.root, classNames?.loading),
|
|
1786
|
+
"data-cilantro-delegated-key-selector": true,
|
|
1787
|
+
"aria-busy": "true",
|
|
1788
|
+
"aria-live": "polite",
|
|
1789
|
+
children: /* @__PURE__ */ jsx9(
|
|
1790
|
+
"div",
|
|
1791
|
+
{
|
|
1792
|
+
className: cn(
|
|
1793
|
+
"flex h-9 w-full items-center justify-between rounded-md border border-input bg-transparent px-3 py-2",
|
|
1794
|
+
classNames?.trigger
|
|
1795
|
+
),
|
|
1796
|
+
children: /* @__PURE__ */ jsx9(Skeleton, { className: cn("h-4 flex-1 rounded", classNames?.skeleton) })
|
|
1797
|
+
}
|
|
1798
|
+
)
|
|
1799
|
+
}
|
|
1800
|
+
);
|
|
1801
|
+
}
|
|
1802
|
+
return /* @__PURE__ */ jsx9(
|
|
1803
|
+
"div",
|
|
1804
|
+
{
|
|
1805
|
+
className: cn(className, classNames?.root),
|
|
1806
|
+
"data-cilantro-delegated-key-selector": true,
|
|
1807
|
+
"aria-busy": isLoading,
|
|
1808
|
+
"aria-live": "polite",
|
|
1809
|
+
children: isLoading ? /* @__PURE__ */ jsx9("p", { className: cn("text-sm text-muted-foreground", classNames?.message), children: "Loading delegated keys..." }) : error ? /* @__PURE__ */ jsx9("p", { className: cn("text-sm text-destructive", classNames?.message), role: "alert", children: error }) : keys.length === 0 ? /* @__PURE__ */ jsx9("p", { className: cn("text-sm text-muted-foreground", classNames?.message), children: "No delegated keys found." }) : /* @__PURE__ */ jsxs4(Select, { value: (value ?? "") || void 0, onValueChange: handleValueChange, children: [
|
|
1810
|
+
/* @__PURE__ */ jsx9(SelectTrigger, { className: classNames?.trigger, "aria-label": "Select delegated key", children: /* @__PURE__ */ jsx9(SelectValue, { placeholder }) }),
|
|
1811
|
+
/* @__PURE__ */ jsx9(SelectContent, { className: classNames?.content, children: keys.map((k) => /* @__PURE__ */ jsx9(SelectItem, { value: k.id, className: classNames?.item, children: k.name || k.publicKey.slice(0, 8) + "..." }, k.id)) })
|
|
1812
|
+
] })
|
|
1813
|
+
}
|
|
1814
|
+
);
|
|
1648
1815
|
}
|
|
1649
1816
|
|
|
1650
1817
|
// src/ui/textarea.tsx
|
|
1651
|
-
import * as
|
|
1652
|
-
import { jsx as
|
|
1653
|
-
var Textarea =
|
|
1654
|
-
({ className, ...props }, ref) => /* @__PURE__ */
|
|
1818
|
+
import * as React4 from "react";
|
|
1819
|
+
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
1820
|
+
var Textarea = React4.forwardRef(
|
|
1821
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx10(
|
|
1655
1822
|
"textarea",
|
|
1656
1823
|
{
|
|
1657
1824
|
className: cn(
|
|
@@ -1666,21 +1833,21 @@ var Textarea = React3.forwardRef(
|
|
|
1666
1833
|
Textarea.displayName = "Textarea";
|
|
1667
1834
|
|
|
1668
1835
|
// src/ui/label.tsx
|
|
1669
|
-
import * as
|
|
1836
|
+
import * as React5 from "react";
|
|
1670
1837
|
import * as LabelPrimitive from "@radix-ui/react-label";
|
|
1671
1838
|
import { cva as cva2 } from "class-variance-authority";
|
|
1672
|
-
import { jsx as
|
|
1839
|
+
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
1673
1840
|
var labelVariants = cva2(
|
|
1674
1841
|
"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
|
|
1675
1842
|
);
|
|
1676
|
-
var Label =
|
|
1843
|
+
var Label = React5.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx11(LabelPrimitive.Root, { ref, className: cn(labelVariants(), className), ...props }));
|
|
1677
1844
|
Label.displayName = LabelPrimitive.Root.displayName;
|
|
1678
1845
|
|
|
1679
1846
|
// src/ui/card.tsx
|
|
1680
|
-
import * as
|
|
1681
|
-
import { jsx as
|
|
1682
|
-
var Card =
|
|
1683
|
-
({ className, ...props }, ref) => /* @__PURE__ */
|
|
1847
|
+
import * as React6 from "react";
|
|
1848
|
+
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
1849
|
+
var Card = React6.forwardRef(
|
|
1850
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx12(
|
|
1684
1851
|
"div",
|
|
1685
1852
|
{
|
|
1686
1853
|
ref,
|
|
@@ -1690,12 +1857,12 @@ var Card = React5.forwardRef(
|
|
|
1690
1857
|
)
|
|
1691
1858
|
);
|
|
1692
1859
|
Card.displayName = "Card";
|
|
1693
|
-
var CardHeader =
|
|
1694
|
-
({ className, ...props }, ref) => /* @__PURE__ */
|
|
1860
|
+
var CardHeader = React6.forwardRef(
|
|
1861
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx12("div", { ref, className: cn("flex flex-col space-y-1.5 p-6", className), ...props })
|
|
1695
1862
|
);
|
|
1696
1863
|
CardHeader.displayName = "CardHeader";
|
|
1697
|
-
var CardTitle =
|
|
1698
|
-
({ className, ...props }, ref) => /* @__PURE__ */
|
|
1864
|
+
var CardTitle = React6.forwardRef(
|
|
1865
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx12(
|
|
1699
1866
|
"h3",
|
|
1700
1867
|
{
|
|
1701
1868
|
ref,
|
|
@@ -1705,19 +1872,19 @@ var CardTitle = React5.forwardRef(
|
|
|
1705
1872
|
)
|
|
1706
1873
|
);
|
|
1707
1874
|
CardTitle.displayName = "CardTitle";
|
|
1708
|
-
var CardDescription =
|
|
1875
|
+
var CardDescription = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx12("p", { ref, className: cn("text-sm text-muted-foreground", className), ...props }));
|
|
1709
1876
|
CardDescription.displayName = "CardDescription";
|
|
1710
|
-
var CardContent =
|
|
1711
|
-
({ className, ...props }, ref) => /* @__PURE__ */
|
|
1877
|
+
var CardContent = React6.forwardRef(
|
|
1878
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx12("div", { ref, className: cn("p-6 pt-0", className), ...props })
|
|
1712
1879
|
);
|
|
1713
1880
|
CardContent.displayName = "CardContent";
|
|
1714
|
-
var CardFooter =
|
|
1715
|
-
({ className, ...props }, ref) => /* @__PURE__ */
|
|
1881
|
+
var CardFooter = React6.forwardRef(
|
|
1882
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx12("div", { ref, className: cn("flex items-center p-6 pt-0", className), ...props })
|
|
1716
1883
|
);
|
|
1717
1884
|
CardFooter.displayName = "CardFooter";
|
|
1718
1885
|
|
|
1719
1886
|
// src/components/MessageSigningForm.tsx
|
|
1720
|
-
import { jsx as
|
|
1887
|
+
import { jsx as jsx13, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1721
1888
|
function MessageSigningForm({
|
|
1722
1889
|
token: tokenOverride,
|
|
1723
1890
|
selectedWalletId: walletIdOverride,
|
|
@@ -1749,7 +1916,7 @@ function MessageSigningForm({
|
|
|
1749
1916
|
walletAdapterPublicKey
|
|
1750
1917
|
});
|
|
1751
1918
|
if (children) {
|
|
1752
|
-
return /* @__PURE__ */
|
|
1919
|
+
return /* @__PURE__ */ jsx13("div", { className: cn(className, classNames?.root), "data-cilantro-message-signing-form": true, children: children({
|
|
1753
1920
|
messageText: signing.messageText,
|
|
1754
1921
|
setMessageText: signing.setMessageText,
|
|
1755
1922
|
signResultState: signing.signResultState,
|
|
@@ -1763,8 +1930,8 @@ function MessageSigningForm({
|
|
|
1763
1930
|
const isError = resultStatus === "error";
|
|
1764
1931
|
return /* @__PURE__ */ jsxs5(Card, { className: cn(className, classNames?.root), "data-cilantro-message-signing-form": true, children: [
|
|
1765
1932
|
/* @__PURE__ */ jsxs5(CardHeader, { className: classNames?.header, children: [
|
|
1766
|
-
/* @__PURE__ */
|
|
1767
|
-
/* @__PURE__ */
|
|
1933
|
+
/* @__PURE__ */ jsx13(CardTitle, { className: cn("text-lg", classNames?.title), children: "Sign message" }),
|
|
1934
|
+
/* @__PURE__ */ jsx13(CardDescription, { className: classNames?.description, children: "Sign a message with your selected wallet or signer. The signature proves you control the key." }),
|
|
1768
1935
|
showContext && (selectedWalletId || selectedSigner) && /* @__PURE__ */ jsxs5("p", { className: cn("mt-1 text-xs text-muted-foreground", classNames?.context), children: [
|
|
1769
1936
|
selectedWalletId && /* @__PURE__ */ jsxs5("span", { children: [
|
|
1770
1937
|
"Wallet: ",
|
|
@@ -1782,8 +1949,8 @@ function MessageSigningForm({
|
|
|
1782
1949
|
] }),
|
|
1783
1950
|
/* @__PURE__ */ jsxs5(CardContent, { className: "space-y-4", children: [
|
|
1784
1951
|
/* @__PURE__ */ jsxs5("div", { className: "space-y-2", children: [
|
|
1785
|
-
/* @__PURE__ */
|
|
1786
|
-
/* @__PURE__ */
|
|
1952
|
+
/* @__PURE__ */ jsx13(Label, { htmlFor: "cilantro-message-text", className: classNames?.label, children: "Message" }),
|
|
1953
|
+
/* @__PURE__ */ jsx13(
|
|
1787
1954
|
Textarea,
|
|
1788
1955
|
{
|
|
1789
1956
|
id: "cilantro-message-text",
|
|
@@ -1801,17 +1968,18 @@ function MessageSigningForm({
|
|
|
1801
1968
|
] })
|
|
1802
1969
|
] }),
|
|
1803
1970
|
/* @__PURE__ */ jsxs5("div", { className: "flex flex-col gap-2 sm:flex-row sm:items-center", children: [
|
|
1804
|
-
/* @__PURE__ */
|
|
1971
|
+
/* @__PURE__ */ jsx13(
|
|
1805
1972
|
Button,
|
|
1806
1973
|
{
|
|
1807
1974
|
type: "button",
|
|
1975
|
+
size: "touch",
|
|
1808
1976
|
className: cn("w-full sm:w-auto", classNames?.button),
|
|
1809
1977
|
onClick: signing.handleSign,
|
|
1810
1978
|
disabled: signing.isSigning || !signing.messageText.trim(),
|
|
1811
1979
|
children: signing.isSigning ? "Signing..." : "Sign message"
|
|
1812
1980
|
}
|
|
1813
1981
|
),
|
|
1814
|
-
/* @__PURE__ */
|
|
1982
|
+
/* @__PURE__ */ jsx13(
|
|
1815
1983
|
Button,
|
|
1816
1984
|
{
|
|
1817
1985
|
type: "button",
|
|
@@ -1826,6 +1994,9 @@ function MessageSigningForm({
|
|
|
1826
1994
|
resultStatus !== "idle" && /* @__PURE__ */ jsxs5(
|
|
1827
1995
|
"div",
|
|
1828
1996
|
{
|
|
1997
|
+
role: "status",
|
|
1998
|
+
"aria-live": isError ? "assertive" : "polite",
|
|
1999
|
+
"aria-busy": resultStatus === "loading",
|
|
1829
2000
|
className: cn(
|
|
1830
2001
|
"rounded-lg border px-3 py-2 text-sm",
|
|
1831
2002
|
isSuccess && cn("border-green-500/50 bg-green-500/10 text-green-700 dark:text-green-400", classNames?.resultSuccess),
|
|
@@ -1836,7 +2007,7 @@ function MessageSigningForm({
|
|
|
1836
2007
|
"data-status": resultStatus,
|
|
1837
2008
|
children: [
|
|
1838
2009
|
signing.signResultState.message,
|
|
1839
|
-
signing.signResultState.detail != null && /* @__PURE__ */
|
|
2010
|
+
signing.signResultState.detail != null && /* @__PURE__ */ jsx13("pre", { className: cn("mt-2 overflow-auto rounded-md bg-muted/80 p-2 text-xs", classNames?.resultPre), children: JSON.stringify(signing.signResultState.detail, null, 2) })
|
|
1840
2011
|
]
|
|
1841
2012
|
}
|
|
1842
2013
|
)
|
|
@@ -1845,7 +2016,7 @@ function MessageSigningForm({
|
|
|
1845
2016
|
}
|
|
1846
2017
|
|
|
1847
2018
|
// src/components/TransactionSigningForm.tsx
|
|
1848
|
-
import { jsx as
|
|
2019
|
+
import { jsx as jsx14, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1849
2020
|
function TransactionSigningForm({
|
|
1850
2021
|
token: tokenOverride,
|
|
1851
2022
|
selectedWalletId: walletIdOverride,
|
|
@@ -1878,7 +2049,7 @@ function TransactionSigningForm({
|
|
|
1878
2049
|
connection
|
|
1879
2050
|
});
|
|
1880
2051
|
if (children) {
|
|
1881
|
-
return /* @__PURE__ */
|
|
2052
|
+
return /* @__PURE__ */ jsx14("div", { className: cn(className, classNames?.root), "data-cilantro-transaction-signing-form": true, children: children({
|
|
1882
2053
|
transactionResultState: signing.transactionResultState,
|
|
1883
2054
|
isSigningTransaction: signing.isSigningTransaction,
|
|
1884
2055
|
isSendingTransaction: signing.isSendingTransaction,
|
|
@@ -1892,12 +2063,12 @@ function TransactionSigningForm({
|
|
|
1892
2063
|
const isError = resultStatus === "error";
|
|
1893
2064
|
return /* @__PURE__ */ jsxs6(Card, { className: cn(className, classNames?.root), "data-cilantro-transaction-signing-form": true, children: [
|
|
1894
2065
|
/* @__PURE__ */ jsxs6(CardHeader, { className: classNames?.header, children: [
|
|
1895
|
-
/* @__PURE__ */
|
|
2066
|
+
/* @__PURE__ */ jsx14(CardTitle, { className: cn("text-lg", classNames?.title), children: "Sign transaction" }),
|
|
1896
2067
|
/* @__PURE__ */ jsxs6(CardDescription, { className: classNames?.description, children: [
|
|
1897
2068
|
"Build a transaction in your app, then pass it to ",
|
|
1898
|
-
/* @__PURE__ */
|
|
2069
|
+
/* @__PURE__ */ jsx14("code", { className: "text-xs", children: "signTransaction(tx)" }),
|
|
1899
2070
|
" to sign only, or ",
|
|
1900
|
-
/* @__PURE__ */
|
|
2071
|
+
/* @__PURE__ */ jsx14("code", { className: "text-xs", children: "signAndSendTransaction(tx)" }),
|
|
1901
2072
|
" to sign and send. Use the render props (children) to wire your own UI."
|
|
1902
2073
|
] }),
|
|
1903
2074
|
showContext && (selectedWalletId || selectedSigner) && /* @__PURE__ */ jsxs6("p", { className: cn("mt-1 text-xs text-muted-foreground", classNames?.context), children: [
|
|
@@ -1916,7 +2087,7 @@ function TransactionSigningForm({
|
|
|
1916
2087
|
] })
|
|
1917
2088
|
] }),
|
|
1918
2089
|
/* @__PURE__ */ jsxs6(CardContent, { className: "space-y-4", children: [
|
|
1919
|
-
/* @__PURE__ */
|
|
2090
|
+
/* @__PURE__ */ jsx14(
|
|
1920
2091
|
Button,
|
|
1921
2092
|
{
|
|
1922
2093
|
type: "button",
|
|
@@ -1930,6 +2101,9 @@ function TransactionSigningForm({
|
|
|
1930
2101
|
resultStatus !== "idle" && /* @__PURE__ */ jsxs6(
|
|
1931
2102
|
"div",
|
|
1932
2103
|
{
|
|
2104
|
+
role: "status",
|
|
2105
|
+
"aria-live": isError ? "assertive" : "polite",
|
|
2106
|
+
"aria-busy": resultStatus === "loading",
|
|
1933
2107
|
className: cn(
|
|
1934
2108
|
"rounded-lg border px-3 py-2 text-sm",
|
|
1935
2109
|
isSuccess && cn("border-green-500/50 bg-green-500/10 text-green-700 dark:text-green-400", classNames?.resultSuccess),
|
|
@@ -1940,7 +2114,7 @@ function TransactionSigningForm({
|
|
|
1940
2114
|
"data-status": resultStatus,
|
|
1941
2115
|
children: [
|
|
1942
2116
|
signing.transactionResultState.message,
|
|
1943
|
-
signing.transactionResultState.detail != null && /* @__PURE__ */
|
|
2117
|
+
signing.transactionResultState.detail != null && /* @__PURE__ */ jsx14("pre", { className: cn("mt-2 overflow-auto rounded-md bg-muted/80 p-2 text-xs", classNames?.resultPre), children: JSON.stringify(signing.transactionResultState.detail, null, 2) })
|
|
1944
2118
|
]
|
|
1945
2119
|
}
|
|
1946
2120
|
)
|
|
@@ -1952,11 +2126,11 @@ function TransactionSigningForm({
|
|
|
1952
2126
|
import { useState as useState8 } from "react";
|
|
1953
2127
|
|
|
1954
2128
|
// src/ui/input.tsx
|
|
1955
|
-
import * as
|
|
1956
|
-
import { jsx as
|
|
1957
|
-
var Input =
|
|
2129
|
+
import * as React7 from "react";
|
|
2130
|
+
import { jsx as jsx15 } from "react/jsx-runtime";
|
|
2131
|
+
var Input = React7.forwardRef(
|
|
1958
2132
|
({ className, type, ...props }, ref) => {
|
|
1959
|
-
return /* @__PURE__ */
|
|
2133
|
+
return /* @__PURE__ */ jsx15(
|
|
1960
2134
|
"input",
|
|
1961
2135
|
{
|
|
1962
2136
|
type,
|
|
@@ -1973,7 +2147,7 @@ var Input = React6.forwardRef(
|
|
|
1973
2147
|
Input.displayName = "Input";
|
|
1974
2148
|
|
|
1975
2149
|
// src/components/LoginForm.tsx
|
|
1976
|
-
import { jsx as
|
|
2150
|
+
import { jsx as jsx16, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1977
2151
|
function LoginForm({
|
|
1978
2152
|
className,
|
|
1979
2153
|
classNames,
|
|
@@ -2002,13 +2176,13 @@ function LoginForm({
|
|
|
2002
2176
|
};
|
|
2003
2177
|
return /* @__PURE__ */ jsxs7(Card, { className: cn(className, classNames?.root), "data-cilantro-login-form": true, children: [
|
|
2004
2178
|
/* @__PURE__ */ jsxs7(CardHeader, { className: classNames?.header, children: [
|
|
2005
|
-
/* @__PURE__ */
|
|
2006
|
-
description != null && /* @__PURE__ */
|
|
2179
|
+
/* @__PURE__ */ jsx16(CardTitle, { className: classNames?.title, children: title }),
|
|
2180
|
+
description != null && /* @__PURE__ */ jsx16(CardDescription, { className: classNames?.description, children: description })
|
|
2007
2181
|
] }),
|
|
2008
|
-
/* @__PURE__ */
|
|
2182
|
+
/* @__PURE__ */ jsx16(CardContent, { children: /* @__PURE__ */ jsxs7("form", { onSubmit: handleSubmit, className: cn("space-y-4", classNames?.form), children: [
|
|
2009
2183
|
/* @__PURE__ */ jsxs7("div", { className: "space-y-2", children: [
|
|
2010
|
-
/* @__PURE__ */
|
|
2011
|
-
/* @__PURE__ */
|
|
2184
|
+
/* @__PURE__ */ jsx16(Label, { htmlFor: "cilantro-login-username", className: classNames?.label, children: "Username or email" }),
|
|
2185
|
+
/* @__PURE__ */ jsx16(
|
|
2012
2186
|
Input,
|
|
2013
2187
|
{
|
|
2014
2188
|
id: "cilantro-login-username",
|
|
@@ -2024,8 +2198,8 @@ function LoginForm({
|
|
|
2024
2198
|
)
|
|
2025
2199
|
] }),
|
|
2026
2200
|
/* @__PURE__ */ jsxs7("div", { className: "space-y-2", children: [
|
|
2027
|
-
/* @__PURE__ */
|
|
2028
|
-
/* @__PURE__ */
|
|
2201
|
+
/* @__PURE__ */ jsx16(Label, { htmlFor: "cilantro-login-password", className: classNames?.label, children: "Password" }),
|
|
2202
|
+
/* @__PURE__ */ jsx16(
|
|
2029
2203
|
Input,
|
|
2030
2204
|
{
|
|
2031
2205
|
id: "cilantro-login-password",
|
|
@@ -2040,7 +2214,7 @@ function LoginForm({
|
|
|
2040
2214
|
}
|
|
2041
2215
|
)
|
|
2042
2216
|
] }),
|
|
2043
|
-
error && /* @__PURE__ */
|
|
2217
|
+
error && /* @__PURE__ */ jsx16(
|
|
2044
2218
|
"div",
|
|
2045
2219
|
{
|
|
2046
2220
|
className: cn(
|
|
@@ -2051,23 +2225,24 @@ function LoginForm({
|
|
|
2051
2225
|
children: error
|
|
2052
2226
|
}
|
|
2053
2227
|
),
|
|
2054
|
-
/* @__PURE__ */
|
|
2228
|
+
/* @__PURE__ */ jsx16(
|
|
2055
2229
|
Button,
|
|
2056
2230
|
{
|
|
2057
2231
|
type: "submit",
|
|
2232
|
+
size: "touch",
|
|
2058
2233
|
className: cn("w-full", classNames?.submitButton),
|
|
2059
2234
|
disabled: isLoading || !usernameOrEmail.trim() || !password,
|
|
2060
2235
|
children: isLoading ? "Signing in..." : submitLabel
|
|
2061
2236
|
}
|
|
2062
2237
|
),
|
|
2063
|
-
renderSwitchToRegister && /* @__PURE__ */
|
|
2238
|
+
renderSwitchToRegister && /* @__PURE__ */ jsx16("div", { className: "text-center text-sm text-muted-foreground", children: renderSwitchToRegister() })
|
|
2064
2239
|
] }) })
|
|
2065
2240
|
] });
|
|
2066
2241
|
}
|
|
2067
2242
|
|
|
2068
2243
|
// src/components/RegisterForm.tsx
|
|
2069
2244
|
import { useState as useState9 } from "react";
|
|
2070
|
-
import { jsx as
|
|
2245
|
+
import { jsx as jsx17, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
2071
2246
|
function RegisterForm({
|
|
2072
2247
|
className,
|
|
2073
2248
|
classNames,
|
|
@@ -2098,13 +2273,13 @@ function RegisterForm({
|
|
|
2098
2273
|
};
|
|
2099
2274
|
return /* @__PURE__ */ jsxs8(Card, { className: cn(className, classNames?.root), "data-cilantro-register-form": true, children: [
|
|
2100
2275
|
/* @__PURE__ */ jsxs8(CardHeader, { className: classNames?.header, children: [
|
|
2101
|
-
/* @__PURE__ */
|
|
2102
|
-
description != null && /* @__PURE__ */
|
|
2276
|
+
/* @__PURE__ */ jsx17(CardTitle, { className: classNames?.title, children: title }),
|
|
2277
|
+
description != null && /* @__PURE__ */ jsx17(CardDescription, { className: classNames?.description, children: description })
|
|
2103
2278
|
] }),
|
|
2104
|
-
/* @__PURE__ */
|
|
2279
|
+
/* @__PURE__ */ jsx17(CardContent, { children: /* @__PURE__ */ jsxs8("form", { onSubmit: handleSubmit, className: cn("space-y-4", classNames?.form), children: [
|
|
2105
2280
|
/* @__PURE__ */ jsxs8("div", { className: "space-y-2", children: [
|
|
2106
|
-
/* @__PURE__ */
|
|
2107
|
-
/* @__PURE__ */
|
|
2281
|
+
/* @__PURE__ */ jsx17(Label, { htmlFor: "cilantro-register-username", className: classNames?.label, children: "Username" }),
|
|
2282
|
+
/* @__PURE__ */ jsx17(
|
|
2108
2283
|
Input,
|
|
2109
2284
|
{
|
|
2110
2285
|
id: "cilantro-register-username",
|
|
@@ -2120,8 +2295,8 @@ function RegisterForm({
|
|
|
2120
2295
|
)
|
|
2121
2296
|
] }),
|
|
2122
2297
|
/* @__PURE__ */ jsxs8("div", { className: "space-y-2", children: [
|
|
2123
|
-
/* @__PURE__ */
|
|
2124
|
-
/* @__PURE__ */
|
|
2298
|
+
/* @__PURE__ */ jsx17(Label, { htmlFor: "cilantro-register-email", className: classNames?.label, children: "Email" }),
|
|
2299
|
+
/* @__PURE__ */ jsx17(
|
|
2125
2300
|
Input,
|
|
2126
2301
|
{
|
|
2127
2302
|
id: "cilantro-register-email",
|
|
@@ -2137,8 +2312,8 @@ function RegisterForm({
|
|
|
2137
2312
|
)
|
|
2138
2313
|
] }),
|
|
2139
2314
|
/* @__PURE__ */ jsxs8("div", { className: "space-y-2", children: [
|
|
2140
|
-
/* @__PURE__ */
|
|
2141
|
-
/* @__PURE__ */
|
|
2315
|
+
/* @__PURE__ */ jsx17(Label, { htmlFor: "cilantro-register-password", className: classNames?.label, children: "Password" }),
|
|
2316
|
+
/* @__PURE__ */ jsx17(
|
|
2142
2317
|
Input,
|
|
2143
2318
|
{
|
|
2144
2319
|
id: "cilantro-register-password",
|
|
@@ -2153,7 +2328,7 @@ function RegisterForm({
|
|
|
2153
2328
|
}
|
|
2154
2329
|
)
|
|
2155
2330
|
] }),
|
|
2156
|
-
error && /* @__PURE__ */
|
|
2331
|
+
error && /* @__PURE__ */ jsx17(
|
|
2157
2332
|
"div",
|
|
2158
2333
|
{
|
|
2159
2334
|
className: cn(
|
|
@@ -2164,23 +2339,24 @@ function RegisterForm({
|
|
|
2164
2339
|
children: error
|
|
2165
2340
|
}
|
|
2166
2341
|
),
|
|
2167
|
-
/* @__PURE__ */
|
|
2342
|
+
/* @__PURE__ */ jsx17(
|
|
2168
2343
|
Button,
|
|
2169
2344
|
{
|
|
2170
2345
|
type: "submit",
|
|
2346
|
+
size: "touch",
|
|
2171
2347
|
className: cn("w-full", classNames?.submitButton),
|
|
2172
2348
|
disabled: isLoading || !username.trim() || !email.trim() || !password,
|
|
2173
2349
|
children: isLoading ? "Creating account..." : submitLabel
|
|
2174
2350
|
}
|
|
2175
2351
|
),
|
|
2176
|
-
renderSwitchToLogin && /* @__PURE__ */
|
|
2352
|
+
renderSwitchToLogin && /* @__PURE__ */ jsx17("div", { className: "text-center text-sm text-muted-foreground", children: renderSwitchToLogin() })
|
|
2177
2353
|
] }) })
|
|
2178
2354
|
] });
|
|
2179
2355
|
}
|
|
2180
2356
|
|
|
2181
2357
|
// src/components/AuthForm.tsx
|
|
2182
2358
|
import { useState as useState10 } from "react";
|
|
2183
|
-
import { Fragment as Fragment4, jsx as
|
|
2359
|
+
import { Fragment as Fragment4, jsx as jsx18, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
2184
2360
|
function AuthForm({
|
|
2185
2361
|
defaultMode = "login",
|
|
2186
2362
|
className,
|
|
@@ -2228,14 +2404,14 @@ function AuthForm({
|
|
|
2228
2404
|
const canSubmit = isLogin ? usernameOrEmail.trim().length > 0 && password.length > 0 : username.trim().length > 0 && email.trim().length > 0 && password.length > 0;
|
|
2229
2405
|
return /* @__PURE__ */ jsxs9(Card, { className: cn("w-full max-w-sm", className, classNames?.root), "data-cilantro-auth-form": true, children: [
|
|
2230
2406
|
/* @__PURE__ */ jsxs9(CardHeader, { className: cn("space-y-1 text-center sm:text-left", classNames?.header), children: [
|
|
2231
|
-
/* @__PURE__ */
|
|
2232
|
-
/* @__PURE__ */
|
|
2407
|
+
/* @__PURE__ */ jsx18(CardTitle, { className: cn("text-xl", classNames?.title), children: isLogin ? loginTitle : registerTitle }),
|
|
2408
|
+
/* @__PURE__ */ jsx18(CardDescription, { className: classNames?.description, children: isLogin ? loginDescription : registerDescription })
|
|
2233
2409
|
] }),
|
|
2234
|
-
/* @__PURE__ */
|
|
2410
|
+
/* @__PURE__ */ jsx18(CardContent, { children: /* @__PURE__ */ jsxs9("form", { onSubmit: handleSubmit, className: cn("space-y-4", classNames?.form), children: [
|
|
2235
2411
|
isLogin ? /* @__PURE__ */ jsxs9(Fragment4, { children: [
|
|
2236
2412
|
/* @__PURE__ */ jsxs9("div", { className: "space-y-2", children: [
|
|
2237
|
-
/* @__PURE__ */
|
|
2238
|
-
/* @__PURE__ */
|
|
2413
|
+
/* @__PURE__ */ jsx18(Label, { htmlFor: "cilantro-auth-username", className: classNames?.label, children: "Username or email" }),
|
|
2414
|
+
/* @__PURE__ */ jsx18(
|
|
2239
2415
|
Input,
|
|
2240
2416
|
{
|
|
2241
2417
|
id: "cilantro-auth-username",
|
|
@@ -2251,8 +2427,8 @@ function AuthForm({
|
|
|
2251
2427
|
)
|
|
2252
2428
|
] }),
|
|
2253
2429
|
/* @__PURE__ */ jsxs9("div", { className: "space-y-2", children: [
|
|
2254
|
-
/* @__PURE__ */
|
|
2255
|
-
/* @__PURE__ */
|
|
2430
|
+
/* @__PURE__ */ jsx18(Label, { htmlFor: "cilantro-auth-password", className: classNames?.label, children: "Password" }),
|
|
2431
|
+
/* @__PURE__ */ jsx18(
|
|
2256
2432
|
Input,
|
|
2257
2433
|
{
|
|
2258
2434
|
id: "cilantro-auth-password",
|
|
@@ -2269,8 +2445,8 @@ function AuthForm({
|
|
|
2269
2445
|
] })
|
|
2270
2446
|
] }) : /* @__PURE__ */ jsxs9(Fragment4, { children: [
|
|
2271
2447
|
/* @__PURE__ */ jsxs9("div", { className: "space-y-2", children: [
|
|
2272
|
-
/* @__PURE__ */
|
|
2273
|
-
/* @__PURE__ */
|
|
2448
|
+
/* @__PURE__ */ jsx18(Label, { htmlFor: "cilantro-auth-reg-username", className: classNames?.label, children: "Username" }),
|
|
2449
|
+
/* @__PURE__ */ jsx18(
|
|
2274
2450
|
Input,
|
|
2275
2451
|
{
|
|
2276
2452
|
id: "cilantro-auth-reg-username",
|
|
@@ -2286,8 +2462,8 @@ function AuthForm({
|
|
|
2286
2462
|
)
|
|
2287
2463
|
] }),
|
|
2288
2464
|
/* @__PURE__ */ jsxs9("div", { className: "space-y-2", children: [
|
|
2289
|
-
/* @__PURE__ */
|
|
2290
|
-
/* @__PURE__ */
|
|
2465
|
+
/* @__PURE__ */ jsx18(Label, { htmlFor: "cilantro-auth-reg-email", className: classNames?.label, children: "Email" }),
|
|
2466
|
+
/* @__PURE__ */ jsx18(
|
|
2291
2467
|
Input,
|
|
2292
2468
|
{
|
|
2293
2469
|
id: "cilantro-auth-reg-email",
|
|
@@ -2303,8 +2479,8 @@ function AuthForm({
|
|
|
2303
2479
|
)
|
|
2304
2480
|
] }),
|
|
2305
2481
|
/* @__PURE__ */ jsxs9("div", { className: "space-y-2", children: [
|
|
2306
|
-
/* @__PURE__ */
|
|
2307
|
-
/* @__PURE__ */
|
|
2482
|
+
/* @__PURE__ */ jsx18(Label, { htmlFor: "cilantro-auth-reg-password", className: classNames?.label, children: "Password" }),
|
|
2483
|
+
/* @__PURE__ */ jsx18(
|
|
2308
2484
|
Input,
|
|
2309
2485
|
{
|
|
2310
2486
|
id: "cilantro-auth-reg-password",
|
|
@@ -2320,7 +2496,7 @@ function AuthForm({
|
|
|
2320
2496
|
)
|
|
2321
2497
|
] })
|
|
2322
2498
|
] }),
|
|
2323
|
-
error && /* @__PURE__ */
|
|
2499
|
+
error && /* @__PURE__ */ jsx18(
|
|
2324
2500
|
"div",
|
|
2325
2501
|
{
|
|
2326
2502
|
className: cn(
|
|
@@ -2331,16 +2507,17 @@ function AuthForm({
|
|
|
2331
2507
|
children: error
|
|
2332
2508
|
}
|
|
2333
2509
|
),
|
|
2334
|
-
/* @__PURE__ */
|
|
2510
|
+
/* @__PURE__ */ jsx18(
|
|
2335
2511
|
Button,
|
|
2336
2512
|
{
|
|
2337
2513
|
type: "submit",
|
|
2514
|
+
size: "touch",
|
|
2338
2515
|
className: cn("w-full", classNames?.submitButton),
|
|
2339
2516
|
disabled: isLoading || !canSubmit,
|
|
2340
2517
|
children: isLoading ? isLogin ? "Signing in..." : "Creating account..." : isLogin ? loginSubmitLabel : registerSubmitLabel
|
|
2341
2518
|
}
|
|
2342
2519
|
),
|
|
2343
|
-
/* @__PURE__ */
|
|
2520
|
+
/* @__PURE__ */ jsx18("p", { className: cn("text-center text-sm text-muted-foreground", classNames?.toggle), children: /* @__PURE__ */ jsx18(
|
|
2344
2521
|
"button",
|
|
2345
2522
|
{
|
|
2346
2523
|
type: "button",
|
|
@@ -2355,35 +2532,49 @@ function AuthForm({
|
|
|
2355
2532
|
}
|
|
2356
2533
|
|
|
2357
2534
|
// src/components/AuthGuard.tsx
|
|
2358
|
-
import { Fragment as Fragment5, jsx as
|
|
2535
|
+
import { Fragment as Fragment5, jsx as jsx19, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
2359
2536
|
function AuthGuard({
|
|
2360
2537
|
children,
|
|
2361
2538
|
fallback,
|
|
2362
2539
|
className,
|
|
2363
2540
|
classNames,
|
|
2364
|
-
showFallback = true
|
|
2541
|
+
showFallback = true,
|
|
2542
|
+
useSkeleton = false
|
|
2365
2543
|
}) {
|
|
2366
2544
|
const { isAuthenticated, isLoading } = useCilantroAuth();
|
|
2367
2545
|
if (isLoading) {
|
|
2368
|
-
return /* @__PURE__ */
|
|
2546
|
+
return /* @__PURE__ */ jsx19(
|
|
2547
|
+
"div",
|
|
2548
|
+
{
|
|
2549
|
+
className: cn(className, classNames?.root, classNames?.loading),
|
|
2550
|
+
"data-cilantro-auth-guard": true,
|
|
2551
|
+
"aria-busy": "true",
|
|
2552
|
+
"aria-live": "polite",
|
|
2553
|
+
children: useSkeleton ? /* @__PURE__ */ jsxs10("div", { className: cn("rounded-lg border border-input p-4 space-y-3 w-full max-w-sm", classNames?.fallback), children: [
|
|
2554
|
+
/* @__PURE__ */ jsx19(Skeleton, { className: cn("h-6 w-2/3 rounded", classNames?.skeleton) }),
|
|
2555
|
+
/* @__PURE__ */ jsx19(Skeleton, { className: cn("h-4 w-full rounded", classNames?.skeleton) }),
|
|
2556
|
+
/* @__PURE__ */ jsx19(Skeleton, { className: cn("h-4 w-[80%] rounded", classNames?.skeleton) })
|
|
2557
|
+
] }) : /* @__PURE__ */ jsx19("div", { className: cn("text-sm text-muted-foreground", classNames?.fallback), children: "Loading..." })
|
|
2558
|
+
}
|
|
2559
|
+
);
|
|
2369
2560
|
}
|
|
2370
2561
|
if (!isAuthenticated) {
|
|
2371
2562
|
if (!showFallback) return null;
|
|
2372
|
-
return /* @__PURE__ */
|
|
2563
|
+
return /* @__PURE__ */ jsx19("div", { className: cn(className, classNames?.root), "data-cilantro-auth-guard": true, children: fallback ?? /* @__PURE__ */ jsx19(LoginForm, { className: classNames?.fallback }) });
|
|
2373
2564
|
}
|
|
2374
|
-
return /* @__PURE__ */
|
|
2565
|
+
return /* @__PURE__ */ jsx19(Fragment5, { children });
|
|
2375
2566
|
}
|
|
2376
2567
|
|
|
2377
2568
|
// src/components/AddSignerForm.tsx
|
|
2378
2569
|
import { useState as useState11 } from "react";
|
|
2379
2570
|
|
|
2380
2571
|
// src/ui/dialog.tsx
|
|
2381
|
-
import * as
|
|
2572
|
+
import * as React8 from "react";
|
|
2382
2573
|
import * as DialogPrimitive from "@radix-ui/react-dialog";
|
|
2383
|
-
import { jsx as
|
|
2574
|
+
import { jsx as jsx20, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
2384
2575
|
var Dialog = DialogPrimitive.Root;
|
|
2385
2576
|
var DialogPortal = DialogPrimitive.Portal;
|
|
2386
|
-
var DialogOverlay =
|
|
2577
|
+
var DialogOverlay = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx20(
|
|
2387
2578
|
DialogPrimitive.Overlay,
|
|
2388
2579
|
{
|
|
2389
2580
|
ref,
|
|
@@ -2395,14 +2586,14 @@ var DialogOverlay = React7.forwardRef(({ className, ...props }, ref) => /* @__PU
|
|
|
2395
2586
|
}
|
|
2396
2587
|
));
|
|
2397
2588
|
DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
|
|
2398
|
-
var DialogContent =
|
|
2399
|
-
/* @__PURE__ */
|
|
2400
|
-
/* @__PURE__ */
|
|
2589
|
+
var DialogContent = React8.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs11(DialogPortal, { children: [
|
|
2590
|
+
/* @__PURE__ */ jsx20(DialogOverlay, {}),
|
|
2591
|
+
/* @__PURE__ */ jsx20(
|
|
2401
2592
|
DialogPrimitive.Content,
|
|
2402
2593
|
{
|
|
2403
2594
|
ref,
|
|
2404
2595
|
className: cn(
|
|
2405
|
-
"fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",
|
|
2596
|
+
"fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg max-h-[100dvh] sm:max-h-[90vh] translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 overflow-y-auto data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",
|
|
2406
2597
|
className
|
|
2407
2598
|
),
|
|
2408
2599
|
...props,
|
|
@@ -2411,9 +2602,9 @@ var DialogContent = React7.forwardRef(({ className, children, ...props }, ref) =
|
|
|
2411
2602
|
)
|
|
2412
2603
|
] }));
|
|
2413
2604
|
DialogContent.displayName = DialogPrimitive.Content.displayName;
|
|
2414
|
-
var DialogHeader = ({ className, ...props }) => /* @__PURE__ */
|
|
2605
|
+
var DialogHeader = ({ className, ...props }) => /* @__PURE__ */ jsx20("div", { className: cn("flex flex-col space-y-1.5 text-center sm:text-left", className), ...props });
|
|
2415
2606
|
DialogHeader.displayName = "DialogHeader";
|
|
2416
|
-
var DialogFooter = ({ className, ...props }) => /* @__PURE__ */
|
|
2607
|
+
var DialogFooter = ({ className, ...props }) => /* @__PURE__ */ jsx20(
|
|
2417
2608
|
"div",
|
|
2418
2609
|
{
|
|
2419
2610
|
className: cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2", className),
|
|
@@ -2421,7 +2612,7 @@ var DialogFooter = ({ className, ...props }) => /* @__PURE__ */ jsx19(
|
|
|
2421
2612
|
}
|
|
2422
2613
|
);
|
|
2423
2614
|
DialogFooter.displayName = "DialogFooter";
|
|
2424
|
-
var DialogTitle =
|
|
2615
|
+
var DialogTitle = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx20(
|
|
2425
2616
|
DialogPrimitive.Title,
|
|
2426
2617
|
{
|
|
2427
2618
|
ref,
|
|
@@ -2430,7 +2621,7 @@ var DialogTitle = React7.forwardRef(({ className, ...props }, ref) => /* @__PURE
|
|
|
2430
2621
|
}
|
|
2431
2622
|
));
|
|
2432
2623
|
DialogTitle.displayName = DialogPrimitive.Title.displayName;
|
|
2433
|
-
var DialogDescription =
|
|
2624
|
+
var DialogDescription = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx20(
|
|
2434
2625
|
DialogPrimitive.Description,
|
|
2435
2626
|
{
|
|
2436
2627
|
ref,
|
|
@@ -2441,7 +2632,7 @@ var DialogDescription = React7.forwardRef(({ className, ...props }, ref) => /* @
|
|
|
2441
2632
|
DialogDescription.displayName = DialogPrimitive.Description.displayName;
|
|
2442
2633
|
|
|
2443
2634
|
// src/components/AddSignerForm.tsx
|
|
2444
|
-
import { Fragment as Fragment6, jsx as
|
|
2635
|
+
import { Fragment as Fragment6, jsx as jsx21, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
2445
2636
|
function AddSignerForm({
|
|
2446
2637
|
walletId,
|
|
2447
2638
|
open = true,
|
|
@@ -2513,12 +2704,12 @@ function AddSignerForm({
|
|
|
2513
2704
|
onError?.(message);
|
|
2514
2705
|
}).finally(() => setIsSubmitting(false));
|
|
2515
2706
|
};
|
|
2516
|
-
const formContent = /* @__PURE__ */
|
|
2517
|
-
!signerType ? /* @__PURE__ */
|
|
2518
|
-
/* @__PURE__ */
|
|
2519
|
-
/* @__PURE__ */
|
|
2520
|
-
/* @__PURE__ */
|
|
2521
|
-
/* @__PURE__ */
|
|
2707
|
+
const formContent = /* @__PURE__ */ jsxs12("form", { onSubmit: handleSubmit, className: cn("space-y-4", classNames?.form), children: [
|
|
2708
|
+
!signerType ? /* @__PURE__ */ jsxs12(Fragment6, { children: [
|
|
2709
|
+
/* @__PURE__ */ jsxs12("div", { className: "space-y-2", role: "group", "aria-labelledby": "add-signer-type-label", children: [
|
|
2710
|
+
/* @__PURE__ */ jsx21(Label, { id: "add-signer-type-label", className: classNames?.label, children: "Signer type" }),
|
|
2711
|
+
/* @__PURE__ */ jsxs12("div", { className: "flex flex-wrap gap-2", children: [
|
|
2712
|
+
/* @__PURE__ */ jsx21(
|
|
2522
2713
|
Button,
|
|
2523
2714
|
{
|
|
2524
2715
|
type: "button",
|
|
@@ -2529,7 +2720,7 @@ function AddSignerForm({
|
|
|
2529
2720
|
children: "Email"
|
|
2530
2721
|
}
|
|
2531
2722
|
),
|
|
2532
|
-
/* @__PURE__ */
|
|
2723
|
+
/* @__PURE__ */ jsx21(
|
|
2533
2724
|
Button,
|
|
2534
2725
|
{
|
|
2535
2726
|
type: "button",
|
|
@@ -2540,7 +2731,7 @@ function AddSignerForm({
|
|
|
2540
2731
|
children: "Phone"
|
|
2541
2732
|
}
|
|
2542
2733
|
),
|
|
2543
|
-
/* @__PURE__ */
|
|
2734
|
+
/* @__PURE__ */ jsx21(
|
|
2544
2735
|
Button,
|
|
2545
2736
|
{
|
|
2546
2737
|
type: "button",
|
|
@@ -2551,7 +2742,7 @@ function AddSignerForm({
|
|
|
2551
2742
|
children: "Passkey"
|
|
2552
2743
|
}
|
|
2553
2744
|
),
|
|
2554
|
-
/* @__PURE__ */
|
|
2745
|
+
/* @__PURE__ */ jsx21(
|
|
2555
2746
|
Button,
|
|
2556
2747
|
{
|
|
2557
2748
|
type: "button",
|
|
@@ -2564,7 +2755,7 @@ function AddSignerForm({
|
|
|
2564
2755
|
)
|
|
2565
2756
|
] })
|
|
2566
2757
|
] }),
|
|
2567
|
-
asDialog && /* @__PURE__ */
|
|
2758
|
+
asDialog && /* @__PURE__ */ jsx21(DialogFooter, { className: "gap-2 sm:gap-0", children: /* @__PURE__ */ jsx21(
|
|
2568
2759
|
Button,
|
|
2569
2760
|
{
|
|
2570
2761
|
type: "button",
|
|
@@ -2575,10 +2766,10 @@ function AddSignerForm({
|
|
|
2575
2766
|
children: "Cancel"
|
|
2576
2767
|
}
|
|
2577
2768
|
) })
|
|
2578
|
-
] }) : signerType === "email" ? /* @__PURE__ */
|
|
2579
|
-
/* @__PURE__ */
|
|
2580
|
-
/* @__PURE__ */
|
|
2581
|
-
/* @__PURE__ */
|
|
2769
|
+
] }) : signerType === "email" ? /* @__PURE__ */ jsxs12(Fragment6, { children: [
|
|
2770
|
+
/* @__PURE__ */ jsxs12("div", { className: "space-y-2", children: [
|
|
2771
|
+
/* @__PURE__ */ jsx21(Label, { htmlFor: "add-signer-email", className: classNames?.label, children: "Email" }),
|
|
2772
|
+
/* @__PURE__ */ jsx21(
|
|
2582
2773
|
Input,
|
|
2583
2774
|
{
|
|
2584
2775
|
id: "add-signer-email",
|
|
@@ -2593,8 +2784,8 @@ function AddSignerForm({
|
|
|
2593
2784
|
}
|
|
2594
2785
|
)
|
|
2595
2786
|
] }),
|
|
2596
|
-
asDialog && /* @__PURE__ */
|
|
2597
|
-
/* @__PURE__ */
|
|
2787
|
+
asDialog && /* @__PURE__ */ jsxs12(DialogFooter, { className: "gap-2 sm:gap-0", children: [
|
|
2788
|
+
/* @__PURE__ */ jsx21(
|
|
2598
2789
|
Button,
|
|
2599
2790
|
{
|
|
2600
2791
|
type: "button",
|
|
@@ -2605,10 +2796,10 @@ function AddSignerForm({
|
|
|
2605
2796
|
children: "Back"
|
|
2606
2797
|
}
|
|
2607
2798
|
),
|
|
2608
|
-
/* @__PURE__ */
|
|
2799
|
+
/* @__PURE__ */ jsx21(Button, { type: "submit", className: classNames?.submitButton, disabled: isSubmitting, children: isSubmitting ? "Adding..." : "Add signer" })
|
|
2609
2800
|
] }),
|
|
2610
|
-
!asDialog && /* @__PURE__ */
|
|
2611
|
-
/* @__PURE__ */
|
|
2801
|
+
!asDialog && /* @__PURE__ */ jsxs12("div", { className: "flex gap-2", children: [
|
|
2802
|
+
/* @__PURE__ */ jsx21(
|
|
2612
2803
|
Button,
|
|
2613
2804
|
{
|
|
2614
2805
|
type: "button",
|
|
@@ -2619,12 +2810,12 @@ function AddSignerForm({
|
|
|
2619
2810
|
children: "Back"
|
|
2620
2811
|
}
|
|
2621
2812
|
),
|
|
2622
|
-
/* @__PURE__ */
|
|
2813
|
+
/* @__PURE__ */ jsx21(Button, { type: "submit", className: classNames?.submitButton, disabled: isSubmitting, children: isSubmitting ? "Adding..." : "Add signer" })
|
|
2623
2814
|
] })
|
|
2624
|
-
] }) : signerType === "phone" ? /* @__PURE__ */
|
|
2625
|
-
/* @__PURE__ */
|
|
2626
|
-
/* @__PURE__ */
|
|
2627
|
-
/* @__PURE__ */
|
|
2815
|
+
] }) : signerType === "phone" ? /* @__PURE__ */ jsxs12(Fragment6, { children: [
|
|
2816
|
+
/* @__PURE__ */ jsxs12("div", { className: "space-y-2", children: [
|
|
2817
|
+
/* @__PURE__ */ jsx21(Label, { htmlFor: "add-signer-phone", className: classNames?.label, children: "Phone number" }),
|
|
2818
|
+
/* @__PURE__ */ jsx21(
|
|
2628
2819
|
Input,
|
|
2629
2820
|
{
|
|
2630
2821
|
id: "add-signer-phone",
|
|
@@ -2639,8 +2830,8 @@ function AddSignerForm({
|
|
|
2639
2830
|
}
|
|
2640
2831
|
)
|
|
2641
2832
|
] }),
|
|
2642
|
-
asDialog && /* @__PURE__ */
|
|
2643
|
-
/* @__PURE__ */
|
|
2833
|
+
asDialog && /* @__PURE__ */ jsxs12(DialogFooter, { className: "gap-2 sm:gap-0", children: [
|
|
2834
|
+
/* @__PURE__ */ jsx21(
|
|
2644
2835
|
Button,
|
|
2645
2836
|
{
|
|
2646
2837
|
type: "button",
|
|
@@ -2651,10 +2842,10 @@ function AddSignerForm({
|
|
|
2651
2842
|
children: "Back"
|
|
2652
2843
|
}
|
|
2653
2844
|
),
|
|
2654
|
-
/* @__PURE__ */
|
|
2845
|
+
/* @__PURE__ */ jsx21(Button, { type: "submit", className: classNames?.submitButton, disabled: isSubmitting, children: isSubmitting ? "Adding..." : "Add signer" })
|
|
2655
2846
|
] }),
|
|
2656
|
-
!asDialog && /* @__PURE__ */
|
|
2657
|
-
/* @__PURE__ */
|
|
2847
|
+
!asDialog && /* @__PURE__ */ jsxs12("div", { className: "flex gap-2", children: [
|
|
2848
|
+
/* @__PURE__ */ jsx21(
|
|
2658
2849
|
Button,
|
|
2659
2850
|
{
|
|
2660
2851
|
type: "button",
|
|
@@ -2665,12 +2856,12 @@ function AddSignerForm({
|
|
|
2665
2856
|
children: "Back"
|
|
2666
2857
|
}
|
|
2667
2858
|
),
|
|
2668
|
-
/* @__PURE__ */
|
|
2859
|
+
/* @__PURE__ */ jsx21(Button, { type: "submit", className: classNames?.submitButton, disabled: isSubmitting, children: isSubmitting ? "Adding..." : "Add signer" })
|
|
2669
2860
|
] })
|
|
2670
|
-
] }) : signerType === "external" ? /* @__PURE__ */
|
|
2671
|
-
/* @__PURE__ */
|
|
2672
|
-
/* @__PURE__ */
|
|
2673
|
-
/* @__PURE__ */
|
|
2861
|
+
] }) : signerType === "external" ? /* @__PURE__ */ jsxs12(Fragment6, { children: [
|
|
2862
|
+
/* @__PURE__ */ jsxs12("div", { className: "space-y-2", children: [
|
|
2863
|
+
/* @__PURE__ */ jsx21(Label, { htmlFor: "add-signer-address", className: classNames?.label, children: "Wallet address" }),
|
|
2864
|
+
/* @__PURE__ */ jsx21(
|
|
2674
2865
|
Input,
|
|
2675
2866
|
{
|
|
2676
2867
|
id: "add-signer-address",
|
|
@@ -2684,8 +2875,8 @@ function AddSignerForm({
|
|
|
2684
2875
|
}
|
|
2685
2876
|
)
|
|
2686
2877
|
] }),
|
|
2687
|
-
asDialog && /* @__PURE__ */
|
|
2688
|
-
/* @__PURE__ */
|
|
2878
|
+
asDialog && /* @__PURE__ */ jsxs12(DialogFooter, { className: "gap-2 sm:gap-0", children: [
|
|
2879
|
+
/* @__PURE__ */ jsx21(
|
|
2689
2880
|
Button,
|
|
2690
2881
|
{
|
|
2691
2882
|
type: "button",
|
|
@@ -2696,10 +2887,10 @@ function AddSignerForm({
|
|
|
2696
2887
|
children: "Back"
|
|
2697
2888
|
}
|
|
2698
2889
|
),
|
|
2699
|
-
/* @__PURE__ */
|
|
2890
|
+
/* @__PURE__ */ jsx21(Button, { type: "submit", className: classNames?.submitButton, disabled: isSubmitting, children: isSubmitting ? "Adding..." : "Add signer" })
|
|
2700
2891
|
] }),
|
|
2701
|
-
!asDialog && /* @__PURE__ */
|
|
2702
|
-
/* @__PURE__ */
|
|
2892
|
+
!asDialog && /* @__PURE__ */ jsxs12("div", { className: "flex gap-2", children: [
|
|
2893
|
+
/* @__PURE__ */ jsx21(
|
|
2703
2894
|
Button,
|
|
2704
2895
|
{
|
|
2705
2896
|
type: "button",
|
|
@@ -2710,34 +2901,35 @@ function AddSignerForm({
|
|
|
2710
2901
|
children: "Back"
|
|
2711
2902
|
}
|
|
2712
2903
|
),
|
|
2713
|
-
/* @__PURE__ */
|
|
2904
|
+
/* @__PURE__ */ jsx21(Button, { type: "submit", className: classNames?.submitButton, disabled: isSubmitting, children: isSubmitting ? "Adding..." : "Add signer" })
|
|
2714
2905
|
] })
|
|
2715
2906
|
] }) : null,
|
|
2716
|
-
error && /* @__PURE__ */
|
|
2907
|
+
error && /* @__PURE__ */ jsx21("div", { className: cn("text-sm text-destructive", classNames?.error), role: "alert", children: error })
|
|
2717
2908
|
] });
|
|
2718
2909
|
if (asDialog) {
|
|
2719
|
-
return /* @__PURE__ */
|
|
2720
|
-
/* @__PURE__ */
|
|
2721
|
-
/* @__PURE__ */
|
|
2722
|
-
/* @__PURE__ */
|
|
2910
|
+
return /* @__PURE__ */ jsx21(Dialog, { open, onOpenChange: handleClose, children: /* @__PURE__ */ jsxs12(DialogContent, { className: cn(classNames?.dialog), children: [
|
|
2911
|
+
/* @__PURE__ */ jsxs12(DialogHeader, { children: [
|
|
2912
|
+
/* @__PURE__ */ jsx21(DialogTitle, { children: "Add signer" }),
|
|
2913
|
+
/* @__PURE__ */ jsx21(DialogDescription, { children: "Add a new signer to this wallet." })
|
|
2723
2914
|
] }),
|
|
2724
2915
|
formContent
|
|
2725
2916
|
] }) });
|
|
2726
2917
|
}
|
|
2727
|
-
return /* @__PURE__ */
|
|
2728
|
-
/* @__PURE__ */
|
|
2918
|
+
return /* @__PURE__ */ jsxs12("div", { className: cn(className, classNames?.root), "data-cilantro-add-signer-form": true, children: [
|
|
2919
|
+
/* @__PURE__ */ jsx21("h3", { className: "text-sm font-medium mb-2", children: "Add signer" }),
|
|
2729
2920
|
formContent
|
|
2730
2921
|
] });
|
|
2731
2922
|
}
|
|
2732
2923
|
|
|
2733
2924
|
// src/components/SignerList.tsx
|
|
2734
2925
|
import { useState as useState12 } from "react";
|
|
2735
|
-
import { Fragment as Fragment7, jsx as
|
|
2926
|
+
import { Fragment as Fragment7, jsx as jsx22, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
2736
2927
|
function SignerList({
|
|
2737
2928
|
walletId,
|
|
2738
2929
|
className,
|
|
2739
2930
|
classNames,
|
|
2740
2931
|
onSignerAdded,
|
|
2932
|
+
useSkeleton = true,
|
|
2741
2933
|
children
|
|
2742
2934
|
}) {
|
|
2743
2935
|
const { signers, isLoading, error, refresh } = useSigners({ walletId });
|
|
@@ -2747,7 +2939,7 @@ function SignerList({
|
|
|
2747
2939
|
onSignerAdded?.();
|
|
2748
2940
|
};
|
|
2749
2941
|
if (children) {
|
|
2750
|
-
return /* @__PURE__ */
|
|
2942
|
+
return /* @__PURE__ */ jsxs13(Fragment7, { children: [
|
|
2751
2943
|
children({
|
|
2752
2944
|
signers,
|
|
2753
2945
|
isLoading,
|
|
@@ -2755,7 +2947,7 @@ function SignerList({
|
|
|
2755
2947
|
refresh,
|
|
2756
2948
|
openAddSigner: () => setAddSignerOpen(true)
|
|
2757
2949
|
}),
|
|
2758
|
-
/* @__PURE__ */
|
|
2950
|
+
/* @__PURE__ */ jsx22(
|
|
2759
2951
|
AddSignerForm,
|
|
2760
2952
|
{
|
|
2761
2953
|
walletId,
|
|
@@ -2768,31 +2960,46 @@ function SignerList({
|
|
|
2768
2960
|
] });
|
|
2769
2961
|
}
|
|
2770
2962
|
if (!walletId) {
|
|
2771
|
-
return /* @__PURE__ */
|
|
2963
|
+
return /* @__PURE__ */ jsx22("div", { className: cn(className, classNames?.root), "data-cilantro-signer-list": true, children: /* @__PURE__ */ jsx22("p", { className: cn("text-sm text-muted-foreground", classNames?.message), children: "Select a wallet first." }) });
|
|
2772
2964
|
}
|
|
2773
|
-
return /* @__PURE__ */
|
|
2774
|
-
/* @__PURE__ */
|
|
2775
|
-
/* @__PURE__ */
|
|
2776
|
-
/* @__PURE__ */
|
|
2965
|
+
return /* @__PURE__ */ jsxs13("div", { className: cn(className, classNames?.root), "data-cilantro-signer-list": true, "aria-busy": isLoading, "aria-live": "polite", children: [
|
|
2966
|
+
/* @__PURE__ */ jsxs13("div", { className: cn("flex items-center justify-between gap-2 mb-2", classNames?.header), children: [
|
|
2967
|
+
/* @__PURE__ */ jsx22("span", { className: "text-sm font-medium", children: "Signers" }),
|
|
2968
|
+
/* @__PURE__ */ jsx22(
|
|
2777
2969
|
Button,
|
|
2778
2970
|
{
|
|
2779
2971
|
type: "button",
|
|
2780
|
-
size: "
|
|
2972
|
+
size: "touch",
|
|
2781
2973
|
variant: "outline",
|
|
2782
2974
|
className: classNames?.addButton,
|
|
2783
2975
|
onClick: () => setAddSignerOpen(true),
|
|
2784
2976
|
disabled: isLoading,
|
|
2977
|
+
"aria-label": "Add signer",
|
|
2785
2978
|
children: "Add signer"
|
|
2786
2979
|
}
|
|
2787
2980
|
)
|
|
2788
2981
|
] }),
|
|
2789
|
-
isLoading
|
|
2982
|
+
isLoading && useSkeleton ? /* @__PURE__ */ jsx22(
|
|
2983
|
+
"div",
|
|
2984
|
+
{
|
|
2985
|
+
className: cn("space-y-1", classNames?.loading),
|
|
2986
|
+
"aria-busy": "true",
|
|
2987
|
+
"aria-live": "polite",
|
|
2988
|
+
children: [1, 2, 3].map((i) => /* @__PURE__ */ jsx22(
|
|
2989
|
+
Skeleton,
|
|
2990
|
+
{
|
|
2991
|
+
className: cn("h-5 w-full rounded-md", classNames?.skeleton)
|
|
2992
|
+
},
|
|
2993
|
+
i
|
|
2994
|
+
))
|
|
2995
|
+
}
|
|
2996
|
+
) : isLoading ? /* @__PURE__ */ jsx22("p", { className: cn("text-sm text-muted-foreground", classNames?.message), children: "Loading signers..." }) : error ? /* @__PURE__ */ jsx22("p", { className: cn("text-sm text-destructive", classNames?.message), role: "alert", children: error }) : signers.length === 0 ? /* @__PURE__ */ jsx22("p", { className: cn("text-sm text-muted-foreground", classNames?.message), children: "No signers. Add one to get started." }) : /* @__PURE__ */ jsx22("ul", { className: cn("space-y-1", classNames?.list), role: "list", children: signers.map((signer) => /* @__PURE__ */ jsxs13("li", { className: cn("text-sm", classNames?.item), children: [
|
|
2790
2997
|
getSignerDisplayName(signer),
|
|
2791
2998
|
" (",
|
|
2792
2999
|
getSignerTypeLabel(signer.type || signer.signerType || ""),
|
|
2793
3000
|
")"
|
|
2794
3001
|
] }, signer.id)) }),
|
|
2795
|
-
/* @__PURE__ */
|
|
3002
|
+
/* @__PURE__ */ jsx22(
|
|
2796
3003
|
AddSignerForm,
|
|
2797
3004
|
{
|
|
2798
3005
|
walletId,
|
|
@@ -2804,6 +3011,74 @@ function SignerList({
|
|
|
2804
3011
|
)
|
|
2805
3012
|
] });
|
|
2806
3013
|
}
|
|
3014
|
+
|
|
3015
|
+
// src/ui/theme-provider.tsx
|
|
3016
|
+
import * as React9 from "react";
|
|
3017
|
+
import { Fragment as Fragment8, jsx as jsx23, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
3018
|
+
var DEFAULT_THEME_CSS = `
|
|
3019
|
+
:root,[data-theme="light"]{--background:0 0% 100%;--foreground:222.2 84% 4.9%;--primary:222.2 47.4% 11.2%;--primary-foreground:210 40% 98%;--muted:210 40% 96.1%;--muted-foreground:215.4 16.3% 46.9%;--border:214.3 31.8% 91.4%;--input:214.3 31.8% 91.4%;--ring:222.2 84% 4.9%;--destructive:0 84.2% 60.2%;--destructive-foreground:210 40% 98%;--accent:210 40% 96.1%;--accent-foreground:222.2 47.4% 11.2%;--popover:0 0% 100%;--popover-foreground:222.2 84% 4.9%;--card:0 0% 100%;--card-foreground:222.2 84% 4.9%}
|
|
3020
|
+
[data-theme="dark"]{--background:222.2 84% 4.9%;--foreground:210 40% 98%;--primary:210 40% 98%;--primary-foreground:222.2 47.4% 11.2%;--muted:217.2 32.6% 17.5%;--muted-foreground:215 20.2% 65.1%;--border:217.2 32.6% 17.5%;--input:217.2 32.6% 17.5%;--ring:212.7 26.8% 83.9%;--destructive:0 62.8% 30.6%;--destructive-foreground:210 40% 98%;--accent:217.2 32.6% 17.5%;--accent-foreground:210 40% 98%;--popover:222.2 84% 4.9%;--popover-foreground:210 40% 98%;--card:222.2 84% 4.9%;--card-foreground:210 40% 98%}
|
|
3021
|
+
`;
|
|
3022
|
+
function getSystemTheme() {
|
|
3023
|
+
if (typeof window === "undefined") return "dark";
|
|
3024
|
+
return window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
3025
|
+
}
|
|
3026
|
+
function ThemeProvider({
|
|
3027
|
+
theme = "system",
|
|
3028
|
+
defaultTheme = "dark",
|
|
3029
|
+
storageKey,
|
|
3030
|
+
className,
|
|
3031
|
+
children,
|
|
3032
|
+
injectStyles = true
|
|
3033
|
+
}) {
|
|
3034
|
+
const [resolved, setResolved] = React9.useState(() => {
|
|
3035
|
+
if (theme === "light") return "light";
|
|
3036
|
+
if (theme === "dark") return "dark";
|
|
3037
|
+
if (typeof window !== "undefined" && storageKey) {
|
|
3038
|
+
const stored = window.localStorage.getItem(storageKey);
|
|
3039
|
+
if (stored === "light" || stored === "dark") return stored;
|
|
3040
|
+
}
|
|
3041
|
+
return defaultTheme;
|
|
3042
|
+
});
|
|
3043
|
+
React9.useEffect(() => {
|
|
3044
|
+
if (theme === "light") {
|
|
3045
|
+
setResolved("light");
|
|
3046
|
+
return;
|
|
3047
|
+
}
|
|
3048
|
+
if (theme === "dark") {
|
|
3049
|
+
setResolved("dark");
|
|
3050
|
+
return;
|
|
3051
|
+
}
|
|
3052
|
+
const system = getSystemTheme();
|
|
3053
|
+
setResolved(system);
|
|
3054
|
+
const mql = window.matchMedia("(prefers-color-scheme: dark)");
|
|
3055
|
+
const listener = () => {
|
|
3056
|
+
const next = mql.matches ? "dark" : "light";
|
|
3057
|
+
setResolved(next);
|
|
3058
|
+
if (storageKey) window.localStorage.setItem(storageKey, next);
|
|
3059
|
+
};
|
|
3060
|
+
mql.addEventListener("change", listener);
|
|
3061
|
+
return () => mql.removeEventListener("change", listener);
|
|
3062
|
+
}, [theme, storageKey]);
|
|
3063
|
+
return /* @__PURE__ */ jsxs14(Fragment8, { children: [
|
|
3064
|
+
injectStyles && /* @__PURE__ */ jsx23(
|
|
3065
|
+
"style",
|
|
3066
|
+
{
|
|
3067
|
+
dangerouslySetInnerHTML: { __html: DEFAULT_THEME_CSS },
|
|
3068
|
+
"data-cilantro-theme-styles": true
|
|
3069
|
+
}
|
|
3070
|
+
),
|
|
3071
|
+
/* @__PURE__ */ jsx23(
|
|
3072
|
+
"div",
|
|
3073
|
+
{
|
|
3074
|
+
className: cn(className),
|
|
3075
|
+
"data-theme": resolved,
|
|
3076
|
+
"data-cilantro-theme-provider": true,
|
|
3077
|
+
children
|
|
3078
|
+
}
|
|
3079
|
+
)
|
|
3080
|
+
] });
|
|
3081
|
+
}
|
|
2807
3082
|
export {
|
|
2808
3083
|
AddSignerForm,
|
|
2809
3084
|
AuthForm,
|
|
@@ -2817,6 +3092,8 @@ export {
|
|
|
2817
3092
|
SIGNER_TYPES,
|
|
2818
3093
|
SignerList,
|
|
2819
3094
|
SignerSelector,
|
|
3095
|
+
Skeleton,
|
|
3096
|
+
ThemeProvider,
|
|
2820
3097
|
TransactionSigningForm,
|
|
2821
3098
|
WalletProvider,
|
|
2822
3099
|
WalletSelector,
|
|
@@ -2827,11 +3104,16 @@ export {
|
|
|
2827
3104
|
signAndSendTransactionWithSigner,
|
|
2828
3105
|
signMessageWithSigner,
|
|
2829
3106
|
signTransactionWithSigner,
|
|
3107
|
+
useCanSign,
|
|
2830
3108
|
useCilantroAuth,
|
|
3109
|
+
useDelegatedKeys,
|
|
2831
3110
|
useMessageSigning,
|
|
3111
|
+
useSelectedWallet,
|
|
2832
3112
|
useSignerSelection,
|
|
2833
3113
|
useSigners,
|
|
3114
|
+
useSignersForSelectedWallet,
|
|
2834
3115
|
useTransactionSigning,
|
|
3116
|
+
useWalletAddress,
|
|
2835
3117
|
useWallets
|
|
2836
3118
|
};
|
|
2837
3119
|
//# sourceMappingURL=index.mjs.map
|