@lark-apaas/coding-templates 0.1.5 → 0.1.7

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 (82) hide show
  1. package/package.json +1 -1
  2. package/template-vite-react/README.md +175 -0
  3. package/template-vite-react/client/index.html +2 -1
  4. package/template-vite-react/client/src/components/layout.tsx +0 -2
  5. package/template-vite-react/client/src/components/ui/README.md +134 -0
  6. package/template-vite-react/client/src/components/ui/accordion.tsx +22 -28
  7. package/template-vite-react/client/src/components/ui/alert-dialog.tsx +34 -64
  8. package/template-vite-react/client/src/components/ui/alert.tsx +10 -15
  9. package/template-vite-react/client/src/components/ui/aspect-ratio.tsx +5 -16
  10. package/template-vite-react/client/src/components/ui/avatar.tsx +11 -67
  11. package/template-vite-react/client/src/components/ui/badge.tsx +21 -31
  12. package/template-vite-react/client/src/components/ui/breadcrumb.tsx +23 -39
  13. package/template-vite-react/client/src/components/ui/button.tsx +36 -25
  14. package/template-vite-react/client/src/components/ui/calendar.tsx +37 -43
  15. package/template-vite-react/client/src/components/ui/card.tsx +73 -94
  16. package/template-vite-react/client/src/components/ui/carousel.tsx +7 -8
  17. package/template-vite-react/client/src/components/ui/chart.tsx +35 -49
  18. package/template-vite-react/client/src/components/ui/checkbox.tsx +10 -7
  19. package/template-vite-react/client/src/components/ui/collapsible.tsx +20 -6
  20. package/template-vite-react/client/src/components/ui/command.tsx +52 -40
  21. package/template-vite-react/client/src/components/ui/context-menu.tsx +170 -117
  22. package/template-vite-react/client/src/components/ui/dialog.tsx +37 -52
  23. package/template-vite-react/client/src/components/ui/drawer.tsx +12 -9
  24. package/template-vite-react/client/src/components/ui/dropdown-menu.tsx +194 -133
  25. package/template-vite-react/client/src/components/ui/hover-card.tsx +24 -29
  26. package/template-vite-react/client/src/components/ui/input-group.tsx +39 -29
  27. package/template-vite-react/client/src/components/ui/input-otp.tsx +7 -17
  28. package/template-vite-react/client/src/components/ui/input.tsx +4 -3
  29. package/template-vite-react/client/src/components/ui/label.tsx +9 -3
  30. package/template-vite-react/client/src/components/ui/menubar.tsx +160 -92
  31. package/template-vite-react/client/src/components/ui/navigation-menu.tsx +45 -45
  32. package/template-vite-react/client/src/components/ui/pagination.tsx +32 -35
  33. package/template-vite-react/client/src/components/ui/popover.tsx +20 -62
  34. package/template-vite-react/client/src/components/ui/progress.tsx +14 -64
  35. package/template-vite-react/client/src/components/ui/radio-group.tsx +20 -13
  36. package/template-vite-react/client/src/components/ui/resizable.tsx +18 -10
  37. package/template-vite-react/client/src/components/ui/scroll-area.tsx +13 -10
  38. package/template-vite-react/client/src/components/ui/select.tsx +122 -78
  39. package/template-vite-react/client/src/components/ui/separator.tsx +7 -4
  40. package/template-vite-react/client/src/components/ui/sheet.tsx +42 -41
  41. package/template-vite-react/client/src/components/ui/sidebar.tsx +162 -156
  42. package/template-vite-react/client/src/components/ui/skeleton.tsx +1 -1
  43. package/template-vite-react/client/src/components/ui/slider.tsx +52 -22
  44. package/template-vite-react/client/src/components/ui/sonner.tsx +44 -26
  45. package/template-vite-react/client/src/components/ui/switch.tsx +9 -8
  46. package/template-vite-react/client/src/components/ui/table.tsx +5 -5
  47. package/template-vite-react/client/src/components/ui/tabs.tsx +24 -38
  48. package/template-vite-react/client/src/components/ui/textarea.tsx +1 -1
  49. package/template-vite-react/client/src/components/ui/toggle-group.tsx +14 -20
  50. package/template-vite-react/client/src/components/ui/toggle.tsx +13 -10
  51. package/template-vite-react/client/src/components/ui/tooltip.tsx +30 -33
  52. package/template-vite-react/client/src/index.css +130 -0
  53. package/template-vite-react/client/src/main.tsx +1 -4
  54. package/template-vite-react/components.json +2 -6
  55. package/template-vite-react/eslint.config.js +11 -0
  56. package/template-vite-react/package.json +29 -2
  57. package/template-vite-react/client/src/components/header.tsx +0 -22
  58. package/template-vite-react/client/src/components/theme-provider.tsx +0 -45
  59. package/template-vite-react/client/src/components/ui/icons/file-ae-colorful-icon.tsx +0 -21
  60. package/template-vite-react/client/src/components/ui/icons/file-ai-colorful-icon.tsx +0 -36
  61. package/template-vite-react/client/src/components/ui/icons/file-android-colorful-icon.tsx +0 -33
  62. package/template-vite-react/client/src/components/ui/icons/file-audio-colorful-icon.tsx +0 -21
  63. package/template-vite-react/client/src/components/ui/icons/file-code-colorful-icon.tsx +0 -28
  64. package/template-vite-react/client/src/components/ui/icons/file-csv-colorful-icon.tsx +0 -21
  65. package/template-vite-react/client/src/components/ui/icons/file-eml-colorful-icon.tsx +0 -29
  66. package/template-vite-react/client/src/components/ui/icons/file-ios-colorful-icon.tsx +0 -25
  67. package/template-vite-react/client/src/components/ui/icons/file-keynote-colorful-icon.tsx +0 -29
  68. package/template-vite-react/client/src/components/ui/icons/file-pages-colorful-icon.tsx +0 -29
  69. package/template-vite-react/client/src/components/ui/icons/file-ps-colorful-icon.tsx +0 -21
  70. package/template-vite-react/client/src/components/ui/icons/file-sketch-colorful-icon.tsx +0 -21
  71. package/template-vite-react/client/src/components/ui/icons/file-slide-colorful-icon.tsx +0 -21
  72. package/template-vite-react/client/src/components/ui/icons/file-vcf-colorful-icon.tsx +0 -29
  73. package/template-vite-react/client/src/components/ui/icons/file-wiki-excel-colorful-icon.tsx +0 -23
  74. package/template-vite-react/client/src/components/ui/icons/file-wiki-image-colorful-icon.tsx +0 -27
  75. package/template-vite-react/client/src/components/ui/icons/file-wiki-pdf-colorful-icon.tsx +0 -20
  76. package/template-vite-react/client/src/components/ui/icons/file-wiki-ppt-colorful-icon.tsx +0 -21
  77. package/template-vite-react/client/src/components/ui/icons/file-wiki-text-colorful-icon.tsx +0 -12
  78. package/template-vite-react/client/src/components/ui/icons/file-wiki-unknown-colorful-icon.tsx +0 -14
  79. package/template-vite-react/client/src/components/ui/icons/file-wiki-video-colorful-icon.tsx +0 -23
  80. package/template-vite-react/client/src/components/ui/icons/file-wiki-word-colorful-icon.tsx +0 -38
  81. package/template-vite-react/client/src/components/ui/icons/file-wiki-zip-colorful-icon.tsx +0 -21
  82. package/template-vite-react/client/src/types/index.ts +0 -1
@@ -1,29 +1,44 @@
1
+ "use client"
2
+
1
3
  import * as React from "react"
2
- import { Select as SelectPrimitive } from "@base-ui/react/select"
4
+ import * as SelectPrimitive from "@radix-ui/react-select"
5
+ import { CheckIcon, ChevronDownIcon, ChevronUpIcon } from "lucide-react"
3
6
 
4
7
  import { cn } from "@/lib/utils"
5
- import { ChevronDownIcon, CheckIcon, ChevronUpIcon } from "lucide-react"
6
-
7
- const Select = SelectPrimitive.Root
8
+ const EMPTY_SENTINEL = "__dont__use__this__empty__value__"
8
9
 
9
- function SelectGroup({ className, ...props }: SelectPrimitive.Group.Props) {
10
+ function Select({
11
+ value,
12
+ defaultValue,
13
+ onValueChange,
14
+ ...props
15
+ }: React.ComponentProps<typeof SelectPrimitive.Root>) {
16
+ const mappedValue = value === "" ? EMPTY_SENTINEL : value
17
+ const mappedDefaultValue = defaultValue === "" ? EMPTY_SENTINEL : defaultValue
18
+ const handleChange = (val: string) => {
19
+ onValueChange?.(val === EMPTY_SENTINEL ? "" : val)
20
+ }
10
21
  return (
11
- <SelectPrimitive.Group
12
- data-slot="select-group"
13
- className={cn("scroll-my-1 p-1", className)}
22
+ <SelectPrimitive.Root
23
+ data-slot="select"
24
+ value={mappedValue}
25
+ defaultValue={mappedDefaultValue}
26
+ onValueChange={handleChange}
14
27
  {...props}
15
28
  />
16
29
  )
17
30
  }
18
31
 
19
- function SelectValue({ className, ...props }: SelectPrimitive.Value.Props) {
20
- return (
21
- <SelectPrimitive.Value
22
- data-slot="select-value"
23
- className={cn("flex flex-1 text-left", className)}
24
- {...props}
25
- />
26
- )
32
+ function SelectGroup({
33
+ ...props
34
+ }: React.ComponentProps<typeof SelectPrimitive.Group>) {
35
+ return <SelectPrimitive.Group data-slot="select-group" {...props} />
36
+ }
37
+
38
+ function SelectValue({
39
+ ...props
40
+ }: React.ComponentProps<typeof SelectPrimitive.Value>) {
41
+ return <SelectPrimitive.Value data-slot="select-value" {...props} />
27
42
  }
28
43
 
29
44
  function SelectTrigger({
@@ -31,7 +46,7 @@ function SelectTrigger({
31
46
  size = "default",
32
47
  children,
33
48
  ...props
34
- }: SelectPrimitive.Trigger.Props & {
49
+ }: React.ComponentProps<typeof SelectPrimitive.Trigger> & {
35
50
  size?: "sm" | "default"
36
51
  }) {
37
52
  return (
@@ -39,17 +54,21 @@ function SelectTrigger({
39
54
  data-slot="select-trigger"
40
55
  data-size={size}
41
56
  className={cn(
42
- "flex w-fit items-center justify-between gap-1.5 rounded-lg border border-input bg-transparent py-2 pr-2 pl-2.5 text-sm whitespace-nowrap transition-colors outline-none select-none 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 data-placeholder:text-muted-foreground 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 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
57
+ "border-input data-[placeholder]:text-muted-foreground data-[state=open]:border-ring [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/20 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap transition-[color,box-shadow] outline-none focus-visible:ring-[3px] enabled:hover:border-ring disabled:cursor-not-allowed disabled:opacity-50 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 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg]:transition-transform [&_svg]:duration-200 data-[state=open]:[&_svg]:rotate-180",
43
58
  className
44
59
  )}
45
60
  {...props}
46
61
  >
47
- {children}
48
- <SelectPrimitive.Icon
49
- render={
50
- <ChevronDownIcon className="pointer-events-none size-4 text-muted-foreground" />
51
- }
52
- />
62
+ {props.asChild ? (
63
+ children
64
+ ) : (
65
+ <>
66
+ {children}
67
+ <SelectPrimitive.Icon asChild>
68
+ <ChevronDownIcon className="h-4 w-4 opacity-50" />
69
+ </SelectPrimitive.Icon>
70
+ </>
71
+ )}
53
72
  </SelectPrimitive.Trigger>
54
73
  )
55
74
  }
@@ -57,38 +76,36 @@ function SelectTrigger({
57
76
  function SelectContent({
58
77
  className,
59
78
  children,
60
- side = "bottom",
61
- sideOffset = 4,
79
+ position = "popper",
62
80
  align = "center",
63
- alignOffset = 0,
64
- alignItemWithTrigger = true,
65
81
  ...props
66
- }: SelectPrimitive.Popup.Props &
67
- Pick<
68
- SelectPrimitive.Positioner.Props,
69
- "align" | "alignOffset" | "side" | "sideOffset" | "alignItemWithTrigger"
70
- >) {
82
+ }: React.ComponentProps<typeof SelectPrimitive.Content>) {
71
83
  return (
72
84
  <SelectPrimitive.Portal>
73
- <SelectPrimitive.Positioner
74
- side={side}
75
- sideOffset={sideOffset}
85
+ <SelectPrimitive.Content
86
+ data-slot="select-content"
87
+ className={cn(
88
+ "bg-popover text-popover-foreground 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 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 shadow-md",
89
+ position === "popper" &&
90
+ "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
91
+ className
92
+ )}
93
+ position={position}
76
94
  align={align}
77
- alignOffset={alignOffset}
78
- alignItemWithTrigger={alignItemWithTrigger}
79
- className="isolate z-50"
95
+ {...props}
80
96
  >
81
- <SelectPrimitive.Popup
82
- data-slot="select-content"
83
- data-align-trigger={alignItemWithTrigger}
84
- className={cn("relative isolate z-50 max-h-(--available-height) w-(--anchor-width) min-w-36 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[align-trigger=true]:animate-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-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", className )}
85
- {...props}
97
+ <SelectScrollUpButton />
98
+ <SelectPrimitive.Viewport
99
+ className={cn(
100
+ "p-1",
101
+ position === "popper" &&
102
+ "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"
103
+ )}
86
104
  >
87
- <SelectScrollUpButton />
88
- <SelectPrimitive.List>{children}</SelectPrimitive.List>
89
- <SelectScrollDownButton />
90
- </SelectPrimitive.Popup>
91
- </SelectPrimitive.Positioner>
105
+ {children}
106
+ </SelectPrimitive.Viewport>
107
+ <SelectScrollDownButton />
108
+ </SelectPrimitive.Content>
92
109
  </SelectPrimitive.Portal>
93
110
  )
94
111
  }
@@ -96,40 +113,69 @@ function SelectContent({
96
113
  function SelectLabel({
97
114
  className,
98
115
  ...props
99
- }: SelectPrimitive.GroupLabel.Props) {
116
+ }: React.ComponentProps<typeof SelectPrimitive.Label>) {
100
117
  return (
101
- <SelectPrimitive.GroupLabel
118
+ <SelectPrimitive.Label
102
119
  data-slot="select-label"
103
- className={cn("px-1.5 py-1 text-xs text-muted-foreground", className)}
120
+ className={cn("text-muted-foreground px-2 py-1.5 text-xs", className)}
104
121
  {...props}
105
122
  />
106
123
  )
107
124
  }
108
125
 
126
+ type SelectItemProps = Omit<
127
+ React.ComponentProps<typeof SelectPrimitive.Item>,
128
+ "value"
129
+ > & {
130
+ value: string
131
+ }
132
+
109
133
  function SelectItem({
110
134
  className,
111
135
  children,
136
+ disabled,
137
+ onClick,
138
+ onMouseDown,
139
+ onKeyDown,
140
+ onKeyUp,
141
+ onPointerDown,
142
+ value,
112
143
  ...props
113
- }: SelectPrimitive.Item.Props) {
144
+ }: SelectItemProps) {
114
145
  return (
115
146
  <SelectPrimitive.Item
116
147
  data-slot="select-item"
117
148
  className={cn(
118
- "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 focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]: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 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",
149
+ "focus:bg-accent focus:text-accent-foreground data-[state=checked]:text-primary data-[state=checked]:[&_svg:not([class*='text-'])]:text-primary 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 data-[disabled]:cursor-not-allowed 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",
119
150
  className
120
151
  )}
152
+ value={value === "" ? EMPTY_SENTINEL : value}
153
+ disabled={disabled}
154
+ onClick={(event) => {
155
+ if (disabled) {
156
+ event.preventDefault()
157
+ return
158
+ }
159
+ onClick?.(event)
160
+ }}
161
+ onMouseDown={disabled ? undefined : onMouseDown}
162
+ onKeyDown={disabled ? undefined : onKeyDown}
163
+ onKeyUp={disabled ? undefined : onKeyUp}
164
+ onPointerDown={(event) => {
165
+ if (disabled) {
166
+ event.preventDefault()
167
+ return
168
+ }
169
+ onPointerDown?.(event)
170
+ }}
121
171
  {...props}
122
172
  >
123
- <SelectPrimitive.ItemText className="flex flex-1 shrink-0 gap-2 whitespace-nowrap">
124
- {children}
125
- </SelectPrimitive.ItemText>
126
- <SelectPrimitive.ItemIndicator
127
- render={
128
- <span className="pointer-events-none absolute right-2 flex size-4 items-center justify-center" />
129
- }
130
- >
131
- <CheckIcon className="pointer-events-none" />
132
- </SelectPrimitive.ItemIndicator>
173
+ <span className="absolute right-2 flex size-3.5 items-center justify-center">
174
+ <SelectPrimitive.ItemIndicator>
175
+ <CheckIcon className="size-4" />
176
+ </SelectPrimitive.ItemIndicator>
177
+ </span>
178
+ <SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>
133
179
  </SelectPrimitive.Item>
134
180
  )
135
181
  }
@@ -137,11 +183,11 @@ function SelectItem({
137
183
  function SelectSeparator({
138
184
  className,
139
185
  ...props
140
- }: SelectPrimitive.Separator.Props) {
186
+ }: React.ComponentProps<typeof SelectPrimitive.Separator>) {
141
187
  return (
142
188
  <SelectPrimitive.Separator
143
189
  data-slot="select-separator"
144
- className={cn("pointer-events-none -mx-1 my-1 h-px bg-border", className)}
190
+ className={cn("bg-border pointer-events-none -mx-1 my-1 h-px", className)}
145
191
  {...props}
146
192
  />
147
193
  )
@@ -150,38 +196,36 @@ function SelectSeparator({
150
196
  function SelectScrollUpButton({
151
197
  className,
152
198
  ...props
153
- }: React.ComponentProps<typeof SelectPrimitive.ScrollUpArrow>) {
199
+ }: React.ComponentProps<typeof SelectPrimitive.ScrollUpButton>) {
154
200
  return (
155
- <SelectPrimitive.ScrollUpArrow
201
+ <SelectPrimitive.ScrollUpButton
156
202
  data-slot="select-scroll-up-button"
157
203
  className={cn(
158
- "top-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",
204
+ "flex cursor-default items-center justify-center py-1",
159
205
  className
160
206
  )}
161
207
  {...props}
162
208
  >
163
- <ChevronUpIcon
164
- />
165
- </SelectPrimitive.ScrollUpArrow>
209
+ <ChevronUpIcon className="size-4" />
210
+ </SelectPrimitive.ScrollUpButton>
166
211
  )
167
212
  }
168
213
 
169
214
  function SelectScrollDownButton({
170
215
  className,
171
216
  ...props
172
- }: React.ComponentProps<typeof SelectPrimitive.ScrollDownArrow>) {
217
+ }: React.ComponentProps<typeof SelectPrimitive.ScrollDownButton>) {
173
218
  return (
174
- <SelectPrimitive.ScrollDownArrow
219
+ <SelectPrimitive.ScrollDownButton
175
220
  data-slot="select-scroll-down-button"
176
221
  className={cn(
177
- "bottom-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",
222
+ "flex cursor-default items-center justify-center py-1",
178
223
  className
179
224
  )}
180
225
  {...props}
181
226
  >
182
- <ChevronDownIcon
183
- />
184
- </SelectPrimitive.ScrollDownArrow>
227
+ <ChevronDownIcon className="size-4" />
228
+ </SelectPrimitive.ScrollDownButton>
185
229
  )
186
230
  }
187
231
 
@@ -1,20 +1,23 @@
1
1
  "use client"
2
2
 
3
- import { Separator as SeparatorPrimitive } from "@base-ui/react/separator"
3
+ import * as React from "react"
4
+ import * as SeparatorPrimitive from "@radix-ui/react-separator"
4
5
 
5
6
  import { cn } from "@/lib/utils"
6
7
 
7
8
  function Separator({
8
9
  className,
9
10
  orientation = "horizontal",
11
+ decorative = true,
10
12
  ...props
11
- }: SeparatorPrimitive.Props) {
13
+ }: React.ComponentProps<typeof SeparatorPrimitive.Root>) {
12
14
  return (
13
- <SeparatorPrimitive
15
+ <SeparatorPrimitive.Root
14
16
  data-slot="separator"
17
+ decorative={decorative}
15
18
  orientation={orientation}
16
19
  className={cn(
17
- "shrink-0 bg-border data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch",
20
+ "bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",
18
21
  className
19
22
  )}
20
23
  {...props}
@@ -1,34 +1,42 @@
1
1
  "use client"
2
2
 
3
3
  import * as React from "react"
4
- import { Dialog as SheetPrimitive } from "@base-ui/react/dialog"
4
+ import * as SheetPrimitive from "@radix-ui/react-dialog"
5
+ import { XIcon } from "lucide-react"
5
6
 
6
7
  import { cn } from "@/lib/utils"
7
- import { Button } from "@/components/ui/button"
8
- import { XIcon } from "lucide-react"
9
8
 
10
- function Sheet({ ...props }: SheetPrimitive.Root.Props) {
9
+ function Sheet({ ...props }: React.ComponentProps<typeof SheetPrimitive.Root>) {
11
10
  return <SheetPrimitive.Root data-slot="sheet" {...props} />
12
11
  }
13
12
 
14
- function SheetTrigger({ ...props }: SheetPrimitive.Trigger.Props) {
13
+ function SheetTrigger({
14
+ ...props
15
+ }: React.ComponentProps<typeof SheetPrimitive.Trigger>) {
15
16
  return <SheetPrimitive.Trigger data-slot="sheet-trigger" {...props} />
16
17
  }
17
18
 
18
- function SheetClose({ ...props }: SheetPrimitive.Close.Props) {
19
+ function SheetClose({
20
+ ...props
21
+ }: React.ComponentProps<typeof SheetPrimitive.Close>) {
19
22
  return <SheetPrimitive.Close data-slot="sheet-close" {...props} />
20
23
  }
21
24
 
22
- function SheetPortal({ ...props }: SheetPrimitive.Portal.Props) {
25
+ function SheetPortal({
26
+ ...props
27
+ }: React.ComponentProps<typeof SheetPrimitive.Portal>) {
23
28
  return <SheetPrimitive.Portal data-slot="sheet-portal" {...props} />
24
29
  }
25
30
 
26
- function SheetOverlay({ className, ...props }: SheetPrimitive.Backdrop.Props) {
31
+ function SheetOverlay({
32
+ className,
33
+ ...props
34
+ }: React.ComponentProps<typeof SheetPrimitive.Overlay>) {
27
35
  return (
28
- <SheetPrimitive.Backdrop
36
+ <SheetPrimitive.Overlay
29
37
  data-slot="sheet-overlay"
30
38
  className={cn(
31
- "fixed inset-0 z-50 bg-black/10 transition-opacity duration-150 data-ending-style:opacity-0 data-starting-style:opacity-0 supports-backdrop-filter:backdrop-blur-xs",
39
+ "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",
32
40
  className
33
41
  )}
34
42
  {...props}
@@ -40,42 +48,35 @@ function SheetContent({
40
48
  className,
41
49
  children,
42
50
  side = "right",
43
- showCloseButton = true,
44
51
  ...props
45
- }: SheetPrimitive.Popup.Props & {
52
+ }: React.ComponentProps<typeof SheetPrimitive.Content> & {
46
53
  side?: "top" | "right" | "bottom" | "left"
47
- showCloseButton?: boolean
48
54
  }) {
49
55
  return (
50
56
  <SheetPortal>
51
57
  <SheetOverlay />
52
- <SheetPrimitive.Popup
58
+ <SheetPrimitive.Content
53
59
  data-slot="sheet-content"
54
- data-side={side}
55
60
  className={cn(
56
- "fixed z-50 flex flex-col gap-4 bg-popover bg-clip-padding text-sm text-popover-foreground shadow-lg transition duration-200 ease-in-out data-ending-style:opacity-0 data-starting-style:opacity-0 data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t data-[side=bottom]:data-ending-style:translate-y-[2.5rem] data-[side=bottom]:data-starting-style:translate-y-[2.5rem] data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-3/4 data-[side=left]:border-r data-[side=left]:data-ending-style:translate-x-[-2.5rem] data-[side=left]:data-starting-style:translate-x-[-2.5rem] data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:w-3/4 data-[side=right]:border-l data-[side=right]:data-ending-style:translate-x-[2.5rem] data-[side=right]:data-starting-style:translate-x-[2.5rem] data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=top]:data-ending-style:translate-y-[-2.5rem] data-[side=top]:data-starting-style:translate-y-[-2.5rem] data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm",
61
+ "bg-background data-[state=open]:animate-in data-[state=closed]:animate-out fixed z-50 flex flex-col gap-4 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500 p-6",
62
+ side === "right" &&
63
+ "data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm",
64
+ side === "left" &&
65
+ "data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left inset-y-0 left-0 h-full w-3/4 border-r sm:max-w-sm",
66
+ side === "top" &&
67
+ "data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top inset-x-0 top-0 h-auto border-b",
68
+ side === "bottom" &&
69
+ "data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom inset-x-0 bottom-0 h-auto border-t",
57
70
  className
58
71
  )}
59
72
  {...props}
60
73
  >
61
74
  {children}
62
- {showCloseButton && (
63
- <SheetPrimitive.Close
64
- data-slot="sheet-close"
65
- render={
66
- <Button
67
- variant="ghost"
68
- className="absolute top-3 right-3"
69
- size="icon-sm"
70
- />
71
- }
72
- >
73
- <XIcon
74
- />
75
- <span className="sr-only">Close</span>
76
- </SheetPrimitive.Close>
77
- )}
78
- </SheetPrimitive.Popup>
75
+ <SheetPrimitive.Close className="ring-offset-background focus:ring-ring data-[state=open]:bg-secondary absolute top-4 right-4 rounded-xs opacity-70 transition-opacity enabled:hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:cursor-not-allowed">
76
+ <XIcon className="size-4" />
77
+ <span className="sr-only">Close</span>
78
+ </SheetPrimitive.Close>
79
+ </SheetPrimitive.Content>
79
80
  </SheetPortal>
80
81
  )
81
82
  }
@@ -84,7 +85,7 @@ function SheetHeader({ className, ...props }: React.ComponentProps<"div">) {
84
85
  return (
85
86
  <div
86
87
  data-slot="sheet-header"
87
- className={cn("flex flex-col gap-0.5 p-4", className)}
88
+ className={cn("flex flex-col gap-1.5 p-4", className)}
88
89
  {...props}
89
90
  />
90
91
  )
@@ -100,14 +101,14 @@ function SheetFooter({ className, ...props }: React.ComponentProps<"div">) {
100
101
  )
101
102
  }
102
103
 
103
- function SheetTitle({ className, ...props }: SheetPrimitive.Title.Props) {
104
+ function SheetTitle({
105
+ className,
106
+ ...props
107
+ }: React.ComponentProps<typeof SheetPrimitive.Title>) {
104
108
  return (
105
109
  <SheetPrimitive.Title
106
110
  data-slot="sheet-title"
107
- className={cn(
108
- "text-base font-medium text-foreground",
109
- className
110
- )}
111
+ className={cn("text-foreground font-semibold", className)}
111
112
  {...props}
112
113
  />
113
114
  )
@@ -116,11 +117,11 @@ function SheetTitle({ className, ...props }: SheetPrimitive.Title.Props) {
116
117
  function SheetDescription({
117
118
  className,
118
119
  ...props
119
- }: SheetPrimitive.Description.Props) {
120
+ }: React.ComponentProps<typeof SheetPrimitive.Description>) {
120
121
  return (
121
122
  <SheetPrimitive.Description
122
123
  data-slot="sheet-description"
123
- className={cn("text-sm text-muted-foreground", className)}
124
+ className={cn("text-muted-foreground text-sm", className)}
124
125
  {...props}
125
126
  />
126
127
  )