🚑️(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:
5
.changeset/purple-jars-turn.md
Normal file
5
.changeset/purple-jars-turn.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@openfun/cunningham-react": minor
|
||||
---
|
||||
|
||||
bug fix, remove usage of InputRefType
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -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} />
|
||||
|
||||
Reference in New Issue
Block a user