@applica-software-guru/persona-sdk 0.1.100 → 0.1.101
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/.eslintrc.cjs +6 -5
- package/.nvmrc +1 -1
- package/.prettierignore +3 -5
- package/.prettierrc +3 -5
- package/README.md +360 -20
- package/bitbucket-pipelines.yml +6 -5
- package/dist/bundle.cjs.js +1 -27
- package/dist/bundle.cjs.js.map +1 -1
- package/dist/bundle.es.js +700 -5086
- package/dist/bundle.es.js.map +1 -1
- package/dist/index.d.ts +1442 -8
- package/package.json +9 -51
- package/src/agents/agents-api.ts +66 -0
- package/src/agents/types.ts +349 -0
- package/src/auth/api-key-auth.ts +13 -0
- package/src/auth/authentication-provider.ts +4 -0
- package/src/auth/bearer-token-auth.ts +13 -0
- package/src/auth/index.ts +3 -0
- package/src/billing/billing-client.ts +182 -0
- package/src/billing/types.ts +166 -0
- package/src/credentials/credentials-api.ts +40 -0
- package/src/credentials/types.ts +67 -0
- package/src/exceptions.ts +10 -0
- package/src/features/feature-templates-api.ts +43 -0
- package/src/features/features-api.ts +16 -0
- package/src/features/types.ts +25 -0
- package/src/http-api.ts +102 -0
- package/src/index.ts +179 -7
- package/src/knowledges/knowledge-base-documents-api.ts +39 -0
- package/src/knowledges/knowledge-bases-api.ts +48 -0
- package/src/knowledges/types.ts +70 -0
- package/src/known-models/known-models-api.ts +33 -0
- package/src/known-models/types.ts +7 -0
- package/src/missions/missions-api.ts +62 -0
- package/src/missions/types.ts +25 -0
- package/src/paginated.ts +6 -0
- package/src/persona-sdk.ts +104 -0
- package/src/projects/projects-api.ts +90 -0
- package/src/projects/types.ts +52 -0
- package/src/revisions/types.ts +9 -0
- package/src/service-prices/service-prices-api.ts +33 -0
- package/src/service-prices/types.ts +8 -0
- package/src/sessions/sessions-api.ts +90 -0
- package/src/sessions/types.ts +150 -0
- package/src/triggers/trigger-executions-api.ts +28 -0
- package/src/triggers/triggers-api.ts +38 -0
- package/src/triggers/types.ts +50 -0
- package/src/values/values-api.ts +84 -0
- package/src/workflows/types.ts +150 -0
- package/src/workflows/workflow-executions-api.ts +28 -0
- package/src/workflows/workflows-api.ts +52 -0
- package/tsconfig.json +20 -28
- package/vite.config.ts +20 -67
- package/.github/copilot-instructions.md +0 -3
- package/CLAUDE.md +0 -3
- package/GEMINI.md +0 -3
- package/components.json +0 -24
- package/dist/bundle.iife.js +0 -28
- package/dist/bundle.iife.js.map +0 -1
- package/dist/bundle.umd.js +0 -28
- package/dist/bundle.umd.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/logging.d.ts +0 -18
- package/dist/logging.d.ts.map +0 -1
- package/dist/messages.d.ts +0 -9
- package/dist/messages.d.ts.map +0 -1
- package/dist/projects.d.ts +0 -17
- package/dist/projects.d.ts.map +0 -1
- package/dist/protocol/base.d.ts +0 -25
- package/dist/protocol/base.d.ts.map +0 -1
- package/dist/protocol/index.d.ts +0 -6
- package/dist/protocol/index.d.ts.map +0 -1
- package/dist/protocol/rest.d.ts +0 -25
- package/dist/protocol/rest.d.ts.map +0 -1
- package/dist/protocol/transaction.d.ts +0 -56
- package/dist/protocol/transaction.d.ts.map +0 -1
- package/dist/protocol/webrtc.d.ts +0 -60
- package/dist/protocol/webrtc.d.ts.map +0 -1
- package/dist/protocol/websocket.d.ts +0 -22
- package/dist/protocol/websocket.d.ts.map +0 -1
- package/dist/runtime/context.d.ts +0 -34
- package/dist/runtime/context.d.ts.map +0 -1
- package/dist/runtime/file-attachment-adapter.d.ts +0 -15
- package/dist/runtime/file-attachment-adapter.d.ts.map +0 -1
- package/dist/runtime/handlers.d.ts +0 -21
- package/dist/runtime/handlers.d.ts.map +0 -1
- package/dist/runtime/listeners.d.ts +0 -6
- package/dist/runtime/listeners.d.ts.map +0 -1
- package/dist/runtime/protocols.d.ts +0 -17
- package/dist/runtime/protocols.d.ts.map +0 -1
- package/dist/runtime/threads.d.ts +0 -34
- package/dist/runtime/threads.d.ts.map +0 -1
- package/dist/runtime/utils.d.ts +0 -10
- package/dist/runtime/utils.d.ts.map +0 -1
- package/dist/runtime.d.ts +0 -6
- package/dist/runtime.d.ts.map +0 -1
- package/dist/storage/base.d.ts +0 -9
- package/dist/storage/base.d.ts.map +0 -1
- package/dist/storage/index.d.ts +0 -3
- package/dist/storage/index.d.ts.map +0 -1
- package/dist/storage/persona.d.ts +0 -29
- package/dist/storage/persona.d.ts.map +0 -1
- package/dist/tools.d.ts +0 -72
- package/dist/tools.d.ts.map +0 -1
- package/dist/types.d.ts +0 -237
- package/dist/types.d.ts.map +0 -1
- package/docs/README.md +0 -13
- package/docs/api-reference.md +0 -16
- package/docs/contributing.md +0 -21
- package/docs/customization.md +0 -74
- package/docs/features.md +0 -7
- package/docs/installation.md +0 -9
- package/docs/messages.md +0 -214
- package/docs/protocols.md +0 -39
- package/docs/transactions.md +0 -121
- package/docs/usage.md +0 -40
- package/jsconfig.node.json +0 -10
- package/playground/index.html +0 -14
- package/playground/src/app.tsx +0 -10
- package/playground/src/chat.tsx +0 -117
- package/playground/src/components/assistant-ui/assistant-modal.tsx +0 -57
- package/playground/src/components/assistant-ui/attachment.tsx +0 -197
- package/playground/src/components/assistant-ui/markdown-text.tsx +0 -228
- package/playground/src/components/assistant-ui/thread-list.tsx +0 -91
- package/playground/src/components/assistant-ui/thread.tsx +0 -302
- package/playground/src/components/assistant-ui/threadlist-sidebar.tsx +0 -59
- package/playground/src/components/assistant-ui/tool-fallback.tsx +0 -93
- package/playground/src/components/assistant-ui/tooltip-icon-button.tsx +0 -42
- package/playground/src/components/chat/logging.tsx +0 -53
- package/playground/src/components/ui/avatar.tsx +0 -51
- package/playground/src/components/ui/button.tsx +0 -60
- package/playground/src/components/ui/dialog.tsx +0 -141
- package/playground/src/components/ui/input.tsx +0 -21
- package/playground/src/components/ui/separator.tsx +0 -26
- package/playground/src/components/ui/sheet.tsx +0 -139
- package/playground/src/components/ui/sidebar.tsx +0 -619
- package/playground/src/components/ui/skeleton.tsx +0 -13
- package/playground/src/components/ui/tooltip.tsx +0 -59
- package/playground/src/hooks/theme.ts +0 -70
- package/playground/src/hooks/use-mobile.ts +0 -19
- package/playground/src/lib/utils.ts +0 -6
- package/playground/src/main.tsx +0 -10
- package/playground/src/styles.css +0 -120
- package/playground/src/tools.ts +0 -149
- package/playground/src/vite-env.d.ts +0 -1
- package/preview-build.sh +0 -23
- package/src/logging.ts +0 -34
- package/src/messages.ts +0 -202
- package/src/projects.ts +0 -57
- package/src/protocol/base.ts +0 -73
- package/src/protocol/index.ts +0 -5
- package/src/protocol/rest.ts +0 -107
- package/src/protocol/transaction.ts +0 -182
- package/src/protocol/webrtc.ts +0 -379
- package/src/protocol/websocket.ts +0 -111
- package/src/runtime/context.ts +0 -88
- package/src/runtime/file-attachment-adapter.ts +0 -48
- package/src/runtime/handlers.ts +0 -322
- package/src/runtime/index.ts +0 -6
- package/src/runtime/listeners.ts +0 -79
- package/src/runtime/protocols.ts +0 -169
- package/src/runtime/threads.ts +0 -105
- package/src/runtime/utils.ts +0 -46
- package/src/runtime.tsx +0 -334
- package/src/storage/base.ts +0 -13
- package/src/storage/index.ts +0 -2
- package/src/storage/persona.ts +0 -138
- package/src/tools.ts +0 -211
- package/src/types.ts +0 -284
- package/tsconfig.node.json +0 -15
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import type { ToolCallMessagePartComponent } from "@assistant-ui/react";
|
|
2
|
-
import {
|
|
3
|
-
CheckIcon,
|
|
4
|
-
ChevronDownIcon,
|
|
5
|
-
ChevronUpIcon,
|
|
6
|
-
XCircleIcon,
|
|
7
|
-
} from "lucide-react";
|
|
8
|
-
import { useState } from "react";
|
|
9
|
-
import { Button } from "@/components/ui/button";
|
|
10
|
-
import { cn } from "@/lib/utils";
|
|
11
|
-
|
|
12
|
-
export const ToolFallback: ToolCallMessagePartComponent = ({
|
|
13
|
-
toolName,
|
|
14
|
-
argsText,
|
|
15
|
-
result,
|
|
16
|
-
status,
|
|
17
|
-
}) => {
|
|
18
|
-
const [isCollapsed, setIsCollapsed] = useState(true);
|
|
19
|
-
|
|
20
|
-
const isCancelled =
|
|
21
|
-
status?.type === "incomplete" && status.reason === "cancelled";
|
|
22
|
-
const cancelledReason =
|
|
23
|
-
isCancelled && status.error
|
|
24
|
-
? typeof status.error === "string"
|
|
25
|
-
? status.error
|
|
26
|
-
: JSON.stringify(status.error)
|
|
27
|
-
: null;
|
|
28
|
-
|
|
29
|
-
return (
|
|
30
|
-
<div
|
|
31
|
-
className={cn(
|
|
32
|
-
"aui-tool-fallback-root mb-4 flex w-full flex-col gap-3 rounded-lg border py-3",
|
|
33
|
-
isCancelled && "border-muted-foreground/30 bg-muted/30",
|
|
34
|
-
)}
|
|
35
|
-
>
|
|
36
|
-
<div className="aui-tool-fallback-header flex items-center gap-2 px-4">
|
|
37
|
-
{isCancelled ? (
|
|
38
|
-
<XCircleIcon className="aui-tool-fallback-icon size-4 text-muted-foreground" />
|
|
39
|
-
) : (
|
|
40
|
-
<CheckIcon className="aui-tool-fallback-icon size-4" />
|
|
41
|
-
)}
|
|
42
|
-
<p
|
|
43
|
-
className={cn(
|
|
44
|
-
"aui-tool-fallback-title grow",
|
|
45
|
-
isCancelled && "text-muted-foreground line-through",
|
|
46
|
-
)}
|
|
47
|
-
>
|
|
48
|
-
{isCancelled ? "Cancelled tool: " : "Used tool: "}
|
|
49
|
-
<b>{toolName}</b>
|
|
50
|
-
</p>
|
|
51
|
-
<Button onClick={() => setIsCollapsed(!isCollapsed)}>
|
|
52
|
-
{isCollapsed ? <ChevronUpIcon /> : <ChevronDownIcon />}
|
|
53
|
-
</Button>
|
|
54
|
-
</div>
|
|
55
|
-
{!isCollapsed && (
|
|
56
|
-
<div className="aui-tool-fallback-content flex flex-col gap-2 border-t pt-2">
|
|
57
|
-
{cancelledReason && (
|
|
58
|
-
<div className="aui-tool-fallback-cancelled-root px-4">
|
|
59
|
-
<p className="aui-tool-fallback-cancelled-header font-semibold text-muted-foreground">
|
|
60
|
-
Cancelled reason:
|
|
61
|
-
</p>
|
|
62
|
-
<p className="aui-tool-fallback-cancelled-reason text-muted-foreground">
|
|
63
|
-
{cancelledReason}
|
|
64
|
-
</p>
|
|
65
|
-
</div>
|
|
66
|
-
)}
|
|
67
|
-
<div
|
|
68
|
-
className={cn(
|
|
69
|
-
"aui-tool-fallback-args-root px-4",
|
|
70
|
-
isCancelled && "opacity-60",
|
|
71
|
-
)}
|
|
72
|
-
>
|
|
73
|
-
<pre className="aui-tool-fallback-args-value whitespace-pre-wrap">
|
|
74
|
-
{argsText}
|
|
75
|
-
</pre>
|
|
76
|
-
</div>
|
|
77
|
-
{!isCancelled && result !== undefined && (
|
|
78
|
-
<div className="aui-tool-fallback-result-root border-t border-dashed px-4 pt-2">
|
|
79
|
-
<p className="aui-tool-fallback-result-header font-semibold">
|
|
80
|
-
Result:
|
|
81
|
-
</p>
|
|
82
|
-
<pre className="aui-tool-fallback-result-content whitespace-pre-wrap">
|
|
83
|
-
{typeof result === "string"
|
|
84
|
-
? result
|
|
85
|
-
: JSON.stringify(result, null, 2)}
|
|
86
|
-
</pre>
|
|
87
|
-
</div>
|
|
88
|
-
)}
|
|
89
|
-
</div>
|
|
90
|
-
)}
|
|
91
|
-
</div>
|
|
92
|
-
);
|
|
93
|
-
};
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import { ComponentPropsWithRef, forwardRef } from "react";
|
|
4
|
-
import { Slottable } from "@radix-ui/react-slot";
|
|
5
|
-
|
|
6
|
-
import {
|
|
7
|
-
Tooltip,
|
|
8
|
-
TooltipContent,
|
|
9
|
-
TooltipTrigger,
|
|
10
|
-
} from "@/components/ui/tooltip";
|
|
11
|
-
import { Button } from "@/components/ui/button";
|
|
12
|
-
import { cn } from "@/lib/utils";
|
|
13
|
-
|
|
14
|
-
export type TooltipIconButtonProps = ComponentPropsWithRef<typeof Button> & {
|
|
15
|
-
tooltip: string;
|
|
16
|
-
side?: "top" | "bottom" | "left" | "right";
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
export const TooltipIconButton = forwardRef<
|
|
20
|
-
HTMLButtonElement,
|
|
21
|
-
TooltipIconButtonProps
|
|
22
|
-
>(({ children, tooltip, side = "bottom", className, ...rest }, ref) => {
|
|
23
|
-
return (
|
|
24
|
-
<Tooltip>
|
|
25
|
-
<TooltipTrigger asChild>
|
|
26
|
-
<Button
|
|
27
|
-
variant="ghost"
|
|
28
|
-
size="icon"
|
|
29
|
-
{...rest}
|
|
30
|
-
className={cn("aui-button-icon size-6 p-1", className)}
|
|
31
|
-
ref={ref}
|
|
32
|
-
>
|
|
33
|
-
<Slottable>{children}</Slottable>
|
|
34
|
-
<span className="aui-sr-only sr-only">{tooltip}</span>
|
|
35
|
-
</Button>
|
|
36
|
-
</TooltipTrigger>
|
|
37
|
-
<TooltipContent side={side}>{tooltip}</TooltipContent>
|
|
38
|
-
</Tooltip>
|
|
39
|
-
);
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
TooltipIconButton.displayName = "TooltipIconButton";
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { usePersonaRuntimeEndpoint, usePersonaRuntimeMessages } from '@applica-software-guru/persona-sdk';
|
|
2
|
-
import { useMemo } from 'react';
|
|
3
|
-
import _ from 'lodash';
|
|
4
|
-
|
|
5
|
-
function MessageLogger() {
|
|
6
|
-
const messages = usePersonaRuntimeMessages();
|
|
7
|
-
const { reasoning, user, assistant, sources } = useMemo(() => {
|
|
8
|
-
const reasoning = _.filter(messages, (message) => message.role === 'assistant' && message.type === 'reasoning').length;
|
|
9
|
-
const user = _.filter(messages, (message) => message.role === 'user').length;
|
|
10
|
-
const assistant = _.filter(messages, (message) => message.role === 'assistant').length;
|
|
11
|
-
const sources = _.filter(messages, (message) => message.role === 'assistant' && message.sources).length;
|
|
12
|
-
return { reasoning, user, assistant, sources };
|
|
13
|
-
}, [messages]);
|
|
14
|
-
return (
|
|
15
|
-
<div className="absolute top-0 left-0 w-30 h-40 overflow-y-auto m-2 box-border border-gray-300 rounded-lg shadow-lg p-2">
|
|
16
|
-
<h3 className="text-md font-bold mb-2">Messages</h3>
|
|
17
|
-
<p className="top-0 left-0 bg-white text-black text-sm">
|
|
18
|
-
<span className="text-gray-500">
|
|
19
|
-
User: <span className="font-bold">{user}</span>
|
|
20
|
-
</span>
|
|
21
|
-
<br />
|
|
22
|
-
<span className="text-gray-500">
|
|
23
|
-
Assistant: <span className="font-bold">{assistant}</span>
|
|
24
|
-
</span>
|
|
25
|
-
<br />
|
|
26
|
-
<span className="text-gray-500">
|
|
27
|
-
Reasoning: <span className="font-bold">{reasoning}</span>
|
|
28
|
-
</span>
|
|
29
|
-
<br />
|
|
30
|
-
<span className="text-gray-500">
|
|
31
|
-
Sources: <span className="font-bold">{sources}</span>
|
|
32
|
-
</span>
|
|
33
|
-
<br />
|
|
34
|
-
<span className="text-gray-500">
|
|
35
|
-
Total: <span className="font-bold">{messages.length}</span>
|
|
36
|
-
</span>
|
|
37
|
-
<br />
|
|
38
|
-
</p>
|
|
39
|
-
</div>
|
|
40
|
-
);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
function EndpointLogger() {
|
|
44
|
-
const endpoint = usePersonaRuntimeEndpoint();
|
|
45
|
-
return (
|
|
46
|
-
<div className="absolute top-0 right-0 w-50 h-40 overflow-y-auto m-2 box-border border-gray-300 rounded-lg shadow-lg p-2">
|
|
47
|
-
<h3 className="text-md font-bold mb-2">Endpoint</h3>
|
|
48
|
-
<p className="top-0 left-0 bg-white text-black text-sm">{endpoint || 'No endpoint available'}</p>
|
|
49
|
-
</div>
|
|
50
|
-
);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
export { MessageLogger, EndpointLogger };
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import * as React from "react"
|
|
2
|
-
import * as AvatarPrimitive from "@radix-ui/react-avatar"
|
|
3
|
-
|
|
4
|
-
import { cn } from "@/lib/utils"
|
|
5
|
-
|
|
6
|
-
function Avatar({
|
|
7
|
-
className,
|
|
8
|
-
...props
|
|
9
|
-
}: React.ComponentProps<typeof AvatarPrimitive.Root>) {
|
|
10
|
-
return (
|
|
11
|
-
<AvatarPrimitive.Root
|
|
12
|
-
data-slot="avatar"
|
|
13
|
-
className={cn(
|
|
14
|
-
"relative flex size-8 shrink-0 overflow-hidden rounded-full",
|
|
15
|
-
className
|
|
16
|
-
)}
|
|
17
|
-
{...props}
|
|
18
|
-
/>
|
|
19
|
-
)
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
function AvatarImage({
|
|
23
|
-
className,
|
|
24
|
-
...props
|
|
25
|
-
}: React.ComponentProps<typeof AvatarPrimitive.Image>) {
|
|
26
|
-
return (
|
|
27
|
-
<AvatarPrimitive.Image
|
|
28
|
-
data-slot="avatar-image"
|
|
29
|
-
className={cn("aspect-square size-full", className)}
|
|
30
|
-
{...props}
|
|
31
|
-
/>
|
|
32
|
-
)
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
function AvatarFallback({
|
|
36
|
-
className,
|
|
37
|
-
...props
|
|
38
|
-
}: React.ComponentProps<typeof AvatarPrimitive.Fallback>) {
|
|
39
|
-
return (
|
|
40
|
-
<AvatarPrimitive.Fallback
|
|
41
|
-
data-slot="avatar-fallback"
|
|
42
|
-
className={cn(
|
|
43
|
-
"bg-muted flex size-full items-center justify-center rounded-full",
|
|
44
|
-
className
|
|
45
|
-
)}
|
|
46
|
-
{...props}
|
|
47
|
-
/>
|
|
48
|
-
)
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export { Avatar, AvatarImage, AvatarFallback }
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import * as React from "react"
|
|
2
|
-
import { Slot } from "@radix-ui/react-slot"
|
|
3
|
-
import { cva, type VariantProps } from "class-variance-authority"
|
|
4
|
-
|
|
5
|
-
import { cn } from "@/lib/utils"
|
|
6
|
-
|
|
7
|
-
const buttonVariants = cva(
|
|
8
|
-
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
|
|
9
|
-
{
|
|
10
|
-
variants: {
|
|
11
|
-
variant: {
|
|
12
|
-
default: "bg-primary text-primary-foreground hover:bg-primary/90",
|
|
13
|
-
destructive:
|
|
14
|
-
"bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
|
|
15
|
-
outline:
|
|
16
|
-
"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",
|
|
17
|
-
secondary:
|
|
18
|
-
"bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
|
19
|
-
ghost:
|
|
20
|
-
"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
|
|
21
|
-
link: "text-primary underline-offset-4 hover:underline",
|
|
22
|
-
},
|
|
23
|
-
size: {
|
|
24
|
-
default: "h-9 px-4 py-2 has-[>svg]:px-3",
|
|
25
|
-
sm: "h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",
|
|
26
|
-
lg: "h-10 rounded-md px-6 has-[>svg]:px-4",
|
|
27
|
-
icon: "size-9",
|
|
28
|
-
"icon-sm": "size-8",
|
|
29
|
-
"icon-lg": "size-10",
|
|
30
|
-
},
|
|
31
|
-
},
|
|
32
|
-
defaultVariants: {
|
|
33
|
-
variant: "default",
|
|
34
|
-
size: "default",
|
|
35
|
-
},
|
|
36
|
-
}
|
|
37
|
-
)
|
|
38
|
-
|
|
39
|
-
function Button({
|
|
40
|
-
className,
|
|
41
|
-
variant,
|
|
42
|
-
size,
|
|
43
|
-
asChild = false,
|
|
44
|
-
...props
|
|
45
|
-
}: React.ComponentProps<"button"> &
|
|
46
|
-
VariantProps<typeof buttonVariants> & {
|
|
47
|
-
asChild?: boolean
|
|
48
|
-
}) {
|
|
49
|
-
const Comp = asChild ? Slot : "button"
|
|
50
|
-
|
|
51
|
-
return (
|
|
52
|
-
<Comp
|
|
53
|
-
data-slot="button"
|
|
54
|
-
className={cn(buttonVariants({ variant, size, className }))}
|
|
55
|
-
{...props}
|
|
56
|
-
/>
|
|
57
|
-
)
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
export { Button, buttonVariants }
|
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
import * as React from "react"
|
|
2
|
-
import * as DialogPrimitive from "@radix-ui/react-dialog"
|
|
3
|
-
import { XIcon } from "lucide-react"
|
|
4
|
-
|
|
5
|
-
import { cn } from "@/lib/utils"
|
|
6
|
-
|
|
7
|
-
function Dialog({
|
|
8
|
-
...props
|
|
9
|
-
}: React.ComponentProps<typeof DialogPrimitive.Root>) {
|
|
10
|
-
return <DialogPrimitive.Root data-slot="dialog" {...props} />
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
function DialogTrigger({
|
|
14
|
-
...props
|
|
15
|
-
}: React.ComponentProps<typeof DialogPrimitive.Trigger>) {
|
|
16
|
-
return <DialogPrimitive.Trigger data-slot="dialog-trigger" {...props} />
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
function DialogPortal({
|
|
20
|
-
...props
|
|
21
|
-
}: React.ComponentProps<typeof DialogPrimitive.Portal>) {
|
|
22
|
-
return <DialogPrimitive.Portal data-slot="dialog-portal" {...props} />
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
function DialogClose({
|
|
26
|
-
...props
|
|
27
|
-
}: React.ComponentProps<typeof DialogPrimitive.Close>) {
|
|
28
|
-
return <DialogPrimitive.Close data-slot="dialog-close" {...props} />
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
function DialogOverlay({
|
|
32
|
-
className,
|
|
33
|
-
...props
|
|
34
|
-
}: React.ComponentProps<typeof DialogPrimitive.Overlay>) {
|
|
35
|
-
return (
|
|
36
|
-
<DialogPrimitive.Overlay
|
|
37
|
-
data-slot="dialog-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 DialogContent({
|
|
48
|
-
className,
|
|
49
|
-
children,
|
|
50
|
-
showCloseButton = true,
|
|
51
|
-
...props
|
|
52
|
-
}: React.ComponentProps<typeof DialogPrimitive.Content> & {
|
|
53
|
-
showCloseButton?: boolean
|
|
54
|
-
}) {
|
|
55
|
-
return (
|
|
56
|
-
<DialogPortal data-slot="dialog-portal">
|
|
57
|
-
<DialogOverlay />
|
|
58
|
-
<DialogPrimitive.Content
|
|
59
|
-
data-slot="dialog-content"
|
|
60
|
-
className={cn(
|
|
61
|
-
"bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 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 p-6 shadow-lg duration-200 sm:max-w-lg",
|
|
62
|
-
className
|
|
63
|
-
)}
|
|
64
|
-
{...props}
|
|
65
|
-
>
|
|
66
|
-
{children}
|
|
67
|
-
{showCloseButton && (
|
|
68
|
-
<DialogPrimitive.Close
|
|
69
|
-
data-slot="dialog-close"
|
|
70
|
-
className="ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground 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 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4"
|
|
71
|
-
>
|
|
72
|
-
<XIcon />
|
|
73
|
-
<span className="sr-only">Close</span>
|
|
74
|
-
</DialogPrimitive.Close>
|
|
75
|
-
)}
|
|
76
|
-
</DialogPrimitive.Content>
|
|
77
|
-
</DialogPortal>
|
|
78
|
-
)
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
function DialogHeader({ className, ...props }: React.ComponentProps<"div">) {
|
|
82
|
-
return (
|
|
83
|
-
<div
|
|
84
|
-
data-slot="dialog-header"
|
|
85
|
-
className={cn("flex flex-col gap-2 text-center sm:text-left", className)}
|
|
86
|
-
{...props}
|
|
87
|
-
/>
|
|
88
|
-
)
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
function DialogFooter({ className, ...props }: React.ComponentProps<"div">) {
|
|
92
|
-
return (
|
|
93
|
-
<div
|
|
94
|
-
data-slot="dialog-footer"
|
|
95
|
-
className={cn(
|
|
96
|
-
"flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",
|
|
97
|
-
className
|
|
98
|
-
)}
|
|
99
|
-
{...props}
|
|
100
|
-
/>
|
|
101
|
-
)
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
function DialogTitle({
|
|
105
|
-
className,
|
|
106
|
-
...props
|
|
107
|
-
}: React.ComponentProps<typeof DialogPrimitive.Title>) {
|
|
108
|
-
return (
|
|
109
|
-
<DialogPrimitive.Title
|
|
110
|
-
data-slot="dialog-title"
|
|
111
|
-
className={cn("text-lg leading-none font-semibold", className)}
|
|
112
|
-
{...props}
|
|
113
|
-
/>
|
|
114
|
-
)
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
function DialogDescription({
|
|
118
|
-
className,
|
|
119
|
-
...props
|
|
120
|
-
}: React.ComponentProps<typeof DialogPrimitive.Description>) {
|
|
121
|
-
return (
|
|
122
|
-
<DialogPrimitive.Description
|
|
123
|
-
data-slot="dialog-description"
|
|
124
|
-
className={cn("text-muted-foreground text-sm", className)}
|
|
125
|
-
{...props}
|
|
126
|
-
/>
|
|
127
|
-
)
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
export {
|
|
131
|
-
Dialog,
|
|
132
|
-
DialogClose,
|
|
133
|
-
DialogContent,
|
|
134
|
-
DialogDescription,
|
|
135
|
-
DialogFooter,
|
|
136
|
-
DialogHeader,
|
|
137
|
-
DialogOverlay,
|
|
138
|
-
DialogPortal,
|
|
139
|
-
DialogTitle,
|
|
140
|
-
DialogTrigger,
|
|
141
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import * as React from "react"
|
|
2
|
-
|
|
3
|
-
import { cn } from "@/lib/utils"
|
|
4
|
-
|
|
5
|
-
function Input({ className, type, ...props }: React.ComponentProps<"input">) {
|
|
6
|
-
return (
|
|
7
|
-
<input
|
|
8
|
-
type={type}
|
|
9
|
-
data-slot="input"
|
|
10
|
-
className={cn(
|
|
11
|
-
"file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
|
|
12
|
-
"focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",
|
|
13
|
-
"aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
|
|
14
|
-
className
|
|
15
|
-
)}
|
|
16
|
-
{...props}
|
|
17
|
-
/>
|
|
18
|
-
)
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export { Input }
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import * as React from "react"
|
|
2
|
-
import * as SeparatorPrimitive from "@radix-ui/react-separator"
|
|
3
|
-
|
|
4
|
-
import { cn } from "@/lib/utils"
|
|
5
|
-
|
|
6
|
-
function Separator({
|
|
7
|
-
className,
|
|
8
|
-
orientation = "horizontal",
|
|
9
|
-
decorative = true,
|
|
10
|
-
...props
|
|
11
|
-
}: React.ComponentProps<typeof SeparatorPrimitive.Root>) {
|
|
12
|
-
return (
|
|
13
|
-
<SeparatorPrimitive.Root
|
|
14
|
-
data-slot="separator"
|
|
15
|
-
decorative={decorative}
|
|
16
|
-
orientation={orientation}
|
|
17
|
-
className={cn(
|
|
18
|
-
"bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",
|
|
19
|
-
className
|
|
20
|
-
)}
|
|
21
|
-
{...props}
|
|
22
|
-
/>
|
|
23
|
-
)
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export { Separator }
|
|
@@ -1,139 +0,0 @@
|
|
|
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
|
-
}
|