@jaw.id/ui 0.0.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/.babelrc +12 -0
- package/README.md +55 -0
- package/components.json +22 -0
- package/dist/ccip-Cdkx99iZ.js +147 -0
- package/dist/components/ConnectDialog/index.d.ts +4 -0
- package/dist/components/ConnectDialog/index.d.ts.map +1 -0
- package/dist/components/ConnectDialog/types.d.ts +20 -0
- package/dist/components/ConnectDialog/types.d.ts.map +1 -0
- package/dist/components/DefaultDialog/index.d.ts +14 -0
- package/dist/components/DefaultDialog/index.d.ts.map +1 -0
- package/dist/components/Eip712Dialog/index.d.ts +4 -0
- package/dist/components/Eip712Dialog/index.d.ts.map +1 -0
- package/dist/components/Eip712Dialog/types.d.ts +19 -0
- package/dist/components/Eip712Dialog/types.d.ts.map +1 -0
- package/dist/components/FeeTokenSelector/index.d.ts +26 -0
- package/dist/components/FeeTokenSelector/index.d.ts.map +1 -0
- package/dist/components/OnboardingDialog/index.d.ts +4 -0
- package/dist/components/OnboardingDialog/index.d.ts.map +1 -0
- package/dist/components/OnboardingDialog/types.d.ts +36 -0
- package/dist/components/OnboardingDialog/types.d.ts.map +1 -0
- package/dist/components/OrSeparator/index.d.ts +2 -0
- package/dist/components/OrSeparator/index.d.ts.map +1 -0
- package/dist/components/PermissionDialog/index.d.ts +4 -0
- package/dist/components/PermissionDialog/index.d.ts.map +1 -0
- package/dist/components/PermissionDialog/types.d.ts +49 -0
- package/dist/components/PermissionDialog/types.d.ts.map +1 -0
- package/dist/components/SignatureDialog/index.d.ts +4 -0
- package/dist/components/SignatureDialog/index.d.ts.map +1 -0
- package/dist/components/SignatureDialog/types.d.ts +19 -0
- package/dist/components/SignatureDialog/types.d.ts.map +1 -0
- package/dist/components/SiweDialog/index.d.ts +4 -0
- package/dist/components/SiweDialog/index.d.ts.map +1 -0
- package/dist/components/SiweDialog/types.d.ts +22 -0
- package/dist/components/SiweDialog/types.d.ts.map +1 -0
- package/dist/components/TransactionDialog/DecodedCalldata.d.ts +9 -0
- package/dist/components/TransactionDialog/DecodedCalldata.d.ts.map +1 -0
- package/dist/components/TransactionDialog/index.d.ts +4 -0
- package/dist/components/TransactionDialog/index.d.ts.map +1 -0
- package/dist/components/TransactionDialog/types.d.ts +34 -0
- package/dist/components/TransactionDialog/types.d.ts.map +1 -0
- package/dist/components/ui/accordion.d.ts +8 -0
- package/dist/components/ui/accordion.d.ts.map +1 -0
- package/dist/components/ui/avatar.d.ts +7 -0
- package/dist/components/ui/avatar.d.ts.map +1 -0
- package/dist/components/ui/button.d.ts +11 -0
- package/dist/components/ui/button.d.ts.map +1 -0
- package/dist/components/ui/card.d.ts +10 -0
- package/dist/components/ui/card.d.ts.map +1 -0
- package/dist/components/ui/checkbox.d.ts +5 -0
- package/dist/components/ui/checkbox.d.ts.map +1 -0
- package/dist/components/ui/dialog.d.ts +18 -0
- package/dist/components/ui/dialog.d.ts.map +1 -0
- package/dist/components/ui/dropdown-menu.d.ts +26 -0
- package/dist/components/ui/dropdown-menu.d.ts.map +1 -0
- package/dist/components/ui/form.d.ts +25 -0
- package/dist/components/ui/form.d.ts.map +1 -0
- package/dist/components/ui/input.d.ts +8 -0
- package/dist/components/ui/input.d.ts.map +1 -0
- package/dist/components/ui/label.d.ts +5 -0
- package/dist/components/ui/label.d.ts.map +1 -0
- package/dist/components/ui/popover.d.ts +8 -0
- package/dist/components/ui/popover.d.ts.map +1 -0
- package/dist/components/ui/scroll-area.d.ts +6 -0
- package/dist/components/ui/scroll-area.d.ts.map +1 -0
- package/dist/components/ui/select.d.ts +14 -0
- package/dist/components/ui/select.d.ts.map +1 -0
- package/dist/components/ui/separator.d.ts +5 -0
- package/dist/components/ui/separator.d.ts.map +1 -0
- package/dist/components/ui/sheet.d.ts +14 -0
- package/dist/components/ui/sheet.d.ts.map +1 -0
- package/dist/components/ui/spinner.d.ts +3 -0
- package/dist/components/ui/spinner.d.ts.map +1 -0
- package/dist/components/ui/tabs.d.ts +8 -0
- package/dist/components/ui/tabs.d.ts.map +1 -0
- package/dist/components/ui/tooltip.d.ts +8 -0
- package/dist/components/ui/tooltip.d.ts.map +1 -0
- package/dist/hooks/index.d.ts +6 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/useChainIconURI.d.ts +12 -0
- package/dist/hooks/useChainIconURI.d.ts.map +1 -0
- package/dist/hooks/useDecodedCalldata.d.ts +15 -0
- package/dist/hooks/useDecodedCalldata.d.ts.map +1 -0
- package/dist/hooks/useFeeTokenPrice.d.ts +8 -0
- package/dist/hooks/useFeeTokenPrice.d.ts.map +1 -0
- package/dist/hooks/useGasEstimation.d.ts +77 -0
- package/dist/hooks/useGasEstimation.d.ts.map +1 -0
- package/dist/hooks/useIsMobile.d.ts +2 -0
- package/dist/hooks/useIsMobile.d.ts.map +1 -0
- package/dist/icons/index.d.ts +12 -0
- package/dist/icons/index.d.ts.map +1 -0
- package/dist/index-DlfjdYW4.js +83119 -0
- package/dist/index.css +1 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +38 -0
- package/dist/lib/utils.d.ts +3 -0
- package/dist/lib/utils.d.ts.map +1 -0
- package/dist/react/ReactUIHandler.d.ts +35 -0
- package/dist/react/ReactUIHandler.d.ts.map +1 -0
- package/dist/react/index.d.ts +2 -0
- package/dist/react/index.d.ts.map +1 -0
- package/dist/utils/formatAddress.d.ts +18 -0
- package/dist/utils/formatAddress.d.ts.map +1 -0
- package/dist/utils/index.d.ts +5 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/justaNameInstance.d.ts +7 -0
- package/dist/utils/justaNameInstance.d.ts.map +1 -0
- package/dist/utils/tokenBalance.d.ts +10 -0
- package/dist/utils/tokenBalance.d.ts.map +1 -0
- package/dist/utils/tokenPrice.d.ts +12 -0
- package/dist/utils/tokenPrice.d.ts.map +1 -0
- package/package.json +67 -0
- package/postcss.config.cjs +6 -0
- package/src/components/ConnectDialog/index.tsx +270 -0
- package/src/components/ConnectDialog/types.ts +34 -0
- package/src/components/DefaultDialog/index.tsx +99 -0
- package/src/components/Eip712Dialog/index.tsx +525 -0
- package/src/components/Eip712Dialog/types.ts +27 -0
- package/src/components/FeeTokenSelector/index.tsx +308 -0
- package/src/components/OnboardingDialog/index.tsx +317 -0
- package/src/components/OnboardingDialog/types.ts +43 -0
- package/src/components/OrSeparator/index.tsx +13 -0
- package/src/components/PermissionDialog/index.tsx +598 -0
- package/src/components/PermissionDialog/types.ts +77 -0
- package/src/components/SignatureDialog/index.tsx +180 -0
- package/src/components/SignatureDialog/types.ts +27 -0
- package/src/components/SiweDialog/index.tsx +231 -0
- package/src/components/SiweDialog/types.ts +34 -0
- package/src/components/TransactionDialog/DecodedCalldata.tsx +79 -0
- package/src/components/TransactionDialog/index.tsx +663 -0
- package/src/components/TransactionDialog/types.ts +54 -0
- package/src/components/ui/accordion.tsx +66 -0
- package/src/components/ui/avatar.tsx +53 -0
- package/src/components/ui/button.tsx +59 -0
- package/src/components/ui/card.tsx +92 -0
- package/src/components/ui/checkbox.tsx +32 -0
- package/src/components/ui/dialog.tsx +183 -0
- package/src/components/ui/dropdown-menu.tsx +258 -0
- package/src/components/ui/form.tsx +167 -0
- package/src/components/ui/input.tsx +60 -0
- package/src/components/ui/label.tsx +24 -0
- package/src/components/ui/popover.tsx +48 -0
- package/src/components/ui/scroll-area.tsx +58 -0
- package/src/components/ui/select.tsx +160 -0
- package/src/components/ui/separator.tsx +28 -0
- package/src/components/ui/sheet.tsx +169 -0
- package/src/components/ui/spinner.tsx +18 -0
- package/src/components/ui/tabs.tsx +69 -0
- package/src/components/ui/tooltip.tsx +61 -0
- package/src/hooks/index.ts +5 -0
- package/src/hooks/useChainIconURI.tsx +117 -0
- package/src/hooks/useDecodedCalldata.ts +128 -0
- package/src/hooks/useFeeTokenPrice.tsx +36 -0
- package/src/hooks/useGasEstimation.ts +474 -0
- package/src/hooks/useIsMobile.ts +36 -0
- package/src/icons/index.tsx +114 -0
- package/src/index.ts +19 -0
- package/src/lib/utils.ts +6 -0
- package/src/react/ReactUIHandler.tsx +3004 -0
- package/src/react/index.ts +2 -0
- package/src/styles.css +210 -0
- package/src/utils/formatAddress.ts +24 -0
- package/src/utils/index.ts +4 -0
- package/src/utils/justaNameInstance.ts +25 -0
- package/src/utils/tokenBalance.ts +41 -0
- package/src/utils/tokenPrice.ts +58 -0
- package/tailwind.config.js +130 -0
- package/tsconfig.json +19 -0
- package/tsconfig.lib.json +43 -0
- package/vite.config.ts +45 -0
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { FeeTokenOption } from '../FeeTokenSelector';
|
|
2
|
+
|
|
3
|
+
export interface TransactionData {
|
|
4
|
+
to: string;
|
|
5
|
+
data?: string;
|
|
6
|
+
value?: string;
|
|
7
|
+
chainId: number;
|
|
8
|
+
// To check if needed
|
|
9
|
+
stepId?: string;
|
|
10
|
+
description?: string;
|
|
11
|
+
action?: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface TransactionDialogProps {
|
|
15
|
+
open: boolean;
|
|
16
|
+
onOpenChange: (open: boolean) => void;
|
|
17
|
+
|
|
18
|
+
// Transaction data
|
|
19
|
+
transactions: TransactionData[];
|
|
20
|
+
|
|
21
|
+
// Wallet info
|
|
22
|
+
walletAddress: string;
|
|
23
|
+
|
|
24
|
+
// Gas estimation
|
|
25
|
+
gasFee: string;
|
|
26
|
+
gasFeeLoading: boolean;
|
|
27
|
+
gasEstimationError: string;
|
|
28
|
+
sponsored: boolean;
|
|
29
|
+
|
|
30
|
+
// Actions
|
|
31
|
+
onConfirm: () => Promise<void>;
|
|
32
|
+
onCancel: () => void;
|
|
33
|
+
isProcessing: boolean;
|
|
34
|
+
|
|
35
|
+
// Status
|
|
36
|
+
transactionStatus: string;
|
|
37
|
+
|
|
38
|
+
// Display utilities
|
|
39
|
+
networkName: string;
|
|
40
|
+
apiKey?: string;
|
|
41
|
+
|
|
42
|
+
// Fee token selection (for ERC-20 paymaster)
|
|
43
|
+
feeTokens?: FeeTokenOption[];
|
|
44
|
+
feeTokensLoading?: boolean;
|
|
45
|
+
selectedFeeToken?: FeeTokenOption | null;
|
|
46
|
+
onFeeTokenSelect?: (token: FeeTokenOption) => void;
|
|
47
|
+
showFeeTokenSelector?: boolean;
|
|
48
|
+
|
|
49
|
+
// ERC-20 payment indicator (when user selected non-native token)
|
|
50
|
+
isPayingWithErc20?: boolean;
|
|
51
|
+
|
|
52
|
+
// RPC configuration
|
|
53
|
+
mainnetRpcUrl: string;
|
|
54
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import * as React from "react"
|
|
4
|
+
import * as AccordionPrimitive from "@radix-ui/react-accordion"
|
|
5
|
+
import { ChevronDownIcon } from "lucide-react"
|
|
6
|
+
|
|
7
|
+
import { cn } from "../../lib/utils"
|
|
8
|
+
|
|
9
|
+
function Accordion({
|
|
10
|
+
...props
|
|
11
|
+
}: React.ComponentProps<typeof AccordionPrimitive.Root>) {
|
|
12
|
+
return <AccordionPrimitive.Root data-slot="accordion" {...props} />
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function AccordionItem({
|
|
16
|
+
className,
|
|
17
|
+
...props
|
|
18
|
+
}: React.ComponentProps<typeof AccordionPrimitive.Item>) {
|
|
19
|
+
return (
|
|
20
|
+
<AccordionPrimitive.Item
|
|
21
|
+
data-slot="accordion-item"
|
|
22
|
+
className={cn("border-b ", className)}
|
|
23
|
+
{...props}
|
|
24
|
+
/>
|
|
25
|
+
)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function AccordionTrigger({
|
|
29
|
+
className,
|
|
30
|
+
children,
|
|
31
|
+
...props
|
|
32
|
+
}: React.ComponentProps<typeof AccordionPrimitive.Trigger>) {
|
|
33
|
+
return (
|
|
34
|
+
<AccordionPrimitive.Header className="flex">
|
|
35
|
+
<AccordionPrimitive.Trigger
|
|
36
|
+
data-slot="accordion-trigger"
|
|
37
|
+
className={cn(
|
|
38
|
+
"focus-visible:border-ring focus-visible:ring-ring/50 flex flex-1 items-start justify-between gap-4 rounded-md py-4 text-left text-sm font-medium outline-none hover:underline focus-visible:ring-[3px] disabled:pointer-events-none disabled:opacity-50 [&[data-state=open]>svg]:rotate-180",
|
|
39
|
+
className
|
|
40
|
+
)}
|
|
41
|
+
{...props}
|
|
42
|
+
>
|
|
43
|
+
{children}
|
|
44
|
+
<ChevronDownIcon className="text-muted-foreground pointer-events-none size-4 shrink-0 translate-y-0.5 transition-transform duration-200" />
|
|
45
|
+
</AccordionPrimitive.Trigger>
|
|
46
|
+
</AccordionPrimitive.Header>
|
|
47
|
+
)
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function AccordionContent({
|
|
51
|
+
className,
|
|
52
|
+
children,
|
|
53
|
+
...props
|
|
54
|
+
}: React.ComponentProps<typeof AccordionPrimitive.Content>) {
|
|
55
|
+
return (
|
|
56
|
+
<AccordionPrimitive.Content
|
|
57
|
+
data-slot="accordion-content"
|
|
58
|
+
className="data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down overflow-hidden text-sm"
|
|
59
|
+
{...props}
|
|
60
|
+
>
|
|
61
|
+
<div className={cn("pt-0 pb-4", className)}>{children}</div>
|
|
62
|
+
</AccordionPrimitive.Content>
|
|
63
|
+
)
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export { Accordion, AccordionItem, AccordionTrigger, AccordionContent }
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import * as React from "react"
|
|
4
|
+
import * as AvatarPrimitive from "@radix-ui/react-avatar"
|
|
5
|
+
|
|
6
|
+
import { cn } from "../../lib/utils"
|
|
7
|
+
|
|
8
|
+
function Avatar({
|
|
9
|
+
className,
|
|
10
|
+
...props
|
|
11
|
+
}: React.ComponentProps<typeof AvatarPrimitive.Root>) {
|
|
12
|
+
return (
|
|
13
|
+
<AvatarPrimitive.Root
|
|
14
|
+
data-slot="avatar"
|
|
15
|
+
className={cn(
|
|
16
|
+
"relative flex size-8 shrink-0 overflow-hidden rounded-full",
|
|
17
|
+
className
|
|
18
|
+
)}
|
|
19
|
+
{...props}
|
|
20
|
+
/>
|
|
21
|
+
)
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function AvatarImage({
|
|
25
|
+
className,
|
|
26
|
+
...props
|
|
27
|
+
}: React.ComponentProps<typeof AvatarPrimitive.Image>) {
|
|
28
|
+
return (
|
|
29
|
+
<AvatarPrimitive.Image
|
|
30
|
+
data-slot="avatar-image"
|
|
31
|
+
className={cn("aspect-square size-full", className)}
|
|
32
|
+
{...props}
|
|
33
|
+
/>
|
|
34
|
+
)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function AvatarFallback({
|
|
38
|
+
className,
|
|
39
|
+
...props
|
|
40
|
+
}: React.ComponentProps<typeof AvatarPrimitive.Fallback>) {
|
|
41
|
+
return (
|
|
42
|
+
<AvatarPrimitive.Fallback
|
|
43
|
+
data-slot="avatar-fallback"
|
|
44
|
+
className={cn(
|
|
45
|
+
"bg-muted flex size-full items-center justify-center rounded-full",
|
|
46
|
+
className
|
|
47
|
+
)}
|
|
48
|
+
{...props}
|
|
49
|
+
/>
|
|
50
|
+
)
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export { Avatar, AvatarImage, AvatarFallback }
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import { Slot } from "@radix-ui/react-slot"
|
|
3
|
+
import { cva, type VariantProps } from "class-variance-authority"
|
|
4
|
+
|
|
5
|
+
import { cn } from "../../lib/utils"
|
|
6
|
+
|
|
7
|
+
const buttonVariants = cva(
|
|
8
|
+
"inline-flex items-center cursor-pointer justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
|
|
9
|
+
{
|
|
10
|
+
variants: {
|
|
11
|
+
variant: {
|
|
12
|
+
default:
|
|
13
|
+
"bg-primary text-primary-foreground shadow-xs hover:bg-primary/90",
|
|
14
|
+
destructive:
|
|
15
|
+
"bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
|
|
16
|
+
outline:
|
|
17
|
+
"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",
|
|
18
|
+
secondary:
|
|
19
|
+
"bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",
|
|
20
|
+
ghost:
|
|
21
|
+
"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
|
|
22
|
+
link: "text-primary underline-offset-4 hover:underline",
|
|
23
|
+
},
|
|
24
|
+
size: {
|
|
25
|
+
default: "h-10 px-4 py-2 has-[>svg]:px-3",
|
|
26
|
+
sm: "h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",
|
|
27
|
+
lg: "h-10 rounded-md px-6 has-[>svg]:px-4",
|
|
28
|
+
icon: "size-9",
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
defaultVariants: {
|
|
32
|
+
variant: "default",
|
|
33
|
+
size: "default",
|
|
34
|
+
},
|
|
35
|
+
}
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
function Button({
|
|
39
|
+
className,
|
|
40
|
+
variant,
|
|
41
|
+
size,
|
|
42
|
+
asChild = false,
|
|
43
|
+
...props
|
|
44
|
+
}: React.ComponentProps<"button"> &
|
|
45
|
+
VariantProps<typeof buttonVariants> & {
|
|
46
|
+
asChild?: boolean
|
|
47
|
+
}) {
|
|
48
|
+
const Comp = asChild ? Slot : "button"
|
|
49
|
+
|
|
50
|
+
return (
|
|
51
|
+
<Comp
|
|
52
|
+
data-slot="button"
|
|
53
|
+
className={cn(buttonVariants({ variant, size, className }))}
|
|
54
|
+
{...props}
|
|
55
|
+
/>
|
|
56
|
+
)
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export { Button, buttonVariants }
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
|
|
3
|
+
import { cn } from "../../lib/utils"
|
|
4
|
+
|
|
5
|
+
function Card({ className, ...props }: React.ComponentProps<"div">) {
|
|
6
|
+
return (
|
|
7
|
+
<div
|
|
8
|
+
data-slot="card"
|
|
9
|
+
className={cn(
|
|
10
|
+
"bg-card text-card-foreground flex flex-col gap-5 rounded-xl border p-5 shadow-sm",
|
|
11
|
+
className
|
|
12
|
+
)}
|
|
13
|
+
{...props}
|
|
14
|
+
/>
|
|
15
|
+
)
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function CardHeader({ className, ...props }: React.ComponentProps<"div">) {
|
|
19
|
+
return (
|
|
20
|
+
<div
|
|
21
|
+
data-slot="card-header"
|
|
22
|
+
className={cn(
|
|
23
|
+
"@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-[5px] has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",
|
|
24
|
+
className
|
|
25
|
+
)}
|
|
26
|
+
{...props}
|
|
27
|
+
/>
|
|
28
|
+
)
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function CardTitle({ className, ...props }: React.ComponentProps<"div">) {
|
|
32
|
+
return (
|
|
33
|
+
<div
|
|
34
|
+
data-slot="card-title"
|
|
35
|
+
className={cn("leading-none font-semibold", className)}
|
|
36
|
+
{...props}
|
|
37
|
+
/>
|
|
38
|
+
)
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function CardDescription({ className, ...props }: React.ComponentProps<"div">) {
|
|
42
|
+
return (
|
|
43
|
+
<div
|
|
44
|
+
data-slot="card-description"
|
|
45
|
+
className={cn("text-muted-foreground text-sm", className)}
|
|
46
|
+
{...props}
|
|
47
|
+
/>
|
|
48
|
+
)
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function CardAction({ className, ...props }: React.ComponentProps<"div">) {
|
|
52
|
+
return (
|
|
53
|
+
<div
|
|
54
|
+
data-slot="card-action"
|
|
55
|
+
className={cn(
|
|
56
|
+
"col-start-2 row-span-2 row-start-1 self-start justify-self-end",
|
|
57
|
+
className
|
|
58
|
+
)}
|
|
59
|
+
{...props}
|
|
60
|
+
/>
|
|
61
|
+
)
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function CardContent({ className, ...props }: React.ComponentProps<"div">) {
|
|
65
|
+
return (
|
|
66
|
+
<div
|
|
67
|
+
data-slot="card-content"
|
|
68
|
+
className={cn(className)}
|
|
69
|
+
{...props}
|
|
70
|
+
/>
|
|
71
|
+
)
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function CardFooter({ className, ...props }: React.ComponentProps<"div">) {
|
|
75
|
+
return (
|
|
76
|
+
<div
|
|
77
|
+
data-slot="card-footer"
|
|
78
|
+
className={cn("flex items-center px-6 [.border-t]:pt-6", className)}
|
|
79
|
+
{...props}
|
|
80
|
+
/>
|
|
81
|
+
)
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export {
|
|
85
|
+
Card,
|
|
86
|
+
CardHeader,
|
|
87
|
+
CardFooter,
|
|
88
|
+
CardTitle,
|
|
89
|
+
CardAction,
|
|
90
|
+
CardDescription,
|
|
91
|
+
CardContent,
|
|
92
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import * as React from "react"
|
|
4
|
+
import * as CheckboxPrimitive from "@radix-ui/react-checkbox"
|
|
5
|
+
import { CheckIcon } from "lucide-react"
|
|
6
|
+
|
|
7
|
+
import { cn } from "../../lib/utils"
|
|
8
|
+
|
|
9
|
+
function Checkbox({
|
|
10
|
+
className,
|
|
11
|
+
...props
|
|
12
|
+
}: React.ComponentProps<typeof CheckboxPrimitive.Root>) {
|
|
13
|
+
return (
|
|
14
|
+
<CheckboxPrimitive.Root
|
|
15
|
+
data-slot="checkbox"
|
|
16
|
+
className={cn(
|
|
17
|
+
"peer border-input dark:bg-input/30 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary data-[state=checked]:border-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive size-4 shrink-0 rounded-[4px] border shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",
|
|
18
|
+
className
|
|
19
|
+
)}
|
|
20
|
+
{...props}
|
|
21
|
+
>
|
|
22
|
+
<CheckboxPrimitive.Indicator
|
|
23
|
+
data-slot="checkbox-indicator"
|
|
24
|
+
className="flex items-center justify-center text-current transition-none"
|
|
25
|
+
>
|
|
26
|
+
<CheckIcon className="size-3.5" />
|
|
27
|
+
</CheckboxPrimitive.Indicator>
|
|
28
|
+
</CheckboxPrimitive.Root>
|
|
29
|
+
)
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export { Checkbox }
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import * as React from "react"
|
|
4
|
+
import * as DialogPrimitive from "@radix-ui/react-dialog"
|
|
5
|
+
import { XIcon } from "lucide-react"
|
|
6
|
+
|
|
7
|
+
import { cn } from "../../lib/utils"
|
|
8
|
+
|
|
9
|
+
function Dialog({
|
|
10
|
+
open,
|
|
11
|
+
...props
|
|
12
|
+
}: React.ComponentProps<typeof DialogPrimitive.Root>) {
|
|
13
|
+
const prevOpenRef = React.useRef(open);
|
|
14
|
+
|
|
15
|
+
// Cleanup pointer-events when dialog closes OR unmounts
|
|
16
|
+
React.useEffect(() => {
|
|
17
|
+
// Track when dialog transitions from open to closed
|
|
18
|
+
if (prevOpenRef.current === true && open === false) {
|
|
19
|
+
// Wait for close animation to complete (200ms duration-200) plus buffer
|
|
20
|
+
const cleanup = setTimeout(() => {
|
|
21
|
+
document.body.style.removeProperty('pointer-events');
|
|
22
|
+
}, 250);
|
|
23
|
+
|
|
24
|
+
prevOpenRef.current = open;
|
|
25
|
+
return () => clearTimeout(cleanup);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
prevOpenRef.current = open;
|
|
29
|
+
|
|
30
|
+
// Cleanup on unmount - remove pointer-events if dialog was open
|
|
31
|
+
return () => {
|
|
32
|
+
if (open === true) {
|
|
33
|
+
setTimeout(() => {
|
|
34
|
+
document.body.style.removeProperty('pointer-events');
|
|
35
|
+
}, 250);
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
}, [open]);
|
|
39
|
+
|
|
40
|
+
return <DialogPrimitive.Root data-slot="dialog" open={open} {...props} />
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function DialogTrigger({
|
|
44
|
+
...props
|
|
45
|
+
}: React.ComponentProps<typeof DialogPrimitive.Trigger>) {
|
|
46
|
+
return <DialogPrimitive.Trigger data-slot="dialog-trigger" {...props} />
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function DialogPortal({
|
|
50
|
+
...props
|
|
51
|
+
}: React.ComponentProps<typeof DialogPrimitive.Portal>) {
|
|
52
|
+
return <DialogPrimitive.Portal data-slot="dialog-portal" {...props} />
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function DialogClose({
|
|
56
|
+
...props
|
|
57
|
+
}: React.ComponentProps<typeof DialogPrimitive.Close>) {
|
|
58
|
+
return <DialogPrimitive.Close data-slot="dialog-close" {...props} />
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function DialogOverlay({
|
|
62
|
+
className,
|
|
63
|
+
onClick,
|
|
64
|
+
...props
|
|
65
|
+
}: React.ComponentProps<typeof DialogPrimitive.Overlay>) {
|
|
66
|
+
return (
|
|
67
|
+
<DialogPrimitive.Overlay
|
|
68
|
+
data-slot="dialog-overlay"
|
|
69
|
+
className={cn(
|
|
70
|
+
"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-[100] bg-black/50",
|
|
71
|
+
className
|
|
72
|
+
)}
|
|
73
|
+
onClick={(e) => {
|
|
74
|
+
// Stop propagation to prevent interference with dialogs underneath
|
|
75
|
+
e.stopPropagation();
|
|
76
|
+
onClick?.(e);
|
|
77
|
+
}}
|
|
78
|
+
{...props}
|
|
79
|
+
/>
|
|
80
|
+
)
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
interface DialogContentProps
|
|
84
|
+
extends React.ComponentProps<typeof DialogPrimitive.Content> {
|
|
85
|
+
showCloseButton?: boolean;
|
|
86
|
+
fullScreen?: boolean;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
function DialogContent({
|
|
90
|
+
className,
|
|
91
|
+
children,
|
|
92
|
+
showCloseButton = true,
|
|
93
|
+
fullScreen = false,
|
|
94
|
+
...props
|
|
95
|
+
}: DialogContentProps) {
|
|
96
|
+
return (
|
|
97
|
+
<DialogPortal data-slot="dialog-portal">
|
|
98
|
+
<DialogOverlay />
|
|
99
|
+
<DialogPrimitive.Content
|
|
100
|
+
data-slot="dialog-content"
|
|
101
|
+
className={cn(
|
|
102
|
+
"bg-background 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 fixed top-[50%] left-[50%] z-[100] grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",
|
|
103
|
+
fullScreen ? 'w-[100vw] h-[100vh] min-w-[100vw] min-h-[100vh] translate-x-0 translate-y-0' : '',
|
|
104
|
+
className
|
|
105
|
+
)}
|
|
106
|
+
{...props}
|
|
107
|
+
>
|
|
108
|
+
{children}
|
|
109
|
+
{showCloseButton && (
|
|
110
|
+
<DialogPrimitive.Close
|
|
111
|
+
data-slot="dialog-close"
|
|
112
|
+
className="ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-sm opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 "
|
|
113
|
+
>
|
|
114
|
+
<XIcon />
|
|
115
|
+
<span className="sr-only">Close</span>
|
|
116
|
+
</DialogPrimitive.Close>
|
|
117
|
+
)}
|
|
118
|
+
</DialogPrimitive.Content>
|
|
119
|
+
</DialogPortal>
|
|
120
|
+
)
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
function DialogHeader({ className, ...props }: React.ComponentProps<"div">) {
|
|
124
|
+
return (
|
|
125
|
+
<div
|
|
126
|
+
data-slot="dialog-header"
|
|
127
|
+
className={cn("flex flex-col gap-2 text-center sm:text-left", className)}
|
|
128
|
+
{...props}
|
|
129
|
+
/>
|
|
130
|
+
)
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
function DialogFooter({ className, ...props }: React.ComponentProps<"div">) {
|
|
134
|
+
return (
|
|
135
|
+
<div
|
|
136
|
+
data-slot="dialog-footer"
|
|
137
|
+
className={cn(
|
|
138
|
+
"flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",
|
|
139
|
+
className
|
|
140
|
+
)}
|
|
141
|
+
{...props}
|
|
142
|
+
/>
|
|
143
|
+
)
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
function DialogTitle({
|
|
147
|
+
className,
|
|
148
|
+
...props
|
|
149
|
+
}: React.ComponentProps<typeof DialogPrimitive.Title>) {
|
|
150
|
+
return (
|
|
151
|
+
<DialogPrimitive.Title
|
|
152
|
+
data-slot="dialog-title"
|
|
153
|
+
className={cn("text-lg leading-none font-semibold", className)}
|
|
154
|
+
{...props}
|
|
155
|
+
/>
|
|
156
|
+
)
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
function DialogDescription({
|
|
160
|
+
className,
|
|
161
|
+
...props
|
|
162
|
+
}: React.ComponentProps<typeof DialogPrimitive.Description>) {
|
|
163
|
+
return (
|
|
164
|
+
<DialogPrimitive.Description
|
|
165
|
+
data-slot="dialog-description"
|
|
166
|
+
className={cn("text-muted-foreground text-sm", className)}
|
|
167
|
+
{...props}
|
|
168
|
+
/>
|
|
169
|
+
)
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
export {
|
|
173
|
+
Dialog,
|
|
174
|
+
DialogClose,
|
|
175
|
+
DialogContent,
|
|
176
|
+
DialogDescription,
|
|
177
|
+
DialogFooter,
|
|
178
|
+
DialogHeader,
|
|
179
|
+
DialogOverlay,
|
|
180
|
+
DialogPortal,
|
|
181
|
+
DialogTitle,
|
|
182
|
+
DialogTrigger,
|
|
183
|
+
}
|