@latte-macchiat-io/latte-vanilla-components 0.0.266 → 0.0.267
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/Row/index.tsx +14 -0
- package/src/components/Form/Row/styles.css.ts +44 -0
- package/src/components/Form/export.tsx +2 -2
- package/src/theme/contract.css.ts +10 -0
- package/src/components/Form/Row/Row.css.ts +0 -73
- package/src/components/Form/Row/Row.tsx +0 -132
package/package.json
CHANGED
@@ -0,0 +1,14 @@
|
|
1
|
+
import { clsx } from 'clsx';
|
2
|
+
import { forwardRef } from 'react';
|
3
|
+
|
4
|
+
import { rowRecipe, type RowVariants } from './styles.css';
|
5
|
+
|
6
|
+
export type RowProps = React.HTMLAttributes<HTMLDivElement> & RowVariants;
|
7
|
+
|
8
|
+
export const Row = forwardRef<HTMLDivElement, RowProps>(({ children, align, className }, ref) => {
|
9
|
+
return (
|
10
|
+
<div ref={ref} className={clsx(rowRecipe({ align }), className)}>
|
11
|
+
{children}
|
12
|
+
</div>
|
13
|
+
);
|
14
|
+
});
|
@@ -0,0 +1,44 @@
|
|
1
|
+
import { recipe, RecipeVariants } from '@vanilla-extract/recipes';
|
2
|
+
|
3
|
+
import { themeContract } from '../../../theme/contract.css';
|
4
|
+
import { generateResponsiveMedia } from '../../../utils/generateResponsiveMedia';
|
5
|
+
|
6
|
+
export const rowRecipe = recipe(
|
7
|
+
{
|
8
|
+
base: {
|
9
|
+
width: '100%',
|
10
|
+
display: 'flex',
|
11
|
+
flexDirection: 'row',
|
12
|
+
|
13
|
+
'@media': {
|
14
|
+
...generateResponsiveMedia({
|
15
|
+
gap: themeContract.form.row.gap,
|
16
|
+
}),
|
17
|
+
},
|
18
|
+
},
|
19
|
+
|
20
|
+
variants: {
|
21
|
+
align: {
|
22
|
+
left: {
|
23
|
+
textAlign: 'left',
|
24
|
+
justifyContent: 'flex-start',
|
25
|
+
},
|
26
|
+
center: {
|
27
|
+
textAlign: 'center',
|
28
|
+
justifyContent: 'center',
|
29
|
+
},
|
30
|
+
right: {
|
31
|
+
textAlign: 'right',
|
32
|
+
justifyContent: 'flex-end',
|
33
|
+
},
|
34
|
+
},
|
35
|
+
},
|
36
|
+
|
37
|
+
defaultVariants: {
|
38
|
+
align: 'left',
|
39
|
+
},
|
40
|
+
},
|
41
|
+
'row'
|
42
|
+
);
|
43
|
+
|
44
|
+
export type RowVariants = RecipeVariants<typeof rowRecipe>;
|
@@ -1,7 +1,7 @@
|
|
1
1
|
export { Form, type FormProps } from '.';
|
2
2
|
|
3
|
-
export { Row, type RowProps } from '
|
4
|
-
export { type RowVariants } from '
|
3
|
+
export { Row, type RowProps } from './Row';
|
4
|
+
export { type RowVariants } from './Row/styles.css';
|
5
5
|
|
6
6
|
export { TextField, type TextFieldProps, type InputType } from '../Form/TextField/TextField';
|
7
7
|
export { type TextFieldVariants } from '../Form/TextField/TextField.css';
|
@@ -906,5 +906,15 @@ export const themeContract = createGlobalThemeContract({
|
|
906
906
|
xl: 'latte-form-paddingLeft-xl',
|
907
907
|
'2xl': 'latte-form-paddingLeft-2xl',
|
908
908
|
},
|
909
|
+
row: {
|
910
|
+
gap: {
|
911
|
+
mobile: 'latte-form-row-gap-mobile',
|
912
|
+
sm: 'latte-form-row-gap-sm',
|
913
|
+
md: 'latte-form-row-gap-md',
|
914
|
+
lg: 'latte-form-row-gap-lg',
|
915
|
+
xl: 'latte-form-row-gap-xl',
|
916
|
+
'2xl': 'latte-form-row-gap-2xl',
|
917
|
+
},
|
918
|
+
},
|
909
919
|
},
|
910
920
|
});
|
@@ -1,73 +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 rowBase = style({
|
6
|
-
display: 'flex',
|
7
|
-
width: '100%',
|
8
|
-
});
|
9
|
-
|
10
|
-
export const rowRecipe = recipe(
|
11
|
-
{
|
12
|
-
base: rowBase,
|
13
|
-
|
14
|
-
variants: {
|
15
|
-
align: {
|
16
|
-
left: {
|
17
|
-
justifyContent: 'flex-start',
|
18
|
-
textAlign: 'left',
|
19
|
-
},
|
20
|
-
center: {
|
21
|
-
justifyContent: 'center',
|
22
|
-
textAlign: 'center',
|
23
|
-
},
|
24
|
-
right: {
|
25
|
-
justifyContent: 'flex-end',
|
26
|
-
textAlign: 'right',
|
27
|
-
},
|
28
|
-
},
|
29
|
-
variant: {
|
30
|
-
default: {
|
31
|
-
flexDirection: 'column',
|
32
|
-
gap: themeContract.space.sm,
|
33
|
-
},
|
34
|
-
actions: {
|
35
|
-
flexDirection: 'row',
|
36
|
-
alignItems: 'center',
|
37
|
-
gap: themeContract.space.md,
|
38
|
-
marginTop: themeContract.space.lg,
|
39
|
-
},
|
40
|
-
message: {
|
41
|
-
flexDirection: 'column',
|
42
|
-
padding: themeContract.space.md,
|
43
|
-
backgroundColor: themeContract.colors.surface,
|
44
|
-
borderRadius: themeContract.radii.md,
|
45
|
-
border: `1px solid ${themeContract.colors.border}`,
|
46
|
-
},
|
47
|
-
},
|
48
|
-
spacing: {
|
49
|
-
none: {
|
50
|
-
gap: 0,
|
51
|
-
},
|
52
|
-
sm: {
|
53
|
-
gap: themeContract.space.sm,
|
54
|
-
},
|
55
|
-
md: {
|
56
|
-
gap: themeContract.space.md,
|
57
|
-
},
|
58
|
-
lg: {
|
59
|
-
gap: themeContract.space.lg,
|
60
|
-
},
|
61
|
-
},
|
62
|
-
},
|
63
|
-
|
64
|
-
defaultVariants: {
|
65
|
-
align: 'left',
|
66
|
-
variant: 'default',
|
67
|
-
spacing: 'sm',
|
68
|
-
},
|
69
|
-
},
|
70
|
-
'row'
|
71
|
-
);
|
72
|
-
|
73
|
-
export type RowVariants = RecipeVariants<typeof rowRecipe>;
|
@@ -1,132 +0,0 @@
|
|
1
|
-
import { clsx } from 'clsx';
|
2
|
-
import { forwardRef } from 'react';
|
3
|
-
import { rowRecipe, type RowVariants } from './Row.css';
|
4
|
-
import { sprinkles, type Sprinkles } from '../../../styles/sprinkles.css';
|
5
|
-
|
6
|
-
export interface RowProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'color'>, Sprinkles, NonNullable<RowVariants> {
|
7
|
-
children: React.ReactNode;
|
8
|
-
isActions?: boolean;
|
9
|
-
isMessage?: boolean;
|
10
|
-
}
|
11
|
-
|
12
|
-
export const Row = forwardRef<HTMLDivElement, RowProps>(
|
13
|
-
(
|
14
|
-
{
|
15
|
-
children,
|
16
|
-
align,
|
17
|
-
variant,
|
18
|
-
spacing,
|
19
|
-
isActions = false,
|
20
|
-
isMessage = false,
|
21
|
-
className,
|
22
|
-
// Extract sprinkles props
|
23
|
-
margin,
|
24
|
-
marginTop,
|
25
|
-
marginBottom,
|
26
|
-
marginLeft,
|
27
|
-
marginRight,
|
28
|
-
padding,
|
29
|
-
paddingTop,
|
30
|
-
paddingBottom,
|
31
|
-
paddingLeft,
|
32
|
-
paddingRight,
|
33
|
-
gap,
|
34
|
-
display,
|
35
|
-
flexDirection,
|
36
|
-
justifyContent,
|
37
|
-
flexWrap,
|
38
|
-
flex,
|
39
|
-
width,
|
40
|
-
height,
|
41
|
-
minWidth,
|
42
|
-
maxWidth,
|
43
|
-
minHeight,
|
44
|
-
position,
|
45
|
-
top,
|
46
|
-
bottom,
|
47
|
-
left,
|
48
|
-
right,
|
49
|
-
zIndex,
|
50
|
-
fontSize,
|
51
|
-
fontFamily,
|
52
|
-
lineHeight,
|
53
|
-
textAlign,
|
54
|
-
fontWeight,
|
55
|
-
color,
|
56
|
-
backgroundColor,
|
57
|
-
borderRadius,
|
58
|
-
borderWidth,
|
59
|
-
borderStyle,
|
60
|
-
borderColor,
|
61
|
-
boxShadow,
|
62
|
-
opacity,
|
63
|
-
overflow,
|
64
|
-
overflowX,
|
65
|
-
overflowY,
|
66
|
-
...htmlProps
|
67
|
-
},
|
68
|
-
ref
|
69
|
-
) => {
|
70
|
-
// Determine the variant based on the props
|
71
|
-
let computedVariant = variant;
|
72
|
-
if (isActions) computedVariant = 'actions';
|
73
|
-
if (isMessage) computedVariant = 'message';
|
74
|
-
|
75
|
-
return (
|
76
|
-
<div
|
77
|
-
ref={ref}
|
78
|
-
className={clsx(
|
79
|
-
rowRecipe({ align, variant: computedVariant, spacing }),
|
80
|
-
sprinkles({
|
81
|
-
margin,
|
82
|
-
marginTop,
|
83
|
-
marginBottom,
|
84
|
-
marginLeft,
|
85
|
-
marginRight,
|
86
|
-
padding,
|
87
|
-
paddingTop,
|
88
|
-
paddingBottom,
|
89
|
-
paddingLeft,
|
90
|
-
paddingRight,
|
91
|
-
gap,
|
92
|
-
display,
|
93
|
-
flexDirection,
|
94
|
-
justifyContent,
|
95
|
-
flexWrap,
|
96
|
-
flex,
|
97
|
-
width,
|
98
|
-
height,
|
99
|
-
minWidth,
|
100
|
-
maxWidth,
|
101
|
-
minHeight,
|
102
|
-
position,
|
103
|
-
top,
|
104
|
-
bottom,
|
105
|
-
left,
|
106
|
-
right,
|
107
|
-
zIndex,
|
108
|
-
fontSize,
|
109
|
-
fontFamily,
|
110
|
-
lineHeight,
|
111
|
-
textAlign,
|
112
|
-
fontWeight,
|
113
|
-
color,
|
114
|
-
backgroundColor,
|
115
|
-
borderRadius,
|
116
|
-
borderWidth,
|
117
|
-
borderStyle,
|
118
|
-
borderColor,
|
119
|
-
boxShadow,
|
120
|
-
opacity,
|
121
|
-
overflow,
|
122
|
-
overflowX,
|
123
|
-
overflowY,
|
124
|
-
}),
|
125
|
-
className
|
126
|
-
)}
|
127
|
-
{...htmlProps}>
|
128
|
-
{children}
|
129
|
-
</div>
|
130
|
-
);
|
131
|
-
}
|
132
|
-
);
|