@ -1,5 +1,6 @@
|
|||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import styled from '@emotion/styled';
|
import styled from '@emotion/styled';
|
||||||
|
import { v4 } from 'uuid';
|
||||||
|
|
||||||
import { IconCheck, IconMinus } from '@/ui/display/icon';
|
import { IconCheck, IconMinus } from '@/ui/display/icon';
|
||||||
|
|
||||||
@ -130,11 +131,14 @@ export const Checkbox = ({
|
|||||||
setIsInternalChecked(event.target.checked);
|
setIsInternalChecked(event.target.checked);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const checkboxId = 'checkbox' + v4();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<StyledInputContainer>
|
<StyledInputContainer>
|
||||||
<StyledInput
|
<StyledInput
|
||||||
autoComplete="off"
|
autoComplete="off"
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
|
id={checkboxId}
|
||||||
name="styled-checkbox"
|
name="styled-checkbox"
|
||||||
data-testid="input-checkbox"
|
data-testid="input-checkbox"
|
||||||
checked={isInternalChecked}
|
checked={isInternalChecked}
|
||||||
@ -145,7 +149,7 @@ export const Checkbox = ({
|
|||||||
isChecked={isInternalChecked}
|
isChecked={isInternalChecked}
|
||||||
onChange={handleChange}
|
onChange={handleChange}
|
||||||
/>
|
/>
|
||||||
<label htmlFor="checkbox">
|
<label htmlFor={checkboxId}>
|
||||||
{indeterminate ? (
|
{indeterminate ? (
|
||||||
<IconMinus />
|
<IconMinus />
|
||||||
) : isInternalChecked ? (
|
) : isInternalChecked ? (
|
||||||
|
|||||||
Reference in New Issue
Block a user