@zendeskgarden/react-grid 8.75.0 → 8.76.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/esm/elements/Col.js +72 -0
- package/dist/esm/elements/Grid.js +49 -0
- package/dist/esm/elements/Row.js +58 -0
- package/dist/esm/elements/pane/Pane.js +55 -0
- package/dist/esm/elements/pane/PaneProvider.js +197 -0
- package/dist/esm/elements/pane/components/Content.js +30 -0
- package/dist/esm/elements/pane/components/Splitter.js +128 -0
- package/dist/esm/elements/pane/components/SplitterButton.js +91 -0
- package/dist/esm/index.js +12 -0
- package/dist/esm/styled/StyledCol.js +73 -0
- package/dist/esm/styled/StyledGrid.js +33 -0
- package/dist/esm/styled/StyledRow.js +53 -0
- package/dist/esm/styled/pane/StyledPane.js +22 -0
- package/dist/esm/styled/pane/StyledPaneContent.js +22 -0
- package/dist/esm/styled/pane/StyledPaneSplitter.js +97 -0
- package/dist/esm/styled/pane/StyledPaneSplitterButton.js +48 -0
- package/dist/esm/styled/pane/StyledPaneSplitterButtonContainer.js +116 -0
- package/dist/esm/types/index.js +16 -0
- package/dist/esm/utils/useGridContext.js +16 -0
- package/dist/esm/utils/usePaneContext.js +16 -0
- package/dist/esm/utils/usePaneProviderContext.js +17 -0
- package/dist/esm/utils/usePaneSplitterContext.js +22 -0
- package/dist/index.cjs.js +162 -106
- package/dist/typings/styled/index.d.ts +1 -0
- package/dist/typings/styled/pane/StyledPaneSplitter.d.ts +0 -1
- package/dist/typings/styled/pane/StyledPaneSplitterButton.d.ts +3 -7
- package/dist/typings/styled/pane/StyledPaneSplitterButtonContainer.d.ts +18 -0
- package/package.json +7 -7
- package/dist/index.esm.js +0 -903
package/dist/index.cjs.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
* Copyright Zendesk, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
+
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
*/
|
|
8
7
|
'use strict';
|
|
9
8
|
|
|
10
9
|
var React = require('react');
|
|
@@ -27,21 +26,6 @@ var styled__default = /*#__PURE__*/_interopDefault(styled);
|
|
|
27
26
|
var useResizeObserver__default = /*#__PURE__*/_interopDefault(useResizeObserver);
|
|
28
27
|
var mergeRefs__default = /*#__PURE__*/_interopDefault(mergeRefs);
|
|
29
28
|
|
|
30
|
-
function _extends() {
|
|
31
|
-
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
32
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
33
|
-
var source = arguments[i];
|
|
34
|
-
for (var key in source) {
|
|
35
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
36
|
-
target[key] = source[key];
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
return target;
|
|
41
|
-
};
|
|
42
|
-
return _extends.apply(this, arguments);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
29
|
const ALIGN_ITEMS = ['start', 'end', 'center', 'baseline', 'stretch'];
|
|
46
30
|
const ALIGN_SELF = ['auto', ...ALIGN_ITEMS];
|
|
47
31
|
const DIRECTION = ['row', 'row-reverse', 'column', 'column-reverse'];
|
|
@@ -51,7 +35,7 @@ const SPACE = [false, 'xxs', 'xs', 'sm', 'md', 'lg', 'xl', 'xxl'];
|
|
|
51
35
|
const WRAP = ['nowrap', 'wrap', 'wrap-reverse'];
|
|
52
36
|
const ORIENTATION = ['top', 'bottom', 'start', 'end'];
|
|
53
37
|
|
|
54
|
-
const COMPONENT_ID$
|
|
38
|
+
const COMPONENT_ID$7 = 'grid.col';
|
|
55
39
|
const colorStyles$4 = props => {
|
|
56
40
|
const backgroundColor = reactTheming.getColorV8('primaryHue', 600, props.theme, 0.1);
|
|
57
41
|
return styled.css(["background-clip:content-box;background-color:", ";"], backgroundColor);
|
|
@@ -97,45 +81,45 @@ const flexStyles$1 = (size, alignSelf, textAlign, offset, order, props) => {
|
|
|
97
81
|
const mediaStyles$1 = (minWidth, size, alignSelf, textAlign, offset, order, props) => {
|
|
98
82
|
return styled.css(["@media (min-width:", "){", ";}"], minWidth, flexStyles$1(size, alignSelf, textAlign, offset, order, props));
|
|
99
83
|
};
|
|
100
|
-
const sizeStyles$
|
|
84
|
+
const sizeStyles$5 = props => {
|
|
101
85
|
const padding = props.gutters ? polished.math(`${props.theme.space[props.gutters]} / 2`) : 0;
|
|
102
86
|
return styled.css(["padding-right:", ";padding-left:", ";"], padding, padding);
|
|
103
87
|
};
|
|
104
88
|
const StyledCol = styled__default.default.div.attrs({
|
|
105
|
-
'data-garden-id': COMPONENT_ID$
|
|
106
|
-
'data-garden-version': '8.
|
|
89
|
+
'data-garden-id': COMPONENT_ID$7,
|
|
90
|
+
'data-garden-version': '8.76.0'
|
|
107
91
|
}).withConfig({
|
|
108
92
|
displayName: "StyledCol",
|
|
109
93
|
componentId: "sc-inuw62-0"
|
|
110
|
-
})(["box-sizing:border-box;width:100%;", ";", ";", ";", ";", ";", ";", ";", ";", ";"], props => 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), props => sizeStyles$
|
|
94
|
+
})(["box-sizing:border-box;width:100%;", ";", ";", ";", ";", ";", ";", ";", ";", ";"], props => 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), props => sizeStyles$5(props), props => props.debug && colorStyles$4(props), props => mediaStyles$1(props.theme.breakpoints.xs, props.xs, props.alignSelfXs, props.textAlignXs, props.offsetXs, props.orderXs, props), props => mediaStyles$1(props.theme.breakpoints.sm, props.sm, props.alignSelfSm, props.textAlignSm, props.offsetSm, props.orderSm, props), props => mediaStyles$1(props.theme.breakpoints.md, props.md, props.alignSelfMd, props.textAlignMd, props.offsetMd, props.orderMd, props), props => mediaStyles$1(props.theme.breakpoints.lg, props.lg, props.alignSelfLg, props.textAlignLg, props.offsetLg, props.orderLg, props), props => mediaStyles$1(props.theme.breakpoints.xl, props.xl, props.alignSelfXl, props.textAlignXl, props.offsetXl, props.orderXl, props), props => reactTheming.retrieveComponentStyles(COMPONENT_ID$7, props));
|
|
111
95
|
StyledCol.defaultProps = {
|
|
112
96
|
columns: 12,
|
|
113
97
|
theme: reactTheming.DEFAULT_THEME
|
|
114
98
|
};
|
|
115
99
|
|
|
116
|
-
const COMPONENT_ID$
|
|
100
|
+
const COMPONENT_ID$6 = 'grid.grid';
|
|
117
101
|
const colorStyles$3 = props => {
|
|
118
102
|
const borderColor = reactTheming.getColorV8(props.theme.palette.crimson, 400, props.theme, 0.5);
|
|
119
103
|
const borderWidth = polished.math(`${props.theme.borderWidths.sm} * 2`);
|
|
120
104
|
return styled.css(["box-shadow:-", " 0 0 0 ", ",", " 0 0 0 ", ";"], borderWidth, borderColor, borderWidth, borderColor);
|
|
121
105
|
};
|
|
122
|
-
const sizeStyles$
|
|
106
|
+
const sizeStyles$4 = props => {
|
|
123
107
|
const padding = props.gutters ? polished.math(`${props.theme.space[props.gutters]} / 2`) : 0;
|
|
124
108
|
return styled.css(["padding-right:", ";padding-left:", ";"], padding, padding);
|
|
125
109
|
};
|
|
126
110
|
const StyledGrid = styled__default.default.div.attrs({
|
|
127
|
-
'data-garden-id': COMPONENT_ID$
|
|
128
|
-
'data-garden-version': '8.
|
|
111
|
+
'data-garden-id': COMPONENT_ID$6,
|
|
112
|
+
'data-garden-version': '8.76.0'
|
|
129
113
|
}).withConfig({
|
|
130
114
|
displayName: "StyledGrid",
|
|
131
115
|
componentId: "sc-oxgg5i-0"
|
|
132
|
-
})(["direction:", ";margin-right:auto;margin-left:auto;width:100%;box-sizing:border-box;", ";", ";", ";"], props => props.theme.rtl && 'rtl', props => sizeStyles$
|
|
116
|
+
})(["direction:", ";margin-right:auto;margin-left:auto;width:100%;box-sizing:border-box;", ";", ";", ";"], props => props.theme.rtl && 'rtl', props => sizeStyles$4(props), props => props.debug && colorStyles$3(props), props => reactTheming.retrieveComponentStyles(COMPONENT_ID$6, props));
|
|
133
117
|
StyledGrid.defaultProps = {
|
|
134
118
|
gutters: 'md',
|
|
135
119
|
theme: reactTheming.DEFAULT_THEME
|
|
136
120
|
};
|
|
137
121
|
|
|
138
|
-
const COMPONENT_ID$
|
|
122
|
+
const COMPONENT_ID$5 = 'grid.row';
|
|
139
123
|
const colorStyles$2 = props => {
|
|
140
124
|
const borderColor = reactTheming.getColorV8(props.theme.palette.mint, 600, props.theme, 0.5);
|
|
141
125
|
const borderWidth = props.theme.borderWidths.sm;
|
|
@@ -161,61 +145,61 @@ const flexStyles = (alignItems, justifyContent, wrap) => {
|
|
|
161
145
|
const mediaStyles = (minWidth, alignItems, justifyContent, wrap) => {
|
|
162
146
|
return styled.css(["@media (min-width:", "){", ";}"], minWidth, flexStyles(alignItems, justifyContent, wrap));
|
|
163
147
|
};
|
|
164
|
-
const sizeStyles$
|
|
148
|
+
const sizeStyles$3 = props => {
|
|
165
149
|
const margin = props.gutters ? polished.math(`${props.theme.space[props.gutters]} / 2`) : 0;
|
|
166
150
|
return styled.css(["margin-right:-", ";margin-left:-", ";"], margin, margin);
|
|
167
151
|
};
|
|
168
152
|
const StyledRow = styled__default.default.div.attrs({
|
|
169
|
-
'data-garden-id': COMPONENT_ID$
|
|
170
|
-
'data-garden-version': '8.
|
|
153
|
+
'data-garden-id': COMPONENT_ID$5,
|
|
154
|
+
'data-garden-version': '8.76.0'
|
|
171
155
|
}).withConfig({
|
|
172
156
|
displayName: "StyledRow",
|
|
173
157
|
componentId: "sc-xjsdg1-0"
|
|
174
|
-
})(["display:flex;box-sizing:border-box;", " ", ";", ";", ";", ";", ";", ";", ";", ";"], props => flexStyles(props.alignItems, props.justifyContent, props.wrapAll), props => sizeStyles$
|
|
158
|
+
})(["display:flex;box-sizing:border-box;", " ", ";", ";", ";", ";", ";", ";", ";", ";"], props => flexStyles(props.alignItems, props.justifyContent, props.wrapAll), props => sizeStyles$3(props), props => props.debug && colorStyles$2(props), props => mediaStyles(props.theme.breakpoints.xs, props.alignItemsXs, props.justifyContentXs, props.wrapXs), props => mediaStyles(props.theme.breakpoints.sm, props.alignItemsSm, props.justifyContentSm, props.wrapSm), props => mediaStyles(props.theme.breakpoints.md, props.alignItemsMd, props.justifyContentMd, props.wrapMd), props => mediaStyles(props.theme.breakpoints.lg, props.alignItemsLg, props.justifyContentLg, props.wrapLg), props => mediaStyles(props.theme.breakpoints.xl, props.alignItemsXl, props.justifyContentXl, props.wrapXl), props => reactTheming.retrieveComponentStyles(COMPONENT_ID$5, props));
|
|
175
159
|
StyledRow.defaultProps = {
|
|
176
160
|
wrapAll: 'wrap',
|
|
177
161
|
theme: reactTheming.DEFAULT_THEME
|
|
178
162
|
};
|
|
179
163
|
|
|
180
|
-
const COMPONENT_ID$
|
|
164
|
+
const COMPONENT_ID$4 = 'pane';
|
|
181
165
|
const StyledPane = styled__default.default.div.attrs({
|
|
182
|
-
'data-garden-id': COMPONENT_ID$
|
|
183
|
-
'data-garden-version': '8.
|
|
166
|
+
'data-garden-id': COMPONENT_ID$4,
|
|
167
|
+
'data-garden-version': '8.76.0'
|
|
184
168
|
}).withConfig({
|
|
185
169
|
displayName: "StyledPane",
|
|
186
170
|
componentId: "sc-1ltjst7-0"
|
|
187
|
-
})(["position:relative;min-width:0;min-height:0;", ";"], props => reactTheming.retrieveComponentStyles(COMPONENT_ID$
|
|
171
|
+
})(["position:relative;min-width:0;min-height:0;", ";"], props => reactTheming.retrieveComponentStyles(COMPONENT_ID$4, props));
|
|
188
172
|
StyledPane.defaultProps = {
|
|
189
173
|
theme: reactTheming.DEFAULT_THEME
|
|
190
174
|
};
|
|
191
175
|
|
|
192
|
-
const COMPONENT_ID$
|
|
176
|
+
const COMPONENT_ID$3 = 'pane.content';
|
|
193
177
|
const StyledPaneContent = styled__default.default.div.attrs({
|
|
194
|
-
'data-garden-id': COMPONENT_ID$
|
|
195
|
-
'data-garden-version': '8.
|
|
178
|
+
'data-garden-id': COMPONENT_ID$3,
|
|
179
|
+
'data-garden-version': '8.76.0'
|
|
196
180
|
}).withConfig({
|
|
197
181
|
displayName: "StyledPaneContent",
|
|
198
182
|
componentId: "sc-1b38mbh-0"
|
|
199
|
-
})(["height:100%;overflow:auto;&[hidden]{display:none;}", ";"], props => reactTheming.retrieveComponentStyles(COMPONENT_ID$
|
|
183
|
+
})(["height:100%;overflow:auto;&[hidden]{display:none;}", ";"], props => reactTheming.retrieveComponentStyles(COMPONENT_ID$3, props));
|
|
200
184
|
StyledPaneContent.defaultProps = {
|
|
201
185
|
theme: reactTheming.DEFAULT_THEME
|
|
202
186
|
};
|
|
203
187
|
|
|
204
|
-
const COMPONENT_ID$
|
|
188
|
+
const COMPONENT_ID$2 = 'pane.splitter';
|
|
205
189
|
const colorStyles$1 = props => {
|
|
206
190
|
const color = reactTheming.getColorV8('neutralHue', 300, props.theme);
|
|
207
191
|
const hoverColor = reactTheming.getColorV8('primaryHue', 600, props.theme);
|
|
208
192
|
const activeColor = reactTheming.getColorV8('primaryHue', 800, props.theme);
|
|
209
|
-
return styled.css(["&::before{background-color:", ";}&:hover::before{background-color:", ";}", " &:active::before{background-color:", ";}"], color,
|
|
193
|
+
return styled.css(["&::before{background-color:", ";}&:hover::before{background-color:", ";}", " &:active::before{background-color:", ";}"], color, hoverColor, reactTheming.focusStyles({
|
|
210
194
|
theme: props.theme,
|
|
211
195
|
hue: hoverColor,
|
|
212
196
|
styles: {
|
|
213
197
|
backgroundColor: hoverColor
|
|
214
198
|
},
|
|
215
199
|
selector: '&:focus-visible::before, &[data-garden-focus-visible="true"]::before'
|
|
216
|
-
}),
|
|
200
|
+
}), activeColor);
|
|
217
201
|
};
|
|
218
|
-
const sizeStyles$
|
|
202
|
+
const sizeStyles$2 = props => {
|
|
219
203
|
const size = polished.math(`${props.theme.shadowWidths.md} * 2`);
|
|
220
204
|
const separatorSize = polished.math(`${props.theme.borderWidths.sm} * 2`);
|
|
221
205
|
const offset = polished.math(`-${size} / 2`);
|
|
@@ -274,20 +258,28 @@ const sizeStyles$1 = props => {
|
|
|
274
258
|
break;
|
|
275
259
|
}
|
|
276
260
|
const dimensionProperty = width === '100%' ? 'height' : 'width';
|
|
277
|
-
return styled.css(["top:", ";right:", ";bottom:", ";left:", ";cursor:", ";width:", ";height:", ";&::before{width:", ";height:", ";}&:hover::before{", ":", ";}&:focus::before,&:focus-visible::before,&[data-garden-focus-visible]::before{", ":", ";}&:focus-visible::before,&[data-garden-focus-visible]::before{border-radius:", ";}"], top, right, bottom, left, props.isFixed ? 'pointer' : cursor, width, height, separatorWidth, separatorHeight, dimensionProperty,
|
|
261
|
+
return styled.css(["top:", ";right:", ";bottom:", ";left:", ";cursor:", ";width:", ";height:", ";&::before{width:", ";height:", ";}&:hover::before{", ":", ";}&:focus::before,&:focus-visible::before,&[data-garden-focus-visible]::before{", ":", ";}&:focus-visible::before,&[data-garden-focus-visible]::before{border-radius:", ";}"], top, right, bottom, left, props.isFixed ? 'pointer' : cursor, width, height, separatorWidth, separatorHeight, dimensionProperty, separatorSize, dimensionProperty, separatorSize, props.theme.borderRadii.md);
|
|
278
262
|
};
|
|
279
263
|
const StyledPaneSplitter = styled__default.default.div.attrs({
|
|
280
|
-
'data-garden-id': COMPONENT_ID$
|
|
281
|
-
'data-garden-version': '8.
|
|
264
|
+
'data-garden-id': COMPONENT_ID$2,
|
|
265
|
+
'data-garden-version': '8.76.0'
|
|
282
266
|
}).withConfig({
|
|
283
267
|
displayName: "StyledPaneSplitter",
|
|
284
268
|
componentId: "sc-jylemn-0"
|
|
285
|
-
})(["display:flex;position:absolute;align-items:center;justify-content:center;z-index:1;user-select:none;", ";", "{z-index:2;}&::before{position:absolute;transition:box-shadow 0.1s ease-in-out,background-color 0.25s ease-in-out;z-index:-1;content:'';}", ";", ";"], sizeStyles$
|
|
269
|
+
})(["display:flex;position:absolute;align-items:center;justify-content:center;z-index:1;user-select:none;", ";", "{z-index:2;}&::before{position:absolute;transition:box-shadow 0.1s ease-in-out,background-color 0.25s ease-in-out;z-index:-1;content:'';}", ";", ";"], sizeStyles$2, reactTheming.SELECTOR_FOCUS_VISIBLE, colorStyles$1, props => reactTheming.retrieveComponentStyles(COMPONENT_ID$2, props));
|
|
286
270
|
StyledPaneSplitter.defaultProps = {
|
|
287
271
|
theme: reactTheming.DEFAULT_THEME
|
|
288
272
|
};
|
|
289
273
|
|
|
290
|
-
const COMPONENT_ID = 'pane.splitter_button';
|
|
274
|
+
const COMPONENT_ID$1 = 'pane.splitter_button';
|
|
275
|
+
const getSize = theme => theme.space.base * 6;
|
|
276
|
+
const sizeStyles$1 = _ref => {
|
|
277
|
+
let {
|
|
278
|
+
theme
|
|
279
|
+
} = _ref;
|
|
280
|
+
const size = `${getSize(theme)}px`;
|
|
281
|
+
return styled.css(["width:", ";min-width:", ";height:", ";"], size, size, size);
|
|
282
|
+
};
|
|
291
283
|
const transformStyles = props => {
|
|
292
284
|
let degrees = 0;
|
|
293
285
|
if (props.isRotated) {
|
|
@@ -302,56 +294,120 @@ const transformStyles = props => {
|
|
|
302
294
|
}
|
|
303
295
|
return styled.css(["& > svg{transform:rotate(", "deg);}"], degrees);
|
|
304
296
|
};
|
|
297
|
+
const StyledPaneSplitterButton = styled__default.default(reactButtons.ChevronButton).attrs({
|
|
298
|
+
'data-garden-id': COMPONENT_ID$1,
|
|
299
|
+
'data-garden-version': '8.76.0',
|
|
300
|
+
isBasic: true,
|
|
301
|
+
isPill: true,
|
|
302
|
+
size: 'small'
|
|
303
|
+
}).withConfig({
|
|
304
|
+
displayName: "StyledPaneSplitterButton",
|
|
305
|
+
componentId: "sc-zh032e-0"
|
|
306
|
+
})(["", ";", ";", ";"], sizeStyles$1, transformStyles, props => reactTheming.retrieveComponentStyles(COMPONENT_ID$1, props));
|
|
307
|
+
StyledPaneSplitterButton.defaultProps = {
|
|
308
|
+
theme: reactTheming.DEFAULT_THEME
|
|
309
|
+
};
|
|
310
|
+
|
|
311
|
+
const COMPONENT_ID = 'pane.splitter_button_container';
|
|
305
312
|
const colorStyles = _ref => {
|
|
306
313
|
let {
|
|
307
314
|
theme
|
|
308
315
|
} = _ref;
|
|
316
|
+
const backgroundColor = reactTheming.getColorV8('background', 600 , theme);
|
|
309
317
|
const boxShadow = theme.shadows.lg(`${theme.space.base}px`, `${theme.space.base * 2}px`, reactTheming.getColorV8('chromeHue', 600, theme, 0.15));
|
|
310
|
-
return styled.css(["box-shadow:", ";", ""], boxShadow,
|
|
311
|
-
theme,
|
|
312
|
-
boxShadow
|
|
313
|
-
}));
|
|
318
|
+
return styled.css(["box-shadow:", ";background-color:", ";"], boxShadow, backgroundColor);
|
|
314
319
|
};
|
|
315
|
-
const
|
|
316
|
-
const size = `${props.theme.space.base * 6}px`;
|
|
317
|
-
const display = props.splitterSize <= polished.stripUnit(polished.math(`${props.theme.shadowWidths.md} * 2 + ${size}`)) && 'none';
|
|
318
|
-
const isVertical = props.orientation === 'start' || props.orientation === 'end';
|
|
320
|
+
const positionStyles = props => {
|
|
319
321
|
let top;
|
|
320
322
|
let left;
|
|
321
323
|
let right;
|
|
322
324
|
let bottom;
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
left =
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
325
|
+
const size = getSize(props.theme);
|
|
326
|
+
const inset = `-${size / 2}px`;
|
|
327
|
+
if (props.placement === 'center' || props.splitterSize < size * 3) {
|
|
328
|
+
const center = `${props.splitterSize / 2 - size / 2}px`;
|
|
329
|
+
switch (`${props.orientation}-${props.theme.rtl ? 'rtl' : 'ltr'}`) {
|
|
330
|
+
case 'top-ltr':
|
|
331
|
+
case 'top-rtl':
|
|
332
|
+
top = inset;
|
|
333
|
+
left = center;
|
|
334
|
+
break;
|
|
335
|
+
case 'start-ltr':
|
|
336
|
+
case 'end-rtl':
|
|
337
|
+
top = center;
|
|
338
|
+
left = inset;
|
|
339
|
+
break;
|
|
340
|
+
case 'end-ltr':
|
|
341
|
+
case 'start-rtl':
|
|
342
|
+
top = center;
|
|
343
|
+
right = inset;
|
|
344
|
+
break;
|
|
345
|
+
case 'bottom-ltr':
|
|
346
|
+
case 'bottom-rtl':
|
|
347
|
+
bottom = inset;
|
|
348
|
+
right = center;
|
|
349
|
+
break;
|
|
350
|
+
}
|
|
351
|
+
} else {
|
|
352
|
+
const offset = `${size}px`;
|
|
353
|
+
switch (`${props.orientation}-${props.placement}-${props.theme.rtl ? 'rtl' : 'ltr'}`) {
|
|
354
|
+
case 'top-end-ltr':
|
|
355
|
+
case 'top-end-rtl':
|
|
356
|
+
case 'top-start-rtl':
|
|
357
|
+
top = inset;
|
|
358
|
+
right = offset;
|
|
359
|
+
break;
|
|
360
|
+
case 'bottom-end-ltr':
|
|
361
|
+
case 'bottom-end-rtl':
|
|
362
|
+
case 'bottom-start-rtl':
|
|
363
|
+
bottom = inset;
|
|
364
|
+
right = offset;
|
|
365
|
+
break;
|
|
366
|
+
case 'start-start-ltr':
|
|
367
|
+
case 'end-start-rtl':
|
|
368
|
+
top = offset;
|
|
369
|
+
left = inset;
|
|
370
|
+
break;
|
|
371
|
+
case 'start-end-ltr':
|
|
372
|
+
case 'end-end-rtl':
|
|
373
|
+
bottom = offset;
|
|
374
|
+
left = inset;
|
|
375
|
+
break;
|
|
376
|
+
case 'end-start-ltr':
|
|
377
|
+
case 'start-start-rtl':
|
|
378
|
+
top = offset;
|
|
379
|
+
right = inset;
|
|
380
|
+
break;
|
|
381
|
+
case 'end-end-ltr':
|
|
382
|
+
case 'start-end-rtl':
|
|
383
|
+
bottom = offset;
|
|
384
|
+
right = inset;
|
|
385
|
+
break;
|
|
386
|
+
case 'top-start-ltr':
|
|
387
|
+
top = inset;
|
|
388
|
+
left = offset;
|
|
389
|
+
break;
|
|
390
|
+
case 'bottom-start-ltr':
|
|
391
|
+
bottom = inset;
|
|
392
|
+
left = offset;
|
|
393
|
+
break;
|
|
340
394
|
}
|
|
341
395
|
}
|
|
342
|
-
return styled.css(["
|
|
396
|
+
return styled.css(["top:", ";right:", ";bottom:", ";left:", ";"], top, right, bottom, left);
|
|
343
397
|
};
|
|
344
|
-
const
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
}
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
398
|
+
const sizeStyles = _ref2 => {
|
|
399
|
+
let {
|
|
400
|
+
theme
|
|
401
|
+
} = _ref2;
|
|
402
|
+
const size = getSize(theme);
|
|
403
|
+
return styled.css(["border-radius:", "px;width:", "px;height:", "px;"], size, size, size);
|
|
404
|
+
};
|
|
405
|
+
const minimumSplitterSize = theme => polished.stripUnit(polished.math(`${theme.shadowWidths.md} * 2 + ${getSize(theme)}`));
|
|
406
|
+
const StyledPaneSplitterButtonContainer = styled__default.default.div.withConfig({
|
|
407
|
+
displayName: "StyledPaneSplitterButtonContainer",
|
|
408
|
+
componentId: "sc-1w84y62-0"
|
|
409
|
+
})(["display:", ";position:absolute;transition:box-shadow 0.1s ease-in-out,opacity 0.25s ease-in-out 0.1s;opacity:0;z-index:2;", ";", ";", ";&:hover,&:focus-within,", ":hover ~ &,", ":focus-visible ~ &{opacity:1;}", ";"], props => props.splitterSize <= minimumSplitterSize(props.theme) ? 'none' : undefined, positionStyles, sizeStyles, colorStyles, StyledPaneSplitter, StyledPaneSplitter, props => reactTheming.retrieveComponentStyles(COMPONENT_ID, props));
|
|
410
|
+
StyledPaneSplitterButtonContainer.defaultProps = {
|
|
355
411
|
theme: reactTheming.DEFAULT_THEME
|
|
356
412
|
};
|
|
357
413
|
|
|
@@ -372,7 +428,7 @@ const Col = React__default.default.forwardRef((_ref, ref) => {
|
|
|
372
428
|
gutters,
|
|
373
429
|
debug
|
|
374
430
|
} = useGridContext();
|
|
375
|
-
return React__default.default.createElement(StyledCol,
|
|
431
|
+
return React__default.default.createElement(StyledCol, Object.assign({
|
|
376
432
|
sizeAll: size,
|
|
377
433
|
columns: columns,
|
|
378
434
|
gutters: gutters,
|
|
@@ -427,7 +483,7 @@ const Grid = React__default.default.forwardRef((_ref, ref) => {
|
|
|
427
483
|
}), [columns, props.gutters, debug]);
|
|
428
484
|
return React__default.default.createElement(GridContext.Provider, {
|
|
429
485
|
value: value
|
|
430
|
-
}, React__default.default.createElement(StyledGrid,
|
|
486
|
+
}, React__default.default.createElement(StyledGrid, Object.assign({
|
|
431
487
|
debug: debug,
|
|
432
488
|
ref: ref
|
|
433
489
|
}, props)));
|
|
@@ -452,7 +508,7 @@ const Row = React__default.default.forwardRef((_ref, ref) => {
|
|
|
452
508
|
gutters,
|
|
453
509
|
debug
|
|
454
510
|
} = useGridContext();
|
|
455
|
-
return React__default.default.createElement(StyledRow,
|
|
511
|
+
return React__default.default.createElement(StyledRow, Object.assign({
|
|
456
512
|
gutters: gutters,
|
|
457
513
|
debug: debug,
|
|
458
514
|
wrapAll: wrap,
|
|
@@ -708,6 +764,7 @@ const orientationToDimension = {
|
|
|
708
764
|
};
|
|
709
765
|
const SplitterComponent = React.forwardRef((_ref, ref) => {
|
|
710
766
|
let {
|
|
767
|
+
children,
|
|
711
768
|
providerId,
|
|
712
769
|
layoutKey,
|
|
713
770
|
min,
|
|
@@ -724,7 +781,6 @@ const SplitterComponent = React.forwardRef((_ref, ref) => {
|
|
|
724
781
|
const paneContext = usePaneContext();
|
|
725
782
|
const themeContext = React.useContext(styled.ThemeContext);
|
|
726
783
|
const environment = reactTheming.useDocument(themeContext);
|
|
727
|
-
const [isHovered, setIsHovered] = React.useState(false);
|
|
728
784
|
const isRow = orientationToDimension[orientation] === 'rows';
|
|
729
785
|
const separatorRef = React.useRef(null);
|
|
730
786
|
const splitterOrientation = paneToSplitterOrientation[orientation || 'end'];
|
|
@@ -766,7 +822,6 @@ const SplitterComponent = React.forwardRef((_ref, ref) => {
|
|
|
766
822
|
onClick
|
|
767
823
|
});
|
|
768
824
|
const size = isRow ? separatorRef.current?.clientWidth : separatorRef.current?.clientHeight;
|
|
769
|
-
const onMouseOver = React.useMemo(() => containerUtilities.composeEventHandlers(props.onMouseOver, event => setIsHovered(event.target === separatorRef.current)), [props.onMouseOver, separatorRef]);
|
|
770
825
|
return React__default.default.createElement(PaneSplitterContext.Provider, {
|
|
771
826
|
value: React.useMemo(() => ({
|
|
772
827
|
orientation,
|
|
@@ -777,14 +832,12 @@ const SplitterComponent = React.forwardRef((_ref, ref) => {
|
|
|
777
832
|
size,
|
|
778
833
|
isRow
|
|
779
834
|
}), [orientation, layoutKey, min, max, valueInFr, size, isRow])
|
|
780
|
-
}, React__default.default.createElement(StyledPaneSplitter,
|
|
781
|
-
isHovered: isHovered,
|
|
835
|
+
}, React__default.default.createElement(StyledPaneSplitter, Object.assign({
|
|
782
836
|
isFixed: isFixed,
|
|
783
837
|
orientation: orientation
|
|
784
838
|
}, separatorProps, props, {
|
|
785
|
-
onMouseOver: onMouseOver,
|
|
786
839
|
ref: mergeRefs__default.default([separatorRef, ref])
|
|
787
|
-
})));
|
|
840
|
+
})), children );
|
|
788
841
|
});
|
|
789
842
|
SplitterComponent.displayName = 'Pane.Splitter';
|
|
790
843
|
SplitterComponent.propTypes = {
|
|
@@ -803,7 +856,7 @@ const ContentComponent = React.forwardRef((props, ref) => {
|
|
|
803
856
|
const {
|
|
804
857
|
isVisible
|
|
805
858
|
} = usePaneContext();
|
|
806
|
-
return React__default.default.createElement(StyledPaneContent,
|
|
859
|
+
return React__default.default.createElement(StyledPaneContent, Object.assign({
|
|
807
860
|
hidden: !isVisible,
|
|
808
861
|
ref: ref
|
|
809
862
|
}, props));
|
|
@@ -856,24 +909,27 @@ const SplitterButtonComponent = React.forwardRef((props, ref) => {
|
|
|
856
909
|
);
|
|
857
910
|
const onMouseDown = containerUtilities.composeEventHandlers(props.onMouseDown, event => event.stopPropagation()
|
|
858
911
|
);
|
|
859
|
-
return React__default.default.createElement(
|
|
912
|
+
return React__default.default.createElement(StyledPaneSplitterButtonContainer, {
|
|
913
|
+
orientation: orientation,
|
|
914
|
+
placement: placement,
|
|
915
|
+
splitterSize: size || 0
|
|
916
|
+
}, React__default.default.createElement(reactTooltips.Tooltip, {
|
|
860
917
|
content: label,
|
|
918
|
+
zIndex: 2,
|
|
861
919
|
style: {
|
|
862
920
|
cursor: 'default'
|
|
863
921
|
},
|
|
864
922
|
onMouseDown: e => e.stopPropagation()
|
|
865
|
-
}, React__default.default.createElement(StyledPaneSplitterButton,
|
|
923
|
+
}, React__default.default.createElement(StyledPaneSplitterButton, Object.assign({
|
|
866
924
|
"aria-label": label
|
|
867
925
|
}, props, {
|
|
868
|
-
placement: placement,
|
|
869
926
|
orientation: orientation,
|
|
870
927
|
isRotated: isMin,
|
|
871
|
-
splitterSize: size || 0,
|
|
872
928
|
ref: ref,
|
|
873
929
|
onClick: onClick,
|
|
874
930
|
onKeyDown: onKeyDown,
|
|
875
931
|
onMouseDown: onMouseDown
|
|
876
|
-
})));
|
|
932
|
+
}))));
|
|
877
933
|
});
|
|
878
934
|
SplitterButtonComponent.displayName = 'Pane.SplitterButton';
|
|
879
935
|
const SplitterButton = SplitterButtonComponent;
|
|
@@ -899,7 +955,7 @@ const PaneComponent = React.forwardRef((_ref, ref) => {
|
|
|
899
955
|
}), [paneId, isVisible]);
|
|
900
956
|
return React__default.default.createElement(PaneContext.Provider, {
|
|
901
957
|
value: paneContext
|
|
902
|
-
}, React__default.default.createElement(StyledPane,
|
|
958
|
+
}, React__default.default.createElement(StyledPane, Object.assign({
|
|
903
959
|
id: paneId,
|
|
904
960
|
ref: mergeRefs__default.default([ref, observerRef])
|
|
905
961
|
}, props), children));
|
|
@@ -6,15 +6,11 @@
|
|
|
6
6
|
*/
|
|
7
7
|
/// <reference types="react" />
|
|
8
8
|
import { DefaultTheme } from 'styled-components';
|
|
9
|
-
import {
|
|
10
|
-
interface IStyledSplitterButtonProps
|
|
9
|
+
import { Orientation } from '../../types';
|
|
10
|
+
interface IStyledSplitterButtonProps {
|
|
11
11
|
orientation: Orientation;
|
|
12
|
-
placement: (typeof PLACEMENT)[number];
|
|
13
12
|
isRotated: boolean;
|
|
14
|
-
splitterSize: number;
|
|
15
13
|
}
|
|
16
|
-
|
|
17
|
-
* 1. Opaque "dish" behind transparent button
|
|
18
|
-
*/
|
|
14
|
+
export declare const getSize: (theme: DefaultTheme) => number;
|
|
19
15
|
export declare const StyledPaneSplitterButton: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("@zendeskgarden/react-buttons").IIconButtonProps & import("react").RefAttributes<HTMLButtonElement>>, DefaultTheme, IStyledSplitterButtonProps, never>;
|
|
20
16
|
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Zendesk, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
+
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
*/
|
|
7
|
+
import { DefaultTheme } from 'styled-components';
|
|
8
|
+
import { Orientation, PLACEMENT } from '../../types';
|
|
9
|
+
interface IStyledSplitterButtonContainerProps {
|
|
10
|
+
orientation: Orientation;
|
|
11
|
+
placement: (typeof PLACEMENT)[number];
|
|
12
|
+
splitterSize: number;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* 1. Match focused `Splitter` z-index
|
|
16
|
+
*/
|
|
17
|
+
export declare const StyledPaneSplitterButtonContainer: import("styled-components").StyledComponent<"div", DefaultTheme, IStyledSplitterButtonContainerProps, never>;
|
|
18
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zendeskgarden/react-grid",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.76.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>",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"url": "https://github.com/zendeskgarden/react-components/issues"
|
|
11
11
|
},
|
|
12
12
|
"main": "dist/index.cjs.js",
|
|
13
|
-
"module": "dist/index.
|
|
13
|
+
"module": "dist/esm/index.js",
|
|
14
14
|
"files": [
|
|
15
15
|
"dist"
|
|
16
16
|
],
|
|
@@ -23,21 +23,21 @@
|
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"@zendeskgarden/container-splitter": "^2.0.3",
|
|
25
25
|
"@zendeskgarden/container-utilities": "^2.0.0",
|
|
26
|
-
"@zendeskgarden/react-buttons": "^8.
|
|
27
|
-
"@zendeskgarden/react-tooltips": "^8.
|
|
26
|
+
"@zendeskgarden/react-buttons": "^8.76.0",
|
|
27
|
+
"@zendeskgarden/react-tooltips": "^8.76.0",
|
|
28
28
|
"polished": "^4.0.0",
|
|
29
29
|
"prop-types": "^15.5.7",
|
|
30
30
|
"react-merge-refs": "^1.1.0",
|
|
31
31
|
"use-resize-observer": "^9.1.0"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
|
-
"@zendeskgarden/react-theming": "^8.
|
|
34
|
+
"@zendeskgarden/react-theming": "^8.75.0",
|
|
35
35
|
"react": ">=16.8.0",
|
|
36
36
|
"react-dom": ">=16.8.0",
|
|
37
37
|
"styled-components": "^4.2.0 || ^5.0.0"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@zendeskgarden/react-theming": "^8.
|
|
40
|
+
"@zendeskgarden/react-theming": "^8.76.0"
|
|
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": "3e52650c39fd1085a2e97b40a43eed7bc1e21937"
|
|
53
53
|
}
|