@zendeskgarden/react-grid 8.53.1 → 8.54.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/dist/index.cjs.js +107 -70
- package/dist/index.esm.js +111 -74
- package/dist/typings/styled/pane/StyledPaneSplitter.d.ts +2 -1
- package/dist/typings/styled/pane/StyledPaneSplitterButton.d.ts +1 -0
- package/dist/typings/utils/usePaneSplitterContext.d.ts +1 -0
- package/package.json +7 -8
- package/LICENSE.md +0 -176
package/dist/index.cjs.js
CHANGED
|
@@ -191,7 +191,7 @@ var WRAP = ['nowrap', 'wrap', 'wrap-reverse'];
|
|
|
191
191
|
var ORIENTATION = ['top', 'bottom', 'start', 'end'];
|
|
192
192
|
|
|
193
193
|
var COMPONENT_ID$6 = 'grid.col';
|
|
194
|
-
var colorStyles$
|
|
194
|
+
var colorStyles$4 = function colorStyles(props) {
|
|
195
195
|
var backgroundColor = reactTheming.getColor('primaryHue', 600, props.theme, 0.1);
|
|
196
196
|
return styled.css(["background-clip:content-box;background-color:", ";"], backgroundColor);
|
|
197
197
|
};
|
|
@@ -242,7 +242,7 @@ var sizeStyles$4 = function sizeStyles(props) {
|
|
|
242
242
|
};
|
|
243
243
|
var StyledCol = styled__default["default"].div.attrs({
|
|
244
244
|
'data-garden-id': COMPONENT_ID$6,
|
|
245
|
-
'data-garden-version': '8.
|
|
245
|
+
'data-garden-version': '8.54.0'
|
|
246
246
|
}).withConfig({
|
|
247
247
|
displayName: "StyledCol",
|
|
248
248
|
componentId: "sc-inuw62-0"
|
|
@@ -251,7 +251,7 @@ var StyledCol = styled__default["default"].div.attrs({
|
|
|
251
251
|
}, function (props) {
|
|
252
252
|
return sizeStyles$4(props);
|
|
253
253
|
}, function (props) {
|
|
254
|
-
return props.debug && colorStyles$
|
|
254
|
+
return props.debug && colorStyles$4(props);
|
|
255
255
|
}, function (props) {
|
|
256
256
|
return mediaStyles$1(props.theme.breakpoints.xs, props.xs, props.alignSelfXs, props.textAlignXs, props.offsetXs, props.orderXs, props);
|
|
257
257
|
}, function (props) {
|
|
@@ -271,7 +271,7 @@ StyledCol.defaultProps = {
|
|
|
271
271
|
};
|
|
272
272
|
|
|
273
273
|
var COMPONENT_ID$5 = 'grid.grid';
|
|
274
|
-
var colorStyles$
|
|
274
|
+
var colorStyles$3 = function colorStyles(props) {
|
|
275
275
|
var borderColor = reactTheming.getColor(props.theme.palette.crimson, 400, props.theme, 0.5);
|
|
276
276
|
var borderWidth = polished.math("".concat(props.theme.borderWidths.sm, " * 2"));
|
|
277
277
|
return styled.css(["box-shadow:-", " 0 0 0 ", ",", " 0 0 0 ", ";"], borderWidth, borderColor, borderWidth, borderColor);
|
|
@@ -282,7 +282,7 @@ var sizeStyles$3 = function sizeStyles(props) {
|
|
|
282
282
|
};
|
|
283
283
|
var StyledGrid = styled__default["default"].div.attrs({
|
|
284
284
|
'data-garden-id': COMPONENT_ID$5,
|
|
285
|
-
'data-garden-version': '8.
|
|
285
|
+
'data-garden-version': '8.54.0'
|
|
286
286
|
}).withConfig({
|
|
287
287
|
displayName: "StyledGrid",
|
|
288
288
|
componentId: "sc-oxgg5i-0"
|
|
@@ -291,7 +291,7 @@ var StyledGrid = styled__default["default"].div.attrs({
|
|
|
291
291
|
}, function (props) {
|
|
292
292
|
return sizeStyles$3(props);
|
|
293
293
|
}, function (props) {
|
|
294
|
-
return props.debug && colorStyles$
|
|
294
|
+
return props.debug && colorStyles$3(props);
|
|
295
295
|
}, function (props) {
|
|
296
296
|
return reactTheming.retrieveComponentStyles(COMPONENT_ID$5, props);
|
|
297
297
|
});
|
|
@@ -301,7 +301,7 @@ StyledGrid.defaultProps = {
|
|
|
301
301
|
};
|
|
302
302
|
|
|
303
303
|
var COMPONENT_ID$4 = 'grid.row';
|
|
304
|
-
var colorStyles$
|
|
304
|
+
var colorStyles$2 = function colorStyles(props) {
|
|
305
305
|
var borderColor = reactTheming.getColor(props.theme.palette.mint, 600, props.theme, 0.5);
|
|
306
306
|
var borderWidth = props.theme.borderWidths.sm;
|
|
307
307
|
return styled.css(["box-shadow:inset 0 ", " 0 0 ", ",inset 0 -", " 0 0 ", ";"], borderWidth, borderColor, borderWidth, borderColor);
|
|
@@ -332,7 +332,7 @@ var sizeStyles$2 = function sizeStyles(props) {
|
|
|
332
332
|
};
|
|
333
333
|
var StyledRow = styled__default["default"].div.attrs({
|
|
334
334
|
'data-garden-id': COMPONENT_ID$4,
|
|
335
|
-
'data-garden-version': '8.
|
|
335
|
+
'data-garden-version': '8.54.0'
|
|
336
336
|
}).withConfig({
|
|
337
337
|
displayName: "StyledRow",
|
|
338
338
|
componentId: "sc-xjsdg1-0"
|
|
@@ -341,7 +341,7 @@ var StyledRow = styled__default["default"].div.attrs({
|
|
|
341
341
|
}, function (props) {
|
|
342
342
|
return sizeStyles$2(props);
|
|
343
343
|
}, function (props) {
|
|
344
|
-
return props.debug && colorStyles$
|
|
344
|
+
return props.debug && colorStyles$2(props);
|
|
345
345
|
}, function (props) {
|
|
346
346
|
return mediaStyles(props.theme.breakpoints.xs, props.alignItemsXs, props.justifyContentXs, props.wrapXs);
|
|
347
347
|
}, function (props) {
|
|
@@ -363,7 +363,7 @@ StyledRow.defaultProps = {
|
|
|
363
363
|
var COMPONENT_ID$3 = 'pane';
|
|
364
364
|
var StyledPane = styled__default["default"].div.attrs({
|
|
365
365
|
'data-garden-id': COMPONENT_ID$3,
|
|
366
|
-
'data-garden-version': '8.
|
|
366
|
+
'data-garden-version': '8.54.0'
|
|
367
367
|
}).withConfig({
|
|
368
368
|
displayName: "StyledPane",
|
|
369
369
|
componentId: "sc-1ltjst7-0"
|
|
@@ -377,7 +377,7 @@ StyledPane.defaultProps = {
|
|
|
377
377
|
var COMPONENT_ID$2 = 'pane.content';
|
|
378
378
|
var StyledPaneContent = styled__default["default"].div.attrs({
|
|
379
379
|
'data-garden-id': COMPONENT_ID$2,
|
|
380
|
-
'data-garden-version': '8.
|
|
380
|
+
'data-garden-version': '8.54.0'
|
|
381
381
|
}).withConfig({
|
|
382
382
|
displayName: "StyledPaneContent",
|
|
383
383
|
componentId: "sc-1b38mbh-0"
|
|
@@ -389,15 +389,16 @@ StyledPaneContent.defaultProps = {
|
|
|
389
389
|
};
|
|
390
390
|
|
|
391
391
|
var COMPONENT_ID$1 = 'pane.splitter';
|
|
392
|
-
var colorStyles = function colorStyles(props) {
|
|
392
|
+
var colorStyles$1 = function colorStyles(props) {
|
|
393
393
|
var color = reactTheming.getColor('neutralHue', 300, props.theme);
|
|
394
394
|
var hoverColor = reactTheming.getColor('primaryHue', 600, props.theme);
|
|
395
395
|
var activeColor = reactTheming.getColor('primaryHue', 800, props.theme);
|
|
396
396
|
var boxShadow = props.theme.shadows.md(polished.rgba(hoverColor, 0.35));
|
|
397
|
-
return styled.css(["&::before{background-color:", ";}&:hover::before
|
|
397
|
+
return styled.css(["&::before{background-color:", ";}&:hover::before{background-color:", ";}&[data-garden-focus-visible]::before{box-shadow:", ";background-color:", ";}&:active::before{background-color:", ";}"], color, props.isHovered && hoverColor, boxShadow, hoverColor, props.isHovered && activeColor);
|
|
398
398
|
};
|
|
399
399
|
var sizeStyles$1 = function sizeStyles(props) {
|
|
400
400
|
var size = polished.math("".concat(props.theme.shadowWidths.md, " * 2"));
|
|
401
|
+
var separatorSize = polished.math("".concat(props.theme.borderWidths.sm, " * 2"));
|
|
401
402
|
var offset = polished.math("-".concat(size, " / 2"));
|
|
402
403
|
var cursor;
|
|
403
404
|
var top;
|
|
@@ -417,19 +418,6 @@ var sizeStyles$1 = function sizeStyles(props) {
|
|
|
417
418
|
separatorWidth = width;
|
|
418
419
|
separatorHeight = props.theme.borderWidths.sm;
|
|
419
420
|
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
421
|
case 'bottom':
|
|
434
422
|
cursor = 'row-resize';
|
|
435
423
|
bottom = offset;
|
|
@@ -451,16 +439,31 @@ var sizeStyles$1 = function sizeStyles(props) {
|
|
|
451
439
|
left = offset;
|
|
452
440
|
}
|
|
453
441
|
break;
|
|
442
|
+
case 'end':
|
|
443
|
+
default:
|
|
444
|
+
cursor = 'col-resize';
|
|
445
|
+
top = 0;
|
|
446
|
+
width = size;
|
|
447
|
+
height = '100%';
|
|
448
|
+
separatorWidth = props.theme.borderWidths.sm;
|
|
449
|
+
separatorHeight = height;
|
|
450
|
+
if (props.theme.rtl) {
|
|
451
|
+
left = offset;
|
|
452
|
+
} else {
|
|
453
|
+
right = offset;
|
|
454
|
+
}
|
|
455
|
+
break;
|
|
454
456
|
}
|
|
455
|
-
|
|
457
|
+
var dimensionProperty = width === '100%' ? 'height' : 'width';
|
|
458
|
+
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, dimensionProperty, props.isHovered && separatorSize, dimensionProperty, separatorSize, props.theme.borderRadii.md);
|
|
456
459
|
};
|
|
457
460
|
var StyledPaneSplitter = styled__default["default"].div.attrs({
|
|
458
461
|
'data-garden-id': COMPONENT_ID$1,
|
|
459
|
-
'data-garden-version': '8.
|
|
462
|
+
'data-garden-version': '8.54.0'
|
|
460
463
|
}).withConfig({
|
|
461
464
|
displayName: "StyledPaneSplitter",
|
|
462
465
|
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) {
|
|
466
|
+
})(["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$1, function (props) {
|
|
464
467
|
return reactTheming.retrieveComponentStyles(COMPONENT_ID$1, props);
|
|
465
468
|
});
|
|
466
469
|
StyledPaneSplitter.defaultProps = {
|
|
@@ -482,42 +485,51 @@ var transformStyles = function transformStyles(props) {
|
|
|
482
485
|
}
|
|
483
486
|
return styled.css(["& > svg{transform:rotate(", "deg);}"], degrees);
|
|
484
487
|
};
|
|
488
|
+
var colorStyles = function colorStyles(_ref) {
|
|
489
|
+
var theme = _ref.theme;
|
|
490
|
+
var boxShadow = theme.shadows.lg("".concat(theme.space.base, "px"), "".concat(theme.space.base * 2, "px"), reactTheming.getColor('chromeHue', 600, theme, 0.15));
|
|
491
|
+
var focusBoxShadow = theme.shadows.md(reactTheming.getColor('primaryHue', 600, theme, 0.35));
|
|
492
|
+
return styled.css(["box-shadow:", ";&[data-garden-focus-visible]{box-shadow:", ",", ";}"], boxShadow, focusBoxShadow, boxShadow);
|
|
493
|
+
};
|
|
485
494
|
var sizeStyles = function sizeStyles(props) {
|
|
486
495
|
var size = "".concat(props.theme.space.base * 6, "px");
|
|
496
|
+
var display = props.splitterSize <= polished.stripUnit(polished.math("".concat(props.theme.shadowWidths.md, " * 2 + ").concat(size))) && 'none';
|
|
487
497
|
var isVertical = props.orientation === 'start' || props.orientation === 'end';
|
|
488
498
|
var top;
|
|
489
499
|
var left;
|
|
490
500
|
var right;
|
|
491
501
|
var bottom;
|
|
492
|
-
if (props.
|
|
493
|
-
if (
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
if (
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
502
|
+
if (props.splitterSize >= polished.stripUnit(polished.math("".concat(size, " * 3")))) {
|
|
503
|
+
if (props.placement === 'start') {
|
|
504
|
+
if (isVertical) {
|
|
505
|
+
top = size;
|
|
506
|
+
} else if (props.theme.rtl) {
|
|
507
|
+
right = size;
|
|
508
|
+
} else {
|
|
509
|
+
left = size;
|
|
510
|
+
}
|
|
511
|
+
} else if (props.placement === 'end') {
|
|
512
|
+
if (isVertical) {
|
|
513
|
+
bottom = size;
|
|
514
|
+
} else if (props.theme.rtl) {
|
|
515
|
+
left = size;
|
|
516
|
+
} else {
|
|
517
|
+
right = size;
|
|
518
|
+
}
|
|
507
519
|
}
|
|
508
520
|
}
|
|
509
|
-
return styled.css(["top:", ";right:", ";bottom:", ";left:", ";width:", ";min-width:", ";height:", ";"], top, right, bottom, left, size, size, size);
|
|
521
|
+
return styled.css(["display:", ";top:", ";right:", ";bottom:", ";left:", ";width:", ";min-width:", ";height:", ";"], display, top, right, bottom, left, size, size, size);
|
|
510
522
|
};
|
|
511
523
|
var StyledPaneSplitterButton = styled__default["default"](reactButtons.ChevronButton).attrs({
|
|
512
524
|
'data-garden-id': COMPONENT_ID,
|
|
513
|
-
'data-garden-version': '8.
|
|
525
|
+
'data-garden-version': '8.54.0',
|
|
514
526
|
isBasic: true,
|
|
515
527
|
isPill: true,
|
|
516
528
|
size: 'small'
|
|
517
529
|
}).withConfig({
|
|
518
530
|
displayName: "StyledPaneSplitterButton",
|
|
519
531
|
componentId: "sc-zh032e-0"
|
|
520
|
-
})(["position:absolute;transition:
|
|
532
|
+
})(["position:absolute;transition: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, colorStyles, function (props) {
|
|
521
533
|
return props.theme.colors.background;
|
|
522
534
|
}, function (props) {
|
|
523
535
|
return reactTheming.retrieveComponentStyles(COMPONENT_ID, props);
|
|
@@ -870,6 +882,7 @@ var PaneSplitterContext = React.createContext({
|
|
|
870
882
|
max: 0,
|
|
871
883
|
layoutKey: '',
|
|
872
884
|
valueNow: 0,
|
|
885
|
+
size: 0,
|
|
873
886
|
isRow: false
|
|
874
887
|
});
|
|
875
888
|
var usePaneSplitterContext = function usePaneSplitterContext() {
|
|
@@ -877,17 +890,11 @@ var usePaneSplitterContext = function usePaneSplitterContext() {
|
|
|
877
890
|
};
|
|
878
891
|
|
|
879
892
|
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
893
|
var paneToSplitterOrientation = {
|
|
887
|
-
start:
|
|
888
|
-
end:
|
|
889
|
-
top:
|
|
890
|
-
bottom:
|
|
894
|
+
start: 'vertical',
|
|
895
|
+
end: 'vertical',
|
|
896
|
+
top: 'horizontal',
|
|
897
|
+
bottom: 'horizontal'
|
|
891
898
|
};
|
|
892
899
|
var orientationToDimension = {
|
|
893
900
|
start: 'columns',
|
|
@@ -896,6 +903,7 @@ var orientationToDimension = {
|
|
|
896
903
|
bottom: 'rows'
|
|
897
904
|
};
|
|
898
905
|
var SplitterComponent = React.forwardRef(function (_ref, ref) {
|
|
906
|
+
var _separatorRef$current, _separatorRef$current2;
|
|
899
907
|
var providerId = _ref.providerId,
|
|
900
908
|
layoutKey = _ref.layoutKey,
|
|
901
909
|
min = _ref.min,
|
|
@@ -905,27 +913,32 @@ var SplitterComponent = React.forwardRef(function (_ref, ref) {
|
|
|
905
913
|
var paneProviderContext = usePaneProviderContextData(providerId);
|
|
906
914
|
var paneContext = usePaneContext();
|
|
907
915
|
var themeContext = React.useContext(styled.ThemeContext);
|
|
908
|
-
var
|
|
916
|
+
var environment = reactTheming.useDocument(themeContext);
|
|
917
|
+
var _useState = React.useState(false),
|
|
918
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
919
|
+
isHovered = _useState2[0],
|
|
920
|
+
setIsHovered = _useState2[1];
|
|
909
921
|
var isRow = orientationToDimension[orientation] === 'rows';
|
|
910
|
-
var
|
|
922
|
+
var separatorRef = React.useRef(null);
|
|
923
|
+
var splitterOrientation = paneToSplitterOrientation[orientation || 'end'];
|
|
911
924
|
var pixelsPerFr = paneProviderContext ? paneProviderContext.pixelsPerFr[orientationToDimension[orientation]] : 0;
|
|
912
925
|
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
926
|
var valueInFr = isRow ? paneProviderContext === null || paneProviderContext === void 0 ? void 0 : paneProviderContext.getRowValue(layoutKey) : paneProviderContext === null || paneProviderContext === void 0 ? void 0 : paneProviderContext.getColumnValue(layoutKey);
|
|
914
927
|
var _useSplitter = containerSplitter.useSplitter({
|
|
915
|
-
type: containerSplitter.SplitterType.VARIABLE,
|
|
916
928
|
orientation: splitterOrientation,
|
|
917
|
-
|
|
929
|
+
isLeading: orientation === 'start' || orientation === 'top',
|
|
918
930
|
min: min * pixelsPerFr,
|
|
919
931
|
max: max * pixelsPerFr,
|
|
920
932
|
rtl: themeContext.rtl,
|
|
921
|
-
environment:
|
|
933
|
+
environment: environment,
|
|
922
934
|
onChange: function onChange(valueNow) {
|
|
923
935
|
if (isRow) {
|
|
924
936
|
return paneProviderContext === null || paneProviderContext === void 0 ? void 0 : paneProviderContext.setRowValue(orientation === 'top', layoutKey, valueNow / pixelsPerFr);
|
|
925
937
|
}
|
|
926
938
|
return paneProviderContext === null || paneProviderContext === void 0 ? void 0 : paneProviderContext.setColumnValue(orientation === 'start', layoutKey, valueNow / pixelsPerFr);
|
|
927
939
|
},
|
|
928
|
-
valueNow: value
|
|
940
|
+
valueNow: value,
|
|
941
|
+
separatorRef: separatorRef
|
|
929
942
|
}),
|
|
930
943
|
getSeparatorProps = _useSplitter.getSeparatorProps,
|
|
931
944
|
getPrimaryPaneProps = _useSplitter.getPrimaryPaneProps;
|
|
@@ -934,9 +947,17 @@ var SplitterComponent = React.forwardRef(function (_ref, ref) {
|
|
|
934
947
|
paneContext.setId(getPrimaryPaneProps().id);
|
|
935
948
|
}
|
|
936
949
|
}, [paneContext, getPrimaryPaneProps]);
|
|
950
|
+
var ariaLabel = reactTheming.useText(SplitterComponent, props, 'aria-label', "".concat(splitterOrientation, " splitter"));
|
|
937
951
|
var separatorProps = getSeparatorProps({
|
|
938
|
-
'aria-controls': paneContext.id
|
|
952
|
+
'aria-controls': paneContext.id,
|
|
953
|
+
'aria-label': ariaLabel
|
|
939
954
|
});
|
|
955
|
+
var size = isRow ? (_separatorRef$current = separatorRef.current) === null || _separatorRef$current === void 0 ? void 0 : _separatorRef$current.clientWidth : (_separatorRef$current2 = separatorRef.current) === null || _separatorRef$current2 === void 0 ? void 0 : _separatorRef$current2.clientHeight;
|
|
956
|
+
var onMouseOver = React.useMemo(function () {
|
|
957
|
+
return containerUtilities.composeEventHandlers(props.onMouseOver, function (event) {
|
|
958
|
+
return setIsHovered(event.target === separatorRef.current);
|
|
959
|
+
});
|
|
960
|
+
}, [props.onMouseOver, separatorRef]);
|
|
940
961
|
return React__default["default"].createElement(PaneSplitterContext.Provider, {
|
|
941
962
|
value: React.useMemo(function () {
|
|
942
963
|
return {
|
|
@@ -945,13 +966,16 @@ var SplitterComponent = React.forwardRef(function (_ref, ref) {
|
|
|
945
966
|
min: min,
|
|
946
967
|
max: max,
|
|
947
968
|
valueNow: valueInFr,
|
|
969
|
+
size: size,
|
|
948
970
|
isRow: isRow
|
|
949
971
|
};
|
|
950
|
-
}, [orientation, layoutKey, min, max, valueInFr, isRow])
|
|
972
|
+
}, [orientation, layoutKey, min, max, valueInFr, size, isRow])
|
|
951
973
|
}, React__default["default"].createElement(StyledPaneSplitter, _extends({
|
|
974
|
+
isHovered: isHovered,
|
|
952
975
|
orientation: orientation
|
|
953
976
|
}, separatorProps, props, {
|
|
954
|
-
|
|
977
|
+
onMouseOver: onMouseOver,
|
|
978
|
+
ref: mergeRefs__default["default"]([separatorRef, ref])
|
|
955
979
|
})));
|
|
956
980
|
});
|
|
957
981
|
SplitterComponent.displayName = 'Pane.Splitter';
|
|
@@ -984,6 +1008,7 @@ var SplitterButtonComponent = React.forwardRef(function (props, ref) {
|
|
|
984
1008
|
max = _usePaneSplitterConte.max,
|
|
985
1009
|
isRow = _usePaneSplitterConte.isRow,
|
|
986
1010
|
valueNow = _usePaneSplitterConte.valueNow,
|
|
1011
|
+
size = _usePaneSplitterConte.size,
|
|
987
1012
|
providerId = _usePaneSplitterConte.providerId;
|
|
988
1013
|
var paneProviderContext = usePaneProviderContextData(providerId);
|
|
989
1014
|
var isTop = orientation === 'top';
|
|
@@ -1000,9 +1025,9 @@ var SplitterButtonComponent = React.forwardRef(function (props, ref) {
|
|
|
1000
1025
|
var setValue = React.useCallback(function (value) {
|
|
1001
1026
|
if (isRow) {
|
|
1002
1027
|
paneProviderContext.setRowValue(isTop, layoutKey, value);
|
|
1003
|
-
|
|
1028
|
+
} else {
|
|
1029
|
+
paneProviderContext.setColumnValue(isStart, layoutKey, value);
|
|
1004
1030
|
}
|
|
1005
|
-
paneProviderContext.setColumnValue(isStart, layoutKey, value);
|
|
1006
1031
|
}, [isRow, isTop, isStart, layoutKey, paneProviderContext]);
|
|
1007
1032
|
var onClick = containerUtilities.composeEventHandlers(props.onClick, function () {
|
|
1008
1033
|
if (isMin) {
|
|
@@ -1015,17 +1040,29 @@ var SplitterButtonComponent = React.forwardRef(function (props, ref) {
|
|
|
1015
1040
|
return event.stopPropagation();
|
|
1016
1041
|
}
|
|
1017
1042
|
);
|
|
1043
|
+
var onMouseDown = containerUtilities.composeEventHandlers(props.onMouseDown, function (event) {
|
|
1044
|
+
return event.stopPropagation();
|
|
1045
|
+
}
|
|
1046
|
+
);
|
|
1018
1047
|
return React__default["default"].createElement(reactTooltips.Tooltip, {
|
|
1019
|
-
content: label
|
|
1048
|
+
content: label,
|
|
1049
|
+
style: {
|
|
1050
|
+
cursor: 'default'
|
|
1051
|
+
},
|
|
1052
|
+
onMouseDown: function onMouseDown(e) {
|
|
1053
|
+
return e.stopPropagation();
|
|
1054
|
+
}
|
|
1020
1055
|
}, React__default["default"].createElement(StyledPaneSplitterButton, _extends({
|
|
1021
1056
|
"aria-label": label
|
|
1022
1057
|
}, props, {
|
|
1023
1058
|
placement: placement,
|
|
1024
1059
|
orientation: orientation,
|
|
1025
1060
|
isRotated: isMin,
|
|
1061
|
+
splitterSize: size || 0,
|
|
1026
1062
|
ref: ref,
|
|
1027
1063
|
onClick: onClick,
|
|
1028
|
-
onKeyDown: onKeyDown
|
|
1064
|
+
onKeyDown: onKeyDown,
|
|
1065
|
+
onMouseDown: onMouseDown
|
|
1029
1066
|
})));
|
|
1030
1067
|
});
|
|
1031
1068
|
SplitterButtonComponent.displayName = 'Pane.SplitterButton';
|
package/dist/index.esm.js
CHANGED
|
@@ -5,15 +5,15 @@
|
|
|
5
5
|
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import React, { createContext, useContext, useMemo, useState, useCallback, forwardRef, useEffect } from 'react';
|
|
8
|
+
import React, { createContext, useContext, useMemo, useState, useCallback, forwardRef, useRef, useEffect } from 'react';
|
|
9
9
|
import PropTypes from 'prop-types';
|
|
10
10
|
import styled, { css, ThemeContext } from 'styled-components';
|
|
11
|
-
import { math, rgba } from 'polished';
|
|
12
|
-
import { retrieveComponentStyles, DEFAULT_THEME, getColor } from '@zendeskgarden/react-theming';
|
|
11
|
+
import { math, rgba, stripUnit } from 'polished';
|
|
12
|
+
import { retrieveComponentStyles, DEFAULT_THEME, getColor, useDocument, useText } from '@zendeskgarden/react-theming';
|
|
13
13
|
import { ChevronButton } from '@zendeskgarden/react-buttons';
|
|
14
14
|
import { useId, composeEventHandlers } from '@zendeskgarden/container-utilities';
|
|
15
15
|
import mergeRefs from 'react-merge-refs';
|
|
16
|
-
import {
|
|
16
|
+
import { useSplitter } from '@zendeskgarden/container-splitter';
|
|
17
17
|
import { Tooltip } from '@zendeskgarden/react-tooltips';
|
|
18
18
|
|
|
19
19
|
function ownKeys(object, enumerableOnly) {
|
|
@@ -180,7 +180,7 @@ var WRAP = ['nowrap', 'wrap', 'wrap-reverse'];
|
|
|
180
180
|
var ORIENTATION = ['top', 'bottom', 'start', 'end'];
|
|
181
181
|
|
|
182
182
|
var COMPONENT_ID$6 = 'grid.col';
|
|
183
|
-
var colorStyles$
|
|
183
|
+
var colorStyles$4 = function colorStyles(props) {
|
|
184
184
|
var backgroundColor = getColor('primaryHue', 600, props.theme, 0.1);
|
|
185
185
|
return css(["background-clip:content-box;background-color:", ";"], backgroundColor);
|
|
186
186
|
};
|
|
@@ -231,7 +231,7 @@ var sizeStyles$4 = function sizeStyles(props) {
|
|
|
231
231
|
};
|
|
232
232
|
var StyledCol = styled.div.attrs({
|
|
233
233
|
'data-garden-id': COMPONENT_ID$6,
|
|
234
|
-
'data-garden-version': '8.
|
|
234
|
+
'data-garden-version': '8.54.0'
|
|
235
235
|
}).withConfig({
|
|
236
236
|
displayName: "StyledCol",
|
|
237
237
|
componentId: "sc-inuw62-0"
|
|
@@ -240,7 +240,7 @@ var StyledCol = styled.div.attrs({
|
|
|
240
240
|
}, function (props) {
|
|
241
241
|
return sizeStyles$4(props);
|
|
242
242
|
}, function (props) {
|
|
243
|
-
return props.debug && colorStyles$
|
|
243
|
+
return props.debug && colorStyles$4(props);
|
|
244
244
|
}, function (props) {
|
|
245
245
|
return mediaStyles$1(props.theme.breakpoints.xs, props.xs, props.alignSelfXs, props.textAlignXs, props.offsetXs, props.orderXs, props);
|
|
246
246
|
}, function (props) {
|
|
@@ -260,7 +260,7 @@ StyledCol.defaultProps = {
|
|
|
260
260
|
};
|
|
261
261
|
|
|
262
262
|
var COMPONENT_ID$5 = 'grid.grid';
|
|
263
|
-
var colorStyles$
|
|
263
|
+
var colorStyles$3 = function colorStyles(props) {
|
|
264
264
|
var borderColor = getColor(props.theme.palette.crimson, 400, props.theme, 0.5);
|
|
265
265
|
var borderWidth = math("".concat(props.theme.borderWidths.sm, " * 2"));
|
|
266
266
|
return css(["box-shadow:-", " 0 0 0 ", ",", " 0 0 0 ", ";"], borderWidth, borderColor, borderWidth, borderColor);
|
|
@@ -271,7 +271,7 @@ var sizeStyles$3 = function sizeStyles(props) {
|
|
|
271
271
|
};
|
|
272
272
|
var StyledGrid = styled.div.attrs({
|
|
273
273
|
'data-garden-id': COMPONENT_ID$5,
|
|
274
|
-
'data-garden-version': '8.
|
|
274
|
+
'data-garden-version': '8.54.0'
|
|
275
275
|
}).withConfig({
|
|
276
276
|
displayName: "StyledGrid",
|
|
277
277
|
componentId: "sc-oxgg5i-0"
|
|
@@ -280,7 +280,7 @@ var StyledGrid = styled.div.attrs({
|
|
|
280
280
|
}, function (props) {
|
|
281
281
|
return sizeStyles$3(props);
|
|
282
282
|
}, function (props) {
|
|
283
|
-
return props.debug && colorStyles$
|
|
283
|
+
return props.debug && colorStyles$3(props);
|
|
284
284
|
}, function (props) {
|
|
285
285
|
return retrieveComponentStyles(COMPONENT_ID$5, props);
|
|
286
286
|
});
|
|
@@ -290,7 +290,7 @@ StyledGrid.defaultProps = {
|
|
|
290
290
|
};
|
|
291
291
|
|
|
292
292
|
var COMPONENT_ID$4 = 'grid.row';
|
|
293
|
-
var colorStyles$
|
|
293
|
+
var colorStyles$2 = function colorStyles(props) {
|
|
294
294
|
var borderColor = getColor(props.theme.palette.mint, 600, props.theme, 0.5);
|
|
295
295
|
var borderWidth = props.theme.borderWidths.sm;
|
|
296
296
|
return css(["box-shadow:inset 0 ", " 0 0 ", ",inset 0 -", " 0 0 ", ";"], borderWidth, borderColor, borderWidth, borderColor);
|
|
@@ -321,7 +321,7 @@ var sizeStyles$2 = function sizeStyles(props) {
|
|
|
321
321
|
};
|
|
322
322
|
var StyledRow = styled.div.attrs({
|
|
323
323
|
'data-garden-id': COMPONENT_ID$4,
|
|
324
|
-
'data-garden-version': '8.
|
|
324
|
+
'data-garden-version': '8.54.0'
|
|
325
325
|
}).withConfig({
|
|
326
326
|
displayName: "StyledRow",
|
|
327
327
|
componentId: "sc-xjsdg1-0"
|
|
@@ -330,7 +330,7 @@ var StyledRow = styled.div.attrs({
|
|
|
330
330
|
}, function (props) {
|
|
331
331
|
return sizeStyles$2(props);
|
|
332
332
|
}, function (props) {
|
|
333
|
-
return props.debug && colorStyles$
|
|
333
|
+
return props.debug && colorStyles$2(props);
|
|
334
334
|
}, function (props) {
|
|
335
335
|
return mediaStyles(props.theme.breakpoints.xs, props.alignItemsXs, props.justifyContentXs, props.wrapXs);
|
|
336
336
|
}, function (props) {
|
|
@@ -352,7 +352,7 @@ StyledRow.defaultProps = {
|
|
|
352
352
|
var COMPONENT_ID$3 = 'pane';
|
|
353
353
|
var StyledPane = styled.div.attrs({
|
|
354
354
|
'data-garden-id': COMPONENT_ID$3,
|
|
355
|
-
'data-garden-version': '8.
|
|
355
|
+
'data-garden-version': '8.54.0'
|
|
356
356
|
}).withConfig({
|
|
357
357
|
displayName: "StyledPane",
|
|
358
358
|
componentId: "sc-1ltjst7-0"
|
|
@@ -366,7 +366,7 @@ StyledPane.defaultProps = {
|
|
|
366
366
|
var COMPONENT_ID$2 = 'pane.content';
|
|
367
367
|
var StyledPaneContent = styled.div.attrs({
|
|
368
368
|
'data-garden-id': COMPONENT_ID$2,
|
|
369
|
-
'data-garden-version': '8.
|
|
369
|
+
'data-garden-version': '8.54.0'
|
|
370
370
|
}).withConfig({
|
|
371
371
|
displayName: "StyledPaneContent",
|
|
372
372
|
componentId: "sc-1b38mbh-0"
|
|
@@ -378,15 +378,16 @@ StyledPaneContent.defaultProps = {
|
|
|
378
378
|
};
|
|
379
379
|
|
|
380
380
|
var COMPONENT_ID$1 = 'pane.splitter';
|
|
381
|
-
var colorStyles = function colorStyles(props) {
|
|
381
|
+
var colorStyles$1 = function colorStyles(props) {
|
|
382
382
|
var color = getColor('neutralHue', 300, props.theme);
|
|
383
383
|
var hoverColor = getColor('primaryHue', 600, props.theme);
|
|
384
384
|
var activeColor = getColor('primaryHue', 800, props.theme);
|
|
385
385
|
var boxShadow = props.theme.shadows.md(rgba(hoverColor, 0.35));
|
|
386
|
-
return css(["&::before{background-color:", ";}&:hover::before
|
|
386
|
+
return css(["&::before{background-color:", ";}&:hover::before{background-color:", ";}&[data-garden-focus-visible]::before{box-shadow:", ";background-color:", ";}&:active::before{background-color:", ";}"], color, props.isHovered && hoverColor, boxShadow, hoverColor, props.isHovered && activeColor);
|
|
387
387
|
};
|
|
388
388
|
var sizeStyles$1 = function sizeStyles(props) {
|
|
389
389
|
var size = math("".concat(props.theme.shadowWidths.md, " * 2"));
|
|
390
|
+
var separatorSize = math("".concat(props.theme.borderWidths.sm, " * 2"));
|
|
390
391
|
var offset = math("-".concat(size, " / 2"));
|
|
391
392
|
var cursor;
|
|
392
393
|
var top;
|
|
@@ -406,19 +407,6 @@ var sizeStyles$1 = function sizeStyles(props) {
|
|
|
406
407
|
separatorWidth = width;
|
|
407
408
|
separatorHeight = props.theme.borderWidths.sm;
|
|
408
409
|
break;
|
|
409
|
-
case 'end':
|
|
410
|
-
cursor = 'col-resize';
|
|
411
|
-
top = 0;
|
|
412
|
-
width = size;
|
|
413
|
-
height = '100%';
|
|
414
|
-
separatorWidth = props.theme.borderWidths.sm;
|
|
415
|
-
separatorHeight = height;
|
|
416
|
-
if (props.theme.rtl) {
|
|
417
|
-
left = offset;
|
|
418
|
-
} else {
|
|
419
|
-
right = offset;
|
|
420
|
-
}
|
|
421
|
-
break;
|
|
422
410
|
case 'bottom':
|
|
423
411
|
cursor = 'row-resize';
|
|
424
412
|
bottom = offset;
|
|
@@ -440,16 +428,31 @@ var sizeStyles$1 = function sizeStyles(props) {
|
|
|
440
428
|
left = offset;
|
|
441
429
|
}
|
|
442
430
|
break;
|
|
431
|
+
case 'end':
|
|
432
|
+
default:
|
|
433
|
+
cursor = 'col-resize';
|
|
434
|
+
top = 0;
|
|
435
|
+
width = size;
|
|
436
|
+
height = '100%';
|
|
437
|
+
separatorWidth = props.theme.borderWidths.sm;
|
|
438
|
+
separatorHeight = height;
|
|
439
|
+
if (props.theme.rtl) {
|
|
440
|
+
left = offset;
|
|
441
|
+
} else {
|
|
442
|
+
right = offset;
|
|
443
|
+
}
|
|
444
|
+
break;
|
|
443
445
|
}
|
|
444
|
-
|
|
446
|
+
var dimensionProperty = width === '100%' ? 'height' : 'width';
|
|
447
|
+
return 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, dimensionProperty, props.isHovered && separatorSize, dimensionProperty, separatorSize, props.theme.borderRadii.md);
|
|
445
448
|
};
|
|
446
449
|
var StyledPaneSplitter = styled.div.attrs({
|
|
447
450
|
'data-garden-id': COMPONENT_ID$1,
|
|
448
|
-
'data-garden-version': '8.
|
|
451
|
+
'data-garden-version': '8.54.0'
|
|
449
452
|
}).withConfig({
|
|
450
453
|
displayName: "StyledPaneSplitter",
|
|
451
454
|
componentId: "sc-jylemn-0"
|
|
452
|
-
})(["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) {
|
|
455
|
+
})(["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$1, function (props) {
|
|
453
456
|
return retrieveComponentStyles(COMPONENT_ID$1, props);
|
|
454
457
|
});
|
|
455
458
|
StyledPaneSplitter.defaultProps = {
|
|
@@ -471,42 +474,51 @@ var transformStyles = function transformStyles(props) {
|
|
|
471
474
|
}
|
|
472
475
|
return css(["& > svg{transform:rotate(", "deg);}"], degrees);
|
|
473
476
|
};
|
|
477
|
+
var colorStyles = function colorStyles(_ref) {
|
|
478
|
+
var theme = _ref.theme;
|
|
479
|
+
var boxShadow = theme.shadows.lg("".concat(theme.space.base, "px"), "".concat(theme.space.base * 2, "px"), getColor('chromeHue', 600, theme, 0.15));
|
|
480
|
+
var focusBoxShadow = theme.shadows.md(getColor('primaryHue', 600, theme, 0.35));
|
|
481
|
+
return css(["box-shadow:", ";&[data-garden-focus-visible]{box-shadow:", ",", ";}"], boxShadow, focusBoxShadow, boxShadow);
|
|
482
|
+
};
|
|
474
483
|
var sizeStyles = function sizeStyles(props) {
|
|
475
484
|
var size = "".concat(props.theme.space.base * 6, "px");
|
|
485
|
+
var display = props.splitterSize <= stripUnit(math("".concat(props.theme.shadowWidths.md, " * 2 + ").concat(size))) && 'none';
|
|
476
486
|
var isVertical = props.orientation === 'start' || props.orientation === 'end';
|
|
477
487
|
var top;
|
|
478
488
|
var left;
|
|
479
489
|
var right;
|
|
480
490
|
var bottom;
|
|
481
|
-
if (props.
|
|
482
|
-
if (
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
if (
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
491
|
+
if (props.splitterSize >= stripUnit(math("".concat(size, " * 3")))) {
|
|
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
|
+
}
|
|
496
508
|
}
|
|
497
509
|
}
|
|
498
|
-
return css(["top:", ";right:", ";bottom:", ";left:", ";width:", ";min-width:", ";height:", ";"], top, right, bottom, left, size, size, size);
|
|
510
|
+
return css(["display:", ";top:", ";right:", ";bottom:", ";left:", ";width:", ";min-width:", ";height:", ";"], display, top, right, bottom, left, size, size, size);
|
|
499
511
|
};
|
|
500
512
|
var StyledPaneSplitterButton = styled(ChevronButton).attrs({
|
|
501
513
|
'data-garden-id': COMPONENT_ID,
|
|
502
|
-
'data-garden-version': '8.
|
|
514
|
+
'data-garden-version': '8.54.0',
|
|
503
515
|
isBasic: true,
|
|
504
516
|
isPill: true,
|
|
505
517
|
size: 'small'
|
|
506
518
|
}).withConfig({
|
|
507
519
|
displayName: "StyledPaneSplitterButton",
|
|
508
520
|
componentId: "sc-zh032e-0"
|
|
509
|
-
})(["position:absolute;transition:
|
|
521
|
+
})(["position:absolute;transition: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, colorStyles, function (props) {
|
|
510
522
|
return props.theme.colors.background;
|
|
511
523
|
}, function (props) {
|
|
512
524
|
return retrieveComponentStyles(COMPONENT_ID, props);
|
|
@@ -859,6 +871,7 @@ var PaneSplitterContext = createContext({
|
|
|
859
871
|
max: 0,
|
|
860
872
|
layoutKey: '',
|
|
861
873
|
valueNow: 0,
|
|
874
|
+
size: 0,
|
|
862
875
|
isRow: false
|
|
863
876
|
});
|
|
864
877
|
var usePaneSplitterContext = function usePaneSplitterContext() {
|
|
@@ -866,17 +879,11 @@ var usePaneSplitterContext = function usePaneSplitterContext() {
|
|
|
866
879
|
};
|
|
867
880
|
|
|
868
881
|
var _excluded$1 = ["providerId", "layoutKey", "min", "max", "orientation"];
|
|
869
|
-
var orientationToPosition = {
|
|
870
|
-
start: SplitterPosition.LEADS,
|
|
871
|
-
end: SplitterPosition.TRAILS,
|
|
872
|
-
top: SplitterPosition.LEADS,
|
|
873
|
-
bottom: SplitterPosition.TRAILS
|
|
874
|
-
};
|
|
875
882
|
var paneToSplitterOrientation = {
|
|
876
|
-
start:
|
|
877
|
-
end:
|
|
878
|
-
top:
|
|
879
|
-
bottom:
|
|
883
|
+
start: 'vertical',
|
|
884
|
+
end: 'vertical',
|
|
885
|
+
top: 'horizontal',
|
|
886
|
+
bottom: 'horizontal'
|
|
880
887
|
};
|
|
881
888
|
var orientationToDimension = {
|
|
882
889
|
start: 'columns',
|
|
@@ -885,6 +892,7 @@ var orientationToDimension = {
|
|
|
885
892
|
bottom: 'rows'
|
|
886
893
|
};
|
|
887
894
|
var SplitterComponent = forwardRef(function (_ref, ref) {
|
|
895
|
+
var _separatorRef$current, _separatorRef$current2;
|
|
888
896
|
var providerId = _ref.providerId,
|
|
889
897
|
layoutKey = _ref.layoutKey,
|
|
890
898
|
min = _ref.min,
|
|
@@ -894,27 +902,32 @@ var SplitterComponent = forwardRef(function (_ref, ref) {
|
|
|
894
902
|
var paneProviderContext = usePaneProviderContextData(providerId);
|
|
895
903
|
var paneContext = usePaneContext();
|
|
896
904
|
var themeContext = useContext(ThemeContext);
|
|
897
|
-
var
|
|
905
|
+
var environment = useDocument(themeContext);
|
|
906
|
+
var _useState = useState(false),
|
|
907
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
908
|
+
isHovered = _useState2[0],
|
|
909
|
+
setIsHovered = _useState2[1];
|
|
898
910
|
var isRow = orientationToDimension[orientation] === 'rows';
|
|
899
|
-
var
|
|
911
|
+
var separatorRef = useRef(null);
|
|
912
|
+
var splitterOrientation = paneToSplitterOrientation[orientation || 'end'];
|
|
900
913
|
var pixelsPerFr = paneProviderContext ? paneProviderContext.pixelsPerFr[orientationToDimension[orientation]] : 0;
|
|
901
914
|
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);
|
|
902
915
|
var valueInFr = isRow ? paneProviderContext === null || paneProviderContext === void 0 ? void 0 : paneProviderContext.getRowValue(layoutKey) : paneProviderContext === null || paneProviderContext === void 0 ? void 0 : paneProviderContext.getColumnValue(layoutKey);
|
|
903
916
|
var _useSplitter = useSplitter({
|
|
904
|
-
type: SplitterType.VARIABLE,
|
|
905
917
|
orientation: splitterOrientation,
|
|
906
|
-
|
|
918
|
+
isLeading: orientation === 'start' || orientation === 'top',
|
|
907
919
|
min: min * pixelsPerFr,
|
|
908
920
|
max: max * pixelsPerFr,
|
|
909
921
|
rtl: themeContext.rtl,
|
|
910
|
-
environment:
|
|
922
|
+
environment: environment,
|
|
911
923
|
onChange: function onChange(valueNow) {
|
|
912
924
|
if (isRow) {
|
|
913
925
|
return paneProviderContext === null || paneProviderContext === void 0 ? void 0 : paneProviderContext.setRowValue(orientation === 'top', layoutKey, valueNow / pixelsPerFr);
|
|
914
926
|
}
|
|
915
927
|
return paneProviderContext === null || paneProviderContext === void 0 ? void 0 : paneProviderContext.setColumnValue(orientation === 'start', layoutKey, valueNow / pixelsPerFr);
|
|
916
928
|
},
|
|
917
|
-
valueNow: value
|
|
929
|
+
valueNow: value,
|
|
930
|
+
separatorRef: separatorRef
|
|
918
931
|
}),
|
|
919
932
|
getSeparatorProps = _useSplitter.getSeparatorProps,
|
|
920
933
|
getPrimaryPaneProps = _useSplitter.getPrimaryPaneProps;
|
|
@@ -923,9 +936,17 @@ var SplitterComponent = forwardRef(function (_ref, ref) {
|
|
|
923
936
|
paneContext.setId(getPrimaryPaneProps().id);
|
|
924
937
|
}
|
|
925
938
|
}, [paneContext, getPrimaryPaneProps]);
|
|
939
|
+
var ariaLabel = useText(SplitterComponent, props, 'aria-label', "".concat(splitterOrientation, " splitter"));
|
|
926
940
|
var separatorProps = getSeparatorProps({
|
|
927
|
-
'aria-controls': paneContext.id
|
|
941
|
+
'aria-controls': paneContext.id,
|
|
942
|
+
'aria-label': ariaLabel
|
|
928
943
|
});
|
|
944
|
+
var size = isRow ? (_separatorRef$current = separatorRef.current) === null || _separatorRef$current === void 0 ? void 0 : _separatorRef$current.clientWidth : (_separatorRef$current2 = separatorRef.current) === null || _separatorRef$current2 === void 0 ? void 0 : _separatorRef$current2.clientHeight;
|
|
945
|
+
var onMouseOver = useMemo(function () {
|
|
946
|
+
return composeEventHandlers(props.onMouseOver, function (event) {
|
|
947
|
+
return setIsHovered(event.target === separatorRef.current);
|
|
948
|
+
});
|
|
949
|
+
}, [props.onMouseOver, separatorRef]);
|
|
929
950
|
return React.createElement(PaneSplitterContext.Provider, {
|
|
930
951
|
value: useMemo(function () {
|
|
931
952
|
return {
|
|
@@ -934,13 +955,16 @@ var SplitterComponent = forwardRef(function (_ref, ref) {
|
|
|
934
955
|
min: min,
|
|
935
956
|
max: max,
|
|
936
957
|
valueNow: valueInFr,
|
|
958
|
+
size: size,
|
|
937
959
|
isRow: isRow
|
|
938
960
|
};
|
|
939
|
-
}, [orientation, layoutKey, min, max, valueInFr, isRow])
|
|
961
|
+
}, [orientation, layoutKey, min, max, valueInFr, size, isRow])
|
|
940
962
|
}, React.createElement(StyledPaneSplitter, _extends({
|
|
963
|
+
isHovered: isHovered,
|
|
941
964
|
orientation: orientation
|
|
942
965
|
}, separatorProps, props, {
|
|
943
|
-
|
|
966
|
+
onMouseOver: onMouseOver,
|
|
967
|
+
ref: mergeRefs([separatorRef, ref])
|
|
944
968
|
})));
|
|
945
969
|
});
|
|
946
970
|
SplitterComponent.displayName = 'Pane.Splitter';
|
|
@@ -973,6 +997,7 @@ var SplitterButtonComponent = forwardRef(function (props, ref) {
|
|
|
973
997
|
max = _usePaneSplitterConte.max,
|
|
974
998
|
isRow = _usePaneSplitterConte.isRow,
|
|
975
999
|
valueNow = _usePaneSplitterConte.valueNow,
|
|
1000
|
+
size = _usePaneSplitterConte.size,
|
|
976
1001
|
providerId = _usePaneSplitterConte.providerId;
|
|
977
1002
|
var paneProviderContext = usePaneProviderContextData(providerId);
|
|
978
1003
|
var isTop = orientation === 'top';
|
|
@@ -989,9 +1014,9 @@ var SplitterButtonComponent = forwardRef(function (props, ref) {
|
|
|
989
1014
|
var setValue = useCallback(function (value) {
|
|
990
1015
|
if (isRow) {
|
|
991
1016
|
paneProviderContext.setRowValue(isTop, layoutKey, value);
|
|
992
|
-
|
|
1017
|
+
} else {
|
|
1018
|
+
paneProviderContext.setColumnValue(isStart, layoutKey, value);
|
|
993
1019
|
}
|
|
994
|
-
paneProviderContext.setColumnValue(isStart, layoutKey, value);
|
|
995
1020
|
}, [isRow, isTop, isStart, layoutKey, paneProviderContext]);
|
|
996
1021
|
var onClick = composeEventHandlers(props.onClick, function () {
|
|
997
1022
|
if (isMin) {
|
|
@@ -1004,17 +1029,29 @@ var SplitterButtonComponent = forwardRef(function (props, ref) {
|
|
|
1004
1029
|
return event.stopPropagation();
|
|
1005
1030
|
}
|
|
1006
1031
|
);
|
|
1032
|
+
var onMouseDown = composeEventHandlers(props.onMouseDown, function (event) {
|
|
1033
|
+
return event.stopPropagation();
|
|
1034
|
+
}
|
|
1035
|
+
);
|
|
1007
1036
|
return React.createElement(Tooltip, {
|
|
1008
|
-
content: label
|
|
1037
|
+
content: label,
|
|
1038
|
+
style: {
|
|
1039
|
+
cursor: 'default'
|
|
1040
|
+
},
|
|
1041
|
+
onMouseDown: function onMouseDown(e) {
|
|
1042
|
+
return e.stopPropagation();
|
|
1043
|
+
}
|
|
1009
1044
|
}, React.createElement(StyledPaneSplitterButton, _extends({
|
|
1010
1045
|
"aria-label": label
|
|
1011
1046
|
}, props, {
|
|
1012
1047
|
placement: placement,
|
|
1013
1048
|
orientation: orientation,
|
|
1014
1049
|
isRotated: isMin,
|
|
1050
|
+
splitterSize: size || 0,
|
|
1015
1051
|
ref: ref,
|
|
1016
1052
|
onClick: onClick,
|
|
1017
|
-
onKeyDown: onKeyDown
|
|
1053
|
+
onKeyDown: onKeyDown,
|
|
1054
|
+
onMouseDown: onMouseDown
|
|
1018
1055
|
})));
|
|
1019
1056
|
});
|
|
1020
1057
|
SplitterButtonComponent.displayName = 'Pane.SplitterButton';
|
|
@@ -7,7 +7,8 @@
|
|
|
7
7
|
import { DefaultTheme } from 'styled-components';
|
|
8
8
|
import { Orientation } from '../../types';
|
|
9
9
|
interface IStyledPaneSplitterProps {
|
|
10
|
-
|
|
10
|
+
isHovered: boolean;
|
|
11
|
+
orientation?: Orientation;
|
|
11
12
|
}
|
|
12
13
|
/**
|
|
13
14
|
* 1. Elevated initial context to pickup full-width hover
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zendeskgarden/react-grid",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.54.0",
|
|
4
4
|
"description": "Components relating to layout grids in the Garden Design System",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Zendesk Garden <garden@zendesk.com>",
|
|
@@ -21,10 +21,10 @@
|
|
|
21
21
|
"sideEffects": false,
|
|
22
22
|
"types": "dist/typings/index.d.ts",
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@zendeskgarden/container-splitter": "^0.
|
|
25
|
-
"@zendeskgarden/container-utilities": "^0.
|
|
26
|
-
"@zendeskgarden/react-buttons": "^8.
|
|
27
|
-
"@zendeskgarden/react-tooltips": "^8.
|
|
24
|
+
"@zendeskgarden/container-splitter": "^2.0.0",
|
|
25
|
+
"@zendeskgarden/container-utilities": "^1.0.0",
|
|
26
|
+
"@zendeskgarden/react-buttons": "^8.54.0",
|
|
27
|
+
"@zendeskgarden/react-tooltips": "^8.54.0",
|
|
28
28
|
"polished": "^4.0.0",
|
|
29
29
|
"prop-types": "^15.5.7",
|
|
30
30
|
"react-merge-refs": "^1.1.0"
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"styled-components": "^4.2.0 || ^5.0.0"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@zendeskgarden/react-theming": "^8.
|
|
39
|
+
"@zendeskgarden/react-theming": "^8.54.0",
|
|
40
40
|
"use-resize-observer": "9.0.0"
|
|
41
41
|
},
|
|
42
42
|
"keywords": [
|
|
@@ -48,6 +48,5 @@
|
|
|
48
48
|
"publishConfig": {
|
|
49
49
|
"access": "public"
|
|
50
50
|
},
|
|
51
|
-
"zendeskgarden:src": "src/index.ts"
|
|
52
|
-
"gitHead": "79dee8e82b6f082e8d4a72ba95a5fb3982d63040"
|
|
51
|
+
"zendeskgarden:src": "src/index.ts"
|
|
53
52
|
}
|
package/LICENSE.md
DELETED
|
@@ -1,176 +0,0 @@
|
|
|
1
|
-
Apache License
|
|
2
|
-
Version 2.0, January 2004
|
|
3
|
-
http://www.apache.org/licenses/
|
|
4
|
-
|
|
5
|
-
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
-
|
|
7
|
-
1. Definitions.
|
|
8
|
-
|
|
9
|
-
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
-
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
-
|
|
12
|
-
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
-
the copyright owner that is granting the License.
|
|
14
|
-
|
|
15
|
-
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
-
other entities that control, are controlled by, or are under common
|
|
17
|
-
control with that entity. For the purposes of this definition,
|
|
18
|
-
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
-
direction or management of such entity, whether by contract or
|
|
20
|
-
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
-
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
-
|
|
23
|
-
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
-
exercising permissions granted by this License.
|
|
25
|
-
|
|
26
|
-
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
-
including but not limited to software source code, documentation
|
|
28
|
-
source, and configuration files.
|
|
29
|
-
|
|
30
|
-
"Object" form shall mean any form resulting from mechanical
|
|
31
|
-
transformation or translation of a Source form, including but
|
|
32
|
-
not limited to compiled object code, generated documentation,
|
|
33
|
-
and conversions to other media types.
|
|
34
|
-
|
|
35
|
-
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
-
Object form, made available under the License, as indicated by a
|
|
37
|
-
copyright notice that is included in or attached to the work
|
|
38
|
-
(an example is provided in the Appendix below).
|
|
39
|
-
|
|
40
|
-
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
-
form, that is based on (or derived from) the Work and for which the
|
|
42
|
-
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
-
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
-
of this License, Derivative Works shall not include works that remain
|
|
45
|
-
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
-
the Work and Derivative Works thereof.
|
|
47
|
-
|
|
48
|
-
"Contribution" shall mean any work of authorship, including
|
|
49
|
-
the original version of the Work and any modifications or additions
|
|
50
|
-
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
-
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
-
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
-
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
-
means any form of electronic, verbal, or written communication sent
|
|
55
|
-
to the Licensor or its representatives, including but not limited to
|
|
56
|
-
communication on electronic mailing lists, source code control systems,
|
|
57
|
-
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
-
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
-
excluding communication that is conspicuously marked or otherwise
|
|
60
|
-
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
-
|
|
62
|
-
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
-
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
-
subsequently incorporated within the Work.
|
|
65
|
-
|
|
66
|
-
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
-
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
-
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
-
Work and such Derivative Works in Source or Object form.
|
|
72
|
-
|
|
73
|
-
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
-
(except as stated in this section) patent license to make, have made,
|
|
77
|
-
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
-
where such license applies only to those patent claims licensable
|
|
79
|
-
by such Contributor that are necessarily infringed by their
|
|
80
|
-
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
-
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
-
institute patent litigation against any entity (including a
|
|
83
|
-
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
-
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
-
or contributory patent infringement, then any patent licenses
|
|
86
|
-
granted to You under this License for that Work shall terminate
|
|
87
|
-
as of the date such litigation is filed.
|
|
88
|
-
|
|
89
|
-
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
-
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
-
modifications, and in Source or Object form, provided that You
|
|
92
|
-
meet the following conditions:
|
|
93
|
-
|
|
94
|
-
(a) You must give any other recipients of the Work or
|
|
95
|
-
Derivative Works a copy of this License; and
|
|
96
|
-
|
|
97
|
-
(b) You must cause any modified files to carry prominent notices
|
|
98
|
-
stating that You changed the files; and
|
|
99
|
-
|
|
100
|
-
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
-
that You distribute, all copyright, patent, trademark, and
|
|
102
|
-
attribution notices from the Source form of the Work,
|
|
103
|
-
excluding those notices that do not pertain to any part of
|
|
104
|
-
the Derivative Works; and
|
|
105
|
-
|
|
106
|
-
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
-
distribution, then any Derivative Works that You distribute must
|
|
108
|
-
include a readable copy of the attribution notices contained
|
|
109
|
-
within such NOTICE file, excluding those notices that do not
|
|
110
|
-
pertain to any part of the Derivative Works, in at least one
|
|
111
|
-
of the following places: within a NOTICE text file distributed
|
|
112
|
-
as part of the Derivative Works; within the Source form or
|
|
113
|
-
documentation, if provided along with the Derivative Works; or,
|
|
114
|
-
within a display generated by the Derivative Works, if and
|
|
115
|
-
wherever such third-party notices normally appear. The contents
|
|
116
|
-
of the NOTICE file are for informational purposes only and
|
|
117
|
-
do not modify the License. You may add Your own attribution
|
|
118
|
-
notices within Derivative Works that You distribute, alongside
|
|
119
|
-
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
-
that such additional attribution notices cannot be construed
|
|
121
|
-
as modifying the License.
|
|
122
|
-
|
|
123
|
-
You may add Your own copyright statement to Your modifications and
|
|
124
|
-
may provide additional or different license terms and conditions
|
|
125
|
-
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
-
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
-
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
-
the conditions stated in this License.
|
|
129
|
-
|
|
130
|
-
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
-
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
-
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
-
this License, without any additional terms or conditions.
|
|
134
|
-
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
-
the terms of any separate license agreement you may have executed
|
|
136
|
-
with Licensor regarding such Contributions.
|
|
137
|
-
|
|
138
|
-
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
-
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
-
except as required for reasonable and customary use in describing the
|
|
141
|
-
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
-
|
|
143
|
-
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
-
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
-
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
-
implied, including, without limitation, any warranties or conditions
|
|
148
|
-
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
-
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
-
appropriateness of using or redistributing the Work and assume any
|
|
151
|
-
risks associated with Your exercise of permissions under this License.
|
|
152
|
-
|
|
153
|
-
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
-
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
-
unless required by applicable law (such as deliberate and grossly
|
|
156
|
-
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
-
liable to You for damages, including any direct, indirect, special,
|
|
158
|
-
incidental, or consequential damages of any character arising as a
|
|
159
|
-
result of this License or out of the use or inability to use the
|
|
160
|
-
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
-
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
-
other commercial damages or losses), even if such Contributor
|
|
163
|
-
has been advised of the possibility of such damages.
|
|
164
|
-
|
|
165
|
-
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
-
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
-
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
-
or other liability obligations and/or rights consistent with this
|
|
169
|
-
License. However, in accepting such obligations, You may act only
|
|
170
|
-
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
-
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
-
defend, and hold each Contributor harmless for any liability
|
|
173
|
-
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
-
of your accepting any such warranty or additional liability.
|
|
175
|
-
|
|
176
|
-
END OF TERMS AND CONDITIONS
|