diff --git a/src/components/Check.tsx b/src/components/Check.tsx index cf94db7..db545af 100644 --- a/src/components/Check.tsx +++ b/src/components/Check.tsx @@ -17,6 +17,7 @@ interface CheckBoxProps { checked?: boolean; defaultChecked?: boolean; disabled?: boolean; + readonly?: boolean; onChange?: (checked?: boolean) => void; } @@ -35,6 +36,7 @@ const Check: ParentComponent = (props) => { const mProps = mergeProps[]>( { disabled: false, + readonly: false, }, props, ); @@ -54,7 +56,7 @@ const Check: ParentComponent = (props) => { }); const handleClick = () => { - if (mProps.disabled) { + if (mProps.disabled || mProps.readonly) { return; } setInternalChecked((prev) => !prev); diff --git a/src/components/Radio.tsx b/src/components/Radio.tsx index f5c4d83..d39380d 100644 --- a/src/components/Radio.tsx +++ b/src/components/Radio.tsx @@ -17,6 +17,7 @@ interface RadioProps { checked?: boolean; defaultChecked?: boolean; disabled?: boolean; + readonly?: boolean; onChange?: (value?: boolean) => void; } @@ -35,6 +36,7 @@ const Radio: ParentComponent = (props) => { const mProps = mergeProps[]>( { disabled: false, + readonly: false, }, props, ); @@ -54,7 +56,7 @@ const Radio: ParentComponent = (props) => { }); const handleClick = () => { - if (mProps.disabled) { + if (mProps.disabled || mProps.readonly) { return; } setInternalChecked((prev) => !prev); diff --git a/src/components/RadioGroup.tsx b/src/components/RadioGroup.tsx index 8a9da62..f16a96e 100644 --- a/src/components/RadioGroup.tsx +++ b/src/components/RadioGroup.tsx @@ -23,6 +23,7 @@ interface RadioGroupProps { value?: Option['value']; defalutValue?: Option['value']; disabled?: boolean; + readonly?: boolean; onChange?: (value?: Option['value']) => void; } @@ -31,6 +32,7 @@ const RadioGroup: Component = (props) => { { options: [], disabled: false, + readonly: false, }, props, ); @@ -50,7 +52,7 @@ const RadioGroup: Component = (props) => { }); const handleSelect = (value: Option['value']) => { - if (mProps.disabled) { + if (mProps.disabled || mProps.readonly) { return; } setSelectedValue(value); @@ -64,6 +66,7 @@ const RadioGroup: Component = (props) => { { handleSelect(option().value); }}>