From e9327f465f6cb88cc6b3ebf456fc3dd0526a5058 Mon Sep 17 00:00:00 2001 From: Daniel Sil Date: Mon, 21 Oct 2024 14:25:00 +0200 Subject: [PATCH] feat(Radio): deprecate readOnly prop. Use disabled instead --- packages/orbit-components/src/Radio/README.md | 1 - .../src/Radio/Radio.stories.tsx | 17 ++--------------- packages/orbit-components/src/Radio/types.d.ts | 3 +++ 3 files changed, 5 insertions(+), 16 deletions(-) diff --git a/packages/orbit-components/src/Radio/README.md b/packages/orbit-components/src/Radio/README.md index 2f4a9bf5ae..2a84eea7bd 100644 --- a/packages/orbit-components/src/Radio/README.md +++ b/packages/orbit-components/src/Radio/README.md @@ -32,7 +32,6 @@ Table below contains all types of the props available in Radio component. | tabIndex | `string \| number` | | Specifies the tab order of an element | | tooltip | `Element` | | Optional property when you need to attach Tooltip to the Radio. [See Functional specs](#functional-specs) | | value | `string` | | The value of the Radio. | -| readOnly | `boolean` | | If `true`, the Radio will be set up as readOnly. | ## Functional specs diff --git a/packages/orbit-components/src/Radio/Radio.stories.tsx b/packages/orbit-components/src/Radio/Radio.stories.tsx index a30243fa8b..a93da105f8 100644 --- a/packages/orbit-components/src/Radio/Radio.stories.tsx +++ b/packages/orbit-components/src/Radio/Radio.stories.tsx @@ -28,7 +28,6 @@ const meta: Meta = { checked: false, disabled: false, hasError: false, - readOnly: false, tabIndex: 0, onChange: action("changed"), }, @@ -73,7 +72,7 @@ export const WithError: Story = { parameters: { info: "Error state of Radio component. Check Orbit.Kiwi for more detailed guidelines.", controls: { - exclude: ["disabled", "readOnly", "onChange", "tabIndex"], + exclude: ["disabled", "onChange", "tabIndex"], }, }, }; @@ -93,7 +92,7 @@ export const WithTextLinkInLabel: Story = { parameters: { controls: { - exclude: ["onChange", "hasError", "disabled", "label", "readOnly", "tabIndex"], + exclude: ["onChange", "hasError", "disabled", "label", "tabIndex"], }, }, }; @@ -108,18 +107,6 @@ export const WithTooltip: Story = { /> ), - parameters: { - controls: { - exclude: ["onChange", "hasError", "disabled", "readOnly", "tabIndex"], - }, - }, -}; - -export const ReadOnly: Story = { - args: { - readOnly: true, - }, - parameters: { controls: { exclude: ["onChange", "hasError", "disabled", "tabIndex"], diff --git a/packages/orbit-components/src/Radio/types.d.ts b/packages/orbit-components/src/Radio/types.d.ts index 8bdbe6310d..cf748be2da 100644 --- a/packages/orbit-components/src/Radio/types.d.ts +++ b/packages/orbit-components/src/Radio/types.d.ts @@ -16,6 +16,9 @@ export interface Props extends Common.Globals { readonly defaultChecked?: boolean; readonly info?: React.ReactNode; readonly tooltip?: React.ReactElement; + /** + * @deprecated Radio does not support `readOnly` prop. Use `disabled` instead. + */ readonly readOnly?: boolean; readonly tabIndex?: string | number; // InputEvent