@zendeskgarden/react-grid 9.0.0-next.6 → 9.0.0-next.8
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 +54 -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 +99 -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 +166 -108
- 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 -906
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');
|
|
@@ -26,21 +25,6 @@ var PropTypes__default = /*#__PURE__*/_interopDefault(PropTypes);
|
|
|
26
25
|
var styled__default = /*#__PURE__*/_interopDefault(styled);
|
|
27
26
|
var useResizeObserver__default = /*#__PURE__*/_interopDefault(useResizeObserver);
|
|
28
27
|
|
|
29
|
-
function _extends() {
|
|
30
|
-
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
31
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
32
|
-
var source = arguments[i];
|
|
33
|
-
for (var key in source) {
|
|
34
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
35
|
-
target[key] = source[key];
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
return target;
|
|
40
|
-
};
|
|
41
|
-
return _extends.apply(this, arguments);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
28
|
const ALIGN_ITEMS = ['start', 'end', 'center', 'baseline', 'stretch'];
|
|
45
29
|
const ALIGN_SELF = ['auto', ...ALIGN_ITEMS];
|
|
46
30
|
const DIRECTION = ['row', 'row-reverse', 'column', 'column-reverse'];
|
|
@@ -50,7 +34,7 @@ const SPACE = [false, 'xxs', 'xs', 'sm', 'md', 'lg', 'xl', 'xxl'];
|
|
|
50
34
|
const WRAP = ['nowrap', 'wrap', 'wrap-reverse'];
|
|
51
35
|
const ORIENTATION = ['top', 'bottom', 'start', 'end'];
|
|
52
36
|
|
|
53
|
-
const COMPONENT_ID$
|
|
37
|
+
const COMPONENT_ID$7 = 'grid.col';
|
|
54
38
|
const colorStyles$4 = props => {
|
|
55
39
|
const backgroundColor = reactTheming.getColorV8('primaryHue', 600, props.theme, 0.1);
|
|
56
40
|
return styled.css(["background-clip:content-box;background-color:", ";"], backgroundColor);
|
|
@@ -96,45 +80,45 @@ const flexStyles$1 = (size, alignSelf, textAlign, offset, order, props) => {
|
|
|
96
80
|
const mediaStyles$1 = (minWidth, size, alignSelf, textAlign, offset, order, props) => {
|
|
97
81
|
return styled.css(["@media (min-width:", "){", ";}"], minWidth, flexStyles$1(size, alignSelf, textAlign, offset, order, props));
|
|
98
82
|
};
|
|
99
|
-
const sizeStyles$
|
|
83
|
+
const sizeStyles$5 = props => {
|
|
100
84
|
const padding = props.gutters ? polished.math(`${props.theme.space[props.gutters]} / 2`) : 0;
|
|
101
85
|
return styled.css(["padding-right:", ";padding-left:", ";"], padding, padding);
|
|
102
86
|
};
|
|
103
87
|
const StyledCol = styled__default.default.div.attrs({
|
|
104
|
-
'data-garden-id': COMPONENT_ID$
|
|
105
|
-
'data-garden-version': '9.0.0-next.
|
|
88
|
+
'data-garden-id': COMPONENT_ID$7,
|
|
89
|
+
'data-garden-version': '9.0.0-next.8'
|
|
106
90
|
}).withConfig({
|
|
107
91
|
displayName: "StyledCol",
|
|
108
92
|
componentId: "sc-inuw62-0"
|
|
109
|
-
})(["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$
|
|
93
|
+
})(["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));
|
|
110
94
|
StyledCol.defaultProps = {
|
|
111
95
|
columns: 12,
|
|
112
96
|
theme: reactTheming.DEFAULT_THEME
|
|
113
97
|
};
|
|
114
98
|
|
|
115
|
-
const COMPONENT_ID$
|
|
99
|
+
const COMPONENT_ID$6 = 'grid.grid';
|
|
116
100
|
const colorStyles$3 = props => {
|
|
117
101
|
const borderColor = reactTheming.getColorV8(props.theme.palette.crimson, 400, props.theme, 0.5);
|
|
118
102
|
const borderWidth = polished.math(`${props.theme.borderWidths.sm} * 2`);
|
|
119
103
|
return styled.css(["box-shadow:-", " 0 0 0 ", ",", " 0 0 0 ", ";"], borderWidth, borderColor, borderWidth, borderColor);
|
|
120
104
|
};
|
|
121
|
-
const sizeStyles$
|
|
105
|
+
const sizeStyles$4 = props => {
|
|
122
106
|
const padding = props.gutters ? polished.math(`${props.theme.space[props.gutters]} / 2`) : 0;
|
|
123
107
|
return styled.css(["padding-right:", ";padding-left:", ";"], padding, padding);
|
|
124
108
|
};
|
|
125
109
|
const StyledGrid = styled__default.default.div.attrs({
|
|
126
|
-
'data-garden-id': COMPONENT_ID$
|
|
127
|
-
'data-garden-version': '9.0.0-next.
|
|
110
|
+
'data-garden-id': COMPONENT_ID$6,
|
|
111
|
+
'data-garden-version': '9.0.0-next.8'
|
|
128
112
|
}).withConfig({
|
|
129
113
|
displayName: "StyledGrid",
|
|
130
114
|
componentId: "sc-oxgg5i-0"
|
|
131
|
-
})(["direction:", ";margin-right:auto;margin-left:auto;width:100%;box-sizing:border-box;", ";", ";", ";"], props => props.theme.rtl && 'rtl', props => sizeStyles$
|
|
115
|
+
})(["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));
|
|
132
116
|
StyledGrid.defaultProps = {
|
|
133
117
|
gutters: 'md',
|
|
134
118
|
theme: reactTheming.DEFAULT_THEME
|
|
135
119
|
};
|
|
136
120
|
|
|
137
|
-
const COMPONENT_ID$
|
|
121
|
+
const COMPONENT_ID$5 = 'grid.row';
|
|
138
122
|
const colorStyles$2 = props => {
|
|
139
123
|
const borderColor = reactTheming.getColorV8(props.theme.palette.mint, 600, props.theme, 0.5);
|
|
140
124
|
const borderWidth = props.theme.borderWidths.sm;
|
|
@@ -160,61 +144,63 @@ const flexStyles = (alignItems, justifyContent, wrap) => {
|
|
|
160
144
|
const mediaStyles = (minWidth, alignItems, justifyContent, wrap) => {
|
|
161
145
|
return styled.css(["@media (min-width:", "){", ";}"], minWidth, flexStyles(alignItems, justifyContent, wrap));
|
|
162
146
|
};
|
|
163
|
-
const sizeStyles$
|
|
147
|
+
const sizeStyles$3 = props => {
|
|
164
148
|
const margin = props.gutters ? polished.math(`${props.theme.space[props.gutters]} / 2`) : 0;
|
|
165
149
|
return styled.css(["margin-right:-", ";margin-left:-", ";"], margin, margin);
|
|
166
150
|
};
|
|
167
151
|
const StyledRow = styled__default.default.div.attrs({
|
|
168
|
-
'data-garden-id': COMPONENT_ID$
|
|
169
|
-
'data-garden-version': '9.0.0-next.
|
|
152
|
+
'data-garden-id': COMPONENT_ID$5,
|
|
153
|
+
'data-garden-version': '9.0.0-next.8'
|
|
170
154
|
}).withConfig({
|
|
171
155
|
displayName: "StyledRow",
|
|
172
156
|
componentId: "sc-xjsdg1-0"
|
|
173
|
-
})(["display:flex;box-sizing:border-box;", " ", ";", ";", ";", ";", ";", ";", ";", ";"], props => flexStyles(props.alignItems, props.justifyContent, props.wrapAll), props => sizeStyles$
|
|
157
|
+
})(["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));
|
|
174
158
|
StyledRow.defaultProps = {
|
|
175
159
|
wrapAll: 'wrap',
|
|
176
160
|
theme: reactTheming.DEFAULT_THEME
|
|
177
161
|
};
|
|
178
162
|
|
|
179
|
-
const COMPONENT_ID$
|
|
163
|
+
const COMPONENT_ID$4 = 'pane';
|
|
180
164
|
const StyledPane = styled__default.default.div.attrs({
|
|
181
|
-
'data-garden-id': COMPONENT_ID$
|
|
182
|
-
'data-garden-version': '9.0.0-next.
|
|
165
|
+
'data-garden-id': COMPONENT_ID$4,
|
|
166
|
+
'data-garden-version': '9.0.0-next.8'
|
|
183
167
|
}).withConfig({
|
|
184
168
|
displayName: "StyledPane",
|
|
185
169
|
componentId: "sc-1ltjst7-0"
|
|
186
|
-
})(["position:relative;min-width:0;min-height:0;", ";"], props => reactTheming.retrieveComponentStyles(COMPONENT_ID$
|
|
170
|
+
})(["position:relative;min-width:0;min-height:0;", ";"], props => reactTheming.retrieveComponentStyles(COMPONENT_ID$4, props));
|
|
187
171
|
StyledPane.defaultProps = {
|
|
188
172
|
theme: reactTheming.DEFAULT_THEME
|
|
189
173
|
};
|
|
190
174
|
|
|
191
|
-
const COMPONENT_ID$
|
|
175
|
+
const COMPONENT_ID$3 = 'pane.content';
|
|
192
176
|
const StyledPaneContent = styled__default.default.div.attrs({
|
|
193
|
-
'data-garden-id': COMPONENT_ID$
|
|
194
|
-
'data-garden-version': '9.0.0-next.
|
|
177
|
+
'data-garden-id': COMPONENT_ID$3,
|
|
178
|
+
'data-garden-version': '9.0.0-next.8'
|
|
195
179
|
}).withConfig({
|
|
196
180
|
displayName: "StyledPaneContent",
|
|
197
181
|
componentId: "sc-1b38mbh-0"
|
|
198
|
-
})(["height:100%;overflow:auto;&[hidden]{display:none;}", ";"], props => reactTheming.retrieveComponentStyles(COMPONENT_ID$
|
|
182
|
+
})(["height:100%;overflow:auto;&[hidden]{display:none;}", ";"], props => reactTheming.retrieveComponentStyles(COMPONENT_ID$3, props));
|
|
199
183
|
StyledPaneContent.defaultProps = {
|
|
200
184
|
theme: reactTheming.DEFAULT_THEME
|
|
201
185
|
};
|
|
202
186
|
|
|
203
|
-
const COMPONENT_ID$
|
|
187
|
+
const COMPONENT_ID$2 = 'pane.splitter';
|
|
204
188
|
const colorStyles$1 = props => {
|
|
205
189
|
const color = reactTheming.getColorV8('neutralHue', 300, props.theme);
|
|
206
190
|
const hoverColor = reactTheming.getColorV8('primaryHue', 600, props.theme);
|
|
207
191
|
const activeColor = reactTheming.getColorV8('primaryHue', 800, props.theme);
|
|
208
|
-
return styled.css(["&::before{background-color:", ";}&:hover::before{background-color:", ";}", " &:active::before{background-color:", ";}"], color,
|
|
192
|
+
return styled.css(["&::before{background-color:", ";}&:hover::before{background-color:", ";}", " &:active::before{background-color:", ";}"], color, hoverColor, reactTheming.focusStyles({
|
|
209
193
|
theme: props.theme,
|
|
210
|
-
|
|
194
|
+
color: {
|
|
195
|
+
hue: hoverColor
|
|
196
|
+
},
|
|
211
197
|
styles: {
|
|
212
198
|
backgroundColor: hoverColor
|
|
213
199
|
},
|
|
214
|
-
selector: '&:focus-visible::before
|
|
215
|
-
}),
|
|
200
|
+
selector: '&:focus-visible::before'
|
|
201
|
+
}), activeColor);
|
|
216
202
|
};
|
|
217
|
-
const sizeStyles$
|
|
203
|
+
const sizeStyles$2 = props => {
|
|
218
204
|
const size = polished.math(`${props.theme.shadowWidths.md} * 2`);
|
|
219
205
|
const separatorSize = polished.math(`${props.theme.borderWidths.sm} * 2`);
|
|
220
206
|
const offset = polished.math(`-${size} / 2`);
|
|
@@ -273,20 +259,28 @@ const sizeStyles$1 = props => {
|
|
|
273
259
|
break;
|
|
274
260
|
}
|
|
275
261
|
const dimensionProperty = width === '100%' ? 'height' : 'width';
|
|
276
|
-
return styled.css(["top:", ";right:", ";bottom:", ";left:", ";cursor:", ";width:", ";height:", ";&::before{width:", ";height:", ";}&:hover::before{", ":", ";}&:focus::before,&:focus-visible::before
|
|
262
|
+
return styled.css(["top:", ";right:", ";bottom:", ";left:", ";cursor:", ";width:", ";height:", ";&::before{width:", ";height:", ";}&:hover::before{", ":", ";}&:focus::before,&:focus-visible::before{", ":", ";}&: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);
|
|
277
263
|
};
|
|
278
264
|
const StyledPaneSplitter = styled__default.default.div.attrs({
|
|
279
|
-
'data-garden-id': COMPONENT_ID$
|
|
280
|
-
'data-garden-version': '9.0.0-next.
|
|
265
|
+
'data-garden-id': COMPONENT_ID$2,
|
|
266
|
+
'data-garden-version': '9.0.0-next.8'
|
|
281
267
|
}).withConfig({
|
|
282
268
|
displayName: "StyledPaneSplitter",
|
|
283
269
|
componentId: "sc-jylemn-0"
|
|
284
|
-
})(["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$
|
|
270
|
+
})(["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));
|
|
285
271
|
StyledPaneSplitter.defaultProps = {
|
|
286
272
|
theme: reactTheming.DEFAULT_THEME
|
|
287
273
|
};
|
|
288
274
|
|
|
289
|
-
const COMPONENT_ID = 'pane.splitter_button';
|
|
275
|
+
const COMPONENT_ID$1 = 'pane.splitter_button';
|
|
276
|
+
const getSize = theme => theme.space.base * 6;
|
|
277
|
+
const sizeStyles$1 = _ref => {
|
|
278
|
+
let {
|
|
279
|
+
theme
|
|
280
|
+
} = _ref;
|
|
281
|
+
const size = `${getSize(theme)}px`;
|
|
282
|
+
return styled.css(["width:", ";min-width:", ";height:", ";"], size, size, size);
|
|
283
|
+
};
|
|
290
284
|
const transformStyles = props => {
|
|
291
285
|
let degrees = 0;
|
|
292
286
|
if (props.isRotated) {
|
|
@@ -301,56 +295,120 @@ const transformStyles = props => {
|
|
|
301
295
|
}
|
|
302
296
|
return styled.css(["& > svg{transform:rotate(", "deg);}"], degrees);
|
|
303
297
|
};
|
|
298
|
+
const StyledPaneSplitterButton = styled__default.default(reactButtons.ChevronButton).attrs({
|
|
299
|
+
'data-garden-id': COMPONENT_ID$1,
|
|
300
|
+
'data-garden-version': '9.0.0-next.8',
|
|
301
|
+
isBasic: true,
|
|
302
|
+
isPill: true,
|
|
303
|
+
size: 'small'
|
|
304
|
+
}).withConfig({
|
|
305
|
+
displayName: "StyledPaneSplitterButton",
|
|
306
|
+
componentId: "sc-zh032e-0"
|
|
307
|
+
})(["", ";", ";", ";"], sizeStyles$1, transformStyles, props => reactTheming.retrieveComponentStyles(COMPONENT_ID$1, props));
|
|
308
|
+
StyledPaneSplitterButton.defaultProps = {
|
|
309
|
+
theme: reactTheming.DEFAULT_THEME
|
|
310
|
+
};
|
|
311
|
+
|
|
312
|
+
const COMPONENT_ID = 'pane.splitter_button_container';
|
|
304
313
|
const colorStyles = _ref => {
|
|
305
314
|
let {
|
|
306
315
|
theme
|
|
307
316
|
} = _ref;
|
|
317
|
+
const backgroundColor = reactTheming.getColorV8('background', 600 , theme);
|
|
308
318
|
const boxShadow = theme.shadows.lg(`${theme.space.base}px`, `${theme.space.base * 2}px`, reactTheming.getColorV8('chromeHue', 600, theme, 0.15));
|
|
309
|
-
return styled.css(["box-shadow:", ";", ""], boxShadow,
|
|
310
|
-
theme,
|
|
311
|
-
boxShadow
|
|
312
|
-
}));
|
|
319
|
+
return styled.css(["box-shadow:", ";background-color:", ";"], boxShadow, backgroundColor);
|
|
313
320
|
};
|
|
314
|
-
const
|
|
315
|
-
const size = `${props.theme.space.base * 6}px`;
|
|
316
|
-
const display = props.splitterSize <= polished.stripUnit(polished.math(`${props.theme.shadowWidths.md} * 2 + ${size}`)) && 'none';
|
|
317
|
-
const isVertical = props.orientation === 'start' || props.orientation === 'end';
|
|
321
|
+
const positionStyles = props => {
|
|
318
322
|
let top;
|
|
319
323
|
let left;
|
|
320
324
|
let right;
|
|
321
325
|
let bottom;
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
left =
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
326
|
+
const size = getSize(props.theme);
|
|
327
|
+
const inset = `-${size / 2}px`;
|
|
328
|
+
if (props.placement === 'center' || props.splitterSize < size * 3) {
|
|
329
|
+
const center = `${props.splitterSize / 2 - size / 2}px`;
|
|
330
|
+
switch (`${props.orientation}-${props.theme.rtl ? 'rtl' : 'ltr'}`) {
|
|
331
|
+
case 'top-ltr':
|
|
332
|
+
case 'top-rtl':
|
|
333
|
+
top = inset;
|
|
334
|
+
left = center;
|
|
335
|
+
break;
|
|
336
|
+
case 'start-ltr':
|
|
337
|
+
case 'end-rtl':
|
|
338
|
+
top = center;
|
|
339
|
+
left = inset;
|
|
340
|
+
break;
|
|
341
|
+
case 'end-ltr':
|
|
342
|
+
case 'start-rtl':
|
|
343
|
+
top = center;
|
|
344
|
+
right = inset;
|
|
345
|
+
break;
|
|
346
|
+
case 'bottom-ltr':
|
|
347
|
+
case 'bottom-rtl':
|
|
348
|
+
bottom = inset;
|
|
349
|
+
right = center;
|
|
350
|
+
break;
|
|
351
|
+
}
|
|
352
|
+
} else {
|
|
353
|
+
const offset = `${size}px`;
|
|
354
|
+
switch (`${props.orientation}-${props.placement}-${props.theme.rtl ? 'rtl' : 'ltr'}`) {
|
|
355
|
+
case 'top-end-ltr':
|
|
356
|
+
case 'top-end-rtl':
|
|
357
|
+
case 'top-start-rtl':
|
|
358
|
+
top = inset;
|
|
359
|
+
right = offset;
|
|
360
|
+
break;
|
|
361
|
+
case 'bottom-end-ltr':
|
|
362
|
+
case 'bottom-end-rtl':
|
|
363
|
+
case 'bottom-start-rtl':
|
|
364
|
+
bottom = inset;
|
|
365
|
+
right = offset;
|
|
366
|
+
break;
|
|
367
|
+
case 'start-start-ltr':
|
|
368
|
+
case 'end-start-rtl':
|
|
369
|
+
top = offset;
|
|
370
|
+
left = inset;
|
|
371
|
+
break;
|
|
372
|
+
case 'start-end-ltr':
|
|
373
|
+
case 'end-end-rtl':
|
|
374
|
+
bottom = offset;
|
|
375
|
+
left = inset;
|
|
376
|
+
break;
|
|
377
|
+
case 'end-start-ltr':
|
|
378
|
+
case 'start-start-rtl':
|
|
379
|
+
top = offset;
|
|
380
|
+
right = inset;
|
|
381
|
+
break;
|
|
382
|
+
case 'end-end-ltr':
|
|
383
|
+
case 'start-end-rtl':
|
|
384
|
+
bottom = offset;
|
|
385
|
+
right = inset;
|
|
386
|
+
break;
|
|
387
|
+
case 'top-start-ltr':
|
|
388
|
+
top = inset;
|
|
389
|
+
left = offset;
|
|
390
|
+
break;
|
|
391
|
+
case 'bottom-start-ltr':
|
|
392
|
+
bottom = inset;
|
|
393
|
+
left = offset;
|
|
394
|
+
break;
|
|
339
395
|
}
|
|
340
396
|
}
|
|
341
|
-
return styled.css(["
|
|
397
|
+
return styled.css(["top:", ";right:", ";bottom:", ";left:", ";"], top, right, bottom, left);
|
|
342
398
|
};
|
|
343
|
-
const
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
399
|
+
const sizeStyles = _ref2 => {
|
|
400
|
+
let {
|
|
401
|
+
theme
|
|
402
|
+
} = _ref2;
|
|
403
|
+
const size = getSize(theme);
|
|
404
|
+
return styled.css(["border-radius:", "px;width:", "px;height:", "px;"], size, size, size);
|
|
405
|
+
};
|
|
406
|
+
const minimumSplitterSize = theme => polished.stripUnit(polished.math(`${theme.shadowWidths.md} * 2 + ${getSize(theme)}`));
|
|
407
|
+
const StyledPaneSplitterButtonContainer = styled__default.default.div.withConfig({
|
|
408
|
+
displayName: "StyledPaneSplitterButtonContainer",
|
|
409
|
+
componentId: "sc-1w84y62-0"
|
|
410
|
+
})(["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));
|
|
411
|
+
StyledPaneSplitterButtonContainer.defaultProps = {
|
|
354
412
|
theme: reactTheming.DEFAULT_THEME
|
|
355
413
|
};
|
|
356
414
|
|
|
@@ -371,7 +429,7 @@ const Col = React__default.default.forwardRef((_ref, ref) => {
|
|
|
371
429
|
gutters,
|
|
372
430
|
debug
|
|
373
431
|
} = useGridContext();
|
|
374
|
-
return React__default.default.createElement(StyledCol,
|
|
432
|
+
return React__default.default.createElement(StyledCol, Object.assign({
|
|
375
433
|
sizeAll: size,
|
|
376
434
|
columns: columns,
|
|
377
435
|
gutters: gutters,
|
|
@@ -422,7 +480,7 @@ const Row = React__default.default.forwardRef((_ref, ref) => {
|
|
|
422
480
|
gutters,
|
|
423
481
|
debug
|
|
424
482
|
} = useGridContext();
|
|
425
|
-
return React__default.default.createElement(StyledRow,
|
|
483
|
+
return React__default.default.createElement(StyledRow, Object.assign({
|
|
426
484
|
gutters: gutters,
|
|
427
485
|
debug: debug,
|
|
428
486
|
wrapAll: wrap,
|
|
@@ -464,7 +522,7 @@ const GridComponent = React__default.default.forwardRef((_ref, ref) => {
|
|
|
464
522
|
}), [columns, props.gutters, debug]);
|
|
465
523
|
return React__default.default.createElement(GridContext.Provider, {
|
|
466
524
|
value: value
|
|
467
|
-
}, React__default.default.createElement(StyledGrid,
|
|
525
|
+
}, React__default.default.createElement(StyledGrid, Object.assign({
|
|
468
526
|
debug: debug,
|
|
469
527
|
ref: ref
|
|
470
528
|
}, props)));
|
|
@@ -710,6 +768,7 @@ const orientationToDimension = {
|
|
|
710
768
|
};
|
|
711
769
|
const SplitterComponent = React.forwardRef((_ref, ref) => {
|
|
712
770
|
let {
|
|
771
|
+
children,
|
|
713
772
|
providerId,
|
|
714
773
|
layoutKey,
|
|
715
774
|
min,
|
|
@@ -726,7 +785,6 @@ const SplitterComponent = React.forwardRef((_ref, ref) => {
|
|
|
726
785
|
const paneContext = usePaneContext();
|
|
727
786
|
const themeContext = React.useContext(styled.ThemeContext);
|
|
728
787
|
const environment = reactTheming.useDocument(themeContext);
|
|
729
|
-
const [isHovered, setIsHovered] = React.useState(false);
|
|
730
788
|
const isRow = orientationToDimension[orientation] === 'rows';
|
|
731
789
|
const separatorRef = React.useRef(null);
|
|
732
790
|
const splitterOrientation = paneToSplitterOrientation[orientation || 'end'];
|
|
@@ -768,7 +826,6 @@ const SplitterComponent = React.forwardRef((_ref, ref) => {
|
|
|
768
826
|
onClick
|
|
769
827
|
});
|
|
770
828
|
const size = isRow ? separatorRef.current?.clientWidth : separatorRef.current?.clientHeight;
|
|
771
|
-
const onMouseOver = React.useMemo(() => containerUtilities.composeEventHandlers(props.onMouseOver, event => setIsHovered(event.target === separatorRef.current)), [props.onMouseOver, separatorRef]);
|
|
772
829
|
return React__default.default.createElement(PaneSplitterContext.Provider, {
|
|
773
830
|
value: React.useMemo(() => ({
|
|
774
831
|
orientation,
|
|
@@ -779,14 +836,12 @@ const SplitterComponent = React.forwardRef((_ref, ref) => {
|
|
|
779
836
|
size,
|
|
780
837
|
isRow
|
|
781
838
|
}), [orientation, layoutKey, min, max, valueInFr, size, isRow])
|
|
782
|
-
}, React__default.default.createElement(StyledPaneSplitter,
|
|
783
|
-
isHovered: isHovered,
|
|
839
|
+
}, React__default.default.createElement(StyledPaneSplitter, Object.assign({
|
|
784
840
|
isFixed: isFixed,
|
|
785
841
|
orientation: orientation
|
|
786
842
|
}, separatorProps, props, {
|
|
787
|
-
onMouseOver: onMouseOver,
|
|
788
843
|
ref: reactMergeRefs.mergeRefs([separatorRef, ref])
|
|
789
|
-
})));
|
|
844
|
+
})), children );
|
|
790
845
|
});
|
|
791
846
|
SplitterComponent.displayName = 'Pane.Splitter';
|
|
792
847
|
SplitterComponent.propTypes = {
|
|
@@ -805,7 +860,7 @@ const ContentComponent = React.forwardRef((props, ref) => {
|
|
|
805
860
|
const {
|
|
806
861
|
isVisible
|
|
807
862
|
} = usePaneContext();
|
|
808
|
-
return React__default.default.createElement(StyledPaneContent,
|
|
863
|
+
return React__default.default.createElement(StyledPaneContent, Object.assign({
|
|
809
864
|
hidden: !isVisible,
|
|
810
865
|
ref: ref
|
|
811
866
|
}, props));
|
|
@@ -858,24 +913,27 @@ const SplitterButtonComponent = React.forwardRef((props, ref) => {
|
|
|
858
913
|
);
|
|
859
914
|
const onMouseDown = containerUtilities.composeEventHandlers(props.onMouseDown, event => event.stopPropagation()
|
|
860
915
|
);
|
|
861
|
-
return React__default.default.createElement(
|
|
916
|
+
return React__default.default.createElement(StyledPaneSplitterButtonContainer, {
|
|
917
|
+
orientation: orientation,
|
|
918
|
+
placement: placement,
|
|
919
|
+
splitterSize: size || 0
|
|
920
|
+
}, React__default.default.createElement(reactTooltips.Tooltip, {
|
|
862
921
|
content: label,
|
|
922
|
+
zIndex: 2,
|
|
863
923
|
style: {
|
|
864
924
|
cursor: 'default'
|
|
865
925
|
},
|
|
866
926
|
onMouseDown: e => e.stopPropagation()
|
|
867
|
-
}, React__default.default.createElement(StyledPaneSplitterButton,
|
|
927
|
+
}, React__default.default.createElement(StyledPaneSplitterButton, Object.assign({
|
|
868
928
|
"aria-label": label
|
|
869
929
|
}, props, {
|
|
870
|
-
placement: placement,
|
|
871
930
|
orientation: orientation,
|
|
872
931
|
isRotated: isMin,
|
|
873
|
-
splitterSize: size || 0,
|
|
874
932
|
ref: ref,
|
|
875
933
|
onClick: onClick,
|
|
876
934
|
onKeyDown: onKeyDown,
|
|
877
935
|
onMouseDown: onMouseDown
|
|
878
|
-
})));
|
|
936
|
+
}))));
|
|
879
937
|
});
|
|
880
938
|
SplitterButtonComponent.displayName = 'Pane.SplitterButton';
|
|
881
939
|
const SplitterButton = SplitterButtonComponent;
|
|
@@ -901,7 +959,7 @@ const PaneComponent = React.forwardRef((_ref, ref) => {
|
|
|
901
959
|
}), [paneId, isVisible]);
|
|
902
960
|
return React__default.default.createElement(PaneContext.Provider, {
|
|
903
961
|
value: paneContext
|
|
904
|
-
}, React__default.default.createElement(StyledPane,
|
|
962
|
+
}, React__default.default.createElement(StyledPane, Object.assign({
|
|
905
963
|
id: paneId,
|
|
906
964
|
ref: reactMergeRefs.mergeRefs([ref, observerRef])
|
|
907
965
|
}, 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": "9.0.0-next.
|
|
3
|
+
"version": "9.0.0-next.8",
|
|
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": "^9.0.0-next.
|
|
27
|
-
"@zendeskgarden/react-tooltips": "^9.0.0-next.
|
|
26
|
+
"@zendeskgarden/react-buttons": "^9.0.0-next.8",
|
|
27
|
+
"@zendeskgarden/react-tooltips": "^9.0.0-next.8",
|
|
28
28
|
"polished": "^4.0.0",
|
|
29
29
|
"prop-types": "^15.5.7",
|
|
30
30
|
"react-merge-refs": "^2.0.0",
|
|
31
31
|
"use-resize-observer": "^9.1.0"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
|
-
"@zendeskgarden/react-theming": "
|
|
34
|
+
"@zendeskgarden/react-theming": ">=9.0.0-next",
|
|
35
35
|
"react": ">=16.8.0",
|
|
36
36
|
"react-dom": ">=16.8.0",
|
|
37
37
|
"styled-components": "^5.3.1"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@zendeskgarden/react-theming": "^9.0.0-next.
|
|
40
|
+
"@zendeskgarden/react-theming": "^9.0.0-next.8"
|
|
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": "a3d6534843d5a4f5cb60b52bc67264f3230f2da0"
|
|
53
53
|
}
|