@gfazioli/mantine-split-pane 1.1.7 → 2.0.0
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/dist/cjs/Pane/SplitPane.cjs +108 -91
- package/dist/cjs/Pane/SplitPane.cjs.map +1 -1
- package/dist/cjs/Resizer/SplitPaneResizer.cjs +260 -91
- package/dist/cjs/Resizer/SplitPaneResizer.cjs.map +1 -1
- package/dist/cjs/Split.cjs +30 -16
- package/dist/cjs/Split.cjs.map +1 -1
- package/dist/cjs/Split.context.cjs +1 -4
- package/dist/cjs/Split.context.cjs.map +1 -1
- package/dist/cjs/index.cjs +2 -6
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/esm/Pane/SplitPane.mjs +109 -92
- package/dist/esm/Pane/SplitPane.mjs.map +1 -1
- package/dist/esm/Resizer/SplitPaneResizer.mjs +261 -93
- package/dist/esm/Resizer/SplitPaneResizer.mjs.map +1 -1
- package/dist/esm/Split.context.mjs +2 -5
- package/dist/esm/Split.context.mjs.map +1 -1
- package/dist/esm/Split.mjs +31 -17
- package/dist/esm/Split.mjs.map +1 -1
- package/dist/esm/index.mjs +1 -3
- package/dist/esm/index.mjs.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/styles.layer.css +1 -1
- package/dist/types/Pane/SplitPane.d.ts +40 -6
- package/dist/types/Resizer/SplitPaneResizer.d.ts +29 -19
- package/dist/types/Split.context.d.ts +4 -2
- package/dist/types/Split.d.ts +5 -3
- package/dist/types/index.d.mts +4 -6
- package/dist/types/index.d.ts +4 -6
- package/package.json +1 -1
- package/dist/cjs/Split.errors.cjs +0 -8
- package/dist/cjs/Split.errors.cjs.map +0 -1
- package/dist/esm/Split.errors.mjs +0 -6
- package/dist/esm/Split.errors.mjs.map +0 -1
|
@@ -1,20 +1,54 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { BoxProps, Factory, StylesApiProps } from '@mantine/core';
|
|
3
|
-
import {
|
|
3
|
+
import { SplitPaneResizerVariant } from '../Resizer/SplitPaneResizer';
|
|
4
4
|
export type SplitPaneStylesNames = 'root';
|
|
5
5
|
export type SplitPaneVariant = SplitPaneResizerVariant;
|
|
6
6
|
export type SplitPaneCssVariables = {};
|
|
7
|
-
export interface
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
export interface SplitPaneHandlers {
|
|
8
|
+
resetInitialSize?: (e: React.MouseEvent<HTMLButtonElement>) => void;
|
|
9
|
+
getMinWidth?: () => number;
|
|
10
|
+
getMinHeight?: () => number;
|
|
11
|
+
getMaxWidth?: () => number;
|
|
12
|
+
getMaxHeight?: () => number;
|
|
13
|
+
getInitialWidth?: () => number;
|
|
14
|
+
getInitialHeight?: () => number;
|
|
15
|
+
onResizeStart?: () => void;
|
|
16
|
+
onResizing?: (size: SPLIT_PANE_SIZE) => void;
|
|
17
|
+
onResizeEnd?: (size: SPLIT_PANE_SIZE) => void;
|
|
18
|
+
splitPane?: HTMLDivElement;
|
|
19
|
+
}
|
|
20
|
+
export type SPLIT_PANE_SIZE = {
|
|
21
|
+
width: number;
|
|
22
|
+
height: number;
|
|
23
|
+
};
|
|
24
|
+
export interface SplitPaneBaseProps {
|
|
10
25
|
/** Grow pane to fill available space */
|
|
11
26
|
grow?: boolean;
|
|
12
27
|
/** Initial width of the pane */
|
|
13
28
|
initialWidth?: number | string;
|
|
14
29
|
/** Initial height of the pane */
|
|
15
30
|
initialHeight?: number | string;
|
|
16
|
-
/**
|
|
17
|
-
|
|
31
|
+
/** The minimum width of the pane when orientation is vertical */
|
|
32
|
+
minWidth?: number | string;
|
|
33
|
+
/** The minimum height of the pane when orientation is horizontal */
|
|
34
|
+
minHeight?: number | string;
|
|
35
|
+
/** The maximum width of the pane when orientation is vertical */
|
|
36
|
+
maxWidth?: number | string;
|
|
37
|
+
/** The maximum height of the pane when orientation is horizontal */
|
|
38
|
+
maxHeight?: number | string;
|
|
39
|
+
/** Event called when pane size starts changing */
|
|
40
|
+
onResizeStart?: () => void;
|
|
41
|
+
/** Event called when pane size changes */
|
|
42
|
+
onResizing?: (size: SPLIT_PANE_SIZE) => void;
|
|
43
|
+
/** Event called when pane size changes */
|
|
44
|
+
onResizeEnd?: (size: SPLIT_PANE_SIZE) => void;
|
|
45
|
+
/** Event called to reset initial size */
|
|
46
|
+
onResetInitialSize?: (e: React.MouseEvent<HTMLButtonElement>) => void;
|
|
47
|
+
}
|
|
48
|
+
export interface SplitPaneProps extends BoxProps, SplitPaneBaseProps, StylesApiProps<SplitPaneFactory> {
|
|
49
|
+
/** Split pane content */
|
|
50
|
+
children: React.ReactNode;
|
|
51
|
+
ref?: React.RefObject<HTMLDivElement & SplitPaneHandlers>;
|
|
18
52
|
}
|
|
19
53
|
export type SplitPaneFactory = Factory<{
|
|
20
54
|
props: SplitPaneProps;
|
|
@@ -1,13 +1,16 @@
|
|
|
1
|
-
import React, { CSSProperties
|
|
2
|
-
import { BoxProps, Factory, MantineColor, MantineRadius, MantineSize, MantineSpacing, StylesApiProps } from '@mantine/core';
|
|
1
|
+
import React, { CSSProperties } from 'react';
|
|
2
|
+
import { BoxProps, Factory, MantineColor, MantineRadius, MantineSize, MantineSpacing, StyleProp, StylesApiProps } from '@mantine/core';
|
|
3
|
+
import { SplitPaneHandlers } from '../Pane/SplitPane';
|
|
3
4
|
export type SplitPaneResizerStylesNames = 'root';
|
|
4
5
|
export type SplitPaneResizerVariant = 'default' | 'filled' | 'outline' | 'transparent' | 'dotted' | 'dashed';
|
|
5
6
|
export type SplitPaneResizerCssVariables = {
|
|
6
7
|
root: '--split-resizer-size' | '--split-resizer-color' | '--split-resizer-color-light' | '--split-resizer-color-dark' | '--split-resizer-hover-color-light' | '--split-resizer-hover-color-dark' | '--split-resizer-radius' | '--split-resizer-knob-size' | '--split-resizer-knob-opacity' | '--split-resizer-knob-radius' | '--split-resizer-knob-color' | '--split-resizer-knob-hover-color' | '--split-resizer-spacing' | '--split-resizer-cursor-vertical' | '--split-resizer-cursor-horizontal';
|
|
7
8
|
};
|
|
8
|
-
export interface
|
|
9
|
+
export interface SplitPaneResizerContextProps {
|
|
9
10
|
/** Split orientation, `'vertical'` by default */
|
|
10
11
|
orientation?: 'horizontal' | 'vertical';
|
|
12
|
+
/** Resizer opacity */
|
|
13
|
+
opacity?: StyleProp<React.CSSProperties['opacity']>;
|
|
11
14
|
/** Resizer size */
|
|
12
15
|
size?: MantineSize | number | (string & {});
|
|
13
16
|
/** Resizer radius */
|
|
@@ -41,31 +44,37 @@ export interface SplitPaneResizerSharedProps {
|
|
|
41
44
|
/** The CSS cursor property for horizontal orientation */
|
|
42
45
|
cursorHorizontal?: CSSProperties['cursor'];
|
|
43
46
|
}
|
|
44
|
-
export type
|
|
45
|
-
|
|
46
|
-
|
|
47
|
+
export type SPLIT_PANE_RESIZE_SIZES = {
|
|
48
|
+
beforePane: {
|
|
49
|
+
width: number;
|
|
50
|
+
height: number;
|
|
51
|
+
};
|
|
52
|
+
afterPane: {
|
|
53
|
+
width: number;
|
|
54
|
+
height: number;
|
|
55
|
+
};
|
|
47
56
|
};
|
|
48
|
-
export interface SplitPaneResizerBaseProps extends
|
|
49
|
-
/** The minimum width of the pane when orientation is vertical */
|
|
50
|
-
minWidth?: number;
|
|
51
|
-
/** The minimum height of the pane when orientation is horizontal */
|
|
52
|
-
minHeight?: number;
|
|
53
|
-
/** The maximum width of the pane when orientation is vertical */
|
|
54
|
-
maxWidth?: number;
|
|
55
|
-
/** The maximum height of the pane when orientation is horizontal */
|
|
56
|
-
maxHeight?: number;
|
|
57
|
+
export interface SplitPaneResizerBaseProps extends SplitPaneResizerContextProps {
|
|
57
58
|
/** Event called when resizer is double clicked */
|
|
58
59
|
onDoubleClick?: (event: React.MouseEvent<HTMLButtonElement>) => void;
|
|
59
60
|
/** Event called when pane size starts changing */
|
|
60
61
|
onResizeStart?: () => void;
|
|
61
62
|
/** Event called when pane size changes */
|
|
62
|
-
onResizing?: (
|
|
63
|
+
onResizing?: (sizes: SPLIT_PANE_RESIZE_SIZES) => void;
|
|
63
64
|
/** Event called when pane size changes */
|
|
64
|
-
onResizeEnd?: (
|
|
65
|
-
/** The pane ref */
|
|
66
|
-
paneRef: MutableRefObject<HTMLDivElement | null>;
|
|
65
|
+
onResizeEnd?: (sizes: SPLIT_PANE_RESIZE_SIZES) => void;
|
|
67
66
|
}
|
|
68
67
|
export interface SplitPaneResizerProps extends BoxProps, SplitPaneResizerBaseProps, StylesApiProps<SplitPaneResizerFactory> {
|
|
68
|
+
/**
|
|
69
|
+
* The before (left | up) componentRef
|
|
70
|
+
* @access private
|
|
71
|
+
* */
|
|
72
|
+
__beforeRef?: React.RefObject<HTMLDivElement & SplitPaneHandlers>;
|
|
73
|
+
/**
|
|
74
|
+
* The after (right | down) componentRef
|
|
75
|
+
* @access private
|
|
76
|
+
* */
|
|
77
|
+
__afterRef?: React.RefObject<HTMLDivElement & SplitPaneHandlers>;
|
|
69
78
|
}
|
|
70
79
|
export type SplitPaneResizerFactory = Factory<{
|
|
71
80
|
props: SplitPaneResizerProps;
|
|
@@ -74,6 +83,7 @@ export type SplitPaneResizerFactory = Factory<{
|
|
|
74
83
|
vars: SplitPaneResizerCssVariables;
|
|
75
84
|
variant: SplitPaneResizerVariant;
|
|
76
85
|
}>;
|
|
86
|
+
export declare const defaultProps: Partial<SplitPaneResizerContextProps>;
|
|
77
87
|
export declare const SplitPaneResizer: import("@mantine/core").MantineComponent<{
|
|
78
88
|
props: SplitPaneResizerProps;
|
|
79
89
|
ref: HTMLButtonElement;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { MantineSpacing } from '@mantine/core';
|
|
2
|
-
import {
|
|
3
|
-
interface SplitContext extends
|
|
2
|
+
import { SplitPaneResizerContextProps, SplitPaneResizerVariant } from './Resizer/SplitPaneResizer';
|
|
3
|
+
interface SplitContext extends SplitPaneResizerContextProps {
|
|
4
|
+
/** Resizer Variant */
|
|
5
|
+
variant?: SplitPaneResizerVariant;
|
|
4
6
|
/** Spacing between resizer and pane */
|
|
5
7
|
spacing?: MantineSpacing;
|
|
6
8
|
}
|
package/dist/types/Split.d.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { BoxProps, Factory, StylesApiProps } from '@mantine/core';
|
|
3
3
|
import { SplitPane } from './Pane/SplitPane';
|
|
4
|
-
import {
|
|
4
|
+
import { SplitPaneResizer, type SplitPaneResizerContextProps, type SplitPaneResizerVariant } from './Resizer/SplitPaneResizer';
|
|
5
5
|
export type SplitStylesNames = 'root';
|
|
6
6
|
export type SplitVariant = SplitPaneResizerVariant;
|
|
7
7
|
export type SplitCssVariables = {
|
|
8
8
|
root: '--split-inline';
|
|
9
9
|
};
|
|
10
|
-
export interface SplitBaseProps extends
|
|
10
|
+
export interface SplitBaseProps extends SplitPaneResizerContextProps {
|
|
11
11
|
/** Make main split container inline */
|
|
12
12
|
inline?: boolean;
|
|
13
13
|
/** Split children */
|
|
14
|
-
children
|
|
14
|
+
children: React.ReactNode;
|
|
15
15
|
}
|
|
16
16
|
export interface SplitProps extends BoxProps, SplitBaseProps, StylesApiProps<SplitFactory> {
|
|
17
17
|
}
|
|
@@ -24,6 +24,7 @@ export type SplitFactory = Factory<{
|
|
|
24
24
|
variant: SplitVariant;
|
|
25
25
|
staticComponents: {
|
|
26
26
|
Pane: typeof SplitPane;
|
|
27
|
+
Resizer: typeof SplitPaneResizer;
|
|
27
28
|
};
|
|
28
29
|
}>;
|
|
29
30
|
export declare const Split: import("@mantine/core").MantineComponent<{
|
|
@@ -35,5 +36,6 @@ export declare const Split: import("@mantine/core").MantineComponent<{
|
|
|
35
36
|
variant: SplitVariant;
|
|
36
37
|
staticComponents: {
|
|
37
38
|
Pane: typeof SplitPane;
|
|
39
|
+
Resizer: typeof SplitPaneResizer;
|
|
38
40
|
};
|
|
39
41
|
}>;
|
package/dist/types/index.d.mts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
export { SplitPane } from './Pane';
|
|
2
|
-
export type { SplitPaneFactory, SplitPaneProps } from './Pane/SplitPane';
|
|
3
|
-
export { SplitPaneResizer } from './Resizer';
|
|
4
|
-
export type { SplitPaneResizerFactory, SplitPaneResizerProps } from './Resizer/SplitPaneResizer';
|
|
5
|
-
export { Split } from './Split';
|
|
6
|
-
export type { SplitBaseProps, SplitCssVariables, SplitFactory } from './Split';
|
|
7
1
|
export { useSplitContext } from './Split.context';
|
|
2
|
+
export { Split } from './Split';
|
|
3
|
+
export type { SplitCssVariables, SplitFactory, SplitProps } from './Split';
|
|
4
|
+
export type { SPLIT_PANE_SIZE, SplitPaneFactory, SplitPaneProps } from './Pane/SplitPane';
|
|
5
|
+
export type { SPLIT_PANE_RESIZE_SIZES, SplitPaneResizerFactory, SplitPaneResizerProps, } from './Resizer/SplitPaneResizer';
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
export { SplitPane } from './Pane';
|
|
2
|
-
export type { SplitPaneFactory, SplitPaneProps } from './Pane/SplitPane';
|
|
3
|
-
export { SplitPaneResizer } from './Resizer';
|
|
4
|
-
export type { SplitPaneResizerFactory, SplitPaneResizerProps } from './Resizer/SplitPaneResizer';
|
|
5
|
-
export { Split } from './Split';
|
|
6
|
-
export type { SplitBaseProps, SplitCssVariables, SplitFactory } from './Split';
|
|
7
1
|
export { useSplitContext } from './Split.context';
|
|
2
|
+
export { Split } from './Split';
|
|
3
|
+
export type { SplitCssVariables, SplitFactory, SplitProps } from './Split';
|
|
4
|
+
export type { SPLIT_PANE_SIZE, SplitPaneFactory, SplitPaneProps } from './Pane/SplitPane';
|
|
5
|
+
export type { SPLIT_PANE_RESIZE_SIZES, SplitPaneResizerFactory, SplitPaneResizerProps, } from './Resizer/SplitPaneResizer';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gfazioli/mantine-split-pane",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "A React component that manages split panes allows users to divide and resize content areas within a layout efficiently.",
|
|
5
5
|
"homepage": "https://gfazioli.github.io/mantine-split-pane/",
|
|
6
6
|
"packageManager": "yarn@4.0.1",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Split.errors.cjs","sources":["../../src/Split.errors.ts"],"sourcesContent":["export const SPLIT_ERRORS = {\n context: 'Split component was not found in the tree',\n children:\n 'Split.Pane component children should be an element or a component that accepts ref, fragments, strings, numbers and other primitive values are not supported',\n};\n"],"names":[],"mappings":";;;AAAY,CAAA,CAAA,CAAA,CAAA,CAAA,CAAC,YAAY,CAAG,CAAA,CAAA,CAAA;AAC5B,CAAE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAO,EAAE,CAEX,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Split.errors.mjs","sources":["../../src/Split.errors.ts"],"sourcesContent":["export const SPLIT_ERRORS = {\n context: 'Split component was not found in the tree',\n children:\n 'Split.Pane component children should be an element or a component that accepts ref, fragments, strings, numbers and other primitive values are not supported',\n};\n"],"names":[],"mappings":";AAAY,CAAA,CAAA,CAAA,CAAA,CAAA,CAAC,YAAY,CAAG,CAAA,CAAA,CAAA;AAC5B,CAAE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAO,EAAE,CAEX,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;;"}
|