@hitch42/applet 0.1.0-beta.2
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/dist/_internal/client.d.ts +7 -0
- package/dist/_internal/client.js +60 -0
- package/dist/_internal/server.d.ts +79 -0
- package/dist/_internal/server.js +232 -0
- package/dist/applet.d.ts +1 -0
- package/dist/applet.js +160 -0
- package/dist/auth-DaVK0k5R.js +350 -0
- package/dist/batch-Qa4B4-Yp.d.ts +30 -0
- package/dist/build-BRkmrUcj.js +74 -0
- package/dist/build-CMluoV6q.js +2 -0
- package/dist/client.d.ts +48 -0
- package/dist/client.js +38 -0
- package/dist/contract-DMrpbaLJ.d.ts +23 -0
- package/dist/deploy-DKB-Tef7.js +2416 -0
- package/dist/generate-BFmIzHaR.js +484 -0
- package/dist/generate-CefnB-bp.js +2 -0
- package/dist/index.d.ts +74 -0
- package/dist/index.js +136 -0
- package/dist/init-CQRsnd3i.js +240 -0
- package/dist/lazy-client-x0DCI98S.js +64 -0
- package/dist/load-config-BnxocLAQ.js +56 -0
- package/dist/logs-m00pzr_O.js +183 -0
- package/dist/manifest-BQCAxATS.d.ts +81 -0
- package/dist/manifest-DyoJ1MIL.js +174 -0
- package/dist/project-CEmDnlKa.js +346 -0
- package/dist/react.d.ts +37 -0
- package/dist/react.js +517 -0
- package/dist/server.d.ts +46 -0
- package/dist/server.js +104 -0
- package/dist/upload-DRbVhuDm.js +114 -0
- package/dist/upload-YbRKEqR6.d.ts +112 -0
- package/dist/variables-CP7Ce3Np.js +133 -0
- package/dist/vite.d.ts +63 -0
- package/dist/vite.js +358 -0
- package/dist/workflow-CTo2kZF1.js +51 -0
- package/dist/workflow-DurM6Fwx.d.ts +28 -0
- package/package.json +104 -0
- package/scaffold/.agents/skills/hitch-applets/SKILL.md +137 -0
- package/scaffold/.agents/skills/hitch-applets/references/client.md +73 -0
- package/scaffold/.agents/skills/hitch-applets/references/files.md +109 -0
- package/scaffold/.agents/skills/hitch-applets/references/manifest.md +171 -0
- package/scaffold/.agents/skills/hitch-applets/references/markdown.md +37 -0
- package/scaffold/.agents/skills/hitch-applets/references/records.md +152 -0
- package/scaffold/.agents/skills/hitch-applets/references/schedules.md +86 -0
- package/scaffold/.agents/skills/hitch-applets/references/server.md +98 -0
- package/scaffold/.agents/skills/hitch-applets/references/workflows.md +73 -0
- package/scaffold/AGENTS.md +38 -0
- package/scaffold/applet/components.json +25 -0
- package/scaffold/applet/src/client/components/ui/alert.tsx +73 -0
- package/scaffold/applet/src/client/components/ui/avatar.tsx +100 -0
- package/scaffold/applet/src/client/components/ui/badge.tsx +55 -0
- package/scaffold/applet/src/client/components/ui/button.tsx +90 -0
- package/scaffold/applet/src/client/components/ui/card.tsx +85 -0
- package/scaffold/applet/src/client/components/ui/checkbox.tsx +35 -0
- package/scaffold/applet/src/client/components/ui/dialog.tsx +164 -0
- package/scaffold/applet/src/client/components/ui/dropdown-menu.tsx +235 -0
- package/scaffold/applet/src/client/components/ui/input-group.tsx +144 -0
- package/scaffold/applet/src/client/components/ui/input.tsx +22 -0
- package/scaffold/applet/src/client/components/ui/label.tsx +29 -0
- package/scaffold/applet/src/client/components/ui/popover.tsx +74 -0
- package/scaffold/applet/src/client/components/ui/select.tsx +243 -0
- package/scaffold/applet/src/client/components/ui/separator.tsx +25 -0
- package/scaffold/applet/src/client/components/ui/sheet.tsx +177 -0
- package/scaffold/applet/src/client/components/ui/skeleton.tsx +13 -0
- package/scaffold/applet/src/client/components/ui/spinner.tsx +16 -0
- package/scaffold/applet/src/client/components/ui/switch.tsx +41 -0
- package/scaffold/applet/src/client/components/ui/table.tsx +114 -0
- package/scaffold/applet/src/client/components/ui/tabs.tsx +78 -0
- package/scaffold/applet/src/client/components/ui/textarea.tsx +23 -0
- package/scaffold/applet/src/client/lib/utils.ts +6 -0
- package/scaffold/applet/src/client/styles/globals.css +136 -0
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import {
|
|
3
|
+
Dialog as DialogPrimitive,
|
|
4
|
+
DialogTrigger as DialogTriggerPrimitive,
|
|
5
|
+
Heading,
|
|
6
|
+
ModalOverlay as ModalOverlayPrimitive,
|
|
7
|
+
Modal as ModalPrimitive,
|
|
8
|
+
type DialogProps as DialogPrimitiveProps,
|
|
9
|
+
type DialogTriggerProps as DialogTriggerPrimitiveProps,
|
|
10
|
+
type ModalOverlayProps as ModalOverlayPrimitiveProps,
|
|
11
|
+
} from "react-aria-components";
|
|
12
|
+
|
|
13
|
+
import { cn } from "@/client/lib/utils";
|
|
14
|
+
import { Button } from "@/client/components/ui/button";
|
|
15
|
+
import { XIcon } from "lucide-react";
|
|
16
|
+
|
|
17
|
+
function DialogTrigger({ ...props }: DialogTriggerPrimitiveProps) {
|
|
18
|
+
return <DialogTriggerPrimitive data-slot="dialog-trigger" {...props} />;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function DialogClose({
|
|
22
|
+
className,
|
|
23
|
+
variant = "outline",
|
|
24
|
+
size = "default",
|
|
25
|
+
...props
|
|
26
|
+
}: React.ComponentProps<typeof Button>) {
|
|
27
|
+
return (
|
|
28
|
+
<Button
|
|
29
|
+
slot="close"
|
|
30
|
+
data-slot="dialog-close"
|
|
31
|
+
variant={variant}
|
|
32
|
+
size={size}
|
|
33
|
+
className={cn(className)}
|
|
34
|
+
{...props}
|
|
35
|
+
/>
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function DialogOverlay({
|
|
40
|
+
className,
|
|
41
|
+
children,
|
|
42
|
+
...props
|
|
43
|
+
}: Omit<ModalOverlayPrimitiveProps, "className" | "children"> & {
|
|
44
|
+
className?: string;
|
|
45
|
+
children: React.ReactNode;
|
|
46
|
+
}) {
|
|
47
|
+
return (
|
|
48
|
+
<ModalOverlayPrimitive
|
|
49
|
+
data-slot="dialog-overlay"
|
|
50
|
+
className={cn(
|
|
51
|
+
"fixed inset-0 isolate z-50 bg-black/30 duration-100 data-entering:animate-in data-entering:fade-in-0 data-exiting:animate-out data-exiting:fade-out-0 supports-backdrop-filter:backdrop-blur-sm",
|
|
52
|
+
className,
|
|
53
|
+
)}
|
|
54
|
+
{...props}
|
|
55
|
+
>
|
|
56
|
+
{children}
|
|
57
|
+
</ModalOverlayPrimitive>
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function Dialog({
|
|
62
|
+
className,
|
|
63
|
+
children,
|
|
64
|
+
showCloseButton = true,
|
|
65
|
+
isDismissable = true,
|
|
66
|
+
...props
|
|
67
|
+
}: Omit<ModalOverlayPrimitiveProps, "className" | "children"> &
|
|
68
|
+
Pick<React.ComponentProps<typeof ModalPrimitive>, "isDismissable"> & {
|
|
69
|
+
className?: string;
|
|
70
|
+
children: React.ReactNode;
|
|
71
|
+
showCloseButton?: boolean;
|
|
72
|
+
}) {
|
|
73
|
+
return (
|
|
74
|
+
<DialogOverlay isDismissable={isDismissable} {...props}>
|
|
75
|
+
<ModalPrimitive
|
|
76
|
+
data-slot="dialog-content"
|
|
77
|
+
className={cn(
|
|
78
|
+
"fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-6 rounded-[min(var(--radius-4xl),24px)] bg-popover p-6 text-sm text-popover-foreground shadow-xl ring-1 ring-foreground/5 duration-100 outline-none data-entering:animate-in data-entering:fade-in-0 data-entering:zoom-in-95 data-exiting:animate-out data-exiting:fade-out-0 data-exiting:zoom-out-95 sm:max-w-md dark:ring-foreground/10",
|
|
79
|
+
className,
|
|
80
|
+
)}
|
|
81
|
+
>
|
|
82
|
+
<DialogPrimitive
|
|
83
|
+
data-slot="dialog"
|
|
84
|
+
className="[display:inherit] [gap:inherit] outline-none"
|
|
85
|
+
>
|
|
86
|
+
{children}
|
|
87
|
+
{showCloseButton && (
|
|
88
|
+
<DialogClose
|
|
89
|
+
variant="ghost"
|
|
90
|
+
className="absolute top-4 right-4 bg-secondary"
|
|
91
|
+
size="icon-sm"
|
|
92
|
+
>
|
|
93
|
+
<XIcon />
|
|
94
|
+
<span className="sr-only">Close</span>
|
|
95
|
+
</DialogClose>
|
|
96
|
+
)}
|
|
97
|
+
</DialogPrimitive>
|
|
98
|
+
</ModalPrimitive>
|
|
99
|
+
</DialogOverlay>
|
|
100
|
+
);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
function DialogHeader({ className, ...props }: React.ComponentProps<"div">) {
|
|
104
|
+
return (
|
|
105
|
+
<div data-slot="dialog-header" className={cn("flex flex-col gap-1.5", className)} {...props} />
|
|
106
|
+
);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
function DialogFooter({
|
|
110
|
+
className,
|
|
111
|
+
showCloseButton = false,
|
|
112
|
+
children,
|
|
113
|
+
...props
|
|
114
|
+
}: React.ComponentProps<"div"> & {
|
|
115
|
+
showCloseButton?: boolean;
|
|
116
|
+
}) {
|
|
117
|
+
return (
|
|
118
|
+
<div
|
|
119
|
+
data-slot="dialog-footer"
|
|
120
|
+
className={cn("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end", className)}
|
|
121
|
+
{...props}
|
|
122
|
+
>
|
|
123
|
+
{children}
|
|
124
|
+
{showCloseButton && <DialogClose variant="outline">Close</DialogClose>}
|
|
125
|
+
</div>
|
|
126
|
+
);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
function DialogTitle({ className, ...props }: Omit<React.ComponentProps<typeof Heading>, "slot">) {
|
|
130
|
+
return (
|
|
131
|
+
<Heading
|
|
132
|
+
slot="title"
|
|
133
|
+
data-slot="dialog-title"
|
|
134
|
+
className={cn("font-heading text-base leading-none font-medium", className)}
|
|
135
|
+
{...props}
|
|
136
|
+
/>
|
|
137
|
+
);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
function DialogDescription({ className, ...props }: Omit<React.ComponentProps<"div">, "slot">) {
|
|
141
|
+
return (
|
|
142
|
+
<div
|
|
143
|
+
data-slot="dialog-description"
|
|
144
|
+
className={cn(
|
|
145
|
+
"text-sm text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground",
|
|
146
|
+
className,
|
|
147
|
+
)}
|
|
148
|
+
{...props}
|
|
149
|
+
/>
|
|
150
|
+
);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
export {
|
|
154
|
+
type DialogPrimitiveProps,
|
|
155
|
+
type DialogTriggerPrimitiveProps,
|
|
156
|
+
Dialog,
|
|
157
|
+
DialogClose,
|
|
158
|
+
DialogDescription,
|
|
159
|
+
DialogFooter,
|
|
160
|
+
DialogHeader,
|
|
161
|
+
DialogOverlay,
|
|
162
|
+
DialogTitle,
|
|
163
|
+
DialogTrigger,
|
|
164
|
+
};
|
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { cva } from "class-variance-authority";
|
|
5
|
+
import {
|
|
6
|
+
composeRenderProps,
|
|
7
|
+
Header as HeaderPrimitive,
|
|
8
|
+
MenuItem as MenuItemPrimitive,
|
|
9
|
+
Menu as MenuPrimitive,
|
|
10
|
+
MenuSection as MenuSectionPrimitive,
|
|
11
|
+
MenuTrigger as MenuTriggerPrimitive,
|
|
12
|
+
Popover as PopoverPrimitive,
|
|
13
|
+
Separator as SeparatorPrimitive,
|
|
14
|
+
SubmenuTrigger as SubmenuTriggerPrimitive,
|
|
15
|
+
type MenuItemProps as MenuItemPrimitiveProps,
|
|
16
|
+
type MenuSectionProps as MenuSectionPrimitiveProps,
|
|
17
|
+
} from "react-aria-components";
|
|
18
|
+
|
|
19
|
+
import { cn } from "@/client/lib/utils";
|
|
20
|
+
import { CheckIcon, ChevronRightIcon } from "lucide-react";
|
|
21
|
+
|
|
22
|
+
function DropdownMenuTrigger({ ...props }: React.ComponentProps<typeof MenuTriggerPrimitive>) {
|
|
23
|
+
return <MenuTriggerPrimitive data-slot="dropdown-menu-trigger" {...props} />;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function DropdownMenu({
|
|
27
|
+
"data-slot": dataSlot = "dropdown-menu-content",
|
|
28
|
+
placement = "bottom start",
|
|
29
|
+
offset = 4,
|
|
30
|
+
crossOffset = 0,
|
|
31
|
+
className,
|
|
32
|
+
children,
|
|
33
|
+
...props
|
|
34
|
+
}: Omit<React.ComponentProps<typeof MenuPrimitive<object>>, "children" | "className"> &
|
|
35
|
+
Pick<React.ComponentProps<typeof PopoverPrimitive>, "placement" | "offset" | "crossOffset"> & {
|
|
36
|
+
"data-slot"?: string;
|
|
37
|
+
className?: string;
|
|
38
|
+
children?: React.ReactNode;
|
|
39
|
+
}) {
|
|
40
|
+
return (
|
|
41
|
+
<PopoverPrimitive
|
|
42
|
+
data-slot={dataSlot}
|
|
43
|
+
placement={placement}
|
|
44
|
+
offset={offset}
|
|
45
|
+
crossOffset={crossOffset}
|
|
46
|
+
className={cn(
|
|
47
|
+
"z-50 w-(--trigger-width) min-w-32 origin-(--trigger-anchor-point) overflow-x-hidden overflow-y-auto rounded-2xl bg-popover p-1 text-popover-foreground shadow-lg ring-1 ring-foreground/5 duration-100 outline-none data-entering:animate-in data-entering:fade-in-0 data-entering:zoom-in-95 data-exiting:animate-out data-exiting:overflow-hidden data-exiting:fade-out-0 data-exiting:zoom-out-95 data-[placement=bottom]:slide-in-from-top-2 data-[placement=left]:slide-in-from-right-2 data-[placement=right]:slide-in-from-left-2 data-[placement=top]:slide-in-from-bottom-2 **:data-[slot$=-item]:data-focused:bg-foreground/10 dark:ring-foreground/10",
|
|
48
|
+
className,
|
|
49
|
+
)}
|
|
50
|
+
>
|
|
51
|
+
<MenuPrimitive
|
|
52
|
+
className="max-h-[inherit] overflow-x-hidden overflow-y-auto outline-hidden"
|
|
53
|
+
{...props}
|
|
54
|
+
>
|
|
55
|
+
{children}
|
|
56
|
+
</MenuPrimitive>
|
|
57
|
+
</PopoverPrimitive>
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function DropdownMenuGroup({
|
|
62
|
+
...props
|
|
63
|
+
}: Omit<MenuSectionPrimitiveProps<object>, "children"> & {
|
|
64
|
+
children?: React.ReactNode;
|
|
65
|
+
}) {
|
|
66
|
+
return <MenuSectionPrimitive data-slot="dropdown-menu-group" {...props} />;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function DropdownMenuLabel({
|
|
70
|
+
className,
|
|
71
|
+
inset,
|
|
72
|
+
...props
|
|
73
|
+
}: React.ComponentProps<typeof HeaderPrimitive> & {
|
|
74
|
+
inset?: boolean;
|
|
75
|
+
}) {
|
|
76
|
+
return (
|
|
77
|
+
<HeaderPrimitive
|
|
78
|
+
data-slot="dropdown-menu-label"
|
|
79
|
+
data-inset={inset}
|
|
80
|
+
className={cn("px-2 py-1 text-xs text-muted-foreground data-inset:pl-7", className)}
|
|
81
|
+
{...props}
|
|
82
|
+
/>
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
const dropdownMenuItemVariants = cva(
|
|
87
|
+
"group/dropdown-menu-item relative flex cursor-default items-center outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0",
|
|
88
|
+
{
|
|
89
|
+
variants: {
|
|
90
|
+
selectionMode: {
|
|
91
|
+
none: "min-h-7 gap-2 rounded-xl px-2 py-1.5 text-sm focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 [&_svg:not([class*='size-'])]:size-4 data-[variant=destructive]:*:[svg]:text-destructive",
|
|
92
|
+
single:
|
|
93
|
+
"min-h-7 gap-2 rounded-xl py-1.5 pr-8 pl-2 text-sm focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:pl-7 [&_svg:not([class*='size-'])]:size-4",
|
|
94
|
+
multiple:
|
|
95
|
+
"min-h-7 gap-2 rounded-xl py-1.5 pr-8 pl-2 text-sm focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:pl-7 [&_svg:not([class*='size-'])]:size-4",
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
);
|
|
100
|
+
|
|
101
|
+
function DropdownMenuItem({
|
|
102
|
+
className,
|
|
103
|
+
inset,
|
|
104
|
+
variant = "default",
|
|
105
|
+
children,
|
|
106
|
+
...props
|
|
107
|
+
}: MenuItemPrimitiveProps<object> & {
|
|
108
|
+
inset?: boolean;
|
|
109
|
+
variant?: "default" | "destructive";
|
|
110
|
+
}) {
|
|
111
|
+
return (
|
|
112
|
+
<MenuItemPrimitive
|
|
113
|
+
data-slot="dropdown-menu-item"
|
|
114
|
+
data-inset={inset}
|
|
115
|
+
data-variant={variant}
|
|
116
|
+
textValue={typeof children === "string" ? children : props.textValue}
|
|
117
|
+
className={composeRenderProps(className, (className, { selectionMode }) =>
|
|
118
|
+
cn(dropdownMenuItemVariants({ selectionMode }), className),
|
|
119
|
+
)}
|
|
120
|
+
{...props}
|
|
121
|
+
>
|
|
122
|
+
{composeRenderProps(children, (children, { isSelected, selectionMode }) => (
|
|
123
|
+
<>
|
|
124
|
+
{selectionMode !== "none" ? (
|
|
125
|
+
<span
|
|
126
|
+
className="pointer-events-none absolute right-2 flex items-center justify-center"
|
|
127
|
+
data-slot={
|
|
128
|
+
selectionMode === "single"
|
|
129
|
+
? "dropdown-menu-radio-item-indicator"
|
|
130
|
+
: "dropdown-menu-checkbox-item-indicator"
|
|
131
|
+
}
|
|
132
|
+
>
|
|
133
|
+
{isSelected ? <CheckIcon /> : null}
|
|
134
|
+
</span>
|
|
135
|
+
) : null}
|
|
136
|
+
{children}
|
|
137
|
+
</>
|
|
138
|
+
))}
|
|
139
|
+
</MenuItemPrimitive>
|
|
140
|
+
);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
function DropdownMenuSub({ ...props }: React.ComponentProps<typeof SubmenuTriggerPrimitive>) {
|
|
144
|
+
return <SubmenuTriggerPrimitive data-slot="dropdown-menu-sub" {...props} />;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
function DropdownMenuSubTrigger({
|
|
148
|
+
className,
|
|
149
|
+
inset,
|
|
150
|
+
children,
|
|
151
|
+
...props
|
|
152
|
+
}: MenuItemPrimitiveProps<object> & {
|
|
153
|
+
inset?: boolean;
|
|
154
|
+
}) {
|
|
155
|
+
return (
|
|
156
|
+
<MenuItemPrimitive
|
|
157
|
+
data-slot="dropdown-menu-sub-trigger"
|
|
158
|
+
data-inset={inset}
|
|
159
|
+
textValue={typeof children === "string" ? children : props.textValue}
|
|
160
|
+
className={cn(
|
|
161
|
+
"flex min-h-7 cursor-default items-center gap-2 rounded-xl px-2 py-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7 data-open:bg-accent data-open:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
162
|
+
className,
|
|
163
|
+
)}
|
|
164
|
+
{...props}
|
|
165
|
+
>
|
|
166
|
+
{composeRenderProps(children, (children) => (
|
|
167
|
+
<>
|
|
168
|
+
{children}
|
|
169
|
+
<ChevronRightIcon className="ml-auto" />
|
|
170
|
+
</>
|
|
171
|
+
))}
|
|
172
|
+
</MenuItemPrimitive>
|
|
173
|
+
);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
function DropdownMenuSubContent({
|
|
177
|
+
placement = "end top",
|
|
178
|
+
crossOffset = -3,
|
|
179
|
+
offset = 0,
|
|
180
|
+
className,
|
|
181
|
+
...props
|
|
182
|
+
}: React.ComponentProps<typeof DropdownMenu>) {
|
|
183
|
+
return (
|
|
184
|
+
<DropdownMenu
|
|
185
|
+
data-slot="dropdown-menu-sub-content"
|
|
186
|
+
className={cn(
|
|
187
|
+
"w-auto min-w-[96px] rounded-2xl bg-popover p-1 text-popover-foreground shadow-lg ring-1 ring-foreground/5 duration-100 dark:ring-foreground/10",
|
|
188
|
+
className,
|
|
189
|
+
)}
|
|
190
|
+
placement={placement}
|
|
191
|
+
crossOffset={crossOffset}
|
|
192
|
+
offset={offset}
|
|
193
|
+
{...props}
|
|
194
|
+
/>
|
|
195
|
+
);
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
function DropdownMenuSeparator({
|
|
199
|
+
className,
|
|
200
|
+
...props
|
|
201
|
+
}: React.ComponentProps<typeof SeparatorPrimitive>) {
|
|
202
|
+
return (
|
|
203
|
+
<SeparatorPrimitive
|
|
204
|
+
data-slot="dropdown-menu-separator"
|
|
205
|
+
className={cn("-mx-1 my-1 h-px bg-border/50", className)}
|
|
206
|
+
{...props}
|
|
207
|
+
/>
|
|
208
|
+
);
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
function DropdownMenuShortcut({ className, ...props }: React.ComponentProps<"span">) {
|
|
212
|
+
return (
|
|
213
|
+
<span
|
|
214
|
+
data-slot="dropdown-menu-shortcut"
|
|
215
|
+
className={cn(
|
|
216
|
+
"ml-auto text-xs tracking-widest text-muted-foreground group-focus/dropdown-menu-item:text-accent-foreground",
|
|
217
|
+
className,
|
|
218
|
+
)}
|
|
219
|
+
{...props}
|
|
220
|
+
/>
|
|
221
|
+
);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
export {
|
|
225
|
+
DropdownMenuTrigger,
|
|
226
|
+
DropdownMenu,
|
|
227
|
+
DropdownMenuGroup,
|
|
228
|
+
DropdownMenuLabel,
|
|
229
|
+
DropdownMenuItem,
|
|
230
|
+
DropdownMenuSeparator,
|
|
231
|
+
DropdownMenuShortcut,
|
|
232
|
+
DropdownMenuSub,
|
|
233
|
+
DropdownMenuSubTrigger,
|
|
234
|
+
DropdownMenuSubContent,
|
|
235
|
+
};
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { cva, type VariantProps } from "class-variance-authority";
|
|
3
|
+
import { Group, type GroupProps } from "react-aria-components";
|
|
4
|
+
|
|
5
|
+
import { cn } from "@/client/lib/utils";
|
|
6
|
+
import { Button } from "@/client/components/ui/button";
|
|
7
|
+
import { Input } from "@/client/components/ui/input";
|
|
8
|
+
import { Textarea } from "@/client/components/ui/textarea";
|
|
9
|
+
|
|
10
|
+
function InputGroup({ className, ...props }: GroupProps) {
|
|
11
|
+
return (
|
|
12
|
+
<Group
|
|
13
|
+
data-slot="input-group"
|
|
14
|
+
className={cn(
|
|
15
|
+
"group/input-group relative flex h-8 w-full min-w-0 items-center rounded-2xl border border-transparent bg-input/50 transition-[color,box-shadow] duration-200 outline-none in-data-[slot=combobox-content]:focus-within:border-inherit in-data-[slot=combobox-content]:focus-within:ring-0 has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-3 has-[[data-slot=input-group-control]:focus-visible]:ring-ring/30 has-[[data-slot][aria-invalid=true]]:border-destructive has-[[data-slot][aria-invalid=true]]:ring-3 has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>textarea]:h-auto dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40 has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:pr-1.5 has-[>[data-align=inline-start]]:[&>input]:pl-1.5",
|
|
16
|
+
className,
|
|
17
|
+
)}
|
|
18
|
+
{...props}
|
|
19
|
+
/>
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const inputGroupAddonVariants = cva(
|
|
24
|
+
"flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-sm font-medium text-muted-foreground select-none group-data-[disabled=true]/input-group:opacity-50 **:data-[slot=kbd]:rounded-2xl **:data-[slot=kbd]:bg-muted-foreground/10 **:data-[slot=kbd]:px-1.5 [&>svg:not([class*='size-'])]:size-4",
|
|
25
|
+
{
|
|
26
|
+
variants: {
|
|
27
|
+
align: {
|
|
28
|
+
"inline-start": "order-first pl-2 has-[>button]:ml-[-0.3rem] has-[>kbd]:ml-[-0.15rem]",
|
|
29
|
+
"inline-end": "order-last pr-2 has-[>button]:mr-[-0.3rem] has-[>kbd]:mr-[-0.15rem]",
|
|
30
|
+
"block-start":
|
|
31
|
+
"order-first w-full justify-start px-2.5 pt-2 group-has-[>input]/input-group:pt-2 [.border-b]:pb-2",
|
|
32
|
+
"block-end":
|
|
33
|
+
"order-last w-full justify-start px-2.5 pb-2 group-has-[>input]/input-group:pb-2 [.border-t]:pt-2",
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
defaultVariants: {
|
|
37
|
+
align: "inline-start",
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
function InputGroupAddon({
|
|
43
|
+
className,
|
|
44
|
+
align = "inline-start",
|
|
45
|
+
...props
|
|
46
|
+
}: React.ComponentProps<"div"> & VariantProps<typeof inputGroupAddonVariants>) {
|
|
47
|
+
return (
|
|
48
|
+
<div
|
|
49
|
+
role="group"
|
|
50
|
+
data-slot="input-group-addon"
|
|
51
|
+
data-align={align}
|
|
52
|
+
className={cn(inputGroupAddonVariants({ align }), className)}
|
|
53
|
+
onClick={(e) => {
|
|
54
|
+
if ((e.target as HTMLElement).closest("button")) {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
e.currentTarget.parentElement?.querySelector("input")?.focus();
|
|
58
|
+
}}
|
|
59
|
+
{...props}
|
|
60
|
+
/>
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const inputGroupButtonVariants = cva("flex items-center gap-2 rounded-2xl text-sm shadow-none", {
|
|
65
|
+
variants: {
|
|
66
|
+
size: {
|
|
67
|
+
xs: "h-6 gap-1 rounded-xl px-1.5 [&>svg:not([class*='size-'])]:size-3.5",
|
|
68
|
+
sm: "",
|
|
69
|
+
"icon-xs": "size-6 rounded-xl p-0 has-[>svg]:p-0",
|
|
70
|
+
"icon-sm": "size-8 p-0 has-[>svg]:p-0",
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
defaultVariants: {
|
|
74
|
+
size: "xs",
|
|
75
|
+
},
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
function InputGroupButton({
|
|
79
|
+
className,
|
|
80
|
+
type = "button",
|
|
81
|
+
variant = "ghost",
|
|
82
|
+
size = "xs",
|
|
83
|
+
...props
|
|
84
|
+
}: Omit<React.ComponentProps<typeof Button>, "size" | "type"> &
|
|
85
|
+
VariantProps<typeof inputGroupButtonVariants> & {
|
|
86
|
+
type?: "button" | "submit" | "reset";
|
|
87
|
+
}) {
|
|
88
|
+
return (
|
|
89
|
+
<Button
|
|
90
|
+
type={type}
|
|
91
|
+
data-size={size}
|
|
92
|
+
variant={variant}
|
|
93
|
+
className={cn(inputGroupButtonVariants({ size }), className)}
|
|
94
|
+
{...props}
|
|
95
|
+
/>
|
|
96
|
+
);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
function InputGroupText({ className, ...props }: React.ComponentProps<"span">) {
|
|
100
|
+
return (
|
|
101
|
+
<span
|
|
102
|
+
className={cn(
|
|
103
|
+
"flex items-center gap-2 text-sm text-muted-foreground [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4",
|
|
104
|
+
className,
|
|
105
|
+
)}
|
|
106
|
+
{...props}
|
|
107
|
+
/>
|
|
108
|
+
);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
function InputGroupInput({ className, ...props }: React.ComponentProps<"input">) {
|
|
112
|
+
return (
|
|
113
|
+
<Input
|
|
114
|
+
data-slot="input-group-control"
|
|
115
|
+
className={cn(
|
|
116
|
+
"flex-1 rounded-none border-0 bg-transparent shadow-none ring-0 focus-visible:ring-0 aria-invalid:ring-0 dark:bg-transparent",
|
|
117
|
+
className,
|
|
118
|
+
)}
|
|
119
|
+
{...props}
|
|
120
|
+
/>
|
|
121
|
+
);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
function InputGroupTextarea({ className, ...props }: React.ComponentProps<"textarea">) {
|
|
125
|
+
return (
|
|
126
|
+
<Textarea
|
|
127
|
+
data-slot="input-group-control"
|
|
128
|
+
className={cn(
|
|
129
|
+
"flex-1 resize-none rounded-none border-0 bg-transparent py-2 shadow-none ring-0 focus-visible:ring-0 aria-invalid:ring-0 dark:bg-transparent",
|
|
130
|
+
className,
|
|
131
|
+
)}
|
|
132
|
+
{...props}
|
|
133
|
+
/>
|
|
134
|
+
);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
export {
|
|
138
|
+
InputGroup,
|
|
139
|
+
InputGroupAddon,
|
|
140
|
+
InputGroupButton,
|
|
141
|
+
InputGroupText,
|
|
142
|
+
InputGroupInput,
|
|
143
|
+
InputGroupTextarea,
|
|
144
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { composeRenderProps, Input as InputPrimitive } from "react-aria-components";
|
|
3
|
+
|
|
4
|
+
import { cn } from "@/client/lib/utils";
|
|
5
|
+
|
|
6
|
+
function Input({ className, type, ...props }: React.ComponentProps<typeof InputPrimitive>) {
|
|
7
|
+
return (
|
|
8
|
+
<InputPrimitive
|
|
9
|
+
type={type}
|
|
10
|
+
data-slot="input"
|
|
11
|
+
className={composeRenderProps(className, (className) =>
|
|
12
|
+
cn(
|
|
13
|
+
"h-8 w-full min-w-0 rounded-2xl border border-transparent bg-input/50 px-2.5 py-1 text-base transition-[color,box-shadow] duration-200 outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/30 disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",
|
|
14
|
+
className,
|
|
15
|
+
),
|
|
16
|
+
)}
|
|
17
|
+
{...props}
|
|
18
|
+
/>
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export { Input };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { LabelContext, Label as LabelPrimitive, type LabelProps } from "react-aria-components";
|
|
5
|
+
|
|
6
|
+
import { cn } from "@/client/lib/utils";
|
|
7
|
+
|
|
8
|
+
function Label({ className, htmlFor, slot, ...props }: LabelProps) {
|
|
9
|
+
const label = (
|
|
10
|
+
<LabelPrimitive
|
|
11
|
+
data-slot="label"
|
|
12
|
+
className={cn(
|
|
13
|
+
"flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50 peer-data-disabled:opacity-50",
|
|
14
|
+
className,
|
|
15
|
+
)}
|
|
16
|
+
{...props}
|
|
17
|
+
htmlFor={htmlFor}
|
|
18
|
+
slot={slot}
|
|
19
|
+
/>
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
if (htmlFor && slot === undefined) {
|
|
23
|
+
return <LabelContext.Provider value={null}>{label}</LabelContext.Provider>;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return label;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export { Label };
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import {
|
|
3
|
+
DialogTrigger,
|
|
4
|
+
Heading,
|
|
5
|
+
Popover as PopoverPrimitive,
|
|
6
|
+
type DialogTriggerProps,
|
|
7
|
+
type PopoverProps as PopoverPrimitiveProps,
|
|
8
|
+
} from "react-aria-components";
|
|
9
|
+
|
|
10
|
+
import { cn } from "@/client/lib/utils";
|
|
11
|
+
|
|
12
|
+
function PopoverTrigger({ children, ...props }: DialogTriggerProps) {
|
|
13
|
+
return (
|
|
14
|
+
<DialogTrigger data-slot="popover-trigger" {...props}>
|
|
15
|
+
{children}
|
|
16
|
+
</DialogTrigger>
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function Popover({
|
|
21
|
+
className,
|
|
22
|
+
placement = "bottom",
|
|
23
|
+
offset = 4,
|
|
24
|
+
crossOffset = 0,
|
|
25
|
+
...props
|
|
26
|
+
}: Omit<PopoverPrimitiveProps, "className"> & {
|
|
27
|
+
className?: string;
|
|
28
|
+
}) {
|
|
29
|
+
return (
|
|
30
|
+
<PopoverPrimitive
|
|
31
|
+
data-slot="popover-content"
|
|
32
|
+
placement={placement}
|
|
33
|
+
offset={offset}
|
|
34
|
+
crossOffset={crossOffset}
|
|
35
|
+
className={cn(
|
|
36
|
+
"z-50 flex w-72 origin-(--trigger-anchor-point) flex-col gap-4 rounded-3xl bg-popover p-4 text-sm text-popover-foreground shadow-lg ring-1 ring-foreground/5 outline-hidden duration-100 data-entering:animate-in data-entering:fade-in-0 data-entering:zoom-in-95 data-exiting:animate-out data-exiting:fade-out-0 data-exiting:zoom-out-95 data-[placement=bottom]:slide-in-from-top-2 data-[placement=left]:slide-in-from-right-2 data-[placement=right]:slide-in-from-left-2 data-[placement=top]:slide-in-from-bottom-2 dark:ring-foreground/10",
|
|
37
|
+
className,
|
|
38
|
+
)}
|
|
39
|
+
{...props}
|
|
40
|
+
/>
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function PopoverHeader({ className, ...props }: React.ComponentProps<"div">) {
|
|
45
|
+
return (
|
|
46
|
+
<div
|
|
47
|
+
data-slot="popover-header"
|
|
48
|
+
className={cn("flex flex-col gap-1 text-sm", className)}
|
|
49
|
+
{...props}
|
|
50
|
+
/>
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function PopoverTitle({ className, ...props }: React.ComponentProps<typeof Heading>) {
|
|
55
|
+
return (
|
|
56
|
+
<Heading
|
|
57
|
+
data-slot="popover-title"
|
|
58
|
+
className={cn("text-base font-medium", className)}
|
|
59
|
+
{...props}
|
|
60
|
+
/>
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function PopoverDescription({ className, ...props }: React.ComponentProps<"div">) {
|
|
65
|
+
return (
|
|
66
|
+
<div
|
|
67
|
+
data-slot="popover-description"
|
|
68
|
+
className={cn("text-muted-foreground", className)}
|
|
69
|
+
{...props}
|
|
70
|
+
/>
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export { Popover, PopoverDescription, PopoverHeader, PopoverTitle, PopoverTrigger };
|