@zendeskgarden/react-grid 9.0.0-next.6 → 9.0.0-next.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +151 -79
- package/dist/index.esm.js +151 -79
- 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 +6 -6
package/dist/index.cjs.js
CHANGED
|
@@ -50,7 +50,7 @@ const SPACE = [false, 'xxs', 'xs', 'sm', 'md', 'lg', 'xl', 'xxl'];
|
|
|
50
50
|
const WRAP = ['nowrap', 'wrap', 'wrap-reverse'];
|
|
51
51
|
const ORIENTATION = ['top', 'bottom', 'start', 'end'];
|
|
52
52
|
|
|
53
|
-
const COMPONENT_ID$
|
|
53
|
+
const COMPONENT_ID$7 = 'grid.col';
|
|
54
54
|
const colorStyles$4 = props => {
|
|
55
55
|
const backgroundColor = reactTheming.getColorV8('primaryHue', 600, props.theme, 0.1);
|
|
56
56
|
return styled.css(["background-clip:content-box;background-color:", ";"], backgroundColor);
|
|
@@ -96,45 +96,45 @@ const flexStyles$1 = (size, alignSelf, textAlign, offset, order, props) => {
|
|
|
96
96
|
const mediaStyles$1 = (minWidth, size, alignSelf, textAlign, offset, order, props) => {
|
|
97
97
|
return styled.css(["@media (min-width:", "){", ";}"], minWidth, flexStyles$1(size, alignSelf, textAlign, offset, order, props));
|
|
98
98
|
};
|
|
99
|
-
const sizeStyles$
|
|
99
|
+
const sizeStyles$5 = props => {
|
|
100
100
|
const padding = props.gutters ? polished.math(`${props.theme.space[props.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
|
-
'data-garden-id': COMPONENT_ID$
|
|
105
|
-
'data-garden-version': '9.0.0-next.
|
|
104
|
+
'data-garden-id': COMPONENT_ID$7,
|
|
105
|
+
'data-garden-version': '9.0.0-next.7'
|
|
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), props => sizeStyles$
|
|
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$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
110
|
StyledCol.defaultProps = {
|
|
111
111
|
columns: 12,
|
|
112
112
|
theme: reactTheming.DEFAULT_THEME
|
|
113
113
|
};
|
|
114
114
|
|
|
115
|
-
const COMPONENT_ID$
|
|
115
|
+
const COMPONENT_ID$6 = 'grid.grid';
|
|
116
116
|
const colorStyles$3 = props => {
|
|
117
117
|
const borderColor = reactTheming.getColorV8(props.theme.palette.crimson, 400, props.theme, 0.5);
|
|
118
118
|
const borderWidth = polished.math(`${props.theme.borderWidths.sm} * 2`);
|
|
119
119
|
return styled.css(["box-shadow:-", " 0 0 0 ", ",", " 0 0 0 ", ";"], borderWidth, borderColor, borderWidth, borderColor);
|
|
120
120
|
};
|
|
121
|
-
const sizeStyles$
|
|
121
|
+
const sizeStyles$4 = props => {
|
|
122
122
|
const padding = props.gutters ? polished.math(`${props.theme.space[props.gutters]} / 2`) : 0;
|
|
123
123
|
return styled.css(["padding-right:", ";padding-left:", ";"], padding, padding);
|
|
124
124
|
};
|
|
125
125
|
const StyledGrid = styled__default.default.div.attrs({
|
|
126
|
-
'data-garden-id': COMPONENT_ID$
|
|
127
|
-
'data-garden-version': '9.0.0-next.
|
|
126
|
+
'data-garden-id': COMPONENT_ID$6,
|
|
127
|
+
'data-garden-version': '9.0.0-next.7'
|
|
128
128
|
}).withConfig({
|
|
129
129
|
displayName: "StyledGrid",
|
|
130
130
|
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$
|
|
131
|
+
})(["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
132
|
StyledGrid.defaultProps = {
|
|
133
133
|
gutters: 'md',
|
|
134
134
|
theme: reactTheming.DEFAULT_THEME
|
|
135
135
|
};
|
|
136
136
|
|
|
137
|
-
const COMPONENT_ID$
|
|
137
|
+
const COMPONENT_ID$5 = 'grid.row';
|
|
138
138
|
const colorStyles$2 = props => {
|
|
139
139
|
const borderColor = reactTheming.getColorV8(props.theme.palette.mint, 600, props.theme, 0.5);
|
|
140
140
|
const borderWidth = props.theme.borderWidths.sm;
|
|
@@ -160,61 +160,61 @@ const flexStyles = (alignItems, justifyContent, wrap) => {
|
|
|
160
160
|
const mediaStyles = (minWidth, alignItems, justifyContent, wrap) => {
|
|
161
161
|
return styled.css(["@media (min-width:", "){", ";}"], minWidth, flexStyles(alignItems, justifyContent, wrap));
|
|
162
162
|
};
|
|
163
|
-
const sizeStyles$
|
|
163
|
+
const sizeStyles$3 = props => {
|
|
164
164
|
const margin = props.gutters ? polished.math(`${props.theme.space[props.gutters]} / 2`) : 0;
|
|
165
165
|
return styled.css(["margin-right:-", ";margin-left:-", ";"], margin, margin);
|
|
166
166
|
};
|
|
167
167
|
const StyledRow = styled__default.default.div.attrs({
|
|
168
|
-
'data-garden-id': COMPONENT_ID$
|
|
169
|
-
'data-garden-version': '9.0.0-next.
|
|
168
|
+
'data-garden-id': COMPONENT_ID$5,
|
|
169
|
+
'data-garden-version': '9.0.0-next.7'
|
|
170
170
|
}).withConfig({
|
|
171
171
|
displayName: "StyledRow",
|
|
172
172
|
componentId: "sc-xjsdg1-0"
|
|
173
|
-
})(["display:flex;box-sizing:border-box;", " ", ";", ";", ";", ";", ";", ";", ";", ";"], props => flexStyles(props.alignItems, props.justifyContent, props.wrapAll), props => sizeStyles$
|
|
173
|
+
})(["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
174
|
StyledRow.defaultProps = {
|
|
175
175
|
wrapAll: 'wrap',
|
|
176
176
|
theme: reactTheming.DEFAULT_THEME
|
|
177
177
|
};
|
|
178
178
|
|
|
179
|
-
const COMPONENT_ID$
|
|
179
|
+
const COMPONENT_ID$4 = 'pane';
|
|
180
180
|
const StyledPane = styled__default.default.div.attrs({
|
|
181
|
-
'data-garden-id': COMPONENT_ID$
|
|
182
|
-
'data-garden-version': '9.0.0-next.
|
|
181
|
+
'data-garden-id': COMPONENT_ID$4,
|
|
182
|
+
'data-garden-version': '9.0.0-next.7'
|
|
183
183
|
}).withConfig({
|
|
184
184
|
displayName: "StyledPane",
|
|
185
185
|
componentId: "sc-1ltjst7-0"
|
|
186
|
-
})(["position:relative;min-width:0;min-height:0;", ";"], props => reactTheming.retrieveComponentStyles(COMPONENT_ID$
|
|
186
|
+
})(["position:relative;min-width:0;min-height:0;", ";"], props => reactTheming.retrieveComponentStyles(COMPONENT_ID$4, props));
|
|
187
187
|
StyledPane.defaultProps = {
|
|
188
188
|
theme: reactTheming.DEFAULT_THEME
|
|
189
189
|
};
|
|
190
190
|
|
|
191
|
-
const COMPONENT_ID$
|
|
191
|
+
const COMPONENT_ID$3 = 'pane.content';
|
|
192
192
|
const StyledPaneContent = styled__default.default.div.attrs({
|
|
193
|
-
'data-garden-id': COMPONENT_ID$
|
|
194
|
-
'data-garden-version': '9.0.0-next.
|
|
193
|
+
'data-garden-id': COMPONENT_ID$3,
|
|
194
|
+
'data-garden-version': '9.0.0-next.7'
|
|
195
195
|
}).withConfig({
|
|
196
196
|
displayName: "StyledPaneContent",
|
|
197
197
|
componentId: "sc-1b38mbh-0"
|
|
198
|
-
})(["height:100%;overflow:auto;&[hidden]{display:none;}", ";"], props => reactTheming.retrieveComponentStyles(COMPONENT_ID$
|
|
198
|
+
})(["height:100%;overflow:auto;&[hidden]{display:none;}", ";"], props => reactTheming.retrieveComponentStyles(COMPONENT_ID$3, props));
|
|
199
199
|
StyledPaneContent.defaultProps = {
|
|
200
200
|
theme: reactTheming.DEFAULT_THEME
|
|
201
201
|
};
|
|
202
202
|
|
|
203
|
-
const COMPONENT_ID$
|
|
203
|
+
const COMPONENT_ID$2 = 'pane.splitter';
|
|
204
204
|
const colorStyles$1 = props => {
|
|
205
205
|
const color = reactTheming.getColorV8('neutralHue', 300, props.theme);
|
|
206
206
|
const hoverColor = reactTheming.getColorV8('primaryHue', 600, props.theme);
|
|
207
207
|
const activeColor = reactTheming.getColorV8('primaryHue', 800, props.theme);
|
|
208
|
-
return styled.css(["&::before{background-color:", ";}&:hover::before{background-color:", ";}", " &:active::before{background-color:", ";}"], color,
|
|
208
|
+
return styled.css(["&::before{background-color:", ";}&:hover::before{background-color:", ";}", " &:active::before{background-color:", ";}"], color, hoverColor, reactTheming.focusStyles({
|
|
209
209
|
theme: props.theme,
|
|
210
210
|
hue: hoverColor,
|
|
211
211
|
styles: {
|
|
212
212
|
backgroundColor: hoverColor
|
|
213
213
|
},
|
|
214
|
-
selector: '&:focus-visible::before
|
|
215
|
-
}),
|
|
214
|
+
selector: '&:focus-visible::before'
|
|
215
|
+
}), activeColor);
|
|
216
216
|
};
|
|
217
|
-
const sizeStyles$
|
|
217
|
+
const sizeStyles$2 = props => {
|
|
218
218
|
const size = polished.math(`${props.theme.shadowWidths.md} * 2`);
|
|
219
219
|
const separatorSize = polished.math(`${props.theme.borderWidths.sm} * 2`);
|
|
220
220
|
const offset = polished.math(`-${size} / 2`);
|
|
@@ -273,20 +273,28 @@ const sizeStyles$1 = props => {
|
|
|
273
273
|
break;
|
|
274
274
|
}
|
|
275
275
|
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
|
|
276
|
+
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
277
|
};
|
|
278
278
|
const StyledPaneSplitter = styled__default.default.div.attrs({
|
|
279
|
-
'data-garden-id': COMPONENT_ID$
|
|
280
|
-
'data-garden-version': '9.0.0-next.
|
|
279
|
+
'data-garden-id': COMPONENT_ID$2,
|
|
280
|
+
'data-garden-version': '9.0.0-next.7'
|
|
281
281
|
}).withConfig({
|
|
282
282
|
displayName: "StyledPaneSplitter",
|
|
283
283
|
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$
|
|
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$2, reactTheming.SELECTOR_FOCUS_VISIBLE, colorStyles$1, props => reactTheming.retrieveComponentStyles(COMPONENT_ID$2, props));
|
|
285
285
|
StyledPaneSplitter.defaultProps = {
|
|
286
286
|
theme: reactTheming.DEFAULT_THEME
|
|
287
287
|
};
|
|
288
288
|
|
|
289
|
-
const COMPONENT_ID = 'pane.splitter_button';
|
|
289
|
+
const COMPONENT_ID$1 = 'pane.splitter_button';
|
|
290
|
+
const getSize = theme => theme.space.base * 6;
|
|
291
|
+
const sizeStyles$1 = _ref => {
|
|
292
|
+
let {
|
|
293
|
+
theme
|
|
294
|
+
} = _ref;
|
|
295
|
+
const size = `${getSize(theme)}px`;
|
|
296
|
+
return styled.css(["width:", ";min-width:", ";height:", ";"], size, size, size);
|
|
297
|
+
};
|
|
290
298
|
const transformStyles = props => {
|
|
291
299
|
let degrees = 0;
|
|
292
300
|
if (props.isRotated) {
|
|
@@ -301,56 +309,120 @@ const transformStyles = props => {
|
|
|
301
309
|
}
|
|
302
310
|
return styled.css(["& > svg{transform:rotate(", "deg);}"], degrees);
|
|
303
311
|
};
|
|
312
|
+
const StyledPaneSplitterButton = styled__default.default(reactButtons.ChevronButton).attrs({
|
|
313
|
+
'data-garden-id': COMPONENT_ID$1,
|
|
314
|
+
'data-garden-version': '9.0.0-next.7',
|
|
315
|
+
isBasic: true,
|
|
316
|
+
isPill: true,
|
|
317
|
+
size: 'small'
|
|
318
|
+
}).withConfig({
|
|
319
|
+
displayName: "StyledPaneSplitterButton",
|
|
320
|
+
componentId: "sc-zh032e-0"
|
|
321
|
+
})(["", ";", ";", ";"], sizeStyles$1, transformStyles, props => reactTheming.retrieveComponentStyles(COMPONENT_ID$1, props));
|
|
322
|
+
StyledPaneSplitterButton.defaultProps = {
|
|
323
|
+
theme: reactTheming.DEFAULT_THEME
|
|
324
|
+
};
|
|
325
|
+
|
|
326
|
+
const COMPONENT_ID = 'pane.splitter_button_container';
|
|
304
327
|
const colorStyles = _ref => {
|
|
305
328
|
let {
|
|
306
329
|
theme
|
|
307
330
|
} = _ref;
|
|
331
|
+
const backgroundColor = reactTheming.getColorV8('background', 600 , theme);
|
|
308
332
|
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
|
-
}));
|
|
333
|
+
return styled.css(["box-shadow:", ";background-color:", ";"], boxShadow, backgroundColor);
|
|
313
334
|
};
|
|
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';
|
|
335
|
+
const positionStyles = props => {
|
|
318
336
|
let top;
|
|
319
337
|
let left;
|
|
320
338
|
let right;
|
|
321
339
|
let bottom;
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
left =
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
340
|
+
const size = getSize(props.theme);
|
|
341
|
+
const inset = `-${size / 2}px`;
|
|
342
|
+
if (props.placement === 'center' || props.splitterSize < size * 3) {
|
|
343
|
+
const center = `${props.splitterSize / 2 - size / 2}px`;
|
|
344
|
+
switch (`${props.orientation}-${props.theme.rtl ? 'rtl' : 'ltr'}`) {
|
|
345
|
+
case 'top-ltr':
|
|
346
|
+
case 'top-rtl':
|
|
347
|
+
top = inset;
|
|
348
|
+
left = center;
|
|
349
|
+
break;
|
|
350
|
+
case 'start-ltr':
|
|
351
|
+
case 'end-rtl':
|
|
352
|
+
top = center;
|
|
353
|
+
left = inset;
|
|
354
|
+
break;
|
|
355
|
+
case 'end-ltr':
|
|
356
|
+
case 'start-rtl':
|
|
357
|
+
top = center;
|
|
358
|
+
right = inset;
|
|
359
|
+
break;
|
|
360
|
+
case 'bottom-ltr':
|
|
361
|
+
case 'bottom-rtl':
|
|
362
|
+
bottom = inset;
|
|
363
|
+
right = center;
|
|
364
|
+
break;
|
|
365
|
+
}
|
|
366
|
+
} else {
|
|
367
|
+
const offset = `${size}px`;
|
|
368
|
+
switch (`${props.orientation}-${props.placement}-${props.theme.rtl ? 'rtl' : 'ltr'}`) {
|
|
369
|
+
case 'top-end-ltr':
|
|
370
|
+
case 'top-end-rtl':
|
|
371
|
+
case 'top-start-rtl':
|
|
372
|
+
top = inset;
|
|
373
|
+
right = offset;
|
|
374
|
+
break;
|
|
375
|
+
case 'bottom-end-ltr':
|
|
376
|
+
case 'bottom-end-rtl':
|
|
377
|
+
case 'bottom-start-rtl':
|
|
378
|
+
bottom = inset;
|
|
379
|
+
right = offset;
|
|
380
|
+
break;
|
|
381
|
+
case 'start-start-ltr':
|
|
382
|
+
case 'end-start-rtl':
|
|
383
|
+
top = offset;
|
|
384
|
+
left = inset;
|
|
385
|
+
break;
|
|
386
|
+
case 'start-end-ltr':
|
|
387
|
+
case 'end-end-rtl':
|
|
388
|
+
bottom = offset;
|
|
389
|
+
left = inset;
|
|
390
|
+
break;
|
|
391
|
+
case 'end-start-ltr':
|
|
392
|
+
case 'start-start-rtl':
|
|
393
|
+
top = offset;
|
|
394
|
+
right = inset;
|
|
395
|
+
break;
|
|
396
|
+
case 'end-end-ltr':
|
|
397
|
+
case 'start-end-rtl':
|
|
398
|
+
bottom = offset;
|
|
399
|
+
right = inset;
|
|
400
|
+
break;
|
|
401
|
+
case 'top-start-ltr':
|
|
402
|
+
top = inset;
|
|
403
|
+
left = offset;
|
|
404
|
+
break;
|
|
405
|
+
case 'bottom-start-ltr':
|
|
406
|
+
bottom = inset;
|
|
407
|
+
left = offset;
|
|
408
|
+
break;
|
|
339
409
|
}
|
|
340
410
|
}
|
|
341
|
-
return styled.css(["
|
|
411
|
+
return styled.css(["top:", ";right:", ";bottom:", ";left:", ";"], top, right, bottom, left);
|
|
342
412
|
};
|
|
343
|
-
const
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
413
|
+
const sizeStyles = _ref2 => {
|
|
414
|
+
let {
|
|
415
|
+
theme
|
|
416
|
+
} = _ref2;
|
|
417
|
+
const size = getSize(theme);
|
|
418
|
+
return styled.css(["border-radius:", "px;width:", "px;height:", "px;"], size, size, size);
|
|
419
|
+
};
|
|
420
|
+
const minimumSplitterSize = theme => polished.stripUnit(polished.math(`${theme.shadowWidths.md} * 2 + ${getSize(theme)}`));
|
|
421
|
+
const StyledPaneSplitterButtonContainer = styled__default.default.div.withConfig({
|
|
422
|
+
displayName: "StyledPaneSplitterButtonContainer",
|
|
423
|
+
componentId: "sc-1w84y62-0"
|
|
424
|
+
})(["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));
|
|
425
|
+
StyledPaneSplitterButtonContainer.defaultProps = {
|
|
354
426
|
theme: reactTheming.DEFAULT_THEME
|
|
355
427
|
};
|
|
356
428
|
|
|
@@ -710,6 +782,7 @@ const orientationToDimension = {
|
|
|
710
782
|
};
|
|
711
783
|
const SplitterComponent = React.forwardRef((_ref, ref) => {
|
|
712
784
|
let {
|
|
785
|
+
children,
|
|
713
786
|
providerId,
|
|
714
787
|
layoutKey,
|
|
715
788
|
min,
|
|
@@ -726,7 +799,6 @@ const SplitterComponent = React.forwardRef((_ref, ref) => {
|
|
|
726
799
|
const paneContext = usePaneContext();
|
|
727
800
|
const themeContext = React.useContext(styled.ThemeContext);
|
|
728
801
|
const environment = reactTheming.useDocument(themeContext);
|
|
729
|
-
const [isHovered, setIsHovered] = React.useState(false);
|
|
730
802
|
const isRow = orientationToDimension[orientation] === 'rows';
|
|
731
803
|
const separatorRef = React.useRef(null);
|
|
732
804
|
const splitterOrientation = paneToSplitterOrientation[orientation || 'end'];
|
|
@@ -768,7 +840,6 @@ const SplitterComponent = React.forwardRef((_ref, ref) => {
|
|
|
768
840
|
onClick
|
|
769
841
|
});
|
|
770
842
|
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
843
|
return React__default.default.createElement(PaneSplitterContext.Provider, {
|
|
773
844
|
value: React.useMemo(() => ({
|
|
774
845
|
orientation,
|
|
@@ -780,13 +851,11 @@ const SplitterComponent = React.forwardRef((_ref, ref) => {
|
|
|
780
851
|
isRow
|
|
781
852
|
}), [orientation, layoutKey, min, max, valueInFr, size, isRow])
|
|
782
853
|
}, React__default.default.createElement(StyledPaneSplitter, _extends({
|
|
783
|
-
isHovered: isHovered,
|
|
784
854
|
isFixed: isFixed,
|
|
785
855
|
orientation: orientation
|
|
786
856
|
}, separatorProps, props, {
|
|
787
|
-
onMouseOver: onMouseOver,
|
|
788
857
|
ref: reactMergeRefs.mergeRefs([separatorRef, ref])
|
|
789
|
-
})));
|
|
858
|
+
})), children );
|
|
790
859
|
});
|
|
791
860
|
SplitterComponent.displayName = 'Pane.Splitter';
|
|
792
861
|
SplitterComponent.propTypes = {
|
|
@@ -858,8 +927,13 @@ const SplitterButtonComponent = React.forwardRef((props, ref) => {
|
|
|
858
927
|
);
|
|
859
928
|
const onMouseDown = containerUtilities.composeEventHandlers(props.onMouseDown, event => event.stopPropagation()
|
|
860
929
|
);
|
|
861
|
-
return React__default.default.createElement(
|
|
930
|
+
return React__default.default.createElement(StyledPaneSplitterButtonContainer, {
|
|
931
|
+
orientation: orientation,
|
|
932
|
+
placement: placement,
|
|
933
|
+
splitterSize: size || 0
|
|
934
|
+
}, React__default.default.createElement(reactTooltips.Tooltip, {
|
|
862
935
|
content: label,
|
|
936
|
+
zIndex: 2,
|
|
863
937
|
style: {
|
|
864
938
|
cursor: 'default'
|
|
865
939
|
},
|
|
@@ -867,15 +941,13 @@ const SplitterButtonComponent = React.forwardRef((props, ref) => {
|
|
|
867
941
|
}, React__default.default.createElement(StyledPaneSplitterButton, _extends({
|
|
868
942
|
"aria-label": label
|
|
869
943
|
}, props, {
|
|
870
|
-
placement: placement,
|
|
871
944
|
orientation: orientation,
|
|
872
945
|
isRotated: isMin,
|
|
873
|
-
splitterSize: size || 0,
|
|
874
946
|
ref: ref,
|
|
875
947
|
onClick: onClick,
|
|
876
948
|
onKeyDown: onKeyDown,
|
|
877
949
|
onMouseDown: onMouseDown
|
|
878
|
-
})));
|
|
950
|
+
}))));
|
|
879
951
|
});
|
|
880
952
|
SplitterButtonComponent.displayName = 'Pane.SplitterButton';
|
|
881
953
|
const SplitterButton = SplitterButtonComponent;
|
package/dist/index.esm.js
CHANGED
|
@@ -41,7 +41,7 @@ const SPACE = [false, 'xxs', 'xs', 'sm', 'md', 'lg', 'xl', 'xxl'];
|
|
|
41
41
|
const WRAP = ['nowrap', 'wrap', 'wrap-reverse'];
|
|
42
42
|
const ORIENTATION = ['top', 'bottom', 'start', 'end'];
|
|
43
43
|
|
|
44
|
-
const COMPONENT_ID$
|
|
44
|
+
const COMPONENT_ID$7 = 'grid.col';
|
|
45
45
|
const colorStyles$4 = props => {
|
|
46
46
|
const backgroundColor = getColorV8('primaryHue', 600, props.theme, 0.1);
|
|
47
47
|
return css(["background-clip:content-box;background-color:", ";"], backgroundColor);
|
|
@@ -87,45 +87,45 @@ const flexStyles$1 = (size, alignSelf, textAlign, offset, order, props) => {
|
|
|
87
87
|
const mediaStyles$1 = (minWidth, size, alignSelf, textAlign, offset, order, props) => {
|
|
88
88
|
return css(["@media (min-width:", "){", ";}"], minWidth, flexStyles$1(size, alignSelf, textAlign, offset, order, props));
|
|
89
89
|
};
|
|
90
|
-
const sizeStyles$
|
|
90
|
+
const sizeStyles$5 = props => {
|
|
91
91
|
const padding = props.gutters ? math(`${props.theme.space[props.gutters]} / 2`) : 0;
|
|
92
92
|
return css(["padding-right:", ";padding-left:", ";"], padding, padding);
|
|
93
93
|
};
|
|
94
94
|
const StyledCol = styled.div.attrs({
|
|
95
|
-
'data-garden-id': COMPONENT_ID$
|
|
96
|
-
'data-garden-version': '9.0.0-next.
|
|
95
|
+
'data-garden-id': COMPONENT_ID$7,
|
|
96
|
+
'data-garden-version': '9.0.0-next.7'
|
|
97
97
|
}).withConfig({
|
|
98
98
|
displayName: "StyledCol",
|
|
99
99
|
componentId: "sc-inuw62-0"
|
|
100
|
-
})(["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$
|
|
100
|
+
})(["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 => retrieveComponentStyles(COMPONENT_ID$7, props));
|
|
101
101
|
StyledCol.defaultProps = {
|
|
102
102
|
columns: 12,
|
|
103
103
|
theme: DEFAULT_THEME
|
|
104
104
|
};
|
|
105
105
|
|
|
106
|
-
const COMPONENT_ID$
|
|
106
|
+
const COMPONENT_ID$6 = 'grid.grid';
|
|
107
107
|
const colorStyles$3 = props => {
|
|
108
108
|
const borderColor = getColorV8(props.theme.palette.crimson, 400, props.theme, 0.5);
|
|
109
109
|
const borderWidth = math(`${props.theme.borderWidths.sm} * 2`);
|
|
110
110
|
return css(["box-shadow:-", " 0 0 0 ", ",", " 0 0 0 ", ";"], borderWidth, borderColor, borderWidth, borderColor);
|
|
111
111
|
};
|
|
112
|
-
const sizeStyles$
|
|
112
|
+
const sizeStyles$4 = props => {
|
|
113
113
|
const padding = props.gutters ? math(`${props.theme.space[props.gutters]} / 2`) : 0;
|
|
114
114
|
return css(["padding-right:", ";padding-left:", ";"], padding, padding);
|
|
115
115
|
};
|
|
116
116
|
const StyledGrid = styled.div.attrs({
|
|
117
|
-
'data-garden-id': COMPONENT_ID$
|
|
118
|
-
'data-garden-version': '9.0.0-next.
|
|
117
|
+
'data-garden-id': COMPONENT_ID$6,
|
|
118
|
+
'data-garden-version': '9.0.0-next.7'
|
|
119
119
|
}).withConfig({
|
|
120
120
|
displayName: "StyledGrid",
|
|
121
121
|
componentId: "sc-oxgg5i-0"
|
|
122
|
-
})(["direction:", ";margin-right:auto;margin-left:auto;width:100%;box-sizing:border-box;", ";", ";", ";"], props => props.theme.rtl && 'rtl', props => sizeStyles$
|
|
122
|
+
})(["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 => retrieveComponentStyles(COMPONENT_ID$6, props));
|
|
123
123
|
StyledGrid.defaultProps = {
|
|
124
124
|
gutters: 'md',
|
|
125
125
|
theme: DEFAULT_THEME
|
|
126
126
|
};
|
|
127
127
|
|
|
128
|
-
const COMPONENT_ID$
|
|
128
|
+
const COMPONENT_ID$5 = 'grid.row';
|
|
129
129
|
const colorStyles$2 = props => {
|
|
130
130
|
const borderColor = getColorV8(props.theme.palette.mint, 600, props.theme, 0.5);
|
|
131
131
|
const borderWidth = props.theme.borderWidths.sm;
|
|
@@ -151,61 +151,61 @@ const flexStyles = (alignItems, justifyContent, wrap) => {
|
|
|
151
151
|
const mediaStyles = (minWidth, alignItems, justifyContent, wrap) => {
|
|
152
152
|
return css(["@media (min-width:", "){", ";}"], minWidth, flexStyles(alignItems, justifyContent, wrap));
|
|
153
153
|
};
|
|
154
|
-
const sizeStyles$
|
|
154
|
+
const sizeStyles$3 = props => {
|
|
155
155
|
const margin = props.gutters ? math(`${props.theme.space[props.gutters]} / 2`) : 0;
|
|
156
156
|
return css(["margin-right:-", ";margin-left:-", ";"], margin, margin);
|
|
157
157
|
};
|
|
158
158
|
const StyledRow = styled.div.attrs({
|
|
159
|
-
'data-garden-id': COMPONENT_ID$
|
|
160
|
-
'data-garden-version': '9.0.0-next.
|
|
159
|
+
'data-garden-id': COMPONENT_ID$5,
|
|
160
|
+
'data-garden-version': '9.0.0-next.7'
|
|
161
161
|
}).withConfig({
|
|
162
162
|
displayName: "StyledRow",
|
|
163
163
|
componentId: "sc-xjsdg1-0"
|
|
164
|
-
})(["display:flex;box-sizing:border-box;", " ", ";", ";", ";", ";", ";", ";", ";", ";"], props => flexStyles(props.alignItems, props.justifyContent, props.wrapAll), props => sizeStyles$
|
|
164
|
+
})(["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 => retrieveComponentStyles(COMPONENT_ID$5, props));
|
|
165
165
|
StyledRow.defaultProps = {
|
|
166
166
|
wrapAll: 'wrap',
|
|
167
167
|
theme: DEFAULT_THEME
|
|
168
168
|
};
|
|
169
169
|
|
|
170
|
-
const COMPONENT_ID$
|
|
170
|
+
const COMPONENT_ID$4 = 'pane';
|
|
171
171
|
const StyledPane = styled.div.attrs({
|
|
172
|
-
'data-garden-id': COMPONENT_ID$
|
|
173
|
-
'data-garden-version': '9.0.0-next.
|
|
172
|
+
'data-garden-id': COMPONENT_ID$4,
|
|
173
|
+
'data-garden-version': '9.0.0-next.7'
|
|
174
174
|
}).withConfig({
|
|
175
175
|
displayName: "StyledPane",
|
|
176
176
|
componentId: "sc-1ltjst7-0"
|
|
177
|
-
})(["position:relative;min-width:0;min-height:0;", ";"], props => retrieveComponentStyles(COMPONENT_ID$
|
|
177
|
+
})(["position:relative;min-width:0;min-height:0;", ";"], props => retrieveComponentStyles(COMPONENT_ID$4, props));
|
|
178
178
|
StyledPane.defaultProps = {
|
|
179
179
|
theme: DEFAULT_THEME
|
|
180
180
|
};
|
|
181
181
|
|
|
182
|
-
const COMPONENT_ID$
|
|
182
|
+
const COMPONENT_ID$3 = 'pane.content';
|
|
183
183
|
const StyledPaneContent = styled.div.attrs({
|
|
184
|
-
'data-garden-id': COMPONENT_ID$
|
|
185
|
-
'data-garden-version': '9.0.0-next.
|
|
184
|
+
'data-garden-id': COMPONENT_ID$3,
|
|
185
|
+
'data-garden-version': '9.0.0-next.7'
|
|
186
186
|
}).withConfig({
|
|
187
187
|
displayName: "StyledPaneContent",
|
|
188
188
|
componentId: "sc-1b38mbh-0"
|
|
189
|
-
})(["height:100%;overflow:auto;&[hidden]{display:none;}", ";"], props => retrieveComponentStyles(COMPONENT_ID$
|
|
189
|
+
})(["height:100%;overflow:auto;&[hidden]{display:none;}", ";"], props => retrieveComponentStyles(COMPONENT_ID$3, props));
|
|
190
190
|
StyledPaneContent.defaultProps = {
|
|
191
191
|
theme: DEFAULT_THEME
|
|
192
192
|
};
|
|
193
193
|
|
|
194
|
-
const COMPONENT_ID$
|
|
194
|
+
const COMPONENT_ID$2 = 'pane.splitter';
|
|
195
195
|
const colorStyles$1 = props => {
|
|
196
196
|
const color = getColorV8('neutralHue', 300, props.theme);
|
|
197
197
|
const hoverColor = getColorV8('primaryHue', 600, props.theme);
|
|
198
198
|
const activeColor = getColorV8('primaryHue', 800, props.theme);
|
|
199
|
-
return css(["&::before{background-color:", ";}&:hover::before{background-color:", ";}", " &:active::before{background-color:", ";}"], color,
|
|
199
|
+
return css(["&::before{background-color:", ";}&:hover::before{background-color:", ";}", " &:active::before{background-color:", ";}"], color, hoverColor, focusStyles({
|
|
200
200
|
theme: props.theme,
|
|
201
201
|
hue: hoverColor,
|
|
202
202
|
styles: {
|
|
203
203
|
backgroundColor: hoverColor
|
|
204
204
|
},
|
|
205
|
-
selector: '&:focus-visible::before
|
|
206
|
-
}),
|
|
205
|
+
selector: '&:focus-visible::before'
|
|
206
|
+
}), activeColor);
|
|
207
207
|
};
|
|
208
|
-
const sizeStyles$
|
|
208
|
+
const sizeStyles$2 = props => {
|
|
209
209
|
const size = math(`${props.theme.shadowWidths.md} * 2`);
|
|
210
210
|
const separatorSize = math(`${props.theme.borderWidths.sm} * 2`);
|
|
211
211
|
const offset = math(`-${size} / 2`);
|
|
@@ -264,20 +264,28 @@ const sizeStyles$1 = props => {
|
|
|
264
264
|
break;
|
|
265
265
|
}
|
|
266
266
|
const dimensionProperty = width === '100%' ? 'height' : 'width';
|
|
267
|
-
return css(["top:", ";right:", ";bottom:", ";left:", ";cursor:", ";width:", ";height:", ";&::before{width:", ";height:", ";}&:hover::before{", ":", ";}&:focus::before,&:focus-visible::before
|
|
267
|
+
return 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);
|
|
268
268
|
};
|
|
269
269
|
const StyledPaneSplitter = styled.div.attrs({
|
|
270
|
-
'data-garden-id': COMPONENT_ID$
|
|
271
|
-
'data-garden-version': '9.0.0-next.
|
|
270
|
+
'data-garden-id': COMPONENT_ID$2,
|
|
271
|
+
'data-garden-version': '9.0.0-next.7'
|
|
272
272
|
}).withConfig({
|
|
273
273
|
displayName: "StyledPaneSplitter",
|
|
274
274
|
componentId: "sc-jylemn-0"
|
|
275
|
-
})(["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$
|
|
275
|
+
})(["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, SELECTOR_FOCUS_VISIBLE, colorStyles$1, props => retrieveComponentStyles(COMPONENT_ID$2, props));
|
|
276
276
|
StyledPaneSplitter.defaultProps = {
|
|
277
277
|
theme: DEFAULT_THEME
|
|
278
278
|
};
|
|
279
279
|
|
|
280
|
-
const COMPONENT_ID = 'pane.splitter_button';
|
|
280
|
+
const COMPONENT_ID$1 = 'pane.splitter_button';
|
|
281
|
+
const getSize = theme => theme.space.base * 6;
|
|
282
|
+
const sizeStyles$1 = _ref => {
|
|
283
|
+
let {
|
|
284
|
+
theme
|
|
285
|
+
} = _ref;
|
|
286
|
+
const size = `${getSize(theme)}px`;
|
|
287
|
+
return css(["width:", ";min-width:", ";height:", ";"], size, size, size);
|
|
288
|
+
};
|
|
281
289
|
const transformStyles = props => {
|
|
282
290
|
let degrees = 0;
|
|
283
291
|
if (props.isRotated) {
|
|
@@ -292,56 +300,120 @@ const transformStyles = props => {
|
|
|
292
300
|
}
|
|
293
301
|
return css(["& > svg{transform:rotate(", "deg);}"], degrees);
|
|
294
302
|
};
|
|
303
|
+
const StyledPaneSplitterButton = styled(ChevronButton).attrs({
|
|
304
|
+
'data-garden-id': COMPONENT_ID$1,
|
|
305
|
+
'data-garden-version': '9.0.0-next.7',
|
|
306
|
+
isBasic: true,
|
|
307
|
+
isPill: true,
|
|
308
|
+
size: 'small'
|
|
309
|
+
}).withConfig({
|
|
310
|
+
displayName: "StyledPaneSplitterButton",
|
|
311
|
+
componentId: "sc-zh032e-0"
|
|
312
|
+
})(["", ";", ";", ";"], sizeStyles$1, transformStyles, props => retrieveComponentStyles(COMPONENT_ID$1, props));
|
|
313
|
+
StyledPaneSplitterButton.defaultProps = {
|
|
314
|
+
theme: DEFAULT_THEME
|
|
315
|
+
};
|
|
316
|
+
|
|
317
|
+
const COMPONENT_ID = 'pane.splitter_button_container';
|
|
295
318
|
const colorStyles = _ref => {
|
|
296
319
|
let {
|
|
297
320
|
theme
|
|
298
321
|
} = _ref;
|
|
322
|
+
const backgroundColor = getColorV8('background', 600 , theme);
|
|
299
323
|
const boxShadow = theme.shadows.lg(`${theme.space.base}px`, `${theme.space.base * 2}px`, getColorV8('chromeHue', 600, theme, 0.15));
|
|
300
|
-
return css(["box-shadow:", ";", ""], boxShadow,
|
|
301
|
-
theme,
|
|
302
|
-
boxShadow
|
|
303
|
-
}));
|
|
324
|
+
return css(["box-shadow:", ";background-color:", ";"], boxShadow, backgroundColor);
|
|
304
325
|
};
|
|
305
|
-
const
|
|
306
|
-
const size = `${props.theme.space.base * 6}px`;
|
|
307
|
-
const display = props.splitterSize <= stripUnit(math(`${props.theme.shadowWidths.md} * 2 + ${size}`)) && 'none';
|
|
308
|
-
const isVertical = props.orientation === 'start' || props.orientation === 'end';
|
|
326
|
+
const positionStyles = props => {
|
|
309
327
|
let top;
|
|
310
328
|
let left;
|
|
311
329
|
let right;
|
|
312
330
|
let bottom;
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
left =
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
331
|
+
const size = getSize(props.theme);
|
|
332
|
+
const inset = `-${size / 2}px`;
|
|
333
|
+
if (props.placement === 'center' || props.splitterSize < size * 3) {
|
|
334
|
+
const center = `${props.splitterSize / 2 - size / 2}px`;
|
|
335
|
+
switch (`${props.orientation}-${props.theme.rtl ? 'rtl' : 'ltr'}`) {
|
|
336
|
+
case 'top-ltr':
|
|
337
|
+
case 'top-rtl':
|
|
338
|
+
top = inset;
|
|
339
|
+
left = center;
|
|
340
|
+
break;
|
|
341
|
+
case 'start-ltr':
|
|
342
|
+
case 'end-rtl':
|
|
343
|
+
top = center;
|
|
344
|
+
left = inset;
|
|
345
|
+
break;
|
|
346
|
+
case 'end-ltr':
|
|
347
|
+
case 'start-rtl':
|
|
348
|
+
top = center;
|
|
349
|
+
right = inset;
|
|
350
|
+
break;
|
|
351
|
+
case 'bottom-ltr':
|
|
352
|
+
case 'bottom-rtl':
|
|
353
|
+
bottom = inset;
|
|
354
|
+
right = center;
|
|
355
|
+
break;
|
|
356
|
+
}
|
|
357
|
+
} else {
|
|
358
|
+
const offset = `${size}px`;
|
|
359
|
+
switch (`${props.orientation}-${props.placement}-${props.theme.rtl ? 'rtl' : 'ltr'}`) {
|
|
360
|
+
case 'top-end-ltr':
|
|
361
|
+
case 'top-end-rtl':
|
|
362
|
+
case 'top-start-rtl':
|
|
363
|
+
top = inset;
|
|
364
|
+
right = offset;
|
|
365
|
+
break;
|
|
366
|
+
case 'bottom-end-ltr':
|
|
367
|
+
case 'bottom-end-rtl':
|
|
368
|
+
case 'bottom-start-rtl':
|
|
369
|
+
bottom = inset;
|
|
370
|
+
right = offset;
|
|
371
|
+
break;
|
|
372
|
+
case 'start-start-ltr':
|
|
373
|
+
case 'end-start-rtl':
|
|
374
|
+
top = offset;
|
|
375
|
+
left = inset;
|
|
376
|
+
break;
|
|
377
|
+
case 'start-end-ltr':
|
|
378
|
+
case 'end-end-rtl':
|
|
379
|
+
bottom = offset;
|
|
380
|
+
left = inset;
|
|
381
|
+
break;
|
|
382
|
+
case 'end-start-ltr':
|
|
383
|
+
case 'start-start-rtl':
|
|
384
|
+
top = offset;
|
|
385
|
+
right = inset;
|
|
386
|
+
break;
|
|
387
|
+
case 'end-end-ltr':
|
|
388
|
+
case 'start-end-rtl':
|
|
389
|
+
bottom = offset;
|
|
390
|
+
right = inset;
|
|
391
|
+
break;
|
|
392
|
+
case 'top-start-ltr':
|
|
393
|
+
top = inset;
|
|
394
|
+
left = offset;
|
|
395
|
+
break;
|
|
396
|
+
case 'bottom-start-ltr':
|
|
397
|
+
bottom = inset;
|
|
398
|
+
left = offset;
|
|
399
|
+
break;
|
|
330
400
|
}
|
|
331
401
|
}
|
|
332
|
-
return css(["
|
|
402
|
+
return css(["top:", ";right:", ";bottom:", ";left:", ";"], top, right, bottom, left);
|
|
333
403
|
};
|
|
334
|
-
const
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
404
|
+
const sizeStyles = _ref2 => {
|
|
405
|
+
let {
|
|
406
|
+
theme
|
|
407
|
+
} = _ref2;
|
|
408
|
+
const size = getSize(theme);
|
|
409
|
+
return css(["border-radius:", "px;width:", "px;height:", "px;"], size, size, size);
|
|
410
|
+
};
|
|
411
|
+
const minimumSplitterSize = theme => stripUnit(math(`${theme.shadowWidths.md} * 2 + ${getSize(theme)}`));
|
|
412
|
+
const StyledPaneSplitterButtonContainer = styled.div.withConfig({
|
|
413
|
+
displayName: "StyledPaneSplitterButtonContainer",
|
|
414
|
+
componentId: "sc-1w84y62-0"
|
|
415
|
+
})(["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 => retrieveComponentStyles(COMPONENT_ID, props));
|
|
416
|
+
StyledPaneSplitterButtonContainer.defaultProps = {
|
|
345
417
|
theme: DEFAULT_THEME
|
|
346
418
|
};
|
|
347
419
|
|
|
@@ -701,6 +773,7 @@ const orientationToDimension = {
|
|
|
701
773
|
};
|
|
702
774
|
const SplitterComponent = forwardRef((_ref, ref) => {
|
|
703
775
|
let {
|
|
776
|
+
children,
|
|
704
777
|
providerId,
|
|
705
778
|
layoutKey,
|
|
706
779
|
min,
|
|
@@ -717,7 +790,6 @@ const SplitterComponent = forwardRef((_ref, ref) => {
|
|
|
717
790
|
const paneContext = usePaneContext();
|
|
718
791
|
const themeContext = useContext(ThemeContext);
|
|
719
792
|
const environment = useDocument(themeContext);
|
|
720
|
-
const [isHovered, setIsHovered] = useState(false);
|
|
721
793
|
const isRow = orientationToDimension[orientation] === 'rows';
|
|
722
794
|
const separatorRef = useRef(null);
|
|
723
795
|
const splitterOrientation = paneToSplitterOrientation[orientation || 'end'];
|
|
@@ -759,7 +831,6 @@ const SplitterComponent = forwardRef((_ref, ref) => {
|
|
|
759
831
|
onClick
|
|
760
832
|
});
|
|
761
833
|
const size = isRow ? separatorRef.current?.clientWidth : separatorRef.current?.clientHeight;
|
|
762
|
-
const onMouseOver = useMemo(() => composeEventHandlers(props.onMouseOver, event => setIsHovered(event.target === separatorRef.current)), [props.onMouseOver, separatorRef]);
|
|
763
834
|
return React.createElement(PaneSplitterContext.Provider, {
|
|
764
835
|
value: useMemo(() => ({
|
|
765
836
|
orientation,
|
|
@@ -771,13 +842,11 @@ const SplitterComponent = forwardRef((_ref, ref) => {
|
|
|
771
842
|
isRow
|
|
772
843
|
}), [orientation, layoutKey, min, max, valueInFr, size, isRow])
|
|
773
844
|
}, React.createElement(StyledPaneSplitter, _extends({
|
|
774
|
-
isHovered: isHovered,
|
|
775
845
|
isFixed: isFixed,
|
|
776
846
|
orientation: orientation
|
|
777
847
|
}, separatorProps, props, {
|
|
778
|
-
onMouseOver: onMouseOver,
|
|
779
848
|
ref: mergeRefs([separatorRef, ref])
|
|
780
|
-
})));
|
|
849
|
+
})), children );
|
|
781
850
|
});
|
|
782
851
|
SplitterComponent.displayName = 'Pane.Splitter';
|
|
783
852
|
SplitterComponent.propTypes = {
|
|
@@ -849,8 +918,13 @@ const SplitterButtonComponent = forwardRef((props, ref) => {
|
|
|
849
918
|
);
|
|
850
919
|
const onMouseDown = composeEventHandlers(props.onMouseDown, event => event.stopPropagation()
|
|
851
920
|
);
|
|
852
|
-
return React.createElement(
|
|
921
|
+
return React.createElement(StyledPaneSplitterButtonContainer, {
|
|
922
|
+
orientation: orientation,
|
|
923
|
+
placement: placement,
|
|
924
|
+
splitterSize: size || 0
|
|
925
|
+
}, React.createElement(Tooltip, {
|
|
853
926
|
content: label,
|
|
927
|
+
zIndex: 2,
|
|
854
928
|
style: {
|
|
855
929
|
cursor: 'default'
|
|
856
930
|
},
|
|
@@ -858,15 +932,13 @@ const SplitterButtonComponent = forwardRef((props, ref) => {
|
|
|
858
932
|
}, React.createElement(StyledPaneSplitterButton, _extends({
|
|
859
933
|
"aria-label": label
|
|
860
934
|
}, props, {
|
|
861
|
-
placement: placement,
|
|
862
935
|
orientation: orientation,
|
|
863
936
|
isRotated: isMin,
|
|
864
|
-
splitterSize: size || 0,
|
|
865
937
|
ref: ref,
|
|
866
938
|
onClick: onClick,
|
|
867
939
|
onKeyDown: onKeyDown,
|
|
868
940
|
onMouseDown: onMouseDown
|
|
869
|
-
})));
|
|
941
|
+
}))));
|
|
870
942
|
});
|
|
871
943
|
SplitterButtonComponent.displayName = 'Pane.SplitterButton';
|
|
872
944
|
const SplitterButton = SplitterButtonComponent;
|
|
@@ -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.7",
|
|
4
4
|
"description": "Components relating to layout grids in the Garden Design System",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Zendesk Garden <garden@zendesk.com>",
|
|
@@ -23,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.7",
|
|
27
|
+
"@zendeskgarden/react-tooltips": "^9.0.0-next.7",
|
|
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",
|
|
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.7"
|
|
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": "50a2b45b2e237a490a6d460818d33498b92479ec"
|
|
53
53
|
}
|