@kalink-ui/seedly 0.31.0 → 0.32.1

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/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @kalink-ui/seedly
2
2
 
3
+ ## 0.32.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 9d3abfd: Add proper styling solution for Input component
8
+
9
+ ## 0.32.0
10
+
11
+ ### Minor Changes
12
+
13
+ - 40a1dbe: Add proper styling solution for form field component
14
+
3
15
  ## 0.31.0
4
16
 
5
17
  ### Minor Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kalink-ui/seedly",
3
- "version": "0.31.0",
3
+ "version": "0.32.1",
4
4
  "description": "A set of components for building UIs with React and TypeScript",
5
5
  "sideEffects": false,
6
6
  "license": "MIT",
@@ -1,6 +1,7 @@
1
1
  'use client';
2
2
 
3
3
  import { PolymorphicComponentProps } from '@kalink-ui/dibbly';
4
+ import { clsx } from 'clsx';
4
5
  import { ElementType, useId } from 'react';
5
6
 
6
7
  import { useFormFieldContext } from './form-field-context';
@@ -20,7 +21,13 @@ export function FormFieldItem<TUse extends ElementType = 'div'>(
20
21
 
21
22
  return (
22
23
  <FormFieldItemContextProvider value={{ id }}>
23
- <Comp className={formFieldStyle({ error: !!errors, disabled })} {...rest}>
24
+ <Comp
25
+ className={clsx(
26
+ formFieldStyle({ error: !!errors, disabled }),
27
+ className,
28
+ )}
29
+ {...rest}
30
+ >
24
31
  {children}
25
32
  </Comp>
26
33
  </FormFieldItemContextProvider>
@@ -1,26 +1,30 @@
1
- import { style, globalStyle, createGlobalTheme } from '@vanilla-extract/css';
1
+ import {
2
+ style,
3
+ globalStyle,
4
+ createThemeContract,
5
+ assignVars,
6
+ fallbackVar,
7
+ } from '@vanilla-extract/css';
2
8
  import { recipe, RecipeVariants } from '@vanilla-extract/recipes';
3
9
 
4
10
  import { sys, transition, typography } from '../../styles';
5
11
  import { components } from '../../styles/layers.css';
12
+ import { formFieldVars } from '../form-field';
6
13
 
7
- export const inputVars = createGlobalTheme(':root', {
8
- '@layer': components,
9
-
14
+ export const inputVars = createThemeContract({
10
15
  color: {
11
- foreground: 'inherit',
12
- background: sys.color.background,
13
- outline: sys.color.foreground,
14
- error: 'red',
16
+ foreground: null,
17
+ background: null,
18
+ outline: null,
15
19
  },
16
20
 
17
21
  spacing: {
18
- block: sys.spacing[2],
19
- inline: sys.spacing[4],
22
+ block: null,
23
+ inline: null,
20
24
  },
21
25
 
22
26
  shape: {
23
- corner: sys.shape.corner.none,
27
+ corner: null,
24
28
  },
25
29
  });
26
30
 
@@ -34,7 +38,7 @@ export const inputAppearance = recipe({
34
38
 
35
39
  color: inputVars.color.foreground,
36
40
 
37
- backgroundColor: 'transparent',
41
+ backgroundColor: inputVars.color.background,
38
42
  borderRadius: inputVars.shape.corner,
39
43
 
40
44
  cursor: 'inherit',
@@ -63,17 +67,39 @@ export const inputAppearance = recipe({
63
67
 
64
68
  '&[aria-invalid], &:has([aria-invalid])': {
65
69
  vars: {
66
- [inputVars.color.foreground]: 'red',
70
+ [inputVars.color.foreground]: fallbackVar(
71
+ formFieldVars.color.foreground,
72
+ 'red',
73
+ ),
67
74
  },
68
75
  },
69
76
  },
70
77
 
71
78
  vars: {
72
- [inputVars.color.foreground]: sys.color.foreground,
73
- [inputVars.color.background]: sys.color.background,
74
- [inputVars.color.outline]: inputVars.color.foreground,
75
- [inputVars.spacing.block]: sys.spacing[2],
76
- [inputVars.spacing.inline]: sys.spacing[4],
79
+ ...assignVars(inputVars.color, {
80
+ foreground: fallbackVar(
81
+ formFieldVars.color.foreground,
82
+ sys.color.foreground,
83
+ ),
84
+ background: fallbackVar(
85
+ formFieldVars.color.background,
86
+ sys.color.background,
87
+ 'transparent',
88
+ ),
89
+ outline: fallbackVar(
90
+ formFieldVars.color.outline,
91
+ sys.color.foreground,
92
+ ),
93
+ }),
94
+
95
+ ...assignVars(inputVars.spacing, {
96
+ block: sys.spacing[2],
97
+ inline: sys.spacing[4],
98
+ }),
99
+
100
+ ...assignVars(inputVars.shape, {
101
+ corner: sys.shape.corner.none,
102
+ }),
77
103
  },
78
104
  },
79
105
  },
@@ -127,8 +153,10 @@ export const inputAppearance = recipe({
127
153
  fontSize: `max(16px, ${sys.typography.body.small.size})`,
128
154
 
129
155
  vars: {
130
- [inputVars.spacing.block]: sys.spacing[1],
131
- [inputVars.spacing.inline]: sys.spacing[1],
156
+ ...assignVars(inputVars.spacing, {
157
+ block: sys.spacing[1],
158
+ inline: sys.spacing[1],
159
+ }),
132
160
  },
133
161
  },
134
162
  },
@@ -146,8 +174,10 @@ export const inputAppearance = recipe({
146
174
  fontSize: `max(16px, ${sys.typography.body.medium.size})`,
147
175
 
148
176
  vars: {
149
- [inputVars.spacing.block]: sys.spacing[2],
150
- [inputVars.spacing.inline]: sys.spacing[2],
177
+ ...assignVars(inputVars.spacing, {
178
+ block: sys.spacing[2],
179
+ inline: sys.spacing[2],
180
+ }),
151
181
  },
152
182
  },
153
183
  },
@@ -165,8 +195,10 @@ export const inputAppearance = recipe({
165
195
  fontSize: `max(16px, ${sys.typography.body.large.size})`,
166
196
 
167
197
  vars: {
168
- [inputVars.spacing.block]: sys.spacing[3],
169
- [inputVars.spacing.inline]: sys.spacing[3],
198
+ ...assignVars(inputVars.spacing, {
199
+ block: sys.spacing[3],
200
+ inline: sys.spacing[3],
201
+ }),
170
202
  },
171
203
  },
172
204
  },
@@ -217,7 +249,6 @@ export const input = style({
217
249
  paddingBottom: 0,
218
250
 
219
251
  color: 'inherit',
220
-
221
252
  border: 'none',
222
253
  backgroundColor: 'transparent',
223
254
  cursor: 'inherit',
@@ -3,3 +3,4 @@ export { Select } from './select';
3
3
  export { SelectItem } from './select-item';
4
4
  export { SelectRoot } from './select-root';
5
5
  export { SelectTrigger } from './select-trigger';
6
+ export { selectStyle } from './select.css';
@@ -0,0 +1,3 @@
1
+ import { style } from '@vanilla-extract/css';
2
+
3
+ export const selectStyle = style({});
@@ -1,4 +1,5 @@
1
1
  import { Value } from '@radix-ui/react-select';
2
+ import { clsx } from 'clsx';
2
3
  import { ComponentPropsWithoutRef, ComponentPropsWithRef } from 'react';
3
4
 
4
5
  import {
@@ -14,6 +15,7 @@ import { InputAppearanceVariants } from '../input';
14
15
  import { SelectContent } from './select-content';
15
16
  import { SelectRoot } from './select-root';
16
17
  import { SelectTrigger } from './select-trigger';
18
+ import { selectStyle } from './select.css';
17
19
 
18
20
  export type SelectProps = ComponentPropsWithoutRef<typeof SelectRoot> &
19
21
  Pick<ComponentPropsWithoutRef<typeof Value>, 'placeholder'> &
@@ -29,6 +31,7 @@ export type SelectProps = ComponentPropsWithoutRef<typeof SelectRoot> &
29
31
  hideLabel?: boolean;
30
32
  errors: string;
31
33
  hideErrorMessage?: boolean;
34
+ className?: string;
32
35
  };
33
36
 
34
37
  export function Select({
@@ -47,6 +50,7 @@ export function Select({
47
50
  required,
48
51
  size = 'md',
49
52
  ref,
53
+ className,
50
54
  ...props
51
55
  }: SelectProps) {
52
56
  return (
@@ -58,7 +62,7 @@ export function Select({
58
62
  disabled={disabled}
59
63
  hideLabel={hideLabel}
60
64
  >
61
- <FormFieldItem>
65
+ <FormFieldItem className={clsx(selectStyle, className)}>
62
66
  <FormFieldLabel required={required} disabled={disabled} size={size}>
63
67
  {label}
64
68
  </FormFieldLabel>
@@ -1 +1,2 @@
1
1
  export { TextField } from './text-field';
2
+ export { textFieldStyle } from './text-field.css';
@@ -1,5 +1,7 @@
1
1
  'use client';
2
2
 
3
+ import { clsx } from 'clsx';
4
+
3
5
  import {
4
6
  FormField,
5
7
  FormFieldControl,
@@ -10,6 +12,8 @@ import {
10
12
  } from '../form-field';
11
13
  import { Input, InputProps } from '../input';
12
14
 
15
+ import { textFieldStyle } from './text-field.css';
16
+
13
17
  export type TextFieldProps = InputProps & {
14
18
  name: string;
15
19
  label: string;
@@ -30,6 +34,7 @@ export function TextField({
30
34
  required,
31
35
  hideErrorMessage = false,
32
36
  size = 'md',
37
+ className,
33
38
  ...rest
34
39
  }: TextFieldProps) {
35
40
  return (
@@ -41,7 +46,7 @@ export function TextField({
41
46
  disabled={disabled}
42
47
  hideLabel={hideLabel}
43
48
  >
44
- <FormFieldItem>
49
+ <FormFieldItem className={clsx(textFieldStyle, className)}>
45
50
  <FormFieldLabel required={required} disabled={disabled} size={size}>
46
51
  {label}
47
52
  </FormFieldLabel>
@@ -1 +1,2 @@
1
1
  export { Textarea } from './textarea';
2
+ export { textareaStyle } from './textarea.css';
@@ -2,6 +2,8 @@ import { style } from '@vanilla-extract/css';
2
2
 
3
3
  import { inputAppearance } from '../input';
4
4
 
5
+ export const textareaStyle = style({});
6
+
5
7
  export const textarea = style([
6
8
  inputAppearance(),
7
9
  {
@@ -1,5 +1,6 @@
1
1
  'use client';
2
2
 
3
+ import { clsx } from 'clsx';
3
4
  import { TextareaHTMLAttributes } from 'react';
4
5
 
5
6
  import {
@@ -13,6 +14,7 @@ import {
13
14
  import { InputProps } from '../input';
14
15
 
15
16
  import { TextareaInput } from './textarea-input';
17
+ import { textareaStyle } from './textarea.css';
16
18
 
17
19
  export type TextareaProps = TextareaHTMLAttributes<HTMLTextAreaElement> &
18
20
  InputProps & {
@@ -46,7 +48,7 @@ export function Textarea({
46
48
  disabled={disabled}
47
49
  hideLabel={hideLabel}
48
50
  >
49
- <FormFieldItem>
51
+ <FormFieldItem className={clsx(textareaStyle, className)}>
50
52
  <FormFieldLabel disabled={disabled} required={required} size={size}>
51
53
  {label}
52
54
  </FormFieldLabel>