(
{
diff --git a/packages/react/src/components/Forms/Radio/index.spec.tsx b/packages/react/src/components/Forms/Radio/index.spec.tsx
index 6926c7c..b41f210 100644
--- a/packages/react/src/components/Forms/Radio/index.spec.tsx
+++ b/packages/react/src/components/Forms/Radio/index.spec.tsx
@@ -1,9 +1,20 @@
import userEvent from "@testing-library/user-event";
import React from "react";
import { render, screen } from "@testing-library/react";
-import { Radio, RadioGroup } from ":/components/Forms/Radio/index";
+import { FieldProps } from "../Field";
+import {
+ Radio,
+ RadioGroup,
+ RadioOnlyProps,
+} from ":/components/Forms/Radio/index";
+
+const spyError = vi.spyOn(global.console, "error");
describe("
", () => {
+ afterAll(() => {
+ spyError.mockRestore();
+ });
+
it("should render", async () => {
render(
);
expect(screen.getByLabelText("Yes")).toBeInTheDocument();
@@ -111,4 +122,20 @@ describe("
", () => {
document.querySelector(".c__radio__group.c__field.c__field--error"),
).toBeInTheDocument();
});
+
+ it("checks the props doesn't create error warning", async () => {
+ const propsInput: Required
= {
+ label: "First name",
+ fullWidth: true,
+ className: "c__field--full-width",
+ compact: false,
+ state: "default",
+ text: "my text",
+ textItems: ["my text item 1", "my text item 2"],
+ rightText: "my right text",
+ };
+
+ render();
+ expect(spyError).not.toHaveBeenCalled();
+ });
});
diff --git a/packages/react/src/components/Forms/Radio/index.tsx b/packages/react/src/components/Forms/Radio/index.tsx
index d428f23..42ec8e3 100644
--- a/packages/react/src/components/Forms/Radio/index.tsx
+++ b/packages/react/src/components/Forms/Radio/index.tsx
@@ -6,13 +6,26 @@ import React, {
import classNames from "classnames";
import { Field, FieldProps } from ":/components/Forms/Field";
+export type RadioOnlyProps = {
+ label?: string;
+};
+
export type RadioProps = InputHTMLAttributes &
- FieldProps & {
- label?: string;
- };
+ FieldProps &
+ RadioOnlyProps;
export const Radio = forwardRef(
({ label, ...props }: RadioProps, ref) => {
+ const {
+ compact,
+ fullWidth,
+ rightText,
+ state,
+ text,
+ textItems,
+ ...inputProps
+ } = props;
+
return (