@elliemae/ds-resizeable-container 2.0.0-next.9 → 2.0.0-rc.12
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/cjs/Resizable.js +28 -11
- package/esm/Resizable.js +28 -11
- package/package.json +8 -5
- package/types/Resizable.d.ts +43 -6
- package/types/props.d.ts +31 -5
package/cjs/Resizable.js
CHANGED
|
@@ -5,7 +5,16 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var _jsx2 = require('@babel/runtime/helpers/jsx');
|
|
6
6
|
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
7
7
|
var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
|
|
8
|
+
require('core-js/modules/esnext.async-iterator.map.js');
|
|
9
|
+
require('core-js/modules/esnext.iterator.map.js');
|
|
8
10
|
require('core-js/modules/web.dom-collections.iterator.js');
|
|
11
|
+
require('core-js/modules/esnext.async-iterator.every.js');
|
|
12
|
+
require('core-js/modules/esnext.iterator.constructor.js');
|
|
13
|
+
require('core-js/modules/esnext.iterator.every.js');
|
|
14
|
+
require('core-js/modules/esnext.async-iterator.filter.js');
|
|
15
|
+
require('core-js/modules/esnext.iterator.filter.js');
|
|
16
|
+
require('core-js/modules/esnext.async-iterator.for-each.js');
|
|
17
|
+
require('core-js/modules/esnext.iterator.for-each.js');
|
|
9
18
|
var React = require('react');
|
|
10
19
|
var reactDesc = require('react-desc');
|
|
11
20
|
var styled = require('styled-components');
|
|
@@ -106,11 +115,14 @@ const ResizableItem = /*#__PURE__*/styled__default["default"](ResizableItemCompo
|
|
|
106
115
|
})(["position:relative;"]);
|
|
107
116
|
const ResizableBar = /*#__PURE__*/styled__default["default"].div.withConfig({
|
|
108
117
|
componentId: "sc-forwbw-2"
|
|
109
|
-
})(["position:absolute;cursor:", ";", ""],
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
118
|
+
})(["position:absolute;cursor:", ";", ""], _ref2 => {
|
|
119
|
+
let {
|
|
120
|
+
container,
|
|
121
|
+
nextContainer,
|
|
122
|
+
v
|
|
123
|
+
} = _ref2;
|
|
124
|
+
return cursorResolver(nextContainer, container, v);
|
|
125
|
+
}, props => {
|
|
114
126
|
if (props.v) {
|
|
115
127
|
return "\n bottom: calc(".concat(dsSystem.mapGap(props.gutter), " * -0.5);\n left: 0;\n width: 100%;\n height: 10px;\n margin-bottom: -5px;\n display: flex;\n flex-direction: column;\n justify-content:space-around;\n align-items: center;\n &:after{\n width: 100%;\n height: 1px;\n display: block;\n background: ").concat(props.theme.colors.neutral['300'], ";\n content: '';\n }\n &:hover{\n &:after{\n background: ").concat(props.theme.colors.brand['600'], ";\n } \n }\n ");
|
|
116
128
|
}
|
|
@@ -122,15 +134,15 @@ const getWidths = list => list.map(l => l.clientWidth);
|
|
|
122
134
|
|
|
123
135
|
const getHeights = list => list.map(l => l.clientHeight);
|
|
124
136
|
|
|
125
|
-
function ResizableContainer(
|
|
137
|
+
function ResizableContainer(_ref3) {
|
|
126
138
|
let {
|
|
127
139
|
children,
|
|
128
140
|
cols,
|
|
129
141
|
rows,
|
|
130
142
|
vertical,
|
|
131
143
|
horizontal
|
|
132
|
-
} =
|
|
133
|
-
rest = _objectWithoutProperties__default["default"](
|
|
144
|
+
} = _ref3,
|
|
145
|
+
rest = _objectWithoutProperties__default["default"](_ref3, _excluded2);
|
|
134
146
|
|
|
135
147
|
const refs = React.useRef([]);
|
|
136
148
|
const [containers, setContainers] = React.useState(cols);
|
|
@@ -147,7 +159,9 @@ function ResizableContainer(_ref2) {
|
|
|
147
159
|
refs.current.push(node);
|
|
148
160
|
};
|
|
149
161
|
|
|
150
|
-
const resizePanels = (
|
|
162
|
+
const resizePanels = function () {
|
|
163
|
+
let diff = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
|
|
164
|
+
let v = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
151
165
|
const index = parseInt(start.index, 10);
|
|
152
166
|
|
|
153
167
|
if (!v) {
|
|
@@ -177,7 +191,9 @@ function ResizableContainer(_ref2) {
|
|
|
177
191
|
}
|
|
178
192
|
};
|
|
179
193
|
|
|
180
|
-
const startResize = (event, index
|
|
194
|
+
const startResize = function (event, index) {
|
|
195
|
+
let v = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
196
|
+
let type = arguments.length > 3 ? arguments[3] : undefined;
|
|
181
197
|
setDragging(type);
|
|
182
198
|
setStartPoint({
|
|
183
199
|
x: event.clientX,
|
|
@@ -218,7 +234,8 @@ function ResizableContainer(_ref2) {
|
|
|
218
234
|
}
|
|
219
235
|
};
|
|
220
236
|
|
|
221
|
-
const handleKeyDown = (e, index
|
|
237
|
+
const handleKeyDown = function (e, index) {
|
|
238
|
+
let v = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
222
239
|
const keyCodes = {
|
|
223
240
|
37: DIRECTION.L,
|
|
224
241
|
Left: DIRECTION.L,
|
package/esm/Resizable.js
CHANGED
|
@@ -1,7 +1,16 @@
|
|
|
1
|
+
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
2
|
+
import 'core-js/modules/esnext.iterator.filter.js';
|
|
3
|
+
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
4
|
+
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
1
5
|
import _jsx2 from '@babel/runtime/helpers/esm/jsx';
|
|
2
6
|
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
3
7
|
import _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';
|
|
8
|
+
import 'core-js/modules/esnext.async-iterator.map.js';
|
|
9
|
+
import 'core-js/modules/esnext.iterator.map.js';
|
|
4
10
|
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
11
|
+
import 'core-js/modules/esnext.async-iterator.every.js';
|
|
12
|
+
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
13
|
+
import 'core-js/modules/esnext.iterator.every.js';
|
|
5
14
|
import React, { useRef, useState, useEffect } from 'react';
|
|
6
15
|
import { describe } from 'react-desc';
|
|
7
16
|
import styled from 'styled-components';
|
|
@@ -94,11 +103,14 @@ const ResizableItem = /*#__PURE__*/styled(ResizableItemComponent).withConfig({
|
|
|
94
103
|
})(["position:relative;"]);
|
|
95
104
|
const ResizableBar = /*#__PURE__*/styled.div.withConfig({
|
|
96
105
|
componentId: "sc-forwbw-2"
|
|
97
|
-
})(["position:absolute;cursor:", ";", ""],
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
106
|
+
})(["position:absolute;cursor:", ";", ""], _ref2 => {
|
|
107
|
+
let {
|
|
108
|
+
container,
|
|
109
|
+
nextContainer,
|
|
110
|
+
v
|
|
111
|
+
} = _ref2;
|
|
112
|
+
return cursorResolver(nextContainer, container, v);
|
|
113
|
+
}, props => {
|
|
102
114
|
if (props.v) {
|
|
103
115
|
return "\n bottom: calc(".concat(mapGap(props.gutter), " * -0.5);\n left: 0;\n width: 100%;\n height: 10px;\n margin-bottom: -5px;\n display: flex;\n flex-direction: column;\n justify-content:space-around;\n align-items: center;\n &:after{\n width: 100%;\n height: 1px;\n display: block;\n background: ").concat(props.theme.colors.neutral['300'], ";\n content: '';\n }\n &:hover{\n &:after{\n background: ").concat(props.theme.colors.brand['600'], ";\n } \n }\n ");
|
|
104
116
|
}
|
|
@@ -110,15 +122,15 @@ const getWidths = list => list.map(l => l.clientWidth);
|
|
|
110
122
|
|
|
111
123
|
const getHeights = list => list.map(l => l.clientHeight);
|
|
112
124
|
|
|
113
|
-
function ResizableContainer(
|
|
125
|
+
function ResizableContainer(_ref3) {
|
|
114
126
|
let {
|
|
115
127
|
children,
|
|
116
128
|
cols,
|
|
117
129
|
rows,
|
|
118
130
|
vertical,
|
|
119
131
|
horizontal
|
|
120
|
-
} =
|
|
121
|
-
rest = _objectWithoutProperties(
|
|
132
|
+
} = _ref3,
|
|
133
|
+
rest = _objectWithoutProperties(_ref3, _excluded2);
|
|
122
134
|
|
|
123
135
|
const refs = useRef([]);
|
|
124
136
|
const [containers, setContainers] = useState(cols);
|
|
@@ -135,7 +147,9 @@ function ResizableContainer(_ref2) {
|
|
|
135
147
|
refs.current.push(node);
|
|
136
148
|
};
|
|
137
149
|
|
|
138
|
-
const resizePanels = (
|
|
150
|
+
const resizePanels = function () {
|
|
151
|
+
let diff = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
|
|
152
|
+
let v = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
139
153
|
const index = parseInt(start.index, 10);
|
|
140
154
|
|
|
141
155
|
if (!v) {
|
|
@@ -165,7 +179,9 @@ function ResizableContainer(_ref2) {
|
|
|
165
179
|
}
|
|
166
180
|
};
|
|
167
181
|
|
|
168
|
-
const startResize = (event, index
|
|
182
|
+
const startResize = function (event, index) {
|
|
183
|
+
let v = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
184
|
+
let type = arguments.length > 3 ? arguments[3] : undefined;
|
|
169
185
|
setDragging(type);
|
|
170
186
|
setStartPoint({
|
|
171
187
|
x: event.clientX,
|
|
@@ -206,7 +222,8 @@ function ResizableContainer(_ref2) {
|
|
|
206
222
|
}
|
|
207
223
|
};
|
|
208
224
|
|
|
209
|
-
const handleKeyDown = (e, index
|
|
225
|
+
const handleKeyDown = function (e, index) {
|
|
226
|
+
let v = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
210
227
|
const keyCodes = {
|
|
211
228
|
37: DIRECTION.L,
|
|
212
229
|
Left: DIRECTION.L,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliemae/ds-resizeable-container",
|
|
3
|
-
"version": "2.0.0-
|
|
3
|
+
"version": "2.0.0-rc.12",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "ICE MT - Dimsum - Resizeable Container",
|
|
6
6
|
"module": "./esm/index.js",
|
|
@@ -44,17 +44,20 @@
|
|
|
44
44
|
"build": "node ../../scripts/build/build.js"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@elliemae/ds-grid": "2.0.0-
|
|
48
|
-
"@elliemae/ds-system": "2.0.0-
|
|
47
|
+
"@elliemae/ds-grid": "2.0.0-rc.12",
|
|
48
|
+
"@elliemae/ds-system": "2.0.0-rc.12",
|
|
49
49
|
"react-desc": "~4.1.3"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
|
-
"
|
|
52
|
+
"@testing-library/jest-dom": "~5.15.0",
|
|
53
|
+
"@testing-library/react": "~12.1.2",
|
|
54
|
+
"@testing-library/user-event": "~13.5.0",
|
|
55
|
+
"styled-components": "~5.3.3"
|
|
53
56
|
},
|
|
54
57
|
"peerDependencies": {
|
|
55
58
|
"react": "^17.0.2",
|
|
56
59
|
"react-dom": "^17.0.2",
|
|
57
|
-
"styled-components": "^5.3.
|
|
60
|
+
"styled-components": "^5.3.3"
|
|
58
61
|
},
|
|
59
62
|
"publishConfig": {
|
|
60
63
|
"access": "public",
|
package/types/Resizable.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference path="../../../../shared/typings/react-desc.d.ts" />
|
|
1
2
|
/// <reference types="react" />
|
|
2
3
|
declare function ResizableContainer({ children, cols, rows, vertical, horizontal, ...rest }: {
|
|
3
4
|
[x: string]: any;
|
|
@@ -9,17 +10,53 @@ declare function ResizableContainer({ children, cols, rows, vertical, horizontal
|
|
|
9
10
|
}): JSX.Element;
|
|
10
11
|
declare namespace ResizableContainer {
|
|
11
12
|
var propTypes: {
|
|
12
|
-
children:
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
children: {
|
|
14
|
+
defaultValue<T = unknown>(arg: T): {
|
|
15
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
16
|
+
};
|
|
17
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
18
|
+
};
|
|
19
|
+
vertical: {
|
|
20
|
+
defaultValue<T = unknown>(arg: T): {
|
|
21
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
22
|
+
};
|
|
23
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
24
|
+
};
|
|
25
|
+
horizontal: {
|
|
26
|
+
defaultValue<T = unknown>(arg: T): {
|
|
27
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
28
|
+
};
|
|
29
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
30
|
+
};
|
|
31
|
+
rows: {
|
|
32
|
+
defaultValue<T = unknown>(arg: T): {
|
|
33
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
34
|
+
};
|
|
35
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
36
|
+
};
|
|
37
|
+
cols: {
|
|
38
|
+
defaultValue<T = unknown>(arg: T): {
|
|
39
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
40
|
+
};
|
|
41
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
42
|
+
};
|
|
17
43
|
};
|
|
18
44
|
var defaultProps: {
|
|
19
45
|
vertical: boolean;
|
|
20
46
|
horizontal: boolean;
|
|
21
47
|
};
|
|
22
48
|
}
|
|
23
|
-
declare const DSResizableContainerWithSchema:
|
|
49
|
+
declare const DSResizableContainerWithSchema: {
|
|
50
|
+
(props?: {
|
|
51
|
+
[x: string]: any;
|
|
52
|
+
children: any;
|
|
53
|
+
cols: any;
|
|
54
|
+
rows: any;
|
|
55
|
+
vertical: any;
|
|
56
|
+
horizontal: any;
|
|
57
|
+
} | undefined): JSX.Element;
|
|
58
|
+
propTypes: unknown;
|
|
59
|
+
toTypescript: () => import("react-desc").TypescriptSchema;
|
|
60
|
+
};
|
|
24
61
|
export { ResizableContainer, DSResizableContainerWithSchema };
|
|
25
62
|
export default ResizableContainer;
|
package/types/props.d.ts
CHANGED
|
@@ -1,12 +1,38 @@
|
|
|
1
|
+
/// <reference path="../../../../shared/typings/react-desc.d.ts" />
|
|
1
2
|
export declare const props: {
|
|
2
3
|
/** grid item content */
|
|
3
|
-
children:
|
|
4
|
+
children: {
|
|
5
|
+
defaultValue<T = unknown>(arg: T): {
|
|
6
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
7
|
+
};
|
|
8
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
9
|
+
};
|
|
4
10
|
/** vertical resizing */
|
|
5
|
-
vertical:
|
|
11
|
+
vertical: {
|
|
12
|
+
defaultValue<T = unknown>(arg: T): {
|
|
13
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
14
|
+
};
|
|
15
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
16
|
+
};
|
|
6
17
|
/** horizontal resizing */
|
|
7
|
-
horizontal:
|
|
18
|
+
horizontal: {
|
|
19
|
+
defaultValue<T = unknown>(arg: T): {
|
|
20
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
21
|
+
};
|
|
22
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
23
|
+
};
|
|
8
24
|
/** Row layout cells */
|
|
9
|
-
rows:
|
|
25
|
+
rows: {
|
|
26
|
+
defaultValue<T = unknown>(arg: T): {
|
|
27
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
28
|
+
};
|
|
29
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
30
|
+
};
|
|
10
31
|
/** Column layout cells */
|
|
11
|
-
cols:
|
|
32
|
+
cols: {
|
|
33
|
+
defaultValue<T = unknown>(arg: T): {
|
|
34
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
35
|
+
};
|
|
36
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
37
|
+
};
|
|
12
38
|
};
|