@twintag/twintag-form 1.6.0 → 1.6.1
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 +7 -7
- package/CHANGELOG.md +6 -0
- package/dist/common/form.d.ts +4 -4
- package/dist/index.cjs +1 -1
- package/dist/index.js +51 -51
- package/dist/webcomponent.cjs +1 -1
- package/dist/webcomponent.js +17 -25
- 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 +4 -4
- package/lib/components/fields/file.tsx +1 -1
- package/lib/components/fields/input.tsx +1 -1
- package/lib/components/fields/radiogroup.tsx +1 -1
- package/lib/components/fields/textarea.tsx +1 -1
- package/lib/components/fields/toggle.tsx +1 -1
- package/lib/components/fields/tri-toggle.tsx +4 -4
- package/package.json +1 -1
- package/tailwind.config.ts +21 -26
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: '',
|
|
@@ -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
|
<></>
|
|
@@ -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
|
<></>
|
|
@@ -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
|
<></>
|
|
@@ -38,7 +38,7 @@ export const Textarea: 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
|
<></>
|
|
@@ -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
|
<></>
|
|
@@ -20,10 +20,10 @@ import { useTwintagForm } from '@twintag/twintag-form/components/provider';
|
|
|
20
20
|
const sliderVariants = tv({
|
|
21
21
|
slots: {
|
|
22
22
|
root: 'relative flex w-11 touch-none select-none items-center',
|
|
23
|
-
track: 'relative h-5 w-full grow overflow-hidden rounded-full bg-muted',
|
|
24
|
-
range: 'absolute h-full bg-accent',
|
|
23
|
+
track: 'relative h-5 w-full grow overflow-hidden rounded-full bg-tf-muted',
|
|
24
|
+
range: 'absolute h-full bg-tf-accent',
|
|
25
25
|
thumb:
|
|
26
|
-
'relative block h-4 w-4 rounded-full border-2 border-transparent bg-background shadow-lg focus-visible:outline-none focus-visible:ring-0 disabled:pointer-events-none disabled:opacity-50',
|
|
26
|
+
'relative block h-4 w-4 rounded-full border-2 border-transparent bg-tf-background shadow-lg focus-visible:outline-none focus-visible:ring-0 disabled:pointer-events-none disabled:opacity-50',
|
|
27
27
|
},
|
|
28
28
|
variants: {
|
|
29
29
|
state: {
|
|
@@ -33,7 +33,7 @@ const sliderVariants = tv({
|
|
|
33
33
|
},
|
|
34
34
|
// null
|
|
35
35
|
1: {
|
|
36
|
-
thumb: 'h-5 w-5 border-accent',
|
|
36
|
+
thumb: 'h-5 w-5 border-tf-accent',
|
|
37
37
|
},
|
|
38
38
|
// true
|
|
39
39
|
2: {
|
package/package.json
CHANGED
package/tailwind.config.ts
CHANGED
|
@@ -7,36 +7,31 @@ const config = {
|
|
|
7
7
|
theme: {
|
|
8
8
|
extend: {
|
|
9
9
|
colors: {
|
|
10
|
-
category: 'hsl(var(--tf-category) / <alpha-value>)',
|
|
11
|
-
label: 'hsl(var(--tf-label) / <alpha-value>)',
|
|
10
|
+
'tf-category': 'hsl(var(--tf-category) / <alpha-value>)',
|
|
11
|
+
'tf-label': 'hsl(var(--tf-label) / <alpha-value>)',
|
|
12
12
|
|
|
13
|
-
background: 'hsl(var(--tf-background) / <alpha-value>)',
|
|
14
|
-
foreground: 'hsl(var(--tf-foreground) / <alpha-value>)',
|
|
13
|
+
'tf-background': 'hsl(var(--tf-background) / <alpha-value>)',
|
|
14
|
+
'tf-foreground': 'hsl(var(--tf-foreground) / <alpha-value>)',
|
|
15
15
|
|
|
16
|
-
primary:
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
accent:
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
foreground: 'hsl(var(--tf-muted-foreground) / <alpha-value>)',
|
|
31
|
-
},
|
|
32
|
-
|
|
33
|
-
input: 'hsl(var(--tf-input) / <alpha-value>)',
|
|
34
|
-
ring: 'hsl(var(--tf-ring) / <alpha-value>)',
|
|
16
|
+
'tf-primary': 'hsl(var(--tf-primary) / <alpha-value>)',
|
|
17
|
+
'tf-primary-foreground':
|
|
18
|
+
'hsl(var(--tf-primary-foreground) / <alpha-value>)',
|
|
19
|
+
'tf-accent': 'hsl(var(--tf-accent) / <alpha-value>)',
|
|
20
|
+
'tf-accent-foreground':
|
|
21
|
+
'hsl(var(--tf-accent-foreground) / <alpha-value>)',
|
|
22
|
+
'tf-destructive': 'hsl(var(--tf-destructive) / <alpha-value>)',
|
|
23
|
+
'tf-destructive-foreground':
|
|
24
|
+
'hsl(var(--tf-destructive-foreground) / <alpha-value>)',
|
|
25
|
+
'tf-muted': 'hsl(var(--tf-muted) / <alpha-value>)',
|
|
26
|
+
'tf-muted-foreground':
|
|
27
|
+
'hsl(var(--tf-muted-foreground) / <alpha-value>)',
|
|
28
|
+
'tf-input': 'hsl(var(--tf-input) / <alpha-value>)',
|
|
29
|
+
'tf-ring': 'hsl(var(--tf-ring) / <alpha-value>)',
|
|
35
30
|
},
|
|
36
31
|
borderRadius: {
|
|
37
|
-
lg: 'var(--tf-radius)',
|
|
38
|
-
md: 'calc(var(--tf-radius) - 2px)',
|
|
39
|
-
sm: 'calc(var(--tf-radius) - 4px)',
|
|
32
|
+
'tf-lg': 'var(--tf-radius)',
|
|
33
|
+
'tf-md': 'calc(var(--tf-radius) - 2px)',
|
|
34
|
+
'tf-sm': 'calc(var(--tf-radius) - 4px)',
|
|
40
35
|
},
|
|
41
36
|
fontFamily: {
|
|
42
37
|
'tf-font': ['var(--tf-font)', ...fontFamily.sans],
|