@helloleo/plugins 0.1.14 → 0.1.16

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.
Files changed (125) hide show
  1. package/dist/index.js +197 -469
  2. package/dist/templates/tanstack-router-2026-06-15/components.json +22 -0
  3. package/dist/templates/tanstack-router-2026-06-15/index.html +13 -0
  4. package/dist/templates/tanstack-router-2026-06-15/package.json +94 -0
  5. package/dist/templates/tanstack-router-2026-06-15/src/components/ui/accordion.tsx +51 -0
  6. package/dist/templates/tanstack-router-2026-06-15/src/components/ui/alert-dialog.tsx +115 -0
  7. package/dist/templates/tanstack-router-2026-06-15/src/components/ui/alert.tsx +49 -0
  8. package/dist/templates/tanstack-router-2026-06-15/src/components/ui/aspect-ratio.tsx +5 -0
  9. package/dist/templates/tanstack-router-2026-06-15/src/components/ui/avatar.tsx +47 -0
  10. package/dist/templates/tanstack-router-2026-06-15/src/components/ui/badge.tsx +32 -0
  11. package/dist/templates/tanstack-router-2026-06-15/src/components/ui/breadcrumb.tsx +101 -0
  12. package/dist/templates/tanstack-router-2026-06-15/src/components/ui/button.tsx +49 -0
  13. package/dist/templates/tanstack-router-2026-06-15/src/components/ui/calendar.tsx +177 -0
  14. package/dist/templates/tanstack-router-2026-06-15/src/components/ui/card.tsx +55 -0
  15. package/dist/templates/tanstack-router-2026-06-15/src/components/ui/carousel.tsx +240 -0
  16. package/dist/templates/tanstack-router-2026-06-15/src/components/ui/chart.tsx +331 -0
  17. package/dist/templates/tanstack-router-2026-06-15/src/components/ui/checkbox.tsx +26 -0
  18. package/dist/templates/tanstack-router-2026-06-15/src/components/ui/collapsible.tsx +11 -0
  19. package/dist/templates/tanstack-router-2026-06-15/src/components/ui/command.tsx +143 -0
  20. package/dist/templates/tanstack-router-2026-06-15/src/components/ui/context-menu.tsx +187 -0
  21. package/dist/templates/tanstack-router-2026-06-15/src/components/ui/dialog.tsx +104 -0
  22. package/dist/templates/tanstack-router-2026-06-15/src/components/ui/drawer.tsx +98 -0
  23. package/dist/templates/tanstack-router-2026-06-15/src/components/ui/dropdown-menu.tsx +188 -0
  24. package/dist/templates/tanstack-router-2026-06-15/src/components/ui/form.tsx +171 -0
  25. package/dist/templates/tanstack-router-2026-06-15/src/components/ui/hover-card.tsx +27 -0
  26. package/dist/templates/tanstack-router-2026-06-15/src/components/ui/input-otp.tsx +69 -0
  27. package/dist/templates/tanstack-router-2026-06-15/src/components/ui/input.tsx +22 -0
  28. package/dist/templates/tanstack-router-2026-06-15/src/components/ui/label.tsx +21 -0
  29. package/dist/templates/tanstack-router-2026-06-15/src/components/ui/menubar.tsx +229 -0
  30. package/dist/templates/tanstack-router-2026-06-15/src/components/ui/navigation-menu.tsx +120 -0
  31. package/dist/templates/tanstack-router-2026-06-15/src/components/ui/pagination.tsx +98 -0
  32. package/dist/templates/tanstack-router-2026-06-15/src/components/ui/popover.tsx +31 -0
  33. package/dist/templates/tanstack-router-2026-06-15/src/components/ui/progress.tsx +25 -0
  34. package/dist/templates/tanstack-router-2026-06-15/src/components/ui/radio-group.tsx +36 -0
  35. package/dist/templates/tanstack-router-2026-06-15/src/components/ui/resizable.tsx +37 -0
  36. package/dist/templates/tanstack-router-2026-06-15/src/components/ui/scroll-area.tsx +44 -0
  37. package/dist/templates/tanstack-router-2026-06-15/src/components/ui/select.tsx +152 -0
  38. package/dist/templates/tanstack-router-2026-06-15/src/components/ui/separator.tsx +24 -0
  39. package/dist/templates/tanstack-router-2026-06-15/src/components/ui/sheet.tsx +122 -0
  40. package/dist/templates/tanstack-router-2026-06-15/src/components/ui/sidebar.tsx +744 -0
  41. package/dist/templates/tanstack-router-2026-06-15/src/components/ui/skeleton.tsx +7 -0
  42. package/dist/templates/tanstack-router-2026-06-15/src/components/ui/slider.tsx +23 -0
  43. package/dist/templates/tanstack-router-2026-06-15/src/components/ui/sonner.tsx +23 -0
  44. package/dist/templates/tanstack-router-2026-06-15/src/components/ui/switch.tsx +27 -0
  45. package/dist/templates/tanstack-router-2026-06-15/src/components/ui/table.tsx +94 -0
  46. package/dist/templates/tanstack-router-2026-06-15/src/components/ui/tabs.tsx +53 -0
  47. package/dist/templates/tanstack-router-2026-06-15/src/components/ui/textarea.tsx +21 -0
  48. package/dist/templates/tanstack-router-2026-06-15/src/components/ui/toggle-group.tsx +57 -0
  49. package/dist/templates/tanstack-router-2026-06-15/src/components/ui/toggle.tsx +42 -0
  50. package/dist/templates/tanstack-router-2026-06-15/src/components/ui/tooltip.tsx +32 -0
  51. package/dist/templates/tanstack-router-2026-06-15/src/hooks/use-mobile.tsx +19 -0
  52. package/dist/templates/tanstack-router-2026-06-15/src/lib/proxy.ts +83 -0
  53. package/dist/templates/tanstack-router-2026-06-15/src/lib/utils.ts +6 -0
  54. package/dist/templates/tanstack-router-2026-06-15/src/main.tsx +33 -0
  55. package/dist/templates/tanstack-router-2026-06-15/src/routeTree.gen.ts +59 -0
  56. package/dist/templates/tanstack-router-2026-06-15/src/router.tsx +23 -0
  57. package/dist/templates/tanstack-router-2026-06-15/src/routes/__root.tsx +16 -0
  58. package/dist/templates/tanstack-router-2026-06-15/src/routes/index.tsx +14 -0
  59. package/dist/templates/tanstack-router-2026-06-15/src/styles.css +214 -0
  60. package/dist/templates/tanstack-router-2026-06-15/tsconfig.json +27 -0
  61. package/dist/templates/tanstack-router-2026-06-15/vite.config.ts +24 -0
  62. package/package.json +3 -2
  63. package/src/template-render.ts +48 -0
  64. package/src/templates/tanstack-router-2026-06-15/components.json +22 -0
  65. package/src/templates/tanstack-router-2026-06-15/index.html +13 -0
  66. package/src/templates/tanstack-router-2026-06-15/package.json +94 -0
  67. package/src/templates/tanstack-router-2026-06-15/src/components/ui/accordion.tsx +51 -0
  68. package/src/templates/tanstack-router-2026-06-15/src/components/ui/alert-dialog.tsx +115 -0
  69. package/src/templates/tanstack-router-2026-06-15/src/components/ui/alert.tsx +49 -0
  70. package/src/templates/tanstack-router-2026-06-15/src/components/ui/aspect-ratio.tsx +5 -0
  71. package/src/templates/tanstack-router-2026-06-15/src/components/ui/avatar.tsx +47 -0
  72. package/src/templates/tanstack-router-2026-06-15/src/components/ui/badge.tsx +32 -0
  73. package/src/templates/tanstack-router-2026-06-15/src/components/ui/breadcrumb.tsx +101 -0
  74. package/src/templates/tanstack-router-2026-06-15/src/components/ui/button.tsx +49 -0
  75. package/src/templates/tanstack-router-2026-06-15/src/components/ui/calendar.tsx +177 -0
  76. package/src/templates/tanstack-router-2026-06-15/src/components/ui/card.tsx +55 -0
  77. package/src/templates/tanstack-router-2026-06-15/src/components/ui/carousel.tsx +240 -0
  78. package/src/templates/tanstack-router-2026-06-15/src/components/ui/chart.tsx +331 -0
  79. package/src/templates/tanstack-router-2026-06-15/src/components/ui/checkbox.tsx +26 -0
  80. package/src/templates/tanstack-router-2026-06-15/src/components/ui/collapsible.tsx +11 -0
  81. package/src/templates/tanstack-router-2026-06-15/src/components/ui/command.tsx +143 -0
  82. package/src/templates/tanstack-router-2026-06-15/src/components/ui/context-menu.tsx +187 -0
  83. package/src/templates/tanstack-router-2026-06-15/src/components/ui/dialog.tsx +104 -0
  84. package/src/templates/tanstack-router-2026-06-15/src/components/ui/drawer.tsx +98 -0
  85. package/src/templates/tanstack-router-2026-06-15/src/components/ui/dropdown-menu.tsx +188 -0
  86. package/src/templates/tanstack-router-2026-06-15/src/components/ui/form.tsx +171 -0
  87. package/src/templates/tanstack-router-2026-06-15/src/components/ui/hover-card.tsx +27 -0
  88. package/src/templates/tanstack-router-2026-06-15/src/components/ui/input-otp.tsx +69 -0
  89. package/src/templates/tanstack-router-2026-06-15/src/components/ui/input.tsx +22 -0
  90. package/src/templates/tanstack-router-2026-06-15/src/components/ui/label.tsx +21 -0
  91. package/src/templates/tanstack-router-2026-06-15/src/components/ui/menubar.tsx +229 -0
  92. package/src/templates/tanstack-router-2026-06-15/src/components/ui/navigation-menu.tsx +120 -0
  93. package/src/templates/tanstack-router-2026-06-15/src/components/ui/pagination.tsx +98 -0
  94. package/src/templates/tanstack-router-2026-06-15/src/components/ui/popover.tsx +31 -0
  95. package/src/templates/tanstack-router-2026-06-15/src/components/ui/progress.tsx +25 -0
  96. package/src/templates/tanstack-router-2026-06-15/src/components/ui/radio-group.tsx +36 -0
  97. package/src/templates/tanstack-router-2026-06-15/src/components/ui/resizable.tsx +37 -0
  98. package/src/templates/tanstack-router-2026-06-15/src/components/ui/scroll-area.tsx +44 -0
  99. package/src/templates/tanstack-router-2026-06-15/src/components/ui/select.tsx +152 -0
  100. package/src/templates/tanstack-router-2026-06-15/src/components/ui/separator.tsx +24 -0
  101. package/src/templates/tanstack-router-2026-06-15/src/components/ui/sheet.tsx +122 -0
  102. package/src/templates/tanstack-router-2026-06-15/src/components/ui/sidebar.tsx +744 -0
  103. package/src/templates/tanstack-router-2026-06-15/src/components/ui/skeleton.tsx +7 -0
  104. package/src/templates/tanstack-router-2026-06-15/src/components/ui/slider.tsx +23 -0
  105. package/src/templates/tanstack-router-2026-06-15/src/components/ui/sonner.tsx +23 -0
  106. package/src/templates/tanstack-router-2026-06-15/src/components/ui/switch.tsx +27 -0
  107. package/src/templates/tanstack-router-2026-06-15/src/components/ui/table.tsx +94 -0
  108. package/src/templates/tanstack-router-2026-06-15/src/components/ui/tabs.tsx +53 -0
  109. package/src/templates/tanstack-router-2026-06-15/src/components/ui/textarea.tsx +21 -0
  110. package/src/templates/tanstack-router-2026-06-15/src/components/ui/toggle-group.tsx +57 -0
  111. package/src/templates/tanstack-router-2026-06-15/src/components/ui/toggle.tsx +42 -0
  112. package/src/templates/tanstack-router-2026-06-15/src/components/ui/tooltip.tsx +32 -0
  113. package/src/templates/tanstack-router-2026-06-15/src/hooks/use-mobile.tsx +19 -0
  114. package/src/templates/tanstack-router-2026-06-15/src/lib/proxy.ts +83 -0
  115. package/src/templates/tanstack-router-2026-06-15/src/lib/utils.ts +6 -0
  116. package/src/templates/tanstack-router-2026-06-15/src/main.tsx +33 -0
  117. package/src/templates/tanstack-router-2026-06-15/src/routeTree.gen.ts +59 -0
  118. package/src/templates/tanstack-router-2026-06-15/src/router.tsx +23 -0
  119. package/src/templates/tanstack-router-2026-06-15/src/routes/__root.tsx +16 -0
  120. package/src/templates/tanstack-router-2026-06-15/src/routes/index.tsx +14 -0
  121. package/src/templates/tanstack-router-2026-06-15/src/styles.css +214 -0
  122. package/src/templates/tanstack-router-2026-06-15/tsconfig.json +27 -0
  123. package/src/templates/tanstack-router-2026-06-15/vite.config.ts +24 -0
  124. package/src/tools/scaffold.ts +51 -444
  125. package/src/tools/setup-netsuite.ts +161 -80
@@ -0,0 +1,188 @@
1
+ "use client";
2
+
3
+ import * as React from "react";
4
+ import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
5
+ import { Check, ChevronRight, Circle } from "lucide-react";
6
+
7
+ import { cn } from "@/lib/utils";
8
+
9
+ const DropdownMenu = DropdownMenuPrimitive.Root;
10
+
11
+ const DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;
12
+
13
+ const DropdownMenuGroup = DropdownMenuPrimitive.Group;
14
+
15
+ const DropdownMenuPortal = DropdownMenuPrimitive.Portal;
16
+
17
+ const DropdownMenuSub = DropdownMenuPrimitive.Sub;
18
+
19
+ const DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup;
20
+
21
+ const DropdownMenuSubTrigger = React.forwardRef<
22
+ React.ElementRef<typeof DropdownMenuPrimitive.SubTrigger>,
23
+ React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubTrigger> & {
24
+ inset?: boolean;
25
+ }
26
+ >(({ className, inset, children, ...props }, ref) => (
27
+ <DropdownMenuPrimitive.SubTrigger
28
+ ref={ref}
29
+ className={cn(
30
+ "flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
31
+ inset && "pl-8",
32
+ className,
33
+ )}
34
+ {...props}
35
+ >
36
+ {children}
37
+ <ChevronRight className="ml-auto" />
38
+ </DropdownMenuPrimitive.SubTrigger>
39
+ ));
40
+ DropdownMenuSubTrigger.displayName = DropdownMenuPrimitive.SubTrigger.displayName;
41
+
42
+ const DropdownMenuSubContent = React.forwardRef<
43
+ React.ElementRef<typeof DropdownMenuPrimitive.SubContent>,
44
+ React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubContent>
45
+ >(({ className, ...props }, ref) => (
46
+ <DropdownMenuPrimitive.SubContent
47
+ ref={ref}
48
+ className={cn(
49
+ "z-50 min-w-[8rem] 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)",
50
+ className,
51
+ )}
52
+ {...props}
53
+ />
54
+ ));
55
+ DropdownMenuSubContent.displayName = DropdownMenuPrimitive.SubContent.displayName;
56
+
57
+ const DropdownMenuContent = React.forwardRef<
58
+ React.ElementRef<typeof DropdownMenuPrimitive.Content>,
59
+ React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Content>
60
+ >(({ className, sideOffset = 4, ...props }, ref) => (
61
+ <DropdownMenuPrimitive.Portal>
62
+ <DropdownMenuPrimitive.Content
63
+ ref={ref}
64
+ sideOffset={sideOffset}
65
+ className={cn(
66
+ "z-50 max-h-[var(--radix-dropdown-menu-content-available-height)] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md",
67
+ "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)",
68
+ className,
69
+ )}
70
+ {...props}
71
+ />
72
+ </DropdownMenuPrimitive.Portal>
73
+ ));
74
+ DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName;
75
+
76
+ const DropdownMenuItem = React.forwardRef<
77
+ React.ElementRef<typeof DropdownMenuPrimitive.Item>,
78
+ React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Item> & {
79
+ inset?: boolean;
80
+ }
81
+ >(({ className, inset, ...props }, ref) => (
82
+ <DropdownMenuPrimitive.Item
83
+ ref={ref}
84
+ className={cn(
85
+ "relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&>svg]:size-4 [&>svg]:shrink-0",
86
+ inset && "pl-8",
87
+ className,
88
+ )}
89
+ {...props}
90
+ />
91
+ ));
92
+ DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName;
93
+
94
+ const DropdownMenuCheckboxItem = React.forwardRef<
95
+ React.ElementRef<typeof DropdownMenuPrimitive.CheckboxItem>,
96
+ React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.CheckboxItem>
97
+ >(({ className, children, checked, ...props }, ref) => (
98
+ <DropdownMenuPrimitive.CheckboxItem
99
+ ref={ref}
100
+ className={cn(
101
+ "relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
102
+ className,
103
+ )}
104
+ checked={checked}
105
+ {...props}
106
+ >
107
+ <span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
108
+ <DropdownMenuPrimitive.ItemIndicator>
109
+ <Check className="h-4 w-4" />
110
+ </DropdownMenuPrimitive.ItemIndicator>
111
+ </span>
112
+ {children}
113
+ </DropdownMenuPrimitive.CheckboxItem>
114
+ ));
115
+ DropdownMenuCheckboxItem.displayName = DropdownMenuPrimitive.CheckboxItem.displayName;
116
+
117
+ const DropdownMenuRadioItem = React.forwardRef<
118
+ React.ElementRef<typeof DropdownMenuPrimitive.RadioItem>,
119
+ React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.RadioItem>
120
+ >(({ className, children, ...props }, ref) => (
121
+ <DropdownMenuPrimitive.RadioItem
122
+ ref={ref}
123
+ className={cn(
124
+ "relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
125
+ className,
126
+ )}
127
+ {...props}
128
+ >
129
+ <span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
130
+ <DropdownMenuPrimitive.ItemIndicator>
131
+ <Circle className="h-2 w-2 fill-current" />
132
+ </DropdownMenuPrimitive.ItemIndicator>
133
+ </span>
134
+ {children}
135
+ </DropdownMenuPrimitive.RadioItem>
136
+ ));
137
+ DropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName;
138
+
139
+ const DropdownMenuLabel = React.forwardRef<
140
+ React.ElementRef<typeof DropdownMenuPrimitive.Label>,
141
+ React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Label> & {
142
+ inset?: boolean;
143
+ }
144
+ >(({ className, inset, ...props }, ref) => (
145
+ <DropdownMenuPrimitive.Label
146
+ ref={ref}
147
+ className={cn("px-2 py-1.5 text-sm font-semibold", inset && "pl-8", className)}
148
+ {...props}
149
+ />
150
+ ));
151
+ DropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName;
152
+
153
+ const DropdownMenuSeparator = React.forwardRef<
154
+ React.ElementRef<typeof DropdownMenuPrimitive.Separator>,
155
+ React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Separator>
156
+ >(({ className, ...props }, ref) => (
157
+ <DropdownMenuPrimitive.Separator
158
+ ref={ref}
159
+ className={cn("-mx-1 my-1 h-px bg-muted", className)}
160
+ {...props}
161
+ />
162
+ ));
163
+ DropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName;
164
+
165
+ const DropdownMenuShortcut = ({ className, ...props }: React.HTMLAttributes<HTMLSpanElement>) => {
166
+ return (
167
+ <span className={cn("ml-auto text-xs tracking-widest opacity-60", className)} {...props} />
168
+ );
169
+ };
170
+ DropdownMenuShortcut.displayName = "DropdownMenuShortcut";
171
+
172
+ export {
173
+ DropdownMenu,
174
+ DropdownMenuTrigger,
175
+ DropdownMenuContent,
176
+ DropdownMenuItem,
177
+ DropdownMenuCheckboxItem,
178
+ DropdownMenuRadioItem,
179
+ DropdownMenuLabel,
180
+ DropdownMenuSeparator,
181
+ DropdownMenuShortcut,
182
+ DropdownMenuGroup,
183
+ DropdownMenuPortal,
184
+ DropdownMenuSub,
185
+ DropdownMenuSubContent,
186
+ DropdownMenuSubTrigger,
187
+ DropdownMenuRadioGroup,
188
+ };
@@ -0,0 +1,171 @@
1
+ import * as React from "react";
2
+ import * as LabelPrimitive from "@radix-ui/react-label";
3
+ import { Slot } from "@radix-ui/react-slot";
4
+ import {
5
+ Controller,
6
+ FormProvider,
7
+ useFormContext,
8
+ type ControllerProps,
9
+ type FieldPath,
10
+ type FieldValues,
11
+ } from "react-hook-form";
12
+
13
+ import { cn } from "@/lib/utils";
14
+ import { Label } from "@/components/ui/label";
15
+
16
+ const Form = FormProvider;
17
+
18
+ type FormFieldContextValue<
19
+ TFieldValues extends FieldValues = FieldValues,
20
+ TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,
21
+ > = {
22
+ name: TName;
23
+ };
24
+
25
+ const FormFieldContext = React.createContext<FormFieldContextValue | null>(null);
26
+
27
+ const FormField = <
28
+ TFieldValues extends FieldValues = FieldValues,
29
+ TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,
30
+ >({
31
+ ...props
32
+ }: ControllerProps<TFieldValues, TName>) => {
33
+ return (
34
+ <FormFieldContext.Provider value={{ name: props.name }}>
35
+ <Controller {...props} />
36
+ </FormFieldContext.Provider>
37
+ );
38
+ };
39
+
40
+ const useFormField = () => {
41
+ const fieldContext = React.useContext(FormFieldContext);
42
+ const itemContext = React.useContext(FormItemContext);
43
+ const { getFieldState, formState } = useFormContext();
44
+
45
+ if (!fieldContext) {
46
+ throw new Error("useFormField should be used within <FormField>");
47
+ }
48
+
49
+ if (!itemContext) {
50
+ throw new Error("useFormField should be used within <FormItem>");
51
+ }
52
+
53
+ const fieldState = getFieldState(fieldContext.name, formState);
54
+
55
+ const { id } = itemContext;
56
+
57
+ return {
58
+ id,
59
+ name: fieldContext.name,
60
+ formItemId: `${id}-form-item`,
61
+ formDescriptionId: `${id}-form-item-description`,
62
+ formMessageId: `${id}-form-item-message`,
63
+ ...fieldState,
64
+ };
65
+ };
66
+
67
+ type FormItemContextValue = {
68
+ id: string;
69
+ };
70
+
71
+ const FormItemContext = React.createContext<FormItemContextValue | null>(null);
72
+
73
+ const FormItem = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(
74
+ ({ className, ...props }, ref) => {
75
+ const id = React.useId();
76
+
77
+ return (
78
+ <FormItemContext.Provider value={{ id }}>
79
+ <div ref={ref} className={cn("space-y-2", className)} {...props} />
80
+ </FormItemContext.Provider>
81
+ );
82
+ },
83
+ );
84
+ FormItem.displayName = "FormItem";
85
+
86
+ const FormLabel = React.forwardRef<
87
+ React.ElementRef<typeof LabelPrimitive.Root>,
88
+ React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root>
89
+ >(({ className, ...props }, ref) => {
90
+ const { error, formItemId } = useFormField();
91
+
92
+ return (
93
+ <Label
94
+ ref={ref}
95
+ className={cn(error && "text-destructive", className)}
96
+ htmlFor={formItemId}
97
+ {...props}
98
+ />
99
+ );
100
+ });
101
+ FormLabel.displayName = "FormLabel";
102
+
103
+ const FormControl = React.forwardRef<
104
+ React.ElementRef<typeof Slot>,
105
+ React.ComponentPropsWithoutRef<typeof Slot>
106
+ >(({ ...props }, ref) => {
107
+ const { error, formItemId, formDescriptionId, formMessageId } = useFormField();
108
+
109
+ return (
110
+ <Slot
111
+ ref={ref}
112
+ id={formItemId}
113
+ aria-describedby={!error ? `${formDescriptionId}` : `${formDescriptionId} ${formMessageId}`}
114
+ aria-invalid={!!error}
115
+ {...props}
116
+ />
117
+ );
118
+ });
119
+ FormControl.displayName = "FormControl";
120
+
121
+ const FormDescription = React.forwardRef<
122
+ HTMLParagraphElement,
123
+ React.HTMLAttributes<HTMLParagraphElement>
124
+ >(({ className, ...props }, ref) => {
125
+ const { formDescriptionId } = useFormField();
126
+
127
+ return (
128
+ <p
129
+ ref={ref}
130
+ id={formDescriptionId}
131
+ className={cn("text-[0.8rem] text-muted-foreground", className)}
132
+ {...props}
133
+ />
134
+ );
135
+ });
136
+ FormDescription.displayName = "FormDescription";
137
+
138
+ const FormMessage = React.forwardRef<
139
+ HTMLParagraphElement,
140
+ React.HTMLAttributes<HTMLParagraphElement>
141
+ >(({ className, children, ...props }, ref) => {
142
+ const { error, formMessageId } = useFormField();
143
+ const body = error ? String(error?.message ?? "") : children;
144
+
145
+ if (!body) {
146
+ return null;
147
+ }
148
+
149
+ return (
150
+ <p
151
+ ref={ref}
152
+ id={formMessageId}
153
+ className={cn("text-[0.8rem] font-medium text-destructive", className)}
154
+ {...props}
155
+ >
156
+ {body}
157
+ </p>
158
+ );
159
+ });
160
+ FormMessage.displayName = "FormMessage";
161
+
162
+ export {
163
+ useFormField,
164
+ Form,
165
+ FormItem,
166
+ FormLabel,
167
+ FormControl,
168
+ FormDescription,
169
+ FormMessage,
170
+ FormField,
171
+ };
@@ -0,0 +1,27 @@
1
+ import * as React from "react";
2
+ import * as HoverCardPrimitive from "@radix-ui/react-hover-card";
3
+
4
+ import { cn } from "@/lib/utils";
5
+
6
+ const HoverCard = HoverCardPrimitive.Root;
7
+
8
+ const HoverCardTrigger = HoverCardPrimitive.Trigger;
9
+
10
+ const HoverCardContent = React.forwardRef<
11
+ React.ElementRef<typeof HoverCardPrimitive.Content>,
12
+ React.ComponentPropsWithoutRef<typeof HoverCardPrimitive.Content>
13
+ >(({ className, align = "center", sideOffset = 4, ...props }, ref) => (
14
+ <HoverCardPrimitive.Content
15
+ ref={ref}
16
+ align={align}
17
+ sideOffset={sideOffset}
18
+ className={cn(
19
+ "z-50 w-64 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none 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)",
20
+ className,
21
+ )}
22
+ {...props}
23
+ />
24
+ ));
25
+ HoverCardContent.displayName = HoverCardPrimitive.Content.displayName;
26
+
27
+ export { HoverCard, HoverCardTrigger, HoverCardContent };
@@ -0,0 +1,69 @@
1
+ import * as React from "react";
2
+ import { OTPInput, OTPInputContext } from "input-otp";
3
+ import { Minus } from "lucide-react";
4
+
5
+ import { cn } from "@/lib/utils";
6
+
7
+ const InputOTP = React.forwardRef<
8
+ React.ElementRef<typeof OTPInput>,
9
+ React.ComponentPropsWithoutRef<typeof OTPInput>
10
+ >(({ className, containerClassName, ...props }, ref) => (
11
+ <OTPInput
12
+ ref={ref}
13
+ containerClassName={cn(
14
+ "flex items-center gap-2 has-[:disabled]:opacity-50",
15
+ containerClassName,
16
+ )}
17
+ className={cn("disabled:cursor-not-allowed", className)}
18
+ {...props}
19
+ />
20
+ ));
21
+ InputOTP.displayName = "InputOTP";
22
+
23
+ const InputOTPGroup = React.forwardRef<
24
+ React.ElementRef<"div">,
25
+ React.ComponentPropsWithoutRef<"div">
26
+ >(({ className, ...props }, ref) => (
27
+ <div ref={ref} className={cn("flex items-center", className)} {...props} />
28
+ ));
29
+ InputOTPGroup.displayName = "InputOTPGroup";
30
+
31
+ const InputOTPSlot = React.forwardRef<
32
+ React.ElementRef<"div">,
33
+ React.ComponentPropsWithoutRef<"div"> & { index: number }
34
+ >(({ index, className, ...props }, ref) => {
35
+ const inputOTPContext = React.useContext(OTPInputContext);
36
+ const { char, hasFakeCaret, isActive } = inputOTPContext.slots[index];
37
+
38
+ return (
39
+ <div
40
+ ref={ref}
41
+ className={cn(
42
+ "relative flex h-9 w-9 items-center justify-center border-y border-r border-input text-sm shadow-sm transition-all first:rounded-l-md first:border-l last:rounded-r-md",
43
+ isActive && "z-10 ring-1 ring-ring",
44
+ className,
45
+ )}
46
+ {...props}
47
+ >
48
+ {char}
49
+ {hasFakeCaret && (
50
+ <div className="pointer-events-none absolute inset-0 flex items-center justify-center">
51
+ <div className="h-4 w-px animate-caret-blink bg-foreground duration-1000" />
52
+ </div>
53
+ )}
54
+ </div>
55
+ );
56
+ });
57
+ InputOTPSlot.displayName = "InputOTPSlot";
58
+
59
+ const InputOTPSeparator = React.forwardRef<
60
+ React.ElementRef<"div">,
61
+ React.ComponentPropsWithoutRef<"div">
62
+ >(({ ...props }, ref) => (
63
+ <div ref={ref} role="separator" {...props}>
64
+ <Minus />
65
+ </div>
66
+ ));
67
+ InputOTPSeparator.displayName = "InputOTPSeparator";
68
+
69
+ export { InputOTP, InputOTPGroup, InputOTPSlot, InputOTPSeparator };
@@ -0,0 +1,22 @@
1
+ import * as React from "react";
2
+
3
+ import { cn } from "@/lib/utils";
4
+
5
+ const Input = React.forwardRef<HTMLInputElement, React.ComponentProps<"input">>(
6
+ ({ className, type, ...props }, ref) => {
7
+ return (
8
+ <input
9
+ type={type}
10
+ className={cn(
11
+ "flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
12
+ className,
13
+ )}
14
+ ref={ref}
15
+ {...props}
16
+ />
17
+ );
18
+ },
19
+ );
20
+ Input.displayName = "Input";
21
+
22
+ export { Input };
@@ -0,0 +1,21 @@
1
+ "use client";
2
+
3
+ import * as React from "react";
4
+ import * as LabelPrimitive from "@radix-ui/react-label";
5
+ import { cva, type VariantProps } from "class-variance-authority";
6
+
7
+ import { cn } from "@/lib/utils";
8
+
9
+ const labelVariants = cva(
10
+ "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",
11
+ );
12
+
13
+ const Label = React.forwardRef<
14
+ React.ElementRef<typeof LabelPrimitive.Root>,
15
+ React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root> & VariantProps<typeof labelVariants>
16
+ >(({ className, ...props }, ref) => (
17
+ <LabelPrimitive.Root ref={ref} className={cn(labelVariants(), className)} {...props} />
18
+ ));
19
+ Label.displayName = LabelPrimitive.Root.displayName;
20
+
21
+ export { Label };