@synerise/ds-panels-resizer 1.0.35 → 1.0.37

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/CHANGELOG.md CHANGED
@@ -3,6 +3,14 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [1.0.37](https://github.com/Synerise/synerise-design/compare/@synerise/ds-panels-resizer@1.0.36...@synerise/ds-panels-resizer@1.0.37) (2026-03-24)
7
+
8
+ **Note:** Version bump only for package @synerise/ds-panels-resizer
9
+
10
+ ## [1.0.36](https://github.com/Synerise/synerise-design/compare/@synerise/ds-panels-resizer@1.0.35...@synerise/ds-panels-resizer@1.0.36) (2026-03-20)
11
+
12
+ **Note:** Version bump only for package @synerise/ds-panels-resizer
13
+
6
14
  ## [1.0.35](https://github.com/Synerise/synerise-design/compare/@synerise/ds-panels-resizer@1.0.34...@synerise/ds-panels-resizer@1.0.35) (2026-02-26)
7
15
 
8
16
  ### Bug Fixes
package/README.md CHANGED
@@ -3,9 +3,9 @@ id: panels-resizer
3
3
  title: PanelResizer
4
4
  ---
5
5
 
6
- The `PanelsResizer` component allows you to create a layout with resizable left and right panels, separated by a draggable resizer.
6
+ The `PanelsResizer` component allows you to create a layout with two resizable panels separated by a draggable resizer. Panels can be arranged side-by-side (default) or stacked top-and-bottom via the `isHorizontal` prop.
7
7
 
8
- Users can adjust the width of the panels by dragging the resizer, providing a flexible and customizable interface.
8
+ Users can adjust the size of the panels by dragging the resizer, providing a flexible and customizable interface.
9
9
 
10
10
  ## Installation
11
11
 
@@ -37,9 +37,10 @@ const App = () => (
37
37
 
38
38
  ## API
39
39
 
40
- | Property | Description | Type | Default |
41
- | ---------- | ---------------------------------------------------------------------------------- | ----------------------------------------------- | ------- |
42
- | leftPanel | The content to display in the left panel. | React.ReactNode | --- |
43
- | rightPanel | The content to display in the right panel. | React.ReactNode | --- |
44
- | initial | Initial widths of the panels. Can specify leftPanel or rightPanel width in pixels. | { leftPanel: number } \| { rightPanel: number } | --- |
45
- | scrollable | Whether the panels should be scrollable when their content overflows. | boolean | false |
40
+ | Property | Description | Type | Default |
41
+ | ------------ | ---------------------------------------------------------------------------------------------------------------- | ----------------------------------------------- | ------- |
42
+ | leftPanel | The content to display in the left (or top, when `isHorizontal`) panel. | React.ReactNode | --- |
43
+ | rightPanel | The content to display in the right (or bottom, when `isHorizontal`) panel. | React.ReactNode | --- |
44
+ | initial | Initial size of one panel in pixels. Converted to an offset from 50% at mount time. | { leftPanel: number } \| { rightPanel: number } | --- |
45
+ | scrollable | Whether the panels should be scrollable when their content overflows. | boolean | --- |
46
+ | isHorizontal | When `true`, panels are stacked top-and-bottom with a horizontal divider instead of the default side-by-side layout. | boolean | false |
@@ -1,3 +1,3 @@
1
- export declare const PanelsResizerContainer: import("styled-components").StyledComponent<"div", any, {
1
+ export declare const PanelsResizerContainer: import('styled-components').StyledComponent<"div", any, {
2
2
  isHorizontal: boolean;
3
3
  }, never>;
@@ -1,9 +1,8 @@
1
- import styled, { css } from 'styled-components';
2
- export var PanelsResizerContainer = styled.div.withConfig({
1
+ import styled, { css } from "styled-components";
2
+ const PanelsResizerContainer = /* @__PURE__ */ styled.div.withConfig({
3
3
  displayName: "PanelResizerstyles__PanelsResizerContainer",
4
4
  componentId: "sc-d1bdei-0"
5
- })(["display:flex;flex-direction:", ";", " overflow:hidden;"], function (props) {
6
- return props.isHorizontal ? 'column' : 'row';
7
- }, function (props) {
8
- return props.isHorizontal ? css(["width:-webkit-fill-available;"]) : css(["flex:1;height:-webkit-fill-available;"]);
9
- });
5
+ })(["display:flex;flex-direction:", ";", " overflow:hidden;"], (props) => props.isHorizontal ? "column" : "row", (props) => props.isHorizontal ? css(["width:-webkit-fill-available;"]) : css(["flex:1;height:-webkit-fill-available;"]));
6
+ export {
7
+ PanelsResizerContainer
8
+ };
@@ -1,5 +1,5 @@
1
- import React, { type ReactNode } from 'react';
2
- import { type InitialVectorOptions } from './utils';
1
+ import { default as React, ReactNode } from 'react';
2
+ import { InitialVectorOptions } from './utils';
3
3
  type PanelsResizerProps = {
4
4
  leftPanel: ReactNode;
5
5
  rightPanel: ReactNode;
@@ -1,85 +1,73 @@
1
- function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
2
- import React, { useCallback, useEffect, useRef, useState } from 'react';
3
- import * as S from './PanelResizer.styles';
4
- import { Resizer } from './Resizer';
5
- import { calculateLeftPanelHeight, calculateLeftPanelWidth, calculateRightPanelHeight, calculateRightPanelWidth, getInitialVector } from './utils';
6
- export var PanelsResizer = function PanelsResizer(_ref) {
7
- var leftPanel = _ref.leftPanel,
8
- rightPanel = _ref.rightPanel,
9
- initial = _ref.initial,
10
- scrollable = _ref.scrollable,
11
- _ref$isHorizontal = _ref.isHorizontal,
12
- isHorizontal = _ref$isHorizontal === void 0 ? false : _ref$isHorizontal;
13
- var containerRef = useRef(null);
14
- var _useState = useState(false),
15
- isResizing = _useState[0],
16
- setIsResizing = _useState[1];
17
- var _useState2 = useState(0),
18
- vector = _useState2[0],
19
- setVector = _useState2[1];
20
- var startClientXRef = useRef(0);
21
- useEffect(function () {
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
+ import { useRef, useState, useEffect, useCallback } from "react";
3
+ import { PanelsResizerContainer } from "./PanelResizer.styles.js";
4
+ import { Resizer } from "./Resizer/Resizer.js";
5
+ import { getInitialVector, calculateLeftPanelHeight, calculateLeftPanelWidth, calculateRightPanelHeight, calculateRightPanelWidth } from "./utils/calculatePanelsWidth.js";
6
+ const PanelsResizer = ({
7
+ leftPanel,
8
+ rightPanel,
9
+ initial,
10
+ scrollable,
11
+ isHorizontal = false
12
+ }) => {
13
+ const containerRef = useRef(null);
14
+ const [isResizing, setIsResizing] = useState(false);
15
+ const [vector, setVector] = useState(0);
16
+ const startClientXRef = useRef(0);
17
+ useEffect(() => {
22
18
  if (containerRef.current) {
23
- var containerWidth = isHorizontal ? containerRef.current.offsetHeight : containerRef.current.offsetWidth;
24
- var initialVector = getInitialVector(initial, containerWidth);
19
+ const containerWidth = isHorizontal ? containerRef.current.offsetHeight : containerRef.current.offsetWidth;
20
+ const initialVector = getInitialVector(initial, containerWidth);
25
21
  setVector(initialVector);
26
22
  }
27
- // eslint-disable-next-line react-hooks/exhaustive-deps
28
23
  }, []);
29
- var handleMouseMove = useCallback(function (event) {
24
+ const handleMouseMove = useCallback((event) => {
30
25
  if (!isResizing) {
31
26
  return;
32
27
  }
33
- var eventClientX = isHorizontal ? event.clientY : event.clientX;
34
- var deltaX = eventClientX - startClientXRef.current;
35
- setVector(function (prevVector) {
36
- return prevVector !== null ? prevVector + deltaX : deltaX;
37
- });
28
+ const eventClientX = isHorizontal ? event.clientY : event.clientX;
29
+ const deltaX = eventClientX - startClientXRef.current;
30
+ setVector((prevVector) => prevVector !== null ? prevVector + deltaX : deltaX);
38
31
  startClientXRef.current = eventClientX;
39
32
  }, [isResizing]);
40
- var handleMouseUpOrLeave = useCallback(function () {
33
+ const handleMouseUpOrLeave = useCallback(() => {
41
34
  if (!isResizing) {
42
35
  return;
43
36
  }
44
37
  setIsResizing(false);
45
38
  }, [isResizing]);
46
- var handleMouseDownOnResizer = useCallback(function (event) {
39
+ const handleMouseDownOnResizer = useCallback((event) => {
47
40
  event.preventDefault();
48
41
  setIsResizing(true);
49
42
  startClientXRef.current = isHorizontal ? event.clientY : event.clientX;
50
43
  }, []);
51
- return /*#__PURE__*/React.createElement(S.PanelsResizerContainer, {
52
- ref: containerRef,
53
- "data-testid": "panels-resizer-container",
54
- onMouseUp: handleMouseUpOrLeave,
55
- onMouseMove: handleMouseMove,
56
- onMouseLeave: handleMouseUpOrLeave,
57
- isHorizontal: isHorizontal
58
- }, /*#__PURE__*/React.createElement("div", {
59
- "data-testid": "left-panel-wrapper",
60
- style: _extends({}, isHorizontal ? {
61
- height: calculateLeftPanelHeight(vector)
62
- } : {
63
- width: calculateLeftPanelWidth(vector)
64
- }, {
65
- pointerEvents: isResizing ? 'none' : 'auto'
66
- }, scrollable ? {
67
- overflow: 'auto'
68
- } : {})
69
- }, leftPanel), /*#__PURE__*/React.createElement(Resizer, {
70
- onMouseDown: handleMouseDownOnResizer,
71
- isHorizontal: isHorizontal
72
- }), /*#__PURE__*/React.createElement("div", {
73
- "data-testid": "right-panel-wrapper",
74
- style: _extends({}, isHorizontal ? {
75
- height: calculateRightPanelHeight(vector)
76
- } : {
77
- width: calculateRightPanelWidth(vector)
78
- }, {
79
- pointerEvents: isResizing ? 'none' : 'auto',
80
- zIndex: 4
81
- }, scrollable ? {
82
- overflow: 'auto'
83
- } : {})
84
- }, rightPanel));
85
- };
44
+ return /* @__PURE__ */ jsxs(PanelsResizerContainer, { ref: containerRef, "data-testid": "panels-resizer-container", onMouseUp: handleMouseUpOrLeave, onMouseMove: handleMouseMove, onMouseLeave: handleMouseUpOrLeave, isHorizontal, children: [
45
+ /* @__PURE__ */ jsx("div", { "data-testid": "left-panel-wrapper", style: {
46
+ ...isHorizontal ? {
47
+ height: calculateLeftPanelHeight(vector)
48
+ } : {
49
+ width: calculateLeftPanelWidth(vector)
50
+ },
51
+ pointerEvents: isResizing ? "none" : "auto",
52
+ ...scrollable ? {
53
+ overflow: "auto"
54
+ } : {}
55
+ }, children: leftPanel }),
56
+ /* @__PURE__ */ jsx(Resizer, { onMouseDown: handleMouseDownOnResizer, isHorizontal }),
57
+ /* @__PURE__ */ jsx("div", { "data-testid": "right-panel-wrapper", style: {
58
+ ...isHorizontal ? {
59
+ height: calculateRightPanelHeight(vector)
60
+ } : {
61
+ width: calculateRightPanelWidth(vector)
62
+ },
63
+ pointerEvents: isResizing ? "none" : "auto",
64
+ zIndex: 4,
65
+ ...scrollable ? {
66
+ overflow: "auto"
67
+ } : {}
68
+ }, children: rightPanel })
69
+ ] });
70
+ };
71
+ export {
72
+ PanelsResizer
73
+ };
@@ -1,4 +1,4 @@
1
- import React, { type MouseEvent } from 'react';
1
+ import { default as React, MouseEvent } from 'react';
2
2
  type ResizerProps = {
3
3
  onMouseDown: (event: MouseEvent<HTMLDivElement>) => void;
4
4
  isHorizontal?: boolean;
@@ -1,18 +1,11 @@
1
- import React from 'react';
2
- import { DragHandleM } from '@synerise/ds-icon';
3
- import { Handler, HandlerIcon } from './Resizer.styles';
4
- var HANDLER_WIDTH = 16;
5
- export var Resizer = function Resizer(_ref) {
6
- var onMouseDown = _ref.onMouseDown,
7
- _ref$isHorizontal = _ref.isHorizontal,
8
- isHorizontal = _ref$isHorizontal === void 0 ? false : _ref$isHorizontal;
9
- return /*#__PURE__*/React.createElement(Handler, {
10
- "data-testid": "resizer-handler",
11
- onMouseDown: onMouseDown,
12
- isHorizontal: isHorizontal
13
- }, /*#__PURE__*/React.createElement(HandlerIcon, {
14
- component: /*#__PURE__*/React.createElement(DragHandleM, null),
15
- size: HANDLER_WIDTH,
16
- isHorizontal: isHorizontal
17
- }));
18
- };
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { DragHandleM } from "@synerise/ds-icon";
3
+ import { Handler, HandlerIcon } from "./Resizer.styles.js";
4
+ const HANDLER_WIDTH = 16;
5
+ const Resizer = ({
6
+ onMouseDown,
7
+ isHorizontal = false
8
+ }) => /* @__PURE__ */ jsx(Handler, { "data-testid": "resizer-handler", onMouseDown, isHorizontal, children: /* @__PURE__ */ jsx(HandlerIcon, { component: /* @__PURE__ */ jsx(DragHandleM, {}), size: HANDLER_WIDTH, isHorizontal }) });
9
+ export {
10
+ Resizer
11
+ };
@@ -1,5 +1,5 @@
1
- import { type StyledIcon } from '@synerise/ds-icon';
2
- export declare const Handler: import("styled-components").StyledComponent<"div", any, {
1
+ import { StyledIcon } from '@synerise/ds-icon';
2
+ export declare const Handler: import('styled-components').StyledComponent<"div", any, {
3
3
  isHorizontal: boolean;
4
4
  }, never>;
5
5
  export declare const HandlerIcon: StyledIcon<{
@@ -1,24 +1,14 @@
1
- import styled, { css } from 'styled-components';
2
- import Icon from '@synerise/ds-icon';
3
- export var Handler = styled.div.withConfig({
1
+ import styled, { css } from "styled-components";
2
+ import Icon from "@synerise/ds-icon";
3
+ const Handler = /* @__PURE__ */ styled.div.withConfig({
4
4
  displayName: "Resizerstyles__Handler",
5
5
  componentId: "sc-s3ii80-0"
6
- })(["display:flex;align-items:center;", " flex-grow:1;z-index:5;background-color:", ";&:hover{", " background-color:", ";}"], function (props) {
7
- return props.isHorizontal ? css(["width:100%;height:16px;justify-content:center;"]) : css(["height:100%;width:16px;"]);
8
- }, function (props) {
9
- return props.theme.palette['grey-200'];
10
- }, function (props) {
11
- return props.isHorizontal ? css(["cursor:ns-resize;"]) : css(["cursor:ew-resize;"]);
12
- }, function (props) {
13
- return props.theme.palette['blue-100'];
14
- });
15
- export var HandlerIcon = styled(Icon).withConfig({
6
+ })(["display:flex;align-items:center;", " flex-grow:1;z-index:5;background-color:", ";&:hover{", " background-color:", ";}"], (props) => props.isHorizontal ? css(["width:100%;height:16px;justify-content:center;"]) : css(["height:100%;width:16px;"]), (props) => props.theme.palette["grey-200"], (props) => props.isHorizontal ? css(["cursor:ns-resize;"]) : css(["cursor:ew-resize;"]), (props) => props.theme.palette["blue-100"]);
7
+ const HandlerIcon = /* @__PURE__ */ styled(Icon).withConfig({
16
8
  displayName: "Resizerstyles__HandlerIcon",
17
9
  componentId: "sc-s3ii80-1"
18
- })(["svg{fill:", ";", "}&:hover{color:", ";}"], function (props) {
19
- return props.theme.palette['grey-600'];
20
- }, function (props) {
21
- return props.isHorizontal && css(["-webkit-transform:rotate(90deg);-ms-transform:rotate(90deg);transform:rotate(90deg);"]);
22
- }, function (props) {
23
- return props.theme.palette['blue-600'];
24
- });
10
+ })(["svg{fill:", ";", "}&:hover{color:", ";}"], (props) => props.theme.palette["grey-600"], (props) => props.isHorizontal && css(["-webkit-transform:rotate(90deg);-ms-transform:rotate(90deg);transform:rotate(90deg);"]), (props) => props.theme.palette["blue-600"]);
11
+ export {
12
+ Handler,
13
+ HandlerIcon
14
+ };
@@ -1 +1,4 @@
1
- export * from './Resizer';
1
+ import { Resizer } from "./Resizer.js";
2
+ export {
3
+ Resizer
4
+ };
package/dist/index.js CHANGED
@@ -1 +1,4 @@
1
- export { PanelsResizer } from './PanelsResizer';
1
+ import { PanelsResizer } from "./PanelsResizer.js";
2
+ export {
3
+ PanelsResizer
4
+ };
package/dist/modules.d.js CHANGED
@@ -1 +1 @@
1
- import '@testing-library/jest-dom/extend-expect';
1
+ import "@testing-library/jest-dom/extend-expect";
File without changes
@@ -1,27 +1,34 @@
1
- export var getInitialVector = function getInitialVector(options, containerWidth) {
1
+ const getInitialVector = (options, containerWidth) => {
2
2
  if (!options) {
3
3
  return 0;
4
4
  }
5
- var half = containerWidth / 2;
6
- if ('leftPanel' in options) {
5
+ const half = containerWidth / 2;
6
+ if ("leftPanel" in options) {
7
7
  return options.leftPanel - half;
8
8
  }
9
- if ('rightPanel' in options) {
9
+ if ("rightPanel" in options) {
10
10
  return half - options.rightPanel;
11
11
  }
12
12
  return 0;
13
13
  };
14
- var HALF_WIDTH = '50%';
15
- export var calculateLeftPanelWidth = function calculateLeftPanelWidth(vector) {
16
- return "calc(" + HALF_WIDTH + " + " + vector + "px)";
14
+ const HALF_WIDTH = "50%";
15
+ const calculateLeftPanelWidth = (vector) => {
16
+ return `calc(${HALF_WIDTH} + ${vector}px)`;
17
17
  };
18
- export var calculateRightPanelWidth = function calculateRightPanelWidth(vector) {
19
- return "calc(" + HALF_WIDTH + " - " + vector + "px)";
18
+ const calculateRightPanelWidth = (vector) => {
19
+ return `calc(${HALF_WIDTH} - ${vector}px)`;
20
20
  };
21
- var HALF_HEIGHT = '50vh';
22
- export var calculateLeftPanelHeight = function calculateLeftPanelHeight(vector) {
23
- return "calc(" + HALF_HEIGHT + " + " + vector + "px)";
21
+ const HALF_HEIGHT = "50vh";
22
+ const calculateLeftPanelHeight = (vector) => {
23
+ return `calc(${HALF_HEIGHT} + ${vector}px)`;
24
+ };
25
+ const calculateRightPanelHeight = (vector) => {
26
+ return `calc(${HALF_HEIGHT} - ${vector}px)`;
27
+ };
28
+ export {
29
+ calculateLeftPanelHeight,
30
+ calculateLeftPanelWidth,
31
+ calculateRightPanelHeight,
32
+ calculateRightPanelWidth,
33
+ getInitialVector
24
34
  };
25
- export var calculateRightPanelHeight = function calculateRightPanelHeight(vector) {
26
- return "calc(" + HALF_HEIGHT + " - " + vector + "px)";
27
- };
@@ -1 +1,8 @@
1
- export * from './calculatePanelsWidth';
1
+ import { calculateLeftPanelHeight, calculateLeftPanelWidth, calculateRightPanelHeight, calculateRightPanelWidth, getInitialVector } from "./calculatePanelsWidth.js";
2
+ export {
3
+ calculateLeftPanelHeight,
4
+ calculateLeftPanelWidth,
5
+ calculateRightPanelHeight,
6
+ calculateRightPanelWidth,
7
+ getInitialVector
8
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synerise/ds-panels-resizer",
3
- "version": "1.0.35",
3
+ "version": "1.0.37",
4
4
  "description": "PanelResizer UI Component for the Synerise Design System",
5
5
  "license": "ISC",
6
6
  "repository": "Synerise/synerise-design",
@@ -16,10 +16,10 @@
16
16
  "access": "public"
17
17
  },
18
18
  "scripts": {
19
- "build": "pnpm run build:js && pnpm run build:css && pnpm run defs",
19
+ "build": "vite build",
20
20
  "build:css": "node ../../../scripts/style/less.js",
21
21
  "build:js": "babel --delete-dir-on-start --root-mode upward src --out-dir dist --extensions '.js,.ts,.tsx'",
22
- "build:watch": "pnpm run build:js -- --watch",
22
+ "build:watch": "vite build --watch",
23
23
  "defs": "tsc --declaration --outDir dist/ --emitDeclarationOnly",
24
24
  "pack:ci": "pnpm pack --pack-destination ../../storybook/storybook-static/static",
25
25
  "prepublish": "pnpm run build",
@@ -35,12 +35,12 @@
35
35
  ],
36
36
  "types": "dist/index.d.ts",
37
37
  "dependencies": {
38
- "@synerise/ds-icon": "^1.14.1"
38
+ "@synerise/ds-icon": "^1.15.1"
39
39
  },
40
40
  "peerDependencies": {
41
41
  "@synerise/ds-core": "*",
42
42
  "react": ">=16.9.0 <= 18.3.1",
43
43
  "styled-components": "^5.3.3"
44
44
  },
45
- "gitHead": "2faf2c7c6f163f754e51c2c5003a6c7aa448ec4d"
45
+ "gitHead": "e4ecca8944fc9b41c1b9d59c8bcad5e5e2013225"
46
46
  }