create-warlock 5.34.2 → 5.35.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/CHANGELOG.md +38 -0
- package/README.md +8 -0
- package/esm/commands/create-new-app/index.mjs +4 -3
- package/esm/commands/create-new-app/index.mjs.map +1 -1
- package/esm/commands/create-warlock-app/index.mjs +7 -1
- package/esm/commands/create-warlock-app/index.mjs.map +1 -1
- package/esm/features/features-map.mjs +8 -2
- package/esm/features/features-map.mjs.map +1 -1
- package/esm/helpers/app.mjs +1 -0
- package/esm/helpers/app.mjs.map +1 -1
- package/esm/prompts/ask-stack.mjs +1 -1
- package/esm/prompts/ask-stack.mjs.map +1 -1
- package/llms-full.txt +64 -28
- package/llms.txt +1 -1
- package/package.json +2 -2
- package/skills/{create-a-warlock-project/SKILL.md → SKILL.md} +63 -27
- package/templates/design-system/SOURCES.md +23 -0
- package/templates/design-system/package.json +14 -0
- package/templates/design-system/src/web/components/ui/LICENSE.md +21 -0
- package/templates/design-system/src/web/components/ui/button.tsx +61 -0
- package/templates/design-system/src/web/components/ui/calendar.tsx +178 -0
- package/templates/design-system/src/web/components/ui/checkbox.tsx +28 -0
- package/templates/design-system/src/web/components/ui/command.tsx +161 -0
- package/templates/design-system/src/web/components/ui/dialog.tsx +144 -0
- package/templates/design-system/src/web/components/ui/input.tsx +20 -0
- package/templates/design-system/src/web/components/ui/label.tsx +20 -0
- package/templates/design-system/src/web/components/ui/popover.tsx +73 -0
- package/templates/design-system/src/web/components/ui/radio-group.tsx +44 -0
- package/templates/design-system/src/web/components/ui/switch.tsx +34 -0
- package/templates/design-system/src/web/components/ui/textarea.tsx +17 -0
- package/templates/design-system/src/web/design-system/components/checkbox-input.tsx +19 -0
- package/templates/design-system/src/web/design-system/components/date-picker-input.tsx +59 -0
- package/templates/design-system/src/web/design-system/components/date-time-picker-input.tsx +67 -0
- package/templates/design-system/src/web/design-system/components/email-input.tsx +22 -0
- package/templates/design-system/src/web/design-system/components/field-frame.tsx +36 -0
- package/templates/design-system/src/web/design-system/components/file-input.tsx +24 -0
- package/templates/design-system/src/web/design-system/components/multi-select-input.tsx +94 -0
- package/templates/design-system/src/web/design-system/components/password-input.tsx +22 -0
- package/templates/design-system/src/web/design-system/components/radio-input.tsx +41 -0
- package/templates/design-system/src/web/design-system/components/select-input.tsx +94 -0
- package/templates/design-system/src/web/design-system/components/submit-button.tsx +20 -0
- package/templates/design-system/src/web/design-system/components/switch-input.tsx +19 -0
- package/templates/design-system/src/web/design-system/components/text-input.tsx +22 -0
- package/templates/design-system/src/web/design-system/components/textarea-input.tsx +22 -0
- package/templates/design-system/src/web/design-system/components/time-picker-input.tsx +22 -0
- package/templates/design-system/src/web/design-system/hooks/use-calendar-day-button.ts +9 -0
- package/templates/design-system/src/web/design-system/hooks/use-control.ts +29 -0
- package/templates/design-system/src/web/design-system/hooks/use-date-control.ts +42 -0
- package/templates/design-system/src/web/design-system/hooks/use-file-control.ts +24 -0
- package/templates/design-system/src/web/design-system/hooks/use-select-control.ts +78 -0
- package/templates/design-system/src/web/design-system/hooks/use-submit-control.ts +13 -0
- package/templates/design-system/src/web/design-system/types/control-props.ts +46 -0
- package/templates/toolchains/oxc/.oxlintrc.json +3 -1
- package/templates/warlock/.oxlintrc.json +3 -1
- package/templates/warlock/AGENTS.md +10 -10
- package/templates/warlock/e2e/home.e2e.ts +19 -0
- package/templates/warlock/package.json +1 -1
- package/templates/warlock/skills/api-design/SKILL.md +180 -57
- package/templates/warlock/skills/code-standards/SKILL.md +48 -39
- package/templates/warlock/skills/data-and-persistence/SKILL.md +72 -57
- package/templates/warlock/skills/git-workflow/SKILL.md +9 -9
- package/templates/warlock/skills/module-boundaries/SKILL.md +2 -2
- package/templates/warlock/skills/observability-and-resilience/SKILL.md +8 -6
- package/templates/warlock/skills/security-baseline/SKILL.md +23 -22
- package/templates/warlock/skills/testing-strategy/SKILL.md +53 -12
- package/templates/warlock/skills/web-code-standards/SKILL.md +195 -60
- package/templates/warlock/src/app/auth/controllers/forgot-password.controller.ts +6 -0
- package/templates/warlock/src/app/auth/controllers/login.controller.ts +17 -0
- package/templates/warlock/src/app/auth/controllers/logout-all.controller.ts +6 -0
- package/templates/warlock/src/app/auth/controllers/logout.controller.ts +6 -0
- package/templates/warlock/src/app/auth/controllers/me.controller.ts +7 -0
- package/templates/warlock/src/app/auth/controllers/refresh-token.controller.ts +12 -0
- package/templates/warlock/src/app/auth/controllers/reset-password.controller.ts +6 -0
- package/templates/warlock/src/app/auth/models/otp/otp.model.ts +9 -3
- package/templates/warlock/src/app/auth/services/otp.service.ts +18 -6
- package/templates/warlock/src/app/contact/controllers/contact.controller.ts +6 -0
- package/templates/warlock/src/app/home/controllers/home-page.controller.ts +4 -0
- package/templates/warlock/src/app/locale/controllers/locale.controller.ts +6 -0
- package/templates/warlock/src/app/posts/controllers/create-new-post.controller.ts +7 -0
- package/templates/warlock/src/app/posts/controllers/update-post.controller.ts +15 -9
- package/templates/warlock/src/app/posts/models/post/migrations/09-01-2026_02-07-51-post.migration.ts +1 -0
- package/templates/warlock/src/app/posts/models/post/post.model.ts +6 -0
- package/templates/warlock/src/app/posts/resources/post.resource.ts +1 -1
- package/templates/warlock/src/app/posts/schema/update-post.schema.ts +1 -0
- package/templates/warlock/src/app/shared/utils/format-http-error-response.ts +53 -0
- package/templates/warlock/src/app/users/commands/hello-world.command.ts +2 -1
- package/templates/warlock/src/app/users/controllers/create-new-user.controller.ts +13 -1
- package/templates/warlock/src/app/users/controllers/list-users.controller.ts +24 -1
- package/templates/warlock/src/app/users/models/user/migrations/11-12-2025_23-58-03-user.migration.ts +1 -0
- package/templates/warlock/src/app/users/models/user/user.model.ts +5 -0
- package/templates/warlock/src/app/users/repositories/users.repository.ts +2 -2
- package/templates/warlock/src/app/users/resources/user.resource.ts +1 -1
- package/templates/warlock/src/app/users/schema/list-users.schema.ts +1 -1
- package/templates/warlock/src/config/http.ts +6 -0
- package/templates/warlock/src/web/home/components/contact-field.tsx +18 -0
- package/templates/warlock/src/web/home/components/contact-section.tsx +5 -29
- package/templates/warlock/src/web/home/components/contact-submit-button.tsx +16 -0
- package/templates/warlock/src/web/home/hooks/use-contact-field.ts +9 -0
- package/templates/warlock/src/web/home/hooks/use-contact-form.ts +5 -8
- package/templates/warlock/src/web/home/hooks/use-contact-locale.ts +34 -0
- package/templates/warlock/src/web/home/hooks/use-contact-submit-button.ts +6 -0
- package/templates/warlock/src/web/home/index.page.tsx +1 -1
- package/templates/warlock/src/web/home/types/contact-controls.type.ts +13 -0
- package/templates/warlock/src/web/shared/utils/set-form-errors.ts +3 -1
- package/templates/warlock/warlock.config.ts +1 -0
- package/templates/warlock/src/web/home/components/contact-form-controls.tsx +0 -42
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { Command as CommandPrimitive } from "cmdk";
|
|
5
|
+
import { cn } from "cn";
|
|
6
|
+
import { SearchIcon } from "lucide-react";
|
|
7
|
+
|
|
8
|
+
import {
|
|
9
|
+
Dialog,
|
|
10
|
+
DialogContent,
|
|
11
|
+
DialogDescription,
|
|
12
|
+
DialogHeader,
|
|
13
|
+
DialogTitle,
|
|
14
|
+
} from "web/components/ui/dialog";
|
|
15
|
+
|
|
16
|
+
function Command({ className, ...props }: React.ComponentProps<typeof CommandPrimitive>) {
|
|
17
|
+
return (
|
|
18
|
+
<CommandPrimitive
|
|
19
|
+
data-slot="command"
|
|
20
|
+
className={cn(
|
|
21
|
+
"flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",
|
|
22
|
+
className,
|
|
23
|
+
)}
|
|
24
|
+
{...props}
|
|
25
|
+
/>
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function CommandDialog({
|
|
30
|
+
title = "Command Palette",
|
|
31
|
+
description = "Search for a command to run...",
|
|
32
|
+
children,
|
|
33
|
+
className,
|
|
34
|
+
showCloseButton = true,
|
|
35
|
+
...props
|
|
36
|
+
}: React.ComponentProps<typeof Dialog> & {
|
|
37
|
+
title?: string;
|
|
38
|
+
description?: string;
|
|
39
|
+
className?: string;
|
|
40
|
+
showCloseButton?: boolean;
|
|
41
|
+
}) {
|
|
42
|
+
return (
|
|
43
|
+
<Dialog {...props}>
|
|
44
|
+
<DialogHeader className="sr-only">
|
|
45
|
+
<DialogTitle>{title}</DialogTitle>
|
|
46
|
+
<DialogDescription>{description}</DialogDescription>
|
|
47
|
+
</DialogHeader>
|
|
48
|
+
<DialogContent
|
|
49
|
+
className={cn("overflow-hidden p-0", className)}
|
|
50
|
+
showCloseButton={showCloseButton}
|
|
51
|
+
>
|
|
52
|
+
<Command className="**:data-[slot=command-input-wrapper]:h-12 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]]:px-2 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5">
|
|
53
|
+
{children}
|
|
54
|
+
</Command>
|
|
55
|
+
</DialogContent>
|
|
56
|
+
</Dialog>
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function CommandInput({
|
|
61
|
+
className,
|
|
62
|
+
...props
|
|
63
|
+
}: React.ComponentProps<typeof CommandPrimitive.Input>) {
|
|
64
|
+
return (
|
|
65
|
+
<div data-slot="command-input-wrapper" className="flex h-9 items-center gap-2 border-b px-3">
|
|
66
|
+
<SearchIcon className="size-4 shrink-0 opacity-50" />
|
|
67
|
+
<CommandPrimitive.Input
|
|
68
|
+
data-slot="command-input"
|
|
69
|
+
className={cn(
|
|
70
|
+
"flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",
|
|
71
|
+
className,
|
|
72
|
+
)}
|
|
73
|
+
{...props}
|
|
74
|
+
/>
|
|
75
|
+
</div>
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function CommandList({ className, ...props }: React.ComponentProps<typeof CommandPrimitive.List>) {
|
|
80
|
+
return (
|
|
81
|
+
<CommandPrimitive.List
|
|
82
|
+
data-slot="command-list"
|
|
83
|
+
className={cn("max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto", className)}
|
|
84
|
+
{...props}
|
|
85
|
+
/>
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
function CommandEmpty({ ...props }: React.ComponentProps<typeof CommandPrimitive.Empty>) {
|
|
90
|
+
return (
|
|
91
|
+
<CommandPrimitive.Empty
|
|
92
|
+
data-slot="command-empty"
|
|
93
|
+
className="py-6 text-center text-sm"
|
|
94
|
+
{...props}
|
|
95
|
+
/>
|
|
96
|
+
);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
function CommandGroup({
|
|
100
|
+
className,
|
|
101
|
+
...props
|
|
102
|
+
}: React.ComponentProps<typeof CommandPrimitive.Group>) {
|
|
103
|
+
return (
|
|
104
|
+
<CommandPrimitive.Group
|
|
105
|
+
data-slot="command-group"
|
|
106
|
+
className={cn(
|
|
107
|
+
"overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",
|
|
108
|
+
className,
|
|
109
|
+
)}
|
|
110
|
+
{...props}
|
|
111
|
+
/>
|
|
112
|
+
);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
function CommandSeparator({
|
|
116
|
+
className,
|
|
117
|
+
...props
|
|
118
|
+
}: React.ComponentProps<typeof CommandPrimitive.Separator>) {
|
|
119
|
+
return (
|
|
120
|
+
<CommandPrimitive.Separator
|
|
121
|
+
data-slot="command-separator"
|
|
122
|
+
className={cn("-mx-1 h-px bg-border", className)}
|
|
123
|
+
{...props}
|
|
124
|
+
/>
|
|
125
|
+
);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
function CommandItem({ className, ...props }: React.ComponentProps<typeof CommandPrimitive.Item>) {
|
|
129
|
+
return (
|
|
130
|
+
<CommandPrimitive.Item
|
|
131
|
+
data-slot="command-item"
|
|
132
|
+
className={cn(
|
|
133
|
+
"relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground",
|
|
134
|
+
className,
|
|
135
|
+
)}
|
|
136
|
+
{...props}
|
|
137
|
+
/>
|
|
138
|
+
);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
function CommandShortcut({ className, ...props }: React.ComponentProps<"span">) {
|
|
142
|
+
return (
|
|
143
|
+
<span
|
|
144
|
+
data-slot="command-shortcut"
|
|
145
|
+
className={cn("ml-auto text-xs tracking-widest text-muted-foreground", className)}
|
|
146
|
+
{...props}
|
|
147
|
+
/>
|
|
148
|
+
);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
export {
|
|
152
|
+
Command,
|
|
153
|
+
CommandDialog,
|
|
154
|
+
CommandInput,
|
|
155
|
+
CommandList,
|
|
156
|
+
CommandEmpty,
|
|
157
|
+
CommandGroup,
|
|
158
|
+
CommandItem,
|
|
159
|
+
CommandShortcut,
|
|
160
|
+
CommandSeparator,
|
|
161
|
+
};
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { cn } from "cn";
|
|
5
|
+
import { XIcon } from "lucide-react";
|
|
6
|
+
import { Dialog as DialogPrimitive } from "radix-ui";
|
|
7
|
+
|
|
8
|
+
import { Button } from "web/components/ui/button";
|
|
9
|
+
|
|
10
|
+
function Dialog({ ...props }: React.ComponentProps<typeof DialogPrimitive.Root>) {
|
|
11
|
+
return <DialogPrimitive.Root data-slot="dialog" {...props} />;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
function DialogTrigger({ ...props }: React.ComponentProps<typeof DialogPrimitive.Trigger>) {
|
|
15
|
+
return <DialogPrimitive.Trigger data-slot="dialog-trigger" {...props} />;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function DialogPortal({ ...props }: React.ComponentProps<typeof DialogPrimitive.Portal>) {
|
|
19
|
+
return <DialogPrimitive.Portal data-slot="dialog-portal" {...props} />;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function DialogClose({ ...props }: React.ComponentProps<typeof DialogPrimitive.Close>) {
|
|
23
|
+
return <DialogPrimitive.Close data-slot="dialog-close" {...props} />;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function DialogOverlay({
|
|
27
|
+
className,
|
|
28
|
+
...props
|
|
29
|
+
}: React.ComponentProps<typeof DialogPrimitive.Overlay>) {
|
|
30
|
+
return (
|
|
31
|
+
<DialogPrimitive.Overlay
|
|
32
|
+
data-slot="dialog-overlay"
|
|
33
|
+
className={cn(
|
|
34
|
+
"fixed inset-0 z-50 bg-black/50 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0",
|
|
35
|
+
className,
|
|
36
|
+
)}
|
|
37
|
+
{...props}
|
|
38
|
+
/>
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function DialogContent({
|
|
43
|
+
className,
|
|
44
|
+
children,
|
|
45
|
+
showCloseButton = true,
|
|
46
|
+
...props
|
|
47
|
+
}: React.ComponentProps<typeof DialogPrimitive.Content> & {
|
|
48
|
+
showCloseButton?: boolean;
|
|
49
|
+
}) {
|
|
50
|
+
return (
|
|
51
|
+
<DialogPortal data-slot="dialog-portal">
|
|
52
|
+
<DialogOverlay />
|
|
53
|
+
<DialogPrimitive.Content
|
|
54
|
+
data-slot="dialog-content"
|
|
55
|
+
className={cn(
|
|
56
|
+
"fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border bg-background p-6 shadow-lg duration-200 outline-none data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 sm:max-w-lg",
|
|
57
|
+
className,
|
|
58
|
+
)}
|
|
59
|
+
{...props}
|
|
60
|
+
>
|
|
61
|
+
{children}
|
|
62
|
+
{showCloseButton && (
|
|
63
|
+
<DialogPrimitive.Close
|
|
64
|
+
data-slot="dialog-close"
|
|
65
|
+
className="absolute top-4 right-4 rounded-xs opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4"
|
|
66
|
+
>
|
|
67
|
+
<XIcon />
|
|
68
|
+
<span className="sr-only">Close</span>
|
|
69
|
+
</DialogPrimitive.Close>
|
|
70
|
+
)}
|
|
71
|
+
</DialogPrimitive.Content>
|
|
72
|
+
</DialogPortal>
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function DialogHeader({ className, ...props }: React.ComponentProps<"div">) {
|
|
77
|
+
return (
|
|
78
|
+
<div
|
|
79
|
+
data-slot="dialog-header"
|
|
80
|
+
className={cn("flex flex-col gap-2 text-center sm:text-left", className)}
|
|
81
|
+
{...props}
|
|
82
|
+
/>
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
function DialogFooter({
|
|
87
|
+
className,
|
|
88
|
+
showCloseButton = false,
|
|
89
|
+
children,
|
|
90
|
+
...props
|
|
91
|
+
}: React.ComponentProps<"div"> & {
|
|
92
|
+
showCloseButton?: boolean;
|
|
93
|
+
}) {
|
|
94
|
+
return (
|
|
95
|
+
<div
|
|
96
|
+
data-slot="dialog-footer"
|
|
97
|
+
className={cn("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end", className)}
|
|
98
|
+
{...props}
|
|
99
|
+
>
|
|
100
|
+
{children}
|
|
101
|
+
{showCloseButton && (
|
|
102
|
+
<DialogPrimitive.Close asChild>
|
|
103
|
+
<Button variant="outline">Close</Button>
|
|
104
|
+
</DialogPrimitive.Close>
|
|
105
|
+
)}
|
|
106
|
+
</div>
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
function DialogTitle({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Title>) {
|
|
111
|
+
return (
|
|
112
|
+
<DialogPrimitive.Title
|
|
113
|
+
data-slot="dialog-title"
|
|
114
|
+
className={cn("text-lg leading-none font-semibold", className)}
|
|
115
|
+
{...props}
|
|
116
|
+
/>
|
|
117
|
+
);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
function DialogDescription({
|
|
121
|
+
className,
|
|
122
|
+
...props
|
|
123
|
+
}: React.ComponentProps<typeof DialogPrimitive.Description>) {
|
|
124
|
+
return (
|
|
125
|
+
<DialogPrimitive.Description
|
|
126
|
+
data-slot="dialog-description"
|
|
127
|
+
className={cn("text-sm text-muted-foreground", className)}
|
|
128
|
+
{...props}
|
|
129
|
+
/>
|
|
130
|
+
);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
export {
|
|
134
|
+
Dialog,
|
|
135
|
+
DialogClose,
|
|
136
|
+
DialogContent,
|
|
137
|
+
DialogDescription,
|
|
138
|
+
DialogFooter,
|
|
139
|
+
DialogHeader,
|
|
140
|
+
DialogOverlay,
|
|
141
|
+
DialogPortal,
|
|
142
|
+
DialogTitle,
|
|
143
|
+
DialogTrigger,
|
|
144
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { cn } from "cn";
|
|
3
|
+
|
|
4
|
+
function Input({ className, type, ...props }: React.ComponentProps<"input">) {
|
|
5
|
+
return (
|
|
6
|
+
<input
|
|
7
|
+
type={type}
|
|
8
|
+
data-slot="input"
|
|
9
|
+
className={cn(
|
|
10
|
+
"h-9 w-full min-w-0 rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none selection:bg-primary selection:text-primary-foreground file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm dark:bg-input/30",
|
|
11
|
+
"focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50",
|
|
12
|
+
"aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40",
|
|
13
|
+
className,
|
|
14
|
+
)}
|
|
15
|
+
{...props}
|
|
16
|
+
/>
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export { Input };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { cn } from "cn";
|
|
5
|
+
import { Label as LabelPrimitive } from "radix-ui";
|
|
6
|
+
|
|
7
|
+
function Label({ className, ...props }: React.ComponentProps<typeof LabelPrimitive.Root>) {
|
|
8
|
+
return (
|
|
9
|
+
<LabelPrimitive.Root
|
|
10
|
+
data-slot="label"
|
|
11
|
+
className={cn(
|
|
12
|
+
"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",
|
|
13
|
+
className,
|
|
14
|
+
)}
|
|
15
|
+
{...props}
|
|
16
|
+
/>
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export { Label };
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { cn } from "cn";
|
|
5
|
+
import { Popover as PopoverPrimitive } from "radix-ui";
|
|
6
|
+
|
|
7
|
+
function Popover({ ...props }: React.ComponentProps<typeof PopoverPrimitive.Root>) {
|
|
8
|
+
return <PopoverPrimitive.Root data-slot="popover" {...props} />;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function PopoverTrigger({ ...props }: React.ComponentProps<typeof PopoverPrimitive.Trigger>) {
|
|
12
|
+
return <PopoverPrimitive.Trigger data-slot="popover-trigger" {...props} />;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function PopoverContent({
|
|
16
|
+
className,
|
|
17
|
+
align = "center",
|
|
18
|
+
sideOffset = 4,
|
|
19
|
+
...props
|
|
20
|
+
}: React.ComponentProps<typeof PopoverPrimitive.Content>) {
|
|
21
|
+
return (
|
|
22
|
+
<PopoverPrimitive.Portal>
|
|
23
|
+
<PopoverPrimitive.Content
|
|
24
|
+
data-slot="popover-content"
|
|
25
|
+
align={align}
|
|
26
|
+
sideOffset={sideOffset}
|
|
27
|
+
className={cn(
|
|
28
|
+
"z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-hidden 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 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95",
|
|
29
|
+
className,
|
|
30
|
+
)}
|
|
31
|
+
{...props}
|
|
32
|
+
/>
|
|
33
|
+
</PopoverPrimitive.Portal>
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function PopoverAnchor({ ...props }: React.ComponentProps<typeof PopoverPrimitive.Anchor>) {
|
|
38
|
+
return <PopoverPrimitive.Anchor data-slot="popover-anchor" {...props} />;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function PopoverHeader({ className, ...props }: React.ComponentProps<"div">) {
|
|
42
|
+
return (
|
|
43
|
+
<div
|
|
44
|
+
data-slot="popover-header"
|
|
45
|
+
className={cn("flex flex-col gap-1 text-sm", className)}
|
|
46
|
+
{...props}
|
|
47
|
+
/>
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function PopoverTitle({ className, ...props }: React.ComponentProps<"h2">) {
|
|
52
|
+
return <div data-slot="popover-title" className={cn("font-medium", className)} {...props} />;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function PopoverDescription({ className, ...props }: React.ComponentProps<"p">) {
|
|
56
|
+
return (
|
|
57
|
+
<p
|
|
58
|
+
data-slot="popover-description"
|
|
59
|
+
className={cn("text-muted-foreground", className)}
|
|
60
|
+
{...props}
|
|
61
|
+
/>
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export {
|
|
66
|
+
Popover,
|
|
67
|
+
PopoverTrigger,
|
|
68
|
+
PopoverContent,
|
|
69
|
+
PopoverAnchor,
|
|
70
|
+
PopoverHeader,
|
|
71
|
+
PopoverTitle,
|
|
72
|
+
PopoverDescription,
|
|
73
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { cn } from "cn";
|
|
5
|
+
import { CircleIcon } from "lucide-react";
|
|
6
|
+
import { RadioGroup as RadioGroupPrimitive } from "radix-ui";
|
|
7
|
+
|
|
8
|
+
function RadioGroup({
|
|
9
|
+
className,
|
|
10
|
+
...props
|
|
11
|
+
}: React.ComponentProps<typeof RadioGroupPrimitive.Root>) {
|
|
12
|
+
return (
|
|
13
|
+
<RadioGroupPrimitive.Root
|
|
14
|
+
data-slot="radio-group"
|
|
15
|
+
className={cn("grid gap-3", className)}
|
|
16
|
+
{...props}
|
|
17
|
+
/>
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function RadioGroupItem({
|
|
22
|
+
className,
|
|
23
|
+
...props
|
|
24
|
+
}: React.ComponentProps<typeof RadioGroupPrimitive.Item>) {
|
|
25
|
+
return (
|
|
26
|
+
<RadioGroupPrimitive.Item
|
|
27
|
+
data-slot="radio-group-item"
|
|
28
|
+
className={cn(
|
|
29
|
+
"aspect-square size-4 shrink-0 rounded-full border border-input text-primary shadow-xs transition-[color,box-shadow] outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:bg-input/30 dark:aria-invalid:ring-destructive/40",
|
|
30
|
+
className,
|
|
31
|
+
)}
|
|
32
|
+
{...props}
|
|
33
|
+
>
|
|
34
|
+
<RadioGroupPrimitive.Indicator
|
|
35
|
+
data-slot="radio-group-indicator"
|
|
36
|
+
className="relative flex items-center justify-center"
|
|
37
|
+
>
|
|
38
|
+
<CircleIcon className="absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2 fill-primary" />
|
|
39
|
+
</RadioGroupPrimitive.Indicator>
|
|
40
|
+
</RadioGroupPrimitive.Item>
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export { RadioGroup, RadioGroupItem };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { cn } from "cn";
|
|
5
|
+
import { Switch as SwitchPrimitive } from "radix-ui";
|
|
6
|
+
|
|
7
|
+
function Switch({
|
|
8
|
+
className,
|
|
9
|
+
size = "default",
|
|
10
|
+
...props
|
|
11
|
+
}: React.ComponentProps<typeof SwitchPrimitive.Root> & {
|
|
12
|
+
size?: "sm" | "default";
|
|
13
|
+
}) {
|
|
14
|
+
return (
|
|
15
|
+
<SwitchPrimitive.Root
|
|
16
|
+
data-slot="switch"
|
|
17
|
+
data-size={size}
|
|
18
|
+
className={cn(
|
|
19
|
+
"peer group/switch inline-flex shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-[1.15rem] data-[size=default]:w-8 data-[size=sm]:h-3.5 data-[size=sm]:w-6 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input dark:data-[state=unchecked]:bg-input/80",
|
|
20
|
+
className,
|
|
21
|
+
)}
|
|
22
|
+
{...props}
|
|
23
|
+
>
|
|
24
|
+
<SwitchPrimitive.Thumb
|
|
25
|
+
data-slot="switch-thumb"
|
|
26
|
+
className={cn(
|
|
27
|
+
"pointer-events-none block rounded-full bg-background ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0 dark:data-[state=checked]:bg-primary-foreground dark:data-[state=unchecked]:bg-foreground",
|
|
28
|
+
)}
|
|
29
|
+
/>
|
|
30
|
+
</SwitchPrimitive.Root>
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export { Switch };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { cn } from "cn";
|
|
3
|
+
|
|
4
|
+
function Textarea({ className, ...props }: React.ComponentProps<"textarea">) {
|
|
5
|
+
return (
|
|
6
|
+
<textarea
|
|
7
|
+
data-slot="textarea"
|
|
8
|
+
className={cn(
|
|
9
|
+
"flex field-sizing-content min-h-16 w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:aria-invalid:ring-destructive/40",
|
|
10
|
+
className,
|
|
11
|
+
)}
|
|
12
|
+
{...props}
|
|
13
|
+
/>
|
|
14
|
+
);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export { Textarea };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Checkbox } from "web/components/ui/checkbox";
|
|
2
|
+
import { useControl } from "../hooks/use-control";
|
|
3
|
+
import type { CheckProps } from "../types/control-props";
|
|
4
|
+
import FieldFrame from "./field-frame";
|
|
5
|
+
|
|
6
|
+
export default function CheckboxInput(props: CheckProps) {
|
|
7
|
+
const field = useControl(props, "checkbox");
|
|
8
|
+
return (
|
|
9
|
+
<FieldFrame {...props} error={field.error}>
|
|
10
|
+
<Checkbox
|
|
11
|
+
{...field.binding}
|
|
12
|
+
disabled={field.disabled || props.readOnly}
|
|
13
|
+
checked={Boolean(field.checked)}
|
|
14
|
+
onCheckedChange={(checked) => field.setChecked(checked === true)}
|
|
15
|
+
aria-labelledby={`${props.id}-label`}
|
|
16
|
+
/>
|
|
17
|
+
</FieldFrame>
|
|
18
|
+
);
|
|
19
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { Button } from "web/components/ui/button";
|
|
2
|
+
import { Calendar } from "web/components/ui/calendar";
|
|
3
|
+
|
|
4
|
+
import { Popover, PopoverContent, PopoverTrigger } from "web/components/ui/popover";
|
|
5
|
+
import { useDateControl } from "../hooks/use-date-control";
|
|
6
|
+
import type { DateProps } from "../types/control-props";
|
|
7
|
+
import FieldFrame from "./field-frame";
|
|
8
|
+
|
|
9
|
+
export default function DatePickerInput(props: DateProps) {
|
|
10
|
+
const field = useDateControl(props, false);
|
|
11
|
+
return (
|
|
12
|
+
<FieldFrame {...props} error={field.error}>
|
|
13
|
+
<Popover modal open={field.open} onOpenChange={field.setOpen}>
|
|
14
|
+
<PopoverTrigger asChild>
|
|
15
|
+
<Button
|
|
16
|
+
{...field.binding}
|
|
17
|
+
type="button"
|
|
18
|
+
variant="outline"
|
|
19
|
+
disabled={field.disabled || props.readOnly}
|
|
20
|
+
aria-haspopup="dialog"
|
|
21
|
+
aria-controls={`${props.id}-dialog`}
|
|
22
|
+
aria-labelledby={`${props.id}-label ${props.id}-value`}
|
|
23
|
+
>
|
|
24
|
+
<span id={`${props.id}-value`}>
|
|
25
|
+
{field.value || props.placeholder || "Choose date"}
|
|
26
|
+
</span>
|
|
27
|
+
</Button>
|
|
28
|
+
</PopoverTrigger>
|
|
29
|
+
<PopoverContent
|
|
30
|
+
id={`${props.id}-dialog`}
|
|
31
|
+
aria-modal="true"
|
|
32
|
+
dir={props.dir}
|
|
33
|
+
align="start"
|
|
34
|
+
aria-labelledby={`${props.id}-label`}
|
|
35
|
+
onCloseAutoFocus={field.onBlur}
|
|
36
|
+
>
|
|
37
|
+
<Calendar
|
|
38
|
+
id={`${props.id}-calendar`}
|
|
39
|
+
mode="single"
|
|
40
|
+
autoFocus
|
|
41
|
+
dir={props.dir}
|
|
42
|
+
selected={field.selected}
|
|
43
|
+
defaultMonth={field.selected}
|
|
44
|
+
onSelect={field.select}
|
|
45
|
+
/>
|
|
46
|
+
|
|
47
|
+
<div className="flex gap-2">
|
|
48
|
+
<Button type="button" variant="ghost" onClick={field.clear}>
|
|
49
|
+
{props.clearLabel ?? "Clear"}
|
|
50
|
+
</Button>
|
|
51
|
+
<Button type="button" variant="ghost" onClick={() => field.setOpen(false)}>
|
|
52
|
+
{props.closeLabel ?? "Close"}
|
|
53
|
+
</Button>
|
|
54
|
+
</div>
|
|
55
|
+
</PopoverContent>
|
|
56
|
+
</Popover>
|
|
57
|
+
</FieldFrame>
|
|
58
|
+
);
|
|
59
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { Button } from "web/components/ui/button";
|
|
2
|
+
import { Calendar } from "web/components/ui/calendar";
|
|
3
|
+
import { Input } from "web/components/ui/input";
|
|
4
|
+
import { Label } from "web/components/ui/label";
|
|
5
|
+
import { Popover, PopoverContent, PopoverTrigger } from "web/components/ui/popover";
|
|
6
|
+
import { useDateControl } from "../hooks/use-date-control";
|
|
7
|
+
import type { DateProps } from "../types/control-props";
|
|
8
|
+
import FieldFrame from "./field-frame";
|
|
9
|
+
|
|
10
|
+
export default function DateTimePickerInput(props: DateProps) {
|
|
11
|
+
const field = useDateControl(props, true);
|
|
12
|
+
return (
|
|
13
|
+
<FieldFrame {...props} error={field.error}>
|
|
14
|
+
<Popover modal open={field.open} onOpenChange={field.setOpen}>
|
|
15
|
+
<PopoverTrigger asChild>
|
|
16
|
+
<Button
|
|
17
|
+
{...field.binding}
|
|
18
|
+
type="button"
|
|
19
|
+
variant="outline"
|
|
20
|
+
disabled={field.disabled || props.readOnly}
|
|
21
|
+
aria-haspopup="dialog"
|
|
22
|
+
aria-controls={`${props.id}-dialog`}
|
|
23
|
+
aria-labelledby={`${props.id}-label ${props.id}-value`}
|
|
24
|
+
>
|
|
25
|
+
<span id={`${props.id}-value`}>
|
|
26
|
+
{field.value || props.placeholder || "Choose date"}
|
|
27
|
+
</span>
|
|
28
|
+
</Button>
|
|
29
|
+
</PopoverTrigger>
|
|
30
|
+
<PopoverContent
|
|
31
|
+
id={`${props.id}-dialog`}
|
|
32
|
+
aria-modal="true"
|
|
33
|
+
dir={props.dir}
|
|
34
|
+
align="start"
|
|
35
|
+
aria-labelledby={`${props.id}-label`}
|
|
36
|
+
onCloseAutoFocus={field.onBlur}
|
|
37
|
+
>
|
|
38
|
+
<Calendar
|
|
39
|
+
id={`${props.id}-calendar`}
|
|
40
|
+
mode="single"
|
|
41
|
+
autoFocus
|
|
42
|
+
dir={props.dir}
|
|
43
|
+
selected={field.selected}
|
|
44
|
+
defaultMonth={field.selected}
|
|
45
|
+
onSelect={field.select}
|
|
46
|
+
/>
|
|
47
|
+
<Label htmlFor={`${props.id}-time`}>{props.timeLabel ?? "Time"}</Label>
|
|
48
|
+
<Input
|
|
49
|
+
id={`${props.id}-time`}
|
|
50
|
+
type="time"
|
|
51
|
+
value={field.time}
|
|
52
|
+
disabled={!field.selected}
|
|
53
|
+
onChange={(event) => field.changeTime(event.target.value)}
|
|
54
|
+
/>
|
|
55
|
+
<div className="flex gap-2">
|
|
56
|
+
<Button type="button" variant="ghost" onClick={field.clear}>
|
|
57
|
+
{props.clearLabel ?? "Clear"}
|
|
58
|
+
</Button>
|
|
59
|
+
<Button type="button" variant="ghost" onClick={() => field.setOpen(false)}>
|
|
60
|
+
{props.closeLabel ?? "Close"}
|
|
61
|
+
</Button>
|
|
62
|
+
</div>
|
|
63
|
+
</PopoverContent>
|
|
64
|
+
</Popover>
|
|
65
|
+
</FieldFrame>
|
|
66
|
+
);
|
|
67
|
+
}
|