🚑️(react) fix unexisting import

Since b72d0d5c90 InputRefType doesn't
exist.
We missed some usage of it that are removed in this fix.
This commit is contained in:
Romain Le Cellier
2023-08-10 18:07:28 +02:00
parent 7de28bcf9b
commit 3e1cdbe9d6
4 changed files with 11 additions and 7 deletions

View File

@@ -0,0 +1,5 @@
---
"@openfun/cunningham-react": minor
---
bug fix, remove usage of InputRefType

View File

@@ -1,6 +1,5 @@
import React, { forwardRef, InputHTMLAttributes, ReactElement } from "react";
import { Field, FieldProps, FieldState } from ":/components/Forms/Field";
import { InputRefType } from ":/components/Forms/Input";
import { FileUploaderMulti } from ":/components/Forms/FileUploader/FileUploaderMulti";
import { FileUploaderMono } from ":/components/Forms/FileUploader/FileUploaderMono";
@@ -22,7 +21,7 @@ export interface FileUploaderProps
fakeDefaultFiles?: File[];
}
export interface FileUploaderRefType extends InputRefType {
export interface FileUploaderRefType {
reset: () => void;
}

View File

@@ -2,7 +2,7 @@ import { render, screen, waitFor } from "@testing-library/react";
import React, { useRef } from "react";
import userEvent from "@testing-library/user-event";
import { expect } from "vitest";
import { Input, InputRefType } from ":/components/Forms/Input/index";
import { Input } from ":/components/Forms/Input/index";
import { Button } from ":/components/Button";
describe("<Input/>", () => {
@@ -146,11 +146,11 @@ describe("<Input/>", () => {
it("forwards ref", async () => {
const user = userEvent.setup();
const Wrapper = () => {
const ref = useRef<InputRefType>(null);
const ref = useRef<HTMLInputElement>(null);
return (
<div>
<Input label="First name" ref={ref} />
<Button onClick={() => ref.current?.input?.focus()}>Focus</Button>
<Button onClick={() => ref.current?.focus()}>Focus</Button>
</div>
);
};

View File

@@ -3,7 +3,7 @@ import { Meta } from "@storybook/react";
import { useForm } from "react-hook-form";
import * as Yup from "yup";
import React, { useRef } from "react";
import { Input, InputRefType } from ":/components/Forms/Input/index";
import { Input } from ":/components/Forms/Input/index";
import { Button } from ":/components/Button";
import {
getFieldState,
@@ -166,7 +166,7 @@ export const NonControlled = () => {
};
export const WithRef = () => {
const ref = useRef<InputRefType>(null);
const ref = useRef<HTMLInputElement>(null);
return (
<div>
<Input label="Your identity" ref={ref} />