@nexface/chat 0.1.1-alpha.1 → 0.1.1-alpha.10
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/dist/THIRD_PARTY_LICENSES.txt +44 -0
- package/dist/assistant-attachments.d.ts +31 -0
- package/dist/assistant-attachments.js +158 -0
- package/dist/assistant-attachments.js.map +1 -0
- package/dist/assistant-components.d.ts +19 -0
- package/dist/assistant-components.js +39 -0
- package/dist/assistant-components.js.map +1 -0
- package/dist/assistant-runtime.d.ts +24 -0
- package/dist/assistant-runtime.js +104 -0
- package/dist/assistant-runtime.js.map +1 -0
- package/dist/attachments.d.ts +3 -1
- package/dist/attachments.js +13 -0
- package/dist/attachments.js.map +1 -1
- package/dist/client.d.ts +89 -0
- package/dist/client.js +620 -0
- package/dist/client.js.map +1 -0
- package/dist/config.d.ts +1 -1
- package/dist/config.js.map +1 -1
- package/dist/default-chat.d.ts +2 -1
- package/dist/default-chat.js +85 -115
- package/dist/default-chat.js.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/messages.d.ts +27 -0
- package/dist/messages.js +121 -0
- package/dist/messages.js.map +1 -0
- package/dist/page-confirmation.d.ts +2 -1
- package/dist/page-confirmation.js.map +1 -1
- package/dist/protocol-messages.d.ts +9 -0
- package/dist/protocol-messages.js +249 -0
- package/dist/protocol-messages.js.map +1 -0
- package/dist/protocol-response.d.ts +32 -0
- package/dist/protocol-response.js +62 -0
- package/dist/protocol-response.js.map +1 -0
- package/dist/react.d.ts +29 -41
- package/dist/react.js +225 -662
- package/dist/react.js.map +1 -1
- package/dist/storage.d.ts +19 -0
- package/dist/storage.js +111 -0
- package/dist/storage.js.map +1 -0
- package/dist/styles.css +2337 -95
- package/dist/tool-result.d.ts +1 -0
- package/dist/tool-result.js +12 -0
- package/dist/tool-result.js.map +1 -0
- package/dist/types.d.ts +40 -1
- package/dist/types.js.map +1 -1
- package/dist/ui/attachment.aui.d.ts +7 -0
- package/dist/ui/attachment.aui.js +93 -0
- package/dist/ui/attachment.aui.js.map +1 -0
- package/dist/ui/avatar.d.ts +11 -0
- package/dist/ui/avatar.js +24 -0
- package/dist/ui/avatar.js.map +1 -0
- package/dist/ui/button.d.ts +13 -0
- package/dist/ui/button.js +38 -0
- package/dist/ui/button.js.map +1 -0
- package/dist/ui/dialog.d.ts +17 -0
- package/dist/ui/dialog.js +43 -0
- package/dist/ui/dialog.js.map +1 -0
- package/dist/ui/dropdown-menu.d.ts +25 -0
- package/dist/ui/dropdown-menu.js +60 -0
- package/dist/ui/dropdown-menu.js.map +1 -0
- package/dist/ui/input.d.ts +3 -0
- package/dist/ui/input.js +9 -0
- package/dist/ui/input.js.map +1 -0
- package/dist/ui/markdown-text.d.ts +7 -0
- package/dist/ui/markdown-text.js +73 -0
- package/dist/ui/markdown-text.js.map +1 -0
- package/dist/ui/skeleton.d.ts +2 -0
- package/dist/ui/skeleton.js +8 -0
- package/dist/ui/skeleton.js.map +1 -0
- package/dist/ui/surface.d.ts +4 -0
- package/dist/ui/surface.js +53 -0
- package/dist/ui/surface.js.map +1 -0
- package/dist/ui/thread-list.aui.d.ts +9 -0
- package/dist/ui/thread-list.aui.js +19 -0
- package/dist/ui/thread-list.aui.js.map +1 -0
- package/dist/ui/thread.aui.d.ts +29 -0
- package/dist/ui/thread.aui.js +25 -0
- package/dist/ui/thread.aui.js.map +1 -0
- package/dist/ui/tooltip-icon-button.d.ts +7 -0
- package/dist/ui/tooltip-icon-button.js +12 -0
- package/dist/ui/tooltip-icon-button.js.map +1 -0
- package/dist/ui/tooltip.d.ts +7 -0
- package/dist/ui/tooltip.js +23 -0
- package/dist/ui/tooltip.js.map +1 -0
- package/dist/ui/use-attachment-src.d.ts +1 -0
- package/dist/ui/use-attachment-src.js +28 -0
- package/dist/ui/use-attachment-src.js.map +1 -0
- package/dist/ui/use-copy-to-clipboard.d.ts +7 -0
- package/dist/ui/use-copy-to-clipboard.js +16 -0
- package/dist/ui/use-copy-to-clipboard.js.map +1 -0
- package/dist/ui/utils.d.ts +2 -0
- package/dist/ui/utils.js +8 -0
- package/dist/ui/utils.js.map +1 -0
- package/package.json +25 -12
- package/dist/operation-surface.d.ts +0 -7
- package/dist/operation-surface.js +0 -79
- package/dist/operation-surface.js.map +0 -1
- package/dist/operation-types.d.ts +0 -17
- package/dist/operation-types.js +0 -2
- package/dist/operation-types.js.map +0 -1
- package/dist/operation-view.d.ts +0 -13
- package/dist/operation-view.js +0 -367
- package/dist/operation-view.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getToolResultError(content: string): string | undefined;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export function getToolResultError(content) {
|
|
2
|
+
try {
|
|
3
|
+
const error = JSON.parse(content)?.error;
|
|
4
|
+
if (typeof error === "string")
|
|
5
|
+
return error;
|
|
6
|
+
if (error && typeof error === "object" && "message" in error && typeof error.message === "string")
|
|
7
|
+
return error.message;
|
|
8
|
+
}
|
|
9
|
+
catch { /* Tool results may contain plain text. */ }
|
|
10
|
+
return undefined;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=tool-result.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-result.js","sourceRoot":"","sources":["../src/tool-result.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,kBAAkB,CAAC,OAAe;IAChD,IAAI,CAAC;QACH,MAAM,KAAK,GAAY,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,KAAK,CAAC;QAClD,IAAI,OAAO,KAAK,KAAK,QAAQ;YAAE,OAAO,KAAK,CAAC;QAC5C,IAAI,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,SAAS,IAAI,KAAK,IAAI,OAAO,KAAK,CAAC,OAAO,KAAK,QAAQ;YAAE,OAAO,KAAK,CAAC,OAAO,CAAC;IAC1H,CAAC;IAAC,MAAM,CAAC,CAAC,0CAA0C,CAAC,CAAC;IACtD,OAAO,SAAS,CAAC;AACnB,CAAC","sourcesContent":["export function getToolResultError(content: string): string | undefined {\n try {\n const error: unknown = JSON.parse(content)?.error;\n if (typeof error === \"string\") return error;\n if (error && typeof error === \"object\" && \"message\" in error && typeof error.message === \"string\") return error.message;\n } catch { /* Tool results may contain plain text. */ }\n return undefined;\n}\n"]}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,18 +1,24 @@
|
|
|
1
1
|
import type { AgentRunResult } from "@nexface/agent";
|
|
2
|
+
import type { CSSProperties } from "react";
|
|
2
3
|
export type ChatRunResult = Extract<AgentRunResult, {
|
|
3
|
-
|
|
4
|
+
outcome: {
|
|
5
|
+
type: "success";
|
|
6
|
+
};
|
|
4
7
|
}>;
|
|
5
8
|
export interface ChatSuggestion {
|
|
6
9
|
readonly label: string;
|
|
7
10
|
readonly prompt: string;
|
|
8
11
|
}
|
|
9
12
|
export interface ChatProps {
|
|
13
|
+
open?: boolean;
|
|
14
|
+
onOpenChange?: (open: boolean) => void;
|
|
10
15
|
showToolDetails?: boolean;
|
|
11
16
|
onFullscreenChange?: (fullscreen: boolean) => void;
|
|
12
17
|
avatar?: string;
|
|
13
18
|
welcomeDescription?: string;
|
|
14
19
|
side?: "left" | "right";
|
|
15
20
|
className?: string;
|
|
21
|
+
style?: CSSProperties;
|
|
16
22
|
attachments?: false | ChatAttachmentOptions;
|
|
17
23
|
title?: string;
|
|
18
24
|
welcomeMessage?: string;
|
|
@@ -25,5 +31,38 @@ export interface ChatAttachmentOptions {
|
|
|
25
31
|
accept?: string;
|
|
26
32
|
maxCount?: number;
|
|
27
33
|
maxSizeBytes?: number;
|
|
34
|
+
adapter?: {
|
|
35
|
+
add(input: {
|
|
36
|
+
id: string;
|
|
37
|
+
file: File;
|
|
38
|
+
signal: AbortSignal;
|
|
39
|
+
}): Promise<{
|
|
40
|
+
data?: unknown;
|
|
41
|
+
preview?: string;
|
|
42
|
+
}>;
|
|
43
|
+
send(input: {
|
|
44
|
+
id: string;
|
|
45
|
+
file: File;
|
|
46
|
+
data?: unknown;
|
|
47
|
+
signal: AbortSignal;
|
|
48
|
+
}): Promise<{
|
|
49
|
+
content: readonly ({
|
|
50
|
+
type: "text";
|
|
51
|
+
text: string;
|
|
52
|
+
} | {
|
|
53
|
+
type: "image";
|
|
54
|
+
source: {
|
|
55
|
+
type: "data";
|
|
56
|
+
value: string;
|
|
57
|
+
mimeType: string;
|
|
58
|
+
};
|
|
59
|
+
})[];
|
|
60
|
+
}>;
|
|
61
|
+
remove?(input: {
|
|
62
|
+
id: string;
|
|
63
|
+
file: File;
|
|
64
|
+
data?: unknown;
|
|
65
|
+
}): void | Promise<void>;
|
|
66
|
+
};
|
|
28
67
|
}
|
|
29
68
|
export type { AgentModelConfig, AgentModelInfo } from "@nexface/agent";
|
package/dist/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { AgentRunResult } from \"@nexface/agent\";\nimport type { CSSProperties } from \"react\";\nexport type ChatRunResult = Extract<AgentRunResult, { outcome: { type: \"success\" } }>;\n\nexport interface ChatSuggestion {\n readonly label: string;\n readonly prompt: string;\n}\n\nexport interface ChatProps {\n open?: boolean;\n onOpenChange?: (open: boolean) => void;\n showToolDetails?: boolean;\n onFullscreenChange?: (fullscreen: boolean) => void;\n avatar?: string;\n welcomeDescription?: string;\n side?: \"left\" | \"right\";\n className?: string;\n style?: CSSProperties;\n attachments?: false | ChatAttachmentOptions;\n title?: string;\n welcomeMessage?: string;\n placeholder?: string;\n layout?: \"floating\" | \"docked\" | \"inline\";\n suggestions?: readonly ChatSuggestion[];\n onRunResult?: (result: ChatRunResult) => void;\n}\n\nexport interface ChatAttachmentOptions {\n accept?: string;\n maxCount?: number;\n maxSizeBytes?: number;\n adapter?: {\n add(input: { id: string; file: File; signal: AbortSignal }): Promise<{ data?: unknown; preview?: string }>;\n send(input: { id: string; file: File; data?: unknown; signal: AbortSignal }): Promise<{\n content: readonly ({ type: \"text\"; text: string } | { type: \"image\"; source: { type: \"data\"; value: string; mimeType: string } })[];\n }>;\n remove?(input: { id: string; file: File; data?: unknown }): void | Promise<void>;\n };\n}\n\nexport type { AgentModelConfig, AgentModelInfo } from \"@nexface/agent\";\n"]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type PropsWithChildren, type FC } from "react";
|
|
2
|
+
export declare function AttachmentUI({ preview, children }: PropsWithChildren<{
|
|
3
|
+
preview?: string | undefined;
|
|
4
|
+
}>): import("react").JSX.Element;
|
|
5
|
+
export declare const UserMessageAttachments: FC;
|
|
6
|
+
export declare const ComposerAttachments: FC;
|
|
7
|
+
export declare const ComposerAddAttachment: FC;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useState, isValidElement, createContext, useContext, } from "react";
|
|
4
|
+
import { XIcon, PlusIcon, FileText, Loader2Icon, AlertCircleIcon, } from "lucide-react";
|
|
5
|
+
import { AttachmentPrimitive, ComposerPrimitive, MessagePrimitive, useAuiState, useAui, } from "@assistant-ui/react";
|
|
6
|
+
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, } from "./tooltip.js";
|
|
7
|
+
import { Dialog, DialogTitle, DialogContent, DialogTrigger, } from "./dialog.js";
|
|
8
|
+
import { Avatar, AvatarFallback, } from "./avatar.js";
|
|
9
|
+
import { TooltipIconButton } from "./tooltip-icon-button.js";
|
|
10
|
+
import { useAttachmentSrc } from "./use-attachment-src.js";
|
|
11
|
+
import { cn } from "./utils.js";
|
|
12
|
+
const PreviewContext = createContext(undefined);
|
|
13
|
+
const usePreview = () => { const fallback = useAttachmentSrc(); return useContext(PreviewContext) ?? fallback; };
|
|
14
|
+
const AttachmentPreview = ({ src }) => {
|
|
15
|
+
const [isLoaded, setIsLoaded] = useState(false);
|
|
16
|
+
return (_jsx("img", { src: src, alt: "\u9644\u4EF6\u9884\u89C8", className: cn("block h-auto max-h-[80vh] w-auto max-w-full rounded-sm object-contain transition-opacity duration-300 motion-reduce:transition-none", isLoaded
|
|
17
|
+
? "aui-attachment-preview-image-loaded opacity-100"
|
|
18
|
+
: "aui-attachment-preview-image-loading opacity-0"), onLoad: () => setIsLoaded(true) }));
|
|
19
|
+
};
|
|
20
|
+
const AttachmentPreviewDialog = ({ children }) => {
|
|
21
|
+
const src = usePreview();
|
|
22
|
+
if (!src)
|
|
23
|
+
return children;
|
|
24
|
+
return (_jsxs(Dialog, { children: [_jsx(DialogTrigger, { className: cn("aui-attachment-preview-trigger cursor-zoom-in"), asChild: true, children: isValidElement(children) ? (children) : (_jsx("button", { type: "button", children: children })) }), _jsxs(DialogContent, { className: cn("aui-attachment-preview-dialog-content [&>button]:bg-foreground/60 [&>button]:hover:bg-foreground/80 [&_svg]:text-background p-2 sm:max-w-3xl [&>button]:rounded-full [&>button]:p-1 [&>button]:opacity-100 [&>button]:ring-0!"), children: [_jsx(DialogTitle, { className: cn("aui-sr-only sr-only"), children: "\u56FE\u7247\u9644\u4EF6\u9884\u89C8" }), _jsx("div", { className: cn("aui-attachment-preview bg-background relative mx-auto flex max-h-[80dvh] w-full items-center justify-center overflow-hidden rounded-sm"), children: _jsx(AttachmentPreview, { src: src }) })] })] }));
|
|
25
|
+
};
|
|
26
|
+
const AttachmentThumb = () => {
|
|
27
|
+
const src = usePreview();
|
|
28
|
+
const name = useAuiState((s) => s.attachment.name);
|
|
29
|
+
return _jsx(Avatar, { className: cn("aui-attachment-tile-avatar h-full w-full rounded-none"), children: src ? _jsx("img", { src: src, alt: name, className: cn("aui-attachment-tile-image h-full w-full rounded-none object-cover") }) : _jsx(AvatarFallback, { children: _jsx(FileText, { className: cn("aui-attachment-tile-fallback-icon text-muted-foreground/80 size-6 stroke-[1.5]") }) }) });
|
|
30
|
+
};
|
|
31
|
+
export function AttachmentUI({ preview, children }) {
|
|
32
|
+
return _jsx(PreviewContext.Provider, { value: preview, children: _jsx(AttachmentContent, { children: children }) });
|
|
33
|
+
}
|
|
34
|
+
const AttachmentContent = ({ children }) => {
|
|
35
|
+
const aui = useAui();
|
|
36
|
+
const isComposer = aui.attachment.source !== "message";
|
|
37
|
+
const isImage = useAuiState((s) => s.attachment.type === "image");
|
|
38
|
+
const typeLabel = useAuiState((s) => {
|
|
39
|
+
const type = s.attachment.type;
|
|
40
|
+
switch (type) {
|
|
41
|
+
case "image":
|
|
42
|
+
return "图片";
|
|
43
|
+
case "document":
|
|
44
|
+
return "文档";
|
|
45
|
+
case "file":
|
|
46
|
+
return "文件";
|
|
47
|
+
default:
|
|
48
|
+
return type;
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
const uploadState = useAuiState((s) => s.attachment.status.type === "running"
|
|
52
|
+
? "uploading"
|
|
53
|
+
: s.attachment.status.type === "incomplete" &&
|
|
54
|
+
s.attachment.status.reason === "error"
|
|
55
|
+
? "error"
|
|
56
|
+
: undefined);
|
|
57
|
+
const isUploading = uploadState === "uploading";
|
|
58
|
+
const isError = uploadState === "error";
|
|
59
|
+
const errorMessage = useAuiState((s) => s.attachment.status.type === "incomplete" &&
|
|
60
|
+
s.attachment.status.reason === "error"
|
|
61
|
+
? (s.attachment.status.message ?? "附件处理失败")
|
|
62
|
+
: undefined);
|
|
63
|
+
return (_jsx(TooltipProvider, { children: _jsxs(Tooltip, { children: [_jsxs(AttachmentPrimitive.Root, { className: cn("aui-attachment-root relative", isComposer &&
|
|
64
|
+
"animate-in fade-in-0 zoom-in-95 duration-200 motion-reduce:animate-none", isImage &&
|
|
65
|
+
!isComposer &&
|
|
66
|
+
"aui-attachment-root-message only:*:first:size-24"), children: [_jsx(AttachmentPreviewDialog, { children: _jsx(TooltipTrigger, { asChild: true, children: _jsxs("div", { className: cn("aui-attachment-tile bg-muted hover:after:bg-foreground/10 focus-visible:ring-ring/50 relative size-14 cursor-pointer overflow-hidden rounded-[calc(var(--nxf-composer-radius,1rem)-var(--nxf-composer-padding,8px))] transition-transform outline-none after:pointer-events-none after:absolute after:inset-0 after:rounded-[inherit] after:ring-1 after:ring-black/10 after:transition-colors after:ring-inset focus-visible:ring-1 active:scale-[0.96] motion-reduce:transition-none dark:after:ring-white/10", isError &&
|
|
67
|
+
"after:ring-destructive/60 dark:after:ring-destructive/60"), role: "button", tabIndex: 0, onKeyDown: (e) => {
|
|
68
|
+
if (e.key === "Enter") {
|
|
69
|
+
e.preventDefault();
|
|
70
|
+
e.currentTarget.click();
|
|
71
|
+
}
|
|
72
|
+
else if (e.key === " ") {
|
|
73
|
+
e.preventDefault();
|
|
74
|
+
}
|
|
75
|
+
}, onKeyUp: (e) => {
|
|
76
|
+
if (e.key === " ")
|
|
77
|
+
e.currentTarget.click();
|
|
78
|
+
}, "aria-label": `${typeLabel}附件${isError ? ",处理失败" : isUploading ? ",正在处理" : ""}`, children: [_jsx(AttachmentThumb, {}), isUploading && (_jsx("div", { "aria-hidden": "true", className: cn("aui-attachment-tile-uploading bg-background/60 animate-in fade-in-0 absolute inset-0 flex items-center justify-center backdrop-blur-[2px] motion-reduce:animate-none"), children: _jsx(Loader2Icon, { className: cn("text-muted-foreground size-4 animate-spin") }) })), isError && (_jsx("div", { "aria-hidden": "true", className: cn("aui-attachment-tile-error bg-background/70 animate-in fade-in-0 absolute inset-0 flex items-center justify-center backdrop-blur-[2px] motion-reduce:animate-none"), children: _jsx(AlertCircleIcon, { className: cn("text-destructive size-4") }) }))] }) }) }), isComposer && _jsx(AttachmentRemove, {}), children] }), _jsxs(TooltipContent, { side: "top", children: [_jsx(AttachmentPrimitive.Name, {}), errorMessage && (_jsx("p", { className: cn("aui-attachment-error-message"), children: errorMessage }))] })] }) }));
|
|
79
|
+
};
|
|
80
|
+
const AttachmentRemove = () => {
|
|
81
|
+
const name = useAuiState((s) => s.attachment.name);
|
|
82
|
+
return (_jsx(AttachmentPrimitive.Remove, { asChild: true, children: _jsx(TooltipIconButton, { tooltip: "\u79FB\u9664\u9644\u4EF6", "aria-label": `移除 ${name}`, className: cn("aui-attachment-tile-remove absolute end-1 top-1 size-5 rounded-full bg-black/50! text-white after:absolute after:-inset-1.5 hover:bg-black/70! hover:text-white! active:scale-[0.96] motion-reduce:transition-none"), side: "top", children: _jsx(XIcon, { className: cn("aui-attachment-remove-icon size-3 stroke-[2.5]") }) }) }));
|
|
83
|
+
};
|
|
84
|
+
export const UserMessageAttachments = () => {
|
|
85
|
+
return (_jsx("div", { className: cn("aui-user-message-attachments-end col-span-full col-start-1 row-start-1 flex w-full flex-row justify-end gap-2"), children: _jsx(MessagePrimitive.Attachments, { children: () => _jsx(AttachmentUI, {}) }) }));
|
|
86
|
+
};
|
|
87
|
+
export const ComposerAttachments = () => {
|
|
88
|
+
return (_jsx("div", { className: cn("aui-composer-attachments flex w-full flex-row items-center gap-2 overflow-x-auto empty:hidden"), children: _jsx(ComposerPrimitive.Attachments, { children: () => _jsx(AttachmentUI, {}) }) }));
|
|
89
|
+
};
|
|
90
|
+
export const ComposerAddAttachment = () => {
|
|
91
|
+
return (_jsx(ComposerPrimitive.AddAttachment, { asChild: true, children: _jsx(TooltipIconButton, { tooltip: "\u6DFB\u52A0\u9644\u4EF6", side: "bottom", variant: "ghost", size: "icon", className: cn("aui-composer-add-attachment text-muted-foreground hover:text-foreground hover:bg-muted-foreground/15 dark:border-muted-foreground/15 dark:hover:bg-muted-foreground/30 size-7 rounded-full active:scale-[0.96] motion-reduce:transition-none"), "aria-label": "\u6DFB\u52A0\u9644\u4EF6", children: _jsx(PlusIcon, { className: cn("aui-attachment-add-icon size-4") }) }) }));
|
|
92
|
+
};
|
|
93
|
+
//# sourceMappingURL=attachment.aui.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attachment.aui.js","sourceRoot":"","sources":["../../src/ui/attachment.aui.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AACb,OAAO,E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AAC,MAAM,sBAAsB,GAAO,GAAG,EAAE;IAC7C,OAAO,CAAC,cAAK,SAAS,EAAE,EAAE,CAAC,+GAA+G,CAAC,YAC1I,KAAC,gBAAgB,CAAC,WAAW,cAC3B,GAAG,EAAE,CAAC,KAAC,YAAY,KAAG,GACO,GAC1B,CAAC,CAAC;AACV,CAAC,CAAC;AACF,MAAM,CAAC,MAAM,mBAAmB,GAAO,GAAG,EAAE;IAC1C,OAAO,CAAC,cAAK,SAAS,EAAE,EAAE,CAAC,+FAA+F,CAAC,YAC1H,KAAC,iBAAiB,CAAC,WAAW,cAC5B,GAAG,EAAE,CAAC,KAAC,YAAY,KAAG,GACQ,GAC3B,CAAC,CAAC;AACV,CAAC,CAAC;AACF,MAAM,CAAC,MAAM,qBAAqB,GAAO,GAAG,EAAE;IAC5C,OAAO,CAAC,KAAC,iBAAiB,CAAC,aAAa,IAAC,OAAO,kBAC/C,KAAC,iBAAiB,IAAC,OAAO,EAAC,0BAAM,EAAC,IAAI,EAAC,QAAQ,EAAC,OAAO,EAAC,OAAO,EAAC,IAAI,EAAC,MAAM,EAAC,SAAS,EAAE,EAAE,CAAC,8OAA8O,CAAC,gBAAa,0BAAM,YAC3V,KAAC,QAAQ,IAAC,SAAS,EAAE,EAAE,CAAC,gCAAgC,CAAC,GAAG,GACzC,GACa,CAAC,CAAC;AACtC,CAAC,CAAC","sourcesContent":["\"use client\";\nimport { type PropsWithChildren, useState, type FC, isValidElement, createContext, useContext, } from \"react\";\nimport { XIcon, PlusIcon, FileText, Loader2Icon, AlertCircleIcon, } from \"lucide-react\";\nimport { AttachmentPrimitive, ComposerPrimitive, MessagePrimitive, useAuiState, useAui, } from \"@assistant-ui/react\";\nimport { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, } from \"./tooltip.js\";\nimport { Dialog, DialogTitle, DialogContent, DialogTrigger, } from \"./dialog.js\";\nimport { Avatar, AvatarImage, AvatarFallback, } from \"./avatar.js\";\nimport { TooltipIconButton } from \"./tooltip-icon-button.js\";\nimport { useAttachmentSrc } from \"./use-attachment-src.js\";\nimport { cn } from \"./utils.js\";\nconst PreviewContext = createContext<string | undefined>(undefined);\nconst usePreview = () => { const fallback = useAttachmentSrc(); return useContext(PreviewContext) ?? fallback; };\ntype AttachmentPreviewProps = {\n src: string;\n};\nconst AttachmentPreview: FC<AttachmentPreviewProps> = ({ src }) => {\n const [isLoaded, setIsLoaded] = useState(false);\n return (<img src={src} alt=\"附件预览\" className={cn(\"block h-auto max-h-[80vh] w-auto max-w-full rounded-sm object-contain transition-opacity duration-300 motion-reduce:transition-none\", isLoaded\n ? \"aui-attachment-preview-image-loaded opacity-100\"\n : \"aui-attachment-preview-image-loading opacity-0\")} onLoad={() => setIsLoaded(true)}/>);\n};\nconst AttachmentPreviewDialog: FC<PropsWithChildren> = ({ children }) => {\n const src = usePreview();\n if (!src)\n return children;\n return (<Dialog>\n <DialogTrigger className={cn(\"aui-attachment-preview-trigger cursor-zoom-in\")} asChild>\n {isValidElement(children) ? (children) : (<button type=\"button\">{children}</button>)}\n </DialogTrigger>\n <DialogContent className={cn(\"aui-attachment-preview-dialog-content [&>button]:bg-foreground/60 [&>button]:hover:bg-foreground/80 [&_svg]:text-background p-2 sm:max-w-3xl [&>button]:rounded-full [&>button]:p-1 [&>button]:opacity-100 [&>button]:ring-0!\")}>\n <DialogTitle className={cn(\"aui-sr-only sr-only\")}>\n 图片附件预览\n </DialogTitle>\n <div className={cn(\"aui-attachment-preview bg-background relative mx-auto flex max-h-[80dvh] w-full items-center justify-center overflow-hidden rounded-sm\")}>\n <AttachmentPreview src={src}/>\n </div>\n </DialogContent>\n </Dialog>);\n};\nconst AttachmentThumb: FC = () => {\n const src = usePreview();\n const name = useAuiState((s) => s.attachment.name);\n return <Avatar className={cn(\"aui-attachment-tile-avatar h-full w-full rounded-none\")}>\n {src ? <img src={src} alt={name} className={cn(\"aui-attachment-tile-image h-full w-full rounded-none object-cover\")}/> : <AvatarFallback><FileText className={cn(\"aui-attachment-tile-fallback-icon text-muted-foreground/80 size-6 stroke-[1.5]\")}/></AvatarFallback>}\n </Avatar>;\n};\nexport function AttachmentUI({ preview, children }: PropsWithChildren<{\n preview?: string | undefined;\n}>) {\n return <PreviewContext.Provider value={preview}><AttachmentContent>{children}</AttachmentContent></PreviewContext.Provider>;\n}\nconst AttachmentContent: FC<PropsWithChildren> = ({ children }) => {\n const aui = useAui();\n const isComposer = aui.attachment.source !== \"message\";\n const isImage = useAuiState((s) => s.attachment.type === \"image\");\n const typeLabel = useAuiState((s) => {\n const type = s.attachment.type;\n switch (type) {\n case \"image\":\n return \"图片\";\n case \"document\":\n return \"文档\";\n case \"file\":\n return \"文件\";\n default:\n return type;\n }\n });\n const uploadState = useAuiState((s) => s.attachment.status.type === \"running\"\n ? \"uploading\"\n : s.attachment.status.type === \"incomplete\" &&\n s.attachment.status.reason === \"error\"\n ? \"error\"\n : undefined);\n const isUploading = uploadState === \"uploading\";\n const isError = uploadState === \"error\";\n const errorMessage = useAuiState((s) => s.attachment.status.type === \"incomplete\" &&\n s.attachment.status.reason === \"error\"\n ? (s.attachment.status.message ?? \"附件处理失败\")\n : undefined);\n return (<TooltipProvider>\n <Tooltip>\n <AttachmentPrimitive.Root className={cn(\"aui-attachment-root relative\", isComposer &&\n \"animate-in fade-in-0 zoom-in-95 duration-200 motion-reduce:animate-none\", isImage &&\n !isComposer &&\n \"aui-attachment-root-message only:*:first:size-24\")}>\n <AttachmentPreviewDialog>\n <TooltipTrigger asChild>\n <div className={cn(\"aui-attachment-tile bg-muted hover:after:bg-foreground/10 focus-visible:ring-ring/50 relative size-14 cursor-pointer overflow-hidden rounded-[calc(var(--nxf-composer-radius,1rem)-var(--nxf-composer-padding,8px))] transition-transform outline-none after:pointer-events-none after:absolute after:inset-0 after:rounded-[inherit] after:ring-1 after:ring-black/10 after:transition-colors after:ring-inset focus-visible:ring-1 active:scale-[0.96] motion-reduce:transition-none dark:after:ring-white/10\", isError &&\n \"after:ring-destructive/60 dark:after:ring-destructive/60\")} role=\"button\" tabIndex={0} onKeyDown={(e) => {\n if (e.key === \"Enter\") {\n e.preventDefault();\n e.currentTarget.click();\n }\n else if (e.key === \" \") {\n e.preventDefault();\n }\n }} onKeyUp={(e) => {\n if (e.key === \" \")\n e.currentTarget.click();\n }} aria-label={`${typeLabel}附件${isError ? \",处理失败\" : isUploading ? \",正在处理\" : \"\"}`}>\n <AttachmentThumb />\n {isUploading && (<div aria-hidden=\"true\" className={cn(\"aui-attachment-tile-uploading bg-background/60 animate-in fade-in-0 absolute inset-0 flex items-center justify-center backdrop-blur-[2px] motion-reduce:animate-none\")}>\n <Loader2Icon className={cn(\"text-muted-foreground size-4 animate-spin\")}/>\n </div>)}\n {isError && (<div aria-hidden=\"true\" className={cn(\"aui-attachment-tile-error bg-background/70 animate-in fade-in-0 absolute inset-0 flex items-center justify-center backdrop-blur-[2px] motion-reduce:animate-none\")}>\n <AlertCircleIcon className={cn(\"text-destructive size-4\")}/>\n </div>)}\n </div>\n </TooltipTrigger>\n </AttachmentPreviewDialog>\n {isComposer && <AttachmentRemove />}\n {children}\n </AttachmentPrimitive.Root>\n <TooltipContent side=\"top\">\n <AttachmentPrimitive.Name />\n {errorMessage && (<p className={cn(\"aui-attachment-error-message\")}>{errorMessage}</p>)}\n </TooltipContent>\n </Tooltip>\n </TooltipProvider>);\n};\nconst AttachmentRemove: FC = () => {\n const name = useAuiState((s) => s.attachment.name);\n return (<AttachmentPrimitive.Remove asChild>\n <TooltipIconButton tooltip=\"移除附件\" aria-label={`移除 ${name}`} className={cn(\"aui-attachment-tile-remove absolute end-1 top-1 size-5 rounded-full bg-black/50! text-white after:absolute after:-inset-1.5 hover:bg-black/70! hover:text-white! active:scale-[0.96] motion-reduce:transition-none\")} side=\"top\">\n <XIcon className={cn(\"aui-attachment-remove-icon size-3 stroke-[2.5]\")}/>\n </TooltipIconButton>\n </AttachmentPrimitive.Remove>);\n};\nexport const UserMessageAttachments: FC = () => {\n return (<div className={cn(\"aui-user-message-attachments-end col-span-full col-start-1 row-start-1 flex w-full flex-row justify-end gap-2\")}>\n <MessagePrimitive.Attachments>\n {() => <AttachmentUI />}\n </MessagePrimitive.Attachments>\n </div>);\n};\nexport const ComposerAttachments: FC = () => {\n return (<div className={cn(\"aui-composer-attachments flex w-full flex-row items-center gap-2 overflow-x-auto empty:hidden\")}>\n <ComposerPrimitive.Attachments>\n {() => <AttachmentUI />}\n </ComposerPrimitive.Attachments>\n </div>);\n};\nexport const ComposerAddAttachment: FC = () => {\n return (<ComposerPrimitive.AddAttachment asChild>\n <TooltipIconButton tooltip=\"添加附件\" side=\"bottom\" variant=\"ghost\" size=\"icon\" className={cn(\"aui-composer-add-attachment text-muted-foreground hover:text-foreground hover:bg-muted-foreground/15 dark:border-muted-foreground/15 dark:hover:bg-muted-foreground/30 size-7 rounded-full active:scale-[0.96] motion-reduce:transition-none\")} aria-label=\"添加附件\">\n <PlusIcon className={cn(\"aui-attachment-add-icon size-4\")}/>\n </TooltipIconButton>\n </ComposerPrimitive.AddAttachment>);\n};\n"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { Avatar as AvatarPrimitive } from "radix-ui";
|
|
3
|
+
declare function Avatar({ className, size, ...props }: React.ComponentProps<typeof AvatarPrimitive.Root> & {
|
|
4
|
+
size?: "default" | "sm" | "lg";
|
|
5
|
+
}): React.JSX.Element;
|
|
6
|
+
declare function AvatarImage({ className, ...props }: React.ComponentProps<typeof AvatarPrimitive.Image>): React.JSX.Element;
|
|
7
|
+
declare function AvatarFallback({ className, ...props }: React.ComponentProps<typeof AvatarPrimitive.Fallback>): React.JSX.Element;
|
|
8
|
+
declare function AvatarBadge({ className, ...props }: React.ComponentProps<"span">): React.JSX.Element;
|
|
9
|
+
declare function AvatarGroup({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
10
|
+
declare function AvatarGroupCount({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
11
|
+
export { Avatar, AvatarImage, AvatarFallback, AvatarBadge, AvatarGroup, AvatarGroupCount, };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { cn } from "./utils.js";
|
|
4
|
+
import { Avatar as AvatarPrimitive } from "radix-ui";
|
|
5
|
+
function Avatar({ className, size = "default", ...props }) {
|
|
6
|
+
return (_jsx(AvatarPrimitive.Root, { "data-slot": "avatar", "data-size": size, className: cn("group/avatar relative flex size-8 shrink-0 overflow-hidden rounded-full select-none data-[size=lg]:size-10 data-[size=sm]:size-6", className), ...props }));
|
|
7
|
+
}
|
|
8
|
+
function AvatarImage({ className, ...props }) {
|
|
9
|
+
return (_jsx(AvatarPrimitive.Image, { "data-slot": "avatar-image", className: cn("aspect-square size-full", className), ...props }));
|
|
10
|
+
}
|
|
11
|
+
function AvatarFallback({ className, ...props }) {
|
|
12
|
+
return (_jsx(AvatarPrimitive.Fallback, { "data-slot": "avatar-fallback", className: cn("flex size-full items-center justify-center rounded-full bg-muted text-sm text-muted-foreground group-data-[size=sm]/avatar:text-xs", className), ...props }));
|
|
13
|
+
}
|
|
14
|
+
function AvatarBadge({ className, ...props }) {
|
|
15
|
+
return (_jsx("span", { "data-slot": "avatar-badge", className: cn("absolute right-0 bottom-0 z-10 inline-flex items-center justify-center rounded-full bg-primary text-primary-foreground ring-2 ring-background select-none", "group-data-[size=sm]/avatar:size-2 group-data-[size=sm]/avatar:[&>svg]:hidden", "group-data-[size=default]/avatar:size-2.5 group-data-[size=default]/avatar:[&>svg]:size-2", "group-data-[size=lg]/avatar:size-3 group-data-[size=lg]/avatar:[&>svg]:size-2", className), ...props }));
|
|
16
|
+
}
|
|
17
|
+
function AvatarGroup({ className, ...props }) {
|
|
18
|
+
return (_jsx("div", { "data-slot": "avatar-group", className: cn("group/avatar-group flex -space-x-2 *:data-[slot=avatar]:ring-2 *:data-[slot=avatar]:ring-background", className), ...props }));
|
|
19
|
+
}
|
|
20
|
+
function AvatarGroupCount({ className, ...props }) {
|
|
21
|
+
return (_jsx("div", { "data-slot": "avatar-group-count", className: cn("relative flex size-8 shrink-0 items-center justify-center rounded-full bg-muted text-sm text-muted-foreground ring-2 ring-background group-has-data-[size=lg]/avatar-group:size-10 group-has-data-[size=sm]/avatar-group:size-6 [&>svg]:size-4 group-has-data-[size=lg]/avatar-group:[&>svg]:size-5 group-has-data-[size=sm]/avatar-group:[&>svg]:size-3", className), ...props }));
|
|
22
|
+
}
|
|
23
|
+
export { Avatar, AvatarImage, AvatarFallback, AvatarBadge, AvatarGroup, AvatarGroupCount, };
|
|
24
|
+
//# sourceMappingURL=avatar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"avatar.js","sourceRoot":"","sources":["../../src/ui/avatar.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,EAAE,EAAE,MAAM,YAAY,CAAC;AAChC,OAAO,EAAE,MAAM,IAAI,eAAe,EAAE,MAAM,UAAU,CAAC;AACrD,SAAS,MAAM,CAAC,EAAE,SAAS,EAAE,IAAI,GAAG,SAAS,EAAE,GAAG,KAAK,EAEtD;IACC,OAAO,CAAC,KAAC,eAAe,CAAC,IAAI,iBAAW,QAAQ,eAAY,IAAI,EAAE,SAAS,EAAE,EAAE,CAAC,kIAAkI,EAAE,SAAS,CAAC,KAAM,KAAK,GAAG,CAAC,CAAC;AAChP,CAAC;AACD,SAAS,WAAW,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAsD;IAC9F,OAAO,CAAC,KAAC,eAAe,CAAC,KAAK,iBAAW,cAAc,EAAC,SAAS,EAAE,EAAE,CAAC,yBAAyB,EAAE,SAAS,CAAC,KAAM,KAAK,GAAG,CAAC,CAAC;AAC7H,CAAC;AACD,SAAS,cAAc,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAyD;IACpG,OAAO,CAAC,KAAC,eAAe,CAAC,QAAQ,iBAAW,iBAAiB,EAAC,SAAS,EAAE,EAAE,CAAC,oIAAoI,EAAE,SAAS,CAAC,KAAM,KAAK,GAAG,CAAC,CAAC;AAC9O,CAAC;AACD,SAAS,WAAW,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAgC;IACxE,OAAO,CAAC,4BAAgB,cAAc,EAAC,SAAS,EAAE,EAAE,CAAC,2JAA2J,EAAE,+EAA+E,EAAE,2FAA2F,EAAE,+EAA+E,EAAE,SAAS,CAAC,KAAM,KAAK,GAAG,CAAC,CAAC;AAC7e,CAAC;AACD,SAAS,WAAW,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAA+B;IACvE,OAAO,CAAC,2BAAe,cAAc,EAAC,SAAS,EAAE,EAAE,CAAC,qGAAqG,EAAE,SAAS,CAAC,KAAM,KAAK,GAAG,CAAC,CAAC;AACvL,CAAC;AACD,SAAS,gBAAgB,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAA+B;IAC5E,OAAO,CAAC,2BAAe,oBAAoB,EAAC,SAAS,EAAE,EAAE,CAAC,0VAA0V,EAAE,SAAS,CAAC,KAAM,KAAK,GAAG,CAAC,CAAC;AAClb,CAAC;AACD,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,cAAc,EAAE,WAAW,EAAE,WAAW,EAAE,gBAAgB,GAAG,CAAC","sourcesContent":["\"use client\";\nimport * as React from \"react\";\nimport { cn } from \"./utils.js\";\nimport { Avatar as AvatarPrimitive } from \"radix-ui\";\nfunction Avatar({ className, size = \"default\", ...props }: React.ComponentProps<typeof AvatarPrimitive.Root> & {\n size?: \"default\" | \"sm\" | \"lg\";\n}) {\n return (<AvatarPrimitive.Root data-slot=\"avatar\" data-size={size} className={cn(\"group/avatar relative flex size-8 shrink-0 overflow-hidden rounded-full select-none data-[size=lg]:size-10 data-[size=sm]:size-6\", className)} {...props}/>);\n}\nfunction AvatarImage({ className, ...props }: React.ComponentProps<typeof AvatarPrimitive.Image>) {\n return (<AvatarPrimitive.Image data-slot=\"avatar-image\" className={cn(\"aspect-square size-full\", className)} {...props}/>);\n}\nfunction AvatarFallback({ className, ...props }: React.ComponentProps<typeof AvatarPrimitive.Fallback>) {\n return (<AvatarPrimitive.Fallback data-slot=\"avatar-fallback\" className={cn(\"flex size-full items-center justify-center rounded-full bg-muted text-sm text-muted-foreground group-data-[size=sm]/avatar:text-xs\", className)} {...props}/>);\n}\nfunction AvatarBadge({ className, ...props }: React.ComponentProps<\"span\">) {\n return (<span data-slot=\"avatar-badge\" className={cn(\"absolute right-0 bottom-0 z-10 inline-flex items-center justify-center rounded-full bg-primary text-primary-foreground ring-2 ring-background select-none\", \"group-data-[size=sm]/avatar:size-2 group-data-[size=sm]/avatar:[&>svg]:hidden\", \"group-data-[size=default]/avatar:size-2.5 group-data-[size=default]/avatar:[&>svg]:size-2\", \"group-data-[size=lg]/avatar:size-3 group-data-[size=lg]/avatar:[&>svg]:size-2\", className)} {...props}/>);\n}\nfunction AvatarGroup({ className, ...props }: React.ComponentProps<\"div\">) {\n return (<div data-slot=\"avatar-group\" className={cn(\"group/avatar-group flex -space-x-2 *:data-[slot=avatar]:ring-2 *:data-[slot=avatar]:ring-background\", className)} {...props}/>);\n}\nfunction AvatarGroupCount({ className, ...props }: React.ComponentProps<\"div\">) {\n return (<div data-slot=\"avatar-group-count\" className={cn(\"relative flex size-8 shrink-0 items-center justify-center rounded-full bg-muted text-sm text-muted-foreground ring-2 ring-background group-has-data-[size=lg]/avatar-group:size-10 group-has-data-[size=sm]/avatar-group:size-6 [&>svg]:size-4 group-has-data-[size=lg]/avatar-group:[&>svg]:size-5 group-has-data-[size=sm]/avatar-group:[&>svg]:size-3\", className)} {...props}/>);\n}\nexport { Avatar, AvatarImage, AvatarFallback, AvatarBadge, AvatarGroup, AvatarGroupCount, };\n"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { type VariantProps } from "class-variance-authority";
|
|
3
|
+
declare const buttonVariants: (props?: ({
|
|
4
|
+
variant?: "link" | "default" | "destructive" | "outline" | "secondary" | "ghost" | null | undefined;
|
|
5
|
+
size?: "default" | "icon" | "xs" | "sm" | "lg" | "icon-xs" | "icon-sm" | "icon-lg" | null | undefined;
|
|
6
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
7
|
+
declare const Button: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & VariantProps<(props?: ({
|
|
8
|
+
variant?: "link" | "default" | "destructive" | "outline" | "secondary" | "ghost" | null | undefined;
|
|
9
|
+
size?: "default" | "icon" | "xs" | "sm" | "lg" | "icon-xs" | "icon-sm" | "icon-lg" | null | undefined;
|
|
10
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string> & {
|
|
11
|
+
asChild?: boolean;
|
|
12
|
+
} & React.RefAttributes<HTMLButtonElement>>;
|
|
13
|
+
export { Button, buttonVariants };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { cva } from "class-variance-authority";
|
|
5
|
+
import { cn } from "./utils.js";
|
|
6
|
+
import { Slot } from "radix-ui";
|
|
7
|
+
const buttonVariants = cva("inline-flex shrink-0 items-center justify-center gap-2 rounded-md text-sm font-medium whitespace-nowrap transition-all outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", {
|
|
8
|
+
variants: {
|
|
9
|
+
variant: {
|
|
10
|
+
default: "bg-primary text-primary-foreground hover:bg-primary/90",
|
|
11
|
+
destructive: "bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:bg-destructive/60 dark:focus-visible:ring-destructive/40",
|
|
12
|
+
outline: "border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",
|
|
13
|
+
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
|
14
|
+
ghost: "hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
|
|
15
|
+
link: "text-primary underline-offset-4 hover:underline",
|
|
16
|
+
},
|
|
17
|
+
size: {
|
|
18
|
+
default: "h-9 px-4 py-2 has-[>svg]:px-3",
|
|
19
|
+
xs: "h-6 gap-1 rounded-md px-2 text-xs has-[>svg]:px-1.5 [&_svg:not([class*='size-'])]:size-3",
|
|
20
|
+
sm: "h-8 gap-1.5 rounded-md px-3 has-[>svg]:px-2.5",
|
|
21
|
+
lg: "h-10 rounded-md px-6 has-[>svg]:px-4",
|
|
22
|
+
icon: "size-9",
|
|
23
|
+
"icon-xs": "size-6 rounded-md [&_svg:not([class*='size-'])]:size-3",
|
|
24
|
+
"icon-sm": "size-8",
|
|
25
|
+
"icon-lg": "size-10",
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
defaultVariants: {
|
|
29
|
+
variant: "default",
|
|
30
|
+
size: "default",
|
|
31
|
+
},
|
|
32
|
+
});
|
|
33
|
+
const Button = React.forwardRef(function Button({ className, variant = "default", size = "default", asChild = false, ...props }, ref) {
|
|
34
|
+
const Comp = asChild ? Slot.Root : "button";
|
|
35
|
+
return (_jsx(Comp, { ref: ref, "data-slot": "button", "data-variant": variant, "data-size": size, className: cn(buttonVariants({ variant, size, className })), ...props }));
|
|
36
|
+
});
|
|
37
|
+
export { Button, buttonVariants };
|
|
38
|
+
//# sourceMappingURL=button.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"button.js","sourceRoot":"","sources":["../../src/ui/button.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AACb,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/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AAC,CAAC,CAAC;AACH,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,CAAC","sourcesContent":["\"use client\";\nimport * as React from \"react\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport { cn } from \"./utils.js\";\nimport { Slot } from \"radix-ui\";\nconst buttonVariants = cva(\"inline-flex shrink-0 items-center justify-center gap-2 rounded-md text-sm font-medium whitespace-nowrap transition-all outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\", {\n variants: {\n variant: {\n default: \"bg-primary text-primary-foreground hover:bg-primary/90\",\n destructive: \"bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:bg-destructive/60 dark:focus-visible:ring-destructive/40\",\n outline: \"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50\",\n secondary: \"bg-secondary text-secondary-foreground hover:bg-secondary/80\",\n ghost: \"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50\",\n link: \"text-primary underline-offset-4 hover:underline\",\n },\n size: {\n default: \"h-9 px-4 py-2 has-[>svg]:px-3\",\n xs: \"h-6 gap-1 rounded-md px-2 text-xs has-[>svg]:px-1.5 [&_svg:not([class*='size-'])]:size-3\",\n sm: \"h-8 gap-1.5 rounded-md px-3 has-[>svg]:px-2.5\",\n lg: \"h-10 rounded-md px-6 has-[>svg]:px-4\",\n icon: \"size-9\",\n \"icon-xs\": \"size-6 rounded-md [&_svg:not([class*='size-'])]:size-3\",\n \"icon-sm\": \"size-8\",\n \"icon-lg\": \"size-10\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n size: \"default\",\n },\n});\nconst Button = React.forwardRef<HTMLButtonElement, React.ComponentPropsWithoutRef<\"button\"> & VariantProps<typeof buttonVariants> & {\n asChild?: boolean;\n}>(function Button({ className, variant = \"default\", size = \"default\", asChild = false, ...props }, ref) {\n const Comp = asChild ? Slot.Root : \"button\";\n return (<Comp ref={ref} data-slot=\"button\" data-variant={variant} data-size={size} className={cn(buttonVariants({ variant, size, className }))} {...props}/>);\n});\nexport { Button, buttonVariants };\n"]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { Dialog as DialogPrimitive } from "radix-ui";
|
|
3
|
+
declare function Dialog({ ...props }: React.ComponentProps<typeof DialogPrimitive.Root>): React.JSX.Element;
|
|
4
|
+
declare const DialogTrigger: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogTriggerProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
5
|
+
declare function DialogPortal({ ...props }: React.ComponentProps<typeof DialogPrimitive.Portal>): React.JSX.Element | null;
|
|
6
|
+
declare const DialogClose: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogCloseProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
7
|
+
declare function DialogOverlay({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Overlay>): React.JSX.Element;
|
|
8
|
+
declare function DialogContent({ className, children, showCloseButton, ...props }: React.ComponentProps<typeof DialogPrimitive.Content> & {
|
|
9
|
+
showCloseButton?: boolean;
|
|
10
|
+
}): React.JSX.Element;
|
|
11
|
+
declare function DialogHeader({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
12
|
+
declare function DialogFooter({ className, showCloseButton, children, ...props }: React.ComponentProps<"div"> & {
|
|
13
|
+
showCloseButton?: boolean;
|
|
14
|
+
}): React.JSX.Element;
|
|
15
|
+
declare function DialogTitle({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Title>): React.JSX.Element;
|
|
16
|
+
declare function DialogDescription({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Description>): React.JSX.Element;
|
|
17
|
+
export { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { usePortalContainer, PortalThemeSync } from "./surface.js";
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import { cn } from "./utils.js";
|
|
6
|
+
import { XIcon } from "lucide-react";
|
|
7
|
+
import { Dialog as DialogPrimitive } from "radix-ui";
|
|
8
|
+
import { Button } from "./button.js";
|
|
9
|
+
function Dialog({ ...props }) {
|
|
10
|
+
return _jsx(DialogPrimitive.Root, { "data-slot": "dialog", ...props });
|
|
11
|
+
}
|
|
12
|
+
const DialogTrigger = React.forwardRef(function DialogTrigger({ ...props }, ref) {
|
|
13
|
+
return _jsx(DialogPrimitive.Trigger, { "data-slot": "dialog-trigger", ref: ref, ...props });
|
|
14
|
+
});
|
|
15
|
+
function DialogPortal({ ...props }) {
|
|
16
|
+
const container = usePortalContainer();
|
|
17
|
+
if (!container)
|
|
18
|
+
return null;
|
|
19
|
+
return _jsx(DialogPrimitive.Portal, { container: container, "data-slot": "dialog-portal", ...props });
|
|
20
|
+
}
|
|
21
|
+
const DialogClose = React.forwardRef(function DialogClose({ ...props }, ref) {
|
|
22
|
+
return _jsx(DialogPrimitive.Close, { "data-slot": "dialog-close", ref: ref, ...props });
|
|
23
|
+
});
|
|
24
|
+
function DialogOverlay({ className, ...props }) {
|
|
25
|
+
return (_jsx(DialogPrimitive.Overlay, { "data-slot": "dialog-overlay", className: cn("fixed inset-0 z-50 bg-black/50 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0", className), ...props }));
|
|
26
|
+
}
|
|
27
|
+
function DialogContent({ className, children, showCloseButton = true, ...props }) {
|
|
28
|
+
return (_jsxs(DialogPortal, { "data-slot": "dialog-portal", children: [_jsx(DialogOverlay, {}), _jsxs(DialogPrimitive.Content, { "data-slot": "dialog-content", className: cn("fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border bg-background p-6 shadow-lg duration-200 outline-none data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 sm:max-w-lg", className), ...props, children: [_jsx(PortalThemeSync, {}), children, showCloseButton && (_jsxs(DialogPrimitive.Close, { "data-slot": "dialog-close", className: cn("absolute top-4 right-4 rounded-xs opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4"), children: [_jsx(XIcon, {}), _jsx("span", { className: cn("sr-only"), children: "Close" })] }))] })] }));
|
|
29
|
+
}
|
|
30
|
+
function DialogHeader({ className, ...props }) {
|
|
31
|
+
return (_jsx("div", { "data-slot": "dialog-header", className: cn("flex flex-col gap-2 text-center sm:text-left", className), ...props }));
|
|
32
|
+
}
|
|
33
|
+
function DialogFooter({ className, showCloseButton = false, children, ...props }) {
|
|
34
|
+
return (_jsxs("div", { "data-slot": "dialog-footer", className: cn("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end", className), ...props, children: [children, showCloseButton && (_jsx(DialogPrimitive.Close, { asChild: true, children: _jsx(Button, { variant: "outline", children: "Close" }) }))] }));
|
|
35
|
+
}
|
|
36
|
+
function DialogTitle({ className, ...props }) {
|
|
37
|
+
return (_jsx(DialogPrimitive.Title, { "data-slot": "dialog-title", className: cn("text-lg leading-none font-semibold", className), ...props }));
|
|
38
|
+
}
|
|
39
|
+
function DialogDescription({ className, ...props }) {
|
|
40
|
+
return (_jsx(DialogPrimitive.Description, { "data-slot": "dialog-description", className: cn("text-sm text-muted-foreground", className), ...props }));
|
|
41
|
+
}
|
|
42
|
+
export { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, };
|
|
43
|
+
//# sourceMappingURL=dialog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dialog.js","sourceRoot":"","sources":["../../src/ui/dialog.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AACb,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACnE,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,EAAE,EAAE,MAAM,YAAY,CAAC;AAChC,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AACrC,OAAO,EAAE,MAAM,IAAI,eAAe,EAAE,MAAM,UAAU,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,SAAS,MAAM,CAAC,EAAE,GAAG,KAAK,EAAqD;IAC7E,OAAO,KAAC,eAAe,CAAC,IAAI,iBAAW,QAAQ,KAAK,KAAK,GAAG,CAAC;AAC/D,CAAC;AACD,MAAM,aAAa,GAAG,KAAK,CAAC,UAAU,CAAoF,SAAS,aAAa,CAAC,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG;IAChK,OAAO,KAAC,eAAe,CAAC,OAAO,iBAAW,gBAAgB,EAAC,GAAG,EAAE,GAAG,KAAM,KAAK,GAAG,CAAC;AACpF,CAAC,CAAC,CAAC;AACH,SAAS,YAAY,CAAC,EAAE,GAAG,KAAK,EAAuD;IACrF,MAAM,SAAS,GAAG,kBAAkB,EAAE,CAAC;IACvC,IAAI,CAAC,SAAS;QACZ,OAAO,IAAI,CAAC;IACd,OAAO,KAAC,eAAe,CAAC,MAAM,IAAC,SAAS,EAAE,SAAS,eAAY,eAAe,K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Y,CAAC,EAAE,SAAS,EAAE,eAAe,GAAG,KAAK,EAAE,QAAQ,EAAE,GAAG,KAAK,EAE7E;IACC,OAAO,CAAC,4BAAe,eAAe,EAAC,SAAS,EAAE,EAAE,CAAC,wDAAwD,EAAE,SAAS,CAAC,KAAM,KAAK,aAClI,QAAQ,EACR,eAAe,IAAI,CAAC,KAAC,eAAe,CAAC,KAAK,IAAC,OAAO,kBACjD,KAAC,MAAM,IAAC,OAAO,EAAC,SAAS,sBAAe,GACjB,CAAC,IACrB,CAAC,CAAC;AACV,CAAC;AACD,SAAS,WAAW,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAsD;IAC9F,OAAO,CAAC,KAAC,eAAe,CAAC,KAAK,iBAAW,cAAc,EAAC,SAAS,EAAE,EAAE,CAAC,oCAAoC,EAAE,SAAS,CAAC,KAAM,KAAK,GAAG,CAAC,CAAC;AACxI,CAAC;AACD,SAAS,iBAAiB,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAA4D;IAC1G,OAAO,CAAC,KAAC,eAAe,CAAC,WAAW,iBAAW,oBAAoB,EAAC,SAAS,EAAE,EAAE,CAAC,+BAA+B,EAAE,SAAS,CAAC,KAAM,KAAK,GAAG,CAAC,CAAC;AAC/I,CAAC;AACD,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,aAAa,EAAE,iBAAiB,EAAE,YAAY,EAAE,YAAY,EAAE,aAAa,EAAE,YAAY,EAAE,WAAW,EAAE,aAAa,GAAG,CAAC","sourcesContent":["\"use client\";\nimport { usePortalContainer, PortalThemeSync } from \"./surface.js\";\nimport * as React from \"react\";\nimport { cn } from \"./utils.js\";\nimport { XIcon } from \"lucide-react\";\nimport { Dialog as DialogPrimitive } from \"radix-ui\";\nimport { Button } from \"./button.js\";\nfunction Dialog({ ...props }: React.ComponentProps<typeof DialogPrimitive.Root>) {\n return <DialogPrimitive.Root data-slot=\"dialog\" {...props}/>;\n}\nconst DialogTrigger = React.forwardRef<HTMLButtonElement, React.ComponentPropsWithoutRef<typeof DialogPrimitive.Trigger>>(function DialogTrigger({ ...props }, ref) {\n return <DialogPrimitive.Trigger data-slot=\"dialog-trigger\" ref={ref} {...props}/>;\n});\nfunction DialogPortal({ ...props }: React.ComponentProps<typeof DialogPrimitive.Portal>) {\n const container = usePortalContainer();\n if (!container)\n return null;\n return <DialogPrimitive.Portal container={container} data-slot=\"dialog-portal\" {...props}/>;\n}\nconst DialogClose = React.forwardRef<HTMLButtonElement, React.ComponentPropsWithoutRef<typeof DialogPrimitive.Close>>(function DialogClose({ ...props }, ref) {\n return <DialogPrimitive.Close data-slot=\"dialog-close\" ref={ref} {...props}/>;\n});\nfunction DialogOverlay({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Overlay>) {\n return (<DialogPrimitive.Overlay data-slot=\"dialog-overlay\" className={cn(\"fixed inset-0 z-50 bg-black/50 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0\", className)} {...props}/>);\n}\nfunction DialogContent({ className, children, showCloseButton = true, ...props }: React.ComponentProps<typeof DialogPrimitive.Content> & {\n showCloseButton?: boolean;\n}) {\n return (<DialogPortal data-slot=\"dialog-portal\">\n <DialogOverlay />\n <DialogPrimitive.Content data-slot=\"dialog-content\" className={cn(\"fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border bg-background p-6 shadow-lg duration-200 outline-none data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 sm:max-w-lg\", className)} {...props}>\n <PortalThemeSync />{children}\n {showCloseButton && (<DialogPrimitive.Close data-slot=\"dialog-close\" className={cn(\"absolute top-4 right-4 rounded-xs opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\")}>\n <XIcon />\n <span className={cn(\"sr-only\")}>Close</span>\n </DialogPrimitive.Close>)}\n </DialogPrimitive.Content>\n </DialogPortal>);\n}\nfunction DialogHeader({ className, ...props }: React.ComponentProps<\"div\">) {\n return (<div data-slot=\"dialog-header\" className={cn(\"flex flex-col gap-2 text-center sm:text-left\", className)} {...props}/>);\n}\nfunction DialogFooter({ className, showCloseButton = false, children, ...props }: React.ComponentProps<\"div\"> & {\n showCloseButton?: boolean;\n}) {\n return (<div data-slot=\"dialog-footer\" className={cn(\"flex flex-col-reverse gap-2 sm:flex-row sm:justify-end\", className)} {...props}>\n {children}\n {showCloseButton && (<DialogPrimitive.Close asChild>\n <Button variant=\"outline\">Close</Button>\n </DialogPrimitive.Close>)}\n </div>);\n}\nfunction DialogTitle({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Title>) {\n return (<DialogPrimitive.Title data-slot=\"dialog-title\" className={cn(\"text-lg leading-none font-semibold\", className)} {...props}/>);\n}\nfunction DialogDescription({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Description>) {\n return (<DialogPrimitive.Description data-slot=\"dialog-description\" className={cn(\"text-sm text-muted-foreground\", className)} {...props}/>);\n}\nexport { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, };\n"]}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { DropdownMenu as DropdownMenuPrimitive } from "radix-ui";
|
|
3
|
+
declare function DropdownMenu({ ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Root>): React.JSX.Element;
|
|
4
|
+
declare function DropdownMenuPortal({ ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Portal>): React.JSX.Element | null;
|
|
5
|
+
declare const DropdownMenuTrigger: React.ForwardRefExoticComponent<Omit<DropdownMenuPrimitive.DropdownMenuTriggerProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
6
|
+
declare function DropdownMenuContent({ children, className, sideOffset, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Content>): React.JSX.Element | null;
|
|
7
|
+
declare function DropdownMenuGroup({ ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Group>): React.JSX.Element;
|
|
8
|
+
declare function DropdownMenuItem({ className, inset, variant, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Item> & {
|
|
9
|
+
inset?: boolean;
|
|
10
|
+
variant?: "default" | "destructive";
|
|
11
|
+
}): React.JSX.Element;
|
|
12
|
+
declare function DropdownMenuCheckboxItem({ className, children, checked, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.CheckboxItem>): React.JSX.Element;
|
|
13
|
+
declare function DropdownMenuRadioGroup({ ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.RadioGroup>): React.JSX.Element;
|
|
14
|
+
declare function DropdownMenuRadioItem({ className, children, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.RadioItem>): React.JSX.Element;
|
|
15
|
+
declare function DropdownMenuLabel({ className, inset, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Label> & {
|
|
16
|
+
inset?: boolean;
|
|
17
|
+
}): React.JSX.Element;
|
|
18
|
+
declare function DropdownMenuSeparator({ className, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Separator>): React.JSX.Element;
|
|
19
|
+
declare function DropdownMenuShortcut({ className, ...props }: React.ComponentProps<"span">): React.JSX.Element;
|
|
20
|
+
declare function DropdownMenuSub({ ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Sub>): React.JSX.Element;
|
|
21
|
+
declare function DropdownMenuSubTrigger({ className, inset, children, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.SubTrigger> & {
|
|
22
|
+
inset?: boolean;
|
|
23
|
+
}): React.JSX.Element;
|
|
24
|
+
declare function DropdownMenuSubContent({ className, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.SubContent>): React.JSX.Element;
|
|
25
|
+
export { DropdownMenu, DropdownMenuPortal, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuGroup, DropdownMenuLabel, DropdownMenuItem, DropdownMenuCheckboxItem, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubTrigger, DropdownMenuSubContent, };
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { usePortalContainer, PortalThemeSync } from "./surface.js";
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import { cn } from "./utils.js";
|
|
6
|
+
import { CheckIcon, ChevronRightIcon, CircleIcon } from "lucide-react";
|
|
7
|
+
import { DropdownMenu as DropdownMenuPrimitive } from "radix-ui";
|
|
8
|
+
function DropdownMenu({ ...props }) {
|
|
9
|
+
return _jsx(DropdownMenuPrimitive.Root, { "data-slot": "dropdown-menu", ...props });
|
|
10
|
+
}
|
|
11
|
+
function DropdownMenuPortal({ ...props }) {
|
|
12
|
+
const container = usePortalContainer();
|
|
13
|
+
if (!container)
|
|
14
|
+
return null;
|
|
15
|
+
return (_jsx(DropdownMenuPrimitive.Portal, { container: container, "data-slot": "dropdown-menu-portal", ...props }));
|
|
16
|
+
}
|
|
17
|
+
const DropdownMenuTrigger = React.forwardRef(function DropdownMenuTrigger({ ...props }, ref) {
|
|
18
|
+
return (_jsx(DropdownMenuPrimitive.Trigger, { "data-slot": "dropdown-menu-trigger", ref: ref, ...props }));
|
|
19
|
+
});
|
|
20
|
+
function DropdownMenuContent({ children, className, sideOffset = 4, ...props }) {
|
|
21
|
+
const container = usePortalContainer();
|
|
22
|
+
if (!container)
|
|
23
|
+
return null;
|
|
24
|
+
return (_jsx(DropdownMenuPrimitive.Portal, { container: container, children: _jsxs(DropdownMenuPrimitive.Content, { "data-slot": "dropdown-menu-content", sideOffset: sideOffset, className: cn("z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border bg-popover p-1 text-popover-foreground shadow-md 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 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95", className), ...props, children: [_jsx(PortalThemeSync, {}), children] }) }));
|
|
25
|
+
}
|
|
26
|
+
function DropdownMenuGroup({ ...props }) {
|
|
27
|
+
return (_jsx(DropdownMenuPrimitive.Group, { "data-slot": "dropdown-menu-group", ...props }));
|
|
28
|
+
}
|
|
29
|
+
function DropdownMenuItem({ className, inset, variant = "default", ...props }) {
|
|
30
|
+
return (_jsx(DropdownMenuPrimitive.Item, { "data-slot": "dropdown-menu-item", "data-inset": inset, "data-variant": variant, className: cn("relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground data-[variant=destructive]:*:[svg]:text-destructive!", className), ...props }));
|
|
31
|
+
}
|
|
32
|
+
function DropdownMenuCheckboxItem({ className, children, checked, ...props }) {
|
|
33
|
+
return (_jsxs(DropdownMenuPrimitive.CheckboxItem, { "data-slot": "dropdown-menu-checkbox-item", className: cn("relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none focus:bg-accent 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", className), checked: checked ?? false, ...props, children: [_jsx("span", { className: cn("pointer-events-none absolute left-2 flex size-3.5 items-center justify-center"), children: _jsx(DropdownMenuPrimitive.ItemIndicator, { children: _jsx(CheckIcon, { className: cn("size-4") }) }) }), children] }));
|
|
34
|
+
}
|
|
35
|
+
function DropdownMenuRadioGroup({ ...props }) {
|
|
36
|
+
return (_jsx(DropdownMenuPrimitive.RadioGroup, { "data-slot": "dropdown-menu-radio-group", ...props }));
|
|
37
|
+
}
|
|
38
|
+
function DropdownMenuRadioItem({ className, children, ...props }) {
|
|
39
|
+
return (_jsxs(DropdownMenuPrimitive.RadioItem, { "data-slot": "dropdown-menu-radio-item", className: cn("relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none focus:bg-accent 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", className), ...props, children: [_jsx("span", { className: cn("pointer-events-none absolute left-2 flex size-3.5 items-center justify-center"), children: _jsx(DropdownMenuPrimitive.ItemIndicator, { children: _jsx(CircleIcon, { className: cn("size-2 fill-current") }) }) }), children] }));
|
|
40
|
+
}
|
|
41
|
+
function DropdownMenuLabel({ className, inset, ...props }) {
|
|
42
|
+
return (_jsx(DropdownMenuPrimitive.Label, { "data-slot": "dropdown-menu-label", "data-inset": inset, className: cn("px-2 py-1.5 text-sm font-medium data-[inset]:pl-8", className), ...props }));
|
|
43
|
+
}
|
|
44
|
+
function DropdownMenuSeparator({ className, ...props }) {
|
|
45
|
+
return (_jsx(DropdownMenuPrimitive.Separator, { "data-slot": "dropdown-menu-separator", className: cn("-mx-1 my-1 h-px bg-border", className), ...props }));
|
|
46
|
+
}
|
|
47
|
+
function DropdownMenuShortcut({ className, ...props }) {
|
|
48
|
+
return (_jsx("span", { "data-slot": "dropdown-menu-shortcut", className: cn("ml-auto text-xs tracking-widest text-muted-foreground", className), ...props }));
|
|
49
|
+
}
|
|
50
|
+
function DropdownMenuSub({ ...props }) {
|
|
51
|
+
return _jsx(DropdownMenuPrimitive.Sub, { "data-slot": "dropdown-menu-sub", ...props });
|
|
52
|
+
}
|
|
53
|
+
function DropdownMenuSubTrigger({ className, inset, children, ...props }) {
|
|
54
|
+
return (_jsxs(DropdownMenuPrimitive.SubTrigger, { "data-slot": "dropdown-menu-sub-trigger", "data-inset": inset, className: cn("flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[inset]:pl-8 data-[state=open]:bg-accent data-[state=open]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground", className), ...props, children: [children, _jsx(ChevronRightIcon, { className: cn("ml-auto size-4") })] }));
|
|
55
|
+
}
|
|
56
|
+
function DropdownMenuSubContent({ className, ...props }) {
|
|
57
|
+
return (_jsx(DropdownMenuPrimitive.SubContent, { "data-slot": "dropdown-menu-sub-content", className: cn("z-50 min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg 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 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95", className), ...props }));
|
|
58
|
+
}
|
|
59
|
+
export { DropdownMenu, DropdownMenuPortal, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuGroup, DropdownMenuLabel, DropdownMenuItem, DropdownMenuCheckboxItem, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubTrigger, DropdownMenuSubContent, };
|
|
60
|
+
//# sourceMappingURL=dropdown-menu.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dropdown-menu.js","sourceRoot":"","sources":["../../src/ui/dropdown-menu.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AACb,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACnE,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,EAAE,EAAE,MAAM,YAAY,CAAC;AAChC,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AACvE,OAAO,EAAE,YAAY,IAAI,qBAAqB,EAAE,MAAM,UAAU,CAAC;AACjE,SAAS,YAAY,CAAC,EAAE,GAAG,KAAK,EAA2D;IACzF,OAAO,KAAC,qBAAqB,CAAC,IAAI,iBAAW,eAAe,KAAK,KAAK,GAAG,CAAC;AAC5E,CAAC;AACD,SAAS,kBAAkB,CAAC,EAAE,GAAG,KAAK,EAA6D;IACjG,MAAM,SAAS,GAAG,kBAAkB,EAAE,CAAC;IACvC,IAAI,CAAC,SAAS;QACZ,OAAO,IAAI,CAAC;IACd,OAAO,CAAC,KAAC,qBAAqB,CAAC,MAAM,IAAC,SAAS,EAAE,SAAS,eAAY,sBAAsB,KAAK,KAAK,GAAG,CAAC,CAAC;AAC7G,CAAC;AACD,MAAM,mBAAmB,GAAG,KAAK,CAAC,UAAU,CAA0F,SAAS,mBAAmB,CAAC,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG;IAClL,OAAO,CAAC,KAAC,qBAAqB,CAAC,OAAO,iBAAW,uBAAuB,EAAC,GAAG,EAAE,GAAG,KAAM,KAAK,GAAG,CAAC,CAAC;AACnG,CA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AE,GAAG,KAAK,EAAgC;IACjF,OAAO,CAAC,4BAAgB,wBAAwB,EAAC,SAAS,EAAE,EAAE,CAAC,uDAAuD,EAAE,SAAS,CAAC,KAAM,KAAK,GAAG,CAAC,CAAC;AACpJ,CAAC;AACD,SAAS,eAAe,CAAC,EAAE,GAAG,KAAK,EAA0D;IAC3F,OAAO,KAAC,qBAAqB,CAAC,GAAG,iBAAW,mBAAmB,KAAK,KAAK,GAAG,CAAC;AAC/E,CAAC;AACD,SAAS,sBAAsB,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,KAAK,EAErE;IACC,OAAO,CAAC,MAAC,qBAAqB,CAAC,UAAU,iBAAW,2BAA2B,gBAAa,KAAK,EAAE,SAAS,EAAE,EAAE,CAAC,4WAA4W,EAAE,SAAS,CAAC,KAAM,KAAK,aAClf,QAAQ,EACT,KAAC,gBAAgB,IAAC,SAAS,EAAE,EAAE,CAAC,gBAAgB,CAAC,GAAG,IAClB,CAAC,CAAC;AACvC,CAAC;AACD,SAAS,sBAAsB,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAiE;IACpH,OAAO,CAAC,KAAC,qBAAqB,CAAC,UAAU,iBAAW,2BAA2B,EAAC,SAAS,EAAE,EAAE,CAAC,+eAA+e,EAAE,SAAS,CAAC,KAAM,KAAK,GAAG,CAAC,CAAC;AAC3mB,CAAC;AACD,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,wBAAwB,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,eAAe,EAAE,sBAAsB,EAAE,sBAAsB,GAAG,CAAC","sourcesContent":["\"use client\";\nimport { usePortalContainer, PortalThemeSync } from \"./surface.js\";\nimport * as React from \"react\";\nimport { cn } from \"./utils.js\";\nimport { CheckIcon, ChevronRightIcon, CircleIcon } from \"lucide-react\";\nimport { DropdownMenu as DropdownMenuPrimitive } from \"radix-ui\";\nfunction DropdownMenu({ ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Root>) {\n return <DropdownMenuPrimitive.Root data-slot=\"dropdown-menu\" {...props}/>;\n}\nfunction DropdownMenuPortal({ ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Portal>) {\n const container = usePortalContainer();\n if (!container)\n return null;\n return (<DropdownMenuPrimitive.Portal container={container} data-slot=\"dropdown-menu-portal\" {...props}/>);\n}\nconst DropdownMenuTrigger = React.forwardRef<HTMLButtonElement, React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Trigger>>(function DropdownMenuTrigger({ ...props }, ref) {\n return (<DropdownMenuPrimitive.Trigger data-slot=\"dropdown-menu-trigger\" ref={ref} {...props}/>);\n});\nfunction DropdownMenuContent({ children, className, sideOffset = 4, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Content>) {\n const container = usePortalContainer();\n if (!container)\n return null;\n return (<DropdownMenuPrimitive.Portal container={container}>\n <DropdownMenuPrimitive.Content data-slot=\"dropdown-menu-content\" sideOffset={sideOffset} className={cn(\"z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border bg-popover p-1 text-popover-foreground shadow-md 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 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95\", className)} {...props}><PortalThemeSync />{children}</DropdownMenuPrimitive.Content>\n </DropdownMenuPrimitive.Portal>);\n}\nfunction DropdownMenuGroup({ ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Group>) {\n return (<DropdownMenuPrimitive.Group data-slot=\"dropdown-menu-group\" {...props}/>);\n}\nfunction DropdownMenuItem({ className, inset, variant = \"default\", ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Item> & {\n inset?: boolean;\n variant?: \"default\" | \"destructive\";\n}) {\n return (<DropdownMenuPrimitive.Item data-slot=\"dropdown-menu-item\" data-inset={inset} data-variant={variant} className={cn(\"relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground data-[variant=destructive]:*:[svg]:text-destructive!\", className)} {...props}/>);\n}\nfunction DropdownMenuCheckboxItem({ className, children, checked, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.CheckboxItem>) {\n return (<DropdownMenuPrimitive.CheckboxItem data-slot=\"dropdown-menu-checkbox-item\" className={cn(\"relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none focus:bg-accent 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\", className)} checked={checked ?? false} {...props}>\n <span className={cn(\"pointer-events-none absolute left-2 flex size-3.5 items-center justify-center\")}>\n <DropdownMenuPrimitive.ItemIndicator>\n <CheckIcon className={cn(\"size-4\")}/>\n </DropdownMenuPrimitive.ItemIndicator>\n </span>\n {children}\n </DropdownMenuPrimitive.CheckboxItem>);\n}\nfunction DropdownMenuRadioGroup({ ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.RadioGroup>) {\n return (<DropdownMenuPrimitive.RadioGroup data-slot=\"dropdown-menu-radio-group\" {...props}/>);\n}\nfunction DropdownMenuRadioItem({ className, children, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.RadioItem>) {\n return (<DropdownMenuPrimitive.RadioItem data-slot=\"dropdown-menu-radio-item\" className={cn(\"relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none focus:bg-accent 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\", className)} {...props}>\n <span className={cn(\"pointer-events-none absolute left-2 flex size-3.5 items-center justify-center\")}>\n <DropdownMenuPrimitive.ItemIndicator>\n <CircleIcon className={cn(\"size-2 fill-current\")}/>\n </DropdownMenuPrimitive.ItemIndicator>\n </span>\n {children}\n </DropdownMenuPrimitive.RadioItem>);\n}\nfunction DropdownMenuLabel({ className, inset, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Label> & {\n inset?: boolean;\n}) {\n return (<DropdownMenuPrimitive.Label data-slot=\"dropdown-menu-label\" data-inset={inset} className={cn(\"px-2 py-1.5 text-sm font-medium data-[inset]:pl-8\", className)} {...props}/>);\n}\nfunction DropdownMenuSeparator({ className, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Separator>) {\n return (<DropdownMenuPrimitive.Separator data-slot=\"dropdown-menu-separator\" className={cn(\"-mx-1 my-1 h-px bg-border\", className)} {...props}/>);\n}\nfunction DropdownMenuShortcut({ className, ...props }: React.ComponentProps<\"span\">) {\n return (<span data-slot=\"dropdown-menu-shortcut\" className={cn(\"ml-auto text-xs tracking-widest text-muted-foreground\", className)} {...props}/>);\n}\nfunction DropdownMenuSub({ ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Sub>) {\n return <DropdownMenuPrimitive.Sub data-slot=\"dropdown-menu-sub\" {...props}/>;\n}\nfunction DropdownMenuSubTrigger({ className, inset, children, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.SubTrigger> & {\n inset?: boolean;\n}) {\n return (<DropdownMenuPrimitive.SubTrigger data-slot=\"dropdown-menu-sub-trigger\" data-inset={inset} className={cn(\"flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[inset]:pl-8 data-[state=open]:bg-accent data-[state=open]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground\", className)} {...props}>\n {children}\n <ChevronRightIcon className={cn(\"ml-auto size-4\")}/>\n </DropdownMenuPrimitive.SubTrigger>);\n}\nfunction DropdownMenuSubContent({ className, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.SubContent>) {\n return (<DropdownMenuPrimitive.SubContent data-slot=\"dropdown-menu-sub-content\" className={cn(\"z-50 min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg 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 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95\", className)} {...props}/>);\n}\nexport { DropdownMenu, DropdownMenuPortal, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuGroup, DropdownMenuLabel, DropdownMenuItem, DropdownMenuCheckboxItem, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubTrigger, DropdownMenuSubContent, };\n"]}
|
package/dist/ui/input.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { cn } from "./utils.js";
|
|
5
|
+
const Input = React.forwardRef(function Input({ className, type, ...props }, ref) {
|
|
6
|
+
return (_jsx("input", { type: type, "data-slot": "input", className: cn("h-9 w-full min-w-0 rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none selection:bg-primary selection:text-primary-foreground file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm dark:bg-input/30", "focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50", "aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40", className), ref: ref, ...props }));
|
|
7
|
+
});
|
|
8
|
+
export { Input };
|
|
9
|
+
//# sourceMappingURL=input.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"input.js","sourceRoot":"","sources":["../../src/ui/input.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AACb,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,EAAE,EAAE,MAAM,YAAY,CAAC;AAChC,MAAM,KAAK,GAAG,KAAK,CAAC,UAAU,CAA4D,SAAS,KAAK,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG;IACzI,OAAO,CAAC,gBAAO,IAAI,EAAE,IAAI,eAAY,OAAO,EAAC,SAAS,EAAE,EAAE,CAAC,4bAA4b,EAAE,+EAA+E,EAAE,wGAAwG,EAAE,SAAS,CAAC,EAAE,GAAG,EAAE,GAAG,KAAM,KAAK,GAAG,CAAC,CAAC;AAC1tB,CAAC,CAAC,CAAC;AACH,OAAO,EAAE,KAAK,EAAE,CAAC","sourcesContent":["\"use client\";\nimport * as React from \"react\";\nimport { cn } from \"./utils.js\";\nconst Input = React.forwardRef<HTMLInputElement, React.ComponentPropsWithoutRef<\"input\">>(function Input({ className, type, ...props }, ref) {\n return (<input type={type} data-slot=\"input\" className={cn(\"h-9 w-full min-w-0 rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none selection:bg-primary selection:text-primary-foreground file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm dark:bg-input/30\", \"focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50\", \"aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40\", className)} ref={ref} {...props}/>);\n});\nexport { Input };\n"]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { unstable_memoizeMarkdownComponents as memoizeMarkdownComponents } from "@assistant-ui/react-markdown";
|
|
2
|
+
import type { TextMessagePartProps } from "@assistant-ui/react";
|
|
3
|
+
type MarkdownTextProps = Partial<TextMessagePartProps> & {
|
|
4
|
+
components?: Parameters<typeof memoizeMarkdownComponents>[0];
|
|
5
|
+
};
|
|
6
|
+
export declare const MarkdownText: import("react").NamedExoticComponent<MarkdownTextProps>;
|
|
7
|
+
export {};
|