@latte-macchiat-io/latte-vanilla-components 0.0.272 → 0.0.274

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.272",
3
+ "version": "0.0.274",
4
4
  "description": "Beautiful components for amazing projects, with a touch of Vanilla 🥤",
5
5
  "type": "module",
6
6
  "main": "./src/index.ts",
@@ -1,71 +1,36 @@
1
- import { style } from '@vanilla-extract/css';
2
1
  import { recipe, RecipeVariants } from '@vanilla-extract/recipes';
2
+
3
3
  import { themeContract } from '../../../../theme/contract.css';
4
4
  import { generateResponsiveMedia } from '../../../../utils/generateResponsiveMedia';
5
5
 
6
- const inputBase = style({
7
- width: '100%',
8
- appearance: 'none',
9
- transition: 'all 0.2s ease-in-out',
10
-
11
- fontFamily: themeContract.fonts.body,
12
- color: themeContract.form.textField.color,
13
- border: themeContract.form.textField.border,
14
- borderRadius: themeContract.form.textField.borderRadius,
15
- backgroundColor: themeContract.form.textField.backgroundColor,
16
-
17
- padding: `${themeContract.space.sm} ${themeContract.space.md}`,
18
-
19
- '@media': {
20
- ...generateResponsiveMedia({
21
- paddingTop: themeContract.form.textField.paddingTop,
22
- paddingLeft: themeContract.form.textField.paddingLeft,
23
- paddingRight: themeContract.form.textField.paddingRight,
24
- paddingBottom: themeContract.form.textField.paddingBottom,
25
- }),
26
- },
27
-
28
- '::placeholder': {
29
- color: themeContract.form.textField.placeholderColor,
30
- },
31
-
32
- // ':hover': {
33
- // borderColor: themeContract.colors.primary,
34
- // },
35
-
36
- // ':focus': {
37
- // outline: '2px solid',
38
- // outlineColor: themeContract.colors.primary,
39
- // outlineOffset: '2px',
40
- // borderColor: themeContract.colors.primary,
41
- // },
42
-
43
- // ':disabled': {
44
- // backgroundColor: themeContract.colors.surface,
45
- // color: themeContract.colors.textSecondary,
46
- // cursor: 'not-allowed',
47
- // opacity: '0.6',
48
- // },
49
-
50
- // selectors: {
51
- // '&[data-error="true"]': {
52
- // borderColor: themeContract.colors.error,
53
- // },
54
- // '&[data-error="true"]:focus': {
55
- // outlineColor: themeContract.colors.error,
56
- // borderColor: themeContract.colors.error,
57
- // },
58
- // // WebKit autofill styles
59
- // '&:-webkit-autofill': {
60
- // WebkitTextFillColor: themeContract.colors.text,
61
- // WebkitBoxShadow: `0 0 0px 1000px ${themeContract.colors.background} inset`,
62
- // },
63
- // },
64
- });
65
-
66
6
  export const inputRecipe = recipe(
67
7
  {
68
- base: inputBase,
8
+ base: {
9
+ width: '100%',
10
+ appearance: 'none',
11
+ transition: 'all 0.2s ease-in-out',
12
+
13
+ fontFamily: themeContract.fonts.body,
14
+ color: themeContract.form.textField.color,
15
+ border: themeContract.form.textField.border,
16
+ borderRadius: themeContract.form.textField.borderRadius,
17
+ backgroundColor: themeContract.form.textField.backgroundColor,
18
+
19
+ padding: `${themeContract.space.sm} ${themeContract.space.md}`,
20
+
21
+ '@media': {
22
+ ...generateResponsiveMedia({
23
+ paddingTop: themeContract.form.textField.paddingTop,
24
+ paddingLeft: themeContract.form.textField.paddingLeft,
25
+ paddingRight: themeContract.form.textField.paddingRight,
26
+ paddingBottom: themeContract.form.textField.paddingBottom,
27
+ }),
28
+ },
29
+
30
+ '::placeholder': {
31
+ color: themeContract.form.textField.placeholderColor,
32
+ },
33
+ },
69
34
  },
70
35
  'input'
71
36
  );
@@ -1,130 +1,13 @@
1
1
  import { clsx } from 'clsx';
2
- import { forwardRef } from 'react';
2
+
3
3
  import { textareaRecipe, type TextareaVariants } from './styles.css';
4
- import { sprinkles, type Sprinkles } from '../../../../styles/sprinkles.css';
5
4
 
6
- export interface TextareaProps
7
- extends Omit<React.TextareaHTMLAttributes<HTMLTextAreaElement>, 'color' | 'size'>,
8
- Sprinkles,
9
- NonNullable<TextareaVariants> {
10
- name: string;
11
- hasError?: boolean;
12
- }
5
+ export type TextareaProps = React.TextareaHTMLAttributes<HTMLTextAreaElement> &
6
+ TextareaVariants & {
7
+ name: string;
8
+ hasError?: boolean;
9
+ };
13
10
 
14
- export const Textarea = forwardRef<HTMLTextAreaElement, TextareaProps>(
15
- (
16
- {
17
- name,
18
- hasError = false,
19
- size,
20
- variant,
21
- resize,
22
- className,
23
- // Extract sprinkles props
24
- margin,
25
- marginTop,
26
- marginBottom,
27
- marginLeft,
28
- marginRight,
29
- padding,
30
- paddingTop,
31
- paddingBottom,
32
- paddingLeft,
33
- paddingRight,
34
- gap,
35
- display,
36
- flexDirection,
37
- justifyContent,
38
- flexWrap,
39
- flex,
40
- width,
41
- height,
42
- minWidth,
43
- maxWidth,
44
- minHeight,
45
- position,
46
- top,
47
- bottom,
48
- left,
49
- right,
50
- zIndex,
51
- fontSize,
52
- fontFamily,
53
- lineHeight,
54
- textAlign,
55
- fontWeight,
56
- color,
57
- backgroundColor,
58
- borderRadius,
59
- borderWidth,
60
- borderStyle,
61
- borderColor,
62
- boxShadow,
63
- opacity,
64
- overflow,
65
- overflowX,
66
- overflowY,
67
- ...htmlProps
68
- },
69
- ref
70
- ) => {
71
- return (
72
- <textarea
73
- ref={ref}
74
- id={name}
75
- name={name}
76
- className={clsx(
77
- textareaRecipe({ size, variant, resize }),
78
- sprinkles({
79
- margin,
80
- marginTop,
81
- marginBottom,
82
- marginLeft,
83
- marginRight,
84
- padding,
85
- paddingTop,
86
- paddingBottom,
87
- paddingLeft,
88
- paddingRight,
89
- gap,
90
- display,
91
- flexDirection,
92
- justifyContent,
93
- flexWrap,
94
- flex,
95
- width,
96
- height,
97
- minWidth,
98
- maxWidth,
99
- minHeight,
100
- position,
101
- top,
102
- bottom,
103
- left,
104
- right,
105
- zIndex,
106
- fontSize,
107
- fontFamily,
108
- lineHeight,
109
- textAlign,
110
- fontWeight,
111
- color,
112
- backgroundColor,
113
- borderRadius,
114
- borderWidth,
115
- borderStyle,
116
- borderColor,
117
- boxShadow,
118
- opacity,
119
- overflow,
120
- overflowX,
121
- overflowY,
122
- }),
123
- className
124
- )}
125
- data-error={hasError}
126
- {...htmlProps}
127
- />
128
- );
129
- }
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)} />
130
13
  );
@@ -1,125 +1,36 @@
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 textareaBase = style(
6
- {
7
- appearance: 'none',
8
- backgroundColor: themeContract.colors.background,
9
- border: `1px solid ${themeContract.colors.border}`,
10
- borderRadius: themeContract.radii.md,
11
- color: themeContract.colors.text,
12
- fontFamily: themeContract.fonts.body,
13
- fontSize: themeContract.fontSizes.sm,
14
- lineHeight: themeContract.lineHeights.normal,
15
- padding: `${themeContract.space.sm} ${themeContract.space.md}`,
16
- transition: 'all 0.2s ease-in-out',
17
- width: '100%',
18
- resize: 'vertical',
19
- minHeight: '80px',
20
-
21
- '::placeholder': {
22
- color: themeContract.colors.textSecondary,
23
- },
24
-
25
- ':hover': {
26
- borderColor: themeContract.colors.primary,
27
- },
28
-
29
- ':focus': {
30
- outline: '2px solid',
31
- outlineColor: themeContract.colors.primary,
32
- outlineOffset: '2px',
33
- borderColor: themeContract.colors.primary,
34
- },
35
-
36
- ':disabled': {
37
- backgroundColor: themeContract.colors.surface,
38
- color: themeContract.colors.textSecondary,
39
- cursor: 'not-allowed',
40
- opacity: '0.6',
41
- resize: 'none',
42
- },
43
2
 
44
- selectors: {
45
- '&[data-error="true"]': {
46
- borderColor: themeContract.colors.error,
47
- },
48
- '&[data-error="true"]:focus': {
49
- outlineColor: themeContract.colors.error,
50
- borderColor: themeContract.colors.error,
51
- },
52
- },
53
- },
54
- 'text-area-base'
55
- );
3
+ import { themeContract } from '../../../../theme/contract.css';
4
+ import { generateResponsiveMedia } from '../../../../utils/generateResponsiveMedia';
56
5
 
57
6
  export const textareaRecipe = recipe(
58
7
  {
59
- base: textareaBase,
60
-
61
- variants: {
62
- size: {
63
- sm: {
64
- fontSize: themeContract.fontSizes.xs,
65
- padding: `${themeContract.space.xs} ${themeContract.space.sm}`,
66
- minHeight: '60px',
67
- },
68
- md: {},
69
- lg: {
70
- fontSize: themeContract.fontSizes.md,
71
- padding: `${themeContract.space.md} ${themeContract.space.lg}`,
72
- minHeight: '100px',
73
- },
8
+ base: {
9
+ width: '100%',
10
+ appearance: 'none',
11
+ transition: 'all 0.2s ease-in-out',
12
+
13
+ fontFamily: themeContract.fonts.body,
14
+ color: themeContract.form.textField.color,
15
+ border: themeContract.form.textField.border,
16
+ borderRadius: themeContract.form.textField.borderRadius,
17
+ backgroundColor: themeContract.form.textField.backgroundColor,
18
+
19
+ padding: `${themeContract.space.sm} ${themeContract.space.md}`,
20
+
21
+ '@media': {
22
+ ...generateResponsiveMedia({
23
+ paddingTop: themeContract.form.textField.paddingTop,
24
+ paddingLeft: themeContract.form.textField.paddingLeft,
25
+ paddingRight: themeContract.form.textField.paddingRight,
26
+ paddingBottom: themeContract.form.textField.paddingBottom,
27
+ }),
74
28
  },
75
- variant: {
76
- default: {},
77
- filled: {
78
- backgroundColor: themeContract.colors.surface,
79
- border: 'none',
80
-
81
- ':focus': {
82
- backgroundColor: themeContract.colors.background,
83
- border: `1px solid ${themeContract.colors.primary}`,
84
- },
85
- },
86
- outlined: {
87
- backgroundColor: 'transparent',
88
- },
89
- underlined: {
90
- backgroundColor: 'transparent',
91
- border: 'none',
92
- borderBottom: `1px solid ${themeContract.colors.border}`,
93
- borderRadius: 0,
94
- padding: `${themeContract.space.sm} 0`,
95
29
 
96
- ':focus': {
97
- borderBottom: `2px solid ${themeContract.colors.primary}`,
98
- outline: 'none',
99
- },
100
- },
101
- },
102
- resize: {
103
- vertical: {
104
- resize: 'vertical',
105
- },
106
- horizontal: {
107
- resize: 'horizontal',
108
- },
109
- both: {
110
- resize: 'both',
111
- },
112
- none: {
113
- resize: 'none',
114
- },
30
+ '::placeholder': {
31
+ color: themeContract.form.textField.placeholderColor,
115
32
  },
116
33
  },
117
-
118
- defaultVariants: {
119
- size: 'md',
120
- variant: 'default',
121
- resize: 'vertical',
122
- },
123
34
  },
124
35
  'text-area'
125
36
  );
@@ -3,6 +3,7 @@ import { useMemo } from 'react';
3
3
  import { Input } from './Input';
4
4
  import { InputType } from './Input/types';
5
5
  import { errorMessage, messageContainer, textFieldRecipe } from './styles.css';
6
+ import { Textarea } from './Textarea';
6
7
 
7
8
  export type TextFieldProps = React.HTMLAttributes<HTMLDivElement> & {
8
9
  name: string;
@@ -29,7 +30,7 @@ export const TextField = (props: TextFieldProps) => {
29
30
  <div className={clsx(textFieldRecipe(), props.className)}>
30
31
  {props.label && <label htmlFor={props.name}>{props.label}</label>}
31
32
 
32
- {isTextarea ? <textarea /> : <Input {...props} />}
33
+ {isTextarea ? <Textarea {...props} /> : <Input {...props} />}
33
34
 
34
35
  {hasErrors && (
35
36
  <div className={messageContainer}>
@@ -1,57 +0,0 @@
1
- const themeFormTextFieldInputBase = {
2
- form: {
3
- textField: {
4
- borderRadius: '30px',
5
- paddingTop: {
6
- mobile: '15px',
7
- sm: '15px',
8
- md: '30px',
9
- lg: '30px',
10
- xl: '50px',
11
- '2xl': '50px',
12
- },
13
- paddingBottom: {
14
- mobile: '15px',
15
- sm: '15px',
16
- md: '30px',
17
- lg: '30px',
18
- xl: '50px',
19
- '2xl': '50px',
20
- },
21
- paddingRight: {
22
- mobile: '15px',
23
- sm: '15px',
24
- md: '30px',
25
- lg: '30px',
26
- xl: '50px',
27
- '2xl': '50px',
28
- },
29
- paddingLeft: {
30
- mobile: '15px',
31
- sm: '15px',
32
- md: '30px',
33
- lg: '30px',
34
- xl: '50px',
35
- '2xl': '50px',
36
- },
37
- },
38
- },
39
- };
40
-
41
- export const themeFormTextFieldInputLight = {
42
- form: {
43
- textField: {
44
- ...themeFormTextFieldInputBase.form,
45
- backgroundColor: '#000000',
46
- },
47
- },
48
- };
49
-
50
- export const themeFormTextFieldInputDark = {
51
- form: {
52
- textField: {
53
- ...themeFormTextFieldInputBase.form,
54
- backgroundColor: '#000000',
55
- },
56
- },
57
- };