@zendeskgarden/react-grid 8.50.1 → 8.53.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +62 -0
- package/dist/index.cjs.js +716 -30
- package/dist/index.esm.js +717 -34
- package/dist/typings/elements/pane/Pane.d.ts +18 -0
- package/dist/typings/elements/pane/PaneProvider.d.ts +23 -0
- package/dist/typings/elements/pane/components/Content.d.ts +11 -0
- package/dist/typings/elements/pane/components/Splitter.d.ts +12 -0
- package/dist/typings/elements/pane/components/SplitterButton.d.ts +12 -0
- package/dist/typings/index.d.ts +3 -1
- package/dist/typings/styled/index.d.ts +4 -0
- package/dist/typings/styled/pane/StyledPane.d.ts +10 -0
- package/dist/typings/styled/pane/StyledPaneContent.d.ts +10 -0
- package/dist/typings/styled/pane/StyledPaneSplitter.d.ts +20 -0
- package/dist/typings/styled/pane/StyledPaneSplitterButton.d.ts +19 -0
- package/dist/typings/types/index.d.ts +61 -1
- package/dist/typings/utils/usePaneContext.d.ts +17 -0
- package/dist/typings/utils/usePaneProviderContext.d.ts +29 -0
- package/dist/typings/utils/usePaneSplitterContext.d.ts +23 -0
- package/package.json +10 -4
package/dist/index.cjs.js
CHANGED
|
@@ -14,12 +14,59 @@ var PropTypes = require('prop-types');
|
|
|
14
14
|
var styled = require('styled-components');
|
|
15
15
|
var polished = require('polished');
|
|
16
16
|
var reactTheming = require('@zendeskgarden/react-theming');
|
|
17
|
+
var reactButtons = require('@zendeskgarden/react-buttons');
|
|
18
|
+
var containerUtilities = require('@zendeskgarden/container-utilities');
|
|
19
|
+
var mergeRefs = require('react-merge-refs');
|
|
20
|
+
var containerSplitter = require('@zendeskgarden/container-splitter');
|
|
21
|
+
var reactTooltips = require('@zendeskgarden/react-tooltips');
|
|
17
22
|
|
|
18
23
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
19
24
|
|
|
20
25
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
21
26
|
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
22
27
|
var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
|
|
28
|
+
var mergeRefs__default = /*#__PURE__*/_interopDefaultLegacy(mergeRefs);
|
|
29
|
+
|
|
30
|
+
function ownKeys(object, enumerableOnly) {
|
|
31
|
+
var keys = Object.keys(object);
|
|
32
|
+
|
|
33
|
+
if (Object.getOwnPropertySymbols) {
|
|
34
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
35
|
+
enumerableOnly && (symbols = symbols.filter(function (sym) {
|
|
36
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
37
|
+
})), keys.push.apply(keys, symbols);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return keys;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function _objectSpread2(target) {
|
|
44
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
45
|
+
var source = null != arguments[i] ? arguments[i] : {};
|
|
46
|
+
i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
|
|
47
|
+
_defineProperty(target, key, source[key]);
|
|
48
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
|
|
49
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return target;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function _defineProperty(obj, key, value) {
|
|
57
|
+
if (key in obj) {
|
|
58
|
+
Object.defineProperty(obj, key, {
|
|
59
|
+
value: value,
|
|
60
|
+
enumerable: true,
|
|
61
|
+
configurable: true,
|
|
62
|
+
writable: true
|
|
63
|
+
});
|
|
64
|
+
} else {
|
|
65
|
+
obj[key] = value;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
return obj;
|
|
69
|
+
}
|
|
23
70
|
|
|
24
71
|
function _extends() {
|
|
25
72
|
_extends = Object.assign || function (target) {
|
|
@@ -75,6 +122,65 @@ function _objectWithoutProperties(source, excluded) {
|
|
|
75
122
|
return target;
|
|
76
123
|
}
|
|
77
124
|
|
|
125
|
+
function _slicedToArray(arr, i) {
|
|
126
|
+
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
function _arrayWithHoles(arr) {
|
|
130
|
+
if (Array.isArray(arr)) return arr;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
function _iterableToArrayLimit(arr, i) {
|
|
134
|
+
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
135
|
+
|
|
136
|
+
if (_i == null) return;
|
|
137
|
+
var _arr = [];
|
|
138
|
+
var _n = true;
|
|
139
|
+
var _d = false;
|
|
140
|
+
|
|
141
|
+
var _s, _e;
|
|
142
|
+
|
|
143
|
+
try {
|
|
144
|
+
for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
|
|
145
|
+
_arr.push(_s.value);
|
|
146
|
+
|
|
147
|
+
if (i && _arr.length === i) break;
|
|
148
|
+
}
|
|
149
|
+
} catch (err) {
|
|
150
|
+
_d = true;
|
|
151
|
+
_e = err;
|
|
152
|
+
} finally {
|
|
153
|
+
try {
|
|
154
|
+
if (!_n && _i["return"] != null) _i["return"]();
|
|
155
|
+
} finally {
|
|
156
|
+
if (_d) throw _e;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
return _arr;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
function _unsupportedIterableToArray(o, minLen) {
|
|
164
|
+
if (!o) return;
|
|
165
|
+
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
166
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
167
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
168
|
+
if (n === "Map" || n === "Set") return Array.from(o);
|
|
169
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
function _arrayLikeToArray(arr, len) {
|
|
173
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
174
|
+
|
|
175
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
176
|
+
|
|
177
|
+
return arr2;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
function _nonIterableRest() {
|
|
181
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
182
|
+
}
|
|
183
|
+
|
|
78
184
|
var ALIGN_ITEMS = ['start', 'end', 'center', 'baseline', 'stretch'];
|
|
79
185
|
var ALIGN_SELF = ['auto'].concat(ALIGN_ITEMS);
|
|
80
186
|
var DIRECTION = ['row', 'row-reverse', 'column', 'column-reverse'];
|
|
@@ -82,9 +188,10 @@ var JUSTIFY_CONTENT = ['start', 'end', 'center', 'between', 'around'];
|
|
|
82
188
|
var TEXT_ALIGN = ['start', 'end', 'center', 'justify'];
|
|
83
189
|
var SPACE = [false, 'xxs', 'xs', 'sm', 'md', 'lg', 'xl', 'xxl'];
|
|
84
190
|
var WRAP = ['nowrap', 'wrap', 'wrap-reverse'];
|
|
191
|
+
var ORIENTATION = ['top', 'bottom', 'start', 'end'];
|
|
85
192
|
|
|
86
|
-
var COMPONENT_ID$
|
|
87
|
-
var colorStyles$
|
|
193
|
+
var COMPONENT_ID$6 = 'grid.col';
|
|
194
|
+
var colorStyles$3 = function colorStyles(props) {
|
|
88
195
|
var backgroundColor = reactTheming.getColor('primaryHue', 600, props.theme, 0.1);
|
|
89
196
|
return styled.css(["background-clip:content-box;background-color:", ";"], backgroundColor);
|
|
90
197
|
};
|
|
@@ -129,22 +236,22 @@ var flexStyles$1 = function flexStyles(size, alignSelf, textAlign, offset, order
|
|
|
129
236
|
var mediaStyles$1 = function mediaStyles(minWidth, size, alignSelf, textAlign, offset, order, props) {
|
|
130
237
|
return styled.css(["@media (min-width:", "){", ";}"], minWidth, flexStyles$1(size, alignSelf, textAlign, offset, order, props));
|
|
131
238
|
};
|
|
132
|
-
var sizeStyles$
|
|
239
|
+
var sizeStyles$4 = function sizeStyles(props) {
|
|
133
240
|
var padding = props.gutters ? polished.math("".concat(props.theme.space[props.gutters], " / 2")) : 0;
|
|
134
241
|
return styled.css(["padding-right:", ";padding-left:", ";"], padding, padding);
|
|
135
242
|
};
|
|
136
243
|
var StyledCol = styled__default["default"].div.attrs({
|
|
137
|
-
'data-garden-id': COMPONENT_ID$
|
|
138
|
-
'data-garden-version': '8.
|
|
244
|
+
'data-garden-id': COMPONENT_ID$6,
|
|
245
|
+
'data-garden-version': '8.53.0'
|
|
139
246
|
}).withConfig({
|
|
140
247
|
displayName: "StyledCol",
|
|
141
248
|
componentId: "sc-inuw62-0"
|
|
142
249
|
})(["box-sizing:border-box;width:100%;", ";", ";", ";", ";", ";", ";", ";", ";", ";"], function (props) {
|
|
143
250
|
return flexStyles$1(!props.sizeAll && (props.xs || props.sm || props.md || props.lg || props.xl) ? undefined : props.sizeAll || false, props.alignSelf, props.textAlign, props.offset, props.order, props);
|
|
144
251
|
}, function (props) {
|
|
145
|
-
return sizeStyles$
|
|
252
|
+
return sizeStyles$4(props);
|
|
146
253
|
}, function (props) {
|
|
147
|
-
return props.debug && colorStyles$
|
|
254
|
+
return props.debug && colorStyles$3(props);
|
|
148
255
|
}, function (props) {
|
|
149
256
|
return mediaStyles$1(props.theme.breakpoints.xs, props.xs, props.alignSelfXs, props.textAlignXs, props.offsetXs, props.orderXs, props);
|
|
150
257
|
}, function (props) {
|
|
@@ -156,45 +263,45 @@ var StyledCol = styled__default["default"].div.attrs({
|
|
|
156
263
|
}, function (props) {
|
|
157
264
|
return mediaStyles$1(props.theme.breakpoints.xl, props.xl, props.alignSelfXl, props.textAlignXl, props.offsetXl, props.orderXl, props);
|
|
158
265
|
}, function (props) {
|
|
159
|
-
return reactTheming.retrieveComponentStyles(COMPONENT_ID$
|
|
266
|
+
return reactTheming.retrieveComponentStyles(COMPONENT_ID$6, props);
|
|
160
267
|
});
|
|
161
268
|
StyledCol.defaultProps = {
|
|
162
269
|
columns: 12,
|
|
163
270
|
theme: reactTheming.DEFAULT_THEME
|
|
164
271
|
};
|
|
165
272
|
|
|
166
|
-
var COMPONENT_ID$
|
|
167
|
-
var colorStyles$
|
|
273
|
+
var COMPONENT_ID$5 = 'grid.grid';
|
|
274
|
+
var colorStyles$2 = function colorStyles(props) {
|
|
168
275
|
var borderColor = reactTheming.getColor(props.theme.palette.crimson, 400, props.theme, 0.5);
|
|
169
276
|
var borderWidth = polished.math("".concat(props.theme.borderWidths.sm, " * 2"));
|
|
170
277
|
return styled.css(["box-shadow:-", " 0 0 0 ", ",", " 0 0 0 ", ";"], borderWidth, borderColor, borderWidth, borderColor);
|
|
171
278
|
};
|
|
172
|
-
var sizeStyles$
|
|
279
|
+
var sizeStyles$3 = function sizeStyles(props) {
|
|
173
280
|
var padding = props.gutters ? polished.math("".concat(props.theme.space[props.gutters], " / 2")) : 0;
|
|
174
281
|
return styled.css(["padding-right:", ";padding-left:", ";"], padding, padding);
|
|
175
282
|
};
|
|
176
283
|
var StyledGrid = styled__default["default"].div.attrs({
|
|
177
|
-
'data-garden-id': COMPONENT_ID$
|
|
178
|
-
'data-garden-version': '8.
|
|
284
|
+
'data-garden-id': COMPONENT_ID$5,
|
|
285
|
+
'data-garden-version': '8.53.0'
|
|
179
286
|
}).withConfig({
|
|
180
287
|
displayName: "StyledGrid",
|
|
181
288
|
componentId: "sc-oxgg5i-0"
|
|
182
289
|
})(["direction:", ";margin-right:auto;margin-left:auto;width:100%;box-sizing:border-box;", ";", ";", ";"], function (props) {
|
|
183
290
|
return props.theme.rtl && 'rtl';
|
|
184
291
|
}, function (props) {
|
|
185
|
-
return sizeStyles$
|
|
292
|
+
return sizeStyles$3(props);
|
|
186
293
|
}, function (props) {
|
|
187
|
-
return props.debug && colorStyles$
|
|
294
|
+
return props.debug && colorStyles$2(props);
|
|
188
295
|
}, function (props) {
|
|
189
|
-
return reactTheming.retrieveComponentStyles(COMPONENT_ID$
|
|
296
|
+
return reactTheming.retrieveComponentStyles(COMPONENT_ID$5, props);
|
|
190
297
|
});
|
|
191
298
|
StyledGrid.defaultProps = {
|
|
192
299
|
gutters: 'md',
|
|
193
300
|
theme: reactTheming.DEFAULT_THEME
|
|
194
301
|
};
|
|
195
302
|
|
|
196
|
-
var COMPONENT_ID = 'grid.row';
|
|
197
|
-
var colorStyles = function colorStyles(props) {
|
|
303
|
+
var COMPONENT_ID$4 = 'grid.row';
|
|
304
|
+
var colorStyles$1 = function colorStyles(props) {
|
|
198
305
|
var borderColor = reactTheming.getColor(props.theme.palette.mint, 600, props.theme, 0.5);
|
|
199
306
|
var borderWidth = props.theme.borderWidths.sm;
|
|
200
307
|
return styled.css(["box-shadow:inset 0 ", " 0 0 ", ",inset 0 -", " 0 0 ", ";"], borderWidth, borderColor, borderWidth, borderColor);
|
|
@@ -219,22 +326,22 @@ var flexStyles = function flexStyles(alignItems, justifyContent, wrap) {
|
|
|
219
326
|
var mediaStyles = function mediaStyles(minWidth, alignItems, justifyContent, wrap) {
|
|
220
327
|
return styled.css(["@media (min-width:", "){", ";}"], minWidth, flexStyles(alignItems, justifyContent, wrap));
|
|
221
328
|
};
|
|
222
|
-
var sizeStyles = function sizeStyles(props) {
|
|
329
|
+
var sizeStyles$2 = function sizeStyles(props) {
|
|
223
330
|
var margin = props.gutters ? polished.math("".concat(props.theme.space[props.gutters], " / 2")) : 0;
|
|
224
331
|
return styled.css(["margin-right:-", ";margin-left:-", ";"], margin, margin);
|
|
225
332
|
};
|
|
226
333
|
var StyledRow = styled__default["default"].div.attrs({
|
|
227
|
-
'data-garden-id': COMPONENT_ID,
|
|
228
|
-
'data-garden-version': '8.
|
|
334
|
+
'data-garden-id': COMPONENT_ID$4,
|
|
335
|
+
'data-garden-version': '8.53.0'
|
|
229
336
|
}).withConfig({
|
|
230
337
|
displayName: "StyledRow",
|
|
231
338
|
componentId: "sc-xjsdg1-0"
|
|
232
339
|
})(["display:flex;box-sizing:border-box;", " ", ";", ";", ";", ";", ";", ";", ";", ";"], function (props) {
|
|
233
340
|
return flexStyles(props.alignItems, props.justifyContent, props.wrapAll);
|
|
234
341
|
}, function (props) {
|
|
235
|
-
return sizeStyles(props);
|
|
342
|
+
return sizeStyles$2(props);
|
|
236
343
|
}, function (props) {
|
|
237
|
-
return props.debug && colorStyles(props);
|
|
344
|
+
return props.debug && colorStyles$1(props);
|
|
238
345
|
}, function (props) {
|
|
239
346
|
return mediaStyles(props.theme.breakpoints.xs, props.alignItemsXs, props.justifyContentXs, props.wrapXs);
|
|
240
347
|
}, function (props) {
|
|
@@ -246,13 +353,179 @@ var StyledRow = styled__default["default"].div.attrs({
|
|
|
246
353
|
}, function (props) {
|
|
247
354
|
return mediaStyles(props.theme.breakpoints.xl, props.alignItemsXl, props.justifyContentXl, props.wrapXl);
|
|
248
355
|
}, function (props) {
|
|
249
|
-
return reactTheming.retrieveComponentStyles(COMPONENT_ID, props);
|
|
356
|
+
return reactTheming.retrieveComponentStyles(COMPONENT_ID$4, props);
|
|
250
357
|
});
|
|
251
358
|
StyledRow.defaultProps = {
|
|
252
359
|
wrapAll: 'wrap',
|
|
253
360
|
theme: reactTheming.DEFAULT_THEME
|
|
254
361
|
};
|
|
255
362
|
|
|
363
|
+
var COMPONENT_ID$3 = 'pane';
|
|
364
|
+
var StyledPane = styled__default["default"].div.attrs({
|
|
365
|
+
'data-garden-id': COMPONENT_ID$3,
|
|
366
|
+
'data-garden-version': '8.53.0'
|
|
367
|
+
}).withConfig({
|
|
368
|
+
displayName: "StyledPane",
|
|
369
|
+
componentId: "sc-1ltjst7-0"
|
|
370
|
+
})(["position:relative;min-width:0;min-height:0;", ";"], function (props) {
|
|
371
|
+
return reactTheming.retrieveComponentStyles(COMPONENT_ID$3, props);
|
|
372
|
+
});
|
|
373
|
+
StyledPane.defaultProps = {
|
|
374
|
+
theme: reactTheming.DEFAULT_THEME
|
|
375
|
+
};
|
|
376
|
+
|
|
377
|
+
var COMPONENT_ID$2 = 'pane.content';
|
|
378
|
+
var StyledPaneContent = styled__default["default"].div.attrs({
|
|
379
|
+
'data-garden-id': COMPONENT_ID$2,
|
|
380
|
+
'data-garden-version': '8.53.0'
|
|
381
|
+
}).withConfig({
|
|
382
|
+
displayName: "StyledPaneContent",
|
|
383
|
+
componentId: "sc-1b38mbh-0"
|
|
384
|
+
})(["height:100%;overflow:auto;", ";"], function (props) {
|
|
385
|
+
return reactTheming.retrieveComponentStyles(COMPONENT_ID$2, props);
|
|
386
|
+
});
|
|
387
|
+
StyledPaneContent.defaultProps = {
|
|
388
|
+
theme: reactTheming.DEFAULT_THEME
|
|
389
|
+
};
|
|
390
|
+
|
|
391
|
+
var COMPONENT_ID$1 = 'pane.splitter';
|
|
392
|
+
var colorStyles = function colorStyles(props) {
|
|
393
|
+
var color = reactTheming.getColor('neutralHue', 300, props.theme);
|
|
394
|
+
var hoverColor = reactTheming.getColor('primaryHue', 600, props.theme);
|
|
395
|
+
var activeColor = reactTheming.getColor('primaryHue', 800, props.theme);
|
|
396
|
+
var boxShadow = props.theme.shadows.md(polished.rgba(hoverColor, 0.35));
|
|
397
|
+
return styled.css(["&::before{background-color:", ";}&:hover::before,&[data-garden-focus-visible]::before{background-color:", ";}&[data-garden-focus-visible]::before{box-shadow:", ";}&:active::before{background-color:", ";}"], color, hoverColor, boxShadow, activeColor);
|
|
398
|
+
};
|
|
399
|
+
var sizeStyles$1 = function sizeStyles(props) {
|
|
400
|
+
var size = polished.math("".concat(props.theme.shadowWidths.md, " * 2"));
|
|
401
|
+
var offset = polished.math("-".concat(size, " / 2"));
|
|
402
|
+
var cursor;
|
|
403
|
+
var top;
|
|
404
|
+
var right;
|
|
405
|
+
var left;
|
|
406
|
+
var bottom;
|
|
407
|
+
var width;
|
|
408
|
+
var height;
|
|
409
|
+
var separatorWidth;
|
|
410
|
+
var separatorHeight;
|
|
411
|
+
switch (props.orientation) {
|
|
412
|
+
case 'top':
|
|
413
|
+
cursor = 'row-resize';
|
|
414
|
+
top = offset;
|
|
415
|
+
width = '100%';
|
|
416
|
+
height = size;
|
|
417
|
+
separatorWidth = width;
|
|
418
|
+
separatorHeight = props.theme.borderWidths.sm;
|
|
419
|
+
break;
|
|
420
|
+
case 'end':
|
|
421
|
+
cursor = 'col-resize';
|
|
422
|
+
top = 0;
|
|
423
|
+
width = size;
|
|
424
|
+
height = '100%';
|
|
425
|
+
separatorWidth = props.theme.borderWidths.sm;
|
|
426
|
+
separatorHeight = height;
|
|
427
|
+
if (props.theme.rtl) {
|
|
428
|
+
left = offset;
|
|
429
|
+
} else {
|
|
430
|
+
right = offset;
|
|
431
|
+
}
|
|
432
|
+
break;
|
|
433
|
+
case 'bottom':
|
|
434
|
+
cursor = 'row-resize';
|
|
435
|
+
bottom = offset;
|
|
436
|
+
width = '100%';
|
|
437
|
+
height = size;
|
|
438
|
+
separatorWidth = width;
|
|
439
|
+
separatorHeight = props.theme.borderWidths.sm;
|
|
440
|
+
break;
|
|
441
|
+
case 'start':
|
|
442
|
+
cursor = 'col-resize';
|
|
443
|
+
top = 0;
|
|
444
|
+
width = size;
|
|
445
|
+
height = '100%';
|
|
446
|
+
separatorWidth = props.theme.borderWidths.sm;
|
|
447
|
+
separatorHeight = height;
|
|
448
|
+
if (props.theme.rtl) {
|
|
449
|
+
right = offset;
|
|
450
|
+
} else {
|
|
451
|
+
left = offset;
|
|
452
|
+
}
|
|
453
|
+
break;
|
|
454
|
+
}
|
|
455
|
+
return styled.css(["top:", ";right:", ";bottom:", ";left:", ";cursor:", ";width:", ";height:", ";&::before{width:", ";height:", ";}&:hover::before,&[data-garden-focus-visible]::before,&:focus::before{", ":", ";}&[data-garden-focus-visible]::before{border-radius:", ";}"], top, right, bottom, left, cursor, width, height, separatorWidth, separatorHeight, width === '100%' ? 'height' : 'width', polished.math("".concat(props.theme.borderWidths.sm, " * 2")), props.theme.borderRadii.md);
|
|
456
|
+
};
|
|
457
|
+
var StyledPaneSplitter = styled__default["default"].div.attrs({
|
|
458
|
+
'data-garden-id': COMPONENT_ID$1,
|
|
459
|
+
'data-garden-version': '8.53.0'
|
|
460
|
+
}).withConfig({
|
|
461
|
+
displayName: "StyledPaneSplitter",
|
|
462
|
+
componentId: "sc-jylemn-0"
|
|
463
|
+
})(["display:flex;position:absolute;align-items:center;justify-content:center;z-index:1;user-select:none;", ";&:focus{outline:none;}&::before{position:absolute;transition:box-shadow 0.1s ease-in-out,background-color 0.25s ease-in-out;z-index:-1;content:'';}", ";", ";"], sizeStyles$1, colorStyles, function (props) {
|
|
464
|
+
return reactTheming.retrieveComponentStyles(COMPONENT_ID$1, props);
|
|
465
|
+
});
|
|
466
|
+
StyledPaneSplitter.defaultProps = {
|
|
467
|
+
theme: reactTheming.DEFAULT_THEME
|
|
468
|
+
};
|
|
469
|
+
|
|
470
|
+
var COMPONENT_ID = 'pane.splitter_button';
|
|
471
|
+
var transformStyles = function transformStyles(props) {
|
|
472
|
+
var degrees = 0;
|
|
473
|
+
if (props.isRotated) {
|
|
474
|
+
degrees = props.theme.rtl ? -180 : 180;
|
|
475
|
+
}
|
|
476
|
+
if (props.orientation === 'end') {
|
|
477
|
+
degrees += props.theme.rtl ? -90 : 90;
|
|
478
|
+
} else if (props.orientation === 'start') {
|
|
479
|
+
degrees += props.theme.rtl ? 90 : -90;
|
|
480
|
+
} else if (props.orientation === 'bottom') {
|
|
481
|
+
degrees += 180;
|
|
482
|
+
}
|
|
483
|
+
return styled.css(["& > svg{transform:rotate(", "deg);}"], degrees);
|
|
484
|
+
};
|
|
485
|
+
var sizeStyles = function sizeStyles(props) {
|
|
486
|
+
var size = "".concat(props.theme.space.base * 6, "px");
|
|
487
|
+
var isVertical = props.orientation === 'start' || props.orientation === 'end';
|
|
488
|
+
var top;
|
|
489
|
+
var left;
|
|
490
|
+
var right;
|
|
491
|
+
var bottom;
|
|
492
|
+
if (props.placement === 'start') {
|
|
493
|
+
if (isVertical) {
|
|
494
|
+
top = size;
|
|
495
|
+
} else if (props.theme.rtl) {
|
|
496
|
+
right = size;
|
|
497
|
+
} else {
|
|
498
|
+
left = size;
|
|
499
|
+
}
|
|
500
|
+
} else if (props.placement === 'end') {
|
|
501
|
+
if (isVertical) {
|
|
502
|
+
bottom = size;
|
|
503
|
+
} else if (props.theme.rtl) {
|
|
504
|
+
left = size;
|
|
505
|
+
} else {
|
|
506
|
+
right = size;
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
return styled.css(["top:", ";right:", ";bottom:", ";left:", ";width:", ";min-width:", ";height:", ";"], top, right, bottom, left, size, size, size);
|
|
510
|
+
};
|
|
511
|
+
var StyledPaneSplitterButton = styled__default["default"](reactButtons.ChevronButton).attrs({
|
|
512
|
+
'data-garden-id': COMPONENT_ID,
|
|
513
|
+
'data-garden-version': '8.53.0',
|
|
514
|
+
isBasic: true,
|
|
515
|
+
isPill: true,
|
|
516
|
+
size: 'small'
|
|
517
|
+
}).withConfig({
|
|
518
|
+
displayName: "StyledPaneSplitterButton",
|
|
519
|
+
componentId: "sc-zh032e-0"
|
|
520
|
+
})(["position:absolute;transition:box-shadow 0.1s ease-in-out,background-color 0.25s ease-in-out,opacity 0.25s ease-in-out 0.1s;opacity:0;&[data-garden-focus-visible],", ":hover &,", "[data-garden-focus-visible] &{opacity:1;}", ";", ";&::before{position:absolute;z-index:-1;background-color:", ";width:100%;height:100%;content:'';}", ";"], StyledPaneSplitter, StyledPaneSplitter, sizeStyles, transformStyles, function (props) {
|
|
521
|
+
return props.theme.colors.background;
|
|
522
|
+
}, function (props) {
|
|
523
|
+
return reactTheming.retrieveComponentStyles(COMPONENT_ID, props);
|
|
524
|
+
});
|
|
525
|
+
StyledPaneSplitterButton.defaultProps = {
|
|
526
|
+
theme: reactTheming.DEFAULT_THEME
|
|
527
|
+
};
|
|
528
|
+
|
|
256
529
|
var GridContext = React.createContext({
|
|
257
530
|
gutters: 'md'
|
|
258
531
|
});
|
|
@@ -260,10 +533,10 @@ var useGridContext = function useGridContext() {
|
|
|
260
533
|
return React.useContext(GridContext);
|
|
261
534
|
};
|
|
262
535
|
|
|
263
|
-
var _excluded$
|
|
536
|
+
var _excluded$4 = ["size"];
|
|
264
537
|
var Col = React__default["default"].forwardRef(function (_ref, ref) {
|
|
265
538
|
var size = _ref.size,
|
|
266
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
539
|
+
props = _objectWithoutProperties(_ref, _excluded$4);
|
|
267
540
|
var _useGridContext = useGridContext(),
|
|
268
541
|
columns = _useGridContext.columns,
|
|
269
542
|
gutters = _useGridContext.gutters,
|
|
@@ -310,11 +583,11 @@ Col.propTypes = {
|
|
|
310
583
|
orderXl: PropTypes__default["default"].oneOfType([PropTypes__default["default"].number, PropTypes__default["default"].string])
|
|
311
584
|
};
|
|
312
585
|
|
|
313
|
-
var _excluded$
|
|
586
|
+
var _excluded$3 = ["columns", "debug"];
|
|
314
587
|
var Grid = React__default["default"].forwardRef(function (_ref, ref) {
|
|
315
588
|
var columns = _ref.columns,
|
|
316
589
|
debug = _ref.debug,
|
|
317
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
590
|
+
props = _objectWithoutProperties(_ref, _excluded$3);
|
|
318
591
|
var value = React.useMemo(function () {
|
|
319
592
|
return {
|
|
320
593
|
columns: columns,
|
|
@@ -340,10 +613,10 @@ Grid.defaultProps = {
|
|
|
340
613
|
gutters: 'md'
|
|
341
614
|
};
|
|
342
615
|
|
|
343
|
-
var _excluded = ["wrap"];
|
|
616
|
+
var _excluded$2 = ["wrap"];
|
|
344
617
|
var Row = React__default["default"].forwardRef(function (_ref, ref) {
|
|
345
618
|
var wrap = _ref.wrap,
|
|
346
|
-
props = _objectWithoutProperties(_ref, _excluded);
|
|
619
|
+
props = _objectWithoutProperties(_ref, _excluded$2);
|
|
347
620
|
var _useGridContext = useGridContext(),
|
|
348
621
|
gutters = _useGridContext.gutters,
|
|
349
622
|
debug = _useGridContext.debug;
|
|
@@ -376,6 +649,417 @@ Row.propTypes = {
|
|
|
376
649
|
wrapXl: PropTypes__default["default"].oneOf(WRAP)
|
|
377
650
|
};
|
|
378
651
|
|
|
652
|
+
var PaneProviderContext = React.createContext({});
|
|
653
|
+
var usePaneProviderContextData = function usePaneProviderContextData(providerId) {
|
|
654
|
+
var context = React.useContext(PaneProviderContext);
|
|
655
|
+
var id = providerId || context.providerId;
|
|
656
|
+
return id && context.contextData ? context.contextData[id] : undefined;
|
|
657
|
+
};
|
|
658
|
+
var usePaneProviderContext = function usePaneProviderContext() {
|
|
659
|
+
return React.useContext(PaneProviderContext);
|
|
660
|
+
};
|
|
661
|
+
|
|
662
|
+
var getPixelsPerFr = function getPixelsPerFr(totalFrs, totalDimension) {
|
|
663
|
+
return totalDimension / totalFrs;
|
|
664
|
+
};
|
|
665
|
+
var convertToPixels = function convertToPixels(values, pixelsPerFr) {
|
|
666
|
+
return Object.entries(values).reduce(function (prev, _ref) {
|
|
667
|
+
var _ref2 = _slicedToArray(_ref, 2),
|
|
668
|
+
key = _ref2[0],
|
|
669
|
+
value = _ref2[1];
|
|
670
|
+
prev[key] = value * pixelsPerFr;
|
|
671
|
+
return prev;
|
|
672
|
+
}, {});
|
|
673
|
+
};
|
|
674
|
+
var PaneProvider = function PaneProvider(_ref3) {
|
|
675
|
+
var id = _ref3.id,
|
|
676
|
+
totalPanesWidth = _ref3.totalPanesWidth,
|
|
677
|
+
totalPanesHeight = _ref3.totalPanesHeight,
|
|
678
|
+
defaultRowValues = _ref3.defaultRowValues,
|
|
679
|
+
defaultColumnValues = _ref3.defaultColumnValues,
|
|
680
|
+
rowValues = _ref3.rowValues,
|
|
681
|
+
columnValues = _ref3.columnValues,
|
|
682
|
+
onChange = _ref3.onChange,
|
|
683
|
+
children = _ref3.children;
|
|
684
|
+
var isControlled = rowValues !== undefined && rowValues !== null && columnValues !== undefined && columnValues !== null;
|
|
685
|
+
var _useState = React.useState(defaultRowValues || {}),
|
|
686
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
687
|
+
rowState = _useState2[0],
|
|
688
|
+
setRowState = _useState2[1];
|
|
689
|
+
var _useState3 = React.useState(defaultColumnValues || {}),
|
|
690
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
691
|
+
columnState = _useState4[0],
|
|
692
|
+
setColumnState = _useState4[1];
|
|
693
|
+
var rowsTrack = isControlled ? rowValues : rowState;
|
|
694
|
+
var columnsTrack = isControlled ? columnValues : columnState;
|
|
695
|
+
var setRowsTrack = React.useCallback(function (values) {
|
|
696
|
+
if (isControlled && onChange) {
|
|
697
|
+
return onChange(values(rowsTrack), columnsTrack);
|
|
698
|
+
}
|
|
699
|
+
return setRowState(values);
|
|
700
|
+
}, [isControlled, onChange, setRowState, columnsTrack, rowsTrack]);
|
|
701
|
+
var setColumnsTrack = React.useCallback(function (values) {
|
|
702
|
+
if (isControlled && onChange) {
|
|
703
|
+
return onChange(rowsTrack, values(columnsTrack));
|
|
704
|
+
}
|
|
705
|
+
return setColumnState(values);
|
|
706
|
+
}, [isControlled, onChange, setColumnState, rowsTrack, columnsTrack]);
|
|
707
|
+
var totalFractions = React.useMemo(function () {
|
|
708
|
+
return {
|
|
709
|
+
rows: Object.values(rowsTrack).reduce(function (prev, value) {
|
|
710
|
+
return value + prev;
|
|
711
|
+
}, 0),
|
|
712
|
+
columns: Object.values(columnsTrack).reduce(function (prev, value) {
|
|
713
|
+
return value + prev;
|
|
714
|
+
}, 0)
|
|
715
|
+
};
|
|
716
|
+
}, [rowsTrack, columnsTrack]);
|
|
717
|
+
var pixelsPerFr = React.useMemo(function () {
|
|
718
|
+
return {
|
|
719
|
+
rows: getPixelsPerFr(totalFractions.rows, totalPanesHeight),
|
|
720
|
+
columns: getPixelsPerFr(totalFractions.columns, totalPanesWidth)
|
|
721
|
+
};
|
|
722
|
+
}, [totalFractions, totalPanesHeight, totalPanesWidth]);
|
|
723
|
+
var layoutStateInPixels = React.useMemo(function () {
|
|
724
|
+
return {
|
|
725
|
+
rows: convertToPixels(rowsTrack, pixelsPerFr.rows),
|
|
726
|
+
columns: convertToPixels(columnsTrack, pixelsPerFr.columns)
|
|
727
|
+
};
|
|
728
|
+
}, [rowsTrack, columnsTrack, pixelsPerFr]);
|
|
729
|
+
var layoutIndices = React.useMemo(function () {
|
|
730
|
+
var rowArray = Object.keys(rowsTrack);
|
|
731
|
+
var columnArray = Object.keys(columnsTrack);
|
|
732
|
+
var rows = rowArray.reduce(function (prev, key, index) {
|
|
733
|
+
prev[key] = index;
|
|
734
|
+
return prev;
|
|
735
|
+
}, {});
|
|
736
|
+
var columns = columnArray.reduce(function (prev, key, index) {
|
|
737
|
+
prev[key] = index;
|
|
738
|
+
return prev;
|
|
739
|
+
}, {});
|
|
740
|
+
return {
|
|
741
|
+
rows: rows,
|
|
742
|
+
columns: columns,
|
|
743
|
+
rowArray: rowArray,
|
|
744
|
+
columnArray: columnArray
|
|
745
|
+
};
|
|
746
|
+
}, [rowsTrack, columnsTrack]);
|
|
747
|
+
var setRowValue = React.useCallback(function (isTop, splitterId, value) {
|
|
748
|
+
var rows = layoutIndices.rows,
|
|
749
|
+
rowArray = layoutIndices.rowArray;
|
|
750
|
+
var stealFromTraversal = isTop ? -1 : 1;
|
|
751
|
+
var addToTraversal = 0;
|
|
752
|
+
setRowsTrack(function (state) {
|
|
753
|
+
var oldValue = rowsTrack[splitterId];
|
|
754
|
+
var stealFromIndex = rows[splitterId] + stealFromTraversal;
|
|
755
|
+
var addToIndex = rows[splitterId] + addToTraversal;
|
|
756
|
+
var stealFromKey = rowArray[stealFromIndex];
|
|
757
|
+
var addToKey = rowArray[addToIndex];
|
|
758
|
+
var difference = oldValue - value;
|
|
759
|
+
var nextState = _objectSpread2({}, state);
|
|
760
|
+
nextState[addToKey] = rowsTrack[addToKey] - difference;
|
|
761
|
+
nextState[stealFromKey] = rowsTrack[stealFromKey] + difference;
|
|
762
|
+
return nextState;
|
|
763
|
+
});
|
|
764
|
+
}, [layoutIndices, rowsTrack, setRowsTrack]);
|
|
765
|
+
var setColumnValue = React.useCallback(function (isStart, splitterId, value) {
|
|
766
|
+
var columns = layoutIndices.columns,
|
|
767
|
+
columnArray = layoutIndices.columnArray;
|
|
768
|
+
var stealFromTraversal = isStart ? -1 : 1;
|
|
769
|
+
var addToTraversal = 0;
|
|
770
|
+
setColumnsTrack(function (state) {
|
|
771
|
+
var stealFromIndex = columns[splitterId] + stealFromTraversal;
|
|
772
|
+
var addToIndex = columns[splitterId] + addToTraversal;
|
|
773
|
+
var oldValue = columnsTrack[splitterId];
|
|
774
|
+
var stealFromKey = columnArray[stealFromIndex];
|
|
775
|
+
var addToKey = columnArray[addToIndex];
|
|
776
|
+
var difference = oldValue - value;
|
|
777
|
+
var nextState = _objectSpread2({}, state);
|
|
778
|
+
nextState[addToKey] = columnsTrack[addToKey] - difference;
|
|
779
|
+
nextState[stealFromKey] = columnsTrack[stealFromKey] + difference;
|
|
780
|
+
return nextState;
|
|
781
|
+
});
|
|
782
|
+
}, [layoutIndices, columnsTrack, setColumnsTrack]);
|
|
783
|
+
var getColumnValue = React.useCallback(function (splitterKey, isPixels) {
|
|
784
|
+
if (isPixels) {
|
|
785
|
+
return layoutStateInPixels.columns[splitterKey];
|
|
786
|
+
}
|
|
787
|
+
return columnsTrack[splitterKey];
|
|
788
|
+
}, [columnsTrack, layoutStateInPixels]);
|
|
789
|
+
var getRowValue = React.useCallback(function (splitterKey, isPixels) {
|
|
790
|
+
if (isPixels) {
|
|
791
|
+
return layoutStateInPixels.rows[splitterKey];
|
|
792
|
+
}
|
|
793
|
+
return rowsTrack[splitterKey];
|
|
794
|
+
}, [rowsTrack, layoutStateInPixels]);
|
|
795
|
+
var getGridTemplateColumns = React.useCallback(function (isPixels) {
|
|
796
|
+
var columnArray = layoutIndices.columnArray;
|
|
797
|
+
if (isPixels) {
|
|
798
|
+
return columnArray.map(function (col) {
|
|
799
|
+
return "".concat(layoutStateInPixels.columns[col], "px");
|
|
800
|
+
}).join(' ');
|
|
801
|
+
}
|
|
802
|
+
return columnArray.map(function (col) {
|
|
803
|
+
return "".concat(columnsTrack[col], "fr");
|
|
804
|
+
}).join(' ');
|
|
805
|
+
}, [layoutIndices, columnsTrack, layoutStateInPixels]);
|
|
806
|
+
var getGridTemplateRows = React.useCallback(function (isPixels) {
|
|
807
|
+
var rowArray = layoutIndices.rowArray;
|
|
808
|
+
if (isPixels) {
|
|
809
|
+
return rowArray.map(function (row) {
|
|
810
|
+
return "".concat(layoutStateInPixels.rows[row], "px");
|
|
811
|
+
}).join(' ');
|
|
812
|
+
}
|
|
813
|
+
return rowArray.map(function (row) {
|
|
814
|
+
return "".concat(rowsTrack[row], "fr");
|
|
815
|
+
}).join(' ');
|
|
816
|
+
}, [layoutIndices, rowsTrack, layoutStateInPixels]);
|
|
817
|
+
var providerId = containerUtilities.useId(id);
|
|
818
|
+
var parentPaneProviderContext = usePaneProviderContext();
|
|
819
|
+
var paneProviderContext = React.useMemo(function () {
|
|
820
|
+
return providerId ? {
|
|
821
|
+
providerId: providerId,
|
|
822
|
+
contextData: _objectSpread2(_objectSpread2({}, parentPaneProviderContext.contextData), {}, _defineProperty({}, providerId, {
|
|
823
|
+
columnState: columnState,
|
|
824
|
+
rowState: rowState,
|
|
825
|
+
setRowValue: setRowValue,
|
|
826
|
+
setColumnValue: setColumnValue,
|
|
827
|
+
getRowValue: getRowValue,
|
|
828
|
+
getColumnValue: getColumnValue,
|
|
829
|
+
totalPanesHeight: totalPanesHeight,
|
|
830
|
+
totalPanesWidth: totalPanesWidth,
|
|
831
|
+
pixelsPerFr: pixelsPerFr
|
|
832
|
+
}))
|
|
833
|
+
} : {};
|
|
834
|
+
}, [providerId, parentPaneProviderContext, rowState, columnState, setRowValue, setColumnValue, getRowValue, getColumnValue, totalPanesHeight, totalPanesWidth, pixelsPerFr]);
|
|
835
|
+
return React__default["default"].createElement(PaneProviderContext.Provider, {
|
|
836
|
+
value: paneProviderContext
|
|
837
|
+
}, children === null || children === void 0 ? void 0 : children({
|
|
838
|
+
id: providerId,
|
|
839
|
+
getRowValue: getRowValue,
|
|
840
|
+
getColumnValue: getColumnValue,
|
|
841
|
+
getGridTemplateColumns: getGridTemplateColumns,
|
|
842
|
+
getGridTemplateRows: getGridTemplateRows
|
|
843
|
+
}));
|
|
844
|
+
};
|
|
845
|
+
PaneProvider.displayName = 'PaneProvider';
|
|
846
|
+
PaneProvider.propTypes = {
|
|
847
|
+
id: PropTypes__default["default"].string,
|
|
848
|
+
totalPanesWidth: PropTypes__default["default"].number.isRequired,
|
|
849
|
+
totalPanesHeight: PropTypes__default["default"].number.isRequired,
|
|
850
|
+
defaultRowValues: PropTypes__default["default"].object,
|
|
851
|
+
defaultColumnValues: PropTypes__default["default"].object,
|
|
852
|
+
rowValues: PropTypes__default["default"].object,
|
|
853
|
+
columnValues: PropTypes__default["default"].object,
|
|
854
|
+
onChange: PropTypes__default["default"].func,
|
|
855
|
+
children: PropTypes__default["default"].func
|
|
856
|
+
};
|
|
857
|
+
|
|
858
|
+
var PaneContext = React.createContext({
|
|
859
|
+
setId: function setId() {
|
|
860
|
+
return undefined;
|
|
861
|
+
}
|
|
862
|
+
});
|
|
863
|
+
var usePaneContext = function usePaneContext() {
|
|
864
|
+
return React.useContext(PaneContext);
|
|
865
|
+
};
|
|
866
|
+
|
|
867
|
+
var PaneSplitterContext = React.createContext({
|
|
868
|
+
orientation: 'start',
|
|
869
|
+
min: 0,
|
|
870
|
+
max: 0,
|
|
871
|
+
layoutKey: '',
|
|
872
|
+
valueNow: 0,
|
|
873
|
+
isRow: false
|
|
874
|
+
});
|
|
875
|
+
var usePaneSplitterContext = function usePaneSplitterContext() {
|
|
876
|
+
return React.useContext(PaneSplitterContext);
|
|
877
|
+
};
|
|
878
|
+
|
|
879
|
+
var _excluded$1 = ["providerId", "layoutKey", "min", "max", "orientation"];
|
|
880
|
+
var orientationToPosition = {
|
|
881
|
+
start: containerSplitter.SplitterPosition.LEADS,
|
|
882
|
+
end: containerSplitter.SplitterPosition.TRAILS,
|
|
883
|
+
top: containerSplitter.SplitterPosition.LEADS,
|
|
884
|
+
bottom: containerSplitter.SplitterPosition.TRAILS
|
|
885
|
+
};
|
|
886
|
+
var paneToSplitterOrientation = {
|
|
887
|
+
start: containerSplitter.SplitterOrientation.VERTICAL,
|
|
888
|
+
end: containerSplitter.SplitterOrientation.VERTICAL,
|
|
889
|
+
top: containerSplitter.SplitterOrientation.HORIZONTAL,
|
|
890
|
+
bottom: containerSplitter.SplitterOrientation.HORIZONTAL
|
|
891
|
+
};
|
|
892
|
+
var orientationToDimension = {
|
|
893
|
+
start: 'columns',
|
|
894
|
+
end: 'columns',
|
|
895
|
+
top: 'rows',
|
|
896
|
+
bottom: 'rows'
|
|
897
|
+
};
|
|
898
|
+
var SplitterComponent = React.forwardRef(function (_ref, ref) {
|
|
899
|
+
var providerId = _ref.providerId,
|
|
900
|
+
layoutKey = _ref.layoutKey,
|
|
901
|
+
min = _ref.min,
|
|
902
|
+
max = _ref.max,
|
|
903
|
+
orientation = _ref.orientation,
|
|
904
|
+
props = _objectWithoutProperties(_ref, _excluded$1);
|
|
905
|
+
var paneProviderContext = usePaneProviderContextData(providerId);
|
|
906
|
+
var paneContext = usePaneContext();
|
|
907
|
+
var themeContext = React.useContext(styled.ThemeContext);
|
|
908
|
+
var position = orientationToPosition[orientation];
|
|
909
|
+
var isRow = orientationToDimension[orientation] === 'rows';
|
|
910
|
+
var splitterOrientation = paneToSplitterOrientation[orientation];
|
|
911
|
+
var pixelsPerFr = paneProviderContext ? paneProviderContext.pixelsPerFr[orientationToDimension[orientation]] : 0;
|
|
912
|
+
var value = isRow ? paneProviderContext === null || paneProviderContext === void 0 ? void 0 : paneProviderContext.getRowValue(layoutKey, true) : paneProviderContext === null || paneProviderContext === void 0 ? void 0 : paneProviderContext.getColumnValue(layoutKey, true);
|
|
913
|
+
var valueInFr = isRow ? paneProviderContext === null || paneProviderContext === void 0 ? void 0 : paneProviderContext.getRowValue(layoutKey) : paneProviderContext === null || paneProviderContext === void 0 ? void 0 : paneProviderContext.getColumnValue(layoutKey);
|
|
914
|
+
var _useSplitter = containerSplitter.useSplitter({
|
|
915
|
+
type: containerSplitter.SplitterType.VARIABLE,
|
|
916
|
+
orientation: splitterOrientation,
|
|
917
|
+
position: position,
|
|
918
|
+
min: min * pixelsPerFr,
|
|
919
|
+
max: max * pixelsPerFr,
|
|
920
|
+
rtl: themeContext.rtl,
|
|
921
|
+
environment: window,
|
|
922
|
+
onChange: function onChange(valueNow) {
|
|
923
|
+
if (isRow) {
|
|
924
|
+
return paneProviderContext === null || paneProviderContext === void 0 ? void 0 : paneProviderContext.setRowValue(orientation === 'top', layoutKey, valueNow / pixelsPerFr);
|
|
925
|
+
}
|
|
926
|
+
return paneProviderContext === null || paneProviderContext === void 0 ? void 0 : paneProviderContext.setColumnValue(orientation === 'start', layoutKey, valueNow / pixelsPerFr);
|
|
927
|
+
},
|
|
928
|
+
valueNow: value
|
|
929
|
+
}),
|
|
930
|
+
getSeparatorProps = _useSplitter.getSeparatorProps,
|
|
931
|
+
getPrimaryPaneProps = _useSplitter.getPrimaryPaneProps;
|
|
932
|
+
React.useEffect(function () {
|
|
933
|
+
if (!paneContext.id) {
|
|
934
|
+
paneContext.setId(getPrimaryPaneProps().id);
|
|
935
|
+
}
|
|
936
|
+
}, [paneContext, getPrimaryPaneProps]);
|
|
937
|
+
var separatorProps = getSeparatorProps({
|
|
938
|
+
'aria-controls': paneContext.id
|
|
939
|
+
});
|
|
940
|
+
return React__default["default"].createElement(PaneSplitterContext.Provider, {
|
|
941
|
+
value: React.useMemo(function () {
|
|
942
|
+
return {
|
|
943
|
+
orientation: orientation,
|
|
944
|
+
layoutKey: layoutKey,
|
|
945
|
+
min: min,
|
|
946
|
+
max: max,
|
|
947
|
+
valueNow: valueInFr,
|
|
948
|
+
isRow: isRow
|
|
949
|
+
};
|
|
950
|
+
}, [orientation, layoutKey, min, max, valueInFr, isRow])
|
|
951
|
+
}, React__default["default"].createElement(StyledPaneSplitter, _extends({
|
|
952
|
+
orientation: orientation
|
|
953
|
+
}, separatorProps, props, {
|
|
954
|
+
ref: mergeRefs__default["default"]([separatorProps.ref, ref])
|
|
955
|
+
})));
|
|
956
|
+
});
|
|
957
|
+
SplitterComponent.displayName = 'Pane.Splitter';
|
|
958
|
+
SplitterComponent.propTypes = {
|
|
959
|
+
layoutKey: PropTypes__default["default"].string.isRequired,
|
|
960
|
+
min: PropTypes__default["default"].number.isRequired,
|
|
961
|
+
max: PropTypes__default["default"].number.isRequired,
|
|
962
|
+
orientation: PropTypes__default["default"].oneOf(ORIENTATION)
|
|
963
|
+
};
|
|
964
|
+
SplitterComponent.defaultProps = {
|
|
965
|
+
orientation: 'end'
|
|
966
|
+
};
|
|
967
|
+
var Splitter = SplitterComponent;
|
|
968
|
+
|
|
969
|
+
var ContentComponent = React.forwardRef(function (props, ref) {
|
|
970
|
+
return React__default["default"].createElement(StyledPaneContent, _extends({
|
|
971
|
+
ref: ref
|
|
972
|
+
}, props));
|
|
973
|
+
});
|
|
974
|
+
ContentComponent.displayName = 'Pane.Content';
|
|
975
|
+
var Content = ContentComponent;
|
|
976
|
+
|
|
977
|
+
var SplitterButtonComponent = React.forwardRef(function (props, ref) {
|
|
978
|
+
var label = props.label,
|
|
979
|
+
defaultPlacement = props.placement;
|
|
980
|
+
var _usePaneSplitterConte = usePaneSplitterContext(),
|
|
981
|
+
orientation = _usePaneSplitterConte.orientation,
|
|
982
|
+
layoutKey = _usePaneSplitterConte.layoutKey,
|
|
983
|
+
min = _usePaneSplitterConte.min,
|
|
984
|
+
max = _usePaneSplitterConte.max,
|
|
985
|
+
isRow = _usePaneSplitterConte.isRow,
|
|
986
|
+
valueNow = _usePaneSplitterConte.valueNow,
|
|
987
|
+
providerId = _usePaneSplitterConte.providerId;
|
|
988
|
+
var paneProviderContext = usePaneProviderContextData(providerId);
|
|
989
|
+
var isTop = orientation === 'top';
|
|
990
|
+
var isStart = orientation === 'start';
|
|
991
|
+
var isMin = valueNow === min;
|
|
992
|
+
var placement = defaultPlacement;
|
|
993
|
+
if (!defaultPlacement) {
|
|
994
|
+
if (isRow) {
|
|
995
|
+
placement = 'center';
|
|
996
|
+
} else {
|
|
997
|
+
placement = 'start';
|
|
998
|
+
}
|
|
999
|
+
}
|
|
1000
|
+
var setValue = React.useCallback(function (value) {
|
|
1001
|
+
if (isRow) {
|
|
1002
|
+
paneProviderContext.setRowValue(isTop, layoutKey, value);
|
|
1003
|
+
return;
|
|
1004
|
+
}
|
|
1005
|
+
paneProviderContext.setColumnValue(isStart, layoutKey, value);
|
|
1006
|
+
}, [isRow, isTop, isStart, layoutKey, paneProviderContext]);
|
|
1007
|
+
var onClick = containerUtilities.composeEventHandlers(props.onClick, function () {
|
|
1008
|
+
if (isMin) {
|
|
1009
|
+
setValue(max);
|
|
1010
|
+
} else {
|
|
1011
|
+
setValue(min);
|
|
1012
|
+
}
|
|
1013
|
+
});
|
|
1014
|
+
var onKeyDown = containerUtilities.composeEventHandlers(props.onKeyDown, function (event) {
|
|
1015
|
+
return event.stopPropagation();
|
|
1016
|
+
}
|
|
1017
|
+
);
|
|
1018
|
+
return React__default["default"].createElement(reactTooltips.Tooltip, {
|
|
1019
|
+
content: label
|
|
1020
|
+
}, React__default["default"].createElement(StyledPaneSplitterButton, _extends({
|
|
1021
|
+
"aria-label": label
|
|
1022
|
+
}, props, {
|
|
1023
|
+
placement: placement,
|
|
1024
|
+
orientation: orientation,
|
|
1025
|
+
isRotated: isMin,
|
|
1026
|
+
ref: ref,
|
|
1027
|
+
onClick: onClick,
|
|
1028
|
+
onKeyDown: onKeyDown
|
|
1029
|
+
})));
|
|
1030
|
+
});
|
|
1031
|
+
SplitterButtonComponent.displayName = 'Pane.SplitterButton';
|
|
1032
|
+
var SplitterButton = SplitterButtonComponent;
|
|
1033
|
+
|
|
1034
|
+
var _excluded = ["children"];
|
|
1035
|
+
var PaneComponent = React.forwardRef(function (_ref, ref) {
|
|
1036
|
+
var children = _ref.children,
|
|
1037
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
1038
|
+
var _useState = React.useState(),
|
|
1039
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
1040
|
+
paneId = _useState2[0],
|
|
1041
|
+
setPaneId = _useState2[1];
|
|
1042
|
+
var paneContext = React.useMemo(function () {
|
|
1043
|
+
return {
|
|
1044
|
+
id: paneId,
|
|
1045
|
+
setId: function setId(id) {
|
|
1046
|
+
return setPaneId(id);
|
|
1047
|
+
}
|
|
1048
|
+
};
|
|
1049
|
+
}, [paneId]);
|
|
1050
|
+
return React__default["default"].createElement(PaneContext.Provider, {
|
|
1051
|
+
value: paneContext
|
|
1052
|
+
}, React__default["default"].createElement(StyledPane, _extends({
|
|
1053
|
+
id: paneId,
|
|
1054
|
+
ref: ref
|
|
1055
|
+
}, props), children));
|
|
1056
|
+
});
|
|
1057
|
+
PaneComponent.displayName = 'Pane';
|
|
1058
|
+
var Pane = PaneComponent;
|
|
1059
|
+
Pane.Content = Content;
|
|
1060
|
+
Pane.Splitter = Splitter;
|
|
1061
|
+
Pane.SplitterButton = SplitterButton;
|
|
1062
|
+
|
|
379
1063
|
exports.ARRAY_ALIGN_ITEMS = ALIGN_ITEMS;
|
|
380
1064
|
exports.ARRAY_ALIGN_SELF = ALIGN_SELF;
|
|
381
1065
|
exports.ARRAY_DIRECTION = DIRECTION;
|
|
@@ -385,4 +1069,6 @@ exports.ARRAY_TEXT_ALIGN = TEXT_ALIGN;
|
|
|
385
1069
|
exports.ARRAY_WRAP = WRAP;
|
|
386
1070
|
exports.Col = Col;
|
|
387
1071
|
exports.Grid = Grid;
|
|
1072
|
+
exports.Pane = Pane;
|
|
1073
|
+
exports.PaneProvider = PaneProvider;
|
|
388
1074
|
exports.Row = Row;
|