@agents24/chat-react 0.4.0 → 0.5.1
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/README.md +92 -18
- package/compatibility.json +10 -10
- package/dist/chunk-SSUO4EPD.js +189 -0
- package/dist/chunk-SSUO4EPD.js.map +1 -0
- package/dist/chunk-ZCNHLFRB.js +108 -0
- package/dist/chunk-ZCNHLFRB.js.map +1 -0
- package/dist/index.cjs +112 -95
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +362 -68
- package/dist/index.js.map +1 -1
- package/dist/mcp-oauth.d.ts +13 -0
- package/dist/runtime/index.cjs +594 -0
- package/dist/runtime/index.cjs.map +1 -0
- package/dist/runtime/index.d.ts +2 -0
- package/dist/runtime/index.js +458 -0
- package/dist/runtime/index.js.map +1 -0
- package/dist/runtime/input-contract.d.ts +20 -0
- package/dist/runtime/use-agent-chat-runtime.d.ts +83 -0
- package/dist/scaffold/app.d.ts +30 -0
- package/dist/scaffold/components/chat/chat-composer.d.ts +21 -0
- package/dist/scaffold/components/chat/chat-message.d.ts +21 -0
- package/dist/scaffold/components/chat/chat-shell.d.ts +8 -0
- package/dist/scaffold/components/chat/collapsible-user-message.d.ts +3 -0
- package/dist/scaffold/components/chat/external-link-dialog.d.ts +2 -0
- package/dist/scaffold/components/chat/identity-control.d.ts +4 -0
- package/dist/scaffold/components/chat/message-parts.d.ts +12 -0
- package/dist/scaffold/components/chat/theme-menu.d.ts +1 -0
- package/dist/scaffold/components/chat/thread-sidebar.d.ts +16 -0
- package/dist/scaffold/components/chat/timeline-loading.d.ts +7 -0
- package/dist/scaffold/components/chat/turn-outline.d.ts +4 -0
- package/dist/scaffold/components/theme-provider.d.ts +20 -0
- package/dist/scaffold/components/ui/attachment.d.ts +24 -0
- package/dist/scaffold/components/ui/bubble.d.ts +17 -0
- package/dist/scaffold/components/ui/button-group.d.ts +11 -0
- package/dist/scaffold/components/ui/button.d.ts +10 -0
- package/dist/scaffold/components/ui/dialog.d.ts +17 -0
- package/dist/scaffold/components/ui/dropdown-menu.d.ts +29 -0
- package/dist/scaffold/components/ui/input.d.ts +3 -0
- package/dist/scaffold/components/ui/marker.d.ts +11 -0
- package/dist/scaffold/components/ui/message-scroller.d.ts +10 -0
- package/dist/scaffold/components/ui/message.d.ts +10 -0
- package/dist/scaffold/components/ui/popover.d.ts +6 -0
- package/dist/scaffold/components/ui/select.d.ts +8 -0
- package/dist/scaffold/components/ui/separator.d.ts +4 -0
- package/dist/scaffold/components/ui/sheet.d.ts +14 -0
- package/dist/scaffold/components/ui/sidebar.d.ts +69 -0
- package/dist/scaffold/components/ui/skeleton.d.ts +2 -0
- package/dist/scaffold/components/ui/textarea.d.ts +3 -0
- package/dist/scaffold/components/ui/tooltip.d.ts +15 -0
- package/dist/scaffold/hooks/use-mobile.d.ts +1 -0
- package/dist/scaffold/identity.d.ts +10 -0
- package/dist/scaffold/index.cjs +2270 -0
- package/dist/scaffold/index.cjs.map +1 -0
- package/dist/scaffold/index.d.ts +14 -0
- package/dist/scaffold/index.js +2244 -0
- package/dist/scaffold/index.js.map +1 -0
- package/dist/scaffold/lib/utils.d.ts +2 -0
- package/dist/styles.css +143 -298
- package/dist/types.d.ts +3 -13
- package/dist/ui/adapters.d.ts +1 -1
- package/dist/ui/agent-chat-actions.d.ts +12 -5
- package/dist/ui/agent-chat-composer.d.ts +2 -1
- package/dist/ui/agent-chat-context-compression-row.d.ts +5 -0
- package/dist/ui/agent-chat-context-status.d.ts +13 -0
- package/dist/ui/agent-chat-message.d.ts +7 -5
- package/dist/ui/agent-response-timeline.d.ts +29 -7
- package/dist/ui/ask-user-interaction-state.d.ts +20 -0
- package/dist/ui/ask-user-interaction.d.ts +8 -0
- package/dist/ui/index.cjs +1392 -272
- package/dist/ui/index.cjs.map +1 -1
- package/dist/ui/index.d.ts +5 -0
- package/dist/ui/index.js +2380 -65
- package/dist/ui/index.js.map +1 -1
- package/dist/ui/tool-sessions.d.ts +70 -0
- package/dist/ui/use-audio-recorder.d.ts +8 -0
- package/package.json +27 -12
- package/scaffold/components.json +25 -0
- package/scaffold/manifest.json +28 -0
- package/scaffold/src/app.tsx +71 -0
- package/scaffold/src/chat.css +54 -0
- package/scaffold/src/components/chat/chat-composer.tsx +237 -0
- package/scaffold/src/components/chat/chat-message.tsx +76 -0
- package/scaffold/src/components/chat/chat-shell.tsx +257 -0
- package/scaffold/src/components/chat/collapsible-user-message.tsx +37 -0
- package/scaffold/src/components/chat/external-link-dialog.tsx +48 -0
- package/scaffold/src/components/chat/identity-control.tsx +69 -0
- package/scaffold/src/components/chat/message-parts.tsx +83 -0
- package/scaffold/src/components/chat/theme-menu.tsx +79 -0
- package/scaffold/src/components/chat/thread-sidebar.tsx +114 -0
- package/scaffold/src/components/chat/timeline-loading.ts +17 -0
- package/scaffold/src/components/chat/turn-outline.tsx +73 -0
- package/scaffold/src/components/theme-provider.tsx +91 -0
- package/scaffold/src/components/ui/attachment.tsx +204 -0
- package/scaffold/src/components/ui/bubble.tsx +125 -0
- package/scaffold/src/components/ui/button-group.tsx +83 -0
- package/scaffold/src/components/ui/button.tsx +65 -0
- package/scaffold/src/components/ui/dialog.tsx +171 -0
- package/scaffold/src/components/ui/dropdown-menu.tsx +271 -0
- package/scaffold/src/components/ui/input.tsx +19 -0
- package/scaffold/src/components/ui/marker.tsx +69 -0
- package/scaffold/src/components/ui/message-scroller.tsx +129 -0
- package/scaffold/src/components/ui/message.tsx +92 -0
- package/scaffold/src/components/ui/popover.tsx +40 -0
- package/scaffold/src/components/ui/select.tsx +92 -0
- package/scaffold/src/components/ui/separator.tsx +28 -0
- package/scaffold/src/components/ui/sheet.tsx +150 -0
- package/scaffold/src/components/ui/sidebar.tsx +677 -0
- package/scaffold/src/components/ui/skeleton.tsx +13 -0
- package/scaffold/src/components/ui/textarea.tsx +18 -0
- package/scaffold/src/components/ui/tooltip.tsx +56 -0
- package/scaffold/src/hooks/use-mobile.ts +24 -0
- package/scaffold/src/identity.ts +17 -0
- package/scaffold/src/index.css +222 -0
- package/scaffold/src/index.tsx +39 -0
- package/scaffold/src/lib/utils.ts +6 -0
- package/scaffold/styles.css +3 -0
- package/dist/chunk-CHAU7FNW.js +0 -140
- package/dist/chunk-CHAU7FNW.js.map +0 -1
- package/dist/chunk-LI67M74F.js +0 -445
- package/dist/chunk-LI67M74F.js.map +0 -1
- package/dist/chunk-NLEOWTZG.js +0 -1327
- package/dist/chunk-NLEOWTZG.js.map +0 -1
- package/dist/renderers.d.ts +0 -10
- package/dist/templates/agent-chat-app.d.ts +0 -18
- package/dist/templates/agent-chat-layout.d.ts +0 -69
- package/dist/templates/agent-chat-shell.d.ts +0 -37
- package/dist/templates/index.cjs +0 -2476
- package/dist/templates/index.cjs.map +0 -1
- package/dist/templates/index.d.ts +0 -3
- package/dist/templates/index.js +0 -723
- package/dist/templates/index.js.map +0 -1
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import {
|
|
3
|
+
MessageScroller as MessageScrollerPrimitive,
|
|
4
|
+
useMessageScroller,
|
|
5
|
+
useMessageScrollerScrollable,
|
|
6
|
+
useMessageScrollerVisibility,
|
|
7
|
+
} from "@shadcn/react/message-scroller"
|
|
8
|
+
|
|
9
|
+
import { cn } from "../../lib/utils"
|
|
10
|
+
import { Button } from "./button"
|
|
11
|
+
import { ArrowDownIcon } from "lucide-react"
|
|
12
|
+
|
|
13
|
+
function MessageScrollerProvider(
|
|
14
|
+
props: React.ComponentProps<typeof MessageScrollerPrimitive.Provider>
|
|
15
|
+
) {
|
|
16
|
+
return <MessageScrollerPrimitive.Provider {...props} />
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function MessageScroller({
|
|
20
|
+
className,
|
|
21
|
+
...props
|
|
22
|
+
}: React.ComponentProps<typeof MessageScrollerPrimitive.Root>) {
|
|
23
|
+
return (
|
|
24
|
+
<MessageScrollerPrimitive.Root
|
|
25
|
+
data-slot="message-scroller"
|
|
26
|
+
className={cn(
|
|
27
|
+
"group/message-scroller relative flex size-full min-h-0 flex-col overflow-hidden",
|
|
28
|
+
className
|
|
29
|
+
)}
|
|
30
|
+
{...props}
|
|
31
|
+
/>
|
|
32
|
+
)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function MessageScrollerViewport({
|
|
36
|
+
className,
|
|
37
|
+
...props
|
|
38
|
+
}: React.ComponentProps<typeof MessageScrollerPrimitive.Viewport>) {
|
|
39
|
+
return (
|
|
40
|
+
<MessageScrollerPrimitive.Viewport
|
|
41
|
+
data-slot="message-scroller-viewport"
|
|
42
|
+
className={cn(
|
|
43
|
+
"size-full min-h-0 min-w-0 scroll-fade-b overflow-y-auto overscroll-contain contain-content [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",
|
|
44
|
+
className
|
|
45
|
+
)}
|
|
46
|
+
{...props}
|
|
47
|
+
/>
|
|
48
|
+
)
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function MessageScrollerContent({
|
|
52
|
+
className,
|
|
53
|
+
...props
|
|
54
|
+
}: React.ComponentProps<typeof MessageScrollerPrimitive.Content>) {
|
|
55
|
+
return (
|
|
56
|
+
<MessageScrollerPrimitive.Content
|
|
57
|
+
data-slot="message-scroller-content"
|
|
58
|
+
className={cn("flex h-max min-h-full flex-col gap-8", className)}
|
|
59
|
+
{...props}
|
|
60
|
+
/>
|
|
61
|
+
)
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function MessageScrollerItem({
|
|
65
|
+
className,
|
|
66
|
+
scrollAnchor = false,
|
|
67
|
+
...props
|
|
68
|
+
}: React.ComponentProps<typeof MessageScrollerPrimitive.Item>) {
|
|
69
|
+
return (
|
|
70
|
+
<MessageScrollerPrimitive.Item
|
|
71
|
+
data-slot="message-scroller-item"
|
|
72
|
+
scrollAnchor={scrollAnchor}
|
|
73
|
+
className={cn(
|
|
74
|
+
"min-w-0 shrink-0 [contain-intrinsic-size:auto_10rem] [content-visibility:auto]",
|
|
75
|
+
className
|
|
76
|
+
)}
|
|
77
|
+
{...props}
|
|
78
|
+
/>
|
|
79
|
+
)
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function MessageScrollerButton({
|
|
83
|
+
direction = "end",
|
|
84
|
+
className,
|
|
85
|
+
children,
|
|
86
|
+
render,
|
|
87
|
+
variant = "secondary",
|
|
88
|
+
size = "icon-sm",
|
|
89
|
+
...props
|
|
90
|
+
}: React.ComponentProps<typeof MessageScrollerPrimitive.Button> &
|
|
91
|
+
Pick<React.ComponentProps<typeof Button>, "variant" | "size">) {
|
|
92
|
+
return (
|
|
93
|
+
<MessageScrollerPrimitive.Button
|
|
94
|
+
data-slot="message-scroller-button"
|
|
95
|
+
data-direction={direction}
|
|
96
|
+
data-variant={variant}
|
|
97
|
+
data-size={size}
|
|
98
|
+
direction={direction}
|
|
99
|
+
className={cn(
|
|
100
|
+
"absolute inset-s-1/2 -translate-x-1/2 border-border bg-background text-foreground transition-[translate,scale,opacity] duration-200 hover:bg-muted hover:text-foreground data-[active=false]:pointer-events-none data-[active=false]:scale-95 data-[active=false]:opacity-0 data-[active=false]:duration-400 data-[active=false]:ease-[cubic-bezier(0.7,0,0.84,0)] data-[active=true]:translate-y-0 data-[active=true]:scale-100 data-[active=true]:opacity-100 data-[active=true]:ease-[cubic-bezier(0.23,1,0.32,1)] data-[direction=end]:bottom-4 data-[direction=end]:data-[active=false]:translate-y-full data-[direction=start]:top-4 data-[direction=start]:data-[active=false]:-translate-y-full rtl:translate-x-1/2 data-[direction=start]:[&_svg]:rotate-180",
|
|
101
|
+
className
|
|
102
|
+
)}
|
|
103
|
+
render={render ?? <Button variant={variant} size={size} />}
|
|
104
|
+
{...props}
|
|
105
|
+
>
|
|
106
|
+
{children ?? (
|
|
107
|
+
<>
|
|
108
|
+
<ArrowDownIcon
|
|
109
|
+
/>
|
|
110
|
+
<span className="sr-only">
|
|
111
|
+
{direction === "end" ? "Scroll to end" : "Scroll to start"}
|
|
112
|
+
</span>
|
|
113
|
+
</>
|
|
114
|
+
)}
|
|
115
|
+
</MessageScrollerPrimitive.Button>
|
|
116
|
+
)
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export {
|
|
120
|
+
MessageScrollerProvider,
|
|
121
|
+
MessageScroller,
|
|
122
|
+
MessageScrollerViewport,
|
|
123
|
+
MessageScrollerContent,
|
|
124
|
+
MessageScrollerItem,
|
|
125
|
+
MessageScrollerButton,
|
|
126
|
+
useMessageScroller,
|
|
127
|
+
useMessageScrollerScrollable,
|
|
128
|
+
useMessageScrollerVisibility,
|
|
129
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
|
|
3
|
+
import { cn } from "../../lib/utils"
|
|
4
|
+
|
|
5
|
+
function MessageGroup({ className, ...props }: React.ComponentProps<"div">) {
|
|
6
|
+
return (
|
|
7
|
+
<div
|
|
8
|
+
data-slot="message-group"
|
|
9
|
+
className={cn("flex min-w-0 flex-col gap-2", className)}
|
|
10
|
+
{...props}
|
|
11
|
+
/>
|
|
12
|
+
)
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function Message({
|
|
16
|
+
className,
|
|
17
|
+
align = "start",
|
|
18
|
+
...props
|
|
19
|
+
}: React.ComponentProps<"div"> & { align?: "start" | "end" }) {
|
|
20
|
+
return (
|
|
21
|
+
<div
|
|
22
|
+
data-slot="message"
|
|
23
|
+
data-align={align}
|
|
24
|
+
className={cn(
|
|
25
|
+
"group/message relative flex w-full min-w-0 gap-2 text-sm data-[align=end]:flex-row-reverse",
|
|
26
|
+
className
|
|
27
|
+
)}
|
|
28
|
+
{...props}
|
|
29
|
+
/>
|
|
30
|
+
)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function MessageAvatar({ className, ...props }: React.ComponentProps<"div">) {
|
|
34
|
+
return (
|
|
35
|
+
<div
|
|
36
|
+
data-slot="message-avatar"
|
|
37
|
+
className={cn(
|
|
38
|
+
"flex w-fit min-w-8 shrink-0 items-center justify-center self-end overflow-hidden rounded-full bg-muted group-has-data-[slot=message-footer]/message:-translate-y-8",
|
|
39
|
+
className
|
|
40
|
+
)}
|
|
41
|
+
{...props}
|
|
42
|
+
/>
|
|
43
|
+
)
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function MessageContent({ className, ...props }: React.ComponentProps<"div">) {
|
|
47
|
+
return (
|
|
48
|
+
<div
|
|
49
|
+
data-slot="message-content"
|
|
50
|
+
className={cn(
|
|
51
|
+
"flex w-full min-w-0 flex-col gap-2.5 wrap-break-word group-data-[align=end]/message:*:data-slot:self-end",
|
|
52
|
+
className
|
|
53
|
+
)}
|
|
54
|
+
{...props}
|
|
55
|
+
/>
|
|
56
|
+
)
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function MessageHeader({ className, ...props }: React.ComponentProps<"div">) {
|
|
60
|
+
return (
|
|
61
|
+
<div
|
|
62
|
+
data-slot="message-header"
|
|
63
|
+
className={cn(
|
|
64
|
+
"flex max-w-full min-w-0 items-center px-3.5 text-xs font-medium text-muted-foreground group-has-data-[variant=ghost]/message:px-0",
|
|
65
|
+
className
|
|
66
|
+
)}
|
|
67
|
+
{...props}
|
|
68
|
+
/>
|
|
69
|
+
)
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function MessageFooter({ className, ...props }: React.ComponentProps<"div">) {
|
|
73
|
+
return (
|
|
74
|
+
<div
|
|
75
|
+
data-slot="message-footer"
|
|
76
|
+
className={cn(
|
|
77
|
+
"flex max-w-full min-w-0 items-center px-3.5 text-xs font-medium text-muted-foreground group-has-data-[variant=ghost]/message:px-0 group-data-[align=end]/message:justify-end",
|
|
78
|
+
className
|
|
79
|
+
)}
|
|
80
|
+
{...props}
|
|
81
|
+
/>
|
|
82
|
+
)
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export {
|
|
86
|
+
MessageGroup,
|
|
87
|
+
Message,
|
|
88
|
+
MessageAvatar,
|
|
89
|
+
MessageContent,
|
|
90
|
+
MessageFooter,
|
|
91
|
+
MessageHeader,
|
|
92
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import { Popover as PopoverPrimitive } from "radix-ui"
|
|
3
|
+
|
|
4
|
+
import { cn } from "../../lib/utils"
|
|
5
|
+
import { useThemePortalContainer } from "../theme-provider"
|
|
6
|
+
|
|
7
|
+
function Popover(props: React.ComponentProps<typeof PopoverPrimitive.Root>) {
|
|
8
|
+
return <PopoverPrimitive.Root data-slot="popover" {...props} />
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function PopoverTrigger(
|
|
12
|
+
props: React.ComponentProps<typeof PopoverPrimitive.Trigger>,
|
|
13
|
+
) {
|
|
14
|
+
return <PopoverPrimitive.Trigger data-slot="popover-trigger" {...props} />
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function PopoverContent({
|
|
18
|
+
align = "start",
|
|
19
|
+
className,
|
|
20
|
+
sideOffset = 6,
|
|
21
|
+
...props
|
|
22
|
+
}: React.ComponentProps<typeof PopoverPrimitive.Content>) {
|
|
23
|
+
const container = useThemePortalContainer()
|
|
24
|
+
return (
|
|
25
|
+
<PopoverPrimitive.Portal container={container || undefined}>
|
|
26
|
+
<PopoverPrimitive.Content
|
|
27
|
+
align={align}
|
|
28
|
+
className={cn(
|
|
29
|
+
"z-50 w-80 rounded-2xl bg-popover p-4 text-popover-foreground shadow-lg ring-1 ring-foreground/10 outline-none",
|
|
30
|
+
className,
|
|
31
|
+
)}
|
|
32
|
+
data-slot="popover-content"
|
|
33
|
+
sideOffset={sideOffset}
|
|
34
|
+
{...props}
|
|
35
|
+
/>
|
|
36
|
+
</PopoverPrimitive.Portal>
|
|
37
|
+
)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export { Popover, PopoverContent, PopoverTrigger }
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { CheckIcon, ChevronDownIcon } from "lucide-react"
|
|
2
|
+
import * as React from "react"
|
|
3
|
+
import { Select as SelectPrimitive } from "radix-ui"
|
|
4
|
+
|
|
5
|
+
import { cn } from "../../lib/utils"
|
|
6
|
+
import { useThemePortalContainer } from "../theme-provider"
|
|
7
|
+
|
|
8
|
+
function Select(props: React.ComponentProps<typeof SelectPrimitive.Root>) {
|
|
9
|
+
return <SelectPrimitive.Root data-slot="select" {...props} />
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
function SelectValue(props: React.ComponentProps<typeof SelectPrimitive.Value>) {
|
|
13
|
+
return <SelectPrimitive.Value data-slot="select-value" {...props} />
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function SelectTrigger({
|
|
17
|
+
children,
|
|
18
|
+
className,
|
|
19
|
+
...props
|
|
20
|
+
}: React.ComponentProps<typeof SelectPrimitive.Trigger>) {
|
|
21
|
+
return (
|
|
22
|
+
<SelectPrimitive.Trigger
|
|
23
|
+
className={cn(
|
|
24
|
+
"flex h-8 w-full items-center justify-between gap-2 rounded-lg bg-transparent px-2.5 text-xs text-foreground outline-none transition-colors hover:bg-muted/50 focus-visible:bg-muted/50 disabled:cursor-not-allowed disabled:opacity-50 data-[placeholder]:text-muted-foreground [&>span]:min-w-0 [&>span]:truncate",
|
|
25
|
+
className,
|
|
26
|
+
)}
|
|
27
|
+
data-slot="select-trigger"
|
|
28
|
+
{...props}
|
|
29
|
+
>
|
|
30
|
+
{children}
|
|
31
|
+
<SelectPrimitive.Icon asChild>
|
|
32
|
+
<ChevronDownIcon className="size-3.5 shrink-0 text-muted-foreground" />
|
|
33
|
+
</SelectPrimitive.Icon>
|
|
34
|
+
</SelectPrimitive.Trigger>
|
|
35
|
+
)
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function SelectContent({
|
|
39
|
+
align = "start",
|
|
40
|
+
children,
|
|
41
|
+
className,
|
|
42
|
+
sideOffset = 4,
|
|
43
|
+
...props
|
|
44
|
+
}: React.ComponentProps<typeof SelectPrimitive.Content>) {
|
|
45
|
+
const container = useThemePortalContainer()
|
|
46
|
+
|
|
47
|
+
return (
|
|
48
|
+
<SelectPrimitive.Portal container={container || undefined}>
|
|
49
|
+
<SelectPrimitive.Content
|
|
50
|
+
align={align}
|
|
51
|
+
className={cn(
|
|
52
|
+
"z-50 max-h-64 min-w-[var(--radix-select-trigger-width)] overflow-hidden rounded-xl border border-border/50 bg-popover p-1 text-popover-foreground shadow-md data-[side=bottom]:animate-in data-[side=bottom]:fade-in-0 data-[side=bottom]:slide-in-from-top-1 data-[side=top]:animate-in data-[side=top]:fade-in-0 data-[side=top]:slide-in-from-bottom-1",
|
|
53
|
+
className,
|
|
54
|
+
)}
|
|
55
|
+
data-slot="select-content"
|
|
56
|
+
position="popper"
|
|
57
|
+
sideOffset={sideOffset}
|
|
58
|
+
{...props}
|
|
59
|
+
>
|
|
60
|
+
<SelectPrimitive.Viewport className="max-h-60 overflow-y-auto p-0.5">
|
|
61
|
+
{children}
|
|
62
|
+
</SelectPrimitive.Viewport>
|
|
63
|
+
</SelectPrimitive.Content>
|
|
64
|
+
</SelectPrimitive.Portal>
|
|
65
|
+
)
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function SelectItem({
|
|
69
|
+
children,
|
|
70
|
+
className,
|
|
71
|
+
...props
|
|
72
|
+
}: React.ComponentProps<typeof SelectPrimitive.Item>) {
|
|
73
|
+
return (
|
|
74
|
+
<SelectPrimitive.Item
|
|
75
|
+
className={cn(
|
|
76
|
+
"relative flex cursor-default select-none items-center rounded-lg py-1.5 pr-8 pl-2 text-sm outline-none data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
77
|
+
className,
|
|
78
|
+
)}
|
|
79
|
+
data-slot="select-item"
|
|
80
|
+
{...props}
|
|
81
|
+
>
|
|
82
|
+
<SelectPrimitive.ItemText className="min-w-0 truncate">{children}</SelectPrimitive.ItemText>
|
|
83
|
+
<span className="absolute right-2 flex size-3.5 items-center justify-center">
|
|
84
|
+
<SelectPrimitive.ItemIndicator>
|
|
85
|
+
<CheckIcon className="size-3.5" />
|
|
86
|
+
</SelectPrimitive.ItemIndicator>
|
|
87
|
+
</span>
|
|
88
|
+
</SelectPrimitive.Item>
|
|
89
|
+
)
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export { Select, SelectContent, SelectItem, SelectTrigger, SelectValue }
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import * as React from "react"
|
|
4
|
+
import { Separator as SeparatorPrimitive } from "radix-ui"
|
|
5
|
+
|
|
6
|
+
import { cn } from "../../lib/utils"
|
|
7
|
+
|
|
8
|
+
function Separator({
|
|
9
|
+
className,
|
|
10
|
+
orientation = "horizontal",
|
|
11
|
+
decorative = true,
|
|
12
|
+
...props
|
|
13
|
+
}: React.ComponentProps<typeof SeparatorPrimitive.Root>) {
|
|
14
|
+
return (
|
|
15
|
+
<SeparatorPrimitive.Root
|
|
16
|
+
data-slot="separator"
|
|
17
|
+
decorative={decorative}
|
|
18
|
+
orientation={orientation}
|
|
19
|
+
className={cn(
|
|
20
|
+
"shrink-0 bg-border data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch",
|
|
21
|
+
className
|
|
22
|
+
)}
|
|
23
|
+
{...props}
|
|
24
|
+
/>
|
|
25
|
+
)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export { Separator }
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import * as React from "react"
|
|
4
|
+
import { Dialog as SheetPrimitive } from "radix-ui"
|
|
5
|
+
|
|
6
|
+
import { cn } from "../../lib/utils"
|
|
7
|
+
import { Button } from "./button"
|
|
8
|
+
import { XIcon } from "lucide-react"
|
|
9
|
+
import { useThemePortalContainer } from "../theme-provider"
|
|
10
|
+
|
|
11
|
+
function Sheet({ ...props }: React.ComponentProps<typeof SheetPrimitive.Root>) {
|
|
12
|
+
return <SheetPrimitive.Root data-slot="sheet" {...props} />
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function SheetTrigger({
|
|
16
|
+
...props
|
|
17
|
+
}: React.ComponentProps<typeof SheetPrimitive.Trigger>) {
|
|
18
|
+
return <SheetPrimitive.Trigger data-slot="sheet-trigger" {...props} />
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function SheetClose({
|
|
22
|
+
...props
|
|
23
|
+
}: React.ComponentProps<typeof SheetPrimitive.Close>) {
|
|
24
|
+
return <SheetPrimitive.Close data-slot="sheet-close" {...props} />
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function SheetPortal({
|
|
28
|
+
container,
|
|
29
|
+
...props
|
|
30
|
+
}: React.ComponentProps<typeof SheetPrimitive.Portal>) {
|
|
31
|
+
const themeContainer = useThemePortalContainer()
|
|
32
|
+
return <SheetPrimitive.Portal container={container || themeContainer || undefined} data-slot="sheet-portal" {...props} />
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function SheetOverlay({
|
|
36
|
+
className,
|
|
37
|
+
...props
|
|
38
|
+
}: React.ComponentProps<typeof SheetPrimitive.Overlay>) {
|
|
39
|
+
return (
|
|
40
|
+
<SheetPrimitive.Overlay
|
|
41
|
+
data-slot="sheet-overlay"
|
|
42
|
+
className={cn(
|
|
43
|
+
"fixed inset-0 z-50 bg-black/30 duration-100 supports-backdrop-filter:backdrop-blur-sm data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0",
|
|
44
|
+
className
|
|
45
|
+
)}
|
|
46
|
+
{...props}
|
|
47
|
+
/>
|
|
48
|
+
)
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function SheetContent({
|
|
52
|
+
className,
|
|
53
|
+
children,
|
|
54
|
+
side = "right",
|
|
55
|
+
showCloseButton = true,
|
|
56
|
+
...props
|
|
57
|
+
}: React.ComponentProps<typeof SheetPrimitive.Content> & {
|
|
58
|
+
side?: "top" | "right" | "bottom" | "left"
|
|
59
|
+
showCloseButton?: boolean
|
|
60
|
+
}) {
|
|
61
|
+
return (
|
|
62
|
+
<SheetPortal>
|
|
63
|
+
<SheetOverlay />
|
|
64
|
+
<SheetPrimitive.Content
|
|
65
|
+
data-slot="sheet-content"
|
|
66
|
+
data-side={side}
|
|
67
|
+
className={cn(
|
|
68
|
+
"fixed z-50 flex flex-col bg-popover bg-clip-padding text-sm text-popover-foreground shadow-xl transition duration-200 ease-in-out data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t 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=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=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-[side=bottom]:data-open:slide-in-from-bottom-10 data-[side=left]:data-open:slide-in-from-left-10 data-[side=right]:data-open:slide-in-from-right-10 data-[side=top]:data-open:slide-in-from-top-10 data-closed:animate-out data-closed:fade-out-0 data-[side=bottom]:data-closed:slide-out-to-bottom-10 data-[side=left]:data-closed:slide-out-to-left-10 data-[side=right]:data-closed:slide-out-to-right-10 data-[side=top]:data-closed:slide-out-to-top-10",
|
|
69
|
+
className
|
|
70
|
+
)}
|
|
71
|
+
{...props}
|
|
72
|
+
>
|
|
73
|
+
{children}
|
|
74
|
+
{showCloseButton && (
|
|
75
|
+
<SheetPrimitive.Close data-slot="sheet-close" asChild>
|
|
76
|
+
<Button
|
|
77
|
+
variant="ghost"
|
|
78
|
+
className="absolute top-4 right-4 bg-secondary"
|
|
79
|
+
size="icon-sm"
|
|
80
|
+
>
|
|
81
|
+
<XIcon
|
|
82
|
+
/>
|
|
83
|
+
<span className="sr-only">Close</span>
|
|
84
|
+
</Button>
|
|
85
|
+
</SheetPrimitive.Close>
|
|
86
|
+
)}
|
|
87
|
+
</SheetPrimitive.Content>
|
|
88
|
+
</SheetPortal>
|
|
89
|
+
)
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function SheetHeader({ className, ...props }: React.ComponentProps<"div">) {
|
|
93
|
+
return (
|
|
94
|
+
<div
|
|
95
|
+
data-slot="sheet-header"
|
|
96
|
+
className={cn("flex flex-col gap-1.5 p-6", className)}
|
|
97
|
+
{...props}
|
|
98
|
+
/>
|
|
99
|
+
)
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
function SheetFooter({ className, ...props }: React.ComponentProps<"div">) {
|
|
103
|
+
return (
|
|
104
|
+
<div
|
|
105
|
+
data-slot="sheet-footer"
|
|
106
|
+
className={cn("mt-auto flex flex-col gap-2 p-6", className)}
|
|
107
|
+
{...props}
|
|
108
|
+
/>
|
|
109
|
+
)
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
function SheetTitle({
|
|
113
|
+
className,
|
|
114
|
+
...props
|
|
115
|
+
}: React.ComponentProps<typeof SheetPrimitive.Title>) {
|
|
116
|
+
return (
|
|
117
|
+
<SheetPrimitive.Title
|
|
118
|
+
data-slot="sheet-title"
|
|
119
|
+
className={cn(
|
|
120
|
+
"font-heading text-base font-medium text-foreground",
|
|
121
|
+
className
|
|
122
|
+
)}
|
|
123
|
+
{...props}
|
|
124
|
+
/>
|
|
125
|
+
)
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
function SheetDescription({
|
|
129
|
+
className,
|
|
130
|
+
...props
|
|
131
|
+
}: React.ComponentProps<typeof SheetPrimitive.Description>) {
|
|
132
|
+
return (
|
|
133
|
+
<SheetPrimitive.Description
|
|
134
|
+
data-slot="sheet-description"
|
|
135
|
+
className={cn("text-sm text-muted-foreground", className)}
|
|
136
|
+
{...props}
|
|
137
|
+
/>
|
|
138
|
+
)
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
export {
|
|
142
|
+
Sheet,
|
|
143
|
+
SheetTrigger,
|
|
144
|
+
SheetClose,
|
|
145
|
+
SheetContent,
|
|
146
|
+
SheetHeader,
|
|
147
|
+
SheetFooter,
|
|
148
|
+
SheetTitle,
|
|
149
|
+
SheetDescription,
|
|
150
|
+
}
|