@twintag/twintag-form 1.4.0-beta.1 → 1.4.0-beta.3

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 (34) hide show
  1. package/.turbo/turbo-build.log +4 -4
  2. package/CHANGELOG.md +12 -0
  3. package/README.md +8 -4
  4. package/dev/main.tsx +453 -233
  5. package/dist/components/config.d.ts +2 -2
  6. package/dist/components/containers/accordion.d.ts +2 -4
  7. package/dist/components/fields/checkbox.d.ts +1 -1
  8. package/dist/components/fields/date-picker.d.ts +1 -1
  9. package/dist/components/fields/file.d.ts +1 -1
  10. package/dist/components/fields/input.d.ts +1 -1
  11. package/dist/components/fields/radiogroup.d.ts +3 -1
  12. package/dist/components/fields/textarea.d.ts +1 -1
  13. package/dist/components/fields/toggle.d.ts +1 -1
  14. package/dist/components/fields/tri-toggle.d.ts +1 -1
  15. package/dist/components/provider.d.ts +3 -3
  16. package/dist/twintag-form.react.js +1637 -1624
  17. package/dist/types/index.d.ts +37 -22
  18. package/dist/utils/data.d.ts +5 -1
  19. package/index.html +1 -0
  20. package/lib/components/config.tsx +2 -2
  21. package/lib/components/containers/accordion.tsx +33 -14
  22. package/lib/components/fields/checkbox.tsx +1 -1
  23. package/lib/components/fields/date-picker.tsx +5 -1
  24. package/lib/components/fields/file.tsx +83 -83
  25. package/lib/components/fields/input.tsx +1 -1
  26. package/lib/components/fields/radiogroup.tsx +5 -1
  27. package/lib/components/fields/textarea.tsx +1 -1
  28. package/lib/components/fields/toggle.tsx +1 -1
  29. package/lib/components/fields/tri-toggle.tsx +1 -1
  30. package/lib/components/provider.tsx +163 -159
  31. package/lib/index.tsx +41 -41
  32. package/lib/types/index.ts +82 -49
  33. package/lib/utils/data.ts +5 -2
  34. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
1
  import { ElementType } from 'react';
2
- import { ComponentConfig } from '../types';
2
+ import { InputCompConfig } from '../types';
3
3
 
4
- export declare const Inputs: Map<string, ComponentConfig>;
4
+ export declare const Inputs: Map<string, InputCompConfig>;
5
5
  export declare const Containers: Map<string, ElementType>;
6
6
  export declare const components: Map<string, ElementType>;
@@ -1,9 +1,7 @@
1
+ import { Props } from '../../types';
1
2
  import { WithChildren } from 'twintag-types/dom';
2
3
  import { FC } from 'react';
3
4
 
4
- type AccordionProps = {
5
- subtype?: 'item' | 'multiple' | 'single';
6
- label?: string;
7
- } & WithChildren;
5
+ type AccordionProps = Props<'accordion', 'item' | 'multiple' | 'single'> & WithChildren;
8
6
  declare const Accordion: FC<AccordionProps>;
9
7
  export { Accordion };
@@ -2,4 +2,4 @@ import { FC } from 'react';
2
2
  import { Props } from '../../types';
3
3
 
4
4
  export declare const DEFAULT_CHECKBOX_VALUE = false;
5
- export declare const Checkbox: FC<Props>;
5
+ export declare const Checkbox: FC<Props<'input'>>;
@@ -2,4 +2,4 @@ import { Props } from '../../types';
2
2
 
3
3
  import * as React from 'react';
4
4
  export declare const DEFAULT_DATE_PICKER_VALUE: null;
5
- export declare const DatePicker: React.FC<Props>;
5
+ export declare const DatePicker: React.FC<Props<'input'>>;
@@ -2,4 +2,4 @@ import { FC } from 'react';
2
2
  import { Props } from '../../types';
3
3
 
4
4
  export declare const DEFAULT_FILE_VALUE = "";
5
- export declare const File: FC<Props>;
5
+ export declare const File: FC<Props<'input'>>;
@@ -2,4 +2,4 @@ import { FC } from 'react';
2
2
  import { Props } from '../../types';
3
3
 
4
4
  export declare const DEFAULT_INPUT_VALUE = "";
5
- export declare const Input: FC<Props>;
5
+ export declare const Input: FC<Props<'input'>>;
@@ -2,4 +2,6 @@ import { FC } from 'react';
2
2
  import { Props } from '../../types';
3
3
 
4
4
  export declare const DEFAULT_RADIOGROUP_VALUE = "";
5
- export declare const RadioGroup: FC<Props>;
5
+ export declare const RadioGroup: FC<Props<'input'> & {
6
+ items: Props<'input'>[];
7
+ }>;
@@ -2,4 +2,4 @@ import { FC } from 'react';
2
2
  import { Props } from '../../types';
3
3
 
4
4
  export declare const DEFAULT_TEXTAREA_VALUE = "";
5
- export declare const Textarea: FC<Props>;
5
+ export declare const Textarea: FC<Props<'input'>>;
@@ -2,4 +2,4 @@ import { FC } from 'react';
2
2
  import { Props } from '../../types';
3
3
 
4
4
  export declare const DEFAULT_TOGGLE_VALUE = false;
5
- export declare const Toggle: FC<Props>;
5
+ export declare const Toggle: FC<Props<'input'>>;
@@ -2,4 +2,4 @@ import { FC } from 'react';
2
2
  import { Props } from '../../types';
3
3
 
4
4
  export declare const DEFAULT_TRI_TOGGLE_VALUE: null;
5
- export declare const TriToggle: FC<Props>;
5
+ export declare const TriToggle: FC<Props<'input'>>;
@@ -1,4 +1,4 @@
1
- import { RawJsonComponent, TwintagFormContext, ComponentConfig } from '../types';
1
+ import { ParsedJsonComponent, RawJsonComponent, TwintagFormContext, InputCompConfig } from '../types';
2
2
  import { WithChildren } from 'twintag-types/dom';
3
3
  import { Context, ElementType, ReactNode } from 'react';
4
4
 
@@ -6,14 +6,14 @@ export declare const twintagFormContext: Context<TwintagFormContext>;
6
6
  export declare const useTwintagForm: () => TwintagFormContext;
7
7
  type Components = TwintagFormContext['components'];
8
8
  type Inputs = TwintagFormContext['inputs'];
9
- export declare const getResetValues: (config: RawJsonComponent | RawJsonComponent[], inputs: Map<string, ComponentConfig>) => {
9
+ export declare const getResetValues: (config: ParsedJsonComponent | ParsedJsonComponent[], inputs: Map<string, InputCompConfig>) => {
10
10
  [k: string]: unknown;
11
11
  };
12
12
  export declare const TwintagFormProvider: ({ variant, size, inputs, components, config, children, }: {
13
13
  config: RawJsonComponent | RawJsonComponent[];
14
14
  variant: TwintagFormContext['variant'];
15
15
  size: TwintagFormContext['size'];
16
- inputs: Map<string, ComponentConfig>;
16
+ inputs: Map<string, InputCompConfig>;
17
17
  components: Map<string, ElementType>;
18
18
  } & {
19
19
  children?: ReactNode;