@zendeskgarden/react-grid 8.57.1 → 8.58.0
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 +358 -568
- package/dist/index.esm.js +358 -568
- package/package.json +5 -5
package/dist/index.cjs.js
CHANGED
|
@@ -27,179 +27,41 @@ var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
|
27
27
|
var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
|
|
28
28
|
var mergeRefs__default = /*#__PURE__*/_interopDefaultLegacy(mergeRefs);
|
|
29
29
|
|
|
30
|
-
function ownKeys(object, enumerableOnly) {
|
|
31
|
-
var keys = Object.keys(object);
|
|
32
|
-
|
|
33
|
-
if (Object.getOwnPropertySymbols) {
|
|
34
|
-
var symbols = Object.getOwnPropertySymbols(object);
|
|
35
|
-
enumerableOnly && (symbols = symbols.filter(function (sym) {
|
|
36
|
-
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
37
|
-
})), keys.push.apply(keys, symbols);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
return keys;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
function _objectSpread2(target) {
|
|
44
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
45
|
-
var source = null != arguments[i] ? arguments[i] : {};
|
|
46
|
-
i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
|
|
47
|
-
_defineProperty(target, key, source[key]);
|
|
48
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
|
|
49
|
-
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
return target;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
function _defineProperty(obj, key, value) {
|
|
57
|
-
if (key in obj) {
|
|
58
|
-
Object.defineProperty(obj, key, {
|
|
59
|
-
value: value,
|
|
60
|
-
enumerable: true,
|
|
61
|
-
configurable: true,
|
|
62
|
-
writable: true
|
|
63
|
-
});
|
|
64
|
-
} else {
|
|
65
|
-
obj[key] = value;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
return obj;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
30
|
function _extends() {
|
|
72
31
|
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
73
32
|
for (var i = 1; i < arguments.length; i++) {
|
|
74
33
|
var source = arguments[i];
|
|
75
|
-
|
|
76
34
|
for (var key in source) {
|
|
77
35
|
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
78
36
|
target[key] = source[key];
|
|
79
37
|
}
|
|
80
38
|
}
|
|
81
39
|
}
|
|
82
|
-
|
|
83
40
|
return target;
|
|
84
41
|
};
|
|
85
42
|
return _extends.apply(this, arguments);
|
|
86
43
|
}
|
|
87
44
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
return target;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
function _objectWithoutProperties(source, excluded) {
|
|
104
|
-
if (source == null) return {};
|
|
105
|
-
|
|
106
|
-
var target = _objectWithoutPropertiesLoose(source, excluded);
|
|
107
|
-
|
|
108
|
-
var key, i;
|
|
109
|
-
|
|
110
|
-
if (Object.getOwnPropertySymbols) {
|
|
111
|
-
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
112
|
-
|
|
113
|
-
for (i = 0; i < sourceSymbolKeys.length; i++) {
|
|
114
|
-
key = sourceSymbolKeys[i];
|
|
115
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
116
|
-
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
117
|
-
target[key] = source[key];
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
return target;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
function _slicedToArray(arr, i) {
|
|
125
|
-
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
function _arrayWithHoles(arr) {
|
|
129
|
-
if (Array.isArray(arr)) return arr;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
function _iterableToArrayLimit(arr, i) {
|
|
133
|
-
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
134
|
-
|
|
135
|
-
if (_i == null) return;
|
|
136
|
-
var _arr = [];
|
|
137
|
-
var _n = true;
|
|
138
|
-
var _d = false;
|
|
139
|
-
|
|
140
|
-
var _s, _e;
|
|
141
|
-
|
|
142
|
-
try {
|
|
143
|
-
for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
|
|
144
|
-
_arr.push(_s.value);
|
|
145
|
-
|
|
146
|
-
if (i && _arr.length === i) break;
|
|
147
|
-
}
|
|
148
|
-
} catch (err) {
|
|
149
|
-
_d = true;
|
|
150
|
-
_e = err;
|
|
151
|
-
} finally {
|
|
152
|
-
try {
|
|
153
|
-
if (!_n && _i["return"] != null) _i["return"]();
|
|
154
|
-
} finally {
|
|
155
|
-
if (_d) throw _e;
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
return _arr;
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
function _unsupportedIterableToArray(o, minLen) {
|
|
163
|
-
if (!o) return;
|
|
164
|
-
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
165
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
166
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
167
|
-
if (n === "Map" || n === "Set") return Array.from(o);
|
|
168
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
function _arrayLikeToArray(arr, len) {
|
|
172
|
-
if (len == null || len > arr.length) len = arr.length;
|
|
173
|
-
|
|
174
|
-
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
175
|
-
|
|
176
|
-
return arr2;
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
function _nonIterableRest() {
|
|
180
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
var ALIGN_ITEMS = ['start', 'end', 'center', 'baseline', 'stretch'];
|
|
184
|
-
var ALIGN_SELF = ['auto'].concat(ALIGN_ITEMS);
|
|
185
|
-
var DIRECTION = ['row', 'row-reverse', 'column', 'column-reverse'];
|
|
186
|
-
var JUSTIFY_CONTENT = ['start', 'end', 'center', 'between', 'around'];
|
|
187
|
-
var TEXT_ALIGN = ['start', 'end', 'center', 'justify'];
|
|
188
|
-
var SPACE = [false, 'xxs', 'xs', 'sm', 'md', 'lg', 'xl', 'xxl'];
|
|
189
|
-
var WRAP = ['nowrap', 'wrap', 'wrap-reverse'];
|
|
190
|
-
var ORIENTATION = ['top', 'bottom', 'start', 'end'];
|
|
191
|
-
|
|
192
|
-
var COMPONENT_ID$6 = 'grid.col';
|
|
193
|
-
var colorStyles$4 = function colorStyles(props) {
|
|
194
|
-
var backgroundColor = reactTheming.getColor('primaryHue', 600, props.theme, 0.1);
|
|
45
|
+
const ALIGN_ITEMS = ['start', 'end', 'center', 'baseline', 'stretch'];
|
|
46
|
+
const ALIGN_SELF = ['auto', ...ALIGN_ITEMS];
|
|
47
|
+
const DIRECTION = ['row', 'row-reverse', 'column', 'column-reverse'];
|
|
48
|
+
const JUSTIFY_CONTENT = ['start', 'end', 'center', 'between', 'around'];
|
|
49
|
+
const TEXT_ALIGN = ['start', 'end', 'center', 'justify'];
|
|
50
|
+
const SPACE = [false, 'xxs', 'xs', 'sm', 'md', 'lg', 'xl', 'xxl'];
|
|
51
|
+
const WRAP = ['nowrap', 'wrap', 'wrap-reverse'];
|
|
52
|
+
const ORIENTATION = ['top', 'bottom', 'start', 'end'];
|
|
53
|
+
|
|
54
|
+
const COMPONENT_ID$6 = 'grid.col';
|
|
55
|
+
const colorStyles$4 = props => {
|
|
56
|
+
const backgroundColor = reactTheming.getColor('primaryHue', 600, props.theme, 0.1);
|
|
195
57
|
return styled.css(["background-clip:content-box;background-color:", ";"], backgroundColor);
|
|
196
58
|
};
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
59
|
+
const flexStyles$1 = (size, alignSelf, textAlign, offset, order, props) => {
|
|
60
|
+
const margin = offset && `${polished.math(`${offset} / ${props.columns} * 100`)}%`;
|
|
61
|
+
let flexBasis;
|
|
62
|
+
let flexGrow;
|
|
63
|
+
let maxWidth;
|
|
64
|
+
let width;
|
|
203
65
|
if (typeof size === 'boolean') {
|
|
204
66
|
flexBasis = 0;
|
|
205
67
|
flexGrow = 1;
|
|
@@ -210,11 +72,11 @@ var flexStyles$1 = function flexStyles(size, alignSelf, textAlign, offset, order
|
|
|
210
72
|
maxWidth = '100%';
|
|
211
73
|
width = 'auto';
|
|
212
74
|
} else if (size !== undefined) {
|
|
213
|
-
flexBasis =
|
|
75
|
+
flexBasis = `${polished.math(`${size} / ${props.columns} * 100`)}%`;
|
|
214
76
|
flexGrow = 0;
|
|
215
77
|
maxWidth = flexBasis;
|
|
216
78
|
}
|
|
217
|
-
|
|
79
|
+
let horizontalAlign;
|
|
218
80
|
if (textAlign === 'start') {
|
|
219
81
|
horizontalAlign = props.theme.rtl ? 'right' : 'left';
|
|
220
82
|
} else if (textAlign === 'end') {
|
|
@@ -222,192 +84,144 @@ var flexStyles$1 = function flexStyles(size, alignSelf, textAlign, offset, order
|
|
|
222
84
|
} else {
|
|
223
85
|
horizontalAlign = textAlign;
|
|
224
86
|
}
|
|
225
|
-
|
|
87
|
+
let flexOrder;
|
|
226
88
|
if (order === 'first') {
|
|
227
89
|
flexOrder = -1;
|
|
228
90
|
} else if (order === 'last') {
|
|
229
|
-
flexOrder = polished.math(
|
|
91
|
+
flexOrder = polished.math(`${props.columns} + 1`);
|
|
230
92
|
} else {
|
|
231
93
|
flexOrder = order;
|
|
232
94
|
}
|
|
233
|
-
return styled.css(["flex-basis:", ";flex-grow:", ";flex-shrink:", ";align-self:", ";order:", ";margin-", ":", ";width:", ";max-width:", ";text-align:", ";"], flexBasis, flexGrow, size && 0, alignSelf === 'start' || alignSelf === 'end' ?
|
|
95
|
+
return styled.css(["flex-basis:", ";flex-grow:", ";flex-shrink:", ";align-self:", ";order:", ";margin-", ":", ";width:", ";max-width:", ";text-align:", ";"], flexBasis, flexGrow, size && 0, alignSelf === 'start' || alignSelf === 'end' ? `flex-${alignSelf}` : alignSelf, flexOrder, props.theme.rtl ? 'right' : 'left', margin, width, maxWidth, horizontalAlign);
|
|
234
96
|
};
|
|
235
|
-
|
|
97
|
+
const mediaStyles$1 = (minWidth, size, alignSelf, textAlign, offset, order, props) => {
|
|
236
98
|
return styled.css(["@media (min-width:", "){", ";}"], minWidth, flexStyles$1(size, alignSelf, textAlign, offset, order, props));
|
|
237
99
|
};
|
|
238
|
-
|
|
239
|
-
|
|
100
|
+
const sizeStyles$4 = props => {
|
|
101
|
+
const padding = props.gutters ? polished.math(`${props.theme.space[props.gutters]} / 2`) : 0;
|
|
240
102
|
return styled.css(["padding-right:", ";padding-left:", ";"], padding, padding);
|
|
241
103
|
};
|
|
242
|
-
|
|
104
|
+
const StyledCol = styled__default["default"].div.attrs({
|
|
243
105
|
'data-garden-id': COMPONENT_ID$6,
|
|
244
|
-
'data-garden-version': '8.
|
|
106
|
+
'data-garden-version': '8.58.0'
|
|
245
107
|
}).withConfig({
|
|
246
108
|
displayName: "StyledCol",
|
|
247
109
|
componentId: "sc-inuw62-0"
|
|
248
|
-
})(["box-sizing:border-box;width:100%;", ";", ";", ";", ";", ";", ";", ";", ";", ";"],
|
|
249
|
-
return 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);
|
|
250
|
-
}, function (props) {
|
|
251
|
-
return sizeStyles$4(props);
|
|
252
|
-
}, function (props) {
|
|
253
|
-
return props.debug && colorStyles$4(props);
|
|
254
|
-
}, function (props) {
|
|
255
|
-
return mediaStyles$1(props.theme.breakpoints.xs, props.xs, props.alignSelfXs, props.textAlignXs, props.offsetXs, props.orderXs, props);
|
|
256
|
-
}, function (props) {
|
|
257
|
-
return mediaStyles$1(props.theme.breakpoints.sm, props.sm, props.alignSelfSm, props.textAlignSm, props.offsetSm, props.orderSm, props);
|
|
258
|
-
}, function (props) {
|
|
259
|
-
return mediaStyles$1(props.theme.breakpoints.md, props.md, props.alignSelfMd, props.textAlignMd, props.offsetMd, props.orderMd, props);
|
|
260
|
-
}, function (props) {
|
|
261
|
-
return mediaStyles$1(props.theme.breakpoints.lg, props.lg, props.alignSelfLg, props.textAlignLg, props.offsetLg, props.orderLg, props);
|
|
262
|
-
}, function (props) {
|
|
263
|
-
return mediaStyles$1(props.theme.breakpoints.xl, props.xl, props.alignSelfXl, props.textAlignXl, props.offsetXl, props.orderXl, props);
|
|
264
|
-
}, function (props) {
|
|
265
|
-
return reactTheming.retrieveComponentStyles(COMPONENT_ID$6, props);
|
|
266
|
-
});
|
|
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$4(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$6, props));
|
|
267
111
|
StyledCol.defaultProps = {
|
|
268
112
|
columns: 12,
|
|
269
113
|
theme: reactTheming.DEFAULT_THEME
|
|
270
114
|
};
|
|
271
115
|
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
116
|
+
const COMPONENT_ID$5 = 'grid.grid';
|
|
117
|
+
const colorStyles$3 = props => {
|
|
118
|
+
const borderColor = reactTheming.getColor(props.theme.palette.crimson, 400, props.theme, 0.5);
|
|
119
|
+
const borderWidth = polished.math(`${props.theme.borderWidths.sm} * 2`);
|
|
276
120
|
return styled.css(["box-shadow:-", " 0 0 0 ", ",", " 0 0 0 ", ";"], borderWidth, borderColor, borderWidth, borderColor);
|
|
277
121
|
};
|
|
278
|
-
|
|
279
|
-
|
|
122
|
+
const sizeStyles$3 = props => {
|
|
123
|
+
const padding = props.gutters ? polished.math(`${props.theme.space[props.gutters]} / 2`) : 0;
|
|
280
124
|
return styled.css(["padding-right:", ";padding-left:", ";"], padding, padding);
|
|
281
125
|
};
|
|
282
|
-
|
|
126
|
+
const StyledGrid = styled__default["default"].div.attrs({
|
|
283
127
|
'data-garden-id': COMPONENT_ID$5,
|
|
284
|
-
'data-garden-version': '8.
|
|
128
|
+
'data-garden-version': '8.58.0'
|
|
285
129
|
}).withConfig({
|
|
286
130
|
displayName: "StyledGrid",
|
|
287
131
|
componentId: "sc-oxgg5i-0"
|
|
288
|
-
})(["direction:", ";margin-right:auto;margin-left:auto;width:100%;box-sizing:border-box;", ";", ";", ";"],
|
|
289
|
-
return props.theme.rtl && 'rtl';
|
|
290
|
-
}, function (props) {
|
|
291
|
-
return sizeStyles$3(props);
|
|
292
|
-
}, function (props) {
|
|
293
|
-
return props.debug && colorStyles$3(props);
|
|
294
|
-
}, function (props) {
|
|
295
|
-
return reactTheming.retrieveComponentStyles(COMPONENT_ID$5, props);
|
|
296
|
-
});
|
|
132
|
+
})(["direction:", ";margin-right:auto;margin-left:auto;width:100%;box-sizing:border-box;", ";", ";", ";"], props => props.theme.rtl && 'rtl', props => sizeStyles$3(props), props => props.debug && colorStyles$3(props), props => reactTheming.retrieveComponentStyles(COMPONENT_ID$5, props));
|
|
297
133
|
StyledGrid.defaultProps = {
|
|
298
134
|
gutters: 'md',
|
|
299
135
|
theme: reactTheming.DEFAULT_THEME
|
|
300
136
|
};
|
|
301
137
|
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
138
|
+
const COMPONENT_ID$4 = 'grid.row';
|
|
139
|
+
const colorStyles$2 = props => {
|
|
140
|
+
const borderColor = reactTheming.getColor(props.theme.palette.mint, 600, props.theme, 0.5);
|
|
141
|
+
const borderWidth = props.theme.borderWidths.sm;
|
|
306
142
|
return styled.css(["box-shadow:inset 0 ", " 0 0 ", ",inset 0 -", " 0 0 ", ";"], borderWidth, borderColor, borderWidth, borderColor);
|
|
307
143
|
};
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
144
|
+
const flexStyles = (alignItems, justifyContent, wrap) => {
|
|
145
|
+
let flexAlignItems;
|
|
146
|
+
let flexJustifyContent;
|
|
311
147
|
if (alignItems === 'start' || alignItems === 'end') {
|
|
312
|
-
flexAlignItems =
|
|
148
|
+
flexAlignItems = `flex-${alignItems}`;
|
|
313
149
|
} else {
|
|
314
150
|
flexAlignItems = alignItems;
|
|
315
151
|
}
|
|
316
152
|
if (justifyContent === 'start' || justifyContent === 'end') {
|
|
317
|
-
flexJustifyContent =
|
|
153
|
+
flexJustifyContent = `flex-${justifyContent}`;
|
|
318
154
|
} else if (justifyContent === 'between' || justifyContent === 'around') {
|
|
319
|
-
flexJustifyContent =
|
|
155
|
+
flexJustifyContent = `space-${justifyContent}`;
|
|
320
156
|
} else {
|
|
321
157
|
flexJustifyContent = justifyContent;
|
|
322
158
|
}
|
|
323
159
|
return styled.css(["flex-wrap:", ";align-items:", ";justify-content:", ";"], wrap, flexAlignItems, flexJustifyContent);
|
|
324
160
|
};
|
|
325
|
-
|
|
161
|
+
const mediaStyles = (minWidth, alignItems, justifyContent, wrap) => {
|
|
326
162
|
return styled.css(["@media (min-width:", "){", ";}"], minWidth, flexStyles(alignItems, justifyContent, wrap));
|
|
327
163
|
};
|
|
328
|
-
|
|
329
|
-
|
|
164
|
+
const sizeStyles$2 = props => {
|
|
165
|
+
const margin = props.gutters ? polished.math(`${props.theme.space[props.gutters]} / 2`) : 0;
|
|
330
166
|
return styled.css(["margin-right:-", ";margin-left:-", ";"], margin, margin);
|
|
331
167
|
};
|
|
332
|
-
|
|
168
|
+
const StyledRow = styled__default["default"].div.attrs({
|
|
333
169
|
'data-garden-id': COMPONENT_ID$4,
|
|
334
|
-
'data-garden-version': '8.
|
|
170
|
+
'data-garden-version': '8.58.0'
|
|
335
171
|
}).withConfig({
|
|
336
172
|
displayName: "StyledRow",
|
|
337
173
|
componentId: "sc-xjsdg1-0"
|
|
338
|
-
})(["display:flex;box-sizing:border-box;", " ", ";", ";", ";", ";", ";", ";", ";", ";"],
|
|
339
|
-
return flexStyles(props.alignItems, props.justifyContent, props.wrapAll);
|
|
340
|
-
}, function (props) {
|
|
341
|
-
return sizeStyles$2(props);
|
|
342
|
-
}, function (props) {
|
|
343
|
-
return props.debug && colorStyles$2(props);
|
|
344
|
-
}, function (props) {
|
|
345
|
-
return mediaStyles(props.theme.breakpoints.xs, props.alignItemsXs, props.justifyContentXs, props.wrapXs);
|
|
346
|
-
}, function (props) {
|
|
347
|
-
return mediaStyles(props.theme.breakpoints.sm, props.alignItemsSm, props.justifyContentSm, props.wrapSm);
|
|
348
|
-
}, function (props) {
|
|
349
|
-
return mediaStyles(props.theme.breakpoints.md, props.alignItemsMd, props.justifyContentMd, props.wrapMd);
|
|
350
|
-
}, function (props) {
|
|
351
|
-
return mediaStyles(props.theme.breakpoints.lg, props.alignItemsLg, props.justifyContentLg, props.wrapLg);
|
|
352
|
-
}, function (props) {
|
|
353
|
-
return mediaStyles(props.theme.breakpoints.xl, props.alignItemsXl, props.justifyContentXl, props.wrapXl);
|
|
354
|
-
}, function (props) {
|
|
355
|
-
return reactTheming.retrieveComponentStyles(COMPONENT_ID$4, props);
|
|
356
|
-
});
|
|
174
|
+
})(["display:flex;box-sizing:border-box;", " ", ";", ";", ";", ";", ";", ";", ";", ";"], props => flexStyles(props.alignItems, props.justifyContent, props.wrapAll), props => sizeStyles$2(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$4, props));
|
|
357
175
|
StyledRow.defaultProps = {
|
|
358
176
|
wrapAll: 'wrap',
|
|
359
177
|
theme: reactTheming.DEFAULT_THEME
|
|
360
178
|
};
|
|
361
179
|
|
|
362
|
-
|
|
363
|
-
|
|
180
|
+
const COMPONENT_ID$3 = 'pane';
|
|
181
|
+
const StyledPane = styled__default["default"].div.attrs({
|
|
364
182
|
'data-garden-id': COMPONENT_ID$3,
|
|
365
|
-
'data-garden-version': '8.
|
|
183
|
+
'data-garden-version': '8.58.0'
|
|
366
184
|
}).withConfig({
|
|
367
185
|
displayName: "StyledPane",
|
|
368
186
|
componentId: "sc-1ltjst7-0"
|
|
369
|
-
})(["position:relative;min-width:0;min-height:0;", ";"],
|
|
370
|
-
return reactTheming.retrieveComponentStyles(COMPONENT_ID$3, props);
|
|
371
|
-
});
|
|
187
|
+
})(["position:relative;min-width:0;min-height:0;", ";"], props => reactTheming.retrieveComponentStyles(COMPONENT_ID$3, props));
|
|
372
188
|
StyledPane.defaultProps = {
|
|
373
189
|
theme: reactTheming.DEFAULT_THEME
|
|
374
190
|
};
|
|
375
191
|
|
|
376
|
-
|
|
377
|
-
|
|
192
|
+
const COMPONENT_ID$2 = 'pane.content';
|
|
193
|
+
const StyledPaneContent = styled__default["default"].div.attrs({
|
|
378
194
|
'data-garden-id': COMPONENT_ID$2,
|
|
379
|
-
'data-garden-version': '8.
|
|
195
|
+
'data-garden-version': '8.58.0'
|
|
380
196
|
}).withConfig({
|
|
381
197
|
displayName: "StyledPaneContent",
|
|
382
198
|
componentId: "sc-1b38mbh-0"
|
|
383
|
-
})(["height:100%;overflow:auto;", ";"],
|
|
384
|
-
return reactTheming.retrieveComponentStyles(COMPONENT_ID$2, props);
|
|
385
|
-
});
|
|
199
|
+
})(["height:100%;overflow:auto;", ";"], props => reactTheming.retrieveComponentStyles(COMPONENT_ID$2, props));
|
|
386
200
|
StyledPaneContent.defaultProps = {
|
|
387
201
|
theme: reactTheming.DEFAULT_THEME
|
|
388
202
|
};
|
|
389
203
|
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
204
|
+
const COMPONENT_ID$1 = 'pane.splitter';
|
|
205
|
+
const colorStyles$1 = props => {
|
|
206
|
+
const color = reactTheming.getColor('neutralHue', 300, props.theme);
|
|
207
|
+
const hoverColor = reactTheming.getColor('primaryHue', 600, props.theme);
|
|
208
|
+
const activeColor = reactTheming.getColor('primaryHue', 800, props.theme);
|
|
209
|
+
const boxShadow = props.theme.shadows.md(polished.rgba(hoverColor, 0.35));
|
|
396
210
|
return styled.css(["&::before{background-color:", ";}&:hover::before{background-color:", ";}&[data-garden-focus-visible]::before{box-shadow:", ";background-color:", ";}&:active::before{background-color:", ";}"], color, props.isHovered && hoverColor, boxShadow, hoverColor, props.isHovered && activeColor);
|
|
397
211
|
};
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
212
|
+
const sizeStyles$1 = props => {
|
|
213
|
+
const size = polished.math(`${props.theme.shadowWidths.md} * 2`);
|
|
214
|
+
const separatorSize = polished.math(`${props.theme.borderWidths.sm} * 2`);
|
|
215
|
+
const offset = polished.math(`-${size} / 2`);
|
|
216
|
+
let cursor;
|
|
217
|
+
let top;
|
|
218
|
+
let right;
|
|
219
|
+
let left;
|
|
220
|
+
let bottom;
|
|
221
|
+
let width;
|
|
222
|
+
let height;
|
|
223
|
+
let separatorWidth;
|
|
224
|
+
let separatorHeight;
|
|
411
225
|
switch (props.orientation) {
|
|
412
226
|
case 'top':
|
|
413
227
|
cursor = 'row-resize';
|
|
@@ -453,25 +267,23 @@ var sizeStyles$1 = function sizeStyles(props) {
|
|
|
453
267
|
}
|
|
454
268
|
break;
|
|
455
269
|
}
|
|
456
|
-
|
|
270
|
+
const dimensionProperty = width === '100%' ? 'height' : 'width';
|
|
457
271
|
return styled.css(["top:", ";right:", ";bottom:", ";left:", ";cursor:", ";width:", ";height:", ";&::before{width:", ";height:", ";}&:hover::before{", ":", ";}&[data-garden-focus-visible]::before,&:focus::before{", ":", ";}&[data-garden-focus-visible]::before{border-radius:", ";}"], top, right, bottom, left, cursor, width, height, separatorWidth, separatorHeight, dimensionProperty, props.isHovered && separatorSize, dimensionProperty, separatorSize, props.theme.borderRadii.md);
|
|
458
272
|
};
|
|
459
|
-
|
|
273
|
+
const StyledPaneSplitter = styled__default["default"].div.attrs({
|
|
460
274
|
'data-garden-id': COMPONENT_ID$1,
|
|
461
|
-
'data-garden-version': '8.
|
|
275
|
+
'data-garden-version': '8.58.0'
|
|
462
276
|
}).withConfig({
|
|
463
277
|
displayName: "StyledPaneSplitter",
|
|
464
278
|
componentId: "sc-jylemn-0"
|
|
465
|
-
})(["display:flex;position:absolute;align-items:center;justify-content:center;z-index:1;user-select:none;", ";&:focus{outline:none;}&::before{position:absolute;transition:box-shadow 0.1s ease-in-out,background-color 0.25s ease-in-out;z-index:-1;content:'';}", ";", ";"], sizeStyles$1, colorStyles$1,
|
|
466
|
-
return reactTheming.retrieveComponentStyles(COMPONENT_ID$1, props);
|
|
467
|
-
});
|
|
279
|
+
})(["display:flex;position:absolute;align-items:center;justify-content:center;z-index:1;user-select:none;", ";&:focus{outline:none;}&::before{position:absolute;transition:box-shadow 0.1s ease-in-out,background-color 0.25s ease-in-out;z-index:-1;content:'';}", ";", ";"], sizeStyles$1, colorStyles$1, props => reactTheming.retrieveComponentStyles(COMPONENT_ID$1, props));
|
|
468
280
|
StyledPaneSplitter.defaultProps = {
|
|
469
281
|
theme: reactTheming.DEFAULT_THEME
|
|
470
282
|
};
|
|
471
283
|
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
284
|
+
const COMPONENT_ID = 'pane.splitter_button';
|
|
285
|
+
const transformStyles = props => {
|
|
286
|
+
let degrees = 0;
|
|
475
287
|
if (props.isRotated) {
|
|
476
288
|
degrees = props.theme.rtl ? -180 : 180;
|
|
477
289
|
}
|
|
@@ -484,21 +296,23 @@ var transformStyles = function transformStyles(props) {
|
|
|
484
296
|
}
|
|
485
297
|
return styled.css(["& > svg{transform:rotate(", "deg);}"], degrees);
|
|
486
298
|
};
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
299
|
+
const colorStyles = _ref => {
|
|
300
|
+
let {
|
|
301
|
+
theme
|
|
302
|
+
} = _ref;
|
|
303
|
+
const boxShadow = theme.shadows.lg(`${theme.space.base}px`, `${theme.space.base * 2}px`, reactTheming.getColor('chromeHue', 600, theme, 0.15));
|
|
304
|
+
const focusBoxShadow = theme.shadows.md(reactTheming.getColor('primaryHue', 600, theme, 0.35));
|
|
491
305
|
return styled.css(["box-shadow:", ";&[data-garden-focus-visible]{box-shadow:", ",", ";}"], boxShadow, focusBoxShadow, boxShadow);
|
|
492
306
|
};
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
if (props.splitterSize >= polished.stripUnit(polished.math(
|
|
307
|
+
const sizeStyles = props => {
|
|
308
|
+
const size = `${props.theme.space.base * 6}px`;
|
|
309
|
+
const display = props.splitterSize <= polished.stripUnit(polished.math(`${props.theme.shadowWidths.md} * 2 + ${size}`)) && 'none';
|
|
310
|
+
const isVertical = props.orientation === 'start' || props.orientation === 'end';
|
|
311
|
+
let top;
|
|
312
|
+
let left;
|
|
313
|
+
let right;
|
|
314
|
+
let bottom;
|
|
315
|
+
if (props.splitterSize >= polished.stripUnit(polished.math(`${size} * 3`))) {
|
|
502
316
|
if (props.placement === 'start') {
|
|
503
317
|
if (isVertical) {
|
|
504
318
|
top = size;
|
|
@@ -519,39 +333,37 @@ var sizeStyles = function sizeStyles(props) {
|
|
|
519
333
|
}
|
|
520
334
|
return styled.css(["display:", ";top:", ";right:", ";bottom:", ";left:", ";width:", ";min-width:", ";height:", ";"], display, top, right, bottom, left, size, size, size);
|
|
521
335
|
};
|
|
522
|
-
|
|
336
|
+
const StyledPaneSplitterButton = styled__default["default"](reactButtons.ChevronButton).attrs({
|
|
523
337
|
'data-garden-id': COMPONENT_ID,
|
|
524
|
-
'data-garden-version': '8.
|
|
338
|
+
'data-garden-version': '8.58.0',
|
|
525
339
|
isBasic: true,
|
|
526
340
|
isPill: true,
|
|
527
341
|
size: 'small'
|
|
528
342
|
}).withConfig({
|
|
529
343
|
displayName: "StyledPaneSplitterButton",
|
|
530
344
|
componentId: "sc-zh032e-0"
|
|
531
|
-
})(["position:absolute;transition:background-color 0.25s ease-in-out,opacity 0.25s ease-in-out 0.1s;opacity:0;&[data-garden-focus-visible],", ":hover &,", "[data-garden-focus-visible] &{opacity:1;}", ";", ";", ";&::before{position:absolute;z-index:-1;background-color:", ";width:100%;height:100%;content:'';}", ";"], StyledPaneSplitter, StyledPaneSplitter, sizeStyles, transformStyles, colorStyles,
|
|
532
|
-
return props.theme.colors.background;
|
|
533
|
-
}, function (props) {
|
|
534
|
-
return reactTheming.retrieveComponentStyles(COMPONENT_ID, props);
|
|
535
|
-
});
|
|
345
|
+
})(["position:absolute;transition:background-color 0.25s ease-in-out,opacity 0.25s ease-in-out 0.1s;opacity:0;&[data-garden-focus-visible],", ":hover &,", "[data-garden-focus-visible] &{opacity:1;}", ";", ";", ";&::before{position:absolute;z-index:-1;background-color:", ";width:100%;height:100%;content:'';}", ";"], StyledPaneSplitter, StyledPaneSplitter, sizeStyles, transformStyles, colorStyles, props => props.theme.colors.background, props => reactTheming.retrieveComponentStyles(COMPONENT_ID, props));
|
|
536
346
|
StyledPaneSplitterButton.defaultProps = {
|
|
537
347
|
theme: reactTheming.DEFAULT_THEME
|
|
538
348
|
};
|
|
539
349
|
|
|
540
|
-
|
|
350
|
+
const GridContext = React.createContext({
|
|
541
351
|
gutters: 'md'
|
|
542
352
|
});
|
|
543
|
-
|
|
353
|
+
const useGridContext = () => {
|
|
544
354
|
return React.useContext(GridContext);
|
|
545
355
|
};
|
|
546
356
|
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
357
|
+
const Col = React__default["default"].forwardRef((_ref, ref) => {
|
|
358
|
+
let {
|
|
359
|
+
size,
|
|
360
|
+
...props
|
|
361
|
+
} = _ref;
|
|
362
|
+
const {
|
|
363
|
+
columns,
|
|
364
|
+
gutters,
|
|
365
|
+
debug
|
|
366
|
+
} = useGridContext();
|
|
555
367
|
return React__default["default"].createElement(StyledCol, _extends({
|
|
556
368
|
sizeAll: size,
|
|
557
369
|
columns: columns,
|
|
@@ -594,18 +406,17 @@ Col.propTypes = {
|
|
|
594
406
|
orderXl: PropTypes__default["default"].oneOfType([PropTypes__default["default"].number, PropTypes__default["default"].string])
|
|
595
407
|
};
|
|
596
408
|
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
}, [columns, props.gutters, debug]);
|
|
409
|
+
const Grid = React__default["default"].forwardRef((_ref, ref) => {
|
|
410
|
+
let {
|
|
411
|
+
columns,
|
|
412
|
+
debug,
|
|
413
|
+
...props
|
|
414
|
+
} = _ref;
|
|
415
|
+
const value = React.useMemo(() => ({
|
|
416
|
+
columns,
|
|
417
|
+
gutters: props.gutters,
|
|
418
|
+
debug
|
|
419
|
+
}), [columns, props.gutters, debug]);
|
|
609
420
|
return React__default["default"].createElement(GridContext.Provider, {
|
|
610
421
|
value: value
|
|
611
422
|
}, React__default["default"].createElement(StyledGrid, _extends({
|
|
@@ -624,13 +435,15 @@ Grid.defaultProps = {
|
|
|
624
435
|
gutters: 'md'
|
|
625
436
|
};
|
|
626
437
|
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
438
|
+
const Row = React__default["default"].forwardRef((_ref, ref) => {
|
|
439
|
+
let {
|
|
440
|
+
wrap,
|
|
441
|
+
...props
|
|
442
|
+
} = _ref;
|
|
443
|
+
const {
|
|
444
|
+
gutters,
|
|
445
|
+
debug
|
|
446
|
+
} = useGridContext();
|
|
634
447
|
return React__default["default"].createElement(StyledRow, _extends({
|
|
635
448
|
gutters: gutters,
|
|
636
449
|
debug: debug,
|
|
@@ -660,197 +473,184 @@ Row.propTypes = {
|
|
|
660
473
|
wrapXl: PropTypes__default["default"].oneOf(WRAP)
|
|
661
474
|
};
|
|
662
475
|
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
476
|
+
const PaneProviderContext = React.createContext({});
|
|
477
|
+
const usePaneProviderContextData = providerId => {
|
|
478
|
+
const context = React.useContext(PaneProviderContext);
|
|
479
|
+
const id = providerId || context.providerId;
|
|
667
480
|
return id && context.contextData ? context.contextData[id] : undefined;
|
|
668
481
|
};
|
|
669
|
-
|
|
670
|
-
return React.useContext(PaneProviderContext);
|
|
671
|
-
};
|
|
482
|
+
const usePaneProviderContext = () => React.useContext(PaneProviderContext);
|
|
672
483
|
|
|
673
|
-
|
|
484
|
+
const getPixelsPerFr = (totalFrs, totalDimension) => {
|
|
674
485
|
return totalDimension / totalFrs;
|
|
675
486
|
};
|
|
676
|
-
|
|
677
|
-
return Object.entries(values).reduce(
|
|
678
|
-
|
|
679
|
-
key = _ref2[0],
|
|
680
|
-
value = _ref2[1];
|
|
487
|
+
const convertToPixels = (values, pixelsPerFr) => {
|
|
488
|
+
return Object.entries(values).reduce((prev, _ref) => {
|
|
489
|
+
let [key, value] = _ref;
|
|
681
490
|
prev[key] = value * pixelsPerFr;
|
|
682
491
|
return prev;
|
|
683
492
|
}, {});
|
|
684
493
|
};
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
setColumnState = _useState4[1];
|
|
704
|
-
var rowsTrack = isControlled ? rowValues : rowState;
|
|
705
|
-
var columnsTrack = isControlled ? columnValues : columnState;
|
|
706
|
-
var setRowsTrack = React.useCallback(function (values) {
|
|
494
|
+
const PaneProvider = _ref2 => {
|
|
495
|
+
let {
|
|
496
|
+
id,
|
|
497
|
+
totalPanesWidth,
|
|
498
|
+
totalPanesHeight,
|
|
499
|
+
defaultRowValues,
|
|
500
|
+
defaultColumnValues,
|
|
501
|
+
rowValues,
|
|
502
|
+
columnValues,
|
|
503
|
+
onChange,
|
|
504
|
+
children
|
|
505
|
+
} = _ref2;
|
|
506
|
+
const isControlled = rowValues !== undefined && rowValues !== null && columnValues !== undefined && columnValues !== null;
|
|
507
|
+
const [rowState, setRowState] = React.useState(defaultRowValues || {});
|
|
508
|
+
const [columnState, setColumnState] = React.useState(defaultColumnValues || {});
|
|
509
|
+
const rowsTrack = isControlled ? rowValues : rowState;
|
|
510
|
+
const columnsTrack = isControlled ? columnValues : columnState;
|
|
511
|
+
const setRowsTrack = React.useCallback(values => {
|
|
707
512
|
if (isControlled && onChange) {
|
|
708
513
|
return onChange(values(rowsTrack), columnsTrack);
|
|
709
514
|
}
|
|
710
515
|
return setRowState(values);
|
|
711
516
|
}, [isControlled, onChange, setRowState, columnsTrack, rowsTrack]);
|
|
712
|
-
|
|
517
|
+
const setColumnsTrack = React.useCallback(values => {
|
|
713
518
|
if (isControlled && onChange) {
|
|
714
519
|
return onChange(rowsTrack, values(columnsTrack));
|
|
715
520
|
}
|
|
716
521
|
return setColumnState(values);
|
|
717
522
|
}, [isControlled, onChange, setColumnState, rowsTrack, columnsTrack]);
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
var layoutStateInPixels = React.useMemo(function () {
|
|
735
|
-
return {
|
|
736
|
-
rows: convertToPixels(rowsTrack, pixelsPerFr.rows),
|
|
737
|
-
columns: convertToPixels(columnsTrack, pixelsPerFr.columns)
|
|
738
|
-
};
|
|
739
|
-
}, [rowsTrack, columnsTrack, pixelsPerFr]);
|
|
740
|
-
var layoutIndices = React.useMemo(function () {
|
|
741
|
-
var rowArray = Object.keys(rowsTrack);
|
|
742
|
-
var columnArray = Object.keys(columnsTrack);
|
|
743
|
-
var rows = rowArray.reduce(function (prev, key, index) {
|
|
523
|
+
const totalFractions = React.useMemo(() => ({
|
|
524
|
+
rows: Object.values(rowsTrack).reduce((prev, value) => value + prev, 0),
|
|
525
|
+
columns: Object.values(columnsTrack).reduce((prev, value) => value + prev, 0)
|
|
526
|
+
}), [rowsTrack, columnsTrack]);
|
|
527
|
+
const pixelsPerFr = React.useMemo(() => ({
|
|
528
|
+
rows: getPixelsPerFr(totalFractions.rows, totalPanesHeight),
|
|
529
|
+
columns: getPixelsPerFr(totalFractions.columns, totalPanesWidth)
|
|
530
|
+
}), [totalFractions, totalPanesHeight, totalPanesWidth]);
|
|
531
|
+
const layoutStateInPixels = React.useMemo(() => ({
|
|
532
|
+
rows: convertToPixels(rowsTrack, pixelsPerFr.rows),
|
|
533
|
+
columns: convertToPixels(columnsTrack, pixelsPerFr.columns)
|
|
534
|
+
}), [rowsTrack, columnsTrack, pixelsPerFr]);
|
|
535
|
+
const layoutIndices = React.useMemo(() => {
|
|
536
|
+
const rowArray = Object.keys(rowsTrack);
|
|
537
|
+
const columnArray = Object.keys(columnsTrack);
|
|
538
|
+
const rows = rowArray.reduce((prev, key, index) => {
|
|
744
539
|
prev[key] = index;
|
|
745
540
|
return prev;
|
|
746
541
|
}, {});
|
|
747
|
-
|
|
542
|
+
const columns = columnArray.reduce((prev, key, index) => {
|
|
748
543
|
prev[key] = index;
|
|
749
544
|
return prev;
|
|
750
545
|
}, {});
|
|
751
546
|
return {
|
|
752
|
-
rows
|
|
753
|
-
columns
|
|
754
|
-
rowArray
|
|
755
|
-
columnArray
|
|
547
|
+
rows,
|
|
548
|
+
columns,
|
|
549
|
+
rowArray,
|
|
550
|
+
columnArray
|
|
756
551
|
};
|
|
757
552
|
}, [rowsTrack, columnsTrack]);
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
553
|
+
const setRowValue = React.useCallback((isTop, splitterId, value) => {
|
|
554
|
+
const {
|
|
555
|
+
rows,
|
|
556
|
+
rowArray
|
|
557
|
+
} = layoutIndices;
|
|
558
|
+
const stealFromTraversal = isTop ? -1 : 1;
|
|
559
|
+
const addToTraversal = 0;
|
|
560
|
+
setRowsTrack(state => {
|
|
561
|
+
const oldValue = rowsTrack[splitterId];
|
|
562
|
+
const stealFromIndex = rows[splitterId] + stealFromTraversal;
|
|
563
|
+
const addToIndex = rows[splitterId] + addToTraversal;
|
|
564
|
+
const stealFromKey = rowArray[stealFromIndex];
|
|
565
|
+
const addToKey = rowArray[addToIndex];
|
|
566
|
+
const difference = oldValue - value;
|
|
567
|
+
const nextState = {
|
|
568
|
+
...state
|
|
569
|
+
};
|
|
771
570
|
nextState[addToKey] = rowsTrack[addToKey] - difference;
|
|
772
571
|
nextState[stealFromKey] = rowsTrack[stealFromKey] + difference;
|
|
773
572
|
return nextState;
|
|
774
573
|
});
|
|
775
574
|
}, [layoutIndices, rowsTrack, setRowsTrack]);
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
575
|
+
const setColumnValue = React.useCallback((isStart, splitterId, value) => {
|
|
576
|
+
const {
|
|
577
|
+
columns,
|
|
578
|
+
columnArray
|
|
579
|
+
} = layoutIndices;
|
|
580
|
+
const stealFromTraversal = isStart ? -1 : 1;
|
|
581
|
+
const addToTraversal = 0;
|
|
582
|
+
setColumnsTrack(state => {
|
|
583
|
+
const stealFromIndex = columns[splitterId] + stealFromTraversal;
|
|
584
|
+
const addToIndex = columns[splitterId] + addToTraversal;
|
|
585
|
+
const oldValue = columnsTrack[splitterId];
|
|
586
|
+
const stealFromKey = columnArray[stealFromIndex];
|
|
587
|
+
const addToKey = columnArray[addToIndex];
|
|
588
|
+
const difference = oldValue - value;
|
|
589
|
+
const nextState = {
|
|
590
|
+
...state
|
|
591
|
+
};
|
|
789
592
|
nextState[addToKey] = columnsTrack[addToKey] - difference;
|
|
790
593
|
nextState[stealFromKey] = columnsTrack[stealFromKey] + difference;
|
|
791
594
|
return nextState;
|
|
792
595
|
});
|
|
793
596
|
}, [layoutIndices, columnsTrack, setColumnsTrack]);
|
|
794
|
-
|
|
597
|
+
const getColumnValue = React.useCallback((splitterKey, isPixels) => {
|
|
795
598
|
if (isPixels) {
|
|
796
599
|
return layoutStateInPixels.columns[splitterKey];
|
|
797
600
|
}
|
|
798
601
|
return columnsTrack[splitterKey];
|
|
799
602
|
}, [columnsTrack, layoutStateInPixels]);
|
|
800
|
-
|
|
603
|
+
const getRowValue = React.useCallback((splitterKey, isPixels) => {
|
|
801
604
|
if (isPixels) {
|
|
802
605
|
return layoutStateInPixels.rows[splitterKey];
|
|
803
606
|
}
|
|
804
607
|
return rowsTrack[splitterKey];
|
|
805
608
|
}, [rowsTrack, layoutStateInPixels]);
|
|
806
|
-
|
|
807
|
-
|
|
609
|
+
const getGridTemplateColumns = React.useCallback(isPixels => {
|
|
610
|
+
const {
|
|
611
|
+
columnArray
|
|
612
|
+
} = layoutIndices;
|
|
808
613
|
if (isPixels) {
|
|
809
|
-
return columnArray.map(
|
|
810
|
-
return "".concat(layoutStateInPixels.columns[col], "px");
|
|
811
|
-
}).join(' ');
|
|
614
|
+
return columnArray.map(col => `${layoutStateInPixels.columns[col]}px`).join(' ');
|
|
812
615
|
}
|
|
813
|
-
return columnArray.map(
|
|
814
|
-
return "".concat(columnsTrack[col], "fr");
|
|
815
|
-
}).join(' ');
|
|
616
|
+
return columnArray.map(col => `${columnsTrack[col]}fr`).join(' ');
|
|
816
617
|
}, [layoutIndices, columnsTrack, layoutStateInPixels]);
|
|
817
|
-
|
|
818
|
-
|
|
618
|
+
const getGridTemplateRows = React.useCallback(isPixels => {
|
|
619
|
+
const {
|
|
620
|
+
rowArray
|
|
621
|
+
} = layoutIndices;
|
|
819
622
|
if (isPixels) {
|
|
820
|
-
return rowArray.map(
|
|
821
|
-
return "".concat(layoutStateInPixels.rows[row], "px");
|
|
822
|
-
}).join(' ');
|
|
623
|
+
return rowArray.map(row => `${layoutStateInPixels.rows[row]}px`).join(' ');
|
|
823
624
|
}
|
|
824
|
-
return rowArray.map(
|
|
825
|
-
return "".concat(rowsTrack[row], "fr");
|
|
826
|
-
}).join(' ');
|
|
625
|
+
return rowArray.map(row => `${rowsTrack[row]}fr`).join(' ');
|
|
827
626
|
}, [layoutIndices, rowsTrack, layoutStateInPixels]);
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
627
|
+
const providerId = containerUtilities.useId(id);
|
|
628
|
+
const parentPaneProviderContext = usePaneProviderContext();
|
|
629
|
+
const paneProviderContext = React.useMemo(() => providerId ? {
|
|
630
|
+
providerId,
|
|
631
|
+
contextData: {
|
|
632
|
+
...parentPaneProviderContext.contextData,
|
|
633
|
+
[providerId]: {
|
|
634
|
+
columnState,
|
|
635
|
+
rowState,
|
|
636
|
+
setRowValue,
|
|
637
|
+
setColumnValue,
|
|
638
|
+
getRowValue,
|
|
639
|
+
getColumnValue,
|
|
640
|
+
totalPanesHeight,
|
|
641
|
+
totalPanesWidth,
|
|
642
|
+
pixelsPerFr
|
|
643
|
+
}
|
|
644
|
+
}
|
|
645
|
+
} : {}, [providerId, parentPaneProviderContext, rowState, columnState, setRowValue, setColumnValue, getRowValue, getColumnValue, totalPanesHeight, totalPanesWidth, pixelsPerFr]);
|
|
846
646
|
return React__default["default"].createElement(PaneProviderContext.Provider, {
|
|
847
647
|
value: paneProviderContext
|
|
848
648
|
}, children === null || children === void 0 ? void 0 : children({
|
|
849
649
|
id: providerId,
|
|
850
|
-
getRowValue
|
|
851
|
-
getColumnValue
|
|
852
|
-
getGridTemplateColumns
|
|
853
|
-
getGridTemplateRows
|
|
650
|
+
getRowValue,
|
|
651
|
+
getColumnValue,
|
|
652
|
+
getGridTemplateColumns,
|
|
653
|
+
getGridTemplateRows
|
|
854
654
|
}));
|
|
855
655
|
};
|
|
856
656
|
PaneProvider.displayName = 'PaneProvider';
|
|
@@ -866,16 +666,14 @@ PaneProvider.propTypes = {
|
|
|
866
666
|
children: PropTypes__default["default"].func
|
|
867
667
|
};
|
|
868
668
|
|
|
869
|
-
|
|
870
|
-
setId:
|
|
871
|
-
return undefined;
|
|
872
|
-
}
|
|
669
|
+
const PaneContext = React.createContext({
|
|
670
|
+
setId: () => undefined
|
|
873
671
|
});
|
|
874
|
-
|
|
672
|
+
const usePaneContext = () => {
|
|
875
673
|
return React.useContext(PaneContext);
|
|
876
674
|
};
|
|
877
675
|
|
|
878
|
-
|
|
676
|
+
const PaneSplitterContext = React.createContext({
|
|
879
677
|
orientation: 'start',
|
|
880
678
|
min: 0,
|
|
881
679
|
max: 0,
|
|
@@ -884,91 +682,92 @@ var PaneSplitterContext = React.createContext({
|
|
|
884
682
|
size: 0,
|
|
885
683
|
isRow: false
|
|
886
684
|
});
|
|
887
|
-
|
|
685
|
+
const usePaneSplitterContext = () => {
|
|
888
686
|
return React.useContext(PaneSplitterContext);
|
|
889
687
|
};
|
|
890
688
|
|
|
891
|
-
|
|
892
|
-
var paneToSplitterOrientation = {
|
|
689
|
+
const paneToSplitterOrientation = {
|
|
893
690
|
start: 'vertical',
|
|
894
691
|
end: 'vertical',
|
|
895
692
|
top: 'horizontal',
|
|
896
693
|
bottom: 'horizontal'
|
|
897
694
|
};
|
|
898
|
-
|
|
695
|
+
const orientationToDimension = {
|
|
899
696
|
start: 'columns',
|
|
900
697
|
end: 'columns',
|
|
901
698
|
top: 'rows',
|
|
902
699
|
bottom: 'rows'
|
|
903
700
|
};
|
|
904
|
-
|
|
701
|
+
const SplitterComponent = React.forwardRef((_ref, ref) => {
|
|
905
702
|
var _separatorRef$current, _separatorRef$current2;
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
703
|
+
let {
|
|
704
|
+
providerId,
|
|
705
|
+
layoutKey,
|
|
706
|
+
min,
|
|
707
|
+
max,
|
|
708
|
+
orientation,
|
|
709
|
+
onMouseDown,
|
|
710
|
+
onTouchStart,
|
|
711
|
+
onKeyDown,
|
|
712
|
+
onClick,
|
|
713
|
+
...props
|
|
714
|
+
} = _ref;
|
|
715
|
+
const paneProviderContext = usePaneProviderContextData(providerId);
|
|
716
|
+
const paneContext = usePaneContext();
|
|
717
|
+
const themeContext = React.useContext(styled.ThemeContext);
|
|
718
|
+
const environment = reactTheming.useDocument(themeContext);
|
|
719
|
+
const [isHovered, setIsHovered] = React.useState(false);
|
|
720
|
+
const isRow = orientationToDimension[orientation] === 'rows';
|
|
721
|
+
const separatorRef = React.useRef(null);
|
|
722
|
+
const splitterOrientation = paneToSplitterOrientation[orientation || 'end'];
|
|
723
|
+
const pixelsPerFr = paneProviderContext ? paneProviderContext.pixelsPerFr[orientationToDimension[orientation]] : 0;
|
|
724
|
+
const value = isRow ? paneProviderContext === null || paneProviderContext === void 0 ? void 0 : paneProviderContext.getRowValue(layoutKey, true) : paneProviderContext === null || paneProviderContext === void 0 ? void 0 : paneProviderContext.getColumnValue(layoutKey, true);
|
|
725
|
+
const valueInFr = isRow ? paneProviderContext === null || paneProviderContext === void 0 ? void 0 : paneProviderContext.getRowValue(layoutKey) : paneProviderContext === null || paneProviderContext === void 0 ? void 0 : paneProviderContext.getColumnValue(layoutKey);
|
|
726
|
+
const {
|
|
727
|
+
getSeparatorProps,
|
|
728
|
+
getPrimaryPaneProps
|
|
729
|
+
} = containerSplitter.useSplitter({
|
|
927
730
|
orientation: splitterOrientation,
|
|
928
731
|
isLeading: orientation === 'start' || orientation === 'top',
|
|
929
732
|
min: min * pixelsPerFr,
|
|
930
733
|
max: max * pixelsPerFr,
|
|
931
734
|
rtl: themeContext.rtl,
|
|
932
|
-
environment
|
|
933
|
-
onChange:
|
|
735
|
+
environment,
|
|
736
|
+
onChange: valueNow => {
|
|
934
737
|
if (isRow) {
|
|
935
738
|
return paneProviderContext === null || paneProviderContext === void 0 ? void 0 : paneProviderContext.setRowValue(orientation === 'top', layoutKey, valueNow / pixelsPerFr);
|
|
936
739
|
}
|
|
937
740
|
return paneProviderContext === null || paneProviderContext === void 0 ? void 0 : paneProviderContext.setColumnValue(orientation === 'start', layoutKey, valueNow / pixelsPerFr);
|
|
938
741
|
},
|
|
939
742
|
valueNow: value,
|
|
940
|
-
separatorRef
|
|
941
|
-
})
|
|
942
|
-
|
|
943
|
-
getPrimaryPaneProps = _useSplitter.getPrimaryPaneProps;
|
|
944
|
-
React.useEffect(function () {
|
|
743
|
+
separatorRef
|
|
744
|
+
});
|
|
745
|
+
React.useEffect(() => {
|
|
945
746
|
if (!paneContext.id) {
|
|
946
747
|
paneContext.setId(getPrimaryPaneProps().id);
|
|
947
748
|
}
|
|
948
749
|
}, [paneContext, getPrimaryPaneProps]);
|
|
949
|
-
|
|
950
|
-
|
|
750
|
+
const ariaLabel = reactTheming.useText(SplitterComponent, props, 'aria-label', `${splitterOrientation} splitter`);
|
|
751
|
+
const separatorProps = getSeparatorProps({
|
|
951
752
|
'aria-controls': paneContext.id,
|
|
952
|
-
'aria-label': ariaLabel
|
|
753
|
+
'aria-label': ariaLabel,
|
|
754
|
+
onMouseDown,
|
|
755
|
+
onTouchStart,
|
|
756
|
+
onKeyDown,
|
|
757
|
+
onClick
|
|
953
758
|
});
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
return containerUtilities.composeEventHandlers(props.onMouseOver, function (event) {
|
|
957
|
-
return setIsHovered(event.target === separatorRef.current);
|
|
958
|
-
});
|
|
959
|
-
}, [props.onMouseOver, separatorRef]);
|
|
759
|
+
const size = isRow ? (_separatorRef$current = separatorRef.current) === null || _separatorRef$current === void 0 ? void 0 : _separatorRef$current.clientWidth : (_separatorRef$current2 = separatorRef.current) === null || _separatorRef$current2 === void 0 ? void 0 : _separatorRef$current2.clientHeight;
|
|
760
|
+
const onMouseOver = React.useMemo(() => containerUtilities.composeEventHandlers(props.onMouseOver, event => setIsHovered(event.target === separatorRef.current)), [props.onMouseOver, separatorRef]);
|
|
960
761
|
return React__default["default"].createElement(PaneSplitterContext.Provider, {
|
|
961
|
-
value: React.useMemo(
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
};
|
|
971
|
-
}, [orientation, layoutKey, min, max, valueInFr, size, isRow])
|
|
762
|
+
value: React.useMemo(() => ({
|
|
763
|
+
orientation,
|
|
764
|
+
layoutKey,
|
|
765
|
+
min,
|
|
766
|
+
max,
|
|
767
|
+
valueNow: valueInFr,
|
|
768
|
+
size,
|
|
769
|
+
isRow
|
|
770
|
+
}), [orientation, layoutKey, min, max, valueInFr, size, isRow])
|
|
972
771
|
}, React__default["default"].createElement(StyledPaneSplitter, _extends({
|
|
973
772
|
isHovered: isHovered,
|
|
974
773
|
orientation: orientation
|
|
@@ -987,33 +786,36 @@ SplitterComponent.propTypes = {
|
|
|
987
786
|
SplitterComponent.defaultProps = {
|
|
988
787
|
orientation: 'end'
|
|
989
788
|
};
|
|
990
|
-
|
|
789
|
+
const Splitter = SplitterComponent;
|
|
991
790
|
|
|
992
|
-
|
|
791
|
+
const ContentComponent = React.forwardRef((props, ref) => {
|
|
993
792
|
return React__default["default"].createElement(StyledPaneContent, _extends({
|
|
994
793
|
ref: ref
|
|
995
794
|
}, props));
|
|
996
795
|
});
|
|
997
796
|
ContentComponent.displayName = 'Pane.Content';
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
797
|
+
const Content = ContentComponent;
|
|
798
|
+
|
|
799
|
+
const SplitterButtonComponent = React.forwardRef((props, ref) => {
|
|
800
|
+
const {
|
|
801
|
+
label,
|
|
802
|
+
placement: defaultPlacement
|
|
803
|
+
} = props;
|
|
804
|
+
const {
|
|
805
|
+
orientation,
|
|
806
|
+
layoutKey,
|
|
807
|
+
min,
|
|
808
|
+
max,
|
|
809
|
+
isRow,
|
|
810
|
+
valueNow,
|
|
811
|
+
size,
|
|
812
|
+
providerId
|
|
813
|
+
} = usePaneSplitterContext();
|
|
814
|
+
const paneProviderContext = usePaneProviderContextData(providerId);
|
|
815
|
+
const isTop = orientation === 'top';
|
|
816
|
+
const isStart = orientation === 'start';
|
|
817
|
+
const isMin = valueNow === min;
|
|
818
|
+
let placement = defaultPlacement;
|
|
1017
819
|
if (!defaultPlacement) {
|
|
1018
820
|
if (isRow) {
|
|
1019
821
|
placement = 'center';
|
|
@@ -1021,36 +823,30 @@ var SplitterButtonComponent = React.forwardRef(function (props, ref) {
|
|
|
1021
823
|
placement = 'start';
|
|
1022
824
|
}
|
|
1023
825
|
}
|
|
1024
|
-
|
|
826
|
+
const setValue = React.useCallback(value => {
|
|
1025
827
|
if (isRow) {
|
|
1026
828
|
paneProviderContext.setRowValue(isTop, layoutKey, value);
|
|
1027
829
|
} else {
|
|
1028
830
|
paneProviderContext.setColumnValue(isStart, layoutKey, value);
|
|
1029
831
|
}
|
|
1030
832
|
}, [isRow, isTop, isStart, layoutKey, paneProviderContext]);
|
|
1031
|
-
|
|
833
|
+
const onClick = containerUtilities.composeEventHandlers(props.onClick, () => {
|
|
1032
834
|
if (isMin) {
|
|
1033
835
|
setValue(max);
|
|
1034
836
|
} else {
|
|
1035
837
|
setValue(min);
|
|
1036
838
|
}
|
|
1037
839
|
});
|
|
1038
|
-
|
|
1039
|
-
return event.stopPropagation();
|
|
1040
|
-
}
|
|
840
|
+
const onKeyDown = containerUtilities.composeEventHandlers(props.onKeyDown, event => event.stopPropagation()
|
|
1041
841
|
);
|
|
1042
|
-
|
|
1043
|
-
return event.stopPropagation();
|
|
1044
|
-
}
|
|
842
|
+
const onMouseDown = containerUtilities.composeEventHandlers(props.onMouseDown, event => event.stopPropagation()
|
|
1045
843
|
);
|
|
1046
844
|
return React__default["default"].createElement(reactTooltips.Tooltip, {
|
|
1047
845
|
content: label,
|
|
1048
846
|
style: {
|
|
1049
847
|
cursor: 'default'
|
|
1050
848
|
},
|
|
1051
|
-
onMouseDown:
|
|
1052
|
-
return e.stopPropagation();
|
|
1053
|
-
}
|
|
849
|
+
onMouseDown: e => e.stopPropagation()
|
|
1054
850
|
}, React__default["default"].createElement(StyledPaneSplitterButton, _extends({
|
|
1055
851
|
"aria-label": label
|
|
1056
852
|
}, props, {
|
|
@@ -1065,24 +861,18 @@ var SplitterButtonComponent = React.forwardRef(function (props, ref) {
|
|
|
1065
861
|
})));
|
|
1066
862
|
});
|
|
1067
863
|
SplitterButtonComponent.displayName = 'Pane.SplitterButton';
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
id: paneId,
|
|
1081
|
-
setId: function setId(id) {
|
|
1082
|
-
return setPaneId(id);
|
|
1083
|
-
}
|
|
1084
|
-
};
|
|
1085
|
-
}, [paneId]);
|
|
864
|
+
const SplitterButton = SplitterButtonComponent;
|
|
865
|
+
|
|
866
|
+
const PaneComponent = React.forwardRef((_ref, ref) => {
|
|
867
|
+
let {
|
|
868
|
+
children,
|
|
869
|
+
...props
|
|
870
|
+
} = _ref;
|
|
871
|
+
const [paneId, setPaneId] = React.useState();
|
|
872
|
+
const paneContext = React.useMemo(() => ({
|
|
873
|
+
id: paneId,
|
|
874
|
+
setId: id => setPaneId(id)
|
|
875
|
+
}), [paneId]);
|
|
1086
876
|
return React__default["default"].createElement(PaneContext.Provider, {
|
|
1087
877
|
value: paneContext
|
|
1088
878
|
}, React__default["default"].createElement(StyledPane, _extends({
|
|
@@ -1091,7 +881,7 @@ var PaneComponent = React.forwardRef(function (_ref, ref) {
|
|
|
1091
881
|
}, props), children));
|
|
1092
882
|
});
|
|
1093
883
|
PaneComponent.displayName = 'Pane';
|
|
1094
|
-
|
|
884
|
+
const Pane = PaneComponent;
|
|
1095
885
|
Pane.Content = Content;
|
|
1096
886
|
Pane.Splitter = Splitter;
|
|
1097
887
|
Pane.SplitterButton = SplitterButton;
|