@allbluecn/admin-app 0.3.3 → 0.3.4
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/allblue-ui/package.json +6 -0
- package/allblue-ui/src/components/confirm-dialog.tsx +94 -0
- package/allblue-ui/src/components/infinite-scroll-sentinel.tsx +37 -0
- package/allblue-ui/src/components/notion-avatar.tsx +126 -0
- package/allblue-ui/src/components/user-avatar.tsx +82 -0
- package/allblue-ui/src/data-table/data-table-pagination.tsx +121 -0
- package/allblue-ui/src/data-table/data-table.tsx +218 -0
- package/allblue-ui/src/data-table/table-detail-layout.tsx +97 -0
- package/allblue-ui/src/hooks/use-load-more.ts +57 -0
- package/allblue-ui/src/hooks/use-mobile.ts +19 -0
- package/allblue-ui/src/index.ts +31 -0
- package/allblue-ui/src/lib/avatar.ts +41 -0
- package/allblue-ui/src/lib/datetime.ts +226 -0
- package/allblue-ui/src/lib/sanitize.ts +18 -0
- package/allblue-ui/src/lib/utils.ts +1 -0
- package/allblue-ui/src/ui/alert-dialog.tsx +185 -0
- package/allblue-ui/src/ui/alert.tsx +75 -0
- package/allblue-ui/src/ui/avatar.tsx +106 -0
- package/allblue-ui/src/ui/badge.tsx +51 -0
- package/allblue-ui/src/ui/button.tsx +57 -0
- package/allblue-ui/src/ui/card.tsx +102 -0
- package/allblue-ui/src/ui/checkbox.tsx +27 -0
- package/allblue-ui/src/ui/collapsible.tsx +19 -0
- package/allblue-ui/src/ui/dialog.tsx +155 -0
- package/allblue-ui/src/ui/dropdown-menu.tsx +265 -0
- package/allblue-ui/src/ui/field.tsx +236 -0
- package/allblue-ui/src/ui/input-group.tsx +157 -0
- package/allblue-ui/src/ui/input.tsx +19 -0
- package/allblue-ui/src/ui/label.tsx +17 -0
- package/allblue-ui/src/ui/pagination.tsx +130 -0
- package/allblue-ui/src/ui/select.tsx +232 -0
- package/allblue-ui/src/ui/separator.tsx +23 -0
- package/allblue-ui/src/ui/sheet.tsx +134 -0
- package/allblue-ui/src/ui/sidebar.tsx +721 -0
- package/allblue-ui/src/ui/skeleton.tsx +13 -0
- package/allblue-ui/src/ui/switch.tsx +30 -0
- package/allblue-ui/src/ui/table.tsx +113 -0
- package/allblue-ui/src/ui/textarea.tsx +17 -0
- package/allblue-ui/src/ui/toast.tsx +308 -0
- package/allblue-ui/src/ui/tooltip.tsx +64 -0
- package/package.json +3 -2
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import { cn } from "cn"
|
|
3
|
+
|
|
4
|
+
import { Button } from "./button"
|
|
5
|
+
import { ChevronLeftIcon, ChevronRightIcon, MoreHorizontalIcon } from "lucide-react"
|
|
6
|
+
|
|
7
|
+
function Pagination({ className, ...props }: React.ComponentProps<"nav">) {
|
|
8
|
+
return (
|
|
9
|
+
<nav
|
|
10
|
+
role="navigation"
|
|
11
|
+
aria-label="pagination"
|
|
12
|
+
data-slot="pagination"
|
|
13
|
+
className={cn("mx-auto flex w-full justify-center", className)}
|
|
14
|
+
{...props}
|
|
15
|
+
/>
|
|
16
|
+
)
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function PaginationContent({
|
|
20
|
+
className,
|
|
21
|
+
...props
|
|
22
|
+
}: React.ComponentProps<"ul">) {
|
|
23
|
+
return (
|
|
24
|
+
<ul
|
|
25
|
+
data-slot="pagination-content"
|
|
26
|
+
className={cn("flex items-center gap-1", className)}
|
|
27
|
+
{...props}
|
|
28
|
+
/>
|
|
29
|
+
)
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function PaginationItem({ ...props }: React.ComponentProps<"li">) {
|
|
33
|
+
return <li data-slot="pagination-item" {...props} />
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
type PaginationLinkProps = {
|
|
37
|
+
isActive?: boolean
|
|
38
|
+
} & Pick<React.ComponentProps<typeof Button>, "size"> &
|
|
39
|
+
React.ComponentProps<"a">
|
|
40
|
+
|
|
41
|
+
function PaginationLink({
|
|
42
|
+
className,
|
|
43
|
+
isActive,
|
|
44
|
+
size = "icon",
|
|
45
|
+
...props
|
|
46
|
+
}: PaginationLinkProps) {
|
|
47
|
+
return (
|
|
48
|
+
<Button
|
|
49
|
+
variant={isActive ? "outline" : "ghost"}
|
|
50
|
+
size={size}
|
|
51
|
+
className={cn(className)}
|
|
52
|
+
nativeButton={false}
|
|
53
|
+
render={
|
|
54
|
+
<a
|
|
55
|
+
aria-current={isActive ? "page" : undefined}
|
|
56
|
+
data-slot="pagination-link"
|
|
57
|
+
data-active={isActive}
|
|
58
|
+
{...props}
|
|
59
|
+
/>
|
|
60
|
+
}
|
|
61
|
+
/>
|
|
62
|
+
)
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function PaginationPrevious({
|
|
66
|
+
className,
|
|
67
|
+
text = "Previous",
|
|
68
|
+
...props
|
|
69
|
+
}: React.ComponentProps<typeof PaginationLink> & { text?: string }) {
|
|
70
|
+
return (
|
|
71
|
+
<PaginationLink
|
|
72
|
+
aria-label="Go to previous page"
|
|
73
|
+
size="default"
|
|
74
|
+
className={cn("pl-2!", className)}
|
|
75
|
+
{...props}
|
|
76
|
+
>
|
|
77
|
+
<ChevronLeftIcon data-icon="inline-start" />
|
|
78
|
+
<span className="hidden sm:block">{text}</span>
|
|
79
|
+
</PaginationLink>
|
|
80
|
+
)
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function PaginationNext({
|
|
84
|
+
className,
|
|
85
|
+
text = "Next",
|
|
86
|
+
...props
|
|
87
|
+
}: React.ComponentProps<typeof PaginationLink> & { text?: string }) {
|
|
88
|
+
return (
|
|
89
|
+
<PaginationLink
|
|
90
|
+
aria-label="Go to next page"
|
|
91
|
+
size="default"
|
|
92
|
+
className={cn("pr-2!", className)}
|
|
93
|
+
{...props}
|
|
94
|
+
>
|
|
95
|
+
<span className="hidden sm:block">{text}</span>
|
|
96
|
+
<ChevronRightIcon data-icon="inline-end" />
|
|
97
|
+
</PaginationLink>
|
|
98
|
+
)
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
function PaginationEllipsis({
|
|
102
|
+
className,
|
|
103
|
+
...props
|
|
104
|
+
}: React.ComponentProps<"span">) {
|
|
105
|
+
return (
|
|
106
|
+
<span
|
|
107
|
+
aria-hidden
|
|
108
|
+
data-slot="pagination-ellipsis"
|
|
109
|
+
className={cn(
|
|
110
|
+
"flex size-9 items-center justify-center [&_svg:not([class*='size-'])]:size-4",
|
|
111
|
+
className
|
|
112
|
+
)}
|
|
113
|
+
{...props}
|
|
114
|
+
>
|
|
115
|
+
<MoreHorizontalIcon
|
|
116
|
+
/>
|
|
117
|
+
<span className="sr-only">More pages</span>
|
|
118
|
+
</span>
|
|
119
|
+
)
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
export {
|
|
123
|
+
Pagination,
|
|
124
|
+
PaginationContent,
|
|
125
|
+
PaginationEllipsis,
|
|
126
|
+
PaginationItem,
|
|
127
|
+
PaginationLink,
|
|
128
|
+
PaginationNext,
|
|
129
|
+
PaginationPrevious,
|
|
130
|
+
}
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import { Select as SelectPrimitive } from "@base-ui/react/select"
|
|
3
|
+
import { cn } from "cn"
|
|
4
|
+
import { ChevronDownIcon, CheckIcon, ChevronUpIcon } from "lucide-react"
|
|
5
|
+
|
|
6
|
+
type CollectedItem = {
|
|
7
|
+
label: React.ReactNode
|
|
8
|
+
value: any
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function collectItems(children: React.ReactNode, acc: CollectedItem[] = []): CollectedItem[] {
|
|
12
|
+
React.Children.forEach(children, child => {
|
|
13
|
+
if (!React.isValidElement(child)) {
|
|
14
|
+
return
|
|
15
|
+
}
|
|
16
|
+
const el = child as React.ReactElement<any>
|
|
17
|
+
if (el.type === SelectItem) {
|
|
18
|
+
const { value, children: label } = el.props
|
|
19
|
+
if (value !== undefined) {
|
|
20
|
+
acc.push({ value, label })
|
|
21
|
+
}
|
|
22
|
+
return
|
|
23
|
+
}
|
|
24
|
+
if (el.props?.children) {
|
|
25
|
+
collectItems(el.props.children, acc)
|
|
26
|
+
}
|
|
27
|
+
})
|
|
28
|
+
return acc
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function Select<Value, Multiple extends boolean | undefined = false>(
|
|
32
|
+
{ children, items, ...props }: SelectPrimitive.Root.Props<Value, Multiple>
|
|
33
|
+
) {
|
|
34
|
+
const resolvedItems = React.useMemo(() => items ?? collectItems(children), [items, children])
|
|
35
|
+
return (
|
|
36
|
+
<SelectPrimitive.Root items={resolvedItems} {...props}>
|
|
37
|
+
{children}
|
|
38
|
+
</SelectPrimitive.Root>
|
|
39
|
+
)
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function SelectGroup({ className, ...props }: SelectPrimitive.Group.Props) {
|
|
43
|
+
return (
|
|
44
|
+
<SelectPrimitive.Group
|
|
45
|
+
data-slot="select-group"
|
|
46
|
+
className={cn("scroll-my-1 p-1", className)}
|
|
47
|
+
{...props}
|
|
48
|
+
/>
|
|
49
|
+
)
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function SelectValue({ className, ...props }: SelectPrimitive.Value.Props) {
|
|
53
|
+
return (
|
|
54
|
+
<SelectPrimitive.Value
|
|
55
|
+
data-slot="select-value"
|
|
56
|
+
className={cn("flex flex-1 text-left", className)}
|
|
57
|
+
{...props}
|
|
58
|
+
/>
|
|
59
|
+
)
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function SelectTrigger({
|
|
63
|
+
className,
|
|
64
|
+
size = "default",
|
|
65
|
+
children,
|
|
66
|
+
...props
|
|
67
|
+
}: SelectPrimitive.Trigger.Props & {
|
|
68
|
+
size?: "sm" | "default"
|
|
69
|
+
}) {
|
|
70
|
+
return (
|
|
71
|
+
<SelectPrimitive.Trigger
|
|
72
|
+
data-slot="select-trigger"
|
|
73
|
+
data-size={size}
|
|
74
|
+
className={cn(
|
|
75
|
+
"flex w-fit items-center justify-between gap-1.5 rounded-md border border-input bg-transparent py-2 pr-2 pl-2.5 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-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-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-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",
|
|
76
|
+
className
|
|
77
|
+
)}
|
|
78
|
+
{...props}
|
|
79
|
+
>
|
|
80
|
+
{children}
|
|
81
|
+
<SelectPrimitive.Icon
|
|
82
|
+
render={
|
|
83
|
+
<ChevronDownIcon className="pointer-events-none size-4 text-muted-foreground" />
|
|
84
|
+
}
|
|
85
|
+
/>
|
|
86
|
+
</SelectPrimitive.Trigger>
|
|
87
|
+
)
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
function SelectContent({
|
|
91
|
+
className,
|
|
92
|
+
children,
|
|
93
|
+
side = "bottom",
|
|
94
|
+
sideOffset = 4,
|
|
95
|
+
align = "center",
|
|
96
|
+
alignOffset = 0,
|
|
97
|
+
alignItemWithTrigger = true,
|
|
98
|
+
...props
|
|
99
|
+
}: SelectPrimitive.Popup.Props &
|
|
100
|
+
Pick<
|
|
101
|
+
SelectPrimitive.Positioner.Props,
|
|
102
|
+
"align" | "alignOffset" | "side" | "sideOffset" | "alignItemWithTrigger"
|
|
103
|
+
>) {
|
|
104
|
+
return (
|
|
105
|
+
<SelectPrimitive.Portal>
|
|
106
|
+
<SelectPrimitive.Positioner
|
|
107
|
+
side={side}
|
|
108
|
+
sideOffset={sideOffset}
|
|
109
|
+
align={align}
|
|
110
|
+
alignOffset={alignOffset}
|
|
111
|
+
alignItemWithTrigger={alignItemWithTrigger}
|
|
112
|
+
className="isolate z-50"
|
|
113
|
+
>
|
|
114
|
+
<SelectPrimitive.Popup
|
|
115
|
+
data-slot="select-content"
|
|
116
|
+
data-align-trigger={alignItemWithTrigger}
|
|
117
|
+
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-md 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 )}
|
|
118
|
+
{...props}
|
|
119
|
+
>
|
|
120
|
+
<SelectScrollUpButton />
|
|
121
|
+
<SelectPrimitive.List>{children}</SelectPrimitive.List>
|
|
122
|
+
<SelectScrollDownButton />
|
|
123
|
+
</SelectPrimitive.Popup>
|
|
124
|
+
</SelectPrimitive.Positioner>
|
|
125
|
+
</SelectPrimitive.Portal>
|
|
126
|
+
)
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
function SelectLabel({
|
|
130
|
+
className,
|
|
131
|
+
...props
|
|
132
|
+
}: SelectPrimitive.GroupLabel.Props) {
|
|
133
|
+
return (
|
|
134
|
+
<SelectPrimitive.GroupLabel
|
|
135
|
+
data-slot="select-label"
|
|
136
|
+
className={cn("px-2 py-1.5 text-xs text-muted-foreground", className)}
|
|
137
|
+
{...props}
|
|
138
|
+
/>
|
|
139
|
+
)
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
function SelectItem({
|
|
143
|
+
className,
|
|
144
|
+
children,
|
|
145
|
+
...props
|
|
146
|
+
}: SelectPrimitive.Item.Props) {
|
|
147
|
+
return (
|
|
148
|
+
<SelectPrimitive.Item
|
|
149
|
+
data-slot="select-item"
|
|
150
|
+
className={cn(
|
|
151
|
+
"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 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",
|
|
152
|
+
className
|
|
153
|
+
)}
|
|
154
|
+
{...props}
|
|
155
|
+
>
|
|
156
|
+
<SelectPrimitive.ItemText className="flex flex-1 shrink-0 gap-2 whitespace-nowrap">
|
|
157
|
+
{children}
|
|
158
|
+
</SelectPrimitive.ItemText>
|
|
159
|
+
<SelectPrimitive.ItemIndicator
|
|
160
|
+
render={
|
|
161
|
+
<span className="pointer-events-none absolute right-2 flex size-4 items-center justify-center" />
|
|
162
|
+
}
|
|
163
|
+
>
|
|
164
|
+
<CheckIcon className="pointer-events-none" />
|
|
165
|
+
</SelectPrimitive.ItemIndicator>
|
|
166
|
+
</SelectPrimitive.Item>
|
|
167
|
+
)
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
function SelectSeparator({
|
|
171
|
+
className,
|
|
172
|
+
...props
|
|
173
|
+
}: SelectPrimitive.Separator.Props) {
|
|
174
|
+
return (
|
|
175
|
+
<SelectPrimitive.Separator
|
|
176
|
+
data-slot="select-separator"
|
|
177
|
+
className={cn("pointer-events-none -mx-1 my-1 h-px bg-border", className)}
|
|
178
|
+
{...props}
|
|
179
|
+
/>
|
|
180
|
+
)
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
function SelectScrollUpButton({
|
|
184
|
+
className,
|
|
185
|
+
...props
|
|
186
|
+
}: React.ComponentProps<typeof SelectPrimitive.ScrollUpArrow>) {
|
|
187
|
+
return (
|
|
188
|
+
<SelectPrimitive.ScrollUpArrow
|
|
189
|
+
data-slot="select-scroll-up-button"
|
|
190
|
+
className={cn(
|
|
191
|
+
"top-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",
|
|
192
|
+
className
|
|
193
|
+
)}
|
|
194
|
+
{...props}
|
|
195
|
+
>
|
|
196
|
+
<ChevronUpIcon
|
|
197
|
+
/>
|
|
198
|
+
</SelectPrimitive.ScrollUpArrow>
|
|
199
|
+
)
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
function SelectScrollDownButton({
|
|
203
|
+
className,
|
|
204
|
+
...props
|
|
205
|
+
}: React.ComponentProps<typeof SelectPrimitive.ScrollDownArrow>) {
|
|
206
|
+
return (
|
|
207
|
+
<SelectPrimitive.ScrollDownArrow
|
|
208
|
+
data-slot="select-scroll-down-button"
|
|
209
|
+
className={cn(
|
|
210
|
+
"bottom-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",
|
|
211
|
+
className
|
|
212
|
+
)}
|
|
213
|
+
{...props}
|
|
214
|
+
>
|
|
215
|
+
<ChevronDownIcon
|
|
216
|
+
/>
|
|
217
|
+
</SelectPrimitive.ScrollDownArrow>
|
|
218
|
+
)
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
export {
|
|
222
|
+
Select,
|
|
223
|
+
SelectContent,
|
|
224
|
+
SelectGroup,
|
|
225
|
+
SelectItem,
|
|
226
|
+
SelectLabel,
|
|
227
|
+
SelectScrollDownButton,
|
|
228
|
+
SelectScrollUpButton,
|
|
229
|
+
SelectSeparator,
|
|
230
|
+
SelectTrigger,
|
|
231
|
+
SelectValue,
|
|
232
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
|
|
2
|
+
import { Separator as SeparatorPrimitive } from "@base-ui/react/separator"
|
|
3
|
+
import { cn } from "cn"
|
|
4
|
+
|
|
5
|
+
function Separator({
|
|
6
|
+
className,
|
|
7
|
+
orientation = "horizontal",
|
|
8
|
+
...props
|
|
9
|
+
}: SeparatorPrimitive.Props) {
|
|
10
|
+
return (
|
|
11
|
+
<SeparatorPrimitive
|
|
12
|
+
data-slot="separator"
|
|
13
|
+
orientation={orientation}
|
|
14
|
+
className={cn(
|
|
15
|
+
"shrink-0 bg-border data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch",
|
|
16
|
+
className
|
|
17
|
+
)}
|
|
18
|
+
{...props}
|
|
19
|
+
/>
|
|
20
|
+
)
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export { Separator }
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
|
|
2
|
+
import * as React from "react"
|
|
3
|
+
import { Dialog as SheetPrimitive } from "@base-ui/react/dialog"
|
|
4
|
+
import { cn } from "cn"
|
|
5
|
+
|
|
6
|
+
import { Button } from "./button"
|
|
7
|
+
import { XIcon } from "lucide-react"
|
|
8
|
+
|
|
9
|
+
function Sheet({ ...props }: SheetPrimitive.Root.Props) {
|
|
10
|
+
return <SheetPrimitive.Root data-slot="sheet" {...props} />
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function SheetTrigger({ ...props }: SheetPrimitive.Trigger.Props) {
|
|
14
|
+
return <SheetPrimitive.Trigger data-slot="sheet-trigger" {...props} />
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function SheetClose({ ...props }: SheetPrimitive.Close.Props) {
|
|
18
|
+
return <SheetPrimitive.Close data-slot="sheet-close" {...props} />
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function SheetPortal({ ...props }: SheetPrimitive.Portal.Props) {
|
|
22
|
+
return <SheetPrimitive.Portal data-slot="sheet-portal" {...props} />
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function SheetOverlay({ className, ...props }: SheetPrimitive.Backdrop.Props) {
|
|
26
|
+
return (
|
|
27
|
+
<SheetPrimitive.Backdrop
|
|
28
|
+
data-slot="sheet-overlay"
|
|
29
|
+
className={cn(
|
|
30
|
+
"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",
|
|
31
|
+
className
|
|
32
|
+
)}
|
|
33
|
+
{...props}
|
|
34
|
+
/>
|
|
35
|
+
)
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function SheetContent({
|
|
39
|
+
className,
|
|
40
|
+
children,
|
|
41
|
+
side = "right",
|
|
42
|
+
showCloseButton = true,
|
|
43
|
+
...props
|
|
44
|
+
}: SheetPrimitive.Popup.Props & {
|
|
45
|
+
side?: "top" | "right" | "bottom" | "left"
|
|
46
|
+
showCloseButton?: boolean
|
|
47
|
+
}) {
|
|
48
|
+
return (
|
|
49
|
+
<SheetPortal>
|
|
50
|
+
<SheetOverlay />
|
|
51
|
+
<SheetPrimitive.Popup
|
|
52
|
+
data-slot="sheet-content"
|
|
53
|
+
data-side={side}
|
|
54
|
+
className={cn(
|
|
55
|
+
"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",
|
|
56
|
+
className
|
|
57
|
+
)}
|
|
58
|
+
{...props}
|
|
59
|
+
>
|
|
60
|
+
{children}
|
|
61
|
+
{showCloseButton && (
|
|
62
|
+
<SheetPrimitive.Close
|
|
63
|
+
data-slot="sheet-close"
|
|
64
|
+
render={
|
|
65
|
+
<Button
|
|
66
|
+
variant="ghost"
|
|
67
|
+
className="absolute top-4 right-4"
|
|
68
|
+
size="icon-sm"
|
|
69
|
+
/>
|
|
70
|
+
}
|
|
71
|
+
>
|
|
72
|
+
<XIcon
|
|
73
|
+
/>
|
|
74
|
+
<span className="sr-only">Close</span>
|
|
75
|
+
</SheetPrimitive.Close>
|
|
76
|
+
)}
|
|
77
|
+
</SheetPrimitive.Popup>
|
|
78
|
+
</SheetPortal>
|
|
79
|
+
)
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function SheetHeader({ className, ...props }: React.ComponentProps<"div">) {
|
|
83
|
+
return (
|
|
84
|
+
<div
|
|
85
|
+
data-slot="sheet-header"
|
|
86
|
+
className={cn("flex flex-col gap-1.5 p-4", className)}
|
|
87
|
+
{...props}
|
|
88
|
+
/>
|
|
89
|
+
)
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function SheetFooter({ className, ...props }: React.ComponentProps<"div">) {
|
|
93
|
+
return (
|
|
94
|
+
<div
|
|
95
|
+
data-slot="sheet-footer"
|
|
96
|
+
className={cn("mt-auto flex flex-col gap-2 p-4", className)}
|
|
97
|
+
{...props}
|
|
98
|
+
/>
|
|
99
|
+
)
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
function SheetTitle({ className, ...props }: SheetPrimitive.Title.Props) {
|
|
103
|
+
return (
|
|
104
|
+
<SheetPrimitive.Title
|
|
105
|
+
data-slot="sheet-title"
|
|
106
|
+
className={cn("font-heading font-medium text-foreground", className)}
|
|
107
|
+
{...props}
|
|
108
|
+
/>
|
|
109
|
+
)
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
function SheetDescription({
|
|
113
|
+
className,
|
|
114
|
+
...props
|
|
115
|
+
}: SheetPrimitive.Description.Props) {
|
|
116
|
+
return (
|
|
117
|
+
<SheetPrimitive.Description
|
|
118
|
+
data-slot="sheet-description"
|
|
119
|
+
className={cn("text-sm text-muted-foreground", className)}
|
|
120
|
+
{...props}
|
|
121
|
+
/>
|
|
122
|
+
)
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
export {
|
|
126
|
+
Sheet,
|
|
127
|
+
SheetTrigger,
|
|
128
|
+
SheetClose,
|
|
129
|
+
SheetContent,
|
|
130
|
+
SheetHeader,
|
|
131
|
+
SheetFooter,
|
|
132
|
+
SheetTitle,
|
|
133
|
+
SheetDescription,
|
|
134
|
+
}
|