Questo è il mio file "import _ from 'lodashOverride'; import React, { ReactNode } from…
- User
Questo è il mio file "import _ from 'lodashOverride'; import React, { ReactNode } from 'react'; import UUID from 'simply-uuid'; import { faCheckSquare, faSquare, SizeProp, IconDefinition } from '@shareSrc/Style/FontAwesomeSvg'; import styles from './arxCheckBox.module.scss'; import ArxLabel, { ArxLabelProps } from '@shareSrc/Components/ArxLabel/ArxLabel'; import { ArxIcon } from '@shareSrc/Components/ArxIcon/ArxIcon'; import CommonService from '@shareSrc/Services/CommonService'; import { faStop } from '@shareSrc/Style/FontAwesomeSvgSolid'; import { OmitTyped } from '@shareSrc/Types/CustomUtilityTypes';
export enum ArxCheckBoxType { Classic = 1, ThreeState = 2 }
export type ArxCheckBoxBooleanType = true | false | 'threeState';
/PROPS/
export type ArxCheckBoxPropsCommon = { /** Id Checkbox. If undefined, will be generate / id: string; /* Checkbox Description / description?: string; /* Checkbox tooltip / tooltip?: string; /* Size of the icon / size?: SizeProp; /* Settings of label / labelProps?: OmitTyped<ArxLabelProps, 'information'>; /* Disable component */ disabled?: boolean; children?: ReactNode; } & Pick<ArxLabelProps, 'information'>;
interface ComponentPropsClassic extends ArxCheckBoxPropsCommon { type?: ArxCheckBoxType.Classic; /** Event that invoke after selection/deselection / onChange(value: boolean, isShiftKeyPressed: boolean): boolean | void; /* Checkbox Value / isChecked: boolean; /* AlternativeIcons*/ alternativeIcons?: { checked: IconDefinition; unchecked: IconDefinition }; }
interface ComponentPropsThreeState extends ArxCheckBoxPropsCommon { type?: ArxCheckBoxType.ThreeState; onChange(value: ArxCheckBoxBooleanType, isShiftKeyPressed: boolean): boolean | void; /** Checkbox Value / isChecked: ArxCheckBoxBooleanType; /* AlternativeIcons*/ alternativeIcons?: { checked: IconDefinition; unchecked: IconDefinition; unchanged: IconDefinition }; }
type ComponentProps = ComponentPropsClassic | ComponentPropsThreeState;
/STATE/
interface ComponentStateClassic { type: ArxCheckBoxType.Classic; checked: boolean; }
interface ComponentStateThreeState { type: ArxCheckBoxType.ThreeState; checked: ArxCheckBoxBooleanType; }
type ComponentState = ComponentStateClassic | ComponentStateThreeState;
export class ArxCheckBox extends React.Component<ComponentProps, ComponentState> { genId;
code - Assistant