@zabuti/components-mcp 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 (54) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +42 -2
  3. package/dist/index.js +527 -0
  4. package/dist/project-setup.js +424 -0
  5. package/dist/registry.js +73 -0
  6. package/dist/source.js +19 -0
  7. package/package.json +41 -4
  8. package/payload/registry.json +801 -0
  9. package/payload/src/components/ui/accordion.tsx +75 -0
  10. package/payload/src/components/ui/alert-dialog.tsx +151 -0
  11. package/payload/src/components/ui/alert.tsx +69 -0
  12. package/payload/src/components/ui/avatar.tsx +59 -0
  13. package/payload/src/components/ui/badge.tsx +57 -0
  14. package/payload/src/components/ui/breadcrumb.tsx +109 -0
  15. package/payload/src/components/ui/button.tsx +76 -0
  16. package/payload/src/components/ui/calendar.tsx +117 -0
  17. package/payload/src/components/ui/card.tsx +120 -0
  18. package/payload/src/components/ui/chart.tsx +249 -0
  19. package/payload/src/components/ui/checkbox.tsx +38 -0
  20. package/payload/src/components/ui/collapsible.tsx +30 -0
  21. package/payload/src/components/ui/combobox.tsx +127 -0
  22. package/payload/src/components/ui/command.tsx +186 -0
  23. package/payload/src/components/ui/context-menu.tsx +261 -0
  24. package/payload/src/components/ui/date-picker.tsx +140 -0
  25. package/payload/src/components/ui/dialog.tsx +176 -0
  26. package/payload/src/components/ui/dropdown-menu.tsx +277 -0
  27. package/payload/src/components/ui/form.tsx +151 -0
  28. package/payload/src/components/ui/hover-card.tsx +46 -0
  29. package/payload/src/components/ui/input-group.tsx +127 -0
  30. package/payload/src/components/ui/input.tsx +25 -0
  31. package/payload/src/components/ui/label.tsx +28 -0
  32. package/payload/src/components/ui/pagination.tsx +130 -0
  33. package/payload/src/components/ui/popover.tsx +97 -0
  34. package/payload/src/components/ui/progress.tsx +35 -0
  35. package/payload/src/components/ui/radio-group.tsx +49 -0
  36. package/payload/src/components/ui/scroll-area.tsx +67 -0
  37. package/payload/src/components/ui/select.tsx +199 -0
  38. package/payload/src/components/ui/separator.tsx +32 -0
  39. package/payload/src/components/ui/sheet.tsx +155 -0
  40. package/payload/src/components/ui/skeleton.tsx +21 -0
  41. package/payload/src/components/ui/slider.tsx +61 -0
  42. package/payload/src/components/ui/sonner.tsx +31 -0
  43. package/payload/src/components/ui/switch.tsx +40 -0
  44. package/payload/src/components/ui/table.tsx +108 -0
  45. package/payload/src/components/ui/tabs.tsx +98 -0
  46. package/payload/src/components/ui/textarea.tsx +24 -0
  47. package/payload/src/components/ui/toggle-group.tsx +72 -0
  48. package/payload/src/components/ui/toggle.tsx +54 -0
  49. package/payload/src/components/ui/tooltip.tsx +65 -0
  50. package/payload/src/lib/utils.ts +1 -0
  51. package/payload/src/themes/manifest.json +12 -0
  52. package/payload/src/themes/zabuti-ui-sky.css +14 -0
  53. package/payload/src/themes/zabuti-ui-teal.css +14 -0
  54. package/payload/src/zabuti-ui.css +272 -0
@@ -0,0 +1,127 @@
1
+ /**
2
+ * Input Group — Zabuti UI primitive.
3
+ *
4
+ * A flex wrapper that lets an `<input>` share one bordered, focus-ringed field
5
+ * with leading/trailing addons — an icon, a button, an affix like `https://`,
6
+ * a spinner. The border, focus ring and disabled/invalid treatment live on the
7
+ * group; `InputGroupInput` is the base input stripped of its own border and
8
+ * ring. No Radix, server-safe. Zabuti-owned, no shadcn dependency.
9
+ *
10
+ * Addons are positioned by `align` ("inline-start" / "inline-end"), not by their
11
+ * order in the markup. Plain content inside an addon is non-interactive;
12
+ * `InputGroupButton` stays clickable.
13
+ */
14
+ import * as React from "react"
15
+ import { cva, type VariantProps } from "class-variance-authority"
16
+ import { cn } from "cn"
17
+
18
+ import { Button } from "@/components/ui/button"
19
+
20
+ const inputGroupVariants = cva(
21
+ [
22
+ "group/input-group relative flex w-full min-w-0 items-center gap-1.5 rounded-lg border border-input bg-transparent px-2.5 text-base transition-colors outline-none md:text-sm dark:bg-input/30",
23
+ "has-[[data-slot=input-group-input]:focus-visible]:border-ring has-[[data-slot=input-group-input]:focus-visible]:ring-3 has-[[data-slot=input-group-input]:focus-visible]:ring-ring/50",
24
+ "has-[[data-slot=input-group-input][aria-invalid=true]]:border-destructive has-[[data-slot=input-group-input][aria-invalid=true]]:ring-3 has-[[data-slot=input-group-input][aria-invalid=true]]:ring-destructive/20 dark:has-[[data-slot=input-group-input][aria-invalid=true]]:border-destructive/50 dark:has-[[data-slot=input-group-input][aria-invalid=true]]:ring-destructive/40",
25
+ "has-[[data-slot=input-group-input]:disabled]:pointer-events-none has-[[data-slot=input-group-input]:disabled]:cursor-not-allowed has-[[data-slot=input-group-input]:disabled]:bg-input/50 has-[[data-slot=input-group-input]:disabled]:opacity-50 dark:has-[[data-slot=input-group-input]:disabled]:bg-input/80",
26
+ "has-[[data-align=inline-start]_button]:pl-1 has-[[data-align=inline-end]_button]:pr-1",
27
+ "has-[>[data-slot=input-group-addon][data-variant=segment]:last-child]:pr-0 has-[>[data-slot=input-group-addon][data-variant=segment]:first-child]:pl-0",
28
+ ].join(" "),
29
+ {
30
+ variants: {
31
+ size: {
32
+ default: "h-8",
33
+ sm: "h-7",
34
+ lg: "h-9",
35
+ },
36
+ },
37
+ defaultVariants: { size: "default" },
38
+ }
39
+ )
40
+
41
+ function InputGroup({
42
+ className,
43
+ size,
44
+ ...props
45
+ }: React.ComponentProps<"div"> & VariantProps<typeof inputGroupVariants>) {
46
+ return (
47
+ <div
48
+ role="group"
49
+ data-slot="input-group"
50
+ className={cn(inputGroupVariants({ size }), className)}
51
+ {...props}
52
+ />
53
+ )
54
+ }
55
+
56
+ function InputGroupInput({ className, type, ...props }: React.ComponentProps<"input">) {
57
+ return (
58
+ <input
59
+ type={type}
60
+ data-slot="input-group-input"
61
+ className={cn(
62
+ "order-none h-full w-full min-w-0 flex-1 bg-transparent py-1 outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed",
63
+ className
64
+ )}
65
+ {...props}
66
+ />
67
+ )
68
+ }
69
+
70
+ function InputGroupAddon({
71
+ className,
72
+ align = "inline-start",
73
+ variant = "default",
74
+ ...props
75
+ }: React.ComponentProps<"div"> & {
76
+ align?: "inline-start" | "inline-end"
77
+ /** `"segment"` renders a locked, divider-separated panel flush to the field edge (e.g. a fixed email domain). */
78
+ variant?: "default" | "segment"
79
+ }) {
80
+ return (
81
+ <div
82
+ data-slot="input-group-addon"
83
+ data-align={align}
84
+ data-variant={variant}
85
+ className={cn(
86
+ "flex shrink-0 items-center gap-1.5 text-muted-foreground select-none [&_svg:not([class*='size-'])]:size-4 [&>*:not(button):not(input)]:pointer-events-none",
87
+ align === "inline-end" ? "order-last" : "order-first",
88
+ variant === "segment" &&
89
+ "self-stretch border-input bg-muted/60 px-2.5 text-sm rounded-[inherit] " +
90
+ (align === "inline-end"
91
+ ? "border-l rounded-l-none"
92
+ : "border-r rounded-r-none"),
93
+ className
94
+ )}
95
+ {...props}
96
+ />
97
+ )
98
+ }
99
+
100
+ function InputGroupText({ className, ...props }: React.ComponentProps<"span">) {
101
+ return (
102
+ <span
103
+ data-slot="input-group-text"
104
+ className={cn("shrink-0 text-sm text-muted-foreground select-none", className)}
105
+ {...props}
106
+ />
107
+ )
108
+ }
109
+
110
+ function InputGroupButton({
111
+ className,
112
+ variant = "ghost",
113
+ size = "icon-xs",
114
+ ...props
115
+ }: React.ComponentProps<typeof Button>) {
116
+ return (
117
+ <Button
118
+ data-slot="input-group-button"
119
+ variant={variant}
120
+ size={size}
121
+ className={cn("pointer-events-auto text-muted-foreground", className)}
122
+ {...props}
123
+ />
124
+ )
125
+ }
126
+
127
+ export { InputGroup, InputGroupInput, InputGroupAddon, InputGroupText, InputGroupButton }
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Input — Zabuti UI primitive.
3
+ *
4
+ * Presentational `<input>` + Tailwind over the `zabuti-ui.css` token layer.
5
+ * No Radix, server-safe. Zabuti-owned, no shadcn dependency. Carries the shared
6
+ * field styling: focus ring, `aria-invalid`, disabled treatment.
7
+ */
8
+ import * as React from "react"
9
+ import { cn } from "cn"
10
+
11
+ function Input({ className, type, ...props }: React.ComponentProps<"input">) {
12
+ return (
13
+ <input
14
+ type={type}
15
+ data-slot="input"
16
+ className={cn(
17
+ "h-8 w-full min-w-0 rounded-lg border border-input bg-transparent px-2.5 py-1 text-base transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",
18
+ className
19
+ )}
20
+ {...props}
21
+ />
22
+ )
23
+ }
24
+
25
+ export { Input }
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Label — Zabuti UI primitive.
3
+ *
4
+ * Radix Label + Tailwind over the `zabuti-ui.css` token layer. Zabuti-owned, no
5
+ * shadcn dependency. Reflects sibling/peer `disabled` state via group/peer
6
+ * selectors. Server-safe.
7
+ */
8
+ import * as React from "react"
9
+ import { cn } from "cn"
10
+ import { Label as LabelPrimitive } from "radix-ui"
11
+
12
+ function Label({
13
+ className,
14
+ ...props
15
+ }: React.ComponentProps<typeof LabelPrimitive.Root>) {
16
+ return (
17
+ <LabelPrimitive.Root
18
+ data-slot="label"
19
+ className={cn(
20
+ "flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",
21
+ className
22
+ )}
23
+ {...props}
24
+ />
25
+ )
26
+ }
27
+
28
+ export { Label }
@@ -0,0 +1,130 @@
1
+ /**
2
+ * Pagination — Zabuti UI primitive.
3
+ *
4
+ * Page navigation for any list or table view (the non-virtualized case — Grid
5
+ * Reports handles its own large-dataset scrolling). Plain semantic markup
6
+ * (`<nav>` + `<ul>`), no Radix; links compose `buttonVariants`. Zabuti-owned,
7
+ * no shadcn dependency. Wire `href` / `onClick` and the active page yourself.
8
+ *
9
+ * The current page is marked with the outline variant, not a solid fill — the
10
+ * house rule for a "current" state.
11
+ */
12
+ import * as React from "react"
13
+ import { type VariantProps } from "class-variance-authority"
14
+ import { cn } from "cn"
15
+ import { ChevronLeftIcon, ChevronRightIcon, MoreHorizontalIcon } from "lucide-react"
16
+
17
+ import { buttonVariants } from "@/components/ui/button"
18
+
19
+ function Pagination({ className, ...props }: React.ComponentProps<"nav">) {
20
+ return (
21
+ <nav
22
+ role="navigation"
23
+ aria-label="pagination"
24
+ data-slot="pagination"
25
+ className={cn("mx-auto flex w-full justify-center", className)}
26
+ {...props}
27
+ />
28
+ )
29
+ }
30
+
31
+ function PaginationContent({ className, ...props }: React.ComponentProps<"ul">) {
32
+ return (
33
+ <ul
34
+ data-slot="pagination-content"
35
+ className={cn("flex flex-row items-center gap-1", className)}
36
+ {...props}
37
+ />
38
+ )
39
+ }
40
+
41
+ function PaginationItem({ ...props }: React.ComponentProps<"li">) {
42
+ return <li data-slot="pagination-item" {...props} />
43
+ }
44
+
45
+ type PaginationLinkProps = {
46
+ isActive?: boolean
47
+ size?: VariantProps<typeof buttonVariants>["size"]
48
+ } & React.ComponentProps<"a">
49
+
50
+ function PaginationLink({
51
+ className,
52
+ isActive,
53
+ size = "icon",
54
+ ...props
55
+ }: PaginationLinkProps) {
56
+ return (
57
+ <a
58
+ aria-current={isActive ? "page" : undefined}
59
+ data-slot="pagination-link"
60
+ data-active={isActive}
61
+ className={cn(
62
+ buttonVariants({ variant: isActive ? "outline" : "ghost", size }),
63
+ "cursor-pointer",
64
+ className
65
+ )}
66
+ {...props}
67
+ />
68
+ )
69
+ }
70
+
71
+ function PaginationPrevious({
72
+ className,
73
+ ...props
74
+ }: React.ComponentProps<typeof PaginationLink>) {
75
+ return (
76
+ <PaginationLink
77
+ aria-label="Go to previous page"
78
+ size="default"
79
+ className={cn("gap-1 px-2.5", className)}
80
+ {...props}
81
+ >
82
+ <ChevronLeftIcon />
83
+ <span>Previous</span>
84
+ </PaginationLink>
85
+ )
86
+ }
87
+
88
+ function PaginationNext({
89
+ className,
90
+ ...props
91
+ }: React.ComponentProps<typeof PaginationLink>) {
92
+ return (
93
+ <PaginationLink
94
+ aria-label="Go to next page"
95
+ size="default"
96
+ className={cn("gap-1 px-2.5", className)}
97
+ {...props}
98
+ >
99
+ <span>Next</span>
100
+ <ChevronRightIcon />
101
+ </PaginationLink>
102
+ )
103
+ }
104
+
105
+ function PaginationEllipsis({
106
+ className,
107
+ ...props
108
+ }: React.ComponentProps<"span">) {
109
+ return (
110
+ <span
111
+ aria-hidden
112
+ data-slot="pagination-ellipsis"
113
+ className={cn("flex size-8 items-center justify-center", className)}
114
+ {...props}
115
+ >
116
+ <MoreHorizontalIcon className="size-4" />
117
+ <span className="sr-only">More pages</span>
118
+ </span>
119
+ )
120
+ }
121
+
122
+ export {
123
+ Pagination,
124
+ PaginationContent,
125
+ PaginationItem,
126
+ PaginationLink,
127
+ PaginationPrevious,
128
+ PaginationNext,
129
+ PaginationEllipsis,
130
+ }
@@ -0,0 +1,97 @@
1
+ "use client"
2
+
3
+ /**
4
+ * Popover — Zabuti UI primitive.
5
+ *
6
+ * Radix Popover + Tailwind over the `zabuti-ui.css` token layer. Zabuti-owned,
7
+ * no shadcn dependency; Radix is the behavioural base only.
8
+ *
9
+ * Local surface: `PopoverHeader` / `PopoverTitle` / `PopoverDescription` layout
10
+ * helpers (not part of Radix).
11
+ */
12
+ import * as React from "react"
13
+ import { cn } from "cn"
14
+ import { Popover as PopoverPrimitive } from "radix-ui"
15
+
16
+ function Popover({
17
+ ...props
18
+ }: React.ComponentProps<typeof PopoverPrimitive.Root>) {
19
+ return <PopoverPrimitive.Root data-slot="popover" {...props} />
20
+ }
21
+
22
+ function PopoverTrigger({
23
+ ...props
24
+ }: React.ComponentProps<typeof PopoverPrimitive.Trigger>) {
25
+ return <PopoverPrimitive.Trigger data-slot="popover-trigger" {...props} />
26
+ }
27
+
28
+ function PopoverContent({
29
+ className,
30
+ align = "center",
31
+ sideOffset = 4,
32
+ ...props
33
+ }: React.ComponentProps<typeof PopoverPrimitive.Content>) {
34
+ return (
35
+ <PopoverPrimitive.Portal>
36
+ <PopoverPrimitive.Content
37
+ data-slot="popover-content"
38
+ align={align}
39
+ sideOffset={sideOffset}
40
+ className={cn(
41
+ "z-50 flex w-72 origin-(--radix-popover-content-transform-origin) flex-col gap-2.5 rounded-lg bg-popover p-2.5 text-sm text-popover-foreground shadow-md ring-1 ring-foreground/10 outline-hidden duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 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",
42
+ className
43
+ )}
44
+ {...props}
45
+ />
46
+ </PopoverPrimitive.Portal>
47
+ )
48
+ }
49
+
50
+ function PopoverAnchor({
51
+ ...props
52
+ }: React.ComponentProps<typeof PopoverPrimitive.Anchor>) {
53
+ return <PopoverPrimitive.Anchor data-slot="popover-anchor" {...props} />
54
+ }
55
+
56
+ function PopoverHeader({ className, ...props }: React.ComponentProps<"div">) {
57
+ return (
58
+ <div
59
+ data-slot="popover-header"
60
+ className={cn("flex flex-col gap-0.5 text-sm", className)}
61
+ {...props}
62
+ />
63
+ )
64
+ }
65
+
66
+ function PopoverTitle({ className, ...props }: React.ComponentProps<"div">) {
67
+ return (
68
+ <div
69
+ data-slot="popover-title"
70
+ className={cn("font-medium", className)}
71
+ {...props}
72
+ />
73
+ )
74
+ }
75
+
76
+ function PopoverDescription({
77
+ className,
78
+ ...props
79
+ }: React.ComponentProps<"p">) {
80
+ return (
81
+ <p
82
+ data-slot="popover-description"
83
+ className={cn("text-muted-foreground", className)}
84
+ {...props}
85
+ />
86
+ )
87
+ }
88
+
89
+ export {
90
+ Popover,
91
+ PopoverAnchor,
92
+ PopoverContent,
93
+ PopoverDescription,
94
+ PopoverHeader,
95
+ PopoverTitle,
96
+ PopoverTrigger,
97
+ }
@@ -0,0 +1,35 @@
1
+ "use client"
2
+
3
+ /**
4
+ * Progress — Zabuti UI primitive.
5
+ *
6
+ * Radix Progress + Tailwind over the `zabuti-ui.css` token layer — a
7
+ * determinate progress bar (`value` 0–100). Zabuti-owned, no shadcn dependency;
8
+ * Radix is the behavioural base only.
9
+ */
10
+ import * as React from "react"
11
+ import { cn } from "cn"
12
+ import { Progress as ProgressPrimitive } from "radix-ui"
13
+
14
+ function Progress({
15
+ className,
16
+ value,
17
+ ...props
18
+ }: React.ComponentProps<typeof ProgressPrimitive.Root>) {
19
+ return (
20
+ <ProgressPrimitive.Root
21
+ data-slot="progress"
22
+ className={cn("relative h-1.5 w-full overflow-hidden rounded-full bg-muted", className)}
23
+ value={value}
24
+ {...props}
25
+ >
26
+ <ProgressPrimitive.Indicator
27
+ data-slot="progress-indicator"
28
+ className="h-full w-full flex-1 bg-primary transition-transform"
29
+ style={{ transform: `translateX(-${100 - (value ?? 0)}%)` }}
30
+ />
31
+ </ProgressPrimitive.Root>
32
+ )
33
+ }
34
+
35
+ export { Progress }
@@ -0,0 +1,49 @@
1
+ "use client"
2
+
3
+ /**
4
+ * Radio Group — Zabuti UI primitive.
5
+ *
6
+ * Radix RadioGroup + Tailwind over the `zabuti-ui.css` token layer. Zabuti-
7
+ * owned, no shadcn dependency; Radix is the behavioural base only.
8
+ */
9
+ import * as React from "react"
10
+ import { cn } from "cn"
11
+ import { RadioGroup as RadioGroupPrimitive } from "radix-ui"
12
+
13
+ function RadioGroup({
14
+ className,
15
+ ...props
16
+ }: React.ComponentProps<typeof RadioGroupPrimitive.Root>) {
17
+ return (
18
+ <RadioGroupPrimitive.Root
19
+ data-slot="radio-group"
20
+ className={cn("grid w-full gap-2", className)}
21
+ {...props}
22
+ />
23
+ )
24
+ }
25
+
26
+ function RadioGroupItem({
27
+ className,
28
+ ...props
29
+ }: React.ComponentProps<typeof RadioGroupPrimitive.Item>) {
30
+ return (
31
+ <RadioGroupPrimitive.Item
32
+ data-slot="radio-group-item"
33
+ className={cn(
34
+ "group/radio-group-item peer relative flex aspect-square size-4 shrink-0 rounded-full border border-input outline-none group-has-[:focus-visible]/field-label:ring-0 group-has-[:focus-visible]/field-label:not-data-checked:border-input after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground group-has-[:focus-visible]/field-label:data-checked:border-primary dark:data-checked:bg-primary",
35
+ className
36
+ )}
37
+ {...props}
38
+ >
39
+ <RadioGroupPrimitive.Indicator
40
+ data-slot="radio-group-indicator"
41
+ className="flex size-4 items-center justify-center"
42
+ >
43
+ <span className="absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2 rounded-full bg-primary-foreground" />
44
+ </RadioGroupPrimitive.Indicator>
45
+ </RadioGroupPrimitive.Item>
46
+ )
47
+ }
48
+
49
+ export { RadioGroup, RadioGroupItem }
@@ -0,0 +1,67 @@
1
+ "use client"
2
+
3
+ /**
4
+ * Scroll Area — Zabuti UI primitive.
5
+ *
6
+ * Radix ScrollArea + Tailwind over the `zabuti-ui.css` token layer. Zabuti-
7
+ * owned, no shadcn dependency; Radix is the behavioural base only.
8
+ *
9
+ * Local surface: `orientation="both"` renders both scrollbars — Grid Reports
10
+ * depends on this (a stock shadcn scroll-area ships vertical-only).
11
+ */
12
+ import * as React from "react"
13
+ import { cn } from "cn"
14
+ import { ScrollArea as ScrollAreaPrimitive } from "radix-ui"
15
+
16
+ function ScrollArea({
17
+ className,
18
+ children,
19
+ orientation = "vertical",
20
+ ...props
21
+ }: React.ComponentProps<typeof ScrollAreaPrimitive.Root> & {
22
+ orientation?: "vertical" | "horizontal" | "both"
23
+ }) {
24
+ return (
25
+ <ScrollAreaPrimitive.Root
26
+ data-slot="scroll-area"
27
+ className={cn("relative", className)}
28
+ {...props}
29
+ >
30
+ <ScrollAreaPrimitive.Viewport
31
+ data-slot="scroll-area-viewport"
32
+ className="size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1"
33
+ >
34
+ {children}
35
+ </ScrollAreaPrimitive.Viewport>
36
+ {orientation !== "horizontal" && <ScrollBar orientation="vertical" />}
37
+ {orientation !== "vertical" && <ScrollBar orientation="horizontal" />}
38
+ <ScrollAreaPrimitive.Corner />
39
+ </ScrollAreaPrimitive.Root>
40
+ )
41
+ }
42
+
43
+ function ScrollBar({
44
+ className,
45
+ orientation = "vertical",
46
+ ...props
47
+ }: React.ComponentProps<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>) {
48
+ return (
49
+ <ScrollAreaPrimitive.ScrollAreaScrollbar
50
+ data-slot="scroll-area-scrollbar"
51
+ data-orientation={orientation}
52
+ orientation={orientation}
53
+ className={cn(
54
+ "flex touch-none p-px transition-colors select-none data-horizontal:h-2.5 data-horizontal:flex-col data-horizontal:border-t data-horizontal:border-t-transparent data-vertical:h-full data-vertical:w-2.5 data-vertical:border-l data-vertical:border-l-transparent",
55
+ className
56
+ )}
57
+ {...props}
58
+ >
59
+ <ScrollAreaPrimitive.ScrollAreaThumb
60
+ data-slot="scroll-area-thumb"
61
+ className="relative flex-1 rounded-full bg-border"
62
+ />
63
+ </ScrollAreaPrimitive.ScrollAreaScrollbar>
64
+ )
65
+ }
66
+
67
+ export { ScrollArea, ScrollBar }