@twintag/twintag-form 1.6.1 → 1.6.2-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.
Files changed (53) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/README.md +59 -22
  3. package/dev/index.css +32 -32
  4. package/dev/main.tsx +1 -0
  5. package/lib/components/fields/date-picker.tsx +1 -1
  6. package/lib/components/fields/file.tsx +3 -2
  7. package/lib/components/fields/input.tsx +1 -1
  8. package/lib/components/fields/textarea.tsx +5 -1
  9. package/lib/components/provider.tsx +4 -5
  10. package/lib/index.tsx +7 -3
  11. package/lib/types/index.ts +26 -6
  12. package/package.json +1 -1
  13. package/.turbo/turbo-build.log +0 -22
  14. package/dist/common/accordion.d.ts +0 -7
  15. package/dist/common/button.d.ts +0 -71
  16. package/dist/common/calendar.d.ts +0 -139
  17. package/dist/common/checkbox.d.ts +0 -4
  18. package/dist/common/form.d.ts +0 -86
  19. package/dist/common/icon.d.ts +0 -8
  20. package/dist/common/input.d.ts +0 -133
  21. package/dist/common/label.d.ts +0 -21
  22. package/dist/common/popover.d.ts +0 -6
  23. package/dist/common/radiogroup.d.ts +0 -5
  24. package/dist/common/slider.d.ts +0 -4
  25. package/dist/common/switch.d.ts +0 -4
  26. package/dist/common/textarea.d.ts +0 -68
  27. package/dist/components/config.d.ts +0 -6
  28. package/dist/components/containers/accordion.d.ts +0 -7
  29. package/dist/components/containers/category.d.ts +0 -8
  30. package/dist/components/fields/checkbox.d.ts +0 -5
  31. package/dist/components/fields/date-picker.d.ts +0 -4
  32. package/dist/components/fields/file.d.ts +0 -5
  33. package/dist/components/fields/input.d.ts +0 -5
  34. package/dist/components/fields/radiogroup.d.ts +0 -7
  35. package/dist/components/fields/submit.d.ts +0 -4
  36. package/dist/components/fields/textarea.d.ts +0 -5
  37. package/dist/components/fields/toggle.d.ts +0 -5
  38. package/dist/components/fields/tri-toggle.d.ts +0 -5
  39. package/dist/components/form.d.ts +0 -9
  40. package/dist/components/input.d.ts +0 -4
  41. package/dist/components/label.d.ts +0 -4
  42. package/dist/components/provider.d.ts +0 -19
  43. package/dist/components/renderer.d.ts +0 -1
  44. package/dist/index.cjs +0 -1
  45. package/dist/index.d.ts +0 -16
  46. package/dist/index.js +0 -4456
  47. package/dist/types/index.d.ts +0 -58
  48. package/dist/utils/data.d.ts +0 -7
  49. package/dist/utils/string.d.ts +0 -3
  50. package/dist/utils/style.d.ts +0 -3
  51. package/dist/webcomponent.cjs +0 -1
  52. package/dist/webcomponent.d.ts +0 -1
  53. package/dist/webcomponent.js +0 -1162
@@ -1,86 +0,0 @@
1
- import { ControllerProps, FieldPath, FieldValues, FormProviderProps, FieldError } from 'react-hook-form';
2
- import { VariantProps, TVReturnType } from 'tailwind-variants';
3
- import { LabelProps } from '@radix-ui/react-label';
4
- import { SlotProps } from '@radix-ui/react-slot';
5
-
6
- import * as React from 'react';
7
- declare const Form: <TFieldValues extends FieldValues, TContext = any, TTransformedValues = TFieldValues>(props: FormProviderProps<TFieldValues, TContext, TTransformedValues>) => React.JSX.Element;
8
- declare const FormField: <TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ ...props }: ControllerProps<TFieldValues, TName>) => import("react/jsx-runtime").JSX.Element;
9
- declare const useFormField: () => {
10
- invalid: boolean;
11
- isDirty: boolean;
12
- isTouched: boolean;
13
- isValidating: boolean;
14
- error?: FieldError;
15
- id: string;
16
- name: string;
17
- formItemId: string;
18
- formDescriptionId: string;
19
- formMessageId: string;
20
- };
21
- declare const FormItem: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & VariantProps< TVReturnType<{
22
- variant: {
23
- default: string;
24
- outline: string;
25
- };
26
- }, undefined, "", {
27
- variant: {
28
- default: string;
29
- outline: string;
30
- };
31
- }, undefined, TVReturnType<{
32
- variant: {
33
- default: string;
34
- outline: string;
35
- };
36
- }, undefined, "", unknown, unknown, undefined>>> & React.RefAttributes<HTMLDivElement>>;
37
- declare const FormLabel: React.ForwardRefExoticComponent<Omit<Omit< LabelProps & React.RefAttributes<HTMLLabelElement>, "ref"> & VariantProps< TVReturnType<{
38
- size: {
39
- sm: string;
40
- base: string;
41
- };
42
- }, undefined, string[], {
43
- size: {
44
- sm: string;
45
- base: string;
46
- };
47
- }, undefined, TVReturnType<{
48
- size: {
49
- sm: string;
50
- base: string;
51
- };
52
- }, undefined, string[], unknown, unknown, undefined>>> & React.RefAttributes<HTMLLabelElement>, "ref"> & React.RefAttributes<HTMLLabelElement>>;
53
- declare const FormControl: React.ForwardRefExoticComponent<Omit< SlotProps & React.RefAttributes<HTMLElement>, "ref"> & React.RefAttributes<HTMLElement>>;
54
- declare const FormDescription: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLParagraphElement> & VariantProps< TVReturnType<{
55
- size: {
56
- sm: string;
57
- base: string;
58
- };
59
- }, undefined, "text-tf-muted-foreground", {
60
- size: {
61
- sm: string;
62
- base: string;
63
- };
64
- }, undefined, TVReturnType<{
65
- size: {
66
- sm: string;
67
- base: string;
68
- };
69
- }, undefined, "text-tf-muted-foreground", unknown, unknown, undefined>>> & React.RefAttributes<HTMLParagraphElement>>;
70
- declare const FormMessage: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLParagraphElement> & VariantProps< TVReturnType<{
71
- size: {
72
- sm: string;
73
- base: string;
74
- };
75
- }, undefined, "font-medium text-tf-destructive", {
76
- size: {
77
- sm: string;
78
- base: string;
79
- };
80
- }, undefined, TVReturnType<{
81
- size: {
82
- sm: string;
83
- base: string;
84
- };
85
- }, undefined, "font-medium text-tf-destructive", unknown, unknown, undefined>>> & React.RefAttributes<HTMLParagraphElement>>;
86
- export { useFormField, Form, FormItem, FormLabel, FormControl, FormDescription, FormMessage, FormField, };
@@ -1,8 +0,0 @@
1
- import { FC } from 'react';
2
-
3
- type Props = {
4
- name: string;
5
- className?: string;
6
- };
7
- export declare const Icon: FC<Props>;
8
- export {};
@@ -1,133 +0,0 @@
1
- import { VariantProps, TVReturnType } from 'tailwind-variants';
2
-
3
- import * as React from 'react';
4
- declare const inputVariants: TVReturnType<{
5
- variant: {
6
- default: {
7
- input: string;
8
- };
9
- outline: {
10
- root: string;
11
- input: string;
12
- };
13
- };
14
- size: {
15
- sm: {
16
- input: string;
17
- };
18
- base: {
19
- input: string;
20
- };
21
- };
22
- }, {
23
- root: string;
24
- input: string[];
25
- }, undefined, {
26
- variant: {
27
- default: {
28
- input: string;
29
- };
30
- outline: {
31
- root: string;
32
- input: string;
33
- };
34
- };
35
- size: {
36
- sm: {
37
- input: string;
38
- };
39
- base: {
40
- input: string;
41
- };
42
- };
43
- }, {
44
- root: string;
45
- input: string[];
46
- }, TVReturnType<{
47
- variant: {
48
- default: {
49
- input: string;
50
- };
51
- outline: {
52
- root: string;
53
- input: string;
54
- };
55
- };
56
- size: {
57
- sm: {
58
- input: string;
59
- };
60
- base: {
61
- input: string;
62
- };
63
- };
64
- }, {
65
- root: string;
66
- input: string[];
67
- }, undefined, unknown, unknown, undefined>>;
68
- export type InputProps = Omit<React.InputHTMLAttributes<HTMLInputElement>, 'size'> & VariantProps<typeof inputVariants>;
69
- declare const Input: React.ForwardRefExoticComponent<Omit<React.InputHTMLAttributes<HTMLInputElement>, "size"> & VariantProps< TVReturnType<{
70
- variant: {
71
- default: {
72
- input: string;
73
- };
74
- outline: {
75
- root: string;
76
- input: string;
77
- };
78
- };
79
- size: {
80
- sm: {
81
- input: string;
82
- };
83
- base: {
84
- input: string;
85
- };
86
- };
87
- }, {
88
- root: string;
89
- input: string[];
90
- }, undefined, {
91
- variant: {
92
- default: {
93
- input: string;
94
- };
95
- outline: {
96
- root: string;
97
- input: string;
98
- };
99
- };
100
- size: {
101
- sm: {
102
- input: string;
103
- };
104
- base: {
105
- input: string;
106
- };
107
- };
108
- }, {
109
- root: string;
110
- input: string[];
111
- }, TVReturnType<{
112
- variant: {
113
- default: {
114
- input: string;
115
- };
116
- outline: {
117
- root: string;
118
- input: string;
119
- };
120
- };
121
- size: {
122
- sm: {
123
- input: string;
124
- };
125
- base: {
126
- input: string;
127
- };
128
- };
129
- }, {
130
- root: string;
131
- input: string[];
132
- }, undefined, unknown, unknown, undefined>>> & React.RefAttributes<HTMLInputElement>>;
133
- export { Input };
@@ -1,21 +0,0 @@
1
- import { VariantProps, TVReturnType } from 'tailwind-variants';
2
-
3
- import * as React from 'react';
4
- import * as LabelPrimitive from '@radix-ui/react-label';
5
- declare const Label: React.ForwardRefExoticComponent<Omit<LabelPrimitive.LabelProps & React.RefAttributes<HTMLLabelElement>, "ref"> & VariantProps< TVReturnType<{
6
- size: {
7
- sm: string;
8
- base: string;
9
- };
10
- }, undefined, string[], {
11
- size: {
12
- sm: string;
13
- base: string;
14
- };
15
- }, undefined, TVReturnType<{
16
- size: {
17
- sm: string;
18
- base: string;
19
- };
20
- }, undefined, string[], unknown, unknown, undefined>>> & React.RefAttributes<HTMLLabelElement>>;
21
- export { Label };
@@ -1,6 +0,0 @@
1
- import * as React from 'react';
2
- import * as PopoverPrimitive from '@radix-ui/react-popover';
3
- declare const Popover: React.FC<PopoverPrimitive.PopoverProps>;
4
- declare const PopoverTrigger: React.ForwardRefExoticComponent<PopoverPrimitive.PopoverTriggerProps & React.RefAttributes<HTMLButtonElement>>;
5
- declare const PopoverContent: React.ForwardRefExoticComponent<Omit<PopoverPrimitive.PopoverContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
6
- export { Popover, PopoverTrigger, PopoverContent };
@@ -1,5 +0,0 @@
1
- import * as React from 'react';
2
- import * as RadioGroupPrimitive from '@radix-ui/react-radio-group';
3
- declare const RadioGroup: React.ForwardRefExoticComponent<Omit<RadioGroupPrimitive.RadioGroupProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
4
- declare const RadioGroupItem: React.ForwardRefExoticComponent<Omit<RadioGroupPrimitive.RadioGroupItemProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
5
- export { RadioGroup, RadioGroupItem };
@@ -1,4 +0,0 @@
1
- import * as React from 'react';
2
- import * as SliderPrimitive from '@radix-ui/react-slider';
3
- declare const Slider: React.ForwardRefExoticComponent<Omit<SliderPrimitive.SliderProps & React.RefAttributes<HTMLSpanElement>, "ref"> & React.RefAttributes<HTMLSpanElement>>;
4
- export { Slider };
@@ -1,4 +0,0 @@
1
- import * as React from 'react';
2
- import * as SwitchPrimitives from '@radix-ui/react-switch';
3
- declare const Switch: React.ForwardRefExoticComponent<Omit<SwitchPrimitives.SwitchProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
4
- export { Switch };
@@ -1,68 +0,0 @@
1
- import { VariantProps, TVReturnType } from 'tailwind-variants';
2
-
3
- import * as React from 'react';
4
- declare const Textarea: React.ForwardRefExoticComponent<React.TextareaHTMLAttributes<HTMLTextAreaElement> & VariantProps< TVReturnType<{
5
- variant: {
6
- default: {
7
- textarea: string;
8
- };
9
- outline: {
10
- root: string;
11
- textarea: string;
12
- };
13
- };
14
- size: {
15
- sm: {
16
- textarea: string;
17
- };
18
- base: {
19
- textarea: string;
20
- };
21
- };
22
- }, {
23
- root: string;
24
- textarea: string[];
25
- }, undefined, {
26
- variant: {
27
- default: {
28
- textarea: string;
29
- };
30
- outline: {
31
- root: string;
32
- textarea: string;
33
- };
34
- };
35
- size: {
36
- sm: {
37
- textarea: string;
38
- };
39
- base: {
40
- textarea: string;
41
- };
42
- };
43
- }, {
44
- root: string;
45
- textarea: string[];
46
- }, TVReturnType<{
47
- variant: {
48
- default: {
49
- textarea: string;
50
- };
51
- outline: {
52
- root: string;
53
- textarea: string;
54
- };
55
- };
56
- size: {
57
- sm: {
58
- textarea: string;
59
- };
60
- base: {
61
- textarea: string;
62
- };
63
- };
64
- }, {
65
- root: string;
66
- textarea: string[];
67
- }, undefined, unknown, unknown, undefined>>> & React.RefAttributes<HTMLTextAreaElement>>;
68
- export { Textarea };
@@ -1,6 +0,0 @@
1
- import { ElementType } from 'react';
2
- import { InputCompConfig } from '../types';
3
-
4
- export declare const Containers: Map<string, ElementType>;
5
- export declare const Inputs: Map<string, InputCompConfig>;
6
- export declare const components: Map<string, ElementType>;
@@ -1,7 +0,0 @@
1
- import { FC } from 'react';
2
- import { Props } from '../../types';
3
- import { WithChildren } from 'twintag-types/dom';
4
-
5
- type AccordionProps = Props<'accordion', 'item' | 'multiple' | 'single'> & WithChildren;
6
- declare const Accordion: FC<AccordionProps>;
7
- export { Accordion };
@@ -1,8 +0,0 @@
1
- import { FC } from 'react';
2
- import { WithChildren } from 'twintag-types/dom';
3
-
4
- type Props = {
5
- label?: string;
6
- } & WithChildren;
7
- declare const Category: FC<Props>;
8
- export { Category };
@@ -1,5 +0,0 @@
1
- import { FC } from 'react';
2
- import { Props } from '../../types';
3
-
4
- export declare const DEFAULT_CHECKBOX_VALUE = false;
5
- export declare const Checkbox: FC<Props<'input'>>;
@@ -1,4 +0,0 @@
1
- import { Props } from '../../types';
2
- import type * as React from 'react';
3
- export declare const DEFAULT_DATE_PICKER_VALUE: null;
4
- export declare const DatePicker: React.FC<Props<'input'>>;
@@ -1,5 +0,0 @@
1
- import { FC } from 'react';
2
- import { Props } from '../../types';
3
-
4
- export declare const DEFAULT_FILE_VALUE = "";
5
- export declare const File: FC<Props<'input'>>;
@@ -1,5 +0,0 @@
1
- import { FC } from 'react';
2
- import { Props } from '../../types';
3
-
4
- export declare const DEFAULT_INPUT_VALUE = "";
5
- export declare const Input: FC<Props<'input'>>;
@@ -1,7 +0,0 @@
1
- import { FC } from 'react';
2
- import { Props } from '../../types';
3
-
4
- export declare const DEFAULT_RADIOGROUP_VALUE = "";
5
- export declare const RadioGroup: FC<Props<'input'> & {
6
- items: Props<'input'>[];
7
- }>;
@@ -1,4 +0,0 @@
1
- import { FC } from 'react';
2
- import { Props } from '../../types';
3
-
4
- export declare const Submit: FC<Props>;
@@ -1,5 +0,0 @@
1
- import { FC } from 'react';
2
- import { Props } from '../../types';
3
-
4
- export declare const DEFAULT_TEXTAREA_VALUE = "";
5
- export declare const Textarea: FC<Props<'input'>>;
@@ -1,5 +0,0 @@
1
- import { FC } from 'react';
2
- import { Props } from '../../types';
3
-
4
- export declare const DEFAULT_TOGGLE_VALUE = false;
5
- export declare const Toggle: FC<Props<'input'>>;
@@ -1,5 +0,0 @@
1
- import { FC } from 'react';
2
- import { Props } from '../../types';
3
-
4
- export declare const DEFAULT_TRI_TOGGLE_VALUE: null;
5
- export declare const TriToggle: FC<Props<'input'>>;
@@ -1,9 +0,0 @@
1
- import { FieldValues } from 'react-hook-form';
2
- import { ForwardRefExoticComponent, ReactNode, RefAttributes } from 'react';
3
-
4
- export declare const TwintagForm: ForwardRefExoticComponent<{
5
- defaultValues?: FieldValues;
6
- resetOnSubmit?: boolean;
7
- } & {
8
- children?: ReactNode;
9
- } & RefAttributes<HTMLFormElement>>;
@@ -1,4 +0,0 @@
1
- import { FC } from 'react';
2
- import { Props } from '../types';
3
-
4
- export declare const Input: FC<Props<'input'>>;
@@ -1,4 +0,0 @@
1
- import { FC } from 'react';
2
- import { Props } from '../types';
3
-
4
- export declare const Label: FC<Props>;
@@ -1,19 +0,0 @@
1
- import { ParsedJsonComponent, RawJsonComponent, TwintagFormContext } from '../types';
2
- import { WithChildren } from 'twintag-types/dom';
3
- import { Context } from 'react';
4
-
5
- export declare const twintagFormContext: Context<TwintagFormContext>;
6
- export declare const useTwintagForm: () => TwintagFormContext;
7
- type Components = TwintagFormContext['components'];
8
- type Inputs = TwintagFormContext['inputs'];
9
- export declare const getResetValues: (config: ParsedJsonComponent | ParsedJsonComponent[], inputs: Inputs) => {
10
- [k: string]: unknown;
11
- };
12
- export declare const TwintagFormProvider: ({ variant, size, inputs, components, config, children, }: {
13
- config: RawJsonComponent | RawJsonComponent[];
14
- variant: TwintagFormContext["variant"];
15
- size: TwintagFormContext["size"];
16
- inputs: Inputs;
17
- components: Components;
18
- } & WithChildren) => import("react/jsx-runtime").JSX.Element;
19
- export {};
@@ -1 +0,0 @@
1
- export declare const JsonRenderer: () => import("react/jsx-runtime").JSX.Element;