doclific 0.1.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/.gitattributes +2 -0
- package/.prettierignore +5 -0
- package/.prettierrc +9 -0
- package/.vscode/settings.json +13 -0
- package/dist/bin/doclific.d.ts +3 -0
- package/dist/bin/doclific.d.ts.map +1 -0
- package/dist/bin/doclific.js +11 -0
- package/dist/core/codebase.js +31 -0
- package/dist/core/docs.js +75 -0
- package/dist/core/git.js +47 -0
- package/dist/server/index.d.ts +2 -0
- package/dist/server/index.d.ts.map +1 -0
- package/dist/server/index.js +46 -0
- package/dist/server/router.d.ts +9 -0
- package/dist/server/router.d.ts.map +1 -0
- package/dist/server/router.js +55 -0
- package/frontend/README.md +73 -0
- package/frontend/components.json +24 -0
- package/frontend/eslint.config.js +23 -0
- package/frontend/index.html +25 -0
- package/frontend/package-lock.json +15754 -0
- package/frontend/package.json +122 -0
- package/frontend/public/logo.svg +1 -0
- package/frontend/src/App.tsx +21 -0
- package/frontend/src/components/app-sidebar.tsx +393 -0
- package/frontend/src/components/editor/editor-base-kit.tsx +43 -0
- package/frontend/src/components/editor/editor-kit.tsx +93 -0
- package/frontend/src/components/editor/plugins/align-base-kit.tsx +16 -0
- package/frontend/src/components/editor/plugins/align-kit.tsx +18 -0
- package/frontend/src/components/editor/plugins/autoformat-kit.tsx +236 -0
- package/frontend/src/components/editor/plugins/basic-blocks-base-kit.tsx +35 -0
- package/frontend/src/components/editor/plugins/basic-blocks-kit.tsx +88 -0
- package/frontend/src/components/editor/plugins/basic-marks-base-kit.tsx +27 -0
- package/frontend/src/components/editor/plugins/basic-marks-kit.tsx +41 -0
- package/frontend/src/components/editor/plugins/basic-nodes-kit.tsx +6 -0
- package/frontend/src/components/editor/plugins/block-menu-kit.tsx +14 -0
- package/frontend/src/components/editor/plugins/block-placeholder-kit.tsx +17 -0
- package/frontend/src/components/editor/plugins/block-selection-kit.tsx +32 -0
- package/frontend/src/components/editor/plugins/callout-base-kit.tsx +7 -0
- package/frontend/src/components/editor/plugins/callout-kit.tsx +7 -0
- package/frontend/src/components/editor/plugins/code-block-base-kit.tsx +23 -0
- package/frontend/src/components/editor/plugins/code-block-kit.tsx +26 -0
- package/frontend/src/components/editor/plugins/codebase-kit.tsx +23 -0
- package/frontend/src/components/editor/plugins/column-base-kit.tsx +11 -0
- package/frontend/src/components/editor/plugins/column-kit.tsx +10 -0
- package/frontend/src/components/editor/plugins/comment-base-kit.tsx +7 -0
- package/frontend/src/components/editor/plugins/comment-kit.tsx +97 -0
- package/frontend/src/components/editor/plugins/cursor-overlay-kit.tsx +13 -0
- package/frontend/src/components/editor/plugins/date-base-kit.tsx +5 -0
- package/frontend/src/components/editor/plugins/date-kit.tsx +7 -0
- package/frontend/src/components/editor/plugins/discussion-kit.tsx +148 -0
- package/frontend/src/components/editor/plugins/dnd-kit.tsx +28 -0
- package/frontend/src/components/editor/plugins/docx-kit.tsx +6 -0
- package/frontend/src/components/editor/plugins/emoji-kit.tsx +13 -0
- package/frontend/src/components/editor/plugins/excalidraw-kit.tsx +9 -0
- package/frontend/src/components/editor/plugins/exit-break-kit.tsx +12 -0
- package/frontend/src/components/editor/plugins/floating-toolbar-kit.tsx +19 -0
- package/frontend/src/components/editor/plugins/font-base-kit.tsx +20 -0
- package/frontend/src/components/editor/plugins/font-kit.tsx +29 -0
- package/frontend/src/components/editor/plugins/indent-base-kit.tsx +19 -0
- package/frontend/src/components/editor/plugins/indent-kit.tsx +22 -0
- package/frontend/src/components/editor/plugins/line-height-base-kit.tsx +14 -0
- package/frontend/src/components/editor/plugins/line-height-kit.tsx +16 -0
- package/frontend/src/components/editor/plugins/link-base-kit.tsx +5 -0
- package/frontend/src/components/editor/plugins/link-kit.tsx +15 -0
- package/frontend/src/components/editor/plugins/list-base-kit.tsx +23 -0
- package/frontend/src/components/editor/plugins/list-kit.tsx +26 -0
- package/frontend/src/components/editor/plugins/markdown-kit.tsx +46 -0
- package/frontend/src/components/editor/plugins/math-base-kit.tsx +11 -0
- package/frontend/src/components/editor/plugins/math-kit.tsx +13 -0
- package/frontend/src/components/editor/plugins/media-base-kit.tsx +31 -0
- package/frontend/src/components/editor/plugins/media-kit.tsx +43 -0
- package/frontend/src/components/editor/plugins/mention-base-kit.tsx +7 -0
- package/frontend/src/components/editor/plugins/mention-kit.tsx +15 -0
- package/frontend/src/components/editor/plugins/slash-kit.tsx +18 -0
- package/frontend/src/components/editor/plugins/suggestion-base-kit.tsx +7 -0
- package/frontend/src/components/editor/plugins/suggestion-kit.tsx +90 -0
- package/frontend/src/components/editor/plugins/table-base-kit.tsx +20 -0
- package/frontend/src/components/editor/plugins/table-kit.tsx +22 -0
- package/frontend/src/components/editor/plugins/toc-base-kit.tsx +5 -0
- package/frontend/src/components/editor/plugins/toc-kit.tsx +14 -0
- package/frontend/src/components/editor/plugins/toggle-base-kit.tsx +7 -0
- package/frontend/src/components/editor/plugins/toggle-kit.tsx +11 -0
- package/frontend/src/components/editor/transforms.ts +194 -0
- package/frontend/src/components/markdown-to-slate-demo.tsx +50 -0
- package/frontend/src/components/mode-toggle.tsx +15 -0
- package/frontend/src/components/theme-provider.tsx +73 -0
- package/frontend/src/components/ui/alert-dialog.tsx +155 -0
- package/frontend/src/components/ui/align-toolbar-button.tsx +84 -0
- package/frontend/src/components/ui/avatar.tsx +51 -0
- package/frontend/src/components/ui/block-context-menu.tsx +199 -0
- package/frontend/src/components/ui/block-discussion.tsx +365 -0
- package/frontend/src/components/ui/block-draggable.tsx +512 -0
- package/frontend/src/components/ui/block-list-static.tsx +80 -0
- package/frontend/src/components/ui/block-list.tsx +87 -0
- package/frontend/src/components/ui/block-selection.tsx +42 -0
- package/frontend/src/components/ui/block-suggestion.tsx +473 -0
- package/frontend/src/components/ui/blockquote-node-static.tsx +11 -0
- package/frontend/src/components/ui/blockquote-node.tsx +13 -0
- package/frontend/src/components/ui/button.tsx +62 -0
- package/frontend/src/components/ui/calendar.tsx +218 -0
- package/frontend/src/components/ui/callout-node-static.tsx +36 -0
- package/frontend/src/components/ui/callout-node.tsx +63 -0
- package/frontend/src/components/ui/caption.tsx +63 -0
- package/frontend/src/components/ui/checkbox.tsx +30 -0
- package/frontend/src/components/ui/code-block-node-static.tsx +35 -0
- package/frontend/src/components/ui/code-block-node.tsx +287 -0
- package/frontend/src/components/ui/code-node-static.tsx +15 -0
- package/frontend/src/components/ui/code-node.tsx +17 -0
- package/frontend/src/components/ui/codebase-snippet-node.tsx +237 -0
- package/frontend/src/components/ui/column-node-static.tsx +29 -0
- package/frontend/src/components/ui/column-node.tsx +317 -0
- package/frontend/src/components/ui/command.tsx +182 -0
- package/frontend/src/components/ui/comment-node-static.tsx +15 -0
- package/frontend/src/components/ui/comment-node.tsx +45 -0
- package/frontend/src/components/ui/comment-toolbar-button.tsx +24 -0
- package/frontend/src/components/ui/comment.tsx +618 -0
- package/frontend/src/components/ui/context-menu.tsx +250 -0
- package/frontend/src/components/ui/cursor-overlay.tsx +66 -0
- package/frontend/src/components/ui/date-node-static.tsx +45 -0
- package/frontend/src/components/ui/date-node.tsx +93 -0
- package/frontend/src/components/ui/dialog.tsx +143 -0
- package/frontend/src/components/ui/dropdown-menu.tsx +255 -0
- package/frontend/src/components/ui/dynamic-icon.tsx +12 -0
- package/frontend/src/components/ui/editor-static.tsx +53 -0
- package/frontend/src/components/ui/editor.tsx +130 -0
- package/frontend/src/components/ui/emoji-node.tsx +69 -0
- package/frontend/src/components/ui/emoji-toolbar-button.tsx +628 -0
- package/frontend/src/components/ui/equation-node-static.tsx +98 -0
- package/frontend/src/components/ui/equation-node.tsx +235 -0
- package/frontend/src/components/ui/equation-toolbar-button.tsx +25 -0
- package/frontend/src/components/ui/excalidraw-node.tsx +36 -0
- package/frontend/src/components/ui/export-toolbar-button.tsx +174 -0
- package/frontend/src/components/ui/file-selector.tsx +339 -0
- package/frontend/src/components/ui/floating-toolbar-buttons.tsx +73 -0
- package/frontend/src/components/ui/floating-toolbar.tsx +85 -0
- package/frontend/src/components/ui/font-color-toolbar-button.tsx +831 -0
- package/frontend/src/components/ui/font-size-toolbar-button.tsx +152 -0
- package/frontend/src/components/ui/heading-node-static.tsx +68 -0
- package/frontend/src/components/ui/heading-node.tsx +58 -0
- package/frontend/src/components/ui/highlight-node-static.tsx +11 -0
- package/frontend/src/components/ui/highlight-node.tsx +13 -0
- package/frontend/src/components/ui/history-toolbar-button.tsx +50 -0
- package/frontend/src/components/ui/hr-node-static.tsx +20 -0
- package/frontend/src/components/ui/hr-node.tsx +33 -0
- package/frontend/src/components/ui/import-toolbar-button.tsx +97 -0
- package/frontend/src/components/ui/indent-toolbar-button.tsx +30 -0
- package/frontend/src/components/ui/inline-combobox.tsx +414 -0
- package/frontend/src/components/ui/input.tsx +21 -0
- package/frontend/src/components/ui/insert-toolbar-button.tsx +254 -0
- package/frontend/src/components/ui/kbd-node-static.tsx +15 -0
- package/frontend/src/components/ui/kbd-node.tsx +17 -0
- package/frontend/src/components/ui/layout-header.tsx +35 -0
- package/frontend/src/components/ui/line-height-toolbar-button.tsx +68 -0
- package/frontend/src/components/ui/link-node-static.tsx +21 -0
- package/frontend/src/components/ui/link-node.tsx +39 -0
- package/frontend/src/components/ui/link-toolbar-button.tsx +22 -0
- package/frontend/src/components/ui/link-toolbar.tsx +206 -0
- package/frontend/src/components/ui/list-toolbar-button.tsx +204 -0
- package/frontend/src/components/ui/mark-toolbar-button.tsx +19 -0
- package/frontend/src/components/ui/media-audio-node-static.tsx +17 -0
- package/frontend/src/components/ui/media-audio-node.tsx +39 -0
- package/frontend/src/components/ui/media-embed-node.tsx +136 -0
- package/frontend/src/components/ui/media-file-node-static.tsx +29 -0
- package/frontend/src/components/ui/media-file-node.tsx +47 -0
- package/frontend/src/components/ui/media-image-node-static.tsx +39 -0
- package/frontend/src/components/ui/media-image-node.tsx +80 -0
- package/frontend/src/components/ui/media-placeholder-node.tsx +249 -0
- package/frontend/src/components/ui/media-preview-dialog.tsx +152 -0
- package/frontend/src/components/ui/media-toolbar-button.tsx +225 -0
- package/frontend/src/components/ui/media-toolbar.tsx +115 -0
- package/frontend/src/components/ui/media-upload-toast.tsx +66 -0
- package/frontend/src/components/ui/media-video-node-static.tsx +30 -0
- package/frontend/src/components/ui/media-video-node.tsx +121 -0
- package/frontend/src/components/ui/mention-node-static.tsx +36 -0
- package/frontend/src/components/ui/mention-node.tsx +194 -0
- package/frontend/src/components/ui/mode-toolbar-button.tsx +123 -0
- package/frontend/src/components/ui/more-toolbar-button.tsx +80 -0
- package/frontend/src/components/ui/paragraph-node-static.tsx +13 -0
- package/frontend/src/components/ui/paragraph-node.tsx +15 -0
- package/frontend/src/components/ui/popover.tsx +46 -0
- package/frontend/src/components/ui/resize-handle.tsx +87 -0
- package/frontend/src/components/ui/separator.tsx +28 -0
- package/frontend/src/components/ui/sheet.tsx +139 -0
- package/frontend/src/components/ui/sidebar.tsx +726 -0
- package/frontend/src/components/ui/skeleton.tsx +13 -0
- package/frontend/src/components/ui/slash-node.tsx +233 -0
- package/frontend/src/components/ui/sonner.tsx +38 -0
- package/frontend/src/components/ui/suggestion-node-static.tsx +35 -0
- package/frontend/src/components/ui/suggestion-node.tsx +162 -0
- package/frontend/src/components/ui/suggestion-toolbar-button.tsx +25 -0
- package/frontend/src/components/ui/table-icons.tsx +862 -0
- package/frontend/src/components/ui/table-node-static.tsx +98 -0
- package/frontend/src/components/ui/table-node.tsx +656 -0
- package/frontend/src/components/ui/table-toolbar-button.tsx +264 -0
- package/frontend/src/components/ui/toc-node-static.tsx +92 -0
- package/frontend/src/components/ui/toc-node.tsx +55 -0
- package/frontend/src/components/ui/toggle-node-static.tsx +18 -0
- package/frontend/src/components/ui/toggle-node.tsx +36 -0
- package/frontend/src/components/ui/toggle-toolbar-button.tsx +22 -0
- package/frontend/src/components/ui/toolbar.tsx +387 -0
- package/frontend/src/components/ui/tooltip.tsx +59 -0
- package/frontend/src/components/ui/turn-into-toolbar-button.tsx +188 -0
- package/frontend/src/hooks/use-debounce.ts +18 -0
- package/frontend/src/hooks/use-is-touch-device.ts +24 -0
- package/frontend/src/hooks/use-mobile.ts +19 -0
- package/frontend/src/hooks/use-mounted.ts +11 -0
- package/frontend/src/hooks/use-upload-file.ts +128 -0
- package/frontend/src/index.css +128 -0
- package/frontend/src/layout.tsx +42 -0
- package/frontend/src/lib/markdown-joiner-transform.ts +239 -0
- package/frontend/src/lib/orpc.ts +13 -0
- package/frontend/src/lib/uploadthing.ts +19 -0
- package/frontend/src/lib/utils.ts +6 -0
- package/frontend/src/main.tsx +13 -0
- package/frontend/src/pages/editor.tsx +44 -0
- package/frontend/src/types/docs.d.ts +6 -0
- package/frontend/src/types/global.d.ts +9 -0
- package/frontend/src/types/router.d.ts +4 -0
- package/frontend/tsconfig.app.json +33 -0
- package/frontend/tsconfig.json +10 -0
- package/frontend/tsconfig.node.json +26 -0
- package/frontend/vite.config.ts +14 -0
- package/package.json +30 -0
- package/src/bin/doclific.ts +17 -0
- package/src/core/codebase.ts +39 -0
- package/src/core/docs.ts +90 -0
- package/src/core/git.ts +48 -0
- package/src/server/index.ts +55 -0
- package/src/server/router.ts +65 -0
- package/tsconfig.json +15 -0
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
import type { VariantProps } from 'class-variance-authority';
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
type ResizeHandle as ResizeHandlePrimitive,
|
|
7
|
+
Resizable as ResizablePrimitive,
|
|
8
|
+
useResizeHandle,
|
|
9
|
+
useResizeHandleState,
|
|
10
|
+
} from '@platejs/resizable';
|
|
11
|
+
import { cva } from 'class-variance-authority';
|
|
12
|
+
|
|
13
|
+
import { cn } from '@/lib/utils';
|
|
14
|
+
|
|
15
|
+
export const mediaResizeHandleVariants = cva(
|
|
16
|
+
cn(
|
|
17
|
+
'top-0 flex w-6 select-none flex-col justify-center',
|
|
18
|
+
"after:flex after:h-16 after:w-[3px] after:rounded-[6px] after:bg-ring after:opacity-0 after:content-['_'] group-hover:after:opacity-100"
|
|
19
|
+
),
|
|
20
|
+
{
|
|
21
|
+
variants: {
|
|
22
|
+
direction: {
|
|
23
|
+
left: '-left-3 -ml-3 pl-3',
|
|
24
|
+
right: '-right-3 -mr-3 items-end pr-3',
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
}
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
const resizeHandleVariants = cva('absolute z-40', {
|
|
31
|
+
variants: {
|
|
32
|
+
direction: {
|
|
33
|
+
bottom: 'w-full cursor-row-resize',
|
|
34
|
+
left: 'h-full cursor-col-resize',
|
|
35
|
+
right: 'h-full cursor-col-resize',
|
|
36
|
+
top: 'w-full cursor-row-resize',
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
export function ResizeHandle({
|
|
42
|
+
className,
|
|
43
|
+
options,
|
|
44
|
+
...props
|
|
45
|
+
}: React.ComponentProps<typeof ResizeHandlePrimitive> &
|
|
46
|
+
VariantProps<typeof resizeHandleVariants>) {
|
|
47
|
+
const state = useResizeHandleState(options ?? {});
|
|
48
|
+
const resizeHandle = useResizeHandle(state);
|
|
49
|
+
|
|
50
|
+
if (state.readOnly) return null;
|
|
51
|
+
|
|
52
|
+
return (
|
|
53
|
+
<div
|
|
54
|
+
className={cn(
|
|
55
|
+
resizeHandleVariants({ direction: options?.direction }),
|
|
56
|
+
className
|
|
57
|
+
)}
|
|
58
|
+
data-resizing={state.isResizing}
|
|
59
|
+
{...resizeHandle.props}
|
|
60
|
+
{...props}
|
|
61
|
+
/>
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const resizableVariants = cva('', {
|
|
66
|
+
variants: {
|
|
67
|
+
align: {
|
|
68
|
+
center: 'mx-auto',
|
|
69
|
+
left: 'mr-auto',
|
|
70
|
+
right: 'ml-auto',
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
export function Resizable({
|
|
76
|
+
align,
|
|
77
|
+
className,
|
|
78
|
+
...props
|
|
79
|
+
}: React.ComponentProps<typeof ResizablePrimitive> &
|
|
80
|
+
VariantProps<typeof resizableVariants>) {
|
|
81
|
+
return (
|
|
82
|
+
<ResizablePrimitive
|
|
83
|
+
{...props}
|
|
84
|
+
className={cn(resizableVariants({ align }), className)}
|
|
85
|
+
/>
|
|
86
|
+
);
|
|
87
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import * as React from "react"
|
|
4
|
+
import * as SeparatorPrimitive from "@radix-ui/react-separator"
|
|
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
|
+
"bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",
|
|
21
|
+
className
|
|
22
|
+
)}
|
|
23
|
+
{...props}
|
|
24
|
+
/>
|
|
25
|
+
)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export { Separator }
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import * as React from "react"
|
|
4
|
+
import * as SheetPrimitive from "@radix-ui/react-dialog"
|
|
5
|
+
import { XIcon } from "lucide-react"
|
|
6
|
+
|
|
7
|
+
import { cn } from "@/lib/utils"
|
|
8
|
+
|
|
9
|
+
function Sheet({ ...props }: React.ComponentProps<typeof SheetPrimitive.Root>) {
|
|
10
|
+
return <SheetPrimitive.Root data-slot="sheet" {...props} />
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function SheetTrigger({
|
|
14
|
+
...props
|
|
15
|
+
}: React.ComponentProps<typeof SheetPrimitive.Trigger>) {
|
|
16
|
+
return <SheetPrimitive.Trigger data-slot="sheet-trigger" {...props} />
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function SheetClose({
|
|
20
|
+
...props
|
|
21
|
+
}: React.ComponentProps<typeof SheetPrimitive.Close>) {
|
|
22
|
+
return <SheetPrimitive.Close data-slot="sheet-close" {...props} />
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function SheetPortal({
|
|
26
|
+
...props
|
|
27
|
+
}: React.ComponentProps<typeof SheetPrimitive.Portal>) {
|
|
28
|
+
return <SheetPrimitive.Portal data-slot="sheet-portal" {...props} />
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function SheetOverlay({
|
|
32
|
+
className,
|
|
33
|
+
...props
|
|
34
|
+
}: React.ComponentProps<typeof SheetPrimitive.Overlay>) {
|
|
35
|
+
return (
|
|
36
|
+
<SheetPrimitive.Overlay
|
|
37
|
+
data-slot="sheet-overlay"
|
|
38
|
+
className={cn(
|
|
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",
|
|
40
|
+
className
|
|
41
|
+
)}
|
|
42
|
+
{...props}
|
|
43
|
+
/>
|
|
44
|
+
)
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function SheetContent({
|
|
48
|
+
className,
|
|
49
|
+
children,
|
|
50
|
+
side = "right",
|
|
51
|
+
...props
|
|
52
|
+
}: React.ComponentProps<typeof SheetPrimitive.Content> & {
|
|
53
|
+
side?: "top" | "right" | "bottom" | "left"
|
|
54
|
+
}) {
|
|
55
|
+
return (
|
|
56
|
+
<SheetPortal>
|
|
57
|
+
<SheetOverlay />
|
|
58
|
+
<SheetPrimitive.Content
|
|
59
|
+
data-slot="sheet-content"
|
|
60
|
+
className={cn(
|
|
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",
|
|
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",
|
|
70
|
+
className
|
|
71
|
+
)}
|
|
72
|
+
{...props}
|
|
73
|
+
>
|
|
74
|
+
{children}
|
|
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 hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none">
|
|
76
|
+
<XIcon className="size-4" />
|
|
77
|
+
<span className="sr-only">Close</span>
|
|
78
|
+
</SheetPrimitive.Close>
|
|
79
|
+
</SheetPrimitive.Content>
|
|
80
|
+
</SheetPortal>
|
|
81
|
+
)
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function SheetHeader({ className, ...props }: React.ComponentProps<"div">) {
|
|
85
|
+
return (
|
|
86
|
+
<div
|
|
87
|
+
data-slot="sheet-header"
|
|
88
|
+
className={cn("flex flex-col gap-1.5 p-4", className)}
|
|
89
|
+
{...props}
|
|
90
|
+
/>
|
|
91
|
+
)
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
function SheetFooter({ className, ...props }: React.ComponentProps<"div">) {
|
|
95
|
+
return (
|
|
96
|
+
<div
|
|
97
|
+
data-slot="sheet-footer"
|
|
98
|
+
className={cn("mt-auto flex flex-col gap-2 p-4", className)}
|
|
99
|
+
{...props}
|
|
100
|
+
/>
|
|
101
|
+
)
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
function SheetTitle({
|
|
105
|
+
className,
|
|
106
|
+
...props
|
|
107
|
+
}: React.ComponentProps<typeof SheetPrimitive.Title>) {
|
|
108
|
+
return (
|
|
109
|
+
<SheetPrimitive.Title
|
|
110
|
+
data-slot="sheet-title"
|
|
111
|
+
className={cn("text-foreground font-semibold", className)}
|
|
112
|
+
{...props}
|
|
113
|
+
/>
|
|
114
|
+
)
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
function SheetDescription({
|
|
118
|
+
className,
|
|
119
|
+
...props
|
|
120
|
+
}: React.ComponentProps<typeof SheetPrimitive.Description>) {
|
|
121
|
+
return (
|
|
122
|
+
<SheetPrimitive.Description
|
|
123
|
+
data-slot="sheet-description"
|
|
124
|
+
className={cn("text-muted-foreground text-sm", className)}
|
|
125
|
+
{...props}
|
|
126
|
+
/>
|
|
127
|
+
)
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
export {
|
|
131
|
+
Sheet,
|
|
132
|
+
SheetTrigger,
|
|
133
|
+
SheetClose,
|
|
134
|
+
SheetContent,
|
|
135
|
+
SheetHeader,
|
|
136
|
+
SheetFooter,
|
|
137
|
+
SheetTitle,
|
|
138
|
+
SheetDescription,
|
|
139
|
+
}
|