@twintag/twintag-form 1.0.1 → 1.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.
- package/.turbo/turbo-build.log +6 -6
- package/CHANGELOG.md +18 -0
- package/README.md +61 -3
- package/dev/index.css +2 -0
- package/dev/main.tsx +50 -27
- package/dist/common/accordion.d.ts +7 -0
- package/dist/common/button.d.ts +28 -0
- package/dist/common/calendar.d.ts +9 -0
- package/dist/common/form.d.ts +1 -1
- package/dist/common/icon.d.ts +7 -0
- package/dist/common/popover.d.ts +6 -0
- package/dist/common/scroll-area.d.ts +5 -0
- package/dist/common/select.d.ts +13 -0
- package/dist/components/config.d.ts +4 -0
- package/dist/components/containers/accordion.d.ts +8 -0
- package/dist/components/fields/date-picker.d.ts +3 -0
- package/dist/components/{Input/simple.d.ts → fields/input.d.ts} +1 -1
- package/dist/components/form.d.ts +3 -1
- package/dist/components/index.d.ts +1 -2
- package/dist/index.d.ts +2 -0
- package/dist/twintag-form.react.js +19844 -6458
- package/dist/twintag-form.webcomponent.js +314 -299
- package/dist/types/index.d.ts +6 -5
- package/dist/utils/data.d.ts +2 -0
- package/dist/utils/string.d.ts +3 -0
- package/dist/utils/style.d.ts +2 -0
- package/index.html +3 -1
- package/lib/common/accordion.tsx +77 -0
- package/lib/common/button.tsx +3 -0
- package/lib/common/calendar.tsx +110 -0
- package/lib/common/form.tsx +14 -1
- package/lib/common/icon.tsx +35 -0
- package/lib/common/input.tsx +2 -1
- package/lib/common/popover.tsx +30 -0
- package/lib/common/scroll-area.tsx +46 -0
- package/lib/common/select.tsx +159 -0
- package/lib/common/textarea.tsx +1 -1
- package/lib/components/Render/index.tsx +4 -2
- package/lib/components/config.tsx +44 -0
- package/lib/components/containers/accordion.tsx +105 -0
- package/lib/components/containers/category.tsx +48 -0
- package/lib/components/fields/date-picker.tsx +117 -0
- package/lib/components/{Input → fields}/file.tsx +1 -1
- package/lib/components/{Input/simple.tsx → fields/input.tsx} +5 -5
- package/lib/components/{Input → fields}/textarea.tsx +2 -2
- package/lib/components/form.tsx +19 -3
- package/lib/components/index.tsx +0 -3
- package/lib/index.tsx +7 -8
- package/lib/types/index.ts +13 -11
- package/lib/utils/data.ts +18 -0
- package/lib/utils/string.ts +12 -0
- package/lib/utils/style.ts +8 -0
- package/package.json +13 -5
- package/tailwind.config.ts +19 -1
- package/.turbo/turbo-lint.log +0 -4
- package/dist/components/Input/index.d.ts +0 -8
- package/lib/components/Input/index.tsx +0 -32
- package/lib/components/category.tsx +0 -31
- /package/dist/components/{category.d.ts → containers/category.d.ts} +0 -0
- /package/dist/components/{Input → fields}/checkbox.d.ts +0 -0
- /package/dist/components/{Input → fields}/file.d.ts +0 -0
- /package/dist/components/{Input → fields}/radiogroup.d.ts +0 -0
- /package/dist/components/{Input → fields}/submit.d.ts +0 -0
- /package/dist/components/{Input → fields}/textarea.d.ts +0 -0
- /package/dist/components/{Input → fields}/toggle.d.ts +0 -0
- /package/lib/components/{Input → fields}/checkbox.tsx +0 -0
- /package/lib/components/{Input → fields}/radiogroup.tsx +0 -0
- /package/lib/components/{Input → fields}/submit.tsx +0 -0
- /package/lib/components/{Input → fields}/toggle.tsx +0 -0
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
|
|
2
|
-
> @twintag/twintag-form@1.0
|
|
2
|
+
> @twintag/twintag-form@1.1.0 build C:\Users\daryl\Desktop\twintag-projects\twintag-admin\packages\twintag-form
|
|
3
3
|
> tsc && vite build
|
|
4
4
|
|
|
5
5
|
[36mvite v4.4.9 [32mbuilding for production...[36m[39m
|
|
6
6
|
transforming...
|
|
7
|
-
[32m✓[39m
|
|
7
|
+
[32m✓[39m 2526 modules transformed.
|
|
8
8
|
rendering chunks...
|
|
9
9
|
|
|
10
10
|
[vite:dts] Start generate declaration files...
|
|
@@ -14,8 +14,8 @@ computing gzip size...
|
|
|
14
14
|
[vite:dts] Outside emitted: C:/Users/daryl/Desktop/twintag-projects/twintag-admin/packages/twintag-form/prettier.config.d.mts
|
|
15
15
|
[vite:dts] Outside emitted: C:/Users/daryl/Desktop/twintag-projects/twintag-admin/packages/twintag-form/dev/main.d.ts
|
|
16
16
|
[vite:dts] Outside emitted: C:/Users/daryl/Desktop/twintag-projects/twintag-admin/packages/twintag-form/vite.config.d.ts
|
|
17
|
-
|
|
18
|
-
[2mdist/[22m[36mtwintag-form.react.js [39m[1m[2m247.12 kB[22m[1m[22m[2m │ gzip: 56.86 kB[22m
|
|
19
|
-
[vite:dts] Declaration files built in 3571ms.
|
|
17
|
+
[vite:dts] Declaration files built in 4882ms.
|
|
20
18
|
|
|
21
|
-
[
|
|
19
|
+
[2mdist/[22m[36mtwintag-form.webcomponent.js [39m[1m[2m119.72 kB[22m[1m[22m[2m │ gzip: 33.42 kB[22m
|
|
20
|
+
[2mdist/[22m[36mtwintag-form.react.js [39m[1m[33m687.68 kB[39m[22m[2m │ gzip: 139.91 kB[22m
|
|
21
|
+
[32m✓ built in 10.80s[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @twintag/twintag-form
|
|
2
2
|
|
|
3
|
+
## 1.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- feat: `datepicker`, `accordion` and `defaultValues`
|
|
8
|
+
|
|
9
|
+
## 1.0.3
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- refactor: remove `twintag-form` reference to `ui-stories`
|
|
14
|
+
|
|
15
|
+
## 1.0.2
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- docs: update list of available CSS properties
|
|
20
|
+
|
|
3
21
|
## 1.0.1
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -74,6 +74,7 @@ Twintag Form provides some options to customize the form:
|
|
|
74
74
|
| --------------- | -------------- | ------------------------------------------------------------------------- |
|
|
75
75
|
| `variant` | `default/beta` | Variant of the form. |
|
|
76
76
|
| `resetOnSubmit` | `boolean` | If `true`, the form will be reset after submitting. (`false` per default) |
|
|
77
|
+
| `defaultValues` | `object` | The properties are the same as the bind values in your config. |
|
|
77
78
|
|
|
78
79
|
### **Inputs**
|
|
79
80
|
|
|
@@ -189,6 +190,60 @@ Each input can be customized with the following optional options:
|
|
|
189
190
|
}
|
|
190
191
|
```
|
|
191
192
|
|
|
193
|
+
- Date picker
|
|
194
|
+
|
|
195
|
+
```json
|
|
196
|
+
{
|
|
197
|
+
"type": "input",
|
|
198
|
+
"subtype": "datepicker",
|
|
199
|
+
"label": "Pick a date"
|
|
200
|
+
}
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
## **Containers**
|
|
204
|
+
|
|
205
|
+
- Accordion
|
|
206
|
+
|
|
207
|
+
```json
|
|
208
|
+
{
|
|
209
|
+
"type": "accordion",
|
|
210
|
+
"children": [
|
|
211
|
+
{
|
|
212
|
+
"type": "accordion",
|
|
213
|
+
"subtype": "item",
|
|
214
|
+
"label": "Your label",
|
|
215
|
+
"icon": "archive-box-x-mark",
|
|
216
|
+
"children": [
|
|
217
|
+
{
|
|
218
|
+
"type": "input",
|
|
219
|
+
"subtype": "simple",
|
|
220
|
+
"bind": "first-item"
|
|
221
|
+
},
|
|
222
|
+
...
|
|
223
|
+
]
|
|
224
|
+
},
|
|
225
|
+
...
|
|
226
|
+
]
|
|
227
|
+
}
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
- Category
|
|
231
|
+
|
|
232
|
+
```json
|
|
233
|
+
{
|
|
234
|
+
"type": "category",
|
|
235
|
+
"label": "Category",
|
|
236
|
+
"children": [
|
|
237
|
+
{
|
|
238
|
+
"type": "input",
|
|
239
|
+
"subtype": "simple",
|
|
240
|
+
"label": "Your label"
|
|
241
|
+
},
|
|
242
|
+
...
|
|
243
|
+
]
|
|
244
|
+
}
|
|
245
|
+
```
|
|
246
|
+
|
|
192
247
|
## **Event Handling**
|
|
193
248
|
|
|
194
249
|
```html
|
|
@@ -228,8 +283,11 @@ The form component exposes the following CSS variables:
|
|
|
228
283
|
|
|
229
284
|
| Variable | Description |
|
|
230
285
|
| ----------------------- | ----------------------------------------------------------------------------------------- |
|
|
286
|
+
| --tf-label | Color used for the inputs `label`. |
|
|
287
|
+
| --tf-category | Color used for the `category` labels. |
|
|
288
|
+
| | |
|
|
231
289
|
| --tf-background | Background color for the input fields. |
|
|
232
|
-
| --tf-foreground |
|
|
290
|
+
| --tf-foreground | Text color for the input fields. |
|
|
233
291
|
| | |
|
|
234
292
|
| --tf-muted | Used for `switch` background when value is false. |
|
|
235
293
|
| --tf-muted-foreground | Color used for `placeholder` text (inputs) and description text. |
|
|
@@ -241,9 +299,9 @@ The form component exposes the following CSS variables:
|
|
|
241
299
|
| --tf-accent-foreground | This color complements `accent` to show contrast between elements: `checkbox` check icon. |
|
|
242
300
|
| | |
|
|
243
301
|
| --tf-destructive | This color is used for `error` messages and the asterisk to mark a required input. |
|
|
244
|
-
| --tf-input | This color is used by the borders
|
|
302
|
+
| --tf-input | This color is used by the input borders. |
|
|
245
303
|
| --tf-ring | This color highlights a focused input. |
|
|
246
304
|
| | |
|
|
247
|
-
| --tf-radius | This value is used for rounded corners
|
|
305
|
+
| --tf-radius | This value is used for input rounded corners. |
|
|
248
306
|
| | |
|
|
249
307
|
| --tf-font | Font family for all the form. |
|
package/dev/index.css
CHANGED
package/dev/main.tsx
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import ReactDOM from 'react-dom/client';
|
|
4
|
-
|
|
5
|
-
import { Form } from '../lib';
|
|
6
|
-
import tw from '../twind.config';
|
|
1
|
+
import type { ComponentProps } from 'react';
|
|
2
|
+
import type { Form } from '../lib';
|
|
7
3
|
|
|
4
|
+
import '../lib/webcomponent';
|
|
8
5
|
import './index.css';
|
|
9
6
|
|
|
10
7
|
const config = [
|
|
@@ -17,14 +14,40 @@ const config = [
|
|
|
17
14
|
{
|
|
18
15
|
type: 'input',
|
|
19
16
|
props: {
|
|
20
|
-
subtype: '
|
|
21
|
-
label: '
|
|
22
|
-
bind: '
|
|
17
|
+
subtype: 'datepicker',
|
|
18
|
+
label: 'Date picker',
|
|
19
|
+
bind: 'datepicker',
|
|
23
20
|
options: {
|
|
24
|
-
description: '
|
|
21
|
+
description: 'this field is required',
|
|
25
22
|
},
|
|
26
23
|
},
|
|
27
24
|
},
|
|
25
|
+
{
|
|
26
|
+
type: 'accordion',
|
|
27
|
+
children: [
|
|
28
|
+
{
|
|
29
|
+
type: 'accordion',
|
|
30
|
+
props: {
|
|
31
|
+
subtype: 'item',
|
|
32
|
+
label: 'Required',
|
|
33
|
+
icon: 'archive-box-x-mark',
|
|
34
|
+
},
|
|
35
|
+
children: [
|
|
36
|
+
{
|
|
37
|
+
type: 'input',
|
|
38
|
+
props: {
|
|
39
|
+
subtype: 'toggle',
|
|
40
|
+
label: 'Required',
|
|
41
|
+
bind: 'required',
|
|
42
|
+
options: {
|
|
43
|
+
description: 'this field is required',
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
],
|
|
48
|
+
},
|
|
49
|
+
],
|
|
50
|
+
},
|
|
28
51
|
],
|
|
29
52
|
},
|
|
30
53
|
{
|
|
@@ -40,6 +63,7 @@ const config = [
|
|
|
40
63
|
label: 'Email',
|
|
41
64
|
bind: 'email',
|
|
42
65
|
options: {
|
|
66
|
+
error: 'This field is required',
|
|
43
67
|
description: 'This field is required',
|
|
44
68
|
},
|
|
45
69
|
},
|
|
@@ -95,6 +119,7 @@ const config = [
|
|
|
95
119
|
label: 'File',
|
|
96
120
|
bind: 'file',
|
|
97
121
|
options: {
|
|
122
|
+
error: 'This field is required',
|
|
98
123
|
description: 'This field is required',
|
|
99
124
|
},
|
|
100
125
|
},
|
|
@@ -134,30 +159,28 @@ const config = [
|
|
|
134
159
|
],
|
|
135
160
|
},
|
|
136
161
|
{
|
|
137
|
-
type: 'input
|
|
162
|
+
type: 'input',
|
|
138
163
|
props: {
|
|
164
|
+
subtype: 'submit',
|
|
139
165
|
label: 'Submit',
|
|
140
166
|
},
|
|
141
167
|
},
|
|
142
168
|
] satisfies React.ComponentProps<typeof Form>['config'];
|
|
143
169
|
|
|
144
170
|
const options = {
|
|
145
|
-
|
|
171
|
+
defaultValues: {
|
|
172
|
+
required: 'true',
|
|
173
|
+
email: 'This should work',
|
|
174
|
+
radiogroup: 'mote',
|
|
175
|
+
checkbox: true,
|
|
176
|
+
textarea: 'This is a textarea',
|
|
177
|
+
},
|
|
146
178
|
resetOnSubmit: true,
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
const App = () => {
|
|
150
|
-
return (
|
|
151
|
-
<div className='mx-auto max-w-lg bg-background p-8'>
|
|
152
|
-
<Form config={config} options={options} />
|
|
153
|
-
</div>
|
|
154
|
-
);
|
|
155
|
-
};
|
|
179
|
+
variant: 'beta',
|
|
180
|
+
} as ComponentProps<typeof Form>['options'];
|
|
156
181
|
|
|
157
|
-
|
|
182
|
+
// the key properties for the defaultValues object are the same as the bind properties
|
|
183
|
+
const form = document.querySelector('twintag-form');
|
|
158
184
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
<App />
|
|
162
|
-
</React.StrictMode>,
|
|
163
|
-
);
|
|
185
|
+
form?.setAttribute('config', JSON.stringify(config));
|
|
186
|
+
form?.setAttribute('options', JSON.stringify(options));
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import * as AccordionPrimitive from '@radix-ui/react-accordion';
|
|
3
|
+
declare const Accordion: React.ForwardRefExoticComponent<(AccordionPrimitive.AccordionSingleProps | AccordionPrimitive.AccordionMultipleProps) & React.RefAttributes<HTMLDivElement>>;
|
|
4
|
+
declare const AccordionItem: React.ForwardRefExoticComponent<Omit<AccordionPrimitive.AccordionItemProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
5
|
+
declare const AccordionTrigger: React.ForwardRefExoticComponent<Omit<AccordionPrimitive.AccordionTriggerProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
6
|
+
declare const AccordionContent: React.ForwardRefExoticComponent<Omit<AccordionPrimitive.AccordionContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
7
|
+
export { Accordion, AccordionItem, AccordionTrigger, AccordionContent };
|
package/dist/common/button.d.ts
CHANGED
|
@@ -4,6 +4,8 @@ import * as React from 'react';
|
|
|
4
4
|
declare const buttonVariants: TVReturnType<{
|
|
5
5
|
variant: {
|
|
6
6
|
default: string;
|
|
7
|
+
outline: string;
|
|
8
|
+
ghost: string;
|
|
7
9
|
};
|
|
8
10
|
size: {
|
|
9
11
|
default: string;
|
|
@@ -13,6 +15,8 @@ declare const buttonVariants: TVReturnType<{
|
|
|
13
15
|
}, undefined, string[], TVConfig<{
|
|
14
16
|
variant: {
|
|
15
17
|
default: string;
|
|
18
|
+
outline: string;
|
|
19
|
+
ghost: string;
|
|
16
20
|
};
|
|
17
21
|
size: {
|
|
18
22
|
default: string;
|
|
@@ -22,6 +26,8 @@ declare const buttonVariants: TVReturnType<{
|
|
|
22
26
|
}, {
|
|
23
27
|
variant: {
|
|
24
28
|
default: string;
|
|
29
|
+
outline: string;
|
|
30
|
+
ghost: string;
|
|
25
31
|
};
|
|
26
32
|
size: {
|
|
27
33
|
default: string;
|
|
@@ -31,6 +37,8 @@ declare const buttonVariants: TVReturnType<{
|
|
|
31
37
|
}>, {
|
|
32
38
|
variant: {
|
|
33
39
|
default: string;
|
|
40
|
+
outline: string;
|
|
41
|
+
ghost: string;
|
|
34
42
|
};
|
|
35
43
|
size: {
|
|
36
44
|
default: string;
|
|
@@ -40,6 +48,8 @@ declare const buttonVariants: TVReturnType<{
|
|
|
40
48
|
}, undefined, TVReturnType<{
|
|
41
49
|
variant: {
|
|
42
50
|
default: string;
|
|
51
|
+
outline: string;
|
|
52
|
+
ghost: string;
|
|
43
53
|
};
|
|
44
54
|
size: {
|
|
45
55
|
default: string;
|
|
@@ -49,6 +59,8 @@ declare const buttonVariants: TVReturnType<{
|
|
|
49
59
|
}, undefined, string[], TVConfig<{
|
|
50
60
|
variant: {
|
|
51
61
|
default: string;
|
|
62
|
+
outline: string;
|
|
63
|
+
ghost: string;
|
|
52
64
|
};
|
|
53
65
|
size: {
|
|
54
66
|
default: string;
|
|
@@ -58,6 +70,8 @@ declare const buttonVariants: TVReturnType<{
|
|
|
58
70
|
}, {
|
|
59
71
|
variant: {
|
|
60
72
|
default: string;
|
|
73
|
+
outline: string;
|
|
74
|
+
ghost: string;
|
|
61
75
|
};
|
|
62
76
|
size: {
|
|
63
77
|
default: string;
|
|
@@ -71,6 +85,8 @@ export type ButtonProps = React.ButtonHTMLAttributes<HTMLButtonElement> & Varian
|
|
|
71
85
|
declare const Button: React.ForwardRefExoticComponent<React.ButtonHTMLAttributes<HTMLButtonElement> & VariantProps<TVReturnType<{
|
|
72
86
|
variant: {
|
|
73
87
|
default: string;
|
|
88
|
+
outline: string;
|
|
89
|
+
ghost: string;
|
|
74
90
|
};
|
|
75
91
|
size: {
|
|
76
92
|
default: string;
|
|
@@ -80,6 +96,8 @@ declare const Button: React.ForwardRefExoticComponent<React.ButtonHTMLAttributes
|
|
|
80
96
|
}, undefined, string[], TVConfig<{
|
|
81
97
|
variant: {
|
|
82
98
|
default: string;
|
|
99
|
+
outline: string;
|
|
100
|
+
ghost: string;
|
|
83
101
|
};
|
|
84
102
|
size: {
|
|
85
103
|
default: string;
|
|
@@ -89,6 +107,8 @@ declare const Button: React.ForwardRefExoticComponent<React.ButtonHTMLAttributes
|
|
|
89
107
|
}, {
|
|
90
108
|
variant: {
|
|
91
109
|
default: string;
|
|
110
|
+
outline: string;
|
|
111
|
+
ghost: string;
|
|
92
112
|
};
|
|
93
113
|
size: {
|
|
94
114
|
default: string;
|
|
@@ -98,6 +118,8 @@ declare const Button: React.ForwardRefExoticComponent<React.ButtonHTMLAttributes
|
|
|
98
118
|
}>, {
|
|
99
119
|
variant: {
|
|
100
120
|
default: string;
|
|
121
|
+
outline: string;
|
|
122
|
+
ghost: string;
|
|
101
123
|
};
|
|
102
124
|
size: {
|
|
103
125
|
default: string;
|
|
@@ -107,6 +129,8 @@ declare const Button: React.ForwardRefExoticComponent<React.ButtonHTMLAttributes
|
|
|
107
129
|
}, undefined, TVReturnType<{
|
|
108
130
|
variant: {
|
|
109
131
|
default: string;
|
|
132
|
+
outline: string;
|
|
133
|
+
ghost: string;
|
|
110
134
|
};
|
|
111
135
|
size: {
|
|
112
136
|
default: string;
|
|
@@ -116,6 +140,8 @@ declare const Button: React.ForwardRefExoticComponent<React.ButtonHTMLAttributes
|
|
|
116
140
|
}, undefined, string[], TVConfig<{
|
|
117
141
|
variant: {
|
|
118
142
|
default: string;
|
|
143
|
+
outline: string;
|
|
144
|
+
ghost: string;
|
|
119
145
|
};
|
|
120
146
|
size: {
|
|
121
147
|
default: string;
|
|
@@ -125,6 +151,8 @@ declare const Button: React.ForwardRefExoticComponent<React.ButtonHTMLAttributes
|
|
|
125
151
|
}, {
|
|
126
152
|
variant: {
|
|
127
153
|
default: string;
|
|
154
|
+
outline: string;
|
|
155
|
+
ghost: string;
|
|
128
156
|
};
|
|
129
157
|
size: {
|
|
130
158
|
default: string;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { JSX } from 'react/jsx-runtime';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { DayPicker } from 'react-day-picker';
|
|
4
|
+
export type CalendarProps = React.ComponentProps<typeof DayPicker>;
|
|
5
|
+
declare function Calendar({ className, classNames, showOutsideDays, ...props }: CalendarProps): JSX.Element;
|
|
6
|
+
declare namespace Calendar {
|
|
7
|
+
var displayName: string;
|
|
8
|
+
}
|
|
9
|
+
export { Calendar };
|
package/dist/common/form.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { JSX } from 'react/jsx-runtime';
|
|
|
3
3
|
import type * as LabelPrimitive from '@radix-ui/react-label';
|
|
4
4
|
import { FormProviderProps, FieldError, ControllerProps, FieldPath, FieldValues } from 'react-hook-form';
|
|
5
5
|
import * as React from 'react';
|
|
6
|
-
declare const Form: <TFieldValues extends FieldValues, TContext = any, TTransformedValues extends FieldValues
|
|
6
|
+
declare const Form: <TFieldValues extends FieldValues, TContext = any, TTransformedValues extends FieldValues = TFieldValues>(props: FormProviderProps<TFieldValues, TContext, TTransformedValues>) => React.JSX.Element;
|
|
7
7
|
declare const FormField: <TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ ...props }: ControllerProps<TFieldValues, TName>) => JSX.Element;
|
|
8
8
|
declare const useFormField: () => {
|
|
9
9
|
invalid: boolean;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import * as PopoverPrimitive from '@radix-ui/react-popover';
|
|
3
|
+
declare const Popover: React.FC<PopoverPrimitive.PopoverProps>;
|
|
4
|
+
declare const PopoverTrigger: React.ForwardRefExoticComponent<PopoverPrimitive.PopoverTriggerProps & React.RefAttributes<HTMLButtonElement>>;
|
|
5
|
+
declare const PopoverContent: React.ForwardRefExoticComponent<Omit<PopoverPrimitive.PopoverContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
6
|
+
export { Popover, PopoverTrigger, PopoverContent };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import * as ScrollAreaPrimitive from '@radix-ui/react-scroll-area';
|
|
3
|
+
declare const ScrollArea: React.ForwardRefExoticComponent<Omit<ScrollAreaPrimitive.ScrollAreaProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
4
|
+
declare const ScrollBar: React.ForwardRefExoticComponent<Omit<ScrollAreaPrimitive.ScrollAreaScrollbarProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
5
|
+
export { ScrollArea, ScrollBar };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import * as SelectPrimitive from '@radix-ui/react-select';
|
|
3
|
+
declare const Select: React.FC<SelectPrimitive.SelectProps>;
|
|
4
|
+
declare const SelectGroup: React.ForwardRefExoticComponent<SelectPrimitive.SelectGroupProps & React.RefAttributes<HTMLDivElement>>;
|
|
5
|
+
declare const SelectValue: React.ForwardRefExoticComponent<SelectPrimitive.SelectValueProps & React.RefAttributes<HTMLSpanElement>>;
|
|
6
|
+
declare const SelectTrigger: React.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectTriggerProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
7
|
+
declare const SelectScrollUpButton: React.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectScrollUpButtonProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
8
|
+
declare const SelectScrollDownButton: React.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectScrollDownButtonProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
9
|
+
declare const SelectContent: React.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
10
|
+
declare const SelectLabel: React.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectLabelProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
11
|
+
declare const SelectItem: React.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectItemProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
12
|
+
declare const SelectSeparator: React.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectSeparatorProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
13
|
+
export { Select, SelectGroup, SelectValue, SelectTrigger, SelectContent, SelectLabel, SelectItem, SelectSeparator, SelectScrollUpButton, SelectScrollDownButton, };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { WithChildren } from 'twintag-types/dom';
|
|
2
|
+
import { type FC } from 'react';
|
|
3
|
+
type AccordionProps = {
|
|
4
|
+
subtype?: 'item' | 'multiple' | 'single';
|
|
5
|
+
label?: string;
|
|
6
|
+
} & WithChildren;
|
|
7
|
+
declare const Accordion: FC<AccordionProps>;
|
|
8
|
+
export { Accordion };
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { JSX } from 'react/jsx-runtime';
|
|
2
|
+
import type { FieldValues } from 'react-hook-form';
|
|
2
3
|
import type { WithChildren } from 'twintag-types/dom';
|
|
3
4
|
type Props = {
|
|
5
|
+
defaultValues?: FieldValues;
|
|
4
6
|
resetOnSubmit?: boolean;
|
|
5
7
|
} & WithChildren;
|
|
6
|
-
export declare const TwintagForm: ({ resetOnSubmit, children }: Props) => JSX.Element;
|
|
8
|
+
export declare const TwintagForm: ({ defaultValues, resetOnSubmit, children, }: Props) => JSX.Element;
|
|
7
9
|
export {};
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { JSX } from 'react/jsx-runtime';
|
|
2
2
|
import type { RawJsonComponent } from '../types';
|
|
3
|
-
export { Input } from './Input';
|
|
4
|
-
export { Category } from './category';
|
|
5
3
|
type Props = {
|
|
6
4
|
config: RawJsonComponent | RawJsonComponent[];
|
|
7
5
|
};
|
|
8
6
|
export declare const TwintagJsonRenderer: ({ config }: Props) => JSX.Element;
|
|
7
|
+
export {};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { JSX } from 'react/jsx-runtime';
|
|
2
2
|
import type { ComponentProps } from 'react';
|
|
3
3
|
import type { RawJsonComponent } from './types';
|
|
4
|
+
import { TwintagForm } from './components/form';
|
|
4
5
|
import { TwintagFormProvider } from './provider';
|
|
5
6
|
type Props = {
|
|
6
7
|
config: RawJsonComponent[];
|
|
7
8
|
options?: Partial<{
|
|
9
|
+
defaultValues?: ComponentProps<typeof TwintagForm>['defaultValues'];
|
|
8
10
|
variant?: ComponentProps<typeof TwintagFormProvider>['variant'];
|
|
9
11
|
resetOnSubmit?: boolean;
|
|
10
12
|
}>;
|