@twintag/twintag-form 0.5.0 → 0.6.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.
- package/.eslintrc.cjs +1 -1
- package/.turbo/turbo-build.log +7 -7
- package/CHANGELOG.md +11 -0
- package/dist/components/Category/__styles.d.ts +11 -1
- package/dist/components/Form/index.d.ts +1 -1
- package/dist/components/Input/__styles.d.ts +236 -21
- package/dist/index.d.ts +1 -1
- package/dist/styles.d.ts +247 -22
- package/dist/twintag-form.react.js +3757 -3689
- package/dist/twintag-form.webcomponent.js +119 -119
- package/lib/__stories__/Form.stories.tsx +3 -3
- package/lib/components/Form/index.tsx +1 -1
- package/lib/components/Input/__styles.ts +16 -16
- package/lib/components/Input/checkbox.tsx +1 -1
- package/lib/components/Input/file.tsx +1 -1
- package/lib/components/Input/simple.tsx +1 -1
- package/lib/components/Input/textarea.tsx +1 -1
- package/lib/components/Input/toggle.tsx +1 -1
- package/lib/components/Label/index.tsx +1 -1
- package/lib/index.tsx +4 -4
- package/lib/styles.ts +18 -18
- package/lib/webcomponent.ts +3 -3
- package/package.json +7 -7
- package/tsconfig.json +12 -4
- package/twind.config.ts +7 -7
- package/vite.config.ts +1 -1
|
@@ -4,7 +4,7 @@ import type { VariantProps } from 'tailwind-variants';
|
|
|
4
4
|
import { useController, useFormContext } from 'react-hook-form';
|
|
5
5
|
import { CloudArrowUpIcon } from '@heroicons/react/24/outline';
|
|
6
6
|
|
|
7
|
-
import { Label } from '@twintag-form/components';
|
|
7
|
+
import { Label } from '@twintag/twintag-form/components';
|
|
8
8
|
import { type CommonProps } from './__props';
|
|
9
9
|
import { fileStyle } from './__styles';
|
|
10
10
|
|
|
@@ -3,7 +3,7 @@ import type { VariantProps } from 'tailwind-variants';
|
|
|
3
3
|
|
|
4
4
|
import { useFormContext } from 'react-hook-form';
|
|
5
5
|
|
|
6
|
-
import { Label } from '@twintag-form/components';
|
|
6
|
+
import { Label } from '@twintag/twintag-form/components';
|
|
7
7
|
import { type CommonProps } from './__props';
|
|
8
8
|
import { simpleStyle } from './__styles';
|
|
9
9
|
|
|
@@ -3,7 +3,7 @@ import type { VariantProps } from 'tailwind-variants';
|
|
|
3
3
|
|
|
4
4
|
import { useFormContext } from 'react-hook-form';
|
|
5
5
|
|
|
6
|
-
import { Label } from '@twintag-form/components';
|
|
6
|
+
import { Label } from '@twintag/twintag-form/components';
|
|
7
7
|
import { type CommonProps } from './__props';
|
|
8
8
|
import { simpleStyle } from './__styles';
|
|
9
9
|
|
|
@@ -4,7 +4,7 @@ import type { VariantProps } from 'tailwind-variants';
|
|
|
4
4
|
import { useController, useFormContext } from 'react-hook-form';
|
|
5
5
|
import * as Switch from '@radix-ui/react-switch';
|
|
6
6
|
|
|
7
|
-
import { Label } from '@twintag-form/components';
|
|
7
|
+
import { Label } from '@twintag/twintag-form/components';
|
|
8
8
|
import { type CommonProps } from './__props';
|
|
9
9
|
import { toggleStyle } from './__styles';
|
|
10
10
|
|
package/lib/index.tsx
CHANGED
|
@@ -3,9 +3,9 @@ import type { RawJsonComponent } from '@twintag/twintag-json-renderer/types';
|
|
|
3
3
|
|
|
4
4
|
import { forwardRef } from 'react';
|
|
5
5
|
|
|
6
|
-
import Form from '@twintag-form
|
|
7
|
-
import Input from '@twintag-form
|
|
8
|
-
import Category from '@twintag-form
|
|
6
|
+
import Form from '@twintag/twintag-form//components/Form';
|
|
7
|
+
import Input from '@twintag/twintag-form//components/Input';
|
|
8
|
+
import Category from '@twintag/twintag-form//components/Category';
|
|
9
9
|
|
|
10
10
|
import {
|
|
11
11
|
TwintagJsonRenderer,
|
|
@@ -52,5 +52,5 @@ export const TwintagForm = forwardRef(
|
|
|
52
52
|
</Form>
|
|
53
53
|
</TwintagJsonRegisterProvider>
|
|
54
54
|
);
|
|
55
|
-
}
|
|
55
|
+
},
|
|
56
56
|
);
|
package/lib/styles.ts
CHANGED
|
@@ -10,9 +10,9 @@ export const containerStyle = tv({
|
|
|
10
10
|
|
|
11
11
|
export const categoryStyle = tv({
|
|
12
12
|
slots: {
|
|
13
|
-
container: '
|
|
13
|
+
container: 'mt-4 grid w-full first:mt-0',
|
|
14
14
|
span: 'text-category-label',
|
|
15
|
-
items: '
|
|
15
|
+
items: 'mb-4 mt-2 grid empty:mb-0',
|
|
16
16
|
},
|
|
17
17
|
variants: {
|
|
18
18
|
variant: {},
|
|
@@ -22,10 +22,10 @@ export const categoryStyle = tv({
|
|
|
22
22
|
export const checkboxStyle = tv({
|
|
23
23
|
slots: {
|
|
24
24
|
container: containerStyle({
|
|
25
|
-
className: 'flex
|
|
25
|
+
className: 'flex w-full items-center gap-4',
|
|
26
26
|
}),
|
|
27
27
|
checkbox:
|
|
28
|
-
'flex appearance-none items-center justify-center bg-white outline-none ring-0
|
|
28
|
+
'border-primary focus:border-accent flex appearance-none items-center justify-center border-2 bg-white outline-none ring-0 focus:ring-0',
|
|
29
29
|
},
|
|
30
30
|
variants: {
|
|
31
31
|
variant: {
|
|
@@ -45,23 +45,23 @@ export const checkboxStyle = tv({
|
|
|
45
45
|
export const fileStyle = tv({
|
|
46
46
|
slots: {
|
|
47
47
|
container: containerStyle({
|
|
48
|
-
className: 'w-full
|
|
48
|
+
className: 'block w-full',
|
|
49
49
|
}),
|
|
50
50
|
span: '',
|
|
51
51
|
input:
|
|
52
|
-
'w-full cursor-pointer ring-0 focus:ring-0
|
|
52
|
+
'w-full cursor-pointer border-2 border-transparent ring-0 focus:ring-0',
|
|
53
53
|
},
|
|
54
54
|
variants: {
|
|
55
55
|
variant: {
|
|
56
56
|
alpha: {
|
|
57
57
|
container: 'grid gap-1.5',
|
|
58
58
|
input:
|
|
59
|
-
'flex items-center justify-between gap-4 rounded-md
|
|
59
|
+
'peer-focus:border-accent flex items-center justify-between gap-4 rounded-md border-slate-700/10 px-3 py-2',
|
|
60
60
|
},
|
|
61
61
|
beta: {
|
|
62
62
|
container: 'grid gap-0',
|
|
63
63
|
input:
|
|
64
|
-
'flex items-center justify-between gap-4
|
|
64
|
+
'peer-focus:border-b-accent flex items-center justify-between gap-4 border-b-slate-700/10 py-2',
|
|
65
65
|
},
|
|
66
66
|
},
|
|
67
67
|
},
|
|
@@ -77,18 +77,18 @@ export const simpleStyle = tv({
|
|
|
77
77
|
}),
|
|
78
78
|
span: '',
|
|
79
79
|
input:
|
|
80
|
-
'
|
|
80
|
+
'placeholder:text-placeholder text-input w-full border-2 border-transparent ring-0 focus:ring-0',
|
|
81
81
|
},
|
|
82
82
|
variants: {
|
|
83
83
|
variant: {
|
|
84
84
|
alpha: {
|
|
85
85
|
container: 'grid gap-1.5',
|
|
86
|
-
input: 'rounded-md border-slate-700/10
|
|
86
|
+
input: 'focus:border-accent rounded-md border-slate-700/10',
|
|
87
87
|
},
|
|
88
88
|
beta: {
|
|
89
89
|
container: 'grid gap-0',
|
|
90
90
|
input:
|
|
91
|
-
'
|
|
91
|
+
'focus:border-b-accent border-b-slate-700/10 px-0 focus:border-transparent',
|
|
92
92
|
},
|
|
93
93
|
},
|
|
94
94
|
},
|
|
@@ -111,16 +111,16 @@ export const toggleStyle = tv({
|
|
|
111
111
|
alpha: {
|
|
112
112
|
container: 'flex justify-between',
|
|
113
113
|
input:
|
|
114
|
-
'h-6 w-9 rounded-full
|
|
114
|
+
'bg-primary focus:ring-accent h-6 w-9 rounded-full border border-black ring-2 focus:border-transparent data-[state=checked]:bg-white',
|
|
115
115
|
thumb:
|
|
116
|
-
'h-4 w-4 translate-x-0.5 rounded-full bg-white data-[state=checked]:translate-x-4
|
|
116
|
+
'data-[state=checked]:bg-primary h-4 w-4 translate-x-0.5 rounded-full bg-white data-[state=checked]:translate-x-4',
|
|
117
117
|
},
|
|
118
118
|
beta: {
|
|
119
119
|
container: 'flex justify-between',
|
|
120
120
|
input:
|
|
121
|
-
'h-6 w-9 rounded-full
|
|
121
|
+
'bg-primary focus:ring-accent h-6 w-9 rounded-full border border-black ring-2 focus:border-transparent data-[state=checked]:bg-white',
|
|
122
122
|
thumb:
|
|
123
|
-
'h-4 w-4 translate-x-0.5 rounded-full bg-white data-[state=checked]:translate-x-4
|
|
123
|
+
'data-[state=checked]:bg-primary h-4 w-4 translate-x-0.5 rounded-full bg-white data-[state=checked]:translate-x-4',
|
|
124
124
|
},
|
|
125
125
|
},
|
|
126
126
|
},
|
|
@@ -130,11 +130,11 @@ export const toggleStyle = tv({
|
|
|
130
130
|
});
|
|
131
131
|
|
|
132
132
|
export const submitStyle = tv({
|
|
133
|
-
base: 'w-max max-w-full
|
|
133
|
+
base: 'mt-2 w-max max-w-full',
|
|
134
134
|
variants: {
|
|
135
135
|
variant: {
|
|
136
|
-
alpha: 'bg-primary
|
|
137
|
-
beta: 'bg-primary
|
|
136
|
+
alpha: 'bg-primary rounded-md px-4 py-2 text-white',
|
|
137
|
+
beta: 'bg-primary px-4 py-2 text-white',
|
|
138
138
|
},
|
|
139
139
|
},
|
|
140
140
|
defaultVariants: {
|
package/lib/webcomponent.ts
CHANGED
|
@@ -3,15 +3,15 @@ import r2wc from '@r2wc/react-to-web-component';
|
|
|
3
3
|
|
|
4
4
|
import config from '../twind.config';
|
|
5
5
|
|
|
6
|
-
import { TwintagForm } from '@twintag-form/index';
|
|
6
|
+
import { TwintagForm } from '@twintag/twintag-form/index';
|
|
7
7
|
|
|
8
8
|
const withTwind = install(config);
|
|
9
9
|
|
|
10
10
|
const TwintagFormElement = r2wc(TwintagForm, {
|
|
11
|
-
props: {
|
|
11
|
+
props: Object.create({
|
|
12
12
|
config: 'json',
|
|
13
13
|
options: 'json',
|
|
14
|
-
},
|
|
14
|
+
}),
|
|
15
15
|
shadow: 'open',
|
|
16
16
|
});
|
|
17
17
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twintag/twintag-form",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"author": "Twintag",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@heroicons/react": "^2.0.16",
|
|
18
|
-
"@r2wc/react-to-web-component": "^2.0.
|
|
18
|
+
"@r2wc/react-to-web-component": "^2.0.3",
|
|
19
19
|
"@radix-ui/react-checkbox": "^1.0.4",
|
|
20
20
|
"@radix-ui/react-switch": "^1.0.2",
|
|
21
21
|
"@storybook/react": "7.0.2",
|
|
@@ -28,19 +28,19 @@
|
|
|
28
28
|
"react": "^18.2.0",
|
|
29
29
|
"react-dom": "^18.2.0",
|
|
30
30
|
"react-hook-form": "^7.43.1",
|
|
31
|
-
"@twintag/twintag-json-renderer": "0.
|
|
31
|
+
"@twintag/twintag-json-renderer": "0.2.0"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@rollup/plugin-typescript": "^11.1.1",
|
|
35
35
|
"@storybook/addon-actions": "^7.0.20",
|
|
36
|
-
"@
|
|
37
|
-
"@types/react-dom": "^18.0.11",
|
|
36
|
+
"@vitejs/plugin-react-swc": "^3.4.0",
|
|
38
37
|
"eslint": "^8.38.0",
|
|
39
38
|
"rollup": "^3.18.0",
|
|
40
39
|
"vite-plugin-dts": "^3.0.3",
|
|
41
|
-
"
|
|
40
|
+
"vite": "^4.4.9",
|
|
41
|
+
"tailwind-config": "0.2.0",
|
|
42
42
|
"tsconfig": "0.0.0",
|
|
43
|
-
"twintag-types": "0.
|
|
43
|
+
"twintag-types": "0.2.0"
|
|
44
44
|
},
|
|
45
45
|
"publishConfig": {
|
|
46
46
|
"access": "public"
|
package/tsconfig.json
CHANGED
|
@@ -3,12 +3,20 @@
|
|
|
3
3
|
"include": ["lib", "types.d.ts", "scripts"],
|
|
4
4
|
"exclude": ["dist"],
|
|
5
5
|
"compilerOptions": {
|
|
6
|
-
"moduleResolution": "Bundler",
|
|
7
|
-
"declaration": true,
|
|
8
|
-
"declarationMap": false,
|
|
9
6
|
"baseUrl": ".",
|
|
10
7
|
"paths": {
|
|
11
|
-
"@twintag-form/*": ["./lib/*"]
|
|
8
|
+
"@twintag/twintag-form/*": ["./lib/*"]
|
|
12
9
|
},
|
|
10
|
+
|
|
11
|
+
/* Bundler mode */
|
|
12
|
+
"moduleResolution": "bundler",
|
|
13
|
+
"declaration": false,
|
|
14
|
+
"declarationMap": false,
|
|
15
|
+
|
|
16
|
+
/* Linting */
|
|
17
|
+
"strict": true,
|
|
18
|
+
"noUnusedLocals": true,
|
|
19
|
+
"noUnusedParameters": true,
|
|
20
|
+
"noFallthroughCasesInSwitch": true
|
|
13
21
|
}
|
|
14
22
|
}
|
package/twind.config.ts
CHANGED
|
@@ -8,15 +8,15 @@ export default defineConfig({
|
|
|
8
8
|
theme: {
|
|
9
9
|
extend: {
|
|
10
10
|
colors: {
|
|
11
|
-
primary: 'var(--clr-primary,black)',
|
|
12
|
-
accent: 'var(--clr-accent,blue)',
|
|
13
|
-
label: 'var(--clr-label,black)',
|
|
14
|
-
input: 'var(--clr-input,black)',
|
|
15
|
-
placeholder: 'var(--clr-placeholder,#94a3b8)',
|
|
16
|
-
'category-label': 'var(--clr-category-label,black)',
|
|
11
|
+
primary: 'var(--tt-clr-primary,black)',
|
|
12
|
+
accent: 'var(--tt-clr-accent,blue)',
|
|
13
|
+
label: 'var(--tt-clr-label,black)',
|
|
14
|
+
input: 'var(--tt-clr-input,black)',
|
|
15
|
+
placeholder: 'var(--tt-clr-placeholder,#94a3b8)',
|
|
16
|
+
'category-label': 'var(--tt-clr-category-label,black)',
|
|
17
17
|
},
|
|
18
18
|
fontFamily: {
|
|
19
|
-
'ff-text': ['var(--ff-text)', 'Helvetica', 'Arial', 'sans-serif'],
|
|
19
|
+
'ff-text': ['var(--tt-ff-text)', 'Helvetica', 'Arial', 'sans-serif'],
|
|
20
20
|
},
|
|
21
21
|
},
|
|
22
22
|
},
|