@ciridae/ui 0.2.4 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/ui/app-shell-page.d.ts +22 -0
- package/dist/components/ui/app-shell-page.js +17 -0
- package/dist/components/ui/item.d.ts +1 -1
- package/dist/styled-system/styles.css +393 -61
- package/dist/styles.css +2 -0
- package/package.json +6 -260
- package/dist/components/agentic/agent-card.d.ts +0 -28
- package/dist/components/agentic/agent-card.js +0 -27
- package/dist/components/agentic/agent-composer.d.ts +0 -44
- package/dist/components/agentic/agent-composer.js +0 -104
- package/dist/components/agentic/agent-context.d.ts +0 -28
- package/dist/components/agentic/agent-context.js +0 -102
- package/dist/components/agentic/agent-plan.d.ts +0 -27
- package/dist/components/agentic/agent-plan.js +0 -43
- package/dist/components/agentic/agent-queue.d.ts +0 -46
- package/dist/components/agentic/agent-queue.js +0 -53
- package/dist/components/agentic/agent-task.d.ts +0 -16
- package/dist/components/agentic/agent-task.js +0 -20
- package/dist/components/agentic/approval-request.d.ts +0 -24
- package/dist/components/agentic/approval-request.js +0 -57
- package/dist/components/agentic/artifact.d.ts +0 -24
- package/dist/components/agentic/artifact.js +0 -72
- package/dist/components/agentic/attachments.d.ts +0 -124
- package/dist/components/agentic/attachments.js +0 -595
- package/dist/components/agentic/audio-player.d.ts +0 -16
- package/dist/components/agentic/audio-player.js +0 -21
- package/dist/components/agentic/canvas.d.ts +0 -10
- package/dist/components/agentic/canvas.js +0 -22
- package/dist/components/agentic/clipboard.d.ts +0 -2
- package/dist/components/agentic/clipboard.js +0 -12
- package/dist/components/agentic/code-block.d.ts +0 -43
- package/dist/components/agentic/code-block.js +0 -92
- package/dist/components/agentic/commit.d.ts +0 -57
- package/dist/components/agentic/commit.js +0 -85
- package/dist/components/agentic/connection.d.ts +0 -3
- package/dist/components/agentic/connection.js +0 -8
- package/dist/components/agentic/controls.d.ts +0 -6
- package/dist/components/agentic/controls.js +0 -7
- package/dist/components/agentic/conversation.d.ts +0 -25
- package/dist/components/agentic/conversation.js +0 -56
- package/dist/components/agentic/edge.d.ts +0 -8
- package/dist/components/agentic/edge.js +0 -65
- package/dist/components/agentic/effort-selector.d.ts +0 -43
- package/dist/components/agentic/effort-selector.js +0 -47
- package/dist/components/agentic/environment-variables.d.ts +0 -32
- package/dist/components/agentic/environment-variables.js +0 -66
- package/dist/components/agentic/file-tree.d.ts +0 -24
- package/dist/components/agentic/file-tree.js +0 -56
- package/dist/components/agentic/image.d.ts +0 -9
- package/dist/components/agentic/image.js +0 -11
- package/dist/components/agentic/inline-citation.d.ts +0 -40
- package/dist/components/agentic/inline-citation.js +0 -111
- package/dist/components/agentic/jsx-preview.d.ts +0 -19
- package/dist/components/agentic/jsx-preview.js +0 -34
- package/dist/components/agentic/message-branch.d.ts +0 -20
- package/dist/components/agentic/message-branch.js +0 -83
- package/dist/components/agentic/message-response.css +0 -265
- package/dist/components/agentic/message-response.css.d.ts +0 -2
- package/dist/components/agentic/message.d.ts +0 -27
- package/dist/components/agentic/message.js +0 -57
- package/dist/components/agentic/mic-selector.d.ts +0 -58
- package/dist/components/agentic/mic-selector.js +0 -173
- package/dist/components/agentic/model-selector.d.ts +0 -39
- package/dist/components/agentic/model-selector.js +0 -47
- package/dist/components/agentic/node.d.ts +0 -26
- package/dist/components/agentic/node.js +0 -29
- package/dist/components/agentic/open-in-chat.d.ts +0 -9
- package/dist/components/agentic/open-in-chat.js +0 -8
- package/dist/components/agentic/package-info.d.ts +0 -30
- package/dist/components/agentic/package-info.js +0 -44
- package/dist/components/agentic/panel.d.ts +0 -6
- package/dist/components/agentic/panel.js +0 -7
- package/dist/components/agentic/persona.d.ts +0 -16
- package/dist/components/agentic/persona.js +0 -116
- package/dist/components/agentic/prompt-input-action-menu.d.ts +0 -16
- package/dist/components/agentic/prompt-input-action-menu.js +0 -22
- package/dist/components/agentic/prompt-input-command.d.ts +0 -18
- package/dist/components/agentic/prompt-input-command.js +0 -25
- package/dist/components/agentic/prompt-input-hover-card.d.ts +0 -10
- package/dist/components/agentic/prompt-input-hover-card.js +0 -13
- package/dist/components/agentic/prompt-input-select.d.ts +0 -14
- package/dist/components/agentic/prompt-input-select.js +0 -19
- package/dist/components/agentic/prompt-input-tabs.d.ts +0 -17
- package/dist/components/agentic/prompt-input-tabs.js +0 -45
- package/dist/components/agentic/prompt-input.d.ts +0 -79
- package/dist/components/agentic/prompt-input.js +0 -206
- package/dist/components/agentic/reasoning.d.ts +0 -21
- package/dist/components/agentic/reasoning.js +0 -106
- package/dist/components/agentic/run-checkpoint.d.ts +0 -13
- package/dist/components/agentic/run-checkpoint.js +0 -19
- package/dist/components/agentic/run-trace.d.ts +0 -30
- package/dist/components/agentic/run-trace.js +0 -56
- package/dist/components/agentic/sandbox.d.ts +0 -24
- package/dist/components/agentic/sandbox.js +0 -33
- package/dist/components/agentic/schema-display.d.ts +0 -39
- package/dist/components/agentic/schema-display.js +0 -56
- package/dist/components/agentic/shimmer.d.ts +0 -11
- package/dist/components/agentic/shimmer.js +0 -16
- package/dist/components/agentic/snippet.d.ts +0 -18
- package/dist/components/agentic/snippet.js +0 -35
- package/dist/components/agentic/sources.d.ts +0 -16
- package/dist/components/agentic/sources.js +0 -17
- package/dist/components/agentic/speech-input.d.ts +0 -24
- package/dist/components/agentic/speech-input.js +0 -30
- package/dist/components/agentic/stack-trace.d.ts +0 -27
- package/dist/components/agentic/stack-trace.js +0 -76
- package/dist/components/agentic/suggestion.d.ts +0 -12
- package/dist/components/agentic/suggestion.js +0 -15
- package/dist/components/agentic/terminal.d.ts +0 -24
- package/dist/components/agentic/terminal.js +0 -47
- package/dist/components/agentic/test-results.d.ts +0 -51
- package/dist/components/agentic/test-results.js +0 -83
- package/dist/components/agentic/theme.d.ts +0 -5
- package/dist/components/agentic/theme.js +0 -31
- package/dist/components/agentic/tool.d.ts +0 -25
- package/dist/components/agentic/tool.js +0 -73
- package/dist/components/agentic/toolbar.d.ts +0 -6
- package/dist/components/agentic/toolbar.js +0 -7
- package/dist/components/agentic/transcription.d.ts +0 -20
- package/dist/components/agentic/transcription.js +0 -32
- package/dist/components/agentic/types.d.ts +0 -172
- package/dist/components/agentic/types.js +0 -1
- package/dist/components/agentic/use-controllable-state.d.ts +0 -6
- package/dist/components/agentic/use-controllable-state.js +0 -13
- package/dist/components/agentic/voice-selector.d.ts +0 -69
- package/dist/components/agentic/voice-selector.js +0 -122
- package/dist/components/agentic/web-preview.d.ts +0 -25
- package/dist/components/agentic/web-preview.js +0 -33
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { CheckIcon, CopyIcon } from "lucide-react";
|
|
3
|
-
import { createContext, useContext, useMemo, useState } from "react";
|
|
4
|
-
import { Badge } from "@ciridae/ui/badge";
|
|
5
|
-
import { Button } from "@ciridae/ui/button";
|
|
6
|
-
import { Switch } from "@ciridae/ui/switch";
|
|
7
|
-
import { cn } from "@ciridae/ui/utils";
|
|
8
|
-
import { copyToClipboard } from "./clipboard";
|
|
9
|
-
const EnvironmentVariablesContext = createContext(null);
|
|
10
|
-
const EnvironmentVariableContext = createContext({ value: "" });
|
|
11
|
-
function useEnvironmentVariables() {
|
|
12
|
-
const context = useContext(EnvironmentVariablesContext);
|
|
13
|
-
if (!context)
|
|
14
|
-
throw new Error("EnvironmentVariables components must be used within EnvironmentVariables");
|
|
15
|
-
return context;
|
|
16
|
-
}
|
|
17
|
-
function EnvironmentVariables({ children, className, defaultRevealed = false, ...props }) {
|
|
18
|
-
const [revealed, setRevealed] = useState(defaultRevealed);
|
|
19
|
-
const contextValue = useMemo(() => ({ revealed, setRevealed }), [revealed]);
|
|
20
|
-
return (_jsx(EnvironmentVariablesContext.Provider, { value: contextValue, children: _jsx("div", { "data-slot": "environment-variables", className: cn("grid gap-3 rounded-lg border bg-card p-4", className), ...props, children: children }) }));
|
|
21
|
-
}
|
|
22
|
-
function EnvironmentVariablesHeader({ className, ...props }) {
|
|
23
|
-
return (_jsx("div", { "data-slot": "environment-variables-header", className: cn("flex items-center justify-between gap-3", className), ...props }));
|
|
24
|
-
}
|
|
25
|
-
function EnvironmentVariablesTitle({ className, ...props }) {
|
|
26
|
-
return (_jsx("h3", { "data-slot": "environment-variables-title", className: cn("text-sm font-medium", className), ...props }));
|
|
27
|
-
}
|
|
28
|
-
function EnvironmentVariablesToggle(props) {
|
|
29
|
-
const { revealed, setRevealed } = useEnvironmentVariables();
|
|
30
|
-
return (_jsx(Switch, { checked: revealed, "data-slot": "environment-variables-toggle", onCheckedChange: setRevealed, ...props }));
|
|
31
|
-
}
|
|
32
|
-
function EnvironmentVariablesContent({ className, ...props }) {
|
|
33
|
-
return (_jsx("div", { "data-slot": "environment-variables-content", className: cn("grid gap-2", className), ...props }));
|
|
34
|
-
}
|
|
35
|
-
function EnvironmentVariableGroup({ className, ...props }) {
|
|
36
|
-
return (_jsx("div", { "data-slot": "environment-variable-group", className: cn("grid gap-2", className), ...props }));
|
|
37
|
-
}
|
|
38
|
-
function EnvironmentVariable({ children, className, value, ...props }) {
|
|
39
|
-
const contextValue = useMemo(() => ({ value }), [value]);
|
|
40
|
-
return (_jsx(EnvironmentVariableContext.Provider, { value: contextValue, children: _jsx("div", { "data-slot": "environment-variable", className: cn("grid gap-1 rounded-md border bg-muted/30 p-2", className), ...props, children: children }) }));
|
|
41
|
-
}
|
|
42
|
-
function EnvironmentVariableName({ className, ...props }) {
|
|
43
|
-
return (_jsx("span", { "data-slot": "environment-variable-name", className: cn("font-mono text-xs font-medium", className), ...props }));
|
|
44
|
-
}
|
|
45
|
-
function EnvironmentVariableValue({ className, ...props }) {
|
|
46
|
-
const { revealed } = useEnvironmentVariables();
|
|
47
|
-
const { value } = useContext(EnvironmentVariableContext);
|
|
48
|
-
return (_jsx("span", { "data-slot": "environment-variable-value", className: cn("break-all font-mono text-xs text-muted-foreground", className), ...props, children: props.children ?? (revealed ? value : maskValue(value)) }));
|
|
49
|
-
}
|
|
50
|
-
function EnvironmentVariableCopyButton({ children, onClick, type = "button", ...props }) {
|
|
51
|
-
const { value } = useContext(EnvironmentVariableContext);
|
|
52
|
-
const [copied, setCopied] = useState(false);
|
|
53
|
-
const Icon = copied ? CheckIcon : CopyIcon;
|
|
54
|
-
return (_jsx(Button, { "aria-label": copied ? "Copied" : "Copy variable", size: "icon", variant: "ghost", ...props, type: type, onClick: (event) => {
|
|
55
|
-
onClick?.(event);
|
|
56
|
-
if (!event.defaultPrevented)
|
|
57
|
-
void copyToClipboard(value, setCopied);
|
|
58
|
-
}, children: children ?? _jsx(Icon, { "aria-hidden": "true", className: "size-4" }) }));
|
|
59
|
-
}
|
|
60
|
-
function EnvironmentVariableRequired({ children = "required", variant = "outline", ...props }) {
|
|
61
|
-
return (_jsx(Badge, { "data-slot": "environment-variable-required", variant: variant, ...props, children: children }));
|
|
62
|
-
}
|
|
63
|
-
function maskValue(value) {
|
|
64
|
-
return value.length > 0 ? "••••••••••••" : "";
|
|
65
|
-
}
|
|
66
|
-
export { EnvironmentVariable, EnvironmentVariableCopyButton, EnvironmentVariableGroup, EnvironmentVariableName, EnvironmentVariableRequired, EnvironmentVariableValue, EnvironmentVariables, EnvironmentVariablesContent, EnvironmentVariablesHeader, EnvironmentVariablesTitle, EnvironmentVariablesToggle, };
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import type * as React from "react";
|
|
2
|
-
type FileTreeProps = Omit<React.ComponentProps<"div">, "onSelect"> & {
|
|
3
|
-
defaultSelectedPath?: string;
|
|
4
|
-
onSelect?: (path: string) => void;
|
|
5
|
-
selectedPath?: string;
|
|
6
|
-
};
|
|
7
|
-
type FileTreeFolderProps = React.ComponentProps<"div"> & {
|
|
8
|
-
defaultOpen?: boolean;
|
|
9
|
-
name: string;
|
|
10
|
-
};
|
|
11
|
-
type FileTreeFileProps = React.ComponentProps<"button"> & {
|
|
12
|
-
path: string;
|
|
13
|
-
};
|
|
14
|
-
type FileTreeIconProps = React.ComponentProps<"span">;
|
|
15
|
-
type FileTreeNameProps = React.ComponentProps<"span">;
|
|
16
|
-
type FileTreeActionsProps = React.ComponentProps<"div">;
|
|
17
|
-
declare function FileTree({ children, className, defaultSelectedPath, onSelect, selectedPath, ...props }: FileTreeProps): React.JSX.Element;
|
|
18
|
-
declare function FileTreeFolder({ children, className, defaultOpen, name, ...props }: FileTreeFolderProps): React.JSX.Element;
|
|
19
|
-
declare function FileTreeFile({ children, className, onClick, path, ...props }: FileTreeFileProps): React.JSX.Element;
|
|
20
|
-
declare function FileTreeIcon({ className, ...props }: FileTreeIconProps): React.JSX.Element;
|
|
21
|
-
declare function FileTreeName({ className, ...props }: FileTreeNameProps): React.JSX.Element;
|
|
22
|
-
declare function FileTreeActions({ className, ...props }: FileTreeActionsProps): React.JSX.Element;
|
|
23
|
-
export { FileTree, FileTreeActions, FileTreeFile, FileTreeFolder, FileTreeIcon, FileTreeName };
|
|
24
|
-
export type { FileTreeActionsProps, FileTreeFileProps, FileTreeFolderProps, FileTreeIconProps, FileTreeNameProps, FileTreeProps, };
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { ChevronDownIcon, FileIcon, FolderIcon, FolderOpenIcon } from "lucide-react";
|
|
3
|
-
import { createContext, useContext, useMemo, useState } from "react";
|
|
4
|
-
import { cn } from "@ciridae/ui/utils";
|
|
5
|
-
const FileTreeContext = createContext(null);
|
|
6
|
-
const FileTreeFolderContext = createContext({ open: false });
|
|
7
|
-
const FileTreeFileContext = createContext(null);
|
|
8
|
-
function useFileTree() {
|
|
9
|
-
const context = useContext(FileTreeContext);
|
|
10
|
-
if (!context)
|
|
11
|
-
throw new Error("FileTree components must be used within FileTree");
|
|
12
|
-
return context;
|
|
13
|
-
}
|
|
14
|
-
function FileTree({ children, className, defaultSelectedPath, onSelect, selectedPath, ...props }) {
|
|
15
|
-
const [internalSelected, setInternalSelected] = useState(defaultSelectedPath);
|
|
16
|
-
const resolvedSelected = selectedPath ?? internalSelected;
|
|
17
|
-
const contextValue = useMemo(() => ({
|
|
18
|
-
selectedPath: resolvedSelected,
|
|
19
|
-
setSelectedPath: (path) => {
|
|
20
|
-
setInternalSelected(path);
|
|
21
|
-
onSelect?.(path);
|
|
22
|
-
},
|
|
23
|
-
}), [onSelect, resolvedSelected]);
|
|
24
|
-
return (_jsx(FileTreeContext.Provider, { value: contextValue, children: _jsx("div", { "data-slot": "file-tree", className: cn("grid gap-1 rounded-lg border bg-card p-2", className), ...props, children: children }) }));
|
|
25
|
-
}
|
|
26
|
-
function FileTreeFolder({ children, className, defaultOpen = true, name, ...props }) {
|
|
27
|
-
const [open, setOpen] = useState(defaultOpen);
|
|
28
|
-
const contextValue = useMemo(() => ({ open }), [open]);
|
|
29
|
-
return (_jsx(FileTreeFolderContext.Provider, { value: contextValue, children: _jsxs("div", { "data-slot": "file-tree-folder", className: cn("grid gap-1", className), ...props, children: [_jsxs("button", { className: "flex min-w-0 items-center gap-2 rounded-md px-2 py-1 text-left text-sm hover:bg-muted", onClick: () => setOpen(!open), type: "button", children: [_jsx(ChevronDownIcon, { "aria-hidden": "true", className: cn("size-4 shrink-0 transition-transform", open ? undefined : "-rotate-90") }), _jsx(FileTreeIcon, {}), _jsx(FileTreeName, { children: name })] }), open ? _jsx("div", { className: "grid gap-1 pl-4", children: children }) : null] }) }));
|
|
30
|
-
}
|
|
31
|
-
function FileTreeFile({ children, className, onClick, path, ...props }) {
|
|
32
|
-
const { selectedPath, setSelectedPath } = useFileTree();
|
|
33
|
-
const contextValue = useMemo(() => ({ path, selected: selectedPath === path }), [path, selectedPath]);
|
|
34
|
-
return (_jsx(FileTreeFileContext.Provider, { value: contextValue, children: _jsx("button", { "data-slot": "file-tree-file", "data-selected": contextValue.selected ? "true" : undefined, className: cn("flex min-w-0 items-center gap-2 rounded-md px-2 py-1 text-left text-sm hover:bg-muted data-[selected=true]:bg-muted", className), ...props, type: "button", onClick: (event) => {
|
|
35
|
-
onClick?.(event);
|
|
36
|
-
if (!event.defaultPrevented)
|
|
37
|
-
setSelectedPath(path);
|
|
38
|
-
}, children: children ?? (_jsxs(_Fragment, { children: [_jsx(FileTreeIcon, {}), _jsx(FileTreeName, { children: getFileName(path) })] })) }) }));
|
|
39
|
-
}
|
|
40
|
-
function FileTreeIcon({ className, ...props }) {
|
|
41
|
-
const folder = useContext(FileTreeFolderContext);
|
|
42
|
-
const file = useContext(FileTreeFileContext);
|
|
43
|
-
const Icon = file ? FileIcon : folder.open ? FolderOpenIcon : FolderIcon;
|
|
44
|
-
return (_jsx("span", { "data-slot": "file-tree-icon", className: cn("shrink-0 text-muted-foreground", className), ...props, children: _jsx(Icon, { "aria-hidden": "true", className: "size-4" }) }));
|
|
45
|
-
}
|
|
46
|
-
function FileTreeName({ className, ...props }) {
|
|
47
|
-
return (_jsx("span", { "data-slot": "file-tree-name", className: cn("min-w-0 flex-1 truncate", className), ...props }));
|
|
48
|
-
}
|
|
49
|
-
function FileTreeActions({ className, ...props }) {
|
|
50
|
-
return (_jsx("div", { "data-slot": "file-tree-actions", className: cn("ml-auto flex shrink-0 items-center gap-1", className), ...props }));
|
|
51
|
-
}
|
|
52
|
-
function getFileName(path) {
|
|
53
|
-
const parts = path.split("/");
|
|
54
|
-
return parts[parts.length - 1];
|
|
55
|
-
}
|
|
56
|
-
export { FileTree, FileTreeActions, FileTreeFile, FileTreeFolder, FileTreeIcon, FileTreeName };
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type * as React from "react";
|
|
2
|
-
type ImageProps = Omit<React.ComponentProps<"img">, "src"> & {
|
|
3
|
-
base64?: string;
|
|
4
|
-
mediaType?: string;
|
|
5
|
-
src?: string;
|
|
6
|
-
};
|
|
7
|
-
declare function Image({ alt, base64, className, mediaType, src, ...props }: ImageProps): React.JSX.Element;
|
|
8
|
-
export { Image };
|
|
9
|
-
export type { ImageProps };
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { cn } from "@ciridae/ui/utils";
|
|
3
|
-
function Image({ alt = "", base64, className, mediaType = "image/png", src, ...props }) {
|
|
4
|
-
return (_jsx("img", { alt: alt, className: cn("h-auto max-w-full overflow-hidden rounded-md border bg-muted object-contain", className), "data-slot": "image", src: src ?? buildDataUrl(base64, mediaType), ...props }));
|
|
5
|
-
}
|
|
6
|
-
function buildDataUrl(base64, mediaType) {
|
|
7
|
-
if (!base64)
|
|
8
|
-
return undefined;
|
|
9
|
-
return `data:${mediaType};base64,${base64}`;
|
|
10
|
-
}
|
|
11
|
-
export { Image };
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import type * as React from "react";
|
|
2
|
-
import { Badge } from "@ciridae/ui/badge";
|
|
3
|
-
import { Carousel, CarouselContent, CarouselItem } from "@ciridae/ui/carousel";
|
|
4
|
-
import { HoverCard } from "@ciridae/ui/hover-card";
|
|
5
|
-
type InlineCitationProps = React.ComponentProps<"span">;
|
|
6
|
-
type InlineCitationTextProps = React.ComponentProps<"span">;
|
|
7
|
-
type InlineCitationCardProps = React.ComponentProps<typeof HoverCard>;
|
|
8
|
-
type InlineCitationCardTriggerProps = React.ComponentProps<typeof Badge> & {
|
|
9
|
-
sources: string[];
|
|
10
|
-
};
|
|
11
|
-
type InlineCitationCardBodyProps = React.ComponentProps<"div">;
|
|
12
|
-
type InlineCitationCarouselProps = React.ComponentProps<typeof Carousel>;
|
|
13
|
-
type InlineCitationCarouselContentProps = React.ComponentProps<typeof CarouselContent>;
|
|
14
|
-
type InlineCitationCarouselItemProps = React.ComponentProps<typeof CarouselItem>;
|
|
15
|
-
type InlineCitationCarouselHeaderProps = React.ComponentProps<"div">;
|
|
16
|
-
type InlineCitationCarouselIndexProps = React.ComponentProps<"div">;
|
|
17
|
-
type InlineCitationCarouselPrevProps = React.ComponentProps<"button">;
|
|
18
|
-
type InlineCitationCarouselNextProps = React.ComponentProps<"button">;
|
|
19
|
-
type InlineCitationSourceProps = React.ComponentProps<"div"> & {
|
|
20
|
-
description?: string;
|
|
21
|
-
title?: string;
|
|
22
|
-
url?: string;
|
|
23
|
-
};
|
|
24
|
-
type InlineCitationQuoteProps = React.ComponentProps<"blockquote">;
|
|
25
|
-
declare function InlineCitation({ className, ...props }: InlineCitationProps): React.JSX.Element;
|
|
26
|
-
declare function InlineCitationText({ className, ...props }: InlineCitationTextProps): React.JSX.Element;
|
|
27
|
-
declare function InlineCitationCard({ closeDelay, openDelay, ...props }: InlineCitationCardProps): React.JSX.Element;
|
|
28
|
-
declare function InlineCitationCardTrigger({ className, sources, ...props }: InlineCitationCardTriggerProps): React.JSX.Element;
|
|
29
|
-
declare function InlineCitationCardBody({ className, ...props }: InlineCitationCardBodyProps): React.JSX.Element;
|
|
30
|
-
declare function InlineCitationCarousel({ children, className, setApi, ...props }: InlineCitationCarouselProps): React.JSX.Element;
|
|
31
|
-
declare function InlineCitationCarouselContent(props: InlineCitationCarouselContentProps): React.JSX.Element;
|
|
32
|
-
declare function InlineCitationCarouselItem({ className, ...props }: InlineCitationCarouselItemProps): React.JSX.Element;
|
|
33
|
-
declare function InlineCitationCarouselHeader({ className, ...props }: InlineCitationCarouselHeaderProps): React.JSX.Element;
|
|
34
|
-
declare function InlineCitationCarouselIndex({ children, className, ...props }: InlineCitationCarouselIndexProps): React.JSX.Element;
|
|
35
|
-
declare function InlineCitationCarouselPrev({ children, ...props }: InlineCitationCarouselPrevProps): React.JSX.Element;
|
|
36
|
-
declare function InlineCitationCarouselNext({ children, ...props }: InlineCitationCarouselNextProps): React.JSX.Element;
|
|
37
|
-
declare function InlineCitationSource({ children, className, description, title, url, ...props }: InlineCitationSourceProps): React.JSX.Element;
|
|
38
|
-
declare function InlineCitationQuote({ children, className, ...props }: InlineCitationQuoteProps): React.JSX.Element;
|
|
39
|
-
export { InlineCitation, InlineCitationCard, InlineCitationCardBody, InlineCitationCardTrigger, InlineCitationCarousel, InlineCitationCarouselContent, InlineCitationCarouselHeader, InlineCitationCarouselIndex, InlineCitationCarouselItem, InlineCitationCarouselNext, InlineCitationCarouselPrev, InlineCitationQuote, InlineCitationSource, InlineCitationText, };
|
|
40
|
-
export type { InlineCitationCardBodyProps, InlineCitationCardProps, InlineCitationCardTriggerProps, InlineCitationCarouselContentProps, InlineCitationCarouselHeaderProps, InlineCitationCarouselIndexProps, InlineCitationCarouselItemProps, InlineCitationCarouselNextProps, InlineCitationCarouselPrevProps, InlineCitationCarouselProps, InlineCitationProps, InlineCitationQuoteProps, InlineCitationSourceProps, InlineCitationTextProps, };
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { ArrowLeftIcon, ArrowRightIcon } from "lucide-react";
|
|
3
|
-
import { createContext, useCallback, useContext, useEffect, useState } from "react";
|
|
4
|
-
import { Badge } from "@ciridae/ui/badge";
|
|
5
|
-
import { Carousel, CarouselContent, CarouselItem } from "@ciridae/ui/carousel";
|
|
6
|
-
import { HoverCard, HoverCardContent, HoverCardTrigger } from "@ciridae/ui/hover-card";
|
|
7
|
-
import { cn } from "@ciridae/ui/utils";
|
|
8
|
-
const CarouselApiContext = createContext(undefined);
|
|
9
|
-
function useInlineCitationCarouselApi() {
|
|
10
|
-
return useContext(CarouselApiContext);
|
|
11
|
-
}
|
|
12
|
-
function InlineCitation({ className, ...props }) {
|
|
13
|
-
return (_jsx("span", { "data-slot": "inline-citation", className: cn("group inline items-center gap-1 align-baseline", className), ...props }));
|
|
14
|
-
}
|
|
15
|
-
function InlineCitationText({ className, ...props }) {
|
|
16
|
-
return (_jsx("span", { "data-slot": "inline-citation-text", className: cn("text-foreground transition-colors group-hover:bg-accent group-hover:text-accent-foreground", className), ...props }));
|
|
17
|
-
}
|
|
18
|
-
function InlineCitationCard({ closeDelay = 0, openDelay = 0, ...props }) {
|
|
19
|
-
return _jsx(HoverCard, { closeDelay: closeDelay, openDelay: openDelay, ...props });
|
|
20
|
-
}
|
|
21
|
-
function InlineCitationCardTrigger({ className, sources, ...props }) {
|
|
22
|
-
return (_jsx(HoverCardTrigger, { "data-slot": "inline-citation-card-trigger", asChild: true, children: _jsx(Badge, { tabIndex: 0, variant: "secondary", className: cn("ml-1 cursor-default rounded-full px-1.5 py-0 text-[0.6875rem]", className), ...props, children: formatSourceHost(sources) }) }));
|
|
23
|
-
}
|
|
24
|
-
function InlineCitationCardBody({ className, ...props }) {
|
|
25
|
-
return (_jsx(HoverCardContent, { "data-slot": "inline-citation-card-body", className: cn("relative w-80 p-0", className), ...props }));
|
|
26
|
-
}
|
|
27
|
-
function InlineCitationCarousel({ children, className, setApi, ...props }) {
|
|
28
|
-
const [api, setLocalApi] = useState();
|
|
29
|
-
const handleSetApi = useCallback((nextApi) => {
|
|
30
|
-
setLocalApi(nextApi);
|
|
31
|
-
setApi?.(nextApi);
|
|
32
|
-
}, [setApi]);
|
|
33
|
-
return (_jsx(CarouselApiContext.Provider, { value: api, children: _jsx(Carousel, { className: cn("w-full", className), setApi: handleSetApi, ...props, children: children }) }));
|
|
34
|
-
}
|
|
35
|
-
function InlineCitationCarouselContent(props) {
|
|
36
|
-
return _jsx(CarouselContent, { "data-slot": "inline-citation-carousel-content", ...props });
|
|
37
|
-
}
|
|
38
|
-
function InlineCitationCarouselItem({ className, ...props }) {
|
|
39
|
-
return (_jsx(CarouselItem, { "data-slot": "inline-citation-carousel-item", className: cn("w-full basis-full space-y-2 p-4 pl-8", className), ...props }));
|
|
40
|
-
}
|
|
41
|
-
function InlineCitationCarouselHeader({ className, ...props }) {
|
|
42
|
-
return (_jsx("div", { "data-slot": "inline-citation-carousel-header", className: cn("flex items-center justify-between gap-2 rounded-t-md bg-secondary p-2", className), ...props }));
|
|
43
|
-
}
|
|
44
|
-
function InlineCitationCarouselIndex({ children, className, ...props }) {
|
|
45
|
-
const api = useInlineCitationCarouselApi();
|
|
46
|
-
const { count, current } = useCarouselIndex(api);
|
|
47
|
-
return (_jsx("div", { "data-slot": "inline-citation-carousel-index", className: cn("flex flex-1 items-center justify-end px-3 py-1 text-xs text-muted-foreground", className), ...props, children: children ?? `${current}/${count}` }));
|
|
48
|
-
}
|
|
49
|
-
function InlineCitationCarouselPrev({ children, ...props }) {
|
|
50
|
-
return (_jsx(InlineCitationCarouselButton, { direction: "prev", ...props, children: children ?? _jsx(ArrowLeftIcon, {}) }));
|
|
51
|
-
}
|
|
52
|
-
function InlineCitationCarouselNext({ children, ...props }) {
|
|
53
|
-
return (_jsx(InlineCitationCarouselButton, { direction: "next", ...props, children: children ?? _jsx(ArrowRightIcon, {}) }));
|
|
54
|
-
}
|
|
55
|
-
function InlineCitationCarouselButton({ children, className, direction, type = "button", onClick, ...props }) {
|
|
56
|
-
const api = useInlineCitationCarouselApi();
|
|
57
|
-
const carouselState = useCarouselIndex(api);
|
|
58
|
-
const isPrevious = direction === "prev";
|
|
59
|
-
return (_jsx("button", { "aria-label": isPrevious ? "Previous source" : "Next source", "data-slot": `inline-citation-carousel-${direction}`, className: cn("inline-flex size-7 shrink-0 items-center justify-center rounded-sm text-muted-foreground transition-colors hover:bg-accent hover:text-accent-foreground focus-visible:ring-[var(--focus-ring-width)] focus-visible:ring-ring focus-visible:outline-none disabled:pointer-events-none disabled:opacity-45 [&_svg]:size-4", className), disabled: isPrevious ? !carouselState.canScrollPrev : !carouselState.canScrollNext, onClick: (event) => {
|
|
60
|
-
onClick?.(event);
|
|
61
|
-
if (event.defaultPrevented)
|
|
62
|
-
return;
|
|
63
|
-
if (isPrevious)
|
|
64
|
-
api?.scrollPrev();
|
|
65
|
-
else
|
|
66
|
-
api?.scrollNext();
|
|
67
|
-
}, ...props, type: type, children: children }));
|
|
68
|
-
}
|
|
69
|
-
function InlineCitationSource({ children, className, description, title, url, ...props }) {
|
|
70
|
-
return (_jsxs("div", { "data-slot": "inline-citation-source", className: cn("grid gap-1.5 px-3 py-3 text-sm", className), ...props, children: [title ? _jsx("h4", { className: "font-medium text-foreground", children: title }) : null, url ? _jsx("p", { className: "truncate font-mono text-xs text-muted-foreground", children: url }) : null, description ? _jsx("p", { className: "text-muted-foreground", children: description }) : null, children] }));
|
|
71
|
-
}
|
|
72
|
-
function InlineCitationQuote({ children, className, ...props }) {
|
|
73
|
-
return (_jsx("blockquote", { "data-slot": "inline-citation-quote", className: cn("border-l-2 pl-3 text-sm text-muted-foreground", className), ...props, children: children }));
|
|
74
|
-
}
|
|
75
|
-
function useCarouselIndex(api) {
|
|
76
|
-
const [current, setCurrent] = useState(0);
|
|
77
|
-
const [count, setCount] = useState(0);
|
|
78
|
-
const [canScrollNext, setCanScrollNext] = useState(false);
|
|
79
|
-
const [canScrollPrev, setCanScrollPrev] = useState(false);
|
|
80
|
-
useEffect(() => {
|
|
81
|
-
if (!api)
|
|
82
|
-
return;
|
|
83
|
-
const syncState = () => {
|
|
84
|
-
setCount(api.scrollSnapList().length);
|
|
85
|
-
setCurrent(api.selectedScrollSnap() + 1);
|
|
86
|
-
setCanScrollPrev(api.canScrollPrev());
|
|
87
|
-
setCanScrollNext(api.canScrollNext());
|
|
88
|
-
};
|
|
89
|
-
syncState();
|
|
90
|
-
api.on("select", syncState);
|
|
91
|
-
api.on("reInit", syncState);
|
|
92
|
-
return () => {
|
|
93
|
-
api.off("select", syncState);
|
|
94
|
-
api.off("reInit", syncState);
|
|
95
|
-
};
|
|
96
|
-
}, [api]);
|
|
97
|
-
return { canScrollNext, canScrollPrev, count, current };
|
|
98
|
-
}
|
|
99
|
-
function formatSourceHost(sources) {
|
|
100
|
-
const firstSource = sources[0];
|
|
101
|
-
const suffix = sources.length > 1 ? ` +${sources.length - 1}` : "";
|
|
102
|
-
if (!firstSource)
|
|
103
|
-
return "source";
|
|
104
|
-
try {
|
|
105
|
-
return `${new URL(firstSource).hostname}${suffix}`;
|
|
106
|
-
}
|
|
107
|
-
catch {
|
|
108
|
-
return `${firstSource}${suffix}`;
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
export { InlineCitation, InlineCitationCard, InlineCitationCardBody, InlineCitationCardTrigger, InlineCitationCarousel, InlineCitationCarouselContent, InlineCitationCarouselHeader, InlineCitationCarouselIndex, InlineCitationCarouselItem, InlineCitationCarouselNext, InlineCitationCarouselPrev, InlineCitationQuote, InlineCitationSource, InlineCitationText, };
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type * as React from "react";
|
|
2
|
-
import { type TProps as JsxParserProps } from "react-jsx-parser";
|
|
3
|
-
type JSXPreviewProps = React.ComponentProps<"div"> & {
|
|
4
|
-
bindings?: JsxParserProps["bindings"];
|
|
5
|
-
components?: JsxParserProps["components"];
|
|
6
|
-
jsx: string;
|
|
7
|
-
onError?: (error: Error) => void;
|
|
8
|
-
};
|
|
9
|
-
type JSXPreviewContentProps = Omit<React.ComponentProps<"div">, "children">;
|
|
10
|
-
type JSXPreviewErrorProps = React.ComponentProps<"div"> & {
|
|
11
|
-
fallback?: React.ReactNode;
|
|
12
|
-
};
|
|
13
|
-
declare function JSXPreview({ bindings, children, className, components, jsx, onError, ...props }: JSXPreviewProps): React.JSX.Element;
|
|
14
|
-
declare function JSXPreviewContent({ className, onError, ...props }: JSXPreviewContentProps & {
|
|
15
|
-
onError?: (error: Error) => void;
|
|
16
|
-
}): React.JSX.Element;
|
|
17
|
-
declare function JSXPreviewError({ className, fallback, ...props }: JSXPreviewErrorProps): React.JSX.Element | null;
|
|
18
|
-
export { JSXPreview, JSXPreviewContent, JSXPreviewError };
|
|
19
|
-
export type { JSXPreviewContentProps, JSXPreviewErrorProps, JSXPreviewProps };
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { AlertCircleIcon } from "lucide-react";
|
|
3
|
-
import { createContext, useContext, useEffect, useMemo, useState } from "react";
|
|
4
|
-
import JsxParser from "react-jsx-parser";
|
|
5
|
-
import { cn } from "@ciridae/ui/utils";
|
|
6
|
-
const JSXPreviewContext = createContext(null);
|
|
7
|
-
function useJSXPreview() {
|
|
8
|
-
const context = useContext(JSXPreviewContext);
|
|
9
|
-
if (!context)
|
|
10
|
-
throw new Error("JSXPreview components must be used within JSXPreview");
|
|
11
|
-
return context;
|
|
12
|
-
}
|
|
13
|
-
function JSXPreview({ bindings, children, className, components, jsx, onError, ...props }) {
|
|
14
|
-
const [error, setError] = useState(null);
|
|
15
|
-
useEffect(() => {
|
|
16
|
-
setError(null);
|
|
17
|
-
}, [jsx]);
|
|
18
|
-
const contextValue = useMemo(() => ({ bindings, components, error, jsx, setError }), [bindings, components, error, jsx]);
|
|
19
|
-
return (_jsx(JSXPreviewContext.Provider, { value: contextValue, children: _jsx("div", { "data-slot": "jsx-preview", className: cn("relative rounded-lg border bg-card p-4", className), ...props, children: children ?? (_jsxs(_Fragment, { children: [_jsx(JSXPreviewContent, { onError: onError }), _jsx(JSXPreviewError, {})] })) }) }));
|
|
20
|
-
}
|
|
21
|
-
function JSXPreviewContent({ className, onError, ...props }) {
|
|
22
|
-
const { bindings, components, jsx, setError } = useJSXPreview();
|
|
23
|
-
return (_jsx("div", { "data-slot": "jsx-preview-content", className: cn("min-h-40", className), ...props, children: _jsx(JsxParser, { allowUnknownElements: false, bindings: bindings, blacklistedAttrs: [/^on.+/i, "style"], blacklistedTags: ["script", "style", "iframe"], components: components, componentsOnly: true, jsx: jsx, onError: (error) => {
|
|
24
|
-
setError(error);
|
|
25
|
-
onError?.(error);
|
|
26
|
-
}, renderInWrapper: false, showWarnings: false }) }));
|
|
27
|
-
}
|
|
28
|
-
function JSXPreviewError({ className, fallback, ...props }) {
|
|
29
|
-
const { error } = useJSXPreview();
|
|
30
|
-
if (!error)
|
|
31
|
-
return null;
|
|
32
|
-
return (_jsxs("div", { "data-slot": "jsx-preview-error", className: cn("mt-3 flex gap-2 rounded-md border p-3 text-sm text-muted-foreground", className), ...props, children: [_jsx(AlertCircleIcon, { "aria-hidden": "true", className: "size-4 shrink-0 text-destructive" }), _jsx("div", { className: "min-w-0", children: fallback ?? error.message })] }));
|
|
33
|
-
}
|
|
34
|
-
export { JSXPreview, JSXPreviewContent, JSXPreviewError };
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import type * as React from "react";
|
|
2
|
-
import { Button } from "@ciridae/ui/button";
|
|
3
|
-
import { ButtonGroup, ButtonGroupText } from "@ciridae/ui/button-group";
|
|
4
|
-
type MessageBranchProps = React.ComponentProps<"div"> & {
|
|
5
|
-
defaultBranch?: number;
|
|
6
|
-
onBranchChange?: (branchIndex: number) => void;
|
|
7
|
-
};
|
|
8
|
-
type MessageBranchContentProps = React.ComponentProps<"div">;
|
|
9
|
-
type MessageBranchSelectorProps = React.ComponentProps<typeof ButtonGroup>;
|
|
10
|
-
type MessageBranchPreviousProps = React.ComponentProps<typeof Button>;
|
|
11
|
-
type MessageBranchNextProps = React.ComponentProps<typeof Button>;
|
|
12
|
-
type MessageBranchPageProps = React.ComponentProps<typeof ButtonGroupText>;
|
|
13
|
-
declare function MessageBranch({ className, defaultBranch, onBranchChange, ...props }: MessageBranchProps): React.JSX.Element;
|
|
14
|
-
declare function MessageBranchContent({ children, className, ...props }: MessageBranchContentProps): React.JSX.Element;
|
|
15
|
-
declare function MessageBranchSelector({ className, ...props }: MessageBranchSelectorProps): React.JSX.Element | null;
|
|
16
|
-
declare function MessageBranchPrevious({ children, disabled, onClick, type, ...props }: MessageBranchPreviousProps): React.JSX.Element;
|
|
17
|
-
declare function MessageBranchNext({ children, disabled, onClick, type, ...props }: MessageBranchNextProps): React.JSX.Element;
|
|
18
|
-
declare function MessageBranchPage({ className, ...props }: MessageBranchPageProps): React.JSX.Element;
|
|
19
|
-
export { MessageBranch, MessageBranchContent, MessageBranchNext, MessageBranchPage, MessageBranchPrevious, MessageBranchSelector, };
|
|
20
|
-
export type { MessageBranchContentProps, MessageBranchNextProps, MessageBranchPageProps, MessageBranchPreviousProps, MessageBranchProps, MessageBranchSelectorProps, };
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { ChevronLeftIcon, ChevronRightIcon } from "lucide-react";
|
|
3
|
-
import { Children, createContext, useCallback, useContext, useEffect, useMemo, useState, } from "react";
|
|
4
|
-
import { Button } from "@ciridae/ui/button";
|
|
5
|
-
import { ButtonGroup, ButtonGroupText } from "@ciridae/ui/button-group";
|
|
6
|
-
import { cn } from "@ciridae/ui/utils";
|
|
7
|
-
const MessageBranchContext = createContext(null);
|
|
8
|
-
function useMessageBranch() {
|
|
9
|
-
const context = useContext(MessageBranchContext);
|
|
10
|
-
if (!context) {
|
|
11
|
-
throw new Error("MessageBranch components must be used within MessageBranch");
|
|
12
|
-
}
|
|
13
|
-
return context;
|
|
14
|
-
}
|
|
15
|
-
function MessageBranch({ className, defaultBranch = 0, onBranchChange, ...props }) {
|
|
16
|
-
const [totalBranches, setTotalBranches] = useState(0);
|
|
17
|
-
const [currentBranch, setCurrentBranch] = useState(Math.max(defaultBranch, 0));
|
|
18
|
-
const handleBranchChange = useCallback((branchIndex) => {
|
|
19
|
-
setCurrentBranch(branchIndex);
|
|
20
|
-
onBranchChange?.(branchIndex);
|
|
21
|
-
}, [onBranchChange]);
|
|
22
|
-
const goToPrevious = useCallback(() => {
|
|
23
|
-
if (totalBranches <= 1)
|
|
24
|
-
return;
|
|
25
|
-
const previousBranch = currentBranch > 0 ? currentBranch - 1 : totalBranches - 1;
|
|
26
|
-
handleBranchChange(previousBranch);
|
|
27
|
-
}, [currentBranch, handleBranchChange, totalBranches]);
|
|
28
|
-
const goToNext = useCallback(() => {
|
|
29
|
-
if (totalBranches <= 1)
|
|
30
|
-
return;
|
|
31
|
-
const nextBranch = currentBranch < totalBranches - 1 ? currentBranch + 1 : 0;
|
|
32
|
-
handleBranchChange(nextBranch);
|
|
33
|
-
}, [currentBranch, handleBranchChange, totalBranches]);
|
|
34
|
-
useEffect(() => {
|
|
35
|
-
if (totalBranches === 0 || currentBranch < totalBranches)
|
|
36
|
-
return;
|
|
37
|
-
handleBranchChange(totalBranches - 1);
|
|
38
|
-
}, [currentBranch, handleBranchChange, totalBranches]);
|
|
39
|
-
const contextValue = useMemo(() => ({
|
|
40
|
-
currentBranch,
|
|
41
|
-
goToNext,
|
|
42
|
-
goToPrevious,
|
|
43
|
-
setTotalBranches,
|
|
44
|
-
totalBranches,
|
|
45
|
-
}), [currentBranch, goToNext, goToPrevious, totalBranches]);
|
|
46
|
-
return (_jsx(MessageBranchContext.Provider, { value: contextValue, children: _jsx("div", { "data-slot": "message-branch", className: cn("grid w-full gap-2", className), ...props }) }));
|
|
47
|
-
}
|
|
48
|
-
function MessageBranchContent({ children, className, ...props }) {
|
|
49
|
-
const { currentBranch, setTotalBranches } = useMessageBranch();
|
|
50
|
-
const childrenArray = useMemo(() => Children.toArray(children), [children]);
|
|
51
|
-
useEffect(() => {
|
|
52
|
-
setTotalBranches((currentTotal) => currentTotal === childrenArray.length ? currentTotal : childrenArray.length);
|
|
53
|
-
}, [childrenArray.length, setTotalBranches]);
|
|
54
|
-
return (_jsx("div", { "data-slot": "message-branch-content", className: cn("grid gap-2 overflow-hidden", className), ...props, children: childrenArray.map((branch, index) => (_jsx("div", { "data-slot": "message-branch-content-item", "data-active": index === currentBranch ? "true" : "false", className: "grid gap-2 overflow-hidden data-[active=false]:hidden", children: branch }, index))) }));
|
|
55
|
-
}
|
|
56
|
-
function MessageBranchSelector({ className, ...props }) {
|
|
57
|
-
const { totalBranches } = useMessageBranch();
|
|
58
|
-
if (totalBranches <= 1)
|
|
59
|
-
return null;
|
|
60
|
-
return (_jsx(ButtonGroup, { "data-slot": "message-branch-selector", orientation: "horizontal", className: cn("items-center", className), ...props }));
|
|
61
|
-
}
|
|
62
|
-
function MessageBranchPrevious({ children, disabled, onClick, type = "button", ...props }) {
|
|
63
|
-
const { goToPrevious, totalBranches } = useMessageBranch();
|
|
64
|
-
return (_jsx(Button, { "aria-label": "Previous branch", disabled: disabled || totalBranches <= 1, onClick: (event) => {
|
|
65
|
-
onClick?.(event);
|
|
66
|
-
if (!event.defaultPrevented)
|
|
67
|
-
goToPrevious();
|
|
68
|
-
}, size: "icon-sm", variant: "ghost", ...props, type: type, children: children ?? _jsx(ChevronLeftIcon, {}) }));
|
|
69
|
-
}
|
|
70
|
-
function MessageBranchNext({ children, disabled, onClick, type = "button", ...props }) {
|
|
71
|
-
const { goToNext, totalBranches } = useMessageBranch();
|
|
72
|
-
return (_jsx(Button, { "aria-label": "Next branch", disabled: disabled || totalBranches <= 1, onClick: (event) => {
|
|
73
|
-
onClick?.(event);
|
|
74
|
-
if (!event.defaultPrevented)
|
|
75
|
-
goToNext();
|
|
76
|
-
}, size: "icon-sm", variant: "ghost", ...props, type: type, children: children ?? _jsx(ChevronRightIcon, {}) }));
|
|
77
|
-
}
|
|
78
|
-
function MessageBranchPage({ className, ...props }) {
|
|
79
|
-
const { currentBranch, totalBranches } = useMessageBranch();
|
|
80
|
-
const page = totalBranches === 0 ? 0 : currentBranch + 1;
|
|
81
|
-
return (_jsxs(ButtonGroupText, { "data-slot": "message-branch-page", className: cn("border-none bg-transparent px-2 text-xs text-muted-foreground shadow-none", className), ...props, children: [page, " of ", totalBranches] }));
|
|
82
|
-
}
|
|
83
|
-
export { MessageBranch, MessageBranchContent, MessageBranchNext, MessageBranchPage, MessageBranchPrevious, MessageBranchSelector, };
|