@boriaui/react 0.0.0-stage → 0.1.1
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/LICENSE +21 -0
- package/README.md +80 -2
- package/dist/components/alert-dialog.d.ts +29 -0
- package/dist/components/alert-dialog.js +62 -0
- package/dist/components/alert.d.ts +12 -0
- package/dist/components/alert.js +35 -0
- package/dist/components/autosize-textarea.d.ts +26 -0
- package/dist/components/autosize-textarea.js +66 -0
- package/dist/components/avatar.d.ts +9 -0
- package/dist/components/avatar.js +30 -0
- package/dist/components/badge.d.ts +16 -0
- package/dist/components/badge.js +24 -0
- package/dist/components/breadcrumb.d.ts +29 -0
- package/dist/components/breadcrumb.js +64 -0
- package/dist/components/button.d.ts +15 -0
- package/dist/components/button.js +45 -0
- package/dist/components/calendar.d.ts +25 -0
- package/dist/components/calendar.js +109 -0
- package/dist/components/card.d.ts +11 -0
- package/dist/components/card.js +44 -0
- package/dist/components/checkbox.d.ts +20 -0
- package/dist/components/checkbox.js +29 -0
- package/dist/components/collapsible.d.ts +9 -0
- package/dist/components/collapsible.js +12 -0
- package/dist/components/command.d.ts +89 -0
- package/dist/components/command.js +79 -0
- package/dist/components/context-menu.d.ts +36 -0
- package/dist/components/context-menu.js +136 -0
- package/dist/components/dialog.d.ts +31 -0
- package/dist/components/dialog.js +58 -0
- package/dist/components/dropdown-menu.d.ts +33 -0
- package/dist/components/dropdown-menu.js +85 -0
- package/dist/components/empty.d.ts +35 -0
- package/dist/components/empty.js +61 -0
- package/dist/components/field.d.ts +64 -0
- package/dist/components/field.js +121 -0
- package/dist/components/hover-card.d.ts +9 -0
- package/dist/components/hover-card.js +25 -0
- package/dist/components/input-group.d.ts +42 -0
- package/dist/components/input-group.js +83 -0
- package/dist/components/input.d.ts +6 -0
- package/dist/components/input.js +17 -0
- package/dist/components/item.d.ts +61 -0
- package/dist/components/item.js +118 -0
- package/dist/components/kbd.d.ts +13 -0
- package/dist/components/kbd.js +21 -0
- package/dist/components/label.d.ts +7 -0
- package/dist/components/label.js +18 -0
- package/dist/components/popover.d.ts +10 -0
- package/dist/components/popover.js +23 -0
- package/dist/components/radio-group.d.ts +14 -0
- package/dist/components/radio-group.js +39 -0
- package/dist/components/resizable.d.ts +34 -0
- package/dist/components/resizable.js +25 -0
- package/dist/components/scroll-area.d.ts +11 -0
- package/dist/components/scroll-area.js +35 -0
- package/dist/components/select.d.ts +16 -0
- package/dist/components/select.js +77 -0
- package/dist/components/separator.d.ts +7 -0
- package/dist/components/separator.js +20 -0
- package/dist/components/sheet.d.ts +34 -0
- package/dist/components/sheet.js +68 -0
- package/dist/components/sidebar.d.ts +72 -0
- package/dist/components/sidebar.js +382 -0
- package/dist/components/skeleton.d.ts +9 -0
- package/dist/components/skeleton.js +13 -0
- package/dist/components/spinner.d.ts +9 -0
- package/dist/components/spinner.js +16 -0
- package/dist/components/switch.d.ts +28 -0
- package/dist/components/switch.js +31 -0
- package/dist/components/tabs.d.ts +10 -0
- package/dist/components/tabs.js +31 -0
- package/dist/components/textarea.d.ts +6 -0
- package/dist/components/textarea.js +16 -0
- package/dist/components/toaster.d.ts +10 -0
- package/dist/components/toaster.js +19 -0
- package/dist/components/toggle-group.d.ts +16 -0
- package/dist/components/toggle-group.js +43 -0
- package/dist/components/toggle.d.ts +16 -0
- package/dist/components/toggle.js +40 -0
- package/dist/components/tooltip.d.ts +10 -0
- package/dist/components/tooltip.js +22 -0
- package/dist/hooks/index.d.ts +3 -0
- package/dist/hooks/index.js +4 -0
- package/dist/hooks/use-media-query.d.ts +8 -0
- package/dist/hooks/use-media-query.js +20 -0
- package/dist/hooks/use-mobile.d.ts +4 -0
- package/dist/hooks/use-mobile.js +20 -0
- package/dist/lib/index.d.ts +3 -0
- package/dist/lib/index.js +4 -0
- package/dist/lib/keyboard-guards.d.ts +11 -0
- package/dist/lib/keyboard-guards.js +21 -0
- package/dist/lib/utils.d.ts +6 -0
- package/dist/lib/utils.js +10 -0
- package/dist/theme/index.d.ts +3 -0
- package/dist/theme/index.js +4 -0
- package/dist/theme/theme-options.d.ts +16 -0
- package/dist/theme/theme-options.js +25 -0
- package/dist/theme/theme-provider.d.ts +50 -0
- package/dist/theme/theme-provider.js +94 -0
- package/package.json +124 -4
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
import { cn } from "../lib/utils.js";
|
|
5
|
+
import * as React from "react";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { X } from "lucide-react";
|
|
8
|
+
import * as DialogPrimitive from "@radix-ui/react-dialog";
|
|
9
|
+
|
|
10
|
+
//#region src/components/dialog.tsx
|
|
11
|
+
const Dialog = DialogPrimitive.Root;
|
|
12
|
+
const DialogTrigger = DialogPrimitive.Trigger;
|
|
13
|
+
const DialogPortal = DialogPrimitive.Portal;
|
|
14
|
+
const DialogClose = DialogPrimitive.Close;
|
|
15
|
+
const DialogOverlay = React.forwardRef(({ className,...props }, ref) => /* @__PURE__ */ jsx(DialogPrimitive.Overlay, {
|
|
16
|
+
ref,
|
|
17
|
+
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),
|
|
18
|
+
...props
|
|
19
|
+
}));
|
|
20
|
+
DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
|
|
21
|
+
const DialogContent = React.forwardRef(({ className, children, showCloseButton = true,...props }, ref) => /* @__PURE__ */ jsxs(DialogPortal, { children: [/* @__PURE__ */ jsx(DialogOverlay, {}), /* @__PURE__ */ jsxs(DialogPrimitive.Content, {
|
|
22
|
+
ref,
|
|
23
|
+
className: cn("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 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 sm:rounded-lg", className),
|
|
24
|
+
...props,
|
|
25
|
+
children: [children, showCloseButton && /* @__PURE__ */ jsxs(DialogPrimitive.Close, {
|
|
26
|
+
className: "absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",
|
|
27
|
+
children: [/* @__PURE__ */ jsx(X, { className: "h-4 w-4" }), /* @__PURE__ */ jsx("span", {
|
|
28
|
+
className: "sr-only",
|
|
29
|
+
children: "Close"
|
|
30
|
+
})]
|
|
31
|
+
})]
|
|
32
|
+
})] }));
|
|
33
|
+
DialogContent.displayName = DialogPrimitive.Content.displayName;
|
|
34
|
+
const DialogHeader = ({ className,...props }) => /* @__PURE__ */ jsx("div", {
|
|
35
|
+
className: cn("flex flex-col space-y-1.5 text-center sm:text-left", className),
|
|
36
|
+
...props
|
|
37
|
+
});
|
|
38
|
+
DialogHeader.displayName = "DialogHeader";
|
|
39
|
+
const DialogFooter = ({ className,...props }) => /* @__PURE__ */ jsx("div", {
|
|
40
|
+
className: cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2", className),
|
|
41
|
+
...props
|
|
42
|
+
});
|
|
43
|
+
DialogFooter.displayName = "DialogFooter";
|
|
44
|
+
const DialogTitle = React.forwardRef(({ className,...props }, ref) => /* @__PURE__ */ jsx(DialogPrimitive.Title, {
|
|
45
|
+
ref,
|
|
46
|
+
className: cn("text-lg font-semibold leading-none tracking-tight", className),
|
|
47
|
+
...props
|
|
48
|
+
}));
|
|
49
|
+
DialogTitle.displayName = DialogPrimitive.Title.displayName;
|
|
50
|
+
const DialogDescription = React.forwardRef(({ className,...props }, ref) => /* @__PURE__ */ jsx(DialogPrimitive.Description, {
|
|
51
|
+
ref,
|
|
52
|
+
className: cn("text-sm text-muted-foreground", className),
|
|
53
|
+
...props
|
|
54
|
+
}));
|
|
55
|
+
DialogDescription.displayName = DialogPrimitive.Description.displayName;
|
|
56
|
+
|
|
57
|
+
//#endregion
|
|
58
|
+
export { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
|
|
3
|
+
|
|
4
|
+
//#region src/components/dropdown-menu.d.ts
|
|
5
|
+
declare const DropdownMenu: React.FC<DropdownMenuPrimitive.DropdownMenuProps>;
|
|
6
|
+
declare const DropdownMenuTrigger: React.ForwardRefExoticComponent<DropdownMenuPrimitive.DropdownMenuTriggerProps & React.RefAttributes<HTMLButtonElement>>;
|
|
7
|
+
declare const DropdownMenuGroup: React.ForwardRefExoticComponent<DropdownMenuPrimitive.DropdownMenuGroupProps & React.RefAttributes<HTMLDivElement>>;
|
|
8
|
+
declare const DropdownMenuPortal: React.FC<DropdownMenuPrimitive.DropdownMenuPortalProps>;
|
|
9
|
+
declare const DropdownMenuSub: React.FC<DropdownMenuPrimitive.DropdownMenuSubProps>;
|
|
10
|
+
declare const DropdownMenuRadioGroup: React.ForwardRefExoticComponent<DropdownMenuPrimitive.DropdownMenuRadioGroupProps & React.RefAttributes<HTMLDivElement>>;
|
|
11
|
+
declare const DropdownMenuSubTrigger: React.ForwardRefExoticComponent<Omit<DropdownMenuPrimitive.DropdownMenuSubTriggerProps & React.RefAttributes<HTMLDivElement>, "ref"> & {
|
|
12
|
+
inset?: boolean;
|
|
13
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
14
|
+
declare const DropdownMenuSubContent: React.ForwardRefExoticComponent<Omit<DropdownMenuPrimitive.DropdownMenuSubContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
15
|
+
declare const DropdownMenuContent: React.ForwardRefExoticComponent<Omit<DropdownMenuPrimitive.DropdownMenuContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
16
|
+
declare const DropdownMenuItem: React.ForwardRefExoticComponent<Omit<DropdownMenuPrimitive.DropdownMenuItemProps & React.RefAttributes<HTMLDivElement>, "ref"> & {
|
|
17
|
+
inset?: boolean;
|
|
18
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
19
|
+
declare const DropdownMenuCheckboxItem: React.ForwardRefExoticComponent<Omit<DropdownMenuPrimitive.DropdownMenuCheckboxItemProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
20
|
+
declare const DropdownMenuRadioItem: React.ForwardRefExoticComponent<Omit<DropdownMenuPrimitive.DropdownMenuRadioItemProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
21
|
+
declare const DropdownMenuLabel: React.ForwardRefExoticComponent<Omit<DropdownMenuPrimitive.DropdownMenuLabelProps & React.RefAttributes<HTMLDivElement>, "ref"> & {
|
|
22
|
+
inset?: boolean;
|
|
23
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
24
|
+
declare const DropdownMenuSeparator: React.ForwardRefExoticComponent<Omit<DropdownMenuPrimitive.DropdownMenuSeparatorProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
25
|
+
declare const DropdownMenuShortcut: {
|
|
26
|
+
({
|
|
27
|
+
className,
|
|
28
|
+
...props
|
|
29
|
+
}: React.HTMLAttributes<HTMLSpanElement>): React.JSX.Element;
|
|
30
|
+
displayName: string;
|
|
31
|
+
};
|
|
32
|
+
//#endregion
|
|
33
|
+
export { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger };
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
import { cn } from "../lib/utils.js";
|
|
5
|
+
import * as React from "react";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { Check, ChevronRight, Circle } from "lucide-react";
|
|
8
|
+
import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
|
|
9
|
+
|
|
10
|
+
//#region src/components/dropdown-menu.tsx
|
|
11
|
+
const DropdownMenu = DropdownMenuPrimitive.Root;
|
|
12
|
+
const DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;
|
|
13
|
+
const DropdownMenuGroup = DropdownMenuPrimitive.Group;
|
|
14
|
+
const DropdownMenuPortal = DropdownMenuPrimitive.Portal;
|
|
15
|
+
const DropdownMenuSub = DropdownMenuPrimitive.Sub;
|
|
16
|
+
const DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup;
|
|
17
|
+
const DropdownMenuSubTrigger = React.forwardRef(({ className, inset, children,...props }, ref) => /* @__PURE__ */ jsxs(DropdownMenuPrimitive.SubTrigger, {
|
|
18
|
+
ref,
|
|
19
|
+
className: cn("flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden focus:bg-accent data-[state=open]:bg-accent [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0", inset && "pl-8", className),
|
|
20
|
+
...props,
|
|
21
|
+
children: [children, /* @__PURE__ */ jsx(ChevronRight, { className: "ml-auto" })]
|
|
22
|
+
}));
|
|
23
|
+
DropdownMenuSubTrigger.displayName = DropdownMenuPrimitive.SubTrigger.displayName;
|
|
24
|
+
const DropdownMenuSubContent = React.forwardRef(({ className,...props }, ref) => /* @__PURE__ */ jsx(DropdownMenuPrimitive.SubContent, {
|
|
25
|
+
ref,
|
|
26
|
+
className: cn("z-50 min-w-32 overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg 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 origin-(--radix-dropdown-menu-content-transform-origin)", className),
|
|
27
|
+
...props
|
|
28
|
+
}));
|
|
29
|
+
DropdownMenuSubContent.displayName = DropdownMenuPrimitive.SubContent.displayName;
|
|
30
|
+
const DropdownMenuContent = React.forwardRef(({ className, sideOffset = 4,...props }, ref) => /* @__PURE__ */ jsx(DropdownMenuPrimitive.Portal, { children: /* @__PURE__ */ jsx(DropdownMenuPrimitive.Content, {
|
|
31
|
+
ref,
|
|
32
|
+
sideOffset,
|
|
33
|
+
className: cn("z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-32 overflow-y-auto overflow-x-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md", "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 origin-(--radix-dropdown-menu-content-transform-origin)", className),
|
|
34
|
+
...props
|
|
35
|
+
}) }));
|
|
36
|
+
DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName;
|
|
37
|
+
const DropdownMenuItem = React.forwardRef(({ className, inset,...props }, ref) => /* @__PURE__ */ jsx(DropdownMenuPrimitive.Item, {
|
|
38
|
+
ref,
|
|
39
|
+
className: cn("relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden transition-colors focus:bg-accent focus:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&>svg]:size-4 [&>svg]:shrink-0", inset && "pl-8", className),
|
|
40
|
+
...props
|
|
41
|
+
}));
|
|
42
|
+
DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName;
|
|
43
|
+
const DropdownMenuCheckboxItem = React.forwardRef(({ className, children, checked,...props }, ref) => /* @__PURE__ */ jsxs(DropdownMenuPrimitive.CheckboxItem, {
|
|
44
|
+
ref,
|
|
45
|
+
className: cn("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-hidden transition-colors focus:bg-accent focus:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50", className),
|
|
46
|
+
checked,
|
|
47
|
+
...props,
|
|
48
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
49
|
+
className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center",
|
|
50
|
+
children: /* @__PURE__ */ jsx(DropdownMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx(Check, { className: "h-4 w-4" }) })
|
|
51
|
+
}), children]
|
|
52
|
+
}));
|
|
53
|
+
DropdownMenuCheckboxItem.displayName = DropdownMenuPrimitive.CheckboxItem.displayName;
|
|
54
|
+
const DropdownMenuRadioItem = React.forwardRef(({ className, children,...props }, ref) => /* @__PURE__ */ jsxs(DropdownMenuPrimitive.RadioItem, {
|
|
55
|
+
ref,
|
|
56
|
+
className: cn("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-hidden transition-colors focus:bg-accent focus:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50", className),
|
|
57
|
+
...props,
|
|
58
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
59
|
+
className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center",
|
|
60
|
+
children: /* @__PURE__ */ jsx(DropdownMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx(Circle, { className: "h-2 w-2 fill-current" }) })
|
|
61
|
+
}), children]
|
|
62
|
+
}));
|
|
63
|
+
DropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName;
|
|
64
|
+
const DropdownMenuLabel = React.forwardRef(({ className, inset,...props }, ref) => /* @__PURE__ */ jsx(DropdownMenuPrimitive.Label, {
|
|
65
|
+
ref,
|
|
66
|
+
className: cn("px-2 py-1.5 text-sm font-semibold", inset && "pl-8", className),
|
|
67
|
+
...props
|
|
68
|
+
}));
|
|
69
|
+
DropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName;
|
|
70
|
+
const DropdownMenuSeparator = React.forwardRef(({ className,...props }, ref) => /* @__PURE__ */ jsx(DropdownMenuPrimitive.Separator, {
|
|
71
|
+
ref,
|
|
72
|
+
className: cn("-mx-1 my-1 h-px bg-muted", className),
|
|
73
|
+
...props
|
|
74
|
+
}));
|
|
75
|
+
DropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName;
|
|
76
|
+
const DropdownMenuShortcut = ({ className,...props }) => {
|
|
77
|
+
return /* @__PURE__ */ jsx("span", {
|
|
78
|
+
className: cn("ml-auto text-xs tracking-widest opacity-60", className),
|
|
79
|
+
...props
|
|
80
|
+
});
|
|
81
|
+
};
|
|
82
|
+
DropdownMenuShortcut.displayName = "DropdownMenuShortcut";
|
|
83
|
+
|
|
84
|
+
//#endregion
|
|
85
|
+
export { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import * as react12 from "react";
|
|
2
|
+
import { VariantProps } from "class-variance-authority";
|
|
3
|
+
import * as class_variance_authority_types3 from "class-variance-authority/types";
|
|
4
|
+
|
|
5
|
+
//#region src/components/empty.d.ts
|
|
6
|
+
declare function Empty({
|
|
7
|
+
className,
|
|
8
|
+
...props
|
|
9
|
+
}: React.ComponentProps<"div">): react12.JSX.Element;
|
|
10
|
+
declare function EmptyHeader({
|
|
11
|
+
className,
|
|
12
|
+
...props
|
|
13
|
+
}: React.ComponentProps<"div">): react12.JSX.Element;
|
|
14
|
+
declare const emptyMediaVariants: (props?: ({
|
|
15
|
+
variant?: "default" | "icon" | null | undefined;
|
|
16
|
+
} & class_variance_authority_types3.ClassProp) | undefined) => string;
|
|
17
|
+
declare function EmptyMedia({
|
|
18
|
+
className,
|
|
19
|
+
variant,
|
|
20
|
+
...props
|
|
21
|
+
}: React.ComponentProps<"div"> & VariantProps<typeof emptyMediaVariants>): react12.JSX.Element;
|
|
22
|
+
declare function EmptyTitle({
|
|
23
|
+
className,
|
|
24
|
+
...props
|
|
25
|
+
}: React.ComponentProps<"div">): react12.JSX.Element;
|
|
26
|
+
declare function EmptyDescription({
|
|
27
|
+
className,
|
|
28
|
+
...props
|
|
29
|
+
}: React.ComponentProps<"p">): react12.JSX.Element;
|
|
30
|
+
declare function EmptyContent({
|
|
31
|
+
className,
|
|
32
|
+
...props
|
|
33
|
+
}: React.ComponentProps<"div">): react12.JSX.Element;
|
|
34
|
+
//#endregion
|
|
35
|
+
export { Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle };
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { cn } from "../lib/utils.js";
|
|
2
|
+
import { cva } from "class-variance-authority";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
|
|
5
|
+
//#region src/components/empty.tsx
|
|
6
|
+
function Empty({ className,...props }) {
|
|
7
|
+
return /* @__PURE__ */ jsx("div", {
|
|
8
|
+
"data-slot": "empty",
|
|
9
|
+
className: cn("flex min-w-0 flex-1 flex-col items-center justify-center gap-6 text-balance rounded-lg border-dashed p-6 text-center md:p-12", className),
|
|
10
|
+
...props
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
function EmptyHeader({ className,...props }) {
|
|
14
|
+
return /* @__PURE__ */ jsx("div", {
|
|
15
|
+
"data-slot": "empty-header",
|
|
16
|
+
className: cn("flex max-w-sm flex-col items-center gap-2 text-center", className),
|
|
17
|
+
...props
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
const emptyMediaVariants = cva("mb-2 flex shrink-0 items-center justify-center [&_svg]:pointer-events-none [&_svg]:shrink-0", {
|
|
21
|
+
variants: { variant: {
|
|
22
|
+
default: "bg-transparent",
|
|
23
|
+
icon: "bg-muted text-foreground flex size-10 shrink-0 items-center justify-center rounded-lg [&_svg:not([class*='size-'])]:size-6"
|
|
24
|
+
} },
|
|
25
|
+
defaultVariants: { variant: "default" }
|
|
26
|
+
});
|
|
27
|
+
function EmptyMedia({ className, variant = "default",...props }) {
|
|
28
|
+
return /* @__PURE__ */ jsx("div", {
|
|
29
|
+
"data-slot": "empty-icon",
|
|
30
|
+
"data-variant": variant,
|
|
31
|
+
className: cn(emptyMediaVariants({
|
|
32
|
+
variant,
|
|
33
|
+
className
|
|
34
|
+
})),
|
|
35
|
+
...props
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
function EmptyTitle({ className,...props }) {
|
|
39
|
+
return /* @__PURE__ */ jsx("div", {
|
|
40
|
+
"data-slot": "empty-title",
|
|
41
|
+
className: cn("text-lg font-medium tracking-tight", className),
|
|
42
|
+
...props
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
function EmptyDescription({ className,...props }) {
|
|
46
|
+
return /* @__PURE__ */ jsx("div", {
|
|
47
|
+
"data-slot": "empty-description",
|
|
48
|
+
className: cn("text-muted-foreground [&>a:hover]:text-primary text-sm/relaxed [&>a]:underline [&>a]:underline-offset-4", className),
|
|
49
|
+
...props
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
function EmptyContent({ className,...props }) {
|
|
53
|
+
return /* @__PURE__ */ jsx("div", {
|
|
54
|
+
"data-slot": "empty-content",
|
|
55
|
+
className: cn("flex w-full min-w-0 max-w-sm flex-col items-center gap-4 text-balance text-sm", className),
|
|
56
|
+
...props
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
//#endregion
|
|
61
|
+
export { Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle };
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { Label } from "./label.js";
|
|
2
|
+
import * as react19 from "react";
|
|
3
|
+
import { VariantProps } from "class-variance-authority";
|
|
4
|
+
import * as class_variance_authority_types5 from "class-variance-authority/types";
|
|
5
|
+
|
|
6
|
+
//#region src/components/field.d.ts
|
|
7
|
+
declare function FieldSet({
|
|
8
|
+
className,
|
|
9
|
+
...props
|
|
10
|
+
}: React.ComponentProps<"fieldset">): react19.JSX.Element;
|
|
11
|
+
declare function FieldLegend({
|
|
12
|
+
className,
|
|
13
|
+
variant,
|
|
14
|
+
...props
|
|
15
|
+
}: React.ComponentProps<"legend"> & {
|
|
16
|
+
variant?: "legend" | "label";
|
|
17
|
+
}): react19.JSX.Element;
|
|
18
|
+
declare function FieldGroup({
|
|
19
|
+
className,
|
|
20
|
+
...props
|
|
21
|
+
}: React.ComponentProps<"div">): react19.JSX.Element;
|
|
22
|
+
declare const fieldVariants: (props?: ({
|
|
23
|
+
orientation?: "vertical" | "horizontal" | "responsive" | null | undefined;
|
|
24
|
+
} & class_variance_authority_types5.ClassProp) | undefined) => string;
|
|
25
|
+
declare function Field({
|
|
26
|
+
className,
|
|
27
|
+
orientation,
|
|
28
|
+
...props
|
|
29
|
+
}: React.ComponentProps<"div"> & VariantProps<typeof fieldVariants>): react19.JSX.Element;
|
|
30
|
+
declare function FieldContent({
|
|
31
|
+
className,
|
|
32
|
+
...props
|
|
33
|
+
}: React.ComponentProps<"div">): react19.JSX.Element;
|
|
34
|
+
declare function FieldLabel({
|
|
35
|
+
className,
|
|
36
|
+
...props
|
|
37
|
+
}: React.ComponentProps<typeof Label>): react19.JSX.Element;
|
|
38
|
+
declare function FieldTitle({
|
|
39
|
+
className,
|
|
40
|
+
...props
|
|
41
|
+
}: React.ComponentProps<"div">): react19.JSX.Element;
|
|
42
|
+
declare function FieldDescription({
|
|
43
|
+
className,
|
|
44
|
+
...props
|
|
45
|
+
}: React.ComponentProps<"p">): react19.JSX.Element;
|
|
46
|
+
declare function FieldSeparator({
|
|
47
|
+
children,
|
|
48
|
+
className,
|
|
49
|
+
...props
|
|
50
|
+
}: React.ComponentProps<"div"> & {
|
|
51
|
+
children?: React.ReactNode;
|
|
52
|
+
}): react19.JSX.Element;
|
|
53
|
+
declare function FieldError({
|
|
54
|
+
className,
|
|
55
|
+
children,
|
|
56
|
+
errors,
|
|
57
|
+
...props
|
|
58
|
+
}: React.ComponentProps<"div"> & {
|
|
59
|
+
errors?: Array<{
|
|
60
|
+
message?: string;
|
|
61
|
+
} | undefined>;
|
|
62
|
+
}): react19.JSX.Element | null;
|
|
63
|
+
//#endregion
|
|
64
|
+
export { Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, FieldSeparator, FieldSet, FieldTitle };
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
import { cn } from "../lib/utils.js";
|
|
5
|
+
import { Label } from "./label.js";
|
|
6
|
+
import { Separator } from "./separator.js";
|
|
7
|
+
import { useMemo } from "react";
|
|
8
|
+
import { cva } from "class-variance-authority";
|
|
9
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
|
+
|
|
11
|
+
//#region src/components/field.tsx
|
|
12
|
+
function FieldSet({ className,...props }) {
|
|
13
|
+
return /* @__PURE__ */ jsx("fieldset", {
|
|
14
|
+
"data-slot": "field-set",
|
|
15
|
+
className: cn("flex flex-col gap-6", "has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3", className),
|
|
16
|
+
...props
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
function FieldLegend({ className, variant = "legend",...props }) {
|
|
20
|
+
return /* @__PURE__ */ jsx("legend", {
|
|
21
|
+
"data-slot": "field-legend",
|
|
22
|
+
"data-variant": variant,
|
|
23
|
+
className: cn("mb-3 font-medium", "data-[variant=legend]:text-base", "data-[variant=label]:text-sm", className),
|
|
24
|
+
...props
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
function FieldGroup({ className,...props }) {
|
|
28
|
+
return /* @__PURE__ */ jsx("div", {
|
|
29
|
+
"data-slot": "field-group",
|
|
30
|
+
className: cn("group/field-group @container/field-group flex w-full flex-col gap-7 data-[slot=checkbox-group]:gap-3 [&>[data-slot=field-group]]:gap-4", className),
|
|
31
|
+
...props
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
const fieldVariants = cva("group/field data-[invalid=true]:text-destructive flex w-full gap-3", {
|
|
35
|
+
variants: { orientation: {
|
|
36
|
+
vertical: ["flex-col [&>*]:w-full [&>.sr-only]:w-auto"],
|
|
37
|
+
horizontal: [
|
|
38
|
+
"flex-row items-center",
|
|
39
|
+
"[&>[data-slot=field-label]]:flex-auto",
|
|
40
|
+
"has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px has-[>[data-slot=field-content]]:items-start"
|
|
41
|
+
],
|
|
42
|
+
responsive: [
|
|
43
|
+
"@md/field-group:flex-row @md/field-group:items-center @md/field-group:[&>*]:w-auto flex-col [&>*]:w-full [&>.sr-only]:w-auto",
|
|
44
|
+
"@md/field-group:[&>[data-slot=field-label]]:flex-auto",
|
|
45
|
+
"@md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px"
|
|
46
|
+
]
|
|
47
|
+
} },
|
|
48
|
+
defaultVariants: { orientation: "vertical" }
|
|
49
|
+
});
|
|
50
|
+
function Field({ className, orientation = "vertical",...props }) {
|
|
51
|
+
return /* @__PURE__ */ jsx("div", {
|
|
52
|
+
role: "group",
|
|
53
|
+
"data-slot": "field",
|
|
54
|
+
"data-orientation": orientation,
|
|
55
|
+
className: cn(fieldVariants({ orientation }), className),
|
|
56
|
+
...props
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
function FieldContent({ className,...props }) {
|
|
60
|
+
return /* @__PURE__ */ jsx("div", {
|
|
61
|
+
"data-slot": "field-content",
|
|
62
|
+
className: cn("group/field-content flex flex-1 flex-col gap-1.5 leading-snug", className),
|
|
63
|
+
...props
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
function FieldLabel({ className,...props }) {
|
|
67
|
+
return /* @__PURE__ */ jsx(Label, {
|
|
68
|
+
"data-slot": "field-label",
|
|
69
|
+
className: cn("group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50", "has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col has-[>[data-slot=field]]:rounded-md has-[>[data-slot=field]]:border [&>[data-slot=field]]:p-4", "has-data-[state=checked]:bg-primary/5 has-data-[state=checked]:border-primary dark:has-data-[state=checked]:bg-primary/10", className),
|
|
70
|
+
...props
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
function FieldTitle({ className,...props }) {
|
|
74
|
+
return /* @__PURE__ */ jsx("div", {
|
|
75
|
+
"data-slot": "field-label",
|
|
76
|
+
className: cn("flex w-fit items-center gap-2 text-sm font-medium leading-snug group-data-[disabled=true]/field:opacity-50", className),
|
|
77
|
+
...props
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
function FieldDescription({ className,...props }) {
|
|
81
|
+
return /* @__PURE__ */ jsx("p", {
|
|
82
|
+
"data-slot": "field-description",
|
|
83
|
+
className: cn("text-muted-foreground text-sm font-normal leading-normal group-has-[[data-orientation=horizontal]]/field:text-balance", "nth-last-2:-mt-1 last:mt-0 [[data-variant=legend]+&]:-mt-1.5", "[&>a:hover]:text-primary [&>a]:underline [&>a]:underline-offset-4", className),
|
|
84
|
+
...props
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
function FieldSeparator({ children, className,...props }) {
|
|
88
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
89
|
+
"data-slot": "field-separator",
|
|
90
|
+
"data-content": !!children,
|
|
91
|
+
className: cn("relative -my-2 h-5 text-sm group-data-[variant=outline]/field-group:-mb-2", className),
|
|
92
|
+
...props,
|
|
93
|
+
children: [/* @__PURE__ */ jsx(Separator, { className: "absolute inset-0 top-1/2" }), children && /* @__PURE__ */ jsx("span", {
|
|
94
|
+
className: "bg-background text-muted-foreground relative mx-auto block w-fit px-2",
|
|
95
|
+
"data-slot": "field-separator-content",
|
|
96
|
+
children
|
|
97
|
+
})]
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
function FieldError({ className, children, errors,...props }) {
|
|
101
|
+
const content = useMemo(() => {
|
|
102
|
+
if (children) return children;
|
|
103
|
+
if (!errors) return null;
|
|
104
|
+
if (errors?.length === 1 && errors[0]?.message) return errors[0].message;
|
|
105
|
+
return /* @__PURE__ */ jsx("ul", {
|
|
106
|
+
className: "ml-4 flex list-disc flex-col gap-1",
|
|
107
|
+
children: errors.map((error, index) => error?.message && /* @__PURE__ */ jsx("li", { children: error.message }, index))
|
|
108
|
+
});
|
|
109
|
+
}, [children, errors]);
|
|
110
|
+
if (!content) return null;
|
|
111
|
+
return /* @__PURE__ */ jsx("div", {
|
|
112
|
+
role: "alert",
|
|
113
|
+
"data-slot": "field-error",
|
|
114
|
+
className: cn("text-destructive text-sm font-normal", className),
|
|
115
|
+
...props,
|
|
116
|
+
children: content
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
//#endregion
|
|
121
|
+
export { Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, FieldSeparator, FieldSet, FieldTitle };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import * as HoverCardPrimitive from "@radix-ui/react-hover-card";
|
|
3
|
+
|
|
4
|
+
//#region src/components/hover-card.d.ts
|
|
5
|
+
declare const HoverCard: React.FC<HoverCardPrimitive.HoverCardProps>;
|
|
6
|
+
declare const HoverCardTrigger: React.ForwardRefExoticComponent<HoverCardPrimitive.HoverCardTriggerProps & React.RefAttributes<HTMLAnchorElement>>;
|
|
7
|
+
declare const HoverCardContent: React.ForwardRefExoticComponent<Omit<HoverCardPrimitive.HoverCardContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
8
|
+
//#endregion
|
|
9
|
+
export { HoverCard, HoverCardContent, HoverCardTrigger };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
import { cn } from "../lib/utils.js";
|
|
5
|
+
import * as React from "react";
|
|
6
|
+
import { jsx } from "react/jsx-runtime";
|
|
7
|
+
import * as HoverCardPrimitive from "@radix-ui/react-hover-card";
|
|
8
|
+
|
|
9
|
+
//#region src/components/hover-card.tsx
|
|
10
|
+
const HoverCard = HoverCardPrimitive.Root;
|
|
11
|
+
const HoverCardTrigger = HoverCardPrimitive.Trigger;
|
|
12
|
+
const HoverCardContent = React.forwardRef(({ className, align = "center", sideOffset = 4,...props }, ref) => /* @__PURE__ */ jsx(HoverCardPrimitive.Portal, {
|
|
13
|
+
"data-slot": "hover-card-portal",
|
|
14
|
+
children: /* @__PURE__ */ jsx(HoverCardPrimitive.Content, {
|
|
15
|
+
ref,
|
|
16
|
+
align,
|
|
17
|
+
sideOffset,
|
|
18
|
+
className: cn("z-50 w-64 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-hidden 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 origin-(--radix-hover-card-content-transform-origin)", className),
|
|
19
|
+
...props
|
|
20
|
+
})
|
|
21
|
+
}));
|
|
22
|
+
HoverCardContent.displayName = HoverCardPrimitive.Content.displayName;
|
|
23
|
+
|
|
24
|
+
//#endregion
|
|
25
|
+
export { HoverCard, HoverCardContent, HoverCardTrigger };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Button } from "./button.js";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { VariantProps } from "class-variance-authority";
|
|
4
|
+
import * as class_variance_authority_types6 from "class-variance-authority/types";
|
|
5
|
+
|
|
6
|
+
//#region src/components/input-group.d.ts
|
|
7
|
+
declare function InputGroup({
|
|
8
|
+
className,
|
|
9
|
+
...props
|
|
10
|
+
}: React.ComponentProps<"div">): React.JSX.Element;
|
|
11
|
+
declare const inputGroupAddonVariants: (props?: ({
|
|
12
|
+
align?: "inline-start" | "inline-end" | "block-start" | "block-end" | null | undefined;
|
|
13
|
+
} & class_variance_authority_types6.ClassProp) | undefined) => string;
|
|
14
|
+
declare function InputGroupAddon({
|
|
15
|
+
className,
|
|
16
|
+
align,
|
|
17
|
+
...props
|
|
18
|
+
}: React.ComponentProps<"div"> & VariantProps<typeof inputGroupAddonVariants>): React.JSX.Element;
|
|
19
|
+
declare const inputGroupButtonVariants: (props?: ({
|
|
20
|
+
size?: "sm" | "xs" | "icon-xs" | "icon-sm" | null | undefined;
|
|
21
|
+
} & class_variance_authority_types6.ClassProp) | undefined) => string;
|
|
22
|
+
declare function InputGroupButton({
|
|
23
|
+
className,
|
|
24
|
+
type,
|
|
25
|
+
variant,
|
|
26
|
+
size,
|
|
27
|
+
...props
|
|
28
|
+
}: Omit<React.ComponentProps<typeof Button>, "size"> & VariantProps<typeof inputGroupButtonVariants>): React.JSX.Element;
|
|
29
|
+
declare function InputGroupText({
|
|
30
|
+
className,
|
|
31
|
+
...props
|
|
32
|
+
}: React.ComponentProps<"span">): React.JSX.Element;
|
|
33
|
+
declare function InputGroupInput({
|
|
34
|
+
className,
|
|
35
|
+
...props
|
|
36
|
+
}: React.ComponentProps<"input">): React.JSX.Element;
|
|
37
|
+
declare function InputGroupTextarea({
|
|
38
|
+
className,
|
|
39
|
+
...props
|
|
40
|
+
}: React.ComponentProps<"textarea">): React.JSX.Element;
|
|
41
|
+
//#endregion
|
|
42
|
+
export { InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea };
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
import { cn } from "../lib/utils.js";
|
|
5
|
+
import { Button } from "./button.js";
|
|
6
|
+
import { Input } from "./input.js";
|
|
7
|
+
import { Textarea } from "./textarea.js";
|
|
8
|
+
import "react";
|
|
9
|
+
import { cva } from "class-variance-authority";
|
|
10
|
+
import { jsx } from "react/jsx-runtime";
|
|
11
|
+
|
|
12
|
+
//#region src/components/input-group.tsx
|
|
13
|
+
function InputGroup({ className,...props }) {
|
|
14
|
+
return /* @__PURE__ */ jsx("div", {
|
|
15
|
+
"data-slot": "input-group",
|
|
16
|
+
role: "group",
|
|
17
|
+
className: cn("group/input-group border-input dark:bg-input/30 shadow-2xs relative flex w-full items-center rounded-md border outline-hidden transition-[color,box-shadow]", "h-9 has-[>textarea]:h-auto", "[&>input]:has-[>[data-align=inline-start]]:pl-2", "[&>input]:has-[>[data-align=inline-end]]:pr-2", "has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col [&>input]:has-[>[data-align=block-start]]:pb-3", "has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col [&>input]:has-[>[data-align=block-end]]:pt-3", "has-[[data-slot=input-group-control]:focus-visible]:ring-ring has-[[data-slot=input-group-control]:focus-visible]:ring-1", "has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[[data-slot][aria-invalid=true]]:border-destructive dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40", className),
|
|
18
|
+
...props
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
const inputGroupAddonVariants = cva("text-muted-foreground flex h-auto cursor-text select-none items-center justify-center gap-2 py-1.5 text-sm font-medium group-data-[disabled=true]/input-group:opacity-50 [&>kbd]:rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-4", {
|
|
22
|
+
variants: { align: {
|
|
23
|
+
"inline-start": "order-first pl-3 has-[>button]:ml-[-0.45rem] has-[>kbd]:ml-[-0.35rem]",
|
|
24
|
+
"inline-end": "order-last pr-3 has-[>button]:mr-[-0.4rem] has-[>kbd]:mr-[-0.35rem]",
|
|
25
|
+
"block-start": "[.border-b]:pb-3 order-first w-full justify-start px-3 pt-3 group-has-[>input]/input-group:pt-2.5",
|
|
26
|
+
"block-end": "[.border-t]:pt-3 order-last w-full justify-start px-3 pb-3 group-has-[>input]/input-group:pb-2.5"
|
|
27
|
+
} },
|
|
28
|
+
defaultVariants: { align: "inline-start" }
|
|
29
|
+
});
|
|
30
|
+
function InputGroupAddon({ className, align = "inline-start",...props }) {
|
|
31
|
+
return /* @__PURE__ */ jsx("div", {
|
|
32
|
+
role: "group",
|
|
33
|
+
"data-slot": "input-group-addon",
|
|
34
|
+
"data-align": align,
|
|
35
|
+
className: cn(inputGroupAddonVariants({ align }), className),
|
|
36
|
+
onClick: (e) => {
|
|
37
|
+
if (e.target.closest("button")) return;
|
|
38
|
+
e.currentTarget.parentElement?.querySelector("input")?.focus();
|
|
39
|
+
},
|
|
40
|
+
...props
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
const inputGroupButtonVariants = cva("flex items-center gap-2 text-sm shadow-none", {
|
|
44
|
+
variants: { size: {
|
|
45
|
+
xs: "h-6 gap-1 rounded-[calc(var(--radius)-5px)] px-2 has-[>svg]:px-2 [&>svg:not([class*='size-'])]:size-3.5",
|
|
46
|
+
sm: "h-8 gap-1.5 rounded-md px-2.5 has-[>svg]:px-2.5",
|
|
47
|
+
"icon-xs": "size-6 rounded-[calc(var(--radius)-5px)] p-0 has-[>svg]:p-0",
|
|
48
|
+
"icon-sm": "size-8 p-0 has-[>svg]:p-0"
|
|
49
|
+
} },
|
|
50
|
+
defaultVariants: { size: "xs" }
|
|
51
|
+
});
|
|
52
|
+
function InputGroupButton({ className, type = "button", variant = "ghost", size = "xs",...props }) {
|
|
53
|
+
return /* @__PURE__ */ jsx(Button, {
|
|
54
|
+
type,
|
|
55
|
+
"data-size": size,
|
|
56
|
+
variant,
|
|
57
|
+
className: cn(inputGroupButtonVariants({ size }), className),
|
|
58
|
+
...props
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
function InputGroupText({ className,...props }) {
|
|
62
|
+
return /* @__PURE__ */ jsx("span", {
|
|
63
|
+
className: cn("text-muted-foreground flex items-center gap-2 text-sm [&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none", className),
|
|
64
|
+
...props
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
function InputGroupInput({ className,...props }) {
|
|
68
|
+
return /* @__PURE__ */ jsx(Input, {
|
|
69
|
+
"data-slot": "input-group-control",
|
|
70
|
+
className: cn("flex-1 rounded-none border-0 bg-transparent shadow-none focus-visible:ring-0 dark:bg-transparent", className),
|
|
71
|
+
...props
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
function InputGroupTextarea({ className,...props }) {
|
|
75
|
+
return /* @__PURE__ */ jsx(Textarea, {
|
|
76
|
+
"data-slot": "input-group-control",
|
|
77
|
+
className: cn("flex-1 resize-none rounded-none border-0 bg-transparent py-3 shadow-none focus-visible:ring-0 dark:bg-transparent", className),
|
|
78
|
+
...props
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
//#endregion
|
|
83
|
+
export { InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
|
|
3
|
+
//#region src/components/input.d.ts
|
|
4
|
+
declare const Input: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "ref"> & React.RefAttributes<HTMLInputElement>>;
|
|
5
|
+
//#endregion
|
|
6
|
+
export { Input };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { cn } from "../lib/utils.js";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
|
|
5
|
+
//#region src/components/input.tsx
|
|
6
|
+
const Input = React.forwardRef(({ className, type,...props }, ref) => {
|
|
7
|
+
return /* @__PURE__ */ jsx("input", {
|
|
8
|
+
type,
|
|
9
|
+
className: cn("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-xs transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-hidden focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm", className),
|
|
10
|
+
ref,
|
|
11
|
+
...props
|
|
12
|
+
});
|
|
13
|
+
});
|
|
14
|
+
Input.displayName = "Input";
|
|
15
|
+
|
|
16
|
+
//#endregion
|
|
17
|
+
export { Input };
|