@twintag/twintag-form 1.4.0-beta.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 +6 -0
- package/README.md +121 -62
- package/dev/main.tsx +233 -209
- package/dist/common/button.d.ts +3 -2
- package/dist/common/calendar.d.ts +4 -4
- package/dist/common/form.d.ts +11 -11
- package/dist/common/icon.d.ts +2 -1
- package/dist/common/input.d.ts +3 -2
- package/dist/common/label.d.ts +3 -2
- package/dist/common/slider.d.ts +4 -0
- package/dist/common/textarea.d.ts +3 -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 +4 -3
- package/dist/twintag-form.react.js +12828 -12261
- package/dist/types/index.d.ts +25 -17
- package/dist/utils/data.d.ts +2 -1
- package/dist/utils/style.d.ts +2 -1
- package/index.html +5 -3
- package/lib/common/slider.tsx +38 -0
- package/lib/components/config.tsx +46 -17
- package/lib/components/containers/accordion.tsx +1 -1
- package/lib/components/containers/category.tsx +1 -1
- package/lib/components/fields/checkbox.tsx +4 -2
- package/lib/components/fields/date-picker.tsx +4 -1
- package/lib/components/fields/file.tsx +83 -82
- package/lib/components/fields/input.tsx +4 -2
- package/lib/components/fields/radiogroup.tsx +4 -2
- package/lib/components/fields/submit.tsx +1 -1
- package/lib/components/fields/textarea.tsx +4 -2
- package/lib/components/fields/toggle.tsx +4 -2
- 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 -41
- package/lib/types/index.ts +49 -40
- package/package.json +7 -9
- 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 -39
|
@@ -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,7 +1,8 @@
|
|
|
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<{
|