@twintag/twintag-form 1.3.0 → 1.4.0-beta.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.
@@ -1,6 +1,7 @@
1
1
  import type { ElementType } from 'react';
2
2
  export type TwintagFormContext = {
3
3
  variant?: 'default' | 'beta';
4
+ size?: 'base' | 'sm';
4
5
  components: Map<string, ElementType>;
5
6
  };
6
7
  type RawProps = Partial<{
@@ -6,7 +6,7 @@ import { tv } from 'tailwind-variants';
6
6
 
7
7
  const buttonVariants = tv({
8
8
  base: [
9
- 'inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium transition-colors',
9
+ 'inline-flex items-center justify-center whitespace-nowrap rounded-md font-medium transition-colors',
10
10
  'ring-offset-background focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-2',
11
11
  'disabled:pointer-events-none disabled:opacity-50',
12
12
  ],
@@ -19,14 +19,13 @@ const buttonVariants = tv({
19
19
  ghost: 'hover:bg-accent hover:text-accent-foreground',
20
20
  },
21
21
  size: {
22
- default: 'h-9 px-4 py-2',
23
- sm: 'h-8 rounded-md px-3 text-xs',
24
- lg: 'h-10 rounded-md px-8',
22
+ sm: 'h-9 rounded-md px-3 text-sm',
23
+ base: 'h-10 px-3 py-2 text-base',
25
24
  },
26
25
  },
27
26
  defaultVariants: {
28
27
  variant: 'default',
29
- size: 'default',
28
+ size: 'base',
30
29
  },
31
30
  });
32
31
 
@@ -1,3 +1,5 @@
1
+ import type { VariantProps } from 'tailwind-variants';
2
+
1
3
  import * as React from 'react';
2
4
  import { ChevronLeft, ChevronRight } from 'lucide-react';
3
5
  import { DayPicker } from 'react-day-picker';
@@ -5,8 +7,6 @@ import { tv } from 'tailwind-variants';
5
7
 
6
8
  import { buttonVariants } from '@twintag/twintag-form/common/button';
7
9
 
8
- export type CalendarProps = React.ComponentProps<typeof DayPicker>;
9
-
10
10
  const calendarVariants = tv({
11
11
  slots: {
12
12
  picker: 'p-3',
@@ -14,7 +14,7 @@ const calendarVariants = tv({
14
14
  month: 'space-y-4',
15
15
  caption: 'relative flex items-center justify-center pt-1',
16
16
  caption_dropdowns: '',
17
- caption_label: 'text-sm font-semibold',
17
+ caption_label: 'font-semibold',
18
18
  nav: 'flex items-center space-x-1',
19
19
  nav_button: buttonVariants({
20
20
  variant: 'outline',
@@ -26,7 +26,7 @@ const calendarVariants = tv({
26
26
  head_row: 'flex',
27
27
  head_cell: 'w-9 rounded-md text-[0.8rem] font-normal text-muted-foreground',
28
28
  row: 'mt-2 flex w-full',
29
- cell: 'relative h-9 w-9 p-0 text-center text-sm focus-within:relative focus-within:z-20 [&:has([aria-selected])]:bg-transparent first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md [&:has([aria-selected].day-outside)]:bg-muted/50 [&:has([aria-selected].day-range-end)]:rounded-r-md',
29
+ cell: 'relative h-9 w-9 p-0 text-center focus-within:relative focus-within:z-20 [&:has([aria-selected])]:bg-transparent first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md [&:has([aria-selected].day-outside)]:bg-muted/50 [&:has([aria-selected].day-range-end)]:rounded-r-md',
30
30
  day: buttonVariants({
31
31
  variant: 'ghost',
32
32
  className: 'h-9 w-9 p-0 font-normal aria-selected:opacity-100',
@@ -49,21 +49,41 @@ const calendarVariants = tv({
49
49
  caption_dropdowns: [
50
50
  'flex w-4/6 justify-center gap-1',
51
51
  '[&>*>span]:hidden [&>*]:flex-1 [&>.rdp-vhidden]:hidden ',
52
- '[&>*>select]:h-7 [&>*>select]:min-w-[3.6rem] [&>*>select]:rounded-md [&>*>select]:border [&>*>select]:border-input [&>*>select]:bg-background [&>*>select]:px-1 [&>*>select]:text-sm',
52
+ '[&>*>select]:h-7 [&>*>select]:min-w-[3.6rem] [&>*>select]:rounded-md [&>*>select]:border [&>*>select]:border-input [&>*>select]:bg-background [&>*>select]:px-1',
53
53
  '[&>*>select]:ring-offset-background [&>*>select]:focus-visible:outline-none [&>*>select]:focus-visible:ring-1 [&>*>select]:focus-visible:ring-ring',
54
54
  ],
55
55
  },
56
56
  },
57
+ size: {
58
+ sm: {
59
+ caption_label: 'text-sm',
60
+ caption_dropdowns: '[&>*>select]:text-sm',
61
+ cell: 'text-sm',
62
+ },
63
+ base: {
64
+ caption_label: 'text-base',
65
+ caption_dropdowns: '[&>*>select]:text-base',
66
+ cell: 'text-base',
67
+ },
68
+ },
69
+ },
70
+ defaultVariants: {
71
+ size: 'base',
57
72
  },
58
73
  });
59
74
 
75
+ export type CalendarProps = React.ComponentProps<typeof DayPicker> &
76
+ VariantProps<typeof calendarVariants>;
77
+
60
78
  function Calendar({
79
+ size,
61
80
  className,
62
81
  classNames,
63
82
  showOutsideDays = true,
64
83
  ...props
65
84
  }: CalendarProps) {
66
85
  const slots = calendarVariants({
86
+ size,
67
87
  variant:
68
88
  props.captionLayout === 'dropdown-buttons' ? 'dropdown' : undefined,
69
89
  });
@@ -1,12 +1,11 @@
1
- import type * as LabelPrimitive from '@radix-ui/react-label';
2
1
  import type { ControllerProps, FieldPath, FieldValues } from 'react-hook-form';
2
+ import type { VariantProps } from 'tailwind-variants';
3
3
 
4
4
  import * as React from 'react';
5
5
  import { Slot } from '@radix-ui/react-slot';
6
6
  import { Controller, FormProvider, useFormContext } from 'react-hook-form';
7
7
  import { tv } from 'tailwind-variants';
8
8
 
9
- import { useTwintagForm } from '../provider';
10
9
  import { Label } from './label';
11
10
 
12
11
  const Form = FormProvider;
@@ -67,22 +66,23 @@ const FormItemContext = React.createContext<FormItemContextValue>(
67
66
  );
68
67
 
69
68
  const formItemVariants = tv({
70
- base: 'space-y-2',
69
+ base: '',
71
70
  variants: {
72
71
  variant: {
73
- default: '',
72
+ default: 'space-y-2',
74
73
  beta: 'space-y-1',
75
74
  },
76
75
  },
76
+ defaultVariants: {
77
+ variant: 'default',
78
+ },
77
79
  });
78
80
  const FormItem = React.forwardRef<
79
81
  HTMLDivElement,
80
- React.HTMLAttributes<HTMLDivElement>
81
- >(({ className, ...props }, ref) => {
82
+ React.HTMLAttributes<HTMLDivElement> & VariantProps<typeof formItemVariants>
83
+ >(({ variant, className, ...props }, ref) => {
82
84
  const id = React.useId();
83
85
 
84
- const { variant } = useTwintagForm();
85
-
86
86
  return (
87
87
  <FormItemContext.Provider value={{ id }}>
88
88
  <div
@@ -104,14 +104,15 @@ const formLabelVariants = tv({
104
104
  },
105
105
  });
106
106
  const FormLabel = React.forwardRef<
107
- React.ElementRef<typeof LabelPrimitive.Root>,
108
- React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root>
109
- >(({ className, ...props }, ref) => {
107
+ React.ElementRef<typeof Label>,
108
+ React.ComponentPropsWithoutRef<typeof Label>
109
+ >(({ size, className, ...props }, ref) => {
110
110
  const { error, formItemId } = useFormField();
111
111
 
112
112
  return (
113
113
  <Label
114
114
  ref={ref}
115
+ size={size}
115
116
  className={formLabelVariants({
116
117
  error: !!error,
117
118
  className,
@@ -147,19 +148,29 @@ const FormControl = React.forwardRef<
147
148
  FormControl.displayName = 'FormControl';
148
149
 
149
150
  const formDescriptionVariants = tv({
150
- base: 'text-[0.8rem] text-muted-foreground',
151
+ base: 'text-muted-foreground',
152
+ variants: {
153
+ size: {
154
+ sm: 'text-[0.8rem] leading-none',
155
+ base: 'text-[0.9rem] leading-none',
156
+ },
157
+ },
158
+ defaultVariants: {
159
+ size: 'base',
160
+ },
151
161
  });
152
162
  const FormDescription = React.forwardRef<
153
163
  HTMLParagraphElement,
154
- React.HTMLAttributes<HTMLParagraphElement>
155
- >(({ className, ...props }, ref) => {
164
+ React.HTMLAttributes<HTMLParagraphElement> &
165
+ VariantProps<typeof formDescriptionVariants>
166
+ >(({ size, className, ...props }, ref) => {
156
167
  const { formDescriptionId } = useFormField();
157
168
 
158
169
  return (
159
170
  <p
160
171
  ref={ref}
161
172
  id={formDescriptionId}
162
- className={formDescriptionVariants({ className })}
173
+ className={formDescriptionVariants({ size, className })}
163
174
  {...props}
164
175
  />
165
176
  );
@@ -167,12 +178,22 @@ const FormDescription = React.forwardRef<
167
178
  FormDescription.displayName = 'FormDescription';
168
179
 
169
180
  const formMessageVariants = tv({
170
- base: 'text-[0.8rem] font-medium text-destructive',
181
+ base: 'font-medium text-destructive',
182
+ variants: {
183
+ size: {
184
+ sm: 'text-[0.8rem]',
185
+ base: 'text-[0.9rem]',
186
+ },
187
+ },
188
+ defaultVariants: {
189
+ size: 'base',
190
+ },
171
191
  });
172
192
  const FormMessage = React.forwardRef<
173
193
  HTMLParagraphElement,
174
- React.HTMLAttributes<HTMLParagraphElement>
175
- >(({ className, children, ...props }, ref) => {
194
+ React.HTMLAttributes<HTMLParagraphElement> &
195
+ VariantProps<typeof formMessageVariants>
196
+ >(({ size, className, children, ...props }, ref) => {
176
197
  const { error, formMessageId } = useFormField();
177
198
  const body = error ? String(error?.message) : children;
178
199
 
@@ -184,7 +205,7 @@ const FormMessage = React.forwardRef<
184
205
  <p
185
206
  ref={ref}
186
207
  id={formMessageId}
187
- className={formMessageVariants({ className })}
208
+ className={formMessageVariants({ size, className })}
188
209
  {...props}
189
210
  >
190
211
  {body}
@@ -1,16 +1,14 @@
1
+ import type { VariantProps } from 'tailwind-variants';
2
+
1
3
  import * as React from 'react';
2
4
  import { tv } from 'tailwind-variants';
3
5
 
4
- import { useTwintagForm } from '@twintag/twintag-form/provider';
5
-
6
- export type InputProps = React.InputHTMLAttributes<HTMLInputElement>;
7
-
8
6
  const inputVariants = tv({
9
7
  slots: {
10
8
  root: 'relative',
11
9
  input: [
12
- 'flex h-10 w-full border-input bg-background py-2 text-sm text-primary-foreground placeholder:text-muted-foreground focus-visible:outline-none',
13
- 'file:border-0 file:bg-transparent file:px-0 file:text-sm file:font-medium file:text-primary-foreground',
10
+ 'flex h-10 w-full border-input bg-background py-2 text-primary-foreground placeholder:text-muted-foreground focus-visible:outline-none',
11
+ 'file:border-0 file:bg-transparent file:px-0 file:font-medium file:text-primary-foreground',
14
12
  'disabled:cursor-not-allowed disabled:opacity-50',
15
13
  ],
16
14
  },
@@ -25,17 +23,29 @@ const inputVariants = tv({
25
23
  input: 'border-b px-1',
26
24
  },
27
25
  },
26
+ size: {
27
+ sm: {
28
+ input: 'text-sm file:text-sm',
29
+ },
30
+ base: {
31
+ input: 'text-base file:text-base',
32
+ },
33
+ },
28
34
  },
29
35
  defaultVariants: {
30
36
  variant: 'default',
37
+ size: 'base',
31
38
  },
32
39
  });
33
40
 
41
+ export type InputProps = Omit<
42
+ React.InputHTMLAttributes<HTMLInputElement>,
43
+ 'size'
44
+ > &
45
+ VariantProps<typeof inputVariants>;
34
46
  const Input = React.forwardRef<HTMLInputElement, InputProps>(
35
- ({ className, type, ...props }, ref) => {
36
- const { variant } = useTwintagForm();
37
-
38
- const { root, input } = inputVariants({ variant });
47
+ ({ variant, size, className, type, ...props }, ref) => {
48
+ const { root, input } = inputVariants({ variant, size });
39
49
 
40
50
  return (
41
51
  <div className={root()}>
@@ -1,21 +1,34 @@
1
+ import type { VariantProps } from 'tailwind-variants';
2
+
1
3
  import * as React from 'react';
2
4
  import * as LabelPrimitive from '@radix-ui/react-label';
3
5
  import { tv } from 'tailwind-variants';
4
6
 
5
7
  const labelVariants = tv({
6
8
  base: [
7
- 'text-sm leading-none text-label',
9
+ 'text-label',
8
10
  'peer-disabled:cursor-not-allowed peer-disabled:opacity-70',
9
11
  ],
12
+ variants: {
13
+ size: {
14
+ sm: 'text-sm leading-none',
15
+ base: 'text-base leading-none',
16
+ },
17
+ },
18
+ defaultVariants: {
19
+ size: 'base',
20
+ },
10
21
  });
11
22
 
12
23
  const Label = React.forwardRef<
13
24
  React.ElementRef<typeof LabelPrimitive.Root>,
14
- React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root>
15
- >(({ className, ...props }, ref) => (
25
+ React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root> &
26
+ VariantProps<typeof labelVariants>
27
+ >(({ size, className, ...props }, ref) => (
16
28
  <LabelPrimitive.Root
17
29
  ref={ref}
18
30
  className={labelVariants({
31
+ size,
19
32
  className,
20
33
  })}
21
34
  {...props}
@@ -1,15 +1,13 @@
1
+ import type { VariantProps } from 'tailwind-variants';
2
+
1
3
  import * as React from 'react';
2
4
  import { tv } from 'tailwind-variants';
3
5
 
4
- import { useTwintagForm } from '@twintag/twintag-form/provider';
5
-
6
- type TextareaProps = React.TextareaHTMLAttributes<HTMLTextAreaElement>;
7
-
8
6
  const textareaVariants = tv({
9
7
  slots: {
10
8
  root: 'relative',
11
9
  textarea: [
12
- 'flex min-h-[60px] w-full border-input bg-background py-2 text-sm text-primary-foreground shadow-sm placeholder:text-muted-foreground focus-visible:outline-none',
10
+ 'flex min-h-[60px] w-full border-input bg-background py-2 text-primary-foreground shadow-sm placeholder:text-muted-foreground focus-visible:outline-none',
13
11
  'disabled:cursor-not-allowed disabled:opacity-50',
14
12
  ],
15
13
  },
@@ -24,16 +22,26 @@ const textareaVariants = tv({
24
22
  textarea: 'border-b px-1',
25
23
  },
26
24
  },
25
+ size: {
26
+ sm: {
27
+ textarea: 'text-sm',
28
+ },
29
+ base: {
30
+ textarea: 'text-base',
31
+ },
32
+ },
27
33
  },
28
34
  defaultVariants: {
29
35
  variant: 'default',
36
+ size: 'base',
30
37
  },
31
38
  });
32
- const Textarea = React.forwardRef<HTMLTextAreaElement, TextareaProps>(
33
- ({ className, ...props }, ref) => {
34
- const { variant } = useTwintagForm();
35
39
 
36
- const { root, textarea } = textareaVariants({ variant });
40
+ type TextareaProps = React.TextareaHTMLAttributes<HTMLTextAreaElement> &
41
+ VariantProps<typeof textareaVariants>;
42
+ const Textarea = React.forwardRef<HTMLTextAreaElement, TextareaProps>(
43
+ ({ variant, size, className, ...props }, ref) => {
44
+ const { root, textarea } = textareaVariants({ size, variant });
37
45
 
38
46
  return (
39
47
  <div className={root()}>
@@ -51,20 +51,32 @@ const accordionItemVariants = tv({
51
51
  slots: {
52
52
  item: 'px-5 last:border-none',
53
53
  trigger: 'flex flex-1 items-center gap-2.5 font-tf-font',
54
- content: 'space-y-4',
54
+ icon: 'shrink-0',
55
+ content: 'space-y-3',
55
56
  },
56
57
  variants: {
57
58
  variant: {
58
59
  default: {
59
- trigger: 'text-base font-medium',
60
+ trigger: 'font-medium',
60
61
  },
61
62
  beta: {
62
- trigger: 'text-sm',
63
+ trigger: '',
64
+ },
65
+ },
66
+ size: {
67
+ sm: {
68
+ item: 'text-sm',
69
+ icon: 'h-4 w-4',
70
+ },
71
+ base: {
72
+ item: 'text-base',
73
+ icon: 'h-5 w-5',
63
74
  },
64
75
  },
65
76
  },
66
77
  defaultVariants: {
67
78
  variant: 'default',
79
+ size: 'base',
68
80
  },
69
81
  });
70
82
 
@@ -74,15 +86,20 @@ const AccordionItem: FC<AccordionItemProps> = ({
74
86
  icon,
75
87
  children,
76
88
  }) => {
77
- const { variant } = useTwintagForm();
89
+ const { variant, size } = useTwintagForm();
78
90
 
79
- const { item, trigger, content } = accordionItemVariants({ variant });
91
+ const {
92
+ item,
93
+ trigger,
94
+ icon: iconVariants,
95
+ content,
96
+ } = accordionItemVariants({ size, variant });
80
97
 
81
98
  return (
82
99
  <AccordionItemPrimitive value={camelize(label)} className={item()}>
83
100
  <AccordionTrigger className='text-category'>
84
101
  <span className={trigger()}>
85
- {icon ? <Icon name={icon} className='shrink-0' /> : <></>}
102
+ {icon ? <Icon name={icon} className={iconVariants()} /> : <></>}
86
103
  {label}
87
104
  </span>
88
105
  </AccordionTrigger>
@@ -7,22 +7,31 @@ import { useTwintagForm } from '@twintag/twintag-form/provider';
7
7
 
8
8
  const categoryStyle = tv({
9
9
  slots: {
10
- container: 'relative w-full space-y-4',
10
+ container: 'relative w-full space-y-3',
11
11
  heading: 'font-tf-font text-category',
12
- content: 'grid gap-4',
12
+ content: 'grid gap-3',
13
13
  },
14
14
  variants: {
15
15
  variant: {
16
16
  default: {
17
- heading: 'text-base font-medium',
17
+ heading: 'font-medium',
18
18
  },
19
19
  beta: {
20
- heading: 'text-sm font-normal',
20
+ heading: 'font-normal',
21
+ },
22
+ },
23
+ size: {
24
+ sm: {
25
+ heading: 'text-sm',
26
+ },
27
+ base: {
28
+ heading: 'text-base',
21
29
  },
22
30
  },
23
31
  },
24
32
  defaultVariants: {
25
33
  variant: 'default',
34
+ size: 'base',
26
35
  },
27
36
  });
28
37
 
@@ -31,9 +40,9 @@ type Props = {
31
40
  } & WithChildren;
32
41
 
33
42
  const Category: FC<Props> = ({ label, children }) => {
34
- const { variant } = useTwintagForm();
43
+ const { variant, size } = useTwintagForm();
35
44
 
36
- const { container, heading, content } = categoryStyle({ variant });
45
+ const { container, heading, content } = categoryStyle({ size, variant });
37
46
 
38
47
  return (
39
48
  <section className={container()}>
@@ -13,9 +13,11 @@ import {
13
13
  FormLabel,
14
14
  FormMessage,
15
15
  } from '@twintag/twintag-form/common/form';
16
+ import { useTwintagForm } from '@twintag/twintag-form/provider';
16
17
 
17
18
  export const Checkbox: FC<Props> = ({ label, bind, options }) => {
18
19
  const { control } = useFormContext();
20
+ const { variant, size } = useTwintagForm();
19
21
 
20
22
  const isOptional = options?.optionalField;
21
23
 
@@ -28,7 +30,7 @@ export const Checkbox: FC<Props> = ({ label, bind, options }) => {
28
30
  required: isOptional ? false : options?.error ?? true,
29
31
  }}
30
32
  render={({ field }) => (
31
- <FormItem className='pt-1.5'>
33
+ <FormItem variant={variant} className='pt-1.5'>
32
34
  <div className='flex space-x-2'>
33
35
  <FormControl>
34
36
  <CommonCheckbox
@@ -39,8 +41,8 @@ export const Checkbox: FC<Props> = ({ label, bind, options }) => {
39
41
  }}
40
42
  />
41
43
  </FormControl>
42
- <div className='grid gap-1.5'>
43
- <FormLabel>
44
+ <div className='grid gap-1'>
45
+ <FormLabel size={size}>
44
46
  {label}
45
47
  {!isOptional ? (
46
48
  <span className='ml-0.5 inline-block'>
@@ -51,11 +53,13 @@ export const Checkbox: FC<Props> = ({ label, bind, options }) => {
51
53
  )}
52
54
  </FormLabel>
53
55
  {options?.description ? (
54
- <FormDescription>{options.description}</FormDescription>
56
+ <FormDescription size={size}>
57
+ {options.description}
58
+ </FormDescription>
55
59
  ) : (
56
60
  <></>
57
61
  )}
58
- <FormMessage />
62
+ <FormMessage size={size} />
59
63
  </div>
60
64
  </div>
61
65
  </FormItem>
@@ -23,25 +23,52 @@ import {
23
23
  } from '@twintag/twintag-form/common/popover';
24
24
  import { useTwintagForm } from '@twintag/twintag-form/provider';
25
25
 
26
- const triggerVariants = tv({
27
- base: 'w-full justify-start text-left font-normal',
26
+ const datePickerTriggerVariants = tv({
27
+ slots: {
28
+ button: 'w-full justify-start text-left font-normal',
29
+ icon: 'ml-auto text-muted-foreground opacity-70',
30
+ },
28
31
  variants: {
29
32
  variant: {
30
- default: 'px-3',
31
- beta: 'rounded-none border-x-transparent border-t-transparent px-1 transition-none hover:bg-white hover:text-muted-foreground',
33
+ default: {
34
+ button: 'px-3',
35
+ },
36
+ beta: {
37
+ button:
38
+ 'rounded-none border-x-transparent border-t-transparent px-1 transition-none hover:bg-white hover:text-muted-foreground',
39
+ },
32
40
  },
33
41
  withValue: {
34
- true: 'text-muted-foreground',
35
- false: '',
42
+ true: {
43
+ button: 'text-muted-foreground',
44
+ },
45
+ false: {
46
+ button: '',
47
+ },
48
+ },
49
+ size: {
50
+ sm: {
51
+ button: 'text-sm',
52
+ icon: 'h-4 w-4',
53
+ },
54
+ base: {
55
+ button: 'text-base',
56
+ icon: 'h-5 w-5',
57
+ },
36
58
  },
37
59
  },
60
+ defaultVariants: {
61
+ variant: 'default',
62
+ size: 'base',
63
+ },
38
64
  });
39
65
 
40
66
  export const DatePicker: React.FC<Props> = ({ label, bind, options }) => {
41
- const { variant } = useTwintagForm();
42
-
67
+ const { variant, size } = useTwintagForm();
43
68
  const { control } = useFormContext();
44
69
 
70
+ const { button, icon } = datePickerTriggerVariants({ variant, size });
71
+
45
72
  const isOptional = options?.optionalField;
46
73
 
47
74
  return (
@@ -52,9 +79,12 @@ export const DatePicker: React.FC<Props> = ({ label, bind, options }) => {
52
79
  required: isOptional ? false : options?.error ?? true,
53
80
  }}
54
81
  render={({ field }) => (
55
- <FormItem className='flex flex-col [&>div[data-radix-popper-content-wrapper]]:!z-50'>
56
- <div className='space-y-0.5'>
57
- <FormLabel>
82
+ <FormItem
83
+ variant={variant}
84
+ className='flex flex-col [&>div[data-radix-popper-content-wrapper]]:!z-50'
85
+ >
86
+ <div className='space-y-1'>
87
+ <FormLabel size={size}>
58
88
  {label}
59
89
  {!isOptional ? (
60
90
  <span className='ml-0.5 inline-block'>
@@ -65,7 +95,9 @@ export const DatePicker: React.FC<Props> = ({ label, bind, options }) => {
65
95
  )}
66
96
  </FormLabel>
67
97
  {options?.description ? (
68
- <FormDescription>{options.description}</FormDescription>
98
+ <FormDescription size={size}>
99
+ {options.description}
100
+ </FormDescription>
69
101
  ) : (
70
102
  <></>
71
103
  )}
@@ -75,10 +107,10 @@ export const DatePicker: React.FC<Props> = ({ label, bind, options }) => {
75
107
  <FormControl>
76
108
  <Button
77
109
  variant='outline'
78
- className={triggerVariants({
79
- variant,
110
+ size={size}
111
+ className={button({
80
112
  withValue: !field.value,
81
- className: 'h-10 gap-3',
113
+ className: 'h-10 gap-2',
82
114
  })}
83
115
  >
84
116
  {field.value ? (
@@ -86,7 +118,7 @@ export const DatePicker: React.FC<Props> = ({ label, bind, options }) => {
86
118
  ) : (
87
119
  <span>{options?.placeholder ?? 'Select a date'}</span>
88
120
  )}
89
- <CalendarIcon className='ml-auto h-4 w-4 opacity-50' />
121
+ <CalendarIcon className={icon()} />
90
122
  </Button>
91
123
  </FormControl>
92
124
  </PopoverTrigger>
@@ -96,6 +128,7 @@ export const DatePicker: React.FC<Props> = ({ label, bind, options }) => {
96
128
  toYear={2050}
97
129
  captionLayout='dropdown-buttons'
98
130
  mode='single'
131
+ size={size}
99
132
  selected={
100
133
  !isNaN(new Date(field.value as Date).getTime())
101
134
  ? new Date(field.value as Date)
@@ -106,7 +139,7 @@ export const DatePicker: React.FC<Props> = ({ label, bind, options }) => {
106
139
  />
107
140
  </PopoverContent>
108
141
  </Popover>
109
- <FormMessage className='pt-1' />
142
+ <FormMessage size={size} className='pt-1' />
110
143
  </FormItem>
111
144
  )}
112
145
  />