Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | 1x | import * as React from "react";
import { useFormContext, Controller } from "react-hook-form";
import GiveText from "@shared/Text/GiveText";
import { CheckboxProps } from "@shared/GiveCheckbox/type";
import GiveCheckbox from "@shared/GiveCheckbox/GiveCheckbox";
import { Stack } from "@mui/material";
import GiveTooltip from "@shared/Tooltip/GiveTooltip";
import { InfoIcon } from "@phosphor-icons/react";
import { useAppTheme } from "@theme/v2/Provider";
export type EDDModalCheckboxProps = CheckboxProps & {
name: string;
label: string;
disabled?: boolean;
tooltipText: string;
};
export const EDDModalCheckbox: React.FC<EDDModalCheckboxProps> = ({
name,
label,
disabled,
tooltipText,
...props
}) => {
const { control } = useFormContext();
const { palette } = useAppTheme();
return (
<Controller
name={name}
control={control}
render={({ field: { ref, value, onChange, ...rest } }) => {
return (
<Stack direction="row" alignItems="center" gap="12px">
<GiveCheckbox
size="medium"
disabled={disabled}
inputRef={ref}
value={value}
onChange={onChange}
{...rest}
{...props}
/>
<GiveText variant="bodyS">{label}</GiveText>
<GiveTooltip
color="default"
width="compact"
title={
<GiveText color="default" variant="bodyS">
{tooltipText}
</GiveText>
}
alignment=""
customTooltipStyles={{
"&.MuiStack-root": {
width: "auto",
},
}}
>
<InfoIcon size={18} color={palette.icon?.["icon-secondary"]} />
</GiveTooltip>
</Stack>
);
}}
/>
);
};
|