xertica-ui 1.4.2 → 1.4.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/TemplateContent.tsx +99 -0
- package/components/ui/dialog.tsx +53 -29
- package/dist/components/ui/dialog.d.ts +7 -2
- package/dist/index.es.js +13580 -96810
- package/dist/index.umd.js +13568 -96816
- package/package.json +1 -1
- package/vite.config.ts +15 -1
|
@@ -21,6 +21,26 @@ import { ScrollArea } from './ui/scroll-area';
|
|
|
21
21
|
import { ThemeToggle } from './ThemeToggle';
|
|
22
22
|
import { LanguageSelector } from './LanguageSelector';
|
|
23
23
|
import { MapShowcase } from './examples/MapShowcase';
|
|
24
|
+
import {
|
|
25
|
+
Dialog,
|
|
26
|
+
DialogTrigger,
|
|
27
|
+
DialogContent,
|
|
28
|
+
DialogHeader,
|
|
29
|
+
DialogTitle,
|
|
30
|
+
DialogDescription,
|
|
31
|
+
DialogFooter,
|
|
32
|
+
} from './ui/dialog';
|
|
33
|
+
import {
|
|
34
|
+
AlertDialog,
|
|
35
|
+
AlertDialogTrigger,
|
|
36
|
+
AlertDialogContent,
|
|
37
|
+
AlertDialogHeader,
|
|
38
|
+
AlertDialogTitle,
|
|
39
|
+
AlertDialogDescription,
|
|
40
|
+
AlertDialogFooter,
|
|
41
|
+
AlertDialogAction,
|
|
42
|
+
AlertDialogCancel,
|
|
43
|
+
} from './ui/alert-dialog';
|
|
24
44
|
|
|
25
45
|
import { useLayout } from '../contexts/LayoutContext';
|
|
26
46
|
|
|
@@ -598,6 +618,85 @@ export function TemplateContent({ }: TemplateContentProps) {
|
|
|
598
618
|
</CardContent>
|
|
599
619
|
</Card>
|
|
600
620
|
</section>
|
|
621
|
+
|
|
622
|
+
<Separator className="my-8" />
|
|
623
|
+
|
|
624
|
+
{/* Dialogs */}
|
|
625
|
+
<section>
|
|
626
|
+
<h3 className="mb-4">Dialogs</h3>
|
|
627
|
+
<div className="grid gap-4 md:grid-cols-2">
|
|
628
|
+
<Card>
|
|
629
|
+
<CardHeader>
|
|
630
|
+
<CardTitle>Dialog</CardTitle>
|
|
631
|
+
<CardDescription>Um modal básico interativo</CardDescription>
|
|
632
|
+
</CardHeader>
|
|
633
|
+
<CardContent className="flex justify-center py-6">
|
|
634
|
+
<Dialog>
|
|
635
|
+
<DialogTrigger asChild>
|
|
636
|
+
<Button variant="outline">Editar Perfil</Button>
|
|
637
|
+
</DialogTrigger>
|
|
638
|
+
<DialogContent className="sm:max-w-[425px]">
|
|
639
|
+
<DialogHeader>
|
|
640
|
+
<DialogTitle>Editar Perfil</DialogTitle>
|
|
641
|
+
<DialogDescription>
|
|
642
|
+
Faça alterações no seu perfil aqui. Clique em salvar quando terminar.
|
|
643
|
+
</DialogDescription>
|
|
644
|
+
</DialogHeader>
|
|
645
|
+
<div className="grid gap-4 py-4">
|
|
646
|
+
<div className="grid grid-cols-4 items-center gap-4">
|
|
647
|
+
<Label htmlFor="name" className="text-right">
|
|
648
|
+
Nome
|
|
649
|
+
</Label>
|
|
650
|
+
<Input id="name" defaultValue="Pedro Duarte" className="col-span-3" />
|
|
651
|
+
</div>
|
|
652
|
+
<div className="grid grid-cols-4 items-center gap-4">
|
|
653
|
+
<Label htmlFor="username" className="text-right">
|
|
654
|
+
Username
|
|
655
|
+
</Label>
|
|
656
|
+
<Input id="username" defaultValue="@pedroduarte" className="col-span-3" />
|
|
657
|
+
</div>
|
|
658
|
+
</div>
|
|
659
|
+
<DialogFooter>
|
|
660
|
+
<Button type="submit">Atualizar</Button>
|
|
661
|
+
</DialogFooter>
|
|
662
|
+
</DialogContent>
|
|
663
|
+
</Dialog>
|
|
664
|
+
</CardContent>
|
|
665
|
+
</Card>
|
|
666
|
+
|
|
667
|
+
<Card>
|
|
668
|
+
<CardHeader>
|
|
669
|
+
<CardTitle>Alert Dialog</CardTitle>
|
|
670
|
+
<CardDescription>Um alerta para decisões importantes</CardDescription>
|
|
671
|
+
</CardHeader>
|
|
672
|
+
<CardContent className="flex justify-center py-6">
|
|
673
|
+
<AlertDialog>
|
|
674
|
+
<AlertDialogTrigger asChild>
|
|
675
|
+
<Button variant="destructive">Excluir Conta</Button>
|
|
676
|
+
</AlertDialogTrigger>
|
|
677
|
+
<AlertDialogContent className="sm:max-w-[425px]">
|
|
678
|
+
<AlertDialogHeader>
|
|
679
|
+
<AlertDialogTitle>Você tem certeza absoluta?</AlertDialogTitle>
|
|
680
|
+
<AlertDialogDescription>
|
|
681
|
+
Esta ação não pode ser desfeita. Isso excluirá permanentemente sua
|
|
682
|
+
conta e removerá seus dados de nossos servidores.
|
|
683
|
+
</AlertDialogDescription>
|
|
684
|
+
</AlertDialogHeader>
|
|
685
|
+
<AlertDialogFooter>
|
|
686
|
+
<AlertDialogCancel>Cancelar</AlertDialogCancel>
|
|
687
|
+
<AlertDialogAction className="bg-destructive text-destructive-foreground hover:bg-destructive/90">
|
|
688
|
+
Continuar
|
|
689
|
+
</AlertDialogAction>
|
|
690
|
+
</AlertDialogFooter>
|
|
691
|
+
</AlertDialogContent>
|
|
692
|
+
</AlertDialog>
|
|
693
|
+
</CardContent>
|
|
694
|
+
</Card>
|
|
695
|
+
</div>
|
|
696
|
+
</section>
|
|
697
|
+
|
|
698
|
+
<Separator className="my-8" />
|
|
699
|
+
|
|
601
700
|
{/* Maps */}
|
|
602
701
|
<section>
|
|
603
702
|
<MapShowcase />
|
package/components/ui/dialog.tsx
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
import * as DialogPrimitive from "@radix-ui/react-dialog";
|
|
5
5
|
import { XIcon } from "lucide-react";
|
|
6
|
+
import { cva, type VariantProps } from "class-variance-authority";
|
|
6
7
|
|
|
7
8
|
import { cn } from "./utils";
|
|
8
9
|
|
|
@@ -46,40 +47,63 @@ const DialogOverlay = React.forwardRef<
|
|
|
46
47
|
))
|
|
47
48
|
DialogOverlay.displayName = DialogPrimitive.Overlay.displayName
|
|
48
49
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
);
|
|
50
|
+
const dialogVariants = cva(
|
|
51
|
+
"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-50 grid w-full translate-x-[-50%] translate-y-[-50%] gap-4 border p-6 shadow-elevation-sm duration-200 rounded-[var(--radius-card)]",
|
|
52
|
+
{
|
|
53
|
+
variants: {
|
|
54
|
+
size: {
|
|
55
|
+
sm: "max-w-sm",
|
|
56
|
+
md: "max-w-md",
|
|
57
|
+
lg: "max-w-lg",
|
|
58
|
+
xl: "max-w-xl",
|
|
59
|
+
"2xl": "max-w-2xl",
|
|
60
|
+
"3xl": "max-w-3xl",
|
|
61
|
+
"4xl": "max-w-4xl",
|
|
62
|
+
"5xl": "max-w-5xl",
|
|
63
|
+
full: "max-w-[calc(100vw-2rem)]",
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
defaultVariants: {
|
|
67
|
+
size: "lg",
|
|
68
|
+
},
|
|
69
|
+
}
|
|
70
|
+
)
|
|
71
|
+
|
|
72
|
+
export interface DialogContentProps
|
|
73
|
+
extends React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>,
|
|
74
|
+
VariantProps<typeof dialogVariants> {
|
|
75
|
+
showClose?: boolean;
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
+
const DialogContent = React.forwardRef<
|
|
79
|
+
React.ElementRef<typeof DialogPrimitive.Content>,
|
|
80
|
+
DialogContentProps
|
|
81
|
+
>(({ className, children, size, showClose = true, ...props }, ref) => (
|
|
82
|
+
<DialogPortal data-slot="dialog-portal">
|
|
83
|
+
<DialogOverlay />
|
|
84
|
+
<DialogPrimitive.Content
|
|
85
|
+
ref={ref}
|
|
86
|
+
data-slot="dialog-content"
|
|
87
|
+
className={cn(dialogVariants({ size, className }))}
|
|
88
|
+
{...props}
|
|
89
|
+
>
|
|
90
|
+
{children}
|
|
91
|
+
{showClose && (
|
|
92
|
+
<DialogPrimitive.Close className="absolute top-4 right-4 rounded-full p-2 opacity-70 transition-all hover:opacity-100 hover:bg-accent focus:ring-2 focus:ring-primary focus:ring-offset-2 focus:outline-none disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4">
|
|
93
|
+
<XIcon />
|
|
94
|
+
<span className="sr-only">Close</span>
|
|
95
|
+
</DialogPrimitive.Close>
|
|
96
|
+
)}
|
|
97
|
+
</DialogPrimitive.Content>
|
|
98
|
+
</DialogPortal>
|
|
99
|
+
))
|
|
100
|
+
DialogContent.displayName = DialogPrimitive.Content.displayName
|
|
101
|
+
|
|
78
102
|
function DialogHeader({ className, ...props }: React.ComponentProps<"div">) {
|
|
79
103
|
return (
|
|
80
104
|
<div
|
|
81
105
|
data-slot="dialog-header"
|
|
82
|
-
className={cn("flex flex-col gap-2
|
|
106
|
+
className={cn("flex flex-col gap-2 text-left", className)}
|
|
83
107
|
{...props}
|
|
84
108
|
/>
|
|
85
109
|
);
|
|
@@ -90,7 +114,7 @@ function DialogFooter({ className, ...props }: React.ComponentProps<"div">) {
|
|
|
90
114
|
<div
|
|
91
115
|
data-slot="dialog-footer"
|
|
92
116
|
className={cn(
|
|
93
|
-
"flex flex-col-reverse gap-
|
|
117
|
+
"flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",
|
|
94
118
|
className,
|
|
95
119
|
)}
|
|
96
120
|
{...props}
|
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import * as DialogPrimitive from "@radix-ui/react-dialog";
|
|
3
|
+
import { type VariantProps } from "class-variance-authority";
|
|
3
4
|
declare function Dialog({ ...props }: React.ComponentProps<typeof DialogPrimitive.Root>): import("react/jsx-runtime").JSX.Element;
|
|
4
5
|
declare function DialogTrigger({ ...props }: React.ComponentProps<typeof DialogPrimitive.Trigger>): import("react/jsx-runtime").JSX.Element;
|
|
5
6
|
declare function DialogPortal({ ...props }: React.ComponentProps<typeof DialogPrimitive.Portal>): import("react/jsx-runtime").JSX.Element;
|
|
6
7
|
declare function DialogClose({ ...props }: React.ComponentProps<typeof DialogPrimitive.Close>): import("react/jsx-runtime").JSX.Element;
|
|
7
8
|
declare const DialogOverlay: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogOverlayProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
8
|
-
declare
|
|
9
|
+
declare const dialogVariants: (props?: ({
|
|
10
|
+
size?: "sm" | "lg" | "md" | "xl" | "2xl" | "3xl" | "4xl" | "5xl" | "full" | null | undefined;
|
|
11
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
12
|
+
export interface DialogContentProps extends React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>, VariantProps<typeof dialogVariants> {
|
|
9
13
|
showClose?: boolean;
|
|
10
|
-
}
|
|
14
|
+
}
|
|
15
|
+
declare const DialogContent: React.ForwardRefExoticComponent<DialogContentProps & React.RefAttributes<HTMLDivElement>>;
|
|
11
16
|
declare function DialogHeader({ className, ...props }: React.ComponentProps<"div">): import("react/jsx-runtime").JSX.Element;
|
|
12
17
|
declare function DialogFooter({ className, ...props }: React.ComponentProps<"div">): import("react/jsx-runtime").JSX.Element;
|
|
13
18
|
declare function DialogTitle({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Title>): import("react/jsx-runtime").JSX.Element;
|