@latte-macchiat-io/latte-vanilla-components 0.0.273 → 0.0.275
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
CHANGED
@@ -1,128 +1,16 @@
|
|
1
1
|
import { clsx } from 'clsx';
|
2
|
-
|
2
|
+
|
3
3
|
import { labelRecipe, type LabelVariants } from './styles.css';
|
4
|
-
import { sprinkles, type Sprinkles } from '../../../../styles/sprinkles.css';
|
5
4
|
|
6
|
-
export
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
5
|
+
export type LabelProps = React.LabelHTMLAttributes<HTMLLabelElement> &
|
6
|
+
LabelVariants & {
|
7
|
+
name: string;
|
8
|
+
label: string;
|
9
|
+
required: boolean;
|
10
|
+
};
|
11
11
|
|
12
|
-
export const Label =
|
13
|
-
(
|
14
|
-
{
|
15
|
-
|
16
|
-
name,
|
17
|
-
required = false,
|
18
|
-
size,
|
19
|
-
variant,
|
20
|
-
className,
|
21
|
-
// Extract sprinkles props
|
22
|
-
margin,
|
23
|
-
marginTop,
|
24
|
-
marginBottom,
|
25
|
-
marginLeft,
|
26
|
-
marginRight,
|
27
|
-
padding,
|
28
|
-
paddingTop,
|
29
|
-
paddingBottom,
|
30
|
-
paddingLeft,
|
31
|
-
paddingRight,
|
32
|
-
gap,
|
33
|
-
display,
|
34
|
-
flexDirection,
|
35
|
-
justifyContent,
|
36
|
-
flexWrap,
|
37
|
-
flex,
|
38
|
-
width,
|
39
|
-
height,
|
40
|
-
minWidth,
|
41
|
-
maxWidth,
|
42
|
-
minHeight,
|
43
|
-
position,
|
44
|
-
top,
|
45
|
-
bottom,
|
46
|
-
left,
|
47
|
-
right,
|
48
|
-
zIndex,
|
49
|
-
fontSize,
|
50
|
-
fontFamily,
|
51
|
-
lineHeight,
|
52
|
-
textAlign,
|
53
|
-
fontWeight,
|
54
|
-
color,
|
55
|
-
backgroundColor,
|
56
|
-
borderRadius,
|
57
|
-
borderWidth,
|
58
|
-
borderStyle,
|
59
|
-
borderColor,
|
60
|
-
boxShadow,
|
61
|
-
opacity,
|
62
|
-
overflow,
|
63
|
-
overflowX,
|
64
|
-
overflowY,
|
65
|
-
...htmlProps
|
66
|
-
},
|
67
|
-
ref
|
68
|
-
) => {
|
69
|
-
return (
|
70
|
-
<label
|
71
|
-
ref={ref}
|
72
|
-
htmlFor={name}
|
73
|
-
className={clsx(
|
74
|
-
labelRecipe({ size, variant }),
|
75
|
-
sprinkles({
|
76
|
-
margin,
|
77
|
-
marginTop,
|
78
|
-
marginBottom,
|
79
|
-
marginLeft,
|
80
|
-
marginRight,
|
81
|
-
padding,
|
82
|
-
paddingTop,
|
83
|
-
paddingBottom,
|
84
|
-
paddingLeft,
|
85
|
-
paddingRight,
|
86
|
-
gap,
|
87
|
-
display,
|
88
|
-
flexDirection,
|
89
|
-
justifyContent,
|
90
|
-
flexWrap,
|
91
|
-
flex,
|
92
|
-
width,
|
93
|
-
height,
|
94
|
-
minWidth,
|
95
|
-
maxWidth,
|
96
|
-
minHeight,
|
97
|
-
position,
|
98
|
-
top,
|
99
|
-
bottom,
|
100
|
-
left,
|
101
|
-
right,
|
102
|
-
zIndex,
|
103
|
-
fontSize,
|
104
|
-
fontFamily,
|
105
|
-
lineHeight,
|
106
|
-
textAlign,
|
107
|
-
fontWeight,
|
108
|
-
color,
|
109
|
-
backgroundColor,
|
110
|
-
borderRadius,
|
111
|
-
borderWidth,
|
112
|
-
borderStyle,
|
113
|
-
borderColor,
|
114
|
-
boxShadow,
|
115
|
-
opacity,
|
116
|
-
overflow,
|
117
|
-
overflowX,
|
118
|
-
overflowY,
|
119
|
-
}),
|
120
|
-
className
|
121
|
-
)}
|
122
|
-
data-required={required}
|
123
|
-
{...htmlProps}>
|
124
|
-
{label}
|
125
|
-
</label>
|
126
|
-
);
|
127
|
-
}
|
12
|
+
export const Label = ({ label, name, required, className }: LabelProps) => (
|
13
|
+
<label htmlFor={name} className={clsx(labelRecipe(), className)}>
|
14
|
+
{label} {required && '*'}
|
15
|
+
</label>
|
128
16
|
);
|
@@ -1,61 +1,10 @@
|
|
1
|
-
import { style } from '@vanilla-extract/css';
|
2
1
|
import { recipe, RecipeVariants } from '@vanilla-extract/recipes';
|
3
|
-
import { themeContract } from '../../../../theme/contract.css';
|
4
|
-
|
5
|
-
const labelBase = style(
|
6
|
-
{
|
7
|
-
fontFamily: themeContract.fonts.body,
|
8
|
-
fontSize: themeContract.fontSizes.sm,
|
9
|
-
fontWeight: themeContract.fontWeights.medium,
|
10
|
-
color: themeContract.colors.text,
|
11
|
-
lineHeight: themeContract.lineHeights.tight,
|
12
|
-
width: '100%',
|
13
|
-
textAlign: 'left',
|
14
|
-
paddingBottom: themeContract.space.xs,
|
15
|
-
|
16
|
-
// selectors: {
|
17
|
-
// '&[data-required="true"]': {
|
18
|
-
// selectors: {
|
19
|
-
// '&::after': {
|
20
|
-
// content: ' *',
|
21
|
-
// color: themeContract.colors.error,
|
22
|
-
// },
|
23
|
-
// },
|
24
|
-
// },
|
25
|
-
// },
|
26
|
-
},
|
27
|
-
'text-field-label-base'
|
28
|
-
);
|
29
2
|
|
30
3
|
export const labelRecipe = recipe(
|
31
4
|
{
|
32
|
-
base:
|
33
|
-
|
34
|
-
|
35
|
-
size: {
|
36
|
-
sm: {
|
37
|
-
fontSize: themeContract.fontSizes.xs,
|
38
|
-
paddingBottom: themeContract.space.xs,
|
39
|
-
},
|
40
|
-
md: {},
|
41
|
-
lg: {
|
42
|
-
fontSize: themeContract.fontSizes.md,
|
43
|
-
paddingBottom: themeContract.space.sm,
|
44
|
-
},
|
45
|
-
},
|
46
|
-
variant: {
|
47
|
-
default: {},
|
48
|
-
inline: {
|
49
|
-
display: 'inline-block',
|
50
|
-
marginRight: themeContract.space.sm,
|
51
|
-
paddingBottom: 0,
|
52
|
-
},
|
53
|
-
},
|
54
|
-
},
|
55
|
-
|
56
|
-
defaultVariants: {
|
57
|
-
size: 'md',
|
58
|
-
variant: 'default',
|
5
|
+
base: {
|
6
|
+
width: '100%',
|
7
|
+
textAlign: 'left',
|
59
8
|
},
|
60
9
|
},
|
61
10
|
'text-field-label'
|
@@ -8,6 +8,6 @@ export type TextareaProps = React.TextareaHTMLAttributes<HTMLTextAreaElement> &
|
|
8
8
|
hasError?: boolean;
|
9
9
|
};
|
10
10
|
|
11
|
-
export const Textarea = ({ name, size, variant, resize, className }: TextareaProps) => (
|
12
|
-
<textarea id={name} name={name} className={clsx(textareaRecipe({ size, variant, resize }), className)} />
|
11
|
+
export const Textarea = ({ name, size, variant, resize, rows, className }: TextareaProps) => (
|
12
|
+
<textarea id={name} rows={rows} name={name} className={clsx(textareaRecipe({ size, variant, resize }), className)} />
|
13
13
|
);
|