github
1776 of 1926 branches covered (92.21%)
Branch coverage included in aggregate %.
417 of 435 new or added lines in 43 files covered. (95.86%)
8 existing lines in 4 files now uncovered.9670 of 10456 relevant lines covered (92.48%)
1315.5 hits per line
1 |
import type { FC } from "react"
|
1✔ |
2 |
|
|
3 |
import { ElasticInput } from "."
|
1✔ |
4 |
|
|
5 |
export type TextInputProps = {
|
|
6 |
value: string |
|
7 |
set?: ((value: string) => void) | undefined |
|
8 |
label?: string
|
|
9 |
placeholder?: string
|
|
10 |
autoSize?: boolean |
|
11 |
readOnly?: boolean |
|
12 |
testid?: string
|
|
13 |
} |
|
14 |
|
|
15 |
export const TextInput: FC<TextInputProps> = ({ |
|
16 |
value, |
10✔ |
17 |
set, |
10✔ |
18 |
label, |
10✔ |
19 |
placeholder, |
10✔ |
20 |
autoSize = false,
|
10✔ |
|
testid, |
10✔ |
22 |
}) => { |
10✔ |
23 |
return (
|
10✔ |
24 |
<span> |
10✔ |
25 |
<label>{label}</label> |
10✔ |
26 |
{autoSize ? ( |
10✔ |
27 |
<ElasticInput |
10✔ |
28 |
type="text"
|
10✔ |
29 |
value={value} |
10✔ |
30 |
onChange={(e) => set?.(e.target.value)} |
|
31 |
disabled={set === undefined} |
10✔ |
32 |
placeholder={placeholder} |
10✔ |
|
data-testid={testid} |
10✔ |
34 |
/> |
|
35 |
) : ( |
|
36 |
<input |
× |
37 |
type="text"
|
× |
38 |
value={value} |
× |
39 |
onChange={(e) => set?.(e.target.value)} |
× |
40 |
disabled={set === undefined} |
× |
41 |
placeholder={placeholder} |
× |
NEW
|
data-testid={testid} |
× |
43 |
/> |
× |
44 |
)} |
|
45 |
</span> |
10✔ |
46 |
) |
|
47 |
} |
10✔ |