@latte-macchiat-io/latte-vanilla-components 0.0.258 → 0.0.259
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/package.json +1 -1
- package/src/components/Form/export.tsx +1 -2
- package/src/components/Form/index.tsx +11 -0
- package/src/components/Form/styles.css.ts +27 -0
- package/src/components/Form/theme.tsx +66 -0
- package/src/theme/baseThemeValues.ts +4 -0
- package/src/theme/contract.css.ts +52 -0
- package/src/theme/createTheme.ts +3 -0
- package/src/components/Form/Form.css.ts +0 -67
- package/src/components/Form/Form.tsx +0 -122
package/package.json
CHANGED
@@ -0,0 +1,11 @@
|
|
1
|
+
import { clsx } from 'clsx';
|
2
|
+
import { forwardRef } from 'react';
|
3
|
+
import { formRecipe } from './styles.css';
|
4
|
+
|
5
|
+
export type FormProps = React.HTMLAttributes<HTMLDivElement> & {
|
6
|
+
children: React.ReactNode;
|
7
|
+
};
|
8
|
+
|
9
|
+
export const Form = forwardRef<HTMLFormElement, FormProps>(({ children, className, ...rest }) => {
|
10
|
+
return <form className={clsx(formRecipe(), className)}>{children}</form>;
|
11
|
+
});
|
@@ -0,0 +1,27 @@
|
|
1
|
+
import { style } from '@vanilla-extract/css';
|
2
|
+
import { recipe } from '@vanilla-extract/recipes';
|
3
|
+
|
4
|
+
import { themeContract } from '../../theme/contract.css';
|
5
|
+
import { generateResponsiveMedia } from '../../utils/generateResponsiveMedia';
|
6
|
+
|
7
|
+
const formBase = style({
|
8
|
+
backgroundColor: themeContract.form.backgroundColor,
|
9
|
+
|
10
|
+
'@media': {
|
11
|
+
...generateResponsiveMedia({
|
12
|
+
gap: themeContract.form.gap,
|
13
|
+
width: themeContract.form.width,
|
14
|
+
paddingTop: themeContract.form.paddingBottom,
|
15
|
+
paddingBottom: themeContract.form.paddingBottom,
|
16
|
+
paddingRight: themeContract.form.paddingRight,
|
17
|
+
paddingLeft: themeContract.form.paddingLeft,
|
18
|
+
}),
|
19
|
+
},
|
20
|
+
});
|
21
|
+
|
22
|
+
export const formRecipe = recipe(
|
23
|
+
{
|
24
|
+
base: formBase,
|
25
|
+
},
|
26
|
+
'form'
|
27
|
+
);
|
@@ -0,0 +1,66 @@
|
|
1
|
+
const themeFormBase = {
|
2
|
+
form: {
|
3
|
+
width: {
|
4
|
+
mobile: '15px',
|
5
|
+
sm: '15px',
|
6
|
+
md: '30px',
|
7
|
+
lg: '30px',
|
8
|
+
xl: '50px',
|
9
|
+
'2xl': '50px',
|
10
|
+
},
|
11
|
+
gap: {
|
12
|
+
mobile: '15px',
|
13
|
+
sm: '15px',
|
14
|
+
md: '30px',
|
15
|
+
lg: '30px',
|
16
|
+
xl: '50px',
|
17
|
+
'2xl': '50px',
|
18
|
+
},
|
19
|
+
paddingTop: {
|
20
|
+
mobile: '15px',
|
21
|
+
sm: '15px',
|
22
|
+
md: '30px',
|
23
|
+
lg: '30px',
|
24
|
+
xl: '50px',
|
25
|
+
'2xl': '50px',
|
26
|
+
},
|
27
|
+
paddingBottom: {
|
28
|
+
mobile: '15px',
|
29
|
+
sm: '15px',
|
30
|
+
md: '30px',
|
31
|
+
lg: '30px',
|
32
|
+
xl: '50px',
|
33
|
+
'2xl': '50px',
|
34
|
+
},
|
35
|
+
paddingRight: {
|
36
|
+
mobile: '15px',
|
37
|
+
sm: '15px',
|
38
|
+
md: '30px',
|
39
|
+
lg: '30px',
|
40
|
+
xl: '50px',
|
41
|
+
'2xl': '50px',
|
42
|
+
},
|
43
|
+
paddingLeft: {
|
44
|
+
mobile: '15px',
|
45
|
+
sm: '15px',
|
46
|
+
md: '30px',
|
47
|
+
lg: '30px',
|
48
|
+
xl: '50px',
|
49
|
+
'2xl': '50px',
|
50
|
+
},
|
51
|
+
},
|
52
|
+
};
|
53
|
+
|
54
|
+
export const themeFormLight = {
|
55
|
+
form: {
|
56
|
+
...themeFormBase.form,
|
57
|
+
backgroundColor: '#000000',
|
58
|
+
},
|
59
|
+
};
|
60
|
+
|
61
|
+
export const themeFormDark = {
|
62
|
+
form: {
|
63
|
+
...themeFormBase.form,
|
64
|
+
backgroundColor: '#000000',
|
65
|
+
},
|
66
|
+
};
|
@@ -3,6 +3,7 @@ import { themeButtonDark, themeButtonLight } from '../components/Button/theme';
|
|
3
3
|
import { themeCarouselDark, themeCarouselLight } from '../components/Carousel/theme';
|
4
4
|
import { themeColumnsDark, themeColumnsLight } from '../components/Columns/theme';
|
5
5
|
import { themeFooterDark, themeFooterLight } from '../components/Footer/theme';
|
6
|
+
import { themeFormDark, themeFormLight } from '../components/Form/theme';
|
6
7
|
import { themeHeaderDark, themeHeaderLight } from '../components/Header/theme';
|
7
8
|
import { themeHeadingDark, themeHeadingLight } from '../components/Heading/theme';
|
8
9
|
import { themeIconDark, themeIconLight } from '../components/Icon/theme';
|
@@ -139,6 +140,7 @@ export const baseLightTheme = {
|
|
139
140
|
...themeNavSocialLight,
|
140
141
|
|
141
142
|
...themeVideoLight,
|
143
|
+
...themeFormLight,
|
142
144
|
};
|
143
145
|
|
144
146
|
export const baseDarkTheme = {
|
@@ -266,4 +268,6 @@ export const baseDarkTheme = {
|
|
266
268
|
...themeNavSocialDark,
|
267
269
|
|
268
270
|
...themeVideoDark,
|
271
|
+
|
272
|
+
...themeFormDark,
|
269
273
|
};
|
@@ -854,4 +854,56 @@ export const themeContract = createGlobalThemeContract({
|
|
854
854
|
},
|
855
855
|
},
|
856
856
|
},
|
857
|
+
|
858
|
+
form: {
|
859
|
+
backgroundColor: 'latte-form-backgroundColor',
|
860
|
+
width: {
|
861
|
+
mobile: 'latte-form-width-mobile',
|
862
|
+
sm: 'latte-form-width-sm',
|
863
|
+
md: 'latte-form-width-md',
|
864
|
+
lg: 'latte-form-width-lg',
|
865
|
+
xl: 'latte-form-width-xl',
|
866
|
+
'2xl': 'latte-form-width-2xl',
|
867
|
+
},
|
868
|
+
gap: {
|
869
|
+
mobile: 'latte-form-gap-mobile',
|
870
|
+
sm: 'latte-form-gap-sm',
|
871
|
+
md: 'latte-form-gap-md',
|
872
|
+
lg: 'latte-form-gap-lg',
|
873
|
+
xl: 'latte-form-gap-xl',
|
874
|
+
'2xl': 'latte-form-gap-2xl',
|
875
|
+
},
|
876
|
+
paddingTop: {
|
877
|
+
mobile: 'latte-form-paddingTop-mobile',
|
878
|
+
sm: 'latte-form-paddingTop-sm',
|
879
|
+
md: 'latte-form-paddingTop-md',
|
880
|
+
lg: 'latte-form-paddingTop-lg',
|
881
|
+
xl: 'latte-form-paddingTop-xl',
|
882
|
+
'2xl': 'latte-form-paddingTop-2xl',
|
883
|
+
},
|
884
|
+
paddingBottom: {
|
885
|
+
mobile: 'latte-form-paddingBottom-mobile',
|
886
|
+
sm: 'latte-form-paddingBottom-sm',
|
887
|
+
md: 'latte-form-paddingBottom-md',
|
888
|
+
lg: 'latte-form-paddingBottom-lg',
|
889
|
+
xl: 'latte-form-paddingBottom-xl',
|
890
|
+
'2xl': 'latte-form-paddingBottom-2xl',
|
891
|
+
},
|
892
|
+
paddingRight: {
|
893
|
+
mobile: 'latte-form-paddingRight-mobile',
|
894
|
+
sm: 'latte-form-paddingRight-sm',
|
895
|
+
md: 'latte-form-paddingRight-md',
|
896
|
+
lg: 'latte-form-paddingRight-lg',
|
897
|
+
xl: 'latte-form-paddingRight-xl',
|
898
|
+
'2xl': 'latte-form-paddingRight-2xl',
|
899
|
+
},
|
900
|
+
paddingLeft: {
|
901
|
+
mobile: 'latte-form-paddingLeft-mobile',
|
902
|
+
sm: 'latte-form-paddingLeft-sm',
|
903
|
+
md: 'latte-form-paddingLeft-md',
|
904
|
+
lg: 'latte-form-paddingLeft-lg',
|
905
|
+
xl: 'latte-form-paddingLeft-xl',
|
906
|
+
'2xl': 'latte-form-paddingLeft-2xl',
|
907
|
+
},
|
908
|
+
},
|
857
909
|
});
|
package/src/theme/createTheme.ts
CHANGED
@@ -30,6 +30,7 @@ export type ThemeOverrides = {
|
|
30
30
|
navSocial?: Partial<typeof baseLightTheme.navSocial>;
|
31
31
|
video?: Partial<typeof baseLightTheme.video>;
|
32
32
|
carousel?: Partial<typeof baseLightTheme.carousel>;
|
33
|
+
form?: Partial<typeof baseLightTheme.form>;
|
33
34
|
};
|
34
35
|
|
35
36
|
// Utility to create a theme with partial overrides over light theme base
|
@@ -61,6 +62,7 @@ const createAppTheme = (selector: string, overrides: ThemeOverrides = {}) => {
|
|
61
62
|
navSocial: { ...baseLightTheme.navSocial, ...overrides.navSocial },
|
62
63
|
video: { ...baseLightTheme.video, ...overrides.video },
|
63
64
|
carousel: { ...baseLightTheme.carousel, ...overrides.carousel },
|
65
|
+
form: { ...baseLightTheme.form, ...overrides.carousel },
|
64
66
|
});
|
65
67
|
};
|
66
68
|
|
@@ -93,6 +95,7 @@ const createAppDarkTheme = (selector: string, overrides: ThemeOverrides = {}) =>
|
|
93
95
|
navSocial: { ...baseDarkTheme.navSocial, ...overrides.navSocial },
|
94
96
|
video: { ...baseDarkTheme.video, ...overrides.video },
|
95
97
|
carousel: { ...baseDarkTheme.carousel, ...overrides.carousel },
|
98
|
+
form: { ...baseDarkTheme.form, ...overrides.carousel },
|
96
99
|
});
|
97
100
|
};
|
98
101
|
|
@@ -1,67 +0,0 @@
|
|
1
|
-
import { style } from '@vanilla-extract/css';
|
2
|
-
import { recipe, RecipeVariants } from '@vanilla-extract/recipes';
|
3
|
-
import { themeContract } from '../../theme/contract.css';
|
4
|
-
|
5
|
-
const formBase = style({
|
6
|
-
width: '100%',
|
7
|
-
backgroundColor: 'transparent',
|
8
|
-
});
|
9
|
-
|
10
|
-
export const formRecipe = recipe(
|
11
|
-
{
|
12
|
-
base: formBase,
|
13
|
-
|
14
|
-
variants: {
|
15
|
-
spacing: {
|
16
|
-
none: {
|
17
|
-
gap: 0,
|
18
|
-
},
|
19
|
-
sm: {
|
20
|
-
display: 'flex',
|
21
|
-
flexDirection: 'column',
|
22
|
-
gap: themeContract.space.sm,
|
23
|
-
},
|
24
|
-
md: {
|
25
|
-
display: 'flex',
|
26
|
-
flexDirection: 'column',
|
27
|
-
gap: themeContract.space.md,
|
28
|
-
},
|
29
|
-
lg: {
|
30
|
-
display: 'flex',
|
31
|
-
flexDirection: 'column',
|
32
|
-
gap: themeContract.space.lg,
|
33
|
-
},
|
34
|
-
xl: {
|
35
|
-
display: 'flex',
|
36
|
-
flexDirection: 'column',
|
37
|
-
gap: themeContract.space.xl,
|
38
|
-
},
|
39
|
-
},
|
40
|
-
layout: {
|
41
|
-
stacked: {
|
42
|
-
display: 'flex',
|
43
|
-
flexDirection: 'column',
|
44
|
-
},
|
45
|
-
inline: {
|
46
|
-
display: 'flex',
|
47
|
-
flexDirection: 'row',
|
48
|
-
flexWrap: 'wrap',
|
49
|
-
alignItems: 'flex-end',
|
50
|
-
},
|
51
|
-
grid: {
|
52
|
-
display: 'grid',
|
53
|
-
gridTemplateColumns: 'repeat(auto-fit, minmax(250px, 1fr))',
|
54
|
-
gap: themeContract.space.md,
|
55
|
-
},
|
56
|
-
},
|
57
|
-
},
|
58
|
-
|
59
|
-
defaultVariants: {
|
60
|
-
spacing: 'md',
|
61
|
-
layout: 'stacked',
|
62
|
-
},
|
63
|
-
},
|
64
|
-
'form'
|
65
|
-
);
|
66
|
-
|
67
|
-
export type FormVariants = RecipeVariants<typeof formRecipe>;
|
@@ -1,122 +0,0 @@
|
|
1
|
-
import { clsx } from 'clsx';
|
2
|
-
import { forwardRef } from 'react';
|
3
|
-
import { formRecipe, type FormVariants } from './Form.css';
|
4
|
-
import { sprinkles, type Sprinkles } from '../../styles/sprinkles.css';
|
5
|
-
|
6
|
-
export interface FormProps extends Omit<React.FormHTMLAttributes<HTMLFormElement>, 'color'>, Sprinkles, NonNullable<FormVariants> {
|
7
|
-
children: React.ReactNode;
|
8
|
-
}
|
9
|
-
|
10
|
-
export const Form = forwardRef<HTMLFormElement, FormProps>(
|
11
|
-
(
|
12
|
-
{
|
13
|
-
children,
|
14
|
-
spacing,
|
15
|
-
layout,
|
16
|
-
className,
|
17
|
-
// Extract sprinkles props
|
18
|
-
margin,
|
19
|
-
marginTop,
|
20
|
-
marginBottom,
|
21
|
-
marginLeft,
|
22
|
-
marginRight,
|
23
|
-
padding,
|
24
|
-
paddingTop,
|
25
|
-
paddingBottom,
|
26
|
-
paddingLeft,
|
27
|
-
paddingRight,
|
28
|
-
gap,
|
29
|
-
display,
|
30
|
-
flexDirection,
|
31
|
-
justifyContent,
|
32
|
-
flexWrap,
|
33
|
-
flex,
|
34
|
-
width,
|
35
|
-
height,
|
36
|
-
minWidth,
|
37
|
-
maxWidth,
|
38
|
-
minHeight,
|
39
|
-
position,
|
40
|
-
top,
|
41
|
-
bottom,
|
42
|
-
left,
|
43
|
-
right,
|
44
|
-
zIndex,
|
45
|
-
fontSize,
|
46
|
-
fontFamily,
|
47
|
-
lineHeight,
|
48
|
-
textAlign,
|
49
|
-
fontWeight,
|
50
|
-
color,
|
51
|
-
backgroundColor,
|
52
|
-
borderRadius,
|
53
|
-
borderWidth,
|
54
|
-
borderStyle,
|
55
|
-
borderColor,
|
56
|
-
boxShadow,
|
57
|
-
opacity,
|
58
|
-
overflow,
|
59
|
-
overflowX,
|
60
|
-
overflowY,
|
61
|
-
...htmlProps
|
62
|
-
},
|
63
|
-
ref
|
64
|
-
) => {
|
65
|
-
return (
|
66
|
-
<form
|
67
|
-
ref={ref}
|
68
|
-
className={clsx(
|
69
|
-
formRecipe({ spacing, layout }),
|
70
|
-
sprinkles({
|
71
|
-
margin,
|
72
|
-
marginTop,
|
73
|
-
marginBottom,
|
74
|
-
marginLeft,
|
75
|
-
marginRight,
|
76
|
-
padding,
|
77
|
-
paddingTop,
|
78
|
-
paddingBottom,
|
79
|
-
paddingLeft,
|
80
|
-
paddingRight,
|
81
|
-
gap,
|
82
|
-
display,
|
83
|
-
flexDirection,
|
84
|
-
justifyContent,
|
85
|
-
flexWrap,
|
86
|
-
flex,
|
87
|
-
width,
|
88
|
-
height,
|
89
|
-
minWidth,
|
90
|
-
maxWidth,
|
91
|
-
minHeight,
|
92
|
-
position,
|
93
|
-
top,
|
94
|
-
bottom,
|
95
|
-
left,
|
96
|
-
right,
|
97
|
-
zIndex,
|
98
|
-
fontSize,
|
99
|
-
fontFamily,
|
100
|
-
lineHeight,
|
101
|
-
textAlign,
|
102
|
-
fontWeight,
|
103
|
-
color,
|
104
|
-
backgroundColor,
|
105
|
-
borderRadius,
|
106
|
-
borderWidth,
|
107
|
-
borderStyle,
|
108
|
-
borderColor,
|
109
|
-
boxShadow,
|
110
|
-
opacity,
|
111
|
-
overflow,
|
112
|
-
overflowX,
|
113
|
-
overflowY,
|
114
|
-
}),
|
115
|
-
className
|
116
|
-
)}
|
117
|
-
{...htmlProps}>
|
118
|
-
{children}
|
119
|
-
</form>
|
120
|
-
);
|
121
|
-
}
|
122
|
-
);
|