Skip to content

Commit

Permalink
[core] chore: minor code style fixes for #6312 (#6335)
Browse files Browse the repository at this point in the history
  • Loading branch information
adidahiya authored Aug 28, 2023
1 parent 31988f9 commit 6ade0a8
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@

import * as React from "react";

import { useAsyncControllableValue } from "./useAsyncControllableValue";
import { DISPLAYNAME_PREFIX } from "../../common";
import { useAsyncControllableValue } from "../../hooks/useAsyncControllableValue";

export type IAsyncControllableTextAreaProps = React.TextareaHTMLAttributes<HTMLTextAreaElement>;
export type AsyncControllableTextAreaProps = React.TextareaHTMLAttributes<HTMLTextAreaElement>;

/**
* A wrapper around the low-level <textarea> component which works around a React bug
* the same way <AsyncControllableInput> does.
*/
export const AsyncControllableTextArea = React.forwardRef<HTMLTextAreaElement, IAsyncControllableTextAreaProps>(
export const AsyncControllableTextArea = React.forwardRef<HTMLTextAreaElement, AsyncControllableTextAreaProps>(
function _AsyncControllableTextArea(props, ref) {
const {
value: parentValue,
Expand Down Expand Up @@ -41,3 +42,4 @@ export const AsyncControllableTextArea = React.forwardRef<HTMLTextAreaElement, I
);
},
);
AsyncControllableTextArea.displayName = `${DISPLAYNAME_PREFIX}.AsyncControllableTextArea`;
1 change: 1 addition & 0 deletions packages/core/src/hooks/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@

export { HotkeyConfig } from "./hotkeys/hotkeyConfig";
export { useHotkeys, UseHotkeysOptions, UseHotkeysReturnValue } from "./hotkeys/useHotkeys";
export { useAsyncControllableValue } from "./useAsyncControllableValue";
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import * as React from "react";

interface IUseAsyncControllableValueProps<E extends HTMLInputElement | HTMLTextAreaElement> {
interface UseAsyncControllableValueProps<E extends HTMLInputElement | HTMLTextAreaElement> {
value?: React.InputHTMLAttributes<E>["value"];
onChange?: React.ChangeEventHandler<E>;
onCompositionStart?: React.CompositionEventHandler<E>;
Expand All @@ -25,7 +25,7 @@ export const ASYNC_CONTROLLABLE_VALUE_COMPOSITION_END_DELAY = 10;
* returned by the input's `onChange` callback.
*/
export function useAsyncControllableValue<E extends HTMLInputElement | HTMLTextAreaElement>(
props: IUseAsyncControllableValueProps<E>,
props: UseAsyncControllableValueProps<E>,
) {
const { onCompositionStart, onCompositionEnd, value: propValue, onChange } = props;

Expand Down
2 changes: 1 addition & 1 deletion packages/core/test/forms/asyncControllableInputTests.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import { spy } from "sinon";
// this component is not part of the public API, but we want to test its implementation in isolation
import { AsyncControllableInput } from "../../src/components/forms/asyncControllableInput";
import { AsyncControllableTextArea } from "../../src/components/forms/asyncControllableTextArea";
import { ASYNC_CONTROLLABLE_VALUE_COMPOSITION_END_DELAY } from "../../src/components/forms/useAsyncControllableValue";
import { ASYNC_CONTROLLABLE_VALUE_COMPOSITION_END_DELAY } from "../../src/hooks/useAsyncControllableValue";
import { sleep } from "../utils";

/*
Expand Down

1 comment on commit 6ade0a8

@adidahiya
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[core] chore: minor code style fixes for #6312 (#6335)

Build artifact links for this commit: documentation | landing | table | demo

This is an automated comment from the deploy-preview CircleCI job.

Please sign in to comment.