react-resizable-panels 2.1.7 → 2.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +4 -0
- package/dist/declarations/src/Panel.d.ts +1 -1
- package/dist/declarations/src/PanelGroup.d.ts +1 -1
- package/dist/declarations/src/PanelResizeHandle.d.ts +6 -3
- package/dist/declarations/src/constants.d.ts +15 -0
- package/dist/declarations/src/index.d.ts +3 -2
- package/dist/react-resizable-panels.browser.cjs.js +202 -176
- package/dist/react-resizable-panels.browser.cjs.mjs +1 -0
- package/dist/react-resizable-panels.browser.development.cjs.js +202 -176
- package/dist/react-resizable-panels.browser.development.cjs.mjs +1 -0
- package/dist/react-resizable-panels.browser.development.esm.js +150 -124
- package/dist/react-resizable-panels.browser.esm.js +150 -124
- package/dist/react-resizable-panels.cjs.js +202 -176
- package/dist/react-resizable-panels.cjs.mjs +1 -0
- package/dist/react-resizable-panels.development.cjs.js +202 -176
- package/dist/react-resizable-panels.development.cjs.mjs +1 -0
- package/dist/react-resizable-panels.development.esm.js +150 -124
- package/dist/react-resizable-panels.development.node.cjs.js +201 -174
- package/dist/react-resizable-panels.development.node.cjs.mjs +1 -0
- package/dist/react-resizable-panels.development.node.esm.js +149 -122
- package/dist/react-resizable-panels.esm.js +150 -124
- package/dist/react-resizable-panels.node.cjs.js +201 -174
- package/dist/react-resizable-panels.node.cjs.mjs +1 -0
- package/dist/react-resizable-panels.node.esm.js +149 -122
- package/package.json +12 -13
- package/dist/declarations/src/vendor/react.d.ts +0 -7
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 Brian Vaughn
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -175,6 +175,10 @@ This likely means that you haven't applied any CSS to style the resize handles.
|
|
|
175
175
|
<PanelResizeHandle className="w-2 bg-blue-800" />
|
|
176
176
|
```
|
|
177
177
|
|
|
178
|
+
### Can panel sizes be persistent?
|
|
179
|
+
|
|
180
|
+
Yes. Panel groups with an `autoSaveId` prop will automatically save and restore their layouts on mount.
|
|
181
|
+
|
|
178
182
|
### How can I use persistent layouts with SSR?
|
|
179
183
|
|
|
180
184
|
By default, this library uses `localStorage` to persist layouts. With server rendering, this can cause a flicker when the default layout (rendered on the server) is replaced with the persisted layout (in `localStorage`). The way to avoid this flicker is to also persist the layout with a cookie like so:
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ForwardedRef, HTMLAttributes, PropsWithChildren, ReactElement } from "
|
|
1
|
+
import { ForwardedRef, HTMLAttributes, PropsWithChildren, ReactElement } from "react";
|
|
2
2
|
export type PanelOnCollapse = () => void;
|
|
3
3
|
export type PanelOnExpand = () => void;
|
|
4
4
|
export type PanelOnResize = (size: number, prevSize: number | undefined) => void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { CSSProperties, HTMLAttributes, PropsWithChildren } from "react";
|
|
1
2
|
import { Direction } from "./types.js";
|
|
2
|
-
import { CSSProperties, HTMLAttributes, PropsWithChildren } from "./vendor/react.js";
|
|
3
3
|
export type ImperativePanelGroupHandle = {
|
|
4
4
|
getId: () => string;
|
|
5
5
|
getLayout: () => number[];
|
|
@@ -1,20 +1,23 @@
|
|
|
1
|
+
import { CSSProperties, HTMLAttributes, PropsWithChildren, ReactElement } from "react";
|
|
1
2
|
import { PointerHitAreaMargins } from "./PanelResizeHandleRegistry.js";
|
|
2
|
-
import { CSSProperties, HTMLAttributes, PropsWithChildren, ReactElement } from "./vendor/react.js";
|
|
3
3
|
export type PanelResizeHandleOnDragging = (isDragging: boolean) => void;
|
|
4
4
|
export type ResizeHandlerState = "drag" | "hover" | "inactive";
|
|
5
|
-
export type PanelResizeHandleProps = Omit<HTMLAttributes<keyof HTMLElementTagNameMap>, "id" | "onBlur" | "onFocus"> & PropsWithChildren<{
|
|
5
|
+
export type PanelResizeHandleProps = Omit<HTMLAttributes<keyof HTMLElementTagNameMap>, "id" | "onBlur" | "onClick" | "onFocus" | "onPointerDown" | "onPointerUp"> & PropsWithChildren<{
|
|
6
6
|
className?: string;
|
|
7
7
|
disabled?: boolean;
|
|
8
8
|
hitAreaMargins?: PointerHitAreaMargins;
|
|
9
9
|
id?: string | null;
|
|
10
10
|
onBlur?: () => void;
|
|
11
|
+
onClick?: () => void;
|
|
11
12
|
onDragging?: PanelResizeHandleOnDragging;
|
|
12
13
|
onFocus?: () => void;
|
|
14
|
+
onPointerDown?: () => void;
|
|
15
|
+
onPointerUp?: () => void;
|
|
13
16
|
style?: CSSProperties;
|
|
14
17
|
tabIndex?: number;
|
|
15
18
|
tagName?: keyof HTMLElementTagNameMap;
|
|
16
19
|
}>;
|
|
17
|
-
export declare function PanelResizeHandle({ children, className: classNameFromProps, disabled, hitAreaMargins, id: idFromProps, onBlur, onDragging, onFocus, style: styleFromProps, tabIndex, tagName: Type, ...rest }: PanelResizeHandleProps): ReactElement;
|
|
20
|
+
export declare function PanelResizeHandle({ children, className: classNameFromProps, disabled, hitAreaMargins, id: idFromProps, onBlur, onClick, onDragging, onFocus, onPointerDown, onPointerUp, style: styleFromProps, tabIndex, tagName: Type, ...rest }: PanelResizeHandleProps): ReactElement;
|
|
18
21
|
export declare namespace PanelResizeHandle {
|
|
19
22
|
var displayName: string;
|
|
20
23
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare const DATA_ATTRIBUTES: {
|
|
2
|
+
readonly group: "data-panel-group";
|
|
3
|
+
readonly groupDirection: "data-panel-group-direction";
|
|
4
|
+
readonly groupId: "data-panel-group-id";
|
|
5
|
+
readonly panel: "data-panel";
|
|
6
|
+
readonly panelCollapsible: "data-panel-collapsible";
|
|
7
|
+
readonly panelId: "data-panel-id";
|
|
8
|
+
readonly panelSize: "data-panel-size";
|
|
9
|
+
readonly resizeHandle: "data-resize-handle";
|
|
10
|
+
readonly resizeHandleActive: "data-resize-handle-active";
|
|
11
|
+
readonly resizeHandleEnabled: "data-panel-resize-handle-enabled";
|
|
12
|
+
readonly resizeHandleId: "data-panel-resize-handle-id";
|
|
13
|
+
readonly resizeHandleState: "data-resize-handle-state";
|
|
14
|
+
};
|
|
15
|
+
export declare const PRECISION = 10;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { Panel } from "./Panel.js";
|
|
2
2
|
import { PanelGroup } from "./PanelGroup.js";
|
|
3
3
|
import { PanelResizeHandle } from "./PanelResizeHandle.js";
|
|
4
|
+
import { DATA_ATTRIBUTES } from "./constants.js";
|
|
4
5
|
import { assert } from "./utils/assert.js";
|
|
5
6
|
import { setNonce } from "./utils/csp.js";
|
|
6
|
-
import {
|
|
7
|
+
import { disableGlobalCursorStyles, enableGlobalCursorStyles } from "./utils/cursor.js";
|
|
7
8
|
import { getPanelElement } from "./utils/dom/getPanelElement.js";
|
|
8
9
|
import { getPanelElementsForGroup } from "./utils/dom/getPanelElementsForGroup.js";
|
|
9
10
|
import { getPanelGroupElement } from "./utils/dom/getPanelGroupElement.js";
|
|
@@ -17,4 +18,4 @@ import type { ImperativePanelHandle, PanelOnCollapse, PanelOnExpand, PanelOnResi
|
|
|
17
18
|
import type { ImperativePanelGroupHandle, PanelGroupOnLayout, PanelGroupProps, PanelGroupStorage } from "./PanelGroup.js";
|
|
18
19
|
import type { PanelResizeHandleOnDragging, PanelResizeHandleProps } from "./PanelResizeHandle.js";
|
|
19
20
|
import type { PointerHitAreaMargins } from "./PanelResizeHandleRegistry.js";
|
|
20
|
-
export { ImperativePanelGroupHandle, ImperativePanelHandle, PanelGroupOnLayout, PanelGroupProps, PanelGroupStorage, PanelOnCollapse, PanelOnExpand, PanelOnResize, PanelProps, PanelResizeHandleOnDragging, PanelResizeHandleProps, PointerHitAreaMargins, Panel, PanelGroup, PanelResizeHandle, assert, getIntersectingRectangle, intersects, getPanelElement, getPanelElementsForGroup, getPanelGroupElement, getResizeHandleElement, getResizeHandleElementIndex, getResizeHandleElementsForGroup, getResizeHandlePanelIds, enableGlobalCursorStyles, disableGlobalCursorStyles, setNonce, };
|
|
21
|
+
export { ImperativePanelGroupHandle, ImperativePanelHandle, PanelGroupOnLayout, PanelGroupProps, PanelGroupStorage, PanelOnCollapse, PanelOnExpand, PanelOnResize, PanelProps, PanelResizeHandleOnDragging, PanelResizeHandleProps, PointerHitAreaMargins, Panel, PanelGroup, PanelResizeHandle, assert, getIntersectingRectangle, intersects, getPanelElement, getPanelElementsForGroup, getPanelGroupElement, getResizeHandleElement, getResizeHandleElementIndex, getResizeHandleElementsForGroup, getResizeHandlePanelIds, enableGlobalCursorStyles, disableGlobalCursorStyles, setNonce, DATA_ATTRIBUTES, };
|