@twintag/twintag-form 1.3.0 → 1.4.0-beta.1
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/.turbo/turbo-build.log +6 -6
- package/CHANGELOG.md +12 -0
- package/README.md +121 -62
- package/dev/main.tsx +233 -210
- package/dist/common/button.d.ts +17 -30
- package/dist/common/calendar.d.ts +212 -4
- package/dist/common/form.d.ts +151 -9
- package/dist/common/icon.d.ts +2 -1
- package/dist/common/input.d.ts +276 -2
- package/dist/common/label.d.ts +39 -1
- package/dist/common/slider.d.ts +4 -0
- package/dist/common/textarea.d.ts +139 -2
- package/dist/components/config.d.ts +4 -2
- package/dist/components/containers/accordion.d.ts +3 -2
- package/dist/components/containers/category.d.ts +3 -2
- package/dist/components/fields/checkbox.d.ts +4 -2
- package/dist/components/fields/date-picker.d.ts +3 -1
- package/dist/components/fields/file.d.ts +4 -2
- package/dist/components/fields/input.d.ts +4 -2
- package/dist/components/fields/radiogroup.d.ts +4 -2
- package/dist/components/fields/submit.d.ts +3 -2
- package/dist/components/fields/textarea.d.ts +4 -2
- package/dist/components/fields/toggle.d.ts +4 -2
- package/dist/components/fields/tri-toggle.d.ts +5 -0
- package/dist/components/form.d.ts +2 -2
- package/dist/components/provider.d.ts +21 -0
- package/dist/components/renderer.d.ts +1 -0
- package/dist/index.d.ts +5 -3
- package/dist/twintag-form.react.js +12868 -12156
- package/dist/types/index.d.ts +25 -16
- package/dist/utils/data.d.ts +2 -1
- package/dist/utils/style.d.ts +2 -1
- package/index.html +5 -3
- package/lib/common/button.tsx +4 -5
- package/lib/common/calendar.tsx +25 -5
- package/lib/common/form.tsx +40 -19
- package/lib/common/input.tsx +20 -10
- package/lib/common/label.tsx +16 -3
- package/lib/common/slider.tsx +38 -0
- package/lib/common/textarea.tsx +17 -9
- package/lib/components/config.tsx +46 -17
- package/lib/components/containers/accordion.tsx +24 -7
- package/lib/components/containers/category.tsx +16 -7
- package/lib/components/fields/checkbox.tsx +12 -6
- package/lib/components/fields/date-picker.tsx +54 -18
- package/lib/components/fields/file.tsx +83 -76
- package/lib/components/fields/input.tsx +15 -6
- package/lib/components/fields/radiogroup.tsx +13 -7
- package/lib/components/fields/submit.tsx +5 -2
- package/lib/components/fields/textarea.tsx +14 -6
- package/lib/components/fields/toggle.tsx +12 -6
- package/lib/components/fields/tri-toggle.tsx +141 -0
- package/lib/components/form.tsx +5 -7
- package/lib/components/provider.tsx +159 -0
- package/lib/components/{Render/index.tsx → renderer.tsx} +19 -2
- package/lib/index.tsx +41 -36
- package/lib/types/index.ts +49 -39
- package/package.json +5 -7
- package/dist/components/Render/index.d.ts +0 -7
- package/dist/components/Render/useJson.d.ts +0 -2
- package/dist/components/index.d.ts +0 -7
- package/dist/provider.d.ts +0 -8
- package/lib/components/Render/useJson.ts +0 -76
- package/lib/components/index.tsx +0 -24
- package/lib/provider.tsx +0 -36
|
@@ -0,0 +1,4 @@
|
|
|
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 +1,141 @@
|
|
|
1
|
+
import { VariantProps, TVReturnType } from 'tailwind-variants';
|
|
2
|
+
import { TVConfig } from 'tailwind-variants/dist/config.js';
|
|
3
|
+
|
|
1
4
|
import * as React from 'react';
|
|
2
|
-
|
|
3
|
-
|
|
5
|
+
declare const Textarea: React.ForwardRefExoticComponent<React.TextareaHTMLAttributes<HTMLTextAreaElement> & VariantProps< TVReturnType<{
|
|
6
|
+
variant: {
|
|
7
|
+
default: {
|
|
8
|
+
textarea: string;
|
|
9
|
+
};
|
|
10
|
+
beta: {
|
|
11
|
+
root: string;
|
|
12
|
+
textarea: string;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
size: {
|
|
16
|
+
sm: {
|
|
17
|
+
textarea: string;
|
|
18
|
+
};
|
|
19
|
+
base: {
|
|
20
|
+
textarea: string;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
}, {
|
|
24
|
+
root: string;
|
|
25
|
+
textarea: string[];
|
|
26
|
+
}, undefined, TVConfig<{
|
|
27
|
+
variant: {
|
|
28
|
+
default: {
|
|
29
|
+
textarea: string;
|
|
30
|
+
};
|
|
31
|
+
beta: {
|
|
32
|
+
root: string;
|
|
33
|
+
textarea: string;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
size: {
|
|
37
|
+
sm: {
|
|
38
|
+
textarea: string;
|
|
39
|
+
};
|
|
40
|
+
base: {
|
|
41
|
+
textarea: string;
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
}, {
|
|
45
|
+
variant: {
|
|
46
|
+
default: {
|
|
47
|
+
textarea: string;
|
|
48
|
+
};
|
|
49
|
+
beta: {
|
|
50
|
+
root: string;
|
|
51
|
+
textarea: string;
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
size: {
|
|
55
|
+
sm: {
|
|
56
|
+
textarea: string;
|
|
57
|
+
};
|
|
58
|
+
base: {
|
|
59
|
+
textarea: string;
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
}>, {
|
|
63
|
+
variant: {
|
|
64
|
+
default: {
|
|
65
|
+
textarea: string;
|
|
66
|
+
};
|
|
67
|
+
beta: {
|
|
68
|
+
root: string;
|
|
69
|
+
textarea: string;
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
size: {
|
|
73
|
+
sm: {
|
|
74
|
+
textarea: string;
|
|
75
|
+
};
|
|
76
|
+
base: {
|
|
77
|
+
textarea: string;
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
}, {
|
|
81
|
+
root: string;
|
|
82
|
+
textarea: string[];
|
|
83
|
+
}, TVReturnType<{
|
|
84
|
+
variant: {
|
|
85
|
+
default: {
|
|
86
|
+
textarea: string;
|
|
87
|
+
};
|
|
88
|
+
beta: {
|
|
89
|
+
root: string;
|
|
90
|
+
textarea: string;
|
|
91
|
+
};
|
|
92
|
+
};
|
|
93
|
+
size: {
|
|
94
|
+
sm: {
|
|
95
|
+
textarea: string;
|
|
96
|
+
};
|
|
97
|
+
base: {
|
|
98
|
+
textarea: string;
|
|
99
|
+
};
|
|
100
|
+
};
|
|
101
|
+
}, {
|
|
102
|
+
root: string;
|
|
103
|
+
textarea: string[];
|
|
104
|
+
}, undefined, TVConfig<{
|
|
105
|
+
variant: {
|
|
106
|
+
default: {
|
|
107
|
+
textarea: string;
|
|
108
|
+
};
|
|
109
|
+
beta: {
|
|
110
|
+
root: string;
|
|
111
|
+
textarea: string;
|
|
112
|
+
};
|
|
113
|
+
};
|
|
114
|
+
size: {
|
|
115
|
+
sm: {
|
|
116
|
+
textarea: string;
|
|
117
|
+
};
|
|
118
|
+
base: {
|
|
119
|
+
textarea: string;
|
|
120
|
+
};
|
|
121
|
+
};
|
|
122
|
+
}, {
|
|
123
|
+
variant: {
|
|
124
|
+
default: {
|
|
125
|
+
textarea: string;
|
|
126
|
+
};
|
|
127
|
+
beta: {
|
|
128
|
+
root: string;
|
|
129
|
+
textarea: string;
|
|
130
|
+
};
|
|
131
|
+
};
|
|
132
|
+
size: {
|
|
133
|
+
sm: {
|
|
134
|
+
textarea: string;
|
|
135
|
+
};
|
|
136
|
+
base: {
|
|
137
|
+
textarea: string;
|
|
138
|
+
};
|
|
139
|
+
};
|
|
140
|
+
}>, unknown, unknown, undefined>>> & React.RefAttributes<HTMLTextAreaElement>>;
|
|
4
141
|
export { Textarea };
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import { ElementType } from 'react';
|
|
2
|
+
import { ComponentConfig } from '../types';
|
|
3
|
+
|
|
4
|
+
export declare const Inputs: Map<string, ComponentConfig>;
|
|
3
5
|
export declare const Containers: Map<string, ElementType>;
|
|
4
6
|
export declare const components: Map<string, ElementType>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { FieldValues } from 'react-hook-form';
|
|
1
2
|
import { ForwardRefExoticComponent, ReactNode, RefAttributes } from 'react';
|
|
2
|
-
|
|
3
|
-
import type { FieldValues } from 'react-hook-form';
|
|
3
|
+
|
|
4
4
|
export declare const TwintagForm: ForwardRefExoticComponent<{
|
|
5
5
|
defaultValues?: FieldValues | undefined;
|
|
6
6
|
resetOnSubmit?: boolean | undefined;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { RawJsonComponent, TwintagFormContext, ComponentConfig } from '../types';
|
|
2
|
+
import { WithChildren } from 'twintag-types/dom';
|
|
3
|
+
import { Context, ElementType, ReactNode } 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: RawJsonComponent | RawJsonComponent[], inputs: Map<string, ComponentConfig>) => {
|
|
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: Map<string, ComponentConfig>;
|
|
17
|
+
components: Map<string, ElementType>;
|
|
18
|
+
} & {
|
|
19
|
+
children?: ReactNode;
|
|
20
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const JsonRenderer: () => import("react/jsx-runtime").JSX.Element;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import { ForwardRefExoticComponent, RefAttributes
|
|
2
|
-
import
|
|
1
|
+
import { ComponentProps, ForwardRefExoticComponent, RefAttributes } from 'react';
|
|
2
|
+
import { RawJsonComponent } from './types';
|
|
3
3
|
import { TwintagForm } from './components/form';
|
|
4
|
-
import { TwintagFormProvider } from './provider';
|
|
4
|
+
import { TwintagFormProvider } from './components/provider';
|
|
5
|
+
|
|
5
6
|
type Props = {
|
|
6
7
|
config: RawJsonComponent[];
|
|
7
8
|
options?: Partial<{
|
|
8
9
|
defaultValues?: ComponentProps<typeof TwintagForm>['defaultValues'];
|
|
9
10
|
variant?: ComponentProps<typeof TwintagFormProvider>['variant'];
|
|
11
|
+
size?: ComponentProps<typeof TwintagFormProvider>['size'];
|
|
10
12
|
resetOnSubmit?: boolean;
|
|
11
13
|
}>;
|
|
12
14
|
};
|