@agent-native/toolkit 0.6.0 → 0.8.0
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 +17 -1
- package/agent-native.eject.json +411 -0
- package/dist/chat-history/ChatHistoryList.d.ts +103 -0
- package/dist/chat-history/ChatHistoryList.d.ts.map +1 -0
- package/dist/chat-history/ChatHistoryList.js +109 -0
- package/dist/chat-history/ChatHistoryList.js.map +1 -0
- package/dist/chat-history/ChatHistoryList.spec.d.ts +2 -0
- package/dist/chat-history/ChatHistoryList.spec.d.ts.map +1 -0
- package/dist/chat-history/ChatHistoryList.spec.js +283 -0
- package/dist/chat-history/ChatHistoryList.spec.js.map +1 -0
- package/dist/chat-history/index.d.ts +2 -0
- package/dist/chat-history/index.d.ts.map +1 -0
- package/dist/chat-history/index.js +2 -0
- package/dist/chat-history/index.js.map +1 -0
- package/dist/chat-history.css +314 -0
- package/package.json +20 -1
- package/src/app-shell/header-actions.tsx +84 -0
- package/src/app-shell/index.ts +1 -0
- package/src/chat-history/ChatHistoryList.spec.tsx +453 -0
- package/src/chat-history/ChatHistoryList.tsx +469 -0
- package/src/chat-history/index.ts +7 -0
- package/src/chat-history.css +314 -0
- package/src/collab-ui/AgentPresenceChip.tsx +69 -0
- package/src/collab-ui/LiveCursorOverlay.tsx +241 -0
- package/src/collab-ui/PresenceBar.tsx +346 -0
- package/src/collab-ui/RecentEditHighlights.tsx +225 -0
- package/src/collab-ui/RemoteSelectionRings.tsx +227 -0
- package/src/collab-ui/agent-identity.ts +16 -0
- package/src/collab-ui/index.ts +39 -0
- package/src/collab-ui/lead-client.ts +32 -0
- package/src/collab-ui/types.spec.ts +18 -0
- package/src/collab-ui/types.ts +96 -0
- package/src/composer/AgentComposerFrame.tsx +59 -0
- package/src/composer/ComposerPlusMenu.tsx +983 -0
- package/src/composer/MentionPopover.tsx +412 -0
- package/src/composer/PastedTextChip.tsx +150 -0
- package/src/composer/PromptComposer.spec.ts +73 -0
- package/src/composer/PromptComposer.tsx +718 -0
- package/src/composer/RealtimeVoiceMode.spec.tsx +771 -0
- package/src/composer/RealtimeVoiceMode.tsx +856 -0
- package/src/composer/TiptapComposer.spec.ts +390 -0
- package/src/composer/TiptapComposer.tsx +2936 -0
- package/src/composer/VoiceButton.spec.ts +33 -0
- package/src/composer/VoiceButton.tsx +255 -0
- package/src/composer/asset-picker-url.spec.ts +56 -0
- package/src/composer/asset-picker-url.ts +80 -0
- package/src/composer/attachment-accept.spec.ts +22 -0
- package/src/composer/attachment-accept.ts +71 -0
- package/src/composer/draft-key.spec.ts +19 -0
- package/src/composer/draft-key.ts +7 -0
- package/src/composer/extensions/FileReference.tsx +55 -0
- package/src/composer/extensions/MentionReference.tsx +93 -0
- package/src/composer/extensions/SkillReference.tsx +56 -0
- package/src/composer/index.ts +79 -0
- package/src/composer/pasted-text.spec.ts +162 -0
- package/src/composer/pasted-text.ts +160 -0
- package/src/composer/prompt-attachments.spec.ts +80 -0
- package/src/composer/prompt-attachments.ts +93 -0
- package/src/composer/realtime-voice-audio-level.spec.ts +32 -0
- package/src/composer/realtime-voice-audio-level.ts +64 -0
- package/src/composer/realtime-voice-transcript.spec.ts +95 -0
- package/src/composer/realtime-voice-transcript.ts +134 -0
- package/src/composer/runtime-adapters.tsx +343 -0
- package/src/composer/types.ts +66 -0
- package/src/composer/use-file-search.ts +64 -0
- package/src/composer/use-mention-search.ts +90 -0
- package/src/composer/use-skills.ts +45 -0
- package/src/composer/useRealtimeVoiceMode.spec.ts +818 -0
- package/src/composer/useRealtimeVoiceMode.tsx +2117 -0
- package/src/composer/useVoiceDictation.spec.ts +45 -0
- package/src/composer/useVoiceDictation.ts +1191 -0
- package/src/context-ui/ContextMeter.tsx +101 -0
- package/src/context-ui/ContextSegmentRow.tsx +184 -0
- package/src/context-ui/ContextTreemap.tsx +125 -0
- package/src/context-ui/ContextXRayPanel.tsx +377 -0
- package/src/context-ui/format.ts +42 -0
- package/src/context-ui/index.ts +15 -0
- package/src/context-ui/types.ts +43 -0
- package/src/design-tweaks/index.ts +1 -0
- package/src/design-tweaks/visual-style-controls.tsx +1084 -0
- package/src/editor/BubbleToolbar.tsx +253 -0
- package/src/editor/CodeBlockNode.tsx +254 -0
- package/src/editor/DragHandle.spec.ts +588 -0
- package/src/editor/DragHandle.ts +1437 -0
- package/src/editor/ImageExtension.roundtrip.spec.ts +117 -0
- package/src/editor/ImageExtension.ts +306 -0
- package/src/editor/RegistryBlockContext.tsx +107 -0
- package/src/editor/RegistryBlockNode.spec.ts +279 -0
- package/src/editor/RegistryBlockNode.tsx +652 -0
- package/src/editor/RichMarkdownEditor.collab.spec.ts +79 -0
- package/src/editor/RichMarkdownEditor.roundtrip.spec.ts +226 -0
- package/src/editor/RichMarkdownEditor.tsx +81 -0
- package/src/editor/RunId.ts +61 -0
- package/src/editor/SharedRichEditor.tsx +321 -0
- package/src/editor/SlashCommandMenu.tsx +310 -0
- package/src/editor/disableHistory.spec.ts +85 -0
- package/src/editor/extensions.ts +402 -0
- package/src/editor/gfmDoc.spec.ts +230 -0
- package/src/editor/gfmDoc.ts +92 -0
- package/src/editor/index.ts +93 -0
- package/src/editor/registrySlashCommands.ts +131 -0
- package/src/editor/structuralReorderUndo.spec.ts +144 -0
- package/src/editor/surgical-apply.spec.ts +279 -0
- package/src/editor/surgical-apply.ts +192 -0
- package/src/editor/useCollabReconcile.concurrent.spec.ts +422 -0
- package/src/editor/useCollabReconcile.idempotent.spec.ts +324 -0
- package/src/editor/useCollabReconcile.ts +589 -0
- package/src/editor.css +510 -0
- package/src/hooks/index.ts +2 -0
- package/src/hooks/use-mobile.tsx +21 -0
- package/src/hooks/use-toast.ts +188 -0
- package/src/index.ts +8 -0
- package/src/onboarding/index.ts +1 -0
- package/src/provider.tsx +47 -0
- package/src/sharing/VisibilityBadge.spec.ts +96 -0
- package/src/sharing/VisibilityBadge.tsx +37 -0
- package/src/sharing/index.ts +4 -0
- package/src/styles.css +21 -0
- package/src/ui/accordion.tsx +56 -0
- package/src/ui/alert-dialog.tsx +141 -0
- package/src/ui/alert.tsx +59 -0
- package/src/ui/aspect-ratio.tsx +5 -0
- package/src/ui/avatar.tsx +48 -0
- package/src/ui/badge.tsx +37 -0
- package/src/ui/breadcrumb.tsx +115 -0
- package/src/ui/button.tsx +78 -0
- package/src/ui/calendar.tsx +214 -0
- package/src/ui/card.tsx +86 -0
- package/src/ui/carousel.tsx +260 -0
- package/src/ui/chart.tsx +375 -0
- package/src/ui/checkbox.tsx +28 -0
- package/src/ui/collapsible.tsx +9 -0
- package/src/ui/command.spec.tsx +51 -0
- package/src/ui/command.tsx +174 -0
- package/src/ui/context-menu.tsx +202 -0
- package/src/ui/date-picker.tsx +64 -0
- package/src/ui/dialog.spec.tsx +43 -0
- package/src/ui/dialog.tsx +146 -0
- package/src/ui/drawer.tsx +126 -0
- package/src/ui/dropdown-menu.tsx +218 -0
- package/src/ui/form.tsx +177 -0
- package/src/ui/hover-card.tsx +27 -0
- package/src/ui/index.ts +52 -0
- package/src/ui/input-otp.tsx +69 -0
- package/src/ui/input.tsx +22 -0
- package/src/ui/label.tsx +24 -0
- package/src/ui/logo.tsx +36 -0
- package/src/ui/menubar.tsx +235 -0
- package/src/ui/navigation-menu.tsx +128 -0
- package/src/ui/pagination.tsx +121 -0
- package/src/ui/popover.tsx +44 -0
- package/src/ui/progress.tsx +26 -0
- package/src/ui/radio-group.tsx +42 -0
- package/src/ui/resizable.tsx +43 -0
- package/src/ui/scroll-area.tsx +46 -0
- package/src/ui/select.tsx +158 -0
- package/src/ui/separator.tsx +29 -0
- package/src/ui/sheet.tsx +160 -0
- package/src/ui/sidebar.tsx +777 -0
- package/src/ui/skeleton.tsx +18 -0
- package/src/ui/slider.tsx +26 -0
- package/src/ui/sonner.tsx +58 -0
- package/src/ui/spinner.tsx +17 -0
- package/src/ui/switch.tsx +27 -0
- package/src/ui/table.tsx +117 -0
- package/src/ui/tabs.tsx +53 -0
- package/src/ui/textarea.tsx +23 -0
- package/src/ui/toast.tsx +127 -0
- package/src/ui/toaster.tsx +33 -0
- package/src/ui/toggle-group.tsx +59 -0
- package/src/ui/toggle.tsx +43 -0
- package/src/ui/tooltip.tsx +53 -0
- package/src/ui/use-toast.ts +3 -0
- package/src/utils.ts +8 -0
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import * as SelectPrimitive from "@radix-ui/react-select";
|
|
2
|
+
import { IconCheck, IconChevronDown, IconChevronUp } from "@tabler/icons-react";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
|
|
5
|
+
import { cn } from "../utils.js";
|
|
6
|
+
|
|
7
|
+
const Select = SelectPrimitive.Root;
|
|
8
|
+
|
|
9
|
+
const SelectGroup = SelectPrimitive.Group;
|
|
10
|
+
|
|
11
|
+
const SelectValue = SelectPrimitive.Value;
|
|
12
|
+
|
|
13
|
+
const SelectTrigger = React.forwardRef<
|
|
14
|
+
React.ElementRef<typeof SelectPrimitive.Trigger>,
|
|
15
|
+
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Trigger>
|
|
16
|
+
>(({ className, children, ...props }, ref) => (
|
|
17
|
+
<SelectPrimitive.Trigger
|
|
18
|
+
ref={ref}
|
|
19
|
+
className={cn(
|
|
20
|
+
"flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",
|
|
21
|
+
className,
|
|
22
|
+
)}
|
|
23
|
+
{...props}
|
|
24
|
+
>
|
|
25
|
+
{children}
|
|
26
|
+
<SelectPrimitive.Icon asChild>
|
|
27
|
+
<IconChevronDown className="h-4 w-4 opacity-50" />
|
|
28
|
+
</SelectPrimitive.Icon>
|
|
29
|
+
</SelectPrimitive.Trigger>
|
|
30
|
+
));
|
|
31
|
+
SelectTrigger.displayName = SelectPrimitive.Trigger.displayName;
|
|
32
|
+
|
|
33
|
+
const SelectScrollUpButton = React.forwardRef<
|
|
34
|
+
React.ElementRef<typeof SelectPrimitive.ScrollUpButton>,
|
|
35
|
+
React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollUpButton>
|
|
36
|
+
>(({ className, ...props }, ref) => (
|
|
37
|
+
<SelectPrimitive.ScrollUpButton
|
|
38
|
+
ref={ref}
|
|
39
|
+
className={cn(
|
|
40
|
+
"flex cursor-default items-center justify-center py-1",
|
|
41
|
+
className,
|
|
42
|
+
)}
|
|
43
|
+
{...props}
|
|
44
|
+
>
|
|
45
|
+
<IconChevronUp className="h-4 w-4" />
|
|
46
|
+
</SelectPrimitive.ScrollUpButton>
|
|
47
|
+
));
|
|
48
|
+
SelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName;
|
|
49
|
+
|
|
50
|
+
const SelectScrollDownButton = React.forwardRef<
|
|
51
|
+
React.ElementRef<typeof SelectPrimitive.ScrollDownButton>,
|
|
52
|
+
React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollDownButton>
|
|
53
|
+
>(({ className, ...props }, ref) => (
|
|
54
|
+
<SelectPrimitive.ScrollDownButton
|
|
55
|
+
ref={ref}
|
|
56
|
+
className={cn(
|
|
57
|
+
"flex cursor-default items-center justify-center py-1",
|
|
58
|
+
className,
|
|
59
|
+
)}
|
|
60
|
+
{...props}
|
|
61
|
+
>
|
|
62
|
+
<IconChevronDown className="h-4 w-4" />
|
|
63
|
+
</SelectPrimitive.ScrollDownButton>
|
|
64
|
+
));
|
|
65
|
+
SelectScrollDownButton.displayName =
|
|
66
|
+
SelectPrimitive.ScrollDownButton.displayName;
|
|
67
|
+
|
|
68
|
+
const SelectContent = React.forwardRef<
|
|
69
|
+
React.ElementRef<typeof SelectPrimitive.Content>,
|
|
70
|
+
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Content>
|
|
71
|
+
>(({ className, children, position = "popper", ...props }, ref) => (
|
|
72
|
+
<SelectPrimitive.Portal>
|
|
73
|
+
<SelectPrimitive.Content
|
|
74
|
+
ref={ref}
|
|
75
|
+
className={cn(
|
|
76
|
+
"relative z-[290] max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md origin-[var(--radix-select-content-transform-origin)] 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 motion-reduce:data-[state=open]:zoom-in-100 motion-reduce:data-[state=closed]:zoom-out-100 motion-reduce:data-[side=bottom]:slide-in-from-top-0 motion-reduce:data-[side=left]:slide-in-from-right-0 motion-reduce:data-[side=right]:slide-in-from-left-0 motion-reduce:data-[side=top]:slide-in-from-bottom-0",
|
|
77
|
+
position === "popper" &&
|
|
78
|
+
"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
|
|
79
|
+
className,
|
|
80
|
+
)}
|
|
81
|
+
position={position}
|
|
82
|
+
{...props}
|
|
83
|
+
>
|
|
84
|
+
<SelectScrollUpButton />
|
|
85
|
+
<SelectPrimitive.Viewport
|
|
86
|
+
className={cn(
|
|
87
|
+
"p-1",
|
|
88
|
+
position === "popper" &&
|
|
89
|
+
"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]",
|
|
90
|
+
)}
|
|
91
|
+
>
|
|
92
|
+
{children}
|
|
93
|
+
</SelectPrimitive.Viewport>
|
|
94
|
+
<SelectScrollDownButton />
|
|
95
|
+
</SelectPrimitive.Content>
|
|
96
|
+
</SelectPrimitive.Portal>
|
|
97
|
+
));
|
|
98
|
+
SelectContent.displayName = SelectPrimitive.Content.displayName;
|
|
99
|
+
|
|
100
|
+
const SelectLabel = React.forwardRef<
|
|
101
|
+
React.ElementRef<typeof SelectPrimitive.Label>,
|
|
102
|
+
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Label>
|
|
103
|
+
>(({ className, ...props }, ref) => (
|
|
104
|
+
<SelectPrimitive.Label
|
|
105
|
+
ref={ref}
|
|
106
|
+
className={cn("py-1.5 ps-8 pe-2 text-sm font-semibold", className)}
|
|
107
|
+
{...props}
|
|
108
|
+
/>
|
|
109
|
+
));
|
|
110
|
+
SelectLabel.displayName = SelectPrimitive.Label.displayName;
|
|
111
|
+
|
|
112
|
+
const SelectItem = React.forwardRef<
|
|
113
|
+
React.ElementRef<typeof SelectPrimitive.Item>,
|
|
114
|
+
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Item>
|
|
115
|
+
>(({ className, children, ...props }, ref) => (
|
|
116
|
+
<SelectPrimitive.Item
|
|
117
|
+
ref={ref}
|
|
118
|
+
className={cn(
|
|
119
|
+
"relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 ps-8 pe-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
120
|
+
className,
|
|
121
|
+
)}
|
|
122
|
+
{...props}
|
|
123
|
+
>
|
|
124
|
+
<span className="absolute start-2 flex h-3.5 w-3.5 items-center justify-center">
|
|
125
|
+
<SelectPrimitive.ItemIndicator>
|
|
126
|
+
<IconCheck className="h-4 w-4" />
|
|
127
|
+
</SelectPrimitive.ItemIndicator>
|
|
128
|
+
</span>
|
|
129
|
+
|
|
130
|
+
<SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>
|
|
131
|
+
</SelectPrimitive.Item>
|
|
132
|
+
));
|
|
133
|
+
SelectItem.displayName = SelectPrimitive.Item.displayName;
|
|
134
|
+
|
|
135
|
+
const SelectSeparator = React.forwardRef<
|
|
136
|
+
React.ElementRef<typeof SelectPrimitive.Separator>,
|
|
137
|
+
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Separator>
|
|
138
|
+
>(({ className, ...props }, ref) => (
|
|
139
|
+
<SelectPrimitive.Separator
|
|
140
|
+
ref={ref}
|
|
141
|
+
className={cn("-mx-1 my-1 h-px bg-muted", className)}
|
|
142
|
+
{...props}
|
|
143
|
+
/>
|
|
144
|
+
));
|
|
145
|
+
SelectSeparator.displayName = SelectPrimitive.Separator.displayName;
|
|
146
|
+
|
|
147
|
+
export {
|
|
148
|
+
Select,
|
|
149
|
+
SelectGroup,
|
|
150
|
+
SelectValue,
|
|
151
|
+
SelectTrigger,
|
|
152
|
+
SelectContent,
|
|
153
|
+
SelectLabel,
|
|
154
|
+
SelectItem,
|
|
155
|
+
SelectSeparator,
|
|
156
|
+
SelectScrollUpButton,
|
|
157
|
+
SelectScrollDownButton,
|
|
158
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import * as SeparatorPrimitive from "@radix-ui/react-separator";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
|
|
4
|
+
import { cn } from "../utils.js";
|
|
5
|
+
|
|
6
|
+
const Separator = React.forwardRef<
|
|
7
|
+
React.ElementRef<typeof SeparatorPrimitive.Root>,
|
|
8
|
+
React.ComponentPropsWithoutRef<typeof SeparatorPrimitive.Root>
|
|
9
|
+
>(
|
|
10
|
+
(
|
|
11
|
+
{ className, orientation = "horizontal", decorative = true, ...props },
|
|
12
|
+
ref,
|
|
13
|
+
) => (
|
|
14
|
+
<SeparatorPrimitive.Root
|
|
15
|
+
ref={ref}
|
|
16
|
+
decorative={decorative}
|
|
17
|
+
orientation={orientation}
|
|
18
|
+
className={cn(
|
|
19
|
+
"shrink-0 bg-border",
|
|
20
|
+
orientation === "horizontal" ? "h-[1px] w-full" : "h-full w-[1px]",
|
|
21
|
+
className,
|
|
22
|
+
)}
|
|
23
|
+
{...props}
|
|
24
|
+
/>
|
|
25
|
+
),
|
|
26
|
+
);
|
|
27
|
+
Separator.displayName = SeparatorPrimitive.Root.displayName;
|
|
28
|
+
|
|
29
|
+
export { Separator };
|
package/src/ui/sheet.tsx
ADDED
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import * as SheetPrimitive from "@radix-ui/react-dialog";
|
|
2
|
+
import { IconX } from "@tabler/icons-react";
|
|
3
|
+
import { cva, type VariantProps } from "class-variance-authority";
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
|
|
6
|
+
import { cn } from "../utils.js";
|
|
7
|
+
|
|
8
|
+
const Sheet = SheetPrimitive.Root;
|
|
9
|
+
|
|
10
|
+
const SheetTrigger = SheetPrimitive.Trigger;
|
|
11
|
+
|
|
12
|
+
const SheetClose = SheetPrimitive.Close;
|
|
13
|
+
|
|
14
|
+
const SheetPortal = SheetPrimitive.Portal;
|
|
15
|
+
|
|
16
|
+
const SheetOverlay = React.forwardRef<
|
|
17
|
+
React.ElementRef<typeof SheetPrimitive.Overlay>,
|
|
18
|
+
React.ComponentPropsWithoutRef<typeof SheetPrimitive.Overlay>
|
|
19
|
+
>(({ className, ...props }, ref) => (
|
|
20
|
+
<SheetPrimitive.Overlay
|
|
21
|
+
ref={ref}
|
|
22
|
+
className={cn(
|
|
23
|
+
"fixed inset-0 z-[220] bg-background/35 backdrop-blur-[1px] data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
|
|
24
|
+
className,
|
|
25
|
+
)}
|
|
26
|
+
{...props}
|
|
27
|
+
/>
|
|
28
|
+
));
|
|
29
|
+
SheetOverlay.displayName = SheetPrimitive.Overlay.displayName;
|
|
30
|
+
|
|
31
|
+
const sheetVariants = cva(
|
|
32
|
+
"fixed z-[230] gap-4 border-border bg-background p-6 text-foreground shadow-lg outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-200 data-[state=open]:duration-300 data-[state=open]:ease-[cubic-bezier(0.32,0.72,0,1)] data-[state=closed]:ease-[cubic-bezier(0.32,0.72,0,1)] data-[state=open]:fade-in-0 data-[state=closed]:fade-out-0 motion-reduce:data-[state=open]:slide-in-from-right-0 motion-reduce:data-[state=closed]:slide-out-to-right-0 motion-reduce:data-[state=open]:slide-in-from-left-0 motion-reduce:data-[state=closed]:slide-out-to-left-0 motion-reduce:data-[state=open]:slide-in-from-top-0 motion-reduce:data-[state=closed]:slide-out-to-top-0 motion-reduce:data-[state=open]:slide-in-from-bottom-0 motion-reduce:data-[state=closed]:slide-out-to-bottom-0",
|
|
33
|
+
{
|
|
34
|
+
variants: {
|
|
35
|
+
side: {
|
|
36
|
+
top: "inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",
|
|
37
|
+
bottom:
|
|
38
|
+
"inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",
|
|
39
|
+
left: "inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",
|
|
40
|
+
right:
|
|
41
|
+
"inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm",
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
defaultVariants: {
|
|
45
|
+
side: "right",
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
interface SheetContentProps
|
|
51
|
+
extends
|
|
52
|
+
React.ComponentPropsWithoutRef<typeof SheetPrimitive.Content>,
|
|
53
|
+
VariantProps<typeof sheetVariants> {
|
|
54
|
+
// When false, the default close button is hidden.
|
|
55
|
+
showClose?: boolean;
|
|
56
|
+
// When false, the overlay backdrop is not rendered (e.g. for inline side panels).
|
|
57
|
+
showOverlay?: boolean;
|
|
58
|
+
overlayClassName?: string;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const SheetContent = React.forwardRef<
|
|
62
|
+
React.ElementRef<typeof SheetPrimitive.Content>,
|
|
63
|
+
SheetContentProps
|
|
64
|
+
>(
|
|
65
|
+
(
|
|
66
|
+
{
|
|
67
|
+
side = "right",
|
|
68
|
+
className,
|
|
69
|
+
children,
|
|
70
|
+
showClose = true,
|
|
71
|
+
showOverlay = true,
|
|
72
|
+
overlayClassName,
|
|
73
|
+
...props
|
|
74
|
+
},
|
|
75
|
+
ref,
|
|
76
|
+
) => (
|
|
77
|
+
<SheetPortal>
|
|
78
|
+
{showOverlay ? <SheetOverlay className={overlayClassName} /> : null}
|
|
79
|
+
<SheetPrimitive.Content
|
|
80
|
+
ref={ref}
|
|
81
|
+
className={cn(sheetVariants({ side }), className)}
|
|
82
|
+
{...props}
|
|
83
|
+
>
|
|
84
|
+
{children}
|
|
85
|
+
{showClose ? (
|
|
86
|
+
<SheetPrimitive.Close className="absolute end-3 top-3 flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground hover:bg-accent hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring">
|
|
87
|
+
<IconX className="h-4 w-4" />
|
|
88
|
+
<span className="sr-only">Close</span>
|
|
89
|
+
</SheetPrimitive.Close>
|
|
90
|
+
) : null}
|
|
91
|
+
</SheetPrimitive.Content>
|
|
92
|
+
</SheetPortal>
|
|
93
|
+
),
|
|
94
|
+
);
|
|
95
|
+
SheetContent.displayName = SheetPrimitive.Content.displayName;
|
|
96
|
+
|
|
97
|
+
const SheetHeader = ({
|
|
98
|
+
className,
|
|
99
|
+
...props
|
|
100
|
+
}: React.HTMLAttributes<HTMLDivElement>) => (
|
|
101
|
+
<div
|
|
102
|
+
className={cn(
|
|
103
|
+
"flex flex-col space-y-2 text-center sm:text-start",
|
|
104
|
+
className,
|
|
105
|
+
)}
|
|
106
|
+
{...props}
|
|
107
|
+
/>
|
|
108
|
+
);
|
|
109
|
+
SheetHeader.displayName = "SheetHeader";
|
|
110
|
+
|
|
111
|
+
const SheetFooter = ({
|
|
112
|
+
className,
|
|
113
|
+
...props
|
|
114
|
+
}: React.HTMLAttributes<HTMLDivElement>) => (
|
|
115
|
+
<div
|
|
116
|
+
className={cn(
|
|
117
|
+
"flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",
|
|
118
|
+
className,
|
|
119
|
+
)}
|
|
120
|
+
{...props}
|
|
121
|
+
/>
|
|
122
|
+
);
|
|
123
|
+
SheetFooter.displayName = "SheetFooter";
|
|
124
|
+
|
|
125
|
+
const SheetTitle = React.forwardRef<
|
|
126
|
+
React.ElementRef<typeof SheetPrimitive.Title>,
|
|
127
|
+
React.ComponentPropsWithoutRef<typeof SheetPrimitive.Title>
|
|
128
|
+
>(({ className, ...props }, ref) => (
|
|
129
|
+
<SheetPrimitive.Title
|
|
130
|
+
ref={ref}
|
|
131
|
+
className={cn("text-lg font-semibold text-foreground", className)}
|
|
132
|
+
{...props}
|
|
133
|
+
/>
|
|
134
|
+
));
|
|
135
|
+
SheetTitle.displayName = SheetPrimitive.Title.displayName;
|
|
136
|
+
|
|
137
|
+
const SheetDescription = React.forwardRef<
|
|
138
|
+
React.ElementRef<typeof SheetPrimitive.Description>,
|
|
139
|
+
React.ComponentPropsWithoutRef<typeof SheetPrimitive.Description>
|
|
140
|
+
>(({ className, ...props }, ref) => (
|
|
141
|
+
<SheetPrimitive.Description
|
|
142
|
+
ref={ref}
|
|
143
|
+
className={cn("text-sm text-muted-foreground", className)}
|
|
144
|
+
{...props}
|
|
145
|
+
/>
|
|
146
|
+
));
|
|
147
|
+
SheetDescription.displayName = SheetPrimitive.Description.displayName;
|
|
148
|
+
|
|
149
|
+
export {
|
|
150
|
+
Sheet,
|
|
151
|
+
SheetPortal,
|
|
152
|
+
SheetOverlay,
|
|
153
|
+
SheetTrigger,
|
|
154
|
+
SheetClose,
|
|
155
|
+
SheetContent,
|
|
156
|
+
SheetHeader,
|
|
157
|
+
SheetFooter,
|
|
158
|
+
SheetTitle,
|
|
159
|
+
SheetDescription,
|
|
160
|
+
};
|