@betterstart/cli 0.1.28 → 0.1.30

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