@fabrica_communications/design-system 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.
- package/README.md +54 -0
- package/package.json +91 -0
- package/src/app/components/page.tsx +19 -0
- package/src/app/favicon.ico +0 -0
- package/src/app/foundations/colors/page.tsx +11 -0
- package/src/app/foundations/page.tsx +11 -0
- package/src/app/foundations/typography/page.tsx +11 -0
- package/src/app/getting-started/page.tsx +11 -0
- package/src/app/globals.css +3 -0
- package/src/app/layout.tsx +61 -0
- package/src/app/page.tsx +994 -0
- package/src/components/shared/gap.tsx +103 -0
- package/src/components/shared/page-header.tsx +11 -0
- package/src/components/shared/page-top-button.tsx +27 -0
- package/src/components/ui/accordion.tsx +66 -0
- package/src/components/ui/alert-dialog.tsx +157 -0
- package/src/components/ui/aspect-ratio.tsx +11 -0
- package/src/components/ui/badge.tsx +46 -0
- package/src/components/ui/breadcrumb.tsx +109 -0
- package/src/components/ui/button.mdx +39 -0
- package/src/components/ui/button.stories.tsx +88 -0
- package/src/components/ui/button.tsx +53 -0
- package/src/components/ui/card.tsx +92 -0
- package/src/components/ui/carousel.tsx +241 -0
- package/src/components/ui/checkbox.tsx +32 -0
- package/src/components/ui/dialog.tsx +143 -0
- package/src/components/ui/field.tsx +248 -0
- package/src/components/ui/heading.tsx +51 -0
- package/src/components/ui/icon-definitions.ts +532 -0
- package/src/components/ui/icon.tsx +115 -0
- package/src/components/ui/input-group.tsx +170 -0
- package/src/components/ui/input.tsx +21 -0
- package/src/components/ui/label.tsx +24 -0
- package/src/components/ui/native-select.tsx +48 -0
- package/src/components/ui/pagination.tsx +127 -0
- package/src/components/ui/radio-group.tsx +45 -0
- package/src/components/ui/scroll-area.tsx +58 -0
- package/src/components/ui/section-container.tsx +24 -0
- package/src/components/ui/select.tsx +187 -0
- package/src/components/ui/separator.tsx +28 -0
- package/src/components/ui/skeleton.tsx +13 -0
- package/src/components/ui/sonner.tsx +40 -0
- package/src/components/ui/switch.mdx +20 -0
- package/src/components/ui/switch.stories.tsx +54 -0
- package/src/components/ui/switch.tsx +66 -0
- package/src/components/ui/table.tsx +119 -0
- package/src/components/ui/tabs.tsx +66 -0
- package/src/components/ui/text-link.tsx +72 -0
- package/src/components/ui/text.tsx +54 -0
- package/src/components/ui/textarea.tsx +18 -0
- package/src/components/ui/toggle.tsx +47 -0
- package/src/components/ui/tooltip.tsx +61 -0
- package/src/index.ts +37 -0
- package/src/lib/utils.ts +6 -0
- package/src/styles/globals.css +162 -0
- package/src/styles/variables.css +261 -0
- package/tokens/design-tokens.tokens.json +1652 -0
- package/tokens/design-tokens.tokens/344/270/213/345/261/244.json +1659 -0
- package/tokens//345/205/250/343/203/227/343/203/255/343/202/270/343/202/247/343/202/257/343/203/210/345/205/261/351/200/232_design-tokens.tokens.json +572 -0
|
@@ -0,0 +1,53 @@
|
|
|
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 justify-center whitespace-nowrap transition-all disabled:pointer-events-none disabled:opacity-50 outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-[var(--usage-active-border)]",
|
|
9
|
+
{
|
|
10
|
+
variants: {
|
|
11
|
+
variant: {
|
|
12
|
+
default: "bg-[var(--usage-button-primary)] text-white hover:bg-[var(--usage-button-primary-hover)] disabled:bg-[var(--usage-button-disabled)] font-bold text-[length:var(--font-size-usage-parts-md)] leading-none",
|
|
13
|
+
accent: "bg-[var(--usage-button-accent)] text-white hover:bg-[var(--usage-button-accent-hover)] disabled:bg-[var(--usage-button-disabled)] font-bold text-[length:var(--font-size-usage-parts-md)] leading-none",
|
|
14
|
+
neutral: "bg-white border border-[var(--primitive-neutral-500)] text-[var(--body-text)] hover:bg-[var(--primitive-neutral-200)] disabled:bg-[var(--usage-button-disabled)] disabled:text-white disabled:border-[var(--usage-button-disabled)] font-normal text-[length:var(--font-size-usage-parts-md)] leading-none",
|
|
15
|
+
destructive:
|
|
16
|
+
"bg-[var(--usage-button-destructive)] text-white hover:bg-[var(--usage-button-destructive-hover)] disabled:bg-[var(--usage-button-disabled)] font-bold text-[length:var(--font-size-usage-parts-md)] leading-none",
|
|
17
|
+
},
|
|
18
|
+
size: {
|
|
19
|
+
default: "px-[var(--primitive-spacing-spacing-24)] py-[var(--primitive-spacing-spacing-8)] rounded-[var(--usage-button-m)] gap-[var(--parts-gap-column-sm)] [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-5 shrink-0 [&_svg]:shrink-0",
|
|
20
|
+
sm: "px-[var(--primitive-spacing-spacing-8)] py-[var(--primitive-spacing-spacing-4)] rounded-[var(--usage-button-s)] gap-[var(--parts-gap-column-xs)] text-[length:var(--font-size-usage-parts-sm)] [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0",
|
|
21
|
+
icon: "size-9",
|
|
22
|
+
"icon-sm": "size-8",
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
defaultVariants: {
|
|
26
|
+
variant: "default",
|
|
27
|
+
size: "default",
|
|
28
|
+
},
|
|
29
|
+
}
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
function Button({
|
|
33
|
+
className,
|
|
34
|
+
variant,
|
|
35
|
+
size,
|
|
36
|
+
asChild = false,
|
|
37
|
+
...props
|
|
38
|
+
}: React.ComponentProps<"button"> &
|
|
39
|
+
VariantProps<typeof buttonVariants> & {
|
|
40
|
+
asChild?: boolean
|
|
41
|
+
}) {
|
|
42
|
+
const Comp = asChild ? Slot : "button"
|
|
43
|
+
|
|
44
|
+
return (
|
|
45
|
+
<Comp
|
|
46
|
+
data-slot="button"
|
|
47
|
+
className={cn(buttonVariants({ variant, size, className }))}
|
|
48
|
+
{...props}
|
|
49
|
+
/>
|
|
50
|
+
)
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
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-6 rounded-xl border py-6 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-2 px-6 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("px-6", 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,241 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import * as React from "react"
|
|
4
|
+
import useEmblaCarousel, {
|
|
5
|
+
type UseEmblaCarouselType,
|
|
6
|
+
} from "embla-carousel-react"
|
|
7
|
+
import { ArrowLeft, ArrowRight } from "lucide-react"
|
|
8
|
+
|
|
9
|
+
import { cn } from "../../lib/utils"
|
|
10
|
+
import { Button } from "./button"
|
|
11
|
+
|
|
12
|
+
type CarouselApi = UseEmblaCarouselType[1]
|
|
13
|
+
type UseCarouselParameters = Parameters<typeof useEmblaCarousel>
|
|
14
|
+
type CarouselOptions = UseCarouselParameters[0]
|
|
15
|
+
type CarouselPlugin = UseCarouselParameters[1]
|
|
16
|
+
|
|
17
|
+
type CarouselProps = {
|
|
18
|
+
opts?: CarouselOptions
|
|
19
|
+
plugins?: CarouselPlugin
|
|
20
|
+
orientation?: "horizontal" | "vertical"
|
|
21
|
+
setApi?: (api: CarouselApi) => void
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
type CarouselContextProps = {
|
|
25
|
+
carouselRef: ReturnType<typeof useEmblaCarousel>[0]
|
|
26
|
+
api: ReturnType<typeof useEmblaCarousel>[1]
|
|
27
|
+
scrollPrev: () => void
|
|
28
|
+
scrollNext: () => void
|
|
29
|
+
canScrollPrev: boolean
|
|
30
|
+
canScrollNext: boolean
|
|
31
|
+
} & CarouselProps
|
|
32
|
+
|
|
33
|
+
const CarouselContext = React.createContext<CarouselContextProps | null>(null)
|
|
34
|
+
|
|
35
|
+
function useCarousel() {
|
|
36
|
+
const context = React.useContext(CarouselContext)
|
|
37
|
+
|
|
38
|
+
if (!context) {
|
|
39
|
+
throw new Error("useCarousel must be used within a <Carousel />")
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return context
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function Carousel({
|
|
46
|
+
orientation = "horizontal",
|
|
47
|
+
opts,
|
|
48
|
+
setApi,
|
|
49
|
+
plugins,
|
|
50
|
+
className,
|
|
51
|
+
children,
|
|
52
|
+
...props
|
|
53
|
+
}: React.ComponentProps<"div"> & CarouselProps) {
|
|
54
|
+
const [carouselRef, api] = useEmblaCarousel(
|
|
55
|
+
{
|
|
56
|
+
...opts,
|
|
57
|
+
axis: orientation === "horizontal" ? "x" : "y",
|
|
58
|
+
},
|
|
59
|
+
plugins
|
|
60
|
+
)
|
|
61
|
+
const [canScrollPrev, setCanScrollPrev] = React.useState(false)
|
|
62
|
+
const [canScrollNext, setCanScrollNext] = React.useState(false)
|
|
63
|
+
|
|
64
|
+
const onSelect = React.useCallback((api: CarouselApi) => {
|
|
65
|
+
if (!api) return
|
|
66
|
+
setCanScrollPrev(api.canScrollPrev())
|
|
67
|
+
setCanScrollNext(api.canScrollNext())
|
|
68
|
+
}, [])
|
|
69
|
+
|
|
70
|
+
const scrollPrev = React.useCallback(() => {
|
|
71
|
+
api?.scrollPrev()
|
|
72
|
+
}, [api])
|
|
73
|
+
|
|
74
|
+
const scrollNext = React.useCallback(() => {
|
|
75
|
+
api?.scrollNext()
|
|
76
|
+
}, [api])
|
|
77
|
+
|
|
78
|
+
const handleKeyDown = React.useCallback(
|
|
79
|
+
(event: React.KeyboardEvent<HTMLDivElement>) => {
|
|
80
|
+
if (event.key === "ArrowLeft") {
|
|
81
|
+
event.preventDefault()
|
|
82
|
+
scrollPrev()
|
|
83
|
+
} else if (event.key === "ArrowRight") {
|
|
84
|
+
event.preventDefault()
|
|
85
|
+
scrollNext()
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
[scrollPrev, scrollNext]
|
|
89
|
+
)
|
|
90
|
+
|
|
91
|
+
React.useEffect(() => {
|
|
92
|
+
if (!api || !setApi) return
|
|
93
|
+
setApi(api)
|
|
94
|
+
}, [api, setApi])
|
|
95
|
+
|
|
96
|
+
React.useEffect(() => {
|
|
97
|
+
if (!api) return
|
|
98
|
+
onSelect(api)
|
|
99
|
+
api.on("reInit", onSelect)
|
|
100
|
+
api.on("select", onSelect)
|
|
101
|
+
|
|
102
|
+
return () => {
|
|
103
|
+
api?.off("select", onSelect)
|
|
104
|
+
}
|
|
105
|
+
}, [api, onSelect])
|
|
106
|
+
|
|
107
|
+
return (
|
|
108
|
+
<CarouselContext.Provider
|
|
109
|
+
value={{
|
|
110
|
+
carouselRef,
|
|
111
|
+
api: api,
|
|
112
|
+
opts,
|
|
113
|
+
orientation:
|
|
114
|
+
orientation || (opts?.axis === "y" ? "vertical" : "horizontal"),
|
|
115
|
+
scrollPrev,
|
|
116
|
+
scrollNext,
|
|
117
|
+
canScrollPrev,
|
|
118
|
+
canScrollNext,
|
|
119
|
+
}}
|
|
120
|
+
>
|
|
121
|
+
<div
|
|
122
|
+
onKeyDownCapture={handleKeyDown}
|
|
123
|
+
className={cn("relative", className)}
|
|
124
|
+
role="region"
|
|
125
|
+
aria-roledescription="carousel"
|
|
126
|
+
data-slot="carousel"
|
|
127
|
+
{...props}
|
|
128
|
+
>
|
|
129
|
+
{children}
|
|
130
|
+
</div>
|
|
131
|
+
</CarouselContext.Provider>
|
|
132
|
+
)
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
function CarouselContent({ className, ...props }: React.ComponentProps<"div">) {
|
|
136
|
+
const { carouselRef, orientation } = useCarousel()
|
|
137
|
+
|
|
138
|
+
return (
|
|
139
|
+
<div
|
|
140
|
+
ref={carouselRef}
|
|
141
|
+
className="overflow-hidden"
|
|
142
|
+
data-slot="carousel-content"
|
|
143
|
+
>
|
|
144
|
+
<div
|
|
145
|
+
className={cn(
|
|
146
|
+
"flex",
|
|
147
|
+
orientation === "horizontal" ? "-ml-4" : "-mt-4 flex-col",
|
|
148
|
+
className
|
|
149
|
+
)}
|
|
150
|
+
{...props}
|
|
151
|
+
/>
|
|
152
|
+
</div>
|
|
153
|
+
)
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
function CarouselItem({ className, ...props }: React.ComponentProps<"div">) {
|
|
157
|
+
const { orientation } = useCarousel()
|
|
158
|
+
|
|
159
|
+
return (
|
|
160
|
+
<div
|
|
161
|
+
role="group"
|
|
162
|
+
aria-roledescription="slide"
|
|
163
|
+
data-slot="carousel-item"
|
|
164
|
+
className={cn(
|
|
165
|
+
"min-w-0 shrink-0 grow-0 basis-full",
|
|
166
|
+
orientation === "horizontal" ? "pl-4" : "pt-4",
|
|
167
|
+
className
|
|
168
|
+
)}
|
|
169
|
+
{...props}
|
|
170
|
+
/>
|
|
171
|
+
)
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
function CarouselPrevious({
|
|
175
|
+
className,
|
|
176
|
+
variant = "neutral",
|
|
177
|
+
size = "icon",
|
|
178
|
+
...props
|
|
179
|
+
}: React.ComponentProps<typeof Button>) {
|
|
180
|
+
const { orientation, scrollPrev, canScrollPrev } = useCarousel()
|
|
181
|
+
|
|
182
|
+
return (
|
|
183
|
+
<Button
|
|
184
|
+
data-slot="carousel-previous"
|
|
185
|
+
variant={variant}
|
|
186
|
+
size={size}
|
|
187
|
+
className={cn(
|
|
188
|
+
"absolute size-8 rounded-full",
|
|
189
|
+
orientation === "horizontal"
|
|
190
|
+
? "top-1/2 -left-12 -translate-y-1/2"
|
|
191
|
+
: "-top-12 left-1/2 -translate-x-1/2 rotate-90",
|
|
192
|
+
className
|
|
193
|
+
)}
|
|
194
|
+
disabled={!canScrollPrev}
|
|
195
|
+
onClick={scrollPrev}
|
|
196
|
+
{...props}
|
|
197
|
+
>
|
|
198
|
+
<ArrowLeft />
|
|
199
|
+
<span className="sr-only">Previous slide</span>
|
|
200
|
+
</Button>
|
|
201
|
+
)
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
function CarouselNext({
|
|
205
|
+
className,
|
|
206
|
+
variant = "neutral",
|
|
207
|
+
size = "icon",
|
|
208
|
+
...props
|
|
209
|
+
}: React.ComponentProps<typeof Button>) {
|
|
210
|
+
const { orientation, scrollNext, canScrollNext } = useCarousel()
|
|
211
|
+
|
|
212
|
+
return (
|
|
213
|
+
<Button
|
|
214
|
+
data-slot="carousel-next"
|
|
215
|
+
variant={variant}
|
|
216
|
+
size={size}
|
|
217
|
+
className={cn(
|
|
218
|
+
"absolute size-8 rounded-full",
|
|
219
|
+
orientation === "horizontal"
|
|
220
|
+
? "top-1/2 -right-12 -translate-y-1/2"
|
|
221
|
+
: "-bottom-12 left-1/2 -translate-x-1/2 rotate-90",
|
|
222
|
+
className
|
|
223
|
+
)}
|
|
224
|
+
disabled={!canScrollNext}
|
|
225
|
+
onClick={scrollNext}
|
|
226
|
+
{...props}
|
|
227
|
+
>
|
|
228
|
+
<ArrowRight />
|
|
229
|
+
<span className="sr-only">Next slide</span>
|
|
230
|
+
</Button>
|
|
231
|
+
)
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
export {
|
|
235
|
+
type CarouselApi,
|
|
236
|
+
Carousel,
|
|
237
|
+
CarouselContent,
|
|
238
|
+
CarouselItem,
|
|
239
|
+
CarouselPrevious,
|
|
240
|
+
CarouselNext,
|
|
241
|
+
}
|
|
@@ -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="grid place-content-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,143 @@
|
|
|
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
|
+
...props
|
|
11
|
+
}: React.ComponentProps<typeof DialogPrimitive.Root>) {
|
|
12
|
+
return <DialogPrimitive.Root data-slot="dialog" {...props} />
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function DialogTrigger({
|
|
16
|
+
...props
|
|
17
|
+
}: React.ComponentProps<typeof DialogPrimitive.Trigger>) {
|
|
18
|
+
return <DialogPrimitive.Trigger data-slot="dialog-trigger" {...props} />
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function DialogPortal({
|
|
22
|
+
...props
|
|
23
|
+
}: React.ComponentProps<typeof DialogPrimitive.Portal>) {
|
|
24
|
+
return <DialogPrimitive.Portal data-slot="dialog-portal" {...props} />
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function DialogClose({
|
|
28
|
+
...props
|
|
29
|
+
}: React.ComponentProps<typeof DialogPrimitive.Close>) {
|
|
30
|
+
return <DialogPrimitive.Close data-slot="dialog-close" {...props} />
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function DialogOverlay({
|
|
34
|
+
className,
|
|
35
|
+
...props
|
|
36
|
+
}: React.ComponentProps<typeof DialogPrimitive.Overlay>) {
|
|
37
|
+
return (
|
|
38
|
+
<DialogPrimitive.Overlay
|
|
39
|
+
data-slot="dialog-overlay"
|
|
40
|
+
className={cn(
|
|
41
|
+
"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-50 bg-black/50",
|
|
42
|
+
className
|
|
43
|
+
)}
|
|
44
|
+
{...props}
|
|
45
|
+
/>
|
|
46
|
+
)
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function DialogContent({
|
|
50
|
+
className,
|
|
51
|
+
children,
|
|
52
|
+
showCloseButton = true,
|
|
53
|
+
...props
|
|
54
|
+
}: React.ComponentProps<typeof DialogPrimitive.Content> & {
|
|
55
|
+
showCloseButton?: boolean
|
|
56
|
+
}) {
|
|
57
|
+
return (
|
|
58
|
+
<DialogPortal data-slot="dialog-portal">
|
|
59
|
+
<DialogOverlay />
|
|
60
|
+
<DialogPrimitive.Content
|
|
61
|
+
data-slot="dialog-content"
|
|
62
|
+
className={cn(
|
|
63
|
+
"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 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",
|
|
64
|
+
className
|
|
65
|
+
)}
|
|
66
|
+
{...props}
|
|
67
|
+
>
|
|
68
|
+
{children}
|
|
69
|
+
{showCloseButton && (
|
|
70
|
+
<DialogPrimitive.Close
|
|
71
|
+
data-slot="dialog-close"
|
|
72
|
+
className="ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs 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 [&_svg:not([class*='size-'])]:size-4"
|
|
73
|
+
>
|
|
74
|
+
<XIcon />
|
|
75
|
+
<span className="sr-only">Close</span>
|
|
76
|
+
</DialogPrimitive.Close>
|
|
77
|
+
)}
|
|
78
|
+
</DialogPrimitive.Content>
|
|
79
|
+
</DialogPortal>
|
|
80
|
+
)
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function DialogHeader({ className, ...props }: React.ComponentProps<"div">) {
|
|
84
|
+
return (
|
|
85
|
+
<div
|
|
86
|
+
data-slot="dialog-header"
|
|
87
|
+
className={cn("flex flex-col gap-2 text-center sm:text-left", className)}
|
|
88
|
+
{...props}
|
|
89
|
+
/>
|
|
90
|
+
)
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
function DialogFooter({ className, ...props }: React.ComponentProps<"div">) {
|
|
94
|
+
return (
|
|
95
|
+
<div
|
|
96
|
+
data-slot="dialog-footer"
|
|
97
|
+
className={cn(
|
|
98
|
+
"flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",
|
|
99
|
+
className
|
|
100
|
+
)}
|
|
101
|
+
{...props}
|
|
102
|
+
/>
|
|
103
|
+
)
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
function DialogTitle({
|
|
107
|
+
className,
|
|
108
|
+
...props
|
|
109
|
+
}: React.ComponentProps<typeof DialogPrimitive.Title>) {
|
|
110
|
+
return (
|
|
111
|
+
<DialogPrimitive.Title
|
|
112
|
+
data-slot="dialog-title"
|
|
113
|
+
className={cn("text-lg leading-none font-semibold", className)}
|
|
114
|
+
{...props}
|
|
115
|
+
/>
|
|
116
|
+
)
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
function DialogDescription({
|
|
120
|
+
className,
|
|
121
|
+
...props
|
|
122
|
+
}: React.ComponentProps<typeof DialogPrimitive.Description>) {
|
|
123
|
+
return (
|
|
124
|
+
<DialogPrimitive.Description
|
|
125
|
+
data-slot="dialog-description"
|
|
126
|
+
className={cn("text-muted-foreground text-sm", className)}
|
|
127
|
+
{...props}
|
|
128
|
+
/>
|
|
129
|
+
)
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
export {
|
|
133
|
+
Dialog,
|
|
134
|
+
DialogClose,
|
|
135
|
+
DialogContent,
|
|
136
|
+
DialogDescription,
|
|
137
|
+
DialogFooter,
|
|
138
|
+
DialogHeader,
|
|
139
|
+
DialogOverlay,
|
|
140
|
+
DialogPortal,
|
|
141
|
+
DialogTitle,
|
|
142
|
+
DialogTrigger,
|
|
143
|
+
}
|