Skip to content

Commit fedd123

Browse files
committed
fix(styled): added bind:value to input
1 parent 47c0712 commit fedd123

File tree

2 files changed

+36
-21
lines changed

2 files changed

+36
-21
lines changed

.changeset/eight-needles-lie.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@qwik-ui/styled': patch
3+
---
4+
5+
FIX: added `bind:value` to input
Lines changed: 31 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,38 @@
1-
import { component$, PropsOf } from '@builder.io/qwik';
1+
import { component$, type PropsOf } from '@builder.io/qwik';
22
import { cn } from '@qwik-ui/utils';
33

44
type InputProps = PropsOf<'input'> & {
55
error?: string;
66
};
77

8-
export const Input = component$<InputProps>(({ name, error, ...props }) => {
9-
return (
10-
<>
11-
<input
12-
{...props}
13-
aria-errormessage={`${name}-error`}
14-
aria-invalid={!!error}
15-
class={cn(
16-
'border-input placeholder:text-muted-foreground focus-visible:ring-ring rounded-base flex h-12 w-full border bg-transparent px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium focus-visible:outline-none focus-visible:ring-1 disabled:cursor-not-allowed disabled:opacity-50',
17-
props.class,
8+
export const Input = component$<InputProps>(
9+
({
10+
name,
11+
error,
12+
'bind:value': valueSig,
13+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
14+
'bind:checked': checkedSig,
15+
...restOfProps
16+
}) => {
17+
return (
18+
<>
19+
<input
20+
{...restOfProps}
21+
bind:value={valueSig}
22+
aria-errormessage={`${name}-error`}
23+
aria-invalid={!!error}
24+
class={cn(
25+
'rounded-base border-input placeholder:text-muted-foreground focus-visible:ring-ring flex h-12 w-full border bg-transparent px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium focus-visible:outline-none focus-visible:ring-1 disabled:cursor-not-allowed disabled:opacity-50',
26+
restOfProps.class,
27+
)}
28+
id={name}
29+
/>
30+
{error && (
31+
<div id={`${name}-error`} class="text-destructive mt-1 text-sm">
32+
{error}
33+
</div>
1834
)}
19-
id={name}
20-
/>
21-
{error && (
22-
<div id={`${name}-error`} class="text-destructive mt-1 text-sm">
23-
{error}
24-
</div>
25-
)}
26-
</>
27-
);
28-
});
35+
</>
36+
);
37+
},
38+
);

0 commit comments

Comments
 (0)