From 28b86604b477578e6dc8666a2fb798207269665d Mon Sep 17 00:00:00 2001 From: Brian Vaughn Date: Tue, 2 Jul 2024 16:15:46 -0400 Subject: [PATCH] Remove event param from onBlur/onFocus --- .../src/PanelResizeHandle.ts | 15 +++++++++------ .../react-resizable-panels/src/vendor/react.ts | 2 -- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/packages/react-resizable-panels/src/PanelResizeHandle.ts b/packages/react-resizable-panels/src/PanelResizeHandle.ts index 61521a070..4a9f50295 100644 --- a/packages/react-resizable-panels/src/PanelResizeHandle.ts +++ b/packages/react-resizable-panels/src/PanelResizeHandle.ts @@ -15,7 +15,6 @@ import { assert } from "./utils/assert"; import { createElement, CSSProperties, - FocusEvent, HTMLAttributes, PropsWithChildren, ReactElement, @@ -30,14 +29,16 @@ export type ResizeHandlerState = "drag" | "hover" | "inactive"; export type PanelResizeHandleProps = Omit< HTMLAttributes, - "id" + "id" | "onBlur" | "onFocus" > & PropsWithChildren<{ className?: string; disabled?: boolean; hitAreaMargins?: PointerHitAreaMargins; id?: string | null; + onBlur?: () => void; onDragging?: PanelResizeHandleOnDragging; + onFocus?: () => void; style?: CSSProperties; tabIndex?: number; tagName?: keyof HTMLElementTagNameMap; @@ -49,7 +50,9 @@ export function PanelResizeHandle({ disabled = false, hitAreaMargins, id: idFromProps, + onBlur, onDragging, + onFocus, style: styleFromProps = {}, tabIndex = 0, tagName: Type = "div", @@ -208,13 +211,13 @@ export function PanelResizeHandle({ children, className: classNameFromProps, id: idFromProps, - onBlur: (event: FocusEvent) => { + onBlur: () => { setIsFocused(false); - rest?.onBlur?.(event); + onBlur?.(); }, - onFocus: () => (event: FocusEvent) => { + onFocus: () => { setIsFocused(true); - rest?.onFocus?.(event); + onFocus?.(); }, ref: elementRef, role: "separator", diff --git a/packages/react-resizable-panels/src/vendor/react.ts b/packages/react-resizable-panels/src/vendor/react.ts index 41b7620a7..dd68d9c7a 100644 --- a/packages/react-resizable-panels/src/vendor/react.ts +++ b/packages/react-resizable-panels/src/vendor/react.ts @@ -11,7 +11,6 @@ import * as React from "react"; import type { CSSProperties, ElementType, - FocusEvent, ForwardedRef, HTMLAttributes, MouseEvent, @@ -61,7 +60,6 @@ export { export type { CSSProperties, ElementType, - FocusEvent, ForwardedRef, HTMLAttributes, MouseEvent,