@kenshinx/ui 1.4.0 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { ClassValue } from 'clsx';
2
2
  import * as class_variance_authority_types from 'class-variance-authority/types';
3
3
  import * as React from 'react';
4
+ import * as class_variance_authority from 'class-variance-authority';
4
5
  import { VariantProps } from 'class-variance-authority';
5
6
  import * as LabelPrimitive from '@radix-ui/react-label';
6
7
  import * as react_jsx_runtime from 'react/jsx-runtime';
@@ -15,6 +16,9 @@ import * as TabsPrimitive from '@radix-ui/react-tabs';
15
16
  import * as TooltipPrimitive from '@radix-ui/react-tooltip';
16
17
  import * as PopoverPrimitive from '@radix-ui/react-popover';
17
18
  import * as AvatarPrimitive from '@radix-ui/react-avatar';
19
+ import * as _radix_ui_react_slot from '@radix-ui/react-slot';
20
+ import * as react_hook_form from 'react-hook-form';
21
+ import { FieldValues, FieldPath, ControllerProps } from 'react-hook-form';
18
22
 
19
23
  /**
20
24
  * Utility function to merge Tailwind CSS classes with clsx
@@ -173,4 +177,24 @@ declare const TableHead: React.ForwardRefExoticComponent<React.ThHTMLAttributes<
173
177
  declare const TableCell: React.ForwardRefExoticComponent<React.TdHTMLAttributes<HTMLTableCellElement> & React.RefAttributes<HTMLTableCellElement>>;
174
178
  declare const TableCaption: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLTableCaptionElement> & React.RefAttributes<HTMLTableCaptionElement>>;
175
179
 
176
- export { Alert, AlertDescription, AlertTitle, Avatar, AvatarFallback, AvatarImage, Badge, type BadgeProps, Button, type ButtonProps, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, Input, type InputProps, Label, Popover, PopoverContent, PopoverTrigger, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, Skeleton, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, type TextareaProps, Toaster, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, alertVariants, badgeVariants, buttonVariants, cn };
180
+ declare const Form: <TFieldValues extends FieldValues, TContext = any, TTransformedValues = TFieldValues>(props: react_hook_form.FormProviderProps<TFieldValues, TContext, TTransformedValues>) => React.JSX.Element;
181
+ declare const FormField: <TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ ...props }: ControllerProps<TFieldValues, TName>) => react_jsx_runtime.JSX.Element;
182
+ declare const useFormField: () => {
183
+ invalid: boolean;
184
+ isDirty: boolean;
185
+ isTouched: boolean;
186
+ isValidating: boolean;
187
+ error?: react_hook_form.FieldError;
188
+ id: string;
189
+ name: string;
190
+ formItemId: string;
191
+ formDescriptionId: string;
192
+ formMessageId: string;
193
+ };
194
+ declare const FormItem: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
195
+ declare const FormLabel: React.ForwardRefExoticComponent<Omit<Omit<LabelPrimitive.LabelProps & React.RefAttributes<HTMLLabelElement>, "ref"> & class_variance_authority.VariantProps<(props?: class_variance_authority_types.ClassProp | undefined) => string> & React.RefAttributes<HTMLLabelElement>, "ref"> & React.RefAttributes<HTMLLabelElement>>;
196
+ declare const FormControl: React.ForwardRefExoticComponent<Omit<_radix_ui_react_slot.SlotProps & React.RefAttributes<HTMLElement>, "ref"> & React.RefAttributes<HTMLElement>>;
197
+ declare const FormDescription: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLParagraphElement> & React.RefAttributes<HTMLParagraphElement>>;
198
+ declare const FormMessage: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLParagraphElement> & React.RefAttributes<HTMLParagraphElement>>;
199
+
200
+ export { Alert, AlertDescription, AlertTitle, Avatar, AvatarFallback, AvatarImage, Badge, type BadgeProps, Button, type ButtonProps, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, Input, type InputProps, Label, Popover, PopoverContent, PopoverTrigger, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, Skeleton, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, type TextareaProps, Toaster, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, alertVariants, badgeVariants, buttonVariants, cn, useFormField };
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { clsx } from 'clsx';
2
2
  import { twMerge } from 'tailwind-merge';
3
- import * as React12 from 'react';
3
+ import * as React19 from 'react';
4
4
  import { useState, useEffect } from 'react';
5
5
  import { Slot } from '@radix-ui/react-slot';
6
6
  import { cva } from 'class-variance-authority';
@@ -18,6 +18,7 @@ import * as TabsPrimitive from '@radix-ui/react-tabs';
18
18
  import * as TooltipPrimitive from '@radix-ui/react-tooltip';
19
19
  import * as PopoverPrimitive from '@radix-ui/react-popover';
20
20
  import * as AvatarPrimitive from '@radix-ui/react-avatar';
21
+ import { useFormContext, useFormState, FormProvider, Controller } from 'react-hook-form';
21
22
 
22
23
  // src/lib/utils.ts
23
24
  function cn(...inputs) {
@@ -48,7 +49,7 @@ var buttonVariants = cva(
48
49
  }
49
50
  }
50
51
  );
51
- var Button = React12.forwardRef(
52
+ var Button = React19.forwardRef(
52
53
  ({ className, variant, size, asChild = false, ...props }, ref) => {
53
54
  const Comp = asChild ? Slot : "button";
54
55
  return /* @__PURE__ */ jsx(
@@ -62,7 +63,7 @@ var Button = React12.forwardRef(
62
63
  }
63
64
  );
64
65
  Button.displayName = "Button";
65
- var Input = React12.forwardRef(
66
+ var Input = React19.forwardRef(
66
67
  ({ className, type, ...props }, ref) => {
67
68
  return /* @__PURE__ */ jsx(
68
69
  "input",
@@ -82,7 +83,7 @@ Input.displayName = "Input";
82
83
  var labelVariants = cva(
83
84
  "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
84
85
  );
85
- var Label = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
86
+ var Label = React19.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
86
87
  LabelPrimitive.Root,
87
88
  {
88
89
  ref,
@@ -91,7 +92,7 @@ var Label = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
91
92
  }
92
93
  ));
93
94
  Label.displayName = LabelPrimitive.Root.displayName;
94
- var Card = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
95
+ var Card = React19.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
95
96
  "div",
96
97
  {
97
98
  ref,
@@ -103,7 +104,7 @@ var Card = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
103
104
  }
104
105
  ));
105
106
  Card.displayName = "Card";
106
- var CardHeader = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
107
+ var CardHeader = React19.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
107
108
  "div",
108
109
  {
109
110
  ref,
@@ -112,7 +113,7 @@ var CardHeader = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE
112
113
  }
113
114
  ));
114
115
  CardHeader.displayName = "CardHeader";
115
- var CardTitle = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
116
+ var CardTitle = React19.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
116
117
  "h3",
117
118
  {
118
119
  ref,
@@ -124,7 +125,7 @@ var CardTitle = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE_
124
125
  }
125
126
  ));
126
127
  CardTitle.displayName = "CardTitle";
127
- var CardDescription = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
128
+ var CardDescription = React19.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
128
129
  "p",
129
130
  {
130
131
  ref,
@@ -133,9 +134,9 @@ var CardDescription = React12.forwardRef(({ className, ...props }, ref) => /* @_
133
134
  }
134
135
  ));
135
136
  CardDescription.displayName = "CardDescription";
136
- var CardContent = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("p-6 pt-0", className), ...props }));
137
+ var CardContent = React19.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("p-6 pt-0", className), ...props }));
137
138
  CardContent.displayName = "CardContent";
138
- var CardFooter = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
139
+ var CardFooter = React19.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
139
140
  "div",
140
141
  {
141
142
  ref,
@@ -148,7 +149,7 @@ var Dialog = DialogPrimitive.Root;
148
149
  var DialogTrigger = DialogPrimitive.Trigger;
149
150
  var DialogPortal = DialogPrimitive.Portal;
150
151
  var DialogClose = DialogPrimitive.Close;
151
- var DialogOverlay = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
152
+ var DialogOverlay = React19.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
152
153
  DialogPrimitive.Overlay,
153
154
  {
154
155
  ref,
@@ -160,7 +161,7 @@ var DialogOverlay = React12.forwardRef(({ className, ...props }, ref) => /* @__P
160
161
  }
161
162
  ));
162
163
  DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
163
- var DialogContent = React12.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(DialogPortal, { children: [
164
+ var DialogContent = React19.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(DialogPortal, { children: [
164
165
  /* @__PURE__ */ jsx(DialogOverlay, {}),
165
166
  /* @__PURE__ */ jsxs(
166
167
  DialogPrimitive.Content,
@@ -210,7 +211,7 @@ var DialogFooter = ({
210
211
  }
211
212
  );
212
213
  DialogFooter.displayName = "DialogFooter";
213
- var DialogTitle = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
214
+ var DialogTitle = React19.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
214
215
  DialogPrimitive.Title,
215
216
  {
216
217
  ref,
@@ -222,7 +223,7 @@ var DialogTitle = React12.forwardRef(({ className, ...props }, ref) => /* @__PUR
222
223
  }
223
224
  ));
224
225
  DialogTitle.displayName = DialogPrimitive.Title.displayName;
225
- var DialogDescription = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
226
+ var DialogDescription = React19.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
226
227
  DialogPrimitive.Description,
227
228
  {
228
229
  ref,
@@ -231,7 +232,7 @@ var DialogDescription = React12.forwardRef(({ className, ...props }, ref) => /*
231
232
  }
232
233
  ));
233
234
  DialogDescription.displayName = DialogPrimitive.Description.displayName;
234
- var Switch = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
235
+ var Switch = React19.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
235
236
  SwitchPrimitives.Root,
236
237
  {
237
238
  className: cn(
@@ -251,7 +252,7 @@ var Switch = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ *
251
252
  }
252
253
  ));
253
254
  Switch.displayName = SwitchPrimitives.Root.displayName;
254
- var Checkbox = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
255
+ var Checkbox = React19.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
255
256
  CheckboxPrimitive.Root,
256
257
  {
257
258
  ref,
@@ -270,7 +271,7 @@ var Checkbox = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__
270
271
  }
271
272
  ));
272
273
  Checkbox.displayName = CheckboxPrimitive.Root.displayName;
273
- var Textarea = React12.forwardRef(
274
+ var Textarea = React19.forwardRef(
274
275
  ({ className, ...props }, ref) => {
275
276
  return /* @__PURE__ */ jsx(
276
277
  "textarea",
@@ -289,7 +290,7 @@ Textarea.displayName = "Textarea";
289
290
  var Select = SelectPrimitive.Root;
290
291
  var SelectGroup = SelectPrimitive.Group;
291
292
  var SelectValue = SelectPrimitive.Value;
292
- var SelectTrigger = React12.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(
293
+ var SelectTrigger = React19.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(
293
294
  SelectPrimitive.Trigger,
294
295
  {
295
296
  ref,
@@ -305,7 +306,7 @@ var SelectTrigger = React12.forwardRef(({ className, children, ...props }, ref)
305
306
  }
306
307
  ));
307
308
  SelectTrigger.displayName = SelectPrimitive.Trigger.displayName;
308
- var SelectScrollUpButton = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
309
+ var SelectScrollUpButton = React19.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
309
310
  SelectPrimitive.ScrollUpButton,
310
311
  {
311
312
  ref,
@@ -318,7 +319,7 @@ var SelectScrollUpButton = React12.forwardRef(({ className, ...props }, ref) =>
318
319
  }
319
320
  ));
320
321
  SelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName;
321
- var SelectScrollDownButton = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
322
+ var SelectScrollDownButton = React19.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
322
323
  SelectPrimitive.ScrollDownButton,
323
324
  {
324
325
  ref,
@@ -331,7 +332,7 @@ var SelectScrollDownButton = React12.forwardRef(({ className, ...props }, ref) =
331
332
  }
332
333
  ));
333
334
  SelectScrollDownButton.displayName = SelectPrimitive.ScrollDownButton.displayName;
334
- var SelectContent = React12.forwardRef(({ className, children, position = "popper", ...props }, ref) => /* @__PURE__ */ jsx(SelectPrimitive.Portal, { children: /* @__PURE__ */ jsxs(
335
+ var SelectContent = React19.forwardRef(({ className, children, position = "popper", ...props }, ref) => /* @__PURE__ */ jsx(SelectPrimitive.Portal, { children: /* @__PURE__ */ jsxs(
335
336
  SelectPrimitive.Content,
336
337
  {
337
338
  ref,
@@ -359,7 +360,7 @@ var SelectContent = React12.forwardRef(({ className, children, position = "poppe
359
360
  }
360
361
  ) }));
361
362
  SelectContent.displayName = SelectPrimitive.Content.displayName;
362
- var SelectLabel = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
363
+ var SelectLabel = React19.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
363
364
  SelectPrimitive.Label,
364
365
  {
365
366
  ref,
@@ -368,7 +369,7 @@ var SelectLabel = React12.forwardRef(({ className, ...props }, ref) => /* @__PUR
368
369
  }
369
370
  ));
370
371
  SelectLabel.displayName = SelectPrimitive.Label.displayName;
371
- var SelectItem = React12.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(
372
+ var SelectItem = React19.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(
372
373
  SelectPrimitive.Item,
373
374
  {
374
375
  ref,
@@ -384,7 +385,7 @@ var SelectItem = React12.forwardRef(({ className, children, ...props }, ref) =>
384
385
  }
385
386
  ));
386
387
  SelectItem.displayName = SelectPrimitive.Item.displayName;
387
- var SelectSeparator = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
388
+ var SelectSeparator = React19.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
388
389
  SelectPrimitive.Separator,
389
390
  {
390
391
  ref,
@@ -454,7 +455,7 @@ var alertVariants = cva(
454
455
  }
455
456
  }
456
457
  );
457
- var Alert = React12.forwardRef(({ className, variant, ...props }, ref) => /* @__PURE__ */ jsx(
458
+ var Alert = React19.forwardRef(({ className, variant, ...props }, ref) => /* @__PURE__ */ jsx(
458
459
  "div",
459
460
  {
460
461
  ref,
@@ -464,7 +465,7 @@ var Alert = React12.forwardRef(({ className, variant, ...props }, ref) => /* @__
464
465
  }
465
466
  ));
466
467
  Alert.displayName = "Alert";
467
- var AlertTitle = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
468
+ var AlertTitle = React19.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
468
469
  "h5",
469
470
  {
470
471
  ref,
@@ -473,7 +474,7 @@ var AlertTitle = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE
473
474
  }
474
475
  ));
475
476
  AlertTitle.displayName = "AlertTitle";
476
- var AlertDescription = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
477
+ var AlertDescription = React19.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
477
478
  "div",
478
479
  {
479
480
  ref,
@@ -498,7 +499,7 @@ var badgeVariants = cva(
498
499
  }
499
500
  }
500
501
  );
501
- var Badge = React12.forwardRef(
502
+ var Badge = React19.forwardRef(
502
503
  ({ className, variant, asChild = false, ...props }, ref) => {
503
504
  const Comp = asChild ? Slot : "div";
504
505
  return /* @__PURE__ */ jsx(
@@ -518,7 +519,7 @@ var DropdownMenuGroup = DropdownMenuPrimitive.Group;
518
519
  var DropdownMenuPortal = DropdownMenuPrimitive.Portal;
519
520
  var DropdownMenuSub = DropdownMenuPrimitive.Sub;
520
521
  var DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup;
521
- var DropdownMenuSubTrigger = React12.forwardRef(({ className, inset, children, ...props }, ref) => /* @__PURE__ */ jsxs(
522
+ var DropdownMenuSubTrigger = React19.forwardRef(({ className, inset, children, ...props }, ref) => /* @__PURE__ */ jsxs(
522
523
  DropdownMenuPrimitive.SubTrigger,
523
524
  {
524
525
  ref,
@@ -535,7 +536,7 @@ var DropdownMenuSubTrigger = React12.forwardRef(({ className, inset, children, .
535
536
  }
536
537
  ));
537
538
  DropdownMenuSubTrigger.displayName = DropdownMenuPrimitive.SubTrigger.displayName;
538
- var DropdownMenuSubContent = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
539
+ var DropdownMenuSubContent = React19.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
539
540
  DropdownMenuPrimitive.SubContent,
540
541
  {
541
542
  ref,
@@ -547,7 +548,7 @@ var DropdownMenuSubContent = React12.forwardRef(({ className, ...props }, ref) =
547
548
  }
548
549
  ));
549
550
  DropdownMenuSubContent.displayName = DropdownMenuPrimitive.SubContent.displayName;
550
- var DropdownMenuContent = React12.forwardRef(({ className, sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx(DropdownMenuPrimitive.Portal, { children: /* @__PURE__ */ jsx(
551
+ var DropdownMenuContent = React19.forwardRef(({ className, sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx(DropdownMenuPrimitive.Portal, { children: /* @__PURE__ */ jsx(
551
552
  DropdownMenuPrimitive.Content,
552
553
  {
553
554
  ref,
@@ -560,7 +561,7 @@ var DropdownMenuContent = React12.forwardRef(({ className, sideOffset = 4, ...pr
560
561
  }
561
562
  ) }));
562
563
  DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName;
563
- var DropdownMenuItem = React12.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ jsx(
564
+ var DropdownMenuItem = React19.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ jsx(
564
565
  DropdownMenuPrimitive.Item,
565
566
  {
566
567
  ref,
@@ -573,7 +574,7 @@ var DropdownMenuItem = React12.forwardRef(({ className, inset, ...props }, ref)
573
574
  }
574
575
  ));
575
576
  DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName;
576
- var DropdownMenuCheckboxItem = React12.forwardRef(({ className, children, checked, ...props }, ref) => /* @__PURE__ */ jsxs(
577
+ var DropdownMenuCheckboxItem = React19.forwardRef(({ className, children, checked, ...props }, ref) => /* @__PURE__ */ jsxs(
577
578
  DropdownMenuPrimitive.CheckboxItem,
578
579
  {
579
580
  ref,
@@ -590,7 +591,7 @@ var DropdownMenuCheckboxItem = React12.forwardRef(({ className, children, checke
590
591
  }
591
592
  ));
592
593
  DropdownMenuCheckboxItem.displayName = DropdownMenuPrimitive.CheckboxItem.displayName;
593
- var DropdownMenuRadioItem = React12.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(
594
+ var DropdownMenuRadioItem = React19.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(
594
595
  DropdownMenuPrimitive.RadioItem,
595
596
  {
596
597
  ref,
@@ -606,7 +607,7 @@ var DropdownMenuRadioItem = React12.forwardRef(({ className, children, ...props
606
607
  }
607
608
  ));
608
609
  DropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName;
609
- var DropdownMenuLabel = React12.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ jsx(
610
+ var DropdownMenuLabel = React19.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ jsx(
610
611
  DropdownMenuPrimitive.Label,
611
612
  {
612
613
  ref,
@@ -619,7 +620,7 @@ var DropdownMenuLabel = React12.forwardRef(({ className, inset, ...props }, ref)
619
620
  }
620
621
  ));
621
622
  DropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName;
622
- var DropdownMenuSeparator = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
623
+ var DropdownMenuSeparator = React19.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
623
624
  DropdownMenuPrimitive.Separator,
624
625
  {
625
626
  ref,
@@ -642,7 +643,7 @@ var DropdownMenuShortcut = ({
642
643
  };
643
644
  DropdownMenuShortcut.displayName = "DropdownMenuShortcut";
644
645
  var Tabs = TabsPrimitive.Root;
645
- var TabsList = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
646
+ var TabsList = React19.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
646
647
  TabsPrimitive.List,
647
648
  {
648
649
  ref,
@@ -654,7 +655,7 @@ var TabsList = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__
654
655
  }
655
656
  ));
656
657
  TabsList.displayName = TabsPrimitive.List.displayName;
657
- var TabsTrigger = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
658
+ var TabsTrigger = React19.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
658
659
  TabsPrimitive.Trigger,
659
660
  {
660
661
  ref,
@@ -666,7 +667,7 @@ var TabsTrigger = React12.forwardRef(({ className, ...props }, ref) => /* @__PUR
666
667
  }
667
668
  ));
668
669
  TabsTrigger.displayName = TabsPrimitive.Trigger.displayName;
669
- var TabsContent = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
670
+ var TabsContent = React19.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
670
671
  TabsPrimitive.Content,
671
672
  {
672
673
  ref,
@@ -681,7 +682,7 @@ TabsContent.displayName = TabsPrimitive.Content.displayName;
681
682
  var TooltipProvider = TooltipPrimitive.Provider;
682
683
  var Tooltip = TooltipPrimitive.Root;
683
684
  var TooltipTrigger = TooltipPrimitive.Trigger;
684
- var TooltipContent = React12.forwardRef(({ className, sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx(
685
+ var TooltipContent = React19.forwardRef(({ className, sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx(
685
686
  TooltipPrimitive.Content,
686
687
  {
687
688
  ref,
@@ -696,7 +697,7 @@ var TooltipContent = React12.forwardRef(({ className, sideOffset = 4, ...props }
696
697
  TooltipContent.displayName = TooltipPrimitive.Content.displayName;
697
698
  var Popover = PopoverPrimitive.Root;
698
699
  var PopoverTrigger = PopoverPrimitive.Trigger;
699
- var PopoverContent = React12.forwardRef(({ className, align = "center", sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx(PopoverPrimitive.Portal, { children: /* @__PURE__ */ jsx(
700
+ var PopoverContent = React19.forwardRef(({ className, align = "center", sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx(PopoverPrimitive.Portal, { children: /* @__PURE__ */ jsx(
700
701
  PopoverPrimitive.Content,
701
702
  {
702
703
  ref,
@@ -714,7 +715,7 @@ var Sheet = DialogPrimitive.Root;
714
715
  var SheetTrigger = DialogPrimitive.Trigger;
715
716
  var SheetClose = DialogPrimitive.Close;
716
717
  var SheetPortal = DialogPrimitive.Portal;
717
- var SheetOverlay = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
718
+ var SheetOverlay = React19.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
718
719
  DialogPrimitive.Overlay,
719
720
  {
720
721
  className: cn(
@@ -742,7 +743,7 @@ var sheetVariants = cva(
742
743
  }
743
744
  }
744
745
  );
745
- var SheetContent = React12.forwardRef(({ side = "right", className, children, ...props }, ref) => /* @__PURE__ */ jsxs(SheetPortal, { children: [
746
+ var SheetContent = React19.forwardRef(({ side = "right", className, children, ...props }, ref) => /* @__PURE__ */ jsxs(SheetPortal, { children: [
746
747
  /* @__PURE__ */ jsx(SheetOverlay, {}),
747
748
  /* @__PURE__ */ jsxs(
748
749
  DialogPrimitive.Content,
@@ -789,7 +790,7 @@ var SheetFooter = ({
789
790
  }
790
791
  );
791
792
  SheetFooter.displayName = "SheetFooter";
792
- var SheetTitle = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
793
+ var SheetTitle = React19.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
793
794
  DialogPrimitive.Title,
794
795
  {
795
796
  ref,
@@ -798,7 +799,7 @@ var SheetTitle = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE
798
799
  }
799
800
  ));
800
801
  SheetTitle.displayName = DialogPrimitive.Title.displayName;
801
- var SheetDescription = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
802
+ var SheetDescription = React19.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
802
803
  DialogPrimitive.Description,
803
804
  {
804
805
  ref,
@@ -807,7 +808,7 @@ var SheetDescription = React12.forwardRef(({ className, ...props }, ref) => /* @
807
808
  }
808
809
  ));
809
810
  SheetDescription.displayName = DialogPrimitive.Description.displayName;
810
- var Avatar = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
811
+ var Avatar = React19.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
811
812
  AvatarPrimitive.Root,
812
813
  {
813
814
  ref,
@@ -819,7 +820,7 @@ var Avatar = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ *
819
820
  }
820
821
  ));
821
822
  Avatar.displayName = AvatarPrimitive.Root.displayName;
822
- var AvatarImage = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
823
+ var AvatarImage = React19.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
823
824
  AvatarPrimitive.Image,
824
825
  {
825
826
  ref,
@@ -828,7 +829,7 @@ var AvatarImage = React12.forwardRef(({ className, ...props }, ref) => /* @__PUR
828
829
  }
829
830
  ));
830
831
  AvatarImage.displayName = AvatarPrimitive.Image.displayName;
831
- var AvatarFallback = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
832
+ var AvatarFallback = React19.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
832
833
  AvatarPrimitive.Fallback,
833
834
  {
834
835
  ref,
@@ -852,7 +853,7 @@ function Skeleton({
852
853
  }
853
854
  );
854
855
  }
855
- var Table = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { className: "relative w-full overflow-auto", children: /* @__PURE__ */ jsx(
856
+ var Table = React19.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { className: "relative w-full overflow-auto", children: /* @__PURE__ */ jsx(
856
857
  "table",
857
858
  {
858
859
  ref,
@@ -861,9 +862,9 @@ var Table = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
861
862
  }
862
863
  ) }));
863
864
  Table.displayName = "Table";
864
- var TableHeader = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("thead", { ref, className: cn("[&_tr]:border-b", className), ...props }));
865
+ var TableHeader = React19.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("thead", { ref, className: cn("[&_tr]:border-b", className), ...props }));
865
866
  TableHeader.displayName = "TableHeader";
866
- var TableBody = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
867
+ var TableBody = React19.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
867
868
  "tbody",
868
869
  {
869
870
  ref,
@@ -872,7 +873,7 @@ var TableBody = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE_
872
873
  }
873
874
  ));
874
875
  TableBody.displayName = "TableBody";
875
- var TableFooter = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
876
+ var TableFooter = React19.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
876
877
  "tfoot",
877
878
  {
878
879
  ref,
@@ -884,7 +885,7 @@ var TableFooter = React12.forwardRef(({ className, ...props }, ref) => /* @__PUR
884
885
  }
885
886
  ));
886
887
  TableFooter.displayName = "TableFooter";
887
- var TableRow = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
888
+ var TableRow = React19.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
888
889
  "tr",
889
890
  {
890
891
  ref,
@@ -896,7 +897,7 @@ var TableRow = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__
896
897
  }
897
898
  ));
898
899
  TableRow.displayName = "TableRow";
899
- var TableHead = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
900
+ var TableHead = React19.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
900
901
  "th",
901
902
  {
902
903
  ref,
@@ -908,7 +909,7 @@ var TableHead = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE_
908
909
  }
909
910
  ));
910
911
  TableHead.displayName = "TableHead";
911
- var TableCell = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
912
+ var TableCell = React19.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
912
913
  "td",
913
914
  {
914
915
  ref,
@@ -917,7 +918,7 @@ var TableCell = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE_
917
918
  }
918
919
  ));
919
920
  TableCell.displayName = "TableCell";
920
- var TableCaption = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
921
+ var TableCaption = React19.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
921
922
  "caption",
922
923
  {
923
924
  ref,
@@ -926,5 +927,99 @@ var TableCaption = React12.forwardRef(({ className, ...props }, ref) => /* @__PU
926
927
  }
927
928
  ));
928
929
  TableCaption.displayName = "TableCaption";
930
+ var Form = FormProvider;
931
+ var FormFieldContext = React19.createContext(
932
+ {}
933
+ );
934
+ var FormField = ({
935
+ ...props
936
+ }) => {
937
+ return /* @__PURE__ */ jsx(FormFieldContext.Provider, { value: { name: props.name }, children: /* @__PURE__ */ jsx(Controller, { ...props }) });
938
+ };
939
+ var useFormField = () => {
940
+ const fieldContext = React19.useContext(FormFieldContext);
941
+ const itemContext = React19.useContext(FormItemContext);
942
+ const { getFieldState } = useFormContext();
943
+ const formState = useFormState({ name: fieldContext.name });
944
+ const fieldState = getFieldState(fieldContext.name, formState);
945
+ if (!fieldContext) {
946
+ throw new Error("useFormField should be used within <FormField>");
947
+ }
948
+ const { id } = itemContext;
949
+ return {
950
+ id,
951
+ name: fieldContext.name,
952
+ formItemId: `${id}-form-item`,
953
+ formDescriptionId: `${id}-form-item-description`,
954
+ formMessageId: `${id}-form-item-message`,
955
+ ...fieldState
956
+ };
957
+ };
958
+ var FormItemContext = React19.createContext(
959
+ {}
960
+ );
961
+ var FormItem = React19.forwardRef(({ className, ...props }, ref) => {
962
+ const id = React19.useId();
963
+ return /* @__PURE__ */ jsx(FormItemContext.Provider, { value: { id }, children: /* @__PURE__ */ jsx("div", { ref, className: cn("space-y-2", className), ...props }) });
964
+ });
965
+ FormItem.displayName = "FormItem";
966
+ var FormLabel = React19.forwardRef(({ className, ...props }, ref) => {
967
+ const { error, formItemId } = useFormField();
968
+ return /* @__PURE__ */ jsx(
969
+ Label,
970
+ {
971
+ ref,
972
+ className: cn(error && "text-destructive", className),
973
+ htmlFor: formItemId,
974
+ ...props
975
+ }
976
+ );
977
+ });
978
+ FormLabel.displayName = "FormLabel";
979
+ var FormControl = React19.forwardRef(({ ...props }, ref) => {
980
+ const { error, formItemId, formDescriptionId, formMessageId } = useFormField();
981
+ return /* @__PURE__ */ jsx(
982
+ Slot,
983
+ {
984
+ ref,
985
+ id: formItemId,
986
+ "aria-describedby": !error ? `${formDescriptionId}` : `${formDescriptionId} ${formMessageId}`,
987
+ "aria-invalid": !!error,
988
+ ...props
989
+ }
990
+ );
991
+ });
992
+ FormControl.displayName = "FormControl";
993
+ var FormDescription = React19.forwardRef(({ className, ...props }, ref) => {
994
+ const { formDescriptionId } = useFormField();
995
+ return /* @__PURE__ */ jsx(
996
+ "p",
997
+ {
998
+ ref,
999
+ id: formDescriptionId,
1000
+ className: cn("text-muted-foreground text-sm", className),
1001
+ ...props
1002
+ }
1003
+ );
1004
+ });
1005
+ FormDescription.displayName = "FormDescription";
1006
+ var FormMessage = React19.forwardRef(({ className, children, ...props }, ref) => {
1007
+ const { error, formMessageId } = useFormField();
1008
+ const body = error ? String(error?.message ?? "") : children;
1009
+ if (!body) {
1010
+ return null;
1011
+ }
1012
+ return /* @__PURE__ */ jsx(
1013
+ "p",
1014
+ {
1015
+ ref,
1016
+ id: formMessageId,
1017
+ className: cn("text-destructive text-sm font-medium", className),
1018
+ ...props,
1019
+ children: body
1020
+ }
1021
+ );
1022
+ });
1023
+ FormMessage.displayName = "FormMessage";
929
1024
 
930
- export { Alert, AlertDescription, AlertTitle, Avatar, AvatarFallback, AvatarImage, Badge, Button, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, Input, Label, Popover, PopoverContent, PopoverTrigger, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, Skeleton, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, Toaster, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, alertVariants, badgeVariants, buttonVariants, cn };
1025
+ export { Alert, AlertDescription, AlertTitle, Avatar, AvatarFallback, AvatarImage, Badge, Button, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, Input, Label, Popover, PopoverContent, PopoverTrigger, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, Skeleton, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, Toaster, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, alertVariants, badgeVariants, buttonVariants, cn, useFormField };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kenshinx/ui",
3
- "version": "1.4.0",
3
+ "version": "1.5.0",
4
4
  "description": "Personal React UI component library based on shadcn/ui patterns",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -54,12 +54,29 @@
54
54
  "peerDependencies": {
55
55
  "react": "^18.0.0 || ^19.0.0",
56
56
  "react-dom": "^18.0.0 || ^19.0.0",
57
- "tailwindcss": "^3.4.0"
57
+ "tailwindcss": "^3.4.0",
58
+ "react-hook-form": "^7.0.0",
59
+ "@hookform/resolvers": "^3.0.0",
60
+ "zod": "^3.0.0"
61
+ },
62
+ "peerDependenciesMeta": {
63
+ "react-hook-form": {
64
+ "optional": true
65
+ },
66
+ "@hookform/resolvers": {
67
+ "optional": true
68
+ },
69
+ "zod": {
70
+ "optional": true
71
+ }
58
72
  },
59
73
  "devDependencies": {
60
74
  "@eslint/js": "^9.0.0",
75
+ "@hookform/resolvers": "^3.9.0",
61
76
  "@types/react": "^18.3.0",
62
77
  "@types/react-dom": "^18.3.0",
78
+ "react-hook-form": "^7.54.0",
79
+ "zod": "^3.24.0",
63
80
  "@typescript-eslint/eslint-plugin": "^8.0.0",
64
81
  "@typescript-eslint/parser": "^8.0.0",
65
82
  "eslint": "^9.0.0",