@zendeskgarden/react-grid 9.0.0-next.2 → 9.0.0-next.20
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 +10 -10
- 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 +89 -0
- package/dist/esm/styled/StyledGrid.js +49 -0
- package/dist/esm/styled/StyledRow.js +65 -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 +119 -0
- package/dist/esm/styled/pane/StyledPaneSplitterButton.js +46 -0
- package/dist/esm/styled/pane/StyledPaneSplitterButtonContainer.js +128 -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 +290 -155
- package/dist/typings/elements/Col.d.ts +2 -0
- package/dist/typings/elements/Grid.d.ts +7 -1
- package/dist/typings/elements/Row.d.ts +2 -0
- package/dist/typings/index.d.ts +1 -1
- 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 +10 -10
- 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');
|
|
@@ -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'];
|
|
@@ -51,8 +35,20 @@ const WRAP = ['nowrap', 'wrap', 'wrap-reverse'];
|
|
|
51
35
|
const ORIENTATION = ['top', 'bottom', 'start', 'end'];
|
|
52
36
|
|
|
53
37
|
const COMPONENT_ID$6 = 'grid.col';
|
|
54
|
-
const colorStyles$4 =
|
|
55
|
-
|
|
38
|
+
const colorStyles$4 = _ref => {
|
|
39
|
+
let {
|
|
40
|
+
theme
|
|
41
|
+
} = _ref;
|
|
42
|
+
const backgroundColor = reactTheming.getColor({
|
|
43
|
+
theme,
|
|
44
|
+
variable: 'background.primaryEmphasis',
|
|
45
|
+
dark: {
|
|
46
|
+
transparency: theme.opacity[200]
|
|
47
|
+
},
|
|
48
|
+
light: {
|
|
49
|
+
transparency: theme.opacity[100]
|
|
50
|
+
}
|
|
51
|
+
});
|
|
56
52
|
return styled.css(["background-clip:content-box;background-color:", ";"], backgroundColor);
|
|
57
53
|
};
|
|
58
54
|
const flexStyles$1 = (size, alignSelf, textAlign, offset, order, props) => {
|
|
@@ -96,48 +92,76 @@ const flexStyles$1 = (size, alignSelf, textAlign, offset, order, props) => {
|
|
|
96
92
|
const mediaStyles$1 = (minWidth, size, alignSelf, textAlign, offset, order, props) => {
|
|
97
93
|
return styled.css(["@media (min-width:", "){", ";}"], minWidth, flexStyles$1(size, alignSelf, textAlign, offset, order, props));
|
|
98
94
|
};
|
|
99
|
-
const sizeStyles$
|
|
100
|
-
|
|
95
|
+
const sizeStyles$5 = _ref2 => {
|
|
96
|
+
let {
|
|
97
|
+
theme,
|
|
98
|
+
gutters
|
|
99
|
+
} = _ref2;
|
|
100
|
+
const padding = gutters ? polished.math(`${theme.space[gutters]} / 2`) : 0;
|
|
101
101
|
return styled.css(["padding-right:", ";padding-left:", ";"], padding, padding);
|
|
102
102
|
};
|
|
103
103
|
const StyledCol = styled__default.default.div.attrs({
|
|
104
104
|
'data-garden-id': COMPONENT_ID$6,
|
|
105
|
-
'data-garden-version': '9.0.0-next.
|
|
105
|
+
'data-garden-version': '9.0.0-next.20'
|
|
106
106
|
}).withConfig({
|
|
107
107
|
displayName: "StyledCol",
|
|
108
108
|
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),
|
|
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), sizeStyles$5, 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$6, props));
|
|
110
110
|
StyledCol.defaultProps = {
|
|
111
111
|
columns: 12,
|
|
112
112
|
theme: reactTheming.DEFAULT_THEME
|
|
113
113
|
};
|
|
114
114
|
|
|
115
115
|
const COMPONENT_ID$5 = 'grid.grid';
|
|
116
|
-
const colorStyles$3 =
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
116
|
+
const colorStyles$3 = _ref => {
|
|
117
|
+
let {
|
|
118
|
+
theme,
|
|
119
|
+
debug
|
|
120
|
+
} = _ref;
|
|
121
|
+
const borderColor = debug && reactTheming.getColor({
|
|
122
|
+
theme,
|
|
123
|
+
hue: 'crimson',
|
|
124
|
+
shade: 700,
|
|
125
|
+
transparency: theme.opacity[600]
|
|
126
|
+
});
|
|
127
|
+
const borderWidth = debug && polished.math(`${theme.borderWidths.sm} * 2`);
|
|
128
|
+
return styled.css(["color-scheme:only ", ";box-shadow:", ";"], theme.colors.base, debug && `
|
|
129
|
+
-${borderWidth} 0 0 0 ${borderColor},
|
|
130
|
+
${borderWidth} 0 0 0 ${borderColor}
|
|
131
|
+
`);
|
|
120
132
|
};
|
|
121
|
-
const sizeStyles$
|
|
122
|
-
|
|
133
|
+
const sizeStyles$4 = _ref2 => {
|
|
134
|
+
let {
|
|
135
|
+
theme,
|
|
136
|
+
gutters
|
|
137
|
+
} = _ref2;
|
|
138
|
+
const padding = gutters ? polished.math(`${theme.space[gutters]} / 2`) : 0;
|
|
123
139
|
return styled.css(["padding-right:", ";padding-left:", ";"], padding, padding);
|
|
124
140
|
};
|
|
125
141
|
const StyledGrid = styled__default.default.div.attrs({
|
|
126
142
|
'data-garden-id': COMPONENT_ID$5,
|
|
127
|
-
'data-garden-version': '9.0.0-next.
|
|
143
|
+
'data-garden-version': '9.0.0-next.20'
|
|
128
144
|
}).withConfig({
|
|
129
145
|
displayName: "StyledGrid",
|
|
130
146
|
componentId: "sc-oxgg5i-0"
|
|
131
|
-
})(["direction:", ";margin-right:auto;margin-left:auto;width:100%;box-sizing:border-box;", ";", ";", ";"], props => props.theme.rtl && 'rtl',
|
|
147
|
+
})(["direction:", ";margin-right:auto;margin-left:auto;width:100%;box-sizing:border-box;", ";", ";", ";"], props => props.theme.rtl && 'rtl', sizeStyles$4, colorStyles$3, props => reactTheming.retrieveComponentStyles(COMPONENT_ID$5, props));
|
|
132
148
|
StyledGrid.defaultProps = {
|
|
133
149
|
gutters: 'md',
|
|
134
150
|
theme: reactTheming.DEFAULT_THEME
|
|
135
151
|
};
|
|
136
152
|
|
|
137
153
|
const COMPONENT_ID$4 = 'grid.row';
|
|
138
|
-
const colorStyles$2 =
|
|
139
|
-
|
|
140
|
-
|
|
154
|
+
const colorStyles$2 = _ref => {
|
|
155
|
+
let {
|
|
156
|
+
theme
|
|
157
|
+
} = _ref;
|
|
158
|
+
const borderColor = reactTheming.getColor({
|
|
159
|
+
theme,
|
|
160
|
+
hue: 'mint',
|
|
161
|
+
shade: 700,
|
|
162
|
+
transparency: theme.opacity[600]
|
|
163
|
+
});
|
|
164
|
+
const borderWidth = theme.borderWidths.sm;
|
|
141
165
|
return styled.css(["box-shadow:inset 0 ", " 0 0 ", ",inset 0 -", " 0 0 ", ";"], borderWidth, borderColor, borderWidth, borderColor);
|
|
142
166
|
};
|
|
143
167
|
const flexStyles = (alignItems, justifyContent, wrap) => {
|
|
@@ -160,17 +184,21 @@ const flexStyles = (alignItems, justifyContent, wrap) => {
|
|
|
160
184
|
const mediaStyles = (minWidth, alignItems, justifyContent, wrap) => {
|
|
161
185
|
return styled.css(["@media (min-width:", "){", ";}"], minWidth, flexStyles(alignItems, justifyContent, wrap));
|
|
162
186
|
};
|
|
163
|
-
const sizeStyles$
|
|
164
|
-
|
|
187
|
+
const sizeStyles$3 = _ref2 => {
|
|
188
|
+
let {
|
|
189
|
+
theme,
|
|
190
|
+
gutters
|
|
191
|
+
} = _ref2;
|
|
192
|
+
const margin = gutters ? polished.math(`${theme.space[gutters]} / 2`) : 0;
|
|
165
193
|
return styled.css(["margin-right:-", ";margin-left:-", ";"], margin, margin);
|
|
166
194
|
};
|
|
167
195
|
const StyledRow = styled__default.default.div.attrs({
|
|
168
196
|
'data-garden-id': COMPONENT_ID$4,
|
|
169
|
-
'data-garden-version': '9.0.0-next.
|
|
197
|
+
'data-garden-version': '9.0.0-next.20'
|
|
170
198
|
}).withConfig({
|
|
171
199
|
displayName: "StyledRow",
|
|
172
200
|
componentId: "sc-xjsdg1-0"
|
|
173
|
-
})(["display:flex;box-sizing:border-box;", " ", ";", ";", ";", ";", ";", ";", ";", ";"], props => flexStyles(props.alignItems, props.justifyContent, props.wrapAll),
|
|
201
|
+
})(["display:flex;box-sizing:border-box;", " ", ";", ";", ";", ";", ";", ";", ";", ";"], props => flexStyles(props.alignItems, props.justifyContent, props.wrapAll), sizeStyles$3, 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$4, props));
|
|
174
202
|
StyledRow.defaultProps = {
|
|
175
203
|
wrapAll: 'wrap',
|
|
176
204
|
theme: reactTheming.DEFAULT_THEME
|
|
@@ -179,7 +207,7 @@ StyledRow.defaultProps = {
|
|
|
179
207
|
const COMPONENT_ID$3 = 'pane';
|
|
180
208
|
const StyledPane = styled__default.default.div.attrs({
|
|
181
209
|
'data-garden-id': COMPONENT_ID$3,
|
|
182
|
-
'data-garden-version': '9.0.0-next.
|
|
210
|
+
'data-garden-version': '9.0.0-next.20'
|
|
183
211
|
}).withConfig({
|
|
184
212
|
displayName: "StyledPane",
|
|
185
213
|
componentId: "sc-1ltjst7-0"
|
|
@@ -191,32 +219,54 @@ StyledPane.defaultProps = {
|
|
|
191
219
|
const COMPONENT_ID$2 = 'pane.content';
|
|
192
220
|
const StyledPaneContent = styled__default.default.div.attrs({
|
|
193
221
|
'data-garden-id': COMPONENT_ID$2,
|
|
194
|
-
'data-garden-version': '9.0.0-next.
|
|
222
|
+
'data-garden-version': '9.0.0-next.20'
|
|
195
223
|
}).withConfig({
|
|
196
224
|
displayName: "StyledPaneContent",
|
|
197
225
|
componentId: "sc-1b38mbh-0"
|
|
198
|
-
})(["height:100%;overflow:auto;&[hidden]{display:none;}", ";"], props => reactTheming.retrieveComponentStyles(COMPONENT_ID$2, props));
|
|
226
|
+
})(["height:100%;overflow:auto;color-scheme:only ", ";&[hidden]{display:none;}", ";"], p => p.theme.colors.base, props => reactTheming.retrieveComponentStyles(COMPONENT_ID$2, props));
|
|
199
227
|
StyledPaneContent.defaultProps = {
|
|
200
228
|
theme: reactTheming.DEFAULT_THEME
|
|
201
229
|
};
|
|
202
230
|
|
|
203
231
|
const COMPONENT_ID$1 = 'pane.splitter';
|
|
204
|
-
const colorStyles$1 =
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
theme
|
|
210
|
-
|
|
232
|
+
const colorStyles$1 = _ref => {
|
|
233
|
+
let {
|
|
234
|
+
theme
|
|
235
|
+
} = _ref;
|
|
236
|
+
const color = reactTheming.getColor({
|
|
237
|
+
theme,
|
|
238
|
+
variable: 'border.default'
|
|
239
|
+
});
|
|
240
|
+
const options = {
|
|
241
|
+
theme,
|
|
242
|
+
variable: 'border.primaryEmphasis'
|
|
243
|
+
};
|
|
244
|
+
const hoverColor = reactTheming.getColor(options);
|
|
245
|
+
const activeColor = reactTheming.getColor({
|
|
246
|
+
...options,
|
|
247
|
+
dark: {
|
|
248
|
+
offset: -200
|
|
249
|
+
},
|
|
250
|
+
light: {
|
|
251
|
+
offset: 200
|
|
252
|
+
}
|
|
253
|
+
});
|
|
254
|
+
return styled.css(["&::before{background-color:", ";}&:hover::before{background-color:", ";}", " &:active::before{background-color:", ";}"], color, hoverColor, reactTheming.focusStyles({
|
|
255
|
+
theme,
|
|
211
256
|
styles: {
|
|
212
257
|
backgroundColor: hoverColor
|
|
213
258
|
},
|
|
214
|
-
selector: '&:focus-visible::before
|
|
215
|
-
}),
|
|
259
|
+
selector: '&:focus-visible::before'
|
|
260
|
+
}), activeColor);
|
|
216
261
|
};
|
|
217
|
-
const sizeStyles$
|
|
218
|
-
|
|
219
|
-
|
|
262
|
+
const sizeStyles$2 = _ref2 => {
|
|
263
|
+
let {
|
|
264
|
+
theme,
|
|
265
|
+
orientation,
|
|
266
|
+
isFixed
|
|
267
|
+
} = _ref2;
|
|
268
|
+
const size = polished.math(`${theme.shadowWidths.md} * 2`);
|
|
269
|
+
const separatorSize = polished.math(`${theme.borderWidths.sm} * 2`);
|
|
220
270
|
const offset = polished.math(`-${size} / 2`);
|
|
221
271
|
let cursor;
|
|
222
272
|
let top;
|
|
@@ -227,14 +277,14 @@ const sizeStyles$1 = props => {
|
|
|
227
277
|
let height;
|
|
228
278
|
let separatorWidth;
|
|
229
279
|
let separatorHeight;
|
|
230
|
-
switch (
|
|
280
|
+
switch (orientation) {
|
|
231
281
|
case 'top':
|
|
232
282
|
cursor = 'row-resize';
|
|
233
283
|
top = offset;
|
|
234
284
|
width = '100%';
|
|
235
285
|
height = size;
|
|
236
286
|
separatorWidth = width;
|
|
237
|
-
separatorHeight =
|
|
287
|
+
separatorHeight = theme.borderWidths.sm;
|
|
238
288
|
break;
|
|
239
289
|
case 'bottom':
|
|
240
290
|
cursor = 'row-resize';
|
|
@@ -242,16 +292,16 @@ const sizeStyles$1 = props => {
|
|
|
242
292
|
width = '100%';
|
|
243
293
|
height = size;
|
|
244
294
|
separatorWidth = width;
|
|
245
|
-
separatorHeight =
|
|
295
|
+
separatorHeight = theme.borderWidths.sm;
|
|
246
296
|
break;
|
|
247
297
|
case 'start':
|
|
248
298
|
cursor = 'col-resize';
|
|
249
299
|
top = 0;
|
|
250
300
|
width = size;
|
|
251
301
|
height = '100%';
|
|
252
|
-
separatorWidth =
|
|
302
|
+
separatorWidth = theme.borderWidths.sm;
|
|
253
303
|
separatorHeight = height;
|
|
254
|
-
if (
|
|
304
|
+
if (theme.rtl) {
|
|
255
305
|
right = offset;
|
|
256
306
|
} else {
|
|
257
307
|
left = offset;
|
|
@@ -263,9 +313,9 @@ const sizeStyles$1 = props => {
|
|
|
263
313
|
top = 0;
|
|
264
314
|
width = size;
|
|
265
315
|
height = '100%';
|
|
266
|
-
separatorWidth =
|
|
316
|
+
separatorWidth = theme.borderWidths.sm;
|
|
267
317
|
separatorHeight = height;
|
|
268
|
-
if (
|
|
318
|
+
if (theme.rtl) {
|
|
269
319
|
left = offset;
|
|
270
320
|
} else {
|
|
271
321
|
right = offset;
|
|
@@ -273,20 +323,27 @@ const sizeStyles$1 = props => {
|
|
|
273
323
|
break;
|
|
274
324
|
}
|
|
275
325
|
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
|
|
326
|
+
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, isFixed ? 'pointer' : cursor, width, height, separatorWidth, separatorHeight, dimensionProperty, separatorSize, dimensionProperty, separatorSize, theme.borderRadii.md);
|
|
277
327
|
};
|
|
278
328
|
const StyledPaneSplitter = styled__default.default.div.attrs({
|
|
279
329
|
'data-garden-id': COMPONENT_ID$1,
|
|
280
|
-
'data-garden-version': '9.0.0-next.
|
|
330
|
+
'data-garden-version': '9.0.0-next.20'
|
|
281
331
|
}).withConfig({
|
|
282
332
|
displayName: "StyledPaneSplitter",
|
|
283
333
|
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$
|
|
334
|
+
})(["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$1, props));
|
|
285
335
|
StyledPaneSplitter.defaultProps = {
|
|
286
336
|
theme: reactTheming.DEFAULT_THEME
|
|
287
337
|
};
|
|
288
338
|
|
|
289
|
-
const
|
|
339
|
+
const getSize = theme => theme.space.base * 6;
|
|
340
|
+
const sizeStyles$1 = _ref => {
|
|
341
|
+
let {
|
|
342
|
+
theme
|
|
343
|
+
} = _ref;
|
|
344
|
+
const size = `${getSize(theme)}px`;
|
|
345
|
+
return styled.css(["width:", ";min-width:", ";height:", ";"], size, size, size);
|
|
346
|
+
};
|
|
290
347
|
const transformStyles = props => {
|
|
291
348
|
let degrees = 0;
|
|
292
349
|
if (props.isRotated) {
|
|
@@ -301,56 +358,131 @@ const transformStyles = props => {
|
|
|
301
358
|
}
|
|
302
359
|
return styled.css(["& > svg{transform:rotate(", "deg);}"], degrees);
|
|
303
360
|
};
|
|
361
|
+
const StyledPaneSplitterButton = styled__default.default(reactButtons.ChevronButton).attrs({
|
|
362
|
+
'data-garden-version': '9.0.0-next.20',
|
|
363
|
+
isBasic: true,
|
|
364
|
+
isPill: true,
|
|
365
|
+
size: 'small'
|
|
366
|
+
}).withConfig({
|
|
367
|
+
displayName: "StyledPaneSplitterButton",
|
|
368
|
+
componentId: "sc-zh032e-0"
|
|
369
|
+
})(["", ";", ";"], sizeStyles$1, transformStyles);
|
|
370
|
+
StyledPaneSplitterButton.defaultProps = {
|
|
371
|
+
theme: reactTheming.DEFAULT_THEME
|
|
372
|
+
};
|
|
373
|
+
|
|
374
|
+
const COMPONENT_ID = 'pane.splitter_button_container';
|
|
304
375
|
const colorStyles = _ref => {
|
|
305
376
|
let {
|
|
306
377
|
theme
|
|
307
378
|
} = _ref;
|
|
308
|
-
const
|
|
309
|
-
return styled.css(["box-shadow:", ";", ""], boxShadow, reactTheming.focusStyles({
|
|
379
|
+
const backgroundColor = reactTheming.getColor({
|
|
310
380
|
theme,
|
|
311
|
-
|
|
381
|
+
variable: 'background.raised'
|
|
382
|
+
});
|
|
383
|
+
const boxShadow = theme.shadows.lg(`${theme.space.base}px`, `${theme.space.base * 2}px`, reactTheming.getColor({
|
|
384
|
+
variable: 'shadow.small',
|
|
385
|
+
theme
|
|
312
386
|
}));
|
|
387
|
+
return styled.css(["box-shadow:", ";background-color:", ";"], boxShadow, backgroundColor);
|
|
313
388
|
};
|
|
314
|
-
const
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
389
|
+
const positionStyles = _ref2 => {
|
|
390
|
+
let {
|
|
391
|
+
theme,
|
|
392
|
+
placement,
|
|
393
|
+
splitterSize,
|
|
394
|
+
orientation
|
|
395
|
+
} = _ref2;
|
|
318
396
|
let top;
|
|
319
397
|
let left;
|
|
320
398
|
let right;
|
|
321
399
|
let bottom;
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
left =
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
400
|
+
const size = getSize(theme);
|
|
401
|
+
const inset = `-${size / 2}px`;
|
|
402
|
+
if (placement === 'center' || splitterSize < size * 3) {
|
|
403
|
+
const center = `${splitterSize / 2 - size / 2}px`;
|
|
404
|
+
switch (`${orientation}-${theme.rtl ? 'rtl' : 'ltr'}`) {
|
|
405
|
+
case 'top-ltr':
|
|
406
|
+
case 'top-rtl':
|
|
407
|
+
top = inset;
|
|
408
|
+
left = center;
|
|
409
|
+
break;
|
|
410
|
+
case 'start-ltr':
|
|
411
|
+
case 'end-rtl':
|
|
412
|
+
top = center;
|
|
413
|
+
left = inset;
|
|
414
|
+
break;
|
|
415
|
+
case 'end-ltr':
|
|
416
|
+
case 'start-rtl':
|
|
417
|
+
top = center;
|
|
418
|
+
right = inset;
|
|
419
|
+
break;
|
|
420
|
+
case 'bottom-ltr':
|
|
421
|
+
case 'bottom-rtl':
|
|
422
|
+
bottom = inset;
|
|
423
|
+
right = center;
|
|
424
|
+
break;
|
|
425
|
+
}
|
|
426
|
+
} else {
|
|
427
|
+
const offset = `${size}px`;
|
|
428
|
+
switch (`${orientation}-${placement}-${theme.rtl ? 'rtl' : 'ltr'}`) {
|
|
429
|
+
case 'top-end-ltr':
|
|
430
|
+
case 'top-end-rtl':
|
|
431
|
+
case 'top-start-rtl':
|
|
432
|
+
top = inset;
|
|
433
|
+
right = offset;
|
|
434
|
+
break;
|
|
435
|
+
case 'bottom-end-ltr':
|
|
436
|
+
case 'bottom-end-rtl':
|
|
437
|
+
case 'bottom-start-rtl':
|
|
438
|
+
bottom = inset;
|
|
439
|
+
right = offset;
|
|
440
|
+
break;
|
|
441
|
+
case 'start-start-ltr':
|
|
442
|
+
case 'end-start-rtl':
|
|
443
|
+
top = offset;
|
|
444
|
+
left = inset;
|
|
445
|
+
break;
|
|
446
|
+
case 'start-end-ltr':
|
|
447
|
+
case 'end-end-rtl':
|
|
448
|
+
bottom = offset;
|
|
449
|
+
left = inset;
|
|
450
|
+
break;
|
|
451
|
+
case 'end-start-ltr':
|
|
452
|
+
case 'start-start-rtl':
|
|
453
|
+
top = offset;
|
|
454
|
+
right = inset;
|
|
455
|
+
break;
|
|
456
|
+
case 'end-end-ltr':
|
|
457
|
+
case 'start-end-rtl':
|
|
458
|
+
bottom = offset;
|
|
459
|
+
right = inset;
|
|
460
|
+
break;
|
|
461
|
+
case 'top-start-ltr':
|
|
462
|
+
top = inset;
|
|
463
|
+
left = offset;
|
|
464
|
+
break;
|
|
465
|
+
case 'bottom-start-ltr':
|
|
466
|
+
bottom = inset;
|
|
467
|
+
left = offset;
|
|
468
|
+
break;
|
|
339
469
|
}
|
|
340
470
|
}
|
|
341
|
-
return styled.css(["
|
|
471
|
+
return styled.css(["top:", ";right:", ";bottom:", ";left:", ";"], top, right, bottom, left);
|
|
342
472
|
};
|
|
343
|
-
const
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
473
|
+
const sizeStyles = _ref3 => {
|
|
474
|
+
let {
|
|
475
|
+
theme
|
|
476
|
+
} = _ref3;
|
|
477
|
+
const size = getSize(theme);
|
|
478
|
+
return styled.css(["border-radius:", "px;width:", "px;height:", "px;"], size, size, size);
|
|
479
|
+
};
|
|
480
|
+
const minimumSplitterSize = theme => polished.stripUnit(polished.math(`${theme.shadowWidths.md} * 2 + ${getSize(theme)}`));
|
|
481
|
+
const StyledPaneSplitterButtonContainer = styled__default.default.div.withConfig({
|
|
482
|
+
displayName: "StyledPaneSplitterButtonContainer",
|
|
483
|
+
componentId: "sc-1w84y62-0"
|
|
484
|
+
})(["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));
|
|
485
|
+
StyledPaneSplitterButtonContainer.defaultProps = {
|
|
354
486
|
theme: reactTheming.DEFAULT_THEME
|
|
355
487
|
};
|
|
356
488
|
|
|
@@ -371,7 +503,7 @@ const Col = React__default.default.forwardRef((_ref, ref) => {
|
|
|
371
503
|
gutters,
|
|
372
504
|
debug
|
|
373
505
|
} = useGridContext();
|
|
374
|
-
return React__default.default.createElement(StyledCol,
|
|
506
|
+
return React__default.default.createElement(StyledCol, Object.assign({
|
|
375
507
|
sizeAll: size,
|
|
376
508
|
columns: columns,
|
|
377
509
|
gutters: gutters,
|
|
@@ -413,35 +545,6 @@ Col.propTypes = {
|
|
|
413
545
|
orderXl: PropTypes__default.default.oneOfType([PropTypes__default.default.number, PropTypes__default.default.string])
|
|
414
546
|
};
|
|
415
547
|
|
|
416
|
-
const Grid = React__default.default.forwardRef((_ref, ref) => {
|
|
417
|
-
let {
|
|
418
|
-
columns,
|
|
419
|
-
debug,
|
|
420
|
-
...props
|
|
421
|
-
} = _ref;
|
|
422
|
-
const value = React.useMemo(() => ({
|
|
423
|
-
columns,
|
|
424
|
-
gutters: props.gutters,
|
|
425
|
-
debug
|
|
426
|
-
}), [columns, props.gutters, debug]);
|
|
427
|
-
return React__default.default.createElement(GridContext.Provider, {
|
|
428
|
-
value: value
|
|
429
|
-
}, React__default.default.createElement(StyledGrid, _extends({
|
|
430
|
-
debug: debug,
|
|
431
|
-
ref: ref
|
|
432
|
-
}, props)));
|
|
433
|
-
});
|
|
434
|
-
Grid.displayName = 'Grid';
|
|
435
|
-
Grid.propTypes = {
|
|
436
|
-
columns: PropTypes__default.default.oneOfType([PropTypes__default.default.number, PropTypes__default.default.string]),
|
|
437
|
-
gutters: PropTypes__default.default.oneOf(SPACE),
|
|
438
|
-
debug: PropTypes__default.default.bool
|
|
439
|
-
};
|
|
440
|
-
Grid.defaultProps = {
|
|
441
|
-
columns: 12,
|
|
442
|
-
gutters: 'md'
|
|
443
|
-
};
|
|
444
|
-
|
|
445
548
|
const Row = React__default.default.forwardRef((_ref, ref) => {
|
|
446
549
|
let {
|
|
447
550
|
wrap,
|
|
@@ -451,7 +554,7 @@ const Row = React__default.default.forwardRef((_ref, ref) => {
|
|
|
451
554
|
gutters,
|
|
452
555
|
debug
|
|
453
556
|
} = useGridContext();
|
|
454
|
-
return React__default.default.createElement(StyledRow,
|
|
557
|
+
return React__default.default.createElement(StyledRow, Object.assign({
|
|
455
558
|
gutters: gutters,
|
|
456
559
|
debug: debug,
|
|
457
560
|
wrapAll: wrap,
|
|
@@ -480,6 +583,38 @@ Row.propTypes = {
|
|
|
480
583
|
wrapXl: PropTypes__default.default.oneOf(WRAP)
|
|
481
584
|
};
|
|
482
585
|
|
|
586
|
+
const GridComponent = React__default.default.forwardRef((_ref, ref) => {
|
|
587
|
+
let {
|
|
588
|
+
columns,
|
|
589
|
+
debug,
|
|
590
|
+
...props
|
|
591
|
+
} = _ref;
|
|
592
|
+
const value = React.useMemo(() => ({
|
|
593
|
+
columns,
|
|
594
|
+
gutters: props.gutters,
|
|
595
|
+
debug
|
|
596
|
+
}), [columns, props.gutters, debug]);
|
|
597
|
+
return React__default.default.createElement(GridContext.Provider, {
|
|
598
|
+
value: value
|
|
599
|
+
}, React__default.default.createElement(StyledGrid, Object.assign({
|
|
600
|
+
debug: debug,
|
|
601
|
+
ref: ref
|
|
602
|
+
}, props)));
|
|
603
|
+
});
|
|
604
|
+
GridComponent.displayName = 'Grid';
|
|
605
|
+
GridComponent.propTypes = {
|
|
606
|
+
columns: PropTypes__default.default.oneOfType([PropTypes__default.default.number, PropTypes__default.default.string]),
|
|
607
|
+
gutters: PropTypes__default.default.oneOf(SPACE),
|
|
608
|
+
debug: PropTypes__default.default.bool
|
|
609
|
+
};
|
|
610
|
+
GridComponent.defaultProps = {
|
|
611
|
+
columns: 12,
|
|
612
|
+
gutters: 'md'
|
|
613
|
+
};
|
|
614
|
+
const Grid = GridComponent;
|
|
615
|
+
Grid.Row = Row;
|
|
616
|
+
Grid.Col = Col;
|
|
617
|
+
|
|
483
618
|
const PaneProviderContext = React.createContext({});
|
|
484
619
|
const usePaneProviderContextData = providerId => {
|
|
485
620
|
const context = React.useContext(PaneProviderContext);
|
|
@@ -707,6 +842,7 @@ const orientationToDimension = {
|
|
|
707
842
|
};
|
|
708
843
|
const SplitterComponent = React.forwardRef((_ref, ref) => {
|
|
709
844
|
let {
|
|
845
|
+
children,
|
|
710
846
|
providerId,
|
|
711
847
|
layoutKey,
|
|
712
848
|
min,
|
|
@@ -723,7 +859,6 @@ const SplitterComponent = React.forwardRef((_ref, ref) => {
|
|
|
723
859
|
const paneContext = usePaneContext();
|
|
724
860
|
const themeContext = React.useContext(styled.ThemeContext);
|
|
725
861
|
const environment = reactTheming.useDocument(themeContext);
|
|
726
|
-
const [isHovered, setIsHovered] = React.useState(false);
|
|
727
862
|
const isRow = orientationToDimension[orientation] === 'rows';
|
|
728
863
|
const separatorRef = React.useRef(null);
|
|
729
864
|
const splitterOrientation = paneToSplitterOrientation[orientation || 'end'];
|
|
@@ -765,7 +900,6 @@ const SplitterComponent = React.forwardRef((_ref, ref) => {
|
|
|
765
900
|
onClick
|
|
766
901
|
});
|
|
767
902
|
const size = isRow ? separatorRef.current?.clientWidth : separatorRef.current?.clientHeight;
|
|
768
|
-
const onMouseOver = React.useMemo(() => containerUtilities.composeEventHandlers(props.onMouseOver, event => setIsHovered(event.target === separatorRef.current)), [props.onMouseOver, separatorRef]);
|
|
769
903
|
return React__default.default.createElement(PaneSplitterContext.Provider, {
|
|
770
904
|
value: React.useMemo(() => ({
|
|
771
905
|
orientation,
|
|
@@ -776,14 +910,12 @@ const SplitterComponent = React.forwardRef((_ref, ref) => {
|
|
|
776
910
|
size,
|
|
777
911
|
isRow
|
|
778
912
|
}), [orientation, layoutKey, min, max, valueInFr, size, isRow])
|
|
779
|
-
}, React__default.default.createElement(StyledPaneSplitter,
|
|
780
|
-
isHovered: isHovered,
|
|
913
|
+
}, React__default.default.createElement(StyledPaneSplitter, Object.assign({
|
|
781
914
|
isFixed: isFixed,
|
|
782
915
|
orientation: orientation
|
|
783
916
|
}, separatorProps, props, {
|
|
784
|
-
onMouseOver: onMouseOver,
|
|
785
917
|
ref: reactMergeRefs.mergeRefs([separatorRef, ref])
|
|
786
|
-
})));
|
|
918
|
+
})), children );
|
|
787
919
|
});
|
|
788
920
|
SplitterComponent.displayName = 'Pane.Splitter';
|
|
789
921
|
SplitterComponent.propTypes = {
|
|
@@ -802,7 +934,7 @@ const ContentComponent = React.forwardRef((props, ref) => {
|
|
|
802
934
|
const {
|
|
803
935
|
isVisible
|
|
804
936
|
} = usePaneContext();
|
|
805
|
-
return React__default.default.createElement(StyledPaneContent,
|
|
937
|
+
return React__default.default.createElement(StyledPaneContent, Object.assign({
|
|
806
938
|
hidden: !isVisible,
|
|
807
939
|
ref: ref
|
|
808
940
|
}, props));
|
|
@@ -855,24 +987,27 @@ const SplitterButtonComponent = React.forwardRef((props, ref) => {
|
|
|
855
987
|
);
|
|
856
988
|
const onMouseDown = containerUtilities.composeEventHandlers(props.onMouseDown, event => event.stopPropagation()
|
|
857
989
|
);
|
|
858
|
-
return React__default.default.createElement(
|
|
990
|
+
return React__default.default.createElement(StyledPaneSplitterButtonContainer, {
|
|
991
|
+
orientation: orientation,
|
|
992
|
+
placement: placement,
|
|
993
|
+
splitterSize: size || 0
|
|
994
|
+
}, React__default.default.createElement(reactTooltips.Tooltip, {
|
|
859
995
|
content: label,
|
|
996
|
+
zIndex: 2,
|
|
860
997
|
style: {
|
|
861
998
|
cursor: 'default'
|
|
862
999
|
},
|
|
863
1000
|
onMouseDown: e => e.stopPropagation()
|
|
864
|
-
}, React__default.default.createElement(StyledPaneSplitterButton,
|
|
1001
|
+
}, React__default.default.createElement(StyledPaneSplitterButton, Object.assign({
|
|
865
1002
|
"aria-label": label
|
|
866
1003
|
}, props, {
|
|
867
|
-
placement: placement,
|
|
868
1004
|
orientation: orientation,
|
|
869
1005
|
isRotated: isMin,
|
|
870
|
-
splitterSize: size || 0,
|
|
871
1006
|
ref: ref,
|
|
872
1007
|
onClick: onClick,
|
|
873
1008
|
onKeyDown: onKeyDown,
|
|
874
1009
|
onMouseDown: onMouseDown
|
|
875
|
-
})));
|
|
1010
|
+
}))));
|
|
876
1011
|
});
|
|
877
1012
|
SplitterButtonComponent.displayName = 'Pane.SplitterButton';
|
|
878
1013
|
const SplitterButton = SplitterButtonComponent;
|
|
@@ -898,7 +1033,7 @@ const PaneComponent = React.forwardRef((_ref, ref) => {
|
|
|
898
1033
|
}), [paneId, isVisible]);
|
|
899
1034
|
return React__default.default.createElement(PaneContext.Provider, {
|
|
900
1035
|
value: paneContext
|
|
901
|
-
}, React__default.default.createElement(StyledPane,
|
|
1036
|
+
}, React__default.default.createElement(StyledPane, Object.assign({
|
|
902
1037
|
id: paneId,
|
|
903
1038
|
ref: reactMergeRefs.mergeRefs([ref, observerRef])
|
|
904
1039
|
}, props), children));
|
|
@@ -909,15 +1044,15 @@ Pane.Content = Content;
|
|
|
909
1044
|
Pane.Splitter = Splitter;
|
|
910
1045
|
Pane.SplitterButton = SplitterButton;
|
|
911
1046
|
|
|
912
|
-
exports.
|
|
913
|
-
exports.
|
|
914
|
-
exports.ARRAY_DIRECTION = DIRECTION;
|
|
915
|
-
exports.ARRAY_JUSTIFY_CONTENT = JUSTIFY_CONTENT;
|
|
916
|
-
exports.ARRAY_SPACE = SPACE;
|
|
917
|
-
exports.ARRAY_TEXT_ALIGN = TEXT_ALIGN;
|
|
918
|
-
exports.ARRAY_WRAP = WRAP;
|
|
1047
|
+
exports.ALIGN_ITEMS = ALIGN_ITEMS;
|
|
1048
|
+
exports.ALIGN_SELF = ALIGN_SELF;
|
|
919
1049
|
exports.Col = Col;
|
|
1050
|
+
exports.DIRECTION = DIRECTION;
|
|
920
1051
|
exports.Grid = Grid;
|
|
1052
|
+
exports.JUSTIFY_CONTENT = JUSTIFY_CONTENT;
|
|
921
1053
|
exports.Pane = Pane;
|
|
922
1054
|
exports.PaneProvider = PaneProvider;
|
|
923
1055
|
exports.Row = Row;
|
|
1056
|
+
exports.SPACE = SPACE;
|
|
1057
|
+
exports.TEXT_ALIGN = TEXT_ALIGN;
|
|
1058
|
+
exports.WRAP = WRAP;
|