@twintag/twintag-form 1.6.0 → 1.6.2-beta.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/CHANGELOG.md +12 -0
- package/README.md +59 -22
- package/dev/index.css +32 -32
- package/dev/main.tsx +1 -0
- package/lib/common/button.tsx +6 -6
- package/lib/common/calendar.tsx +10 -9
- package/lib/common/checkbox.tsx +3 -3
- package/lib/common/form.tsx +3 -3
- package/lib/common/icon.tsx +1 -1
- package/lib/common/input.tsx +4 -4
- package/lib/common/label.tsx +1 -1
- package/lib/common/popover.tsx +1 -1
- package/lib/common/radiogroup.tsx +2 -2
- package/lib/common/slider.tsx +3 -3
- package/lib/common/switch.tsx +3 -3
- package/lib/common/textarea.tsx +3 -3
- package/lib/components/containers/category.tsx +1 -1
- package/lib/components/fields/checkbox.tsx +1 -1
- package/lib/components/fields/date-picker.tsx +5 -5
- package/lib/components/fields/file.tsx +4 -3
- package/lib/components/fields/input.tsx +2 -2
- package/lib/components/fields/radiogroup.tsx +1 -1
- package/lib/components/fields/textarea.tsx +6 -2
- package/lib/components/fields/toggle.tsx +1 -1
- package/lib/components/fields/tri-toggle.tsx +4 -4
- package/lib/components/provider.tsx +4 -5
- package/lib/index.tsx +7 -3
- package/lib/types/index.ts +26 -6
- package/package.json +1 -1
- package/tailwind.config.ts +21 -26
- package/.turbo/turbo-build.log +0 -22
- package/dist/common/accordion.d.ts +0 -7
- package/dist/common/button.d.ts +0 -71
- package/dist/common/calendar.d.ts +0 -139
- package/dist/common/checkbox.d.ts +0 -4
- package/dist/common/form.d.ts +0 -86
- package/dist/common/icon.d.ts +0 -8
- package/dist/common/input.d.ts +0 -133
- package/dist/common/label.d.ts +0 -21
- package/dist/common/popover.d.ts +0 -6
- package/dist/common/radiogroup.d.ts +0 -5
- package/dist/common/slider.d.ts +0 -4
- package/dist/common/switch.d.ts +0 -4
- package/dist/common/textarea.d.ts +0 -68
- package/dist/components/config.d.ts +0 -6
- package/dist/components/containers/accordion.d.ts +0 -7
- package/dist/components/containers/category.d.ts +0 -8
- package/dist/components/fields/checkbox.d.ts +0 -5
- package/dist/components/fields/date-picker.d.ts +0 -4
- package/dist/components/fields/file.d.ts +0 -5
- package/dist/components/fields/input.d.ts +0 -5
- package/dist/components/fields/radiogroup.d.ts +0 -7
- package/dist/components/fields/submit.d.ts +0 -4
- package/dist/components/fields/textarea.d.ts +0 -5
- package/dist/components/fields/toggle.d.ts +0 -5
- package/dist/components/fields/tri-toggle.d.ts +0 -5
- package/dist/components/form.d.ts +0 -9
- package/dist/components/input.d.ts +0 -4
- package/dist/components/label.d.ts +0 -4
- package/dist/components/provider.d.ts +0 -19
- package/dist/components/renderer.d.ts +0 -1
- package/dist/index.cjs +0 -1
- package/dist/index.d.ts +0 -16
- package/dist/index.js +0 -4456
- package/dist/types/index.d.ts +0 -58
- package/dist/utils/data.d.ts +0 -7
- package/dist/utils/string.d.ts +0 -3
- package/dist/utils/style.d.ts +0 -3
- package/dist/webcomponent.cjs +0 -1
- package/dist/webcomponent.d.ts +0 -1
- package/dist/webcomponent.js +0 -1170
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @twintag/twintag-form
|
|
2
2
|
|
|
3
|
+
## 1.6.2-beta.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- fix(twintag-form): filter file types using the `accept` attribute
|
|
8
|
+
|
|
9
|
+
## 1.6.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#216](https://github.com/esoptra/twintag-admin/pull/216) [`03eed64`](https://github.com/esoptra/twintag-admin/commit/03eed64d90ce7b0098a509399bdb8ea4b8fb8e6b) Thanks [@leweyse](https://github.com/leweyse)! - fix(twintag-form): use package specific class names for styling
|
|
14
|
+
|
|
3
15
|
## 1.6.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -76,12 +76,13 @@ The `config` object contains the form structure. It is organized by the index of
|
|
|
76
76
|
|
|
77
77
|
Twintag Form provides some options to customize the form:
|
|
78
78
|
|
|
79
|
-
| Option
|
|
80
|
-
|
|
|
81
|
-
| `variant`
|
|
82
|
-
| `size`
|
|
83
|
-
| `resetOnSubmit`
|
|
84
|
-
| `defaultValues`
|
|
79
|
+
| Option | Type | Description |
|
|
80
|
+
| ---------------- | -------------------- | ----------------------------------------------------------------------------------------------------------------- |
|
|
81
|
+
| `variant` | `default / outline` | Variant of the form. |
|
|
82
|
+
| `size` | `base / sm` | Default: `base` (font-size set to 16px). |
|
|
83
|
+
| `resetOnSubmit` | `boolean` | If `true`, the form will be reset after submitting. (`false` per default) |
|
|
84
|
+
| `defaultValues` | `object` | The properties are the same as the bind values in your config. |
|
|
85
|
+
| `acceptFileType` | `string` | Accept file type. ([ref](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/input/file#accept)) |
|
|
85
86
|
|
|
86
87
|
### **Inputs**
|
|
87
88
|
|
|
@@ -89,12 +90,13 @@ Twintag Form provides some options to customize the form:
|
|
|
89
90
|
|
|
90
91
|
Each input can be customized with the following optional options:
|
|
91
92
|
|
|
92
|
-
| Option | Type | Description
|
|
93
|
-
| --------------- | --------- |
|
|
94
|
-
| `description` | `string` | Description of the input.
|
|
95
|
-
| `error` | `string` | Error message.
|
|
96
|
-
| `placeholder` | `string` | Placeholder of the input.
|
|
97
|
-
| `optionalField` | `boolean` | If `true`, the field will be optional. (`false` per default)
|
|
93
|
+
| Option | Type | Description |
|
|
94
|
+
| --------------- | --------- | ----------------------------------------------------------------------------------------------------------------- |
|
|
95
|
+
| `description` | `string` | Description of the input. |
|
|
96
|
+
| `error` | `string` | Error message. |
|
|
97
|
+
| `placeholder` | `string` | Placeholder of the input. |
|
|
98
|
+
| `optionalField` | `boolean` | If `true`, the field will be optional. (`false` per default) |
|
|
99
|
+
| `accept` | `string` | Accept file type. ([ref](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/input/file#accept)) |
|
|
98
100
|
|
|
99
101
|
```json
|
|
100
102
|
{
|
|
@@ -104,10 +106,7 @@ Each input can be customized with the following optional options:
|
|
|
104
106
|
"label": "Email",
|
|
105
107
|
"bind": "email",
|
|
106
108
|
"options": {
|
|
107
|
-
|
|
108
|
-
"error": "The field is empty."
|
|
109
|
-
"placeholder": "Write here...",
|
|
110
|
-
"optionalField": true
|
|
109
|
+
...
|
|
111
110
|
}
|
|
112
111
|
}
|
|
113
112
|
}
|
|
@@ -123,7 +122,13 @@ Each input can be customized with the following optional options:
|
|
|
123
122
|
"props": {
|
|
124
123
|
"subtype": "simple",
|
|
125
124
|
"label": "Email",
|
|
126
|
-
"bind": "email"
|
|
125
|
+
"bind": "email",
|
|
126
|
+
"options": {
|
|
127
|
+
"description": "Please enter you email",
|
|
128
|
+
"error": "The field is empty."
|
|
129
|
+
"placeholder": "Write here...",
|
|
130
|
+
"optionalField": false
|
|
131
|
+
}
|
|
127
132
|
}
|
|
128
133
|
}
|
|
129
134
|
```
|
|
@@ -136,7 +141,13 @@ Each input can be customized with the following optional options:
|
|
|
136
141
|
"props": {
|
|
137
142
|
"subtype": "textarea",
|
|
138
143
|
"label": "Message",
|
|
139
|
-
"bind": "message"
|
|
144
|
+
"bind": "message",
|
|
145
|
+
"options": {
|
|
146
|
+
"description": "Please enter you message",
|
|
147
|
+
"error": "The field is empty."
|
|
148
|
+
"placeholder": "Write here...",
|
|
149
|
+
"optionalField": false
|
|
150
|
+
}
|
|
140
151
|
}
|
|
141
152
|
}
|
|
142
153
|
```
|
|
@@ -149,7 +160,13 @@ Each input can be customized with the following optional options:
|
|
|
149
160
|
"props": {
|
|
150
161
|
"subtype": "file",
|
|
151
162
|
"label": "File",
|
|
152
|
-
"bind": "file"
|
|
163
|
+
"bind": "file",
|
|
164
|
+
"options": {
|
|
165
|
+
"description": "Please upload an image",
|
|
166
|
+
"error": "The field is empty.",
|
|
167
|
+
"accept": "image/*",
|
|
168
|
+
"optionalField": true
|
|
169
|
+
}
|
|
153
170
|
}
|
|
154
171
|
}
|
|
155
172
|
```
|
|
@@ -162,7 +179,12 @@ Each input can be customized with the following optional options:
|
|
|
162
179
|
"props": {
|
|
163
180
|
"subtype": "checkbox",
|
|
164
181
|
"label": "Checkbox",
|
|
165
|
-
"bind": "checkbox"
|
|
182
|
+
"bind": "checkbox",
|
|
183
|
+
"options": {
|
|
184
|
+
"description": "Please enter you email",
|
|
185
|
+
"error": "The field is empty."
|
|
186
|
+
"optionalField": false
|
|
187
|
+
}
|
|
166
188
|
}
|
|
167
189
|
}
|
|
168
190
|
```
|
|
@@ -175,7 +197,12 @@ Each input can be customized with the following optional options:
|
|
|
175
197
|
"props": {
|
|
176
198
|
"subtype": "toggle",
|
|
177
199
|
"label": "Toggle",
|
|
178
|
-
"bind": "toggle"
|
|
200
|
+
"bind": "toggle",
|
|
201
|
+
"options": {
|
|
202
|
+
"description": "Please enter you email",
|
|
203
|
+
"error": "The field is empty."
|
|
204
|
+
"optionalField": false
|
|
205
|
+
}
|
|
179
206
|
}
|
|
180
207
|
}
|
|
181
208
|
```
|
|
@@ -188,7 +215,12 @@ Each input can be customized with the following optional options:
|
|
|
188
215
|
"props": {
|
|
189
216
|
"subtype": "tri-toggle",
|
|
190
217
|
"label": "Toggle with 3 states",
|
|
191
|
-
"bind": "tri-states"
|
|
218
|
+
"bind": "tri-states",
|
|
219
|
+
"options": {
|
|
220
|
+
"description": "Please enter you email",
|
|
221
|
+
"error": "The field is empty."
|
|
222
|
+
"optionalField": false
|
|
223
|
+
}
|
|
192
224
|
}
|
|
193
225
|
}
|
|
194
226
|
```
|
|
@@ -202,6 +234,11 @@ Each input can be customized with the following optional options:
|
|
|
202
234
|
"subtype": "radiogroup",
|
|
203
235
|
"label": "Radio Group",
|
|
204
236
|
"bind": "radiogroup",
|
|
237
|
+
"options": {
|
|
238
|
+
"description": "Please enter you email",
|
|
239
|
+
"error": "The field is empty."
|
|
240
|
+
"optionalField": false
|
|
241
|
+
}
|
|
205
242
|
},
|
|
206
243
|
"children": [
|
|
207
244
|
{
|
package/dev/index.css
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
@import url('https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap');
|
|
2
|
-
|
|
3
|
-
@tailwind base;
|
|
4
|
-
@tailwind components;
|
|
5
|
-
@tailwind utilities;
|
|
6
|
-
|
|
7
|
-
:root {
|
|
8
|
-
--tf-label: 222.2 47.4% 11.2%;
|
|
9
|
-
--tf-category: 222.2 47.4% 11.2%;
|
|
10
|
-
|
|
11
|
-
--tf-background: 0 0% 100%;
|
|
12
|
-
--tf-foreground: 0 0% 0%;
|
|
13
|
-
|
|
14
|
-
--tf-muted: 210 40% 96.1%;
|
|
15
|
-
--tf-muted-foreground: 215.4 16.3% 46.9%;
|
|
16
|
-
|
|
17
|
-
--tf-primary: 210 40% 98%;
|
|
18
|
-
--tf-primary-foreground: 222.2 47.4% 11.2%;
|
|
19
|
-
|
|
20
|
-
--tf-accent: 222.2 47.4% 11.2%;
|
|
21
|
-
--tf-accent-foreground: 210 40% 96.1%;
|
|
22
|
-
|
|
23
|
-
--tf-destructive: 0 100% 50%;
|
|
24
|
-
--tf-destructive-foreground: 210 40% 98%;
|
|
25
|
-
|
|
26
|
-
--tf-input: 214.3 31.8% 91.4%;
|
|
27
|
-
--tf-ring: 215 20.2% 65.1%;
|
|
28
|
-
|
|
29
|
-
--tf-radius: 0.5rem;
|
|
30
|
-
|
|
31
|
-
--tf-font: 'Roboto', sans-serif;
|
|
32
|
-
}
|
|
1
|
+
@import url('https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap');
|
|
2
|
+
|
|
3
|
+
@tailwind base;
|
|
4
|
+
@tailwind components;
|
|
5
|
+
@tailwind utilities;
|
|
6
|
+
|
|
7
|
+
:root {
|
|
8
|
+
--tf-label: 222.2 47.4% 11.2%;
|
|
9
|
+
--tf-category: 222.2 47.4% 11.2%;
|
|
10
|
+
|
|
11
|
+
--tf-background: 0 0% 100%;
|
|
12
|
+
--tf-foreground: 0 0% 0%;
|
|
13
|
+
|
|
14
|
+
--tf-muted: 210 40% 96.1%;
|
|
15
|
+
--tf-muted-foreground: 215.4 16.3% 46.9%;
|
|
16
|
+
|
|
17
|
+
--tf-primary: 210 40% 98%;
|
|
18
|
+
--tf-primary-foreground: 222.2 47.4% 11.2%;
|
|
19
|
+
|
|
20
|
+
--tf-accent: 222.2 47.4% 11.2%;
|
|
21
|
+
--tf-accent-foreground: 210 40% 96.1%;
|
|
22
|
+
|
|
23
|
+
--tf-destructive: 0 100% 50%;
|
|
24
|
+
--tf-destructive-foreground: 210 40% 98%;
|
|
25
|
+
|
|
26
|
+
--tf-input: 214.3 31.8% 91.4%;
|
|
27
|
+
--tf-ring: 215 20.2% 65.1%;
|
|
28
|
+
|
|
29
|
+
--tf-radius: 0.5rem;
|
|
30
|
+
|
|
31
|
+
--tf-font: 'Roboto', sans-serif;
|
|
32
|
+
}
|
package/dev/main.tsx
CHANGED
package/lib/common/button.tsx
CHANGED
|
@@ -6,20 +6,20 @@ import { tv } from 'tailwind-variants';
|
|
|
6
6
|
|
|
7
7
|
const buttonVariants = tv({
|
|
8
8
|
base: [
|
|
9
|
-
'inline-flex items-center justify-center whitespace-nowrap rounded-md font-medium transition-colors',
|
|
10
|
-
'ring-offset-background focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-2',
|
|
9
|
+
'inline-flex items-center justify-center whitespace-nowrap rounded-tf-md font-medium transition-colors',
|
|
10
|
+
'ring-offset-background focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-tf-ring focus-visible:ring-offset-2',
|
|
11
11
|
'disabled:pointer-events-none disabled:opacity-50',
|
|
12
12
|
],
|
|
13
13
|
variants: {
|
|
14
14
|
variant: {
|
|
15
15
|
default:
|
|
16
|
-
'bg-primary-foreground text-primary shadow hover:bg-primary-foreground/90',
|
|
16
|
+
'bg-tf-primary-foreground text-tf-primary shadow hover:bg-tf-primary-foreground/90',
|
|
17
17
|
outline:
|
|
18
|
-
'border border-input bg-background hover:bg-accent hover:text-accent-foreground',
|
|
19
|
-
ghost: 'hover:bg-accent hover:text-accent-foreground',
|
|
18
|
+
'border border-tf-input bg-tf-background hover:bg-tf-accent hover:text-tf-accent-foreground',
|
|
19
|
+
ghost: 'hover:bg-tf-accent hover:text-tf-accent-foreground',
|
|
20
20
|
},
|
|
21
21
|
size: {
|
|
22
|
-
sm: 'h-9 rounded-md px-3 text-sm',
|
|
22
|
+
sm: 'h-9 rounded-tf-md px-3 text-sm',
|
|
23
23
|
base: 'h-10 px-3 py-2 text-base',
|
|
24
24
|
},
|
|
25
25
|
},
|
package/lib/common/calendar.tsx
CHANGED
|
@@ -24,22 +24,23 @@ const calendarVariants = tv({
|
|
|
24
24
|
nav_button_next: 'absolute right-1',
|
|
25
25
|
table: 'w-full border-collapse space-y-1',
|
|
26
26
|
head_row: 'flex',
|
|
27
|
-
head_cell:
|
|
27
|
+
head_cell:
|
|
28
|
+
'w-9 rounded-tf-md text-[0.8rem] font-normal text-tf-muted-foreground',
|
|
28
29
|
row: 'mt-2 flex w-full',
|
|
29
|
-
cell: 'relative h-9 w-9 p-0 text-center focus-within:relative focus-within:z-20 [&:has([aria-selected])]:bg-transparent first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md [&:has([aria-selected].day-outside)]:bg-muted/50 [&:has([aria-selected].day-range-end)]:rounded-r-md',
|
|
30
|
+
cell: 'relative h-9 w-9 p-0 text-center focus-within:relative focus-within:z-20 [&:has([aria-selected])]:bg-transparent first:[&:has([aria-selected])]:rounded-l-tf-md last:[&:has([aria-selected])]:rounded-r-tf-md [&:has([aria-selected].day-outside)]:bg-tf-muted/50 [&:has([aria-selected].day-range-end)]:rounded-r-tf-md',
|
|
30
31
|
day: buttonVariants({
|
|
31
32
|
variant: 'ghost',
|
|
32
33
|
className: 'h-9 w-9 p-0 font-normal aria-selected:opacity-100',
|
|
33
34
|
}),
|
|
34
35
|
day_range_end: 'day-range-end',
|
|
35
36
|
day_selected:
|
|
36
|
-
'bg-accent text-accent-foreground hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground',
|
|
37
|
-
day_today: 'bg-muted text-muted-foreground',
|
|
37
|
+
'bg-tf-accent text-tf-accent-foreground hover:bg-tf-accent hover:text-tf-accent-foreground focus:bg-tf-accent focus:text-tf-accent-foreground',
|
|
38
|
+
day_today: 'bg-tf-muted text-tf-muted-foreground',
|
|
38
39
|
day_outside:
|
|
39
|
-
'day-outside text-muted-foreground opacity-50 aria-selected:bg-accent/30 aria-selected:text-accent-foreground',
|
|
40
|
-
day_disabled: 'text-muted-foreground opacity-50',
|
|
40
|
+
'day-outside text-tf-muted-foreground opacity-50 aria-selected:bg-tf-accent/30 aria-selected:text-tf-accent-foreground',
|
|
41
|
+
day_disabled: 'text-tf-muted-foreground opacity-50',
|
|
41
42
|
day_range_middle:
|
|
42
|
-
'aria-selected:bg-accent aria-selected:text-accent-foreground',
|
|
43
|
+
'aria-selected:bg-tf-accent aria-selected:text-tf-accent-foreground',
|
|
43
44
|
day_hidden: 'invisible',
|
|
44
45
|
},
|
|
45
46
|
variants: {
|
|
@@ -49,8 +50,8 @@ const calendarVariants = tv({
|
|
|
49
50
|
caption_dropdowns: [
|
|
50
51
|
'flex w-4/6 justify-center gap-1',
|
|
51
52
|
'[&>*>span]:hidden [&>*]:flex-1 [&>.rdp-vhidden]:hidden ',
|
|
52
|
-
'[&>*>select]:h-7 [&>*>select]:min-w-[3.6rem] [&>*>select]:rounded-md [&>*>select]:border [&>*>select]:border-input [&>*>select]:bg-background [&>*>select]:px-1',
|
|
53
|
-
'[&>*>select]:ring-offset-background [&>*>select]:focus-visible:outline-none [&>*>select]:focus-visible:ring-1 [&>*>select]:focus-visible:ring-ring',
|
|
53
|
+
'[&>*>select]:h-7 [&>*>select]:min-w-[3.6rem] [&>*>select]:rounded-tf-md [&>*>select]:border [&>*>select]:border-tf-input [&>*>select]:bg-tf-background [&>*>select]:px-1',
|
|
54
|
+
'[&>*>select]:ring-offset-tf-background [&>*>select]:focus-visible:outline-none [&>*>select]:focus-visible:ring-1 [&>*>select]:focus-visible:ring-tf-ring',
|
|
54
55
|
],
|
|
55
56
|
},
|
|
56
57
|
},
|
package/lib/common/checkbox.tsx
CHANGED
|
@@ -6,10 +6,10 @@ import { tv } from 'tailwind-variants';
|
|
|
6
6
|
const checkboxVariants = tv({
|
|
7
7
|
slots: {
|
|
8
8
|
root: [
|
|
9
|
-
'peer h-4 w-4 shrink-0 rounded-sm border border-accent shadow',
|
|
10
|
-
'focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1',
|
|
9
|
+
'peer h-4 w-4 shrink-0 rounded-tf-sm border border-tf-accent shadow',
|
|
10
|
+
'focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-tf-ring focus-visible:ring-offset-1',
|
|
11
11
|
'disabled:cursor-not-allowed disabled:opacity-50',
|
|
12
|
-
'data-[state=checked]:bg-accent data-[state=checked]:text-accent-foreground',
|
|
12
|
+
'data-[state=checked]:bg-tf-accent data-[state=checked]:text-tf-accent-foreground',
|
|
13
13
|
],
|
|
14
14
|
indicator: 'flex items-center justify-center text-current',
|
|
15
15
|
icon: 'h-4 w-4',
|
package/lib/common/form.tsx
CHANGED
|
@@ -99,7 +99,7 @@ const formLabelVariants = tv({
|
|
|
99
99
|
base: '',
|
|
100
100
|
variants: {
|
|
101
101
|
error: {
|
|
102
|
-
true: 'text-destructive',
|
|
102
|
+
true: 'text-tf-destructive',
|
|
103
103
|
},
|
|
104
104
|
},
|
|
105
105
|
});
|
|
@@ -148,7 +148,7 @@ const FormControl = React.forwardRef<
|
|
|
148
148
|
FormControl.displayName = 'FormControl';
|
|
149
149
|
|
|
150
150
|
const formDescriptionVariants = tv({
|
|
151
|
-
base: 'text-muted-foreground',
|
|
151
|
+
base: 'text-tf-muted-foreground',
|
|
152
152
|
variants: {
|
|
153
153
|
size: {
|
|
154
154
|
sm: 'text-[0.8rem] leading-none',
|
|
@@ -178,7 +178,7 @@ const FormDescription = React.forwardRef<
|
|
|
178
178
|
FormDescription.displayName = 'FormDescription';
|
|
179
179
|
|
|
180
180
|
const formMessageVariants = tv({
|
|
181
|
-
base: 'font-medium text-destructive',
|
|
181
|
+
base: 'font-medium text-tf-destructive',
|
|
182
182
|
variants: {
|
|
183
183
|
size: {
|
|
184
184
|
sm: 'text-[0.8rem]',
|
package/lib/common/icon.tsx
CHANGED
package/lib/common/input.tsx
CHANGED
|
@@ -7,8 +7,8 @@ const inputVariants = tv({
|
|
|
7
7
|
slots: {
|
|
8
8
|
root: 'relative',
|
|
9
9
|
input: [
|
|
10
|
-
'flex h-10 w-full border-input bg-background py-2 text-primary-foreground placeholder:text-muted-foreground focus-visible:outline-none',
|
|
11
|
-
'file:border-0 file:bg-transparent file:px-0 file:font-medium file:text-primary-foreground',
|
|
10
|
+
'flex h-10 w-full border-tf-input bg-tf-background py-2 text-tf-primary-foreground placeholder:text-tf-muted-foreground focus-visible:outline-none',
|
|
11
|
+
'file:border-0 file:bg-transparent file:px-0 file:font-medium file:text-tf-primary-foreground',
|
|
12
12
|
'disabled:cursor-not-allowed disabled:opacity-50',
|
|
13
13
|
],
|
|
14
14
|
},
|
|
@@ -16,10 +16,10 @@ const inputVariants = tv({
|
|
|
16
16
|
variant: {
|
|
17
17
|
default: {
|
|
18
18
|
input:
|
|
19
|
-
'rounded-md border px-3 ring-offset-background focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2',
|
|
19
|
+
'rounded-tf-md border px-3 ring-offset-tf-background focus-visible:ring-2 focus-visible:ring-tf-ring focus-visible:ring-offset-2',
|
|
20
20
|
},
|
|
21
21
|
outline: {
|
|
22
|
-
root: 'after:absolute after:left-0 after:top-[calc(100%_+_1px)] after:w-full after:rounded-full after:content-[""] focus-within:after:h-0.5 focus-within:after:bg-ring',
|
|
22
|
+
root: 'after:absolute after:left-0 after:top-[calc(100%_+_1px)] after:w-full after:rounded-full after:content-[""] focus-within:after:h-0.5 focus-within:after:bg-tf-ring',
|
|
23
23
|
input: 'border-b px-1',
|
|
24
24
|
},
|
|
25
25
|
},
|
package/lib/common/label.tsx
CHANGED
package/lib/common/popover.tsx
CHANGED
|
@@ -7,7 +7,7 @@ const Popover = PopoverPrimitive.Root;
|
|
|
7
7
|
const PopoverTrigger = PopoverPrimitive.Trigger;
|
|
8
8
|
|
|
9
9
|
const popoverContentVariants = tv({
|
|
10
|
-
base: 'z-50 w-72 rounded-md border bg-background p-4 text-foreground shadow-md outline-none',
|
|
10
|
+
base: 'z-50 w-72 rounded-tf-md border bg-tf-background p-4 text-tf-foreground shadow-md outline-none',
|
|
11
11
|
});
|
|
12
12
|
const PopoverContent = React.forwardRef<
|
|
13
13
|
React.ElementRef<typeof PopoverPrimitive.Content>,
|
|
@@ -23,8 +23,8 @@ RadioGroup.displayName = RadioGroupPrimitive.Root.displayName;
|
|
|
23
23
|
const radioGroupItemVariants = tv({
|
|
24
24
|
slots: {
|
|
25
25
|
item: [
|
|
26
|
-
'aspect-square h-4 w-4 items-center rounded-full border border-accent text-accent ring-offset-background',
|
|
27
|
-
'focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2',
|
|
26
|
+
'aspect-square h-4 w-4 items-center rounded-full border border-tf-accent text-tf-accent ring-offset-tf-background',
|
|
27
|
+
'focus:outline-none focus-visible:ring-2 focus-visible:ring-tf-ring focus-visible:ring-offset-2',
|
|
28
28
|
'disabled:cursor-not-allowed disabled:opacity-50',
|
|
29
29
|
],
|
|
30
30
|
indicator: 'relative block h-full w-full',
|
package/lib/common/slider.tsx
CHANGED
|
@@ -5,10 +5,10 @@ import { tv } from 'tailwind-variants';
|
|
|
5
5
|
const sliderVariants = tv({
|
|
6
6
|
slots: {
|
|
7
7
|
root: 'relative flex w-full touch-none select-none items-center',
|
|
8
|
-
track: 'relative h-2 w-full grow overflow-hidden rounded-full bg-muted',
|
|
9
|
-
range: 'absolute h-full bg-accent',
|
|
8
|
+
track: 'relative h-2 w-full grow overflow-hidden rounded-full bg-tf-muted',
|
|
9
|
+
range: 'absolute h-full bg-tf-accent',
|
|
10
10
|
thumb:
|
|
11
|
-
'block h-5 w-5 rounded-full border-2 border-accent bg-background ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50',
|
|
11
|
+
'block h-5 w-5 rounded-full border-2 border-tf-accent bg-tf-background ring-offset-tf-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-tf-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50',
|
|
12
12
|
},
|
|
13
13
|
});
|
|
14
14
|
|
package/lib/common/switch.tsx
CHANGED
|
@@ -6,12 +6,12 @@ const switchVariants = tv({
|
|
|
6
6
|
slots: {
|
|
7
7
|
root: [
|
|
8
8
|
'peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors',
|
|
9
|
-
'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background',
|
|
9
|
+
'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-tf-ring focus-visible:ring-offset-2 focus-visible:ring-offset-tf-background',
|
|
10
10
|
'disabled:cursor-not-allowed disabled:opacity-50',
|
|
11
|
-
'data-[state=checked]:bg-accent data-[state=unchecked]:bg-muted',
|
|
11
|
+
'data-[state=checked]:bg-tf-accent data-[state=unchecked]:bg-tf-muted',
|
|
12
12
|
],
|
|
13
13
|
thumb: [
|
|
14
|
-
'pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform',
|
|
14
|
+
'pointer-events-none block h-4 w-4 rounded-full bg-tf-background shadow-lg ring-0 transition-transform',
|
|
15
15
|
'data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0',
|
|
16
16
|
],
|
|
17
17
|
},
|
package/lib/common/textarea.tsx
CHANGED
|
@@ -7,7 +7,7 @@ const textareaVariants = tv({
|
|
|
7
7
|
slots: {
|
|
8
8
|
root: 'relative',
|
|
9
9
|
textarea: [
|
|
10
|
-
'flex min-h-[60px] w-full border-input bg-background py-2 text-primary-foreground shadow-sm placeholder:text-muted-foreground focus-visible:outline-none',
|
|
10
|
+
'flex min-h-[60px] w-full border-tf-input bg-tf-background py-2 text-tf-primary-foreground shadow-sm placeholder:text-tf-muted-foreground focus-visible:outline-none',
|
|
11
11
|
'disabled:cursor-not-allowed disabled:opacity-50',
|
|
12
12
|
],
|
|
13
13
|
},
|
|
@@ -15,10 +15,10 @@ const textareaVariants = tv({
|
|
|
15
15
|
variant: {
|
|
16
16
|
default: {
|
|
17
17
|
textarea:
|
|
18
|
-
'rounded-md border px-3 ring-offset-background focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2',
|
|
18
|
+
'rounded-tf-md border px-3 ring-offset-tf-background focus-visible:ring-2 focus-visible:ring-tf-ring focus-visible:ring-offset-2',
|
|
19
19
|
},
|
|
20
20
|
outline: {
|
|
21
|
-
root: 'after:absolute after:left-0 after:top-[calc(100%_+_1px)] after:w-full after:rounded-full after:content-[""] focus-within:after:h-0.5 focus-within:after:bg-ring',
|
|
21
|
+
root: 'after:absolute after:left-0 after:top-[calc(100%_+_1px)] after:w-full after:rounded-full after:content-[""] focus-within:after:h-0.5 focus-within:after:bg-tf-ring',
|
|
22
22
|
textarea: 'border-b px-1',
|
|
23
23
|
},
|
|
24
24
|
},
|
|
@@ -8,7 +8,7 @@ import { useTwintagForm } from '@twintag/twintag-form/components/provider';
|
|
|
8
8
|
const categoryStyle = tv({
|
|
9
9
|
slots: {
|
|
10
10
|
container: 'relative w-full space-y-3',
|
|
11
|
-
heading: 'font-tf-font text-category',
|
|
11
|
+
heading: 'font-tf-font text-tf-category',
|
|
12
12
|
content: 'grid gap-3',
|
|
13
13
|
},
|
|
14
14
|
variants: {
|
|
@@ -48,7 +48,7 @@ export const Checkbox: FC<Props<'input'>> = ({ label, bind, options }) => {
|
|
|
48
48
|
{label}
|
|
49
49
|
{!isOptional ? (
|
|
50
50
|
<span className='ml-0.5 inline-block'>
|
|
51
|
-
<AsteriskIcon className='h-3 w-3 text-destructive' />
|
|
51
|
+
<AsteriskIcon className='h-3 w-3 text-tf-destructive' />
|
|
52
52
|
</span>
|
|
53
53
|
) : (
|
|
54
54
|
<></>
|
|
@@ -26,7 +26,7 @@ import { useTwintagForm } from '@twintag/twintag-form/components/provider';
|
|
|
26
26
|
const datePickerTriggerVariants = tv({
|
|
27
27
|
slots: {
|
|
28
28
|
button: 'w-full justify-start text-left font-normal',
|
|
29
|
-
icon: 'ml-auto text-muted-foreground opacity-70',
|
|
29
|
+
icon: 'ml-auto text-tf-muted-foreground opacity-70',
|
|
30
30
|
},
|
|
31
31
|
variants: {
|
|
32
32
|
variant: {
|
|
@@ -35,12 +35,12 @@ const datePickerTriggerVariants = tv({
|
|
|
35
35
|
},
|
|
36
36
|
outline: {
|
|
37
37
|
button:
|
|
38
|
-
'rounded-none border-x-transparent border-t-transparent px-1 transition-none hover:bg-white hover:text-muted-foreground',
|
|
38
|
+
'rounded-none border-x-transparent border-t-transparent px-1 transition-none hover:bg-white hover:text-tf-muted-foreground',
|
|
39
39
|
},
|
|
40
40
|
},
|
|
41
41
|
withValue: {
|
|
42
42
|
true: {
|
|
43
|
-
button: 'text-muted-foreground',
|
|
43
|
+
button: 'text-tf-muted-foreground',
|
|
44
44
|
},
|
|
45
45
|
false: {
|
|
46
46
|
button: '',
|
|
@@ -65,7 +65,7 @@ const datePickerTriggerVariants = tv({
|
|
|
65
65
|
|
|
66
66
|
export const DEFAULT_DATE_PICKER_VALUE = null;
|
|
67
67
|
|
|
68
|
-
export const DatePicker: React.FC<Props<'input'>> = ({
|
|
68
|
+
export const DatePicker: React.FC<Props<'input', 'datepicker'>> = ({
|
|
69
69
|
label,
|
|
70
70
|
bind,
|
|
71
71
|
options,
|
|
@@ -95,7 +95,7 @@ export const DatePicker: React.FC<Props<'input'>> = ({
|
|
|
95
95
|
{label}
|
|
96
96
|
{!isOptional ? (
|
|
97
97
|
<span className='ml-0.5 inline-block'>
|
|
98
|
-
<AsteriskIcon className='h-3 w-3 text-destructive' />
|
|
98
|
+
<AsteriskIcon className='h-3 w-3 text-tf-destructive' />
|
|
99
99
|
</span>
|
|
100
100
|
) : (
|
|
101
101
|
<></>
|
|
@@ -17,9 +17,9 @@ import { useTwintagForm } from '@twintag/twintag-form/components/provider';
|
|
|
17
17
|
|
|
18
18
|
export const DEFAULT_FILE_VALUE = '';
|
|
19
19
|
|
|
20
|
-
export const File: FC<Props<'input'>> = ({ label, bind, options }) => {
|
|
20
|
+
export const File: FC<Props<'input', 'file'>> = ({ label, bind, options }) => {
|
|
21
21
|
const { control } = useFormContext();
|
|
22
|
-
const { variant, size } = useTwintagForm();
|
|
22
|
+
const { variant, size, acceptFileType } = useTwintagForm();
|
|
23
23
|
|
|
24
24
|
const isOptional = options?.optionalField;
|
|
25
25
|
|
|
@@ -38,7 +38,7 @@ export const File: FC<Props<'input'>> = ({ label, bind, options }) => {
|
|
|
38
38
|
{label}
|
|
39
39
|
{!isOptional ? (
|
|
40
40
|
<span className='ml-0.5 inline-block'>
|
|
41
|
-
<AsteriskIcon className='h-3 w-3 text-destructive' />
|
|
41
|
+
<AsteriskIcon className='h-3 w-3 text-tf-destructive' />
|
|
42
42
|
</span>
|
|
43
43
|
) : (
|
|
44
44
|
<></>
|
|
@@ -63,6 +63,7 @@ export const File: FC<Props<'input'>> = ({ label, bind, options }) => {
|
|
|
63
63
|
}}
|
|
64
64
|
id={bind}
|
|
65
65
|
type='file'
|
|
66
|
+
accept={options?.accept ?? acceptFileType}
|
|
66
67
|
name={field.name}
|
|
67
68
|
size={size}
|
|
68
69
|
variant={variant}
|
|
@@ -17,7 +17,7 @@ import { useTwintagForm } from '@twintag/twintag-form/components/provider';
|
|
|
17
17
|
|
|
18
18
|
export const DEFAULT_INPUT_VALUE = '';
|
|
19
19
|
|
|
20
|
-
export const Input: FC<Props<'input'>> = ({ label, bind, options }) => {
|
|
20
|
+
export const Input: FC<Props<'input', 'text'>> = ({ label, bind, options }) => {
|
|
21
21
|
const { control } = useFormContext();
|
|
22
22
|
|
|
23
23
|
const { variant, size } = useTwintagForm();
|
|
@@ -39,7 +39,7 @@ export const Input: FC<Props<'input'>> = ({ label, bind, options }) => {
|
|
|
39
39
|
{label}
|
|
40
40
|
{!isOptional ? (
|
|
41
41
|
<span className='ml-0.5 inline-block'>
|
|
42
|
-
<AsteriskIcon className='h-3 w-3 text-destructive' />
|
|
42
|
+
<AsteriskIcon className='h-3 w-3 text-tf-destructive' />
|
|
43
43
|
</span>
|
|
44
44
|
) : (
|
|
45
45
|
<></>
|
|
@@ -17,7 +17,11 @@ import { useTwintagForm } from '@twintag/twintag-form/components/provider';
|
|
|
17
17
|
|
|
18
18
|
export const DEFAULT_TEXTAREA_VALUE = '';
|
|
19
19
|
|
|
20
|
-
export const Textarea: FC<Props<'input'>> = ({
|
|
20
|
+
export const Textarea: FC<Props<'input', 'text'>> = ({
|
|
21
|
+
label,
|
|
22
|
+
bind,
|
|
23
|
+
options,
|
|
24
|
+
}) => {
|
|
21
25
|
const { control } = useFormContext();
|
|
22
26
|
const { variant, size } = useTwintagForm();
|
|
23
27
|
|
|
@@ -38,7 +42,7 @@ export const Textarea: FC<Props<'input'>> = ({ label, bind, options }) => {
|
|
|
38
42
|
{label}
|
|
39
43
|
{!isOptional ? (
|
|
40
44
|
<span className='ml-0.5 inline-block'>
|
|
41
|
-
<AsteriskIcon className='h-3 w-3 text-destructive' />
|
|
45
|
+
<AsteriskIcon className='h-3 w-3 text-tf-destructive' />
|
|
42
46
|
</span>
|
|
43
47
|
) : (
|
|
44
48
|
<></>
|
|
@@ -39,7 +39,7 @@ export const Toggle: FC<Props<'input'>> = ({ label, bind, options }) => {
|
|
|
39
39
|
{label}
|
|
40
40
|
{!isOptional ? (
|
|
41
41
|
<span className='ml-0.5 inline-block'>
|
|
42
|
-
<AsteriskIcon className='h-3 w-3 text-destructive' />
|
|
42
|
+
<AsteriskIcon className='h-3 w-3 text-tf-destructive' />
|
|
43
43
|
</span>
|
|
44
44
|
) : (
|
|
45
45
|
<></>
|