Skip to content

Commit 100ed43

Browse files
committed
fix: solve linter errors
1 parent 545a4c4 commit 100ed43

File tree

1 file changed

+20
-10
lines changed

1 file changed

+20
-10
lines changed

packages/headless/src/components/checkbox/checkbox.tsx

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1-
import { component$, Slot, QwikChangeEvent } from '@builder.io/qwik';
1+
import {
2+
component$,
3+
Slot,
4+
QwikChangeEvent,
5+
PropFunction,
6+
} from '@builder.io/qwik';
7+
28
interface StyleProps {
39
class?: string;
410
style?: string;
@@ -7,7 +13,7 @@ interface LabelProps extends StyleProps {
713
htmlFor?: string;
814
}
915

10-
const Label = component$(({ ...props }: LabelProps) => {
16+
export const Label = component$(({ ...props }: LabelProps) => {
1117
return (
1218
<label {...props}>
1319
<Slot />
@@ -23,13 +29,15 @@ export interface CheckboxProps extends StyleProps {
2329
id?: string;
2430
value?: string;
2531
tabIndex?: number;
26-
onChange?: (
27-
event: QwikChangeEvent<HTMLInputElement>,
28-
element: HTMLInputElement
29-
) => any;
32+
onChange?: PropFunction<
33+
(
34+
event: QwikChangeEvent<HTMLInputElement>,
35+
element: HTMLInputElement
36+
) => void
37+
>;
3038
}
3139

32-
const Root = component$(
40+
export const Root = component$(
3341
({
3442
checked,
3543
disabled,
@@ -53,11 +61,13 @@ const Root = component$(
5361
aria-checked={checked}
5462
value={value}
5563
tabIndex={tabIndex}
56-
onChange$={onChange}
64+
onChange$={(event, element) => {
65+
if (onChange) {
66+
onChange(event, element);
67+
}
68+
}}
5769
{...props}
5870
/>
5971
);
6072
}
6173
);
62-
63-
export { Label, Root };

0 commit comments

Comments
 (0)