@twintag/twintag-form 0.1.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/.eslintrc.cjs +4 -0
  2. package/.turbo/turbo-build.log +50 -0
  3. package/CHANGELOG.md +7 -0
  4. package/dist/index.es.js +27356 -0
  5. package/dist/index.umd.js +196 -0
  6. package/dist/lib/components/Form/index.d.ts +10 -0
  7. package/dist/lib/components/Form/index.d.ts.map +1 -0
  8. package/dist/lib/components/Form/register.d.ts +13 -0
  9. package/dist/lib/components/Form/register.d.ts.map +1 -0
  10. package/dist/lib/components/Input/checkbox.d.ts +8 -0
  11. package/dist/lib/components/Input/checkbox.d.ts.map +1 -0
  12. package/dist/lib/components/Input/file.d.ts +8 -0
  13. package/dist/lib/components/Input/file.d.ts.map +1 -0
  14. package/dist/lib/components/Input/index.d.ts +8 -0
  15. package/dist/lib/components/Input/index.d.ts.map +1 -0
  16. package/dist/lib/components/Input/simple.d.ts +8 -0
  17. package/dist/lib/components/Input/simple.d.ts.map +1 -0
  18. package/dist/lib/components/Input/submit.d.ts +8 -0
  19. package/dist/lib/components/Input/submit.d.ts.map +1 -0
  20. package/dist/lib/components/Input/textarea.d.ts +8 -0
  21. package/dist/lib/components/Input/textarea.d.ts.map +1 -0
  22. package/dist/lib/components/Input/toggle.d.ts +8 -0
  23. package/dist/lib/components/Input/toggle.d.ts.map +1 -0
  24. package/dist/lib/index.d.ts +18 -0
  25. package/dist/lib/index.d.ts.map +1 -0
  26. package/dist/lib/styles.d.ts +120 -0
  27. package/dist/lib/styles.d.ts.map +1 -0
  28. package/dist/lib/types/index.d.ts +16 -0
  29. package/dist/lib/types/index.d.ts.map +1 -0
  30. package/dist/lib/webcomponent.d.ts +2 -0
  31. package/dist/lib/webcomponent.d.ts.map +1 -0
  32. package/dist/twind.config.d.ts +5 -0
  33. package/dist/twind.config.d.ts.map +1 -0
  34. package/dist/webcomponent.es.js +31725 -0
  35. package/dist/webcomponent.umd.js +196 -0
  36. package/lib/components/Form/index.tsx +86 -0
  37. package/lib/components/Form/register.tsx +70 -0
  38. package/lib/components/Input/checkbox.tsx +50 -0
  39. package/lib/components/Input/file.tsx +76 -0
  40. package/lib/components/Input/index.tsx +30 -0
  41. package/lib/components/Input/simple.tsx +41 -0
  42. package/lib/components/Input/submit.tsx +24 -0
  43. package/lib/components/Input/textarea.tsx +36 -0
  44. package/lib/components/Input/toggle.tsx +50 -0
  45. package/lib/index.tsx +173 -0
  46. package/lib/styles.ts +116 -0
  47. package/lib/types/index.ts +16 -0
  48. package/lib/webcomponent.ts +20 -0
  49. package/package.json +56 -0
  50. package/scripts/build.js +55 -0
  51. package/tailwind.config.cjs +8 -0
  52. package/tsconfig.json +13 -0
  53. package/twind.config.ts +22 -0
@@ -0,0 +1,10 @@
1
+ /// <reference types="react" />
2
+ import type { WithChildren } from 'twintag-types/dom';
3
+ type Props = {
4
+ options?: {
5
+ resetOnSubmit?: boolean;
6
+ };
7
+ } & WithChildren;
8
+ declare const Form: ({ children, options }: Props) => JSX.Element;
9
+ export default Form;
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../lib/components/Form/index.tsx"],"names":[],"mappings":";AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAOtD,KAAK,KAAK,GAAG;IACX,OAAO,CAAC,EAAE;QACR,aAAa,CAAC,EAAE,OAAO,CAAC;KACzB,CAAC;CACH,GAAG,YAAY,CAAC;AAEjB,QAAA,MAAM,IAAI,0BAA2B,KAAK,gBAqEzC,CAAC;AAEF,eAAe,IAAI,CAAC"}
@@ -0,0 +1,13 @@
1
+ /// <reference types="react" />
2
+ import type { UseFormRegister, Control } from 'react-hook-form';
3
+ import type { WithChildren } from 'twintag-types/dom';
4
+ declare const RegisterInputs: ({ children, useForm, }: {
5
+ useForm: {
6
+ register: UseFormRegister<any>;
7
+ control: Control;
8
+ };
9
+ } & {
10
+ children?: import("react").ReactNode;
11
+ }) => any;
12
+ export { RegisterInputs };
13
+ //# sourceMappingURL=register.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../../../lib/components/Form/register.tsx"],"names":[],"mappings":";AACA,OAAO,KAAK,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAChE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAMtD,QAAA,MAAM,cAAc;aAIT;QAAE,QAAQ,EAAE,gBAAgB,GAAG,CAAC,CAAC;QAAC,OAAO,EAAE,OAAO,CAAA;KAAE;;;SAuD9D,CAAC;AAEF,OAAO,EAAE,cAAc,EAAE,CAAC"}
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ import type { VariantProps } from 'tailwind-variants';
3
+ import type { CommonProps } from '@/types';
4
+ import { checkboxStyle } from '@/styles';
5
+ type Props = CommonProps<VariantProps<typeof checkboxStyle>['variant']>;
6
+ declare const Checkbox: ({ useForm, label, bind, options }: Props) => JSX.Element;
7
+ export default Checkbox;
8
+ //# sourceMappingURL=checkbox.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checkbox.d.ts","sourceRoot":"","sources":["../../../../lib/components/Input/checkbox.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAOtD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE3C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,KAAK,KAAK,GAAG,WAAW,CAAC,YAAY,CAAC,OAAO,aAAa,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC;AAExE,QAAA,MAAM,QAAQ,sCAAuC,KAAK,gBAkCzD,CAAC;AAEF,eAAe,QAAQ,CAAC"}
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ import type { VariantProps } from 'tailwind-variants';
3
+ import type { CommonProps } from '@/types';
4
+ import { fileStyle } from '@/styles';
5
+ type Props = CommonProps<VariantProps<typeof fileStyle>['variant']>;
6
+ declare const File: ({ useForm, label, bind, options }: Props) => JSX.Element;
7
+ export default File;
8
+ //# sourceMappingURL=file.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file.d.ts","sourceRoot":"","sources":["../../../../lib/components/Input/file.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAMtD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE3C,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAErC,KAAK,KAAK,GAAG,WAAW,CAAC,YAAY,CAAC,OAAO,SAAS,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC;AAEpE,QAAA,MAAM,IAAI,sCAAuC,KAAK,gBA6DrD,CAAC;AAEF,eAAe,IAAI,CAAC"}
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ export declare const Inputs: Map<any, any>;
3
+ type Props = {
4
+ subtype?: string;
5
+ };
6
+ declare const Input: ({ subtype, ...rest }: Props) => JSX.Element;
7
+ export default Input;
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../lib/components/Input/index.tsx"],"names":[],"mappings":";AASA,eAAO,MAAM,MAAM,eAMS,CAAC;AAE7B,KAAK,KAAK,GAAG;IACX,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,QAAA,MAAM,KAAK,yBAAqC,KAAK,gBAMpD,CAAC;AAEF,eAAe,KAAK,CAAC"}
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ import type { VariantProps } from 'tailwind-variants';
3
+ import type { CommonProps } from '@/types';
4
+ import { simpleStyle } from '@/styles';
5
+ type Props = CommonProps<VariantProps<typeof simpleStyle>['variant']>;
6
+ declare const Simple: ({ useForm, label, bind, options }: Props) => JSX.Element;
7
+ export default Simple;
8
+ //# sourceMappingURL=simple.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"simple.d.ts","sourceRoot":"","sources":["../../../../lib/components/Input/simple.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAItD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE3C,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAEvC,KAAK,KAAK,GAAG,WAAW,CAAC,YAAY,CAAC,OAAO,WAAW,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC;AAEtE,QAAA,MAAM,MAAM,sCAAuC,KAAK,gBA4BvD,CAAC;AAEF,eAAe,MAAM,CAAC"}
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ import type { VariantProps } from 'tailwind-variants';
3
+ import type { CommonProps } from '@/types';
4
+ import { submitStyle } from '@/styles';
5
+ type Props = CommonProps<VariantProps<typeof submitStyle>['variant']>;
6
+ declare const Submit: ({ label, options }: Props) => JSX.Element;
7
+ export default Submit;
8
+ //# sourceMappingURL=submit.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"submit.d.ts","sourceRoot":"","sources":["../../../../lib/components/Input/submit.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAItD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE3C,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAEvC,KAAK,KAAK,GAAG,WAAW,CAAC,YAAY,CAAC,OAAO,WAAW,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC;AAEtE,QAAA,MAAM,MAAM,uBAAwB,KAAK,gBAWxC,CAAC;AAEF,eAAe,MAAM,CAAC"}
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ import type { VariantProps } from 'tailwind-variants';
3
+ import type { CommonProps } from '@/types';
4
+ import { simpleStyle } from '@/styles';
5
+ type Props = CommonProps<VariantProps<typeof simpleStyle>['variant']>;
6
+ declare const Textarea: ({ useForm, label, bind, options }: Props) => JSX.Element;
7
+ export default Textarea;
8
+ //# sourceMappingURL=textarea.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"textarea.d.ts","sourceRoot":"","sources":["../../../../lib/components/Input/textarea.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAItD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE3C,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAEvC,KAAK,KAAK,GAAG,WAAW,CAAC,YAAY,CAAC,OAAO,WAAW,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC;AAEtE,QAAA,MAAM,QAAQ,sCAAuC,KAAK,gBAuBzD,CAAC;AAEF,eAAe,QAAQ,CAAC"}
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ import type { VariantProps } from 'tailwind-variants';
3
+ import type { CommonProps } from '@/types';
4
+ import { toggleStyle } from '@/styles';
5
+ type Props = CommonProps<VariantProps<typeof toggleStyle>['variant']>;
6
+ declare const Toggle: ({ useForm, label, bind, options }: Props) => JSX.Element;
7
+ export default Toggle;
8
+ //# sourceMappingURL=toggle.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"toggle.d.ts","sourceRoot":"","sources":["../../../../lib/components/Input/toggle.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAMtD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE3C,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAEvC,KAAK,KAAK,GAAG,WAAW,CAAC,YAAY,CAAC,OAAO,WAAW,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC;AAEtE,QAAA,MAAM,MAAM,sCAAuC,KAAK,gBAmCvD,CAAC;AAEF,eAAe,MAAM,CAAC"}
@@ -0,0 +1,18 @@
1
+ import type { ReactNode } from 'react';
2
+ type Component = {
3
+ subtype?: string;
4
+ label?: string;
5
+ bind?: string;
6
+ children?: ReactNode;
7
+ options?: Record<string, any>;
8
+ };
9
+ type Props = {
10
+ config: Component[];
11
+ options?: {
12
+ variant?: string;
13
+ resetOnSubmit?: boolean;
14
+ };
15
+ };
16
+ declare const TwintagForm: ({ config, options }: Props) => JSX.Element;
17
+ export default TwintagForm;
18
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../lib/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAM,SAAS,EAAE,MAAM,OAAO,CAAC;AAiB3C,KAAK,SAAS,GAAG;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC/B,CAAC;AA+HF,KAAK,KAAK,GAAG;IACX,MAAM,EAAE,SAAS,EAAE,CAAC;IACpB,OAAO,CAAC,EAAE;QACR,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,aAAa,CAAC,EAAE,OAAO,CAAC;KACzB,CAAC;CACH,CAAC;AAEF,QAAA,MAAM,WAAW,wBAAyB,KAAK,gBAY9C,CAAC;AAEF,eAAe,WAAW,CAAC"}
@@ -0,0 +1,120 @@
1
+ export declare const checkboxStyle: import("tailwind-variants").TVReturnType<{
2
+ variant: {
3
+ alpha: {
4
+ checkbox: string;
5
+ };
6
+ beta: {
7
+ checkbox: string;
8
+ };
9
+ };
10
+ }, unknown, {
11
+ container: string;
12
+ checkbox: string;
13
+ }, undefined, undefined, import("tailwind-variants/dist/config").TVConfig<{
14
+ variant: {
15
+ alpha: {
16
+ checkbox: string;
17
+ };
18
+ beta: {
19
+ checkbox: string;
20
+ };
21
+ };
22
+ }, unknown>>;
23
+ export declare const fileStyle: import("tailwind-variants").TVReturnType<{
24
+ variant: {
25
+ alpha: {
26
+ container: string;
27
+ input: string;
28
+ };
29
+ beta: {
30
+ container: string;
31
+ input: string;
32
+ };
33
+ };
34
+ }, unknown, {
35
+ container: string;
36
+ span: string;
37
+ input: string;
38
+ }, undefined, undefined, import("tailwind-variants/dist/config").TVConfig<{
39
+ variant: {
40
+ alpha: {
41
+ container: string;
42
+ input: string;
43
+ };
44
+ beta: {
45
+ container: string;
46
+ input: string;
47
+ };
48
+ };
49
+ }, unknown>>;
50
+ export declare const simpleStyle: import("tailwind-variants").TVReturnType<{
51
+ variant: {
52
+ alpha: {
53
+ container: string;
54
+ input: string;
55
+ };
56
+ beta: {
57
+ container: string;
58
+ input: string;
59
+ };
60
+ };
61
+ }, unknown, {
62
+ container: string;
63
+ span: string;
64
+ input: string;
65
+ }, undefined, undefined, import("tailwind-variants/dist/config").TVConfig<{
66
+ variant: {
67
+ alpha: {
68
+ container: string;
69
+ input: string;
70
+ };
71
+ beta: {
72
+ container: string;
73
+ input: string;
74
+ };
75
+ };
76
+ }, unknown>>;
77
+ export declare const submitStyle: import("tailwind-variants").TVReturnType<{
78
+ variant: {
79
+ alpha: string;
80
+ beta: string;
81
+ };
82
+ }, unknown, undefined, undefined, "w-max max-w-full", import("tailwind-variants/dist/config").TVConfig<{
83
+ variant: {
84
+ alpha: string;
85
+ beta: string;
86
+ };
87
+ }, unknown>>;
88
+ export declare const toggleStyle: import("tailwind-variants").TVReturnType<{
89
+ variant: {
90
+ alpha: {
91
+ container: string;
92
+ input: string;
93
+ thumb: string;
94
+ };
95
+ beta: {
96
+ container: string;
97
+ input: string;
98
+ thumb: string;
99
+ };
100
+ };
101
+ }, unknown, {
102
+ container: string;
103
+ span: string;
104
+ input: string;
105
+ thumb: string;
106
+ }, undefined, undefined, import("tailwind-variants/dist/config").TVConfig<{
107
+ variant: {
108
+ alpha: {
109
+ container: string;
110
+ input: string;
111
+ thumb: string;
112
+ };
113
+ beta: {
114
+ container: string;
115
+ input: string;
116
+ thumb: string;
117
+ };
118
+ };
119
+ }, unknown>>;
120
+ //# sourceMappingURL=styles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../lib/styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;YAmBxB,CAAC;AAEH,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;YAwBpB,CAAC;AAEH,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;YAuBtB,CAAC;AAEH,eAAO,MAAM,WAAW;;;;;;;;;;YAWtB,CAAC;AAEH,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YA4BtB,CAAC"}
@@ -0,0 +1,16 @@
1
+ import type { UseFormRegister, Control } from 'react-hook-form';
2
+ import type { Label } from 'twintag-types/dom';
3
+ export type CommonProps<TVariant> = {
4
+ label: Label;
5
+ bind?: Label;
6
+ useForm?: {
7
+ register: UseFormRegister<any>;
8
+ control: Control;
9
+ };
10
+ checked?: boolean;
11
+ options?: {
12
+ variant?: TVariant;
13
+ optionalField?: boolean;
14
+ };
15
+ };
16
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAChE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAE/C,MAAM,MAAM,WAAW,CAAC,QAAQ,IAAI;IAClC,KAAK,EAAE,KAAK,CAAC;IACb,IAAI,CAAC,EAAE,KAAK,CAAC;IACb,OAAO,CAAC,EAAE;QACR,QAAQ,EAAE,eAAe,CAAC,GAAG,CAAC,CAAC;QAC/B,OAAO,EAAE,OAAO,CAAC;KAClB,CAAC;IACF,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE;QACR,OAAO,CAAC,EAAE,QAAQ,CAAC;QACnB,aAAa,CAAC,EAAE,OAAO,CAAC;KACzB,CAAC;CACH,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=webcomponent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webcomponent.d.ts","sourceRoot":"","sources":["../../lib/webcomponent.ts"],"names":[],"mappings":""}
@@ -0,0 +1,5 @@
1
+ declare const _default: import("@twind/core").TwindConfig<import("@twind/core").BaseTheme & import("@twind/preset-tailwind").TailwindTheme & import("@twind/preset-typography").TypographyTheme & {
2
+ extend: never;
3
+ }>;
4
+ export default _default;
5
+ //# sourceMappingURL=twind.config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"twind.config.d.ts","sourceRoot":"","sources":["../twind.config.ts"],"names":[],"mappings":";;;AAMA,wBAeG"}