@zendeskgarden/react-grid 9.0.0-next.1 → 9.0.0-next.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -10
- package/dist/esm/elements/Col.js +72 -0
- package/dist/esm/elements/Grid.js +54 -0
- package/dist/esm/elements/Row.js +58 -0
- package/dist/esm/elements/pane/Pane.js +55 -0
- package/dist/esm/elements/pane/PaneProvider.js +197 -0
- package/dist/esm/elements/pane/components/Content.js +30 -0
- package/dist/esm/elements/pane/components/Splitter.js +128 -0
- package/dist/esm/elements/pane/components/SplitterButton.js +91 -0
- package/dist/esm/index.js +12 -0
- package/dist/esm/styled/StyledCol.js +73 -0
- package/dist/esm/styled/StyledGrid.js +33 -0
- package/dist/esm/styled/StyledRow.js +53 -0
- package/dist/esm/styled/pane/StyledPane.js +22 -0
- package/dist/esm/styled/pane/StyledPaneContent.js +22 -0
- package/dist/esm/styled/pane/StyledPaneSplitter.js +99 -0
- package/dist/esm/styled/pane/StyledPaneSplitterButton.js +48 -0
- package/dist/esm/styled/pane/StyledPaneSplitterButtonContainer.js +116 -0
- package/dist/esm/types/index.js +16 -0
- package/dist/esm/utils/useGridContext.js +16 -0
- package/dist/esm/utils/usePaneContext.js +16 -0
- package/dist/esm/utils/usePaneProviderContext.js +17 -0
- package/dist/esm/utils/usePaneSplitterContext.js +22 -0
- package/dist/index.cjs.js +211 -150
- package/dist/typings/elements/Col.d.ts +2 -0
- package/dist/typings/elements/Grid.d.ts +7 -1
- package/dist/typings/elements/Row.d.ts +2 -0
- package/dist/typings/index.d.ts +1 -1
- package/dist/typings/styled/index.d.ts +1 -0
- package/dist/typings/styled/pane/StyledPaneSplitter.d.ts +0 -1
- package/dist/typings/styled/pane/StyledPaneSplitterButton.d.ts +3 -7
- package/dist/typings/styled/pane/StyledPaneSplitterButtonContainer.d.ts +18 -0
- package/package.json +8 -8
- package/dist/index.esm.js +0 -903
package/dist/index.cjs.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
* Copyright Zendesk, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
+
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
*/
|
|
8
7
|
'use strict';
|
|
9
8
|
|
|
10
9
|
var React = require('react');
|
|
@@ -26,21 +25,6 @@ var PropTypes__default = /*#__PURE__*/_interopDefault(PropTypes);
|
|
|
26
25
|
var styled__default = /*#__PURE__*/_interopDefault(styled);
|
|
27
26
|
var useResizeObserver__default = /*#__PURE__*/_interopDefault(useResizeObserver);
|
|
28
27
|
|
|
29
|
-
function _extends() {
|
|
30
|
-
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
31
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
32
|
-
var source = arguments[i];
|
|
33
|
-
for (var key in source) {
|
|
34
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
35
|
-
target[key] = source[key];
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
return target;
|
|
40
|
-
};
|
|
41
|
-
return _extends.apply(this, arguments);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
28
|
const ALIGN_ITEMS = ['start', 'end', 'center', 'baseline', 'stretch'];
|
|
45
29
|
const ALIGN_SELF = ['auto', ...ALIGN_ITEMS];
|
|
46
30
|
const DIRECTION = ['row', 'row-reverse', 'column', 'column-reverse'];
|
|
@@ -50,9 +34,9 @@ const SPACE = [false, 'xxs', 'xs', 'sm', 'md', 'lg', 'xl', 'xxl'];
|
|
|
50
34
|
const WRAP = ['nowrap', 'wrap', 'wrap-reverse'];
|
|
51
35
|
const ORIENTATION = ['top', 'bottom', 'start', 'end'];
|
|
52
36
|
|
|
53
|
-
const COMPONENT_ID$
|
|
37
|
+
const COMPONENT_ID$7 = 'grid.col';
|
|
54
38
|
const colorStyles$4 = props => {
|
|
55
|
-
const backgroundColor = reactTheming.
|
|
39
|
+
const backgroundColor = reactTheming.getColorV8('primaryHue', 600, props.theme, 0.1);
|
|
56
40
|
return styled.css(["background-clip:content-box;background-color:", ";"], backgroundColor);
|
|
57
41
|
};
|
|
58
42
|
const flexStyles$1 = (size, alignSelf, textAlign, offset, order, props) => {
|
|
@@ -96,47 +80,47 @@ const flexStyles$1 = (size, alignSelf, textAlign, offset, order, props) => {
|
|
|
96
80
|
const mediaStyles$1 = (minWidth, size, alignSelf, textAlign, offset, order, props) => {
|
|
97
81
|
return styled.css(["@media (min-width:", "){", ";}"], minWidth, flexStyles$1(size, alignSelf, textAlign, offset, order, props));
|
|
98
82
|
};
|
|
99
|
-
const sizeStyles$
|
|
83
|
+
const sizeStyles$5 = props => {
|
|
100
84
|
const padding = props.gutters ? polished.math(`${props.theme.space[props.gutters]} / 2`) : 0;
|
|
101
85
|
return styled.css(["padding-right:", ";padding-left:", ";"], padding, padding);
|
|
102
86
|
};
|
|
103
87
|
const StyledCol = styled__default.default.div.attrs({
|
|
104
|
-
'data-garden-id': COMPONENT_ID$
|
|
105
|
-
'data-garden-version': '9.0.0-next.
|
|
88
|
+
'data-garden-id': COMPONENT_ID$7,
|
|
89
|
+
'data-garden-version': '9.0.0-next.10'
|
|
106
90
|
}).withConfig({
|
|
107
91
|
displayName: "StyledCol",
|
|
108
92
|
componentId: "sc-inuw62-0"
|
|
109
|
-
})(["box-sizing:border-box;width:100%;", ";", ";", ";", ";", ";", ";", ";", ";", ";"], props => flexStyles$1(!props.sizeAll && (props.xs || props.sm || props.md || props.lg || props.xl) ? undefined : props.sizeAll || false, props.alignSelf, props.textAlign, props.offset, props.order, props), props => sizeStyles$
|
|
93
|
+
})(["box-sizing:border-box;width:100%;", ";", ";", ";", ";", ";", ";", ";", ";", ";"], props => flexStyles$1(!props.sizeAll && (props.xs || props.sm || props.md || props.lg || props.xl) ? undefined : props.sizeAll || false, props.alignSelf, props.textAlign, props.offset, props.order, props), props => sizeStyles$5(props), props => props.debug && colorStyles$4(props), props => mediaStyles$1(props.theme.breakpoints.xs, props.xs, props.alignSelfXs, props.textAlignXs, props.offsetXs, props.orderXs, props), props => mediaStyles$1(props.theme.breakpoints.sm, props.sm, props.alignSelfSm, props.textAlignSm, props.offsetSm, props.orderSm, props), props => mediaStyles$1(props.theme.breakpoints.md, props.md, props.alignSelfMd, props.textAlignMd, props.offsetMd, props.orderMd, props), props => mediaStyles$1(props.theme.breakpoints.lg, props.lg, props.alignSelfLg, props.textAlignLg, props.offsetLg, props.orderLg, props), props => mediaStyles$1(props.theme.breakpoints.xl, props.xl, props.alignSelfXl, props.textAlignXl, props.offsetXl, props.orderXl, props), props => reactTheming.retrieveComponentStyles(COMPONENT_ID$7, props));
|
|
110
94
|
StyledCol.defaultProps = {
|
|
111
95
|
columns: 12,
|
|
112
96
|
theme: reactTheming.DEFAULT_THEME
|
|
113
97
|
};
|
|
114
98
|
|
|
115
|
-
const COMPONENT_ID$
|
|
99
|
+
const COMPONENT_ID$6 = 'grid.grid';
|
|
116
100
|
const colorStyles$3 = props => {
|
|
117
|
-
const borderColor = reactTheming.
|
|
101
|
+
const borderColor = reactTheming.getColorV8(props.theme.palette.crimson, 400, props.theme, 0.5);
|
|
118
102
|
const borderWidth = polished.math(`${props.theme.borderWidths.sm} * 2`);
|
|
119
103
|
return styled.css(["box-shadow:-", " 0 0 0 ", ",", " 0 0 0 ", ";"], borderWidth, borderColor, borderWidth, borderColor);
|
|
120
104
|
};
|
|
121
|
-
const sizeStyles$
|
|
105
|
+
const sizeStyles$4 = props => {
|
|
122
106
|
const padding = props.gutters ? polished.math(`${props.theme.space[props.gutters]} / 2`) : 0;
|
|
123
107
|
return styled.css(["padding-right:", ";padding-left:", ";"], padding, padding);
|
|
124
108
|
};
|
|
125
109
|
const StyledGrid = styled__default.default.div.attrs({
|
|
126
|
-
'data-garden-id': COMPONENT_ID$
|
|
127
|
-
'data-garden-version': '9.0.0-next.
|
|
110
|
+
'data-garden-id': COMPONENT_ID$6,
|
|
111
|
+
'data-garden-version': '9.0.0-next.10'
|
|
128
112
|
}).withConfig({
|
|
129
113
|
displayName: "StyledGrid",
|
|
130
114
|
componentId: "sc-oxgg5i-0"
|
|
131
|
-
})(["direction:", ";margin-right:auto;margin-left:auto;width:100%;box-sizing:border-box;", ";", ";", ";"], props => props.theme.rtl && 'rtl', props => sizeStyles$
|
|
115
|
+
})(["direction:", ";margin-right:auto;margin-left:auto;width:100%;box-sizing:border-box;", ";", ";", ";"], props => props.theme.rtl && 'rtl', props => sizeStyles$4(props), props => props.debug && colorStyles$3(props), props => reactTheming.retrieveComponentStyles(COMPONENT_ID$6, props));
|
|
132
116
|
StyledGrid.defaultProps = {
|
|
133
117
|
gutters: 'md',
|
|
134
118
|
theme: reactTheming.DEFAULT_THEME
|
|
135
119
|
};
|
|
136
120
|
|
|
137
|
-
const COMPONENT_ID$
|
|
121
|
+
const COMPONENT_ID$5 = 'grid.row';
|
|
138
122
|
const colorStyles$2 = props => {
|
|
139
|
-
const borderColor = reactTheming.
|
|
123
|
+
const borderColor = reactTheming.getColorV8(props.theme.palette.mint, 600, props.theme, 0.5);
|
|
140
124
|
const borderWidth = props.theme.borderWidths.sm;
|
|
141
125
|
return styled.css(["box-shadow:inset 0 ", " 0 0 ", ",inset 0 -", " 0 0 ", ";"], borderWidth, borderColor, borderWidth, borderColor);
|
|
142
126
|
};
|
|
@@ -160,61 +144,63 @@ const flexStyles = (alignItems, justifyContent, wrap) => {
|
|
|
160
144
|
const mediaStyles = (minWidth, alignItems, justifyContent, wrap) => {
|
|
161
145
|
return styled.css(["@media (min-width:", "){", ";}"], minWidth, flexStyles(alignItems, justifyContent, wrap));
|
|
162
146
|
};
|
|
163
|
-
const sizeStyles$
|
|
147
|
+
const sizeStyles$3 = props => {
|
|
164
148
|
const margin = props.gutters ? polished.math(`${props.theme.space[props.gutters]} / 2`) : 0;
|
|
165
149
|
return styled.css(["margin-right:-", ";margin-left:-", ";"], margin, margin);
|
|
166
150
|
};
|
|
167
151
|
const StyledRow = styled__default.default.div.attrs({
|
|
168
|
-
'data-garden-id': COMPONENT_ID$
|
|
169
|
-
'data-garden-version': '9.0.0-next.
|
|
152
|
+
'data-garden-id': COMPONENT_ID$5,
|
|
153
|
+
'data-garden-version': '9.0.0-next.10'
|
|
170
154
|
}).withConfig({
|
|
171
155
|
displayName: "StyledRow",
|
|
172
156
|
componentId: "sc-xjsdg1-0"
|
|
173
|
-
})(["display:flex;box-sizing:border-box;", " ", ";", ";", ";", ";", ";", ";", ";", ";"], props => flexStyles(props.alignItems, props.justifyContent, props.wrapAll), props => sizeStyles$
|
|
157
|
+
})(["display:flex;box-sizing:border-box;", " ", ";", ";", ";", ";", ";", ";", ";", ";"], props => flexStyles(props.alignItems, props.justifyContent, props.wrapAll), props => sizeStyles$3(props), props => props.debug && colorStyles$2(props), props => mediaStyles(props.theme.breakpoints.xs, props.alignItemsXs, props.justifyContentXs, props.wrapXs), props => mediaStyles(props.theme.breakpoints.sm, props.alignItemsSm, props.justifyContentSm, props.wrapSm), props => mediaStyles(props.theme.breakpoints.md, props.alignItemsMd, props.justifyContentMd, props.wrapMd), props => mediaStyles(props.theme.breakpoints.lg, props.alignItemsLg, props.justifyContentLg, props.wrapLg), props => mediaStyles(props.theme.breakpoints.xl, props.alignItemsXl, props.justifyContentXl, props.wrapXl), props => reactTheming.retrieveComponentStyles(COMPONENT_ID$5, props));
|
|
174
158
|
StyledRow.defaultProps = {
|
|
175
159
|
wrapAll: 'wrap',
|
|
176
160
|
theme: reactTheming.DEFAULT_THEME
|
|
177
161
|
};
|
|
178
162
|
|
|
179
|
-
const COMPONENT_ID$
|
|
163
|
+
const COMPONENT_ID$4 = 'pane';
|
|
180
164
|
const StyledPane = styled__default.default.div.attrs({
|
|
181
|
-
'data-garden-id': COMPONENT_ID$
|
|
182
|
-
'data-garden-version': '9.0.0-next.
|
|
165
|
+
'data-garden-id': COMPONENT_ID$4,
|
|
166
|
+
'data-garden-version': '9.0.0-next.10'
|
|
183
167
|
}).withConfig({
|
|
184
168
|
displayName: "StyledPane",
|
|
185
169
|
componentId: "sc-1ltjst7-0"
|
|
186
|
-
})(["position:relative;min-width:0;min-height:0;", ";"], props => reactTheming.retrieveComponentStyles(COMPONENT_ID$
|
|
170
|
+
})(["position:relative;min-width:0;min-height:0;", ";"], props => reactTheming.retrieveComponentStyles(COMPONENT_ID$4, props));
|
|
187
171
|
StyledPane.defaultProps = {
|
|
188
172
|
theme: reactTheming.DEFAULT_THEME
|
|
189
173
|
};
|
|
190
174
|
|
|
191
|
-
const COMPONENT_ID$
|
|
175
|
+
const COMPONENT_ID$3 = 'pane.content';
|
|
192
176
|
const StyledPaneContent = styled__default.default.div.attrs({
|
|
193
|
-
'data-garden-id': COMPONENT_ID$
|
|
194
|
-
'data-garden-version': '9.0.0-next.
|
|
177
|
+
'data-garden-id': COMPONENT_ID$3,
|
|
178
|
+
'data-garden-version': '9.0.0-next.10'
|
|
195
179
|
}).withConfig({
|
|
196
180
|
displayName: "StyledPaneContent",
|
|
197
181
|
componentId: "sc-1b38mbh-0"
|
|
198
|
-
})(["height:100%;overflow:auto;&[hidden]{display:none;}", ";"], props => reactTheming.retrieveComponentStyles(COMPONENT_ID$
|
|
182
|
+
})(["height:100%;overflow:auto;&[hidden]{display:none;}", ";"], props => reactTheming.retrieveComponentStyles(COMPONENT_ID$3, props));
|
|
199
183
|
StyledPaneContent.defaultProps = {
|
|
200
184
|
theme: reactTheming.DEFAULT_THEME
|
|
201
185
|
};
|
|
202
186
|
|
|
203
|
-
const COMPONENT_ID$
|
|
187
|
+
const COMPONENT_ID$2 = 'pane.splitter';
|
|
204
188
|
const colorStyles$1 = props => {
|
|
205
|
-
const color = reactTheming.
|
|
206
|
-
const hoverColor = reactTheming.
|
|
207
|
-
const activeColor = reactTheming.
|
|
208
|
-
return styled.css(["&::before{background-color:", ";}&:hover::before{background-color:", ";}", " &:active::before{background-color:", ";}"], color,
|
|
189
|
+
const color = reactTheming.getColorV8('neutralHue', 300, props.theme);
|
|
190
|
+
const hoverColor = reactTheming.getColorV8('primaryHue', 600, props.theme);
|
|
191
|
+
const activeColor = reactTheming.getColorV8('primaryHue', 800, props.theme);
|
|
192
|
+
return styled.css(["&::before{background-color:", ";}&:hover::before{background-color:", ";}", " &:active::before{background-color:", ";}"], color, hoverColor, reactTheming.focusStyles({
|
|
209
193
|
theme: props.theme,
|
|
210
|
-
|
|
194
|
+
color: {
|
|
195
|
+
hue: hoverColor
|
|
196
|
+
},
|
|
211
197
|
styles: {
|
|
212
198
|
backgroundColor: hoverColor
|
|
213
199
|
},
|
|
214
|
-
selector: '&:focus-visible::before
|
|
215
|
-
}),
|
|
200
|
+
selector: '&:focus-visible::before'
|
|
201
|
+
}), activeColor);
|
|
216
202
|
};
|
|
217
|
-
const sizeStyles$
|
|
203
|
+
const sizeStyles$2 = props => {
|
|
218
204
|
const size = polished.math(`${props.theme.shadowWidths.md} * 2`);
|
|
219
205
|
const separatorSize = polished.math(`${props.theme.borderWidths.sm} * 2`);
|
|
220
206
|
const offset = polished.math(`-${size} / 2`);
|
|
@@ -273,20 +259,28 @@ const sizeStyles$1 = props => {
|
|
|
273
259
|
break;
|
|
274
260
|
}
|
|
275
261
|
const dimensionProperty = width === '100%' ? 'height' : 'width';
|
|
276
|
-
return styled.css(["top:", ";right:", ";bottom:", ";left:", ";cursor:", ";width:", ";height:", ";&::before{width:", ";height:", ";}&:hover::before{", ":", ";}&:focus::before,&:focus-visible::before
|
|
262
|
+
return styled.css(["top:", ";right:", ";bottom:", ";left:", ";cursor:", ";width:", ";height:", ";&::before{width:", ";height:", ";}&:hover::before{", ":", ";}&:focus::before,&:focus-visible::before{", ":", ";}&:focus-visible::before{border-radius:", ";}"], top, right, bottom, left, props.isFixed ? 'pointer' : cursor, width, height, separatorWidth, separatorHeight, dimensionProperty, separatorSize, dimensionProperty, separatorSize, props.theme.borderRadii.md);
|
|
277
263
|
};
|
|
278
264
|
const StyledPaneSplitter = styled__default.default.div.attrs({
|
|
279
|
-
'data-garden-id': COMPONENT_ID$
|
|
280
|
-
'data-garden-version': '9.0.0-next.
|
|
265
|
+
'data-garden-id': COMPONENT_ID$2,
|
|
266
|
+
'data-garden-version': '9.0.0-next.10'
|
|
281
267
|
}).withConfig({
|
|
282
268
|
displayName: "StyledPaneSplitter",
|
|
283
269
|
componentId: "sc-jylemn-0"
|
|
284
|
-
})(["display:flex;position:absolute;align-items:center;justify-content:center;z-index:1;user-select:none;", ";", "{z-index:2;}&::before{position:absolute;transition:box-shadow 0.1s ease-in-out,background-color 0.25s ease-in-out;z-index:-1;content:'';}", ";", ";"], sizeStyles$
|
|
270
|
+
})(["display:flex;position:absolute;align-items:center;justify-content:center;z-index:1;user-select:none;", ";", "{z-index:2;}&::before{position:absolute;transition:box-shadow 0.1s ease-in-out,background-color 0.25s ease-in-out;z-index:-1;content:'';}", ";", ";"], sizeStyles$2, reactTheming.SELECTOR_FOCUS_VISIBLE, colorStyles$1, props => reactTheming.retrieveComponentStyles(COMPONENT_ID$2, props));
|
|
285
271
|
StyledPaneSplitter.defaultProps = {
|
|
286
272
|
theme: reactTheming.DEFAULT_THEME
|
|
287
273
|
};
|
|
288
274
|
|
|
289
|
-
const COMPONENT_ID = 'pane.splitter_button';
|
|
275
|
+
const COMPONENT_ID$1 = 'pane.splitter_button';
|
|
276
|
+
const getSize = theme => theme.space.base * 6;
|
|
277
|
+
const sizeStyles$1 = _ref => {
|
|
278
|
+
let {
|
|
279
|
+
theme
|
|
280
|
+
} = _ref;
|
|
281
|
+
const size = `${getSize(theme)}px`;
|
|
282
|
+
return styled.css(["width:", ";min-width:", ";height:", ";"], size, size, size);
|
|
283
|
+
};
|
|
290
284
|
const transformStyles = props => {
|
|
291
285
|
let degrees = 0;
|
|
292
286
|
if (props.isRotated) {
|
|
@@ -301,56 +295,120 @@ const transformStyles = props => {
|
|
|
301
295
|
}
|
|
302
296
|
return styled.css(["& > svg{transform:rotate(", "deg);}"], degrees);
|
|
303
297
|
};
|
|
298
|
+
const StyledPaneSplitterButton = styled__default.default(reactButtons.ChevronButton).attrs({
|
|
299
|
+
'data-garden-id': COMPONENT_ID$1,
|
|
300
|
+
'data-garden-version': '9.0.0-next.10',
|
|
301
|
+
isBasic: true,
|
|
302
|
+
isPill: true,
|
|
303
|
+
size: 'small'
|
|
304
|
+
}).withConfig({
|
|
305
|
+
displayName: "StyledPaneSplitterButton",
|
|
306
|
+
componentId: "sc-zh032e-0"
|
|
307
|
+
})(["", ";", ";", ";"], sizeStyles$1, transformStyles, props => reactTheming.retrieveComponentStyles(COMPONENT_ID$1, props));
|
|
308
|
+
StyledPaneSplitterButton.defaultProps = {
|
|
309
|
+
theme: reactTheming.DEFAULT_THEME
|
|
310
|
+
};
|
|
311
|
+
|
|
312
|
+
const COMPONENT_ID = 'pane.splitter_button_container';
|
|
304
313
|
const colorStyles = _ref => {
|
|
305
314
|
let {
|
|
306
315
|
theme
|
|
307
316
|
} = _ref;
|
|
308
|
-
const
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
boxShadow
|
|
312
|
-
}));
|
|
317
|
+
const backgroundColor = reactTheming.getColorV8('background', 600 , theme);
|
|
318
|
+
const boxShadow = theme.shadows.lg(`${theme.space.base}px`, `${theme.space.base * 2}px`, reactTheming.getColorV8('chromeHue', 600, theme, 0.15));
|
|
319
|
+
return styled.css(["box-shadow:", ";background-color:", ";"], boxShadow, backgroundColor);
|
|
313
320
|
};
|
|
314
|
-
const
|
|
315
|
-
const size = `${props.theme.space.base * 6}px`;
|
|
316
|
-
const display = props.splitterSize <= polished.stripUnit(polished.math(`${props.theme.shadowWidths.md} * 2 + ${size}`)) && 'none';
|
|
317
|
-
const isVertical = props.orientation === 'start' || props.orientation === 'end';
|
|
321
|
+
const positionStyles = props => {
|
|
318
322
|
let top;
|
|
319
323
|
let left;
|
|
320
324
|
let right;
|
|
321
325
|
let bottom;
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
left =
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
326
|
+
const size = getSize(props.theme);
|
|
327
|
+
const inset = `-${size / 2}px`;
|
|
328
|
+
if (props.placement === 'center' || props.splitterSize < size * 3) {
|
|
329
|
+
const center = `${props.splitterSize / 2 - size / 2}px`;
|
|
330
|
+
switch (`${props.orientation}-${props.theme.rtl ? 'rtl' : 'ltr'}`) {
|
|
331
|
+
case 'top-ltr':
|
|
332
|
+
case 'top-rtl':
|
|
333
|
+
top = inset;
|
|
334
|
+
left = center;
|
|
335
|
+
break;
|
|
336
|
+
case 'start-ltr':
|
|
337
|
+
case 'end-rtl':
|
|
338
|
+
top = center;
|
|
339
|
+
left = inset;
|
|
340
|
+
break;
|
|
341
|
+
case 'end-ltr':
|
|
342
|
+
case 'start-rtl':
|
|
343
|
+
top = center;
|
|
344
|
+
right = inset;
|
|
345
|
+
break;
|
|
346
|
+
case 'bottom-ltr':
|
|
347
|
+
case 'bottom-rtl':
|
|
348
|
+
bottom = inset;
|
|
349
|
+
right = center;
|
|
350
|
+
break;
|
|
351
|
+
}
|
|
352
|
+
} else {
|
|
353
|
+
const offset = `${size}px`;
|
|
354
|
+
switch (`${props.orientation}-${props.placement}-${props.theme.rtl ? 'rtl' : 'ltr'}`) {
|
|
355
|
+
case 'top-end-ltr':
|
|
356
|
+
case 'top-end-rtl':
|
|
357
|
+
case 'top-start-rtl':
|
|
358
|
+
top = inset;
|
|
359
|
+
right = offset;
|
|
360
|
+
break;
|
|
361
|
+
case 'bottom-end-ltr':
|
|
362
|
+
case 'bottom-end-rtl':
|
|
363
|
+
case 'bottom-start-rtl':
|
|
364
|
+
bottom = inset;
|
|
365
|
+
right = offset;
|
|
366
|
+
break;
|
|
367
|
+
case 'start-start-ltr':
|
|
368
|
+
case 'end-start-rtl':
|
|
369
|
+
top = offset;
|
|
370
|
+
left = inset;
|
|
371
|
+
break;
|
|
372
|
+
case 'start-end-ltr':
|
|
373
|
+
case 'end-end-rtl':
|
|
374
|
+
bottom = offset;
|
|
375
|
+
left = inset;
|
|
376
|
+
break;
|
|
377
|
+
case 'end-start-ltr':
|
|
378
|
+
case 'start-start-rtl':
|
|
379
|
+
top = offset;
|
|
380
|
+
right = inset;
|
|
381
|
+
break;
|
|
382
|
+
case 'end-end-ltr':
|
|
383
|
+
case 'start-end-rtl':
|
|
384
|
+
bottom = offset;
|
|
385
|
+
right = inset;
|
|
386
|
+
break;
|
|
387
|
+
case 'top-start-ltr':
|
|
388
|
+
top = inset;
|
|
389
|
+
left = offset;
|
|
390
|
+
break;
|
|
391
|
+
case 'bottom-start-ltr':
|
|
392
|
+
bottom = inset;
|
|
393
|
+
left = offset;
|
|
394
|
+
break;
|
|
339
395
|
}
|
|
340
396
|
}
|
|
341
|
-
return styled.css(["
|
|
397
|
+
return styled.css(["top:", ";right:", ";bottom:", ";left:", ";"], top, right, bottom, left);
|
|
342
398
|
};
|
|
343
|
-
const
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
399
|
+
const sizeStyles = _ref2 => {
|
|
400
|
+
let {
|
|
401
|
+
theme
|
|
402
|
+
} = _ref2;
|
|
403
|
+
const size = getSize(theme);
|
|
404
|
+
return styled.css(["border-radius:", "px;width:", "px;height:", "px;"], size, size, size);
|
|
405
|
+
};
|
|
406
|
+
const minimumSplitterSize = theme => polished.stripUnit(polished.math(`${theme.shadowWidths.md} * 2 + ${getSize(theme)}`));
|
|
407
|
+
const StyledPaneSplitterButtonContainer = styled__default.default.div.withConfig({
|
|
408
|
+
displayName: "StyledPaneSplitterButtonContainer",
|
|
409
|
+
componentId: "sc-1w84y62-0"
|
|
410
|
+
})(["display:", ";position:absolute;transition:box-shadow 0.1s ease-in-out,opacity 0.25s ease-in-out 0.1s;opacity:0;z-index:2;", ";", ";", ";&:hover,&:focus-within,", ":hover ~ &,", ":focus-visible ~ &{opacity:1;}", ";"], props => props.splitterSize <= minimumSplitterSize(props.theme) ? 'none' : undefined, positionStyles, sizeStyles, colorStyles, StyledPaneSplitter, StyledPaneSplitter, props => reactTheming.retrieveComponentStyles(COMPONENT_ID, props));
|
|
411
|
+
StyledPaneSplitterButtonContainer.defaultProps = {
|
|
354
412
|
theme: reactTheming.DEFAULT_THEME
|
|
355
413
|
};
|
|
356
414
|
|
|
@@ -371,7 +429,7 @@ const Col = React__default.default.forwardRef((_ref, ref) => {
|
|
|
371
429
|
gutters,
|
|
372
430
|
debug
|
|
373
431
|
} = useGridContext();
|
|
374
|
-
return React__default.default.createElement(StyledCol,
|
|
432
|
+
return React__default.default.createElement(StyledCol, Object.assign({
|
|
375
433
|
sizeAll: size,
|
|
376
434
|
columns: columns,
|
|
377
435
|
gutters: gutters,
|
|
@@ -413,35 +471,6 @@ Col.propTypes = {
|
|
|
413
471
|
orderXl: PropTypes__default.default.oneOfType([PropTypes__default.default.number, PropTypes__default.default.string])
|
|
414
472
|
};
|
|
415
473
|
|
|
416
|
-
const Grid = React__default.default.forwardRef((_ref, ref) => {
|
|
417
|
-
let {
|
|
418
|
-
columns,
|
|
419
|
-
debug,
|
|
420
|
-
...props
|
|
421
|
-
} = _ref;
|
|
422
|
-
const value = React.useMemo(() => ({
|
|
423
|
-
columns,
|
|
424
|
-
gutters: props.gutters,
|
|
425
|
-
debug
|
|
426
|
-
}), [columns, props.gutters, debug]);
|
|
427
|
-
return React__default.default.createElement(GridContext.Provider, {
|
|
428
|
-
value: value
|
|
429
|
-
}, React__default.default.createElement(StyledGrid, _extends({
|
|
430
|
-
debug: debug,
|
|
431
|
-
ref: ref
|
|
432
|
-
}, props)));
|
|
433
|
-
});
|
|
434
|
-
Grid.displayName = 'Grid';
|
|
435
|
-
Grid.propTypes = {
|
|
436
|
-
columns: PropTypes__default.default.oneOfType([PropTypes__default.default.number, PropTypes__default.default.string]),
|
|
437
|
-
gutters: PropTypes__default.default.oneOf(SPACE),
|
|
438
|
-
debug: PropTypes__default.default.bool
|
|
439
|
-
};
|
|
440
|
-
Grid.defaultProps = {
|
|
441
|
-
columns: 12,
|
|
442
|
-
gutters: 'md'
|
|
443
|
-
};
|
|
444
|
-
|
|
445
474
|
const Row = React__default.default.forwardRef((_ref, ref) => {
|
|
446
475
|
let {
|
|
447
476
|
wrap,
|
|
@@ -451,7 +480,7 @@ const Row = React__default.default.forwardRef((_ref, ref) => {
|
|
|
451
480
|
gutters,
|
|
452
481
|
debug
|
|
453
482
|
} = useGridContext();
|
|
454
|
-
return React__default.default.createElement(StyledRow,
|
|
483
|
+
return React__default.default.createElement(StyledRow, Object.assign({
|
|
455
484
|
gutters: gutters,
|
|
456
485
|
debug: debug,
|
|
457
486
|
wrapAll: wrap,
|
|
@@ -480,6 +509,38 @@ Row.propTypes = {
|
|
|
480
509
|
wrapXl: PropTypes__default.default.oneOf(WRAP)
|
|
481
510
|
};
|
|
482
511
|
|
|
512
|
+
const GridComponent = React__default.default.forwardRef((_ref, ref) => {
|
|
513
|
+
let {
|
|
514
|
+
columns,
|
|
515
|
+
debug,
|
|
516
|
+
...props
|
|
517
|
+
} = _ref;
|
|
518
|
+
const value = React.useMemo(() => ({
|
|
519
|
+
columns,
|
|
520
|
+
gutters: props.gutters,
|
|
521
|
+
debug
|
|
522
|
+
}), [columns, props.gutters, debug]);
|
|
523
|
+
return React__default.default.createElement(GridContext.Provider, {
|
|
524
|
+
value: value
|
|
525
|
+
}, React__default.default.createElement(StyledGrid, Object.assign({
|
|
526
|
+
debug: debug,
|
|
527
|
+
ref: ref
|
|
528
|
+
}, props)));
|
|
529
|
+
});
|
|
530
|
+
GridComponent.displayName = 'Grid';
|
|
531
|
+
GridComponent.propTypes = {
|
|
532
|
+
columns: PropTypes__default.default.oneOfType([PropTypes__default.default.number, PropTypes__default.default.string]),
|
|
533
|
+
gutters: PropTypes__default.default.oneOf(SPACE),
|
|
534
|
+
debug: PropTypes__default.default.bool
|
|
535
|
+
};
|
|
536
|
+
GridComponent.defaultProps = {
|
|
537
|
+
columns: 12,
|
|
538
|
+
gutters: 'md'
|
|
539
|
+
};
|
|
540
|
+
const Grid = GridComponent;
|
|
541
|
+
Grid.Row = Row;
|
|
542
|
+
Grid.Col = Col;
|
|
543
|
+
|
|
483
544
|
const PaneProviderContext = React.createContext({});
|
|
484
545
|
const usePaneProviderContextData = providerId => {
|
|
485
546
|
const context = React.useContext(PaneProviderContext);
|
|
@@ -707,6 +768,7 @@ const orientationToDimension = {
|
|
|
707
768
|
};
|
|
708
769
|
const SplitterComponent = React.forwardRef((_ref, ref) => {
|
|
709
770
|
let {
|
|
771
|
+
children,
|
|
710
772
|
providerId,
|
|
711
773
|
layoutKey,
|
|
712
774
|
min,
|
|
@@ -723,7 +785,6 @@ const SplitterComponent = React.forwardRef((_ref, ref) => {
|
|
|
723
785
|
const paneContext = usePaneContext();
|
|
724
786
|
const themeContext = React.useContext(styled.ThemeContext);
|
|
725
787
|
const environment = reactTheming.useDocument(themeContext);
|
|
726
|
-
const [isHovered, setIsHovered] = React.useState(false);
|
|
727
788
|
const isRow = orientationToDimension[orientation] === 'rows';
|
|
728
789
|
const separatorRef = React.useRef(null);
|
|
729
790
|
const splitterOrientation = paneToSplitterOrientation[orientation || 'end'];
|
|
@@ -765,7 +826,6 @@ const SplitterComponent = React.forwardRef((_ref, ref) => {
|
|
|
765
826
|
onClick
|
|
766
827
|
});
|
|
767
828
|
const size = isRow ? separatorRef.current?.clientWidth : separatorRef.current?.clientHeight;
|
|
768
|
-
const onMouseOver = React.useMemo(() => containerUtilities.composeEventHandlers(props.onMouseOver, event => setIsHovered(event.target === separatorRef.current)), [props.onMouseOver, separatorRef]);
|
|
769
829
|
return React__default.default.createElement(PaneSplitterContext.Provider, {
|
|
770
830
|
value: React.useMemo(() => ({
|
|
771
831
|
orientation,
|
|
@@ -776,14 +836,12 @@ const SplitterComponent = React.forwardRef((_ref, ref) => {
|
|
|
776
836
|
size,
|
|
777
837
|
isRow
|
|
778
838
|
}), [orientation, layoutKey, min, max, valueInFr, size, isRow])
|
|
779
|
-
}, React__default.default.createElement(StyledPaneSplitter,
|
|
780
|
-
isHovered: isHovered,
|
|
839
|
+
}, React__default.default.createElement(StyledPaneSplitter, Object.assign({
|
|
781
840
|
isFixed: isFixed,
|
|
782
841
|
orientation: orientation
|
|
783
842
|
}, separatorProps, props, {
|
|
784
|
-
onMouseOver: onMouseOver,
|
|
785
843
|
ref: reactMergeRefs.mergeRefs([separatorRef, ref])
|
|
786
|
-
})));
|
|
844
|
+
})), children );
|
|
787
845
|
});
|
|
788
846
|
SplitterComponent.displayName = 'Pane.Splitter';
|
|
789
847
|
SplitterComponent.propTypes = {
|
|
@@ -802,7 +860,7 @@ const ContentComponent = React.forwardRef((props, ref) => {
|
|
|
802
860
|
const {
|
|
803
861
|
isVisible
|
|
804
862
|
} = usePaneContext();
|
|
805
|
-
return React__default.default.createElement(StyledPaneContent,
|
|
863
|
+
return React__default.default.createElement(StyledPaneContent, Object.assign({
|
|
806
864
|
hidden: !isVisible,
|
|
807
865
|
ref: ref
|
|
808
866
|
}, props));
|
|
@@ -855,24 +913,27 @@ const SplitterButtonComponent = React.forwardRef((props, ref) => {
|
|
|
855
913
|
);
|
|
856
914
|
const onMouseDown = containerUtilities.composeEventHandlers(props.onMouseDown, event => event.stopPropagation()
|
|
857
915
|
);
|
|
858
|
-
return React__default.default.createElement(
|
|
916
|
+
return React__default.default.createElement(StyledPaneSplitterButtonContainer, {
|
|
917
|
+
orientation: orientation,
|
|
918
|
+
placement: placement,
|
|
919
|
+
splitterSize: size || 0
|
|
920
|
+
}, React__default.default.createElement(reactTooltips.Tooltip, {
|
|
859
921
|
content: label,
|
|
922
|
+
zIndex: 2,
|
|
860
923
|
style: {
|
|
861
924
|
cursor: 'default'
|
|
862
925
|
},
|
|
863
926
|
onMouseDown: e => e.stopPropagation()
|
|
864
|
-
}, React__default.default.createElement(StyledPaneSplitterButton,
|
|
927
|
+
}, React__default.default.createElement(StyledPaneSplitterButton, Object.assign({
|
|
865
928
|
"aria-label": label
|
|
866
929
|
}, props, {
|
|
867
|
-
placement: placement,
|
|
868
930
|
orientation: orientation,
|
|
869
931
|
isRotated: isMin,
|
|
870
|
-
splitterSize: size || 0,
|
|
871
932
|
ref: ref,
|
|
872
933
|
onClick: onClick,
|
|
873
934
|
onKeyDown: onKeyDown,
|
|
874
935
|
onMouseDown: onMouseDown
|
|
875
|
-
})));
|
|
936
|
+
}))));
|
|
876
937
|
});
|
|
877
938
|
SplitterButtonComponent.displayName = 'Pane.SplitterButton';
|
|
878
939
|
const SplitterButton = SplitterButtonComponent;
|
|
@@ -898,7 +959,7 @@ const PaneComponent = React.forwardRef((_ref, ref) => {
|
|
|
898
959
|
}), [paneId, isVisible]);
|
|
899
960
|
return React__default.default.createElement(PaneContext.Provider, {
|
|
900
961
|
value: paneContext
|
|
901
|
-
}, React__default.default.createElement(StyledPane,
|
|
962
|
+
}, React__default.default.createElement(StyledPane, Object.assign({
|
|
902
963
|
id: paneId,
|
|
903
964
|
ref: reactMergeRefs.mergeRefs([ref, observerRef])
|
|
904
965
|
}, props), children));
|
|
@@ -909,15 +970,15 @@ Pane.Content = Content;
|
|
|
909
970
|
Pane.Splitter = Splitter;
|
|
910
971
|
Pane.SplitterButton = SplitterButton;
|
|
911
972
|
|
|
912
|
-
exports.
|
|
913
|
-
exports.
|
|
914
|
-
exports.ARRAY_DIRECTION = DIRECTION;
|
|
915
|
-
exports.ARRAY_JUSTIFY_CONTENT = JUSTIFY_CONTENT;
|
|
916
|
-
exports.ARRAY_SPACE = SPACE;
|
|
917
|
-
exports.ARRAY_TEXT_ALIGN = TEXT_ALIGN;
|
|
918
|
-
exports.ARRAY_WRAP = WRAP;
|
|
973
|
+
exports.ALIGN_ITEMS = ALIGN_ITEMS;
|
|
974
|
+
exports.ALIGN_SELF = ALIGN_SELF;
|
|
919
975
|
exports.Col = Col;
|
|
976
|
+
exports.DIRECTION = DIRECTION;
|
|
920
977
|
exports.Grid = Grid;
|
|
978
|
+
exports.JUSTIFY_CONTENT = JUSTIFY_CONTENT;
|
|
921
979
|
exports.Pane = Pane;
|
|
922
980
|
exports.PaneProvider = PaneProvider;
|
|
923
981
|
exports.Row = Row;
|
|
982
|
+
exports.SPACE = SPACE;
|
|
983
|
+
exports.TEXT_ALIGN = TEXT_ALIGN;
|
|
984
|
+
exports.WRAP = WRAP;
|
|
@@ -7,6 +7,8 @@
|
|
|
7
7
|
import React from 'react';
|
|
8
8
|
import { IColProps } from '../types';
|
|
9
9
|
/**
|
|
10
|
+
* @deprecated use `Grid.Col` instead
|
|
11
|
+
*
|
|
10
12
|
* @extends HTMLAttributes<HTMLDivElement>
|
|
11
13
|
*/
|
|
12
14
|
export declare const Col: React.ForwardRefExoticComponent<IColProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -6,7 +6,13 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import React from 'react';
|
|
8
8
|
import { IGridProps } from '../types';
|
|
9
|
+
import { Row } from './Row';
|
|
10
|
+
import { Col } from './Col';
|
|
11
|
+
export declare const GridComponent: React.ForwardRefExoticComponent<IGridProps & React.RefAttributes<HTMLDivElement>>;
|
|
9
12
|
/**
|
|
10
13
|
* @extends HTMLAttributes<HTMLDivElement>
|
|
11
14
|
*/
|
|
12
|
-
export declare const Grid: React.ForwardRefExoticComponent<IGridProps & React.RefAttributes<HTMLDivElement
|
|
15
|
+
export declare const Grid: React.ForwardRefExoticComponent<IGridProps & React.RefAttributes<HTMLDivElement>> & {
|
|
16
|
+
Row: typeof Row;
|
|
17
|
+
Col: typeof Col;
|
|
18
|
+
};
|
|
@@ -7,6 +7,8 @@
|
|
|
7
7
|
import React from 'react';
|
|
8
8
|
import { IRowProps } from '../types';
|
|
9
9
|
/**
|
|
10
|
+
* @deprecated use `Grid.Row` instead
|
|
11
|
+
*
|
|
10
12
|
* @extends HTMLAttributes<HTMLDivElement>
|
|
11
13
|
*/
|
|
12
14
|
export declare const Row: React.ForwardRefExoticComponent<IRowProps & React.RefAttributes<HTMLDivElement>>;
|
package/dist/typings/index.d.ts
CHANGED
|
@@ -9,4 +9,4 @@ export { Grid } from './elements/Grid';
|
|
|
9
9
|
export { Row } from './elements/Row';
|
|
10
10
|
export { PaneProvider } from './elements/pane/PaneProvider';
|
|
11
11
|
export { Pane } from './elements/pane/Pane';
|
|
12
|
-
export { ALIGN_ITEMS
|
|
12
|
+
export { ALIGN_ITEMS, ALIGN_SELF, DIRECTION, JUSTIFY_CONTENT, TEXT_ALIGN, SPACE, WRAP, type IPaneProviderProps, type ISplitterProps, type ISplitterButtonProps, type IColProps, type IGridProps, type IRowProps } from './types';
|