@elliemae/ds-resizeable-container 3.0.0-next.2 → 3.0.0-next.6
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/Resizable.js +348 -0
- package/dist/cjs/Resizable.js.map +7 -0
- package/dist/cjs/defaultProps.js +38 -0
- package/dist/cjs/defaultProps.js.map +7 -0
- package/dist/cjs/index.js +36 -0
- package/dist/cjs/index.js.map +7 -0
- package/dist/cjs/props.js +42 -0
- package/dist/cjs/props.js.map +7 -0
- package/dist/esm/Resizable.js +321 -0
- package/dist/esm/Resizable.js.map +7 -0
- package/dist/esm/defaultProps.js +9 -0
- package/dist/esm/defaultProps.js.map +7 -0
- package/dist/esm/index.js +7 -0
- package/dist/esm/index.js.map +7 -0
- package/dist/esm/props.js +13 -0
- package/dist/esm/props.js.map +7 -0
- package/package.json +33 -24
- package/cjs/Resizable.js +0 -323
- package/cjs/defaultProps.js +0 -10
- package/cjs/index.js +0 -11
- package/cjs/props.js +0 -24
- package/esm/Resizable.js +0 -309
- package/esm/defaultProps.js +0 -6
- package/esm/index.js +0 -1
- package/esm/props.js +0 -20
- package/types/Resizable.d.ts +0 -62
- package/types/defaultProps.d.ts +0 -4
- package/types/index.d.ts +0 -2
- package/types/props.d.ts +0 -38
- package/types/tests/DSResizableContainer.events.test.d.ts +0 -1
|
@@ -0,0 +1,348 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __defProps = Object.defineProperties;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
8
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
9
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
11
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
12
|
+
var __spreadValues = (a, b) => {
|
|
13
|
+
for (var prop in b || (b = {}))
|
|
14
|
+
if (__hasOwnProp.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
if (__getOwnPropSymbols)
|
|
17
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
18
|
+
if (__propIsEnum.call(b, prop))
|
|
19
|
+
__defNormalProp(a, prop, b[prop]);
|
|
20
|
+
}
|
|
21
|
+
return a;
|
|
22
|
+
};
|
|
23
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
24
|
+
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
25
|
+
var __objRest = (source, exclude) => {
|
|
26
|
+
var target = {};
|
|
27
|
+
for (var prop in source)
|
|
28
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
29
|
+
target[prop] = source[prop];
|
|
30
|
+
if (source != null && __getOwnPropSymbols)
|
|
31
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
32
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
33
|
+
target[prop] = source[prop];
|
|
34
|
+
}
|
|
35
|
+
return target;
|
|
36
|
+
};
|
|
37
|
+
var __export = (target, all) => {
|
|
38
|
+
for (var name in all)
|
|
39
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
40
|
+
};
|
|
41
|
+
var __reExport = (target, module2, copyDefault, desc) => {
|
|
42
|
+
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
43
|
+
for (let key of __getOwnPropNames(module2))
|
|
44
|
+
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
45
|
+
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
46
|
+
}
|
|
47
|
+
return target;
|
|
48
|
+
};
|
|
49
|
+
var __toESM = (module2, isNodeMode) => {
|
|
50
|
+
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
51
|
+
};
|
|
52
|
+
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
53
|
+
return (module2, temp) => {
|
|
54
|
+
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
55
|
+
};
|
|
56
|
+
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
57
|
+
var Resizable_exports = {};
|
|
58
|
+
__export(Resizable_exports, {
|
|
59
|
+
DSResizableContainerWithSchema: () => DSResizableContainerWithSchema,
|
|
60
|
+
ResizableContainer: () => ResizableContainer,
|
|
61
|
+
default: () => Resizable_default
|
|
62
|
+
});
|
|
63
|
+
var React = __toESM(require("react"));
|
|
64
|
+
var import_react = __toESM(require("react"));
|
|
65
|
+
var import_react_desc = require("react-desc");
|
|
66
|
+
var import_styled_components = __toESM(require("styled-components"));
|
|
67
|
+
var import_ds_system = require("@elliemae/ds-system");
|
|
68
|
+
var import_ds_grid = require("@elliemae/ds-grid");
|
|
69
|
+
var import_props = require("./props");
|
|
70
|
+
var import_defaultProps = require("./defaultProps");
|
|
71
|
+
const safeDifference = 15;
|
|
72
|
+
const minDifference = 8;
|
|
73
|
+
const EVENT_TYPE = { MOUSE: "mouse", KEY: "arrows" };
|
|
74
|
+
const DIRECTION = {
|
|
75
|
+
L: "left",
|
|
76
|
+
R: "right",
|
|
77
|
+
U: "up",
|
|
78
|
+
D: "down"
|
|
79
|
+
};
|
|
80
|
+
function calcPosition(arrow, position) {
|
|
81
|
+
let offset;
|
|
82
|
+
switch (arrow) {
|
|
83
|
+
case DIRECTION.U:
|
|
84
|
+
offset = position - 3;
|
|
85
|
+
break;
|
|
86
|
+
case DIRECTION.D:
|
|
87
|
+
offset = position + 3;
|
|
88
|
+
break;
|
|
89
|
+
case DIRECTION.L:
|
|
90
|
+
offset = position - 3;
|
|
91
|
+
break;
|
|
92
|
+
case DIRECTION.R:
|
|
93
|
+
offset = position + 3;
|
|
94
|
+
break;
|
|
95
|
+
default:
|
|
96
|
+
offset = position;
|
|
97
|
+
}
|
|
98
|
+
return offset;
|
|
99
|
+
}
|
|
100
|
+
function cursorResolver(nextPx, px, isVertical) {
|
|
101
|
+
const orientation = {
|
|
102
|
+
vertical: "row-resize",
|
|
103
|
+
horizontal: "col-resize",
|
|
104
|
+
left: "w-resize",
|
|
105
|
+
right: "e-resize",
|
|
106
|
+
up: "n-resize",
|
|
107
|
+
down: "s-resize"
|
|
108
|
+
};
|
|
109
|
+
if (isVertical && nextPx && nextPx <= safeDifference + 1)
|
|
110
|
+
return orientation.up;
|
|
111
|
+
if (isVertical && px > safeDifference + 1)
|
|
112
|
+
return orientation.vertical;
|
|
113
|
+
if (isVertical && px <= safeDifference + 1)
|
|
114
|
+
return orientation.down;
|
|
115
|
+
if (!isVertical && nextPx && nextPx <= safeDifference + 1)
|
|
116
|
+
return orientation.left;
|
|
117
|
+
if (!isVertical && px <= safeDifference + 1)
|
|
118
|
+
return orientation.right;
|
|
119
|
+
if (!isVertical && px > safeDifference + 1)
|
|
120
|
+
return orientation.horizontal;
|
|
121
|
+
return isVertical ? orientation.vertical : orientation.horizontal;
|
|
122
|
+
}
|
|
123
|
+
function ResizableItemComponent(_a) {
|
|
124
|
+
var _b = _a, { innerRef } = _b, p = __objRest(_b, ["innerRef"]);
|
|
125
|
+
return /* @__PURE__ */ import_react.default.createElement(import_ds_grid.Grid, __spreadValues({
|
|
126
|
+
ref: innerRef
|
|
127
|
+
}, p));
|
|
128
|
+
}
|
|
129
|
+
const ResizableGrid = (0, import_styled_components.default)(import_ds_grid.Grid)``;
|
|
130
|
+
const ResizableItem = (0, import_styled_components.default)(ResizableItemComponent)`
|
|
131
|
+
position: relative;
|
|
132
|
+
`;
|
|
133
|
+
const ResizableBar = import_styled_components.default.div`
|
|
134
|
+
position: absolute;
|
|
135
|
+
cursor: ${({ container, nextContainer, v }) => cursorResolver(nextContainer, container, v)};
|
|
136
|
+
|
|
137
|
+
${(props) => {
|
|
138
|
+
if (props.v) {
|
|
139
|
+
return `
|
|
140
|
+
bottom: calc(${(0, import_ds_system.mapGap)(props.gutter)} * -0.5);
|
|
141
|
+
left: 0;
|
|
142
|
+
width: 100%;
|
|
143
|
+
height: 10px;
|
|
144
|
+
margin-bottom: -5px;
|
|
145
|
+
display: flex;
|
|
146
|
+
flex-direction: column;
|
|
147
|
+
justify-content:space-around;
|
|
148
|
+
align-items: center;
|
|
149
|
+
&:after{
|
|
150
|
+
width: 100%;
|
|
151
|
+
height: 1px;
|
|
152
|
+
display: block;
|
|
153
|
+
background: ${props.theme.colors.neutral["300"]};
|
|
154
|
+
content: '';
|
|
155
|
+
}
|
|
156
|
+
&:hover{
|
|
157
|
+
&:after{
|
|
158
|
+
background: ${props.theme.colors.brand["600"]};
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
`;
|
|
162
|
+
}
|
|
163
|
+
return `
|
|
164
|
+
top: 0;
|
|
165
|
+
right: calc(${(0, import_ds_system.mapGap)(props.gutter)} * -0.5);
|
|
166
|
+
height: 100%;
|
|
167
|
+
width: 10px;
|
|
168
|
+
margin-right: -5px;
|
|
169
|
+
display: flex;
|
|
170
|
+
flex-direction: row;
|
|
171
|
+
justify-content:space-around;
|
|
172
|
+
align-items: center;
|
|
173
|
+
&:after{
|
|
174
|
+
height: 100%;
|
|
175
|
+
width: 1px;
|
|
176
|
+
display: block;
|
|
177
|
+
background: ${props.theme.colors.neutral["300"]};
|
|
178
|
+
content: '';
|
|
179
|
+
}
|
|
180
|
+
&:hover{
|
|
181
|
+
&:after{
|
|
182
|
+
background: ${props.theme.colors.brand["600"]};
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
`;
|
|
186
|
+
}}
|
|
187
|
+
`;
|
|
188
|
+
const getWidths = (list) => list.map((l) => l.clientWidth);
|
|
189
|
+
const getHeights = (list) => list.map((l) => l.clientHeight);
|
|
190
|
+
function ResizableContainer(_c) {
|
|
191
|
+
var _d = _c, {
|
|
192
|
+
children,
|
|
193
|
+
cols,
|
|
194
|
+
rows,
|
|
195
|
+
vertical,
|
|
196
|
+
horizontal
|
|
197
|
+
} = _d, rest = __objRest(_d, [
|
|
198
|
+
"children",
|
|
199
|
+
"cols",
|
|
200
|
+
"rows",
|
|
201
|
+
"vertical",
|
|
202
|
+
"horizontal"
|
|
203
|
+
]);
|
|
204
|
+
const refs = (0, import_react.useRef)([]);
|
|
205
|
+
const [containers, setContainers] = (0, import_react.useState)(cols);
|
|
206
|
+
const [blocks, setBlocks] = (0, import_react.useState)(rows);
|
|
207
|
+
const [isDragging, setDragging] = (0, import_react.useState)(false);
|
|
208
|
+
const [start, setStartPoint] = (0, import_react.useState)(0);
|
|
209
|
+
const [resetPoint, setResetPoint] = (0, import_react.useState)();
|
|
210
|
+
(0, import_react.useEffect)(() => {
|
|
211
|
+
if (horizontal)
|
|
212
|
+
setContainers(getWidths(refs.current));
|
|
213
|
+
if (vertical)
|
|
214
|
+
setBlocks(getHeights(refs.current));
|
|
215
|
+
}, [refs.current, horizontal, vertical]);
|
|
216
|
+
const addRef = (node) => {
|
|
217
|
+
refs.current.push(node);
|
|
218
|
+
};
|
|
219
|
+
const resizePanels = (diff = 1, v = false) => {
|
|
220
|
+
const index = parseInt(start.index, 10);
|
|
221
|
+
if (!v) {
|
|
222
|
+
const newContainers = [...containers];
|
|
223
|
+
if (newContainers[index + 1] && newContainers[index + 1] > minDifference) {
|
|
224
|
+
newContainers[index + 1] = newContainers[index + 1] - diff;
|
|
225
|
+
newContainers[index] = diff + newContainers[index];
|
|
226
|
+
} else if (newContainers[index - 1] && newContainers[index - 1] > minDifference) {
|
|
227
|
+
newContainers[index - 1] = newContainers[index - 1] - diff;
|
|
228
|
+
newContainers[index] = diff + newContainers[index];
|
|
229
|
+
}
|
|
230
|
+
if (newContainers.every((c) => c > safeDifference))
|
|
231
|
+
setContainers(newContainers);
|
|
232
|
+
} else {
|
|
233
|
+
const newBlocks = [...blocks];
|
|
234
|
+
if (newBlocks[index + 1] && newBlocks[index + 1] > minDifference) {
|
|
235
|
+
newBlocks[index + 1] = newBlocks[index + 1] - diff;
|
|
236
|
+
newBlocks[index] = diff + newBlocks[index];
|
|
237
|
+
} else if (newBlocks[index - 1] && newBlocks[index - 1] > minDifference) {
|
|
238
|
+
newBlocks[index - 1] = newBlocks[index - 1] - diff;
|
|
239
|
+
newBlocks[index] = diff + newBlocks[index];
|
|
240
|
+
}
|
|
241
|
+
if (newBlocks.every((c) => c > safeDifference))
|
|
242
|
+
setBlocks(newBlocks);
|
|
243
|
+
}
|
|
244
|
+
};
|
|
245
|
+
const startResize = (event, index, v = false, type) => {
|
|
246
|
+
setDragging(type);
|
|
247
|
+
setStartPoint({
|
|
248
|
+
x: event.clientX,
|
|
249
|
+
y: event.clientY,
|
|
250
|
+
index,
|
|
251
|
+
v
|
|
252
|
+
});
|
|
253
|
+
setResetPoint({ containers, blocks });
|
|
254
|
+
};
|
|
255
|
+
const moveResize = (event, type) => {
|
|
256
|
+
if (isDragging && isDragging === type && !start.v) {
|
|
257
|
+
const diff = event.clientX - start.x;
|
|
258
|
+
if (diff === 0)
|
|
259
|
+
return;
|
|
260
|
+
setStartPoint({ x: event.clientX, index: start.index });
|
|
261
|
+
resizePanels(diff);
|
|
262
|
+
} else if (isDragging && isDragging === type && start.v) {
|
|
263
|
+
const diff = event.clientY - start.y;
|
|
264
|
+
if (diff === 0)
|
|
265
|
+
return;
|
|
266
|
+
setStartPoint(__spreadProps(__spreadValues({}, start), { y: event.clientY, index: start.index }));
|
|
267
|
+
resizePanels(diff, true);
|
|
268
|
+
}
|
|
269
|
+
};
|
|
270
|
+
const endResize = (type) => {
|
|
271
|
+
if (isDragging === type) {
|
|
272
|
+
setDragging(false);
|
|
273
|
+
setStartPoint();
|
|
274
|
+
}
|
|
275
|
+
};
|
|
276
|
+
const handleKeyDown = (e, index, v = false) => {
|
|
277
|
+
const keyCodes = {
|
|
278
|
+
37: DIRECTION.L,
|
|
279
|
+
Left: DIRECTION.L,
|
|
280
|
+
ArrowLeft: DIRECTION.L,
|
|
281
|
+
38: DIRECTION.U,
|
|
282
|
+
Up: DIRECTION.U,
|
|
283
|
+
ArrowUp: DIRECTION.U,
|
|
284
|
+
39: DIRECTION.R,
|
|
285
|
+
Right: DIRECTION.R,
|
|
286
|
+
ArrowRight: DIRECTION.R,
|
|
287
|
+
40: DIRECTION.D,
|
|
288
|
+
Down: DIRECTION.D,
|
|
289
|
+
ArrowDown: DIRECTION.D
|
|
290
|
+
};
|
|
291
|
+
if (keyCodes[e.key || e.keyCode]) {
|
|
292
|
+
e.preventDefault();
|
|
293
|
+
const { top: y, left: x } = e.target.getBoundingClientRect();
|
|
294
|
+
if (!start) {
|
|
295
|
+
startResize({ clientX: x, clientY: y }, index, v, EVENT_TYPE.KEY);
|
|
296
|
+
} else {
|
|
297
|
+
const clientX = keyCodes[e.keyCode] === DIRECTION.L || keyCodes[e.keyCode] === DIRECTION.R ? calcPosition(keyCodes[e.keyCode], x) : x;
|
|
298
|
+
const clientY = keyCodes[e.keyCode] === DIRECTION.U || keyCodes[e.keyCode] === DIRECTION.D ? calcPosition(keyCodes[e.keyCode], y) : y;
|
|
299
|
+
moveResize({ clientX, clientY }, EVENT_TYPE.KEY);
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
};
|
|
303
|
+
const onLeave = (type) => {
|
|
304
|
+
if (isDragging === type) {
|
|
305
|
+
setDragging(false);
|
|
306
|
+
if (resetPoint && resetPoint.blocks)
|
|
307
|
+
setBlocks(resetPoint.blocks);
|
|
308
|
+
if (resetPoint && resetPoint.containers)
|
|
309
|
+
setContainers(resetPoint.containers);
|
|
310
|
+
}
|
|
311
|
+
};
|
|
312
|
+
const count = import_react.default.Children.count(children);
|
|
313
|
+
return /* @__PURE__ */ import_react.default.createElement(ResizableGrid, __spreadProps(__spreadValues({}, rest), {
|
|
314
|
+
cols: containers,
|
|
315
|
+
onKeyUp: () => endResize(EVENT_TYPE.KEY),
|
|
316
|
+
onMouseLeave: () => onLeave(EVENT_TYPE.MOUSE),
|
|
317
|
+
onMouseMove: (e) => moveResize(e, EVENT_TYPE.MOUSE),
|
|
318
|
+
onMouseUp: () => endResize(EVENT_TYPE.MOUSE),
|
|
319
|
+
rows: blocks
|
|
320
|
+
}), import_react.default.Children.map(children, (child, index) => /* @__PURE__ */ import_react.default.createElement(ResizableItem, {
|
|
321
|
+
"data-index": index,
|
|
322
|
+
innerRef: addRef
|
|
323
|
+
}, child, count - 1 !== index && horizontal && /* @__PURE__ */ import_react.default.createElement(ResizableBar, {
|
|
324
|
+
container: containers[index],
|
|
325
|
+
"data-index": index,
|
|
326
|
+
gutter: rest.gutter,
|
|
327
|
+
nextContainer: containers[index + 1],
|
|
328
|
+
onKeyDown: (e) => handleKeyDown(e, index, false),
|
|
329
|
+
onMouseDown: (e) => startResize(e, index, false, EVENT_TYPE.MOUSE),
|
|
330
|
+
tabIndex: 0
|
|
331
|
+
}), count - 1 !== index && vertical && /* @__PURE__ */ import_react.default.createElement(ResizableBar, {
|
|
332
|
+
container: blocks[index],
|
|
333
|
+
"data-index": index,
|
|
334
|
+
gutter: rest.gutter,
|
|
335
|
+
nextContainer: blocks[index + 1],
|
|
336
|
+
onKeyDown: (e) => handleKeyDown(e, index, true),
|
|
337
|
+
onMouseDown: (e) => startResize(e, index, true, EVENT_TYPE.MOUSE),
|
|
338
|
+
tabIndex: 0,
|
|
339
|
+
v: true
|
|
340
|
+
}))));
|
|
341
|
+
}
|
|
342
|
+
ResizableContainer.propTypes = import_props.props;
|
|
343
|
+
ResizableContainer.defaultProps = import_defaultProps.defaultProps;
|
|
344
|
+
const DSResizableContainerWithSchema = (0, import_react_desc.describe)(ResizableContainer);
|
|
345
|
+
DSResizableContainerWithSchema.propTypes = import_props.props;
|
|
346
|
+
var Resizable_default = ResizableContainer;
|
|
347
|
+
module.exports = __toCommonJS(Resizable_exports);
|
|
348
|
+
//# sourceMappingURL=Resizable.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/Resizable.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["/* eslint-disable complexity */\n/* eslint-disable max-lines */\n/* eslint-disable max-statements */\nimport React, { useRef, useState, useEffect } from 'react';\nimport { describe } from 'react-desc';\nimport styled from 'styled-components';\nimport { mapGap } from '@elliemae/ds-system';\nimport { Grid } from '@elliemae/ds-grid';\nimport { props as rprops } from './props';\nimport { defaultProps } from './defaultProps';\n\nconst safeDifference = 15;\nconst minDifference = 8;\nconst EVENT_TYPE = { MOUSE: 'mouse', KEY: 'arrows' };\nconst DIRECTION = {\n L: 'left',\n R: 'right',\n U: 'up',\n D: 'down',\n};\n\nfunction calcPosition(arrow, position) {\n let offset;\n switch (arrow) {\n case DIRECTION.U:\n offset = position - 3;\n break;\n case DIRECTION.D:\n offset = position + 3;\n break;\n case DIRECTION.L:\n offset = position - 3;\n break;\n case DIRECTION.R:\n offset = position + 3;\n break;\n default:\n offset = position;\n }\n return offset;\n}\n\nfunction cursorResolver(nextPx, px, isVertical) {\n const orientation = {\n vertical: 'row-resize',\n horizontal: 'col-resize',\n left: 'w-resize',\n right: 'e-resize',\n up: 'n-resize',\n down: 's-resize',\n };\n\n if (isVertical && nextPx && nextPx <= safeDifference + 1)\n return orientation.up;\n if (isVertical && px > safeDifference + 1) return orientation.vertical;\n if (isVertical && px <= safeDifference + 1) return orientation.down;\n\n if (!isVertical && nextPx && nextPx <= safeDifference + 1)\n return orientation.left;\n if (!isVertical && px <= safeDifference + 1) return orientation.right;\n if (!isVertical && px > safeDifference + 1) return orientation.horizontal;\n\n return isVertical ? orientation.vertical : orientation.horizontal;\n}\n\nfunction ResizableItemComponent({ innerRef, ...p }) {\n return <Grid ref={innerRef} {...p} />;\n}\n\nconst ResizableGrid = styled(Grid)``;\nconst ResizableItem = styled(ResizableItemComponent)`\n position: relative;\n`;\nconst ResizableBar = styled.div`\n position: absolute;\n cursor: ${({ container, nextContainer, v }) =>\n cursorResolver(nextContainer, container, v)};\n\n ${(props) => {\n if (props.v) {\n return `\n bottom: calc(${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: ${props.theme.colors.neutral['300']};\n content: '';\n }\n &:hover{\n &:after{\n background: ${props.theme.colors.brand['600']};\n } \n }\n `;\n }\n return `\n top: 0;\n right: calc(${mapGap(props.gutter)} * -0.5);\n height: 100%;\n width: 10px;\n margin-right: -5px;\n display: flex;\n flex-direction: row;\n justify-content:space-around;\n align-items: center;\n &:after{\n height: 100%;\n width: 1px;\n display: block;\n background: ${props.theme.colors.neutral['300']};\n content: '';\n }\n &:hover{\n &:after{\n background: ${props.theme.colors.brand['600']};\n } \n }\n `;\n }}\n`;\nconst getWidths = (list) => list.map((l) => l.clientWidth);\nconst getHeights = (list) => list.map((l) => l.clientHeight);\n\nfunction ResizableContainer({\n children,\n cols,\n rows,\n vertical,\n horizontal,\n ...rest\n}) {\n const refs = useRef([]);\n const [containers, setContainers] = useState(cols);\n const [blocks, setBlocks] = useState(rows);\n const [isDragging, setDragging] = useState(false);\n const [start, setStartPoint] = useState(0);\n const [resetPoint, setResetPoint] = useState();\n\n useEffect(() => {\n if (horizontal) setContainers(getWidths(refs.current));\n if (vertical) setBlocks(getHeights(refs.current));\n }, [refs.current, horizontal, vertical]);\n const addRef = (node) => {\n refs.current.push(node);\n };\n const resizePanels = (diff = 1, v = false) => {\n const index = parseInt(start.index, 10);\n if (!v) {\n const newContainers = [...containers];\n if (\n newContainers[index + 1] &&\n newContainers[index + 1] > minDifference\n ) {\n newContainers[index + 1] = newContainers[index + 1] - diff;\n newContainers[index] = diff + newContainers[index];\n } else if (\n newContainers[index - 1] &&\n newContainers[index - 1] > minDifference\n ) {\n newContainers[index - 1] = newContainers[index - 1] - diff;\n newContainers[index] = diff + newContainers[index];\n }\n if (newContainers.every((c) => c > safeDifference))\n setContainers(newContainers);\n } else {\n const newBlocks = [...blocks];\n if (newBlocks[index + 1] && newBlocks[index + 1] > minDifference) {\n newBlocks[index + 1] = newBlocks[index + 1] - diff;\n newBlocks[index] = diff + newBlocks[index];\n } else if (newBlocks[index - 1] && newBlocks[index - 1] > minDifference) {\n newBlocks[index - 1] = newBlocks[index - 1] - diff;\n newBlocks[index] = diff + newBlocks[index];\n }\n if (newBlocks.every((c) => c > safeDifference)) setBlocks(newBlocks);\n }\n };\n const startResize = (event, index, v = false, type) => {\n setDragging(type);\n setStartPoint({\n x: event.clientX,\n y: event.clientY,\n index,\n v,\n });\n setResetPoint({ containers, blocks });\n };\n const moveResize = (event, type) => {\n if (isDragging && isDragging === type && !start.v) {\n const diff = event.clientX - start.x;\n if (diff === 0) return;\n setStartPoint({ x: event.clientX, index: start.index });\n resizePanels(diff);\n } else if (isDragging && isDragging === type && start.v) {\n const diff = event.clientY - start.y;\n if (diff === 0) return;\n setStartPoint({ ...start, y: event.clientY, index: start.index });\n resizePanels(diff, true);\n }\n };\n const endResize = (type) => {\n if (isDragging === type) {\n setDragging(false);\n setStartPoint();\n }\n };\n const handleKeyDown = (e, index, v = false) => {\n const keyCodes = {\n 37: DIRECTION.L,\n Left: DIRECTION.L,\n ArrowLeft: DIRECTION.L,\n 38: DIRECTION.U,\n Up: DIRECTION.U,\n ArrowUp: DIRECTION.U,\n 39: DIRECTION.R,\n Right: DIRECTION.R,\n ArrowRight: DIRECTION.R,\n 40: DIRECTION.D,\n Down: DIRECTION.D,\n ArrowDown: DIRECTION.D,\n };\n\n if (keyCodes[e.key || e.keyCode]) {\n e.preventDefault();\n const { top: y, left: x } = e.target.getBoundingClientRect();\n if (!start) {\n startResize({ clientX: x, clientY: y }, index, v, EVENT_TYPE.KEY);\n } else {\n const clientX =\n keyCodes[e.keyCode] === DIRECTION.L ||\n keyCodes[e.keyCode] === DIRECTION.R\n ? calcPosition(keyCodes[e.keyCode], x)\n : x;\n const clientY =\n keyCodes[e.keyCode] === DIRECTION.U ||\n keyCodes[e.keyCode] === DIRECTION.D\n ? calcPosition(keyCodes[e.keyCode], y)\n : y;\n\n moveResize({ clientX, clientY }, EVENT_TYPE.KEY);\n }\n }\n };\n\n const onLeave = (type) => {\n if (isDragging === type) {\n setDragging(false);\n\n if (resetPoint && resetPoint.blocks) setBlocks(resetPoint.blocks);\n if (resetPoint && resetPoint.containers)\n setContainers(resetPoint.containers);\n }\n };\n const count = React.Children.count(children);\n\n return (\n <ResizableGrid\n {...rest}\n cols={containers}\n onKeyUp={() => endResize(EVENT_TYPE.KEY)}\n onMouseLeave={() => onLeave(EVENT_TYPE.MOUSE)}\n onMouseMove={(e) => moveResize(e, EVENT_TYPE.MOUSE)}\n onMouseUp={() => endResize(EVENT_TYPE.MOUSE)}\n rows={blocks}\n >\n {React.Children.map(children, (child, index) => (\n <ResizableItem data-index={index} innerRef={addRef}>\n {child}\n {count - 1 !== index && horizontal && (\n <ResizableBar\n container={containers[index]}\n data-index={index}\n gutter={rest.gutter}\n nextContainer={containers[index + 1]}\n onKeyDown={(e) => handleKeyDown(e, index, false)}\n onMouseDown={(e) =>\n startResize(e, index, false, EVENT_TYPE.MOUSE)\n }\n tabIndex={0}\n />\n )}\n {count - 1 !== index && vertical && (\n <ResizableBar\n container={blocks[index]}\n data-index={index}\n gutter={rest.gutter}\n nextContainer={blocks[index + 1]}\n onKeyDown={(e) => handleKeyDown(e, index, true)}\n onMouseDown={(e) => startResize(e, index, true, EVENT_TYPE.MOUSE)}\n tabIndex={0}\n v\n />\n )}\n </ResizableItem>\n ))}\n </ResizableGrid>\n );\n}\n\nResizableContainer.propTypes = rprops;\nResizableContainer.defaultProps = defaultProps;\n\nconst DSResizableContainerWithSchema = describe(ResizableContainer);\nDSResizableContainerWithSchema.propTypes = rprops;\n\nexport { ResizableContainer, DSResizableContainerWithSchema };\nexport default ResizableContainer;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADGvB,mBAAmD;AACnD,wBAAyB;AACzB,+BAAmB;AACnB,uBAAuB;AACvB,qBAAqB;AACrB,mBAAgC;AAChC,0BAA6B;AAE7B,MAAM,iBAAiB;AACvB,MAAM,gBAAgB;AACtB,MAAM,aAAa,EAAE,OAAO,SAAS,KAAK;AAC1C,MAAM,YAAY;AAAA,EAChB,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA;AAGL,sBAAsB,OAAO,UAAU;AACrC,MAAI;AACJ,UAAQ;AAAA,SACD,UAAU;AACb,eAAS,WAAW;AACpB;AAAA,SACG,UAAU;AACb,eAAS,WAAW;AACpB;AAAA,SACG,UAAU;AACb,eAAS,WAAW;AACpB;AAAA,SACG,UAAU;AACb,eAAS,WAAW;AACpB;AAAA;AAEA,eAAS;AAAA;AAEb,SAAO;AAAA;AAGT,wBAAwB,QAAQ,IAAI,YAAY;AAC9C,QAAM,cAAc;AAAA,IAClB,UAAU;AAAA,IACV,YAAY;AAAA,IACZ,MAAM;AAAA,IACN,OAAO;AAAA,IACP,IAAI;AAAA,IACJ,MAAM;AAAA;AAGR,MAAI,cAAc,UAAU,UAAU,iBAAiB;AACrD,WAAO,YAAY;AACrB,MAAI,cAAc,KAAK,iBAAiB;AAAG,WAAO,YAAY;AAC9D,MAAI,cAAc,MAAM,iBAAiB;AAAG,WA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Y,GAAG,OAAO,OAAO,WAAW;AAAA,IAE1C,UAAU;AAAA,MAGb,QAAQ,MAAM,SAAS,YACtB,mDAAC,cAAD;AAAA,IACE,WAAW,OAAO;AAAA,IAClB,cAAY;AAAA,IACZ,QAAQ,KAAK;AAAA,IACb,eAAe,OAAO,QAAQ;AAAA,IAC9B,WAAW,CAAC,MAAM,cAAc,GAAG,OAAO;AAAA,IAC1C,aAAa,CAAC,MAAM,YAAY,GAAG,OAAO,MAAM,WAAW;AAAA,IAC3D,UAAU;AAAA,IACV,GAAC;AAAA;AAAA;AASf,mBAAmB,YAAY;AAC/B,mBAAmB,eAAe;AAElC,MAAM,iCAAiC,gCAAS;AAChD,+BAA+B,YAAY;AAG3C,IAAO,oBAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __reExport = (target, module2, copyDefault, desc) => {
|
|
13
|
+
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(module2))
|
|
15
|
+
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
16
|
+
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return target;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (module2, isNodeMode) => {
|
|
21
|
+
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
22
|
+
};
|
|
23
|
+
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
24
|
+
return (module2, temp) => {
|
|
25
|
+
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
26
|
+
};
|
|
27
|
+
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
28
|
+
var defaultProps_exports = {};
|
|
29
|
+
__export(defaultProps_exports, {
|
|
30
|
+
defaultProps: () => defaultProps
|
|
31
|
+
});
|
|
32
|
+
var React = __toESM(require("react"));
|
|
33
|
+
const defaultProps = {
|
|
34
|
+
vertical: false,
|
|
35
|
+
horizontal: false
|
|
36
|
+
};
|
|
37
|
+
module.exports = __toCommonJS(defaultProps_exports);
|
|
38
|
+
//# sourceMappingURL=defaultProps.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/defaultProps.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["export const defaultProps = {\n vertical: false,\n horizontal: false,\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAhB,MAAM,eAAe;AAAA,EAC1B,UAAU;AAAA,EACV,YAAY;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __reExport = (target, module2, copyDefault, desc) => {
|
|
13
|
+
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(module2))
|
|
15
|
+
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
16
|
+
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return target;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (module2, isNodeMode) => {
|
|
21
|
+
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
22
|
+
};
|
|
23
|
+
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
24
|
+
return (module2, temp) => {
|
|
25
|
+
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
26
|
+
};
|
|
27
|
+
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
28
|
+
var src_exports = {};
|
|
29
|
+
__export(src_exports, {
|
|
30
|
+
default: () => import_Resizable.default
|
|
31
|
+
});
|
|
32
|
+
var React = __toESM(require("react"));
|
|
33
|
+
__reExport(src_exports, require("./Resizable"));
|
|
34
|
+
var import_Resizable = __toESM(require("./Resizable"));
|
|
35
|
+
module.exports = __toCommonJS(src_exports);
|
|
36
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/index.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["export * from './Resizable';\nexport { default } from './Resizable';\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,wBAAc;AACd,uBAAwB;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __reExport = (target, module2, copyDefault, desc) => {
|
|
13
|
+
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(module2))
|
|
15
|
+
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
16
|
+
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return target;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (module2, isNodeMode) => {
|
|
21
|
+
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
22
|
+
};
|
|
23
|
+
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
24
|
+
return (module2, temp) => {
|
|
25
|
+
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
26
|
+
};
|
|
27
|
+
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
28
|
+
var props_exports = {};
|
|
29
|
+
__export(props_exports, {
|
|
30
|
+
props: () => props
|
|
31
|
+
});
|
|
32
|
+
var React = __toESM(require("react"));
|
|
33
|
+
var import_react_desc = require("react-desc");
|
|
34
|
+
const props = {
|
|
35
|
+
children: import_react_desc.PropTypes.node.description("Grid item content"),
|
|
36
|
+
vertical: import_react_desc.PropTypes.bool.description("vertical resizing"),
|
|
37
|
+
horizontal: import_react_desc.PropTypes.bool.description("horizontal resizing"),
|
|
38
|
+
rows: import_react_desc.PropTypes.arrayOf(import_react_desc.PropTypes.oneOfType([import_react_desc.PropTypes.number, import_react_desc.PropTypes.string])).description("Row layout cells"),
|
|
39
|
+
cols: import_react_desc.PropTypes.arrayOf(import_react_desc.PropTypes.oneOfType([import_react_desc.PropTypes.number, import_react_desc.PropTypes.string])).description("Column layout cells")
|
|
40
|
+
};
|
|
41
|
+
module.exports = __toCommonJS(props_exports);
|
|
42
|
+
//# sourceMappingURL=props.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/props.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import { PropTypes } from 'react-desc';\n\nexport const props = {\n /** grid item content */\n children: PropTypes.node.description('Grid item content'),\n /** vertical resizing */\n vertical: PropTypes.bool.description('vertical resizing'),\n /** horizontal resizing */\n horizontal: PropTypes.bool.description('horizontal resizing'),\n /** Row layout cells */\n rows: PropTypes.arrayOf(\n PropTypes.oneOfType([PropTypes.number, PropTypes.string]),\n ).description('Row layout cells'),\n /** Column layout cells */\n cols: PropTypes.arrayOf(\n PropTypes.oneOfType([PropTypes.number, PropTypes.string]),\n ).description('Column layout cells'),\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,wBAA0B;AAEnB,MAAM,QAAQ;AAAA,EAEnB,UAAU,4BAAU,KAAK,YAAY;AAAA,EAErC,UAAU,4BAAU,KAAK,YAAY;AAAA,EAErC,YAAY,4BAAU,KAAK,YAAY;AAAA,EAEvC,MAAM,4BAAU,QACd,4BAAU,UAAU,CAAC,4BAAU,QAAQ,4BAAU,UACjD,YAAY;AAAA,EAEd,MAAM,4BAAU,QACd,4BAAU,UAAU,CAAC,4BAAU,QAAQ,4BAAU,UACjD,YAAY;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|