@zendeskgarden/react-grid 8.75.0 → 8.75.1
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 +150 -78
- package/dist/index.esm.js +150 -78
- 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 +5 -5
package/dist/index.cjs.js
CHANGED
|
@@ -51,7 +51,7 @@ const SPACE = [false, 'xxs', 'xs', 'sm', 'md', 'lg', 'xl', 'xxl'];
|
|
|
51
51
|
const WRAP = ['nowrap', 'wrap', 'wrap-reverse'];
|
|
52
52
|
const ORIENTATION = ['top', 'bottom', 'start', 'end'];
|
|
53
53
|
|
|
54
|
-
const COMPONENT_ID$
|
|
54
|
+
const COMPONENT_ID$7 = 'grid.col';
|
|
55
55
|
const colorStyles$4 = props => {
|
|
56
56
|
const backgroundColor = reactTheming.getColorV8('primaryHue', 600, props.theme, 0.1);
|
|
57
57
|
return styled.css(["background-clip:content-box;background-color:", ";"], backgroundColor);
|
|
@@ -97,45 +97,45 @@ const flexStyles$1 = (size, alignSelf, textAlign, offset, order, props) => {
|
|
|
97
97
|
const mediaStyles$1 = (minWidth, size, alignSelf, textAlign, offset, order, props) => {
|
|
98
98
|
return styled.css(["@media (min-width:", "){", ";}"], minWidth, flexStyles$1(size, alignSelf, textAlign, offset, order, props));
|
|
99
99
|
};
|
|
100
|
-
const sizeStyles$
|
|
100
|
+
const sizeStyles$5 = props => {
|
|
101
101
|
const padding = props.gutters ? polished.math(`${props.theme.space[props.gutters]} / 2`) : 0;
|
|
102
102
|
return styled.css(["padding-right:", ";padding-left:", ";"], padding, padding);
|
|
103
103
|
};
|
|
104
104
|
const StyledCol = styled__default.default.div.attrs({
|
|
105
|
-
'data-garden-id': COMPONENT_ID$
|
|
106
|
-
'data-garden-version': '8.75.
|
|
105
|
+
'data-garden-id': COMPONENT_ID$7,
|
|
106
|
+
'data-garden-version': '8.75.1'
|
|
107
107
|
}).withConfig({
|
|
108
108
|
displayName: "StyledCol",
|
|
109
109
|
componentId: "sc-inuw62-0"
|
|
110
|
-
})(["box-sizing:border-box;width:100%;", ";", ";", ";", ";", ";", ";", ";", ";", ";"], props => flexStyles$1(!props.sizeAll && (props.xs || props.sm || props.md || props.lg || props.xl) ? undefined : props.sizeAll || false, props.alignSelf, props.textAlign, props.offset, props.order, props), props => sizeStyles$
|
|
110
|
+
})(["box-sizing:border-box;width:100%;", ";", ";", ";", ";", ";", ";", ";", ";", ";"], props => flexStyles$1(!props.sizeAll && (props.xs || props.sm || props.md || props.lg || props.xl) ? undefined : props.sizeAll || false, props.alignSelf, props.textAlign, props.offset, props.order, props), props => sizeStyles$5(props), props => props.debug && colorStyles$4(props), props => mediaStyles$1(props.theme.breakpoints.xs, props.xs, props.alignSelfXs, props.textAlignXs, props.offsetXs, props.orderXs, props), props => mediaStyles$1(props.theme.breakpoints.sm, props.sm, props.alignSelfSm, props.textAlignSm, props.offsetSm, props.orderSm, props), props => mediaStyles$1(props.theme.breakpoints.md, props.md, props.alignSelfMd, props.textAlignMd, props.offsetMd, props.orderMd, props), props => mediaStyles$1(props.theme.breakpoints.lg, props.lg, props.alignSelfLg, props.textAlignLg, props.offsetLg, props.orderLg, props), props => mediaStyles$1(props.theme.breakpoints.xl, props.xl, props.alignSelfXl, props.textAlignXl, props.offsetXl, props.orderXl, props), props => reactTheming.retrieveComponentStyles(COMPONENT_ID$7, props));
|
|
111
111
|
StyledCol.defaultProps = {
|
|
112
112
|
columns: 12,
|
|
113
113
|
theme: reactTheming.DEFAULT_THEME
|
|
114
114
|
};
|
|
115
115
|
|
|
116
|
-
const COMPONENT_ID$
|
|
116
|
+
const COMPONENT_ID$6 = 'grid.grid';
|
|
117
117
|
const colorStyles$3 = props => {
|
|
118
118
|
const borderColor = reactTheming.getColorV8(props.theme.palette.crimson, 400, props.theme, 0.5);
|
|
119
119
|
const borderWidth = polished.math(`${props.theme.borderWidths.sm} * 2`);
|
|
120
120
|
return styled.css(["box-shadow:-", " 0 0 0 ", ",", " 0 0 0 ", ";"], borderWidth, borderColor, borderWidth, borderColor);
|
|
121
121
|
};
|
|
122
|
-
const sizeStyles$
|
|
122
|
+
const sizeStyles$4 = props => {
|
|
123
123
|
const padding = props.gutters ? polished.math(`${props.theme.space[props.gutters]} / 2`) : 0;
|
|
124
124
|
return styled.css(["padding-right:", ";padding-left:", ";"], padding, padding);
|
|
125
125
|
};
|
|
126
126
|
const StyledGrid = styled__default.default.div.attrs({
|
|
127
|
-
'data-garden-id': COMPONENT_ID$
|
|
128
|
-
'data-garden-version': '8.75.
|
|
127
|
+
'data-garden-id': COMPONENT_ID$6,
|
|
128
|
+
'data-garden-version': '8.75.1'
|
|
129
129
|
}).withConfig({
|
|
130
130
|
displayName: "StyledGrid",
|
|
131
131
|
componentId: "sc-oxgg5i-0"
|
|
132
|
-
})(["direction:", ";margin-right:auto;margin-left:auto;width:100%;box-sizing:border-box;", ";", ";", ";"], props => props.theme.rtl && 'rtl', props => sizeStyles$
|
|
132
|
+
})(["direction:", ";margin-right:auto;margin-left:auto;width:100%;box-sizing:border-box;", ";", ";", ";"], props => props.theme.rtl && 'rtl', props => sizeStyles$4(props), props => props.debug && colorStyles$3(props), props => reactTheming.retrieveComponentStyles(COMPONENT_ID$6, props));
|
|
133
133
|
StyledGrid.defaultProps = {
|
|
134
134
|
gutters: 'md',
|
|
135
135
|
theme: reactTheming.DEFAULT_THEME
|
|
136
136
|
};
|
|
137
137
|
|
|
138
|
-
const COMPONENT_ID$
|
|
138
|
+
const COMPONENT_ID$5 = 'grid.row';
|
|
139
139
|
const colorStyles$2 = props => {
|
|
140
140
|
const borderColor = reactTheming.getColorV8(props.theme.palette.mint, 600, props.theme, 0.5);
|
|
141
141
|
const borderWidth = props.theme.borderWidths.sm;
|
|
@@ -161,61 +161,61 @@ const flexStyles = (alignItems, justifyContent, wrap) => {
|
|
|
161
161
|
const mediaStyles = (minWidth, alignItems, justifyContent, wrap) => {
|
|
162
162
|
return styled.css(["@media (min-width:", "){", ";}"], minWidth, flexStyles(alignItems, justifyContent, wrap));
|
|
163
163
|
};
|
|
164
|
-
const sizeStyles$
|
|
164
|
+
const sizeStyles$3 = props => {
|
|
165
165
|
const margin = props.gutters ? polished.math(`${props.theme.space[props.gutters]} / 2`) : 0;
|
|
166
166
|
return styled.css(["margin-right:-", ";margin-left:-", ";"], margin, margin);
|
|
167
167
|
};
|
|
168
168
|
const StyledRow = styled__default.default.div.attrs({
|
|
169
|
-
'data-garden-id': COMPONENT_ID$
|
|
170
|
-
'data-garden-version': '8.75.
|
|
169
|
+
'data-garden-id': COMPONENT_ID$5,
|
|
170
|
+
'data-garden-version': '8.75.1'
|
|
171
171
|
}).withConfig({
|
|
172
172
|
displayName: "StyledRow",
|
|
173
173
|
componentId: "sc-xjsdg1-0"
|
|
174
|
-
})(["display:flex;box-sizing:border-box;", " ", ";", ";", ";", ";", ";", ";", ";", ";"], props => flexStyles(props.alignItems, props.justifyContent, props.wrapAll), props => sizeStyles$
|
|
174
|
+
})(["display:flex;box-sizing:border-box;", " ", ";", ";", ";", ";", ";", ";", ";", ";"], props => flexStyles(props.alignItems, props.justifyContent, props.wrapAll), props => sizeStyles$3(props), props => props.debug && colorStyles$2(props), props => mediaStyles(props.theme.breakpoints.xs, props.alignItemsXs, props.justifyContentXs, props.wrapXs), props => mediaStyles(props.theme.breakpoints.sm, props.alignItemsSm, props.justifyContentSm, props.wrapSm), props => mediaStyles(props.theme.breakpoints.md, props.alignItemsMd, props.justifyContentMd, props.wrapMd), props => mediaStyles(props.theme.breakpoints.lg, props.alignItemsLg, props.justifyContentLg, props.wrapLg), props => mediaStyles(props.theme.breakpoints.xl, props.alignItemsXl, props.justifyContentXl, props.wrapXl), props => reactTheming.retrieveComponentStyles(COMPONENT_ID$5, props));
|
|
175
175
|
StyledRow.defaultProps = {
|
|
176
176
|
wrapAll: 'wrap',
|
|
177
177
|
theme: reactTheming.DEFAULT_THEME
|
|
178
178
|
};
|
|
179
179
|
|
|
180
|
-
const COMPONENT_ID$
|
|
180
|
+
const COMPONENT_ID$4 = 'pane';
|
|
181
181
|
const StyledPane = styled__default.default.div.attrs({
|
|
182
|
-
'data-garden-id': COMPONENT_ID$
|
|
183
|
-
'data-garden-version': '8.75.
|
|
182
|
+
'data-garden-id': COMPONENT_ID$4,
|
|
183
|
+
'data-garden-version': '8.75.1'
|
|
184
184
|
}).withConfig({
|
|
185
185
|
displayName: "StyledPane",
|
|
186
186
|
componentId: "sc-1ltjst7-0"
|
|
187
|
-
})(["position:relative;min-width:0;min-height:0;", ";"], props => reactTheming.retrieveComponentStyles(COMPONENT_ID$
|
|
187
|
+
})(["position:relative;min-width:0;min-height:0;", ";"], props => reactTheming.retrieveComponentStyles(COMPONENT_ID$4, props));
|
|
188
188
|
StyledPane.defaultProps = {
|
|
189
189
|
theme: reactTheming.DEFAULT_THEME
|
|
190
190
|
};
|
|
191
191
|
|
|
192
|
-
const COMPONENT_ID$
|
|
192
|
+
const COMPONENT_ID$3 = 'pane.content';
|
|
193
193
|
const StyledPaneContent = styled__default.default.div.attrs({
|
|
194
|
-
'data-garden-id': COMPONENT_ID$
|
|
195
|
-
'data-garden-version': '8.75.
|
|
194
|
+
'data-garden-id': COMPONENT_ID$3,
|
|
195
|
+
'data-garden-version': '8.75.1'
|
|
196
196
|
}).withConfig({
|
|
197
197
|
displayName: "StyledPaneContent",
|
|
198
198
|
componentId: "sc-1b38mbh-0"
|
|
199
|
-
})(["height:100%;overflow:auto;&[hidden]{display:none;}", ";"], props => reactTheming.retrieveComponentStyles(COMPONENT_ID$
|
|
199
|
+
})(["height:100%;overflow:auto;&[hidden]{display:none;}", ";"], props => reactTheming.retrieveComponentStyles(COMPONENT_ID$3, props));
|
|
200
200
|
StyledPaneContent.defaultProps = {
|
|
201
201
|
theme: reactTheming.DEFAULT_THEME
|
|
202
202
|
};
|
|
203
203
|
|
|
204
|
-
const COMPONENT_ID$
|
|
204
|
+
const COMPONENT_ID$2 = 'pane.splitter';
|
|
205
205
|
const colorStyles$1 = props => {
|
|
206
206
|
const color = reactTheming.getColorV8('neutralHue', 300, props.theme);
|
|
207
207
|
const hoverColor = reactTheming.getColorV8('primaryHue', 600, props.theme);
|
|
208
208
|
const activeColor = reactTheming.getColorV8('primaryHue', 800, props.theme);
|
|
209
|
-
return styled.css(["&::before{background-color:", ";}&:hover::before{background-color:", ";}", " &:active::before{background-color:", ";}"], color,
|
|
209
|
+
return styled.css(["&::before{background-color:", ";}&:hover::before{background-color:", ";}", " &:active::before{background-color:", ";}"], color, hoverColor, reactTheming.focusStyles({
|
|
210
210
|
theme: props.theme,
|
|
211
211
|
hue: hoverColor,
|
|
212
212
|
styles: {
|
|
213
213
|
backgroundColor: hoverColor
|
|
214
214
|
},
|
|
215
215
|
selector: '&:focus-visible::before, &[data-garden-focus-visible="true"]::before'
|
|
216
|
-
}),
|
|
216
|
+
}), activeColor);
|
|
217
217
|
};
|
|
218
|
-
const sizeStyles$
|
|
218
|
+
const sizeStyles$2 = props => {
|
|
219
219
|
const size = polished.math(`${props.theme.shadowWidths.md} * 2`);
|
|
220
220
|
const separatorSize = polished.math(`${props.theme.borderWidths.sm} * 2`);
|
|
221
221
|
const offset = polished.math(`-${size} / 2`);
|
|
@@ -274,20 +274,28 @@ const sizeStyles$1 = props => {
|
|
|
274
274
|
break;
|
|
275
275
|
}
|
|
276
276
|
const dimensionProperty = width === '100%' ? 'height' : 'width';
|
|
277
|
-
return styled.css(["top:", ";right:", ";bottom:", ";left:", ";cursor:", ";width:", ";height:", ";&::before{width:", ";height:", ";}&:hover::before{", ":", ";}&:focus::before,&:focus-visible::before,&[data-garden-focus-visible]::before{", ":", ";}&:focus-visible::before,&[data-garden-focus-visible]::before{border-radius:", ";}"], top, right, bottom, left, props.isFixed ? 'pointer' : cursor, width, height, separatorWidth, separatorHeight, dimensionProperty,
|
|
277
|
+
return styled.css(["top:", ";right:", ";bottom:", ";left:", ";cursor:", ";width:", ";height:", ";&::before{width:", ";height:", ";}&:hover::before{", ":", ";}&:focus::before,&:focus-visible::before,&[data-garden-focus-visible]::before{", ":", ";}&:focus-visible::before,&[data-garden-focus-visible]::before{border-radius:", ";}"], top, right, bottom, left, props.isFixed ? 'pointer' : cursor, width, height, separatorWidth, separatorHeight, dimensionProperty, separatorSize, dimensionProperty, separatorSize, props.theme.borderRadii.md);
|
|
278
278
|
};
|
|
279
279
|
const StyledPaneSplitter = styled__default.default.div.attrs({
|
|
280
|
-
'data-garden-id': COMPONENT_ID$
|
|
281
|
-
'data-garden-version': '8.75.
|
|
280
|
+
'data-garden-id': COMPONENT_ID$2,
|
|
281
|
+
'data-garden-version': '8.75.1'
|
|
282
282
|
}).withConfig({
|
|
283
283
|
displayName: "StyledPaneSplitter",
|
|
284
284
|
componentId: "sc-jylemn-0"
|
|
285
|
-
})(["display:flex;position:absolute;align-items:center;justify-content:center;z-index:1;user-select:none;", ";", "{z-index:2;}&::before{position:absolute;transition:box-shadow 0.1s ease-in-out,background-color 0.25s ease-in-out;z-index:-1;content:'';}", ";", ";"], sizeStyles$
|
|
285
|
+
})(["display:flex;position:absolute;align-items:center;justify-content:center;z-index:1;user-select:none;", ";", "{z-index:2;}&::before{position:absolute;transition:box-shadow 0.1s ease-in-out,background-color 0.25s ease-in-out;z-index:-1;content:'';}", ";", ";"], sizeStyles$2, reactTheming.SELECTOR_FOCUS_VISIBLE, colorStyles$1, props => reactTheming.retrieveComponentStyles(COMPONENT_ID$2, props));
|
|
286
286
|
StyledPaneSplitter.defaultProps = {
|
|
287
287
|
theme: reactTheming.DEFAULT_THEME
|
|
288
288
|
};
|
|
289
289
|
|
|
290
|
-
const COMPONENT_ID = 'pane.splitter_button';
|
|
290
|
+
const COMPONENT_ID$1 = 'pane.splitter_button';
|
|
291
|
+
const getSize = theme => theme.space.base * 6;
|
|
292
|
+
const sizeStyles$1 = _ref => {
|
|
293
|
+
let {
|
|
294
|
+
theme
|
|
295
|
+
} = _ref;
|
|
296
|
+
const size = `${getSize(theme)}px`;
|
|
297
|
+
return styled.css(["width:", ";min-width:", ";height:", ";"], size, size, size);
|
|
298
|
+
};
|
|
291
299
|
const transformStyles = props => {
|
|
292
300
|
let degrees = 0;
|
|
293
301
|
if (props.isRotated) {
|
|
@@ -302,56 +310,120 @@ const transformStyles = props => {
|
|
|
302
310
|
}
|
|
303
311
|
return styled.css(["& > svg{transform:rotate(", "deg);}"], degrees);
|
|
304
312
|
};
|
|
313
|
+
const StyledPaneSplitterButton = styled__default.default(reactButtons.ChevronButton).attrs({
|
|
314
|
+
'data-garden-id': COMPONENT_ID$1,
|
|
315
|
+
'data-garden-version': '8.75.1',
|
|
316
|
+
isBasic: true,
|
|
317
|
+
isPill: true,
|
|
318
|
+
size: 'small'
|
|
319
|
+
}).withConfig({
|
|
320
|
+
displayName: "StyledPaneSplitterButton",
|
|
321
|
+
componentId: "sc-zh032e-0"
|
|
322
|
+
})(["", ";", ";", ";"], sizeStyles$1, transformStyles, props => reactTheming.retrieveComponentStyles(COMPONENT_ID$1, props));
|
|
323
|
+
StyledPaneSplitterButton.defaultProps = {
|
|
324
|
+
theme: reactTheming.DEFAULT_THEME
|
|
325
|
+
};
|
|
326
|
+
|
|
327
|
+
const COMPONENT_ID = 'pane.splitter_button_container';
|
|
305
328
|
const colorStyles = _ref => {
|
|
306
329
|
let {
|
|
307
330
|
theme
|
|
308
331
|
} = _ref;
|
|
332
|
+
const backgroundColor = reactTheming.getColorV8('background', 600 , theme);
|
|
309
333
|
const boxShadow = theme.shadows.lg(`${theme.space.base}px`, `${theme.space.base * 2}px`, reactTheming.getColorV8('chromeHue', 600, theme, 0.15));
|
|
310
|
-
return styled.css(["box-shadow:", ";", ""], boxShadow,
|
|
311
|
-
theme,
|
|
312
|
-
boxShadow
|
|
313
|
-
}));
|
|
334
|
+
return styled.css(["box-shadow:", ";background-color:", ";"], boxShadow, backgroundColor);
|
|
314
335
|
};
|
|
315
|
-
const
|
|
316
|
-
const size = `${props.theme.space.base * 6}px`;
|
|
317
|
-
const display = props.splitterSize <= polished.stripUnit(polished.math(`${props.theme.shadowWidths.md} * 2 + ${size}`)) && 'none';
|
|
318
|
-
const isVertical = props.orientation === 'start' || props.orientation === 'end';
|
|
336
|
+
const positionStyles = props => {
|
|
319
337
|
let top;
|
|
320
338
|
let left;
|
|
321
339
|
let right;
|
|
322
340
|
let bottom;
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
left =
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
341
|
+
const size = getSize(props.theme);
|
|
342
|
+
const inset = `-${size / 2}px`;
|
|
343
|
+
if (props.placement === 'center' || props.splitterSize < size * 3) {
|
|
344
|
+
const center = `${props.splitterSize / 2 - size / 2}px`;
|
|
345
|
+
switch (`${props.orientation}-${props.theme.rtl ? 'rtl' : 'ltr'}`) {
|
|
346
|
+
case 'top-ltr':
|
|
347
|
+
case 'top-rtl':
|
|
348
|
+
top = inset;
|
|
349
|
+
left = center;
|
|
350
|
+
break;
|
|
351
|
+
case 'start-ltr':
|
|
352
|
+
case 'end-rtl':
|
|
353
|
+
top = center;
|
|
354
|
+
left = inset;
|
|
355
|
+
break;
|
|
356
|
+
case 'end-ltr':
|
|
357
|
+
case 'start-rtl':
|
|
358
|
+
top = center;
|
|
359
|
+
right = inset;
|
|
360
|
+
break;
|
|
361
|
+
case 'bottom-ltr':
|
|
362
|
+
case 'bottom-rtl':
|
|
363
|
+
bottom = inset;
|
|
364
|
+
right = center;
|
|
365
|
+
break;
|
|
366
|
+
}
|
|
367
|
+
} else {
|
|
368
|
+
const offset = `${size}px`;
|
|
369
|
+
switch (`${props.orientation}-${props.placement}-${props.theme.rtl ? 'rtl' : 'ltr'}`) {
|
|
370
|
+
case 'top-end-ltr':
|
|
371
|
+
case 'top-end-rtl':
|
|
372
|
+
case 'top-start-rtl':
|
|
373
|
+
top = inset;
|
|
374
|
+
right = offset;
|
|
375
|
+
break;
|
|
376
|
+
case 'bottom-end-ltr':
|
|
377
|
+
case 'bottom-end-rtl':
|
|
378
|
+
case 'bottom-start-rtl':
|
|
379
|
+
bottom = inset;
|
|
380
|
+
right = offset;
|
|
381
|
+
break;
|
|
382
|
+
case 'start-start-ltr':
|
|
383
|
+
case 'end-start-rtl':
|
|
384
|
+
top = offset;
|
|
385
|
+
left = inset;
|
|
386
|
+
break;
|
|
387
|
+
case 'start-end-ltr':
|
|
388
|
+
case 'end-end-rtl':
|
|
389
|
+
bottom = offset;
|
|
390
|
+
left = inset;
|
|
391
|
+
break;
|
|
392
|
+
case 'end-start-ltr':
|
|
393
|
+
case 'start-start-rtl':
|
|
394
|
+
top = offset;
|
|
395
|
+
right = inset;
|
|
396
|
+
break;
|
|
397
|
+
case 'end-end-ltr':
|
|
398
|
+
case 'start-end-rtl':
|
|
399
|
+
bottom = offset;
|
|
400
|
+
right = inset;
|
|
401
|
+
break;
|
|
402
|
+
case 'top-start-ltr':
|
|
403
|
+
top = inset;
|
|
404
|
+
left = offset;
|
|
405
|
+
break;
|
|
406
|
+
case 'bottom-start-ltr':
|
|
407
|
+
bottom = inset;
|
|
408
|
+
left = offset;
|
|
409
|
+
break;
|
|
340
410
|
}
|
|
341
411
|
}
|
|
342
|
-
return styled.css(["
|
|
412
|
+
return styled.css(["top:", ";right:", ";bottom:", ";left:", ";"], top, right, bottom, left);
|
|
343
413
|
};
|
|
344
|
-
const
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
}
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
414
|
+
const sizeStyles = _ref2 => {
|
|
415
|
+
let {
|
|
416
|
+
theme
|
|
417
|
+
} = _ref2;
|
|
418
|
+
const size = getSize(theme);
|
|
419
|
+
return styled.css(["border-radius:", "px;width:", "px;height:", "px;"], size, size, size);
|
|
420
|
+
};
|
|
421
|
+
const minimumSplitterSize = theme => polished.stripUnit(polished.math(`${theme.shadowWidths.md} * 2 + ${getSize(theme)}`));
|
|
422
|
+
const StyledPaneSplitterButtonContainer = styled__default.default.div.withConfig({
|
|
423
|
+
displayName: "StyledPaneSplitterButtonContainer",
|
|
424
|
+
componentId: "sc-1w84y62-0"
|
|
425
|
+
})(["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));
|
|
426
|
+
StyledPaneSplitterButtonContainer.defaultProps = {
|
|
355
427
|
theme: reactTheming.DEFAULT_THEME
|
|
356
428
|
};
|
|
357
429
|
|
|
@@ -708,6 +780,7 @@ const orientationToDimension = {
|
|
|
708
780
|
};
|
|
709
781
|
const SplitterComponent = React.forwardRef((_ref, ref) => {
|
|
710
782
|
let {
|
|
783
|
+
children,
|
|
711
784
|
providerId,
|
|
712
785
|
layoutKey,
|
|
713
786
|
min,
|
|
@@ -724,7 +797,6 @@ const SplitterComponent = React.forwardRef((_ref, ref) => {
|
|
|
724
797
|
const paneContext = usePaneContext();
|
|
725
798
|
const themeContext = React.useContext(styled.ThemeContext);
|
|
726
799
|
const environment = reactTheming.useDocument(themeContext);
|
|
727
|
-
const [isHovered, setIsHovered] = React.useState(false);
|
|
728
800
|
const isRow = orientationToDimension[orientation] === 'rows';
|
|
729
801
|
const separatorRef = React.useRef(null);
|
|
730
802
|
const splitterOrientation = paneToSplitterOrientation[orientation || 'end'];
|
|
@@ -766,7 +838,6 @@ const SplitterComponent = React.forwardRef((_ref, ref) => {
|
|
|
766
838
|
onClick
|
|
767
839
|
});
|
|
768
840
|
const size = isRow ? separatorRef.current?.clientWidth : separatorRef.current?.clientHeight;
|
|
769
|
-
const onMouseOver = React.useMemo(() => containerUtilities.composeEventHandlers(props.onMouseOver, event => setIsHovered(event.target === separatorRef.current)), [props.onMouseOver, separatorRef]);
|
|
770
841
|
return React__default.default.createElement(PaneSplitterContext.Provider, {
|
|
771
842
|
value: React.useMemo(() => ({
|
|
772
843
|
orientation,
|
|
@@ -778,13 +849,11 @@ const SplitterComponent = React.forwardRef((_ref, ref) => {
|
|
|
778
849
|
isRow
|
|
779
850
|
}), [orientation, layoutKey, min, max, valueInFr, size, isRow])
|
|
780
851
|
}, React__default.default.createElement(StyledPaneSplitter, _extends({
|
|
781
|
-
isHovered: isHovered,
|
|
782
852
|
isFixed: isFixed,
|
|
783
853
|
orientation: orientation
|
|
784
854
|
}, separatorProps, props, {
|
|
785
|
-
onMouseOver: onMouseOver,
|
|
786
855
|
ref: mergeRefs__default.default([separatorRef, ref])
|
|
787
|
-
})));
|
|
856
|
+
})), children );
|
|
788
857
|
});
|
|
789
858
|
SplitterComponent.displayName = 'Pane.Splitter';
|
|
790
859
|
SplitterComponent.propTypes = {
|
|
@@ -856,8 +925,13 @@ const SplitterButtonComponent = React.forwardRef((props, ref) => {
|
|
|
856
925
|
);
|
|
857
926
|
const onMouseDown = containerUtilities.composeEventHandlers(props.onMouseDown, event => event.stopPropagation()
|
|
858
927
|
);
|
|
859
|
-
return React__default.default.createElement(
|
|
928
|
+
return React__default.default.createElement(StyledPaneSplitterButtonContainer, {
|
|
929
|
+
orientation: orientation,
|
|
930
|
+
placement: placement,
|
|
931
|
+
splitterSize: size || 0
|
|
932
|
+
}, React__default.default.createElement(reactTooltips.Tooltip, {
|
|
860
933
|
content: label,
|
|
934
|
+
zIndex: 2,
|
|
861
935
|
style: {
|
|
862
936
|
cursor: 'default'
|
|
863
937
|
},
|
|
@@ -865,15 +939,13 @@ const SplitterButtonComponent = React.forwardRef((props, ref) => {
|
|
|
865
939
|
}, React__default.default.createElement(StyledPaneSplitterButton, _extends({
|
|
866
940
|
"aria-label": label
|
|
867
941
|
}, props, {
|
|
868
|
-
placement: placement,
|
|
869
942
|
orientation: orientation,
|
|
870
943
|
isRotated: isMin,
|
|
871
|
-
splitterSize: size || 0,
|
|
872
944
|
ref: ref,
|
|
873
945
|
onClick: onClick,
|
|
874
946
|
onKeyDown: onKeyDown,
|
|
875
947
|
onMouseDown: onMouseDown
|
|
876
|
-
})));
|
|
948
|
+
}))));
|
|
877
949
|
});
|
|
878
950
|
SplitterButtonComponent.displayName = 'Pane.SplitterButton';
|
|
879
951
|
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': '8.75.
|
|
95
|
+
'data-garden-id': COMPONENT_ID$7,
|
|
96
|
+
'data-garden-version': '8.75.1'
|
|
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': '8.75.
|
|
117
|
+
'data-garden-id': COMPONENT_ID$6,
|
|
118
|
+
'data-garden-version': '8.75.1'
|
|
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': '8.75.
|
|
159
|
+
'data-garden-id': COMPONENT_ID$5,
|
|
160
|
+
'data-garden-version': '8.75.1'
|
|
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': '8.75.
|
|
172
|
+
'data-garden-id': COMPONENT_ID$4,
|
|
173
|
+
'data-garden-version': '8.75.1'
|
|
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': '8.75.
|
|
184
|
+
'data-garden-id': COMPONENT_ID$3,
|
|
185
|
+
'data-garden-version': '8.75.1'
|
|
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
205
|
selector: '&:focus-visible::before, &[data-garden-focus-visible="true"]::before'
|
|
206
|
-
}),
|
|
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,&[data-garden-focus-visible]::before{", ":", ";}&:focus-visible::before,&[data-garden-focus-visible]::before{border-radius:", ";}"], top, right, bottom, left, props.isFixed ? 'pointer' : cursor, width, height, separatorWidth, separatorHeight, dimensionProperty,
|
|
267
|
+
return css(["top:", ";right:", ";bottom:", ";left:", ";cursor:", ";width:", ";height:", ";&::before{width:", ";height:", ";}&:hover::before{", ":", ";}&:focus::before,&:focus-visible::before,&[data-garden-focus-visible]::before{", ":", ";}&:focus-visible::before,&[data-garden-focus-visible]::before{border-radius:", ";}"], top, right, bottom, left, props.isFixed ? 'pointer' : cursor, width, height, separatorWidth, separatorHeight, dimensionProperty, separatorSize, dimensionProperty, separatorSize, props.theme.borderRadii.md);
|
|
268
268
|
};
|
|
269
269
|
const StyledPaneSplitter = styled.div.attrs({
|
|
270
|
-
'data-garden-id': COMPONENT_ID$
|
|
271
|
-
'data-garden-version': '8.75.
|
|
270
|
+
'data-garden-id': COMPONENT_ID$2,
|
|
271
|
+
'data-garden-version': '8.75.1'
|
|
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': '8.75.1',
|
|
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
|
|
|
@@ -698,6 +770,7 @@ const orientationToDimension = {
|
|
|
698
770
|
};
|
|
699
771
|
const SplitterComponent = forwardRef((_ref, ref) => {
|
|
700
772
|
let {
|
|
773
|
+
children,
|
|
701
774
|
providerId,
|
|
702
775
|
layoutKey,
|
|
703
776
|
min,
|
|
@@ -714,7 +787,6 @@ const SplitterComponent = forwardRef((_ref, ref) => {
|
|
|
714
787
|
const paneContext = usePaneContext();
|
|
715
788
|
const themeContext = useContext(ThemeContext);
|
|
716
789
|
const environment = useDocument(themeContext);
|
|
717
|
-
const [isHovered, setIsHovered] = useState(false);
|
|
718
790
|
const isRow = orientationToDimension[orientation] === 'rows';
|
|
719
791
|
const separatorRef = useRef(null);
|
|
720
792
|
const splitterOrientation = paneToSplitterOrientation[orientation || 'end'];
|
|
@@ -756,7 +828,6 @@ const SplitterComponent = forwardRef((_ref, ref) => {
|
|
|
756
828
|
onClick
|
|
757
829
|
});
|
|
758
830
|
const size = isRow ? separatorRef.current?.clientWidth : separatorRef.current?.clientHeight;
|
|
759
|
-
const onMouseOver = useMemo(() => composeEventHandlers(props.onMouseOver, event => setIsHovered(event.target === separatorRef.current)), [props.onMouseOver, separatorRef]);
|
|
760
831
|
return React.createElement(PaneSplitterContext.Provider, {
|
|
761
832
|
value: useMemo(() => ({
|
|
762
833
|
orientation,
|
|
@@ -768,13 +839,11 @@ const SplitterComponent = forwardRef((_ref, ref) => {
|
|
|
768
839
|
isRow
|
|
769
840
|
}), [orientation, layoutKey, min, max, valueInFr, size, isRow])
|
|
770
841
|
}, React.createElement(StyledPaneSplitter, _extends({
|
|
771
|
-
isHovered: isHovered,
|
|
772
842
|
isFixed: isFixed,
|
|
773
843
|
orientation: orientation
|
|
774
844
|
}, separatorProps, props, {
|
|
775
|
-
onMouseOver: onMouseOver,
|
|
776
845
|
ref: mergeRefs([separatorRef, ref])
|
|
777
|
-
})));
|
|
846
|
+
})), children );
|
|
778
847
|
});
|
|
779
848
|
SplitterComponent.displayName = 'Pane.Splitter';
|
|
780
849
|
SplitterComponent.propTypes = {
|
|
@@ -846,8 +915,13 @@ const SplitterButtonComponent = forwardRef((props, ref) => {
|
|
|
846
915
|
);
|
|
847
916
|
const onMouseDown = composeEventHandlers(props.onMouseDown, event => event.stopPropagation()
|
|
848
917
|
);
|
|
849
|
-
return React.createElement(
|
|
918
|
+
return React.createElement(StyledPaneSplitterButtonContainer, {
|
|
919
|
+
orientation: orientation,
|
|
920
|
+
placement: placement,
|
|
921
|
+
splitterSize: size || 0
|
|
922
|
+
}, React.createElement(Tooltip, {
|
|
850
923
|
content: label,
|
|
924
|
+
zIndex: 2,
|
|
851
925
|
style: {
|
|
852
926
|
cursor: 'default'
|
|
853
927
|
},
|
|
@@ -855,15 +929,13 @@ const SplitterButtonComponent = forwardRef((props, ref) => {
|
|
|
855
929
|
}, React.createElement(StyledPaneSplitterButton, _extends({
|
|
856
930
|
"aria-label": label
|
|
857
931
|
}, props, {
|
|
858
|
-
placement: placement,
|
|
859
932
|
orientation: orientation,
|
|
860
933
|
isRotated: isMin,
|
|
861
|
-
splitterSize: size || 0,
|
|
862
934
|
ref: ref,
|
|
863
935
|
onClick: onClick,
|
|
864
936
|
onKeyDown: onKeyDown,
|
|
865
937
|
onMouseDown: onMouseDown
|
|
866
|
-
})));
|
|
938
|
+
}))));
|
|
867
939
|
});
|
|
868
940
|
SplitterButtonComponent.displayName = 'Pane.SplitterButton';
|
|
869
941
|
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": "8.75.
|
|
3
|
+
"version": "8.75.1",
|
|
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,8 +23,8 @@
|
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"@zendeskgarden/container-splitter": "^2.0.3",
|
|
25
25
|
"@zendeskgarden/container-utilities": "^2.0.0",
|
|
26
|
-
"@zendeskgarden/react-buttons": "^8.75.
|
|
27
|
-
"@zendeskgarden/react-tooltips": "^8.75.
|
|
26
|
+
"@zendeskgarden/react-buttons": "^8.75.1",
|
|
27
|
+
"@zendeskgarden/react-tooltips": "^8.75.1",
|
|
28
28
|
"polished": "^4.0.0",
|
|
29
29
|
"prop-types": "^15.5.7",
|
|
30
30
|
"react-merge-refs": "^1.1.0",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"styled-components": "^4.2.0 || ^5.0.0"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@zendeskgarden/react-theming": "^8.75.
|
|
40
|
+
"@zendeskgarden/react-theming": "^8.75.1"
|
|
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": "8e2bb36bcfef722db47a135fc987f72597be5000"
|
|
53
53
|
}
|