@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.
- package/package.json +1 -1
- package/template-vite-react/README.md +175 -0
- package/template-vite-react/client/index.html +2 -1
- package/template-vite-react/client/src/components/layout.tsx +0 -2
- package/template-vite-react/client/src/components/ui/README.md +134 -0
- package/template-vite-react/client/src/components/ui/accordion.tsx +22 -28
- package/template-vite-react/client/src/components/ui/alert-dialog.tsx +34 -64
- package/template-vite-react/client/src/components/ui/alert.tsx +10 -15
- package/template-vite-react/client/src/components/ui/aspect-ratio.tsx +5 -16
- package/template-vite-react/client/src/components/ui/avatar.tsx +11 -67
- package/template-vite-react/client/src/components/ui/badge.tsx +21 -31
- package/template-vite-react/client/src/components/ui/breadcrumb.tsx +23 -39
- package/template-vite-react/client/src/components/ui/button.tsx +36 -25
- package/template-vite-react/client/src/components/ui/calendar.tsx +37 -43
- package/template-vite-react/client/src/components/ui/card.tsx +73 -94
- package/template-vite-react/client/src/components/ui/carousel.tsx +7 -8
- package/template-vite-react/client/src/components/ui/chart.tsx +35 -49
- package/template-vite-react/client/src/components/ui/checkbox.tsx +10 -7
- package/template-vite-react/client/src/components/ui/collapsible.tsx +20 -6
- package/template-vite-react/client/src/components/ui/command.tsx +52 -40
- package/template-vite-react/client/src/components/ui/context-menu.tsx +170 -117
- package/template-vite-react/client/src/components/ui/dialog.tsx +37 -52
- package/template-vite-react/client/src/components/ui/drawer.tsx +12 -9
- package/template-vite-react/client/src/components/ui/dropdown-menu.tsx +194 -133
- package/template-vite-react/client/src/components/ui/hover-card.tsx +24 -29
- package/template-vite-react/client/src/components/ui/input-group.tsx +39 -29
- package/template-vite-react/client/src/components/ui/input-otp.tsx +7 -17
- package/template-vite-react/client/src/components/ui/input.tsx +4 -3
- package/template-vite-react/client/src/components/ui/label.tsx +9 -3
- package/template-vite-react/client/src/components/ui/menubar.tsx +160 -92
- package/template-vite-react/client/src/components/ui/navigation-menu.tsx +45 -45
- package/template-vite-react/client/src/components/ui/pagination.tsx +32 -35
- package/template-vite-react/client/src/components/ui/popover.tsx +20 -62
- package/template-vite-react/client/src/components/ui/progress.tsx +14 -64
- package/template-vite-react/client/src/components/ui/radio-group.tsx +20 -13
- package/template-vite-react/client/src/components/ui/resizable.tsx +18 -10
- package/template-vite-react/client/src/components/ui/scroll-area.tsx +13 -10
- package/template-vite-react/client/src/components/ui/select.tsx +122 -78
- package/template-vite-react/client/src/components/ui/separator.tsx +7 -4
- package/template-vite-react/client/src/components/ui/sheet.tsx +42 -41
- package/template-vite-react/client/src/components/ui/sidebar.tsx +162 -156
- package/template-vite-react/client/src/components/ui/skeleton.tsx +1 -1
- package/template-vite-react/client/src/components/ui/slider.tsx +52 -22
- package/template-vite-react/client/src/components/ui/sonner.tsx +44 -26
- package/template-vite-react/client/src/components/ui/switch.tsx +9 -8
- package/template-vite-react/client/src/components/ui/table.tsx +5 -5
- package/template-vite-react/client/src/components/ui/tabs.tsx +24 -38
- package/template-vite-react/client/src/components/ui/textarea.tsx +1 -1
- package/template-vite-react/client/src/components/ui/toggle-group.tsx +14 -20
- package/template-vite-react/client/src/components/ui/toggle.tsx +13 -10
- package/template-vite-react/client/src/components/ui/tooltip.tsx +30 -33
- package/template-vite-react/client/src/index.css +130 -0
- package/template-vite-react/client/src/main.tsx +1 -4
- package/template-vite-react/components.json +2 -6
- package/template-vite-react/eslint.config.js +11 -0
- package/template-vite-react/package.json +29 -2
- package/template-vite-react/client/src/components/header.tsx +0 -22
- package/template-vite-react/client/src/components/theme-provider.tsx +0 -45
- package/template-vite-react/client/src/components/ui/icons/file-ae-colorful-icon.tsx +0 -21
- package/template-vite-react/client/src/components/ui/icons/file-ai-colorful-icon.tsx +0 -36
- package/template-vite-react/client/src/components/ui/icons/file-android-colorful-icon.tsx +0 -33
- package/template-vite-react/client/src/components/ui/icons/file-audio-colorful-icon.tsx +0 -21
- package/template-vite-react/client/src/components/ui/icons/file-code-colorful-icon.tsx +0 -28
- package/template-vite-react/client/src/components/ui/icons/file-csv-colorful-icon.tsx +0 -21
- package/template-vite-react/client/src/components/ui/icons/file-eml-colorful-icon.tsx +0 -29
- package/template-vite-react/client/src/components/ui/icons/file-ios-colorful-icon.tsx +0 -25
- package/template-vite-react/client/src/components/ui/icons/file-keynote-colorful-icon.tsx +0 -29
- package/template-vite-react/client/src/components/ui/icons/file-pages-colorful-icon.tsx +0 -29
- package/template-vite-react/client/src/components/ui/icons/file-ps-colorful-icon.tsx +0 -21
- package/template-vite-react/client/src/components/ui/icons/file-sketch-colorful-icon.tsx +0 -21
- package/template-vite-react/client/src/components/ui/icons/file-slide-colorful-icon.tsx +0 -21
- package/template-vite-react/client/src/components/ui/icons/file-vcf-colorful-icon.tsx +0 -29
- package/template-vite-react/client/src/components/ui/icons/file-wiki-excel-colorful-icon.tsx +0 -23
- package/template-vite-react/client/src/components/ui/icons/file-wiki-image-colorful-icon.tsx +0 -27
- package/template-vite-react/client/src/components/ui/icons/file-wiki-pdf-colorful-icon.tsx +0 -20
- package/template-vite-react/client/src/components/ui/icons/file-wiki-ppt-colorful-icon.tsx +0 -21
- package/template-vite-react/client/src/components/ui/icons/file-wiki-text-colorful-icon.tsx +0 -12
- package/template-vite-react/client/src/components/ui/icons/file-wiki-unknown-colorful-icon.tsx +0 -14
- package/template-vite-react/client/src/components/ui/icons/file-wiki-video-colorful-icon.tsx +0 -23
- package/template-vite-react/client/src/components/ui/icons/file-wiki-word-colorful-icon.tsx +0 -38
- package/template-vite-react/client/src/components/ui/icons/file-wiki-zip-colorful-icon.tsx +0 -21
- 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
|
|
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
|
-
|
|
6
|
-
|
|
7
|
-
const Select = SelectPrimitive.Root
|
|
8
|
+
const EMPTY_SENTINEL = "__dont__use__this__empty__value__"
|
|
8
9
|
|
|
9
|
-
function
|
|
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.
|
|
12
|
-
data-slot="select
|
|
13
|
-
|
|
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
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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
|
|
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-
|
|
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
|
-
{
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
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
|
-
|
|
61
|
-
sideOffset = 4,
|
|
79
|
+
position = "popper",
|
|
62
80
|
align = "center",
|
|
63
|
-
alignOffset = 0,
|
|
64
|
-
alignItemWithTrigger = true,
|
|
65
81
|
...props
|
|
66
|
-
}: SelectPrimitive.
|
|
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.
|
|
74
|
-
|
|
75
|
-
|
|
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
|
-
|
|
78
|
-
alignItemWithTrigger={alignItemWithTrigger}
|
|
79
|
-
className="isolate z-50"
|
|
95
|
+
{...props}
|
|
80
96
|
>
|
|
81
|
-
<
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
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
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
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.
|
|
116
|
+
}: React.ComponentProps<typeof SelectPrimitive.Label>) {
|
|
100
117
|
return (
|
|
101
|
-
<SelectPrimitive.
|
|
118
|
+
<SelectPrimitive.Label
|
|
102
119
|
data-slot="select-label"
|
|
103
|
-
className={cn("px-
|
|
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
|
-
}:
|
|
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-
|
|
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
|
-
<
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
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
|
|
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
|
|
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.
|
|
199
|
+
}: React.ComponentProps<typeof SelectPrimitive.ScrollUpButton>) {
|
|
154
200
|
return (
|
|
155
|
-
<SelectPrimitive.
|
|
201
|
+
<SelectPrimitive.ScrollUpButton
|
|
156
202
|
data-slot="select-scroll-up-button"
|
|
157
203
|
className={cn(
|
|
158
|
-
"
|
|
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.
|
|
217
|
+
}: React.ComponentProps<typeof SelectPrimitive.ScrollDownButton>) {
|
|
173
218
|
return (
|
|
174
|
-
<SelectPrimitive.
|
|
219
|
+
<SelectPrimitive.ScrollDownButton
|
|
175
220
|
data-slot="select-scroll-down-button"
|
|
176
221
|
className={cn(
|
|
177
|
-
"
|
|
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
|
|
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.
|
|
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
|
|
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
|
|
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
|
|
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({
|
|
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({
|
|
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({
|
|
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({
|
|
31
|
+
function SheetOverlay({
|
|
32
|
+
className,
|
|
33
|
+
...props
|
|
34
|
+
}: React.ComponentProps<typeof SheetPrimitive.Overlay>) {
|
|
27
35
|
return (
|
|
28
|
-
<SheetPrimitive.
|
|
36
|
+
<SheetPrimitive.Overlay
|
|
29
37
|
data-slot="sheet-overlay"
|
|
30
38
|
className={cn(
|
|
31
|
-
"
|
|
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.
|
|
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.
|
|
58
|
+
<SheetPrimitive.Content
|
|
53
59
|
data-slot="sheet-content"
|
|
54
|
-
data-side={side}
|
|
55
60
|
className={cn(
|
|
56
|
-
"
|
|
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
|
-
|
|
63
|
-
<
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
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-
|
|
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({
|
|
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
|
|
120
|
+
}: React.ComponentProps<typeof SheetPrimitive.Description>) {
|
|
120
121
|
return (
|
|
121
122
|
<SheetPrimitive.Description
|
|
122
123
|
data-slot="sheet-description"
|
|
123
|
-
className={cn("text-
|
|
124
|
+
className={cn("text-muted-foreground text-sm", className)}
|
|
124
125
|
{...props}
|
|
125
126
|
/>
|
|
126
127
|
)
|