@twintag/twintag-form 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.
Files changed (39) hide show
  1. package/.turbo/turbo-build.log +16 -14
  2. package/CHANGELOG.md +12 -0
  3. package/dev/main.tsx +7 -1
  4. package/dist/common/form.d.ts +7 -7
  5. package/dist/common/input.d.ts +14 -14
  6. package/dist/common/textarea.d.ts +7 -7
  7. package/dist/components/config.d.ts +1 -1
  8. package/dist/components/input.d.ts +4 -0
  9. package/dist/components/label.d.ts +4 -0
  10. package/dist/components/provider.d.ts +4 -6
  11. package/dist/react.cjs +89 -0
  12. package/dist/{twintag-form.react.js → react.js} +3535 -3528
  13. package/dist/types/index.d.ts +1 -1
  14. package/dist/webcomponent.cjs +1 -0
  15. package/dist/{twintag-form.webcomponent.js → webcomponent.js} +1 -1
  16. package/lib/common/form.tsx +1 -1
  17. package/lib/common/input.tsx +1 -1
  18. package/lib/common/textarea.tsx +1 -1
  19. package/lib/components/config.tsx +10 -22
  20. package/lib/components/containers/accordion.tsx +2 -2
  21. package/lib/components/containers/category.tsx +1 -1
  22. package/lib/components/fields/checkbox.tsx +1 -1
  23. package/lib/components/fields/date-picker.tsx +2 -2
  24. package/lib/components/fields/file.tsx +1 -1
  25. package/lib/components/fields/input.tsx +1 -1
  26. package/lib/components/fields/radiogroup.tsx +1 -1
  27. package/lib/components/fields/textarea.tsx +1 -1
  28. package/lib/components/fields/toggle.tsx +1 -1
  29. package/lib/components/form.tsx +1 -1
  30. package/lib/components/input.tsx +12 -0
  31. package/lib/components/label.tsx +8 -0
  32. package/lib/types/index.ts +1 -1
  33. package/package.json +3 -6
  34. package/tsconfig.json +5 -3
  35. package/vite.config.ts +5 -8
  36. package/dist/common/scroll-area.d.ts +0 -5
  37. package/dist/common/select.d.ts +0 -13
  38. package/lib/common/scroll-area.tsx +0 -46
  39. package/lib/common/select.tsx +0 -159
@@ -1,46 +0,0 @@
1
- import * as React from 'react';
2
- import * as ScrollAreaPrimitive from '@radix-ui/react-scroll-area';
3
-
4
- import { cn } from '@twintag/twintag-form/utils/style';
5
-
6
- const ScrollArea = React.forwardRef<
7
- React.ElementRef<typeof ScrollAreaPrimitive.Root>,
8
- React.ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.Root>
9
- >(({ className, children, ...props }, ref) => (
10
- <ScrollAreaPrimitive.Root
11
- ref={ref}
12
- className={cn('relative overflow-hidden', className)}
13
- {...props}
14
- >
15
- <ScrollAreaPrimitive.Viewport className='h-full w-full rounded-[inherit]'>
16
- {children}
17
- </ScrollAreaPrimitive.Viewport>
18
- <ScrollBar />
19
- <ScrollAreaPrimitive.Corner />
20
- </ScrollAreaPrimitive.Root>
21
- ));
22
- ScrollArea.displayName = ScrollAreaPrimitive.Root.displayName;
23
-
24
- const ScrollBar = React.forwardRef<
25
- React.ElementRef<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>,
26
- React.ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>
27
- >(({ className, orientation = 'vertical', ...props }, ref) => (
28
- <ScrollAreaPrimitive.ScrollAreaScrollbar
29
- ref={ref}
30
- orientation={orientation}
31
- className={cn(
32
- 'flex touch-none select-none transition-colors',
33
- orientation === 'vertical' &&
34
- 'h-full w-2.5 border-l border-l-transparent p-[1px]',
35
- orientation === 'horizontal' &&
36
- 'h-2.5 flex-col border-t border-t-transparent p-[1px]',
37
- className,
38
- )}
39
- {...props}
40
- >
41
- <ScrollAreaPrimitive.ScrollAreaThumb className='relative flex-1 rounded-full bg-input' />
42
- </ScrollAreaPrimitive.ScrollAreaScrollbar>
43
- ));
44
- ScrollBar.displayName = ScrollAreaPrimitive.ScrollAreaScrollbar.displayName;
45
-
46
- export { ScrollArea, ScrollBar };
@@ -1,159 +0,0 @@
1
- import * as React from 'react';
2
- import { CaretSortIcon } from '@radix-ui/react-icons';
3
- import * as SelectPrimitive from '@radix-ui/react-select';
4
- import { Check, ChevronDown, ChevronUp } from 'lucide-react';
5
-
6
- import { cn } from '../utils/style';
7
-
8
- const Select = SelectPrimitive.Root;
9
-
10
- const SelectGroup = SelectPrimitive.Group;
11
-
12
- const SelectValue = SelectPrimitive.Value;
13
-
14
- const SelectTrigger = React.forwardRef<
15
- React.ElementRef<typeof SelectPrimitive.Trigger>,
16
- React.ComponentPropsWithoutRef<typeof SelectPrimitive.Trigger>
17
- >(({ className, children, ...props }, ref) => (
18
- <SelectPrimitive.Trigger
19
- ref={ref}
20
- className={cn(
21
- 'flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1',
22
- className,
23
- )}
24
- {...props}
25
- >
26
- {children}
27
- <SelectPrimitive.Icon asChild>
28
- <CaretSortIcon className='h-4 w-4 opacity-50' />
29
- </SelectPrimitive.Icon>
30
- </SelectPrimitive.Trigger>
31
- ));
32
- SelectTrigger.displayName = SelectPrimitive.Trigger.displayName;
33
-
34
- const SelectScrollUpButton = React.forwardRef<
35
- React.ElementRef<typeof SelectPrimitive.ScrollUpButton>,
36
- React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollUpButton>
37
- >(({ className, ...props }, ref) => (
38
- <SelectPrimitive.ScrollUpButton
39
- ref={ref}
40
- className={cn(
41
- 'flex cursor-default items-center justify-center py-1',
42
- className,
43
- )}
44
- {...props}
45
- >
46
- <ChevronUp className='h-4 w-4' />
47
- </SelectPrimitive.ScrollUpButton>
48
- ));
49
- SelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName;
50
-
51
- const SelectScrollDownButton = React.forwardRef<
52
- React.ElementRef<typeof SelectPrimitive.ScrollDownButton>,
53
- React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollDownButton>
54
- >(({ className, ...props }, ref) => (
55
- <SelectPrimitive.ScrollDownButton
56
- ref={ref}
57
- className={cn(
58
- 'flex cursor-default items-center justify-center py-1',
59
- className,
60
- )}
61
- {...props}
62
- >
63
- <ChevronDown className='h-4 w-4' />
64
- </SelectPrimitive.ScrollDownButton>
65
- ));
66
- SelectScrollDownButton.displayName =
67
- SelectPrimitive.ScrollDownButton.displayName;
68
-
69
- const SelectContent = React.forwardRef<
70
- React.ElementRef<typeof SelectPrimitive.Content>,
71
- React.ComponentPropsWithoutRef<typeof SelectPrimitive.Content>
72
- >(({ className, children, position = 'popper', ...props }, ref) => {
73
- return (
74
- <SelectPrimitive.Content
75
- ref={ref}
76
- className={cn(
77
- 'relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-background text-foreground shadow-md',
78
- position === 'popper' &&
79
- 'data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1',
80
- className,
81
- )}
82
- position={position}
83
- {...props}
84
- >
85
- <SelectScrollUpButton />
86
- <SelectPrimitive.Viewport
87
- className={cn(
88
- 'p-1',
89
- position === 'popper' &&
90
- 'h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]',
91
- )}
92
- >
93
- {children}
94
- </SelectPrimitive.Viewport>
95
- <SelectScrollDownButton />
96
- </SelectPrimitive.Content>
97
- );
98
- });
99
- SelectContent.displayName = SelectPrimitive.Content.displayName;
100
-
101
- const SelectLabel = React.forwardRef<
102
- React.ElementRef<typeof SelectPrimitive.Label>,
103
- React.ComponentPropsWithoutRef<typeof SelectPrimitive.Label>
104
- >(({ className, ...props }, ref) => (
105
- <SelectPrimitive.Label
106
- ref={ref}
107
- className={cn('py-1.5 pl-8 pr-2 text-sm font-semibold', className)}
108
- {...props}
109
- />
110
- ));
111
- SelectLabel.displayName = SelectPrimitive.Label.displayName;
112
-
113
- const SelectItem = React.forwardRef<
114
- React.ElementRef<typeof SelectPrimitive.Item>,
115
- React.ComponentPropsWithoutRef<typeof SelectPrimitive.Item>
116
- >(({ className, children, ...props }, ref) => (
117
- <SelectPrimitive.Item
118
- ref={ref}
119
- className={cn(
120
- 'relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50',
121
- className,
122
- )}
123
- {...props}
124
- >
125
- <span className='absolute left-2 flex h-3.5 w-3.5 items-center justify-center'>
126
- <SelectPrimitive.ItemIndicator>
127
- <Check className='h-4 w-4' />
128
- </SelectPrimitive.ItemIndicator>
129
- </span>
130
-
131
- <SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>
132
- </SelectPrimitive.Item>
133
- ));
134
- SelectItem.displayName = SelectPrimitive.Item.displayName;
135
-
136
- const SelectSeparator = React.forwardRef<
137
- React.ElementRef<typeof SelectPrimitive.Separator>,
138
- React.ComponentPropsWithoutRef<typeof SelectPrimitive.Separator>
139
- >(({ className, ...props }, ref) => (
140
- <SelectPrimitive.Separator
141
- ref={ref}
142
- className={cn('-mx-1 my-1 h-px bg-muted', className)}
143
- {...props}
144
- />
145
- ));
146
- SelectSeparator.displayName = SelectPrimitive.Separator.displayName;
147
-
148
- export {
149
- Select,
150
- SelectGroup,
151
- SelectValue,
152
- SelectTrigger,
153
- SelectContent,
154
- SelectLabel,
155
- SelectItem,
156
- SelectSeparator,
157
- SelectScrollUpButton,
158
- SelectScrollDownButton,
159
- };