@blips/ui 1.0.1 → 2.0.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 (59) hide show
  1. package/dist/index.cjs +3612 -2515
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.d.cts +329 -484
  4. package/dist/index.d.ts +329 -484
  5. package/dist/index.js +3602 -2513
  6. package/dist/index.js.map +1 -1
  7. package/package.json +14 -12
  8. package/src/components/accordion.tsx +56 -46
  9. package/src/components/alert-dialog.tsx +166 -109
  10. package/src/components/alert.tsx +45 -38
  11. package/src/components/aspect-ratio.tsx +7 -1
  12. package/src/components/avatar.tsx +104 -45
  13. package/src/components/badge.tsx +25 -13
  14. package/src/components/breadcrumb.tsx +76 -82
  15. package/src/components/button-group.tsx +2 -2
  16. package/src/components/button.tsx +36 -28
  17. package/src/components/calendar.tsx +35 -28
  18. package/src/components/card.tsx +83 -70
  19. package/src/components/carousel.tsx +118 -137
  20. package/src/components/chart.tsx +197 -208
  21. package/src/components/checkbox.tsx +25 -21
  22. package/src/components/collapsible.tsx +25 -3
  23. package/src/components/command.tsx +138 -105
  24. package/src/components/context-menu.tsx +215 -161
  25. package/src/components/dialog.tsx +127 -91
  26. package/src/components/drawer.tsx +102 -83
  27. package/src/components/dropdown-menu.tsx +227 -170
  28. package/src/components/form.tsx +41 -52
  29. package/src/components/hover-card.tsx +36 -19
  30. package/src/components/input-group.tsx +4 -4
  31. package/src/components/input-otp.tsx +51 -43
  32. package/src/components/input.tsx +16 -17
  33. package/src/components/kbd.tsx +1 -1
  34. package/src/components/label.tsx +16 -18
  35. package/src/components/menubar.tsx +214 -192
  36. package/src/components/navigation-menu.tsx +140 -98
  37. package/src/components/pagination.tsx +97 -87
  38. package/src/components/popover.tsx +83 -23
  39. package/src/components/progress.tsx +23 -20
  40. package/src/components/radio-group.tsx +23 -20
  41. package/src/components/resizable.tsx +39 -31
  42. package/src/components/scroll-area.tsx +51 -39
  43. package/src/components/select.tsx +161 -131
  44. package/src/components/separator.tsx +13 -14
  45. package/src/components/sheet.tsx +112 -109
  46. package/src/components/sidebar.tsx +422 -470
  47. package/src/components/skeleton.tsx +4 -6
  48. package/src/components/slider.tsx +57 -20
  49. package/src/components/sonner.tsx +19 -24
  50. package/src/components/spinner.tsx +3 -3
  51. package/src/components/switch.tsx +28 -20
  52. package/src/components/table.tsx +94 -95
  53. package/src/components/tabs.tsx +88 -50
  54. package/src/components/textarea.tsx +5 -9
  55. package/src/components/toggle-group.tsx +52 -30
  56. package/src/components/toggle.tsx +24 -20
  57. package/src/components/tooltip.tsx +46 -19
  58. package/src/globals.css +213 -96
  59. package/src/index.ts +27 -6
@@ -1,42 +1,45 @@
1
+ "use client"
2
+
1
3
  import * as React from "react"
4
+ import { Circle } from "@phosphor-icons/react"
2
5
  import * as RadioGroupPrimitive from "@radix-ui/react-radio-group"
3
- import { Circle } from "lucide-react"
4
6
 
5
- import { cn } from "@/lib/utils"
7
+ import { cn } from "../lib/utils"
6
8
 
7
- const RadioGroup = React.forwardRef<
8
- React.ElementRef<typeof RadioGroupPrimitive.Root>,
9
- React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Root>
10
- >(({ className, ...props }, ref) => {
9
+ function RadioGroup({
10
+ className,
11
+ ...props
12
+ }: React.ComponentProps<typeof RadioGroupPrimitive.Root>) {
11
13
  return (
12
14
  <RadioGroupPrimitive.Root
13
- className={cn("grid gap-2", className)}
15
+ data-slot="radio-group"
16
+ className={cn("grid gap-3", className)}
14
17
  {...props}
15
- ref={ref}
16
18
  />
17
19
  )
18
- })
19
- RadioGroup.displayName = RadioGroupPrimitive.Root.displayName
20
+ }
20
21
 
21
- const RadioGroupItem = React.forwardRef<
22
- React.ElementRef<typeof RadioGroupPrimitive.Item>,
23
- React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Item>
24
- >(({ className, ...props }, ref) => {
22
+ function RadioGroupItem({
23
+ className,
24
+ ...props
25
+ }: React.ComponentProps<typeof RadioGroupPrimitive.Item>) {
25
26
  return (
26
27
  <RadioGroupPrimitive.Item
27
- ref={ref}
28
+ data-slot="radio-group-item"
28
29
  className={cn(
29
- "aspect-square h-4 w-4 rounded-full border border-primary text-primary ring-offset-background focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
30
+ "aspect-square size-4 shrink-0 rounded-full border border-input text-primary shadow-xs transition-[color,box-shadow] outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:bg-input/30 dark:aria-invalid:ring-destructive/40",
30
31
  className
31
32
  )}
32
33
  {...props}
33
34
  >
34
- <RadioGroupPrimitive.Indicator className="flex items-center justify-center">
35
- <Circle className="h-2.5 w-2.5 fill-current text-current" />
35
+ <RadioGroupPrimitive.Indicator
36
+ data-slot="radio-group-indicator"
37
+ className="relative flex items-center justify-center"
38
+ >
39
+ <Circle className="absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2 fill-primary" />
36
40
  </RadioGroupPrimitive.Indicator>
37
41
  </RadioGroupPrimitive.Item>
38
42
  )
39
- })
40
- RadioGroupItem.displayName = RadioGroupPrimitive.Item.displayName
43
+ }
41
44
 
42
45
  export { RadioGroup, RadioGroupItem }
@@ -1,45 +1,53 @@
1
1
  "use client"
2
2
 
3
- import { GripVertical } from "lucide-react"
3
+ import { DotsSixVertical } from "@phosphor-icons/react"
4
4
  import * as ResizablePrimitive from "react-resizable-panels"
5
5
 
6
- import { cn } from "@/lib/utils"
6
+ import { cn } from "../lib/utils"
7
7
 
8
- const ResizablePanelGroup = ({
8
+ function ResizablePanelGroup({
9
9
  className,
10
10
  ...props
11
- }: React.ComponentProps<typeof ResizablePrimitive.Group>) => (
12
- <ResizablePrimitive.Group
13
- className={cn(
14
- "flex h-full w-full data-[panel-group-direction=vertical]:flex-col",
15
- className
16
- )}
17
- {...props}
18
- />
19
- )
11
+ }: ResizablePrimitive.GroupProps) {
12
+ return (
13
+ <ResizablePrimitive.Group
14
+ data-slot="resizable-panel-group"
15
+ className={cn(
16
+ "flex h-full w-full aria-[orientation=vertical]:flex-col",
17
+ className
18
+ )}
19
+ {...props}
20
+ />
21
+ )
22
+ }
20
23
 
21
- const ResizablePanel = ResizablePrimitive.Panel
24
+ function ResizablePanel({ ...props }: ResizablePrimitive.PanelProps) {
25
+ return <ResizablePrimitive.Panel data-slot="resizable-panel" {...props} />
26
+ }
22
27
 
23
- const ResizableHandle = ({
28
+ function ResizableHandle({
24
29
  withHandle,
25
30
  className,
26
31
  ...props
27
- }: React.ComponentProps<typeof ResizablePrimitive.Separator> & {
32
+ }: ResizablePrimitive.SeparatorProps & {
28
33
  withHandle?: boolean
29
- }) => (
30
- <ResizablePrimitive.Separator
31
- className={cn(
32
- "relative flex w-px items-center justify-center bg-border after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1 data-[panel-group-direction=vertical]:h-px data-[panel-group-direction=vertical]:w-full data-[panel-group-direction=vertical]:after:left-0 data-[panel-group-direction=vertical]:after:h-1 data-[panel-group-direction=vertical]:after:w-full data-[panel-group-direction=vertical]:after:-translate-y-1/2 data-[panel-group-direction=vertical]:after:translate-x-0 [&[data-panel-group-direction=vertical]>div]:rotate-90",
33
- className
34
- )}
35
- {...props}
36
- >
37
- {withHandle && (
38
- <div className="z-10 flex h-4 w-3 items-center justify-center rounded-sm border bg-border">
39
- <GripVertical className="h-2.5 w-2.5" />
40
- </div>
41
- )}
42
- </ResizablePrimitive.Separator>
43
- )
34
+ }) {
35
+ return (
36
+ <ResizablePrimitive.Separator
37
+ data-slot="resizable-handle"
38
+ className={cn(
39
+ "relative flex w-px items-center justify-center bg-border after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:outline-hidden aria-[orientation=horizontal]:h-px aria-[orientation=horizontal]:w-full aria-[orientation=horizontal]:after:left-0 aria-[orientation=horizontal]:after:h-1 aria-[orientation=horizontal]:after:w-full aria-[orientation=horizontal]:after:translate-x-0 aria-[orientation=horizontal]:after:-translate-y-1/2 [&[aria-orientation=horizontal]>div]:rotate-90",
40
+ className
41
+ )}
42
+ {...props}
43
+ >
44
+ {withHandle && (
45
+ <div className="z-10 flex h-4 w-3 items-center justify-center rounded-xs border bg-border">
46
+ <DotsSixVertical className="size-2.5" />
47
+ </div>
48
+ )}
49
+ </ResizablePrimitive.Separator>
50
+ )
51
+ }
44
52
 
45
- export { ResizablePanelGroup, ResizablePanel, ResizableHandle }
53
+ export { ResizableHandle, ResizablePanel, ResizablePanelGroup }
@@ -1,46 +1,58 @@
1
+ "use client"
2
+
1
3
  import * as React from "react"
2
4
  import * as ScrollAreaPrimitive from "@radix-ui/react-scroll-area"
3
5
 
4
- import { cn } from "@/lib/utils"
6
+ import { cn } from "../lib/utils"
5
7
 
6
- const ScrollArea = React.forwardRef<
7
- React.ElementRef<typeof ScrollAreaPrimitive.Root>,
8
- React.ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.Root>
9
- >(({ className, children, ...props }, ref) => (
10
- <ScrollAreaPrimitive.Root
11
- ref={ref}
12
- className={cn("relative overflow-hidden", className)}
13
- {...props}
14
- >
15
- <ScrollAreaPrimitive.Viewport className="h-full w-full rounded-[inherit]">
16
- {children}
17
- </ScrollAreaPrimitive.Viewport>
18
- <ScrollBar />
19
- <ScrollAreaPrimitive.Corner />
20
- </ScrollAreaPrimitive.Root>
21
- ))
22
- ScrollArea.displayName = ScrollAreaPrimitive.Root.displayName
8
+ function ScrollArea({
9
+ className,
10
+ children,
11
+ ...props
12
+ }: React.ComponentProps<typeof ScrollAreaPrimitive.Root>) {
13
+ return (
14
+ <ScrollAreaPrimitive.Root
15
+ data-slot="scroll-area"
16
+ className={cn("relative", className)}
17
+ {...props}
18
+ >
19
+ <ScrollAreaPrimitive.Viewport
20
+ data-slot="scroll-area-viewport"
21
+ className="size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1"
22
+ >
23
+ {children}
24
+ </ScrollAreaPrimitive.Viewport>
25
+ <ScrollBar />
26
+ <ScrollAreaPrimitive.Corner />
27
+ </ScrollAreaPrimitive.Root>
28
+ )
29
+ }
23
30
 
24
- const ScrollBar = React.forwardRef<
25
- React.ElementRef<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>,
26
- React.ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>
27
- >(({ className, orientation = "vertical", ...props }, ref) => (
28
- <ScrollAreaPrimitive.ScrollAreaScrollbar
29
- ref={ref}
30
- orientation={orientation}
31
- className={cn(
32
- "flex touch-none select-none transition-colors",
33
- orientation === "vertical" &&
34
- "h-full w-2.5 border-l border-l-transparent p-[1px]",
35
- orientation === "horizontal" &&
36
- "h-2.5 flex-col border-t border-t-transparent p-[1px]",
37
- className
38
- )}
39
- {...props}
40
- >
41
- <ScrollAreaPrimitive.ScrollAreaThumb className="relative flex-1 rounded-full bg-border" />
42
- </ScrollAreaPrimitive.ScrollAreaScrollbar>
43
- ))
44
- ScrollBar.displayName = ScrollAreaPrimitive.ScrollAreaScrollbar.displayName
31
+ function ScrollBar({
32
+ className,
33
+ orientation = "vertical",
34
+ ...props
35
+ }: React.ComponentProps<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>) {
36
+ return (
37
+ <ScrollAreaPrimitive.ScrollAreaScrollbar
38
+ data-slot="scroll-area-scrollbar"
39
+ orientation={orientation}
40
+ className={cn(
41
+ "flex touch-none p-px transition-colors select-none",
42
+ orientation === "vertical" &&
43
+ "h-full w-2.5 border-l border-l-transparent",
44
+ orientation === "horizontal" &&
45
+ "h-2.5 flex-col border-t border-t-transparent",
46
+ className
47
+ )}
48
+ {...props}
49
+ >
50
+ <ScrollAreaPrimitive.ScrollAreaThumb
51
+ data-slot="scroll-area-thumb"
52
+ className="relative flex-1 rounded-full bg-border"
53
+ />
54
+ </ScrollAreaPrimitive.ScrollAreaScrollbar>
55
+ )
56
+ }
45
57
 
46
58
  export { ScrollArea, ScrollBar }
@@ -1,160 +1,190 @@
1
1
  "use client"
2
2
 
3
3
  import * as React from "react"
4
+ import { Check, CaretDown, CaretUp } from "@phosphor-icons/react"
4
5
  import * as SelectPrimitive from "@radix-ui/react-select"
5
- import { Check, ChevronDown, ChevronUp } from "lucide-react"
6
6
 
7
- import { cn } from "@/lib/utils"
7
+ import { cn } from "../lib/utils"
8
8
 
9
- const Select = SelectPrimitive.Root
10
-
11
- const SelectGroup = SelectPrimitive.Group
12
-
13
- const SelectValue = SelectPrimitive.Value
14
-
15
- const SelectTrigger = React.forwardRef<
16
- React.ElementRef<typeof SelectPrimitive.Trigger>,
17
- React.ComponentPropsWithoutRef<typeof SelectPrimitive.Trigger>
18
- >(({ className, children, ...props }, ref) => (
19
- <SelectPrimitive.Trigger
20
- ref={ref}
21
- className={cn(
22
- "flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background data-[placeholder]:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",
23
- className
24
- )}
25
- {...props}
26
- >
27
- {children}
28
- <SelectPrimitive.Icon asChild>
29
- <ChevronDown className="h-4 w-4 opacity-50" />
30
- </SelectPrimitive.Icon>
31
- </SelectPrimitive.Trigger>
32
- ))
33
- SelectTrigger.displayName = SelectPrimitive.Trigger.displayName
9
+ function Select({
10
+ ...props
11
+ }: React.ComponentProps<typeof SelectPrimitive.Root>) {
12
+ return <SelectPrimitive.Root data-slot="select" {...props} />
13
+ }
34
14
 
35
- const SelectScrollUpButton = React.forwardRef<
36
- React.ElementRef<typeof SelectPrimitive.ScrollUpButton>,
37
- React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollUpButton>
38
- >(({ className, ...props }, ref) => (
39
- <SelectPrimitive.ScrollUpButton
40
- ref={ref}
41
- className={cn(
42
- "flex cursor-default items-center justify-center py-1",
43
- className
44
- )}
45
- {...props}
46
- >
47
- <ChevronUp className="h-4 w-4" />
48
- </SelectPrimitive.ScrollUpButton>
49
- ))
50
- SelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName
15
+ function SelectGroup({
16
+ ...props
17
+ }: React.ComponentProps<typeof SelectPrimitive.Group>) {
18
+ return <SelectPrimitive.Group data-slot="select-group" {...props} />
19
+ }
51
20
 
52
- const SelectScrollDownButton = React.forwardRef<
53
- React.ElementRef<typeof SelectPrimitive.ScrollDownButton>,
54
- React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollDownButton>
55
- >(({ className, ...props }, ref) => (
56
- <SelectPrimitive.ScrollDownButton
57
- ref={ref}
58
- className={cn(
59
- "flex cursor-default items-center justify-center py-1",
60
- className
61
- )}
62
- {...props}
63
- >
64
- <ChevronDown className="h-4 w-4" />
65
- </SelectPrimitive.ScrollDownButton>
66
- ))
67
- SelectScrollDownButton.displayName =
68
- SelectPrimitive.ScrollDownButton.displayName
21
+ function SelectValue({
22
+ ...props
23
+ }: React.ComponentProps<typeof SelectPrimitive.Value>) {
24
+ return <SelectPrimitive.Value data-slot="select-value" {...props} />
25
+ }
69
26
 
70
- const SelectContent = React.forwardRef<
71
- React.ElementRef<typeof SelectPrimitive.Content>,
72
- React.ComponentPropsWithoutRef<typeof SelectPrimitive.Content>
73
- >(({ className, children, position = "popper", ...props }, ref) => (
74
- <SelectPrimitive.Portal>
75
- <SelectPrimitive.Content
76
- ref={ref}
27
+ function SelectTrigger({
28
+ className,
29
+ size = "default",
30
+ children,
31
+ ...props
32
+ }: React.ComponentProps<typeof SelectPrimitive.Trigger> & {
33
+ size?: "sm" | "default"
34
+ }) {
35
+ return (
36
+ <SelectPrimitive.Trigger
37
+ data-slot="select-trigger"
38
+ data-size={size}
77
39
  className={cn(
78
- "relative z-50 max-h-[--radix-select-content-available-height] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border bg-popover text-popover-foreground shadow-md 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 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 origin-[--radix-select-content-transform-origin]",
79
- position === "popper" &&
80
- "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
40
+ "flex w-fit items-center justify-between gap-2 rounded-md border border-input bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-[placeholder]:text-muted-foreground data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground",
81
41
  className
82
42
  )}
83
- position={position}
84
43
  {...props}
85
44
  >
86
- <SelectScrollUpButton />
87
- <SelectPrimitive.Viewport
45
+ {children}
46
+ <SelectPrimitive.Icon asChild>
47
+ <CaretDown className="size-4 opacity-50" />
48
+ </SelectPrimitive.Icon>
49
+ </SelectPrimitive.Trigger>
50
+ )
51
+ }
52
+
53
+ function SelectContent({
54
+ className,
55
+ children,
56
+ position = "item-aligned",
57
+ align = "center",
58
+ ...props
59
+ }: React.ComponentProps<typeof SelectPrimitive.Content>) {
60
+ return (
61
+ <SelectPrimitive.Portal>
62
+ <SelectPrimitive.Content
63
+ data-slot="select-content"
88
64
  className={cn(
89
- "p-1",
65
+ "relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border bg-popover text-popover-foreground shadow-md 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-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95",
90
66
  position === "popper" &&
91
- "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"
67
+ "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
68
+ className
92
69
  )}
70
+ position={position}
71
+ align={align}
72
+ {...props}
93
73
  >
94
- {children}
95
- </SelectPrimitive.Viewport>
96
- <SelectScrollDownButton />
97
- </SelectPrimitive.Content>
98
- </SelectPrimitive.Portal>
99
- ))
100
- SelectContent.displayName = SelectPrimitive.Content.displayName
74
+ <SelectScrollUpButton />
75
+ <SelectPrimitive.Viewport
76
+ className={cn(
77
+ "p-1",
78
+ position === "popper" &&
79
+ "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"
80
+ )}
81
+ >
82
+ {children}
83
+ </SelectPrimitive.Viewport>
84
+ <SelectScrollDownButton />
85
+ </SelectPrimitive.Content>
86
+ </SelectPrimitive.Portal>
87
+ )
88
+ }
101
89
 
102
- const SelectLabel = React.forwardRef<
103
- React.ElementRef<typeof SelectPrimitive.Label>,
104
- React.ComponentPropsWithoutRef<typeof SelectPrimitive.Label>
105
- >(({ className, ...props }, ref) => (
106
- <SelectPrimitive.Label
107
- ref={ref}
108
- className={cn("py-1.5 pl-8 pr-2 text-sm font-semibold", className)}
109
- {...props}
110
- />
111
- ))
112
- SelectLabel.displayName = SelectPrimitive.Label.displayName
90
+ function SelectLabel({
91
+ className,
92
+ ...props
93
+ }: React.ComponentProps<typeof SelectPrimitive.Label>) {
94
+ return (
95
+ <SelectPrimitive.Label
96
+ data-slot="select-label"
97
+ className={cn("px-2 py-1.5 text-xs text-muted-foreground", className)}
98
+ {...props}
99
+ />
100
+ )
101
+ }
113
102
 
114
- const SelectItem = React.forwardRef<
115
- React.ElementRef<typeof SelectPrimitive.Item>,
116
- React.ComponentPropsWithoutRef<typeof SelectPrimitive.Item>
117
- >(({ className, children, ...props }, ref) => (
118
- <SelectPrimitive.Item
119
- ref={ref}
120
- className={cn(
121
- "relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
122
- className
123
- )}
124
- {...props}
125
- >
126
- <span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
127
- <SelectPrimitive.ItemIndicator>
128
- <Check className="h-4 w-4" />
129
- </SelectPrimitive.ItemIndicator>
130
- </span>
103
+ function SelectItem({
104
+ className,
105
+ children,
106
+ ...props
107
+ }: React.ComponentProps<typeof SelectPrimitive.Item>) {
108
+ return (
109
+ <SelectPrimitive.Item
110
+ data-slot="select-item"
111
+ className={cn(
112
+ "relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",
113
+ className
114
+ )}
115
+ {...props}
116
+ >
117
+ <span
118
+ data-slot="select-item-indicator"
119
+ className="absolute right-2 flex size-3.5 items-center justify-center"
120
+ >
121
+ <SelectPrimitive.ItemIndicator>
122
+ <Check className="size-4" />
123
+ </SelectPrimitive.ItemIndicator>
124
+ </span>
125
+ <SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>
126
+ </SelectPrimitive.Item>
127
+ )
128
+ }
131
129
 
132
- <SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>
133
- </SelectPrimitive.Item>
134
- ))
135
- SelectItem.displayName = SelectPrimitive.Item.displayName
130
+ function SelectSeparator({
131
+ className,
132
+ ...props
133
+ }: React.ComponentProps<typeof SelectPrimitive.Separator>) {
134
+ return (
135
+ <SelectPrimitive.Separator
136
+ data-slot="select-separator"
137
+ className={cn("pointer-events-none -mx-1 my-1 h-px bg-border", className)}
138
+ {...props}
139
+ />
140
+ )
141
+ }
136
142
 
137
- const SelectSeparator = React.forwardRef<
138
- React.ElementRef<typeof SelectPrimitive.Separator>,
139
- React.ComponentPropsWithoutRef<typeof SelectPrimitive.Separator>
140
- >(({ className, ...props }, ref) => (
141
- <SelectPrimitive.Separator
142
- ref={ref}
143
- className={cn("-mx-1 my-1 h-px bg-muted", className)}
144
- {...props}
145
- />
146
- ))
147
- SelectSeparator.displayName = SelectPrimitive.Separator.displayName
143
+ function SelectScrollUpButton({
144
+ className,
145
+ ...props
146
+ }: React.ComponentProps<typeof SelectPrimitive.ScrollUpButton>) {
147
+ return (
148
+ <SelectPrimitive.ScrollUpButton
149
+ data-slot="select-scroll-up-button"
150
+ className={cn(
151
+ "flex cursor-default items-center justify-center py-1",
152
+ className
153
+ )}
154
+ {...props}
155
+ >
156
+ <CaretUp className="size-4" />
157
+ </SelectPrimitive.ScrollUpButton>
158
+ )
159
+ }
160
+
161
+ function SelectScrollDownButton({
162
+ className,
163
+ ...props
164
+ }: React.ComponentProps<typeof SelectPrimitive.ScrollDownButton>) {
165
+ return (
166
+ <SelectPrimitive.ScrollDownButton
167
+ data-slot="select-scroll-down-button"
168
+ className={cn(
169
+ "flex cursor-default items-center justify-center py-1",
170
+ className
171
+ )}
172
+ {...props}
173
+ >
174
+ <CaretDown className="size-4" />
175
+ </SelectPrimitive.ScrollDownButton>
176
+ )
177
+ }
148
178
 
149
179
  export {
150
180
  Select,
151
- SelectGroup,
152
- SelectValue,
153
- SelectTrigger,
154
181
  SelectContent,
155
- SelectLabel,
182
+ SelectGroup,
156
183
  SelectItem,
157
- SelectSeparator,
158
- SelectScrollUpButton,
184
+ SelectLabel,
159
185
  SelectScrollDownButton,
186
+ SelectScrollUpButton,
187
+ SelectSeparator,
188
+ SelectTrigger,
189
+ SelectValue,
160
190
  }
@@ -1,29 +1,28 @@
1
+ "use client"
2
+
1
3
  import * as React from "react"
2
4
  import * as SeparatorPrimitive from "@radix-ui/react-separator"
3
5
 
4
- import { cn } from "@/lib/utils"
6
+ import { cn } from "../lib/utils"
5
7
 
6
- const Separator = React.forwardRef<
7
- React.ElementRef<typeof SeparatorPrimitive.Root>,
8
- React.ComponentPropsWithoutRef<typeof SeparatorPrimitive.Root>
9
- >(
10
- (
11
- { className, orientation = "horizontal", decorative = true, ...props },
12
- ref
13
- ) => (
8
+ function Separator({
9
+ className,
10
+ orientation = "horizontal",
11
+ decorative = true,
12
+ ...props
13
+ }: React.ComponentProps<typeof SeparatorPrimitive.Root>) {
14
+ return (
14
15
  <SeparatorPrimitive.Root
15
- ref={ref}
16
+ data-slot="separator"
16
17
  decorative={decorative}
17
18
  orientation={orientation}
18
19
  className={cn(
19
- "shrink-0 bg-border",
20
- orientation === "horizontal" ? "h-[1px] w-full" : "h-full w-[1px]",
20
+ "shrink-0 bg-border data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",
21
21
  className
22
22
  )}
23
23
  {...props}
24
24
  />
25
25
  )
26
- )
27
- Separator.displayName = SeparatorPrimitive.Root.displayName
26
+ }
28
27
 
29
28
  export { Separator }