react-resizable-panels 0.0.54 → 0.0.56

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.
Files changed (86) hide show
  1. package/.eslintrc.cjs +26 -0
  2. package/CHANGELOG.md +253 -80
  3. package/README.md +55 -49
  4. package/dist/declarations/src/Panel.d.ts +76 -20
  5. package/dist/declarations/src/PanelGroup.d.ts +29 -21
  6. package/dist/declarations/src/PanelResizeHandle.d.ts +1 -1
  7. package/dist/declarations/src/index.d.ts +5 -5
  8. package/dist/declarations/src/types.d.ts +3 -25
  9. package/dist/declarations/src/vendor/react.d.ts +4 -4
  10. package/dist/react-resizable-panels.browser.cjs.js +1279 -796
  11. package/dist/react-resizable-panels.browser.development.cjs.js +1404 -809
  12. package/dist/react-resizable-panels.browser.development.esm.js +1398 -803
  13. package/dist/react-resizable-panels.browser.esm.js +1279 -796
  14. package/dist/react-resizable-panels.cjs.js +1279 -796
  15. package/dist/react-resizable-panels.cjs.js.map +1 -0
  16. package/dist/react-resizable-panels.development.cjs.js +1399 -804
  17. package/dist/react-resizable-panels.development.esm.js +1400 -805
  18. package/dist/react-resizable-panels.development.node.cjs.js +1172 -755
  19. package/dist/react-resizable-panels.development.node.esm.js +1173 -756
  20. package/dist/react-resizable-panels.esm.js +1279 -796
  21. package/dist/react-resizable-panels.esm.js.map +1 -0
  22. package/dist/react-resizable-panels.node.cjs.js +1064 -749
  23. package/dist/react-resizable-panels.node.esm.js +1065 -750
  24. package/jest.config.js +10 -0
  25. package/package.json +3 -1
  26. package/src/Panel.test.tsx +308 -0
  27. package/src/Panel.ts +179 -127
  28. package/src/PanelGroup.test.tsx +210 -0
  29. package/src/PanelGroup.ts +751 -580
  30. package/src/PanelGroupContext.ts +33 -0
  31. package/src/PanelResizeHandle.ts +13 -8
  32. package/src/hooks/useUniqueId.ts +1 -1
  33. package/src/hooks/useWindowSplitterBehavior.ts +9 -161
  34. package/src/hooks/useWindowSplitterPanelGroupBehavior.ts +185 -0
  35. package/src/index.ts +24 -11
  36. package/src/types.ts +3 -29
  37. package/src/utils/adjustLayoutByDelta.test.ts +1808 -0
  38. package/src/utils/adjustLayoutByDelta.ts +211 -0
  39. package/src/utils/calculateAriaValues.test.ts +111 -0
  40. package/src/utils/calculateAriaValues.ts +67 -0
  41. package/src/utils/calculateDeltaPercentage.ts +68 -0
  42. package/src/utils/calculateDragOffsetPercentage.ts +30 -0
  43. package/src/utils/calculateUnsafeDefaultLayout.test.ts +92 -0
  44. package/src/utils/calculateUnsafeDefaultLayout.ts +55 -0
  45. package/src/utils/callPanelCallbacks.ts +81 -0
  46. package/src/utils/compareLayouts.test.ts +9 -0
  47. package/src/utils/compareLayouts.ts +12 -0
  48. package/src/utils/computePanelFlexBoxStyle.ts +44 -0
  49. package/src/utils/computePercentagePanelConstraints.test.ts +71 -0
  50. package/src/utils/computePercentagePanelConstraints.ts +56 -0
  51. package/src/utils/convertPercentageToPixels.test.ts +9 -0
  52. package/src/utils/convertPercentageToPixels.ts +6 -0
  53. package/src/utils/convertPixelConstraintsToPercentages.ts +55 -0
  54. package/src/utils/convertPixelsToPercentage.test.ts +9 -0
  55. package/src/utils/convertPixelsToPercentage.ts +6 -0
  56. package/src/utils/determinePivotIndices.ts +10 -0
  57. package/src/utils/dom/calculateAvailablePanelSizeInPixels.ts +29 -0
  58. package/src/utils/dom/getAvailableGroupSizePixels.ts +29 -0
  59. package/src/utils/dom/getPanelElement.ts +7 -0
  60. package/src/utils/dom/getPanelGroupElement.ts +7 -0
  61. package/src/utils/dom/getResizeHandleElement.ts +9 -0
  62. package/src/utils/dom/getResizeHandleElementIndex.ts +12 -0
  63. package/src/utils/dom/getResizeHandleElementsForGroup.ts +9 -0
  64. package/src/utils/dom/getResizeHandlePanelIds.ts +18 -0
  65. package/src/utils/events.ts +13 -0
  66. package/src/utils/getPercentageSizeFromMixedSizes.test.ts +47 -0
  67. package/src/utils/getPercentageSizeFromMixedSizes.ts +15 -0
  68. package/src/utils/getResizeEventCursorPosition.ts +19 -0
  69. package/src/utils/initializeDefaultStorage.ts +26 -0
  70. package/src/utils/numbers/fuzzyCompareNumbers.test.ts +16 -0
  71. package/src/utils/numbers/fuzzyCompareNumbers.ts +17 -0
  72. package/src/utils/numbers/fuzzyNumbersEqual.ts +9 -0
  73. package/src/utils/resizePanel.ts +41 -0
  74. package/src/utils/serialization.ts +9 -4
  75. package/src/utils/shouldMonitorPixelBasedConstraints.test.ts +23 -0
  76. package/src/utils/shouldMonitorPixelBasedConstraints.ts +13 -0
  77. package/src/utils/test-utils.ts +136 -0
  78. package/src/utils/validatePanelConstraints.test.ts +151 -0
  79. package/src/utils/validatePanelConstraints.ts +103 -0
  80. package/src/utils/validatePanelGroupLayout.test.ts +233 -0
  81. package/src/utils/validatePanelGroupLayout.ts +88 -0
  82. package/src/vendor/react.ts +4 -0
  83. package/.eslintrc.json +0 -22
  84. package/src/PanelContexts.ts +0 -20
  85. package/src/utils/coordinates.ts +0 -149
  86. package/src/utils/group.ts +0 -315
package/README.md CHANGED
@@ -1,11 +1,12 @@
1
1
  # react-resizable-panels
2
+
2
3
  React components for resizable panel groups/layouts
3
4
 
4
5
  ```jsx
5
6
  import { Panel, PanelGroup, PanelResizeHandle } from "react-resizable-panels";
6
7
 
7
8
  <PanelGroup autoSaveId="example" direction="horizontal">
8
- <Panel defaultSize={25}>
9
+ <Panel defaultSizePercentage={25}>
9
10
  <SourcesExplorer />
10
11
  </Panel>
11
12
  <PanelResizeHandle />
@@ -13,10 +14,10 @@ import { Panel, PanelGroup, PanelResizeHandle } from "react-resizable-panels";
13
14
  <SourceViewer />
14
15
  </Panel>
15
16
  <PanelResizeHandle />
16
- <Panel defaultSize={25}>
17
+ <Panel defaultSizePercentage={25}>
17
18
  <Console />
18
19
  </Panel>
19
- </PanelGroup>
20
+ </PanelGroup>;
20
21
  ```
21
22
 
22
23
  ### If you like this project, 🎉 [become a sponsor](https://github.com/sponsors/bvaughn/) or ☕ [buy me a coffee](http://givebrian.coffee/)
@@ -24,68 +25,73 @@ import { Panel, PanelGroup, PanelResizeHandle } from "react-resizable-panels";
24
25
  ## Props
25
26
 
26
27
  ### `PanelGroup`
27
- | prop | type | description
28
- | :--------------------------------- | :--------------------------- | :---
29
- | `autoSaveId` | `?string` | Unique id used to auto-save group arrangement via `localStorage`
30
- | `children` | `ReactNode` | Arbitrary React element(s)
31
- | `className` | `?string` | Class name to attach to root element
32
- | `direction` | `"horizontal" \| "vertical"` | Group orientation
33
- | `disablePointerEventsDuringResize` | `?boolean = false` | Disable pointer events inside `Panel`s during resize <sup>2</sup>
34
- | `id` | `?string` | Group id; falls back to `useId` when not provided
35
- | `onLayout` | `?(sizes: number[]) => void` | Called when group layout changes
36
- | `storage` | `?PanelGroupStorage` | Custom storage API; defaults to `localStorage` <sup>1</sup>
37
- | `style` | `?CSSProperties` | CSS style to attach to root element
38
- | `tagName` | `?string = "div"` | HTML element tag name for root element
28
+
29
+ | prop | type | description |
30
+ | :--------------------------------- | :--------------------------- | :---------------------------------------------------------------- |
31
+ | `autoSaveId` | `?string` | Unique id used to auto-save group arrangement via `localStorage` |
32
+ | `children` | `ReactNode` | Arbitrary React element(s) |
33
+ | `className` | `?string` | Class name to attach to root element |
34
+ | `direction` | `"horizontal" \| "vertical"` | Group orientation |
35
+ | `disablePointerEventsDuringResize` | `?boolean = false` | Disable pointer events inside `Panel`s during resize <sup>2</sup> |
36
+ | `id` | `?string` | Group id; falls back to `useId` when not provided |
37
+ | `onLayout` | `?(sizes: number[]) => void` | Called when group layout changes |
38
+ | `storage` | `?PanelGroupStorage` | Custom storage API; defaults to `localStorage` <sup>1</sup> |
39
+ | `style` | `?CSSProperties` | CSS style to attach to root element |
40
+ | `tagName` | `?string = "div"` | HTML element tag name for root element |
39
41
 
40
42
  <sup>1</sup>: Storage API must define the following _synchronous_ methods:
41
- * `getItem: (name:string) => string`
42
- * `setItem: (name: string, value: string) => void`
43
43
 
44
- <sup>2</sup>: This behavior is disabled by default because it can interfere with scrollbar styles, but it can be useful in the edge case where a `Panel` contains an `<iframe>`
44
+ - `getItem: (name:string) => string`
45
+ - `setItem: (name: string, value: string) => void`
46
+
47
+ <sup>2</sup>: This behavior is disabled by default because it can interfere with scrollbar styles, but it can be useful in the edge case where a `Panel` contains an `<iframe>`
45
48
 
46
49
  `PanelGroup` components also expose an imperative API for manual resizing:
47
- | method | description
50
+ | method | description
48
51
  | :-------------------------------- | :---
49
52
  | `setLayout(panelSizes: number[])` | Resize panel group to the specified _panelSizes_ (`[1 - 100, ...]`).
50
53
 
51
54
  ### `Panel`
52
- | prop | type | description
53
- | :-------------- | :------------------------------ | :---
54
- | `children` | `ReactNode` | Arbitrary React element(s)
55
- | `className` | `?string` | Class name to attach to root element
56
- | `collapsedSize` | `?number=0` | Panel should collapse to this size
57
- | `collapsible` | `?boolean=false` | Panel should collapse when resized beyond its `minSize`
58
- | `defaultSize` | `?number` | Initial size of panel (numeric value between 1-100)
59
- | `id` | `?string` | Panel id (unique within group); falls back to `useId` when not provided
60
- | `maxSize` | `?number = 100` | Maximum allowable size of panel (numeric value between 1-100); defaults to `100`
61
- | `minSize` | `?number = 10` | Minimum allowable size of panel (numeric value between 1-100); defaults to `10`
62
- | `onCollapse` | `?(collapsed: boolean) => void` | Called when panel is collapsed; `collapsed` boolean parameter reflecting the new state
63
- | `onResize` | `?(size: number) => void` | Called when panel is resized; `size` parameter is a numeric value between 1-100. <sup>1</sup>
64
- | `order` | `?number` | Order of panel within group; required for groups with conditionally rendered panels
65
- | `style` | `?CSSProperties` | CSS style to attach to root element
66
- | `tagName` | `?string = "div"` | HTML element tag name for root element
55
+
56
+ | prop | type | description |
57
+ | :-------------- | :------------------------------ | :-------------------------------------------------------------------------------------------- |
58
+ | `children` | `ReactNode` | Arbitrary React element(s) |
59
+ | `className` | `?string` | Class name to attach to root element |
60
+ | `collapsedSize` | `?number=0` | Panel should collapse to this size |
61
+ | `collapsible` | `?boolean=false` | Panel should collapse when resized beyond its `minSize` |
62
+ | `defaultSize` | `?number` | Initial size of panel (numeric value between 1-100) |
63
+ | `id` | `?string` | Panel id (unique within group); falls back to `useId` when not provided |
64
+ | `maxSize` | `?number = 100` | Maximum allowable size of panel (numeric value between 1-100); defaults to `100` |
65
+ | `minSize` | `?number = 10` | Minimum allowable size of panel (numeric value between 1-100); defaults to `10` |
66
+ | `onCollapse` | `?(collapsed: boolean) => void` | Called when panel is collapsed; `collapsed` boolean parameter reflecting the new state |
67
+ | `onResize` | `?(size: number) => void` | Called when panel is resized; `size` parameter is a numeric value between 1-100. <sup>1</sup> |
68
+ | `order` | `?number` | Order of panel within group; required for groups with conditionally rendered panels |
69
+ | `style` | `?CSSProperties` | CSS style to attach to root element |
70
+ | `tagName` | `?string = "div"` | HTML element tag name for root element |
67
71
 
68
72
  <sup>1</sup>: If any `Panel` has an `onResize` callback, the `order` prop should be provided for all `Panel`s.
69
73
 
70
74
  `Panel` components also expose an imperative API for manual resizing:
71
- | method | description
75
+ | method | description
72
76
  | :--------------------------- | :---
73
- | `collapse()` | If panel is `collapsible`, collapse it fully.
74
- | `expand()` | If panel is currently _collapsed_, expand it to its most recent size.
75
- | `getCollapsed(): boolean` | Returns `true` if the panel is currently _collapsed_ (`size === 0`).
76
- | `getSize(): number` | Returns the most recently commited size of the panel as a percentage (`1 - 100`).
77
+ | `collapse()` | If panel is `collapsible`, collapse it fully.
78
+ | `expand()` | If panel is currently _collapsed_, expand it to its most recent size.
79
+ | `getCollapsed(): boolean` | Returns `true` if the panel is currently _collapsed_ (`size === 0`).
80
+ | `getSize(): number` | Returns the most recently commited size of the panel as a percentage (`1 - 100`).
77
81
  | `resize(percentage: number)` | Resize panel to the specified _percentage_ (`1 - 100`).
78
82
 
79
83
  ### `PanelResizeHandle`
80
- | prop | type | description
81
- | :------------ | :------------------------------- | :---
82
- | `children` | `?ReactNode` | Custom drag UI; can be any arbitrary React element(s)
83
- | `className` | `?string` | Class name to attach to root element
84
- | `disabled` | `?boolean` | Disable drag handle
85
- | `id` | `?string` | Resize handle id (unique within group); falls back to `useId` when not provided
86
- | `onDragging` | `?(isDragging: boolean) => void` | Called when group layout changes
87
- | `style` | `?CSSProperties` | CSS style to attach to root element
88
- | `tagName` | `?string = "div"` | HTML element tag name for root element
84
+
85
+ | prop | type | description |
86
+ | :----------- | :------------------------------- | :------------------------------------------------------------------------------ |
87
+ | `children` | `?ReactNode` | Custom drag UI; can be any arbitrary React element(s) |
88
+ | `className` | `?string` | Class name to attach to root element |
89
+ | `disabled` | `?boolean` | Disable drag handle |
90
+ | `id` | `?string` | Resize handle id (unique within group); falls back to `useId` when not provided |
91
+ | `onDragging` | `?(isDragging: boolean) => void` | Called when group layout changes |
92
+ | `style` | `?CSSProperties` | CSS style to attach to root element |
93
+ | `tagName` | `?string = "div"` | HTML element tag name for root element |
94
+
89
95
  ---
90
96
 
91
- #### If you like this project, [buy me a coffee](http://givebrian.coffee/).
97
+ #### If you like this project, [buy me a coffee](http://givebrian.coffee/).
@@ -1,25 +1,81 @@
1
- import { CSSProperties, ElementType, ReactNode } from "./vendor/react.js";
2
- import { PanelOnCollapse, PanelOnResize } from "./types.js";
3
- export type PanelProps = {
4
- children?: ReactNode;
5
- className?: string;
6
- collapsedSize?: number;
7
- collapsible?: boolean;
8
- defaultSize?: number | null;
9
- id?: string | null;
10
- maxSize?: number;
11
- minSize?: number;
12
- onCollapse?: PanelOnCollapse | null;
13
- onResize?: PanelOnResize | null;
14
- order?: number | null;
15
- style?: CSSProperties;
16
- tagName?: ElementType;
1
+ import { MixedSizes } from "./types.js";
2
+ import { ElementType, ForwardedRef, PropsWithChildren } from "./vendor/react.js";
3
+ export type PanelOnCollapse = () => void;
4
+ export type PanelOnExpand = () => void;
5
+ export type PanelOnResize = (mixedSizes: MixedSizes, prevMixedSizes: MixedSizes) => void;
6
+ export type PanelCallbacks = {
7
+ onCollapse?: PanelOnCollapse;
8
+ onExpand?: PanelOnExpand;
9
+ onResize?: PanelOnResize;
10
+ };
11
+ export type PanelConstraints = {
12
+ collapsedSizePercentage?: number | undefined;
13
+ collapsedSizePixels?: number | undefined;
14
+ collapsible?: boolean | undefined;
15
+ defaultSizePercentage?: number | undefined;
16
+ defaultSizePixels?: number | undefined;
17
+ maxSizePercentage?: number | undefined;
18
+ maxSizePixels?: number | undefined;
19
+ minSizePercentage?: number | undefined;
20
+ minSizePixels?: number | undefined;
21
+ };
22
+ export type PanelData = {
23
+ callbacks: PanelCallbacks;
24
+ constraints: PanelConstraints;
25
+ id: string;
26
+ idIsFromProps: boolean;
27
+ order: number | undefined;
17
28
  };
18
29
  export type ImperativePanelHandle = {
19
30
  collapse: () => void;
20
31
  expand: () => void;
21
- getCollapsed(): boolean;
22
- getSize(): number;
23
- resize: (percentage: number) => void;
32
+ getId(): string;
33
+ getSize(): MixedSizes;
34
+ resize: (size: Partial<MixedSizes>) => void;
24
35
  };
25
- export declare const Panel: import("react").ForwardRefExoticComponent<PanelProps & import("react").RefAttributes<ImperativePanelHandle>>;
36
+ export type PanelProps = PropsWithChildren<{
37
+ className?: string;
38
+ collapsedSizePercentage?: number | undefined;
39
+ collapsedSizePixels?: number | undefined;
40
+ collapsible?: boolean | undefined;
41
+ defaultSizePercentage?: number | undefined;
42
+ defaultSizePixels?: number | undefined;
43
+ id?: string;
44
+ maxSizePercentage?: number | undefined;
45
+ maxSizePixels?: number | undefined;
46
+ minSizePercentage?: number | undefined;
47
+ minSizePixels?: number | undefined;
48
+ onCollapse?: PanelOnCollapse;
49
+ onExpand?: PanelOnExpand;
50
+ onResize?: PanelOnResize;
51
+ order?: number;
52
+ style?: object;
53
+ tagName?: ElementType;
54
+ }>;
55
+ export declare function PanelWithForwardedRef({ children, className: classNameFromProps, collapsedSizePercentage, collapsedSizePixels, collapsible, defaultSizePercentage, defaultSizePixels, forwardedRef, id: idFromProps, maxSizePercentage, maxSizePixels, minSizePercentage, minSizePixels, onCollapse, onExpand, onResize, order, style: styleFromProps, tagName: Type, }: PanelProps & {
56
+ forwardedRef: ForwardedRef<ImperativePanelHandle>;
57
+ }): import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
58
+ export declare namespace PanelWithForwardedRef {
59
+ var displayName: string;
60
+ }
61
+ export declare const Panel: import("react").ForwardRefExoticComponent<{
62
+ className?: string | undefined;
63
+ collapsedSizePercentage?: number | undefined;
64
+ collapsedSizePixels?: number | undefined;
65
+ collapsible?: boolean | undefined;
66
+ defaultSizePercentage?: number | undefined;
67
+ defaultSizePixels?: number | undefined;
68
+ id?: string | undefined;
69
+ maxSizePercentage?: number | undefined;
70
+ maxSizePixels?: number | undefined;
71
+ minSizePercentage?: number | undefined;
72
+ minSizePixels?: number | undefined;
73
+ onCollapse?: PanelOnCollapse | undefined;
74
+ onExpand?: PanelOnExpand | undefined;
75
+ onResize?: PanelOnResize | undefined;
76
+ order?: number | undefined;
77
+ style?: object | undefined;
78
+ tagName?: ElementType | undefined;
79
+ } & {
80
+ children?: import("react").ReactNode;
81
+ } & import("react").RefAttributes<ImperativePanelHandle>>;
@@ -1,30 +1,38 @@
1
- import { CSSProperties, ElementType, ReactNode } from "./vendor/react.js";
2
- import { Direction, PanelData, PanelGroupOnLayout, PanelGroupStorage } from "./types.js";
3
- export type CommittedValues = {
4
- direction: Direction;
5
- panels: Map<string, PanelData>;
6
- sizes: number[];
1
+ import { Direction, MixedSizes } from "./types.js";
2
+ import { CSSProperties, ElementType, PropsWithChildren } from "./vendor/react.js";
3
+ export type ImperativePanelGroupHandle = {
4
+ getId: () => string;
5
+ getLayout: () => MixedSizes[];
6
+ setLayout: (layout: Partial<MixedSizes>[]) => void;
7
7
  };
8
- export type PanelDataMap = Map<string, PanelData>;
9
- export type InitialDragState = {
10
- dragHandleRect: DOMRect;
11
- dragOffset: number;
12
- sizes: number[];
8
+ export type PanelGroupStorage = {
9
+ getItem(name: string): string | null;
10
+ setItem(name: string, value: string): void;
13
11
  };
14
- export type PanelGroupProps = {
12
+ export type PanelGroupOnLayout = (layout: MixedSizes[]) => void;
13
+ export type PanelGroupProps = PropsWithChildren<{
15
14
  autoSaveId?: string;
16
- children?: ReactNode;
17
15
  className?: string;
18
16
  direction: Direction;
19
- disablePointerEventsDuringResize?: boolean;
20
17
  id?: string | null;
21
- onLayout?: PanelGroupOnLayout;
18
+ keyboardResizeByPercentage?: number | null;
19
+ keyboardResizeByPixels?: number | null;
20
+ onLayout?: PanelGroupOnLayout | null;
22
21
  storage?: PanelGroupStorage;
23
22
  style?: CSSProperties;
24
23
  tagName?: ElementType;
25
- };
26
- export type ImperativePanelGroupHandle = {
27
- getLayout: () => number[];
28
- setLayout: (panelSizes: number[]) => void;
29
- };
30
- export declare const PanelGroup: import("react").ForwardRefExoticComponent<PanelGroupProps & import("react").RefAttributes<ImperativePanelGroupHandle>>;
24
+ }>;
25
+ export declare const PanelGroup: import("react").ForwardRefExoticComponent<{
26
+ autoSaveId?: string | undefined;
27
+ className?: string | undefined;
28
+ direction: Direction;
29
+ id?: string | null | undefined;
30
+ keyboardResizeByPercentage?: number | null | undefined;
31
+ keyboardResizeByPixels?: number | null | undefined;
32
+ onLayout?: PanelGroupOnLayout | null | undefined;
33
+ storage?: PanelGroupStorage | undefined;
34
+ style?: CSSProperties | undefined;
35
+ tagName?: ElementType | undefined;
36
+ } & {
37
+ children?: import("react").ReactNode;
38
+ } & import("react").RefAttributes<ImperativePanelGroupHandle>>;
@@ -1,5 +1,5 @@
1
1
  import { CSSProperties, ElementType, ReactNode } from "./vendor/react.js";
2
- import type { PanelResizeHandleOnDragging } from "./types.js";
2
+ export type PanelResizeHandleOnDragging = (isDragging: boolean) => void;
3
3
  export type PanelResizeHandleProps = {
4
4
  children?: ReactNode;
5
5
  className?: string;
@@ -1,8 +1,8 @@
1
1
  import { Panel } from "./Panel.js";
2
2
  import { PanelGroup } from "./PanelGroup.js";
3
3
  import { PanelResizeHandle } from "./PanelResizeHandle.js";
4
- import type { ImperativePanelHandle, PanelProps } from "./Panel.js";
5
- import type { ImperativePanelGroupHandle, PanelGroupProps } from "./PanelGroup.js";
6
- import type { PanelResizeHandleProps } from "./PanelResizeHandle.js";
7
- import type { PanelGroupOnLayout, PanelGroupStorage, PanelOnCollapse, PanelOnResize, PanelResizeHandleOnDragging } from "./types.js";
8
- export { ImperativePanelGroupHandle, ImperativePanelHandle, Panel, PanelOnCollapse, PanelOnResize, PanelGroup, PanelGroupOnLayout, PanelGroupProps, PanelGroupStorage, PanelProps, PanelResizeHandle, PanelResizeHandleOnDragging, PanelResizeHandleProps, };
4
+ import type { MixedSizes } from "./types.js";
5
+ import type { ImperativePanelHandle, PanelOnCollapse, PanelOnExpand, PanelOnResize, PanelProps } from "./Panel.js";
6
+ import type { ImperativePanelGroupHandle, PanelGroupOnLayout, PanelGroupProps, PanelGroupStorage } from "./PanelGroup.js";
7
+ import type { PanelResizeHandleOnDragging, PanelResizeHandleProps } from "./PanelResizeHandle.js";
8
+ export { ImperativePanelGroupHandle, ImperativePanelHandle, MixedSizes, PanelGroupOnLayout, PanelGroupProps, PanelGroupStorage, PanelOnCollapse, PanelOnExpand, PanelOnResize, PanelProps, PanelResizeHandleOnDragging, PanelResizeHandleProps, Panel, PanelGroup, PanelResizeHandle, };
@@ -1,29 +1,7 @@
1
- import { RefObject } from "./vendor/react.js";
2
1
  export type Direction = "horizontal" | "vertical";
3
- export type PanelGroupStorage = {
4
- getItem(name: string): string | null;
5
- setItem(name: string, value: string): void;
6
- };
7
- export type PanelGroupOnLayout = (sizes: number[]) => void;
8
- export type PanelOnCollapse = (collapsed: boolean) => void;
9
- export type PanelOnResize = (size: number, prevSize: number) => void;
10
- export type PanelResizeHandleOnDragging = (isDragging: boolean) => void;
11
- export type PanelCallbackRef = RefObject<{
12
- onCollapse: PanelOnCollapse | null;
13
- onResize: PanelOnResize | null;
14
- }>;
15
- export type PanelData = {
16
- current: {
17
- callbacksRef: PanelCallbackRef;
18
- collapsedSize: number;
19
- collapsible: boolean;
20
- defaultSize: number | null;
21
- id: string;
22
- idWasAutoGenerated: boolean;
23
- maxSize: number;
24
- minSize: number;
25
- order: number | null;
26
- };
2
+ export type MixedSizes = {
3
+ sizePercentage: number;
4
+ sizePixels: number;
27
5
  };
28
6
  export type ResizeEvent = KeyboardEvent | MouseEvent | TouchEvent;
29
7
  export type ResizeHandler = (event: ResizeEvent) => void;
@@ -1,6 +1,6 @@
1
1
  import * as React from "react";
2
- import type { CSSProperties, ElementType, ForwardedRef, MouseEvent, ReactNode, RefObject, TouchEvent } from "react";
3
- declare const createElement: typeof React.createElement, createContext: typeof React.createContext, forwardRef: typeof React.forwardRef, useCallback: typeof React.useCallback, useContext: typeof React.useContext, useEffect: typeof React.useEffect, useImperativeHandle: typeof React.useImperativeHandle, useLayoutEffect: typeof React.useLayoutEffect, useMemo: typeof React.useMemo, useRef: typeof React.useRef, useState: typeof React.useState;
2
+ import type { CSSProperties, ElementType, ForwardedRef, MouseEvent, PropsWithChildren, ReactNode, RefObject, TouchEvent } from "react";
3
+ declare const createElement: typeof React.createElement, createContext: typeof React.createContext, createRef: typeof React.createRef, forwardRef: typeof React.forwardRef, useCallback: typeof React.useCallback, useContext: typeof React.useContext, useEffect: typeof React.useEffect, useImperativeHandle: typeof React.useImperativeHandle, useLayoutEffect: typeof React.useLayoutEffect, useMemo: typeof React.useMemo, useRef: typeof React.useRef, useState: typeof React.useState;
4
4
  declare const useId: () => string;
5
- export { createElement, createContext, forwardRef, useCallback, useContext, useEffect, useId, useImperativeHandle, useLayoutEffect, useMemo, useRef, useState, };
6
- export type { CSSProperties, ElementType, ForwardedRef, MouseEvent, ReactNode, RefObject, TouchEvent, };
5
+ export { createElement, createContext, createRef, forwardRef, useCallback, useContext, useEffect, useId, useImperativeHandle, useLayoutEffect, useMemo, useRef, useState, };
6
+ export type { CSSProperties, ElementType, ForwardedRef, MouseEvent, PropsWithChildren, ReactNode, RefObject, TouchEvent, };