@krak-stack/registry 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +29 -0
- package/dist/components/ui/alert-dialog.d.ts +18 -0
- package/dist/components/ui/app-brand.d.ts +26 -0
- package/dist/components/ui/app-brand.js +78 -0
- package/dist/components/ui/attachment.d.ts +23 -0
- package/dist/components/ui/badge.d.ts +7 -0
- package/dist/components/ui/button.d.ts +8 -0
- package/dist/components/ui/card.d.ts +11 -0
- package/dist/components/ui/checkbox.d.ts +3 -0
- package/dist/components/ui/code-block.d.ts +14 -0
- package/dist/components/ui/code-block.js +224 -0
- package/dist/components/ui/command.d.ts +18 -0
- package/dist/components/ui/copy-button.d.ts +18 -0
- package/dist/components/ui/copy-button.js +133 -0
- package/dist/components/ui/data-table.d.ts +264 -0
- package/dist/components/ui/data-table.js +3594 -0
- package/dist/components/ui/dialog.d.ts +13 -0
- package/dist/components/ui/dropdown-menu.d.ts +29 -0
- package/dist/components/ui/editing-locale-switcher.d.ts +7 -0
- package/dist/components/ui/editing-locale-switcher.js +626 -0
- package/dist/components/ui/effect-form.d.ts +137 -0
- package/dist/components/ui/effect-form.js +2330 -0
- package/dist/components/ui/field.d.ts +24 -0
- package/dist/components/ui/file-picker.d.ts +30 -0
- package/dist/components/ui/file-picker.js +811 -0
- package/dist/components/ui/form.d.ts +402 -0
- package/dist/components/ui/form.js +2245 -0
- package/dist/components/ui/google-map.d.ts +103 -0
- package/dist/components/ui/google-map.js +754 -0
- package/dist/components/ui/icon-input.d.ts +9 -0
- package/dist/components/ui/icon-input.js +971 -0
- package/dist/components/ui/input-group.d.ts +17 -0
- package/dist/components/ui/input.d.ts +3 -0
- package/dist/components/ui/label.d.ts +3 -0
- package/dist/components/ui/loading.d.ts +7 -0
- package/dist/components/ui/loading.js +467 -0
- package/dist/components/ui/locale-switcher.d.ts +7 -0
- package/dist/components/ui/locale-switcher.js +632 -0
- package/dist/components/ui/pagination.d.ts +43 -0
- package/dist/components/ui/pagination.js +787 -0
- package/dist/components/ui/popover.d.ts +9 -0
- package/dist/components/ui/scroll-area.d.ts +4 -0
- package/dist/components/ui/search-menu.d.ts +34 -0
- package/dist/components/ui/search-menu.js +839 -0
- package/dist/components/ui/select.d.ts +15 -0
- package/dist/components/ui/separator.d.ts +3 -0
- package/dist/components/ui/sheet.d.ts +14 -0
- package/dist/components/ui/sidebar-layout.d.ts +29 -0
- package/dist/components/ui/sidebar-layout.js +755 -0
- package/dist/components/ui/sidebar.d.ts +63 -0
- package/dist/components/ui/skeleton.d.ts +2 -0
- package/dist/components/ui/stats-card.d.ts +12 -0
- package/dist/components/ui/stats-card.js +125 -0
- package/dist/components/ui/table.d.ts +10 -0
- package/dist/components/ui/textarea.d.ts +3 -0
- package/dist/components/ui/theme-switcher.d.ts +29 -0
- package/dist/components/ui/theme-switcher.js +775 -0
- package/dist/components/ui/tooltip.d.ts +6 -0
- package/dist/components/ui/virtualized-combobox.d.ts +54 -0
- package/dist/components/ui/virtualized-combobox.js +821 -0
- package/dist/hooks/use-mobile.d.ts +1 -0
- package/dist/lib/query.d.ts +49 -0
- package/dist/lib/utils.d.ts +2 -0
- package/dist/paraglide/runtime.d.ts +978 -0
- package/dist/services/embedding.d.ts +2 -0
- package/dist/services/embedding.js +23 -0
- package/dist/services/notification/channels/index.d.ts +22 -0
- package/dist/services/notification/channels/index.js +11 -0
- package/dist/services/notification/channels/ses/index.d.ts +51 -0
- package/dist/services/notification/channels/ses/index.js +145 -0
- package/dist/services/notification/channels/ses/schema.d.ts +13 -0
- package/dist/services/notification/channels/ses/schema.js +35 -0
- package/dist/services/notification/index.d.ts +15 -0
- package/dist/services/notification/index.js +67 -0
- package/dist/services/notification/schema.d.ts +10 -0
- package/dist/services/notification/schema.js +30 -0
- package/dist/services/opentelemetry.d.ts +8 -0
- package/dist/services/opentelemetry.js +23 -0
- package/dist/services/s3/index.d.ts +62 -0
- package/dist/services/s3/index.js +208 -0
- package/dist/services/s3/schema.d.ts +18 -0
- package/dist/services/s3/schema.js +37 -0
- package/package.json +218 -0
- package/tailwind.css +1 -0
package/README.md
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# @krak-stack/registry
|
|
2
|
+
|
|
3
|
+
Tree-shakable runtime components and Effect services from the KrakStack shadcn registry.
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
bun add @krak-stack/registry
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
Import only the subpaths used by the application:
|
|
10
|
+
|
|
11
|
+
```tsx
|
|
12
|
+
import { DataTable } from "@krak-stack/registry/data-table";
|
|
13
|
+
import { Pagination } from "@krak-stack/registry/pagination";
|
|
14
|
+
import { NotificationService } from "@krak-stack/registry/service-notification";
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Add the package's Tailwind source to the application stylesheet:
|
|
18
|
+
|
|
19
|
+
```css
|
|
20
|
+
@import "@krak-stack/registry/tailwind.css";
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
The same canonical sources remain available through shadcn:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
bunx shadcn@latest add @krak-stack/data-table
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Project-specific services, configuration, and agent scaffolding are available through shadcn only.
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { AlertDialog as AlertDialogPrimitive } from "@base-ui/react/alert-dialog";
|
|
3
|
+
import { Button } from "./button.js";
|
|
4
|
+
declare function AlertDialog({ ...props }: AlertDialogPrimitive.Root.Props): React.JSX.Element;
|
|
5
|
+
declare function AlertDialogTrigger({ ...props }: AlertDialogPrimitive.Trigger.Props): React.JSX.Element;
|
|
6
|
+
declare function AlertDialogPortal({ ...props }: AlertDialogPrimitive.Portal.Props): React.JSX.Element;
|
|
7
|
+
declare function AlertDialogOverlay({ className, ...props }: AlertDialogPrimitive.Backdrop.Props): React.JSX.Element;
|
|
8
|
+
declare function AlertDialogContent({ className, size, ...props }: AlertDialogPrimitive.Popup.Props & {
|
|
9
|
+
size?: "default" | "sm";
|
|
10
|
+
}): React.JSX.Element;
|
|
11
|
+
declare function AlertDialogHeader({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
12
|
+
declare function AlertDialogFooter({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
13
|
+
declare function AlertDialogMedia({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
14
|
+
declare function AlertDialogTitle({ className, ...props }: React.ComponentProps<typeof AlertDialogPrimitive.Title>): React.JSX.Element;
|
|
15
|
+
declare function AlertDialogDescription({ className, ...props }: React.ComponentProps<typeof AlertDialogPrimitive.Description>): React.JSX.Element;
|
|
16
|
+
declare function AlertDialogAction({ className, ...props }: React.ComponentProps<typeof Button>): React.JSX.Element;
|
|
17
|
+
declare function AlertDialogCancel({ className, variant, size, ...props }: AlertDialogPrimitive.Close.Props & Pick<React.ComponentProps<typeof Button>, "variant" | "size">): React.JSX.Element;
|
|
18
|
+
export { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogMedia, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type LinkProps } from "@tanstack/react-router";
|
|
2
|
+
import type { ComponentProps } from "react";
|
|
3
|
+
import type { LucideIcon } from "lucide-react";
|
|
4
|
+
type AppBrandBaseProps = {
|
|
5
|
+
label: string;
|
|
6
|
+
subtitle: string;
|
|
7
|
+
className?: string;
|
|
8
|
+
variant?: "default" | "sidebar";
|
|
9
|
+
} & ((Omit<LinkProps, "className" | "children"> & {
|
|
10
|
+
to?: LinkProps["to"];
|
|
11
|
+
}) | (ComponentProps<"a"> & {
|
|
12
|
+
href: string;
|
|
13
|
+
to?: never;
|
|
14
|
+
}) | (ComponentProps<"div"> & {
|
|
15
|
+
to: null;
|
|
16
|
+
href?: never;
|
|
17
|
+
}));
|
|
18
|
+
type AppBrandProps = AppBrandBaseProps & ({
|
|
19
|
+
icon: LucideIcon;
|
|
20
|
+
imageSrc?: string;
|
|
21
|
+
} | {
|
|
22
|
+
imageSrc: string;
|
|
23
|
+
icon?: LucideIcon;
|
|
24
|
+
});
|
|
25
|
+
export declare function AppBrand({ className, label, subtitle, icon: Icon, imageSrc, href, to, variant, ...props }: AppBrandProps): import("react").JSX.Element;
|
|
26
|
+
export {};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
// ../../src/components/ui/app-brand.tsx
|
|
2
|
+
import { Link } from "@tanstack/react-router";
|
|
3
|
+
import { jsxDEV, Fragment } from "react/jsx-dev-runtime";
|
|
4
|
+
function AppBrand({
|
|
5
|
+
className,
|
|
6
|
+
label,
|
|
7
|
+
subtitle,
|
|
8
|
+
icon: Icon,
|
|
9
|
+
imageSrc,
|
|
10
|
+
href,
|
|
11
|
+
to,
|
|
12
|
+
variant = "default",
|
|
13
|
+
...props
|
|
14
|
+
}) {
|
|
15
|
+
const iconClassName = variant === "sidebar" ? "bg-sidebar-primary" : "bg-primary";
|
|
16
|
+
const iconColor = variant === "sidebar" ? "var(--sidebar-primary-foreground)" : "var(--primary-foreground)";
|
|
17
|
+
const contentClassName = variant === "sidebar" ? "group-data-[collapsible=icon]:hidden" : undefined;
|
|
18
|
+
const content = /* @__PURE__ */ jsxDEV(Fragment, {
|
|
19
|
+
children: [
|
|
20
|
+
/* @__PURE__ */ jsxDEV("div", {
|
|
21
|
+
className: [
|
|
22
|
+
"flex size-8 shrink-0 items-center justify-center overflow-hidden rounded-md",
|
|
23
|
+
imageSrc ? "border bg-background" : iconClassName
|
|
24
|
+
].join(" "),
|
|
25
|
+
children: imageSrc ? /* @__PURE__ */ jsxDEV("img", {
|
|
26
|
+
src: imageSrc,
|
|
27
|
+
alt: label,
|
|
28
|
+
className: "size-full object-cover"
|
|
29
|
+
}, undefined, false, undefined, this) : Icon ? /* @__PURE__ */ jsxDEV(Icon, {
|
|
30
|
+
className: "size-4",
|
|
31
|
+
color: iconColor
|
|
32
|
+
}, undefined, false, undefined, this) : null
|
|
33
|
+
}, undefined, false, undefined, this),
|
|
34
|
+
/* @__PURE__ */ jsxDEV("div", {
|
|
35
|
+
className: ["flex min-w-0 flex-col leading-tight", contentClassName].filter(Boolean).join(" "),
|
|
36
|
+
children: [
|
|
37
|
+
/* @__PURE__ */ jsxDEV("span", {
|
|
38
|
+
className: "truncate font-semibold tracking-tight",
|
|
39
|
+
children: label
|
|
40
|
+
}, undefined, false, undefined, this),
|
|
41
|
+
subtitle ? /* @__PURE__ */ jsxDEV("span", {
|
|
42
|
+
className: "text-muted-foreground truncate text-xs",
|
|
43
|
+
children: subtitle
|
|
44
|
+
}, undefined, false, undefined, this) : null
|
|
45
|
+
]
|
|
46
|
+
}, undefined, true, undefined, this)
|
|
47
|
+
]
|
|
48
|
+
}, undefined, true, undefined, this);
|
|
49
|
+
const brandClassName = [
|
|
50
|
+
"flex min-w-0 items-center gap-2 text-foreground hover:text-foreground",
|
|
51
|
+
variant === "sidebar" ? "p-2 group-data-[collapsible=icon]:justify-center group-data-[collapsible=icon]:p-0" : "",
|
|
52
|
+
className
|
|
53
|
+
].filter(Boolean).join(" ");
|
|
54
|
+
if (to === null) {
|
|
55
|
+
return /* @__PURE__ */ jsxDEV("div", {
|
|
56
|
+
className: brandClassName,
|
|
57
|
+
...props,
|
|
58
|
+
children: content
|
|
59
|
+
}, undefined, false, undefined, this);
|
|
60
|
+
}
|
|
61
|
+
if (href) {
|
|
62
|
+
return /* @__PURE__ */ jsxDEV("a", {
|
|
63
|
+
className: brandClassName,
|
|
64
|
+
href,
|
|
65
|
+
...props,
|
|
66
|
+
children: content
|
|
67
|
+
}, undefined, false, undefined, this);
|
|
68
|
+
}
|
|
69
|
+
return /* @__PURE__ */ jsxDEV(Link, {
|
|
70
|
+
to: to ?? "/",
|
|
71
|
+
className: brandClassName,
|
|
72
|
+
...props,
|
|
73
|
+
children: content
|
|
74
|
+
}, undefined, false, undefined, this);
|
|
75
|
+
}
|
|
76
|
+
export {
|
|
77
|
+
AppBrand
|
|
78
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
3
|
+
import { type VariantProps } from "class-variance-authority";
|
|
4
|
+
import { Button } from "./button.js";
|
|
5
|
+
declare const attachmentVariants: (props?: ({
|
|
6
|
+
size?: "default" | "sm" | "xs" | null | undefined;
|
|
7
|
+
orientation?: "horizontal" | "vertical" | null | undefined;
|
|
8
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
9
|
+
declare function Attachment({ className, state, size, orientation, ...props }: React.ComponentProps<"div"> & VariantProps<typeof attachmentVariants> & {
|
|
10
|
+
state?: "idle" | "uploading" | "processing" | "error" | "done";
|
|
11
|
+
}): React.JSX.Element;
|
|
12
|
+
declare const attachmentMediaVariants: (props?: ({
|
|
13
|
+
variant?: "icon" | "image" | null | undefined;
|
|
14
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
15
|
+
declare function AttachmentMedia({ className, variant, ...props }: React.ComponentProps<"div"> & VariantProps<typeof attachmentMediaVariants>): React.JSX.Element;
|
|
16
|
+
declare function AttachmentContent({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
17
|
+
declare function AttachmentTitle({ className, ...props }: React.ComponentProps<"span">): React.JSX.Element;
|
|
18
|
+
declare function AttachmentDescription({ className, ...props }: React.ComponentProps<"span">): React.JSX.Element;
|
|
19
|
+
declare function AttachmentActions({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
20
|
+
declare function AttachmentAction({ className, variant, size, ...props }: React.ComponentProps<typeof Button>): React.JSX.Element;
|
|
21
|
+
declare function AttachmentTrigger({ className, render, type, ...props }: useRender.ComponentProps<"button">): React.ReactElement<unknown, string | React.JSXElementConstructor<any>>;
|
|
22
|
+
declare function AttachmentGroup({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
23
|
+
export { Attachment, AttachmentGroup, AttachmentMedia, AttachmentContent, AttachmentTitle, AttachmentDescription, AttachmentActions, AttachmentAction, AttachmentTrigger, };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
2
|
+
import { type VariantProps } from "class-variance-authority";
|
|
3
|
+
declare const badgeVariants: (props?: ({
|
|
4
|
+
variant?: "default" | "destructive" | "ghost" | "link" | "outline" | "secondary" | null | undefined;
|
|
5
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
6
|
+
declare function Badge({ className, variant, render, ...props }: useRender.ComponentProps<"span"> & VariantProps<typeof badgeVariants>): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
7
|
+
export { Badge, badgeVariants };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Button as ButtonPrimitive } from "@base-ui/react/button";
|
|
2
|
+
import { type VariantProps } from "class-variance-authority";
|
|
3
|
+
declare const buttonVariants: (props?: ({
|
|
4
|
+
variant?: "default" | "destructive" | "ghost" | "link" | "outline" | "secondary" | null | undefined;
|
|
5
|
+
size?: "default" | "icon" | "icon-lg" | "icon-sm" | "icon-xs" | "lg" | "sm" | "xs" | null | undefined;
|
|
6
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
7
|
+
declare function Button({ className, variant, size, ...props }: ButtonPrimitive.Props & VariantProps<typeof buttonVariants>): import("react").JSX.Element;
|
|
8
|
+
export { Button, buttonVariants };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
declare function Card({ className, size, ...props }: React.ComponentProps<"div"> & {
|
|
3
|
+
size?: "default" | "sm";
|
|
4
|
+
}): React.JSX.Element;
|
|
5
|
+
declare function CardHeader({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
6
|
+
declare function CardTitle({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
7
|
+
declare function CardDescription({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
8
|
+
declare function CardAction({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
9
|
+
declare function CardContent({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
10
|
+
declare function CardFooter({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
11
|
+
export { Card, CardHeader, CardFooter, CardTitle, CardAction, CardDescription, CardContent, };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { HighlighterCore } from "shiki/core";
|
|
2
|
+
type CodeBlockMessages = {
|
|
3
|
+
copy?: string;
|
|
4
|
+
copied?: string;
|
|
5
|
+
copyFailed?: string;
|
|
6
|
+
};
|
|
7
|
+
type CodeBlockProps = {
|
|
8
|
+
code: string;
|
|
9
|
+
highlighter: HighlighterCore;
|
|
10
|
+
language?: string;
|
|
11
|
+
messages?: CodeBlockMessages;
|
|
12
|
+
};
|
|
13
|
+
export declare function CodeBlock({ code, highlighter, language, messages, }: CodeBlockProps): import("react").JSX.Element;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
// ../../src/components/ui/button.tsx
|
|
2
|
+
import { Button as ButtonPrimitive } from "@base-ui/react/button";
|
|
3
|
+
import { cva } from "class-variance-authority";
|
|
4
|
+
|
|
5
|
+
// ../../src/lib/utils.ts
|
|
6
|
+
import { clsx } from "clsx";
|
|
7
|
+
import { twMerge } from "tailwind-merge";
|
|
8
|
+
function cn(...inputs) {
|
|
9
|
+
return twMerge(clsx(inputs));
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
// ../../src/components/ui/button.tsx
|
|
13
|
+
import { jsxDEV } from "react/jsx-dev-runtime";
|
|
14
|
+
var buttonVariants = cva("group/button inline-flex shrink-0 items-center justify-center rounded-md border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", {
|
|
15
|
+
variants: {
|
|
16
|
+
variant: {
|
|
17
|
+
default: "bg-primary text-primary-foreground hover:bg-primary/80",
|
|
18
|
+
outline: "border-border bg-background shadow-xs hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",
|
|
19
|
+
secondary: "bg-secondary text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)] aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",
|
|
20
|
+
ghost: "hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",
|
|
21
|
+
destructive: "bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40",
|
|
22
|
+
link: "text-primary underline-offset-4 hover:underline"
|
|
23
|
+
},
|
|
24
|
+
size: {
|
|
25
|
+
default: "h-9 gap-1.5 px-2.5 in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
|
|
26
|
+
xs: "h-6 gap-1 rounded-[min(var(--radius-md),8px)] px-2 text-xs in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",
|
|
27
|
+
sm: "h-8 gap-1 rounded-[min(var(--radius-md),10px)] px-2.5 in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5",
|
|
28
|
+
lg: "h-10 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
|
|
29
|
+
icon: "size-9",
|
|
30
|
+
"icon-xs": "size-6 rounded-[min(var(--radius-md),8px)] in-data-[slot=button-group]:rounded-md [&_svg:not([class*='size-'])]:size-3",
|
|
31
|
+
"icon-sm": "size-8 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-md",
|
|
32
|
+
"icon-lg": "size-10"
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
defaultVariants: {
|
|
36
|
+
variant: "default",
|
|
37
|
+
size: "default"
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
function Button({
|
|
41
|
+
className,
|
|
42
|
+
variant = "default",
|
|
43
|
+
size = "default",
|
|
44
|
+
...props
|
|
45
|
+
}) {
|
|
46
|
+
return /* @__PURE__ */ jsxDEV(ButtonPrimitive, {
|
|
47
|
+
"data-slot": "button",
|
|
48
|
+
className: cn(buttonVariants({ variant, size, className })),
|
|
49
|
+
...props
|
|
50
|
+
}, undefined, false, undefined, this);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// ../../src/components/ui/copy-button.tsx
|
|
54
|
+
import { Check, Copy, TriangleAlert } from "lucide-react";
|
|
55
|
+
import { useEffect, useRef, useState } from "react";
|
|
56
|
+
import { jsxDEV as jsxDEV2 } from "react/jsx-dev-runtime";
|
|
57
|
+
function CopyButton({
|
|
58
|
+
value,
|
|
59
|
+
valueDescription,
|
|
60
|
+
copyVariant = "default",
|
|
61
|
+
messages,
|
|
62
|
+
onCopied,
|
|
63
|
+
onCopyError,
|
|
64
|
+
resetDelay = 1500,
|
|
65
|
+
disabled,
|
|
66
|
+
size,
|
|
67
|
+
"aria-label": ariaLabel,
|
|
68
|
+
...props
|
|
69
|
+
}) {
|
|
70
|
+
const [copyState, setCopyState] = useState("idle");
|
|
71
|
+
const copyTimeout = useRef(undefined);
|
|
72
|
+
const labels = {
|
|
73
|
+
copy: messages?.copy ?? "Copy",
|
|
74
|
+
copied: messages?.copied ?? "Copied",
|
|
75
|
+
copyFailed: messages?.copyFailed ?? "Copy failed"
|
|
76
|
+
};
|
|
77
|
+
const accessibleLabel = ariaLabel ?? (valueDescription ? `${labels.copy} ${valueDescription}` : labels.copy);
|
|
78
|
+
const isLarge = copyVariant === "large";
|
|
79
|
+
const defaultSize = copyVariant === "sm" ? "icon-xs" : isLarge ? "sm" : "icon-sm";
|
|
80
|
+
useEffect(() => {
|
|
81
|
+
return () => {
|
|
82
|
+
if (copyTimeout.current)
|
|
83
|
+
clearTimeout(copyTimeout.current);
|
|
84
|
+
};
|
|
85
|
+
}, []);
|
|
86
|
+
const resetCopyState = () => {
|
|
87
|
+
if (copyTimeout.current)
|
|
88
|
+
clearTimeout(copyTimeout.current);
|
|
89
|
+
copyTimeout.current = setTimeout(() => setCopyState("idle"), resetDelay);
|
|
90
|
+
};
|
|
91
|
+
const copy = async () => {
|
|
92
|
+
try {
|
|
93
|
+
await navigator.clipboard.writeText(value);
|
|
94
|
+
setCopyState("copied");
|
|
95
|
+
onCopied?.();
|
|
96
|
+
} catch (error) {
|
|
97
|
+
setCopyState("failed");
|
|
98
|
+
onCopyError?.(error);
|
|
99
|
+
}
|
|
100
|
+
resetCopyState();
|
|
101
|
+
};
|
|
102
|
+
const status = copyState === "copied" ? valueDescription ? `${labels.copied}: ${valueDescription}` : labels.copied : copyState === "failed" ? valueDescription ? `${labels.copyFailed}: ${valueDescription}` : labels.copyFailed : "";
|
|
103
|
+
return /* @__PURE__ */ jsxDEV2(Button, {
|
|
104
|
+
"aria-label": accessibleLabel,
|
|
105
|
+
disabled,
|
|
106
|
+
onClick: copy,
|
|
107
|
+
size: size ?? defaultSize,
|
|
108
|
+
...props,
|
|
109
|
+
children: [
|
|
110
|
+
/* @__PURE__ */ jsxDEV2("span", {
|
|
111
|
+
"aria-live": "polite",
|
|
112
|
+
className: "sr-only",
|
|
113
|
+
role: "status",
|
|
114
|
+
children: status
|
|
115
|
+
}, undefined, false, undefined, this),
|
|
116
|
+
copyState === "copied" ? /* @__PURE__ */ jsxDEV2(Check, {
|
|
117
|
+
"aria-hidden": "true"
|
|
118
|
+
}, undefined, false, undefined, this) : null,
|
|
119
|
+
copyState === "failed" ? /* @__PURE__ */ jsxDEV2(TriangleAlert, {
|
|
120
|
+
"aria-hidden": "true"
|
|
121
|
+
}, undefined, false, undefined, this) : null,
|
|
122
|
+
copyState === "idle" ? /* @__PURE__ */ jsxDEV2(Copy, {
|
|
123
|
+
"aria-hidden": "true"
|
|
124
|
+
}, undefined, false, undefined, this) : null,
|
|
125
|
+
isLarge ? /* @__PURE__ */ jsxDEV2("span", {
|
|
126
|
+
children: labels.copy
|
|
127
|
+
}, undefined, false, undefined, this) : null
|
|
128
|
+
]
|
|
129
|
+
}, undefined, true, undefined, this);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
// ../../src/components/ui/code-block.tsx
|
|
133
|
+
import { Fragment, useEffect as useEffect2, useState as useState2 } from "react";
|
|
134
|
+
import { jsxDEV as jsxDEV3 } from "react/jsx-dev-runtime";
|
|
135
|
+
var codeBodyClassName = "font-mono text-[0.875rem] leading-[1.625] break-all whitespace-pre-wrap [&_code]:block [&_code]:font-mono [&_code]:text-[inherit] [&_code]:leading-[inherit] [&_code]:whitespace-pre-wrap [&_span]:break-all";
|
|
136
|
+
var getTokenStyle = (token) => {
|
|
137
|
+
const style = {};
|
|
138
|
+
if (token.variants.light?.color) {
|
|
139
|
+
style["--shiki-light"] = token.variants.light.color;
|
|
140
|
+
}
|
|
141
|
+
if (token.variants.dark?.color) {
|
|
142
|
+
style["--shiki-dark"] = token.variants.dark.color;
|
|
143
|
+
}
|
|
144
|
+
return style;
|
|
145
|
+
};
|
|
146
|
+
function CodeBlock({
|
|
147
|
+
code,
|
|
148
|
+
highlighter,
|
|
149
|
+
language = "text",
|
|
150
|
+
messages
|
|
151
|
+
}) {
|
|
152
|
+
const [tokens, setTokens] = useState2();
|
|
153
|
+
useEffect2(() => {
|
|
154
|
+
let active = true;
|
|
155
|
+
setTokens(undefined);
|
|
156
|
+
try {
|
|
157
|
+
const result = highlighter.codeToTokensWithThemes(code, {
|
|
158
|
+
lang: language.toLowerCase() || "text",
|
|
159
|
+
themes: {
|
|
160
|
+
light: "vitesse-light",
|
|
161
|
+
dark: "vitesse-dark"
|
|
162
|
+
}
|
|
163
|
+
});
|
|
164
|
+
if (active)
|
|
165
|
+
setTokens(result);
|
|
166
|
+
} catch {}
|
|
167
|
+
return () => {
|
|
168
|
+
active = false;
|
|
169
|
+
};
|
|
170
|
+
}, [code, highlighter, language]);
|
|
171
|
+
return /* @__PURE__ */ jsxDEV3("div", {
|
|
172
|
+
className: "overflow-hidden rounded-md border",
|
|
173
|
+
children: [
|
|
174
|
+
/* @__PURE__ */ jsxDEV3("div", {
|
|
175
|
+
className: "border-border/60 flex items-center justify-between border-b px-3 py-2",
|
|
176
|
+
children: [
|
|
177
|
+
/* @__PURE__ */ jsxDEV3("span", {
|
|
178
|
+
className: "text-muted-foreground font-mono text-xs",
|
|
179
|
+
children: language.toLowerCase()
|
|
180
|
+
}, undefined, false, undefined, this),
|
|
181
|
+
/* @__PURE__ */ jsxDEV3(CopyButton, {
|
|
182
|
+
value: code,
|
|
183
|
+
valueDescription: `${language.toLowerCase()} code`,
|
|
184
|
+
variant: "secondary",
|
|
185
|
+
messages: {
|
|
186
|
+
...messages?.copy === undefined ? {} : { copy: messages.copy },
|
|
187
|
+
...messages?.copied === undefined ? {} : { copied: messages.copied },
|
|
188
|
+
...messages?.copyFailed === undefined ? {} : { copyFailed: messages.copyFailed }
|
|
189
|
+
}
|
|
190
|
+
}, undefined, false, undefined, this)
|
|
191
|
+
]
|
|
192
|
+
}, undefined, true, undefined, this),
|
|
193
|
+
/* @__PURE__ */ jsxDEV3("div", {
|
|
194
|
+
className: "bg-muted max-h-full overflow-auto p-3",
|
|
195
|
+
children: tokens ? /* @__PURE__ */ jsxDEV3("div", {
|
|
196
|
+
className: codeBodyClassName,
|
|
197
|
+
children: /* @__PURE__ */ jsxDEV3("code", {
|
|
198
|
+
className: `language-${language}`,
|
|
199
|
+
children: tokens.map((line, lineIndex) => /* @__PURE__ */ jsxDEV3(Fragment, {
|
|
200
|
+
children: [
|
|
201
|
+
line.map((token) => /* @__PURE__ */ jsxDEV3("span", {
|
|
202
|
+
className: "text-[var(--shiki-light)] dark:text-[var(--shiki-dark)]",
|
|
203
|
+
style: getTokenStyle(token),
|
|
204
|
+
children: token.content
|
|
205
|
+
}, token.offset, false, undefined, this)),
|
|
206
|
+
lineIndex < tokens.length - 1 ? `
|
|
207
|
+
` : null
|
|
208
|
+
]
|
|
209
|
+
}, lineIndex, true, undefined, this))
|
|
210
|
+
}, undefined, false, undefined, this)
|
|
211
|
+
}, undefined, false, undefined, this) : /* @__PURE__ */ jsxDEV3("div", {
|
|
212
|
+
className: `max-w-full ${codeBodyClassName}`,
|
|
213
|
+
children: /* @__PURE__ */ jsxDEV3("code", {
|
|
214
|
+
className: `language-${language}`,
|
|
215
|
+
children: code
|
|
216
|
+
}, undefined, false, undefined, this)
|
|
217
|
+
}, undefined, false, undefined, this)
|
|
218
|
+
}, undefined, false, undefined, this)
|
|
219
|
+
]
|
|
220
|
+
}, undefined, true, undefined, this);
|
|
221
|
+
}
|
|
222
|
+
export {
|
|
223
|
+
CodeBlock
|
|
224
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { Command as CommandPrimitive } from "cmdk";
|
|
3
|
+
import { Dialog } from "./dialog.js";
|
|
4
|
+
declare function Command({ className, ...props }: React.ComponentProps<typeof CommandPrimitive>): React.JSX.Element;
|
|
5
|
+
declare function CommandDialog({ title, description, children, className, ...props }: Omit<React.ComponentProps<typeof Dialog>, "children"> & {
|
|
6
|
+
title: string;
|
|
7
|
+
description: string;
|
|
8
|
+
className?: string;
|
|
9
|
+
children: React.ReactNode;
|
|
10
|
+
}): React.JSX.Element;
|
|
11
|
+
declare function CommandInput({ className, ...props }: React.ComponentProps<typeof CommandPrimitive.Input>): React.JSX.Element;
|
|
12
|
+
declare function CommandList({ className, ...props }: React.ComponentProps<typeof CommandPrimitive.List>): React.JSX.Element;
|
|
13
|
+
declare function CommandEmpty({ className, ...props }: React.ComponentProps<typeof CommandPrimitive.Empty>): React.JSX.Element;
|
|
14
|
+
declare function CommandGroup({ className, ...props }: React.ComponentProps<typeof CommandPrimitive.Group>): React.JSX.Element;
|
|
15
|
+
declare function CommandSeparator({ className, ...props }: React.ComponentProps<typeof CommandPrimitive.Separator>): React.JSX.Element;
|
|
16
|
+
declare function CommandItem({ className, ...props }: React.ComponentProps<typeof CommandPrimitive.Item>): React.JSX.Element;
|
|
17
|
+
declare function CommandShortcut({ className, ...props }: React.ComponentProps<"span">): React.JSX.Element;
|
|
18
|
+
export { Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Button } from "./button.js";
|
|
2
|
+
import type { ComponentProps } from "react";
|
|
3
|
+
type CopyButtonMessages = {
|
|
4
|
+
copy?: string;
|
|
5
|
+
copied?: string;
|
|
6
|
+
copyFailed?: string;
|
|
7
|
+
};
|
|
8
|
+
type CopyButtonProps = Omit<ComponentProps<typeof Button>, "children" | "onClick"> & {
|
|
9
|
+
value: string;
|
|
10
|
+
valueDescription?: string;
|
|
11
|
+
copyVariant?: "default" | "sm" | "large";
|
|
12
|
+
messages?: CopyButtonMessages;
|
|
13
|
+
onCopied?: () => void;
|
|
14
|
+
onCopyError?: (error: unknown) => void;
|
|
15
|
+
resetDelay?: number;
|
|
16
|
+
};
|
|
17
|
+
export declare function CopyButton({ value, valueDescription, copyVariant, messages, onCopied, onCopyError, resetDelay, disabled, size, "aria-label": ariaLabel, ...props }: CopyButtonProps): import("react").JSX.Element;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
// ../../src/components/ui/button.tsx
|
|
2
|
+
import { Button as ButtonPrimitive } from "@base-ui/react/button";
|
|
3
|
+
import { cva } from "class-variance-authority";
|
|
4
|
+
|
|
5
|
+
// ../../src/lib/utils.ts
|
|
6
|
+
import { clsx } from "clsx";
|
|
7
|
+
import { twMerge } from "tailwind-merge";
|
|
8
|
+
function cn(...inputs) {
|
|
9
|
+
return twMerge(clsx(inputs));
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
// ../../src/components/ui/button.tsx
|
|
13
|
+
import { jsxDEV } from "react/jsx-dev-runtime";
|
|
14
|
+
var buttonVariants = cva("group/button inline-flex shrink-0 items-center justify-center rounded-md border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", {
|
|
15
|
+
variants: {
|
|
16
|
+
variant: {
|
|
17
|
+
default: "bg-primary text-primary-foreground hover:bg-primary/80",
|
|
18
|
+
outline: "border-border bg-background shadow-xs hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",
|
|
19
|
+
secondary: "bg-secondary text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)] aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",
|
|
20
|
+
ghost: "hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",
|
|
21
|
+
destructive: "bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40",
|
|
22
|
+
link: "text-primary underline-offset-4 hover:underline"
|
|
23
|
+
},
|
|
24
|
+
size: {
|
|
25
|
+
default: "h-9 gap-1.5 px-2.5 in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
|
|
26
|
+
xs: "h-6 gap-1 rounded-[min(var(--radius-md),8px)] px-2 text-xs in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",
|
|
27
|
+
sm: "h-8 gap-1 rounded-[min(var(--radius-md),10px)] px-2.5 in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5",
|
|
28
|
+
lg: "h-10 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
|
|
29
|
+
icon: "size-9",
|
|
30
|
+
"icon-xs": "size-6 rounded-[min(var(--radius-md),8px)] in-data-[slot=button-group]:rounded-md [&_svg:not([class*='size-'])]:size-3",
|
|
31
|
+
"icon-sm": "size-8 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-md",
|
|
32
|
+
"icon-lg": "size-10"
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
defaultVariants: {
|
|
36
|
+
variant: "default",
|
|
37
|
+
size: "default"
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
function Button({
|
|
41
|
+
className,
|
|
42
|
+
variant = "default",
|
|
43
|
+
size = "default",
|
|
44
|
+
...props
|
|
45
|
+
}) {
|
|
46
|
+
return /* @__PURE__ */ jsxDEV(ButtonPrimitive, {
|
|
47
|
+
"data-slot": "button",
|
|
48
|
+
className: cn(buttonVariants({ variant, size, className })),
|
|
49
|
+
...props
|
|
50
|
+
}, undefined, false, undefined, this);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// ../../src/components/ui/copy-button.tsx
|
|
54
|
+
import { Check, Copy, TriangleAlert } from "lucide-react";
|
|
55
|
+
import { useEffect, useRef, useState } from "react";
|
|
56
|
+
import { jsxDEV as jsxDEV2 } from "react/jsx-dev-runtime";
|
|
57
|
+
function CopyButton({
|
|
58
|
+
value,
|
|
59
|
+
valueDescription,
|
|
60
|
+
copyVariant = "default",
|
|
61
|
+
messages,
|
|
62
|
+
onCopied,
|
|
63
|
+
onCopyError,
|
|
64
|
+
resetDelay = 1500,
|
|
65
|
+
disabled,
|
|
66
|
+
size,
|
|
67
|
+
"aria-label": ariaLabel,
|
|
68
|
+
...props
|
|
69
|
+
}) {
|
|
70
|
+
const [copyState, setCopyState] = useState("idle");
|
|
71
|
+
const copyTimeout = useRef(undefined);
|
|
72
|
+
const labels = {
|
|
73
|
+
copy: messages?.copy ?? "Copy",
|
|
74
|
+
copied: messages?.copied ?? "Copied",
|
|
75
|
+
copyFailed: messages?.copyFailed ?? "Copy failed"
|
|
76
|
+
};
|
|
77
|
+
const accessibleLabel = ariaLabel ?? (valueDescription ? `${labels.copy} ${valueDescription}` : labels.copy);
|
|
78
|
+
const isLarge = copyVariant === "large";
|
|
79
|
+
const defaultSize = copyVariant === "sm" ? "icon-xs" : isLarge ? "sm" : "icon-sm";
|
|
80
|
+
useEffect(() => {
|
|
81
|
+
return () => {
|
|
82
|
+
if (copyTimeout.current)
|
|
83
|
+
clearTimeout(copyTimeout.current);
|
|
84
|
+
};
|
|
85
|
+
}, []);
|
|
86
|
+
const resetCopyState = () => {
|
|
87
|
+
if (copyTimeout.current)
|
|
88
|
+
clearTimeout(copyTimeout.current);
|
|
89
|
+
copyTimeout.current = setTimeout(() => setCopyState("idle"), resetDelay);
|
|
90
|
+
};
|
|
91
|
+
const copy = async () => {
|
|
92
|
+
try {
|
|
93
|
+
await navigator.clipboard.writeText(value);
|
|
94
|
+
setCopyState("copied");
|
|
95
|
+
onCopied?.();
|
|
96
|
+
} catch (error) {
|
|
97
|
+
setCopyState("failed");
|
|
98
|
+
onCopyError?.(error);
|
|
99
|
+
}
|
|
100
|
+
resetCopyState();
|
|
101
|
+
};
|
|
102
|
+
const status = copyState === "copied" ? valueDescription ? `${labels.copied}: ${valueDescription}` : labels.copied : copyState === "failed" ? valueDescription ? `${labels.copyFailed}: ${valueDescription}` : labels.copyFailed : "";
|
|
103
|
+
return /* @__PURE__ */ jsxDEV2(Button, {
|
|
104
|
+
"aria-label": accessibleLabel,
|
|
105
|
+
disabled,
|
|
106
|
+
onClick: copy,
|
|
107
|
+
size: size ?? defaultSize,
|
|
108
|
+
...props,
|
|
109
|
+
children: [
|
|
110
|
+
/* @__PURE__ */ jsxDEV2("span", {
|
|
111
|
+
"aria-live": "polite",
|
|
112
|
+
className: "sr-only",
|
|
113
|
+
role: "status",
|
|
114
|
+
children: status
|
|
115
|
+
}, undefined, false, undefined, this),
|
|
116
|
+
copyState === "copied" ? /* @__PURE__ */ jsxDEV2(Check, {
|
|
117
|
+
"aria-hidden": "true"
|
|
118
|
+
}, undefined, false, undefined, this) : null,
|
|
119
|
+
copyState === "failed" ? /* @__PURE__ */ jsxDEV2(TriangleAlert, {
|
|
120
|
+
"aria-hidden": "true"
|
|
121
|
+
}, undefined, false, undefined, this) : null,
|
|
122
|
+
copyState === "idle" ? /* @__PURE__ */ jsxDEV2(Copy, {
|
|
123
|
+
"aria-hidden": "true"
|
|
124
|
+
}, undefined, false, undefined, this) : null,
|
|
125
|
+
isLarge ? /* @__PURE__ */ jsxDEV2("span", {
|
|
126
|
+
children: labels.copy
|
|
127
|
+
}, undefined, false, undefined, this) : null
|
|
128
|
+
]
|
|
129
|
+
}, undefined, true, undefined, this);
|
|
130
|
+
}
|
|
131
|
+
export {
|
|
132
|
+
CopyButton
|
|
133
|
+
};
|