@strategicos/ui 0.0.0-stage → 0.1.0

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.
Files changed (119) hide show
  1. package/README.md +33 -2
  2. package/THIRD_PARTY_NOTICES.md +27 -0
  3. package/dist/components/alert-dialog.d.ts +15 -0
  4. package/dist/components/alert-dialog.d.ts.map +1 -0
  5. package/dist/components/alert-dialog.js +40 -0
  6. package/dist/components/alert-dialog.js.map +1 -0
  7. package/dist/components/alert.d.ts +11 -0
  8. package/dist/components/alert.d.ts.map +1 -0
  9. package/dist/components/alert.js +28 -0
  10. package/dist/components/alert.js.map +1 -0
  11. package/dist/components/avatar.d.ts +12 -0
  12. package/dist/components/avatar.d.ts.map +1 -0
  13. package/dist/components/avatar.js +24 -0
  14. package/dist/components/avatar.js.map +1 -0
  15. package/dist/components/badge.d.ts +10 -0
  16. package/dist/components/badge.d.ts.map +1 -0
  17. package/dist/components/badge.js +33 -0
  18. package/dist/components/badge.js.map +1 -0
  19. package/dist/components/button.d.ts +11 -0
  20. package/dist/components/button.d.ts.map +1 -0
  21. package/dist/components/button.js +36 -0
  22. package/dist/components/button.js.map +1 -0
  23. package/dist/components/card.d.ts +12 -0
  24. package/dist/components/card.d.ts.map +1 -0
  25. package/dist/components/card.js +25 -0
  26. package/dist/components/card.js.map +1 -0
  27. package/dist/components/dialog.d.ts +18 -0
  28. package/dist/components/dialog.d.ts.map +1 -0
  29. package/dist/components/dialog.js +38 -0
  30. package/dist/components/dialog.js.map +1 -0
  31. package/dist/components/dropdown-menu.d.ts +30 -0
  32. package/dist/components/dropdown-menu.d.ts.map +1 -0
  33. package/dist/components/dropdown-menu.js +52 -0
  34. package/dist/components/dropdown-menu.js.map +1 -0
  35. package/dist/components/input.d.ts +4 -0
  36. package/dist/components/input.d.ts.map +1 -0
  37. package/dist/components/input.js +7 -0
  38. package/dist/components/input.js.map +1 -0
  39. package/dist/components/label.d.ts +5 -0
  40. package/dist/components/label.d.ts.map +1 -0
  41. package/dist/components/label.js +9 -0
  42. package/dist/components/label.js.map +1 -0
  43. package/dist/components/pagination.d.ts +12 -0
  44. package/dist/components/pagination.d.ts.map +1 -0
  45. package/dist/components/pagination.js +12 -0
  46. package/dist/components/pagination.js.map +1 -0
  47. package/dist/components/select.d.ts +18 -0
  48. package/dist/components/select.d.ts.map +1 -0
  49. package/dist/components/select.js +37 -0
  50. package/dist/components/select.js.map +1 -0
  51. package/dist/components/separator.d.ts +5 -0
  52. package/dist/components/separator.d.ts.map +1 -0
  53. package/dist/components/separator.js +9 -0
  54. package/dist/components/separator.js.map +1 -0
  55. package/dist/components/sheet.d.ts +15 -0
  56. package/dist/components/sheet.d.ts.map +1 -0
  57. package/dist/components/sheet.js +38 -0
  58. package/dist/components/sheet.js.map +1 -0
  59. package/dist/components/sidebar.d.ts +70 -0
  60. package/dist/components/sidebar.d.ts.map +1 -0
  61. package/dist/components/sidebar.js +207 -0
  62. package/dist/components/sidebar.js.map +1 -0
  63. package/dist/components/skeleton.d.ts +3 -0
  64. package/dist/components/skeleton.d.ts.map +1 -0
  65. package/dist/components/skeleton.js +7 -0
  66. package/dist/components/skeleton.js.map +1 -0
  67. package/dist/components/sonner.d.ts +4 -0
  68. package/dist/components/sonner.d.ts.map +1 -0
  69. package/dist/components/sonner.js +26 -0
  70. package/dist/components/sonner.js.map +1 -0
  71. package/dist/components/table.d.ts +11 -0
  72. package/dist/components/table.d.ts.map +1 -0
  73. package/dist/components/table.js +29 -0
  74. package/dist/components/table.js.map +1 -0
  75. package/dist/components/tabs.d.ts +13 -0
  76. package/dist/components/tabs.d.ts.map +1 -0
  77. package/dist/components/tabs.js +69 -0
  78. package/dist/components/tabs.js.map +1 -0
  79. package/dist/components/textarea.d.ts +15 -0
  80. package/dist/components/textarea.d.ts.map +1 -0
  81. package/dist/components/textarea.js +18 -0
  82. package/dist/components/textarea.js.map +1 -0
  83. package/dist/components/tooltip.d.ts +8 -0
  84. package/dist/components/tooltip.d.ts.map +1 -0
  85. package/dist/components/tooltip.js +18 -0
  86. package/dist/components/tooltip.js.map +1 -0
  87. package/dist/hooks/use-mobile.d.ts +2 -0
  88. package/dist/hooks/use-mobile.d.ts.map +1 -0
  89. package/dist/hooks/use-mobile.js +14 -0
  90. package/dist/hooks/use-mobile.js.map +1 -0
  91. package/dist/lib/utils.d.ts +4 -0
  92. package/dist/lib/utils.d.ts.map +1 -0
  93. package/dist/lib/utils.js +7 -0
  94. package/dist/lib/utils.js.map +1 -0
  95. package/package.json +76 -4
  96. package/src/components/alert-dialog.tsx +152 -0
  97. package/src/components/alert.tsx +76 -0
  98. package/src/components/avatar.tsx +112 -0
  99. package/src/components/badge.tsx +57 -0
  100. package/src/components/button.tsx +67 -0
  101. package/src/components/card.tsx +103 -0
  102. package/src/components/dialog.tsx +168 -0
  103. package/src/components/dropdown-menu.tsx +269 -0
  104. package/src/components/input.tsx +19 -0
  105. package/src/components/label.tsx +24 -0
  106. package/src/components/pagination.tsx +62 -0
  107. package/src/components/select.tsx +208 -0
  108. package/src/components/separator.tsx +28 -0
  109. package/src/components/sheet.tsx +147 -0
  110. package/src/components/sidebar.tsx +702 -0
  111. package/src/components/skeleton.tsx +13 -0
  112. package/src/components/sonner.tsx +49 -0
  113. package/src/components/table.tsx +116 -0
  114. package/src/components/tabs.tsx +153 -0
  115. package/src/components/textarea.tsx +29 -0
  116. package/src/components/tooltip.tsx +57 -0
  117. package/src/hooks/use-mobile.ts +20 -0
  118. package/src/lib/utils.ts +7 -0
  119. package/styles.css +112 -0
@@ -0,0 +1,76 @@
1
+ import * as React from "react"
2
+ import { cva, type VariantProps } from "class-variance-authority"
3
+
4
+ import { cn } from "../lib/utils.js"
5
+
6
+ const alertVariants = cva(
7
+ "group/alert relative grid w-full gap-0.5 rounded-lg border px-2.5 py-2 text-left text-sm has-data-[slot=alert-action]:relative has-data-[slot=alert-action]:pr-18 has-[>svg]:grid-cols-[auto_1fr] has-[>svg]:gap-x-2 *:[svg]:row-span-2 *:[svg]:translate-y-0.5 *:[svg]:text-current *:[svg:not([class*='size-'])]:size-4",
8
+ {
9
+ variants: {
10
+ variant: {
11
+ default: "bg-card text-card-foreground",
12
+ destructive:
13
+ "bg-card text-destructive *:data-[slot=alert-description]:text-destructive/90 *:[svg]:text-current",
14
+ },
15
+ },
16
+ defaultVariants: {
17
+ variant: "default",
18
+ },
19
+ }
20
+ )
21
+
22
+ function Alert({
23
+ className,
24
+ variant,
25
+ ...props
26
+ }: React.ComponentProps<"div"> & VariantProps<typeof alertVariants>) {
27
+ return (
28
+ <div
29
+ data-slot="alert"
30
+ role="alert"
31
+ className={cn(alertVariants({ variant }), className)}
32
+ {...props}
33
+ />
34
+ )
35
+ }
36
+
37
+ function AlertTitle({ className, ...props }: React.ComponentProps<"div">) {
38
+ return (
39
+ <div
40
+ data-slot="alert-title"
41
+ className={cn(
42
+ "font-medium group-has-[>svg]/alert:col-start-2 [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground",
43
+ className
44
+ )}
45
+ {...props}
46
+ />
47
+ )
48
+ }
49
+
50
+ function AlertDescription({
51
+ className,
52
+ ...props
53
+ }: React.ComponentProps<"div">) {
54
+ return (
55
+ <div
56
+ data-slot="alert-description"
57
+ className={cn(
58
+ "text-sm text-balance text-muted-foreground md:text-pretty [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground [&_p:not(:last-child)]:mb-4",
59
+ className
60
+ )}
61
+ {...props}
62
+ />
63
+ )
64
+ }
65
+
66
+ function AlertAction({ className, ...props }: React.ComponentProps<"div">) {
67
+ return (
68
+ <div
69
+ data-slot="alert-action"
70
+ className={cn("absolute top-2 right-2", className)}
71
+ {...props}
72
+ />
73
+ )
74
+ }
75
+
76
+ export { Alert, AlertTitle, AlertDescription, AlertAction }
@@ -0,0 +1,112 @@
1
+ "use client"
2
+
3
+ import * as React from "react"
4
+ import { Avatar as AvatarPrimitive } from "radix-ui"
5
+
6
+ import { cn } from "../lib/utils.js"
7
+
8
+ function Avatar({
9
+ className,
10
+ size = "default",
11
+ ...props
12
+ }: React.ComponentProps<typeof AvatarPrimitive.Root> & {
13
+ size?: "default" | "sm" | "lg"
14
+ }) {
15
+ return (
16
+ <AvatarPrimitive.Root
17
+ data-slot="avatar"
18
+ data-size={size}
19
+ className={cn(
20
+ "group/avatar relative flex size-8 shrink-0 rounded-full select-none after:absolute after:inset-0 after:rounded-full after:border after:border-border after:mix-blend-darken data-[size=lg]:size-10 data-[size=sm]:size-6 dark:after:mix-blend-lighten",
21
+ className
22
+ )}
23
+ {...props}
24
+ />
25
+ )
26
+ }
27
+
28
+ function AvatarImage({
29
+ className,
30
+ ...props
31
+ }: React.ComponentProps<typeof AvatarPrimitive.Image>) {
32
+ return (
33
+ <AvatarPrimitive.Image
34
+ data-slot="avatar-image"
35
+ className={cn(
36
+ "aspect-square size-full rounded-full object-cover",
37
+ className
38
+ )}
39
+ {...props}
40
+ />
41
+ )
42
+ }
43
+
44
+ function AvatarFallback({
45
+ className,
46
+ ...props
47
+ }: React.ComponentProps<typeof AvatarPrimitive.Fallback>) {
48
+ return (
49
+ <AvatarPrimitive.Fallback
50
+ data-slot="avatar-fallback"
51
+ className={cn(
52
+ "flex size-full items-center justify-center rounded-full bg-muted text-sm text-muted-foreground group-data-[size=sm]/avatar:text-xs",
53
+ className
54
+ )}
55
+ {...props}
56
+ />
57
+ )
58
+ }
59
+
60
+ function AvatarBadge({ className, ...props }: React.ComponentProps<"span">) {
61
+ return (
62
+ <span
63
+ data-slot="avatar-badge"
64
+ className={cn(
65
+ "absolute right-0 bottom-0 z-10 inline-flex items-center justify-center rounded-full bg-primary text-primary-foreground bg-blend-color ring-2 ring-background select-none",
66
+ "group-data-[size=sm]/avatar:size-2 group-data-[size=sm]/avatar:[&>svg]:hidden",
67
+ "group-data-[size=default]/avatar:size-2.5 group-data-[size=default]/avatar:[&>svg]:size-2",
68
+ "group-data-[size=lg]/avatar:size-3 group-data-[size=lg]/avatar:[&>svg]:size-2",
69
+ className
70
+ )}
71
+ {...props}
72
+ />
73
+ )
74
+ }
75
+
76
+ function AvatarGroup({ className, ...props }: React.ComponentProps<"div">) {
77
+ return (
78
+ <div
79
+ data-slot="avatar-group"
80
+ className={cn(
81
+ "group/avatar-group flex -space-x-2 *:data-[slot=avatar]:ring-2 *:data-[slot=avatar]:ring-background",
82
+ className
83
+ )}
84
+ {...props}
85
+ />
86
+ )
87
+ }
88
+
89
+ function AvatarGroupCount({
90
+ className,
91
+ ...props
92
+ }: React.ComponentProps<"div">) {
93
+ return (
94
+ <div
95
+ data-slot="avatar-group-count"
96
+ className={cn(
97
+ "relative flex size-8 shrink-0 items-center justify-center rounded-full bg-muted text-sm text-muted-foreground ring-2 ring-background group-has-data-[size=lg]/avatar-group:size-10 group-has-data-[size=sm]/avatar-group:size-6 [&>svg]:size-4 group-has-data-[size=lg]/avatar-group:[&>svg]:size-5 group-has-data-[size=sm]/avatar-group:[&>svg]:size-3",
98
+ className
99
+ )}
100
+ {...props}
101
+ />
102
+ )
103
+ }
104
+
105
+ export {
106
+ Avatar,
107
+ AvatarImage,
108
+ AvatarFallback,
109
+ AvatarGroup,
110
+ AvatarGroupCount,
111
+ AvatarBadge,
112
+ }
@@ -0,0 +1,57 @@
1
+ import * as React from "react"
2
+ import { cva, type VariantProps } from "class-variance-authority"
3
+ import { Slot } from "radix-ui"
4
+
5
+ import { cn } from "../lib/utils.js"
6
+
7
+ const badgeVariants = cva(
8
+ "group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!",
9
+ {
10
+ variants: {
11
+ variant: {
12
+ default: "bg-primary text-primary-foreground [a]:hover:bg-primary/80",
13
+ secondary:
14
+ "bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",
15
+ destructive:
16
+ "bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20",
17
+ // ── Status ──────────────────────────────────────────────────────────
18
+ // Mesmo formato tingido do `destructive`. Cada tom é um token com valor
19
+ // próprio por tema, então não há mais `dark:text-*` para manter em par.
20
+ // Tinta em /10 nos DOIS temas. No escuro era /20, e sobre o card escuro
21
+ // isso derrubava o texto do selo destrutivo para 4,0:1.
22
+ success: "bg-success/10 text-success",
23
+ warning: "bg-warning/10 text-warning-strong",
24
+ info: "bg-info/10 text-info",
25
+ outline:
26
+ "border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground",
27
+ ghost:
28
+ "hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",
29
+ link: "text-primary-strong underline-offset-4 hover:underline",
30
+ },
31
+ },
32
+ defaultVariants: {
33
+ variant: "default",
34
+ },
35
+ }
36
+ )
37
+
38
+ function Badge({
39
+ className,
40
+ variant = "default",
41
+ asChild = false,
42
+ ...props
43
+ }: React.ComponentProps<"span"> &
44
+ VariantProps<typeof badgeVariants> & { asChild?: boolean }) {
45
+ const Comp = asChild ? Slot.Root : "span"
46
+
47
+ return (
48
+ <Comp
49
+ data-slot="badge"
50
+ data-variant={variant}
51
+ className={cn(badgeVariants({ variant }), className)}
52
+ {...props}
53
+ />
54
+ )
55
+ }
56
+
57
+ export { Badge, badgeVariants }
@@ -0,0 +1,67 @@
1
+ import * as React from "react"
2
+ import { cva, type VariantProps } from "class-variance-authority"
3
+ import { Slot } from "radix-ui"
4
+
5
+ import { cn } from "../lib/utils.js"
6
+
7
+ const buttonVariants = cva(
8
+ "group/button inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
9
+ {
10
+ variants: {
11
+ variant: {
12
+ default: "bg-primary text-primary-foreground hover:bg-primary-hover aria-expanded:bg-primary-hover",
13
+ outline:
14
+ "border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",
15
+ secondary:
16
+ "bg-secondary text-secondary-foreground hover:bg-accent aria-expanded:bg-accent aria-expanded:text-secondary-foreground",
17
+ ghost:
18
+ "hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",
19
+ destructive:
20
+ "bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40",
21
+ link: "text-primary-strong underline-offset-4 hover:underline",
22
+ },
23
+ size: {
24
+ default:
25
+ "h-9 gap-2 px-4 has-data-[icon=inline-end]:pr-3 has-data-[icon=inline-start]:pl-3",
26
+ xs: "h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",
27
+ sm: "h-7.5 gap-1.5 rounded-[min(var(--radius-md),12px)] px-3 text-[0.8rem] in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5",
28
+ lg: "h-10.5 gap-2 px-5 text-base has-data-[icon=inline-end]:pr-4 has-data-[icon=inline-start]:pl-4",
29
+ icon: "size-9",
30
+ "icon-xs":
31
+ "size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3",
32
+ "icon-sm":
33
+ "size-7.5 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg",
34
+ "icon-lg": "size-10.5",
35
+ },
36
+ },
37
+ defaultVariants: {
38
+ variant: "default",
39
+ size: "default",
40
+ },
41
+ }
42
+ )
43
+
44
+ function Button({
45
+ className,
46
+ variant = "default",
47
+ size = "default",
48
+ asChild = false,
49
+ ...props
50
+ }: React.ComponentProps<"button"> &
51
+ VariantProps<typeof buttonVariants> & {
52
+ asChild?: boolean
53
+ }) {
54
+ const Comp = asChild ? Slot.Root : "button"
55
+
56
+ return (
57
+ <Comp
58
+ data-slot="button"
59
+ data-variant={variant}
60
+ data-size={size}
61
+ className={cn(buttonVariants({ variant, size, className }))}
62
+ {...props}
63
+ />
64
+ )
65
+ }
66
+
67
+ export { Button, buttonVariants }
@@ -0,0 +1,103 @@
1
+ import * as React from "react"
2
+
3
+ import { cn } from "../lib/utils.js"
4
+
5
+ function Card({
6
+ className,
7
+ size = "default",
8
+ ...props
9
+ }: React.ComponentProps<"div"> & { size?: "default" | "sm" }) {
10
+ return (
11
+ <div
12
+ data-slot="card"
13
+ data-size={size}
14
+ className={cn(
15
+ "group/card flex flex-col gap-4 overflow-hidden rounded-xl bg-card py-4 text-sm text-card-foreground shadow-card ring-1 ring-foreground/10 has-data-[slot=card-footer]:pb-0 has-[>img:first-child]:pt-0 data-[size=sm]:gap-3 data-[size=sm]:py-3 data-[size=sm]:has-data-[slot=card-footer]:pb-0 *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl",
16
+ className
17
+ )}
18
+ {...props}
19
+ />
20
+ )
21
+ }
22
+
23
+ function CardHeader({ className, ...props }: React.ComponentProps<"div">) {
24
+ return (
25
+ <div
26
+ data-slot="card-header"
27
+ className={cn(
28
+ "group/card-header @container/card-header grid auto-rows-min items-start gap-1 rounded-t-xl px-4 group-data-[size=sm]/card:px-3 has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto] [.border-b]:pb-4 group-data-[size=sm]/card:[.border-b]:pb-3",
29
+ className
30
+ )}
31
+ {...props}
32
+ />
33
+ )
34
+ }
35
+
36
+ function CardTitle({ className, ...props }: React.ComponentProps<"div">) {
37
+ return (
38
+ <div
39
+ data-slot="card-title"
40
+ className={cn(
41
+ "font-heading text-base leading-snug font-medium group-data-[size=sm]/card:text-sm",
42
+ className
43
+ )}
44
+ {...props}
45
+ />
46
+ )
47
+ }
48
+
49
+ function CardDescription({ className, ...props }: React.ComponentProps<"div">) {
50
+ return (
51
+ <div
52
+ data-slot="card-description"
53
+ className={cn("text-sm text-muted-foreground", className)}
54
+ {...props}
55
+ />
56
+ )
57
+ }
58
+
59
+ function CardAction({ className, ...props }: React.ComponentProps<"div">) {
60
+ return (
61
+ <div
62
+ data-slot="card-action"
63
+ className={cn(
64
+ "col-start-2 row-span-2 row-start-1 self-start justify-self-end",
65
+ className
66
+ )}
67
+ {...props}
68
+ />
69
+ )
70
+ }
71
+
72
+ function CardContent({ className, ...props }: React.ComponentProps<"div">) {
73
+ return (
74
+ <div
75
+ data-slot="card-content"
76
+ className={cn("px-4 group-data-[size=sm]/card:px-3", className)}
77
+ {...props}
78
+ />
79
+ )
80
+ }
81
+
82
+ function CardFooter({ className, ...props }: React.ComponentProps<"div">) {
83
+ return (
84
+ <div
85
+ data-slot="card-footer"
86
+ className={cn(
87
+ "flex items-center rounded-b-xl border-t bg-muted/50 p-4 group-data-[size=sm]/card:p-3",
88
+ className
89
+ )}
90
+ {...props}
91
+ />
92
+ )
93
+ }
94
+
95
+ export {
96
+ Card,
97
+ CardHeader,
98
+ CardFooter,
99
+ CardTitle,
100
+ CardAction,
101
+ CardDescription,
102
+ CardContent,
103
+ }
@@ -0,0 +1,168 @@
1
+ "use client"
2
+
3
+ import * as React from "react"
4
+ import { Dialog as DialogPrimitive } from "radix-ui"
5
+
6
+ import { cn } from "../lib/utils.js"
7
+ import { Button } from "./button.js"
8
+ import { XIcon } from "lucide-react"
9
+
10
+ function Dialog({
11
+ ...props
12
+ }: React.ComponentProps<typeof DialogPrimitive.Root>) {
13
+ return <DialogPrimitive.Root data-slot="dialog" {...props} />
14
+ }
15
+
16
+ function DialogTrigger({
17
+ ...props
18
+ }: React.ComponentProps<typeof DialogPrimitive.Trigger>) {
19
+ return <DialogPrimitive.Trigger data-slot="dialog-trigger" {...props} />
20
+ }
21
+
22
+ function DialogPortal({
23
+ ...props
24
+ }: React.ComponentProps<typeof DialogPrimitive.Portal>) {
25
+ return <DialogPrimitive.Portal data-slot="dialog-portal" {...props} />
26
+ }
27
+
28
+ function DialogClose({
29
+ ...props
30
+ }: React.ComponentProps<typeof DialogPrimitive.Close>) {
31
+ return <DialogPrimitive.Close data-slot="dialog-close" {...props} />
32
+ }
33
+
34
+ function DialogOverlay({
35
+ className,
36
+ ...props
37
+ }: React.ComponentProps<typeof DialogPrimitive.Overlay>) {
38
+ return (
39
+ <DialogPrimitive.Overlay
40
+ data-slot="dialog-overlay"
41
+ className={cn(
42
+ "fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0",
43
+ className
44
+ )}
45
+ {...props}
46
+ />
47
+ )
48
+ }
49
+
50
+ function DialogContent({
51
+ className,
52
+ children,
53
+ showCloseButton = true,
54
+ ...props
55
+ }: React.ComponentProps<typeof DialogPrimitive.Content> & {
56
+ showCloseButton?: boolean
57
+ }) {
58
+ return (
59
+ <DialogPortal>
60
+ <DialogOverlay />
61
+ <DialogPrimitive.Content
62
+ data-slot="dialog-content"
63
+ className={cn(
64
+ "fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-popover p-4 text-sm text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",
65
+ className
66
+ )}
67
+ {...props}
68
+ >
69
+ {children}
70
+ {showCloseButton && (
71
+ <DialogPrimitive.Close data-slot="dialog-close" asChild>
72
+ <Button
73
+ variant="ghost"
74
+ className="absolute top-2 right-2"
75
+ size="icon-sm"
76
+ >
77
+ <XIcon
78
+ />
79
+ <span className="sr-only">Fechar</span>
80
+ </Button>
81
+ </DialogPrimitive.Close>
82
+ )}
83
+ </DialogPrimitive.Content>
84
+ </DialogPortal>
85
+ )
86
+ }
87
+
88
+ function DialogHeader({ className, ...props }: React.ComponentProps<"div">) {
89
+ return (
90
+ <div
91
+ data-slot="dialog-header"
92
+ className={cn("flex flex-col gap-2", className)}
93
+ {...props}
94
+ />
95
+ )
96
+ }
97
+
98
+ function DialogFooter({
99
+ className,
100
+ showCloseButton = false,
101
+ children,
102
+ ...props
103
+ }: React.ComponentProps<"div"> & {
104
+ showCloseButton?: boolean
105
+ }) {
106
+ return (
107
+ <div
108
+ data-slot="dialog-footer"
109
+ className={cn(
110
+ "-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t bg-muted/50 p-4 sm:flex-row sm:justify-end",
111
+ className
112
+ )}
113
+ {...props}
114
+ >
115
+ {children}
116
+ {showCloseButton && (
117
+ <DialogPrimitive.Close asChild>
118
+ <Button variant="outline">Fechar</Button>
119
+ </DialogPrimitive.Close>
120
+ )}
121
+ </div>
122
+ )
123
+ }
124
+
125
+ function DialogTitle({
126
+ className,
127
+ ...props
128
+ }: React.ComponentProps<typeof DialogPrimitive.Title>) {
129
+ return (
130
+ <DialogPrimitive.Title
131
+ data-slot="dialog-title"
132
+ className={cn(
133
+ "font-heading text-base leading-none font-medium",
134
+ className
135
+ )}
136
+ {...props}
137
+ />
138
+ )
139
+ }
140
+
141
+ function DialogDescription({
142
+ className,
143
+ ...props
144
+ }: React.ComponentProps<typeof DialogPrimitive.Description>) {
145
+ return (
146
+ <DialogPrimitive.Description
147
+ data-slot="dialog-description"
148
+ className={cn(
149
+ "text-sm text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground",
150
+ className
151
+ )}
152
+ {...props}
153
+ />
154
+ )
155
+ }
156
+
157
+ export {
158
+ Dialog,
159
+ DialogClose,
160
+ DialogContent,
161
+ DialogDescription,
162
+ DialogFooter,
163
+ DialogHeader,
164
+ DialogOverlay,
165
+ DialogPortal,
166
+ DialogTitle,
167
+ DialogTrigger,
168
+ }