@zendeskgarden/react-grid 8.62.0 → 8.62.2
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 +5 -0
- package/dist/index.cjs.js +118 -105
- package/dist/index.esm.js +24 -10
- package/dist/typings/utils/usePaneContext.d.ts +1 -0
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -103,3 +103,8 @@ import { PaneProvider, Pane } from '@zendeskgarden/react-grid';
|
|
|
103
103
|
</PaneProvider>
|
|
104
104
|
</ThemeProvider>;
|
|
105
105
|
```
|
|
106
|
+
|
|
107
|
+
> the `Pane` component uses [`ResizeObserver`](https://developer.mozilla.org/en-US/docs/Web/API/Resize_Observer_API)
|
|
108
|
+
> which is not available in node.js or other server side environments (if testing with Jest) - please
|
|
109
|
+
> make sure to polyfill as needed. Since the ref used internally is not created when server side rendering,
|
|
110
|
+
> the ResizeObserver API will not be invoked and should not pose an issue when doing so.
|
package/dist/index.cjs.js
CHANGED
|
@@ -7,8 +7,6 @@
|
|
|
7
7
|
|
|
8
8
|
'use strict';
|
|
9
9
|
|
|
10
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
11
|
-
|
|
12
10
|
var React = require('react');
|
|
13
11
|
var PropTypes = require('prop-types');
|
|
14
12
|
var styled = require('styled-components');
|
|
@@ -16,16 +14,18 @@ var polished = require('polished');
|
|
|
16
14
|
var reactTheming = require('@zendeskgarden/react-theming');
|
|
17
15
|
var reactButtons = require('@zendeskgarden/react-buttons');
|
|
18
16
|
var containerUtilities = require('@zendeskgarden/container-utilities');
|
|
17
|
+
var useResizeObserver = require('use-resize-observer');
|
|
19
18
|
var mergeRefs = require('react-merge-refs');
|
|
20
19
|
var containerSplitter = require('@zendeskgarden/container-splitter');
|
|
21
20
|
var reactTooltips = require('@zendeskgarden/react-tooltips');
|
|
22
21
|
|
|
23
|
-
function
|
|
22
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
24
23
|
|
|
25
|
-
var React__default = /*#__PURE__*/
|
|
26
|
-
var PropTypes__default = /*#__PURE__*/
|
|
27
|
-
var styled__default = /*#__PURE__*/
|
|
28
|
-
var
|
|
24
|
+
var React__default = /*#__PURE__*/_interopDefault(React);
|
|
25
|
+
var PropTypes__default = /*#__PURE__*/_interopDefault(PropTypes);
|
|
26
|
+
var styled__default = /*#__PURE__*/_interopDefault(styled);
|
|
27
|
+
var useResizeObserver__default = /*#__PURE__*/_interopDefault(useResizeObserver);
|
|
28
|
+
var mergeRefs__default = /*#__PURE__*/_interopDefault(mergeRefs);
|
|
29
29
|
|
|
30
30
|
function _extends() {
|
|
31
31
|
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
@@ -101,9 +101,9 @@ const sizeStyles$4 = props => {
|
|
|
101
101
|
const padding = props.gutters ? polished.math(`${props.theme.space[props.gutters]} / 2`) : 0;
|
|
102
102
|
return styled.css(["padding-right:", ";padding-left:", ";"], padding, padding);
|
|
103
103
|
};
|
|
104
|
-
const StyledCol = styled__default
|
|
104
|
+
const StyledCol = styled__default.default.div.attrs({
|
|
105
105
|
'data-garden-id': COMPONENT_ID$6,
|
|
106
|
-
'data-garden-version': '8.62.
|
|
106
|
+
'data-garden-version': '8.62.2'
|
|
107
107
|
}).withConfig({
|
|
108
108
|
displayName: "StyledCol",
|
|
109
109
|
componentId: "sc-inuw62-0"
|
|
@@ -123,9 +123,9 @@ const sizeStyles$3 = props => {
|
|
|
123
123
|
const padding = props.gutters ? polished.math(`${props.theme.space[props.gutters]} / 2`) : 0;
|
|
124
124
|
return styled.css(["padding-right:", ";padding-left:", ";"], padding, padding);
|
|
125
125
|
};
|
|
126
|
-
const StyledGrid = styled__default
|
|
126
|
+
const StyledGrid = styled__default.default.div.attrs({
|
|
127
127
|
'data-garden-id': COMPONENT_ID$5,
|
|
128
|
-
'data-garden-version': '8.62.
|
|
128
|
+
'data-garden-version': '8.62.2'
|
|
129
129
|
}).withConfig({
|
|
130
130
|
displayName: "StyledGrid",
|
|
131
131
|
componentId: "sc-oxgg5i-0"
|
|
@@ -165,9 +165,9 @@ const sizeStyles$2 = props => {
|
|
|
165
165
|
const margin = props.gutters ? polished.math(`${props.theme.space[props.gutters]} / 2`) : 0;
|
|
166
166
|
return styled.css(["margin-right:-", ";margin-left:-", ";"], margin, margin);
|
|
167
167
|
};
|
|
168
|
-
const StyledRow = styled__default
|
|
168
|
+
const StyledRow = styled__default.default.div.attrs({
|
|
169
169
|
'data-garden-id': COMPONENT_ID$4,
|
|
170
|
-
'data-garden-version': '8.62.
|
|
170
|
+
'data-garden-version': '8.62.2'
|
|
171
171
|
}).withConfig({
|
|
172
172
|
displayName: "StyledRow",
|
|
173
173
|
componentId: "sc-xjsdg1-0"
|
|
@@ -178,9 +178,9 @@ StyledRow.defaultProps = {
|
|
|
178
178
|
};
|
|
179
179
|
|
|
180
180
|
const COMPONENT_ID$3 = 'pane';
|
|
181
|
-
const StyledPane = styled__default
|
|
181
|
+
const StyledPane = styled__default.default.div.attrs({
|
|
182
182
|
'data-garden-id': COMPONENT_ID$3,
|
|
183
|
-
'data-garden-version': '8.62.
|
|
183
|
+
'data-garden-version': '8.62.2'
|
|
184
184
|
}).withConfig({
|
|
185
185
|
displayName: "StyledPane",
|
|
186
186
|
componentId: "sc-1ltjst7-0"
|
|
@@ -190,13 +190,13 @@ StyledPane.defaultProps = {
|
|
|
190
190
|
};
|
|
191
191
|
|
|
192
192
|
const COMPONENT_ID$2 = 'pane.content';
|
|
193
|
-
const StyledPaneContent = styled__default
|
|
193
|
+
const StyledPaneContent = styled__default.default.div.attrs({
|
|
194
194
|
'data-garden-id': COMPONENT_ID$2,
|
|
195
|
-
'data-garden-version': '8.62.
|
|
195
|
+
'data-garden-version': '8.62.2'
|
|
196
196
|
}).withConfig({
|
|
197
197
|
displayName: "StyledPaneContent",
|
|
198
198
|
componentId: "sc-1b38mbh-0"
|
|
199
|
-
})(["height:100%;overflow:auto;", ";"], props => reactTheming.retrieveComponentStyles(COMPONENT_ID$2, props));
|
|
199
|
+
})(["height:100%;overflow:auto;&[hidden]{display:none;}", ";"], props => reactTheming.retrieveComponentStyles(COMPONENT_ID$2, props));
|
|
200
200
|
StyledPaneContent.defaultProps = {
|
|
201
201
|
theme: reactTheming.DEFAULT_THEME
|
|
202
202
|
};
|
|
@@ -270,9 +270,9 @@ const sizeStyles$1 = props => {
|
|
|
270
270
|
const dimensionProperty = width === '100%' ? 'height' : 'width';
|
|
271
271
|
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, props.isFixed ? 'pointer' : cursor, width, height, separatorWidth, separatorHeight, dimensionProperty, props.isHovered && separatorSize, dimensionProperty, separatorSize, props.theme.borderRadii.md);
|
|
272
272
|
};
|
|
273
|
-
const StyledPaneSplitter = styled__default
|
|
273
|
+
const StyledPaneSplitter = styled__default.default.div.attrs({
|
|
274
274
|
'data-garden-id': COMPONENT_ID$1,
|
|
275
|
-
'data-garden-version': '8.62.
|
|
275
|
+
'data-garden-version': '8.62.2'
|
|
276
276
|
}).withConfig({
|
|
277
277
|
displayName: "StyledPaneSplitter",
|
|
278
278
|
componentId: "sc-jylemn-0"
|
|
@@ -333,9 +333,9 @@ const sizeStyles = props => {
|
|
|
333
333
|
}
|
|
334
334
|
return styled.css(["display:", ";top:", ";right:", ";bottom:", ";left:", ";width:", ";min-width:", ";height:", ";"], display, top, right, bottom, left, size, size, size);
|
|
335
335
|
};
|
|
336
|
-
const StyledPaneSplitterButton = styled__default
|
|
336
|
+
const StyledPaneSplitterButton = styled__default.default(reactButtons.ChevronButton).attrs({
|
|
337
337
|
'data-garden-id': COMPONENT_ID,
|
|
338
|
-
'data-garden-version': '8.62.
|
|
338
|
+
'data-garden-version': '8.62.2',
|
|
339
339
|
isBasic: true,
|
|
340
340
|
isPill: true,
|
|
341
341
|
size: 'small'
|
|
@@ -354,7 +354,7 @@ const useGridContext = () => {
|
|
|
354
354
|
return React.useContext(GridContext);
|
|
355
355
|
};
|
|
356
356
|
|
|
357
|
-
const Col = React__default
|
|
357
|
+
const Col = React__default.default.forwardRef((_ref, ref) => {
|
|
358
358
|
let {
|
|
359
359
|
size,
|
|
360
360
|
...props
|
|
@@ -364,7 +364,7 @@ const Col = React__default["default"].forwardRef((_ref, ref) => {
|
|
|
364
364
|
gutters,
|
|
365
365
|
debug
|
|
366
366
|
} = useGridContext();
|
|
367
|
-
return React__default
|
|
367
|
+
return React__default.default.createElement(StyledCol, _extends({
|
|
368
368
|
sizeAll: size,
|
|
369
369
|
columns: columns,
|
|
370
370
|
gutters: gutters,
|
|
@@ -374,39 +374,39 @@ const Col = React__default["default"].forwardRef((_ref, ref) => {
|
|
|
374
374
|
});
|
|
375
375
|
Col.displayName = 'Col';
|
|
376
376
|
Col.propTypes = {
|
|
377
|
-
size: PropTypes__default
|
|
378
|
-
xs: PropTypes__default
|
|
379
|
-
sm: PropTypes__default
|
|
380
|
-
md: PropTypes__default
|
|
381
|
-
lg: PropTypes__default
|
|
382
|
-
xl: PropTypes__default
|
|
383
|
-
alignSelf: PropTypes__default
|
|
384
|
-
alignSelfXs: PropTypes__default
|
|
385
|
-
alignSelfSm: PropTypes__default
|
|
386
|
-
alignSelfMd: PropTypes__default
|
|
387
|
-
alignSelfLg: PropTypes__default
|
|
388
|
-
alignSelfXl: PropTypes__default
|
|
389
|
-
textAlign: PropTypes__default
|
|
390
|
-
textAlignXs: PropTypes__default
|
|
391
|
-
textAlignSm: PropTypes__default
|
|
392
|
-
textAlignMd: PropTypes__default
|
|
393
|
-
textAlignLg: PropTypes__default
|
|
394
|
-
textAlignXl: PropTypes__default
|
|
395
|
-
offset: PropTypes__default
|
|
396
|
-
offsetXs: PropTypes__default
|
|
397
|
-
offsetSm: PropTypes__default
|
|
398
|
-
offsetMd: PropTypes__default
|
|
399
|
-
offsetLg: PropTypes__default
|
|
400
|
-
offsetXl: PropTypes__default
|
|
401
|
-
order: PropTypes__default
|
|
402
|
-
orderXs: PropTypes__default
|
|
403
|
-
orderSm: PropTypes__default
|
|
404
|
-
orderMd: PropTypes__default
|
|
405
|
-
orderLg: PropTypes__default
|
|
406
|
-
orderXl: PropTypes__default
|
|
377
|
+
size: PropTypes__default.default.oneOfType([PropTypes__default.default.number, PropTypes__default.default.string]),
|
|
378
|
+
xs: PropTypes__default.default.oneOfType([PropTypes__default.default.number, PropTypes__default.default.string, PropTypes__default.default.bool]),
|
|
379
|
+
sm: PropTypes__default.default.oneOfType([PropTypes__default.default.number, PropTypes__default.default.string, PropTypes__default.default.bool]),
|
|
380
|
+
md: PropTypes__default.default.oneOfType([PropTypes__default.default.number, PropTypes__default.default.string, PropTypes__default.default.bool]),
|
|
381
|
+
lg: PropTypes__default.default.oneOfType([PropTypes__default.default.number, PropTypes__default.default.string, PropTypes__default.default.bool]),
|
|
382
|
+
xl: PropTypes__default.default.oneOfType([PropTypes__default.default.number, PropTypes__default.default.string, PropTypes__default.default.bool]),
|
|
383
|
+
alignSelf: PropTypes__default.default.oneOf(ALIGN_SELF),
|
|
384
|
+
alignSelfXs: PropTypes__default.default.oneOf(ALIGN_SELF),
|
|
385
|
+
alignSelfSm: PropTypes__default.default.oneOf(ALIGN_SELF),
|
|
386
|
+
alignSelfMd: PropTypes__default.default.oneOf(ALIGN_SELF),
|
|
387
|
+
alignSelfLg: PropTypes__default.default.oneOf(ALIGN_SELF),
|
|
388
|
+
alignSelfXl: PropTypes__default.default.oneOf(ALIGN_SELF),
|
|
389
|
+
textAlign: PropTypes__default.default.oneOf(TEXT_ALIGN),
|
|
390
|
+
textAlignXs: PropTypes__default.default.oneOf(TEXT_ALIGN),
|
|
391
|
+
textAlignSm: PropTypes__default.default.oneOf(TEXT_ALIGN),
|
|
392
|
+
textAlignMd: PropTypes__default.default.oneOf(TEXT_ALIGN),
|
|
393
|
+
textAlignLg: PropTypes__default.default.oneOf(TEXT_ALIGN),
|
|
394
|
+
textAlignXl: PropTypes__default.default.oneOf(TEXT_ALIGN),
|
|
395
|
+
offset: PropTypes__default.default.oneOfType([PropTypes__default.default.number, PropTypes__default.default.string]),
|
|
396
|
+
offsetXs: PropTypes__default.default.oneOfType([PropTypes__default.default.number, PropTypes__default.default.string]),
|
|
397
|
+
offsetSm: PropTypes__default.default.oneOfType([PropTypes__default.default.number, PropTypes__default.default.string]),
|
|
398
|
+
offsetMd: PropTypes__default.default.oneOfType([PropTypes__default.default.number, PropTypes__default.default.string]),
|
|
399
|
+
offsetLg: PropTypes__default.default.oneOfType([PropTypes__default.default.number, PropTypes__default.default.string]),
|
|
400
|
+
offsetXl: PropTypes__default.default.oneOfType([PropTypes__default.default.number, PropTypes__default.default.string]),
|
|
401
|
+
order: PropTypes__default.default.oneOfType([PropTypes__default.default.number, PropTypes__default.default.string]),
|
|
402
|
+
orderXs: PropTypes__default.default.oneOfType([PropTypes__default.default.number, PropTypes__default.default.string]),
|
|
403
|
+
orderSm: PropTypes__default.default.oneOfType([PropTypes__default.default.number, PropTypes__default.default.string]),
|
|
404
|
+
orderMd: PropTypes__default.default.oneOfType([PropTypes__default.default.number, PropTypes__default.default.string]),
|
|
405
|
+
orderLg: PropTypes__default.default.oneOfType([PropTypes__default.default.number, PropTypes__default.default.string]),
|
|
406
|
+
orderXl: PropTypes__default.default.oneOfType([PropTypes__default.default.number, PropTypes__default.default.string])
|
|
407
407
|
};
|
|
408
408
|
|
|
409
|
-
const Grid = React__default
|
|
409
|
+
const Grid = React__default.default.forwardRef((_ref, ref) => {
|
|
410
410
|
let {
|
|
411
411
|
columns,
|
|
412
412
|
debug,
|
|
@@ -417,25 +417,25 @@ const Grid = React__default["default"].forwardRef((_ref, ref) => {
|
|
|
417
417
|
gutters: props.gutters,
|
|
418
418
|
debug
|
|
419
419
|
}), [columns, props.gutters, debug]);
|
|
420
|
-
return React__default
|
|
420
|
+
return React__default.default.createElement(GridContext.Provider, {
|
|
421
421
|
value: value
|
|
422
|
-
}, React__default
|
|
422
|
+
}, React__default.default.createElement(StyledGrid, _extends({
|
|
423
423
|
debug: debug,
|
|
424
424
|
ref: ref
|
|
425
425
|
}, props)));
|
|
426
426
|
});
|
|
427
427
|
Grid.displayName = 'Grid';
|
|
428
428
|
Grid.propTypes = {
|
|
429
|
-
columns: PropTypes__default
|
|
430
|
-
gutters: PropTypes__default
|
|
431
|
-
debug: PropTypes__default
|
|
429
|
+
columns: PropTypes__default.default.oneOfType([PropTypes__default.default.number, PropTypes__default.default.string]),
|
|
430
|
+
gutters: PropTypes__default.default.oneOf(SPACE),
|
|
431
|
+
debug: PropTypes__default.default.bool
|
|
432
432
|
};
|
|
433
433
|
Grid.defaultProps = {
|
|
434
434
|
columns: 12,
|
|
435
435
|
gutters: 'md'
|
|
436
436
|
};
|
|
437
437
|
|
|
438
|
-
const Row = React__default
|
|
438
|
+
const Row = React__default.default.forwardRef((_ref, ref) => {
|
|
439
439
|
let {
|
|
440
440
|
wrap,
|
|
441
441
|
...props
|
|
@@ -444,7 +444,7 @@ const Row = React__default["default"].forwardRef((_ref, ref) => {
|
|
|
444
444
|
gutters,
|
|
445
445
|
debug
|
|
446
446
|
} = useGridContext();
|
|
447
|
-
return React__default
|
|
447
|
+
return React__default.default.createElement(StyledRow, _extends({
|
|
448
448
|
gutters: gutters,
|
|
449
449
|
debug: debug,
|
|
450
450
|
wrapAll: wrap,
|
|
@@ -453,24 +453,24 @@ const Row = React__default["default"].forwardRef((_ref, ref) => {
|
|
|
453
453
|
});
|
|
454
454
|
Row.displayName = 'Row';
|
|
455
455
|
Row.propTypes = {
|
|
456
|
-
alignItems: PropTypes__default
|
|
457
|
-
alignItemsXs: PropTypes__default
|
|
458
|
-
alignItemsSm: PropTypes__default
|
|
459
|
-
alignItemsMd: PropTypes__default
|
|
460
|
-
alignItemsLg: PropTypes__default
|
|
461
|
-
alignItemsXl: PropTypes__default
|
|
462
|
-
justifyContent: PropTypes__default
|
|
463
|
-
justifyContentXs: PropTypes__default
|
|
464
|
-
justifyContentSm: PropTypes__default
|
|
465
|
-
justifyContentMd: PropTypes__default
|
|
466
|
-
justifyContentLg: PropTypes__default
|
|
467
|
-
justifyContentXl: PropTypes__default
|
|
468
|
-
wrap: PropTypes__default
|
|
469
|
-
wrapXs: PropTypes__default
|
|
470
|
-
wrapSm: PropTypes__default
|
|
471
|
-
wrapMd: PropTypes__default
|
|
472
|
-
wrapLg: PropTypes__default
|
|
473
|
-
wrapXl: PropTypes__default
|
|
456
|
+
alignItems: PropTypes__default.default.oneOf(ALIGN_ITEMS),
|
|
457
|
+
alignItemsXs: PropTypes__default.default.oneOf(ALIGN_ITEMS),
|
|
458
|
+
alignItemsSm: PropTypes__default.default.oneOf(ALIGN_ITEMS),
|
|
459
|
+
alignItemsMd: PropTypes__default.default.oneOf(ALIGN_ITEMS),
|
|
460
|
+
alignItemsLg: PropTypes__default.default.oneOf(ALIGN_ITEMS),
|
|
461
|
+
alignItemsXl: PropTypes__default.default.oneOf(ALIGN_ITEMS),
|
|
462
|
+
justifyContent: PropTypes__default.default.oneOf(JUSTIFY_CONTENT),
|
|
463
|
+
justifyContentXs: PropTypes__default.default.oneOf(JUSTIFY_CONTENT),
|
|
464
|
+
justifyContentSm: PropTypes__default.default.oneOf(JUSTIFY_CONTENT),
|
|
465
|
+
justifyContentMd: PropTypes__default.default.oneOf(JUSTIFY_CONTENT),
|
|
466
|
+
justifyContentLg: PropTypes__default.default.oneOf(JUSTIFY_CONTENT),
|
|
467
|
+
justifyContentXl: PropTypes__default.default.oneOf(JUSTIFY_CONTENT),
|
|
468
|
+
wrap: PropTypes__default.default.oneOf(WRAP),
|
|
469
|
+
wrapXs: PropTypes__default.default.oneOf(WRAP),
|
|
470
|
+
wrapSm: PropTypes__default.default.oneOf(WRAP),
|
|
471
|
+
wrapMd: PropTypes__default.default.oneOf(WRAP),
|
|
472
|
+
wrapLg: PropTypes__default.default.oneOf(WRAP),
|
|
473
|
+
wrapXl: PropTypes__default.default.oneOf(WRAP)
|
|
474
474
|
};
|
|
475
475
|
|
|
476
476
|
const PaneProviderContext = React.createContext({});
|
|
@@ -643,7 +643,7 @@ const PaneProvider = _ref2 => {
|
|
|
643
643
|
}
|
|
644
644
|
}
|
|
645
645
|
} : {}, [providerId, parentPaneProviderContext, rowState, columnState, setRowValue, setColumnValue, getRowValue, getColumnValue, totalPanesHeight, totalPanesWidth, pixelsPerFr]);
|
|
646
|
-
return React__default
|
|
646
|
+
return React__default.default.createElement(PaneProviderContext.Provider, {
|
|
647
647
|
value: paneProviderContext
|
|
648
648
|
}, children === null || children === void 0 ? void 0 : children({
|
|
649
649
|
id: providerId,
|
|
@@ -655,15 +655,15 @@ const PaneProvider = _ref2 => {
|
|
|
655
655
|
};
|
|
656
656
|
PaneProvider.displayName = 'PaneProvider';
|
|
657
657
|
PaneProvider.propTypes = {
|
|
658
|
-
id: PropTypes__default
|
|
659
|
-
totalPanesWidth: PropTypes__default
|
|
660
|
-
totalPanesHeight: PropTypes__default
|
|
661
|
-
defaultRowValues: PropTypes__default
|
|
662
|
-
defaultColumnValues: PropTypes__default
|
|
663
|
-
rowValues: PropTypes__default
|
|
664
|
-
columnValues: PropTypes__default
|
|
665
|
-
onChange: PropTypes__default
|
|
666
|
-
children: PropTypes__default
|
|
658
|
+
id: PropTypes__default.default.string,
|
|
659
|
+
totalPanesWidth: PropTypes__default.default.number.isRequired,
|
|
660
|
+
totalPanesHeight: PropTypes__default.default.number.isRequired,
|
|
661
|
+
defaultRowValues: PropTypes__default.default.object,
|
|
662
|
+
defaultColumnValues: PropTypes__default.default.object,
|
|
663
|
+
rowValues: PropTypes__default.default.object,
|
|
664
|
+
columnValues: PropTypes__default.default.object,
|
|
665
|
+
onChange: PropTypes__default.default.func,
|
|
666
|
+
children: PropTypes__default.default.func
|
|
667
667
|
};
|
|
668
668
|
|
|
669
669
|
const PaneContext = React.createContext({
|
|
@@ -760,7 +760,7 @@ const SplitterComponent = React.forwardRef((_ref, ref) => {
|
|
|
760
760
|
});
|
|
761
761
|
const 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;
|
|
762
762
|
const onMouseOver = React.useMemo(() => containerUtilities.composeEventHandlers(props.onMouseOver, event => setIsHovered(event.target === separatorRef.current)), [props.onMouseOver, separatorRef]);
|
|
763
|
-
return React__default
|
|
763
|
+
return React__default.default.createElement(PaneSplitterContext.Provider, {
|
|
764
764
|
value: React.useMemo(() => ({
|
|
765
765
|
orientation,
|
|
766
766
|
layoutKey,
|
|
@@ -770,22 +770,22 @@ const SplitterComponent = React.forwardRef((_ref, ref) => {
|
|
|
770
770
|
size,
|
|
771
771
|
isRow
|
|
772
772
|
}), [orientation, layoutKey, min, max, valueInFr, size, isRow])
|
|
773
|
-
}, React__default
|
|
773
|
+
}, React__default.default.createElement(StyledPaneSplitter, _extends({
|
|
774
774
|
isHovered: isHovered,
|
|
775
775
|
isFixed: isFixed,
|
|
776
776
|
orientation: orientation
|
|
777
777
|
}, separatorProps, props, {
|
|
778
778
|
onMouseOver: onMouseOver,
|
|
779
|
-
ref: mergeRefs__default
|
|
779
|
+
ref: mergeRefs__default.default([separatorRef, ref])
|
|
780
780
|
})));
|
|
781
781
|
});
|
|
782
782
|
SplitterComponent.displayName = 'Pane.Splitter';
|
|
783
783
|
SplitterComponent.propTypes = {
|
|
784
|
-
layoutKey: PropTypes__default
|
|
785
|
-
min: PropTypes__default
|
|
786
|
-
max: PropTypes__default
|
|
787
|
-
orientation: PropTypes__default
|
|
788
|
-
isFixed: PropTypes__default
|
|
784
|
+
layoutKey: PropTypes__default.default.string.isRequired,
|
|
785
|
+
min: PropTypes__default.default.number.isRequired,
|
|
786
|
+
max: PropTypes__default.default.number.isRequired,
|
|
787
|
+
orientation: PropTypes__default.default.oneOf(ORIENTATION),
|
|
788
|
+
isFixed: PropTypes__default.default.bool
|
|
789
789
|
};
|
|
790
790
|
SplitterComponent.defaultProps = {
|
|
791
791
|
orientation: 'end'
|
|
@@ -793,7 +793,11 @@ SplitterComponent.defaultProps = {
|
|
|
793
793
|
const Splitter = SplitterComponent;
|
|
794
794
|
|
|
795
795
|
const ContentComponent = React.forwardRef((props, ref) => {
|
|
796
|
-
|
|
796
|
+
const {
|
|
797
|
+
isVisible
|
|
798
|
+
} = usePaneContext();
|
|
799
|
+
return React__default.default.createElement(StyledPaneContent, _extends({
|
|
800
|
+
hidden: !isVisible,
|
|
797
801
|
ref: ref
|
|
798
802
|
}, props));
|
|
799
803
|
});
|
|
@@ -845,13 +849,13 @@ const SplitterButtonComponent = React.forwardRef((props, ref) => {
|
|
|
845
849
|
);
|
|
846
850
|
const onMouseDown = containerUtilities.composeEventHandlers(props.onMouseDown, event => event.stopPropagation()
|
|
847
851
|
);
|
|
848
|
-
return React__default
|
|
852
|
+
return React__default.default.createElement(reactTooltips.Tooltip, {
|
|
849
853
|
content: label,
|
|
850
854
|
style: {
|
|
851
855
|
cursor: 'default'
|
|
852
856
|
},
|
|
853
857
|
onMouseDown: e => e.stopPropagation()
|
|
854
|
-
}, React__default
|
|
858
|
+
}, React__default.default.createElement(StyledPaneSplitterButton, _extends({
|
|
855
859
|
"aria-label": label
|
|
856
860
|
}, props, {
|
|
857
861
|
placement: placement,
|
|
@@ -873,15 +877,24 @@ const PaneComponent = React.forwardRef((_ref, ref) => {
|
|
|
873
877
|
...props
|
|
874
878
|
} = _ref;
|
|
875
879
|
const [paneId, setPaneId] = React.useState();
|
|
880
|
+
const observerRef = React.useRef(null);
|
|
881
|
+
const {
|
|
882
|
+
width = 0,
|
|
883
|
+
height = 0
|
|
884
|
+
} = useResizeObserver__default.default({
|
|
885
|
+
ref: observerRef
|
|
886
|
+
});
|
|
887
|
+
const isVisible = React.useMemo(() => observerRef.current ? width > 0 && height > 0 : true, [width, height]);
|
|
876
888
|
const paneContext = React.useMemo(() => ({
|
|
889
|
+
isVisible,
|
|
877
890
|
id: paneId,
|
|
878
891
|
setId: id => setPaneId(id)
|
|
879
|
-
}), [paneId]);
|
|
880
|
-
return React__default
|
|
892
|
+
}), [paneId, isVisible]);
|
|
893
|
+
return React__default.default.createElement(PaneContext.Provider, {
|
|
881
894
|
value: paneContext
|
|
882
|
-
}, React__default
|
|
895
|
+
}, React__default.default.createElement(StyledPane, _extends({
|
|
883
896
|
id: paneId,
|
|
884
|
-
ref: ref
|
|
897
|
+
ref: mergeRefs__default.default([ref, observerRef])
|
|
885
898
|
}, props), children));
|
|
886
899
|
});
|
|
887
900
|
PaneComponent.displayName = 'Pane';
|
package/dist/index.esm.js
CHANGED
|
@@ -12,6 +12,7 @@ import { math, rgba, stripUnit } from 'polished';
|
|
|
12
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
|
+
import useResizeObserver from 'use-resize-observer';
|
|
15
16
|
import mergeRefs from 'react-merge-refs';
|
|
16
17
|
import { useSplitter } from '@zendeskgarden/container-splitter';
|
|
17
18
|
import { Tooltip } from '@zendeskgarden/react-tooltips';
|
|
@@ -92,7 +93,7 @@ const sizeStyles$4 = props => {
|
|
|
92
93
|
};
|
|
93
94
|
const StyledCol = styled.div.attrs({
|
|
94
95
|
'data-garden-id': COMPONENT_ID$6,
|
|
95
|
-
'data-garden-version': '8.62.
|
|
96
|
+
'data-garden-version': '8.62.2'
|
|
96
97
|
}).withConfig({
|
|
97
98
|
displayName: "StyledCol",
|
|
98
99
|
componentId: "sc-inuw62-0"
|
|
@@ -114,7 +115,7 @@ const sizeStyles$3 = props => {
|
|
|
114
115
|
};
|
|
115
116
|
const StyledGrid = styled.div.attrs({
|
|
116
117
|
'data-garden-id': COMPONENT_ID$5,
|
|
117
|
-
'data-garden-version': '8.62.
|
|
118
|
+
'data-garden-version': '8.62.2'
|
|
118
119
|
}).withConfig({
|
|
119
120
|
displayName: "StyledGrid",
|
|
120
121
|
componentId: "sc-oxgg5i-0"
|
|
@@ -156,7 +157,7 @@ const sizeStyles$2 = props => {
|
|
|
156
157
|
};
|
|
157
158
|
const StyledRow = styled.div.attrs({
|
|
158
159
|
'data-garden-id': COMPONENT_ID$4,
|
|
159
|
-
'data-garden-version': '8.62.
|
|
160
|
+
'data-garden-version': '8.62.2'
|
|
160
161
|
}).withConfig({
|
|
161
162
|
displayName: "StyledRow",
|
|
162
163
|
componentId: "sc-xjsdg1-0"
|
|
@@ -169,7 +170,7 @@ StyledRow.defaultProps = {
|
|
|
169
170
|
const COMPONENT_ID$3 = 'pane';
|
|
170
171
|
const StyledPane = styled.div.attrs({
|
|
171
172
|
'data-garden-id': COMPONENT_ID$3,
|
|
172
|
-
'data-garden-version': '8.62.
|
|
173
|
+
'data-garden-version': '8.62.2'
|
|
173
174
|
}).withConfig({
|
|
174
175
|
displayName: "StyledPane",
|
|
175
176
|
componentId: "sc-1ltjst7-0"
|
|
@@ -181,11 +182,11 @@ StyledPane.defaultProps = {
|
|
|
181
182
|
const COMPONENT_ID$2 = 'pane.content';
|
|
182
183
|
const StyledPaneContent = styled.div.attrs({
|
|
183
184
|
'data-garden-id': COMPONENT_ID$2,
|
|
184
|
-
'data-garden-version': '8.62.
|
|
185
|
+
'data-garden-version': '8.62.2'
|
|
185
186
|
}).withConfig({
|
|
186
187
|
displayName: "StyledPaneContent",
|
|
187
188
|
componentId: "sc-1b38mbh-0"
|
|
188
|
-
})(["height:100%;overflow:auto;", ";"], props => retrieveComponentStyles(COMPONENT_ID$2, props));
|
|
189
|
+
})(["height:100%;overflow:auto;&[hidden]{display:none;}", ";"], props => retrieveComponentStyles(COMPONENT_ID$2, props));
|
|
189
190
|
StyledPaneContent.defaultProps = {
|
|
190
191
|
theme: DEFAULT_THEME
|
|
191
192
|
};
|
|
@@ -261,7 +262,7 @@ const sizeStyles$1 = props => {
|
|
|
261
262
|
};
|
|
262
263
|
const StyledPaneSplitter = styled.div.attrs({
|
|
263
264
|
'data-garden-id': COMPONENT_ID$1,
|
|
264
|
-
'data-garden-version': '8.62.
|
|
265
|
+
'data-garden-version': '8.62.2'
|
|
265
266
|
}).withConfig({
|
|
266
267
|
displayName: "StyledPaneSplitter",
|
|
267
268
|
componentId: "sc-jylemn-0"
|
|
@@ -324,7 +325,7 @@ const sizeStyles = props => {
|
|
|
324
325
|
};
|
|
325
326
|
const StyledPaneSplitterButton = styled(ChevronButton).attrs({
|
|
326
327
|
'data-garden-id': COMPONENT_ID,
|
|
327
|
-
'data-garden-version': '8.62.
|
|
328
|
+
'data-garden-version': '8.62.2',
|
|
328
329
|
isBasic: true,
|
|
329
330
|
isPill: true,
|
|
330
331
|
size: 'small'
|
|
@@ -782,7 +783,11 @@ SplitterComponent.defaultProps = {
|
|
|
782
783
|
const Splitter = SplitterComponent;
|
|
783
784
|
|
|
784
785
|
const ContentComponent = forwardRef((props, ref) => {
|
|
786
|
+
const {
|
|
787
|
+
isVisible
|
|
788
|
+
} = usePaneContext();
|
|
785
789
|
return React.createElement(StyledPaneContent, _extends({
|
|
790
|
+
hidden: !isVisible,
|
|
786
791
|
ref: ref
|
|
787
792
|
}, props));
|
|
788
793
|
});
|
|
@@ -862,15 +867,24 @@ const PaneComponent = forwardRef((_ref, ref) => {
|
|
|
862
867
|
...props
|
|
863
868
|
} = _ref;
|
|
864
869
|
const [paneId, setPaneId] = useState();
|
|
870
|
+
const observerRef = useRef(null);
|
|
871
|
+
const {
|
|
872
|
+
width = 0,
|
|
873
|
+
height = 0
|
|
874
|
+
} = useResizeObserver({
|
|
875
|
+
ref: observerRef
|
|
876
|
+
});
|
|
877
|
+
const isVisible = useMemo(() => observerRef.current ? width > 0 && height > 0 : true, [width, height]);
|
|
865
878
|
const paneContext = useMemo(() => ({
|
|
879
|
+
isVisible,
|
|
866
880
|
id: paneId,
|
|
867
881
|
setId: id => setPaneId(id)
|
|
868
|
-
}), [paneId]);
|
|
882
|
+
}), [paneId, isVisible]);
|
|
869
883
|
return React.createElement(PaneContext.Provider, {
|
|
870
884
|
value: paneContext
|
|
871
885
|
}, React.createElement(StyledPane, _extends({
|
|
872
886
|
id: paneId,
|
|
873
|
-
ref: ref
|
|
887
|
+
ref: mergeRefs([ref, observerRef])
|
|
874
888
|
}, props), children));
|
|
875
889
|
});
|
|
876
890
|
PaneComponent.displayName = 'Pane';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zendeskgarden/react-grid",
|
|
3
|
-
"version": "8.62.
|
|
3
|
+
"version": "8.62.2",
|
|
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>",
|
|
@@ -23,11 +23,12 @@
|
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"@zendeskgarden/container-splitter": "^2.0.3",
|
|
25
25
|
"@zendeskgarden/container-utilities": "^1.0.0",
|
|
26
|
-
"@zendeskgarden/react-buttons": "^8.62.
|
|
27
|
-
"@zendeskgarden/react-tooltips": "^8.62.
|
|
26
|
+
"@zendeskgarden/react-buttons": "^8.62.2",
|
|
27
|
+
"@zendeskgarden/react-tooltips": "^8.62.2",
|
|
28
28
|
"polished": "^4.0.0",
|
|
29
29
|
"prop-types": "^15.5.7",
|
|
30
|
-
"react-merge-refs": "^1.1.0"
|
|
30
|
+
"react-merge-refs": "^1.1.0",
|
|
31
|
+
"use-resize-observer": "^9.1.0"
|
|
31
32
|
},
|
|
32
33
|
"peerDependencies": {
|
|
33
34
|
"@zendeskgarden/react-theming": "^8.1.0",
|
|
@@ -36,8 +37,7 @@
|
|
|
36
37
|
"styled-components": "^4.2.0 || ^5.0.0"
|
|
37
38
|
},
|
|
38
39
|
"devDependencies": {
|
|
39
|
-
"@zendeskgarden/react-theming": "^8.62.
|
|
40
|
-
"use-resize-observer": "9.1.0"
|
|
40
|
+
"@zendeskgarden/react-theming": "^8.62.2"
|
|
41
41
|
},
|
|
42
42
|
"keywords": [
|
|
43
43
|
"components",
|
|
@@ -49,5 +49,5 @@
|
|
|
49
49
|
"access": "public"
|
|
50
50
|
},
|
|
51
51
|
"zendeskgarden:src": "src/index.ts",
|
|
52
|
-
"gitHead": "
|
|
52
|
+
"gitHead": "27a7d6c021f3360396af60d51ecbf66e9076a405"
|
|
53
53
|
}
|