Commit b9417e2e authored by tom's avatar tom

fix input styles

parent 28d52130
...@@ -27,6 +27,8 @@ export const Field = React.forwardRef<HTMLDivElement, FieldProps>( ...@@ -27,6 +27,8 @@ export const Field = React.forwardRef<HTMLDivElement, FieldProps>(
size: props.size, size: props.size,
floating: props.floating, floating: props.floating,
bgColor: rest.bgColor, bgColor: rest.bgColor,
disabled: rest.disabled,
readOnly: rest.readOnly,
}; };
const labelElement = ( const labelElement = (
......
...@@ -232,6 +232,7 @@ const semanticTokens: ThemingConfig['semanticTokens'] = { ...@@ -232,6 +232,7 @@ const semanticTokens: ThemingConfig['semanticTokens'] = {
readOnly: { value: { _light: '{colors.gray.200}', _dark: '{colors.gray.800}' } }, readOnly: { value: { _light: '{colors.gray.200}', _dark: '{colors.gray.800}' } },
error: { value: '{colors.red.500}' }, error: { value: '{colors.red.500}' },
}, },
placeholder: { value: '{colors.gray.500}' },
}, },
field: { field: {
placeholder: { placeholder: {
......
...@@ -52,7 +52,7 @@ export const recipe = defineSlotRecipe({ ...@@ -52,7 +52,7 @@ export const recipe = defineSlotRecipe({
bg: 'bg', bg: 'bg',
top: '2px', top: '2px',
left: '2px', left: '2px',
color: 'gray.500', color: 'input.placeholder',
width: 'calc(100% - 4px)', width: 'calc(100% - 4px)',
borderRadius: 'base', borderRadius: 'base',
pointerEvents: 'none', pointerEvents: 'none',
......
...@@ -52,8 +52,14 @@ export const recipe = defineRecipe({ ...@@ -52,8 +52,14 @@ export const recipe = defineRecipe({
outline: { outline: {
bg: 'input.bg', bg: 'input.bg',
borderWidth: '2px', borderWidth: '2px',
borderColor: 'input.border', borderColor: 'input.border.filled',
focusVisibleRing: 'none', focusVisibleRing: 'none',
_placeholder: {
color: 'input.placeholder',
},
_placeholderShown: {
borderColor: 'input.border',
},
_hover: { _hover: {
borderColor: 'input.border.hover', borderColor: 'input.border.hover',
}, },
......
...@@ -66,11 +66,11 @@ const InputShowcase = () => { ...@@ -66,11 +66,11 @@ const InputShowcase = () => {
<Field label="Email" required floating size="xl" helperText="Helper text" maxWidth="300px"> <Field label="Email" required floating size="xl" helperText="Helper text" maxWidth="300px">
<Input size="xl"/> <Input size="xl"/>
</Field> </Field>
<Field label="Email (disabled)" required floating size="xl" maxWidth="300px"> <Field label="Email (disabled)" required floating disabled size="xl" maxWidth="300px">
<Input size="xl" disabled value="me@example.com"/> <Input size="xl" value="me@example.com"/>
</Field> </Field>
<Field label="Email (readOnly)" required floating size="xl" maxWidth="300px"> <Field label="Email (readOnly)" required floating readOnly size="xl" maxWidth="300px">
<Input size="xl" readOnly value="me@example.com"/> <Input size="xl" value="me@example.com"/>
</Field> </Field>
<Field label="Email (invalid)" required floating size="xl" errorText="Something went wrong" invalid maxWidth="300px"> <Field label="Email (invalid)" required floating size="xl" errorText="Something went wrong" invalid maxWidth="300px">
<Input size="xl" value="duck"/> <Input size="xl" value="duck"/>
...@@ -84,25 +84,25 @@ const InputShowcase = () => { ...@@ -84,25 +84,25 @@ const InputShowcase = () => {
<Field label="Email" required helperText="Helper text" maxWidth="200px"> <Field label="Email" required helperText="Helper text" maxWidth="200px">
<Input/> <Input/>
</Field> </Field>
<Field label="Email (disabled)" required maxWidth="200px"> <Field label="Email (disabled)" required disabled maxWidth="200px">
<Input disabled value="me@example.com"/> <Input value="me@example.com"/>
</Field> </Field>
<Field label="Email (readOnly)" required maxWidth="200px"> <Field label="Email (readOnly)" required readOnly maxWidth="200px">
<Input readOnly value="me@example.com"/> <Input value="me@example.com"/>
</Field> </Field>
<Field label="Email (invalid)" required errorText="Something went wrong" invalid maxWidth="200px"> <Field label="Email (invalid)" required errorText="Something went wrong" invalid maxWidth="200px">
<Input size="xl" value="duck"/> <Input value="duck"/>
</Field> </Field>
</Sample> </Sample>
<Sample label="floating label" p={ 4 } bgColor={{ _light: 'blackAlpha.200', _dark: 'whiteAlpha.200' }} alignItems="flex-start"> <Sample label="floating label" p={ 4 } bgColor={{ _light: 'blackAlpha.200', _dark: 'whiteAlpha.200' }} alignItems="flex-start">
<Field label="Email" required floating size="xl" helperText="Helper text" maxWidth="300px"> <Field label="Email" required floating size="xl" helperText="Helper text" maxWidth="300px">
<Input size="xl"/> <Input size="xl"/>
</Field> </Field>
<Field label="Email (disabled)" required floating size="xl" maxWidth="300px"> <Field label="Email (disabled)" required disabled floating size="xl" maxWidth="300px">
<Input size="xl" disabled value="me@example.com"/> <Input size="xl" value="me@example.com"/>
</Field> </Field>
<Field label="Email (readOnly)" required floating size="xl" maxWidth="300px"> <Field label="Email (readOnly)" required readOnly floating size="xl" maxWidth="300px">
<Input size="xl" readOnly value="me@example.com"/> <Input size="xl" value="me@example.com"/>
</Field> </Field>
<Field label="Email (invalid)" required floating size="xl" errorText="Something went wrong" invalid maxWidth="300px"> <Field label="Email (invalid)" required floating size="xl" errorText="Something went wrong" invalid maxWidth="300px">
<Input size="xl" value="duck"/> <Input size="xl" value="duck"/>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment