@alpic-ai/ui 0.0.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/accordion-card.d.mts +41 -0
- package/dist/components/accordion-card.mjs +61 -0
- package/dist/components/accordion.d.mts +29 -0
- package/dist/components/accordion.mjs +48 -0
- package/dist/components/alert.d.mts +40 -0
- package/dist/components/alert.mjs +63 -0
- package/dist/components/attachment-tile.d.mts +26 -0
- package/dist/components/attachment-tile.mjs +35 -0
- package/dist/components/avatar.d.mts +52 -0
- package/dist/components/avatar.mjs +81 -0
- package/dist/components/badge.d.mts +20 -0
- package/dist/components/badge.mjs +36 -0
- package/dist/components/breadcrumb.d.mts +42 -0
- package/dist/components/breadcrumb.mjs +79 -0
- package/dist/components/button.d.mts +29 -0
- package/dist/components/button.mjs +67 -0
- package/dist/components/card.d.mts +37 -0
- package/dist/components/card.mjs +54 -0
- package/dist/components/checkbox.d.mts +11 -0
- package/dist/components/checkbox.mjs +26 -0
- package/dist/components/collapsible.d.mts +16 -0
- package/dist/components/collapsible.mjs +24 -0
- package/dist/components/combobox.d.mts +86 -0
- package/dist/components/combobox.mjs +207 -0
- package/dist/components/command.d.mts +38 -0
- package/dist/components/command.mjs +68 -0
- package/dist/components/copyable.d.mts +22 -0
- package/dist/components/copyable.mjs +33 -0
- package/dist/components/description-list.d.mts +22 -0
- package/dist/components/description-list.mjs +34 -0
- package/dist/components/dialog.d.mts +61 -0
- package/dist/components/dialog.mjs +110 -0
- package/dist/components/dropdown-menu.d.mts +72 -0
- package/dist/components/dropdown-menu.mjs +122 -0
- package/dist/components/input-group.d.mts +25 -0
- package/dist/components/input-group.mjs +43 -0
- package/dist/components/input.d.mts +27 -0
- package/dist/components/input.mjs +90 -0
- package/dist/components/label.d.mts +11 -0
- package/dist/components/label.mjs +14 -0
- package/dist/components/pagination.d.mts +18 -0
- package/dist/components/pagination.mjs +42 -0
- package/dist/components/popover.d.mts +22 -0
- package/dist/components/popover.mjs +34 -0
- package/dist/components/radio-group.d.mts +15 -0
- package/dist/components/radio-group.mjs +26 -0
- package/dist/components/scroll-area.d.mts +17 -0
- package/dist/components/scroll-area.mjs +35 -0
- package/dist/components/select-trigger-variants.d.mts +13 -0
- package/dist/components/select-trigger-variants.mjs +23 -0
- package/dist/components/select.d.mts +51 -0
- package/dist/components/select.mjs +95 -0
- package/dist/components/separator.d.mts +13 -0
- package/dist/components/separator.mjs +16 -0
- package/dist/components/sheet.d.mts +43 -0
- package/dist/components/sheet.mjs +74 -0
- package/dist/components/sidebar.d.mts +163 -0
- package/dist/components/sidebar.mjs +378 -0
- package/dist/components/skeleton.d.mts +16 -0
- package/dist/components/skeleton.mjs +21 -0
- package/dist/components/sonner.d.mts +29 -0
- package/dist/components/sonner.mjs +76 -0
- package/dist/components/spinner.d.mts +30 -0
- package/dist/components/spinner.mjs +46 -0
- package/dist/components/status-dot.d.mts +19 -0
- package/dist/components/status-dot.mjs +34 -0
- package/dist/components/switch.d.mts +11 -0
- package/dist/components/switch.mjs +18 -0
- package/dist/components/table.d.mts +38 -0
- package/dist/components/table.mjs +65 -0
- package/dist/components/tabs.d.mts +58 -0
- package/dist/components/tabs.mjs +119 -0
- package/dist/components/tag.d.mts +35 -0
- package/dist/components/tag.mjs +65 -0
- package/dist/components/textarea.d.mts +21 -0
- package/dist/components/textarea.mjs +44 -0
- package/dist/components/toggle-group.d.mts +28 -0
- package/dist/components/toggle-group.mjs +72 -0
- package/dist/components/tooltip-icon-button.d.mts +12 -0
- package/dist/components/tooltip-icon-button.mjs +27 -0
- package/dist/components/tooltip.d.mts +23 -0
- package/dist/components/tooltip.mjs +35 -0
- package/dist/hooks/use-copy-to-clipboard.d.mts +11 -0
- package/dist/hooks/use-copy-to-clipboard.mjs +24 -0
- package/dist/hooks/use-mobile.d.mts +4 -0
- package/dist/hooks/use-mobile.mjs +16 -0
- package/dist/lib/cn.d.mts +6 -0
- package/dist/lib/cn.mjs +8 -0
- package/package.json +88 -0
- package/src/components/accordion-card.tsx +103 -0
- package/src/components/accordion.tsx +63 -0
- package/src/components/alert.tsx +74 -0
- package/src/components/attachment-tile.tsx +68 -0
- package/src/components/avatar.tsx +127 -0
- package/src/components/badge.tsx +41 -0
- package/src/components/breadcrumb.tsx +98 -0
- package/src/components/button.tsx +106 -0
- package/src/components/card.tsx +62 -0
- package/src/components/checkbox.tsx +35 -0
- package/src/components/collapsible.tsx +18 -0
- package/src/components/combobox.tsx +393 -0
- package/src/components/command.tsx +112 -0
- package/src/components/copyable.tsx +47 -0
- package/src/components/description-list.tsx +36 -0
- package/src/components/dialog.tsx +161 -0
- package/src/components/dropdown-menu.tsx +234 -0
- package/src/components/input-group.tsx +97 -0
- package/src/components/input.tsx +145 -0
- package/src/components/label.tsx +20 -0
- package/src/components/pagination.tsx +53 -0
- package/src/components/popover.tsx +49 -0
- package/src/components/radio-group.tsx +33 -0
- package/src/components/scroll-area.tsx +48 -0
- package/src/components/select-trigger-variants.ts +28 -0
- package/src/components/select.tsx +186 -0
- package/src/components/separator.tsx +30 -0
- package/src/components/sheet.tsx +112 -0
- package/src/components/sidebar.tsx +682 -0
- package/src/components/skeleton.tsx +24 -0
- package/src/components/sonner.tsx +91 -0
- package/src/components/spinner.tsx +62 -0
- package/src/components/status-dot.tsx +33 -0
- package/src/components/switch.tsx +33 -0
- package/src/components/table.tsx +89 -0
- package/src/components/tabs.tsx +226 -0
- package/src/components/tag.tsx +82 -0
- package/src/components/textarea.tsx +70 -0
- package/src/components/toggle-group.tsx +96 -0
- package/src/components/tooltip-icon-button.tsx +33 -0
- package/src/components/tooltip.tsx +54 -0
- package/src/hooks/use-copy-to-clipboard.ts +27 -0
- package/src/hooks/use-mobile.ts +17 -0
- package/src/lib/cn.ts +6 -0
- package/src/styles/tokens.css +352 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
2
|
+
import { ReactNode } from "react";
|
|
3
|
+
|
|
4
|
+
//#region src/components/copyable.d.ts
|
|
5
|
+
interface CopyableProps {
|
|
6
|
+
content: string;
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
className?: string;
|
|
9
|
+
}
|
|
10
|
+
declare function Copyable({
|
|
11
|
+
content,
|
|
12
|
+
children,
|
|
13
|
+
className
|
|
14
|
+
}: CopyableProps): _$react_jsx_runtime0.JSX.Element;
|
|
15
|
+
interface CopyableUrlProps {
|
|
16
|
+
url: URL;
|
|
17
|
+
}
|
|
18
|
+
declare function CopyableUrl({
|
|
19
|
+
url
|
|
20
|
+
}: CopyableUrlProps): _$react_jsx_runtime0.JSX.Element;
|
|
21
|
+
//#endregion
|
|
22
|
+
export { Copyable, type CopyableProps, CopyableUrl, type CopyableUrlProps };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../lib/cn.mjs";
|
|
3
|
+
import { Button } from "./button.mjs";
|
|
4
|
+
import { useCopyToClipboard } from "../hooks/use-copy-to-clipboard.mjs";
|
|
5
|
+
import { Check, Copy } from "lucide-react";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
//#region src/components/copyable.tsx
|
|
8
|
+
function Copyable({ content, children, className }) {
|
|
9
|
+
const { copy, isCopied } = useCopyToClipboard();
|
|
10
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
11
|
+
className: cn("flex items-center gap-1", className),
|
|
12
|
+
children: [children, /* @__PURE__ */ jsx(Button, {
|
|
13
|
+
variant: "tertiary",
|
|
14
|
+
size: "icon",
|
|
15
|
+
onClick: (event) => {
|
|
16
|
+
event.preventDefault();
|
|
17
|
+
copy(content);
|
|
18
|
+
},
|
|
19
|
+
children: isCopied ? /* @__PURE__ */ jsx(Check, { className: "size-4 text-success" }) : /* @__PURE__ */ jsx(Copy, { className: "size-4 text-muted-foreground" })
|
|
20
|
+
})]
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
function CopyableUrl({ url }) {
|
|
24
|
+
return /* @__PURE__ */ jsx(Copyable, {
|
|
25
|
+
content: url.href,
|
|
26
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
27
|
+
className: "font-semibold",
|
|
28
|
+
children: url.hostname
|
|
29
|
+
})
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
//#endregion
|
|
33
|
+
export { Copyable, CopyableUrl };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
|
|
4
|
+
//#region src/components/description-list.d.ts
|
|
5
|
+
declare function DescriptionList({
|
|
6
|
+
className,
|
|
7
|
+
...props
|
|
8
|
+
}: React.ComponentProps<"dl">): _$react_jsx_runtime0.JSX.Element;
|
|
9
|
+
declare function DescriptionItem({
|
|
10
|
+
className,
|
|
11
|
+
...props
|
|
12
|
+
}: React.ComponentProps<"div">): _$react_jsx_runtime0.JSX.Element;
|
|
13
|
+
declare function DescriptionTitle({
|
|
14
|
+
className,
|
|
15
|
+
...props
|
|
16
|
+
}: React.ComponentProps<"dt">): _$react_jsx_runtime0.JSX.Element;
|
|
17
|
+
declare function DescriptionValue({
|
|
18
|
+
className,
|
|
19
|
+
...props
|
|
20
|
+
}: React.ComponentProps<"dd">): _$react_jsx_runtime0.JSX.Element;
|
|
21
|
+
//#endregion
|
|
22
|
+
export { DescriptionItem, DescriptionList, DescriptionTitle, DescriptionValue };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../lib/cn.mjs";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
//#region src/components/description-list.tsx
|
|
5
|
+
function DescriptionList({ className, ...props }) {
|
|
6
|
+
return /* @__PURE__ */ jsx("dl", {
|
|
7
|
+
"data-slot": "description-list",
|
|
8
|
+
className: cn("grid grid-cols-1 gap-4 md:grid-cols-2 xl:grid-cols-4", className),
|
|
9
|
+
...props
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
function DescriptionItem({ className, ...props }) {
|
|
13
|
+
return /* @__PURE__ */ jsx("div", {
|
|
14
|
+
"data-slot": "description-item",
|
|
15
|
+
className: cn("flex flex-col gap-1 xl:gap-1.5", className),
|
|
16
|
+
...props
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
function DescriptionTitle({ className, ...props }) {
|
|
20
|
+
return /* @__PURE__ */ jsx("dt", {
|
|
21
|
+
"data-slot": "description-title",
|
|
22
|
+
className: cn("type-text-xs font-medium text-subtle-foreground", className),
|
|
23
|
+
...props
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
function DescriptionValue({ className, ...props }) {
|
|
27
|
+
return /* @__PURE__ */ jsx("dd", {
|
|
28
|
+
"data-slot": "description-value",
|
|
29
|
+
className: cn("type-text-sm text-foreground truncate", className),
|
|
30
|
+
...props
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
//#endregion
|
|
34
|
+
export { DescriptionItem, DescriptionList, DescriptionTitle, DescriptionValue };
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { ButtonProps } from "./button.mjs";
|
|
2
|
+
import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
3
|
+
import { VariantProps } from "class-variance-authority";
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import * as DialogPrimitive from "@radix-ui/react-dialog";
|
|
6
|
+
import * as _$class_variance_authority_types0 from "class-variance-authority/types";
|
|
7
|
+
|
|
8
|
+
//#region src/components/dialog.d.ts
|
|
9
|
+
declare function Dialog({
|
|
10
|
+
...props
|
|
11
|
+
}: React.ComponentProps<typeof DialogPrimitive.Root>): _$react_jsx_runtime0.JSX.Element;
|
|
12
|
+
declare function DialogTrigger({
|
|
13
|
+
...props
|
|
14
|
+
}: React.ComponentProps<typeof DialogPrimitive.Trigger>): _$react_jsx_runtime0.JSX.Element;
|
|
15
|
+
declare function DialogPortal({
|
|
16
|
+
...props
|
|
17
|
+
}: React.ComponentProps<typeof DialogPrimitive.Portal>): _$react_jsx_runtime0.JSX.Element;
|
|
18
|
+
declare function DialogOverlay({
|
|
19
|
+
className,
|
|
20
|
+
...props
|
|
21
|
+
}: React.ComponentProps<typeof DialogPrimitive.Overlay>): _$react_jsx_runtime0.JSX.Element;
|
|
22
|
+
declare const dialogContentVariants: (props?: ({
|
|
23
|
+
size?: "sm" | "lg" | null | undefined;
|
|
24
|
+
} & _$class_variance_authority_types0.ClassProp) | undefined) => string;
|
|
25
|
+
interface DialogContentProps extends React.ComponentProps<typeof DialogPrimitive.Content>, VariantProps<typeof dialogContentVariants> {
|
|
26
|
+
showCloseButton?: boolean;
|
|
27
|
+
}
|
|
28
|
+
declare function DialogContent({
|
|
29
|
+
className,
|
|
30
|
+
children,
|
|
31
|
+
size,
|
|
32
|
+
showCloseButton,
|
|
33
|
+
...props
|
|
34
|
+
}: DialogContentProps): _$react_jsx_runtime0.JSX.Element;
|
|
35
|
+
declare function DialogHeader({
|
|
36
|
+
className,
|
|
37
|
+
...props
|
|
38
|
+
}: React.ComponentProps<"div">): _$react_jsx_runtime0.JSX.Element;
|
|
39
|
+
declare const dialogFooterVariants: (props?: ({
|
|
40
|
+
layout?: "horizontal" | "vertical" | null | undefined;
|
|
41
|
+
} & _$class_variance_authority_types0.ClassProp) | undefined) => string;
|
|
42
|
+
interface DialogFooterProps extends React.ComponentProps<"div">, VariantProps<typeof dialogFooterVariants> {}
|
|
43
|
+
declare function DialogFooter({
|
|
44
|
+
className,
|
|
45
|
+
layout,
|
|
46
|
+
...props
|
|
47
|
+
}: DialogFooterProps): _$react_jsx_runtime0.JSX.Element;
|
|
48
|
+
declare function DialogTitle({
|
|
49
|
+
className,
|
|
50
|
+
...props
|
|
51
|
+
}: React.ComponentProps<typeof DialogPrimitive.Title>): _$react_jsx_runtime0.JSX.Element;
|
|
52
|
+
declare function DialogClose({
|
|
53
|
+
children,
|
|
54
|
+
...props
|
|
55
|
+
}: Omit<ButtonProps, "variant" | "asChild">): _$react_jsx_runtime0.JSX.Element;
|
|
56
|
+
declare function DialogDescription({
|
|
57
|
+
className,
|
|
58
|
+
...props
|
|
59
|
+
}: React.ComponentProps<typeof DialogPrimitive.Description>): _$react_jsx_runtime0.JSX.Element;
|
|
60
|
+
//#endregion
|
|
61
|
+
export { Dialog, DialogClose, DialogContent, type DialogContentProps, DialogDescription, DialogFooter, type DialogFooterProps, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, dialogContentVariants, dialogFooterVariants };
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../lib/cn.mjs";
|
|
3
|
+
import { Button } from "./button.mjs";
|
|
4
|
+
import { XIcon } from "lucide-react";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { cva } from "class-variance-authority";
|
|
7
|
+
import * as DialogPrimitive from "@radix-ui/react-dialog";
|
|
8
|
+
//#region src/components/dialog.tsx
|
|
9
|
+
function Dialog({ ...props }) {
|
|
10
|
+
return /* @__PURE__ */ jsx(DialogPrimitive.Root, {
|
|
11
|
+
"data-slot": "dialog",
|
|
12
|
+
...props
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
function DialogTrigger({ ...props }) {
|
|
16
|
+
return /* @__PURE__ */ jsx(DialogPrimitive.Trigger, {
|
|
17
|
+
"data-slot": "dialog-trigger",
|
|
18
|
+
...props
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
function DialogPortal({ ...props }) {
|
|
22
|
+
return /* @__PURE__ */ jsx(DialogPrimitive.Portal, {
|
|
23
|
+
"data-slot": "dialog-portal",
|
|
24
|
+
...props
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
function DialogOverlay({ className, ...props }) {
|
|
28
|
+
return /* @__PURE__ */ jsx(DialogPrimitive.Overlay, {
|
|
29
|
+
"data-slot": "dialog-overlay",
|
|
30
|
+
className: cn("fixed inset-0 z-50 bg-overlay", "data-[state=open]:animate-in data-[state=closed]:animate-out", "data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0", className),
|
|
31
|
+
...props
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
const dialogContentVariants = cva([
|
|
35
|
+
"bg-background fixed top-1/2 left-1/2 z-50 grid w-full -translate-x-1/2 -translate-y-1/2",
|
|
36
|
+
"overflow-y-auto rounded-2xl px-6 shadow-lg outline-none",
|
|
37
|
+
"data-[state=open]:animate-in data-[state=closed]:animate-out",
|
|
38
|
+
"data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
|
|
39
|
+
"data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95",
|
|
40
|
+
"duration-200"
|
|
41
|
+
].join(" "), {
|
|
42
|
+
variants: { size: {
|
|
43
|
+
sm: "max-w-[400px]",
|
|
44
|
+
lg: "max-w-[544px]"
|
|
45
|
+
} },
|
|
46
|
+
defaultVariants: { size: "sm" }
|
|
47
|
+
});
|
|
48
|
+
function DialogContent({ className, children, size, showCloseButton = true, ...props }) {
|
|
49
|
+
return /* @__PURE__ */ jsxs(DialogPortal, { children: [/* @__PURE__ */ jsx(DialogOverlay, {}), /* @__PURE__ */ jsxs(DialogPrimitive.Content, {
|
|
50
|
+
"data-slot": "dialog-content",
|
|
51
|
+
className: cn(dialogContentVariants({ size }), className),
|
|
52
|
+
...props,
|
|
53
|
+
children: [children, showCloseButton && /* @__PURE__ */ jsxs(DialogPrimitive.Close, {
|
|
54
|
+
"data-slot": "dialog-close",
|
|
55
|
+
className: cn("absolute top-3 right-4 flex size-8 items-center justify-center rounded-md", "text-subtle-foreground transition-colors", "[@media(hover:hover)]:hover:text-foreground", "focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none", "disabled:pointer-events-none"),
|
|
56
|
+
children: [/* @__PURE__ */ jsx(XIcon, { className: "size-4" }), /* @__PURE__ */ jsx("span", {
|
|
57
|
+
className: "sr-only",
|
|
58
|
+
children: "Close"
|
|
59
|
+
})]
|
|
60
|
+
})]
|
|
61
|
+
})] });
|
|
62
|
+
}
|
|
63
|
+
function DialogHeader({ className, ...props }) {
|
|
64
|
+
return /* @__PURE__ */ jsx("div", {
|
|
65
|
+
"data-slot": "dialog-header",
|
|
66
|
+
className: cn("flex flex-col gap-0.5 pt-6 pr-10", className),
|
|
67
|
+
...props
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
const dialogFooterVariants = cva("pb-6 pt-6", {
|
|
71
|
+
variants: { layout: {
|
|
72
|
+
horizontal: "flex gap-3 [&>*]:flex-1",
|
|
73
|
+
vertical: "flex flex-col gap-3"
|
|
74
|
+
} },
|
|
75
|
+
defaultVariants: { layout: "horizontal" }
|
|
76
|
+
});
|
|
77
|
+
function DialogFooter({ className, layout, ...props }) {
|
|
78
|
+
return /* @__PURE__ */ jsx("div", {
|
|
79
|
+
"data-slot": "dialog-footer",
|
|
80
|
+
className: cn(dialogFooterVariants({ layout }), className),
|
|
81
|
+
...props
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
function DialogTitle({ className, ...props }) {
|
|
85
|
+
return /* @__PURE__ */ jsx(DialogPrimitive.Title, {
|
|
86
|
+
"data-slot": "dialog-title",
|
|
87
|
+
className: cn("type-text-md font-semibold text-foreground", className),
|
|
88
|
+
...props
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
function DialogClose({ children = "Cancel", ...props }) {
|
|
92
|
+
return /* @__PURE__ */ jsx(DialogPrimitive.Close, {
|
|
93
|
+
"data-slot": "dialog-cancel",
|
|
94
|
+
asChild: true,
|
|
95
|
+
children: /* @__PURE__ */ jsx(Button, {
|
|
96
|
+
variant: "secondary",
|
|
97
|
+
...props,
|
|
98
|
+
children
|
|
99
|
+
})
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
function DialogDescription({ className, ...props }) {
|
|
103
|
+
return /* @__PURE__ */ jsx(DialogPrimitive.Description, {
|
|
104
|
+
"data-slot": "dialog-description",
|
|
105
|
+
className: cn("type-text-sm text-subtle-foreground", className),
|
|
106
|
+
...props
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
//#endregion
|
|
110
|
+
export { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, dialogContentVariants, dialogFooterVariants };
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
2
|
+
import { VariantProps } from "class-variance-authority";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
|
|
5
|
+
import * as _$class_variance_authority_types0 from "class-variance-authority/types";
|
|
6
|
+
|
|
7
|
+
//#region src/components/dropdown-menu.d.ts
|
|
8
|
+
declare function DropdownMenu({
|
|
9
|
+
...props
|
|
10
|
+
}: React.ComponentProps<typeof DropdownMenuPrimitive.Root>): _$react_jsx_runtime0.JSX.Element;
|
|
11
|
+
declare function DropdownMenuPortal({
|
|
12
|
+
...props
|
|
13
|
+
}: React.ComponentProps<typeof DropdownMenuPrimitive.Portal>): _$react_jsx_runtime0.JSX.Element;
|
|
14
|
+
declare function DropdownMenuTrigger({
|
|
15
|
+
...props
|
|
16
|
+
}: React.ComponentProps<typeof DropdownMenuPrimitive.Trigger>): _$react_jsx_runtime0.JSX.Element;
|
|
17
|
+
declare function DropdownMenuContent({
|
|
18
|
+
className,
|
|
19
|
+
sideOffset,
|
|
20
|
+
...props
|
|
21
|
+
}: React.ComponentProps<typeof DropdownMenuPrimitive.Content>): _$react_jsx_runtime0.JSX.Element;
|
|
22
|
+
declare function DropdownMenuGroup({
|
|
23
|
+
...props
|
|
24
|
+
}: React.ComponentProps<typeof DropdownMenuPrimitive.Group>): _$react_jsx_runtime0.JSX.Element;
|
|
25
|
+
declare const dropdownMenuItemVariants: (props?: ({
|
|
26
|
+
variant?: "default" | "destructive" | null | undefined;
|
|
27
|
+
} & _$class_variance_authority_types0.ClassProp) | undefined) => string;
|
|
28
|
+
declare function DropdownMenuItem({
|
|
29
|
+
className,
|
|
30
|
+
inset,
|
|
31
|
+
variant,
|
|
32
|
+
...props
|
|
33
|
+
}: React.ComponentProps<typeof DropdownMenuPrimitive.Item> & VariantProps<typeof dropdownMenuItemVariants> & {
|
|
34
|
+
inset?: boolean;
|
|
35
|
+
}): _$react_jsx_runtime0.JSX.Element;
|
|
36
|
+
declare function DropdownMenuLabel({
|
|
37
|
+
className,
|
|
38
|
+
inset,
|
|
39
|
+
...props
|
|
40
|
+
}: React.ComponentProps<typeof DropdownMenuPrimitive.Label> & {
|
|
41
|
+
inset?: boolean;
|
|
42
|
+
}): _$react_jsx_runtime0.JSX.Element;
|
|
43
|
+
declare function DropdownMenuHeader({
|
|
44
|
+
className,
|
|
45
|
+
children,
|
|
46
|
+
...props
|
|
47
|
+
}: React.HTMLAttributes<HTMLDivElement>): _$react_jsx_runtime0.JSX.Element;
|
|
48
|
+
declare function DropdownMenuSeparator({
|
|
49
|
+
className,
|
|
50
|
+
...props
|
|
51
|
+
}: React.ComponentProps<typeof DropdownMenuPrimitive.Separator>): _$react_jsx_runtime0.JSX.Element;
|
|
52
|
+
declare function DropdownMenuShortcut({
|
|
53
|
+
className,
|
|
54
|
+
...props
|
|
55
|
+
}: React.ComponentProps<"span">): _$react_jsx_runtime0.JSX.Element;
|
|
56
|
+
declare function DropdownMenuSub({
|
|
57
|
+
...props
|
|
58
|
+
}: React.ComponentProps<typeof DropdownMenuPrimitive.Sub>): _$react_jsx_runtime0.JSX.Element;
|
|
59
|
+
declare function DropdownMenuSubTrigger({
|
|
60
|
+
className,
|
|
61
|
+
inset,
|
|
62
|
+
children,
|
|
63
|
+
...props
|
|
64
|
+
}: React.ComponentProps<typeof DropdownMenuPrimitive.SubTrigger> & {
|
|
65
|
+
inset?: boolean;
|
|
66
|
+
}): _$react_jsx_runtime0.JSX.Element;
|
|
67
|
+
declare function DropdownMenuSubContent({
|
|
68
|
+
className,
|
|
69
|
+
...props
|
|
70
|
+
}: React.ComponentProps<typeof DropdownMenuPrimitive.SubContent>): _$react_jsx_runtime0.JSX.Element;
|
|
71
|
+
//#endregion
|
|
72
|
+
export { DropdownMenu, DropdownMenuContent, DropdownMenuGroup, DropdownMenuHeader, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, dropdownMenuItemVariants };
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../lib/cn.mjs";
|
|
3
|
+
import { ChevronRightIcon } from "lucide-react";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
import { cva } from "class-variance-authority";
|
|
6
|
+
import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
|
|
7
|
+
//#region src/components/dropdown-menu.tsx
|
|
8
|
+
function DropdownMenu({ ...props }) {
|
|
9
|
+
return /* @__PURE__ */ jsx(DropdownMenuPrimitive.Root, {
|
|
10
|
+
"data-slot": "dropdown-menu",
|
|
11
|
+
...props
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
function DropdownMenuPortal({ ...props }) {
|
|
15
|
+
return /* @__PURE__ */ jsx(DropdownMenuPrimitive.Portal, {
|
|
16
|
+
"data-slot": "dropdown-menu-portal",
|
|
17
|
+
...props
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
function DropdownMenuTrigger({ ...props }) {
|
|
21
|
+
return /* @__PURE__ */ jsx(DropdownMenuPrimitive.Trigger, {
|
|
22
|
+
"data-slot": "dropdown-menu-trigger",
|
|
23
|
+
...props
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
function DropdownMenuContent({ className, sideOffset = 4, ...props }) {
|
|
27
|
+
return /* @__PURE__ */ jsx(DropdownMenuPrimitive.Portal, { children: /* @__PURE__ */ jsx(DropdownMenuPrimitive.Content, {
|
|
28
|
+
"data-slot": "dropdown-menu-content",
|
|
29
|
+
sideOffset,
|
|
30
|
+
className: cn("bg-popover text-popover-foreground", "z-50 min-w-60 overflow-x-hidden overflow-y-auto rounded-md border border-border-secondary py-1 shadow-lg", "max-h-(--radix-dropdown-menu-content-available-height)", "origin-(--radix-dropdown-menu-content-transform-origin)", "data-[state=open]:animate-in data-[state=closed]:animate-out", "data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0", "data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95", "data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2", "data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2", className),
|
|
31
|
+
...props
|
|
32
|
+
}) });
|
|
33
|
+
}
|
|
34
|
+
function DropdownMenuGroup({ ...props }) {
|
|
35
|
+
return /* @__PURE__ */ jsx(DropdownMenuPrimitive.Group, {
|
|
36
|
+
"data-slot": "dropdown-menu-group",
|
|
37
|
+
...props
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
const dropdownMenuItemVariants = cva([
|
|
41
|
+
"relative flex cursor-default items-center gap-2 rounded-sm px-2.5 py-2 outline-hidden select-none",
|
|
42
|
+
"type-text-sm font-semibold",
|
|
43
|
+
"mx-1.5 my-px",
|
|
44
|
+
"[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
45
|
+
"data-[disabled]:pointer-events-none data-[disabled]:opacity-50"
|
|
46
|
+
].join(" "), {
|
|
47
|
+
variants: { variant: {
|
|
48
|
+
default: [
|
|
49
|
+
"text-muted-foreground",
|
|
50
|
+
"[&_svg:not([class*='text-'])]:text-muted-foreground",
|
|
51
|
+
"[@media(hover:hover)]:hover:bg-background-hover [@media(hover:hover)]:hover:text-muted-foreground-hover",
|
|
52
|
+
"focus:bg-background-hover focus:text-muted-foreground-hover"
|
|
53
|
+
].join(" "),
|
|
54
|
+
destructive: [
|
|
55
|
+
"text-destructive",
|
|
56
|
+
"[&_svg]:!text-destructive",
|
|
57
|
+
"[@media(hover:hover)]:hover:bg-destructive/10 dark:[@media(hover:hover)]:hover:bg-destructive/20",
|
|
58
|
+
"focus:bg-destructive/10 dark:focus:bg-destructive/20"
|
|
59
|
+
].join(" ")
|
|
60
|
+
} },
|
|
61
|
+
defaultVariants: { variant: "default" }
|
|
62
|
+
});
|
|
63
|
+
function DropdownMenuItem({ className, inset, variant = "default", ...props }) {
|
|
64
|
+
return /* @__PURE__ */ jsx(DropdownMenuPrimitive.Item, {
|
|
65
|
+
"data-slot": "dropdown-menu-item",
|
|
66
|
+
"data-inset": inset,
|
|
67
|
+
className: cn(dropdownMenuItemVariants({ variant }), inset && "pl-8", className),
|
|
68
|
+
...props
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
function DropdownMenuLabel({ className, inset, ...props }) {
|
|
72
|
+
return /* @__PURE__ */ jsx(DropdownMenuPrimitive.Label, {
|
|
73
|
+
"data-slot": "dropdown-menu-label",
|
|
74
|
+
className: cn("px-2.5 py-1.5 type-text-sm font-semibold text-foreground", inset && "pl-8", className),
|
|
75
|
+
...props
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
function DropdownMenuHeader({ className, children, ...props }) {
|
|
79
|
+
return /* @__PURE__ */ jsx("div", {
|
|
80
|
+
"data-slot": "dropdown-menu-header",
|
|
81
|
+
className: cn("flex items-center gap-2 border-b border-border-secondary p-3", className),
|
|
82
|
+
...props,
|
|
83
|
+
children
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
function DropdownMenuSeparator({ className, ...props }) {
|
|
87
|
+
return /* @__PURE__ */ jsx(DropdownMenuPrimitive.Separator, {
|
|
88
|
+
"data-slot": "dropdown-menu-separator",
|
|
89
|
+
className: cn("bg-border -mx-1 my-1 h-px", className),
|
|
90
|
+
...props
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
function DropdownMenuShortcut({ className, ...props }) {
|
|
94
|
+
return /* @__PURE__ */ jsx("span", {
|
|
95
|
+
"data-slot": "dropdown-menu-shortcut",
|
|
96
|
+
className: cn("ml-auto shrink-0 rounded-xs border border-border px-1 py-px type-text-xs font-medium text-subtle-foreground", className),
|
|
97
|
+
...props
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
function DropdownMenuSub({ ...props }) {
|
|
101
|
+
return /* @__PURE__ */ jsx(DropdownMenuPrimitive.Sub, {
|
|
102
|
+
"data-slot": "dropdown-menu-sub",
|
|
103
|
+
...props
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
function DropdownMenuSubTrigger({ className, inset, children, ...props }) {
|
|
107
|
+
return /* @__PURE__ */ jsxs(DropdownMenuPrimitive.SubTrigger, {
|
|
108
|
+
"data-slot": "dropdown-menu-sub-trigger",
|
|
109
|
+
className: cn(dropdownMenuItemVariants({ variant: "default" }), "data-[state=open]:bg-background-hover data-[state=open]:text-muted-foreground-hover", inset && "pl-8", className),
|
|
110
|
+
...props,
|
|
111
|
+
children: [children, /* @__PURE__ */ jsx(ChevronRightIcon, { className: "ml-auto size-4" })]
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
function DropdownMenuSubContent({ className, ...props }) {
|
|
115
|
+
return /* @__PURE__ */ jsx(DropdownMenuPrimitive.SubContent, {
|
|
116
|
+
"data-slot": "dropdown-menu-sub-content",
|
|
117
|
+
className: cn("bg-popover text-popover-foreground", "z-50 min-w-[8rem] overflow-hidden rounded-md border border-border-secondary py-1 shadow-lg", "origin-(--radix-dropdown-menu-content-transform-origin)", "data-[state=open]:animate-in data-[state=closed]:animate-out", "data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0", "data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95", "data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2", "data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2", className),
|
|
118
|
+
...props
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
//#endregion
|
|
122
|
+
export { DropdownMenu, DropdownMenuContent, DropdownMenuGroup, DropdownMenuHeader, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, dropdownMenuItemVariants };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
2
|
+
import { VariantProps } from "class-variance-authority";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import * as _$class_variance_authority_types0 from "class-variance-authority/types";
|
|
5
|
+
|
|
6
|
+
//#region src/components/input-group.d.ts
|
|
7
|
+
declare function InputGroup({
|
|
8
|
+
className,
|
|
9
|
+
children,
|
|
10
|
+
...props
|
|
11
|
+
}: React.ComponentProps<"fieldset">): _$react_jsx_runtime0.JSX.Element;
|
|
12
|
+
declare const inputGroupAddonVariants: (props?: ({
|
|
13
|
+
align?: "inline-start" | "inline-end" | "block-start" | "block-end" | null | undefined;
|
|
14
|
+
} & _$class_variance_authority_types0.ClassProp) | undefined) => string;
|
|
15
|
+
declare function InputGroupAddon({
|
|
16
|
+
className,
|
|
17
|
+
align,
|
|
18
|
+
...props
|
|
19
|
+
}: React.ComponentProps<"div"> & VariantProps<typeof inputGroupAddonVariants>): _$react_jsx_runtime0.JSX.Element;
|
|
20
|
+
declare function InputGroupTextarea({
|
|
21
|
+
className,
|
|
22
|
+
...props
|
|
23
|
+
}: React.ComponentProps<"textarea">): _$react_jsx_runtime0.JSX.Element;
|
|
24
|
+
//#endregion
|
|
25
|
+
export { InputGroup, InputGroupAddon, InputGroupTextarea };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../lib/cn.mjs";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
import { cva } from "class-variance-authority";
|
|
5
|
+
//#region src/components/input-group.tsx
|
|
6
|
+
function InputGroup({ className, children, ...props }) {
|
|
7
|
+
return /* @__PURE__ */ jsx("fieldset", {
|
|
8
|
+
"data-slot": "input-group",
|
|
9
|
+
className: cn("group/input-group relative flex w-full items-center rounded-md border bg-background", "h-9 min-w-0 has-[>textarea]:h-auto", "transition-colors", "has-[>[data-align=inline-start]]:[&>input]:pl-2", "has-[>[data-align=inline-end]]:[&>input]:pr-2", "has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>[data-align=block-start]]:[&>input]:pb-3", "has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-end]]:[&>input]:pt-3", "has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:border-2", "has-[[data-slot][aria-invalid=true]]:border-border-error", "has-[[data-slot=input-group-control]:disabled]:bg-disabled has-[[data-slot=input-group-control]:disabled]:text-disabled-foreground has-[[data-slot=input-group-control]:disabled]:cursor-not-allowed", className),
|
|
10
|
+
...props,
|
|
11
|
+
children
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
const inputGroupAddonVariants = cva("text-muted-foreground flex h-auto cursor-text items-center justify-center gap-2 py-1.5 type-text-sm font-medium select-none [&>svg:not([class*='size-'])]:size-4 group-disabled/input-group:opacity-50", {
|
|
15
|
+
variants: { align: {
|
|
16
|
+
"inline-start": "order-first pl-3 has-[>button]:ml-[-0.45rem] has-[>kbd]:ml-[-0.35rem]",
|
|
17
|
+
"inline-end": "order-last pr-3 has-[>button]:mr-[-0.45rem] has-[>kbd]:mr-[-0.35rem]",
|
|
18
|
+
"block-start": "order-first w-full justify-start px-3 pt-3 [.border-b]:pb-3 group-has-[>input]/input-group:pt-2.5",
|
|
19
|
+
"block-end": "order-last w-full justify-start px-3 pb-3 [.border-t]:pt-3 group-has-[>input]/input-group:pb-2.5"
|
|
20
|
+
} },
|
|
21
|
+
defaultVariants: { align: "inline-start" }
|
|
22
|
+
});
|
|
23
|
+
function InputGroupAddon({ className, align = "inline-start", ...props }) {
|
|
24
|
+
return /* @__PURE__ */ jsx("div", {
|
|
25
|
+
"data-slot": "input-group-addon",
|
|
26
|
+
"data-align": align,
|
|
27
|
+
className: cn(inputGroupAddonVariants({ align }), className),
|
|
28
|
+
onClick: (event) => {
|
|
29
|
+
if (event.target.closest("button")) return;
|
|
30
|
+
(event.currentTarget.parentElement?.querySelector("textarea, input"))?.focus();
|
|
31
|
+
},
|
|
32
|
+
...props
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
function InputGroupTextarea({ className, ...props }) {
|
|
36
|
+
return /* @__PURE__ */ jsx("textarea", {
|
|
37
|
+
"data-slot": "input-group-control",
|
|
38
|
+
className: cn("w-full flex-1 resize-none rounded-none border-0 bg-transparent px-3 py-3 shadow-none outline-none", "type-text-md text-foreground placeholder:text-placeholder", "focus-visible:ring-0", className),
|
|
39
|
+
...props
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
//#endregion
|
|
43
|
+
export { InputGroup, InputGroupAddon, InputGroupTextarea };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
|
|
4
|
+
//#region src/components/input.d.ts
|
|
5
|
+
interface InputProps extends Omit<React.ComponentProps<"input">, "size"> {
|
|
6
|
+
label?: string;
|
|
7
|
+
required?: boolean;
|
|
8
|
+
hint?: string;
|
|
9
|
+
error?: string;
|
|
10
|
+
leadingText?: string;
|
|
11
|
+
leadingIcon?: React.ReactNode;
|
|
12
|
+
size?: "sm" | "md";
|
|
13
|
+
}
|
|
14
|
+
declare function Input({
|
|
15
|
+
className,
|
|
16
|
+
id,
|
|
17
|
+
label,
|
|
18
|
+
required,
|
|
19
|
+
hint,
|
|
20
|
+
error,
|
|
21
|
+
leadingText,
|
|
22
|
+
leadingIcon,
|
|
23
|
+
size,
|
|
24
|
+
...props
|
|
25
|
+
}: InputProps): _$react_jsx_runtime0.JSX.Element;
|
|
26
|
+
//#endregion
|
|
27
|
+
export { Input, type InputProps };
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../lib/cn.mjs";
|
|
3
|
+
import { Label } from "./label.mjs";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
import * as React from "react";
|
|
6
|
+
//#region src/components/input.tsx
|
|
7
|
+
const inputSizeStyles = {
|
|
8
|
+
sm: {
|
|
9
|
+
standalone: "h-8 px-2 py-1.5 type-text-sm",
|
|
10
|
+
wrapper: "h-8",
|
|
11
|
+
inner: "px-2 py-1.5",
|
|
12
|
+
text: "type-text-sm",
|
|
13
|
+
leadingText: "pl-2 pr-2 type-text-sm",
|
|
14
|
+
leadingIcon: "pl-2 [&_svg]:size-4"
|
|
15
|
+
},
|
|
16
|
+
md: {
|
|
17
|
+
standalone: "h-8 px-2.5 py-1.5 type-text-md",
|
|
18
|
+
wrapper: "h-8",
|
|
19
|
+
inner: "px-2.5 py-1.5",
|
|
20
|
+
text: "type-text-md",
|
|
21
|
+
leadingText: "pl-2.5 pr-2 type-text-md",
|
|
22
|
+
leadingIcon: "pl-2.5 [&_svg]:size-5"
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
function Input({ className, id, label, required, hint, error, leadingText, leadingIcon, size = "md", ...props }) {
|
|
26
|
+
const generatedId = React.useId();
|
|
27
|
+
const fieldId = id ?? generatedId;
|
|
28
|
+
const hasAddons = leadingText || leadingIcon;
|
|
29
|
+
const sizes = inputSizeStyles[size];
|
|
30
|
+
const inputElement = /* @__PURE__ */ jsx("input", {
|
|
31
|
+
id: fieldId,
|
|
32
|
+
"data-slot": "input",
|
|
33
|
+
className: cn("w-full min-w-0 bg-transparent outline-none", sizes.text, "text-foreground placeholder:text-placeholder", "disabled:cursor-not-allowed", !hasAddons && [
|
|
34
|
+
"flex",
|
|
35
|
+
sizes.standalone,
|
|
36
|
+
"bg-background border border-border rounded-md",
|
|
37
|
+
"transition-colors",
|
|
38
|
+
"focus-visible:border-ring focus-visible:border-2",
|
|
39
|
+
"disabled:bg-disabled disabled:text-disabled-foreground",
|
|
40
|
+
"aria-invalid:border-border-error",
|
|
41
|
+
error && "border-border-error"
|
|
42
|
+
], hasAddons && "flex-1 min-h-0", className),
|
|
43
|
+
required,
|
|
44
|
+
"aria-invalid": error ? true : void 0,
|
|
45
|
+
"aria-describedby": fieldId && (hint || error) ? `${fieldId}-description` : void 0,
|
|
46
|
+
...props
|
|
47
|
+
});
|
|
48
|
+
const wrappedInput = hasAddons ? /* @__PURE__ */ jsxs("div", {
|
|
49
|
+
className: cn("flex items-center w-full overflow-hidden", sizes.wrapper, "bg-background border border-border rounded-md", "transition-colors", "has-[input:focus-visible]:border-ring has-[input:focus-visible]:border-2", "has-[input:disabled]:bg-disabled has-[input:disabled]:text-disabled-foreground has-[input:disabled]:cursor-not-allowed", error && "border-border-error"),
|
|
50
|
+
children: [
|
|
51
|
+
leadingIcon && /* @__PURE__ */ jsx("span", {
|
|
52
|
+
className: cn("flex items-center text-subtle-foreground [&_svg]:shrink-0", sizes.leadingIcon),
|
|
53
|
+
children: leadingIcon
|
|
54
|
+
}),
|
|
55
|
+
leadingText && /* @__PURE__ */ jsx("span", {
|
|
56
|
+
className: cn("flex items-center text-subtle-foreground whitespace-nowrap border-r border-border self-stretch", sizes.leadingText),
|
|
57
|
+
children: leadingText
|
|
58
|
+
}),
|
|
59
|
+
/* @__PURE__ */ jsx("div", {
|
|
60
|
+
className: cn("flex flex-1 items-center min-w-0", sizes.inner),
|
|
61
|
+
children: inputElement
|
|
62
|
+
})
|
|
63
|
+
]
|
|
64
|
+
}) : inputElement;
|
|
65
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
66
|
+
className: "flex flex-col gap-1.5",
|
|
67
|
+
children: [
|
|
68
|
+
label && /* @__PURE__ */ jsxs("div", {
|
|
69
|
+
className: "flex items-center gap-0.5",
|
|
70
|
+
children: [/* @__PURE__ */ jsx(Label, {
|
|
71
|
+
htmlFor: fieldId,
|
|
72
|
+
className: "type-text-sm font-medium text-muted-foreground",
|
|
73
|
+
children: label
|
|
74
|
+
}), required && /* @__PURE__ */ jsx("span", {
|
|
75
|
+
"aria-hidden": true,
|
|
76
|
+
className: "type-text-sm font-medium text-required",
|
|
77
|
+
children: "*"
|
|
78
|
+
})]
|
|
79
|
+
}),
|
|
80
|
+
wrappedInput,
|
|
81
|
+
(hint || error) && /* @__PURE__ */ jsx("p", {
|
|
82
|
+
id: fieldId ? `${fieldId}-description` : void 0,
|
|
83
|
+
className: cn("type-text-sm", error ? "text-destructive" : "text-subtle-foreground"),
|
|
84
|
+
children: error ?? hint
|
|
85
|
+
})
|
|
86
|
+
]
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
//#endregion
|
|
90
|
+
export { Input };
|