@elliemae/ds-resizeable-container 2.3.1 → 3.0.0-alpha.3

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.
@@ -0,0 +1,321 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __defProps = Object.defineProperties;
3
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
+ var __spreadValues = (a, b) => {
9
+ for (var prop in b || (b = {}))
10
+ if (__hasOwnProp.call(b, prop))
11
+ __defNormalProp(a, prop, b[prop]);
12
+ if (__getOwnPropSymbols)
13
+ for (var prop of __getOwnPropSymbols(b)) {
14
+ if (__propIsEnum.call(b, prop))
15
+ __defNormalProp(a, prop, b[prop]);
16
+ }
17
+ return a;
18
+ };
19
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
+ var __objRest = (source, exclude) => {
21
+ var target = {};
22
+ for (var prop in source)
23
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
24
+ target[prop] = source[prop];
25
+ if (source != null && __getOwnPropSymbols)
26
+ for (var prop of __getOwnPropSymbols(source)) {
27
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
28
+ target[prop] = source[prop];
29
+ }
30
+ return target;
31
+ };
32
+ import * as React from "react";
33
+ import React2, { useRef, useState, useEffect } from "react";
34
+ import { describe } from "react-desc";
35
+ import styled from "styled-components";
36
+ import { mapGap } from "@elliemae/ds-system";
37
+ import { Grid } from "@elliemae/ds-grid";
38
+ import { props as rprops } from "./props";
39
+ import { defaultProps } from "./defaultProps";
40
+ const safeDifference = 15;
41
+ const minDifference = 8;
42
+ const EVENT_TYPE = { MOUSE: "mouse", KEY: "arrows" };
43
+ const DIRECTION = {
44
+ L: "left",
45
+ R: "right",
46
+ U: "up",
47
+ D: "down"
48
+ };
49
+ function calcPosition(arrow, position) {
50
+ let offset;
51
+ switch (arrow) {
52
+ case DIRECTION.U:
53
+ offset = position - 3;
54
+ break;
55
+ case DIRECTION.D:
56
+ offset = position + 3;
57
+ break;
58
+ case DIRECTION.L:
59
+ offset = position - 3;
60
+ break;
61
+ case DIRECTION.R:
62
+ offset = position + 3;
63
+ break;
64
+ default:
65
+ offset = position;
66
+ }
67
+ return offset;
68
+ }
69
+ function cursorResolver(nextPx, px, isVertical) {
70
+ const orientation = {
71
+ vertical: "row-resize",
72
+ horizontal: "col-resize",
73
+ left: "w-resize",
74
+ right: "e-resize",
75
+ up: "n-resize",
76
+ down: "s-resize"
77
+ };
78
+ if (isVertical && nextPx && nextPx <= safeDifference + 1)
79
+ return orientation.up;
80
+ if (isVertical && px > safeDifference + 1)
81
+ return orientation.vertical;
82
+ if (isVertical && px <= safeDifference + 1)
83
+ return orientation.down;
84
+ if (!isVertical && nextPx && nextPx <= safeDifference + 1)
85
+ return orientation.left;
86
+ if (!isVertical && px <= safeDifference + 1)
87
+ return orientation.right;
88
+ if (!isVertical && px > safeDifference + 1)
89
+ return orientation.horizontal;
90
+ return isVertical ? orientation.vertical : orientation.horizontal;
91
+ }
92
+ function ResizableItemComponent(_a) {
93
+ var _b = _a, { innerRef } = _b, p = __objRest(_b, ["innerRef"]);
94
+ return /* @__PURE__ */ React2.createElement(Grid, __spreadValues({
95
+ ref: innerRef
96
+ }, p));
97
+ }
98
+ const ResizableGrid = styled(Grid)``;
99
+ const ResizableItem = styled(ResizableItemComponent)`
100
+ position: relative;
101
+ `;
102
+ const ResizableBar = styled.div`
103
+ position: absolute;
104
+ cursor: ${({ container, nextContainer, v }) => cursorResolver(nextContainer, container, v)};
105
+
106
+ ${(props) => {
107
+ if (props.v) {
108
+ return `
109
+ bottom: calc(${mapGap(props.gutter)} * -0.5);
110
+ left: 0;
111
+ width: 100%;
112
+ height: 10px;
113
+ margin-bottom: -5px;
114
+ display: flex;
115
+ flex-direction: column;
116
+ justify-content:space-around;
117
+ align-items: center;
118
+ &:after{
119
+ width: 100%;
120
+ height: 1px;
121
+ display: block;
122
+ background: ${props.theme.colors.neutral["300"]};
123
+ content: '';
124
+ }
125
+ &:hover{
126
+ &:after{
127
+ background: ${props.theme.colors.brand["600"]};
128
+ }
129
+ }
130
+ `;
131
+ }
132
+ return `
133
+ top: 0;
134
+ right: calc(${mapGap(props.gutter)} * -0.5);
135
+ height: 100%;
136
+ width: 10px;
137
+ margin-right: -5px;
138
+ display: flex;
139
+ flex-direction: row;
140
+ justify-content:space-around;
141
+ align-items: center;
142
+ &:after{
143
+ height: 100%;
144
+ width: 1px;
145
+ display: block;
146
+ background: ${props.theme.colors.neutral["300"]};
147
+ content: '';
148
+ }
149
+ &:hover{
150
+ &:after{
151
+ background: ${props.theme.colors.brand["600"]};
152
+ }
153
+ }
154
+ `;
155
+ }}
156
+ `;
157
+ const getWidths = (list) => list.map((l) => l.clientWidth);
158
+ const getHeights = (list) => list.map((l) => l.clientHeight);
159
+ function ResizableContainer(_c) {
160
+ var _d = _c, {
161
+ children,
162
+ cols,
163
+ rows,
164
+ vertical,
165
+ horizontal
166
+ } = _d, rest = __objRest(_d, [
167
+ "children",
168
+ "cols",
169
+ "rows",
170
+ "vertical",
171
+ "horizontal"
172
+ ]);
173
+ const refs = useRef([]);
174
+ const [containers, setContainers] = useState(cols);
175
+ const [blocks, setBlocks] = useState(rows);
176
+ const [isDragging, setDragging] = useState(false);
177
+ const [start, setStartPoint] = useState(0);
178
+ const [resetPoint, setResetPoint] = useState();
179
+ useEffect(() => {
180
+ if (horizontal)
181
+ setContainers(getWidths(refs.current));
182
+ if (vertical)
183
+ setBlocks(getHeights(refs.current));
184
+ }, [refs.current, horizontal, vertical]);
185
+ const addRef = (node) => {
186
+ refs.current.push(node);
187
+ };
188
+ const resizePanels = (diff = 1, v = false) => {
189
+ const index = parseInt(start.index, 10);
190
+ if (!v) {
191
+ const newContainers = [...containers];
192
+ if (newContainers[index + 1] && newContainers[index + 1] > minDifference) {
193
+ newContainers[index + 1] = newContainers[index + 1] - diff;
194
+ newContainers[index] = diff + newContainers[index];
195
+ } else if (newContainers[index - 1] && newContainers[index - 1] > minDifference) {
196
+ newContainers[index - 1] = newContainers[index - 1] - diff;
197
+ newContainers[index] = diff + newContainers[index];
198
+ }
199
+ if (newContainers.every((c) => c > safeDifference))
200
+ setContainers(newContainers);
201
+ } else {
202
+ const newBlocks = [...blocks];
203
+ if (newBlocks[index + 1] && newBlocks[index + 1] > minDifference) {
204
+ newBlocks[index + 1] = newBlocks[index + 1] - diff;
205
+ newBlocks[index] = diff + newBlocks[index];
206
+ } else if (newBlocks[index - 1] && newBlocks[index - 1] > minDifference) {
207
+ newBlocks[index - 1] = newBlocks[index - 1] - diff;
208
+ newBlocks[index] = diff + newBlocks[index];
209
+ }
210
+ if (newBlocks.every((c) => c > safeDifference))
211
+ setBlocks(newBlocks);
212
+ }
213
+ };
214
+ const startResize = (event, index, v = false, type) => {
215
+ setDragging(type);
216
+ setStartPoint({
217
+ x: event.clientX,
218
+ y: event.clientY,
219
+ index,
220
+ v
221
+ });
222
+ setResetPoint({ containers, blocks });
223
+ };
224
+ const moveResize = (event, type) => {
225
+ if (isDragging && isDragging === type && !start.v) {
226
+ const diff = event.clientX - start.x;
227
+ if (diff === 0)
228
+ return;
229
+ setStartPoint({ x: event.clientX, index: start.index });
230
+ resizePanels(diff);
231
+ } else if (isDragging && isDragging === type && start.v) {
232
+ const diff = event.clientY - start.y;
233
+ if (diff === 0)
234
+ return;
235
+ setStartPoint(__spreadProps(__spreadValues({}, start), { y: event.clientY, index: start.index }));
236
+ resizePanels(diff, true);
237
+ }
238
+ };
239
+ const endResize = (type) => {
240
+ if (isDragging === type) {
241
+ setDragging(false);
242
+ setStartPoint();
243
+ }
244
+ };
245
+ const handleKeyDown = (e, index, v = false) => {
246
+ const keyCodes = {
247
+ 37: DIRECTION.L,
248
+ Left: DIRECTION.L,
249
+ ArrowLeft: DIRECTION.L,
250
+ 38: DIRECTION.U,
251
+ Up: DIRECTION.U,
252
+ ArrowUp: DIRECTION.U,
253
+ 39: DIRECTION.R,
254
+ Right: DIRECTION.R,
255
+ ArrowRight: DIRECTION.R,
256
+ 40: DIRECTION.D,
257
+ Down: DIRECTION.D,
258
+ ArrowDown: DIRECTION.D
259
+ };
260
+ if (keyCodes[e.key || e.keyCode]) {
261
+ e.preventDefault();
262
+ const { top: y, left: x } = e.target.getBoundingClientRect();
263
+ if (!start) {
264
+ startResize({ clientX: x, clientY: y }, index, v, EVENT_TYPE.KEY);
265
+ } else {
266
+ const clientX = keyCodes[e.keyCode] === DIRECTION.L || keyCodes[e.keyCode] === DIRECTION.R ? calcPosition(keyCodes[e.keyCode], x) : x;
267
+ const clientY = keyCodes[e.keyCode] === DIRECTION.U || keyCodes[e.keyCode] === DIRECTION.D ? calcPosition(keyCodes[e.keyCode], y) : y;
268
+ moveResize({ clientX, clientY }, EVENT_TYPE.KEY);
269
+ }
270
+ }
271
+ };
272
+ const onLeave = (type) => {
273
+ if (isDragging === type) {
274
+ setDragging(false);
275
+ if (resetPoint && resetPoint.blocks)
276
+ setBlocks(resetPoint.blocks);
277
+ if (resetPoint && resetPoint.containers)
278
+ setContainers(resetPoint.containers);
279
+ }
280
+ };
281
+ const count = React2.Children.count(children);
282
+ return /* @__PURE__ */ React2.createElement(ResizableGrid, __spreadProps(__spreadValues({}, rest), {
283
+ cols: containers,
284
+ onKeyUp: () => endResize(EVENT_TYPE.KEY),
285
+ onMouseLeave: () => onLeave(EVENT_TYPE.MOUSE),
286
+ onMouseMove: (e) => moveResize(e, EVENT_TYPE.MOUSE),
287
+ onMouseUp: () => endResize(EVENT_TYPE.MOUSE),
288
+ rows: blocks
289
+ }), React2.Children.map(children, (child, index) => /* @__PURE__ */ React2.createElement(ResizableItem, {
290
+ "data-index": index,
291
+ innerRef: addRef
292
+ }, child, count - 1 !== index && horizontal && /* @__PURE__ */ React2.createElement(ResizableBar, {
293
+ container: containers[index],
294
+ "data-index": index,
295
+ gutter: rest.gutter,
296
+ nextContainer: containers[index + 1],
297
+ onKeyDown: (e) => handleKeyDown(e, index, false),
298
+ onMouseDown: (e) => startResize(e, index, false, EVENT_TYPE.MOUSE),
299
+ tabIndex: 0
300
+ }), count - 1 !== index && vertical && /* @__PURE__ */ React2.createElement(ResizableBar, {
301
+ container: blocks[index],
302
+ "data-index": index,
303
+ gutter: rest.gutter,
304
+ nextContainer: blocks[index + 1],
305
+ onKeyDown: (e) => handleKeyDown(e, index, true),
306
+ onMouseDown: (e) => startResize(e, index, true, EVENT_TYPE.MOUSE),
307
+ tabIndex: 0,
308
+ v: true
309
+ }))));
310
+ }
311
+ ResizableContainer.propTypes = rprops;
312
+ ResizableContainer.defaultProps = defaultProps;
313
+ const DSResizableContainerWithSchema = describe(ResizableContainer);
314
+ DSResizableContainerWithSchema.propTypes = rprops;
315
+ var Resizable_default = ResizableContainer;
316
+ export {
317
+ DSResizableContainerWithSchema,
318
+ ResizableContainer,
319
+ Resizable_default as default
320
+ };
321
+ //# sourceMappingURL=Resizable.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/Resizable.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* 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"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;ACGA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA,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;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MAAM;AAAA,MAEL,OAAM,SAAS,IAAI,UAAU,CAAC,OAAO,UACpC,qCAAC,eAAD;AAAA,IAAe,cAAY;AAAA,IAAO,UAAU;AAAA,KACzC,OACA,QAAQ,MAAM,SAAS,cACtB,qCAAC,cAAD;AAAA,IACE,WAAW,WAAW;AAAA,IACtB,cAAY;AAAA,IACZ,QAAQ,KAAK;AAAA,IACb,eAAe,WAAW,QAAQ;AAAA,IAClC,WAAW,CAAC,MAAM,cAAc,GAAG,OAAO;AAAA,IAC1C,aAAa,CAAC,MACZ,YAAY,GAAG,OAAO,OAAO,WAAW;AAAA,IAE1C,UAAU;AAAA,MAGb,QAAQ,MAAM,SAAS,YACtB,qCAAC,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,SAAS;AAChD,+BAA+B,YAAY;AAG3C,IAAO,oBAAQ;",
6
+ "names": []
7
+ }
@@ -0,0 +1,9 @@
1
+ import * as React from "react";
2
+ const defaultProps = {
3
+ vertical: false,
4
+ horizontal: false
5
+ };
6
+ export {
7
+ defaultProps
8
+ };
9
+ //# sourceMappingURL=defaultProps.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/defaultProps.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export const defaultProps = {\n vertical: false,\n horizontal: false,\n};\n"],
5
+ "mappings": "AAAA;ACAO,MAAM,eAAe;AAAA,EAC1B,UAAU;AAAA,EACV,YAAY;AAAA;",
6
+ "names": []
7
+ }
@@ -0,0 +1,7 @@
1
+ import * as React from "react";
2
+ export * from "./Resizable";
3
+ import { default as default2 } from "./Resizable";
4
+ export {
5
+ default2 as default
6
+ };
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/index.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export * from './Resizable';\nexport { default } from './Resizable';\n"],
5
+ "mappings": "AAAA;ACAA;AACA;",
6
+ "names": []
7
+ }
@@ -0,0 +1,13 @@
1
+ import * as React from "react";
2
+ import { PropTypes } from "react-desc";
3
+ const props = {
4
+ children: PropTypes.node.description("Grid item content"),
5
+ vertical: PropTypes.bool.description("vertical resizing"),
6
+ horizontal: PropTypes.bool.description("horizontal resizing"),
7
+ rows: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.string])).description("Row layout cells"),
8
+ cols: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.string])).description("Column layout cells")
9
+ };
10
+ export {
11
+ props
12
+ };
13
+ //# sourceMappingURL=props.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/props.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "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"],
5
+ "mappings": "AAAA;ACAA;AAEO,MAAM,QAAQ;AAAA,EAEnB,UAAU,UAAU,KAAK,YAAY;AAAA,EAErC,UAAU,UAAU,KAAK,YAAY;AAAA,EAErC,YAAY,UAAU,KAAK,YAAY;AAAA,EAEvC,MAAM,UAAU,QACd,UAAU,UAAU,CAAC,UAAU,QAAQ,UAAU,UACjD,YAAY;AAAA,EAEd,MAAM,UAAU,QACd,UAAU,UAAU,CAAC,UAAU,QAAQ,UAAU,UACjD,YAAY;AAAA;",
6
+ "names": []
7
+ }
package/package.json CHANGED
@@ -1,27 +1,30 @@
1
1
  {
2
2
  "name": "@elliemae/ds-resizeable-container",
3
- "version": "2.3.1",
3
+ "version": "3.0.0-alpha.3",
4
4
  "license": "MIT",
5
5
  "description": "ICE MT - Dimsum - Resizeable Container",
6
- "module": "./esm/index.js",
7
- "main": "./cjs/index.js",
8
- "types": "./types/index.d.ts",
6
+ "files": [
7
+ "dist"
8
+ ],
9
+ "module": "./dist/esm/index.js",
10
+ "main": "./dist/cjs/index.js",
11
+ "types": "./dist/types/index.d.ts",
9
12
  "exports": {
10
13
  ".": {
11
- "import": "./esm/index.js",
12
- "require": "./cjs/index.js"
14
+ "import": "./dist/esm/index.js",
15
+ "require": "./dist/cjs/index.js"
13
16
  },
14
17
  "./Resizable": {
15
- "import": "./esm/Resizable.js",
16
- "require": "./cjs/Resizable.js"
18
+ "import": "./dist/esm/Resizable.js",
19
+ "require": "./dist/cjs/Resizable.js"
17
20
  },
18
21
  "./props": {
19
- "import": "./esm/props.js",
20
- "require": "./cjs/props.js"
22
+ "import": "./dist/esm/props.js",
23
+ "require": "./dist/cjs/props.js"
21
24
  },
22
25
  "./defaultProps": {
23
- "import": "./esm/defaultProps.js",
24
- "require": "./cjs/defaultProps.js"
26
+ "import": "./dist/esm/defaultProps.js",
27
+ "require": "./dist/cjs/defaultProps.js"
25
28
  }
26
29
  },
27
30
  "sideEffects": [
@@ -33,23 +36,23 @@
33
36
  "url": "https://git.elliemae.io/platform-ui/dimsum.git"
34
37
  },
35
38
  "engines": {
36
- "npm": ">=7",
37
- "node": ">=14"
39
+ "pnpm": ">=6",
40
+ "node": ">=16"
38
41
  },
39
42
  "author": "ICE MT",
40
- "scripts": {
41
- "dev": "cross-env NODE_ENV=development && node ../../scripts/build/build.js -w",
42
- "prebuild": "exit 0",
43
- "predev": "exit 0",
44
- "build": "node ../../scripts/build/build.js"
43
+ "jestSonar": {
44
+ "sonar56x": true,
45
+ "reportPath": "reports",
46
+ "reportFile": "tests.xml",
47
+ "indent": 4
45
48
  },
46
49
  "dependencies": {
47
- "@elliemae/ds-grid": "2.3.1",
48
- "@elliemae/ds-system": "2.3.1",
50
+ "@elliemae/ds-grid": "3.0.0-alpha.3",
51
+ "@elliemae/ds-system": "3.0.0-alpha.3",
49
52
  "react-desc": "~4.1.3"
50
53
  },
51
54
  "devDependencies": {
52
- "@testing-library/jest-dom": "~5.15.0",
55
+ "@testing-library/jest-dom": "~5.15.1",
53
56
  "@testing-library/react": "~12.1.2",
54
57
  "@testing-library/user-event": "~13.5.0",
55
58
  "styled-components": "~5.3.3"
@@ -61,7 +64,13 @@
61
64
  },
62
65
  "publishConfig": {
63
66
  "access": "public",
64
- "directory": "dist",
65
- "generateSubmodules": true
67
+ "typeSafety": false
68
+ },
69
+ "scripts": {
70
+ "dev": "cross-env NODE_ENV=development node ../../scripts/build/build.mjs --watch",
71
+ "test": "node ../../scripts/testing/test.mjs",
72
+ "lint": "node ../../scripts/lint.mjs",
73
+ "dts": "node ../../scripts/dts.mjs",
74
+ "build": "cross-env NODE_ENV=production node ../../scripts/build/build.mjs"
66
75
  }
67
76
  }