diff --git a/packages/react-resizable-panels-website/src/routes/EndToEndTesting/index.tsx b/packages/react-resizable-panels-website/src/routes/EndToEndTesting/index.tsx index 549bf34c9..c3562e61d 100644 --- a/packages/react-resizable-panels-website/src/routes/EndToEndTesting/index.tsx +++ b/packages/react-resizable-panels-website/src/routes/EndToEndTesting/index.tsx @@ -9,7 +9,6 @@ import { import { ImperativePanelGroupHandle, ImperativePanelHandle, - MixedSizes, } from "react-resizable-panels"; import { urlPanelGroupToPanelGroup, urlToUrlData } from "../../utils/UrlData"; diff --git a/packages/react-resizable-panels-website/src/routes/examples/ImperativePanelGroupApi.tsx b/packages/react-resizable-panels-website/src/routes/examples/ImperativePanelGroupApi.tsx index 834be01fd..260eca08c 100644 --- a/packages/react-resizable-panels-website/src/routes/examples/ImperativePanelGroupApi.tsx +++ b/packages/react-resizable-panels-website/src/routes/examples/ImperativePanelGroupApi.tsx @@ -1,8 +1,5 @@ import { useRef, useState } from "react"; -import type { - ImperativePanelGroupHandle, - MixedSizes, -} from "react-resizable-panels"; +import type { ImperativePanelGroupHandle } from "react-resizable-panels"; import { Panel, PanelGroup } from "react-resizable-panels"; import { ResizeHandle } from "../../components/ResizeHandle"; diff --git a/packages/react-resizable-panels-website/src/routes/examples/types.ts b/packages/react-resizable-panels-website/src/routes/examples/types.ts index 3de2d2dde..d04b369ed 100644 --- a/packages/react-resizable-panels-website/src/routes/examples/types.ts +++ b/packages/react-resizable-panels-website/src/routes/examples/types.ts @@ -1,5 +1,3 @@ -import { MixedSizes } from "react-resizable-panels"; - export type PanelCollapseLogEntryType = "onCollapse"; export type PanelExpandLogEntryType = "onExpand"; export type PanelGroupLayoutLogEntryType = "onLayout"; @@ -21,12 +19,12 @@ export type PanelResizeHandleDraggingLogEntry = { }; export type PanelGroupLayoutLogEntry = { groupId: string; - layout: MixedSizes[]; + layout: number[]; type: PanelGroupLayoutLogEntryType; }; export type PanelResizeLogEntry = { panelId: string; - size: MixedSizes; + size: number; type: PanelResizeLogEntryType; }; diff --git a/packages/react-resizable-panels-website/src/utils/UrlData.ts b/packages/react-resizable-panels-website/src/utils/UrlData.ts index 1bf27a72b..c919261b1 100644 --- a/packages/react-resizable-panels-website/src/utils/UrlData.ts +++ b/packages/react-resizable-panels-website/src/utils/UrlData.ts @@ -9,7 +9,6 @@ import { import { ImperativePanelGroupHandle, ImperativePanelHandle, - MixedSizes, Panel, PanelGroup, PanelGroupOnLayout, @@ -183,7 +182,7 @@ function urlPanelToPanel( } }; - onResize = (size: MixedSizes) => { + onResize = (size: number) => { const debugLog = debugLogRef.current; if (debugLog) { debugLog.log({ @@ -248,7 +247,7 @@ export function urlPanelGroupToPanelGroup( const groupId = urlPanelGroup.id; if (groupId) { - onLayout = (layout: MixedSizes[]) => { + onLayout = (layout: number[]) => { const debugLog = debugLogRef.current; if (debugLog) { debugLog.log({ groupId, type: "onLayout", layout }); diff --git a/packages/react-resizable-panels-website/tests/utils/panels.ts b/packages/react-resizable-panels-website/tests/utils/panels.ts index f1e9dc1e3..46b07381a 100644 --- a/packages/react-resizable-panels-website/tests/utils/panels.ts +++ b/packages/react-resizable-panels-website/tests/utils/panels.ts @@ -2,7 +2,6 @@ import { Locator, Page, expect } from "@playwright/test"; import { assert } from "./assert"; import { getBodyCursorStyle } from "./cursor"; import { verifyFuzzySizesPercentages } from "./verify"; -import { Size } from "react-resizable-panels"; type Operation = { expectedCursor?: string; @@ -150,7 +149,7 @@ export async function dragResizeTo( export async function imperativeResizePanel( page: Page, panelId: string, - size: Size + size: number ) { const panelIdSelect = page.locator("#panelIdSelect"); await panelIdSelect.selectOption(panelId); diff --git a/packages/react-resizable-panels/CHANGELOG.md b/packages/react-resizable-panels/CHANGELOG.md index e16a8ecd9..0133cf5bd 100644 --- a/packages/react-resizable-panels/CHANGELOG.md +++ b/packages/react-resizable-panels/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## 1.0.0-rc.1 + +- Remove support for pixel-based Panel constraints; props like `defaultSizePercentage` should now be `defaultSize` +- Replaced `dataAttributes` prop with `...rest` prop that supports all HTML attributes + ## 0.0.63 - Change default (not-yet-registered) Panel flex-grow style from 0 to 1 diff --git a/packages/react-resizable-panels/src/Panel.test.tsx b/packages/react-resizable-panels/src/Panel.test.tsx index 7dc14abc6..c81b3765e 100644 --- a/packages/react-resizable-panels/src/Panel.test.tsx +++ b/packages/react-resizable-panels/src/Panel.test.tsx @@ -1,12 +1,8 @@ +import assert from "assert"; import { Root, createRoot } from "react-dom/client"; import { act } from "react-dom/test-utils"; -import { - ImperativePanelHandle, - MixedSizes, - Panel, - PanelGroup, - PanelResizeHandle, -} from "."; +import { ImperativePanelHandle, Panel, PanelGroup, PanelResizeHandle } from "."; +import { getPanelElement } from "./utils/dom/getPanelElement"; import { mockPanelGroupOffsetWidthAndHeight, verifyExpandedPanelGroupLayout, @@ -66,7 +62,7 @@ describe("PanelGroup", () => { let leftPanelRef = createRef(); let rightPanelRef = createRef(); - let mostRecentLayout: MixedSizes[] | null; + let mostRecentLayout: number[] | null; beforeEach(() => { leftPanelRef = createRef(); @@ -74,7 +70,7 @@ describe("PanelGroup", () => { mostRecentLayout = null; - const onLayout = (layout: MixedSizes[]) => { + const onLayout = (layout: number[]) => { mostRecentLayout = layout; }; @@ -135,7 +131,7 @@ describe("PanelGroup", () => { let middlePanelRef = createRef(); let rightPanelRef = createRef(); - let mostRecentLayout: MixedSizes[] | null; + let mostRecentLayout: number[] | null; beforeEach(() => { leftPanelRef = createRef(); @@ -144,7 +140,7 @@ describe("PanelGroup", () => { mostRecentLayout = null; - const onLayout = (layout: MixedSizes[]) => { + const onLayout = (layout: number[]) => { mostRecentLayout = layout; }; @@ -227,6 +223,24 @@ describe("PanelGroup", () => { }); }); + it("should support ...rest attributes", () => { + act(() => { + root.render( + + + + + + ); + }); + + const element = getPanelElement("panel"); + assert(element); + expect(element.tabIndex).toBe(123); + expect(element.getAttribute("data-test-name")).toBe("foo"); + expect(element.title).toBe("bar"); + }); + describe("DEV warnings", () => { it("should warn about server rendered panels with no default size", () => { jest.resetModules(); diff --git a/packages/react-resizable-panels/src/Panel.ts b/packages/react-resizable-panels/src/Panel.ts index 887defcfa..be9ba9d27 100644 --- a/packages/react-resizable-panels/src/Panel.ts +++ b/packages/react-resizable-panels/src/Panel.ts @@ -3,10 +3,10 @@ import { isDevelopment } from "#is-development"; import { PanelGroupContext } from "./PanelGroupContext"; import useIsomorphicLayoutEffect from "./hooks/useIsomorphicEffect"; import useUniqueId from "./hooks/useUniqueId"; -import { DataAttributes, Size } from "./types"; import { ElementType, ForwardedRef, + HTMLAttributes, PropsWithChildren, createElement, forwardRef, @@ -18,8 +18,8 @@ import { export type PanelOnCollapse = () => void; export type PanelOnExpand = () => void; export type PanelOnResize = ( - mixedSizes: Size, - prevMixedSizes: Size | undefined + size: number, + prevSize: number | undefined ) => void; export type PanelCallbacks = { @@ -48,35 +48,34 @@ export type ImperativePanelHandle = { collapse: () => void; expand: () => void; getId(): string; - getSize(): Size; + getSize(): number; isCollapsed: () => boolean; isExpanded: () => boolean; - resize: (size: Partial) => void; + resize: (size: number) => void; }; -export type PanelProps = PropsWithChildren<{ - className?: string; - collapsedSize?: number | undefined; - collapsible?: boolean | undefined; - dataAttributes?: DataAttributes; - defaultSize?: number | undefined; - id?: string; - maxSize?: number | undefined; - minSize?: number | undefined; - onCollapse?: PanelOnCollapse; - onExpand?: PanelOnExpand; - onResize?: PanelOnResize; - order?: number; - style?: object; - tagName?: ElementType; -}>; +export type PanelProps = Omit, "id" | "onResize"> & + PropsWithChildren<{ + className?: string; + collapsedSize?: number | undefined; + collapsible?: boolean | undefined; + defaultSize?: number | undefined; + id?: string; + maxSize?: number | undefined; + minSize?: number | undefined; + onCollapse?: PanelOnCollapse; + onExpand?: PanelOnExpand; + onResize?: PanelOnResize; + order?: number; + style?: object; + tagName?: ElementType; + }>; export function PanelWithForwardedRef({ children, className: classNameFromProps = "", collapsedSize, collapsible, - dataAttributes, defaultSize, forwardedRef, id: idFromProps, @@ -88,6 +87,7 @@ export function PanelWithForwardedRef({ order, style: styleFromProps, tagName: Type = "div", + ...rest }: PanelProps & { forwardedRef: ForwardedRef; }) { @@ -198,8 +198,8 @@ export function PanelWithForwardedRef({ isExpanded() { return !isPanelCollapsed(panelDataRef.current); }, - resize: (mixedSizes: Partial) => { - resizePanel(panelDataRef.current, mixedSizes); + resize: (size: number) => { + resizePanel(panelDataRef.current, size); }, }), [ @@ -215,6 +215,8 @@ export function PanelWithForwardedRef({ const style = getPanelStyle(panelDataRef.current); return createElement(Type, { + ...rest, + children, className: classNameFromProps, style: { @@ -222,8 +224,6 @@ export function PanelWithForwardedRef({ ...styleFromProps, }, - ...dataAttributes, - // CSS selectors "data-panel": "", "data-panel-id": panelId, diff --git a/packages/react-resizable-panels/src/PanelGroup.test.tsx b/packages/react-resizable-panels/src/PanelGroup.test.tsx index 11ac72296..1aeb6147f 100644 --- a/packages/react-resizable-panels/src/PanelGroup.test.tsx +++ b/packages/react-resizable-panels/src/PanelGroup.test.tsx @@ -2,13 +2,14 @@ import { Root, createRoot } from "react-dom/client"; import { act } from "react-dom/test-utils"; import { ImperativePanelGroupHandle, - MixedSizes, Panel, PanelGroup, PanelResizeHandle, } from "."; import { mockPanelGroupOffsetWidthAndHeight } from "./utils/test-utils"; import { createRef } from "./vendor/react"; +import { getPanelGroupElement } from "./utils/dom/getPanelGroupElement"; +import assert from "assert"; describe("PanelGroup", () => { let expectedWarnings: string[] = []; @@ -79,9 +80,9 @@ describe("PanelGroup", () => { it("should get and set layouts", () => { const ref = createRef(); - let mostRecentLayout: MixedSizes[] | null = null; + let mostRecentLayout: number[] | null = null; - const onLayout = (layout: MixedSizes[]) => { + const onLayout = (layout: number[]) => { mostRecentLayout = layout; }; @@ -105,6 +106,30 @@ describe("PanelGroup", () => { }); }); + it("should support ...rest attributes", () => { + act(() => { + root.render( + + + + + + ); + }); + + const element = getPanelGroupElement("group"); + assert(element); + expect(element.tabIndex).toBe(123); + expect(element.getAttribute("data-test-name")).toBe("foo"); + expect(element.title).toBe("bar"); + }); + describe("DEV warnings", () => { it("should warn about unstable layouts without id and order props", () => { act(() => { diff --git a/packages/react-resizable-panels/src/PanelGroup.ts b/packages/react-resizable-panels/src/PanelGroup.ts index 6c0852508..9b5c96d99 100644 --- a/packages/react-resizable-panels/src/PanelGroup.ts +++ b/packages/react-resizable-panels/src/PanelGroup.ts @@ -4,7 +4,7 @@ import { DragState, PanelGroupContext, ResizeEvent } from "./PanelGroupContext"; import useIsomorphicLayoutEffect from "./hooks/useIsomorphicEffect"; import useUniqueId from "./hooks/useUniqueId"; import { useWindowSplitterPanelGroupBehavior } from "./hooks/useWindowSplitterPanelGroupBehavior"; -import { DataAttributes, Direction, Size } from "./types"; +import { Direction } from "./types"; import { adjustLayoutByDelta } from "./utils/adjustLayoutByDelta"; import { areEqual } from "./utils/arrays"; import { calculateDeltaPercentage } from "./utils/calculateDeltaPercentage"; @@ -27,6 +27,7 @@ import { CSSProperties, ElementType, ForwardedRef, + HTMLAttributes, PropsWithChildren, createElement, forwardRef, @@ -42,8 +43,8 @@ const LOCAL_STORAGE_DEBOUNCE_INTERVAL = 100; export type ImperativePanelGroupHandle = { getId: () => string; - getLayout: () => Size[]; - setLayout: (layout: Partial[]) => void; + getLayout: () => number[]; + setLayout: (layout: number[]) => void; }; export type PanelGroupStorage = { @@ -51,7 +52,7 @@ export type PanelGroupStorage = { setItem(name: string, value: string): void; }; -export type PanelGroupOnLayout = (layout: Size[]) => void; +export type PanelGroupOnLayout = (layout: number[]) => void; const defaultStorage: PanelGroupStorage = { getItem: (name: string) => { @@ -64,18 +65,18 @@ const defaultStorage: PanelGroupStorage = { }, }; -export type PanelGroupProps = PropsWithChildren<{ - autoSaveId?: string | null; - className?: string; - dataAttributes?: DataAttributes; - direction: Direction; - id?: string | null; - keyboardResizeBy?: number | null; - onLayout?: PanelGroupOnLayout | null; - storage?: PanelGroupStorage; - style?: CSSProperties; - tagName?: ElementType; -}>; +export type PanelGroupProps = Omit, "id"> & + PropsWithChildren<{ + autoSaveId?: string | null; + className?: string; + direction: Direction; + id?: string | null; + keyboardResizeBy?: number | null; + onLayout?: PanelGroupOnLayout | null; + storage?: PanelGroupStorage; + style?: CSSProperties; + tagName?: ElementType; + }>; const debounceMap: { [key: string]: typeof savePanelGroupLayout; @@ -86,15 +87,15 @@ function PanelGroupWithForwardedRef({ autoSaveId = null, children, className: classNameFromProps = "", - dataAttributes, direction, forwardedRef, - id: idFromProps, + id: idFromProps = null, onLayout = null, keyboardResizeBy = null, storage = defaultStorage, style: styleFromProps, tagName: Type = "div", + ...rest }: PanelGroupProps & { forwardedRef: ForwardedRef; }) { @@ -103,7 +104,7 @@ function PanelGroupWithForwardedRef({ const [dragState, setDragState] = useState(null); const [layout, setLayout] = useState([]); - const panelIdToLastNotifiedSizeMapRef = useRef>({}); + const panelIdToLastNotifiedSizeMapRef = useRef>({}); const panelSizeBeforeCollapseRef = useRef>(new Map()); const prevDeltaRef = useRef(0); @@ -152,7 +153,7 @@ function PanelGroupWithForwardedRef({ return layout; }, - setLayout: (unsafeLayout: Size[]) => { + setLayout: (unsafeLayout: number[]) => { const { onLayout } = committedValuesRef.current; const { layout: prevLayout, panelDataArray } = eagerValuesRef.current; @@ -826,6 +827,8 @@ function PanelGroupWithForwardedRef({ PanelGroupContext.Provider, { value: context }, createElement(Type, { + ...rest, + children, className: classNameFromProps, style: { @@ -833,8 +836,6 @@ function PanelGroupWithForwardedRef({ ...styleFromProps, }, - ...dataAttributes, - // CSS selectors "data-panel-group": "", "data-panel-group-direction": direction, diff --git a/packages/react-resizable-panels/src/PanelGroupContext.ts b/packages/react-resizable-panels/src/PanelGroupContext.ts index 772a33e62..094061344 100644 --- a/packages/react-resizable-panels/src/PanelGroupContext.ts +++ b/packages/react-resizable-panels/src/PanelGroupContext.ts @@ -1,5 +1,4 @@ import { PanelData } from "./Panel"; -import { Size } from "./types"; import { CSSProperties, createContext } from "./vendor/react"; export type ResizeEvent = KeyboardEvent | MouseEvent | TouchEvent; @@ -17,14 +16,14 @@ export const PanelGroupContext = createContext<{ direction: "horizontal" | "vertical"; dragState: DragState | null; expandPanel: (panelData: PanelData) => void; - getPanelSize: (panelData: PanelData) => Size; + getPanelSize: (panelData: PanelData) => number; getPanelStyle: (panelData: PanelData) => CSSProperties; groupId: string; isPanelCollapsed: (panelData: PanelData) => boolean; isPanelExpanded: (panelData: PanelData) => boolean; registerPanel: (panelData: PanelData) => void; registerResizeHandle: (dragHandleId: string) => ResizeHandler; - resizePanel: (panelData: PanelData, mixedSizes: Partial) => void; + resizePanel: (panelData: PanelData, size: number) => void; startDragging: (dragHandleId: string, event: ResizeEvent) => void; stopDragging: () => void; unregisterPanel: (panelData: PanelData) => void; diff --git a/packages/react-resizable-panels/src/PanelResizeHandle.test.tsx b/packages/react-resizable-panels/src/PanelResizeHandle.test.tsx new file mode 100644 index 000000000..f088e43a9 --- /dev/null +++ b/packages/react-resizable-panels/src/PanelResizeHandle.test.tsx @@ -0,0 +1,68 @@ +import assert from "assert"; +import { Root, createRoot } from "react-dom/client"; +import { act } from "react-dom/test-utils"; +import { Panel, PanelGroup, PanelResizeHandle } from "."; +import { getResizeHandleElement } from "./utils/dom/getResizeHandleElement"; + +describe("PanelResizeHandle", () => { + let expectedWarnings: string[] = []; + let root: Root; + + beforeEach(() => { + // @ts-expect-error + global.IS_REACT_ACT_ENVIRONMENT = true; + + const container = document.createElement("div"); + document.body.appendChild(container); + + expectedWarnings = []; + root = createRoot(container); + + jest.spyOn(console, "warn").mockImplementation((actualMessage: string) => { + const match = expectedWarnings.findIndex((expectedMessage) => { + return actualMessage.includes(expectedMessage); + }); + + if (match >= 0) { + expectedWarnings.splice(match, 1); + return; + } + + throw Error(`Unexpected warning: ${actualMessage}`); + }); + }); + + afterEach(() => { + jest.clearAllMocks(); + jest.resetModules(); + + act(() => { + root.unmount(); + }); + + expect(expectedWarnings).toHaveLength(0); + }); + + it("should support ...rest attributes", () => { + act(() => { + root.render( + + + + + + ); + }); + + const element = getResizeHandleElement("handle"); + assert(element); + expect(element.tabIndex).toBe(123); + expect(element.getAttribute("data-test-name")).toBe("foo"); + expect(element.title).toBe("bar"); + }); +}); diff --git a/packages/react-resizable-panels/src/PanelResizeHandle.ts b/packages/react-resizable-panels/src/PanelResizeHandle.ts index 520b61dce..ac8daf27d 100644 --- a/packages/react-resizable-panels/src/PanelResizeHandle.ts +++ b/packages/react-resizable-panels/src/PanelResizeHandle.ts @@ -3,8 +3,9 @@ import { createElement, CSSProperties, ElementType, + HTMLAttributes, + PropsWithChildren, MouseEvent as ReactMouseEvent, - ReactNode, TouchEvent, useCallback, useContext, @@ -20,30 +21,30 @@ import { ResizeHandler, } from "./PanelGroupContext"; import { getCursorStyle } from "./utils/cursor"; -import { DataAttributes } from "./types"; export type PanelResizeHandleOnDragging = (isDragging: boolean) => void; -export type PanelResizeHandleProps = { - children?: ReactNode; - className?: string; - dataAttributes?: DataAttributes; - disabled?: boolean; - id?: string | null; - onDragging?: PanelResizeHandleOnDragging; - style?: CSSProperties; - tagName?: ElementType; -}; +export type PanelResizeHandleProps = Omit, "id"> & + PropsWithChildren<{ + className?: string; + disabled?: boolean; + id?: string | null; + onDragging?: PanelResizeHandleOnDragging; + style?: CSSProperties; + tabIndex?: number; + tagName?: ElementType; + }>; export function PanelResizeHandle({ children = null, className: classNameFromProps = "", - dataAttributes, disabled = false, - id: idFromProps = null, + id: idFromProps, onDragging, style: styleFromProps = {}, + tabIndex = 0, tagName: Type = "div", + ...rest }: PanelResizeHandleProps) { const divElementRef = useRef(null); @@ -152,6 +153,8 @@ export function PanelResizeHandle({ }; return createElement(Type, { + ...rest, + children, className: classNameFromProps, onBlur: () => setIsFocused(false), @@ -181,9 +184,7 @@ export function PanelResizeHandle({ ...style, ...styleFromProps, }, - tabIndex: 0, - - ...dataAttributes, + tabIndex, // CSS selectors "data-panel-group-direction": direction, diff --git a/packages/react-resizable-panels/src/index.ts b/packages/react-resizable-panels/src/index.ts index be8a53d0c..d5a42906a 100644 --- a/packages/react-resizable-panels/src/index.ts +++ b/packages/react-resizable-panels/src/index.ts @@ -2,8 +2,6 @@ import { Panel } from "./Panel"; import { PanelGroup } from "./PanelGroup"; import { PanelResizeHandle } from "./PanelResizeHandle"; -import type { Size } from "./types"; - import type { ImperativePanelHandle, PanelOnCollapse, @@ -26,7 +24,6 @@ export { // TypeScript types ImperativePanelGroupHandle, ImperativePanelHandle, - Size as MixedSizes, PanelGroupOnLayout, PanelGroupProps, PanelGroupStorage, @@ -36,7 +33,6 @@ export { PanelProps, PanelResizeHandleOnDragging, PanelResizeHandleProps, - Size, // React components Panel, diff --git a/packages/react-resizable-panels/src/types.ts b/packages/react-resizable-panels/src/types.ts index 7abdbe185..ef9ffc8ce 100644 --- a/packages/react-resizable-panels/src/types.ts +++ b/packages/react-resizable-panels/src/types.ts @@ -1,10 +1,4 @@ export type Direction = "horizontal" | "vertical"; -export type Size = number; - export type ResizeEvent = KeyboardEvent | MouseEvent | TouchEvent; export type ResizeHandler = (event: ResizeEvent) => void; - -export type DataAttributes = { - [attribute: string]: string | number | boolean | undefined; -}; diff --git a/packages/react-resizable-panels/src/utils/callPanelCallbacks.ts b/packages/react-resizable-panels/src/utils/callPanelCallbacks.ts index 689928408..a8831a4d3 100644 --- a/packages/react-resizable-panels/src/utils/callPanelCallbacks.ts +++ b/packages/react-resizable-panels/src/utils/callPanelCallbacks.ts @@ -1,11 +1,10 @@ import { PanelData } from "../Panel"; -import { Size } from "../types"; // Layout should be pre-converted into percentages export function callPanelCallbacks( panelsArray: PanelData[], layout: number[], - panelIdToLastNotifiedMixedSizesMap: Record + panelIdToLastNotifiedSizeMap: Record ) { layout.forEach((size, index) => { const panelData = panelsArray[index]; @@ -19,9 +18,9 @@ export function callPanelCallbacks( const { callbacks, constraints, id: panelId } = panelData; const { collapsedSize = 0, collapsible } = constraints; - const lastNotifiedSize = panelIdToLastNotifiedMixedSizesMap[panelId]; + const lastNotifiedSize = panelIdToLastNotifiedSizeMap[panelId]; if (lastNotifiedSize == null || size !== lastNotifiedSize) { - panelIdToLastNotifiedMixedSizesMap[panelId] = size; + panelIdToLastNotifiedSizeMap[panelId] = size; const { onCollapse, onExpand, onResize } = callbacks; diff --git a/packages/react-resizable-panels/src/utils/test-utils.ts b/packages/react-resizable-panels/src/utils/test-utils.ts index 3b699d1af..7491229f6 100644 --- a/packages/react-resizable-panels/src/utils/test-utils.ts +++ b/packages/react-resizable-panels/src/utils/test-utils.ts @@ -1,5 +1,3 @@ -import { Size } from "../types"; - const util = require("util"); export function expectToBeCloseToArray( @@ -74,7 +72,7 @@ export function mockPanelGroupOffsetWidthAndHeight( } export function verifyExpandedPanelGroupLayout( - actualLayout: Size[], + actualLayout: number[], expectedLayout: number[] ) { expect(actualLayout).toEqual(expectedLayout); diff --git a/packages/react-resizable-panels/src/vendor/react.ts b/packages/react-resizable-panels/src/vendor/react.ts index a0f3d73cb..cffb0fb3e 100644 --- a/packages/react-resizable-panels/src/vendor/react.ts +++ b/packages/react-resizable-panels/src/vendor/react.ts @@ -12,6 +12,7 @@ import type { CSSProperties, ElementType, ForwardedRef, + HTMLAttributes, MouseEvent, PropsWithChildren, ReactNode, @@ -57,6 +58,7 @@ export type { CSSProperties, ElementType, ForwardedRef, + HTMLAttributes, MouseEvent, PropsWithChildren, ReactNode,