@latte-macchiat-io/latte-vanilla-components 0.0.274 → 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,6 +1,6 @@
1
1
  {
2
2
  "name": "@latte-macchiat-io/latte-vanilla-components",
3
- "version": "0.0.274",
3
+ "version": "0.0.275",
4
4
  "description": "Beautiful components for amazing projects, with a touch of Vanilla 🥤",
5
5
  "type": "module",
6
6
  "main": "./src/index.ts",
@@ -1,128 +1,16 @@
1
1
  import { clsx } from 'clsx';
2
- import { forwardRef } from 'react';
2
+
3
3
  import { labelRecipe, type LabelVariants } from './styles.css';
4
- import { sprinkles, type Sprinkles } from '../../../../styles/sprinkles.css';
5
4
 
6
- export interface LabelProps extends Omit<React.LabelHTMLAttributes<HTMLLabelElement>, 'color'>, Sprinkles, NonNullable<LabelVariants> {
7
- label: string;
8
- name: string;
9
- required?: boolean;
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 = forwardRef<HTMLLabelElement, LabelProps>(
13
- (
14
- {
15
- label,
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: labelBase,
33
-
34
- variants: {
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'
@@ -7,6 +7,8 @@ export const textareaRecipe = recipe(
7
7
  {
8
8
  base: {
9
9
  width: '100%',
10
+ maxWidth: '100%',
11
+ minWidth: '100%',
10
12
  appearance: 'none',
11
13
  transition: 'all 0.2s ease-in-out',
12
14