From e9952b0dea306e50e7da08f190fa33e046cac769 Mon Sep 17 00:00:00 2001 From: Daniel Sil Date: Mon, 21 Oct 2024 14:24:41 +0200 Subject: [PATCH] feat(Checkbox): deprecate readOnly prop. Use disabled instead --- .../src/Checkbox/Checkbox.stories.tsx | 13 +------------ packages/orbit-components/src/Checkbox/types.d.ts | 3 +++ 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/packages/orbit-components/src/Checkbox/Checkbox.stories.tsx b/packages/orbit-components/src/Checkbox/Checkbox.stories.tsx index 319f59ceb2..5f750d36fe 100644 --- a/packages/orbit-components/src/Checkbox/Checkbox.stories.tsx +++ b/packages/orbit-components/src/Checkbox/Checkbox.stories.tsx @@ -27,7 +27,6 @@ const meta: Meta = { checked: false, hasError: false, disabled: false, - readOnly: false, name: "name", onChange: action("onChange"), }, @@ -41,7 +40,7 @@ export const Default: Story = { parameters: { info: "Checkbox needs only label and onChange by default.", controls: { - exclude: ["info", "hasError", "disabled", "readOnly", "name", "value", "onChange"], + exclude: ["info", "hasError", "disabled", "name", "value", "onChange"], }, }, @@ -126,16 +125,6 @@ export const WithTooltip: Story = { }, }; -export const ReadOnly: Story = { - args: { - readOnly: true, - }, - - parameters: { - info: "This is a preview of this component in read-only state.", - }, -}; - export const Rtl: Story = { render: args => ( diff --git a/packages/orbit-components/src/Checkbox/types.d.ts b/packages/orbit-components/src/Checkbox/types.d.ts index 963a0cf822..c4d3a166aa 100644 --- a/packages/orbit-components/src/Checkbox/types.d.ts +++ b/packages/orbit-components/src/Checkbox/types.d.ts @@ -15,6 +15,9 @@ export interface Props extends Common.Globals { readonly name?: string; readonly info?: React.ReactNode; readonly tabIndex?: string | number; + /** + * @deprecated Radio does not support `readOnly` prop. Use `disabled` instead. + */ readonly readOnly?: boolean; readonly tooltip?: React.ReactNode | null; // Should be InputEvent type