@schemavaults/ui 0.80.0 → 0.82.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/index.d.ts +4 -0
- package/dist/components/ui/index.js +2 -0
- package/dist/components/ui/index.js.map +1 -1
- package/dist/components/ui/split-button/index.d.ts +4 -0
- package/dist/components/ui/split-button/index.js +3 -0
- package/dist/components/ui/split-button/index.js.map +1 -0
- package/dist/components/ui/split-button/split-button-variants.d.ts +4 -0
- package/dist/components/ui/split-button/split-button-variants.js +13 -0
- package/dist/components/ui/split-button/split-button-variants.js.map +1 -0
- package/dist/components/ui/split-button/split-button.d.ts +60 -0
- package/dist/components/ui/split-button/split-button.js +60 -0
- package/dist/components/ui/split-button/split-button.js.map +1 -0
- package/dist/components/ui/terminal-frame/index.d.ts +2 -0
- package/dist/components/ui/terminal-frame/index.js +2 -0
- package/dist/components/ui/terminal-frame/index.js.map +1 -0
- package/dist/components/ui/terminal-frame/terminal-frame.d.ts +110 -0
- package/dist/components/ui/terminal-frame/terminal-frame.js +159 -0
- package/dist/components/ui/terminal-frame/terminal-frame.js.map +1 -0
- package/package.json +1 -1
|
@@ -210,5 +210,9 @@ export * from "./http-method-badge";
|
|
|
210
210
|
export type * from "./http-method-badge";
|
|
211
211
|
export * from "./browser-frame";
|
|
212
212
|
export type * from "./browser-frame";
|
|
213
|
+
export * from "./terminal-frame";
|
|
214
|
+
export type * from "./terminal-frame";
|
|
213
215
|
export * from "./inline-edit";
|
|
214
216
|
export type * from "./inline-edit";
|
|
217
|
+
export * from "./split-button";
|
|
218
|
+
export type * from "./split-button";
|
|
@@ -104,5 +104,7 @@ export * from "./time-picker";
|
|
|
104
104
|
export * from "./mark";
|
|
105
105
|
export * from "./http-method-badge";
|
|
106
106
|
export * from "./browser-frame";
|
|
107
|
+
export * from "./terminal-frame";
|
|
107
108
|
export * from "./inline-edit";
|
|
109
|
+
export * from "./split-button";
|
|
108
110
|
//# sourceMapping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c,CAAC;AAG7B,cAAc,WAAW,CAAC;AAG1B,cAAc,iBAAiB,CAAC;AAGhC,cAAc,eAAe,CAAC;AAG9B,cAAc,eAAe,CAAC;AAG9B,cAAc,qBAAqB,CAAC;AAGpC,cAAc,WAAW,CAAC;AAG1B,cAAc,UAAU,CAAC;AAGzB,cAAc,QAAQ,CAAC;AAGvB,cAAc,cAAc,CAAC;AAG7B,cAAc,iBAAiB,CAAC;AAGhC,cAAc,aAAa,CAAC;AAG5B,cAAc,gBAAgB,CAAC;AAG/B,cAAc,gBAAgB,CAAC;AAG/B,cAAc,oBAAoB,CAAC;AAGnC,cAAc,aAAa,CAAC;AAG5B,cAAc,aAAa,CAAC;AAG5B,cAAc,cAAc,CAAC;AAG7B,cAAc,qBAAqB,CAAC;AAGpC,cAAc,kBAAkB,CAAC;AAGjC,cAAc,aAAa,CAAC;AAG5B,cAAc,YAAY,CAAC;AAG3B,cAAc,aAAa,CAAC;AAG5B,cAAc,0BAA0B,CAAC;AAGzC,cAAc,qBAAqB,CAAC;AAGpC,cAAc,YAAY,CAAC;AAG3B,cAAc,eAAe,CAAC;AAG9B,cAAc,qBAAqB,CAAC;AAGpC,cAAc,eAAe,CAAC;AAG9B,cAAc,QAAQ,CAAC;AAGvB,cAAc,qBAAqB,CAAC;AAGpC,cAAc,iBAAiB,CAAC;AAGhC,cAAc,kBAAkB,CAAC;AAGjC,cAAc,eAAe,CAAC;AAG9B,cAAc,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { SplitButton, SplitButtonAction, SplitButtonTrigger, SplitButtonContent, splitButtonSizeIds, splitButtonVariantIds, } from "./split-button";
|
|
2
|
+
export type * from "./split-button";
|
|
3
|
+
export type * from "./split-button-variants";
|
|
4
|
+
export { SplitButton as default } from "./split-button";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/ui/split-button/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,EAClB,kBAAkB,EAClB,qBAAqB,GACtB,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EAAE,WAAW,IAAI,OAAO,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const splitButtonVariantIds: readonly ["default", "destructive", "outline", "secondary", "ghost"];
|
|
2
|
+
export type SplitButtonVariant = (typeof splitButtonVariantIds)[number];
|
|
3
|
+
export declare const splitButtonSizeIds: readonly ["sm", "default", "lg"];
|
|
4
|
+
export type SplitButtonSize = (typeof splitButtonSizeIds)[number];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"split-button-variants.js","sourceRoot":"","sources":["../../../../src/components/ui/split-button/split-button-variants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,SAAS;IACT,aAAa;IACb,SAAS;IACT,WAAW;IACX,OAAO;CAC6B,CAAC;AAGvC,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,IAAI;IACJ,SAAS;IACT,IAAI;CACgC,CAAC"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { type ButtonHTMLAttributes, type ComponentPropsWithoutRef, type HTMLAttributes, type ReactElement, type ReactNode, type Ref } from "react";
|
|
2
|
+
import { DropdownMenuContent } from "../dropdown-menu/dropdown-menu";
|
|
3
|
+
import { splitButtonSizeIds, splitButtonVariantIds, type SplitButtonSize, type SplitButtonVariant } from "./split-button-variants";
|
|
4
|
+
export interface SplitButtonProps extends HTMLAttributes<HTMLDivElement> {
|
|
5
|
+
/** Visual style shared by both halves. Mirrors the Button variants. */
|
|
6
|
+
variant?: SplitButtonVariant;
|
|
7
|
+
/** Height/padding shared by both halves. */
|
|
8
|
+
size?: SplitButtonSize;
|
|
9
|
+
/** Disables both the primary action and the dropdown trigger. */
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
/** Controlled open state for the dropdown menu. */
|
|
12
|
+
open?: boolean;
|
|
13
|
+
/** Uncontrolled initial open state for the dropdown menu. */
|
|
14
|
+
defaultOpen?: boolean;
|
|
15
|
+
/** Fires when the dropdown opens or closes. */
|
|
16
|
+
onOpenChange?: (open: boolean) => void;
|
|
17
|
+
/** Text direction forwarded to the underlying DropdownMenu.Root. */
|
|
18
|
+
dir?: "ltr" | "rtl";
|
|
19
|
+
/** Modal control forwarded to the underlying DropdownMenu.Root. */
|
|
20
|
+
modal?: boolean;
|
|
21
|
+
ref?: Ref<HTMLDivElement>;
|
|
22
|
+
}
|
|
23
|
+
declare function SplitButton({ variant, size, disabled, open, defaultOpen, onOpenChange, dir, modal, className, children, ref, ...props }: SplitButtonProps): ReactElement;
|
|
24
|
+
declare namespace SplitButton {
|
|
25
|
+
var displayName: string;
|
|
26
|
+
}
|
|
27
|
+
export interface SplitButtonActionProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
28
|
+
/** Override the container-provided variant just for the primary action. */
|
|
29
|
+
variant?: SplitButtonVariant;
|
|
30
|
+
/** Override the container-provided size just for the primary action. */
|
|
31
|
+
size?: SplitButtonSize;
|
|
32
|
+
}
|
|
33
|
+
declare function SplitButtonAction({ className, variant, size, disabled, type, ...props }: SplitButtonActionProps): ReactElement;
|
|
34
|
+
declare namespace SplitButtonAction {
|
|
35
|
+
var displayName: string;
|
|
36
|
+
}
|
|
37
|
+
export interface SplitButtonTriggerProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, "children"> {
|
|
38
|
+
/** Override the container-provided variant just for the trigger. */
|
|
39
|
+
variant?: SplitButtonVariant;
|
|
40
|
+
/** Override the container-provided size just for the trigger. */
|
|
41
|
+
size?: SplitButtonSize;
|
|
42
|
+
/** Optional replacement for the default chevron icon. */
|
|
43
|
+
icon?: ReactNode;
|
|
44
|
+
/**
|
|
45
|
+
* Accessible label for the icon-only trigger. Defaults to
|
|
46
|
+
* "Show more actions".
|
|
47
|
+
*/
|
|
48
|
+
"aria-label"?: string;
|
|
49
|
+
}
|
|
50
|
+
declare function SplitButtonTrigger({ className, variant, size, disabled, icon, type, "aria-label": ariaLabel, ...props }: SplitButtonTriggerProps): ReactElement;
|
|
51
|
+
declare namespace SplitButtonTrigger {
|
|
52
|
+
var displayName: string;
|
|
53
|
+
}
|
|
54
|
+
export type SplitButtonContentProps = ComponentPropsWithoutRef<typeof DropdownMenuContent>;
|
|
55
|
+
declare function SplitButtonContent({ align, sideOffset, className, ...props }: SplitButtonContentProps): ReactElement;
|
|
56
|
+
declare namespace SplitButtonContent {
|
|
57
|
+
var displayName: string;
|
|
58
|
+
}
|
|
59
|
+
export { SplitButton, SplitButtonAction, SplitButtonTrigger, SplitButtonContent, splitButtonSizeIds, splitButtonVariantIds, };
|
|
60
|
+
export type { SplitButtonSize, SplitButtonVariant };
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
|
|
4
|
+
import { ChevronDown } from "lucide-react";
|
|
5
|
+
import { createContext, useContext, } from "react";
|
|
6
|
+
import { cn } from "../../../lib/utils";
|
|
7
|
+
import { Button } from "../button/button";
|
|
8
|
+
import { DropdownMenuContent } from "../dropdown-menu/dropdown-menu";
|
|
9
|
+
import { splitButtonSizeIds, splitButtonVariantIds, } from "./split-button-variants";
|
|
10
|
+
const SplitButtonContext = createContext(null);
|
|
11
|
+
function useSplitButtonContext(componentName) {
|
|
12
|
+
const ctx = useContext(SplitButtonContext);
|
|
13
|
+
if (ctx === null) {
|
|
14
|
+
throw new Error(`<${componentName}> must be rendered inside a <SplitButton> parent.`);
|
|
15
|
+
}
|
|
16
|
+
return ctx;
|
|
17
|
+
}
|
|
18
|
+
const dividerClassByVariant = {
|
|
19
|
+
default: "border-l border-primary-foreground/25",
|
|
20
|
+
destructive: "border-l border-destructive-foreground/25",
|
|
21
|
+
outline: "border-l border-input",
|
|
22
|
+
secondary: "border-l border-secondary-foreground/20",
|
|
23
|
+
ghost: "border-l border-border",
|
|
24
|
+
};
|
|
25
|
+
const triggerSizeClass = {
|
|
26
|
+
sm: "h-9 w-8 px-0",
|
|
27
|
+
default: "h-10 w-10 px-0",
|
|
28
|
+
lg: "h-11 w-11 px-0",
|
|
29
|
+
};
|
|
30
|
+
const triggerIconSizeClass = {
|
|
31
|
+
sm: "h-3.5 w-3.5",
|
|
32
|
+
default: "h-4 w-4",
|
|
33
|
+
lg: "h-5 w-5",
|
|
34
|
+
};
|
|
35
|
+
function SplitButton({ variant = "default", size = "default", disabled = false, open, defaultOpen, onOpenChange, dir, modal, className, children, ref, ...props }) {
|
|
36
|
+
return (_jsx(SplitButtonContext.Provider, { value: { variant, size, disabled }, children: _jsx(DropdownMenuPrimitive.Root, { open: open, defaultOpen: defaultOpen, onOpenChange: onOpenChange, dir: dir, modal: modal, children: _jsx("div", { ref: ref, "data-slot": "split-button", "data-variant": variant, "data-size": size, "data-disabled": disabled ? "true" : "false", className: cn("inline-flex items-stretch", className), ...props, children: children }) }) }));
|
|
37
|
+
}
|
|
38
|
+
SplitButton.displayName = "SplitButton";
|
|
39
|
+
function SplitButtonAction({ className, variant, size, disabled, type = "button", ...props }) {
|
|
40
|
+
const ctx = useSplitButtonContext("SplitButtonAction");
|
|
41
|
+
const resolvedVariant = variant ?? ctx.variant;
|
|
42
|
+
const resolvedSize = size ?? ctx.size;
|
|
43
|
+
const resolvedDisabled = disabled ?? ctx.disabled;
|
|
44
|
+
return (_jsx(Button, { type: type, variant: resolvedVariant, size: resolvedSize, disabled: resolvedDisabled, "data-slot": "split-button-action", className: cn("rounded-r-none border-r-0 focus-visible:z-10", className), ...props }));
|
|
45
|
+
}
|
|
46
|
+
SplitButtonAction.displayName = "SplitButtonAction";
|
|
47
|
+
function SplitButtonTrigger({ className, variant, size, disabled, icon, type = "button", "aria-label": ariaLabel = "Show more actions", ...props }) {
|
|
48
|
+
const ctx = useSplitButtonContext("SplitButtonTrigger");
|
|
49
|
+
const resolvedVariant = variant ?? ctx.variant;
|
|
50
|
+
const resolvedSize = size ?? ctx.size;
|
|
51
|
+
const resolvedDisabled = disabled ?? ctx.disabled;
|
|
52
|
+
return (_jsx(DropdownMenuPrimitive.Trigger, { asChild: true, disabled: resolvedDisabled, children: _jsx(Button, { type: type, variant: resolvedVariant, size: resolvedSize, disabled: resolvedDisabled, "aria-label": ariaLabel, "aria-haspopup": "menu", "data-slot": "split-button-trigger", className: cn("rounded-l-none focus-visible:z-10 data-[state=open]:bg-accent/60", triggerSizeClass[resolvedSize], dividerClassByVariant[resolvedVariant], className), ...props, children: icon ?? (_jsx(ChevronDown, { "aria-hidden": "true", className: cn("transition-transform duration-150 data-[state=open]:rotate-180", triggerIconSizeClass[resolvedSize]) })) }) }));
|
|
53
|
+
}
|
|
54
|
+
SplitButtonTrigger.displayName = "SplitButtonTrigger";
|
|
55
|
+
function SplitButtonContent({ align = "end", sideOffset = 4, className, ...props }) {
|
|
56
|
+
return (_jsx(DropdownMenuContent, { align: align, sideOffset: sideOffset, "data-slot": "split-button-content", className: cn("min-w-[10rem]", className), ...props }));
|
|
57
|
+
}
|
|
58
|
+
SplitButtonContent.displayName = "SplitButtonContent";
|
|
59
|
+
export { SplitButton, SplitButtonAction, SplitButtonTrigger, SplitButtonContent, splitButtonSizeIds, splitButtonVariantIds, };
|
|
60
|
+
//# sourceMappingURL=split-button.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"split-button.js","sourceRoot":"","sources":["../../../../src/components/ui/split-button/split-button.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,KAAK,qBAAqB,MAAM,+BAA+B,CAAC;AACvE,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EACL,aAAa,EACb,UAAU,GAOX,MAAM,OAAO,CAAC;AAEf,OAAO,EAAE,EAAE,EAAE,MAAM,a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B,kBAAkB,EAClB,kBAAkB,EAClB,qBAAqB,GACtB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/ui/terminal-frame/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { type VariantProps } from "class-variance-authority";
|
|
2
|
+
import type { HTMLAttributes, ReactElement, ReactNode, Ref } from "react";
|
|
3
|
+
export declare const terminalFrameVariantIds: ["macos", "windows", "minimal"];
|
|
4
|
+
export type TerminalFrameVariantId = (typeof terminalFrameVariantIds)[number];
|
|
5
|
+
export declare const terminalFrameSizeIds: ["sm", "md", "lg"];
|
|
6
|
+
export type TerminalFrameSizeId = (typeof terminalFrameSizeIds)[number];
|
|
7
|
+
export declare const terminalFrameThemeIds: ["default", "dark", "matrix", "amber"];
|
|
8
|
+
export type TerminalFrameThemeId = (typeof terminalFrameThemeIds)[number];
|
|
9
|
+
declare const terminalFrameVariants: (props?: ({
|
|
10
|
+
variant?: "minimal" | "macos" | "windows" | null | undefined;
|
|
11
|
+
size?: "sm" | "lg" | "md" | null | undefined;
|
|
12
|
+
theme?: "default" | "dark" | "matrix" | "amber" | null | undefined;
|
|
13
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
14
|
+
export interface TerminalFrameProps extends HTMLAttributes<HTMLDivElement>, VariantProps<typeof terminalFrameVariants> {
|
|
15
|
+
ref?: Ref<HTMLDivElement>;
|
|
16
|
+
}
|
|
17
|
+
declare function TerminalFrame({ className, variant, size, theme, ref, ...props }: TerminalFrameProps): ReactElement;
|
|
18
|
+
declare namespace TerminalFrame {
|
|
19
|
+
var displayName: string;
|
|
20
|
+
}
|
|
21
|
+
declare const terminalFrameHeaderVariants: (props?: ({
|
|
22
|
+
variant?: "minimal" | "macos" | "windows" | null | undefined;
|
|
23
|
+
size?: "sm" | "lg" | "md" | null | undefined;
|
|
24
|
+
theme?: "default" | "dark" | "matrix" | "amber" | null | undefined;
|
|
25
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
26
|
+
export interface TerminalFrameHeaderProps extends HTMLAttributes<HTMLDivElement>, VariantProps<typeof terminalFrameHeaderVariants> {
|
|
27
|
+
ref?: Ref<HTMLDivElement>;
|
|
28
|
+
}
|
|
29
|
+
declare function TerminalFrameHeader({ className, variant, size, theme, ref, ...props }: TerminalFrameHeaderProps): ReactElement;
|
|
30
|
+
declare namespace TerminalFrameHeader {
|
|
31
|
+
var displayName: string;
|
|
32
|
+
}
|
|
33
|
+
export interface TerminalFrameControlsProps extends HTMLAttributes<HTMLDivElement> {
|
|
34
|
+
variant?: TerminalFrameVariantId;
|
|
35
|
+
/**
|
|
36
|
+
* Disable the visual difference between hover/idle dots. When true,
|
|
37
|
+
* the controls render as non-interactive decorations only.
|
|
38
|
+
*/
|
|
39
|
+
decorative?: boolean;
|
|
40
|
+
ref?: Ref<HTMLDivElement>;
|
|
41
|
+
}
|
|
42
|
+
declare function TerminalFrameControls({ className, variant, decorative, ref, ...props }: TerminalFrameControlsProps): ReactElement;
|
|
43
|
+
declare namespace TerminalFrameControls {
|
|
44
|
+
var displayName: string;
|
|
45
|
+
}
|
|
46
|
+
export interface TerminalFrameTitleProps extends HTMLAttributes<HTMLDivElement> {
|
|
47
|
+
/**
|
|
48
|
+
* Optional icon rendered before the title text (e.g. a shell glyph).
|
|
49
|
+
*/
|
|
50
|
+
leadingIcon?: ReactNode;
|
|
51
|
+
ref?: Ref<HTMLDivElement>;
|
|
52
|
+
}
|
|
53
|
+
declare function TerminalFrameTitle({ className, leadingIcon, children, ref, ...props }: TerminalFrameTitleProps): ReactElement;
|
|
54
|
+
declare namespace TerminalFrameTitle {
|
|
55
|
+
var displayName: string;
|
|
56
|
+
}
|
|
57
|
+
declare const terminalFrameBodyVariants: (props?: ({
|
|
58
|
+
size?: "sm" | "lg" | "md" | null | undefined;
|
|
59
|
+
theme?: "default" | "dark" | "matrix" | "amber" | null | undefined;
|
|
60
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
61
|
+
export interface TerminalFrameBodyProps extends HTMLAttributes<HTMLDivElement>, VariantProps<typeof terminalFrameBodyVariants> {
|
|
62
|
+
ref?: Ref<HTMLDivElement>;
|
|
63
|
+
}
|
|
64
|
+
declare function TerminalFrameBody({ className, size, theme, ref, ...props }: TerminalFrameBodyProps): ReactElement;
|
|
65
|
+
declare namespace TerminalFrameBody {
|
|
66
|
+
var displayName: string;
|
|
67
|
+
}
|
|
68
|
+
export interface TerminalFramePromptProps extends HTMLAttributes<HTMLDivElement> {
|
|
69
|
+
/**
|
|
70
|
+
* The prompt symbol or full prompt string rendered before the command.
|
|
71
|
+
* Defaults to `$`. Common alternatives: `#`, `>`, `➜`, `user@host:~$`.
|
|
72
|
+
*/
|
|
73
|
+
prompt?: ReactNode;
|
|
74
|
+
/**
|
|
75
|
+
* Color/style variant for the prompt symbol.
|
|
76
|
+
*/
|
|
77
|
+
promptTone?: "muted" | "primary" | "success" | "warning" | "danger" | "info";
|
|
78
|
+
/**
|
|
79
|
+
* When true, appends a blinking cursor after the command text.
|
|
80
|
+
*/
|
|
81
|
+
cursor?: boolean;
|
|
82
|
+
ref?: Ref<HTMLDivElement>;
|
|
83
|
+
}
|
|
84
|
+
declare function TerminalFramePrompt({ className, prompt, promptTone, cursor, children, ref, ...props }: TerminalFramePromptProps): ReactElement;
|
|
85
|
+
declare namespace TerminalFramePrompt {
|
|
86
|
+
var displayName: string;
|
|
87
|
+
}
|
|
88
|
+
export interface TerminalFrameOutputProps extends HTMLAttributes<HTMLDivElement> {
|
|
89
|
+
/**
|
|
90
|
+
* Color/style variant for the output line. `default` inherits body color.
|
|
91
|
+
*/
|
|
92
|
+
tone?: "default" | "muted" | "success" | "warning" | "danger" | "info";
|
|
93
|
+
ref?: Ref<HTMLDivElement>;
|
|
94
|
+
}
|
|
95
|
+
declare function TerminalFrameOutput({ className, tone, ref, ...props }: TerminalFrameOutputProps): ReactElement;
|
|
96
|
+
declare namespace TerminalFrameOutput {
|
|
97
|
+
var displayName: string;
|
|
98
|
+
}
|
|
99
|
+
export interface TerminalFrameCursorProps extends HTMLAttributes<HTMLSpanElement> {
|
|
100
|
+
/**
|
|
101
|
+
* When false, the cursor is rendered but does not blink.
|
|
102
|
+
*/
|
|
103
|
+
blink?: boolean;
|
|
104
|
+
ref?: Ref<HTMLSpanElement>;
|
|
105
|
+
}
|
|
106
|
+
declare function TerminalFrameCursor({ className, blink, ref, ...props }: TerminalFrameCursorProps): ReactElement;
|
|
107
|
+
declare namespace TerminalFrameCursor {
|
|
108
|
+
var displayName: string;
|
|
109
|
+
}
|
|
110
|
+
export { TerminalFrame, TerminalFrameHeader, TerminalFrameControls, TerminalFrameTitle, TerminalFrameBody, TerminalFramePrompt, TerminalFrameOutput, TerminalFrameCursor, terminalFrameVariants, terminalFrameHeaderVariants, terminalFrameBodyVariants, };
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { cva } from "class-variance-authority";
|
|
4
|
+
import { cn } from "../../../lib/utils";
|
|
5
|
+
export const terminalFrameVariantIds = [
|
|
6
|
+
"macos",
|
|
7
|
+
"windows",
|
|
8
|
+
"minimal",
|
|
9
|
+
];
|
|
10
|
+
export const terminalFrameSizeIds = [
|
|
11
|
+
"sm",
|
|
12
|
+
"md",
|
|
13
|
+
"lg",
|
|
14
|
+
];
|
|
15
|
+
export const terminalFrameThemeIds = [
|
|
16
|
+
"default",
|
|
17
|
+
"dark",
|
|
18
|
+
"matrix",
|
|
19
|
+
"amber",
|
|
20
|
+
];
|
|
21
|
+
const terminalFrameVariants = cva("flex w-full flex-col overflow-hidden border shadow-lg font-mono", {
|
|
22
|
+
variants: {
|
|
23
|
+
variant: {
|
|
24
|
+
macos: "rounded-xl border-border",
|
|
25
|
+
windows: "rounded-md border-border",
|
|
26
|
+
minimal: "rounded-lg border-border",
|
|
27
|
+
},
|
|
28
|
+
size: {
|
|
29
|
+
sm: "text-xs",
|
|
30
|
+
md: "text-sm",
|
|
31
|
+
lg: "text-base",
|
|
32
|
+
},
|
|
33
|
+
theme: {
|
|
34
|
+
default: "bg-card text-card-foreground",
|
|
35
|
+
dark: "border-zinc-800 bg-zinc-950 text-zinc-100",
|
|
36
|
+
matrix: "border-emerald-900 bg-black text-emerald-400",
|
|
37
|
+
amber: "border-amber-900/60 bg-[#1a0f00] text-amber-300",
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
defaultVariants: {
|
|
41
|
+
variant: "macos",
|
|
42
|
+
size: "md",
|
|
43
|
+
theme: "default",
|
|
44
|
+
},
|
|
45
|
+
});
|
|
46
|
+
function TerminalFrame({ className, variant, size, theme, ref, ...props }) {
|
|
47
|
+
return (_jsx("div", { ref: ref, "data-slot": "terminal-frame", "data-variant": variant ?? "macos", "data-size": size ?? "md", "data-theme": theme ?? "default", className: cn(terminalFrameVariants({ variant, size, theme }), className), ...props }));
|
|
48
|
+
}
|
|
49
|
+
TerminalFrame.displayName = "TerminalFrame";
|
|
50
|
+
const terminalFrameHeaderVariants = cva("flex items-center gap-3 border-b backdrop-blur-sm", {
|
|
51
|
+
variants: {
|
|
52
|
+
variant: {
|
|
53
|
+
macos: "px-3 py-2.5",
|
|
54
|
+
windows: "px-2 py-1.5",
|
|
55
|
+
minimal: "px-3 py-2",
|
|
56
|
+
},
|
|
57
|
+
size: {
|
|
58
|
+
sm: "min-h-8",
|
|
59
|
+
md: "min-h-10",
|
|
60
|
+
lg: "min-h-12",
|
|
61
|
+
},
|
|
62
|
+
theme: {
|
|
63
|
+
default: "border-border bg-muted/60 text-muted-foreground",
|
|
64
|
+
dark: "border-zinc-800 bg-zinc-900/70 text-zinc-400",
|
|
65
|
+
matrix: "border-emerald-900 bg-emerald-950/50 text-emerald-500/80",
|
|
66
|
+
amber: "border-amber-900/60 bg-[#241300] text-amber-400/80",
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
defaultVariants: {
|
|
70
|
+
variant: "macos",
|
|
71
|
+
size: "md",
|
|
72
|
+
theme: "default",
|
|
73
|
+
},
|
|
74
|
+
});
|
|
75
|
+
function TerminalFrameHeader({ className, variant, size, theme, ref, ...props }) {
|
|
76
|
+
return (_jsx("div", { ref: ref, "data-slot": "terminal-frame-header", className: cn(terminalFrameHeaderVariants({ variant, size, theme }), className), ...props }));
|
|
77
|
+
}
|
|
78
|
+
TerminalFrameHeader.displayName = "TerminalFrameHeader";
|
|
79
|
+
const macosControlColors = [
|
|
80
|
+
{
|
|
81
|
+
label: "Close",
|
|
82
|
+
className: "bg-[#ff5f57] border-[#e0443e]",
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
label: "Minimize",
|
|
86
|
+
className: "bg-[#febc2e] border-[#dea123]",
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
label: "Maximize",
|
|
90
|
+
className: "bg-[#28c840] border-[#1aab29]",
|
|
91
|
+
},
|
|
92
|
+
];
|
|
93
|
+
function TerminalFrameControls({ className, variant = "macos", decorative = true, ref, ...props }) {
|
|
94
|
+
if (variant === "minimal") {
|
|
95
|
+
return (_jsx("div", { ref: ref, "data-slot": "terminal-frame-controls", className: cn("flex items-center", className), "aria-hidden": decorative ? "true" : undefined, ...props }));
|
|
96
|
+
}
|
|
97
|
+
if (variant === "windows") {
|
|
98
|
+
return (_jsxs("div", { ref: ref, "data-slot": "terminal-frame-controls", "data-variant": "windows", className: cn("ml-auto flex items-center gap-0", className), "aria-hidden": decorative ? "true" : undefined, ...props, children: [_jsx("span", { className: "flex h-6 w-9 items-center justify-center hover:bg-white/10", children: _jsx("svg", { width: "10", height: "10", viewBox: "0 0 10 10", fill: "none", "aria-hidden": "true", children: _jsx("path", { d: "M0 5h10", stroke: "currentColor", strokeWidth: "1" }) }) }), _jsx("span", { className: "flex h-6 w-9 items-center justify-center hover:bg-white/10", children: _jsx("svg", { width: "10", height: "10", viewBox: "0 0 10 10", fill: "none", "aria-hidden": "true", children: _jsx("rect", { x: "0.5", y: "0.5", width: "9", height: "9", stroke: "currentColor", strokeWidth: "1", fill: "none" }) }) }), _jsx("span", { className: "flex h-6 w-9 items-center justify-center hover:bg-destructive hover:text-white", children: _jsx("svg", { width: "10", height: "10", viewBox: "0 0 10 10", fill: "none", "aria-hidden": "true", children: _jsx("path", { d: "M0 0L10 10M10 0L0 10", stroke: "currentColor", strokeWidth: "1" }) }) })] }));
|
|
99
|
+
}
|
|
100
|
+
return (_jsx("div", { ref: ref, "data-slot": "terminal-frame-controls", "data-variant": "macos", className: cn("flex items-center gap-1.5", className), "aria-hidden": decorative ? "true" : undefined, ...props, children: macosControlColors.map((control) => (_jsx("span", { "aria-label": decorative ? undefined : control.label, className: cn("block size-3 rounded-full border", control.className) }, control.label))) }));
|
|
101
|
+
}
|
|
102
|
+
TerminalFrameControls.displayName = "TerminalFrameControls";
|
|
103
|
+
function TerminalFrameTitle({ className, leadingIcon, children, ref, ...props }) {
|
|
104
|
+
return (_jsxs("div", { ref: ref, "data-slot": "terminal-frame-title", className: cn("flex min-w-0 flex-1 items-center justify-center gap-2 truncate text-center", className), ...props, children: [leadingIcon ? (_jsx("span", { className: "flex shrink-0 items-center", children: leadingIcon })) : null, _jsx("span", { className: "truncate", children: children })] }));
|
|
105
|
+
}
|
|
106
|
+
TerminalFrameTitle.displayName = "TerminalFrameTitle";
|
|
107
|
+
const terminalFrameBodyVariants = cva("relative flex-1 overflow-auto whitespace-pre-wrap break-words leading-relaxed", {
|
|
108
|
+
variants: {
|
|
109
|
+
size: {
|
|
110
|
+
sm: "gap-1 px-3 py-2",
|
|
111
|
+
md: "gap-1.5 px-4 py-3",
|
|
112
|
+
lg: "gap-2 px-5 py-4",
|
|
113
|
+
},
|
|
114
|
+
theme: {
|
|
115
|
+
default: "bg-background text-foreground",
|
|
116
|
+
dark: "bg-zinc-950 text-zinc-100",
|
|
117
|
+
matrix: "bg-black text-emerald-400",
|
|
118
|
+
amber: "bg-[#1a0f00] text-amber-300",
|
|
119
|
+
},
|
|
120
|
+
},
|
|
121
|
+
defaultVariants: {
|
|
122
|
+
size: "md",
|
|
123
|
+
theme: "default",
|
|
124
|
+
},
|
|
125
|
+
});
|
|
126
|
+
function TerminalFrameBody({ className, size, theme, ref, ...props }) {
|
|
127
|
+
return (_jsx("div", { ref: ref, "data-slot": "terminal-frame-body", className: cn("flex flex-col", terminalFrameBodyVariants({ size, theme }), className), ...props }));
|
|
128
|
+
}
|
|
129
|
+
TerminalFrameBody.displayName = "TerminalFrameBody";
|
|
130
|
+
const promptToneClasses = {
|
|
131
|
+
muted: "text-muted-foreground opacity-70",
|
|
132
|
+
primary: "text-primary",
|
|
133
|
+
success: "text-emerald-500 dark:text-emerald-400",
|
|
134
|
+
warning: "text-amber-500 dark:text-amber-400",
|
|
135
|
+
danger: "text-red-500 dark:text-red-400",
|
|
136
|
+
info: "text-sky-500 dark:text-sky-400",
|
|
137
|
+
};
|
|
138
|
+
function TerminalFramePrompt({ className, prompt = "$", promptTone = "success", cursor = false, children, ref, ...props }) {
|
|
139
|
+
return (_jsxs("div", { ref: ref, "data-slot": "terminal-frame-prompt", className: cn("flex items-baseline gap-2", className), ...props, children: [_jsx("span", { "aria-hidden": "true", className: cn("shrink-0 select-none", promptToneClasses[promptTone]), children: prompt }), _jsxs("span", { className: "min-w-0 flex-1 whitespace-pre-wrap break-words", children: [children, cursor ? _jsx(TerminalFrameCursor, { className: "ml-1 align-middle" }) : null] })] }));
|
|
140
|
+
}
|
|
141
|
+
TerminalFramePrompt.displayName = "TerminalFramePrompt";
|
|
142
|
+
const outputToneClasses = {
|
|
143
|
+
default: "",
|
|
144
|
+
muted: "opacity-60",
|
|
145
|
+
success: "text-emerald-500 dark:text-emerald-400",
|
|
146
|
+
warning: "text-amber-500 dark:text-amber-400",
|
|
147
|
+
danger: "text-red-500 dark:text-red-400",
|
|
148
|
+
info: "text-sky-500 dark:text-sky-400",
|
|
149
|
+
};
|
|
150
|
+
function TerminalFrameOutput({ className, tone = "default", ref, ...props }) {
|
|
151
|
+
return (_jsx("div", { ref: ref, "data-slot": "terminal-frame-output", className: cn("whitespace-pre-wrap break-words", outputToneClasses[tone], className), ...props }));
|
|
152
|
+
}
|
|
153
|
+
TerminalFrameOutput.displayName = "TerminalFrameOutput";
|
|
154
|
+
function TerminalFrameCursor({ className, blink = true, ref, ...props }) {
|
|
155
|
+
return (_jsx("span", { ref: ref, "data-slot": "terminal-frame-cursor", "aria-hidden": "true", className: cn("inline-block h-[1em] w-[0.5em] translate-y-[0.15em] bg-current align-baseline", blink && "animate-pulse", className), ...props }));
|
|
156
|
+
}
|
|
157
|
+
TerminalFrameCursor.displayName = "TerminalFrameCursor";
|
|
158
|
+
export { TerminalFrame, TerminalFrameHeader, TerminalFrameControls, TerminalFrameTitle, TerminalFrameBody, TerminalFramePrompt, TerminalFrameOutput, TerminalFrameCursor, terminalFrameVariants, terminalFrameHeaderVariants, terminalFrameBodyVariants, };
|
|
159
|
+
//# sourceMappingURL=terminal-frame.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"terminal-frame.js","sourceRoot":"","sources":["../../../../src/components/ui/terminal-frame/terminal-frame.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,GAAG,EAAqB,MAAM,0BAA0B,CAAC;AAQlE,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AAEjC,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACrC,OAAO;IACP,SAAS;IACT,SAAS;CACkB,CAAC;AAI9B,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,IAAI;IACJ,IAAI;IACJ,IAAI;CACuB,CAAC;AAI9B,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,SAAS;IACT,MAAM;IACN,QAAQ;IACR,OAAO;CACoB,CAAC;AAI9B,MAAM,qBAAqB,GAAG,GAAG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